diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index eaf4170..0000000 --- a/.drone.yml +++ /dev/null @@ -1,38 +0,0 @@ -kind: pipeline -name: default - -steps: - - name: Build Bullseye - image: debian:bullseye - volumes: - - name: finished_files - path: /deb_files - commands: - - apt update - - apt -y upgrade - - apt -y install --no-install-recommends build-essential equivs devscripts git rename - - git clean -f -d -x - - mk-build-deps --install --tool='apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes' debian/control - - dpkg-buildpackage -b -uc - - rename 's/\.deb/_bullseye\.deb/' ../*.deb - - mkdir -p /deb_files/bullseye/ - - cp ../*.deb /deb_files/bullseye/ - - find /deb_files/ - - - name: gitea_release - image: plugins/gitea-release - volumes: - - name: finished_files - path: /deb_files - settings: - api_key: - from_secret: GITEA_KEY - base_url: https://git.neulandlabor.de/ - files: - - /deb_files/bullseye/* - when: - event: tag - -volumes: - - name: finished_files - temp: {} diff --git a/AUTHORS b/AUTHORS index c179b0c..320efbe 100644 --- a/AUTHORS +++ b/AUTHORS @@ -170,7 +170,3 @@ D: pwmib support for snmp-ups N: Kjell Claesson E: Kjell.claesson@epost.tidanet.se D: Author of bcmxcp driver, 3-phase work. - -N: Giuseppe Corbelli -E: giuseppe.corbelli@copanitalia.com -D: Author of asem driver diff --git a/ChangeLog b/ChangeLog index 669274b..7188f00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,18550 +1,3 @@ -2022-04-04 Jim Klimov - - * configure.ac: configure.ac: cut the release of NUT v2.8.0 - * clients/Makefile.am, tools/nut-scanner/Makefile.am: tools/nut- - scanner/Makefile.am, clients/Makefile.am: bump "version-info" for - NUT v2.8.0 Development since 2.7.4 release included changes to - code structure, fought warnings, and might impact ABI/API by the - changes to arguments (specific integer types and size_t vs. - architecture-dependent choice). - -2022-04-26 Jim Klimov - - * docs/nut.dict: docs/nut.dict: update dict - * docs/download.txt: docs/download.txt: link to distro packaging wiki - page on NUT github - * docs/download.txt: docs/download.txt: update links to distro - packaging recipes and their results - * docs/download.txt: docs/download.txt: deprecate buildbot tarballs - * drivers/libusb0.c, drivers/libusb1.c: drivers/libusb{0,1}.c: report - why we could not open any HID devices Closes: #477 - -2022-04-23 Jim Klimov - - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 750T/HID (USB) Closes: #774 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 2200 SH and 650 SHL (USB) Closes: #646 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 2200 SHL (USB) Closes: #756 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 650 SH (USB) Closes: #473 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - Basic VI 1000 SB (USB) Closes: #818 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 3000 SCL (USB) Closes: #971 - * data/driver.list.in: driver.list.in: Add HCL info for PowerWalker - VI 1200 SHL (USB) Closes: #1270 - * data/driver.list.in: driver.list.in: Add HCL info for UPS Phasak - model 9465, renamed as P6N (USB) Closes: #1187 - * data/driver.list.in: driver.list.in: Add HCL info for Online-UPS - Xanto S700 [#1279] - * data/driver.list.in: driver.list.in: Add HCL info for Santak - MT*-PRO / Castle C*K (Serial) Closes: #1039 - * data/driver.list.in: driver.list.in: Add HCL info for Digitus - DN-170040, DN-170041, and Voltronic Power GalleonX9-RT LCD-1-3K - (USB) Closes: #1251 - * data/driver.list.in: driver.list.in: Add HCL info for Kebo - UPS-650VA (USB) from DDL - * data/driver.list.in: driver.list.in: Add HCL info for Kebo - UPS-1000D (USB) Closes: #981 - * data/driver.list.in: driver.list.in: Add HCL info for Aviem Pro - 2000VA (USB) Closes: #827 - * data/driver.list.in: driver.list.in: Add HCL info for Digitus - DN-170076 (USB) Closes: #948 - * data/driver.list.in: driver.list.in: Add HCL info for Ippon Back - Basic 850 Euro (USB) Closes: #802 - * data/driver.list.in: driver.list.in: Add HCL info for Energy - Technologies DPK1/1-3 (Serial) Closes: #762 - * data/driver.list.in: driver.list.in: Add HCL info for V7 - UPS1RM2U1500-1E UPS 1500VA Rack Mount 2U (USB) Closes: #716 - * data/driver.list.in: driver.list.in: Add HCL info for Advice PRS850 - and PRV700 Pro (USB) from DDL - * data/driver.list.in: driver.list.in: Add HCL info for Advice Top V - Pro 6-10K (USB) Closes: #744 - * data/driver.list.in: driver.list.in: Add HCL info for Tecnoware UPS - ERA PLUS 1100 (USB) Closes: #747 - * data/driver.list.in: driver.list.in: Add HCL info for Elsist UPS - Nemo2.0 160 (USB) Closes: #719 - * data/driver.list.in: driver.list.in: Add HCL info for Powercom - Raptor 2000 and RPT-600AP (USB) Closes: #633 - * data/driver.list.in: driver.list.in: Add HCL info for Eaton 9PX - 2000 RT (USB) Closes: #540 - * data/driver.list.in: driver.list.in: Add HCL info for Salicru SPS - ONE (USB) Closes: #554 - * data/driver.list.in: driver.list.in: Add HCL info for APC - SMC2200BI-BR (USB) Closes: #557 - * data/driver.list.in: driver.list.in: Update comment for APC Back- - UPS Pro 1000, Model BX1000M (USB) [nut#139] - * data/driver.list.in: driver.list.in: Add HCL info for Liebert - PowerSure PSA 500 series (USB) Closes: #601 - * docs/man/usbhid-ups.txt: docs/man/usbhid-ups.txt: document some - caveats with CyberPower UPSes [issues #520, #1394] - * data/driver.list.in: driver.list.in: Update for CyberPower Systems - OR1500ERM1U [#1338] - * data/driver.list.in: driver.list.in: Update comment for CyberPower - Systems PR1500RT2U [#1191] - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems CP850PFCLCD (USB) Closes: #605 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems BL1250U (USB) Closes: #1012 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems RT650EI (USB) Closes: #453 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems CP1500PFCLCD (USB) Closes: #520 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems BR1000ELCD (USB) Closes: #552 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems UT2200E (USB) Closes: #556 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems OR500LCDRM1U (USB) Closes: #578 - * data/driver.list.in: driver.list.in: Add HCL info for CyberPower - Systems EC850LCD (USB) Closes: #622 - * data/driver.list.in: driver.list.in: Add HCL info for Guardian LCD - 1500 AP (IGA1500LCD) (Serial) Closes: #449 - * data/driver.list.in: driver.list.in: Add HCL info for Ablerex MARS - MS3000RT (Serial) Closes: #449 - * data/driver.list.in: driver.list.in: Add HCL info for APC AP9584 - Serial-to-USB kit Closes: #181 - * data/driver.list.in: driver.list.in: Update comment for Tripp_Lite - SMX500RT1U (USB) [#584] - * data/driver.list.in: driver.list.in: Add HCL info for Huawei - UPS2000 series (modbus) [#954 #1066 #1198 #1017] - * data/driver.list.in: driver.list.in: Add HCL info for DEXP MIX - 850VA (USB) Closes: #721 - * data/driver.list.in: driver.list.in: Add HCL info for CPC, ARES and - Powercool models with hunnox protocol (USB) Closes: #537 - * data/driver.list.in: driver.list.in: Add HCL info for Greencell - Micropower 600 (USB) Closes: #1080 - * data/driver.list.in: driver.list.in: Add HCL info for Crown CMU- - SP1200IEC (USB) Closes: #1014 - * data/driver.list.in: driver.list.in: Add HCL info for DigiTECH - 650VA (USB) Closes: #674 - * data/driver.list.in: driver.list.in: Add HCL info for Hunnox - devices (and new protocol subdriver) (USB) [#638] - * data/driver.list.in: driver.list.in: Add HCL info for nJoy Aten PRO - 3000 (SNMP) Closes: #1281 - -2022-04-25 Jim Klimov - - * docs/nut.dict: docs/nut.dict: add wc - * docs/nut.dict: docs/nut.dict: add uniq - -2022-04-25 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add a - CI_BUILDDIR=obj into docs scenario; name "out-of-tree builds" as - such - -2022-04-24 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: run some tests with - CI_BUILDDIR - * .gitignore, ci_build.sh: ci_build.sh: prepare for CI_BUILDDIR=obj - * ci_build.sh: ci_build.sh: introduce CI_BUILDDIR to handle out-of- - tree builds other than distcheck - * docs/man/Makefile.am, docs/man/index.txt, docs/man/nutupsdrv.txt, - docs/man/upsd.txt, docs/nut.dict: docs/man/nutupsdrv.txt + - index.txt + upsd.txt: use {builddir}/linkman-*.txt for included - data - * docs/man/Makefile.am: docs/man/Makefile.am: refactor - LINKMAN_INCLUDE_CONSUMERS - * docs/man/Makefile.am: docs/man/Makefile.am: introduce A2X_VERBOSE - * docs/nut-qa.txt, docs/nut.dict: docs/nut-qa.txt: mention "make - check-NIT-devel" helper target - * docs/man/victronups.txt: docs/man/victronups.txt: update link to - cable pinout Closes: #1371 - * configure.ac: configure.ac: fix enableval vs withval - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, - drivers/tripplite_usb.c, drivers/usb-common.c, drivers/usb- - common.h, drivers/usbhid-ups.c: drivers/usb-common.{h,c} and USB- - capable drivers: introduce warn_if_bad_usb_port_filename() Closes: - #1368 - * ci_build.sh: ci_build.sh: disable check-NIT by default in CI runs - for now - -2022-04-23 Jim Klimov - - * drivers/main.c: drivers/main.c: simplify detection of PROGNAME="lt- - DRIVERNAME" making it more reliable for some platforms - -2022-04-18 Jim Klimov - - * drivers/cyberpower-mib.c: drivers/cyberpower-mib.c: update - cyberpower_power_status[] with new values [#1377] - -2022-04-23 Jim Klimov - - * data/driver.list.in: Update driver.list.in - -2022-04-23 Jim Klimov - - * configure.ac: configure.ac: fix nut_enable_check_NIT - * ci_build.sh: ci_build.sh: "--enable-check-NIT" and "--enable- - maintainer-mode" for developer builds without a BUILD_TYPE - * ci_build.sh: ci_build.sh: "--enable-check-NIT" for CI builds - * tests/NIT/nit.sh: tests/NIT/nit.sh: fix renaming typo - * tests/NIT/nit.sh: tests/NIT/nit.sh: remove mktemp-ed TESTDIR when - we exit - * tests/NIT/nit.sh: tests/NIT/nit.sh: refactor with TESTDIR - * clients/upssched.c, common/common.c, drivers/clone-outlet.c, - drivers/clone.c, drivers/dstate.c, include/common.h, - server/sockdebug.c, server/sstate.c: check_unix_socket_filename() - to meaningfully abort when our paths are too long - * docs/man/clone.txt, docs/man/dummy-ups.txt: docs/man/clone.txt + - dummy-ups.txt: clarify the dependency caveats Clone drivers do not - require to run after upsd, but may need to start after the "real" - driver whose socket thay leech onto. - * tests/NIT/nit.sh: tests/NIT/nit.sh: limit how long we wait for - UPS1/UPS2 to begin responding - * configure.ac, docs/configure.txt, docs/nut-qa.txt, - tests/NIT/Makefile.am: tests/NIT/Makefile.am + configure.ac: - introduce --enable-check-NIT - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: re-wrap long lines - and reword - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: highlight that - upsrw can not define new variables - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: update notes for - dummy-once mode ability to re-read file only if it changes - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: update notes for - dummy-once mode - * docs/man/clone.txt, docs/man/dummy-ups.txt: docs/man/dummy-ups.txt - + clone.txt: cross-link two man pages to remind about similar use- - cases - -2022-04-23 Jim Klimov - - * data/driver.list.in: driver.list.in: Add HCL info for nJoy Keen 600 - (USB) Closes: #867 - -2022-04-22 Jim Klimov - - * tests/NIT/nit.sh: tests/NIT/nit.sh: - testcase_sandbox_upsc_query_timer(): do not waste time if we did - get the answer we want - * tests/NIT/nit.sh: tests/NIT/nit.sh: - testcase_sandbox_upsc_query_timer(): for slower testers out there, - wait one more cycle - * tests/NIT/nit.sh: tests/NIT/nit.sh: ignore message from NSS builds - Those tend to add lines like Init SSL without certificate database - so we should better grep for expected char sequence - -2022-04-22 Paweł Rapkiewicz - - * data/driver.list.in, drivers/ever-hid.c, scripts/upower/95-upower- - hid.hwdb: Confirm support for ECO Pro AVR CDS series EVER UPS This - commit confirms that EVER UPS line 'ECO Pro AVR CDS' is supported - by NUT, from nowon, nut-scanner will recognize EVER Ups as follows: - [nutdev1] driver = "usbhid-ups" port = "auto" vendorid = "2E51" - productid = "0000" product = "ECO PRO AVR CDS" serial = - "XXXXXXXXXXXXXXXXXXXXXXXXX" vendor = "EVER" bus = "003" - -2022-04-22 Jim Klimov - - * tests/NIT/nit.sh: tests/NIT/nit.sh: add - testgroup_sandbox_cppnit_simple_admin() to troubleshoot dummy-ups - data propagation - * tests/NIT/nit.sh: tests/NIT/nit.sh: - testcase_sandbox_start_drivers_after_upsd(): wait for UPS1 and UPS2 - to respond - * tests/cpputest-client.cpp: tests/cpputest-client.cpp: allow up to - 10 seconds for SET VAR to propagate into read-back value - * tests/.gitignore: GitIgnore tests/cppnit binary and logs - * docs/nut.dict: Update nut.dict - * tests/NIT/nit.sh: tests/NIT/nit.sh: refactor test cases into - smaller routines and groups, and allow to select NIT_CASE - optionally - * tests/NIT/nit.sh: tests/NIT/nit.sh: refactor stop_daemons() - * Makefile.am, tests/Makefile.am, tests/NIT/Makefile.am: - tests/NIT/Makefile.am: extend with check-NIT-devel for iterating - * drivers/dstate.c: drivers/dstate.c: log start of processing in - sock_arg() - * drivers/dstate.c: drivers/dstate.c: whitespace fix - * tests/NIT/nit.sh: tests/NIT/nit.sh: allow to tweak NUT_DEBUG_MIN - * tests/cpputest-client.cpp: tests/cpputest-client.cpp: trace values - read back after setting - * tests/cpputest-client.cpp: tests/cpputest-client.cpp: rename "s1" - original value reading - * scripts/python/Makefile.am: scripts/python/Makefile.am: clean *.pyc - and __pycache__/ if present - -2022-04-21 Jim Klimov - - * drivers/dummy-ups.c: drivers/dummy-ups.c: fix dummy-once mode for - relative path in port - * tests/NIT/nit.sh: tests/NIT/nit.sh: name the "dummy.seq" so it - loops by default - * drivers/main.c: drivers/main.c: better fix for handling of libtool- - named binaries - * tests/NIT/nit.sh: tests/NIT/nit.sh: if "Error: Driver not - connected" retry with UPSD started after drivers are running - * drivers/main.c: drivers/main.c: fix the handling of libtool-named - binaries - * tests/NIT/nit.sh: tests/NIT/nit.sh: "sed -i" requires an extension - (may be empty, in BSD must be a separate CLI token, in others must - be same token - not empty is ok for all) - * tests/NIT/nit.sh: tests/NIT/nit.sh: "sed -i" requires an extension - (may be empty, in BSD must be a separate CLI token) - * drivers/dummy-ups.c: drivers/dummy-ups.c: cover exhaustive - case(enum) with pragmas for diametral warnings - * tests/NIT/nit.sh: tests/NIT/nit.sh: extend with mode=... for dummy- - ups [#1385] - * NEWS, UPGRADING, docs/man/dummy-ups.txt, drivers/dummy-ups.c: - dummy-ups: do re-read a "dummy-once" file, though only if it - changes while the driver runs r the commit message for your - changes. Lines starting - * NEWS, UPGRADING, docs/man/dummy-ups.txt, drivers/dummy-ups.c: - dummy-ups: separate MODE_DUMMY_ONCE from MODE_DUMMY_LOOP Closes: - #1385 - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: small rewording - * drivers/dummy-ups.c: drivers/dummy-ups.c: refactor "mode" from - random defines to an enum - * common/str.c, include/str.h: include/str.h, common/str.c: add - str_ends_with() - * tests/NIT/nit.sh: tests/NIT/nit.sh: make sure ups.status is not - pre-defined empty in test sandbox - * tests/cpputest-client.cpp: tests/cpputest-client.cpp: - test_auth_user(): bail out if "ups.status" reply is empty - * tests/NIT/nit.sh: tests/NIT/nit.sh: report DEBUG_SLEEP mode more - usefully - * tests/NIT/nit.sh: tests/NIT/nit.sh: spell out 127.0.0.1 and ::1 if - detected supported on local system - do not rely on ping CLI alone - * tests/NIT/nit.sh: tests/NIT/nit.sh: spell out 127.0.0.1 and ::1 if - detected supported on local system - -2022-04-20 Jim Klimov - - * tests/NIT/nit.sh: tests/NIT/nit.sh: report issues more usefully for - troubleshooting CI - * tests/NIT/Makefile.am: tests/NIT/Makefile.am: use more portable - clumsier code - * drivers/main.c: drivers/main.c: accept "lt-PROGNAME" to run - libtool-wrapped builds during development - * tests/NIT/nit.sh: tests/NIT/nit.sh: Avoid dummies with TIMER flip- - flops for cppnit if we can - * tests/Makefile.am: tests/Makefile.am: do not run "cppnit" as part - of TESTS, only give a recipe to build it - * clients/nutclient.h, tests/Makefile.am, tests/NIT/nit.sh, - tests/cpputest-client.cpp: NutActiveClientTest: introduce C++ - NutActiveClientTest for NIT and similar uses - * tests/NIT/nit.sh: tests/NIT/nit.sh: log OVERALL results before - DEBUG_SLEEP - * tests/NIT/nit.sh: tests/NIT/nit.sh: refactor upsd.users passwords - as shell vars to ease reuse - * tests/NIT/nit.sh: tests/NIT/nit.sh: check that test_nutclient.py - was generated before running it; export NUT_PORT just once - * tests/NIT/nit.sh: tests/NIT/nit.sh: embed weak randomization of - NUT_PORT At least this little magic is better than a hardcoded - number: if several CI executors run `make check` at once on same - host, they now have a decent chance to not collide (not guaranteed - though) - * tests/NIT/nit.sh: tests/NIT/nit.sh: let caller customize NUT_PORT - * Makefile.am, configure.ac, tests/Makefile.am, tests/NIT/.gitignore, - tests/NIT/Makefile.am: Add tests/NIT/Makefile.am for - straightforward integration of the test suite - * configure.ac, tests/Makefile.am: configure.ac: fix detection of - cppunit on some platforms Note for posterity: CFLAGS go before - source, LDFLAGS+LIBS after source, in g++ cmdline - * Makefile.am: Makefile.am: fix "make check-docs" and siblings from - root dir - * Makefile.am: Makefile.am: let "make check-NIT" from root dir - * tests/NIT/README, tests/NIT/nit.sh: tests/NIT: warn in - docs/comments that starting pwd should be the BUILDDIR - * tests/Makefile.am: tests/Makefile.am: help check-NIT pass in - distcheck (cleaner) - * tests/NIT/README, tests/NIT/nit.sh: tests/NIT/README: update a bit - * tests/Makefile.am: tests/Makefile.am: help check-NIT pass in - distcheck - * docs/nut-qa.txt: docs/nut-qa.txt: mention NUT NIT and update links - to Ubuntu QART - * tests/NIT/nit.sh: tests/NIT/nit.sh: make some debug noise optional - * tests/NIT/nit.sh: tests/NIT/nit.sh: typo fix for SRCDIR - * tests/NIT/nit.sh: tests/NIT/nit.sh: sanity checks for BUILDDIR - * tests/NIT/nit.sh: tests/NIT/nit.sh: bail out quickly if got no - daemons to run - * tests/Makefile.am: tests/Makefile.am: call NIT suite - * tests/NIT/nit.sh: tests/NIT/nit.sh: document DEBUG_SLEEP a bit - -2022-04-19 Jim Klimov - - * tests/NIT/.gitignore, tests/NIT/README, tests/NIT/nit.sh: NIT: NUT - Integration Tests (usable PoC) [another take at issue #3] - * clients/upsrw.c, docs/man/upsrw.txt: upsrw: accept "-l" for listing - Closes: #1382 - * scripts/python/module/test_nutclient.py.in: test_nutclient.py.in: - allow to override NUT_PORT, NUT_USER, NUT_PASS - * conf/ups.conf.sample: conf/ups.conf.sample: update with info from - docs/man/ups.conf.txt - -2022-04-18 Jim Klimov - - * clients/nutclient.cpp: clients/nutclient.{cpp,h}: - deviceMaster()/devicePrimary(): add fallback handling with the - other keyword [#840, #1374] - * clients/nutclient.cpp, clients/nutclient.h, - clients/nutclientmem.cpp, clients/nutclientmem.h, - docs/man/libnutclient_misc.txt: clients/nutclient{mem}.{cpp,h} - docs/man/libnutclient_misc.txt: add PRIMARY handling [#840] - Closes: #1374 - * clients/nutclient.cpp, clients/nutclient.h, - docs/man/libnutclient_tcp.txt: clients/nutclient.{cpp,h} - docs/man/libnutclient_tcp.txt: fix timeout from long to time_t - Closes: #1376 - * clients/upsc.c, clients/upsclient.c, clients/upsclient.h, - clients/upscmd.c, clients/upsimage.c, clients/upslog.c, - clients/upsmon.h, clients/upsrw.c, clients/upsset.c, - clients/upsstats.c, docs/man/upscli_connect.txt, drivers/dummy- - ups.c: clients/upsclient.{c,h} and many clients + dummy-ups: fix - port from int to uint16_t Closes: #1379 - * docs/man/libnutclient_variables.txt: - docs/man/libnutclient_variables.txt: fix English - * clients/upsclient.h: clients/upsclient.h: fix whitespace - * clients/upsclient.c, clients/upsclient.h, - docs/man/upscli_readline.txt, docs/man/upscli_sendline.txt: - clients/upsclient.{c,h} docs/man/upscli_{read,send}line.txt: fix - timeout from long to time_t Closes: #1373 - * clients/nutclient.cpp, clients/nutclient.h, - docs/man/libnutclient_tcp.txt, docs/nut.dict: - clients/nutclient.{cpp,h}: fix port type from unsigned short to - uint16_t Closes: #1375 - * docs/man/Makefile.am: docs/man/Makefile.am: `$( - - * docs/man/Makefile.am: docs/man/Makefile.am: abstract filenames into - LINKMAN_INCLUDE_GENERATED macro - -2022-04-16 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am: DOCBUILD_BEGIN: work - around older BSD make not seeing sources not present in builddir - It seems to resolve single-source documents well, but fails to find - the upsd.txt which depends on linkman*-names.txt and build a proper - relative path to it. - * docs/man/Makefile.am: docs/man/Makefile.am: ensure linkman- - drivertool*names.txt are in builddir - * docs/man/Makefile.am: docs/man/Makefile.am: ensure linkman- - drivertool*names.txt are in A2X_OUTDIR - * docs/man/Makefile.am: docs/man/Makefile.am: avoid spurious - regeneration of linkman-drivertool*names.txt whenever we reference - them - * docs/man/Makefile.am: docs/man/Makefile.am: generate linkman- - drivertool*names.txt independent of current dir being srcdir - * ci_build.sh: ci_build.sh: "cat" the "git diff" - -2022-04-15 Jim Klimov - - * docs/man/libnutclient_general.txt, docs/man/libnutclient_misc.txt, - docs/man/libnutclient_tcp.txt, docs/man/libnutclient_variables.txt, - docs/man/libupsclient-config.txt, docs/nut.dict: - docs/man/libnutclient*.txt: wrap long lines, minor rephrase, bullet - points - * docs/man/libnutclient_commands.txt, - docs/man/libnutclient_devices.txt: - docs/man/libnutclient_devices.txt, libnutclient_commands.txt: - synopsis for strarr - * docs/man/libnutclient_devices.txt: - docs/man/libnutclient_devices.txt: wrap long lines, minor rephrase, - bullet points - * docs/man/libnutclient_commands.txt: - docs/man/libnutclient_commands.txt: wrap long lines, minor - rephrase, bullet points; added optional param arg in API - * docs/man/upscli_strerror.txt: docs/man/upscli_strerror.txt: fix - return type modifier to const - * docs/man/upscli_add_host_cert.txt, docs/man/upscli_cleanup.txt, - docs/man/upscli_disconnect.txt, docs/man/upscli_fd.txt, - docs/man/upscli_get.txt, docs/man/upscli_init.txt, - docs/man/upscli_list_next.txt, docs/man/upscli_readline.txt, - docs/man/upscli_sendline.txt, docs/man/upscli_splitaddr.txt: - docs/man/upscli*.txt: wrap long lines, minor rephrase - * docs/man/nutscan_init.txt, docs/man/nutscan_new_device.txt, - docs/man/nutscan_scan_usb.txt: docs/man/nutscan*.txt: document - methods with (void) arg list as such - * docs/man/Makefile.am, docs/man/index.txt, docs/man/nutscan.txt, - docs/man/nutscan_add_device_to_device.txt, - docs/man/nutscan_add_option_to_device.txt, - docs/man/nutscan_cidr_to_ip.txt, - docs/man/nutscan_display_parsable.txt, - docs/man/nutscan_display_ups_conf.txt, - docs/man/nutscan_free_device.txt, - docs/man/nutscan_get_serial_ports_list.txt, - docs/man/nutscan_init.txt, docs/man/nutscan_new_device.txt, - docs/man/nutscan_scan_avahi.txt, - docs/man/nutscan_scan_eaton_serial.txt, - docs/man/nutscan_scan_ipmi.txt, docs/man/nutscan_scan_nut.txt, - docs/man/nutscan_scan_snmp.txt, docs/man/nutscan_scan_usb.txt, - docs/man/nutscan_scan_xml_http.txt, - docs/man/nutscan_scan_xml_http_range.txt: - docs/man/nutscan_scan_xml_http_range.txt: document the method which - got extended from original nutscan_scan_xml_http() doing just a - local broadcast - * docs/man/nutscan_scan_ipmi.txt: docs/man/nutscan_scan_ipmi.txt: - document the method which now is implemented - * docs/man/nutscan.txt, docs/man/nutscan_add_device_to_device.txt, - docs/man/nutscan_add_option_to_device.txt, - docs/man/nutscan_cidr_to_ip.txt, docs/man/nutscan_free_device.txt, - docs/man/nutscan_get_serial_ports_list.txt, - docs/man/nutscan_init.txt, docs/man/nutscan_new_device.txt, - docs/man/nutscan_scan_avahi.txt, - docs/man/nutscan_scan_eaton_serial.txt, - docs/man/nutscan_scan_nut.txt, docs/man/nutscan_scan_snmp.txt, - docs/man/nutscan_scan_usb.txt, docs/man/nutscan_scan_xml_http.txt: - docs/man/nutscan*.txt: wrap long lines, minor rephrase, fix - timeouts to useconds_t - * docs/nut.dict: docs/nut.dict: spellcheck drivertool - * docs/man/apcsmart-old.txt, docs/man/apcsmart.txt, - docs/man/asem.txt, docs/man/bcmxcp_usb.txt, docs/man/liebert- - esp2.txt, docs/man/macosx-ups.txt, docs/man/microsol-apc.txt, - docs/man/nut.conf.txt, docs/man/nutdrv_atcl_usb.txt, - docs/man/nutdrv_qx.txt, docs/man/nutdrv_siemens_sitop.txt, - docs/man/oneac.txt, docs/man/optiups.txt, docs/man/upscode2.txt, - docs/man/usbhid-ups.txt: docs/man/*.txt: reformat AUTHOR(S) and - INTERNET RESOURCES blocks to common style - * docs/man/upsdrvsvcctl.txt: docs/man/upsdrvsvcctl.txt: list Jim - Klimov as the AUTHOR - * docs/man/nut-driver-enumerator.txt: docs/man/nut-driver- - enumerator.txt: list Jim Klimov as the AUTHOR - * docs/man/snmp-ups.txt: docs/man/snmp-ups.txt: list AUTHORS as a - bulleted list and add Jim Klimov - * docs/man/snmp-ups.txt: docs/man/snmp-ups.txt: wrap long lines and - reword a bit - * docs/man/optiups.txt: docs/man/optiups.txt: wrap long lines - * docs/man/phoenixcontact_modbus.txt: - docs/man/phoenixcontact_modbus.txt: wrap long lines - * docs/man/belkinunv.txt: docs/man/belkinunv.txt: add link to - protocol description copy on NUT site - * docs/support.txt: docs/support.txt: mention github instead of - subversion - * docs/man/.gitignore, docs/man/Makefile.am, docs/man/index.txt, - docs/man/nutupsdrv.txt, docs/man/upsd.txt: docs/man/index.txt, - upsd.txt, nutupsdrv.txt: generate the up-to-date list of drivers, - current for each iteration - * docs/man/index.txt, docs/man/nutupsdrv.txt, docs/man/upsd.txt: - docs/man/upsd.txt, nutupsdrv.txt, index.txt: move common - nutupsdrv[8] from the bulk of driver list - * docs/man/nutupsdrv.txt, docs/man/upsd.txt: docs/man/upsd.txt, - nutupsdrv.txt: generate current list of drivers - * docs/man/index.txt: docs/man/index.txt: generate current list of - drivers, separate "Driver Control" title - * docs/man/nutupsdrv.txt, docs/man/upsd.txt: docs/man/upsd.txt, - nutupsdrv.txt: reformat lists of drivers and tools to bullet lists - * docs/Makefile.am: docs/Makefile.am: DOCBUILD_BEGIN: symlink images/ - ONLY for PDF generation - * ci_build.sh: ci_build.sh: add notes to Consider `--enable- - maintainer-mode` - * .gitignore: GitIgnore IDEA metadata files - * docs/.gitignore: GitIgnore more intermediate XML files from docs - generation - -2022-04-14 Jim Klimov - - * docs/man/nutscan_display_parsable.txt, - docs/man/nutscan_display_ups_conf.txt, - docs/man/nutscan_free_device.txt, - docs/man/nutscan_get_serial_ports_list.txt: docs/man/nutscan*.txt: - fix formatting and typos - * docs/man/upscli_get.txt, docs/man/upscli_init.txt, - docs/man/upscli_list_start.txt: docs/man/upscli*.txt: fix sample - source formatting - * docs/man/upsmon.txt: docs/man/upsmon.txt: reword a dangling - sentence - * docs/man/tripplite_usb.txt: docs/man/tripplite_usb.txt: fix - formatting - * docs/man/riello_ser.txt: docs/man/riello_ser.txt: fix formatting - * docs/man/riello_usb.txt: docs/man/riello_usb.txt: fix formatting - * docs/man/snmp-ups.txt: docs/man/snmp-ups.txt: fix sample source - formatting - * docs/man/socomec_jbus.txt: docs/man/socomec_jbus.txt: fix - formatting and typos - * docs/man/Makefile.am, docs/nut.dict: docs/man/Makefile.am: list the - socomec_jbus.txt - * docs/man/pijuice.txt: docs/man/pijuice.txt: fix formatting - * docs/man/nutdrv_qx.txt: docs/man/nutdrv_qx.txt: fix formatting - * docs/man/nutdrv_atcl_usb.txt: docs/man/nutdrv_atcl_usb.txt: fix - formatting - * docs/man/nut.conf.txt: docs/man/nut.conf.txt: fix sample source - formatting - * docs/man/mge-utalk.txt: docs/man/mge-utalk.txt: fix formatting - * docs/man/liebert-esp2.txt: docs/man/liebert-esp2.txt: fix - formatting - * docs/man/clone.txt: docs/man/clone.txt: fix sample source - formatting - * docs/man/bestups.txt, docs/man/blazer-common.txt, - docs/man/masterguard.txt: docs/man/blazer-common.txt, - masterguard.txt, bestups.txt: fix formatting [#1361] - * docs/man/adelsystem_cbi.txt: docs/man/adelsystem_cbi.txt: fix - formatting - * docs/sock-protocol.txt: docs/sock-protocol.txt: fix formatting - * docs/snmp-subdrivers.txt: docs/snmp-subdrivers.txt: small typo - * docs/packager-guide.txt: docs/packager-guide.txt: reshuffle known - names - * docs/nut-qa.txt: docs/nut-qa.txt: list a few more tools we use - * TODO, docs/nut-qa.txt: Fix remaining links to asciidoc.org - * docs/nut-names.txt: docs/nut-names.txt: fix table formatting - * docs/new-clients.txt: docs/new-clients.txt: fix sample source - formatting - * docs/net-protocol.txt: docs/net-protocol.txt: fix version table - formatting - * docs/FAQ.txt: docs/FAQ.txt: fix formatting, extend some notes - * docs/nut.dict: Update nut.dict - * docs/developers.txt: docs/developers.txt: fix formatting, extend - some notes - * docs/developer-guide.txt: docs/developer-guide.txt: fix formatting; - update URL to evolution500.seq - * docs/design.txt: docs/design.txt: fix formatting; note FIXMEs for - documenting TRACKING support - * docs/daisychain.txt: docs/daisychain.txt: fix formatting - * drivers/snmp-ups.h: drivers/snmp-ups.h: update comment to clarify - the meaning of SU_TYPE_DAISY_1 and SU_TYPE_DAISY_2 - * docs/configure.txt: docs/configure.txt: fix formatting, add titles, - extend some notes - * docs/configure.txt: docs/configure.txt: add a section on modbus - drivers - * docs/configure.txt: docs/configure.txt: link to powerman project - * docs/configure.txt: docs/configure.txt: fix formatting, add driver - type titles, extend some notes - * docs/config-prereqs.txt: docs/config-prereqs.txt: fix formatting, - extend some notes - -2022-04-14 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am: A2X_COMMON_OPTS: use "-- - attribute=..." consistently - * docs/Makefile.am: docs/Makefile.am: have "images/" in A2X_OUTDIR - (fallout of #1152) Closes: #1365 - -2022-04-14 Jim Klimov - - * docs/solaris-usb.txt: docs/solaris-usb.txt: drop suggestions about - building special libusb-1.0/0.1 branches - * docs/solaris-usb.txt: docs/solaris-usb.txt: fix formatting, extend - some notes - * docs/solaris-usb.txt: docs/solaris-usb.txt: add a NOTE for USB - drivers ignoring port option [#1368] - * docs/config-notes.txt: docs/config-notes.txt: fix formatting, - extend some notes and warnings, and service-driven life-cycle - * docs/config-notes.txt: docs/config-notes.txt: document - ALLOW_NO_DEVICE for upsd.conf [#766, #837] - * docs/config-notes.txt: docs/config-notes.txt: reformat and extend - the NOTE for USB drivers ignoring port option [#1368] - * ci_build.sh, docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci- - farm-lxc-setup.txt: fix formatting, extend on Jenkins agent setup - * ci_build.sh: ci_build.sh: use "gmake" for "./ci_build.sh - spellcheck" if available and no particular MAKE was requested - - fall back to "make" if "gmake" is not available - -2022-04-13 Jim Klimov - - * docs/asciidoc.txt: docs/asciidoc.txt: update link to the Asciidoc - Manual (and project now on github) - -2022-04-12 Jim Klimov - - * Makefile.am: Makefile.am: define dependencies between recipes for - dist* and package; tarball, sig and checksum filenames - -2022-04-10 Jim Klimov - - * docs/daisychain.txt, docs/man/adelsystem_cbi.txt, - docs/man/al175.txt, docs/man/apcsmart-old.txt, - docs/man/apcsmart.txt, docs/man/apcupsd-ups.txt, docs/man/asem.txt, - docs/man/bcmxcp.txt, docs/man/bcmxcp_usb.txt, docs/man/belkin.txt, - docs/man/belkinunv.txt, docs/man/bestfcom.txt, - docs/man/bestfortress.txt, docs/man/bestuferrups.txt, - docs/man/bestups.txt, docs/man/blazer-common.txt, - docs/man/clone.txt, docs/man/dummy-ups.txt, docs/man/etapro.txt, - docs/man/everups.txt, docs/man/gamatronic.txt, - docs/man/generic_modbus.txt, docs/man/genericups.txt, - docs/man/hosts.conf.txt, docs/man/huawei-ups2000.txt, - docs/man/isbmex.txt, docs/man/ivtscd.txt, - docs/man/libnutclient.txt, docs/man/libnutclient_commands.txt, - docs/man/libnutclient_devices.txt, - docs/man/libnutclient_general.txt, docs/man/libnutclient_misc.txt, - docs/man/libnutclient_tcp.txt, docs/man/libnutclient_variables.txt, - docs/man/libupsclient-config.txt, docs/man/liebert-esp2.txt, - docs/man/liebert.txt, docs/man/macosx-ups.txt, - docs/man/masterguard.txt, docs/man/metasys.txt, docs/man/mge- - shut.txt, docs/man/mge-utalk.txt, docs/man/microdowell.txt, - docs/man/microsol-apc.txt, docs/man/netxml-ups.txt, docs/man/nut- - driver-enumerator.txt, docs/man/nut-ipmipsu.txt, docs/man/nut- - recorder.txt, docs/man/nut-scanner.txt, docs/man/nut.conf.txt, - docs/man/nutdrv_atcl_usb.txt, docs/man/nutdrv_siemens_sitop.txt, - docs/man/nutscan.txt, docs/man/nutscan_add_device_to_device.txt, - docs/man/nutscan_add_option_to_device.txt, - docs/man/nutscan_cidr_to_ip.txt, - docs/man/nutscan_display_parsable.txt, - docs/man/nutscan_display_ups_conf.txt, - docs/man/nutscan_free_device.txt, - docs/man/nutscan_get_serial_ports_list.txt, - docs/man/nutscan_init.txt, docs/man/nutscan_new_device.txt, - docs/man/nutscan_scan_avahi.txt, - docs/man/nutscan_scan_eaton_serial.txt, - docs/man/nutscan_scan_ipmi.txt, docs/man/nutscan_scan_nut.txt, - docs/man/nutscan_scan_snmp.txt, docs/man/nutscan_scan_usb.txt, - docs/man/nutscan_scan_xml_http.txt, docs/man/nutupsdrv.txt, - docs/man/oneac.txt, docs/man/optiups.txt, - docs/man/phoenixcontact_modbus.txt, docs/man/pijuice.txt, - docs/man/powercom.txt, docs/man/powerman-pdu.txt, - docs/man/powerpanel.txt, docs/man/rhino.txt, - docs/man/richcomm_usb.txt, docs/man/riello_ser.txt, - docs/man/riello_usb.txt, docs/man/safenet.txt, docs/man/skel.txt, - docs/man/snmp-ups.txt, docs/man/socomec_jbus.txt, - docs/man/solis.txt, docs/man/tripplite.txt, - docs/man/tripplite_usb.txt, docs/man/tripplitesu.txt, - docs/man/ups.conf.txt, docs/man/upsc.txt, - docs/man/upscli_add_host_cert.txt, docs/man/upscli_cleanup.txt, - docs/man/upscli_connect.txt, docs/man/upscli_disconnect.txt, - docs/man/upscli_get.txt, docs/man/upscli_init.txt, - docs/man/upscli_list_next.txt, docs/man/upscli_list_start.txt, - docs/man/upscli_readline.txt, docs/man/upscli_sendline.txt, - docs/man/upscli_splitname.txt, docs/man/upsclient.txt, - docs/man/upscmd.txt, docs/man/upscode2.txt, docs/man/upsd.conf.txt, - docs/man/upsd.txt, docs/man/upsd.users.txt, docs/man/upsdrvctl.txt, - docs/man/upsdrvsvcctl.txt, docs/man/upsimage.cgi.txt, - docs/man/upslog.txt, docs/man/upsmon.conf.txt, docs/man/upsmon.txt, - docs/man/upsrw.txt, docs/man/upssched.conf.txt, - docs/man/upssched.txt, docs/man/upsset.cgi.txt, - docs/man/upsset.conf.txt, docs/man/upsstats.cgi.txt, - docs/man/upsstats.html.txt, docs/man/usbhid-ups.txt, - docs/man/victronups.txt, docs/nut-names.txt, docs/packager- - guide.txt: docs/man: be sure to keep a blank line after SYNOPSIS - and other titles [#1362] - * docs/FAQ.txt: docs/FAQ.txt: clarify about nutdrv_qx - * UPGRADING: UPGRADING: detail about "OBSOLETION WARNING" for - "Megatec Q*" - * docs/man/bestups.txt, docs/man/blazer-common.txt, - docs/man/masterguard.txt, drivers/bestups.c, drivers/blazer.c, - drivers/masterguard.c: Report deprecation messages when starting - older Qx drivers And document similarly in their man pages - (bestups, blazer, masterguard) - * docs/FAQ.txt, docs/nut.dict: docs/FAQ.txt: add more reasons and - symptoms that a running driver disappears - * docs/FAQ.txt, docs/nut.dict: docs/FAQ.txt: suggest checking Linux - USB HID Quirk [#630] - * ci_build.sh: ci_build.sh: use "gmake" for "./ci_build.sh - spellcheck" if available and no particular MAKE was requested - * docs/FAQ.txt, docs/nut.dict: docs/FAQ.txt: suggest how to pick - drivers for bogus vendor IDs - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: bump version for #1356 - and #1359 - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: bump version for - #584 - * drivers/mge-hid.c: drivers/mge-hid.c: bump version for #1357 - -2022-04-09 Stuart Henderson - - * drivers/usbhid-ups.c: reinstate handling for STATUS(ONLINE) in - usbhid-ups The recent onlinedischarge changes removed support for - some STATUS(ONLINE) cases, affecting at least CP1300EPFCLCD - this - brings them back. - -2022-04-08 Jim Klimov - - * NEWS: NEWS: note Liebert/Phoenixtec vs MGE HID handling of VendorID - 0x06da - * drivers/mge-hid.c: drivers/mge-hid.c: mge_claim(): test that - VendorID==PHOENIXTEC 0x06da has also Vendor or Product containing - "AEG" - * data/driver.list.in: data/driver.list.in: update for "PowerWalker - VFI 2000 TGS" via "usbhid-ups" [#564] - * docs/man/usbhid-ups.txt: docs/man/usbhid-ups.txt: update for "some - PowerWalker models" - -2022-04-08 Jim Klimov - - * NEWS: NEWS: tripplite_usb recognizes "3005" protocol for NUT v2.7.5 - -2022-04-08 Jim Klimov - - * NEWS, docs/nut.dict: NEWS: improve PowerWalker VFI 2000 TGS support - in NUT v2.7.5 - * drivers/liebert-hid.c, drivers/mge-hid.c: drivers/liebert-hid.c: - get PowerWalker VFI 2000 TGS working, read values correctly This - reverts commit c38b45a56a9d1283657d62a9fa1ed1af5daa1ba2 which added - such support into mge-hid.c (at risk to proper support of earlier - handled devices by various vendors), and transplants the new lines - into liebert-hid.c See issue #560 for a HID walk from the device - in question; data like that may help expand liebert-hid.c later - (its table seems to map a lot less field names than mge-hid.c, but - not sure if "true" Liebert/Phoenixtec HID devices support the - rest). - -2022-04-07 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: instcmd(): do not risk - NULL-dereference debugging about "using Path" with a NULL hidpath - (just in case) [#1346] - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: instcmd(): do not risk - NULL-dereference debugging about "using Path" too early [#1346] - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: instcmd(): wrap some - long lines - -2022-04-07 Jim Klimov - - * docs/nut.dict: docs/nut.dict: update spellchecker - * docs/nut.dict: docs/nut.dict: update spellchecker - -2022-04-05 Jim Klimov - - * docs/man/upsmon.conf.txt: docs/man/upsmon.conf.txt: fix markup - (pluses make emphasis and xmllint goes upset) - -2022-04-04 Jim Klimov - - * INSTALL.nut: INSTALL.nut: add another perspective on packages vs - source builds; refer to config-prereqs.txt - * INSTALL.nut: INSTALL.nut: trim trailing spaces - * README: README: trim trailing spaces - * README: README: clarify use of github - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - clarify pre-installation of python and perl - * docs/config-prereqs.txt: docs/config-prereqs.txt: clarify that non- - GNU makes should work well - -2022-04-02 Jim Klimov - - * scripts/python/app/NUT-Monitor: scripts/python/app/NUT-Monitor: fix - typo, thank CI - * UPGRADING: UPGRADING: detail the Py2/Py3 packages - * UPGRADING: UPGRADING: make note of systemd and Py2/3 changes on top - for packagers to see - * NEWS: NEWS: detail the split of NUT-Monitor and new wrapper script - * scripts/python/app/README: scripts/python/app/README: update with - sections; list Desktop menu integration and Kudos - * scripts/python/app/.gitignore, scripts/python/app/NUT-Monitor, - scripts/python/app/nut-monitor.desktop: Introduce new NUT-Monitor - name-holder as a wrapping script to pick usable implementation - * scripts/python/app/.gitignore: GitIgnore newly named variants of - NUT-Monitor-py2gtk2 and NUT-Monitor-py3qt5 - * scripts/python/app/README: scripts/python/app/README: document how - to get localized UI in dev/testing - * scripts/python/app/README: scripts/python/app/README: document how - to run UI app in-place - * m4/nut_check_python.m4: m4/nut_check_python.m4: extend list of some - python interpreter filenames - * configure.ac, scripts/python/Makefile.am, scripts/python/app/{NUT- - Monitor.in => NUT-Monitor-py2gtk2.in}, scripts/python/app/nut- - monitor-py2gtk2.desktop, scripts/python/app/nut-monitor.desktop, - scripts/python/app/{ => ui}/gui-1.3.glade, scripts/python/app/{ => - ui}/gui-1.3.glade.h: Rename NUT-Monitor UI app to NUT-Monitor- - py2gtk2 - * configure.ac, scripts/python/Makefile.am, scripts/python/app/{NUT- - Monitor.in => NUT-Monitor-py3qt5.in}, scripts/python/app/nut- - monitor-py3qt5.desktop, scripts/python/app/nut-monitor.desktop: - Rename modernized NUT-Monitor UI app to NUT-Monitor-py3qt5 - -2022-02-21 Luke Dashjr - - * scripts/python/Makefile.am, scripts/python/README, - scripts/python/app/NUT-Monitor.in, scripts/python/app/README, - scripts/python/app/gui-1.3.glade, - scripts/python/app/gui-1.3.glade.h, scripts/python/app/nut- - monitor.desktop, scripts/python/app/ui/aboutdialog1.ui, - scripts/python/app/ui/dialog1.ui, scripts/python/app/ui/dialog2.ui, - scripts/python/app/ui/window1.ui: NUT-Monitor: Port to - Python3+PyQt5 - -2022-02-13 Luke Dashjr - - * scripts/python/app/NUT-Monitor.in: NUT-Monitor: Run py2to3-3.10 - -2022-04-01 Jim Klimov - - * scripts/python/README: scripts/python/README: clarify that - `test_nutclient.py` requires an `upsd` running - * scripts/python/module/PyNUT.py.in: - scripts/python/module/PyNUT.py.in: fix typo (fallout of #840) - * docs/config-prereqs.txt: docs/config-prereqs.txt: fix typos in - OpenIndiana chapter - * NEWS, docs/net-protocol.txt, docs/nut.dict, server/netcmds.h: Add - "PROTVER" as alias to "NETVER" for NUT v2.8.0 Closes: #1347 - -2022-03-31 Jim Klimov - - * Makefile.am, docs/Makefile.am, docs/man/Makefile.am: - {.,docs,docs/man}/Makefile.am: add "all-man" target to build all - possible man pages (vs ones for enabled drivers), and weave this - and check targets to parent makefiles - * ci_build.sh: ci_build.sh: introduce shortcut for - BUILD_TYPE=fightwarn-all - * ci_build.sh: ci_build.sh: in BUILD_TYPE=default-all-errors report - visibly when no failures happened - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: treat - /usr/pkg/include as -isystem - * common/parseconf.c, common/str.c, drivers/apcsmart-old.c, - drivers/apcsmart.c, drivers/mge-utalk.c, drivers/serial.c, - drivers/snmp-ups.c, server/conf.c: Cast (size_t)(char) for - isprint(), isspace(), isdigit(), toupper(), etc. who may be macros - and use it as array subscript (due to sys/ctype_inline.h) - -2022-03-30 Jim Klimov - - * autogen.sh: autogen.sh: suggest to export PYTHON=python-x.y - * autogen.sh: autogen.sh: detect more python-x.y filenames - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - add chapter for NetBSD 9.2 builder setup - * docs/config-prereqs.txt: docs/config-prereqs.txt: drop bogus - command (copy-paste typo) - -2022-03-29 Jim Klimov - - * .github/pull_request_template.md: Update pull_request_template.md - -2022-03-28 Benjamin Berg - - * scripts/upower/95-upower-hid.hwdb, scripts/upower/95-upower- - hid.rules, tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: Use hwdb for - UPower rules - -2022-03-28 Jim Klimov - - * ci_build.sh: ci_build.sh: recognize more "*bsd" CI_OS_NAME values - * ci_build.sh: ci_build.sh: do not make noise about non-ubiquitous - options to "uname" program - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: set the onlinedischarge - variable based on flag presence - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: drop - DEFAULT_ONLINEDISCHARGE to match "VAR_FLAG" semantics - * docs/nut.dict: docs/nut.dict: add onlinedischarge - * NEWS: NEWS: clarify that NUT 2.8.0 is new name for old planned NUT - 2.7.5 - * NEWS: NEWS: added usbhid-ups onlinedischarge for NUT v2.7.5 - * docs/man/usbhid-ups.txt: docs/man/usbhid-ups.txt: document - onlinedischarge - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix var usage for - upsname - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix format string for - "onlinedischarge" help - -2022-03-26 Jim Klimov - - * ci_build.sh: ci_build.sh: default to clang if also available when - default gcc is too old - -2022-03-25 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: update openbsd - tools for man-page builds - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: avoid failure-prone - build toolkits for manpage tests - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: avoid - configure noise message - * m4/ax_check_compile_flag.m4: m4/ax_check_compile_flag.m4: extend to - check conftest.err log about unsupported flags - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: define - axisCombos_COMPILER_GCC_TOO_OLD near other compiler-related combos - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: fix scenarios with - "non-fatal warnings" that had BUILD_WARNFATAL=yes anyway (copy- - paste issue) - -2022-03-24 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: avoid even running - axisCombos_GCC_TOO_OLD where we require fatal warnings - * configure.ac: configure.ac: for very old GCC where we are not in - control of warnings, make them non-fatal always (for "auto" level) - * drivers/libhid.c: drivers/libhid.c: clang-3.4 does not know - "-Wtautological-type-limit-compare" either - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: make use of - dsbcStageTimeoutSettings - -2022-03-23 Jim Klimov - - * configure.ac: configure.ac: with nut_enable_warnings=auto, avoid - fatal warnings with GCC 4.3 or older (no support for diags pragmas) - * configure.ac: configure.ac: report initial nut_enable_warnings - (default or argument) - * configure.ac: configure.ac: pre-set nut_enable_warnings=auto by - default (not hardcoded "medium") - * ci_build.sh: ci_build.sh: set BUILD_WARNOPT and BUILD_WARNFATAL to - "auto" for BUILD_TYPE="fightwarn"* shortcuts (survive antique - compilers, default to medium/fatal normally) - * ci_build.sh: ci_build.sh: comment BUILD_WARNOPT setting for - BUILD_TYPE="fightwarn"* shortcuts - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: enable back - the "-isystem" tuning to not complain about packaged third-party - headers - * drivers/libhid.c: drivers/libhid.c: make use of - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE - (clang-6.0.0 of OpenBSD 6.4) - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - [HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE - * configure.ac: configure.ac: specify AC_PREREQ([2.64]) - * m4/nut_check_libgd.m4: m4/nut_check_libgd.m4: fix detection of - gdImagePng() with additional link requirements - * configure.ac: configure.ac: document practical requirement for - AC_PREREQ(2.64) - * NEWS, UPGRADING, docs/config-notes.txt, docs/man/upscmd.txt, - docs/man/upsrw.txt: docs, NEWS, UPGRADING: rename 2.7.5 to 2.8.0 in - text that appeared after 2.7.4 - * docs/net-protocol.txt: docs/net-protocol.txt: document "PRIMARY" as - alias to "MASTER" - * docs/net-protocol.txt: docs/net-protocol.txt: bump next release - from 2.7.5 to 2.8.0 - * configure.ac: configure.ac: bump NUT_NETVERSION to 1.3 to match - docs/net-protocol.txt - -2022-03-21 Jim Klimov - - * scripts/subdriver/gen-snmp-subdriver.sh: scripts/subdriver/gen- - snmp-subdriver.sh: fix back markup for mib2nut_info_t lines - Follow-up for #1327 Thanks to @aquette - -2022-03-19 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: qx_ups_walk(): log the - change of estimated remaining runtime - * NEWS: NEWS: nutdrv_qx: enhanced estimation of remaining battery - runtime for NUT v2.7.5 - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: comment about source and - data for estimated runtime corrections - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix trailing whitespace - * ci_build.sh: ci_build.sh: when parsing BUILD_TYPE=fightwarn, do not - default NUT_SSL_VARIANTS and NUT_USB_VARIANTS to "auto" - so - building just one variant at most, even if agent supports more - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: snr_command(): adapt to - usb_ctrl_charbuf - -2022-03-16 Jim Klimov - - * drivers/libhid.h, drivers/usbhid-ups.c: drivers/libhid.h, usbhid- - ups.c: define HID_DEV_HANDLE_CLOSED usable for both SHUT and USB - cases - -2022-03-15 Jim Klimov - - * drivers/libusb0.c, drivers/libusb1.c: drivers/libusb{0,1}.c: retry - getting Manufacturer/Product/Serial a few times if failed on the - first Kudos to Sam Varshavchik for proposing this code change in - discussion https://github.com/networkupstools/nut/issues/414 - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: try to close libusb - handle before reconnecting (from discussion of issue #414) - -2022-03-16 Jim Klimov - - * NEWS: NEWS: added driver adelsystem_cbi for NUT v2.7.5 - * drivers/adelsystem_cbi.h: drivers/adelsystem_cbi.h: functions - implemented in a header should be static - * drivers/adelsystem_cbi.c: drivers/adelsystem_cbi.c: extend pragmas - for covered/requred "default" case to work with clang-3.4 - -2022-03-15 Jim Klimov - - * ci_build.sh: ci_build.sh: if we only build USB variant(s), do not - shy away from testing some SSL and whatever drivers we can - -2022-03-15 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: currently refrain - from clang-13 in OI - * docs/config-prereqs.txt: docs/config-prereqs.txt: mark aspell as - recommended (it is not big) - * docs/config-prereqs.txt: docs/config-prereqs.txt: update - instructions for symlinks on OI - * docs/config-prereqs.txt: docs/config-prereqs.txt: fix typos in - instructions for OpenIndiana, and update for new toolkits available - in 2022 - -2022-03-12 Jim Klimov - - * ci_build.sh: ci_build.sh: add support for CI_CROSSBUILD_HOST and/or - CI_CROSSBUILD_TARGET settings [#1294, #1289, #1334] - * ci_build.sh: ci_build.sh: check for "gd" as one of names gdlib can - go by - * ci_build.sh: ci_build.sh: use PKG_CONFIG variable if provided (fall - back to pkg-config from PATH, but only for this script itself) - [#710] - * drivers/salicru-hid.c: Update salicru-hid.c Cosmetic fixes - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: improve - checks for actually present priv/auth protocols [#1289] Great - thanks to @eklinedi on GitHub for finding the issue and - investigating ways to fix it - * drivers/snmp-ups.h: drivers/snmp-ups.h: net-snmp after v5.9.1 does - not declare ONE_SEC that our code uses; stash the definiton - * configure.ac, m4/ax_c_pragmas.m4, m4/ax_run_or_link_ifelse.m4, - m4/nut_compiler_family.m4: Introduce m4/ax_run_or_link_ifelse.m4 to - facilitate cross-builds [#1289] - * ci_build.sh: ci_build.sh: report OS_* envvar values if passed by - caller - -2022-03-12 juantonio - - * drivers/salicru-hid.c: Add tested descriptors for Salicru Twin Pro - 2 - -2022-03-12 Jim Klimov - - * ci_build.sh: ci_build.sh: expand a bit CI_OS_HINT detection on - linux systems - -2022-03-11 Jim Klimov - - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: quiesce - -Wreserved-identifier (clang 13+) that acts up on system headers - * drivers/riello.c: drivers/riello.c: riello_parse_re(): assign - Pout#W and Pout#VA from pom_long not pom_word - * drivers/belkinunv.c: drivers/belkinunv.c: instcmd(): find use for - "r" to at least report failed cmds - -2022-03-11 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: rearrange - packages to not require heavy ones by default dependency footprint - (aspell, docs generation and libgd) - * server/netuser.c: server/netuser.c: copy-paste typo fix - * NEWS, UPGRADING: NEWS: rename pending NUT release from 2.7.5 to - 2.8.0 (config files using new keywords are not backwards- - compatible, not usable by old binaries) - * NEWS: NEWS: added battery.mfr.date APC HID UPS setting for NUT - v2.7.5 - * NEWS, docs/nut.dict: NEWS: added socomec_jbus driver for NUT v2.7.5 - * server/netuser.c: server/netuser.c: net_master(): provide more - details about client using deprecated commands - * docs/net-protocol.txt: docs/net-protocol.txt: update for "PRIMARY" - netcmd support (alias of "MASTER") [issue #840] - * NEWS: NEWS: update for "PRIMARY" netcmd support (alias of "MASTER") - [issue #840] - * scripts/python/module/PyNUT.py.in, server/netcmds.h, - server/netuser.c, server/netuser.h: netcmds.h, netuser.{c,h}, - PyNUT.py.in: deprecate protocol "MASTER" command in favor of - "PRIMARY" [issue #840] - * server/upsd.c: server/upsd.c: check_command(): instrument with - upsdebugx() - * server/netuser.c: server/netuser.c: net_login(): instrument with - upsdebugx() - * clients/upsmon.c: clients/upsmon.c: apply_for_primary(): request - elevation by PRIMARY, fall back to MASTER (for older upsd builds) - * NEWS, UPGRADING: NEWS: rename pending NUT release from 2.7.5 to - 2.8.0 (config files using new keywords are not backwards- - compatible, not usable by old binaries) - -2022-03-10 Jim Klimov - - * scripts/subdriver/gen-snmp-subdriver.sh: gen-snmp-subdriver.sh: put - back indented CFILE markup (fix here-docs, instead of - unmaintainable printf) - * scripts/subdriver/gen-snmp-subdriver.sh: gen-snmp-subdriver.sh: fix - valid chars HOSTNAME input (e.g. IP) - -2022-03-10 Jim Klimov - - * scripts/subdriver/gen-snmp-subdriver.sh: Update gen-snmp- - subdriver.sh Quote variable expansions; replace `echo -n` with a - more portable `printf` - -2022-03-10 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: SNMP subdriver generation - script: minor reformatting - * scripts/subdriver/gen-snmp-subdriver.sh: SNMP subdriver generation - script: fixes and improvements - -2022-03-08 Jim Klimov - - * tests/getvaluetest.c: tests/getvaluetest.c: check different methods - to combine two "wire" bytes into a lenght word (follows up for - #1320), hopefully all work the same on all architectures - -2022-03-08 Thanos Chatziathanassiou - - * docs/man/socomec_jbus.txt: some documentatyion fixes - -2022-03-08 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: simplify back the bit- - maths to cast into uint8_t following discussion in #1320 - * drivers/libusb0.c, drivers/libusb1.c: drivers/libusb{0,1}.c: - simplify back the bit-maths to cast into uint8_t following - discussion in #1320 - -2022-03-07 Jim Klimov - - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: fix (commented- - away) hard_shutdown() to "unsigned char" and bit maths similar to - soft_shutdown() - * drivers/riello_usb.c: drivers/riello_usb.c: Get_USB_Packet(): cast - bit maths to (unsigned char) to err on safe side - * drivers/riello_usb.c: drivers/riello_usb.c: whitespace fix - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: upsdrv_initups(): cast - langid calculations to uint16_t (or wider) [similar to #1320] - * drivers/libusb0.c, drivers/libusb1.c: drivers/libusb{1,0}.c: - {nut_}libusb_open(): cast rdlen calculations to uint16_t (or wider) - [follow-up from #1320] - * drivers/libshut.c: drivers/libshut.c: shut_checksum(): address - (usb_ctrl_charbuf)buf as (unsigned char) in bit maths - * drivers/libshut.c: drivers/libshut.c: BYTESWAP(): cast "in" to - (uint16_t) for bit maths and use a full-width mask - * drivers/blazer_usb.c: drivers/blazer_usb.c: upsdrv_initups(): - address (usb_ctrl_charbuf)tbuf as (unsigned char) in bit maths - -2022-03-02 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: make sure - WITH_SNMP_LKP_FUN_DUMMY is defined - -2022-02-27 Nita Vesa - - * drivers/apc-hid.c, drivers/usbhid-ups.c: APC HID UPS: Add ability - to set battery battery.mfr.date Some APC UPSes allow for setting - battery.mfr.date, so it can be easily referenced later, even if - there were no stickers or papers left to refer to. This patch has - been tested to work with APC Back-UPS ES 550G. - -2022-03-02 Jim Klimov - - * drivers/mge-xml.c: drivers/mge-xml.c: mge_drycontact_info(): avoid - shadowing global variable - -2022-02-28 Nick Briggs - - * drivers/libusb0.c: Cast to unsigned type when interpreting HID - descriptor length bytes (libusb 0.1) The libusb 0.1 interface - definition declares a (signed) char type for control messages. The - HID descriptor length contained within a control message is - intended to be interpreted as a pair of unsigned bytes so we must - cast to uint8_t when doing the arithmetic rather than trip over the - sign bit. Closes #1261, closes #1312. - -2022-02-27 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: extend daisychain - initialization to use optional mapping function Note: ported sub- - set of "snmp-ups.[ch] : add support for extended fun/nuf l2s/s2l - conversions and use it for daisychain initialization" without the - actual 2x2 "fun/nuf l2s/s2l" support here. - -2022-02-27 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: daisychain_init(): add - debug trace - * drivers/eaton-pdu-marlin-helpers.c: drivers/eaton-pdu-marlin- - helpers.c: marlin_device_count_fun(): add debug trace - -2021-11-17 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_find_strval(): mark - NUT_UNUSED_VARIABLE(oid2info) when not WITH_SNMP_LKP_FUN - -2022-02-27 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: whitespace fix - -2017-10-11 Jim Klimov - - * drivers/snmp-ups.c: snmp-ups.c : publish device.count==1 too - -2021-10-13 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_find_strval() should - consider #if WITH_SNMP_LKP_FUN - -2019-09-25 Arnaud Quette - - * drivers/snmp-ups.c: Fix false positive when communication is lost - -2022-02-27 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - resync comments and use of SU_FLAG_SEMI_STATIC - -2022-02-25 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - break long lines - -2022-02-27 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: avoid stringop-truncation - warning: make sure string is finite - -2021-11-11 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: avoid stringop-truncation - warning - -2021-11-17 Jim Klimov - - * drivers/eaton-pdu-marlin-helpers.c: drivers/eaton-pdu-marlin- - helpers.c: include config.h first - -2021-11-25 Arnaud Quette - - * drivers/powerware-mib.c: Eaton SNMP: also publish ups.load for - 3phase Though there is output.Lx.power.percent, for 3phase, it's - desirable to also have the standard ups.load - -2022-01-12 Arnaud Quette - - * drivers/mge-xml.c: Eaton NMC: fix the non publication of real/power - with 3ph power and realpower for 3ph Lx were not publishing values - when they were 0 - -2021-11-22 Arnaud Quette - - * drivers/mge-xml.c: Eaton XML/PDC: add External Battery Module count - -2021-11-15 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c: Fix - regression on Eaton EMP002 temperature reading (SNMP) Following - the recent addition of the "String reformating function" - (su_find_strval()), a regression appeared on a corner case: when - flagging a data with ST_FLAG_STRING, while the SNMP OID is an int, - and when there is a fun_vp2s() conversion function, a double - conversion is applied, resulting in no value published. This was - limited to one data (temperature.unit) - -2021-06-14 Clappier, Eric - - * drivers/powerware-mib.c, drivers/snmp-ups.c: Add missing outlet - objects for master - -2021-02-01 Clappier, Eric - - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c: Fix dry - contacts status for EMP02 - -2022-02-27 Jim Klimov - - * drivers/snmp-ups-helpers.c, drivers/snmp-ups.c: Move - su_temperature_read_fun() from drivers/snmp-ups.c to snmp-ups- - helpers.c - -2021-01-26 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: fix regression on Eaton - ePDU Fix a regression that caused a mis-determination of the SNMP - base OID index (0 or 1, should be 1). This in turn caused a mis- - iteration over the outlets, from 0 to N-1 instead of 1 to N, which - resulted in the missing Nth outlet (last outlet of the PDU). This - also caused some data refresh issues - -2020-12-16 Clappier, Eric - - * drivers/eaton-pdu-marlin-mib.c, drivers/snmp-ups.c: Add - ambient.n.parent.serial for marlin epdu Regarding dropped code - from snmp-ups.c - per discussion in - https://github.com/42ity/nut/pull/117 this was not a typo: > It is - an intentional change for oid read value issue. > This allows to - actually retrieve an indirection value > (when an Oid points at an - Oid, like stood) - -2020-12-15 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: Restore legacy Eaton ePDU - switchability info Use a hack to also have switchability for both - the unit and its outlets on legacy Eaton G2 ePDU - -2020-12-15 Clappier, Eric - - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c: Change uid - and modbus address name according nut nomenclature - -2020-12-14 Clappier, Eric - - * drivers/powerware-mib.c: Add modbus_address and uuid in snmp-ups/pw - driver - -2019-11-07 Arnaud Quette - - * drivers/powerware-mib.c: SNMP Eaton Gb Network Card: various data - completion * fix reading of input.voltage, related to the ending - ".0", * fix existing commands handling, * add support for the load - segment (managed outlets), including status information and - commands - -2019-09-19 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c: SNMP Eaton - EMP002: handle sensor presence Sensor may not be present (or - connected). However, the values (temperature, humidity, ...) are - still available, but should not be considered - -2022-02-27 Jim Klimov - - * drivers/powerware-mib.c: drivers/powerware-mib.c: update comments - and implem for dummy - eaton_sensor_temperature_unit_fun()/su_temperature_read_fun() from - 42ity/nut - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - update comments and implem for dummy - eaton_sensor_temperature_unit_fun()/su_temperature_read_fun() from - 42ity/nut - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c, - drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups.{c,h}: - adjust su_temperature_read_fun() API to that used in NUT master - branch - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h: drivers/eaton-pdu-marlin-helpers.{c,h}: adjust - eaton_sensor_temperature_unit_fun() API to that used in NUT master - branch - -2019-09-19 Arnaud Quette - - * drivers/eaton-pdu-marlin-helpers.c: SNMP Eaton ePDU: always return - celsius for temperature since the value reading is always adapted - to celsius - -2016-05-25 Jim Klimov - - * drivers/powerware-mib.c: powerware-mib - renamed "ietf_*" and - "eaton_*" lookups to have "pw_*" prefix - -2019-09-12 Arnaud Quette - - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin-mib.c, - drivers/powerware-mib.c, drivers/snmp-ups.c, drivers/snmp-ups.h: - Typo fix: sorry Mr Fahrenheit And thanks to Jim Klimov for the - review! - * drivers/eaton-pdu-marlin-mib.c: Fix compilation warning - -2019-09-09 Arnaud Quette - - * drivers/powerware-mib.c: SNMP Eaton Gb Network Card: support for - EMPDT1H1C2 - -2022-02-27 Jim Klimov - - * drivers/eaton-pdu-marlin-helpers.c: drivers/eaton-pdu-marlin- - helpers.c: fix whitespace - -2017-10-11 Jim Klimov - - * drivers/eaton-pdu-marlin-helpers.c: eaton-pdu-marlin-helpers.c : in - device_count helper do not assume a trailing comma (as last char) - as an extra device - -2019-09-09 Arnaud Quette - - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h, drivers/eaton-pdu-marlin-mib.c: SNMP Eaton ePDU: support - for EMPDT1H1C2 - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: support for - daisychained ambient sensor - -2022-02-27 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - align comments around outlet.%i.name with FTY version - -2017-10-11 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : preferred - templated outlet.%i.name goes last in MIB - -2018-08-07 Jim Klimov - - * drivers/powerware-mib.c: powerware-mib.c : fix fallout from "snmp- - ups: support newer Genepi management cards" (unused variable - warning) - -2018-08-07 Arnaud Quette - - * drivers/powerware-mib.c: snmp-ups: support newer Genepi management - cards * duplicate some OIDs, with refinement to point at the first - index (i.e ".0" or ".1.0") since otherwise the agent doesn't - respond to queries. This could be fixed at the snmp-ups level later - * fixed "ups.type" (power topology of the UPS) which was pointing - at the output.source or ups.mode - -2022-02-27 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - align with "snmp-ups: Simplify the mapping structure" changes for - input.phases=>input.count - -2017-11-17 Arnaud Quette - - * drivers/eaton-ats16-nmc-mib.c, drivers/eaton-pdu-marlin-mib.c, - drivers/mge-mib.c, drivers/mge-xml.c, drivers/powerware-mib.c: - Modify "open" to "opened" for dry contacts status While "open" is - the best adjective for the opposite of "closed", and thus suitable - for GPI status, this may lead to confusion with the GPO actions - "open|close" Vs the GPI status "opened|closed". These last are also - not inapropriate, since they can refer to the fact that the GPI - state has change due to some external action or event - -2017-11-03 Arnaud Quette - - * drivers/eaton-ats16-nm2-mib.c, drivers/eaton-ats16-nmc-mib.c, - drivers/mge-mib.c, drivers/mge-xml.c, drivers/powerware-mib.c: Add - support for dry contacts to Eaton ATS16 and UPS Add support for - the 2 GPI accessible through EMP001 environmental sensor, connected - to a UPS or ATS16. The same is already available for Eaton ePDU. - This affect the snmp-ups driver (eaton_ats16 and pw/pxgx_ups MIBs), - and the netxml-ups driver - -2022-02-25 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: avoid "#if" with possibly - not-defined macro - -2018-08-02 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: Eaton feed color is semi - static - -2018-06-26 Arnaud Quette - - * docs/nut-names.txt, drivers/eaton-pdu-marlin-mib.c: snmp-ups: Eaton - ePDU input.power.nominal is realpower Fix data name, since the - published value is in Watts, so realpower, not power - -2017-10-30 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c/dmf: add - outlet timers Add support for shutdown and start timers - -2022-02-25 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - relocate outlet.%i.load.off.delay etc like in FTY - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - break long lines like in FTY - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - break long lines - -2017-10-17 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: fix Eaton ePDU group - phase handling Remove the not needed SU_FLAG_UNIQUE and the - erroneous value lookup structure index - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h, drivers/eaton-pdu-marlin-mib.c: snmp-ups: simplify Eaton - ePDU group phase handling - -2017-10-11 Jim Klimov - - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h: eaton-pdu-marlin-* : add support for extended fun/nuf - l2s/s2l conversions - -2017-10-13 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : updated - comments about input/feed relationship, and daisychain implications - -2017-10-13 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: Problem: Need to fix published feed - variables Solution: Attach 1 feed to the current input - -2017-10-13 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : fix OID - and raise questions on input.power.nominal - -2017-10-11 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : Revised - added OIDs with a single-group ePDU Also update line-breaks for - readability and 80-col standard - -2017-10-09 Jim Klimov - - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h, drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c / - drivers/eaton-pdu-marlin-helpers.[ch] : Implement conversion func - for "device.count" which returns a comma-separated list - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h, drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c / - drivers/eaton-pdu-marlin-helpers.[ch] : Implement conversion func - for "outlet.group.%i.phase" - * docs/nut-names.txt, drivers/eaton-pdu-marlin-mib.c: eaton-pdu- - marlin-mib.c : add basic listing of newly defined OIDs (not a full - solution - some mapping functions are needed and revision of MIB - data types) - -2017-08-30 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: Fix typo in OID, noticed by aquette - -2017-08-24 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c, drivers/snmp-ups.c, drivers/snmp- - ups.h: snmp-ups / eaton-marlin : introduce WITH_SNMP_LKP_FUN to - separate codebases that support these callbacks from those that - currently do not - * drivers/eaton-pdu-marlin-helpers.c, drivers/eaton-pdu-marlin- - helpers.h: eaton-pdu-marlin-helpers.c/h fix - * drivers/eaton-pdu-marlin-helpers.c: eaton-pdu-marlin-helpers.c : - update comments for marlin_outlet_group_phase_fun() - -2017-08-23 Jim Klimov - - * drivers/Makefile.am, drivers/eaton-pdu-marlin-helpers.c, - drivers/eaton-pdu-marlin-helpers.h: Expel the helper function that - interacts with dstate from eaton-pdu-marlin-mib.c to eaton-pdu- - marlin-helpers.c/.h - -2016-05-13 Jim Klimov - - * drivers/Makefile.am, drivers/apc-iem-mib.h, drivers/apc-mib.c, - drivers/apc-mib.h: drivers/apc-iem-mib.h: split some macro - definitions away from apc-mib.h and apc-mib.c and snmp-ups.c - -2017-10-11 Jim Klimov - - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups.[ch] : introduce - SU_FLAG_SEMI_STATIC - -2022-02-24 Jim Klimov - - * docs/nut.dict: Update nut.dict Update for Adelsystem CBI - -2022-02-24 Jim Klimov - - * NEWS: NEWS: Update synchronous=auto for NUT v2.7.5 - * drivers/dstate.c: drivers/dstate.c: send_to_all(): port - do_synchronous auto=>on fallback from send_to_one() - * drivers/dstate.c: drivers/dstate.c: send_to_one()/send_to_all(): - make the success-report less verbose (level 6) - * drivers/dstate.c: drivers/dstate.c: send_to_one()/send_to_all(): - make the reconnection WARNING more visible - * conf/ups.conf.sample, docs/man/ups.conf.txt, drivers/dstate.c, - drivers/main.c: driver/dstate.c, main.c: extend do_synchronous to - have an "auto" mode (now by default) so reconnections would be sync - * drivers/dstate.c: drivers/dstate.c: send_to_one(): log at level 0 - if write failed (twice maybe) and so driver is disconnecting - * drivers/dstate.c: drivers/dstate.c: send_to_one(): log more details - if throttling down, and if it helped - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): log - "walking device %d" at level 1 now, and without a dot-number (to - avoid confusion) - * drivers/dstate.c: drivers/dstate.c: send_to_one(): try to sleep and - resend failed posting; log the faults (and successes) at level 1 - -2022-02-23 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: send_to_all() send_to_one(): - clarify "disconnecting" when logging that write failed - * drivers/snmp-ups.c: drivers/snmp-ups.c: update comment for - snmp_ups_walk() for "single" device - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): for - "unitary" (non-daisychain member) devices, walk a ".1" device only - (should end up querying non-templated OIDs anyway) - avoid walking - .0 partially and .1 again for same data - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): log - walking an "unitary" device if not a daisy-chain, for balance - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): only log - "Skipping daisychain device.0" when in daisy-chain context (skip - anyway even for singular devices where we should also walk .1 - anyway) - * drivers/snmp-ups.c: drivers/snmp-ups.c: update heading comments for - daisychain related variables - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): only skip - "device.0" if in daisy-chain mode - * drivers/snmp-ups.c: drivers/snmp-ups.c: update comment for - current_device_number - -2022-02-22 Thanos Chatziathanassiou - - * docs/man/socomec_jbus.txt, drivers/Makefile.am, - drivers/socomec_jbus.c: Added socomec_jbus implementation - -2022-02-22 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): fix - taxonomy of "processing daisy-chain device" debug log - -2022-02-19 Jim Klimov - - * drivers/snmp-ups.c, server/upsd.c: drivers/snmp-ups.c - upsdrv_updateinfo(); server/upsd.c driver_free() mainloop(): trace - connection faults and reconnections better - * drivers/dstate.c: drivers/dstate.c: send_to_one(): consistently use - "buflen" - * drivers/dstate.c: drivers/dstate.c: send_to_all/send_to_one: extend - failed-send tracing - -2022-02-19 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: wrap long lines, add - comments - -2022-02-22 Jim Klimov - - * scripts/subdriver/gen-snmp-subdriver.sh: scripts/subdriver/gen- - snmp-subdriver.sh: generate "standard MIB items" into new MIB - mappings Kudos to @aquette for the catch in PR review - -2022-02-21 Luke Dashjr - - * scripts/python/Makefile.am, scripts/python/README, - scripts/python/app/NUT-Monitor.in, scripts/python/app/README, - scripts/python/app/gui-1.3.glade, - scripts/python/app/gui-1.3.glade.h, scripts/python/app/nut- - monitor.desktop, scripts/python/app/ui/aboutdialog1.ui, - scripts/python/app/ui/dialog1.ui, scripts/python/app/ui/dialog2.ui, - scripts/python/app/ui/window1.ui: NUT-Monitor: Port to - Python3+PyQt5 - -2022-02-19 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setOID(): uncomment the - fallback for "device.x.contact" not found as a "contact", and add - another to strip "device.1." => "device." to allow setting non- - templated values to daisy-chain master - * drivers/snmp-ups.c, server/upsd.c: drivers/snmp-ups.c - upsdrv_updateinfo(); server/upsd.c driver_free() mainloop(): trace - connection faults and reconnections better - * drivers/dstate.c: drivers/dstate.c: send_to_one(): consistently use - "buflen" - * drivers/dstate.c: drivers/dstate.c: send_to_all/send_to_one: extend - failed-send tracing - -2022-02-19 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: upsdrv_initups(): check - that there is no daisychain master entry before defining IETF-MIB - fallback defaults for contact/location/description - * drivers/snmp-ups.c: drivers/snmp-ups.c: upsdrv_initups(): comment - and log that IETF-MIB fallback defaults for - contact/location/description are only read once (not updated while - driver runs) - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_ups_get(): fake - current_device_number=1 to su_setinfo() when walking a daisy-chain - with non-templated OID - * drivers/snmp-ups.c: drivers/snmp-ups.c: get_and_process_data(), - su_ups_get(): add tracing logs to make sense of daisy-chain OID - adaptations - * drivers/snmp-ups.c: drivers/snmp-ups.c: wrap long lines, add - comments - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setinfo(): trace diags - for different code-paths about daisy-chained OID decisions - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setinfo(): this is not - the place to check for ".%i" after all - -2022-02-18 Jim Klimov - - * tools/nut-dumpdiff.sh: tools/nut-dumpdiff.sh: revise to also strip - frequency measurements - * tools/nut-dumpdiff.sh: tools/nut-dumpdiff.sh: revise to also strip - (load|temperature|humidity) measurements - * docs/documentation.txt: docs/documentation.txt: document tools/nut- - dumpdiff.sh helper - * tools/nut-dumpdiff.sh: tools/nut-dumpdiff.sh: revise to strip just - numeric measurements of (*.power|voltage|current) - * tools/nut-dumpdiff.sh: tools/nut-dumpdiff.sh: extend to not strip - ALL numeric values but ones that are likely measurements - * tools/Makefile.am, tools/nut-dumpdiff.sh: Add tools/nut-dumpdiff.sh - helper - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setOID(): handle e.g. - "device.contact" as either "device.0.contact" for "all devices" if - OID is templated or NULL, or "device.1.contact" for "master device" - in other cases - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setOID(): import - (commented away - not deemed necessary so far) fallback for e.g. - "device.x.contact" is not found as a "contact" - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setinfo(): fix comment - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix "device.varname" for - daisychain 'master' units * su_setinfo(): should not expose - master-specific data (like device.contact coming from IETF un- - templated data points not aware about daisy chains) as if it were - the data specific to every device in the chain; note that for - defaulted data (like device.type="pdu" hardcoded with NULL OID) we - still expose it across the board * su_setOID(): "upsrw ... - device.contact" should change the daisychain master device (for - IETF un-templated data; but in this commit - always) - -2022-02-17 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_setOID(): fix mis- - interpretation of "device*" as always a daisy-chain - * drivers/snmp-ups.c: drivers/snmp-ups.c: use "hard-coded" IETF MIB - for read-only access to sysDescr also (only if mib2nut does not yet - define a better value) - * drivers/snmp-ups.c: drivers/snmp-ups.c: use "hard-coded" IETF MIB - for read-only access to sysContact and sysLocation only if mib2nut - does not yet define a better value - * drivers/emerson-avocent-pdu-mib.c: drivers/emerson-avocent-pdu- - mib.c: whitespace fix - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - whitespace fix - * drivers/apc-mib.c: drivers/apc-mib: whitespace fix - * drivers/xppc-mib.c: drivers/xppc-mib.c: whitespace fix - * drivers/apc-ats-mib.c, drivers/apc-mib.c, drivers/baytech-mib.c, - drivers/bestpower-mib.c, drivers/compaq-mib.c, drivers/cyberpower- - mib.c, drivers/delta_ups-mib.c, drivers/eaton-ats16-nm2-mib.c, - drivers/eaton-ats16-nmc-mib.c, drivers/eaton-pdu-genesis2-mib.c, - drivers/eaton-pdu-marlin-mib.c, drivers/eaton-pdu-pulizzi-mib.c, - drivers/eaton-pdu-revelation-mib.c, drivers/emerson-avocent-pdu- - mib.c, drivers/hpe-pdu-mib.c, drivers/huawei-mib.c, drivers/ietf- - mib.c, drivers/mge-mib.c, drivers/netvision-mib.c, - drivers/powerware-mib.c, drivers/raritan-pdu-mib.c, - drivers/raritan-px2-mib.c, drivers/xppc-mib.c: drivers/*-mib.c: - define standard-MIB entries for device.description, contact, - location (RW STRING) - -2016-09-16 Arnaud Quette - - * drivers/snmp-ups.h: snmp-ups: update todo list The addition of - sysContact and sysLocation support is now addressed centrally - * drivers/snmp-ups.c: snmp-ups: add sysContact and sysLocation - support The generic MIB-2 provides system contact and location - information that are now publish respectively as device.contact and - device.location - -2022-02-18 Viktor Kuzmin - - * configure.ac: Fix individual drivers configuration - -2022-02-17 Dimitris Economou - - * drivers/adelsystem_cbi.c: handle covered-switch-default and switch- - enum warnings - * drivers/adelsystem_cbi.h: clean up, fix typos - * drivers/adelsystem_cbi.c: clean up, fix typos - * docs/man/Makefile.am, docs/man/adelsystem_cbi.txt: man page added - -2022-02-17 Jim Klimov - - * clients/upscmd.c, clients/upsrw.c: clients/upsrw.c, upscmd.c: fix - sanity-check of tracking_id length (forgot the nul-byte) - * scripts/systemd/nut-driver@.service.in: scripts/systemd/nut- - driver@.service.in: make sure drivers always try to start and - connect - how ever many attempts that takes - * scripts/systemd/nut-driver@.service.in: scripts/systemd/nut- - driver@.service.in: comment about "Before=nut-driver.target" - constraint - * scripts/systemd/nut-driver@.service.in: scripts/systemd/nut- - driver@.service.in: make sure drivers always try to start and - connect - -2022-02-16 Jim Klimov - - * drivers/libhid.c: drivers/libhid.c: string_to_path(): report - hid_lookup_usage() miss - * drivers/libhid.c: drivers/libhid.c: fix misfire of fightwarn commit - 58e5b49 (string_to_path(): range-check...) Closes: #1286 - * conf/upsd.conf.sample, conf/upsmon.conf.sample.in, - docs/man/upsd.conf.txt, docs/man/upsmon.conf.txt: upsd and upsmon - configuration sample files and man pages: add note about run-time - config reload with DEBUG_MIN setting in sight - -2022-02-16 Jim Klimov - - * clients/upsmon.c: clients/upsmon.c: restructure config reload for - debug_min to be more similar to that in upsd.c - * clients/upsmon.c: clients/upsmon.c: whitespace fix - -2022-02-16 Jim Klimov - - * clients/upsmon.c: clients/upsmon.c: allow upsmon to reload config - and apply its debug_min setting - * common/common.c: common/common.c: writepid(): debug-trace creation - of a PID file - -2022-02-16 Jim Klimov - - * scripts/systemd/nut-server.service.in: scripts/systemd/nut- - server.service.in: reload upsd without PID file [for #1299] - * server/conf.c: server/conf.c: allow upsd to reload config and apply - its debug_min setting - * clients/upsmon.c, docs/man/upsmon.txt: clients/upsmon.c: add "-P - pid" arg handling, and report result of sendsignal(), like in upsd - [for #1299, #123] - * docs/man/upsd.txt, scripts/systemd/nut-server.service.in, - server/upsd.c: upsd.c: add -FF option to stay foregrounded AND - write the PID file, use it in systemd/nut-server.service [for - #1299] - * docs/man/upsd.txt, server/upsd.c: server/upsd.c: add "-P PID" arg - for commands [for #1299] - * common/common.c, include/common.h: include/common.h, common.c: - refactor sendsignalfn() into parsepid() and sendsignalpid() - reusable methods - * server/upsd.c: server/upsd.c: warn about not saving a pid file - * server/upsd.c: server/upsd.c: handle extended return values from - sendsignalfn() to tell more about the error - * common/common.c: common/common.c: sendsignalfn(): if we use sig==0 - to probe that a process runs, no need to send that twice - * common/common.c, include/common.h: include/common.h, common.c: - extend sendsignalfn() return value for more error types - -2022-02-15 Jim Klimov - - * drivers/main.c: drivers/main.c: fix user:group separator in debug - message - * configure.ac: configure.ac: report default/detected - RUN_AS_USER/RUN_AS_GROUP values in help; check if "nobody" group is - not resolvable when "nogroup" us to use it as default RUN_AS_GROUP - instead - * drivers/main.c: drivers/main.c: report whether we succeeded or - failed chown/chmod for sockname - * docs/man/nutupsdrv.txt, docs/man/ups.conf.txt, drivers/main.c: - drivers/main.c: support setting group name for socket file - (ups.conf, CLI -g arg) Closes: #1296 - * drivers/dstate.c, drivers/dstate.h, drivers/main.c: drivers/main.c - + dstate.{c,h}: refactor dstate_init() to return a copy of the - "sockname" path used - * drivers/main.c: drivers/main.c: re-word debug message for "-u name" - overriding built-in or configured values - * drivers/main.c: drivers/main.c: trace do_global_args() and - main_arg() var/val stream - * docs/hid-subdrivers.txt: docs/hid-subdrivers.txt: describe tech for - "Fixing report descriptors" - * docs/hid-subdrivers.txt, docs/nut.dict, drivers/hidtypes.h: - docs/hid-subdrivers.txt: document where USAGE_POW_ and USAGE_BAT_ - macros come from - * drivers/apc-hid.c: drivers/apc-hid.c: apc_fix_report_desc(): - normalize indentations - -2022-02-14 Nick Briggs - - * drivers/apc-hid.c: Update APC HID driver version - * drivers/apc-hid.c: Only indicate report descriptor fixed if it was - actually changed. - -2022-02-14 Jim Klimov - - * docs/man/ups.conf.txt, drivers/main.c: drivers/main.c: allow to - specify a user for each driver via ups.conf Closes: #1288 - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: suggest "-d" when warning - about passing debugging through to actual drivers - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: only warn about passing - debugging through to actual drivers if (nut_debug_level_passthrough - == 0) - * docs/man/upsdrvctl.txt, drivers/upsdrvctl.c: drivers/upsdrvctl: add - "-d" option to pass debug level to drivers Closes: #1036 (Note: - that issue discusses other possible improvements around this - subject, which are synergetic with this one) - -2022-02-13 Luke Dashjr - - * scripts/python/app/NUT-Monitor.in: NUT-Monitor: Run py2to3-3.10 - -2022-02-13 Nick Briggs - - * drivers/apc-hid.c, drivers/cps-hid.c, drivers/hidparser.c, - drivers/hidparser.h, drivers/hidtypes.h: Fix incorrect limits for - input and config voltages in APC report descriptor The Back-UPS XS - 1400U has been observed to report input/config voltage limits that - are appropriate for the North American 120V region even though the - unit is operating in the European or other 220+V region. This - change diagnoses the the problem by checking if the logical maximum - values for UPS.Input.Voltage and UPS.Input.ConfigVoltage are - consistent with the UPS.Input.HighVoltageTransfer and if not, - increases them. A similar problem was reported for CPS units in - the EU region. - introduces #defines for all standard usages in - power system and battery device pages. - moves cps-hid.c - FindReport() to hidparser.c as FindObject_with_ID_Node(). - updates - cps-hid.c to account for new defines/function name - adds - apc_fix_report_desc() to implement change for APC UPS units - -2022-02-11 Jim Klimov - - * NEWS: NEWS: added usbhid-ups "ever-hid" subdriver for NUT v2.7.5 - * docs/man/upsd.conf.txt: docs/man/upsd.conf.txt: document - DISABLE_WEAK_SSL - * NEWS, docs/nut.dict: NEWS: announce "debug_min" options for daemons - in NUT v2.7.5 - * NEWS: NEWS: announce fore-/back-grounding options for daemons in - NUT v2.7.5 - * docs/man/upsd.conf.txt: docs/man/upsd.conf.txt: document optional - "DEBUG_MIN" setting - * conf/upsd.conf.sample: conf/upsd.conf.sample: document optional - "DEBUG_MIN" setting - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: document - optional "DEBUG_MIN" setting - * conf/ups.conf.sample: conf/ups.conf.sample: document optional - "debug_min" setting - * docs/man/upsmon.conf.txt: docs/man/upsmon.conf.txt: document - optional "DEBUG_MIN" setting - * docs/man/ups.conf.txt: docs/man/ups.conf.txt: document optional - "debug_min" setting - * server/conf.c, server/conf.h, server/upsd.c: server/upsd.c, conf.c: - support "debug_min" from upsd.conf - * clients/upsmon.c: clients/upsmon.c: support "debug_min" from - upsmon.conf - * drivers/main.c: drivers/main.c: comment typo fixes - * docs/man/upslog.txt: docs/man/upslog.txt: fix typo "upsmon" => - "upslog" - * clients/upslog.c: clients/upslog.c: align -F/-B options with - drivers/main.c - * scripts/systemd/nut-monitor.service.in: scripts/systemd/nut- - monitor.service.in: with daemon not backgrounding, "Type=forking" - no longer applies - * docs/man/upsd.txt: docs/man/upsd.txt: document -F/-B for fore/back- - ground enforcement, and that -D only defaults to foregrounding now - (can be overridden) - * server/upsd.c: server/upsd.c: align -F/-B options with - drivers/main.c - * docs/man/upsmon.txt: docs/man/upsmon.txt: document -F/-B for - fore/back-ground enforcement, and that -D only defaults to - foregrounding now (can be overridden) - * clients/upsmon.c: clients/upsmon.c: align -F/-B options with - drivers/main.c - * docs/man/nutupsdrv.txt: docs/man/nutupsdrv.txt: document -F/-B for - fore/back-ground enforcement, and that -D/-d only default to - foregrounding now (can be overridden) - * drivers/main.c: drivers/main.c: update comments - -2019-03-19 Jim Klimov - - * drivers/main.c: drivers/main.c : rearrange handling of configured - nut_debug_level_global vs nut_debug_level_driver vs ultimately used - nut_debug_level - * drivers/main.c: driver/main.c : separate toggles for driver - debugging and backgrounding - -2019-03-18 Jim Klimov - - * drivers/main.c: drivers/main.c : allow to configure debug_min=NUM - to ease service debugging - -2022-02-11 Dimitris Economou - - * drivers/adelsystem_cbi.c, drivers/adelsystem_cbi.h: coding style - changes - -2022-02-10 Jim Klimov - - * .github/pull_request_template.md: .github/pull_request_template.md: - remind to update recipes for new man pages - -2022-02-11 Dimitris Economou - - * drivers/adelsystem_cbi.c: fix parameter hiding global variable - -2022-02-10 Jim Klimov - - * configure.ac: configure.ac: avoid noise about pkg-config not - finding (lib)systemd.pc on systems where it is not installed - * configure.ac: configure.ac: default to detection of - systemdsystemunitdir (and systemdshutdowndir) - "auto" is not a - final option - * configure.ac, docs/configure.txt: configure.ac: default to - detection of systemdsystemunitdir (and systemdshutdowndir), non- - fatal if not found - * configure.ac: configure.ac: fall back from pkg-config queries for - "systemd" to try also "libsystemd" - fix calling "test" - -2022-02-10 Nick Geoghegan - - * drivers/riello_usb.c: Fixes formatting in riello_usb - * drivers/riello_ser.c: Updates riello_ser to version 0.07 - -2022-02-10 Jim Klimov - - * configure.ac: configure.ac: fall back from pkg-config queries for - "systemd" to try also "libsystemd" - * docs/man/Makefile.am: docs/man/Makefile.am: build and install - nutdrv_siemens_sitop man pages - -2022-02-09 Nick Geoghegan - - * drivers/riello_usb.c: Fixes 530 - -2022-02-09 Jim Klimov - - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - rename non-standard dstate variables to "experimental.*" namespace - Closes: NUT issue #1045 - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - fix "ups.delay.return" => "ups.delay.start" - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - whitespace fixes (some long lines) - * docs/packager-guide.txt: docs/packager-guide.txt: update for nut- - linux-i2c and nut-macosx-ups platform-dependent package groups - * docs/packager-guide.txt: docs/packager-guide.txt: fix title for - pkg-nut-modbus - * drivers/ever-hid.c: drivers/ever-hid.c: tag non-standard NUT - variable/command names as "experimental.*" to help identify lacking - mappings and rename some into standard data points - * drivers/ever-hid.c, drivers/ever-hid.h: drivers/ever-hid.{c,h}: - update (C) heading - * drivers/ever-hid.c: drivers/ever-hid.c: print unsigned int as %u - * drivers/ever-hid.c: drivers/ever-hid.c: mark - NUT_UNUSED_VARIABLE(double value) where appropriate - * drivers/ever-hid.c: drivers/ever-hid.c: use complete struct - initializers for info_lkp_t tables; use sentinels; mark static - * drivers/ever-hid.c: drivers/ever-hid.c: ever_alarms_fun(), - ever_workmode_fun(): define "workmode" on top of function - * drivers/ever-hid.c: drivers/ever-hid.c: fix switch/case whitespaces - * drivers/ever-hid.c: drivers/ever-hid.c: fix trailing whitespaces - * drivers/ever-hid.c: drivers/ever-hid.c: wrap some long lines for - readability - * drivers/ever-hid.c: drivers/ever-hid.c: adjust to upstream changes: - config.h goes first, PID/VID are unsigned, got a fix_report_desc() - default - * drivers/everups.c: drivers/everups.c: whitespace fixes; clarify - this is a serial driver (as opposed to ever-hid.c for USB devices) - -2022-02-08 Dimitris Economou - - * drivers/adelsystem_cbi.h: check ifndef READALL_REGS - * drivers/adelsystem_cbi.c: minor fix in upsdrv_updateinfo - * drivers/adelsystem_cbi.c, drivers/adelsystem_cbi.h: fix warning for - initializing structure with flexible array member - -2022-02-08 Jim Klimov - - * configure.ac: configure.ac: error out for unhandled --with- - drivers=xxx names - * configure.ac: configure.ac: improve handling of platform-dependent - (linux-i2c, macosx) drivers - do not default to require them - everywhere - * configure.ac: configure.ac: move --with-drivers=... handling to - before --with-all, and consult drivers/Makefile.am for list names - to require certain dependencies - * drivers/Makefile.am: drivers/Makefile.am: parameterize - POWERMAN_DRIVERLIST and IPMI_DRIVERLIST like others - * configure.ac: configure.ac: move "--with-drivers=name[,name...]" - handling to before we check for third-party dependencies - * clients/upssched.c: clients/upssched.c: sendcmd(): rectify - enclen/buflen sanity checks and usage - * clients/upssched.c: clients/upssched.c: whitespace and comment - fixes - -2022-02-07 Dimitris Economou - - * clients/upssched.c: fix code alignemnt, casting sizeof with ssize_t - -2022-02-07 Jim Klimov - - * scripts/subdriver/gen-usbhid-subdriver.sh: gen-usbhid-subdriver.sh: - suggest "fix_report_desc" in subdriver_t (follow-up to PR #1245) - -2022-02-06 Jim Klimov - - * docs/packager-guide.txt: docs/packager-guide.txt: mention ipmi and - modbus drivers as separate packaging goals - -2022-02-06 Dimitris Economou - - * clients/upssched.c: check zero bytes read from O_NDELAY socket - * clients/upssched.c: fix enc size write on pipeifd, fix parent - select on child's pipefd - * drivers/Makefile.am: adelsystem_cbi header filename fix - -2022-02-05 Jim Klimov - - * docs/nut.dict, docs/support.txt: docs/support.txt: detail abot - GitHub issues and PRs, and IRC channel - * drivers/al175.c, drivers/apc-ats-mib.c, drivers/apc-hid.c, - drivers/apc-mib.c, drivers/apc-pdu-mib.c, drivers/apcsmart-old.c, - drivers/apcsmart.h, drivers/apcupsd-ups.c, drivers/arduino-hid.c, - drivers/asem.c, drivers/baytech-mib.c, drivers/bcmxcp.c, - drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c, drivers/belkin-hid.c, - drivers/belkin.c, drivers/belkinunv.c, drivers/bestfcom.c, - drivers/bestfortress.c, drivers/bestpower-mib.c, - drivers/bestuferrups.c, drivers/bestups.c, drivers/blazer_ser.c, - drivers/blazer_usb.c, drivers/clone-outlet.c, drivers/clone.c, - drivers/compaq-mib.c, drivers/cps-hid.c, drivers/cyberpower-mib.c, - drivers/delta_ups-hid.c, drivers/delta_ups-mib.c, drivers/dummy- - ups.c, drivers/eaton-ats16-nm2-mib.c, drivers/eaton-ats16-nmc- - mib.c, drivers/eaton-ats30-mib.c, drivers/eaton-pdu-genesis2-mib.c, - drivers/eaton-pdu-marlin-mib.c, drivers/eaton-pdu-pulizzi-mib.c, - drivers/eaton-pdu-revelation-mib.c, drivers/emerson-avocent-pdu- - mib.c, drivers/etapro.c, drivers/everups.c, drivers/explore-hid.c, - drivers/gamatronic.c, drivers/generic_modbus.c, - drivers/genericups.c, drivers/hpe-pdu-mib.c, drivers/huawei-mib.c, - drivers/huawei-ups2000.c, drivers/idowell-hid.c, drivers/ietf- - mib.c, drivers/isbmex.c, drivers/ivtscd.c, drivers/legrand-hid.c, - drivers/libshut.c, drivers/libusb0.c, drivers/libusb1.c, - drivers/liebert-esp2.c, drivers/liebert-hid.c, drivers/liebert.c, - drivers/macosx-ups.c, drivers/masterguard.c, drivers/metasys.c, - drivers/mge-hid.c, drivers/mge-mib.c, drivers/mge-utalk.c, - drivers/microdowell.c, drivers/microsol-apc.c, drivers/netvision- - mib.c, drivers/netxml-ups.c, drivers/nut-ipmipsu.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/nutdrv_siemens_sitop.c, drivers/oneac.c, drivers/openups- - hid.c, drivers/optiups.c, drivers/phoenixcontact_modbus.c, - drivers/pijuice.c, drivers/powercom-hid.c, drivers/powercom.c, - drivers/powerman-pdu.c, drivers/powerpanel.c, drivers/powervar- - hid.c, drivers/powerware-mib.c, drivers/raritan-pdu-mib.c, - drivers/raritan-px2-mib.c, drivers/rhino.c, drivers/richcomm_usb.c, - drivers/riello_ser.c, drivers/riello_usb.c, drivers/safenet.c, - drivers/salicru-hid.c, drivers/skel.c, drivers/snmp-ups.c, - drivers/solis.c, drivers/tripplite-hid.c, drivers/tripplite.c, - drivers/tripplite_usb.c, drivers/tripplitesu.c, drivers/upscode2.c, - drivers/usbhid-ups.c, drivers/victronups.c, drivers/xppc-mib.c: - drivers: bump versions for all drivers, they could have been - refactored during fightwarn (so might add regressions) without - regard to versioning - * UPGRADING: NEWS: plea to package maintainers to share their - customizations into common uptream - * docs/documentation.txt, docs/nut.dict: documentation.txt: add a - blog by James Ridgway - * docs/documentation.txt: documentation.txt: update with a link to - video by Techno Tim - * docs/documentation.txt: developers.txt: "trac" is AWOL, update the - link to github wiki copy - * docs/developers.txt: developers.txt: "alioth" is AWOL, update the - text - * docs/download.txt: download.txt: "trac" and "alioth" are AWOL, - update the links - -2022-02-05 Dimitris Economou - - * drivers/adelsystem_cbi.c: apply Jim's modbus changes on PR #1239 - -2022-01-23 Jim Klimov - - * ci_build.sh: ci_build.sh: fix CI_FAILFAST to abort after failed - configure scripts - -2022-01-27 Jim Klimov - - * drivers/snmp-ups.c: Revert "drivers/snmp-ups.c: replace - strcmp("short string") with strncmp() (clang-3.4 warns about array - out of bounds)" This reverts commit - d2f7193af42e987f7948e072a963dc7bb1e25dc1. Currently the configure - script should properly avoid the built-in strcmp() versions which - upset current build compiler. Using the range-limited strncmp() has - a downside of matching start-of-string. - * drivers/snmp-ups.c: Revert "drivers/snmp-ups.c: fix strncmp() - limits for "v1" and "v3" checks (copy-pasting typo)" This reverts - commit d0d02d3a70c6544c8ea7868dd63738595f2ae657. Currently the - configure script should properly avoid the built-in strcmp() - versions which upset current build compiler. Using the range- - limited strncmp() has a downside of matching start-of-string. - * clients/upsclient.c, clients/upslog.c, clients/upsmon.c, - clients/upsrw.c, clients/upssched.c, clients/upsset.c, - common/state.c, common/upsconf.c, docs/developers.txt, - docs/nut.dict, drivers/apcsmart-old.c, drivers/apcsmart.c, - drivers/apcupsd-ups.c, drivers/belkin.c, drivers/belkinunv.c, - drivers/bestups.c, drivers/clone-outlet.c, drivers/clone.c, - drivers/dstate.c, drivers/gamatronic.c, drivers/huawei-ups2000.c, - drivers/main.c, drivers/masterguard.c, drivers/mge-utalk.c, - drivers/mge-xml.c, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_bestups.c, drivers/nutdrv_qx_blazer-common.c, - drivers/nutdrv_qx_voltronic-qs-hex.c, drivers/nutdrv_qx_voltronic- - qs.c, drivers/nutdrv_qx_voltronic.c, drivers/oneac.c, - drivers/powercom.c, drivers/powerman-pdu.c, drivers/powerp-txt.c, - drivers/snmp-ups.c, drivers/tripplite_usb.c, drivers/upscode2.c, - drivers/victronups.c, server/conf.c, server/netget.c, - server/netlist.c, server/netset.c, server/user.c, - tests/cpputest.cpp, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/scan_snmp.c: Revert "Replace strcmp() and strcasecmp() use- - cases for short fixed string args by strncmp() and strncasecmp() - respectively" This reverts commit - a0d5ad57956ebcb5878744acb7657e1356ba0ea8. Currently the configure - script should properly avoid the built-in strcmp() versions which - upset current build compiler. Using the range-limited strncmp() has - a downside of matching start-of-string. - * drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: Revert - "tools/nut-scanner/scan_snmp.c, drivers/snmp-ups.c: strcmp() - shorter "SHA" and "AES" and check this is all of the string length" - This reverts commit 57182d51b2954e6b7bb5199f658f38a89ce93648. - Currently the configure script should properly avoid the built-in - strcmp() versions which upset current build compiler. Using the - range-limited strncmp() has a downside of matching start-of-string. - -2022-01-23 Jim Klimov - - * NEWS, UPGRADING: NEWS, UPGRADING: snmp-ups.h flags (bit-mask - macros) changed for NUT v2.7.5 - * drivers/snmp-ups.h: drivers/snmp-ups.h: mib2nut mappings with - "zero" flag value are not illegal - -2022-01-18 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: mib2nut mappings with - "zero" flag value are not illegal Do not yell about them like it's - a bug, after all. - -2022-01-23 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: redefine bit-flags macros - so they do not overlap (and update some helper-masking macros) - follows up on issue from PR #1177 and aligns with ultimately DMF - (42ity fork) tested changes to help merge that later with less - effort - -2021-11-22 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: update mask for - SU_TYPE_DAISY() and comments for it and SU_DAISY - -2021-11-13 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: report if an snmp_info[] - entry flag was not defined (is 0) - * drivers/snmp-ups.h: drivers/snmp-ups.h: redefine bit-flags macros - so they do not overlap (and some helper-masking macros) [follow up - on issue from PR #1177] - -2022-01-22 Jim Klimov - - * NEWS: NEWS: drop chapters for "PLANNED NEWS" for releases after - v2.7.5 - * UPGRADING: UPGRADING: highlight libusb-1.0 in NUT v2.7.5 - -2022-01-21 Jim Klimov - - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - "libssl-dev" name is more popular nowadays than "openssl-dev" - (Debian and family) - * docs/nut.dict: docs/nut.dict: update for Armac subdriver NEWS - * data/driver.list.in: data/driver.list.in: add PiJuice HAT (big) and - pHAT (Zero) - -2022-01-20 Jim Klimov - - * drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: tools/nut- - scanner/scan_snmp.c, drivers/snmp-ups.c: strcmp() shorter "SHA" and - "AES" and check this is all of the string length Alternative: move - matching to end of stack - * NEWS: NEWS: prepare for nutdrv-qx armac merge in 2.7.5 timeline - * NEWS: NEWS: added usbhid-ups fix_report_desc() for NUT v2.7.5 - * NEWS: NEWS: added powercom "nobt" option for NUT v2.7.5 - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): - accomodate "usb_ctrl_charbuf" and formatting changes for libusb-1.0 - support - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): mark as - static method - * drivers/nutdrv_qx_ablerex.c: drivers/nutdrv_qx_ablerex.c: - ablerex_process_status_bits(): mark as static method - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: ablerex_command(): - accomodate "usb_ctrl_charbuf" and formatting changes for libusb-1.0 - support - * ci_build.sh: ci_build.sh: make distcheck (pun intended) less noisy - * ci_build.sh: ci_build.sh: comment a suggestion how to use - BUILD_TYPE=fightwarn typically - * ci_build.sh: ci_build.sh: make distcheck (pun intended) less noisy - * ci_build.sh: ci_build.sh: comment a suggestion how to use - BUILD_TYPE=fightwarn typically - -2022-01-20 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): use - nut_usb_strerror(ret) Match updated libusb-1.0/0.1 API in NUT - master - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Fix nut_usb_strerror(ret) - for new libusb-1.0/0.1 support in master branch - -2022-01-19 Jim Klimov - - * drivers/legrand-hid.c: Update legrand-hid.c Initialize - "fix_report_desc", this file appeared from another PR merged before - #1245 - -2022-01-19 Jim Klimov - - * ci_build.sh: ci_build.sh: provision check_gitignore() calls for DMF - branch build products - * ci_build.sh: ci_build.sh: check_gitignore(): wrap long lines - * ci_build.sh: ci_build.sh: check_gitignore(): add a FILE_GLOB - support - * ci_build.sh: ci_build.sh: optional_dist_clean_check(): copypasta - error, GIT_ARGS not needed in this one - * ci_build.sh: ci_build.sh: fix "MAKE distclean" operations back to - not-quiet, they look weird as a half-muted wall of text - * ci_build.sh: ci_build.sh: fix use of git status $GIT_ARGS - consistently - * drivers/snmp-ups.c: drivers/snmp-ups.c: match_sysoid(): test for - NULL mib2nut[i]->snmp_info (and skip if so) - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): imply that - skipped value is not a "valid" name in the mapping table (name may - be known, but with no snmp_info attached) - -2022-01-18 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: handle not-loaded snmp_info - without segfaulting - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): better - tracing of mib_name comparisons - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): test for - NULL mib2nut[i]->snmp_info (and skip if so) before accounting - mibSeen=TRUE and trying to match_model_OID() - -2022-01-18 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: delete duplicates after - rebase - * drivers/{adele_cbi.c => adelsystem_cbi.c}, drivers/{adele_cbi.h => - adelsystem_cbi.h}: rename after rebase - * drivers/{adelsystem_cbi.c => adele_cbi.c}, - drivers/{adelsystem_cbi.h => adele_cbi.h}: rename for rebase - -2022-01-13 Dimitris Economou - - * drivers/adelsystem_cbi.c: try to reconnect on IVALID DATA and - INVALID CRC from read_all_regs - * drivers/adelsystem_cbi.c: try to reconnect on INVALID DATA and - INVALID CRC errors - * drivers/adele_cbi.c, drivers/adele_cbi.h, - drivers/adelsystems_cbi.c, drivers/adelsystems_cbi.h: delete - renamed driver files - * drivers/Makefile.am, drivers/adelsystem_cbi.c, - drivers/adelsystem_cbi.h: filename fixes - * drivers/Makefile.am, drivers/adelsystems_cbi.c, - drivers/adelsystems_cbi.h: adele changed to adelsystems - * drivers/adele_cbi.c, drivers/adele_cbi.h: macro name changes - * drivers/adele_cbi.c, drivers/adele_cbi.h: minor bug fixes - * drivers/adele_cbi.h: modify regs_data memory, devreg enum - rearrangement - -2022-01-12 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: some fixes in - read_all_regs approach - * drivers/adele_cbi.c, drivers/adele_cbi.h: read_all_regs aproach - integrated - -2022-01-11 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: ghost alarms bug fix, - other bug fixes - -2022-01-10 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: first testing release - -2022-01-09 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: alrm_t, alrm_ar_t data - structures, construction of upsdrv_updateinfo in progress - -2022-01-08 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: structure device data, - code get_dev_state, in progress - -2022-01-07 Dimitris Economou - - * drivers/adele_cbi.h: register status values and masks added - -2022-01-06 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: under construction - -2022-01-11 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: ghost alarms bug fix, - other bug fixes - -2022-01-10 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: first testing release - -2022-01-09 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: alrm_t, alrm_ar_t data - structures, construction of upsdrv_updateinfo in progress - -2022-01-08 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: structure device data, - code get_dev_state, in progress - -2022-01-07 Dimitris Economou - - * drivers/adele_cbi.h: register status values and masks added - -2022-01-06 Dimitris Economou - - * drivers/Makefile.am: Makefile.am modifications - * drivers/adele_cbi.c, drivers/adele_cbi.h: under construction - -2022-01-18 Dimitris Economou - - * drivers/{adelsystem_cbi.c => adele_cbi.c}, - drivers/{adelsystem_cbi.h => adele_cbi.h}: rename for rebase - -2022-01-18 Jim Klimov - - * drivers/usbhid-ups.h: drivers/usbhid-ups.h: rename pDesc arg to - match wording in usbhid-ups.c - * drivers/hidparser.c, drivers/hidparser.h: drivers/hidparser.{c,h}: - rename pDesc arg/var to avoid shadowing a global variable Pre- - emptively: `extern pDesc` is defined in libhid.h which does not - seem to be used in/along-with hidparser.{c,h} currently - but this - collision may happen later (especially with code-copying around). - * drivers/cps-hid.c: drivers/cps-hid.c: clean up trailing whitespaces - * drivers/cps-hid.c: drivers/cps-hid.c: FindReport() - cps_fix_report_desc(): rename pDesc arg to avoid shadowing a global - variable - * drivers/cps-hid.c: drivers/cps-hid.c: mark non-exported - FindReport() as static - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: enhance - NUT_CHECK_COMPILE_FLAG() to run the whole toolchain for "build and - run" when checking CLI option support - * ci_build.sh: ci_build.sh: build_to_only_catch_errors_target(): - CI_PARMAKE_VERBOSITY=silent should not hide warnings - * ci_build.sh: ci_build.sh: do not silent-make initial clean-up (it - is chatty anyway, so let us see the dirs processed) - * ci_build.sh: ci_build.sh: comment verbosity (non-)tweaks for builds - without a BUILD_TYPE - * ci_build.sh: ci_build.sh: report around initial clean-up for - clearer log reading - * ci_build.sh: ci_build.sh: refactor with check_gitignore() - * ci_build.sh: ci_build.sh: refactor ccache_stats() - * ci_build.sh: ci_build.sh: refactor make-verbosity settings and - adjust some for default builds to store less log - -2022-01-18 Jim Klimov - - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: avoid - SIGSEGV in libusb-1.0 when running as non-root and device fails to - open (e.g. perms error) - -2022-01-17 Jim Klimov - - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - report in usage() if "library not detected" for a scan option - -2022-01-17 Jim Klimov - - * drivers/generic_modbus.c: drivers/generic_modbus.c: address - -Wmissing-field-initializers complaints for timeval with timeouts - (memset to 0 instead) - * drivers/generic_modbus.c: drivers/generic_modbus.c: address - -Wstrict-prototypes complaints - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: raise the bar for - code quality non-regression, to fail on any (new) warnings in - master branch and PRs to it - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: shut back the - cppcheck-by-default - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: do not allow to - disable delayedIssueAnalysis on "stable branches" - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: enable cppcheck - slowBuild stages generally, not just for "fightwarn" branches - -2022-01-16 Jim Klimov - - * configure.ac: configure.ac: adjust test structure for both built-in - ntohl/htonl and string built-ins (using explicit -Werror -Wno-... - checks) - * configure.ac: configure.ac: adjust test structure for built-in - ntohl/htonl to be similar to that for string built-ins (using - explicit -Werror) - * ci_build.sh: ci_build.sh: do not lose original LDFLAGS - -2022-01-15 Jim Klimov - - * configure.ac: configure.ac: tweak LIBLTDL_CFLAGS same as - LIBNETSNMP_CFLAGS for -Wno-shadow if needed for string methods or - htonl() etc In some builds of the NUT CI farm dynamatrix (possibly - ones without SNMP support), the nutscan-ip.c complains about - "declaration shadows a local variable" -- investigation of which - leads into the macros expanded for common method names on those - systems and/or compiler toolkit versions. This PR hopes to avoid - that situation more extensively. - -2022-01-14 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: treat DISABLE_MIB_LOADING - more safely - -2022-01-14 Jim Klimov - - * tests/cpputest.cpp, tests/example.cpp, tests/nutclienttest.cpp: - tests/*.cpp: mark overridden class methods as such - * clients/nutclient.h, clients/nutclientmem.h: clients/nutclient.h + - nutclientmem.h: mark overridden class methods as such - -2022-01-13 Jim Klimov - - * configure.ac: configure.ac: adjust test for built-in string - functions (problematic on clang-3.4) to see any warnings and - specifically for unreachable code there - * ci_build.sh: ci_build.sh: relay more build-influencing envvars in - the (Jenkins-logged) printout - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: fix the - range-check and message/comment it better - * drivers/asem.c: drivers/asem.c: macro ACCESS_DEVICE() ends with a - brace; we HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT to - keep the useless trailing ";" for readability - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: add - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT(_BESIDEFUNC) - * drivers/asem.c: drivers/asem.c: declare upsdrv_shutdown() as - noreturn - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: avoid including usb- - common.h twice - -2022-01-13 Dimitris Economou - - * drivers/adelsystem_cbi.c: try to reconnect on IVALID DATA and - INVALID CRC from read_all_regs - * drivers/adelsystem_cbi.c: try to reconnect on INVALID DATA and - INVALID CRC errors - -2022-01-13 Jim Klimov - - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: ask CLANG to reject unknown - pragmas when checking for them - * common/common.c: common/common.c: check for - HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN - support before use - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: test specifically for HAVE_ - PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN(_BESIDEFUNC - ) support - -2022-01-13 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h, - drivers/adelsystems_cbi.c, drivers/adelsystems_cbi.h: delete - renamed driver files - * drivers/Makefile.am, drivers/adelsystem_cbi.c, - drivers/adelsystem_cbi.h: filename fixes - * drivers/Makefile.am, drivers/adelsystems_cbi.c, - drivers/adelsystems_cbi.h: adele changed to adelsystems - * drivers/adele_cbi.c, drivers/adele_cbi.h: macro name changes - * drivers/adele_cbi.c, drivers/adele_cbi.h: minor bug fixes - * drivers/adele_cbi.h: modify regs_data memory, devreg enum - rearrangement - -2022-01-12 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: some fixes in - read_all_regs approach - * drivers/adele_cbi.c, drivers/adele_cbi.h: read_all_regs aproach - integrated - -2022-01-12 Jim Klimov - - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: set default - C/C++ standards to GNU dialects for GCC/CLANG - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: set default - C/C++ standards to avoid C90-non-compliance warnings noise (on - compilers that can do better than that) - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: fix a test - from shell to autoscript - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - only evaluate if NUT_HAVE_LIBNETSNMP_* when we build WITH_SNMP - * common/common.c: common/common.c: use - HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: add HAVE_PRAGMA_GCC_DIAGNOS - TIC_IGNORED_UNREACHABLE_CODE_RETURN(_BESIDEFUNC) - * configure.ac, m4/nut_compiler_family.m4: m4/nut_compiler_family.m4 - + configure.ac: refactor NUT_COMPILER_FAMILY_FLAGS_DEFAULT_STANDARD - as a separate method to apply just before we set up warning-level - support - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - update dependency package naming for libusb-1.0 on Debian family - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: set default - C/C++ standards to GNU dialects for GCC/CLANG - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: set default - C/C++ standards to avoid C90-non-compliance warnings noise (on - compilers that can do better than that) - * ci_build.sh: ci_build.sh: comment why ./configure is not without - args - -2022-01-11 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: ghost alarms bug fix, - other bug fixes - -2022-01-10 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: first testing release - -2022-01-09 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: alrm_t, alrm_ar_t data - structures, construction of upsdrv_updateinfo in progress - -2022-01-08 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: structure device data, - code get_dev_state, in progress - -2022-01-07 Dimitris Economou - - * drivers/adele_cbi.h: register status values and masks added - -2022-01-06 Dimitris Economou - - * drivers/Makefile.am: Makefile.am modifications - * drivers/adele_cbi.c, drivers/adele_cbi.h: under construction - -2021-09-23 Jim Klimov - - * drivers/generic_modbus.c: drivers/generic_modbus.{c,h}: fix - whitespace style (original fix from master branch) - -2022-01-12 Jim Klimov - - * drivers/generic_modbus.c: drivers/generic_modbus.c: fix whitespace - style (in PR-1239) - -2022-01-12 Arnaud Quette - - * drivers/mge-xml.c: Eaton NMC: fix the non publication of real/power - with 3ph power and realpower for 3ph Lx were not publishing values - when they were 0 - -2022-01-11 Dave Williams - - * drivers/cps-hid.c: New HID fix strategy after consultation with CPS - It appears both input and output LogMin and LogMax values are - incorrect as the rated voltage (for EU models) is 170v to 270v - which is outside the logical limits reported by the HID. The fix - checks for the error (loosely) and then applies reasonable values - (0v and 511v) to allow the actual input and output voltages to be - reported rather than be constrained to the limits. - -2022-01-11 Jim Klimov - - * drivers/arduino-hid.c, drivers/delta_ups-hid.c, - drivers/hidparser.c, drivers/idowell-hid.c, drivers/powervar-hid.c, - drivers/salicru-hid.c: drivers/hidparser.c + *-hid.c: include - "config.h" first - -2022-01-11 Jim Klimov - - * docs/nut.dict: Update nut.dict Updated for PR - https://github.com/networkupstools/nut/pull/1256 - -2022-01-11 Jim Klimov - - * drivers/generic_modbus.c: drivers/generic_modbus.c: handle the two - APIs for libmodbus timeout setting - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: in tests for - API, the AC_DEFINE must be used with exact macro names (not - m4/shell variables) - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: in tests for - API, clarify if old API (timeval) can be used with variables from - new API (uint32) set into the struct - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: in tests for - API, "new/old" comments were confused - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: in tests for - API, initialize modbus_t *ctx differently - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: test actively - for the modbus timeout API (count and type of args used) - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: convert a - code block from plain shell to autoscript - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: test for - presence of modbus_set_byte_timeout() and - modbus_set_response_timeout() - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: detect support for - (ignoring) "-Wsign-conversion" - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: add guards to call - AX_C_PRINTF_STRING_NULL and AX_C_PRAGMAS logic only once - * drivers/generic_modbus.c: drivers/generic_modbus.c: bump - DRIVER_VERSION for feature change (connection timeout handling) - -2022-01-10 Ablerexsoftware - - * data/driver.list.in: update the driver.list.in - -2022-01-11 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: ghost alarms bug fix, - other bug fixes - -2022-01-10 Jim Klimov - - * docs/man/powercom.txt: Update powercom.txt Sentence restructure - -2022-01-10 Jim Klimov - - * .github/pull_request_template.md: pull_request_template.md: update - and reshuffle check-list items - * .../{PULL_REQUEST_TEMPLATE/nut-driver-PR.md => - pull_request_template.md}: Move fancy-named PR template to plain - .github/pull_request_template.md - * drivers/salicru-hid.c, scripts/upower/95-upower-hid.rules: - drivers/salicru-hid.c: add known compatibility for Salicru SLC TWIN - (PRO2, PRO3, RT3) per reports in issue #1142 - * data/driver.list.in: data/driver.list.in: add known compatibility - for Salicru TWIN (PRO2, PRO3, RT3) per reports in issues #450 and - #1142 - * .github/PULL_REQUEST_TEMPLATE/nut-driver-PR.md: Add - .github/PULL_REQUEST_TEMPLATE/nut-driver-PR.md template - -2022-01-10 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: first testing release - -2022-01-10 Jim Klimov - - * data/driver.list.in: data/driver.list.in: fix English typos in - comment - * docs/developers.txt: docs/developers.txt: remind to update - docs/acknowledgements.txt when adding vendor-backed support - * docs/man/usbhid-ups.txt: docs/man/usbhid-ups.txt: fix reference to - data/driver.list (typo in filename) - -2022-01-09 Rouben Tchakhmakhtchian - - * docs/man/powercom.txt, drivers/powercom.c: Powercom driver - (drivers/powercom.c) version bump from 0.17 to 0.18: * Implement - configuration flag "nobt" to skip battery test during - initialization * Cleanup old code to use testvar() for config - parameter checks in upsdrv_initups() * Add nobt flag to sample - config file in built-in doc Powercom driver man page - (docs/man/powercom.txt) update to explain nobt flag - -2022-01-09 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: alrm_t, alrm_ar_t data - structures, construction of upsdrv_updateinfo in progress - -2022-01-08 Dimitris Economou - - * drivers/adele_cbi.c, drivers/adele_cbi.h: structure device data, - code get_dev_state, in progress - -2022-01-07 Jim Klimov - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: be sure to have - PATH_MAX defined (for usb.h that did not bother by itself) - * drivers/usb-common.h: drivers/usb-common.h: be sure to have - PATH_MAX defined (for usb.h that did not bother by itself) - -2022-01-07 Dimitris Economou - - * drivers/adele_cbi.h: register status values and masks added - -2022-01-06 Jim Klimov - - * Jenkinsfile-dynamatrix: Revert "Jenkinsfile-dynamatrix: be sure to - reset slowBuild configs over dynacfgBase" This reverts commit - 18cf19ebc7e01f30c3d84c7b3b8f69e961429ebb as the "design flaw" which - that change worked around should now be (hopefully) fixed in the - jenkins-fynamatrix library itselg. - -2022-01-06 Dimitris Economou - - * drivers/Makefile.am: Makefile.am modifications - * drivers/adele_cbi.c, drivers/adele_cbi.h: under construction - -2022-01-05 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: fix - dynamatrixAxesCommonEnvCartesian cases to group the variables we - apply as one bunch, not as several separate hits - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: define - dynacfgPipeline.excludeCombos_DEFAULT (mismatched ARCHes only) - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - avoid implicit case fallthrough - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: be sure to reset - slowBuild configs over dynacfgBase - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: avoid running - "cppcheck" several times per host - -2022-01-04 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: reinstate - excludeCombos for autotools-only builds (fightwarn) to avoid - unsupported ARCH-bits mix builds - -2022-01-02 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: fix "Default - autotools driven build with default warning levels (gnu99/gnu++11)" - dynamatrixAxesVirtualLabelsMap mergeMode from "merge" to "replace" - (want to only build listed scenarios, not everything possible in - the matrix) - -2021-12-30 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: avoid using - undefined (null) excludeCombos_DEFAULT - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: fix references to - excludeCombos: ... axisCombos_COMPILER_(NOT_)GCC - -2022-01-05 Jim Klimov - - * m4/nut_check_cppcheck.m4: m4/nut_check_cppcheck.m4: relax required - tool version for cppcheck*.xml generation - * Makefile.am: Makefile.am: fix dependencies for cppcheck*.xml - generation - -2022-01-04 Dimitris Economou - - * drivers/generic_modbus.c: comment and code alignment fixes - -2022-01-03 Jim Klimov - - * ci_build.sh: ci_build.sh: set DO_CLEAN_CHECK=no for default- - tgt:cppcheck or docs-building scenarios by default, so we can - get/archive those costly media files - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: set - DO_CLEAN_CHECK=no for default-tgt:cppcheck scenarios, so we can get - that analysis data - -2021-12-30 Jim Klimov - - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - include config.h first - -2021-12-30 Jim Klimov - - * docs/developers.txt, docs/nut.dict: docs/developers.txt: update - about C89/GNU89 support (with GCC toolkit) - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: separate - C89/C90/ANSI builds with GCC (can actually pass strict and GNU - modes) and CLANG (more pedantic) - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: typo fix for - disableSlowBuildCIBuildExperimentalANSI - -2021-12-30 Jim Klimov - - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: do not test - for "-fcolor-diagnostics" - redundant for clang, and sometimes - toxic for gcc - * drivers/Makefile.am: drivers/Makefile.am: snmp-ups uses fabsf() so - needs libm - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: include - config.h first - * drivers/microsol-apc.c: drivers/microsol-apc.c: include config.h - first - * drivers/genericups.c: drivers/genericups.c: include config.h first - * include/nut_stdint.h: include/nut_stdint.h: define SSIZE_MAX if - missing - * drivers/serial.h: drivers/serial.h: pull more includes - -2021-12-30 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am: metasys uses fabsf() so - needs libm - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix comments to C-style - * drivers/powercom.c: drivers/powercom.c: fix comments to C-style - * drivers/microdowell.h: drivers/microdowell.h: fix comments to - C-style - * drivers/solis.h: drivers/solis.h: fix comments to C-style - * drivers/libshut.c: drivers/libshut.c: fix comments to C-style - * drivers/openups-hid.c: drivers/openups-hid.c: include config.h - first - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix comments to C-style - * drivers/riello_usb.c: drivers/riello_usb.c: fix comments to C-style - * drivers/generic_modbus.h: drivers/generic_modbus.h: fix comments to - C-style - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix comments to C-style - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - fix comments to C-style - * tools/nut-scanner/nutscan-init.c: tools/nut-scanner/nutscan-init.c: - fix comments to C-style - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: fix comments to C-style - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - comments to C-style - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: fix - comments to C-style - * server/upsd.c: server/upsd.c: fix comments to C-style - * server/conf.c: server/conf.c: fix comments to C-style - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix comments to C-style - * drivers/main.c: drivers/main.c: fix comments to C-style - * common/upsconf.c: common/upsconf.c: include config.h first - * common/str.c: common/str.c: fix comments to C-style - * server/user.c: server/user.c: include config.h first - * server/desc.c: server/desc.c: include config.h first - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: include config.h first - * drivers/riello_usb.c: drivers/riello_usb.c: include config.h first - * drivers/riello_ser.c: drivers/riello_ser.c: include config.h first - * drivers/rhino.c: drivers/rhino.c: include config.h first - * drivers/mge-utalk.c: drivers/mge-utalk.c: include config.h first - * drivers/libhid.c: drivers/libhid.c: include config.h first, and try - to get strings.h explicitly - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: include - config.h first - * drivers/dummy-ups.c: drivers/dummy-ups.c: include config.h first - * drivers/dstate.c: drivers/dstate.c: include config.h first - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: try to include explicitly both of - (sys/)signal.h - * server/upsd.c: server/upsd.c: try to include explicitly both of - (sys/)signal.h - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: include config.h first - * tools/nut-scanner/nutscan-device.c: tools/nut-scanner/nutscan- - device.c: include config.h first - * drivers/mge-xml.c: drivers/mge-xml.c: include config.h first - * drivers/libshut.c: drivers/libshut.c: include config.h first - * common/state.c: common/state.c: include config.h first - * common/str.c: common/str.c: include config.h first, and try to get - strings.h explicitly - * include/common.h: include/common.h: try to include explicitly - string(s).h and (sys/)signal.h - * configure.ac: configure.ac: test more actively for strcasecmp, - strncasecmp, strdup and usleep methods that are problematic for - strict C99+ builds - * configure.ac: configure.ac: detect explicitly string(s).h and - (sys/)signal.h - -2021-12-29 Jim Klimov - - * configure.ac: configure.ac: zero-init struct in ntohl/htonl - warning-tweaks test code - -2021-12-29 Jim Klimov - - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: be pragmatic - about possibly unreachable error handling in arch-dependent range - check - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: mark local - vars as static - * configure.ac: configure.ac: constrain warning-tweaks against macro - str*() and ntohl/htonl to LIBNETSNMP_CFLAGS (empirically) - * configure.ac: configure.ac: detect if compiler (e.g. older - clang-3.4) has a problem with built-in/macro variants of system - str*() and htonl/ntohl functions at our higher warning levels, and - mitigate that - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: rearrange - detection order of compiler flags - * drivers/generic_modbus.c: drivers/generic_modbus.c: quiesce - warnings about unreachable-code (default after full enum-case - handling) with older clang - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: ignore potentially - unreachable code in assert() - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: quiesce warnings about - unreachable-code (default after full enum-case handling) with older - clang - * drivers/upscode2.c: drivers/upscode2.c: quiesce warnings about - unreachable-code (default after full enum-case handling) with older - clang - * drivers/hidparser.c: drivers/hidparser.c: ignore potentially - unreachable code in platforms-dependent range checks - * drivers/libhid.c: drivers/libhid.c: ignore potentially unreachable - code in platforms-dependent range checks - * drivers/libshut.c: drivers/libshut.c: tell compiler that we do want - to treat a char array (managed by comms code) as the aligned - pointer to struct - * drivers/libshut.c: drivers/libshut.c: adjust data_size usage to - usb_ctrl_charbufsize typedef - fix pragmas for range-checks - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: quiesce warnings about - unreachable-code (default after full enum-case handling) with older - clang - * drivers/genericups.c: drivers/genericups.c: ignore potentially - unreachable code in platforms-dependent range checks - * drivers/bestuferrups.c: drivers/bestuferrups.c: ignore potentially - unreachable code in assert(0) - * drivers/bestfcom.c: drivers/bestfcom.c: ignore potentially - unreachable code in assert(0) - * clients/upsmon.c: clients/upsmon.c: ignore potentially unreachable - code in platforms-dependent range checks - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: ignore - potentially unreachable code in platforms-dependent range checks - * tools/nut-scanner/nutscan-init.c: tools/nut-scanner/nutscan-init.c: - ignore potentially unreachable code in platforms-dependent range - checks - * server/upsd.c: server/upsd.c: quiesce warnings about unreachable- - code (default after full enum-case handling) with older clang - * configure.ac: configure.ac: update "clang-medium" warnings level - with "-Wno-conversion" for older clang releases - * ci_build.sh: ci_build.sh: introduce CI_FAILFAST for - BUILD_TYPE=default-all-errors - * ci_build.sh: ci_build.sh: use configurable --enable-Wcolor for - compiler warnings in default quick build - * ci_build.sh: ci_build.sh: use configurable --enable-Wcolor for - compiler warnings in all BUILD_TYPEs - * configure.ac, m4/nut_compiler_family.m4: configure.ac + - m4/nut_compiler_family.m4: allow configurable --enable-Wcolor for - compiler warnings - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: add - diagnostics-color support for GCC - * configure.ac, m4/ax_check_compile_flag.m4, - m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: use - AX_CHECK_COMPILE_FLAG to detect generic options supported by - compilers - -2021-12-28 Jim Klimov - - * configure.ac: configure.ac: pass "-Wno-disabled-macro-expansion" in - clang-medium and clang-hard modes, to avoid choking on systems- - provided strncmp() etc. - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: pw_comm_setup(): ignore - potentially unreachable code in platforms-dependent range checks - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - ignore potentially unreachable code in platforms-dependent range - checks - * common/common.c: common/common.c: get_user_pwent(): ignore - "-Wunreachable-code" where we were required to have a return - * common/common.c: common/common.c: get_max_pid_t(): avoid warnings - in C89/C90/ANSI builds *because* we check for LLONG_MAX macro - * common/common.c: common/common.c: get_max_pid_t(): ignore - "-Wunreachable-code" - * common/common.c: common/common.c: vupslog(): ignore "-Wformat- - nonliteral" with older clang too - * configure.ac: configure.ac: with (older) clang, ignore "unused- - arguments" (of clang program) - * server/upsd.c: server/upsd.c: mainloop(): ignore "-Wcovered-switch- - default" with older clang too - * clients/upsclient.c: clients/upsclient.c: upscli_init(): fix "ret" - to "long", to match some versions of SSL_CTX_ctrl() (from - openssl/ssl.h e.g. in FreeBSD) - * drivers/riello_usb.c: drivers/riello_usb.c: riello_command(): - handle possibly undefined ETIME - * drivers/blazer_usb.c: drivers/blazer_usb.c: blazer_command(): - handle possibly undefined ETIME - * drivers/blazer_usb.c: drivers/blazer_usb.c: phoenix_command(): - avoid fall-through in a case - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: qx_command(): handle - possibly undefined ETIME - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: phoenix_command(): avoid - fall-through in a case - * drivers/mge-hid.c: drivers/mge-hid.c: nominal_output_voltage_fun(): - explicitly fall-through in a case - * drivers/libshut.c: drivers/libshut.c: shut_control_msg(): - explicitly fall-through in a case, and finish the default with a - break - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: comment away - setting "-isystem ..." common paths early in CFLAGS - * configure.ac: configure.ac: set "-Wno-system-headers" early in - gcc/clang medium and hard warning levels - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: set "-isystem - ..." paths early in CFLAGS - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: expel other - C89/C90/ANSI builds to only happen if not - disableSlowBuildCIBuildExperimentalANSI and only in branches (or - PRs to) matching ~/fightwarn.*89.*/ currently - * configure.ac: configure.ac: try to handle warnings in system - headers at our medium and hard levels - -2021-12-28 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix_report_desc(): - avoid shadowing global var with method arg name - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix_report_desc(): mark - NUT_UNUSED_VARIABLEs - -2021-12-28 Jim Klimov - - * docs/man/nutdrv_qx.txt: docs/man/nutdrv_qx.txt: mention Armac in - SUPPORTED HARDWARE section, and wrap long lines there - * docs/man/nutdrv_qx.txt, docs/nut.dict: docs/man/nutdrv_qx.txt: port - notes for "armac" subdriver from source code - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): move - variable declarations to top of scope - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): fix - varied int types to size_t, and move equation sides around to avoid - signedness - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: armac_command(): zero out - whole tmpbuf[], not one element - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: normalize whitespace for - "armac" code addition - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: add (C) for "armac" code - addition - -2021-12-25 Tomasz Fortuna - - * data/driver.list.in, docs/man/nutdrv_qx.txt, docs/nut.dict, - drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: add support for Armac UPS - (or maybe other richcomm_usb like) Based on Armac R/2000I/PSW, but - should support other UPSes that work with "PowerManagerII" software - from Richcomm Technologies from around 2004-2005. - -2021-12-28 Jim Klimov - - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: add a troubleshooting section, with entry for - cgroupsv1-only guests on a cgroupsv2-only host - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - add a chapter for CentOS 7 agent preparation - * docs/config-prereqs.txt: docs/config-prereqs.txt: clarify that - OpenBSD multitude of autotools versions is a blessing, not a pain - ;) - * docs/config-prereqs.txt: docs/config-prereqs.txt: clarify that JDK - installation in Debian guests may need /proc submounted - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: move "sudo" - installation away from useradd example (so "apt-get" does not - pollute non-debian guest examples) - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: change - CentOS7 example guest name from ...-x86_64 to ...-x86-64 (or - -amd64) to avoid loss of character - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: avoid - "AltArch" CentOS i686, use just x86_64 as something easier to get - hands on - -2021-12-27 hunter86bg - - * data/driver.list.in: Add Cyber Power PR1500RT2U, fixes - networkupstools/nut#1191 - -2021-12-27 Jim Klimov - - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: remind to - revise container MAC addresses - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: clarify - that "third-party distro" LXC helpers may need chiseling - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: hint at needed "pacman" for Arch Linux container - installation - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: add installation of RPM based distros as guests on non- - RPM (DEB) hosts - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: clarify how - to find defined LXC templates, and get usage details about them - -2021-12-25 Jim Klimov - - * drivers/riello_ser.c: drivers/riello_ser.c: do not include - hidparser.h (hiccups in usb-common.h due to lack of - WITH_LIBUSB_x_y) - * drivers/riello_ser.c: drivers/riello_ser.c: do not include - hidparser.h (hiccups in usb-common.h due to lack of - WITH_LIBUSB_x_y) - * drivers/libshut.c: drivers/libshut.c: adjust data_size usage to - usb_ctrl_charbufsize typedef - -2021-12-21 Jim Klimov - - * configure.ac: configure.ac: switch default warnings level to - "medium" - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: range-check quiesced by - pragmas (GCC) - * drivers/libusb0.c: drivers/libusb0.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/libusb1.c: drivers/libusb1.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/libshut.c: drivers/libshut.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/hidparser.c: drivers/hidparser.c: do not separate if-clause - parenthesis by pragmas (GCC) - -2021-12-20 Jim Klimov - - * drivers/libusb1.c: drivers/libusb1.c: fix whitespace (break long - lines) - * drivers/libshut.h: drivers/libshut.h: define ERROR_ACCESS etc. used - for USB(-like) result states - -2021-12-19 Jim Klimov - - * drivers/hidparser.c, drivers/hidparser.h, drivers/libhid.c, - drivers/libhid.h, drivers/libshut.c, drivers/libshut.h, - drivers/libusb0.c, drivers/libusb1.c, drivers/nut_libusb.h, - drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, - drivers/riello_usb.c, drivers/tripplite_usb.c, drivers/usb- - common.h, drivers/usbhid-ups.c: drivers (c,h) USB, HID and SHUT: - converge parameter usage from strict int types to backend API - dependent "usb_ctrl_*" and "usb_dev_handle" typedefs, then range- - check and cast the numbers, and avoid build warnings - -2021-12-25 Jim Klimov - - * drivers/libshut.c: drivers/libshut.c: adjust data_size usage to - usb_ctrl_charbufsize typedef - -2021-12-21 Jim Klimov - - * configure.ac: configure.ac: switch default warnings level to - "medium" - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: range-check quiesced by - pragmas (GCC) - * drivers/libusb0.c: drivers/libusb0.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/libusb1.c: drivers/libusb1.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/libshut.c: drivers/libshut.c: do not separate if-clause - parenthesis by pragmas (GCC) - * drivers/hidparser.c: drivers/hidparser.c: do not separate if-clause - parenthesis by pragmas (GCC) - -2021-12-20 Jim Klimov - - * drivers/libusb1.c: drivers/libusb1.c: fix whitespace (break long - lines) - * drivers/libshut.h: drivers/libshut.h: define ERROR_ACCESS etc. used - for USB(-like) result states - -2021-12-19 Jim Klimov - - * drivers/hidparser.c, drivers/hidparser.h, drivers/libhid.c, - drivers/libhid.h, drivers/libshut.c, drivers/libshut.h, - drivers/libusb0.c, drivers/libusb1.c, drivers/nut_libusb.h, - drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, - drivers/riello_usb.c, drivers/tripplite_usb.c, drivers/usb- - common.h, drivers/usbhid-ups.c: drivers (c,h) USB, HID and SHUT: - converge parameter usage from strict int types to backend API - dependent "usb_ctrl_*" and "usb_dev_handle" typedefs, then range- - check and cast the numbers, and avoid build warnings - -2021-12-25 Jim Klimov - - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, drivers/usb- - common.h, m4/nut_check_libusb.m4: m4/nut_check_libusb.m4, - drivers/usb-common.h + nutdrv_atcl_usb.c + richcomm_usb.c: only - apply usb_detach_kernel_driver_np to libusb-0.1 builds (no alias - tricks) - * drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c, m4/nut_check_libusb.m4: - m4/nut_check_libusb.m4, drivers/libusb1.c + nutdrv_atcl_usb.c + - richcomm_usb.c: honor that libusb-1.0 may - HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, drivers/usb- - common.h, m4/nut_check_libusb.m4: m4/nut_check_libusb.m4, - drivers/usb-common.h + nutdrv_atcl_usb.c + richcomm_usb.c: only - apply usb_detach_kernel_driver_np to libusb-0.1 builds (no alias - tricks) - * drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c, m4/nut_check_libusb.m4: - m4/nut_check_libusb.m4, drivers/libusb1.c + nutdrv_atcl_usb.c + - richcomm_usb.c: honor that libusb-1.0 may - HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP - -2021-12-24 Jim Klimov - - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, - drivers/riello_usb.c: drivers/riello_usb.c, richcomm_usb.c, - nutdrv_atcl_usb.c: fix remaining uses of (lib)usb_strerror with - nut_usb_strerror() - -2021-12-25 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: map - libusb_detach_kernel_driver_np (1.0) as usb_detach_kernel_driver_np - (0.1) - * drivers/usb-common.h: drivers/usb-common.h: map - libusb_detach_kernel_driver_np (1.0) as usb_detach_kernel_driver_np - (0.1) - -2021-12-24 Jim Klimov - - * configure.ac: configure.ac: update "clang-medium" warnings pre-set - with -Wno-incompatible-pointer-types-discards-qualifiers - * drivers/libusb1.c: drivers/libusb1.c: some more whitespace and - comment fixes - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, - drivers/riello_usb.c: drivers/riello_usb.c, richcomm_usb.c, - nutdrv_atcl_usb.c: fix remaining uses of (lib)usb_strerror with - nut_usb_strerror() - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: missed - whitespace fixes - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: comment - "#else WITH_LIBUSB_..." in long blocks - -2021-12-20 Jim Klimov - - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - whitespace (indentation etc) - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: drop local - libusb-0.1 vs 1.0 definitions now provided by usb-common.h - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: update comments - -2021-12-19 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: make sure (missing) - methods from another API are defined in config.h (so "#if HAVE_..." - is valid and not guessed as 0) - -2021-12-20 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: whitespace-separate - definitions of ERROR_ACCESS etc., nut_usb_strerror() and similar - macros - -2021-12-21 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: include "common.h" - -2021-12-16 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: define - PRI_NUT_USB_CTRL_CHARBUFSIZE, usb_ctrl_msgvalue and - usb_ctrl_strindex - * drivers/usb-common.h: drivers/usb-common.h: clarify that libusb - timeouts are in milliseconds (with variouts int types per API - version) - * drivers/usb-common.h: drivers/usb-common.h: update comment about - mapping from libusb-0.1 to libusb-1.0 API - * drivers/nut_libusb.h: drivers/nut_libusb.h: comment the practical - mess around hid_rep_index - * drivers/usb-common.h: drivers/usb-common.h: comment which API - version each endif is for - * drivers/usb-common.h: drivers/usb-common.h: note the arg type for - libusb_strerror() in comments to our macro wrapper - nut_usb_strerror() - * drivers/usb-common.h: drivers/usb-common.h: update heading comment - with references to different API docs - * drivers/usb-common.h: drivers/usb-common.h: update heading comment - and (C) for libusb-1.0 related changes - -2021-12-24 Jim Klimov - - * drivers/libshut.c: drivers/libshut.c: shut_control_msg(): data_size - is a "short int" (not size_t) in this branch - -2021-12-15 Jim Klimov - - * drivers/libshut.c: drivers/libshut.c: shut_control_msg(): range- - check data_size before stuffing the number into a char - * drivers/libshut.c: drivers/libshut.c: range-check and cast ints to - struct members and library args - * drivers/libshut.c: drivers/libshut.c: braces fix - * drivers/nut_libusb.h, drivers/usb-common.h: drivers/usb-common.h + - nut_libusb.h: typedef more usb_ctrl_* tokens to match libusb-0.1 vs - 1.0 API - -2021-12-20 Jim Klimov - - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: comment FIXME for - possible uses of usb_ctrl_* typedefs - -2021-12-13 Jim Klimov - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, drivers/usb-common.h: - USB: Rename typedef usb_ctrl_char to usb_ctrl_charbuf to avoid - confsion (it is a char* sibling, not plain char) - * drivers/libshut.h, drivers/nut_libusb.h: drivers/nut_libusb.h, - libshut.h: whitespace fixes (align "version") - -2021-12-10 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: current use of - SHUT_MODE relies on defined/not-defined, not on value for plain #if - macro - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: adapt to usb-common.h and - (usb_ctrl_char) casting - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: adapt to usb-common.h - and (usb_ctrl_char) casting - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: adapt to usb- - common.h and (usb_ctrl_char) casting - -2021-12-20 Jim Klimov - - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: fix whitespace - (break long lines) - * drivers/riello_usb.c: drivers/riello_usb.c: fix whitespace (break - long lines) - -2021-12-10 Jim Klimov - - * drivers/riello_usb.c: drivers/riello_usb.c: adapt to usb-common.h - and (usb_ctrl_char) casting - * drivers/riello.h: drivers/riello.h: do not define duplicate - USB_ENDPOINT_IN/USB_ENDPOINT_OUT - * drivers/usb-common.h: drivers/usb-common.h: convert - usb_get_string{_simple}() from macro aliases to real mappings with - range-checks for libusb-1.0 API - * drivers/usb-common.h: drivers/usb-common.h: mark "static inline" - functions with - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC since not - all C files call them - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/libhid.h, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, - drivers/tripplite_usb.c, drivers/usb-common.h: drivers/usb- - common.h: consolidate libusb-0.1 vs 1.0 data/func mappings from - *usb.c files - * drivers/nut_libusb.h, drivers/usb-common.h: drivers/nut_libusb.h - already includes "usb-common.h" so no need to pull LibUSB headers - again - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: range-check and cast - args for usb_control_msg() => libusb_control_transfer() and - usb_interrupt_read() => libusb_interrupt_transfer() for libusb-1.0 - support - -2021-12-09 Jim Klimov - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - * drivers/usb-common.h: drivers/usb-common.h: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - -2021-12-08 Jim Klimov - - * drivers/nut_libusb.h: drivers/nut_libusb.h: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - -2021-12-24 Jim Klimov - - * drivers/libusb1.c: drivers/libusb1.c: - HAVE_LIBUSB_DETACH_KERNEL_DRIVER needs "#ifdef" not "#if" - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, tools/nut- - scanner/scan_usb.c: Convert C code from "#ifdef WITH_LIBUSB_x_y" to - "#if" tests for defined value - merging missed a few in - libusb-1.0+0.1 branch - -2021-12-08 Jim Klimov - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/nut_libusb.h, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, - drivers/tripplite_usb.c, drivers/usb-common.h, tools/nut- - scanner/nutscan-init.c, tools/nut-scanner/scan_usb.c, tools/nut- - usbinfo.pl: Convert C code from "#ifdef WITH_LIBUSB_x_y" to "#if" - tests for defined value - -2021-12-24 Jim Klimov - - * configure.ac: configure.ac: update "clang-medium" warnings pre-set - with -Wno-incompatible-pointer-types-discards-qualifiers - -2021-12-20 Jim Klimov - - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - whitespace (indentation etc) - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: drop local - libusb-0.1 vs 1.0 definitions now provided by usb-common.h - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: update comments - -2021-12-19 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: make sure (missing) - methods from another API are defined in config.h (so "#if HAVE_..." - is valid and not guessed as 0) - -2021-12-20 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: whitespace-separate - definitions of ERROR_ACCESS etc., nut_usb_strerror() and similar - macros - -2021-12-21 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: include "common.h" - -2021-12-16 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: define - PRI_NUT_USB_CTRL_CHARBUFSIZE, usb_ctrl_msgvalue and - usb_ctrl_strindex - * drivers/usb-common.h: drivers/usb-common.h: clarify that libusb - timeouts are in milliseconds (with variouts int types per API - version) - * drivers/usb-common.h: drivers/usb-common.h: update comment about - mapping from libusb-0.1 to libusb-1.0 API - * drivers/nut_libusb.h: drivers/nut_libusb.h: comment the practical - mess around hid_rep_index - * drivers/usb-common.h: drivers/usb-common.h: comment which API - version each endif is for - * drivers/usb-common.h: drivers/usb-common.h: note the arg type for - libusb_strerror() in comments to our macro wrapper - nut_usb_strerror() - * drivers/usb-common.h: drivers/usb-common.h: update heading comment - with references to different API docs - * drivers/usb-common.h: drivers/usb-common.h: update heading comment - and (C) for libusb-1.0 related changes - -2021-12-24 Jim Klimov - - * drivers/libshut.c: drivers/libshut.c: shut_control_msg(): data_size - is a "short int" (not size_t) in this branch - -2021-12-15 Jim Klimov - - * drivers/libshut.c: drivers/libshut.c: shut_control_msg(): range- - check data_size before stuffing the number into a char - * drivers/libshut.c: drivers/libshut.c: range-check and cast ints to - struct members and library args - * drivers/libshut.c: drivers/libshut.c: braces fix - * drivers/nut_libusb.h, drivers/usb-common.h: drivers/usb-common.h + - nut_libusb.h: typedef more usb_ctrl_* tokens to match libusb-0.1 vs - 1.0 API - -2021-12-20 Jim Klimov - - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: comment FIXME for - possible uses of usb_ctrl_* typedefs - -2021-12-13 Jim Klimov - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, drivers/usb-common.h: - USB: Rename typedef usb_ctrl_char to usb_ctrl_charbuf to avoid - confsion (it is a char* sibling, not plain char) - * drivers/libshut.h, drivers/nut_libusb.h: drivers/nut_libusb.h, - libshut.h: whitespace fixes (align "version") - -2021-12-10 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: current use of - SHUT_MODE relies on defined/not-defined, not on value for plain #if - macro - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: adapt to usb-common.h and - (usb_ctrl_char) casting - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: adapt to usb-common.h - and (usb_ctrl_char) casting - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: adapt to usb- - common.h and (usb_ctrl_char) casting - -2021-12-20 Jim Klimov - - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: fix whitespace - (break long lines) - * drivers/riello_usb.c: drivers/riello_usb.c: fix whitespace (break - long lines) - -2021-12-10 Jim Klimov - - * drivers/riello_usb.c: drivers/riello_usb.c: adapt to usb-common.h - and (usb_ctrl_char) casting - * drivers/riello.h: drivers/riello.h: do not define duplicate - USB_ENDPOINT_IN/USB_ENDPOINT_OUT - * drivers/usb-common.h: drivers/usb-common.h: convert - usb_get_string{_simple}() from macro aliases to real mappings with - range-checks for libusb-1.0 API - * drivers/usb-common.h: drivers/usb-common.h: mark "static inline" - functions with - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC since not - all C files call them - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/libhid.h, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, - drivers/tripplite_usb.c, drivers/usb-common.h: drivers/usb- - common.h: consolidate libusb-0.1 vs 1.0 data/func mappings from - *usb.c files - * drivers/nut_libusb.h, drivers/usb-common.h: drivers/nut_libusb.h - already includes "usb-common.h" so no need to pull LibUSB headers - again - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: range-check and cast - args for usb_control_msg() => libusb_control_transfer() and - usb_interrupt_read() => libusb_interrupt_transfer() for libusb-1.0 - support - -2021-12-09 Jim Klimov - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - * drivers/usb-common.h: drivers/usb-common.h: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - -2021-12-08 Jim Klimov - - * drivers/nut_libusb.h: drivers/nut_libusb.h: sanity check that - exactly one version of WITH_LIBUSB_x_y is set (defined and has - value 1) - -2021-12-24 Jim Klimov - - * drivers/libusb1.c: drivers/libusb1.c: - HAVE_LIBUSB_DETACH_KERNEL_DRIVER needs "#ifdef" not "#if" - -2021-12-08 Jim Klimov - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/nut_libusb.h, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c, - drivers/tripplite_usb.c, drivers/usb-common.h, tools/nut- - scanner/nutscan-init.c, tools/nut-scanner/scan_usb.c, tools/nut- - usbinfo.pl: Convert C code from "#ifdef WITH_LIBUSB_x_y" to "#if" - tests for defined value - -2021-12-18 Dave Williams - - * drivers/apc-hid.c, drivers/arduino-hid.c, drivers/belkin-hid.c, - drivers/cps-hid.c, drivers/delta_ups-hid.c, drivers/explore-hid.c, - drivers/hidtypes.h, drivers/idowell-hid.c, drivers/liebert-hid.c, - drivers/mge-hid.c, drivers/openups-hid.c, drivers/powercom-hid.c, - drivers/powervar-hid.c, drivers/salicru-hid.c, drivers/tripplite- - hid.c, drivers/usbhid-ups.c, drivers/usbhid-ups.h: Fix #439 - Incorrect Output Voltage on CPS*EFPCLCD - -2021-12-08 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am: define SHUT_MODE=1 (with - a value) so #if is predictable - -2021-12-09 Jim Klimov - - * configure.ac, m4/nut_check_libusb.m4: configure.ac + - m4/nut_check_libusb.m4: rectify WITH_LIBUSB_x_y definitions - -2021-12-08 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: (hidden) debug - before AC_DEFINE - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: always AC_DEFINE - the WITH_LIBUSB_1_0 and WITH_LIBUSB_0_1 macros with a 0 or 1 value - -2021-12-07 Jim Klimov - - * docs/configure.txt: configure.ac et al: drop the extra --with- - libusb-version and handle its goals via --with-usb=VERSION - -2021-12-24 Jim Klimov - - * configure.ac, m4/nut_check_libusb.m4: m4/nut_check_libusb.m4 + - configure.ac: port newer solution for libusb version selection from - libusb-1.0 branch - -2021-12-07 Jim Klimov - - * configure.ac: configure.ac: drop duplicate NUT_CHECK_LIBNETSNMP - * configure.ac: configure.ac: regroup some NUT_ARG_WITH() closer to - their NUT_CHECK_*() so help for detailed options is near - -2021-11-15 Jim Klimov - - * m4/nut_check_libusb.m4: Move "additional USB-related checks" from - configure.ac to m4/nut_check_libusb.m4 - -2021-12-08 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am: define SHUT_MODE=1 (with - a value) so #if is predictable - -2021-12-09 Jim Klimov - - * configure.ac, m4/nut_check_libusb.m4: configure.ac + - m4/nut_check_libusb.m4: rectify WITH_LIBUSB_x_y definitions - -2021-12-08 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: (hidden) debug - before AC_DEFINE - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: always AC_DEFINE - the WITH_LIBUSB_1_0 and WITH_LIBUSB_0_1 macros with a 0 or 1 value - -2021-12-24 Dimitris Economou - - * drivers/generic_modbus.c: fix in modbus response value check - -2021-12-23 dtsecon - - * drivers/generic_modbus.c, drivers/generic_modbus.h: handle broken - pine error in modbus TCP connections, configurable modbus response - timeouts between requests and frame bytes - -2021-12-23 Jim Klimov - - * ci_build.sh: ci_build.sh: separate the "RES" vars used for - configure_nut() and default-all-errors processing (extend to - libusb-1.0* branches) - * tests/getvaluetest.c: tests/getvaluetest.c: include "config.h" - first - * tests/Makefile.am: tests/Makefile.am: only TEST getvaluetest "if - WITH_USB" - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: do not report - misleading "none (libusb-0.1-config)" as the detected libusb - version Seems this confused not only human readers, but also the - verdict - whether we build WITH_USB - * ci_build.sh: ci_build.sh: separate the "RES" vars used for - configure_nut() and default-all-errors processing (extend to - libusb-1.0* branches - * tests/getvaluetest.c: tests/getvaluetest.c: include "config.h" - first - * tests/Makefile.am: tests/Makefile.am: only TEST getvaluetest "if - WITH_USB" - -2021-12-22 Jim Klimov - - * clients/upsclient.c: clients/upsclient.c: upscli_tryconnect(): in - logged messages, clarity "connect to NUT server %s" Otherwise nut- - scanner output looks awkward when looking at large subnets with - many protocols (including "Old NUT") - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - convert logging in the main loop from a lot of fprintf() to - manageable upsdebugx() - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: - convert logging in the main loop from a lot of fprintf() to - manageable upsdebugx() - * ci_build.sh: ci_build.sh: fix a typo, copypasted around - * tests/Makefile.am: tests/Makefile.am: only build getvaluetest "if - WITH_USB" - * drivers/blazer_usb.c: drivers/blazer_usb.c: forget - libusb_device_handle - * drivers/libhid.h: drivers/libhid.h: forget libusb_device_handle - -2021-12-19 Jim Klimov - - * ci_build.sh: ci_build.sh: allow to build custom - NUT_USB_VARIANTS=libusb-x.y (not plain "x.y") - * ci_build.sh: ci_build.sh: allow to build custom NUT_USB_VARIANTS - and skip building a separate NUT_SSL_VARIANTS=auto - -2021-12-22 Jim Klimov - - * ci_build.sh: ci_build.sh: fix a typo, copypasted around - * tests/Makefile.am: tests/Makefile.am: only build getvaluetest "if - WITH_USB" - * drivers/blazer_usb.c: drivers/blazer_usb.c: forget - libusb_device_handle - * drivers/libhid.h: drivers/libhid.h: forget libusb_device_handle - -2021-12-21 Jim Klimov - - * docs/nut.dict: docs/nut.dict: update for recent NEWS - * NEWS: NEWS: prepare for nutdrv-qx legrand merge in 2.7.5 timeline - * NEWS: NEWS: prepare for nutdrv-qx ablerex merge in 2.7.5 timeline - * NEWS: NEWS: know about usbhid-ups Delta Minuteman support for NUT - v2.7.5 - * NEWS: NEWS: fix USB LogMin/LogMax mismatch reporting (just once!) - for NUT v2.7.5 - * NEWS: NEWS: add a little delay between multicommands [PR #1228] for - NUT v2.7.5 - * NEWS: NEWS: prepare for libusb-1.0 merge in 2.7.5 timeline - -2021-05-25 Jim Klimov - - * NEWS: NEWS: added nutdrv_qx "phoenixtec" subdriver in NUT-2.7.5 - -2021-04-23 Jim Klimov - - * docs/nut.dict: docs/nut.dict + NEWS: fix both to pass spellcheck - -2019-03-13 Arnaud Quette - - * docs/nut.dict: Update spelling dictionary - -2021-12-19 Jim Klimov - - * ci_build.sh: ci_build.sh: allow to build custom - NUT_USB_VARIANTS=libusb-x.y (not plain "x.y") - * ci_build.sh: ci_build.sh: allow to build custom NUT_USB_VARIANTS - and skip building a separate NUT_SSL_VARIANTS=auto - * ci_build.sh: ci_build.sh: allow to build custom - NUT_USB_VARIANTS=libusb-x.y (not plain "x.y") - * ci_build.sh: ci_build.sh: allow to build custom NUT_USB_VARIANTS - and skip building a separate NUT_SSL_VARIANTS=auto - -2021-12-21 Jim Klimov - - * drivers/legrand-hid.c: drivers/legrand-hid.c: fix type of - usb_device_id_t vendorID/productID to uint16_t * *{usb,hid}.c: - sentinel in a table of uint16_t can not be -1 - -2021-12-21 Jim Klimov - - * ci_build.sh: ci_build.sh: separate the "RES" vars used for - configure_nut() and default-all-errors processing - -2021-12-15 Jim Klimov - - * drivers/libshut.h: drivers/libshut.h: whitespace fixes (make func - ptrs more visible) - -2021-12-13 Jim Klimov - - * drivers/libusb.h: drivers/libusb.h: whitespace fixes (make func - ptrs more visible) - -2021-12-10 Jim Klimov - - * ci_build.sh: ci_build.sh: comment the rationale reminder for - "default-all-errors" mode - * ci_build.sh: ci_build.sh: try more options for non-verbose MAKE - runs - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: update - suggestions and envvar list for NOTIFYCMD callouts - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION - -2021-12-19 Jim Klimov - - * drivers/hidparser.c, drivers/hidparser.h: drivers/hidparser.{c,h}: - fix ReportDescSize from int to size_t - -2021-12-15 Jim Klimov - - * drivers/libhid.c, drivers/libhid.h: drivers/libhid.{c,h}: - HIDGetDataValue(), refresh_report_buffer(), get_item_buffered(): - fix "age" from int to time_t, to match time() operations - -2021-12-21 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: date_conversion_fun(): - hush a string overflow warning (overkill the buffer size a bit) - -2021-12-15 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: date_conversion_fun(): - comment and cast numeric type conversions - -2021-12-16 Jim Klimov - - * include/nut_stdint.h: include/nut_stdint.h: make sure we know - PRIsize and PRIssize - -2021-12-21 Jim Klimov - - * docs/developers.txt, docs/nut.dict: docs/developers.txt: note that - we define "gcc-medium|gcc-hard" warnings without "pedantic" for - C89/C90/ANSI builds (flaws in OS headers are out of our control) - * configure.ac: configure.ac: define "gcc-medium|gcc-hard" warnings - with "extra" always, but without "pedantic" for C89/C90/ANSI builds - (flaws in OS headers are out of our control) - * tests/Makefile.am: tests/Makefile.am: consider LIBUSB_CFLAGS when - building parser test - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: separate (and - disable by default) ANSI C build scenarios, they are too noisy in - fightwarn for no real good - * common/common.c: common/common.c: s_upsdebug*(): move fmt2[] - declarations to top from code - * common/common.c: common/common.c: fix comments from // to /* */ - * drivers/hidparser.h: drivers/hidparser.h: include "config.h" - * server/upsd.c: server/upsd.c: #include config.h first - -2021-12-21 Jim Klimov - - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Fix this on some of the CI - platforms: ```` [2021-12-21T09:21:47.623Z] nutdrv_qx.c:1665:2: - error: initialization from incompatible pointer type [-Werror] - [2021-12-21T09:21:47.623Z] { USB_DEVICE(0xffff, 0x0000), NULL, - NULL, &ablerex_subdriver }, /* Ablerex 625L USB */ - [2021-12-21T09:21:47.623Z] ^ [2021-12-21T09:21:47.623Z] - nutdrv_qx.c:1665:2: error: (near initialization for - 'qx_usb_id[1].fun') [-Werror] ```` - -2021-12-21 Jim Klimov - - * scripts/upower/95-upower-hid.rules: Update 95-upower-hid.rules Add - VID/PID for Minuteman UPS - * drivers/blazer_usb.c: drivers/blazer_usb.c: cast tmp as char* - Older compilers complain that we are: passing argument 3 of - 'usb_interrupt_read' from incompatible pointer type expected 'char - *' but argument is of type 'char (*)[512]' - -2021-12-21 Jim Klimov - - * docs/nut.dict: Update nut.dict Update for PR #1135 - -2021-12-20 Jim Klimov - - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Whitespace fix - -2021-12-20 hunter86bg - - * data/driver.list.in: Add Powerwalker VFI 3000 TG Online UPS to - driver.list.in (#1224) - -2021-12-20 Jim Klimov - - * drivers/hidparser.c: Update hidparser.c Fix whitespace in recent - changes for LogMin/LogMax rectification - -2021-12-20 Jim Klimov - - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - whitespace (indentation etc) - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix whitespace (break - long lines) - * drivers/riello_usb.c: drivers/riello_usb.c: fix whitespace (break - long lines) - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: fix whitespace - (break long lines) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix whitespace (break - long lines) - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix whitespace (break - long lines) - -2021-12-19 Scott Colby - - * drivers/usbhid-ups.c: Add a short sleep between fallback instcmds - in usbhid-ups. For some devices, missing instcmds are emulated by - calling two instcmds that do exist in sequence. For some devices, - when these commands arrive too quickly, they are not properly - processed. (One, both, or neither of the commands are acted upon.) - Adding a 1/8th-second delay (125,000 microseconds) between the two - instcmds that make up the fallback command has worked to make the - TrippLite AVR750U (new version with the 3024 productId/protocol) - behave consistently when using the fallback commands - (shutdown.return and shutdown.stayoff). This delay is also short - enough that it seems unlikely to cause a problem for any devices - which don't exhibit this issue. - -2021-12-16 Ablerexsoftware - - * docs/acknowledgements.txt, docs/man/nutdrv_qx.txt, docs/nutdrv_qx- - subdrivers.txt, drivers/Makefile.am, drivers/nutdrv_qx.c: modify CI - warnings and Replace the new sub driver - -2021-12-15 Nick Briggs - - * drivers/hidparser.c: Move check for LogMax encoding error to - parsing of report description At least one UPS [APC Back-UPS - BX1600MI FW:294201G -302201G] is known to have encoding errors in - its USB HID report description such that a conforming - interpretation of the encoded LogicalMaximum value indicates that - it is -1 and the resulting LogicalMin..LogicalMax range is 0..-1. - The actual report values read are correctly encoded. Rather than - log a range error each time a value is read we can detect the - encoding error when the report description is read (once, at - startup) and adjust for the encoding error at that time. - -2021-12-09 Jim Klimov - - * ci_build.sh: Refactor `./ci_build.sh spellcheck` to be more useful - * ci_build.sh: ci_build.sh: refactor - build_to_only_catch_errors_target() out of - build_to_only_catch_errors() - * ci_build.sh, docs/developers.txt: ci_build.sh: introduce support - for CI_SHELL_IS_FLAKY=true - * docs/developers.txt: docs/developers.txt: when introducing - ci_build.sh, mention that NUT CI farm tells how to reproduce builds - -2021-12-08 Jim Klimov - - * docs/man/nut-scanner.txt: Update nut-scanner.txt Clarify SNMP - auth/priv proto support depends on Net-SNMP lib - * docs/man/snmp-ups.txt: Update snmp-ups.txt Clarify SNMP auth/priv - proto support depends on Net-SNMP lib - -2021-12-08 Mauro Guerrera - - * docs/man/snmp-ups.txt: Update snmp-ups docs - * docs/man/nut-scanner.txt: Update docs to list new auth and privacy - encryption options - -2021-12-07 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: refactor shell - if/case to m4 (tracking down missed parentheses) - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: port more function - probes from libusb-1.0+0.1 branch - * ci_build.sh, configure.ac, docs/configure.txt, - m4/nut_check_libusb.m4: configure.ac et al: drop the extra --with- - libusb-version and handle its goals via --with-usb=VERSION - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: port comments and - m4 markup from libusb-1.0+0.1 branch - * configure.ac, m4/nut_check_libusb.m4: configure.ac: move remaining - libusb sanity checks into the m4/nut_check_libusb.m4 file - * configure.ac: configure.ac: drop duplicate NUT_CHECK_LIBNETSNMP - * configure.ac: configure.ac: regroup some NUT_ARG_WITH() closer to - their NUT_CHECK_*() so help for detailed options is near - * drivers/libusb1.c: drivers/libusb1.c: nut_libusb_open(): range- - check and cast libusb_control_transfer() arg rdlen - * drivers/libusb1.c: drivers/libusb1.c: nut_libusb_open(): range- - check and cast libusb_control_transfer() arg rdlen - * Makefile.am: Makefile.am: do not let (parallel) "make maintainer- - clean" remove the files that cleanup recipe needs - * ci_build.sh: Revert "ci_build.sh: fix bogus expression for - BUILDSTODO" This reverts commit - e57eec425da5c2020656fd48ec3f8bb9bbf55c52 and adds comments and - handling why that weird construct was not bogus ;) - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: reword notes for default QEMU container memory settings - * ci_build.sh: Add a shortcut hack to "./ci_build.sh spellcheck" - easily - * common/Makefile.am: common/Makefile.am: some "make" implems dislike - DRY multi-entry definition of same target (common.c) - * ci_build.sh: Add a shortcut hack to "./ci_build.sh spellcheck" - easily - * drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: drivers/snmp- - ups.c + tools/nut-scanner/scan_snmp.c: hide sanity checks before - generate_Ku() into pragmas to not warn about type-limits - ("comparison is always false due to limited range of data type" on - some architectures) - * drivers/solis.c: drivers/solis.c: make sure nut_stdint.h is - included early and defines size_t - -2021-12-06 Jim Klimov - - * drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: drivers/snmp- - ups.c + tools/nut-scanner/scan_snmp.c: align (cast) arg type of - generate_Ku() with net-snmp headers, and document the inconsistency - of size_t vs u_int in the same API - * drivers/snmp-ups.c: drivers/snmp-ups.c: align (cast) arg type of - malloc()/realloc() - * drivers/snmp-ups.c: drivers/snmp-ups.c: align (cast) arg type of - snmp_errstring() vs response->errstat (int vs long), and document - the inconsistency with net-snmp headers - * drivers/snmp-ups.c: drivers/snmp-ups.c: upsdrv_makevartable(): fix - maths with size_t vs int - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: setvar(): cast - placing of new_unit_id into wire protocol (FIXME? Does that code - assume CPU endianness?) - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: - upsdrv_initinfo(): fix receiver of strtol() - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: whitespace fixes - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: setvar(): fix - determination of outlet index number - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: debug_message(): - fix len from int to size_t - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: soft_shutdown(): - cast placing of offdelay into wire protocol (FIXME? Does that code - assume CPU endianness?) - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: fix reading and - printing of offdelay (unsigned int in this driver) - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: fix hex2d() to - long as a consumer of strtol() - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: fix toprint_str() - length to size_t and toprint(x) to char - * drivers/netxml-ups.c: drivers/netxml-ups.c: fix type of "ret" for - ne_read_response_block() and ne_sock_read() to ssize_t (as in - libneon headers) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix qx_command() to - return ssize_t like ser_send() at least - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - "u_langid_fix" in upsdrv_initups() - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - length of "cmdlen" in phoenixtec_command() - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - bytes in phoenixtec_command() - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - bytes in fuji_command() - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - bytes in repetitive "Simple unicode -> ASCII inplace conversion" - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast int - vs size_t in subdriver handlers (buflen, ret, i++) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: initialize ret=0 before - we potentially use it in loop i+=ret (should not happen in current - code, but...) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: cast upsdebug_hex() - logging with non-size_t args - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: range-check and cast - receivers of strtol() - * drivers/nutdrv_qx.c, drivers/nutdrv_qx.h: drivers/nutdrv_qx.{c,h}: - qx_process(), item_t.answer_len: fix lengths from int to size_t - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: qx_command(): indent - ifdefs for TESTING/QX_USB/QX_SERIAL for easier navigation - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: qx_command() complains - about unused parameters (not sure why); mark with - NUT_UNUSED_VARIABLE just in case - * drivers/nutdrv_qx.c, drivers/nutdrv_qx.h: drivers/nutdrv_qx.{c,h}: - fix STATUS() macro, qx_status(), status_lkp_t.status_mask field and - ups_status var to all be "unsigned int" - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: - range-check and cast receivers of strtol(); wrap a few long lines - * drivers/nutdrv_qx_mecer.c: drivers/nutdrv_qx_mecer.c: fix receivers - of strtol() - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - masterguard_test_battery(): fix receivers of strtol() - duration - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - masterguard_shutdown(): fix receivers of strtol() - - ondelay/offdelay - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - masterguard_new_slaveaddr(): range-check and cast - "masterguard_next_slaveaddr" - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - fix receivers of strtol() - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - masterguard_output_voltages(): fix type for sizeof() maths - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - masterguard_model(): fix type of min_bp/max_bp - -2021-12-04 Jim Klimov - - * drivers/nutdrv_qx_blazer-common.c: drivers/nutdrv_qx_blazer- - common.c: fix and range-check receivers of strtol() - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: fix - receivers of strtol() - * drivers/nutdrv_qx_voltronic-qs-hex.c: drivers/nutdrv_qx_voltronic- - qs-hex.c: fix receivers of strtol() - * drivers/solis.c: drivers/solis.c: fix packet_size from int to - size_t - * drivers/apcsmart.c: drivers/apcsmart.c: bit-wise &= ~() insists it - is for unsigned (int) types - vt->flags - * drivers/apcsmart.c: drivers/apcsmart.c: bit-wise &= ~() insists it - is for unsigned (int) types - termios struct - * drivers/apcsmart.c: drivers/apcsmart.c: sdcmd_CS: fix cshd from int - to useconds_t - * drivers/apcsmart.c: drivers/apcsmart.c: whitespace fix - * drivers/apcsmart.c: drivers/apcsmart.c: apc_getcaps(): fix i, - nument, entlen from int to size_t - * drivers/apcsmart.c: drivers/apcsmart.c: cast prtchr() args from - (unsigned char) to (char) - * drivers/apcsmart.c: drivers/apcsmart.c: fix receivers of strtol() - * drivers/apcsmart.c: drivers/apcsmart.c: cast - apc_read*()/apc_write*() from ((const) char) to (const unsigned - char) - * drivers/apcsmart.c: drivers/apcsmart.c: fix receivers of strlen() - from int to ssize_t - * drivers/apcsmart.c, drivers/apcsmart.h: drivers/apcsmart.{c,h}: fix - ups_status and APC_STAT_* from int to long (to match strtol() used) - * drivers/apcsmart.c: drivers/apcsmart.c: fix receivers of strlen() - from int to ssize_t - * drivers/apcsmart.c: drivers/apcsmart.c: fix - apc_read*()/apc_write*() from int to ssize_t to match select_read() - et al - * drivers/apcsmart.c: drivers/apcsmart.c: include main.h => config.h - first - * drivers/apcsmart.c: drivers/apcsmart.c: convert_data(): fix - receivers of strtol() - * drivers/apcsmart-old.c, drivers/apcsmart-old.h: drivers/apcsmart- - old.c: fix const/unsigned/char usages - * drivers/apcsmart-old.c: drivers/apcsmart-old.c: do_capabilities(): - fix i, nument, entlen from int to size_t - * drivers/apcsmart-old.c, drivers/apcsmart-old.h: drivers/apcsmart- - old.c: fix receivers of strtol() - * drivers/solis.h: drivers/solis.h: fix packet_size from into to - size_t - * drivers/apcsmart-old.c: drivers/apcsmart-old.c: fix handling of - ser_*() retval from int to ssize_t - * drivers/clone.c: drivers/clone.c: fix ondelay/offdelay handling - from int to long (to match strtol() used) - * drivers/clone-outlet.c: drivers/clone-outlet.c: fix handling of - read()/write() retval from int to ssize_t - * drivers/clone.c: drivers/clone.c: fix handling of read()/write() - retval from int to ssize_t - * drivers/blazer.h, drivers/blazer_ser.c, drivers/blazer_usb.c: - drivers/blazer.h + blazer_{ser,usb}.c: blazer_command(): fix - handling of ser_get_buf() retval from int to ssize_t - * drivers/blazer.c: drivers/blazer.c: fix ondelay/offdelay handling - from int to long (to match strtol() used) - * drivers/blazer.c: drivers/blazer.c: fix receivers of strtol() - - delay tmp var - * drivers/powerp-txt.c: drivers/powerp-txt.c: fix ondelay/offdelay - handling from int to long (to match strtol() used) - * drivers/victronups.c: drivers/victronups.c: fix receivers of - strtol() - * drivers/victronups.c: drivers/victronups.c: fix handling of - ser_get_line() retval from int to ssize_t - * drivers/tripplite.c: drivers/tripplite.c: fix receivers of strtol() - => hex2d() - * drivers/tripplite.c: drivers/tripplite.c: fix handling of - ser_get_char() retval from int to ssize_t - * drivers/solis.c, drivers/solis.h: drivers/solis.{c,h}: fix - comm_receive() from int to size_t, and match ser_get_buf_len() len- - or-error returns - * drivers/solis.c, drivers/solis.h: drivers/solis.{c,h}: fix byte- - sized maths of str2bin() and day counts to uint8_t - * drivers/solis.c: drivers/solis.c: include main.h => config.h first - * drivers/solis.c, drivers/solis.h: drivers/solis.c: - save_ups_config(): fix casting of ConfigPack[] entries to (unsigned - char) from original types - * drivers/nutdrv_siemens_sitop.c: drivers/nutdrv_siemens_sitop.c: fix - handling of ser_get_line() retval from int to ssize_t - * drivers/safenet.c: drivers/safenet.c: fix ondelay/offdelay handling - from int to long (to match strtol() used) - * drivers/safenet.c: drivers/safenet.c: fix array loop iterator from - int to size_t - * drivers/safenet.c: drivers/safenet.c: fix handling of - ser_get_line() retval from int to ssize_t - * drivers/rhino.c: drivers/rhino.c: fix handling of ser_get_line() - retval from int to ssize_t - * drivers/powercom.h: drivers/powercom.h: fix whitespace - (indentations) - * drivers/powercom.c: drivers/powercom.c: fix array loop iterator - from int to size_t - * drivers/powercom.c: drivers/powercom.c: fix handling of - ser_get_line() retval from int to ssize_t - * drivers/optiups.c: drivers/optiups.c: a few whitespace nits - * drivers/optiups.c: drivers/optiups.c: fix OPTISBIT_* handling from - int to long (to match strtol() used) - * drivers/optiups.c: drivers/optiups.c: fix optifill() len from int - to size_t - * drivers/optiups.c: drivers/optiups.c: fix handling of - ser_get_line() retval from int to ssize_t - * drivers/oneac.c: drivers/oneac.c: fix handling of ser_get_line() - retval from int to ssize_t - * scripts/subdriver/gen-usbhid-subdriver.sh: scripts/subdriver/gen- - usbhid-subdriver.sh: update generated C heading comment with "TODO" - and update generated code whitespace markup - * drivers/arduino-hid.c, drivers/salicru-hid.c: drivers/usb- - common.{c,h} drivers/*{usb,hid}.c: fix type of usb_device_id_t - vendorID/productID to uint16_t Catch up to earlier change for - recently merged USB HID drivers; specifically * *{usb,hid}.c: - sentinel in a table of uint16_t can not be -1 for: * - drivers/salicru-hid.c * drivers/arduino-hid.c * - scripts/subdriver/gen-usbhid-subdriver.sh creating the boilerplates - -2021-12-03 Jim Klimov - - * drivers/microsol-common.c: drivers/microsol-common.c: fix - setup_poweroff_schedule() vars from int to bool_t to match - set_schedule_time() - * drivers/microsol-common.c: drivers/microsol-common.c: fix - get_base_info(), get_updated_info() buf sizes from unsigned int to - ssize_t (to match ser_get_buf_len() len-or-error returns) - * drivers/microsol-common.c: drivers/microsol-common.c: fix - comm_receive() from int to size_t - * drivers/microsol-common.c: drivers/microsol-common.c: - save_ups_config(): fix casting of configuration_packet[] entries to - (unsigned char) from original types - * drivers/microsol-common.c: drivers/microsol-common.c: fix byte- - sized maths of bitstring_to_binary() and day counts to uint8_t - -2021-12-06 Jim Klimov - - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: instcmd(): - range-check and cast for ups2000_write_register() and - handler_func() - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_update_alarm(): range-check and cast all_alarms_len from - snprintf() retval - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_update_info(): pragma disable warnings for non-fixed format - string - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_update_info(): cast uint32_t for reg-idx - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_read_serial(): range-check and cast ssize_t vs size_t - increments - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_update_info(): cast uint8_t calculations of reg_id parts - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_device_identification(): cast uint32_t calculations of - ups2000_ident - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_device_identification(): range-check and cast crc16 - calculations - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_write_registers(), ups2000_read_registers(), - ups2000_device_identification(): initialize variables that clang-9 - is not sure about Seems like a clang analyzer bug frankly: code - starts with a retrying loop that would initialize these variables. - But still, adding determinism into code never hurts ;) - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: crc16(): fix - casting to uint16_t when bit-shifting - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: ups2000_alarm[] - sentinel: fix uint16_t reg from -1 to 0 - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: - ups2000_device_identification(): fix r from int to size_t, to match - ser_send_buf() - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: fix - ups2000_read_serial() from int to size_t, to match ser_get_buf() - * drivers/huawei-ups2000.c: drivers/huawei-ups2000.c: mark local - variables static - -2021-12-03 Jim Klimov - - * drivers/microsol-common.c: drivers/microsol-common.c: fix (and - range-check) casting for memcpy - * drivers/microsol-common.c: drivers/microsol-common.c: wrap some - long comments - * drivers/microsol-common.c: drivers/microsol-common.c: include - main.h => config.h first - * common/Makefile.am: common/Makefile.am: limit the use of common.c - symlinking from srcdir to builddir only to cases when not - BUILDING_IN_TREE - * tools/nut-scanner/nutscan-init.c: tools/nut-scanner/nutscan-init.c: - comment that semaphore gets re-initialized by nut-scanner.c program - and why - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nutscan-init.c: - tools/nut-scanner/nutscan-init.c + nut-scan.h: hide "semaphore" - library variable - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - #include "config.h" first - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/nutscan-init.c, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_xml_http.c: - tools/nut-scanner/*.c: fix use of size_t max_threads(_scantype) vs - (unsigned int) in sem_init() args - * tools/nut-scanner/nut-scan.h: tools/nut-scanner/nut-scan.h: fix - declaration of nutscan_semaphore(void) - * drivers/snmp-ups.c, m4/nut_check_libnetsnmp.m4, tools/nut- - scanner/nut-scanner.c, tools/nut-scanner/scan_snmp.c: - nut_check_libnetsnmp.m4, nut-scanner.c, scan_snmp.c, snmp-ups.c: - transition from NETSNMP_DRAFT_BLUMENTHAL_AES_04 (that may be not- - defined so #if is invalid) to - NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 - * ci_build.sh: ci_build.sh: in default-all-errors mode, avoid last- - loop cleanup if DO_CLEAN_CHECK==no - * ci_build.sh: ci_build.sh: fix bogus expression for BUILDSTODO - * ci_build.sh: ci_build.sh: only score *_clean_check as SUCCEEDED if - they were not skipped, and report a bit more - -2021-11-30 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): import - tracing messages and points from 42ITy/DMF fork - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): clarify the - "trying the new match_sysoid() method" message - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): fix - upsdebugx() levels verbosity to make more sense - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): reformat - some debugs, use __func__ - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): report - device name (section) and host/IP in progress and errors - -2021-11-28 Jim Klimov - - * m4/nut_check_libpowerman.m4: m4/nut_check_libpowerman.m4: if - (lib)powerman.pc is missing, but header is present, check - -lpowerman directly - * m4/nut_check_libpowerman.m4: m4/nut_check_libpowerman.m4: they - deliver an empty version string, so we should not error out on that - -2021-11-27 Jim Klimov - - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: if libusb-config - and libusb.pc are missing, but header is present, check -lusb - directly - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: detect - NET_SNMP_CONFIG with AC_PATH_PROGS and/or configure option (and - handle if it is missing) - * docs/configure.txt: docs/configure.txt: document --with-net-snmp- - config configure option better - * docs/configure.txt: docs/configure.txt: rephrase comments about - --with-*-libs and --with-*-include - * docs/configure.txt, m4/nut_check_pkgconfig.m4: - m4/nut_check_pkgconfig.m4 + docs/configure.txt: detect - (dummy_)PKG_CONFIG with AC_PATH_PROGS and/or configure option (and - handle if it is missing) - * m4/nut_check_libgd.m4: m4/nut_check_libgd.m4: initialize empty - CFLAGS LIBS LDFLAGS - * m4/nut_check_libgd.m4: m4/nut_check_libgd.m4: detect GDLIB_CONFIG - with AC_PATH_PROGS and/or configure option (and handle if it is - missing) - * docs/configure.txt, m4/nut_check_libusb.m4: m4/nut_check_libusb.m4 - + docs/configure.txt: detect LIBUSB_CONFIG with AC_PATH_PROGS - and/or configure option (and handle if it is missing) - * m4/nut_check_libpowerman.m4: m4/nut_check_libpowerman.m4: consider - have_PKG_CONFIG - * m4/nut_check_libwrap.m4: *.m4: AC_LANG_PUSH before AC_LINK_IFELSE - and similar tests - -2021-11-27 Jim Klimov - - * m4/ax_c___attribute__.m4, m4/nut_check_headers_windows.m4, - m4/nut_check_libnetsnmp.m4, m4/nut_func_getnameinfo_argtypes.m4, - m4/nut_type_socklen_t.m4: *.m4: AC_LANG_PUSH before - AC_COMPILE_IFELSE and similar tests - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: try to report - toStringStageCountDump() in ircNotify() - * configure.ac: configure.ac: AC_LANG_PUSH before AC_COMPILE_IFELSE - and similar tests - * clients/upsclient.c, clients/upslog.c, clients/upsmon.c, - clients/upsrw.c, clients/upssched.c, clients/upsset.c, - common/state.c, common/upsconf.c, docs/developers.txt, - docs/nut.dict, drivers/apcsmart-old.c, drivers/apcsmart.c, - drivers/apcupsd-ups.c, drivers/belkin.c, drivers/belkinunv.c, - drivers/bestups.c, drivers/clone-outlet.c, drivers/clone.c, - drivers/dstate.c, drivers/gamatronic.c, drivers/huawei-ups2000.c, - drivers/main.c, drivers/masterguard.c, drivers/mge-utalk.c, - drivers/mge-xml.c, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_bestups.c, drivers/nutdrv_qx_blazer-common.c, - drivers/nutdrv_qx_voltronic-qs-hex.c, drivers/nutdrv_qx_voltronic- - qs.c, drivers/nutdrv_qx_voltronic.c, drivers/oneac.c, - drivers/powercom.c, drivers/powerman-pdu.c, drivers/powerp-txt.c, - drivers/snmp-ups.c, drivers/tripplite_usb.c, drivers/upscode2.c, - drivers/victronups.c, server/conf.c, server/netget.c, - server/netlist.c, server/netset.c, server/user.c, - tests/cpputest.cpp, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/scan_snmp.c: Replace strcmp() and strcasecmp() use-cases - for short fixed string args by strncmp() and strncasecmp() - respectively Some compilers on some OSes complain due to implem - nuances. Updated docs/developers.txt to make note for posterity. - * drivers/microdowell.c: drivers/microdowell.c: some more pragmatic - ignorance for CLAMP() macro uses (older clang-3.4 et al) - -2021-11-22 Yifeng Li - - * drivers/huawei-ups2000.c: huawei-ups2000.c: rework logic for - "load.on". Currently the driver prevents the user from executing - "load.on" when the UPS is already on, and reports a - STAT_INSTCMD_FAILED with error logs. We need to do this if the UPS - is in bypass mode, because the UPS would otherwise enter normal - mode - "load.on" is not supposed to do that. On the other hand, - executing "load.on" when the UPS is already in "normal-mode on" has - no effect, it's still a legal command and should not be rejected - arbitrarily, which can potentially confuse downstream applications - and users. It also contains two misleading typos in the error - logs: (1) it incorrectly suggests "bypass.off" instead of - "bypass.stop", and (2) reports "failed: reason unknown." when the - reason is simply an already-on UPS. This commit allows "load.on" - to execute when it's in normal mode and already on, and changes the - log messages from errors to warnings. Typos in the log messages are - also fixed. The "load.on" command is only rejected in bypass mode, - with error logs. Finally, the logic for the off test is reworked - to improve readability. The original code checks whether the UPS is - on by testing the negative "not OFF" condition, which is not easy - to understand - the reader must have intimate knowledge on the code - to know its correctness. Namely, When the UPS power status is - updated, 1 of the 5 mutually exclusive flags, OL, OB, OL ECO, - BYPASS, or OFF is always set, thus the absence of the OFF flag - always reliably indicates an ON status. This commits converts the - single negative "not OFF" test to three positive tests for "OL", - "OB" and "OFF", with additional comments added on reachable and - unreachable conditions. Thus, previous uncertainty is eliminated. - -2021-11-26 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix dummy nutscan_scan_xml_http_range() - (WITHOUT_NEON) arg type for useconds_t usec_timeout - * drivers/libhid.c: drivers/libhid.c: fix debug-printing of byte- - counts as size_t - * drivers/microdowell.c: drivers/microdowell.c: some more pragmatic - ignorance for CLAMP() macro uses - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: - whitespace fix - * tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_xml_http.c: tools/nut-scanner/scan_*.c: fix debug- - printing of thread accounting as size_t - -2021-10-26 Jim Klimov - - * drivers/hidparser.c: drivers/hidparser.c: Parse_ReportDesc(): fix - "max" to size_t and "id" to uint8_t, to match struct fields - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix cast of range- - checked u_langid_fix - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix cast of return - types to size_t vs int - * drivers/libhid.c: drivers/libhid.c: string_to_path(): range-check - and cast converted values for path->Node[] - * drivers/libhid.c: drivers/libhid.c: hid_lookup_usage(): fix cast of - usage_code for printing and returning - * drivers/libhid.c: drivers/libhid.c: string_to_path(): check for - type overflow, and cast - * drivers/libhid.c: drivers/libhid.c: fix types for iterating vs - rbuflen from int to size_t - * drivers/libhid.c, drivers/libhid.h: drivers/libhid.{c,h}: fix - interrupt_size from int to size_t - * drivers/libhid.c: drivers/libhid.c: fix types for iterating vs - rbuflen from int to size_t - * drivers/libhid.c, drivers/libhid.h: drivers/libhid.{c,h}: fix - max_report_size from int to size_t - * drivers/libhid.c: drivers/libhid.c: file_report_buffer(): fix - buflen from int to size_t - * drivers/hidtypes.h: drivers/hidtypes.h: change HIDDesc_t.replen[] - from (array of) int to size_t - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: cast for - bit math for qx_status() result - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: cast - for bit math for qx_status() result, and line-wrap a long message - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: cast arg for - upsdebug_hex() to size_t - * drivers/nutdrv_qx_voltronic-qs-hex.c: drivers/nutdrv_qx_voltronic- - qs-hex.c: cast arg for upsdebug_hex() to size_t - * drivers/libusb.c: drivers/libusb.c: libusb_open(): cast rdlen to - unsigned to match usb_control_msg() where it is safe to do so - * drivers/libhid.h: drivers/libusb.h: change reportbuf_t.len[] from - (array of) int to size_t - * drivers/hidparser.c, drivers/hidtypes.h: drivers/hidtypes.h + - hidparser.c: change HIDDesc_t.nitems from int to size_t - * drivers/hidparser.c: drivers/hidparser.c: cast int types to - explicit conversions where safe - -2021-10-04 Jim Klimov - - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: process(): fix int - types - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: upsdrv_initups(): fix - type of port - * drivers/nutdrv_qx.h: drivers/nutdrv_qx.h: define QX_FLAG_* macros - as typed numbers (UL) to match item_t->qxflags - * drivers/powercom-hid.c: drivers/powercom-hid.c: range-check and - cast uint16_t values for ups delays - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: align return - type of usb_interrupt_read() and our upsdebug_hex() args - * drivers/upscode2.c: drivers/upscode2.c: align types of two statuses - * drivers/upscode2.c: drivers/upscode2.c: fix useconds_t - output_pace_usec - * drivers/upscode2.c: drivers/upscode2.c: fix speed_t baud var - * drivers/upscode2.c: drivers/upscode2.c: fix ssize_t ret for ser*() - routines - * drivers/powerp-txt.c: drivers/powerp-txt.c: fix ssize_t ret for - ser*() routines - * drivers/powerp-bin.c: drivers/powerp-bin.c: fix ssize_t ret for - ser*() routines, and cmd len - * drivers/powerpanel.h: drivers/powerpanel.h: adjust powerpanel - subdriver_t funcptr type for initups() - * drivers/ivtscd.c: drivers/ivtscd.c: fix ssize_t for ivt_status() - and ser_*() involved - * drivers/riello_ser.c: drivers/riello_ser.c: riello_instcmd(): fix - int type of delay vs atoi() - * drivers/riello_ser.c: drivers/riello_ser.c: fix ssize_t ret for - read() routines - * drivers/riello_usb.c: drivers/riello_usb.c: ussleep(): fix - useconds_t type - * drivers/riello_usb.c: drivers/riello_usb.c: riello_instcmd(): fix - int type of delay vs atoi() - * drivers/riello_usb.c: drivers/riello_usb.c: Get_USB_Packet(): fix - int type of size - * drivers/riello.c: drivers/riello.c: riello_parse_rc(): cast uint8_t - into char - * drivers/riello.c: drivers/riello.c: riello_prepare*(): cast - delay%256 into uint8_t - * drivers/riello.c: drivers/riello.c: riello_parse_sentr(): cast pom - maths into uint16_t explicitly... range-check missing though - * drivers/riello.c: drivers/riello.c: riello_parse_sentr(): cast - uint8_t => char to construct Version byte by byte - * drivers/riello.c: drivers/riello.c: riello_parse_gn(): range-check - and cast the NomPowerKVA / NomPowerKW - * drivers/riello.c: drivers/riello.c: riello_calc_CRC(): clarify and - cast the bitness magic as needed - * drivers/powercom.c: drivers/powercom.c: fix int type of model vars - to match OPTImodels/BNTmodels/KINmodels/IMPmodels arrays - * drivers/powercom.c: drivers/powercom.c: avoid casting via wrong int - type for termios fields - * drivers/powercom.c, drivers/powercom.h: drivers/powercom.{c,h}: - align int size for delay (min, sec) and ser_send_char() sending a - char - * drivers/tripplite.c: drivers/tripplite.c: fix casting of unsigned - delays from atoi() - * drivers/tripplite.c: drivers/tripplite.c: fix casting of ints in - send_cmd() - * drivers/tripplitesu.c: drivers/tripplitesu.c: fix casting of ints - into unsigned min/max high/low transfer values - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - hide warnings for intentional variable format string use - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - avoid a few potential uninitialized uses - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - fix a case of shadowed vars in a clause - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - declare local vars and funcs as static - * drivers/netxml-ups.c: drivers/netxml-ups.c: fix casting ssize_t - value up to size_t for ne_buffer_append() args - * drivers/netxml-ups.c: drivers/netxml-ups.c: fix int type of port - for ne_sock_connect() args - -2021-09-28 Jim Klimov - - * drivers/microdowell.c: drivers/microdowell.c: shuffle include-file - order - * drivers/microdowell.c: drivers/microdowell.c: instcmd(): casting - and (pragma-hushed) range checks for "delay" - * drivers/solis.c: drivers/solis.c: convert_days(): limit the range - for safe casting to size_t for memcpy() - * drivers/rhino.c: drivers/rhino.c: align int types in send_command() - * drivers/microsol-common.c, drivers/microsol-common.h: - drivers/microsol-common.{c,h}: mark local variables as static; - expose a few reasonable ones as extern - * drivers/microdowell.c, drivers/microdowell.h: - drivers/microdowell.{c,h}: fix size_t lengths and uint16_t/uint32_t - status bitmasks - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - declare upsdrv_shutdown() as noreturn - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - declare file-local variables static - * drivers/hidparser.c: drivers/hidparser.c: avoid shadowed local - variables in HIDParse() - * drivers/hidparser.c: drivers/hidparser.c: fix Value cast in - FormatValue() - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix status_mask to - unsigned int for STATUS() and bitmask maths - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: fix parsing of - interrupt_size from args, and error out on invalid inputs - * drivers/nutdrv_siemens_sitop.c: drivers/nutdrv_siemens_sitop.c: fix - counters to unsigned int - * drivers/mge-hid.c, drivers/usbhid-ups.c, drivers/usbhid-ups.h: - drivers/usbhid-ups.{c,h} + mge-hid.c: fix ups_status from int to - "unsigned" to match the STATUS() macro and bitmask maths - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - type for snmp_sess.timeout assignment - * drivers/microsol-apc.h: drivers/microsol-apc.h: align type of - NOMINAL_POWER[] to int, like nominal_power var in microsol-common.h - * drivers/oneac.c: drivers/oneac.c: fix buf sizes to size_t - * drivers/main.c, drivers/main.h, drivers/mge-utalk.c, - drivers/nutdrv_siemens_sitop.c, drivers/usbhid-ups.c: - drivers/main.{c,h} et al: fix poll_interval to be time_t like the - time() it has maths with - * drivers/main.c: drivers/main.c: allow only positive pollinterval - settings (avoid DoS by crazy loop) - * drivers/main.c: drivers/main.c: report and fail with invalid - pollinterval settings - * drivers/serial.c: drivers/serial.c: after some investigation of - standards, we may cast useconds_t=>suseconds_t - * server/netset.c: server/netset.c: log tracking_disable() result to - find a use for it (warning fix) - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: - execute_and_retrieve_query(): fix int casting and add diags pragmas - for range checks - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: get_answer(): fix int - casting for tail; fix redundant comparison - * drivers/bestfortress.c: drivers/bestfortress.c: simplify - usleep(d_usec) to no casting - * drivers/belkin.c: drivers/belkin.c: comment why casting usleep(cnt) - is okay - -2021-09-27 Jim Klimov - - * clients/upsclient.c, common/common.c, docs/new-drivers.txt, - drivers/serial.c, drivers/serial.h, include/common.h: - include/common.h, drivers/serial.{c,h}, docs/new-drivers.txt, - common/common.c, clients/upsclient.c: fix d_sec long => time_t to - match timeval struct fields - * clients/upsclient.c, common/common.c, include/common.h: - include/common.h, common/common.c, clients/upsclient.c: fix - select_read()/select_write(): long d_usec => suseconds_t - * docs/nut.dict: docs/nut.dict: update for new-drivers.txt revision - * docs/new-drivers.txt: docs/new-drivers.txt: align USB-common - structure and method signature descriptions with current - drivers/*usb*.h - * docs/man/upscli_readline.txt, docs/man/upscli_sendline.txt: - docs/man/upscli_readline.txt + upscli_sendline.txt: update method - arguments to match code (timeout unsigned int => const long) - * docs/man/upscli_list_next.txt, docs/man/upscli_list_start.txt: - docs/man/upscli_list_start.txt + upscli_list_next.txt: update - method arguments to match code (numa/numq unsigned int => size_t) - -2021-09-26 Jim Klimov - - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: fix data types for - alarm() and sleep() - * drivers/mge-utalk.c: drivers/mge-utalk.c: fix int casting to - snprintf() (size_t/ssize_t) - * drivers/mge-utalk.c: drivers/mge-utalk.c: fix int casting to - ser_get*()/ser_send_*() (size_t/ssize_t) - * drivers/metasys.c: drivers/metasys.c: fix int casting to - ser_get*()/ser_send_*() (size_t/ssize_t) - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: fix int casting to - ser_get*() (size_t/ssize_t) - * drivers/gamatronic.c: drivers/gamatronic.c: fix int casting to - ser_get*() (size_t/ssize_t) and unify naming of msg(_)len - * drivers/bestups.c: drivers/bestups.c: fix int casting to ser_get*() - (size_t/ssize_t) - * drivers/bestuferrups.c: drivers/bestuferrups.c: fix int casting to - ser_get*() (size_t/ssize_t) - * drivers/bestfortress.c: drivers/bestfortress.c: fix int casting to - ser_get*() (size_t/ssize_t) - * drivers/bestfcom.c: drivers/bestfcom.c: fix int casting to - ser_get*() (size_t/ssize_t) - * drivers/belkinunv.c: drivers/belkinunv.c: fix int casting to - ser_get*(), read() and write() (size_t/ssize_t) - * drivers/belkin.c: drivers/belkin.c: fix int casting to ser_get*() - (size_t/ssize_t) - * drivers/al175.c: drivers/al175.c: fix raw_data_t::buf_size and - io_head_t::addr,len to size_t - * drivers/al175.c: drivers/al175.c: fix int casting to ser_get*() - (size_t/ssize_t) - * drivers/dstate.c: drivers/dstate.c: augment range check when using - size_t as int - * drivers/dstate.c: drivers/dstate.c: fix int casting to read() and - write(), add range checks for bytes written (size_t/ssize_t) - -2021-09-23 Jim Klimov - - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: fix elapsed_time type - and casting - * drivers/bcmxcp.c, drivers/bcmxcp_io.h, drivers/bcmxcp_ser.c, - drivers/bcmxcp_usb.c: drivers/bcmxcp*.{c,h}: fix types involved - with read() and write() to ssize_t - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: fix count to size_t - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: fix - buf_size to size_t - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: fix types involved with read() and - write() to ssize_t - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: fix size_t thread_count and its - iterator - * drivers/serial.c, drivers/serial.h: drivers/serial.[h,c]: fix - d_usec from long to useconds_t - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/scan_avahi.c, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_xml_http.c: - tools/nut-scanner/*.[h,c]: fix usec_timeout from long to useconds_t - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix size_t thread_count and its iterator - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix recv_size use as size_t parameter - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/scan_xml_http.c: - tools/nut-scanner/nut-scan.h + scan_xml_http.c: fix port type to - uint16_t - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - arg type for generate_Ku() - * drivers/apc-hid.c, drivers/bcmxcp_usb.c, drivers/belkin-hid.c, - drivers/blazer_usb.c, drivers/cps-hid.c, drivers/delta_ups-hid.c, - drivers/idowell-hid.c, drivers/liebert-hid.c, drivers/mge-hid.c, - drivers/nutdrv_atcl_usb.c, drivers/openups-hid.c, drivers/powercom- - hid.c, drivers/powervar-hid.c, drivers/richcomm_usb.c, - drivers/riello_usb.c, drivers/tripplite-hid.c, - drivers/tripplite_usb.c, drivers/usb-common.c, drivers/usb- - common.h: drivers/usb-common.{c,h} drivers/*{usb,hid}.c: fix type - of usb_device_id_t vendorID/productID to uint16_t * usb-common.h: - fix the definition * *{usb,hid}.c: sentinel in a table of uint16_t - can not be -1 * usb-common.c: uint16_t for vendor and product -- - change sentinel matcher for full (0,0,NULL) hits - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/scan_xml_http.c: - 32-bit IPv4 addr mask should be uint32_t not int - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/scan_xml_http.c: - 32-bit IPv4 addr should be uint32_t not int - -2021-10-12 Jim Klimov - - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - safety-check and cast use of small mask_byte values - -2021-09-23 Jim Klimov - - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: use - platform-dependent getnameinfo() argument types - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - size_t thread_count and its iterator - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: fix - size_t thread_count and its iterator - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: fix - size_t buf_size - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: align - upscli_*() numa and numq args from "unsigned int" to "size_t", to - match PCONF_CTX_t fields - * server/upsd.c: server/upsd.c: fix comparisons of nfds_t maxconn, - long sysconf() and size_t malloc() - * server/upsd.c: server/upsd.c: check if maxconn<1 to avoid - signedness issues and because zero connections are also useless - * server/upsd.c: server/upsd.c: align use of nfds_t vs. long - (maxconn) for GCC "-Wtype-limits" - -2021-09-22 Jim Klimov - - * server/sstate.c: server/sstate.c: fix missed include - * server/conf.c, server/upsd.c, server/upsd.h: server/upsd.c + - conf.c: align use of nfds_t vs. long (maxconn) - * server/upsd.c: server/upsd.c: align use of uint8_t when - constructing an UUID - * clients/upsclient.c, server/netssl.c: server/netssl.c + - clients/upsclient.c: fix ssl_error() to use ssize_t "ret" - * server/sstate.c: server/sstate.c: fix int casting to read() and - write(), add range checks for bytes written (size_t/ssize_t) - * clients/upsc.c, clients/upsclient.c, clients/upsclient.h, - clients/upscmd.c, clients/upsimage.c, clients/upslog.c, - clients/upsmon.c, clients/upsrw.c, clients/upsset.c, - clients/upsstats.c, docs/man/upscli_get.txt, drivers/dummy-ups.c: - clients/upsclient.h and numerous *.c: align upscli_get(), - upscli_list_start(), upscli_list_next() numa and numq args from - "unsigned int" to "size_t", to match PCONF_CTX_t fields - * clients/upsmon.c: clients/upsmon.c: fix int casting to read() and - write(), add separate retval processing from system() - * clients/upssched.c: clients/upssched.c: fix int casting to read() - and write(), add range checks for bytes written (size_t/ssize_t) - * clients/upsclient.c: clients/upsclient.c: fix receiver of strtol(), - and log a FIXME for sanity checks - * clients/upsmon.c: clients/upsmon.c: fix receiver of strtol() - * clients/upssched.c: clients/upssched.c: fix receiver of strtol() - * clients/upsmon.c: clients/upsmon.c: fix int type for use of - upscli_readline() - * clients/upscmd.c: clients/upscmd.c: fix int type for use of - upscli_readline() - * clients/upsimage.c: clients/upsimage.c: fix int casting - * clients/upsrw.c: clients/upsrw.c: fix receiver of strtol() - * drivers/nutdrv_qx.c, server/netset.c: server/netset.c + - drivers/nutdrv_qx.c: fix consumers of "long" getaux() - * common/str.c: common/str.c: fix buffer int length in str_to_*int*() - methods - * common/state.c, include/state.h, server/sstate.c, server/sstate.h: - common/state.c + server/sstate.c + *.h: aux field is a "long" so - getaux() should return long - * common/common.c, include/common.h: common/common.c: fix use of a - pid_t value - -2021-11-25 Jim Klimov - - * configure.ac: configure.ac: typo fix for ABS_TOP_* determination - -2021-11-25 Jim Klimov - - * docs/FAQ.txt: Update FAQ.txt Update rationale (reasonable use- - cases) for "clone" driver - -2021-11-25 Jim Klimov - - * common/Makefile.am, configure.ac: configure.ac + - common/Makefile.am: detect if building in-tree and differentiate - the recipe involving common.c based on that - * common/Makefile.am: common/Makefile.am: let OpenBSD 6.4 make cope - with common.c recipe - * docs/config-prereqs.txt: docs/config-prereqs.txt: add libusb1 for - OpenBSD - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - concerns about OpenBSD 6.4 freeipmi vs. "-largp" - -2021-11-25 Jim Klimov - - * NEWS, docs/nut.dict: NEWS: added new salicru-hid subdriver in - usbhid-ups for NUT v2.7.5 - -2021-11-25 xbgmsharp - - * drivers/salicru-hid.c: Rename unmapped.* to experimental.* data - points Add untested instant commands - -2021-11-24 xbgmsharp - - * drivers/salicru-hid.c: Update mapping - -2021-11-23 Jim Klimov - - * docs/FAQ.txt: docs/FAQ.txt: extend Q&A on "NUT proxying" with - mention of "clone" driver - -2021-11-22 xbgmsharp - - * data/driver.list.in, drivers/Makefile.am, drivers/salicru-hid.c, - drivers/salicru-hid.h, drivers/usbhid-ups.c, - scripts/upower/95-upower-hid.rules: Initial release for Salicru - driver - * data/driver.list.in, drivers/Makefile.am, drivers/salicru-hid.c, - drivers/salicru-hid.h, drivers/usbhid-ups.c, - scripts/upower/95-upower-hid.rules: Initial release for Salicru - driver - -2021-11-22 Yifeng Li - - * docs/nut.dict: docs/nut.dict: add model name "KRTS". - * docs/man/huawei-ups2000.txt: huawei-ups2000.txt: update tested - models and user report suggestions. - * docs/man/huawei-ups2000.txt: huawei-ups2000.txt: minor typo fixes - -2021-11-22 Jim Klimov - - * docs/FAQ.txt: Update docs/FAQ.txt Add example of dummy-ups (relay - mode) configuration section Co-authored-by: Helmut K. C. Tessarek - - -2021-11-18 Jim Klimov - - * drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups.{c,h}: - typedef snmp_info_t::flags and define its PRI_SU_FLAGS format to - ease type changes later Also adds a "default:" to case for - template flag handling (from FTY fork) - -2021-11-22 Jim Klimov - - * docs/FAQ.txt: docs/FAQ.txt: update for interactions via github - (issues, PRs, ...) - * docs/FAQ.txt: docs/FAQ.txt: update for use-cases of dummy-ups in - relay mode - -2021-11-20 Jim Klimov - - * ci_build.sh: ci_build.sh: Make end of log useful for spellcheck - failure handling - -2021-11-20 Jim Klimov - - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - add a chapter on OpenBSD build agent setup - * configure.ac: configure.ac: require at least autoconf-2.61 (macros - are used that are missing in 2.60 and before) - * autogen.sh: autogen.sh: comment that libtool is also needed - * autogen.sh: autogen.sh: comment about envs that want - AUTOCONF_VERSION or AUTOMAKE_VERSION - * autogen.sh, configure.ac, scripts/augeas/.gitignore, - scripts/devd/Makefile.am, scripts/udev/.gitignore, - scripts/udev/Makefile.am: autogen.sh + configure.ac: try to support - building on systems without Python or Perl - -2021-11-22 Arnaud Quette - - * drivers/mge-xml.c: Eaton XML/PDC: add External Battery Module count - -2021-11-16 Jim Klimov - - * drivers/snmp-ups-helpers.c: drivers/snmp-ups-helpers.c: reshuffle - includes - * drivers/snmp-ups.c: drivers/snmp-ups.c: include main.h => common.h - => config.h first - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix strncmp() limits for - "v1" and "v3" checks (copy-pasting typo) - * drivers/snmp-ups.c: drivers/snmp-ups.c: mention in help that SNMP - version may be "v3" - * drivers/libusb1.c: drivers/libusb1.c: fix devcount and devnum from - ssize_t to size_t - -2021-11-15 Jim Klimov - - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - printf() assumes floating-point numbers are doubles, satisfy its - warnings - * drivers/libusb1.c: drivers/libusb1.c: drop extra "int i" definition - * ci_build.sh: ci_build.sh: NUT_USB_VARIANT= => --with- - usb=libusb [libusb-1.0+0.1 branch] - * ci_build.sh: ci_build.sh: NUT_USB_VARIANT=no => --without-usb - explicitly - * ci_build.sh: ci_build.sh: default-all-errors: report - BUILDSTODO_INITIAL at the end of log, and if non-zero BUILDSTODO - remained unaccounted - * ci_build.sh: ci_build.sh: report which SSL/USB variants will be - looped - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - use a longer global var name for modbus_ctx (nee ctx) - * drivers/bcmxcp_ser.c, drivers/bcmxcp_ser.h, tools/nut- - scanner/scan_eaton_serial.c: drivers/bcmxcp_ser.{c,h} + tools/nut- - scanner/scan_eaton_serial.c: use longer global var name (AUT => - BCMXCP_AUTHCMD) - * drivers/bestfortress.c: drivers/bestfortress.c: comment an - analyzer-check complaint - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: avoid useless - comparison (warning) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: only define - "Compatibility layer between libusb 0.1 and 1.0" if we build with - QX_USB at all (no required headers are in context otherwise) - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts for SSL+USB are planned same as executed - and - handle explicit NUT_USB_VARIANTS=no - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts for SSL+USB are planned same as executed - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts are decremented when configuration failed - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": between - configure and build, report the Configured NUT_USB_VARIANT - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": between - configure and build, report the Configured NUT_SSL_VARIANT - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": support - looping over NUT_USB_VARIANTS as well - * drivers/libhid.c: drivers/libhid.c: HIDDumpTree(): mark that arg - "hd" is not used in SHUT_MODE - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: the "additional - USB-related checks" should now manipulate "LIBS" not "LIBUSB_LIBS" - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: comment on - "additional USB-related checks" - * m4/nut_check_libusb.m4: Move "additional USB-related checks" from - configure.ac to m4/nut_check_libusb.m4 - * drivers/nutdrv_qx.c: [libusb-1.0] Realign buffer casting to - (usb_ctrl_char) after merge from master - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - merge conflict [libusb-1.0+0.1] - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: complete the merge - from master to libusb-1.0+0.1 - * ci_build.sh: ci_build.sh: NUT_USB_VARIANT=no => --without-usb - explicitly - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: fix definition of - curDevice (libusb-1.0) - * ci_build.sh: ci_build.sh: default-all-errors: report - BUILDSTODO_INITIAL at the end of log, and if non-zero BUILDSTODO - remained unaccounted - * ci_build.sh: ci_build.sh: default-all-errors: report - BUILDSTODO_INITIAL at the end of log, and if non-zero BUILDSTODO - remained unaccounted - * ci_build.sh: ci_build.sh: report which SSL/USB variants will be - looped - -2018-03-14 Daniele Pezzini - - * data/cmdvartab, docs/nut-names.txt: libusb: update example of - driver.version.usb and add it to cmdvartab - -2021-11-15 François-Régis Degott - - * drivers/eaton-ats16-nm2-mib.c: eaton-ats16-nm2-mib.c: fix mul coef. - for ambient.temperature and humidity (#1173) * eaton- - ats16-nm2-mib.c: fix mul coef. for ambient.temperature and - ambient.humidity * Update eaton-ats16-nm2-mib.c Co-authored-by: - Arnaud Quette - -2021-11-15 Jim Klimov - - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": between - configure and build, report the Configured NUT_SSL_VARIANT - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts are decremented when configuration failed - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: avoid useless - comparison (warning) - * drivers/bestfortress.c: drivers/bestfortress.c: comment an - analyzer-check complaint - * drivers/bcmxcp_ser.c, drivers/bcmxcp_ser.h, tools/nut- - scanner/scan_eaton_serial.c: drivers/bcmxcp_ser.{c,h} + tools/nut- - scanner/scan_eaton_serial.c: use longer global var name (AUT => - BCMXCP_AUTHCMD) - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - use a longer global var name for modbus_ctx (nee ctx) - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - use a longer global var name for modbus_ctx (nee ctx) - * drivers/bcmxcp_ser.c, drivers/bcmxcp_ser.h, tools/nut- - scanner/scan_eaton_serial.c: drivers/bcmxcp_ser.{c,h} + tools/nut- - scanner/scan_eaton_serial.c: use longer global var name (AUT => - BCMXCP_AUTHCMD) - * drivers/bestfortress.c: drivers/bestfortress.c: comment an - analyzer-check complaint - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: avoid useless - comparison (warning) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: only define - "Compatibility layer between libusb 0.1 and 1.0" if we build with - QX_USB at all (no required headers are in context otherwise) - * configure.ac: configure.ac: neuter "nut_usb_lib" if building - --without-usb - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts for SSL+USB are planned same as executed - and - handle explicit NUT_USB_VARIANTS=no - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts for SSL+USB are planned same as executed - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": ensure - BUILDSTODO counts are decremented when configuration failed - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": between - configure and build, report the Configured NUT_USB_VARIANT - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": between - configure and build, report the Configured NUT_SSL_VARIANT - * ci_build.sh: ci_build.sh: BUILD_TYPE="default-all-errors": support - looping over NUT_USB_VARIANTS as well - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: report a NOTICE if - libusb-1.0 support was detected, but another was chosen - * drivers/libhid.c: drivers/libhid.c: HIDDumpTree(): mark that arg - "hd" is not used in SHUT_MODE - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: the "additional - USB-related checks" should now manipulate "LIBS" not "LIBUSB_LIBS" - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: comment on - "additional USB-related checks" - * configure.ac, m4/nut_check_libusb.m4: Move "additional USB-related - checks" from configure.ac to m4/nut_check_libusb.m4 - * configure.ac, docs/configure.txt, m4/nut_check_libusb.m4: - m4/nut_check_libusb.m4 et al: add support for --with-libusb- - version=(auto|0.1|1.0) - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: restore "ret" lost in - merging - * drivers/riello_usb.c: drivers/riello_usb.c: properly export - variables shared between driver subtypes (reapply to libusb-1.0 - branch) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: add a bit more of - "Compatibility layer between libusb 0.1 and 1.0" - * drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c: [libusb-1.0] Realign use of - nut_usb_strerror() after merge from master - * drivers/libusb1.c, drivers/nutdrv_qx.c: [libusb-1.0] Realign buffer - casting to (usb_ctrl_char) after merge from master - -2021-11-13 Dan Benton - - * data/driver.list.in: Add CyberPower RMCARD205 which is supported - -2021-11-13 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: hide clang-3.4 warnings - about str{n}cmp() args into pragmas - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: detect general "-Warray- - bounds" support - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: detect general - "-Wtautological-compare" - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: detect "pragma clang - diagnostic push/pop" support (needed with older clang versions not - on par with GCC) - * drivers/snmp-ups-helpers.c: drivers/snmp-ups-helpers.c: include - "config.h" before any system headers (such as time.h indirectly) - * configure.ac: configure.ac: be sure to detect "time.h" - * ci_build.sh: ci_build.sh: support a common DO_CLEAN_CHECK=no - -2021-11-13 Jim Klimov - - * drivers/snmp-ups-helpers.c: drivers/snmp-ups-helpers.c: include a - header, avoid a warning - * UPGRADING, docs/nut.dict: NEWS: updated build against various - generations of Net-SNMP for NUT v2.7.5 - * docs/configure.txt, m4/nut_check_libnetsnmp.m4: - m4/nut_check_libnetsnmp.m4: allow --with-netsnmp-config(=yes) to - mean prefer_NET_SNMP_CONFIG=true - * NEWS: NEWS: updated build against various generations of FreeIPMI - for NUT v2.7.5 - * drivers/snmp-ups.c: drivers/snmp-ups.c: replace strcmp("short - string") with strncmp() (clang-3.4 warns about array out of bounds) - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: resolve a "tautological - compare" when building on older agents - * drivers/nut-ipmi.h, drivers/nut-ipmipsu.c, drivers/nut- - libfreeipmi.c: drivers/nut-libfreeipmi.c nut-ipmipsu.c nut-ipmi.h: - adjust input_voltage_range_t (args of - ipmi_fru_multirecord_power_supply_information() vs. - ipmi_fru_parse_multirecord_power_supply_information() in different - FreeIPMI releases) [issue #1175] - * drivers/Makefile.am: drivers/Makefile.am: disable quick-hack of - nut_ipmipsu_CFLAGS+="-Wno-pointer-sign" [issue #1175] - * m4/nut_check_libusb.m4: m4/nut_check_libusb.m4: consider - have_PKG_CONFIG - * m4/nut_check_libopenssl.m4: m4/nut_check_libopenssl.m4: consider - have_PKG_CONFIG - * m4/nut_check_libnss.m4: m4/nut_check_libnss.m4: consider - have_PKG_CONFIG - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: consider - have_PKG_CONFIG - * m4/nut_check_libneon.m4: m4/nut_check_libneon.m4: consider - have_PKG_CONFIG - * m4/nut_check_libmodbus.m4: m4/nut_check_libmodbus.m4: consider - have_PKG_CONFIG - * m4/nut_check_libgd.m4: m4/nut_check_libgd.m4: consider - have_PKG_CONFIG - * m4/nut_check_libfreeipmi.m4: m4/nut_check_libfreeipmi.m4: consider - have_PKG_CONFIG - * m4/nut_check_libavahi.m4: m4/nut_check_libavahi.m4: consider - have_PKG_CONFIG - * m4/nut_check_pkgconfig.m4: m4/nut_check_pkgconfig.m4: separate - detection of support for have_PKG_CONFIG vs have_PKG_CONFIG_MACROS - * configure.ac: configure.ac: call PKG_CONFIG for systemd settings - query only if we have_PKG_CONFIG, and die if "yes" was required but - query is not possible - * m4/nut_check_pkgconfig.m4: m4/nut_check_pkgconfig.m4: extend to - consider PKG_CONFIG possibly detected by autoconf - * configure.ac, m4/nut_check_pkgconfig.m4: configure.ac: evict - NUT_CHECK_PKGCONFIG into m4/nut_check_pkgconfig.m4 - * clients/upsmon.c, drivers/mge-utalk.c, drivers/snmp-ups.c, - tools/nut-scanner/scan_snmp.c: clients/upsmon.c tools/nut- - scanner/scan_snmp.c drivers/snmp-ups.c mge-utalk.c: avoid - strcmp("") as the implementation may be invalid (reaches out of - one-element array for "") - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: whitespace - fix (indent if-clause content) - -2021-11-12 Jim Klimov - - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: support - (and prefer) pkg-config info to net-snmp-config script(s) - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: separate - "distcheck-valgrind" from "default-nodoc", to filter away - "NUT_BUILD_CAPS=valgrind=no" agents - -2021-11-13 Jim Klimov - - * ci_build.sh: ci_build.sh: update guessing SYS_PKG_CONFIG_PATH for - *openindiana*|*omnios*|*solaris*|*illumos*|*sunos* - * ci_build.sh: ci_build.sh: for optional_maintainer_clean_check(), - ignore ".ci*.log*" files if present - -2021-11-12 Jim Klimov - - * ci_build.sh: ci_build.sh: report which PWD failed a "git status" - query - * ci_build.sh: ci_build.sh: report if ".git" disappeared during - *clean check [issue #1167] - -2021-11-11 Jim Klimov - - * drivers/snmp-ups.h: drivers/snmp-ups.h: fix remaining SU_* flag - bits to (unsigned long), to match snmp_info_t->flags type - * drivers/snmp-ups.h: drivers/snmp-ups.h: comment SU_* bit usage by - bit-shifting macros - * drivers/snmp-ups.h: drivers/snmp-ups.h: wrap long comments, and - detail where flag-field bits come from - * drivers/snmp-ups.h: drivers/snmp-ups.h: comment typical use of - SU_TYPE(t) macro - * drivers/snmp-ups.h: drivers/snmp-ups.h: fix SU_TYPE_DAISY(t) macro - (had no arg) - * drivers/snmp-ups.h: drivers/snmp-ups.h: whitespace fixes - * drivers/snmp-ups.h: drivers/snmp-ups.h: comment SU_STATUS_NUM_ELEM - as possibly obsolete - -2021-10-27 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix buffer size to possibly - print max size_t - -2021-10-26 Jim Klimov - - * drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups.{c,h}: fix - SU_FLAG_* to (unsigned long) and their usage, to match - snmp_info_t->flags type - * drivers/snmp-ups.c: drivers/snmp-ups.c: decode_str(): range-check - return of snprintf() - -2021-11-11 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - rearrange lines to better match with 42ITy fork - * NEWS, docs/nut.dict: NEWS: improved SNMPv3 Auth/Priv algo support, - and nut-scanner threadcount, for NUT v2.7.5 - -2021-11-10 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am: hotfix header - (in)compatibility of different IPMI versions - * drivers/Makefile.am: drivers/Makefile.am: hotfix header - (in)compatibility of different IPMI versions - * drivers/Makefile.am: drivers/Makefile.am: hotfix header - (in)compatibility of different IPMI versions - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: hunnox_step is only used - qith QX_USB - * drivers/bcmxcp_usb.c, drivers/libusb.h, drivers/nutdrv_atcl_usb.c, - drivers/nutdrv_qx.c, drivers/richcomm_usb.c, - drivers/tripplite_usb.c: drivers/*usb*: align whitespace changes - with libusb-1.0 branch - * drivers/Makefile.am: drivers/Makefile.am: use LIBUSB_IMPL macro to - align with libusb-1.0 branch - * drivers/libusb.c: drivers/libusb.c: whitespace fixes and message - fixes to align with libusb-1.0 branch - * drivers/libusb.c, drivers/libusb.h, drivers/powervar-hid.c, - drivers/usbhid-ups.c: drivers/libusb.{c,h} + powervar-hid.c + - usbhid-ups.c: whitespace fixes after PR #1044 - * docs/config-prereqs.txt: docs/config-prereqs.txt: mention further - I2C-related packages in Debian/Ubuntu distros - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, report the - start of build variant and how many remain - * Makefile.am, clients/Makefile.am, common/Makefile.am, - conf/Makefile.am, data/Makefile.am, data/html/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - drivers/Makefile.am, include/Makefile.am, lib/Makefile.am, - scripts/Makefile.am, scripts/Solaris/Makefile.am, - scripts/augeas/Makefile.am, scripts/devd/Makefile.am, - scripts/hotplug/Makefile.am, scripts/python/Makefile.am, - scripts/systemd/Makefile.am, scripts/udev/Makefile.am, - scripts/ufw/Makefile.am, scripts/upsdrvsvcctl/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/Makefile.am, - tools/nut-scanner/Makefile.am: */Makefile.am: ensure that `make - maintainer-clean` also removes .dirstamp files - * .gitignore: .gitignore: remove a redundancy - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, ignore - strange exit-code from `expr` - if the maths result was "0" - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, ignore - strange exit-code from `expr` - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, do not - distclean before build (this just spends time to generate the - Makefile to kill it) - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, report - "SUCCEEDED build(s)" after final optional_maintainer_clean_check() - if that is called - * ci_build.sh: ci_build.sh: dumb down can_clean_check() to pass "set - -e" shells - * ci_build.sh: ci_build.sh: optional_*_clean_check() quickly skip if - there is no Makefile - * ci_build.sh: ci_build.sh: in "default-all-errors" mode, count - expected/remaining BUILDSTODO and call - optional_maintainer_clean_check() for the last iteration and - optional_dist_clean_check() for others - * ci_build.sh: ci_build.sh: introduce can_clean_check() to not fail - when we have nothing to test against - -2021-11-09 Jim Klimov - - * Makefile.am: Makefile.am: first-shot "git-realclean-check" and - targets to print *CLEANFILES lists - * ci_build.sh: ci_build.sh: introduce optional_dist_clean_check() to - use e.g. in "default-all-errors" case - * ci_build.sh: ci_build.sh: in loop for "default-all-errors", report - "build" successes as such - * ci_build.sh: ci_build.sh: skip optional_maintainer_clean_check() if - there is no .git [issue #1167] - -2021-11-09 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: consider SNMPv3 Auth/Priv - algos detected by configure script when reporting the usage (via - addvar() help messages) [issue #1169] - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - consider SNMPv3 Auth/Priv algos detected by configure script when - reporting the usage [issue #1169] - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: - comment the comment - * tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c + scan_snmp.c + scan_nut.c: ifdef the - references to max_threads_scantype - -2021-11-09 Jim Klimov - - * configure.ac: configure.ac: limit the impact of linux_i2c absent - libs when "auto" mode was requested - * ci_build.sh: ci_build.sh: start default build from a clean slate, - and do not REQUIRE to be able to build everything (do auto-detect) - * tests/Makefile.am, tools/nut-scanner/Makefile.am: tools/nut- - scanner/Makefile.am, tests/Makefile.am: do not refer to - LINKED_SOURCE_FILES with extra paths - -2021-11-09 Jim Klimov - - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: note about PTY definitions - * docs/config-prereqs.txt: docs/config-prereqs.txt: say a bit more - about OSes with containers - * docs/config-prereqs.txt: docs/config-prereqs.txt: say a bit more - about "General call to Test" and mention "ci_build.sh" - * docs/config-prereqs.txt, docs/nut.dict: docs/config-prereqs.txt: - revise pkgs available in Debian-like operating systems - -2021-11-08 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: use detected - NUT_HAVE_LIBNETSNMP_usm* support to define and use actual Priv or - Auth types - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: use - detected NUT_HAVE_LIBNETSNMP_usm* support to define and use actual - Priv or Auth types - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: detect - support of usmAES128PrivProtocol in Net-SNMP we build against - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: detect - support of (NETSNMP_DRAFT_BLUMENTHAL_AES_04) usmAES192PrivProtocol - usmAES256PrivProtocol in Net-SNMP we build against - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: detect - support of usmDESPrivProtocol usmHMACMD5AuthProtocol - usmHMACSHA1AuthProtocol in Net-SNMP we build against - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: detect - support of usmHMAC256SHA384AuthProtocol - usmHMAC384SHA512AuthProtocol usmHMAC192SHA256AuthProtocol in Net- - SNMP we build against - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: ifdef - all references to NETSNMP_DRAFT_BLUMENTHAL_AES_04 related code - * tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-init.c: - tools/nut-scanner/... : move init/destroy of threadcount_mutex from - nut-scanner.c to nutscan-init.c - -2021-11-05 Dim - - * drivers/snmp-ups.c, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/scan_snmp.c: Added new auth methods to snmp - -2021-11-08 Jim Klimov - - * tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_xml_http.c: tools/nut-scanner/scan_eaton_serial.c + - scan_nut.c + scan_snmp.c + scan_xml_http.c: release global - semaphores in final protocol-scanner tread reaping - * tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_xml_http.c: tools/nut-scanner/scan_eaton_serial.c + - scan_nut.c + scan_snmp.c + scan_xml_http.c: report if we are - waiting for semaphored threads to complete - -2017-10-31 barraudl - - * tools/nut-scanner/Makefile.am, tools/nut-scanner/README, tools/nut- - scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/nutscan-init.c, tools/nut-scanner/nutscan-init.h: Revise - use of semaphores in nut-scanner vs libnutscanner Original commit - in 42ITy fork in 2017: "Fix the Debian package generation" Adapted - into NUT upstream code, considering 4 years of codebase evolution, - in 2021: - -2017-10-23 barraudl - - * configure.ac, tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut- - scanner.c, tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_xml_http.c: Add thread limitation to avoid memory - error Original development in 42ITy fork in 2017: UPDATE: Merged - with NUT upstream, considering evolution of codebases over 4 years - since original commit, revised 2021: - -2021-11-08 Jim Klimov - - * drivers/mge-hid.c: drivers/mge-hid.c: actively check and warn if we - truncated the string - * drivers/gamatronic.c: drivers/gamatronic.c: actively check and warn - if we truncated the string - * docs/nut.dict: docs/nut.dict: update for recent NEWS - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - safely limit a strncpy() call - * drivers/oneac.c: drivers/oneac.c: shield a potentially truncating - snprintf() into a small buffer - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION - * drivers/mge-hid.c: drivers/mge-hid.c: shield a potentially - truncating snprintf() into a small buffer - -2021-11-08 Jim Klimov - - * configure.ac: configure.ac: for CppUnit, also sanity-check - CPPUNIT_ASSERT_MESSAGE() - -2021-11-07 Jim Klimov - - * clients/Makefile.am: clients/Makefile.am: depend on "dummy" recipe - to re-evaluate out-of-dir libs (so development iterations in them - are reflected in rebuilds) - * drivers/Makefile.am: drivers/Makefile.am: depend on "dummy" recipe - to re-evaluate out-of-dir libs (so development iterations in them - are reflected in rebuilds) - * server/Makefile.am: server/Makefile.am: depend on "dummy" recipe to - re-evaluate out-of-dir libs (so development iterations in them are - reflected in rebuilds) - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - depend on "dummy" recipe to re-evaluate out-of-dir libs (so - development iterations in them are reflected in rebuilds) - * tests/Makefile.am: tests/Makefile.am: depend on "dummy" recipe to - re-evaluate out-of-dir libs (so development iterations in them are - reflected in rebuilds) - * tests/Makefile.am: tests/Makefile.am: drop obsoleted comment - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: add - test_strarr_alloc() This may seem trivial, but there are - suspicions this allocation does not always work (e.g. NUT issue - #1126) - -2021-11-07 Jim Klimov - - * drivers/gamatronic.c: drivers/gamatronic.c: shield a potentially - truncating snprintf() into a small buffer - * drivers/bcmxcp.c: drivers/bcmxcp.c: shield a potentially dangerous - snprintf() into a small buffer as tested-safe - * clients/upscmd.c: clients/upscmd.c: shield a potentially dangerous - snprintf() into a small buffer as tested-safe - * clients/upsrw.c: clients/upsrw.c: shield a potentially dangerous - snprintf() into a small buffer as tested-safe - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: add - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION - -2021-11-07 Jim Klimov - - * clients/nutclient.cpp: clients/nutclient.cpp: safety check in - strarr_alloc(): returned pointer should be not null - * clients/nutclient.h: tests/nutclienttest.h: whitespace fixes - (indent chars) - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: whitespace fixes - (wrap long lines for maintainability) - -2021-11-07 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: load_mib2nut(): do not - report "Unknown mibs value" just if a device did not match the - mapping [NUT issue #1141] - * drivers/snmp-ups.c: drivers/snmp-ups.c: refactor load_mib2nut() to - not `strcmp(mib, "auto")` many times - -2021-11-07 Jim Klimov - - * drivers/snmp-ups.c: Update snmp-ups.c Fix use of `char - su_scratch_buf[255]` (original static array moved to another file - in master branch), and bump `DRIVER_VERSION` - -2021-11-07 Jim Klimov - - * NEWS: NEWS: added snmp-ups support for ondelay/offdelay for - NUT-2.7.5 - -2021-11-07 Jim Klimov - - * drivers/snmp-ups.c: Update snmp-ups.c Use the common (and - sufficiently large for any runaway numeric madness) - `su_scratch_buf` instead of a local `char[6]` buffer. - * drivers/snmp-ups.c: Update snmp-ups.c A few small whitespace fixes - -2021-11-07 Jim Klimov - - * drivers/arduino-hid.c: drivers/arduino-hid.c: normalize whitespace - for NUT codebase - * drivers/arduino-hid.c, drivers/arduino-hid.h: drivers/arduino- - hid.{c,h}: update (C) to arduino-hid support author - * NEWS: NEWS: added usbhid-ups new subdriver arduino-hid support for - NUT-2.7.5 - * NEWS: NEWS: added USB HID support on interface number greater than - 0 for NUT-2.7.5 - * NEWS: NEWS: added huawei-ups2000 support for NUT-2.7.5 - -2021-11-07 Jim Klimov - - * docs/man/huawei-ups2000.txt: Update huawei-ups2000.txt Made the - `configure` example a bit friendlier for copy-pasting. - -2021-11-06 Jim Klimov - - * tests/.gitignore, tools/nut-scanner/.gitignore: GitIgnore - LINKED_SOURCES (follow-up to PR #1159) - * .gitignore: GitIgnore .dirstamp in build trees - * Makefile.am: Makefile.am: move removal of dist tarballs and build - packages from "distclean" to "maintainer-clean" - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: mark - use of LINKED_SOURCE_FILES as "nodist" - * tests/Makefile.am: tests/Makefile.am: mark use of - LINKED_SOURCE_FILES as "nodist" - * Makefile.am: Makefile.am: add a "make realclean" as alias to - maintainer-clean - * Makefile.am: Makefile.am: typo fix MAINTAINERCLEAN_FILES => - MAINTAINERCLEANFILES - * ci_build.sh: ci_build.sh: there is no default "make realclean" - implem in autotools, fall back to "maintainer-clean" support for - wipingg the workspace - * Makefile.am, clients/Makefile.am, common/Makefile.am, - conf/Makefile.am, data/Makefile.am, data/html/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - drivers/Makefile.am, include/Makefile.am, lib/Makefile.am, - scripts/Makefile.am, scripts/Solaris/Makefile.am, - scripts/augeas/Makefile.am, scripts/devd/Makefile.am, - scripts/hotplug/Makefile.am, scripts/python/Makefile.am, - scripts/systemd/Makefile.am, scripts/udev/Makefile.am, - scripts/ufw/Makefile.am, scripts/upsdrvsvcctl/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/Makefile.am, - tools/nut-scanner/Makefile.am: */Makefile.am: there is no default - "make realclean" implem in autotools, fall back to "maintainer- - clean" support for wipingg the workspace - * Makefile.am, clients/Makefile.am, common/Makefile.am, - conf/Makefile.am, data/Makefile.am, data/html/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - drivers/Makefile.am, include/Makefile.am, lib/Makefile.am, - scripts/Makefile.am, scripts/Solaris/Makefile.am, - scripts/augeas/Makefile.am, scripts/devd/Makefile.am, - scripts/hotplug/Makefile.am, scripts/python/Makefile.am, - scripts/systemd/Makefile.am, scripts/udev/Makefile.am, - scripts/ufw/Makefile.am, scripts/upsdrvsvcctl/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/Makefile.am, - tools/nut-scanner/Makefile.am: */Makefile.am: reshuffle what we - remove as part of "make distclean" vs. "make realclean" (can be - remade only by autogen.sh) - * Makefile.am: Makefile.am: do not "distclean" away some more parts - of "configure" script ecosystem (leave that to "realclean") - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - restore use of $(builddir) for LINKED_SOURCE_FILES - * tests/Makefile.am: tests/Makefile.am: restore use of $(builddir) - for LINKED_SOURCE_FILES - * ci_build.sh: ci_build.sh: call optional_realclean_check() after - more build variants - * tools/Makefile.am: tools/Makefile.am: distclean the helper scripts - that can be re-made - * ci_build.sh: ci_build.sh: change the cleanliness check from - "distcheck" to "realcheck" and factor into a method - * Makefile.am: Makefile.am: regenerate the helper needed for - ChangeLog if cleaned away - * Makefile.am: Makefile.am: delete the configure script and its - components not in a "make distclean" but in "make realclean" - -2021-11-05 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: use - BUILT_SOURCES=LINKED_SOURCE_FILES to avoid dist-ing temporary - symlinks as files - * tests/Makefile.am: tests/Makefile.am: use - BUILT_SOURCES=LINKED_SOURCE_FILES to avoid dist-ing temporary - symlinks as files - * ci_build.sh: ci_build.sh: only call dpkg if present - * ci_build.sh: ci_build.sh: configure_nut(): call ./autogen.sh before - CONFIGURE_SCRIPT if there is no configure script - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - revise the magic of LINKED_SOURCE_FILES for distcheck - * tests/Makefile.am: tests/Makefile.am: revise the magic of - LINKED_SOURCE_FILES for distcheck - * ci_build.sh: ci_build.sh: add a DO_DISTCHECK_CLEAN to make sure we - clean everything made, and no more (after any distcheck) - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - revise the magic of LINKED_SOURCE_FILES for distcheck - * tests/Makefile.am: tests/Makefile.am: revise the magic of - LINKED_SOURCE_FILES for distcheck - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: make - sure to symlink sources into $(builddir)/ - * tests/Makefile.am: tests/Makefile.am: make sure to symlink sources - into $(builddir)/ - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: work - around dmake bugs - * tests/Makefile.am: tests/Makefile.am: work around dmake bugs - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: quote - pathnames, and force the symlink (to overwrite older if any) - * tests/Makefile.am: tests/Makefile.am: quote pathnames, and force - the symlink (to overwrite older if any) - * Makefile.am: Makefile.am: distclean-local: first find(), then rm() - the findings (find-recursion fails otherwise) - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - symlink source used from another directory into current builddir, - do avoid external ".deps/" usage - * tests/Makefile.am: tests/Makefile.am: symlink source used from - another directory into current builddir, do avoid external ".deps/" - usage - * Makefile.am, clients/Makefile.am, common/Makefile.am, - drivers/Makefile.am, server/Makefile.am, tests/Makefile.am, - tools/nut-scanner/Makefile.am: */Makefile.am: Do not clean ".deps" - in SUBDIRS of the main project - * Makefile.am, clients/Makefile.am, common/Makefile.am, - conf/Makefile.am, data/Makefile.am, data/html/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - drivers/Makefile.am, include/Makefile.am, lib/Makefile.am, - scripts/Makefile.am, scripts/Solaris/Makefile.am, - scripts/augeas/Makefile.am, scripts/devd/Makefile.am, - scripts/hotplug/Makefile.am, scripts/python/Makefile.am, - scripts/systemd/Makefile.am, scripts/udev/Makefile.am, - scripts/ufw/Makefile.am, scripts/upsdrvsvcctl/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/Makefile.am, - tools/nut-scanner/Makefile.am: */Makefile.am: revise CLEANFILES and - DISTCLEANFILES (favored over clean-local target rules) - -2021-11-04 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: use - libcommon.la as part of libnutscan.(la|so) - -2021-11-04 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: do - not build common.c into nut-scanner (avoid double-definition of - nut_debug_level among other things) - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: fix - rule for NUT_SCANNER_DEPS to be sure - * clients/Makefile.am, common/Makefile.am, drivers/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/nut- - scanner/Makefile.am: */Makefile.am: define dependencies on out-of- - dir *.la helper libs: use AM_MAKEFLAGS (follows-up to PR #1151) - -2021-11-04 Jim Klimov - - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - revise parsing of --thread via strtol() Inspired by 42ITy fork - approach to similar issue - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - rename "--jobs" to "--thread" Inspired by 42ITy fork approach to - similar issue - -2021-11-04 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: fix - rule for NUT_SCANNER_DEPS to be sure - * clients/Makefile.am, common/Makefile.am, drivers/Makefile.am, - server/Makefile.am, tests/Makefile.am, tools/nut- - scanner/Makefile.am: */Makefile.am: define dependencies on out-of- - dir *.la helper libs: use AM_MAKEFLAGS (follows-up to PR #1151) - -2021-11-04 Jim Klimov - - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - refine sanity-checks for nofile_limit.rlim_cur value range - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_xml_http.c: tools/nut-scanner/nut-scanner.c - + scan_xml_http.c + scan_snmp.c + scan_nut.c + nut-scan.h: Add a - hard limit on netxml scanning thread count - * configure.ac, tools/nut-scanner/nut-scanner.c: tools/nut- - scanner/nut-scanner.c + configure.ac: detect if getrlimit() is - usable - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - constrain default or requested job count with current `ulimit -n` - (minus known overhead) - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - whitespace fix - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - wrap long line - -2021-11-03 Jim Klimov - - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: limit thread count like in scan_snmp.c - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: limit - thread count like in scan_snmp.c - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: define TRUE/FALSE - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: limit thread count like in scan_snmp.c - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - comment "#endif // HAVE_PTHREAD" to navigate in code better - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: only - loop to free the thread_array if any were allocated - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/scan_snmp.c: - tools/nut-scanner/nut-scan.h + scan_snmp.c: (C) header and some - cosmetic fixes - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - bump default max_threads to not lag with /24 subnets - -2021-11-03 Jim Klimov - - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: only - sleep after attempting pthread_tryjoin_np() if nothing got cleaned - away - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: hide - debug logging for thread herding - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/scan_snmp.c: - tools/nut-scanner/scan_snmp.c: update comments and messages - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - update log-tracing of pthread herding - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: move - locking of total thread count change when we add one - -2021-11-03 Jim Klimov - - * configure.ac, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/scan_snmp.c: configure.ac, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/nut-scanner.c: not all glibc versions - HAVE_PTHREAD_TRYJOIN - -2021-11-03 Jim Klimov - - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: limit - the thread count for parallelized scanning - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - add a threadcount_mutex to use in all children - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - handle max_threads, curr_threads - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - add support for -j N (--jobs=N) option to limit simultaneous - scanning threads - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - comment a FIXME for limiting the pthread count - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - nutscan_cidr_to_ip(): forbid scanning whole Internet - -2021-11-03 Jim Klimov - - * tests/.gitignore: GitIgnore test log and trace for "getvaluetest" - -2021-11-03 Jim Klimov - - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - tone down the debug-logging of CIDR processing - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - only free cidr_tok after we are done manipulating its memory buffer - * tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-ip.c: - nutscan-ip.c, nut-scanner.c: instrument the CIDR processing to - trace an error - -2021-11-02 Jim Klimov - - * docs/documentation.txt, docs/man/dummy-ups.txt: - docs/documentation.txt + docs/man/dummy-ups.txt: refer to - `tools/nut-ddl-dump.sh` in the same manner (issue #1111) - * docs/man/dummy-ups.txt: docs/man/dummy-ups.txt: fix use of "link:" - tag in asciidoc (issue #1111) and slightly reword - * docs/documentation.txt: docs/documentation.txt: fix use of "link:" - tag in asciidoc (issue #1111) and slightly reword - * docs/nut-names.txt: docs/nut-names.txt: fix use of "link:" tag in - asciidoc (issue #1111) - * docs/developers.txt: docs/developers.txt: fix use of "link:" tag in - asciidoc (issue #1111) - -2021-11-01 Jim Klimov - - * ci_build.sh: ci_build.sh: give the caller a way to disable parallel - builds with PARMAKE_FLAGS=" " (space) - * ci_build.sh: ci_build.sh: enable parallel builds for default build - (one without a BUILD_TYPE specified) - * ci_build.sh: ci_build.sh: enable parallel builds for "distcheck" in - default builds, which should now pass well (after usual build and - check passed) - * ci_build.sh: ci_build.sh: report chosen settings for parallel - builds - * configure.ac: configure.ac: test more proactively if valgrind can - test things and not crash by itself - * ci_build.sh: ci_build.sh: enable parallel builds for "default- - tgt:*" which should now pass well - * ci_build.sh: ci_build.sh: guess the available amount of parallelism - for the current system; consider load averages for GNU Make too - * docs/Makefile.am, docs/man/Makefile.am: docs/(man/)Makefile.am: - move back to builddir all files for the built documents, not just - the target name - * docs/Makefile.am, docs/man/Makefile.am: docs/(man/)Makefile.am: - before putting back the built documents, clean up the destination - if needed and make the workdir removable if needed (a2x can copy - system/EXTRA_DIST resources with their attrs) - -2021-10-31 Jim Klimov - - * docs/Makefile.am, docs/man/Makefile.am: docs/(man/)Makefile.am: - only delete target before build if it is a directory (chunked HTML) - * docs/Makefile.am: docs/Makefile.am: update comment about - destination dir for asciidoc/a2x - * docs/man/Makefile.am: Revert "docs/man/Makefile.am: tone down the - use of "touch" for multicomponent docs" This reverts commit - 0b9ac2500ddbc7bd11a639805d43cda9259bfb1f. - * docs/Makefile.am: docs/Makefile.am: avoid potential for races where - same document is built several times (mentioned in different list - variables) - * docs/man/Makefile.am: docs/man/Makefile.am: avoid races where same - document is built several times (mentioned in different list - variables) - * docs/man/Makefile.am: Revert "docs/man/Makefile.am: avoid races - where same document is built several times (mentioned in different - list variables)" This reverts commit - 29ae5a8f6e5524d689ebaf2abdf508528288b010. - * docs/man/Makefile.am: docs/man/Makefile.am: tag DOC-MAN-HTML - visibly different from DOC-HTML of the main docs dir - * docs/man/Makefile.am: docs/man/Makefile.am: avoid races where same - document is built several times (mentioned in different list - variables) - * docs/man/Makefile.am: docs/man/Makefile.am: tone down the use of - "touch" for multicomponent docs - * docs/.gitignore, docs/Makefile.am, docs/man/.gitignore, - docs/man/Makefile.am: docs/(man/)Makefile.am: fan out doc builds - into subdirectories, where we can, so parallel runs do not collide - -2021-11-01 Jim Klimov - - * ci_build.sh: ci_build.sh: update the heading comment - -2021-10-31 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am: whitespace fixes (drop - some indentation) - -2021-10-30 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am: as developer aid, add - "(all-)docs" target to try building all types regardless of - enablement by configure script; also add "make man" support - -2021-10-31 Jim Klimov - - * ci_build.sh: ci_build.sh: support CI_REQUIRE_GOOD_GITIGNORE=false - to bypass fatal error on git status being not empty after build - -2021-10-30 Jim Klimov - - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - reference nut_version.h in a way that does not offend "make - dist(check)" - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am: - reference some out-of-dir sources via top_srcdir (not ../..) - * clients/Makefile.am, drivers/Makefile.am, server/Makefile.am, - tests/Makefile.am, tools/nut-scanner/Makefile.am: */Makefile.am: - define dependencies on out-of-dir *.la helper libs, and reference - them via top_builddir (not ..) - * common/Makefile.am: common/Makefile.am: reference nut_version.h in - a way that does not offend "make dist(check)" - * ci_build.sh: ci_build.sh: default "minimal" ritual should not spend - half the time building docs - -2021-10-04 Jim Klimov - - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: range-check - and cast returned ipmi_dev->sensors_count - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: - libfreeipmi_get_sensors_info(): we check that sdr_record_len is not - negative, so can cast to (uint) - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: - libfreeipmi_get_board_info(): range-check and cast mfg_date_time - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: - libfreeipmi_get_psu_info(): range-check and cast libfreeipmi method - arguments which are ints - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: - libfreeipmi_get_psu_info(): range-check and cast libfreeipmi method - arguments which are uint8_t - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: - nut_ipmi_open(): range-check and cast libfreeipmi method arguments - which are uint8_t - -2021-09-23 Jim Klimov - - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: - range-check and cast ipmi_sec->authentication_type - ipmi_sec->privilege_level ipmi_id to match method signatures - -2021-10-15 Jim Klimov - - * ci_build.sh: ci_build.sh: report Build host settings - -2021-10-16 Jim Klimov - - * ci_build.sh, docs/developers.txt: ci_build.sh: add - BUILD_TYPE=fightwarn(-clang|-gcc) for presets with developer aid - Also updated docs/developers.txt with example and description - -2021-10-26 Jim Klimov - - * tests/getvaluetest.c: tests/getvaluetest.c: align test structure - with field types in HIDData_t - * tests/getvaluetest.c: tests/getvaluetest.c: fix bufsize size_t type - * tests/getvaluetest.c: tests/getvaluetest.c: mark static local - methods as such - * drivers/hidparser.c: drivers/hidparser.c: for skipping botched - LogMin/LogMax, also log a message - -2021-10-20 Stephan Blecher <_github@blecher.at> - - * drivers/hidparser.c: drivers/hidparser.c - -2021-10-22 Jim Klimov - - * autogen.sh: autogen.sh: surprise, not all systems have "dos2unix" - * configure.ac: configure.ac: fix use of --with-docs - * configure.ac: configure.ac: fix use of --with-valgrind - -2021-10-21 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: currently constrain - cppcheck phase(s) to fightwarn-related branch/PR builds - -2021-10-20 Jim Klimov - - * .gitignore, Jenkinsfile-dynamatrix, Makefile.am, ci_build.sh, - configure.ac, docs/config-prereqs.txt, docs/nut.dict, - m4/nut_check_cppcheck.m4: Add recipe support for cppcheck analysis - * ci_build.sh: ci_build.sh: let initial DO_DISTCHECK value be set by - caller - -2021-10-20 Arnaud Quette - - * tools/nut-scanner/scan_snmp.c: Only try all OIDs if sysOID matching - failed - -2021-10-19 Jim Klimov - - * drivers/nutdrv_qx_ablerex.c, drivers/nutdrv_qx_ablerex.h: - drivers/nutdrv_qx_ablerex.{c,h}: heading fixes -- name, descr, (C) - * drivers/nutdrv_qx.c, drivers/nutdrv_qx_ablerex.c: - drivers/nutdrv_qx.c + nutdrv_qx_ablerex.c: common whitespace fixes - * drivers/Makefile.am: drivers/Makefile.am: restore bits lost with - initial posting of PR #1135 - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: update DRIVER_VERSION for - added "ablerex" support - -2021-10-18 Ablerexsoftware - - * drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_ablerex.c, drivers/nutdrv_qx_ablerex.h: Add - nutdrv_qx driver for Ablerex model PR#2 - -2021-10-16 Jim Klimov - - * NEWS, UPGRADING, docs/nut.dict: UPGRADING: notice that upsdebugx() - et al became macros in NUT-2.7.5 - * NEWS: NEWS: another expected point for release after 2.7.5 - -2021-10-14 Jim Klimov - - * drivers/Makefile.am, drivers/snmp-ups-helpers.c, drivers/snmp- - ups.c, drivers/snmp-ups.h: Separate source files of snmp-ups.c - (driver core) and snmp-ups-helpers.c (shared mapping tables and - funcs) (#1134) * drivers/Makefile.am: bring some order into - snmp_ups_SOURCES list * drivers/snmp-ups.h: update (C) heading * - drivers/snmp-ups.h: comment that su_find*() are related to certain - info_lkp_t fields * drivers/snmp-ups.c: extract snmp-ups-helpers.c - that can be built independently * drivers/snmp-ups.h: mark the - range of data points related to Subdrivers shared helpers functions - -2021-10-12 Jim Klimov - - * drivers/powerware-mib.c, drivers/snmp-ups.c, drivers/snmp-ups.h: - drivers/snmp-ups.{h,c} + powerware-mib.c: reference date converter - by macro name instead of magic number - * drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups.{h,c}: - rename the fun/nuf mappings to fun_vp2s/nuf_s2l to match the DMF - codebase and ease eventual backports - * drivers/snmp-ups.h: drivers/snmp-ups.h: comment the fun/nuf mapping - and their relation to su_find_*() methods - * drivers/snmp-ups.c: drivers/snmp-ups.c: clarify that we pass a - "long*" arg to su_find_infoval() - * drivers/snmp-ups.c: drivers/snmp-ups.c: typo fix - * drivers/snmp-ups.c: drivers/snmp-ups.c: clarify in decode_str() - that we pass a "long*" arg to su_find_infoval() - * drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups.{c,h}: - rearrange braces, blank lines and some comments to match the - formatting fixes in DMF branch (and to simplify eventual backport) - * drivers/snmp-ups.c: drivers/snmp-ups.c: rearrange mib2nut[] in - alphabetic order (except *ietf tables that go last) and reference - mib.c sources - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - whitespace (indent) - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: fix regex pattern - for dynacfgPipeline.appliesToChangedFilesRegex_FILES_PY - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: parameterize - dynacfgPipeline.axisCombos* and excludeCombos_DEFAULT_* for - repetitive settings - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: parameterize - dynacfgPipeline.branchStableRegex - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: extend - sample capability labels with PYTHON variants - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: update for Python- - version build scenarios - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add - dynacfgPipeline.appliesToChangedFilesRegex_FILES_PY for future - handling - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: update - dynacfgPipeline.appliesToChangedFilesRegex_FILES_RECIPE to consider - changes of autogen.sh - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: fix whitespace style - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: fix - whitespace style - -2021-10-11 Jim Klimov - - * tools/nut-scanner/nutscan-device.c: tools/nut-scanner/nutscan- - device.c: fix whitespace style - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - whitespace style - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: fix - whitespace style - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: fix - whitespace style - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: fix whitespace style - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: fix - whitespace style - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix whitespace style - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: fix whitespace style - * tools/nut-scanner/nutscan-device.h: tools/nut-scanner/nutscan- - device.h: fix whitespace style - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - whitespace style - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: fix - whitespace style - * tools/nut-snmpinfo.py.in: tools/nut-snmpinfo.py.in: fix whitespace - style of generated header - * tools/nut-snmpinfo.py.in: tools/nut-snmpinfo.py.in: fix heading of - generated header - -2021-09-28 Jim Klimov - - * drivers/microdowell.h: drivers/microdowell.h: normalize whitespace - within the file - * drivers/microsol-apc.h: drivers/microsol-apc.h: whitespace fix - -2021-09-23 Jim Klimov - - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix whitespace style - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: fix whitespace style - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: fix - whitespace style - -2021-09-22 Jim Klimov - - * tests/cpputest.cpp: tests/cpputest.cpp: avoid "no out-of-line - virtual method definitions" (weak-vtables) - * tests/nutclienttest.cpp: tests/nutclienttest.h: avoid "unused - exception parameter ex" - * clients/nutclientmem.h: clients/nutclientmem.h: avoid "extra ; - after method" warnings - -2021-10-11 Jim Klimov - - * docs/Makefile.am, docs/man/Makefile.am: docs{,/man}/Makefile.am: - quiesce docs-generating targets by default to just state what they - make - * docs/nut.dict: Update spellchecker dict - -2021-10-09 Jim Klimov - - * ci_build.sh: ci_build.sh: add support for CI agents setting - NUT_BUILD_CAPS=valgrind=no - * Makefile.am: Makefile.am: `make spellcheck` from top dir should be - quieter (fallout from touchfiles) - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: stress to - `systemctl restart lxc-net` after edits of /etc/lxc/dnsmasq- - hosts.conf - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: stress that for CI_WRAP_SH method, the Prefix Start - Agent Commandshould not pollute stderr/stdout - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: report more details - about the build host when we "Inspect initial envvars" - -2021-10-08 Jim Klimov - - * scripts/subdriver/gen-snmp-subdriver.sh: gen-snmp-subdriver.sh: - deprecate "which" in favor of "command -v" - * ci_build.sh: ci_build.sh: deprecate "which" in favor of "command - -v" - -2021-10-07 Jim Klimov - - * m4/nut_check_python.m4: m4/nut_check_python.m4: export PYTHON(2,3) - envvars for other scripts called in the build - -2021-09-28 Jim Klimov - - * .gitignore: GitIgnore the tmp/ subdirectory used by CI builds - * .gitignore: GitIgnore Python precompiled files - -2021-09-27 Jim Klimov - - * configure.ac: configure.ac: split generation of "data" files vs. - "scripts" from *.in templates - * configure.ac: Update python scripts to be generated by configure - and using the detected PYTHON value - * clients/nutclient.h: clients/nutclient.h: whitespace typo fix - * docs/developers.txt: docs/developers.txt: fix reference to Fosshost - to be an URL - -2021-09-26 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: for a non-PR build - of a fightwarn* branch, reference 'fightwarn' for analysis - -2021-09-23 Jim Klimov - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl => generated nutscan- - usb.h: sentinel in a table of uint16_t can not be -1 - -2021-09-22 Jim Klimov - - * clients/upsclient.c, configure.ac: clients/upsclient.c + - configure.ac: fix use of CPU_TYPE - * configure.ac: configure.ac: add "-Wno-cast-qual" to clang-medium - and clang-hard warnings levels - -2021-10-05 Jim Klimov - - * docs/nut.dict: Update spellchecker - * NEWS: NEWS: added FTTx support and other genericups improvenets for - NUT-2.7.5 - -2021-10-05 Jim Klimov - - * configure.ac: configure.ac: more AC_CHECK_HEADERS_ONCE - * ci_build.sh: ci_build.sh: for default mode (no BUILD_TYPE) enable - cgi and dev files (no=>auto) and do not require serial drivers - (yes=>auto) - * m4/nut_type_socklen_t.m4: m4/nut_type_socklen_t.m4: fix detection - on windows Probably practical codebase should also account for - other arg types, e.g. "SOCKET" that is not even exported into a - macro so far. - * ci_build.sh: ci_build.sh: report CI_OS_NAME detection issues more - clearly It is not helpful to read just this: Could not recognize - ... from ''-'' - -2021-10-05 Jim Klimov - - * autogen.sh: autogen.sh: suggest CRLF fixes for the workspace (e.g. - if checked out on Windows) This falls a bit short of enforcing - with .gitattributes which may or may not interfere with platform- - native editors and other tools. - -2021-10-04 Jim Klimov - - * conf/Makefile.am, docs/man/Makefile.am: conf/Makefile.am, - docs/man/Makefile.am: avoid prerequisites on suffix rules - * drivers/apc-mib.c: drivers/apc-mib.c: bump APCC_MIB_VERSION for PR - #1113 - * docs/man/genericups.txt, drivers/genericups.c: genericups: - officially alias "NULL" and "none" setting keywords - -2021-10-04 Jim Klimov - - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: recommend a unique Remote root directory per agent - -2021-10-04 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: extend QEMU build - scenarios to "ssh-qemu-nut-builder" agents, and to iterate - "COMPILER" toolkits for cross-check on same platform - -2021-10-04 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: Debianish systems - tend to deliver g++ in a separate package from gcc - * docs/ci-farm-lxc-setup.txt, docs/nut.dict: docs/ci-farm-lxc- - setup.txt: add a chapter on Jenkins Build Agent setup for the - containers - -2021-10-03 Jim Klimov - - * docs/nut.dict: Update spellchecker - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: document - making a self-login ssh key for abuild - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: document - allowing container SSH server to accept envvars from client - -2021-10-03 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: Typo fix: remove - extra unstashCleanSrc() for ci_build.sh preparations - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: allow limited use - of QEMU containers as build agents (slow workers => few combos) - -2021-10-02 Jim Klimov - - * configure.ac: configure.ac: quiesce the check for usable valgrind - binary - * docs/nut.dict: Update spellchecker - * configure.ac: configure.ac: adapt warnings level (auto, minimal) - for GCC with c89/c90/ansi requested builds - * tests/getvaluetest.c: tests/getvaluetest.c: fix declaration of - variables in code body, and type of sizeof-derived iterator - * tests/getvaluetest.c: tests/getvaluetest.c: normalize whitespace to - NUT style - * tests/getvaluetest.c: tests/getvaluetest.c: add (C) and descriptive - heading - -2021-10-02 Jim Klimov - - * configure.ac: configure.ac: test if valgrind is actually usable on - build/check ssytem - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: fix - extraction of hosts-map data - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: make note - of lxc-create for other distros - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: add git to - early starter-kit of packages - -2021-09-30 Jim Klimov - - * Jenkinsfile-dynamatrix, docs/developers.txt: Jenkinsfile-dynamatrix - + developers.txt: for "GNU C89 standard builds with fatal - warnings", only run with a `fightwarn.*89.*` regex branch name; do - not pollute logs and analysis of "usual fightwarn" builds - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: for "GNU C standard - builds with non-fatal warnings, without distcheck and docs (must - pass)" slowBuild scenario, start with a "gnu89/gnu++98" non- - regression variant - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: reword some - slowBuild filter config descriptions and comments - * docs/developers.txt, docs/nut.dict: docs/developers.txt: extend the - description of NUT CI setup Clarification of adaptive jobs, - running different sets of scenarios, and how to reproduce a failed - test case locally. Also updated spellchecker dictionary. - * docs/developers.txt: docs/developers.txt: stress likely - incompatibility with stricter C89/GNU89/ANSI-C standard, so C99 - (GNU99) is the baseline - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: rearrange for - readability (line-split allowedFailure and excludeCombos blocks - that have many combos inside) - -2021-09-30 Jim Klimov - - * .lgtm.yml: .lgtm.yml: drop redundant lines - * autogen.sh: autogen.sh: whitespace fix - * autogen.sh, configure.ac, scripts/systemd/Makefile.am: nut- - common.tmpfiles.in: fix systemd magic vs autoconf magic Follows up - from PR #1037 for issue #1030 to let the trick work for distcheck - and similar out-of-tree builds. - -2021-09-27 Jim Klimov - - * .lgtm.yml: Add .lgtm.yml to specify search for python template - files * Index *.py.in + scripts/python/app/NUT-Monitor.in * Do not - consider them templates to ignore * Also turn off the FIXME alerts, - NUT has a lot of those so far - * NEWS: NEWS: updated the python 2+3 compatibility notice - * Makefile.am: Makefile.am: call the generated gitlog2changelog.py - from correct path - * scripts/augeas/Makefile.am, tools/Makefile.am: Fix "dist" targets - to call templates gen-nutupsconf-aug.py.in and nut-snmpinfo.py.in - that they have - * scripts/python/module/PyNUT.py.in, - scripts/python/module/test_nutclient.py.in: - scripts/python/module/PyNUT.py.in: update syntax for Python 3 (also - ok for 2.7) - * .gitignore: GitIgnore possible leftovers from interrupted configure - script run - * scripts/Solaris/.gitignore, scripts/augeas/.gitignore, - scripts/python/app/.gitignore, scripts/python/module/.gitignore, - tools/.gitignore: GitIgnore generated python scripts - * scripts/augeas/Makefile.am: scripts/augeas/Makefile.am: comment - where gen-nutupsconf-aug.py comes from - * autogen.sh: autogen.sh: simplify call of gen-nutupsconf-aug.py.in - in the subdir - * autogen.sh: autogen.sh: use gen-nutupsconf-aug.py.in with the - $PYTHON interpreter - * ci_build.sh: ci_build.sh: pass $PYTHON envvar -t configure --with- - python=... arg - * configure.ac: configure.ac: split generation of "data" files vs. - "scripts" from *.in templates - * configure.ac, scripts/Solaris/Makefile.am, - scripts/Solaris/{precheck.py => precheck.py.in}, - scripts/augeas/Makefile.am, .../{gen-nutupsconf-aug.py => gen- - nutupsconf-aug.py.in}, scripts/python/Makefile.am, - scripts/python/app/{NUT-Monitor => NUT-Monitor.in}, - scripts/python/module/{PyNUT.py => PyNUT.py.in}, - .../module/{test_nutclient.py => test_nutclient.py.in}, - tools/Makefile.am, tools/{gitlog2changelog.py => - gitlog2changelog.py.in}, tools/{nut-snmpinfo.py => nut- - snmpinfo.py.in}: Update python scripts to be generated by configure - and using the detected PYTHON value - * configure.ac, m4/nut_check_python.m4: configure.ac: detect PYTHON, - PYTHON2, PYTHON3 implementations in the build environment - * autogen.sh: autogen.sh: find various python versions if not - specified by $PYTHON - * clients/nutclient.h: clients/nutclient.h: whitespace typo fix - * docs/developers.txt: docs/developers.txt: fix reference to Fosshost - to be an URL - * NEWS: NEWS: expect a few more milestones for 2.7.6 (or later) - release - * UPGRADING: UPGRADING: mention protocol changes due to new TRACKING - ability - * NEWS, UPGRADING: NEWS + UPGRADING: Warn about API changes due to - fightwarn - -2021-09-26 Mark Dietzer - - * drivers/apc-mib.c: Add active power and apparent power from APC - MIBs for single-phase UPS devices - -2021-09-25 Jim Klimov - - * docs/developers.txt, docs/nut.dict: docs/developers.txt: replace - references to defunct Travis CI with new NUT CI farm [#869] - * docs/nut-qa.txt, docs/nut.dict: docs/nut-qa.txt: replace references - to defunct Travis CI with new NUT CI farm [#869] - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: with customized - shellcheck dynamatrixAxesLabels, be sure to match both OS_FAMILY - and OS_DISTRO as a bundle - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: with - docs+distcheck, also test compliance with available Make - interpreters - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: with shellcheck, - also test available Make interpreters - * Makefile.am, configure.ac, include/Makefile.am: configure.ac + - {./,include/}Makefile.am: revise the recipe for - include/nut_version.h - * docs/nut.dict: docs/nut.dict: update dict - * ci_build.sh: ci_build.sh: call "$MAKE -j NUM" with a space, to - cater for make implems that require a separate argument token - -2021-09-23 Jim Klimov - - * m4/nut_func_getnameinfo_argtypes.m4: - m4/nut_func_getnameinfo_argtypes.m4: reorder the loop to first try - current X/Open definition of getnameinfo() - * configure.ac, m4/nut_check_headers_windows.m4, - m4/nut_func_getnameinfo_argtypes.m4: - m4/nut_func_getnameinfo_argtypes.m4 - m4/nut_check_headers_windows.m4: lift recipes from cURL to detect - NUT_FUNC_GETNAMEINFO_ARGTYPES - -2021-09-22 Jim Klimov - - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE and HAVE_PRAGMA_GCC - _DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE Sometimes - library/system provided types are beyond our control and vary from - OS to OS... - -2021-09-23 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix whitespace style - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: fix - whitespace style - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - whitespace style - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: fix - whitespace style - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: fix - whitespace style - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: fix whitespace style - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: fix - whitespace style - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: fix whitespace style - * tools/nut-scanner/nutscan-ip.c, tools/nut-scanner/nutscan-ip.h: - tools/nut-scanner/nutscan-ip.c: fix whitespace style - * tools/nut-scanner/nutscan-init.c: tools/nut-scanner/nutscan-init.c: - fix whitespace style - * tools/nut-scanner/nutscan-device.c, tools/nut-scanner/nutscan- - device.h: tools/nut-scanner/nutscan-device.[c,h]: fix whitespace - style - * tools/nut-scanner/nutscan-display.c: tools/nut-scanner/nutscan- - display.c: fix whitespace style - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - fix whitespace style - * tools/nut-scanner/nut-scan.h: tools/nut-scanner/nut-scan.h: fix - whitespace style - -2021-09-22 Jim Klimov - - * server/sstate.c: server/sstate.c: whitespace fix - -2021-09-23 Jim Klimov - - * ci_build.sh: ci_build.sh: warn that a build without BUILD_TYPE - ignores BUILD_WARNOPT and BUILD_WARNFATAL settings - -2021-09-22 Jim Klimov - - * tests/Makefile.am: tests/Makefile.am: comment a TODO for - referencing helpers built in other dirs - -2021-09-22 Yifeng Li - - * docs/nut.dict: nut.dict: add my name "Yifeng". - * docs/nut.dict: nut.dict: add technical terms for UPS2000 man page. - * docs/man/Makefile.am, docs/man/huawei-ups2000.txt: huawei-ups2000: - add documentation. - * drivers/Makefile.am, drivers/huawei-ups2000.c: huawei-ups2000: - Modbus driver for Huawei UPS2000 (1kVA-3kVA) This commit - implements a Modbus driver for Huawei UPS2000 (1kVA-3kVA) series - UPS units using the USB or RS-232 interface (USB is only support on - Linux 5.12+ via the "xr_serial" kernel module), with support for - power and battery status monitoring, alarm reporting, RW variables, - and instant commands for battery selftest, buzzer, shutdown, - restart, and bypass control. - -2021-09-23 Jim Klimov - - * drivers/generic_modbus.c: drivers/generic_modbus.c: fix assignments - of sigar[].type to enum - * drivers/generic_modbus.c: drivers/generic_modbus.{c,h}: fix - ser_parity to char, and sanity-check before dereferencing - * drivers/generic_modbus.c: drivers/generic_modbus.c: fix switch{} - warnings - * drivers/generic_modbus.c: drivers/generic_modbus.c: fix suseconds_t - for time ranges - * drivers/generic_modbus.c: drivers/generic_modbus.c: fix warnings - with declarations - * drivers/generic_modbus.c, drivers/generic_modbus.h: - drivers/generic_modbus.{c,h}: fix whitespace style - * NEWS: NEWS: added tripplite ability to manage outlet groups for - NUT-2.7.5 - -2021-09-23 Jim Klimov - - * docs/nut.dict: Update nut.dict - -2021-09-22 Jim Klimov - - * docs/nut.dict: docs/nut.dict: updated for recent NEWS and UPGRADING - * UPGRADING: UPGRADING: clarified upsdebugx() `[D#]` prefix impact - * UPGRADING: UPGRADING: stress that new Qx protocol drivers should be - developed in common nutdrv_qx framework - * UPGRADING: UPGRADING: Cut-off features that did land into master - branch to become the 2.7.5 release, vs. big chunks planned now for - later releases - * NEWS: NEWS: update reference to ChangeLog file vs. Git history - * NEWS: NEWS: refactored upsdebugx() and friends as macros for - NUT-2.7.5 - * NEWS: NEWS: HCL updated with Ippon Back Comfo Pro II 650/850/1050 - (USB) for NUT-2.7.5 - * NEWS: NEWS: added and clarified many battery.* protocol variables - for NUT-2.7.5 - * NEWS: NEWS: netxml-ups battery info fixed for NUT-2.7.5 - * NEWS: NEWS: HCL updated with Opti-UPS PS1500E (USB) for NUT-2.7.5 - * NEWS: NEWS: referenced Date and Time representations preferred for - NUT-2.7.5 - * NEWS: NEWS: added generic_modbus driver for NUT-2.7.5 - * NEWS: NEWS: updated systemd integration for NUT-2.7.5 - * NEWS: NEWS: added autoconf-2.70 update for NUT-2.7.5 - * NEWS: NEWS: added portable Makefile effort for NUT-2.7.5 - * NEWS: NEWS: added incremental "make spellcheck" support for - NUT-2.7.5 - * NEWS: NEWS: Cut-off features that did land into master branch to - become the 2.7.5 release, vs. big chunks planned now for later - releases - * NEWS: NEWS: added DISABLE_WEAK_SSL for NUT-2.7.5 - -2021-06-30 Jim Klimov - - * NEWS: NEWS: mention `experimental.*` namespace - * NEWS: NEWS: mention that master/slave deprecation did not impact - protocol currently - * NEWS: NEWS: mark libusb-1.0 support in main branch as "expected" - currently - -2021-05-24 Jim Klimov - - * NEWS: NEWS: added powerpanel driver support for CyberPower - OR1500LCDRTXL2U in NUT-2.7.5 - * NEWS: NEWS: added TcpClient C++ testing mock for NUT-2.7.5 - * NEWS: NEWS: improved USB HID parsing for NUT-2.7.5 - * NEWS: NEWS: improved USB device matching for NUT-2.7.5 - * NEWS: NEWS: microsol-apc added for NUT-2.7.5 - -2021-04-23 Jim Klimov - - * NEWS, docs/nut.dict: docs/nut.dict + NEWS: fix both to pass - spellcheck - -2021-04-21 Jim Klimov - - * NEWS: NEWS: Add 2.7.5 support for Tripplite AVR750U - -2021-04-20 Jim Klimov - - * NEWS: NEWS: List more achievements of 2.7.5 - -2020-01-20 Jim Klimov - - * NEWS: NEWS: described nut-driver-enumerator introduction - -2019-03-15 Arnaud Quette - - * NEWS: Add entry for openssl-1.1.0 support - -2019-03-13 Arnaud Quette - - * docs/nut.dict: Update spelling dictionary - -2019-02-28 Arnaud Quette - - * NEWS: Update NEWS for next release - -2018-02-28 Arnaud Quette - - * docs/nut.dict: Add Avocent to the spell check list - -2018-02-27 Arnaud Quette - - * NEWS: Update NEWS for Emerson Avocent PM3000 PDU - -2017-11-17 Arnaud Quette - - * NEWS: Update NEWS for next release - * NEWS: Update NEWS for next release - -2017-10-08 Charles Lepple - - * NEWS, UPGRADING, docs/nut.dict: Spell-check release notes - * NEWS, UPGRADING: Update NEWS and UPGRADING for next release - Current as of master @ b8df06b761, assuming libusb-1.0+0.1 gets - merged - -2021-09-22 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: cosmetically - update OmniOS notes - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: comment a - TODO for NAT setup desired - * docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc-setup.txt: comment why - LXC+LIBVIRT - * docs/ci-farm-lxc-setup.txt, docs/config-prereqs.txt, docs/user- - manual.txt: docs/config-prereq.txt + ci-farm-lxc-setup.txt + user- - manual.txt: fix markup so new docs can be chapters in user- - manual.html - -2021-09-21 Jim Klimov - - * scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in: - scripts/Solaris/preremove.in + postinstall.in: configure sanity - checker likes datarootdir more than datadir - * ci_build.sh: ci_build.sh: fix reported BUILD_TYPE for default- - spellcheck builds - -2021-09-21 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am: try to avoid "warning: ignoring - prerequisites on suffix rule definition" - * docs/Makefile.am: docs/Makefile.am: when calling a sub-make for - *-spellchecked rule, make sure to use the - "$(abs_top_builddir)/docs/Makefile" (the original "top_builddir" - might come from outer caller in another subdir) - * docs/Makefile.am: docs/Makefile.am: move reading of the - spellchecked file out of the pipe so errors finding one are exposed - to build result - * conf/Makefile.am, data/Makefile.am, docs/Makefile.am, - docs/man/Makefile.am: docs/Makefile.am: conjure a portable - *-spellchecked rule that works for non-GNU make tools - * docs/Makefile.am: docs/Makefile.am: comment about a non-portable - GNU Make feature use - * docs/Makefile.am: docs/Makefile.am: for no-op *-spellchecked rule, - report SKIP-ASPELL with the target (touchfile) name to avoid - source-text determination - * docs/Makefile.am: docs/Makefile.am: be sure to run the quiet sub- - make using docs/Makefile.am to use its target definitions - * docs/Makefile.am: docs/Makefile.am: if SPELLCHECK_ENV_DEBUG, report - which file we would spellcheck (quiet sub-make might do and report - nothing for an already checked text) - * docs/Makefile.am: docs/Makefile.am: consider "-spellchecked" among - SUFFIXes - * docs/Makefile.am: docs/Makefile.am: comment about a non-portable - GNU Make feature use - -2021-09-21 Jim Klimov - - * .gitignore, Makefile.am, conf/Makefile.am, data/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - lib/Makefile.am, scripts/augeas/Makefile.am, - scripts/ufw/Makefile.am, tools/nut-scanner/Makefile.am: Makefiles: - change from *.spellchecked suffix pattern to *-spellchecked which - is easier to plug into POSIX make rulesets - * Makefile.am, conf/Makefile.am, configure.ac, data/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - lib/Makefile.am, scripts/Makefile.am, scripts/augeas/Makefile.am, - scripts/ufw/Makefile.am, tools/nut-scanner/Makefile.am: Makefiles + - configure.ac: add a way to "make clean" away the *.spellchecked - touch-files - * .gitignore, conf/Makefile.am, data/Makefile.am, docs/Makefile.am, - docs/man/Makefile.am: Makefiles: mark every spellchecked text file - with a touch-file to not re-test it again needlessly (at a cost of - some noise for some implementations of make) - -2021-09-21 Jim Klimov - - * drivers/legrand-hid.c: Update legrand-hid.c Address build warnings - from CI - -2021-09-21 Jim Klimov - - * scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in: - scripts/Solaris/preremove.in + postinstall.in: configure sanity - checker likes datarootdir more than datadir - * ci_build.sh: ci_build.sh: fix reported BUILD_TYPE for default- - spellcheck builds - -2021-09-21 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am: try to avoid "warning: ignoring - prerequisites on suffix rule definition" - * docs/Makefile.am: docs/Makefile.am: when calling a sub-make for - *-spellchecked rule, make sure to use the - "$(abs_top_builddir)/docs/Makefile" (the original "top_builddir" - might come from outer caller in another subdir) - * docs/Makefile.am: docs/Makefile.am: move reading of the - spellchecked file out of the pipe so errors finding one are exposed - to build result - * conf/Makefile.am, data/Makefile.am, docs/Makefile.am, - docs/man/Makefile.am: docs/Makefile.am: conjure a portable - *-spellchecked rule that works for non-GNU make tools - * docs/Makefile.am: docs/Makefile.am: comment about a non-portable - GNU Make feature use - * docs/Makefile.am: docs/Makefile.am: for no-op *-spellchecked rule, - report SKIP-ASPELL with the target (touchfile) name to avoid - source-text determination - * docs/Makefile.am: docs/Makefile.am: be sure to run the quiet sub- - make using docs/Makefile.am to use its target definitions - * docs/Makefile.am: docs/Makefile.am: if SPELLCHECK_ENV_DEBUG, report - which file we would spellcheck (quiet sub-make might do and report - nothing for an already checked text) - * docs/Makefile.am: docs/Makefile.am: consider "-spellchecked" among - SUFFIXes - * docs/Makefile.am: docs/Makefile.am: comment about a non-portable - GNU Make feature use - -2021-09-21 Jim Klimov - - * .gitignore, Makefile.am, conf/Makefile.am, data/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - lib/Makefile.am, scripts/augeas/Makefile.am, - scripts/ufw/Makefile.am, tools/nut-scanner/Makefile.am: Makefiles: - change from *.spellchecked suffix pattern to *-spellchecked which - is easier to plug into POSIX make rulesets - * Makefile.am, conf/Makefile.am, configure.ac, data/Makefile.am, - docs/Makefile.am, docs/cables/Makefile.am, docs/man/Makefile.am, - lib/Makefile.am, scripts/Makefile.am, scripts/augeas/Makefile.am, - scripts/ufw/Makefile.am, tools/nut-scanner/Makefile.am: Makefiles + - configure.ac: add a way to "make clean" away the *.spellchecked - touch-files - * .gitignore, conf/Makefile.am, data/Makefile.am, docs/Makefile.am, - docs/man/Makefile.am: Makefiles: mark every spellchecked text file - with a touch-file to not re-test it again needlessly (at a cost of - some noise for some implementations of make) - * docs/nut.dict: docs/nut.dict: update for recent changes - * docs/man/apcsmart.txt, docs/man/generic_modbus.txt: - docs/man/apcsmart.txt: fix an indented block - * docs/man/apcsmart.txt, docs/man/generic_modbus.txt: - docs/man/generic_modbus.txt + apcsmart.txt: drop "[source, conf]" - decorators for sample configs and ASCII-art, pygmentize needs much - setup to render that - * docs/config-prereqs.txt: docs/config-prereqs.txt: add "pygmentize" - packages to the list, for HTML rendering of "source" blocks - * docs/man/generic_modbus.txt: docs/man/generic_modbus.txt: import a - note from discussion at NUT issue #1056 about the data-path and - generic use for the modbus driver - * docs/man/generic_modbus.txt: docs/man/generic_modbus.txt: line-wrap - long paragraphs - * tests/nutlogtest.c: tests/nutlogtest.c: fix more fallout from #675 - * configure.ac, m4/nut_check_libnss.m4: m4/nut_check_libnss.m4: fix - deterministic 32/64 bit builds (on illumos/solaris family of OSes - at least) - * ci_build.sh: ci_build.sh: tweak PKG_CONFIG_PATH setting for 64-bit - dirs on illumos/solaris and related operating systems (otherwise - pkg-config reports default data, can be for 32-bit libs, on 64-bit - hosts) - * ci_build.sh: ci_build.sh: report detected CI_OS_NAME if we had to - guess - * ci_build.sh: ci_build.sh: for developer workstation use, detect - CI_OS_NAME via uname as a fallback (if CI vars are not provided) - * ci_build.sh: ci_build.sh: recognize CI_OS_NAME from case- - insensitive match of "$OS_FAMILY-$OS_DISTRO", and recognize - solaris+sunos - * include/common.h: Fix some fallout from PR #685 * The - parenthesized "(label)" in debug macros is a safer expansion than - the original "label" * Avoid the dangling "args..." that may be - not-specified by caller (strict-C99 compat) - * docs/Makefile.am: docs/Makefile.am: do not spellcheck ../INSTALL - which is generated - * ci_build.sh: ci_build.sh: run the first spellcheck really quietly - * docs/Makefile.am, docs/nut.dict: docs/Makefile.am + docs/nut.dict: - add more texts from base dir to spellcheck them too - * docs/Makefile.am: docs/Makefile.am: report the directory relative - to which spellchecked text sources failed - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: use ci_build.sh to - spellcheck with a more user-friendly output - * ci_build.sh: ci_build.sh: extend the BUILD_TYPE=default-spellcheck - to do a quiet round first, and only report details about failed - files if needed - * ci_build.sh: ci_build.sh: fallback BUILD_WARNFATAL=true/false - handling; comment values for BUILD_WARNOPT - -2021-09-20 Jim Klimov - - * docs/nut.dict: docs/nut.dict: update for recently added docs and - merged PRs, and update sorting - * docs/config-prereqs.txt: config-prereqs.txt: fix markup to become - asciidoc - -2021-09-20 Jim Klimov - - * docs/Makefile.am, docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc- - setup.txt + docs/Makefile.am: update some notes and ability to - build the new doc - -2021-09-20 Jim Klimov - - * docs/ci-farm-lxc-setup.txt: ci-farm-lxc-setup.txt: update with - notes for "chroot apt-get" tricks - * docs/ci-farm-lxc-setup.txt: ci-farm-lxc-setup.txt: fix markup to - become asciidoc - -2021-09-21 Jim Klimov - - * docs/man/generic_modbus.txt: docs/man/generic_modbus.txt: some - whitespace issues - * m4/nut_type_socklen_t.m4: [NUT issue #1053] - m4/nut_type_socklen_t.m4: convert one remaining - AC_TRY_COMPILE(H,M,S) into modern - AC_COMPILE_IFELSE(AC_LANG_PROGRAM(H,M), S) - * configure.ac: [NUT issue #1053] configure.ac: apply recommendations - of "autoupdate" and warnings from "autoconf" for autotools-2.70 - -2021-09-20 Jim Klimov - - * docs/config-prereqs.txt: config-prereqs.txt: fix markup to become - asciidoc - * tests/.gitignore: GitIgnore test log and trace for "nutlogtest" - -2021-09-20 Jim Klimov - - * docs/Makefile.am, docs/ci-farm-lxc-setup.txt: docs/ci-farm-lxc- - setup.txt + docs/Makefile.am: update some notes and ability to - build the new doc - -2021-09-20 Jim Klimov - - * docs/nut.dict: docs/nut.dict: ordering and typo fixes in the - dictionary :) - * docs/ci-farm-lxc-setup.txt: ci-farm-lxc-setup.txt: update with - notes for "chroot apt-get" tricks - -2021-09-19 Jim Klimov - - * docs/nut-names.txt: docs/nut-names.txt: refactor the standalone - Time and Date format chapter - -2021-09-20 Jim Klimov - - * docs/ci-farm-lxc-setup.txt: ci-farm-lxc-setup.txt: fix markup to - become asciidoc - -2021-09-19 Jim Klimov - - * docs/ci-farm-lxc-setup.txt: Introduce docs/ci-farm-lxc-setup.txt - with setup notes - * docs/ci-farm-lxc-setup.txt: Introduce docs/ci-farm-lxc-setup.txt - with setup notes - -2021-09-17 Jim Klimov - - * Jenkinsfile-dynamatrix: Update Jenkinsfile-dynamatrix Revise - pattern for Makefiles and similar - * Jenkinsfile-dynamatrix: Update Jenkinsfile-dynamatrix Do not apply - filename regex filtering to main branch builds so they can always - serve as a reference - * Jenkinsfile-dynamatrix: Update Jenkinsfile-dynamatrix Remove - 'default' target as it brings little value: default-tgt:distcheck- - valgrind tests the distcheck part, and default-nodoc tests the main - recipe with default settings and no distcheck (both skip/disable - docs). - -2021-09-17 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: modularize the way - to constrain build scenarios not relevant to the changed files - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: find a way to - constrain build scenarios not relevant to the changed files (e.g. - no big rebuilds for a docs-only change) - -2021-09-16 Jim Klimov - - * docs/nut.dict: Update nut.dict - * docs/nut.dict: Update nut.dict - * docs/nut-names.txt: Update nut-names.txt Clarified an ambiguity - typo about time format, added examples for data with time zones - -2021-09-16 dtsecon - - * drivers/generic_modbus.c: change ulon to uint_32 - * drivers/generic_modbus.h: fix forward declarations of enum - occurances - -2021-09-15 Jim Klimov - - * docs/nut.dict: Update nut.dict Update for PR #1076 - * docs/nut.dict: Update nut.dict Add "FTTx" for PR #1061 - * tests/getvaluetest.c: Update getvaluetest.c Include NUT "common.h" - for NUT_UNUSED_VARIABLE among other things - * tests/getvaluetest.c: getvaluetest.c: Fixing a NUT_UNUSED_VARIABLE - -2021-09-15 Jim Klimov - - * clients/upsclient.c: upsclient.c: log upscli_init() as a no-op in - case of builds without SSL - * clients/upsclient.c: upsclient.c: add NUT_UNUSED_VARIABLE for the - stub implem in case of builds without SSL - * server/netssl.c: netssl.c: add NUT_UNUSED_VARIABLE for the stub - implem in case of builds without SSL - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: limit default- - withdoc(:man) scenarios to not iterate compiler variants, only OSes - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add a comment with - overview of the dynacfgPipeline.slowBuild goals and trade-offs - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add a groovy - shebang for highlighters - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: rephrase some - comments and filter bundle names - -2021-09-14 dtsecon - - * docs/nut.dict: update nut.dict - * docs/nut.dict: update nut.dic - -2021-09-13 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: only run and - withdocs:man on setups that did not yet run a witdocs:all (and are - declared capable of man) - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: remove distcheck- - light (sort of pointless WRT other scenarios) and withdocs:man - (redundant) from "various builds" - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: comment that - "default-all-errors" builds do not include docs and distcheck - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add "default- - alldrv:no-distcheck" variant - * ci_build.sh: ci_build.sh: add "default-alldrv:no-distcheck" variant - * ci_build.sh: ci_build.sh: comment "default-all-errors" builds with - varying SSL implementations and refactor into a loop and case - Should be helftul for https://github.com/networkupstools/jenkins- - dynamatrix/issues/4 eventually - * ci_build.sh: ci_build.sh: comment the case BUILD_TYPE to maintain - easier - -2021-09-12 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: reduce the amount - of build combos by careful use of dynamatrixAxesCommonEnv - -2021-09-11 Jim Klimov - - * tests/cpputest.cpp: tests/cpputest.cpp: add an optional verbose - mode to list executed test case names - * configure.ac: ci_build.sh: actively check that cppunit is not just - installed, but is usable with current compiler toolkit (we saw - linking issues and runtime segfaults with it) - * ci_build.sh: ci_build.sh: update a comment for OpenIndiana gcc-4.x - vs. libgd - * ci_build.sh: ci_build.sh: skip CGI builds for openindiana with - gcc-4.x (or older, preemptively) for now - * ci_build.sh: ci_build.sh: update constraints for libgd/cgi builds - on freebsd - * ci_build.sh: ci_build.sh: fix --disable-cppunit (not --without- - cppunit) - -2021-09-11 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: constrain autotools - builds to "*fightwarn*" branches and PRs - -2021-06-14 Doug Nazar - - * server/netssl.c: server: Add warning if DISABLE_WEAK_SSL is not - enabled. - -2021-06-12 Jim Klimov - - * server/netssl.c: Update netssl.c Comment the default value of - `disable_weak_ssl` (currently not getting in our way, but can - change later) - * server/netssl.c: Update netssl.c Slight pedantic fix for use of - NSS VMAJOR/VMINOR macros - * server/conf.c: Update conf.c Comment parse_boolean() and add - support for "0" and "1" string values there, for good measure - * conf/upsd.conf.sample: Update upsd.conf.sample Mention that - DISABLE_WEAK_SSL is "currently" disabled by default, hinting that - it can become enabled after some releases. - * docs/nut.dict: Update nut.dict Add "TLSv" support in - spellchecker - -2021-06-11 Doug Nazar - - * conf/upsd.conf.sample, server/conf.c, server/netssl.c, - server/netssl.h: server: Add option to disable weak SSL - protocols/ciphers. - -2021-09-01 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c, drivers/powerware-mib.c, - drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: Add a generic - function to convert date (#1078) This provides conversion from US - date (mm/dd/yyyy) to ISO Calendar date (yyyy-mm-dd). Also adapt the - function callback mechanism to make it more generic, and only char* - to char* reformating, beside from the int to char* value lookup. - Co-authored-by: Jim Klimov - -2021-08-03 Jim Klimov - - * clients/nutclient.h, clients/nutclientmem.cpp, - clients/nutclientmem.h: clients/nutclient.h + nutclientmem.h/.cpp: - add NUT_UNUSED_VARIABLE() where needed - * drivers/libshut.h: drivers/libshut.h: define the Device field - recently added to USBDevice_t - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: initialize the recently - added USBDevice_t Device field - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - fix the switch-case fallthrough that should not be (the case of "s" - is handled lower in the routine, so instant return is not logical) - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - complete the item_t initializers - * drivers/nutdrv_qx_masterguard.c: drivers/nutdrv_qx_masterguard.c: - be explicit about NUT_UNUSED_VARIABLEs - -2021-07-20 Jim Klimov - - * common/common.c: common/common.c: avoid C++ style comments - -2021-05-25 Jim Klimov - - * docs/images/ci/fosshost.org_Host_Light_309px.png, - docs/images/ci/fosshost.org_Host_Light_38px.png: docs/image/ci: add - more Fosshost logos tuned to be readable at smaller height - -2021-04-26 Jim Klimov - - * docs/man/dummy-ups.txt: dummy-ups.txt: mention the DDL and nut-ddl- - dump.sh - -2021-08-27 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: note caveats - about installing cppunit and gcc-4.4.4 on OpenIndiana - -2021-08-07 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: suggest - installing valgrind where available - -2021-08-04 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: suggest - installing source-highlight where available - -2021-08-03 Jim Klimov - - * docs/nut.dict: docs/config-prereqs.txt: list prerequisites for at - least a minimal build in OmniOS CE - update spellchecker - * docs/config-prereqs.txt: docs/config-prereqs.txt: list - prerequisites for at least a minimal build in OmniOS CE - * docs/config-prereqs.txt: docs/config-prereqs.txt: document libtool - as a prerequisite - -2021-08-02 Jim Klimov - - * docs/config-prereqs.txt: docs/config-prereqs.txt: revise - installation of supported shell interpreters - * docs/config-prereqs.txt: docs/config-prereqs.txt: add en-aspell for - freebsd profile - -2021-08-01 Jim Klimov - - * docs/Makefile.am, docs/config-prereqs.txt, docs/nut.dict, - docs/packager-guide.txt, docs/user-manual.txt: Introduce - docs/config-prereqs.txt and spellcheck for it - -2021-08-11 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: revise use of - requiredNodelabels/excludedNodelabels, and reset them to surely - delete any cached values in the reusable dynamatrix object - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: keep docs builds to - the standard set of builders (nut-builder not doc-builder) - -2021-08-10 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: use a custom-named - dynacfgPipeline.stashnameSrc - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: neuter the example - buildCommit - * Jenkinsfile-dynamatrix: Revert "Jenkinsfile-dynamatrix: list the - custom commits built on new NUT CI for initial history" This - reverts commit c9b5c870ac6834f16ebecb5334ac178de2d03d3d. Have that - list in history but do not clutter live version. - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: list the custom - commits built on new NUT CI for initial history - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: revise docs-all - build spec - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: modernize example - for custom replayed builds - -2021-08-04 Jim Klimov - - * ci_build.sh: ci_build.sh: double-quote path var expansions - * ci_build.sh: ci_build.sh: detect build agent capabilities for - Jenkins builds with NUT dynaMatrix config - * ci_build.sh: ci_build.sh: abstract from TRAVIS_OS_NAME to - CI_OS_NAME and set one for Jenkins builds with NUT dynaMatrix - config - -2021-08-03 Jim Klimov - - * configure.ac: configure.ac: hack around libtool when building with - custom bitness - -2021-08-03 Jim Klimov - - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: define autotools- - based distcheck for NUT - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: define autotools- - based distcheck for NUT - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: explicitly exclude - openindiana from build scenario with all docs types - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: typo fix - (require*d*Nodelabels after upstream refactor) - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: do not pass - "-Wno-unknown-warning" to GCC - * m4/nut_check_libavahi.m4: m4/nut_check_libavahi.m4: PoC enable - avahi build in FreeBSD - rearrange - -2021-08-02 Jim Klimov - - * Jenkinsfile-dynamatrix: Revert "Jenkinsfile-dynamatrix: try to - synchronize cloning of dsbcClone+stageNameClone" This reverts - commit 2d477fac1c67f7a8477c550f1e5a638e533ab2ad : "synchronized" is - not supported for Jenkins Groovy CPS - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: try to synchronize - cloning of dsbcClone+stageNameClone - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: define - dsbcClone+stageNameClone closer to start of closure to get the - correct copy ASAP - * Jenkinsfile-dynamatrix: Jenkinsfile-dynamatrix: add - SERVICE_FRAMEWORK="selftest" to shellcheck-nde (equivalent) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in: check for not-supported (t)csh interpreter - * Makefile.am: Makefile.am: add SERVICE_FRAMEWORK="selftest" to - shellcheck-nde - * Makefile.am: Makefile.am: add shellcheck-nde - * Makefile.am: Makefile.am: fix shellcheck (not all OSes serve - /bin/bash at that pathname) - -2021-07-31 Jim Klimov - - * m4/nut_check_libavahi.m4: m4/nut_check_libavahi.m4: PoC enable - avahi build in FreeBSD - * m4/nut_check_libneon.m4: m4/nut_check_libneon.m4: FreeBSD installs - stuff under /usr/local - -2021-07-28 Jim Klimov - - * ci_build.sh: ci_build.sh: report CONFIGURING NUT in a way - friendlier for copy-paste - * configure.ac, m4/nut_compiler_family.m4: configure.ac + - m4/nut_compiler_family.m4: introduce NUT_COMPILER_FAMILY_FLAGS to - propagate -Wno-unknown-warning(-opton) before any pkgconfig - * docs/man/Makefile.am: docs/man/Makefile.am: Fix check-man-txt to - also run from separate build dirs - * ci_build.sh: ci_build.sh: do not make TOO MUCH noise when dumping - config.log - * ci_build.sh: ci_build.sh: set DISTCHECK_FLAGS in "default-tgt:"* - handling too - -2021-07-27 Jim Klimov - - * ci_build.sh: ci_build.sh: introduce BUILD_TYPE=default-withdoc:man - (and allow it) - * .gitignore: GitIgnore CI-generated log files - * ci_build.sh: ci_build.sh: introduce BUILD_TYPE=default-withdoc:man - * ci_build.sh: ci_build.sh: make sure DISTCHECK_FLAGS is single-line - * configure.ac: configure.ac: tell compiler to not choke on unknown - options - -2021-07-26 Jim Klimov - - * ci_build.sh: ci_build.sh: parameterize $MAKE - * ci_build.sh: ci_build.sh: try to avoid problems with multi-token - CFLAGS etc. when passed from "${CONFIG_OPTS[@]}" array into - DISTCHECK_CONFIGURE_FLAGS string (envvar) - refactor - -2021-07-22 Jim Klimov - - * ci_build.sh: ci_build.sh: try to avoid problems with multi-token - CFLAGS etc. when passed from "${CONFIG_OPTS[@]}" array into - DISTCHECK_CONFIGURE_FLAGS string (envvar) - -2021-07-20 Jim Klimov - - * configure.ac: configure.ac: detect if i2c library is usable, and - cancel i2c driver build if it is not - -2021-06-26 Jim Klimov - - * Makefile.am, configure.ac: configure.ac: follow autotools doc - recommendation to automatically update the libtool script if it - becomes out-of-date - * configure.ac: configure.ac: AC_PROG_LIBTOOL is noisily deprecated - since autotools-2.70; LT_INIT is the replacement - * m4/nut_arg_with.m4: m4/nut_arg_with.m4: AC_HELP_STRING is noisily - deprecated since autotools-2.70; AS_HELP_STRING is available since - 2.59 and we use it already a lot elsewhere - -2021-04-26 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am: fix truncated comment - Text originates from SVN-Git migration in - e8e716e0598158f705e060c72f8f4b0444fbcd0f - -2021-08-23 Arnaud Quette - - * docs/nut-names.txt: Complete the date standardization proposal for - time - -2021-08-20 Arnaud Quette - - * docs/nut-names.txt: Propose to express dates using ISO 8601 when - possible - -2021-08-19 Stephan Blecher <_github@blecher.at> - - * drivers/legrand-hid.c: issue-616: legrand 600 fix input voltage - -2021-08-18 root - - * scripts/upower/95-upower-hid.rules: legrand hid rules update - -2021-08-12 Arnaud Quette - - * drivers/mge-xml.c: netxml-ups: fix for erroneous battery info - (MGEXML/0.30) (#1069) Some battery related information were - wrongly using output information - * docs/nut-names.txt: RFC: clarify and complete battery dates (#1063) - The existing battery.date means the installation or last - replacement date, as it seems to be implemented by various drivers. - Add an additional battery.date.maintenance for the next replacement - or maintenance date - * docs/nut-names.txt: Extend battery information collection (#1062) - * RFC: Add battery.capacity.nominal * RFC: add Li-ion battery - cell information * RFC: Add battery.status * Clarify Li-ion - battery cell information Mention that min/max cell voltage and - temperature are observed values, not settings - * docs/nut-names.txt: RFC: add new variable battery.packs.external - (#1060) * RFC: add new variable battery.packs.external * Improve - wording, as per Charles Lepple feedback * Improve example values, - which can or not be zero-padded - -2021-08-01 Jim Klimov - - * Jenkinsfile-dynamatrix: Introduce Jenkinsfile-dynamatrix - -2021-07-28 Jim Klimov - - * data/driver.list.in: data/driver.list.in: list Ippon Back Comfo Pro - II 650/850/1050 as supported by blazer_usb [#1035] - -2021-07-21 dtsecon - - * drivers/generic_modbus.c, drivers/generic_modbus.h: shutdown - configurable repetition with increasing time interval added - -2021-07-19 dtsecon - - * configure.ac, docs/Makefile.am, docs/man/Makefile.am: fix man pages - broken build process - -2021-07-16 dtsecon - - * docs/man/generic_modbus.txt: improve man page - * docs/man/Makefile.am, docs/man/generic_modbus.txt: man page text - created, added in build procedure - -2021-07-08 dogtopus - - * docs/man/genericups.txt, drivers/genericups.h: genericups: Change - type 23 to be active low. Seems that typical RS232 transceivers - inverts the signal automatically anyway, so there's no point of - making them active high by default. - -2021-07-06 dogtopus - - * docs/man/genericups.txt: docs: Document the special line NULL in - genericups documentation. - * drivers/genericups.c: genericups: Bump version number. - * docs/contact-closure.txt, docs/man/genericups.txt, - drivers/genericups.c, drivers/genericups.h: genericups: Add support - for FTTx battery backup. A lot of those "UPSes" use a 4-wire open- - drain-like contact closure signaling (dubbed "telemetry interface") - to report their status (see https://dl4jz3rbrsfum.cloudfront.net/do - cuments/CyberPower_UM_CBN50U48A-1.pdf for example). They are sorta - compatible with APC 940-0020B/C cables in terms of pin assignments, - with extra signals for replace battery and battery missing and lack - of shutdown signal. This patch adds a sample device type (23) for - this kind of device. It also adds support for the extra signal - types (RB for replace battery and BYPASS for disconnected battery) - used by these devices, as well as an option to unassign/disable an - unused signal in the config file by setting it to NULL. Note that - there is no standard cable for this kind of device, so type 23 - assumes RS232 control signaling and RTS as the voltage source for - input pin pullups. - -2021-07-06 dtsecon - - * drivers/generic_modbus.c, drivers/generic_modbus.h: fix serial - options in modbus_open - * drivers/generic_modbus.c: fix 'for' loop initial declarations for - compatibility out of C99 mode - * drivers/Makefile.am: generic_modbus.h added to Makefile.am - * drivers/generic_modbus.c: just one space less - -2021-06-30 Nick Briggs - - * tests/.gitignore, tests/Makefile.am, tests/getvaluetest.c: Create - test harness for GetValue() report value extraction (usbhid-ups) - Adds source and updates Makefile.am to build tests/getvaluetest, a - test harness for the report value extraction function GetValue() in - hidparser.c. getvaluetest has some built-in test cases, which are - easily extensible, but also accepts a single test specification on - the command line to allow for easy experimentation. getvaluetest - -h for usage - -2021-06-30 Jim Klimov - - * scripts/systemd/nut-driver-enumerator.service.in, - scripts/systemd/nut-driver@.service.in, scripts/systemd/nut- - monitor.service.in, scripts/systemd/nut-server.service.in: - systemd/*.service(.in): update units with SyslogIdentifier=%N The - log identifier should hopefully help make more sense of syslog or - journal entries where helper shell script traces might end up. - -2021-06-29 Dimitris Economou - - * drivers/generic_modbus.c: minor changes to comply with nut - development guidelines - * drivers/generic_modbus.c: variable ctx changed to mbctx - -2021-06-25 dtsecon - - * drivers/generic_modbus.c: removing unnecessary code - * drivers/generic_modbus.c: time_ellapsed fixed - -2021-06-25 abratchik - - * drivers/Makefile.am, drivers/arduino-hid.c, drivers/arduino-hid.h, - drivers/usbhid-ups.c, scripts/upower/95-upower-hid.rules: Arduino - UPS Support - -2021-06-12 abratchik - - * docs/FAQ.txt, drivers/libusb.c, drivers/libusb.h, drivers/powervar- - hid.c: HID-compliant UPS support with interface gt than 0 - -2021-06-24 dtsecon - - * drivers/generic_modbus.c: minor changes and tidying up - * drivers/generic_modbus.c: remove unnecessary stuff - * drivers/generic_modbus.c, drivers/generic_modbus.h: initial commit - of generic_modbus beta version source files - * drivers/Makefile.am: generic_modbus sources add in buidling - procedure - -2021-06-22 Tom Fifield - - * data/driver.list.in: Opti-UPS PS1500E is supported by blazer_usb - Opti-UPS PS1500E connects via serial over USB, and is supported by - the blazer_usb driver. This patch updates the compatibility list. - Manufacturer link: https://www.opti- - ups.com/index.asp?SCID=SC20060001 Device is automatically detected - by nut-scanner > [nutdev1] > driver = "blazer_usb" > - port = "auto" > vendorid = "0665" > productid = "5161" - > bus = "001" OB status is correctly detected, and other - correct values are displayed when queried: battery.charge: 100 - battery.voltage: 27.60 battery.voltage.high: 26.00 - battery.voltage.low: 20.80 battery.voltage.nominal: 24.0 - device.mfr: device.model: 1500VA device.type: ups driver.name: - blazer_usb driver.parameter.bus: 001 driver.parameter.pollinterval: - 2 driver.parameter.port: auto driver.parameter.productid: 5161 - driver.parameter.synchronous: no driver.parameter.vendorid: 0665 - driver.version: 2.7.4 driver.version.internal: 0.12 - input.current.nominal: 13.0 input.frequency: 60.0 - input.frequency.nominal: 60 input.voltage: 113.9 - input.voltage.fault: 111.4 input.voltage.nominal: 110 - output.voltage: 113.3 ups.beeper.status: enabled - ups.delay.shutdown: 30 ups.delay.start: 180 ups.firmware: ups.load: - 2 ups.mfr: ups.model: 1500VA ups.productid: 5161 ups.status: OL - ups.type: offline / line interactive ups.vendorid: 0665 - -2021-06-18 Scott K Logan - - * drivers/tripplite.c: drivers/tripplite.c: start using the 'X' value - Relatively ancient documentation seems to suggest that this - 'firmware checksum' value can be used to indicate the firmware - generation as well as the capabilities of the UPS, namely the - number of independently controllable plugs. - -2021-06-16 Nick Briggs - - * drivers/hidparser.c: Add note regarding sensitivity to 32- vs 64- - bit compilation and overflow - -2021-06-14 Doug Nazar - - * Makefile.am, conf/Makefile.am, data/Makefile.am, docs/Makefile.am, - docs/man/Makefile.am: Fix spellcheck to also run from separate - build dirs - -2021-06-12 Jim Klimov - - * docs/nut-names.txt: docs/nut-names.txt: add the note about RFC - Recording Document - * docs/nut-names.txt: docs/nut-names.txt: reword the intro paragraphs - and define the "experimental.*" namespace - * docs/FAQ.txt: FAQ.txt: make it easier to find suggestions for - missing "battery.charge.restart" workarounds - -2021-06-02 Nick Briggs - - * drivers/hidparser.c: Fix GetValue() to correctly extract values - from a report when compiled in LP64 mode Changes the strategy for - removing potential garbage bits from values extracted from a - report. Use the LogMin and LogMax fields to drive which bits are - meaningful but avoid confusion when, for example, given a range of - -1..2147483647 - -2021-05-30 Jim Klimov - - * configure.ac: configure.ac: bugfix - populate systemdtmpfilesdir in - its option, not systemdshutdowndir - * configure.ac: configure.ac: do not make noise with yet empty - systemdtmpfilesdir - * configure.ac: configure.ac: process other values for - systemdshutdowndir option - * configure.ac: configure.ac: just in case, double-quote to single- - tokenize detected systemd related options - * configure.ac: configure.ac: update comments for systemd related - options - -2021-05-28 Jim Klimov - - * docs/nut.dict: nut.dict: add new words for nut-website - * configure.ac: configure.ac: improve reporting of systemd options - processing - * autogen.sh, configure.ac, scripts/systemd/.gitignore, - scripts/systemd/nut-common.tmpfiles.in: configure.ac: generate - scripts/systemd/nut-common.in based on current config - * configure.ac: configure.ac: typo fix in comment - * Makefile.am, configure.ac, docs/configure.txt, docs/nut.dict, - scripts/systemd/.gitignore, scripts/systemd/Makefile.am, - scripts/systemd/nut-common.tmpfiles.in: [Issue #1030] Deliver - systemd-tmpfiles config to pre-create runtime locations - -2021-05-24 Jim Klimov - - * docs/nut.dict: Update nut.dict Update dict for PR #975 - * docs/man/nutdrv_qx.txt: Update nutdrv_qx.txt Our accepted - terminology is for multiple "UPSes" not "UPSen", however - questionable the language might be - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Bump version due to - addition of `phoenixtec_command()` - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Pre-initialize "e = NULL" - in phoenixtec_command(), we do not set it from `memchr()` later in - all cases. - * drivers/nutdrv_qx_masterguard.c: Update nutdrv_qx_masterguard.c - Add #include - * drivers/powerpanel.h: Update powerpanel.h Define a subdriver_t for - driver version (modifiable) vs type (bin/txt) - * drivers/powerp-txt.c: Update powerp-txt.c Fix subdriver type vs - subdriver version - * drivers/powerp-bin.c: Update powerp-bin.c Track subdriver version - * drivers/powerp-txt.c: Update powerp-txt.c Introduce versioning - * drivers/cyberpower-mib.c: Update cyberpower-mib.c Update reported - driver version after the bump - * drivers/cyberpower-mib.c: Update cyberpower-mib.c Handle - "battery.voltage" and "battery.current" readings for different MIB - revisions - -2021-05-24 Jim Klimov - - * lib/.gitignore: GitIgnore generated lib/libnutclientstub.pc - -2021-05-24 Jim Klimov - - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Formatting and slight - rewording of a comment - -2021-05-24 Jim Klimov - - * drivers/usb-common.h: drivers/usb-common.h: better comment "the 5 - pieces of information by which a USB device identifies itself" - * drivers/usb-common.h: drivers/usb-common.h: move the recently added - USBDevice_t Device field to the end, for a bit of cross-version - binary compatibility - * docs/man/blazer-common.txt, docs/man/nutdrv_qx.txt, - docs/man/tripplite_usb.txt, docs/man/usbhid-ups.txt: Docs: rephrase - Note for "device" option in USB drivers - -2021-05-18 Clappier, Eric - - * tests/nutclienttest.cpp: Fix typo - -2021-05-17 Clappier, Eric - - * clients/nutclientmem.cpp, clients/nutclientmem.h, - tests/nutclienttest.cpp: Take into account pull request remarks - -2021-05-07 Clappier, Eric - - * drivers/bcmxcp_ser.c: Fix coverity test issue - * tests/nutclienttest.cpp: Try fixing coverity test issue - * clients/Makefile.am, configure.ac, lib/Makefile.am, - lib/libnutclientstub.pc.in, tests/Makefile.am: Separate lib for - stub - -2021-05-05 Clappier, Eric - - * tests/nutclienttest.cpp: Add tests in cppunit - * clients/Makefile.am: Fix missing header - -2021-05-04 Clappier, Eric - - * clients/Makefile.am, clients/{nutclientmock.cpp => - nutclientmem.cpp}, clients/{nutclientmock.h => nutclientmem.h}, - tests/nutclienttest.cpp: Rename class Fix cppunit test Add - typedef for map - * clients/nutclientmock.cpp: Fix indentation - * clients/Makefile.am, clients/nutclient.cpp, clients/nutclient.h, - clients/nutclientmock.cpp, clients/nutclientmock.h: Separate - NutClientMock class - * clients/nutclient.cpp, clients/nutclient.h, - tests/nutclienttest.cpp: Add mock for TcpClient - -2021-05-20 Denis Yurin - - * drivers/powercom-hid.c: add temperature readings for Powercom - MRT-3000 add temperature readings support for Powercom MRT-3000 - -2021-05-18 Alexey Kazancev - - * drivers/nutdrv_qx.c: nutdrv_qx.c: bump version to 0.31 - * drivers/nutdrv_qx.c: nutdrv_qx.c: add batt.volt.act validation - Some UPS return zero batt voltage after communication error. This - validation must fix wrong runtime calculation. - * drivers/nutdrv_qx.c: nutdrv_qx.c: fix snr_command communication - error in protocol matching phase. - -2021-05-06 Alexey Kazancev - - * drivers/nutdrv_qx.c: nutdrv_qx.c: bump version to 0.30 - -2021-04-26 Alexey Kazancev - - * drivers/nutdrv_qx.c: nutdrv_qx.c: add correction of runtime - estimation - -2021-04-23 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: - fabula_hunnox_subdriver(): annotate NUT_UNUSED_VARIABLE(device) arg - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c: fix - initialization of delta_ups_type_info[] - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c: fix - initialization of delta_ups_type_info[] - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: - fabula_hunnox_subdriver(): annotate NUT_UNUSED_VARIABLE(device) arg - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: order includes and - subdrivers alphabetically - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: order includes and - subdrivers alphabetically - * clients/nutclient.cpp, clients/nutclient.h: - clients/nutclient.{h,cpp}: explicitly request assignment operator - generation for exception classes - -2021-04-09 Jim Klimov - - * drivers/metasys.c: drivers/metasys.c: fix SIZE_MAX comparison - * drivers/metasys.c: drivers/metasys.c: fix %zd printing of ssize_t - res - -2021-03-31 Jim Klimov - - * drivers/metasys.c: drivers/metasys.c: protect failsafe logic from - compiler warnings with pragmas - * drivers/metasys.c: drivers/metasys.c: upsdrv_initinfo(): pedantic - and stylistic fixes - * drivers/metasys.c: drivers/metasys.c: upsdrv_initinfo(): sanity- - check that reply was big enough to have a serial number, and then - cast for memcpy() - * drivers/metasys.c: drivers/metasys.c: get_answer(): rectify var - types to avoid signedness and range warnings - * drivers/metasys.c: drivers/metasys.c: fix arg type for - send_read_command() to avoid signedness mismatches - * drivers/metasys.c: drivers/metasys.c: refactor a get_word_float() - to simplify code - * drivers/metasys.c: drivers/metasys.c: fix fixed-width integers for - get_word()/get_long() or cast meaningfully where needed - * drivers/bcmxcp.c: drivers/bcmxcp.c: cast the bytes when - constructing "cbuf[]"s element by element - * drivers/bcmxcp.c: drivers/bcmxcp.c: instcmd(): cast use of sddelay - to avoid signedness warnings - * drivers/bcmxcp.c: drivers/bcmxcp.c: upsdrv_initinfo(): buf is - size_t by usage - * drivers/bcmxcp.c: drivers/bcmxcp.c: upsdrv_initinfo(): fix atoi() - of unsigned value for shutdown_delay - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix fixed-width integers for - get_word()/get_long()/init_outlet() or cast meaningfully where - needed - * drivers/al175.c: drivers/al175.c: avoid implicit conversion of byte - to int during bit-shifting - -2021-03-30 Jim Klimov - - * drivers/al175.c: drivers/al175.c: avoid implicit tcflag_t - signedness conversion - * drivers/al175.c: drivers/al175.c: avoid implicit char/byte - conversion - * drivers/al175.c: drivers/al175.c: avoid implicit long/unsigned long - conversion, and fix formatting nearby - * drivers/al175.c: drivers/al175.c: align arguments to wrappers of - al175_do() with the uint16_t type it accepts (avoid variable-width - signed int) - * drivers/libusb.c: drivers/libusb.c: mark hid_rep_index static (not - externalized) - -2021-01-20 Jim Klimov - - * drivers/eaton-ats16-nm2-mib.c, drivers/eaton-ats16-nmc-mib.c: - eaton-ats16-nm?-mib.c: port comments from 42ity fork to clarify - what is going on here for mib2nut_info_t definitions - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - comment about not-function pointers from libnet-snmp - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: fix - indentations and whitespaces - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: fix indentations and whitespaces - * tools/nut-scanner/nut-scanner.c: nut-scanner.c: some extra - whitespace, some missing, in longopts[] - -2021-01-06 Jim Klimov - - * server/netssl.c: server/netssl.c: #include "nut_stdint.h" for - limits definitions - * clients/upscmd.c, clients/upsimage.c, clients/upsmon.c, - clients/upsrw.c, clients/upsstats.c, common/common.c, common/str.c, - drivers/al175.c, drivers/bcmxcp.c, drivers/bcmxcp_ser.c, - drivers/bcmxcp_usb.c, drivers/bestfortress.c, drivers/etapro.c, - drivers/genericups.c, drivers/metasys.c, drivers/netxml-ups.c, - drivers/nutdrv_siemens_sitop.c, drivers/powercom.h, - drivers/richcomm_usb.c, drivers/serial.c, drivers/snmp-ups.c, - server/upsd.c: Various sources: use nut_stdint.h where limits.h was - introduced recently - * configure.ac, include/nut_stdint.h: nut_stdint.h: include limits.h - and make sure SIZE_MAX is defined - -2020-12-27 Jim Klimov - - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: fix size_t types - for upsdebugx_hex() and range-check the values - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix static const struct - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix whitespace - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix static const struct - -2020-12-26 Jim Klimov - - * server/conf.c, server/upsd.c, server/upsd.h: server/upsd.{c,h} - conf.c: fix maxconn to long, to match sysconf() return value; check - that practical value range allows to malloc() the buffers - * server/upsd.c: server/upsd.c: fix size_t/ssize_t types for - {ssl_,}write() in sendback() - * server/netssl.c, server/netssl.h: server/netssl.{c,h}: fix - ssl_write()/ssl_read() to return ssize_t (like upsclient - net_write()/net_read()) - * server/netssl.c: server/netssl.c: fix int types for OpenSSL - codepaths - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: fix numphases to - unsigned int - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: fix int size_t - types for read(), malloc() etc. - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: fix size_t types - for upsdebugx_hex() and some indentation - * drivers/isbmex.c: drivers/isbmex.c: fix int size_t types for - read(), malloc() etc. - * drivers/genericups.c: drivers/genericups.c: fix int types for - sleep() - * drivers/genericups.c: drivers/genericups.c: cast termios types for - bit magic - * drivers/gamatronic.h: drivers/gamatronic.h: fix speed_t/size_t in - baud_rates[] definition like for bcmxcp_ser - * drivers/gamatronic.c: drivers/gamatronic.c: fix some whitespace - * drivers/gamatronic.c: drivers/gamatronic.c: fix int size_t types - for read(), malloc() etc. - * drivers/etapro.c: drivers/etapro.c: constrain return value for - etapro_get_response() type - * drivers/bestuferrups.c: drivers/bestuferrups.c: fix size_t int type - for execute() (use-cases pass sizeof() anyway) - * drivers/bestfortress.c: drivers/bestfortress.c: constrain value for - usleep() in upssend() - * drivers/bestfortress.c: drivers/bestfortress.c: constrain return - value for upssend() type - * drivers/bestfortress.c: drivers/bestfortress.c: fix size_t types - for upsdebugx_hex() - -2021-04-23 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: fix back setparam() - arg type - -2020-12-01 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: fix printing of - ssize_t variable - -2020-11-30 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: use size_t where it - should be, for data chunk length parsing - -2020-12-26 Jim Klimov - - * drivers/bestfcom.c: drivers/bestfcom.c: fix size_t int type for - execute() (use-cases pass sizeof() anyway) - * drivers/belkinunv.c: drivers/belkinunv.c: fix int types for read(), - malloc() etc. - * drivers/belkinunv.c: drivers/belkinunv.c: fix int types for reg - (byte) - * drivers/belkin.c: drivers/belkin.c: fix size_t/useconds_t int type - for cnt (already limited to byte range) - * drivers/bcmxcp.c: drivers/bcmxcp.c: whitespace fix indentation in - set_alarm_support_in_alarm_map() - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix unsigned int type for index - arguments in set_alarm_support_in_alarm_map() - * drivers/serial.c: drivers/serial.c: fix ssize_t int type for - function returns vs size_t buflen argument - * drivers/dstate.c: drivers/dstate.c: fix size_t int type for - bufrw_max - * drivers/main.c: drivers/main.c: fix int types for poll_interval - * clients/upscmd.c: clients/upscmd.c: fix data range warnings for - asserts about implem-dependent overflow chances - * clients/upsrw.c: clients/upsrw.c: fix data range warnings for - asserts about implem-dependent overflow chances - * clients/upsclient.c: clients/upsclient.c: fix data range warnings - for asserts about implem-dependent overflow chances - * clients/upsmon.c, clients/upsmon.h: clients/upsmon.c: fix int types - for power value and totalpv accounting - * clients/upsmon.c: clients/upsmon.c: fix int types for sleep() - * clients/upsimage.c: clients/upsimage.c: make explicit casts from - floating-points into int types for rendering - * clients/upscmd.c: clients/upscmd.c: fix int types for timeouts from - upsclient.c - * clients/upsrw.c: clients/upsrw.c: fix int types for timeouts from - upsclient.c - * clients/upsclient.c: clients/upsclient.c: fix numq int types for - verify_resp() - -2020-12-25 Jim Klimov - - * clients/upsclient.c: clients/upsclient.c: make explicit a case - size_t/ssize_t casting - * clients/upsclient.c, clients/upsclient.h: clients/upsclient.{c,h}: - fix "timeout" type in - net_read/net_write/upscli_sendline_timeout/upscli_readline_timeout - to match upscli_select_read/upscli_select_write - * clients/upsclient.c: clients/upsclient.c: fix int types for OpenSSL - codepaths - -2020-12-07 Jim Klimov - - * drivers/metasys.c: drivers/metasys.c: various routines: fix - command_length into size_t - * drivers/bcmxcp_io.h, drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c: - bcmxcp*: various routines: fix command_length into size_t - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: get_answer(): fix - bytes_read, end_length and length into size_t - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: get_answer(): fix - bytes_read, end_length and length into size_t - -2020-12-02 Jim Klimov - - * drivers/bcmxcp.c: drivers/bcmxcp.c: use size_t for upsdebugx_hex() - and upsdebugx_ascii() args for logged data length - -2020-12-01 Jim Klimov - - * drivers/masterguard.c: drivers/masterguard.c: fix printing of - ssize_t variable - -2020-11-30 Jim Klimov - - * clients/upsstats.c: clients/upsstats.c: fix use of use size_t vs - int-argumented printf("%.*s", int, str) formatting - * drivers/al175.c: drivers/al175.c: check pointer math WRT buffer - lengths passed to logging - * common/common.c, include/common.h: common.{c,h}: use size_t for - upsdebugx_hex() and upsdebugx_ascii() args for logged data length - * drivers/tripplitesu.c: drivers/tripplitesu.c: init_comm(): fix data - types to size_t for strlen() function - * drivers/tripplitesu.c: drivers/tripplitesu.c: do_command(): fix up - "count" int type to be unsigned - * drivers/tripplitesu.c: drivers/tripplitesu.c: do_command(): fix up - "ret" int type to avoid conversions - * drivers/masterguard.c: drivers/masterguard.c: avoid value type - conversion by changing data types to size_t for strlen() function - * drivers/masterguard.c: drivers/masterguard.c: avoid value type - conversion by casting explicitly the return value of strlen() - function - -2020-12-27 Jim Klimov - - * clients/nutclient.cpp, clients/nutclient.h: - clients/nutclient.{h,cpp}: explicitly request copy constructor - generation for exception classes - -2020-11-30 Jim Klimov - - * clients/upsset.c: drivers/upsset.c: fix up int types to avoid - implicit conversions - * clients/upsimage.c: drivers/upsimage.c: avoid value type conversion - by casting explicitly the return value of strlen() function - * clients/upsimage.c: drivers/upsimage.c: fix up int types to avoid - conversions - * clients/cgilib.c: drivers/cgilib.c: fix up int types to avoid - conversions - * clients/upsstats.c: drivers/upsstats.c: fix up floating-point types - to avoid conversions and precision change - * clients/upsstats.c: clients/upsstats.c: use size_t where it should - be, for string length related processing - * clients/upslog.c: clients/upslog.c: use size_t where it should be, - for string length related processing - * clients/upslog.c: clients/upslog.c: avoid implicit floating-integer - conversion - -2021-03-30 Jim Klimov - - * configure.ac: configure.ac: nut_enable_warnings: clang presets - should let "-Wdocumentation" slide: NUT does not use it now, and - third-party headers are what they are - -2020-12-29 Jim Klimov - - * tests/nut-driver-enumerator-test.sh: tests/nut-driver-enumerator- - test.sh: allow to pass SHELL_PROGS="busybox_sh" as a single token - -2020-12-26 Jim Klimov - - * .travis.yml: .travis.yml: move _matrix_linux_gnustd_warn_viable a - bit up in _matrix_required_linux listing, to get more probable - failures earlier - -2021-04-23 Jim Klimov - - * drivers/delta_ups-mib.c: delta-mib.c: rename onbatt_info lookup - table in commented-away code sample (and match naming pattern with - other tables) - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c: typo in comment - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: comment that Vendor ID - 0x0483 is from ST Microelectronics - -2021-04-23 Jim Klimov - - * drivers/ever-hid.c: Update ever-hid.c Make and comment the macro - for ST Microelectronics vendor id (to generate udev data, etc. - properly) - * drivers/ever-hid.c: Update ever-hid.c Lowercase the hex in vendor - ID macro, for consistency - -2021-04-22 Nick Briggs - - * drivers/hidparser.c: correct 'for' loop initial declarations are - only allowed in C99 or C11 mode - * drivers/hidparser.c: Extract values in HIDParse correctly when - compiled in 64-bit (LP64) mode Reworks the conversion of bytes in - little-endian order to host order to operate independently of the - sizeof(long) and the byte-order of the host system. The extracted - value is stored as uint32_t as the code already performs casts to - signed/unsigned of varying sizes as appropriate to the context of - use. - -2021-04-21 Jim Klimov - - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: sync polling frequencies - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: remove (read-only) mappings for ups.delay* - in favor of same points polled for ups.timer* - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: comment away ups.mfr/model/serial setting - per PR comments - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: set voltage/current/frequency precision to - %.1f same for all entries - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: set battery.charge* precision to %.0f same - for all entries - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: import delta_ups_hid2nut[] entries "as is" - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: import Helper lookup tables and mapping - functions from master - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: change delta_ups_hid2nut[] content order - by names to be same as in master - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: import named delta_ups_usage_lkp[] content - from master - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: import delta_ups_format_model() content - from master - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: move delta_ups_format_model() to same - position as in master - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: indentations in delta_ups_claim() - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: indentations in delta_ups_hid2nut[] - * drivers/delta_ups-hid.c: drivers/delta_ups-hid.c/.h: sync PR #807 - code with master branch: indentations in delta_ups_usage_lkp[] - * drivers/delta_ups-hid.c, drivers/delta_ups-hid.h: - drivers/delta_ups-hid.c/.h: sync PR #807 code with master branch: - rename delta => delta_ups, sync comments - * drivers/Makefile.am, drivers/{delta-hid.c => delta_ups-hid.c}, - drivers/{delta-hid.h => delta_ups-hid.h}, drivers/usbhid-ups.c, - scripts/upower/95-upower-hid.rules: Rename delta-hid.c/.h to - delta_ups-hid.c/.h and sync vendor label for USB [#807] - -2021-04-21 Edgar Fuß - - * drivers/nutdrv_qx.c: Correct format string size_t is unsigned, so - use %zu (not %zd) in upsdebug() format string. - * drivers/nutdrv_qx.c: Remove vis-dependent debugging code Remove - (level 4) debugging code in the phoenixtex/masterguard USB - subdriver that depends on the BSD strvis() family for visual string - formatting. - -2021-04-20 Jim Klimov - - * drivers/delta-hid.c: Update delta-hid.c Sync the vendor-name - comment (for udev generation among others) with another Delta HID - driver merged to master recently. - -2021-04-20 Jim Klimov - - * drivers/delta_ups-hid.c, scripts/upower/95-upower-hid.rules: - 95-upower-hid.rules: regenerate for idVendor=05dd (Delta UPS) - * docs/documentation.txt: docs/documentation.txt: add a section on - reporting Data dumps for the DDL - -2021-04-20 Jim Klimov - - * docs/nut.dict: Update nut.dict Updated for PR #994 - -2021-04-20 Jim Klimov - - * docs/man/nutdrv_qx.txt: docs/man/nutdrv_qx.txt: fix copy-paste typo - -2021-04-20 Ygor Amadeo Sartori Regados - - * docs/man/microsol-apc.txt: Man page compilation error fixes - * docs/man/Makefile.am, docs/man/microsol-apc.txt: Added man page - * drivers/microsol-apc.c, drivers/microsol-common.h: Fix: wrong - operator and unused function - * drivers/microsol-apc.c, drivers/microsol-apc.h: Fixed driver name - -2021-04-20 Jim Klimov - - * drivers/microsol-apc.c: Update microsol-apc.c In upsdrv_info, - split contributors one per line for better source readability - -2021-04-20 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix back the name for - "fabula_hunnox_subdriver" (USB protocol subdriver vs. - "hunnox_subdriver" for device data mapping) - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: bump core DRIVER_VERSION - to reflect changes from PR #638 for "hunnox" support - * docs/man/nutdrv_qx.txt, drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: - simplify new subdriver/command naming from "fabula-hunnox" to - "hunnox" - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: restore indentation with - TABs - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fabula_command_hunnox(): - comment about truncating the buflen to 102 bytes - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fabula_command_hunnox(): - comment away scoping for (and use of) "hunnox_patch" leaving the - markers in comments for refactoring - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: comment that - fabula_hunnox_subdriver was reported to support more than Hunnox - branded devices - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fabula_command_hunnox(): - restore originally PRed choice of usb_get_string{,_simple}() based - on langid_fix alone - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: separate - fabula_command_hunnox() from fabula_command() without using a mixed - routine, to ensure no impact on currently supported devices - * docs/nut.dict: docs/nut.dict: typo fix - -2021-04-20 Jim Klimov - - * docs/nut.dict: Update nut.dict Some more keywords to the - dictionary from PR #638 - -2021-04-19 Jim Klimov - - * docs/nut.dict: Update nut.dict Update dictionary for Hunnox PR - #638 - * docs/man/nutdrv_qx.txt: Update nutdrv_qx.txt Basically mention - updates from Hunnox subdriver and protocol addition (PR #638). - * drivers/nutdrv_qx.c: Update nutdrv_qx.c Err on the safer side of - changing behavior for non-hunnox device support, limit the - applicability of langid_fix (per PR #638 review cautionary - comments). Maybe the proposed original change did apply to other - devices that support the fix-up, but that should be evaluated - separately and this new constraint reversed if needed. - * drivers/nutdrv_qx_hunnox.c: Update nutdrv_qx_hunnox.c Updated file - heading - * drivers/nutdrv_qx_hunnox.h: Update nutdrv_qx_hunnox.h Updated file - heading - -2021-04-10 Jim Klimov - - * docs/images/advanced.png, docs/images/bizarre.png: Vox populi: - replace master by primary and slave by secondary in documentation - images [#840] - -2021-04-09 Jim Klimov - - * docs/images/ci/fosshost.org_Host_Dark_56px.png, - docs/images/ci/jenkins-nut-large-256px.png, docs/images/ci/jenkins- - nut-large-squared.png, docs/images/ci/jenkins-nut-large.pdn, - docs/images/ci/jenkins-nut-large.png, docs/images/ci/jenkins-nut- - small-256px.png, docs/images/ci/jenkins-nut-small.pdn, - docs/images/ci/jenkins-nut-small.png, docs/images/ci/jenkins-nut- - squared.png, docs/images/ci/jenkins-nut-transparent-bg-40px.png, - docs/images/ci/jenkins-nut-transparent-bg.png, - docs/images/ci/jenkins-nut.css, docs/images/ci/jenkins-nut.png, - docs/images/ci/jenkins-nut.txt: Add image and CSS resources used in - new Jenkins CI [#869] - -2021-04-09 Jim Klimov - - * docs/nut.dict: Update nut.dict Missed a couple of new dictionary - words - -2021-04-09 Alexey Kazancev - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: add overflows protection - for snr subdriver - -2021-04-09 Jim Klimov - - * docs/nut.dict: Update nut.dict Added "snr" and "SNR" to - spellchecker dictionary - -2021-04-09 Alexey Kazancev - - * docs/acknowledgements.txt: docs/acknowledgements.txt: add NAG at - manufacturer list - * data/driver.list.in: data/driver.list.in: add various SNR-UPS-LID- - XXXX UPSes supported by nutdrv_qx Protocol: 'megatec' USB - subdriver: 'snr' - * docs/man/nutdrv_qx.txt: docs/man/nutdrv_qx.txt: update man page for - new 'snr' USB subdriver - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: add new 'snr' USB - subdriver to support SNR-UPS-LID units - -2021-04-08 Jim Klimov - - * docs/man/Makefile.am: Update Makefile.am Beside exactly "troff" - some systems have other "*roff" family tools and formats - -2021-04-07 Jim Klimov - - * configure.ac: configure.ac: satisfy both builders that have pkg- - config installed and those who do not - * configure.ac: configure.ac: avoid syntax errors if pkg-config is - not installed - -2021-04-06 Aaron Thompson - - * drivers/powercom.c: drivers/powercom.c: Fix a small error in output - voltage for KIN models. - -2021-03-31 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: protect failsafe logic from - compiler warnings with pragmas - -2021-03-30 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: alarm_set(): stretch slightly - absurd ways to avoid overflow and fix signed/unsigned mismatch - (follow up for #986) - * configure.ac: configure.ac: add --enable-cppunit to allow disabling - it even if deemed supported by compiler Practice shows that - libcppunit.so may be linked against a different compiler version - and/or libc than the one used for current NUT build. While formal - support checked by the script works, practical build fails. - * NEWS: NEWS: Reflect terminology change for upsmon - -2021-03-29 Jim Klimov - - * clients/upsmon.c: clients/upsmon.c: rename static functions - slavesync() => sync_secondaries() and checkmaster() => - apply_for_primary() and document them better - * README, clients/nutclient.cpp, clients/nutclient.h, - clients/upsmon.c, clients/upsmon.h, conf/ups.conf.sample, - conf/upsd.users.sample, conf/upsmon.conf.sample.in, docs/config- - notes.txt, docs/design.txt, docs/features.txt, docs/history.txt, - docs/man/clone.txt, docs/man/genericups.txt, - docs/man/libnutclient_misc.txt, docs/man/nut.conf.txt, - docs/man/nutdrv_atcl_usb.txt, docs/man/richcomm_usb.txt, - docs/man/upsd.txt, docs/man/upsd.users.txt, - docs/man/upsmon.conf.txt, docs/man/upsmon.txt, docs/net- - protocol.txt, docs/new-drivers.txt, docs/scheduling.txt, - docs/security.txt, drivers/optiups.c, scripts/augeas/README, - scripts/augeas/nutupsdusers.aug.in, - scripts/augeas/tests/test_nut.aug, scripts/perl/Nut.pm, - scripts/python/module/PyNUT.py, server/netcmds.h, server/netuser.c, - server/netuser.h, server/user.c: Vox populi: replace manager/master - by primary and subordinate/slave by secondary - * scripts/python/app/README: scripts/python/app/README: typo fix - * docs/man/libnutclient_misc.txt: docs/man/libnutclient_misc.txt: fix - English wording a bit - * docs/nut.dict: docs/nut.dict: update word-count after large docs - update - -2021-03-27 orbea - - * drivers/Makefile.am: drivers: Fix undefined references with - slibtool. - -2021-03-26 Arnaud Quette - - * scripts/upower/95-upower-hid.rules: Revert "95-upower-hid.rules - script updated" This reverts commit - 262c23c6b8f1368165c75a0df317b1ba9ff5c511. - -2021-03-26 Jim Klimov - - * tools/nut-snmpinfo.py: Update nut-snmpinfo.py Also handle the `//` - comments same way as `/*...` - -2021-03-25 Arnaud Quette - - * tools/nut-snmpinfo.py: nut-scanner: improve SNMP extractor script - Also remove EOL comments - -2021-03-24 Jim Klimov - - * drivers/bestups.c, drivers/blazer.c, drivers/blazer.h, - drivers/blazer_ser.c, drivers/blazer_usb.c: bestups, blazer* driver - sources: add obsoletion notices on top, in favor of nutdrv_qx - drivers - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: allow to trace USB - driver conflicts (e.g. obsoleted and new handlers of same - vendor/product IDs) - -2021-03-23 Ygor Amadeo Sartori Regados - - * drivers/microsol-apc.c, drivers/microsol-apc.h, drivers/microsol- - common.c, drivers/microsol-common.h: Bug fix: battery charge - calculation - -2021-03-23 Jim Klimov - - * ci_build.sh: ci_build.sh: make GitIgnores failure fatal (and report - what the difference is, for tracked and regenerated files) - * tests/.gitignore: GitIgnore tests/nutlogtest binary - * ci_build.sh: ci_build.sh: make GitIgnores failure fatal - -2021-03-23 Degott, Francois Regis - - * scripts/upower/95-upower-hid.rules: 95-upower-hid.rules script - updated - -2021-03-23 Ygor Amadeo Sartori Regados - - * drivers/microsol-common.c: Bug fix: Handle packet boundary - desynchronization - -2021-03-23 Degott, Francois Regis - - * scripts/upower/95-upower-hid.rules: 95-upower-hid.rules script - updated - * drivers/Makefile.am, drivers/eaton-ats16-nm2-mib.c, .../{eaton- - ats16-mib.h => eaton-ats16-nm2-mib.h}, .../{eaton-ats16-mib.c => - eaton-ats16-nmc-mib.c}, drivers/eaton-ats16-nmc-mib.h, - drivers/snmp-ups.c: improve support of EATON ATS16 NMC/NM2 - -2021-03-21 Ygor Amadeo Sartori Regados - - * drivers/microsol-apc.c: Fixed missing calculation part for BZ1500 - Bug identified with data provided on issue #697 - * drivers/microsol-common.c: CI fix: C89 compilation fixed - * drivers/Makefile.am: Missing header fixed - * drivers/Makefile.am: CI error fix: missing header file - -2021-03-19 Ygor Amadeo Sartori Regados - - * drivers/microsol-common.c, drivers/microsol-common.h: Fixed LGTM - alert about localtime_r Also passed microsol-common.c through - indent - * drivers/Makefile.am, drivers/microsol-apc.c, drivers/microsol- - apc.h, drivers/microsol-common.c, drivers/microsol-common.h: New - driver: microsol-apc Derived from solis driver, for newer APC - Back-UPS BR hardware. Support added for APC Back-UPS BZ1500, - BZ2200BI and BZ2200I. Tested on BZ2200BI. Created common file that - may be used on solis as well. - -2021-03-14 JungEon Kim - - * data/driver.list.in: Add Delta UPS Amplon R Series in drivers.list - -2021-03-14 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: alarm_set(): at least log the - truncated buf if it does not fit into dstate field - -2021-03-13 Jim Klimov - - * docs/developers.txt: docs/developers.txt: replace "master" where it - is easy, and update some recommendations - * clients/upsmon.c: clients/upsmon.c: comment that also several NUT - drivers can directly set FSD flag propagated from the smarter power - devices - * docs/security.txt: docs/security.txt: extend the Firewall section - for more considerations - * docs/man/upsmon.txt: docs/man/upsmon.txt: suggestions for - experiments about timing the shutdown vs. dummy SHUTDOWNCMD to - check the skeleton logic - * docs/man/upsmon.conf.txt: docs/man/upsmon.conf.txt: extend the - example for "bigserver" with manager vs subordinate upsmon's - * docs/history.txt: docs/history.txt: reflect that slave/master terms - were deprecated - * README: README: Make note of UPSes which allow multiple managerial - accesses - * clients/nutclient.cpp, clients/nutclient.h, clients/upsmon.c, - docs/net-protocol.txt, scripts/perl/Nut.pm, - scripts/python/module/PyNUT.py, server/netcmds.h, server/netuser.c, - server/netuser.h, server/user.c: Identify points in source code - (and few related docs) for deprecating master|slave terminology - * README, clients/upsmon.c, clients/upsmon.h, conf/ups.conf.sample, - conf/upsd.users.sample, conf/upsmon.conf.sample.in, docs/config- - notes.txt, docs/design.txt, docs/features.txt, docs/man/clone.txt, - docs/man/genericups.txt, docs/man/libnutclient_misc.txt, - docs/man/nut.conf.txt, docs/man/nutdrv_atcl_usb.txt, - docs/man/richcomm_usb.txt, docs/man/upsd.txt, - docs/man/upsd.users.txt, docs/man/upsmon.conf.txt, - docs/man/upsmon.txt, docs/net-protocol.txt, docs/new-drivers.txt, - docs/nut.dict, docs/scheduling.txt, docs/security.txt, - drivers/optiups.c, scripts/augeas/README, - scripts/augeas/nutupsdusers.aug.in, - scripts/augeas/tests/test_nut.aug, scripts/perl/Nut.pm, - server/user.c: Update documentation, emitted messages and easy-to- - fix code to rename master=>manager and slave=>subordinate - * docs/man/upsmon.txt: docs/man/upsmon.txt: suggestions for - experiments about timing the shutdown vs. dummy SHUTDOWNCMD to - check the skeleton logic - * docs/security.txt: docs/security.txt: extend the Firewall section - for more considerations - * docs/security.txt: docs/security.txt: reword one shade of "master" - * docs/solaris-usb.txt: docs/solaris-usb.txt: reword one shade of - "master" - * drivers/asem.c: drivers/asem.c: clarify the use of "S" word - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - clarify the use of "S" word - * drivers/nutdrv_qx.c, drivers/usbhid-ups.c: drivers/nutdrv_qx.c & - usbhid-ups.c: reword "Reference list of..." - * clients/upsmon.c, docs/net-protocol.txt: docs/net-protocol.txt + - upsmon.c: comment that also several NUT drivers can directly set - FSD flag propagated from the smarter power devices - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: note that - systems should only shutdown when less than MINSUPPLIES PSUs are - non-critical - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: note about - UPSes with manageable thresholds for critical state - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: note that - rack shutdowns can compete for I/O and take longer - * conf/upsmon.conf.sample.in: conf/upsmon.conf.sample.in: generalize - the example about multi-PSU servers - * docs/config-notes.txt: docs/config-notes.txt: update the example - about multi-PSU servers - -2021-03-13 JungEon Kim - - * drivers/Makefile.am, drivers/delta_ups-hid.c, drivers/delta_ups- - hid.h, drivers/usbhid-ups.c: delta_ups-hid: Add support for Delta - UPS Amplon R Series - -2021-03-13 Jim Klimov - - * docs/config-notes.txt: docs/config-notes.txt: note about upsmon - with 0 PSUs for just-monitoring - * data/html/header.html.in, docs/cables/apc-rs500-serial.txt, - docs/cables/ge-imv-victron.txt, docs/cables/powerware.txt, - docs/cables/repotec.txt, docs/cables/sms.txt, docs/man/apcsmart- - old.txt, docs/man/apcsmart.txt, docs/man/asem.txt, - docs/man/bcmxcp.txt, docs/man/bcmxcp_usb.txt, docs/man/belkin.txt, - docs/man/belkinunv.txt, docs/man/bestfcom.txt, - docs/man/bestuferrups.txt, docs/man/bestups.txt, - docs/man/everups.txt, docs/man/genericups.txt, docs/man/index.txt, - docs/man/libnutclient_misc.txt, docs/man/libnutclient_tcp.txt, - docs/man/libupsclient-config.txt, docs/man/liebert-esp2.txt, - docs/man/metasys.txt, docs/man/mge-shut.txt, docs/man/mge- - utalk.txt, docs/man/nut-driver-enumerator.txt, docs/man/nut- - ipmipsu.txt, docs/man/nut-scanner.txt, - docs/man/nutdrv_atcl_usb.txt, - docs/man/nutscan_add_device_to_device.txt, - docs/man/nutscan_add_option_to_device.txt, - docs/man/nutscan_cidr_to_ip.txt, - docs/man/nutscan_display_parsable.txt, - docs/man/nutscan_display_ups_conf.txt, - docs/man/nutscan_free_device.txt, - docs/man/nutscan_get_serial_ports_list.txt, - docs/man/nutscan_init.txt, docs/man/nutscan_new_device.txt, - docs/man/nutscan_scan_avahi.txt, - docs/man/nutscan_scan_eaton_serial.txt, - docs/man/nutscan_scan_ipmi.txt, docs/man/nutscan_scan_nut.txt, - docs/man/nutscan_scan_snmp.txt, docs/man/nutscan_scan_usb.txt, - docs/man/nutscan_scan_xml_http.txt, docs/man/oneac.txt, - docs/man/optiups.txt, docs/man/phoenixcontact_modbus.txt, - docs/man/powercom.txt, docs/man/powerman-pdu.txt, - docs/man/rhino.txt, docs/man/richcomm_usb.txt, - docs/man/riello_ser.txt, docs/man/riello_usb.txt, - docs/man/skel.txt, docs/man/solis.txt, docs/man/tripplite.txt, - docs/man/ups.conf.txt, docs/man/upscli_add_host_cert.txt, - docs/man/upscli_connect.txt, docs/man/upscli_disconnect.txt, - docs/man/upscli_get.txt, docs/man/upscli_init.txt, - docs/man/upscli_splitaddr.txt, docs/man/upscli_splitname.txt, - docs/man/upscli_upserror.txt, docs/man/upsclient.txt, - docs/man/upscmd.txt, docs/man/upsd.conf.txt, docs/man/upsd.txt, - docs/man/upsd.users.txt, docs/man/upsdrvctl.txt, - docs/man/upsdrvsvcctl.txt, docs/man/upslog.txt, - docs/man/upsmon.conf.txt, docs/man/upsmon.txt, docs/man/upsrw.txt, - docs/man/upssched.txt, docs/man/upsset.cgi.txt, - docs/man/upsset.conf.txt, docs/man/upsstats.html.txt, - docs/man/usbhid-ups.txt, docs/man/victronups.txt: docs: fix some - trailing whitespaces - -2021-03-12 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: limit alarm_buf string to fit - into a dstate info status, and log errors and overflows from - alarm_set() [issue #960] - -2021-03-02 Edgar Fuß - - * docs/man/blazer-common.txt, docs/man/nutdrv_qx.txt, - docs/man/tripplite_usb.txt, docs/man/usbhid-ups.txt: Add a remark - that USB device numbers may be unstable In the documentation of - the USB device number matching, add a remark that device numbers - need not to be stable across re-boots or when re-plugging the - device. - * drivers/usb-common.c: USB device matching: add debug messages on - non-match When failing to match the Device part, note this via - upsdebugx() just like when not matching any other part (VendorId, - ProductId, Bus, etc.). - -2021-03-02 Jim Klimov - - * docs/man/nutdrv_qx.txt: Update nutdrv_qx.txt Fixed typo in a new - masterguard paragraph - -2021-02-12 Edgar Fuß - - * tools/nut-usbinfo.pl: Fix VendorID/ProductID matching In a line - like { USB_DEVICE(0x06da, 0x0002), "Phoenixtec Power","USB Cable - (V2.00)", &phoenixtec_subdriver },/* Masterguard A Series */ don't - match ProductID up to the closing parenthesis in the product name - string. - -2021-02-11 Edgar Fuß - - * docs/man/masterguard.txt, docs/man/nutdrv_qx.txt, docs/nutdrv_qx- - subdrivers.txt, drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_masterguard.c, drivers/nutdrv_qx_masterguard.h: - Add Masterguard A/E driver based on Q* framework Add a new driver - for Masterguard A and E series based on the Q* framework - (nutdrv_qx). Based on vendor documentation of both the command set - and USB protocol I was both asked not to disclose. Supports "new" - A700/1000/2000/3000(-19) and E40/60/100(-19) (totally untested due - to lack of hardware). Still sort of work in progress due to some - open questions on NUT integration. - * docs/man/blazer-common.txt, docs/man/nutdrv_qx.txt, - docs/man/tripplite_usb.txt, docs/man/usbhid-ups.txt, - drivers/blazer_usb.c, drivers/libusb.c, drivers/nutdrv_qx.c, - drivers/riello_usb.c, drivers/tripplite_usb.c, drivers/usb- - common.c, drivers/usb-common.h, drivers/usbhid-ups.c: Add USB - device number matching Extend the USB matching by a device number - (in addition to the existing bus number) by adding a Device field - to USBDevice_[st] and ammending the RegExp by a seventh field. - Maybe some #defines for the magical constants would be appropriate. - Add DEBUG_EXACT_MATCH_DEVICE analogous to DEBUG_EXACT_MATCH_BUS, - whatever its intended usage is. Document the device field where - the bus field was documented (which is not the case everywhere it's - actually used). - -2021-01-31 TJ McConnell - - * drivers/tripplite-hid.c: Move 0x3024 alphabetically. Add comment - about new version - -2021-01-26 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: fix regression on Eaton - ePDU Fix a regression that caused a mis-determination of the SNMP - base OID index (0 or 1, should be 1). This in turn caused a mis- - iteration over the outlets, from 0 to N-1 instead of 1 to N, which - resulted in the missing Nth outlet (last outlet of the PDU). This - also caused some data refresh issues - -2021-01-23 Yifeng Li - - * drivers/main.c: main.c: write upsdrv_initinfo/updateinfo() logs to - syslog When a NUT driver is started (via upsdrvctl start), it runs - the following sequence: 1. Run as a foreground process. 2. Do some - basic initialization, log to stderr. 3. If not debugging: - fork() - - Run as a daemon, stderr off, syslog on. The problem, however, is - that upsdrv_initinfo() and updateinfo() are first called before - forking, as a result, the log messages is only sent to stderr, not - syslog. On a traditional init + syslog server setup, those startup - messages are lost. However, those lost messages can be urgent - for - example, it can be a warning about a failed UPS inverter. If the - server is freshly started, the admin may miss them until much - later, or keep staring at the mysterious alarm word without finding - anything relevant in syslog. Similarly, other types of warnings, - such as a rounded ondelay value, should also be visible in syslog. - This patch checks the debugging flags and turn on syslog earlier - when it's in non-debug, non-fork mode, allowing the logs during - upsdrv_initinfo() and upsdrv_updateinfo() to be recorded in syslog. - Mailing list discussion: https://alioth- - lists.debian.net/pipermail/nut-upsdev/2021-January/007508.html - -2021-01-23 TJ McConnell - - * drivers/tripplite-hid.c, scripts/upower/95-upower-hid.rules: Add - AVR750U (0x3024). Use smart1500lcdt_scale for - voltage/current/frequence - -2021-01-20 Jim Klimov - - * drivers/delta_ups-mib.c: delta-mib.c: rename onbatt_info lookup - table in commented-away code sample - * drivers/huawei-mib.c: huawei-mib.c: rename onbatt_info lookup table - in commented-away code sample - * drivers/xppc-mib.c: xppc-mib.c: rename onbatt_info lookup table in - commented-away code sample - -2016-05-25 Jim Klimov - - * drivers/raritan-px2-mib.c: raritan-px2-mib - renamed lookups to - have "raritanpx2_*" prefix - * drivers/raritan-pdu-mib.c: raritan-pdu-mib - renamed lookups to - have "raritan_pdu_*" prefix - * drivers/powerware-mib.c: powerware-mib - renamed "ietf_*" and - "eaton_*" lookups to have "pw_*" prefix - -2016-05-23 Jim Klimov - - * drivers/mge-mib.c: mge-mib.c : rename rogue ietf_* lookups to mge_* - -2016-05-25 Jim Klimov - - * drivers/baytech-mib.c: baytech-mib - renamed "outlet_status_info" - lookup to "baytech_outlet_status_info" - * drivers/apc-ats-mib.c: apc-ats-mib.c- renamed "ats_*" lookups to - "apc_ats_*" - -2021-01-08 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix instant commands using numeric - parameters Instant commands using numeric parameters, like - on/off/cycle commands, were failing due to a bad value submitted - type (time instead of integer) Cherry-picked from - https://github.com/42ity/nut/pull/120 - -2020-12-29 Steve Magoun - - * drivers/macosx-ups.c: drivers/macosx-ups.c: Add ups.mfr and - ups.model legacy vars, fixes #949 - -2020-12-29 Jim Klimov - - * ci_build.sh: ci_build.sh: allow CI workers to say if they have - functional libgd (for the current compiler/ABI version) so whether - it should not be required - -2020-12-28 Jim Klimov - - * ci_build.sh: ci_build.sh: treat helper dirs (tmp/ .inst/ - CCACHE_DIR/) correctly even if named FS objects are symlinks to - dirs - * docs/Makefile.am, docs/man/Makefile.am: docs/{man/,}Makefile.am: - parameterize EGREP and call "file" sanity checks case-insensitive - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: detect Apple - LLVM as CLANG - -2020-12-27 Jim Klimov - - * configure.ac, docs/developers.txt: configure.ac - docs/developers.txt: add a "medium" warning pre-set difficulty - level - * configure.ac: configure.ac: document the choice rationale of no- - warning macros - * docs/developers.txt, docs/nut.dict: docs/developers.txt: document - the new --enable-warnings options - * configure.ac: configure.ac: define a clang-minimal warning preset - that our codebase already survives - * .travis.yml, configure.ac: Move comment about clang no-warning - selection from .travis.yml to configure.ac - * .travis.yml: .travis.yml: make use of BUILD_WARNFATAL=yes - BUILD_WARNOPT=hard to simplify the test setup specifications - -2020-12-26 Jim Klimov - - * configure.ac: configure.ac: hush clang warnings about nullptr in - C++ code (c++98 not compatible)) - * configure.ac: configure.ac: provide a hidden "gcc-legacy" warnings - option to cover previous behavior - * ci_build.sh: ci_build.sh: allow passing --enable-warnings=... and - --enable-Werror=... args via BUILD_WARNOPT and BUILD_WARNFATAL - envvars - * configure.ac: configure.ac: implement --enable-warnings=... and - --enable-Werror(=yes/no) to specify the presets we require to pass - * m4/nut_arg_with.m4: m4/nut_arg_with.m4: add NUT_ARG_ENABLE and - document the difference vs NUT_ARG_WITH - * ci_build.sh: ci_build.sh: support passing BUILD_SSL_ONCE=true to - only try whichever SSL implem is found, not both even if installed - * autogen.sh: autogen.sh: shell-check that generated configure script - is syntactically valid - * m4/nut_compiler_family.m4: m4/nut_compiler_family.m4: fix tracking - nut_cv_CLANGCC and determining CLANGCC=yes - * drivers/apcsmart.c, drivers/apcsmart.h: drivers/apcsmart.{c,h}: - drop custom debx()/logx()/fatx()/fate() macros in favor of NUT- - standard ones - -2020-12-02 Jim Klimov - - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix a few whitespaces - (indentation) - -2020-12-07 Jim Klimov - - * drivers/libusb.c: drivers/libusb.c: fix whitespace - -2020-12-25 Jim Klimov - - * common/common.c: common/common.c: fix initialization of a struct - timeval (initialize all fields) - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: fix - initialization of a info_lkp_t (initialize all fields) - * drivers/al175.c: drivers/al175.c: assert incoming numbers, error- - check the sprintf() result, and comment why - * drivers/blazer_usb.c, drivers/nutdrv_qx.c: nutdrv_qx blazer_usb: - report acceptable subdriver names in help() - -2020-12-25 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: - match_function_subdriver(): upsdebugx() device matching faults to - help troubleshoot driver setups - -2020-12-24 Jim Klimov - - * drivers/usb-common.c: usb-common.c: upsdebugx() device matching - faults to help troubleshoot driver setups - -2020-12-25 Jim Klimov - - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: add comment for per- - warning pragma naming - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: fix wrong long macro - name typo, for the pragmas gating - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.h: #include - (lost in cherrypick web) - * docs/nut.dict: docs/nut.dict: add Evgeny - * docs/nut.dict: docs/nut.dict: add maintainership - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: fix nesting of macros - for pragmas - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: use HAVE_PRAGMAS_FOR_GC - C_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce HAVE_PRAGMAS_FOR_ - GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE - (equivalent of HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS on - some compilers) - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: comment in/out function - contexts for the pragma - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: do macro magic for - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC working - with older compilers - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: separate the support for - #pragma GCC diagnostic... inside vs outside function bodies - (gcc-4.4 and older are upset about "inside" case) - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: cast type for printing - speed_t on different OSes - -2020-12-07 Jim Klimov - - * drivers/bcmxcp_ser.c, drivers/bcmxcp_ser.h: - drivers/bcmxcp_ser.{c,h}: get_answer(): fix baud rate processing - into speed_t and size_t - -2020-12-23 Jim Klimov - - * docs/user-manual.txt: docs/user-manual.txt: small typo fix - * docs/nut.dict: nut.dict: update with project names that nut-website - spellchecking prefers to know - * docs/nut.dict: nut.dict: update with project names that nut-website - spellchecking prefers to know - * docs/nut.dict: nut.dict: update with project names that nut-website - spellchecking prefers to know - -2020-12-21 Jim Klimov - - * docs/acknowledgements.txt: docs/acknowledgements.txt: update - persons currently involved, new maintainer https://alioth- - lists.debian.net/pipermail/nut-upsdev/2020-November/007494.html - -2020-12-15 Bi11 - - * drivers/snmp-ups.c, tools/nut-scanner/scan_snmp.c: Fix incorrect - fatal message for privProtocol - * tools/nut-scanner/scan_snmp.c: Fix incorrect usmAESPrivProtocol - import in nut-scanner In libnetsnmp, usmAES128PrivProtocol is a - pointer, while usmAESPrivProtocol is an array. This change is the - same as in c7cf507454bcf6f40b24b58e61c130c7772c5bf2. - -2020-12-15 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: Restore legacy Eaton ePDU - switchability info Use a hack to also have switchability for both - the unit and its outlets on legacy Eaton G2 ePDU Partially - cherry-picked from 42ity fork, and bumped to their faster moving - MIB mapping revision number. See - https://github.com/42ity/nut/pull/118 As for the behavior of the - fix: * on G2, the first outlet.switchable doesn't exist, so try - the 2nd, which is the ugly hack: try on the first outlet to see if - switchable * on G3, the first is good, so flag unique does the - rest Tested on MA G2 and G3. - -2020-11-30 Jim Klimov - - * drivers/dummy-ups.c: drivers/dummy-ups.c: use size_t where it - should be, for numargs-related parsing - * clients/upsclient.c: clients/upsclient.c: use size_t where it - should be, for numargs parsing - * server/netcmds.h, server/netget.c, server/netget.h, - server/netinstcmd.c, server/netinstcmd.h, server/netlist.c, - server/netlist.h, server/netmisc.c, server/netmisc.h, - server/netset.c, server/netset.h, server/netssl.c, server/netssl.h, - server/netuser.c, server/netuser.h, server/upsd.c, server/user.c: - server/*: numerous upsd commands: use size_t where it should be, - for numargs parsing - * server/sockdebug.c: server/sockdebug.c: use (and print) size_t - where it should be, for numargs parsing - * drivers/dstate.c: drivers/dstate.c: use size_t where it should be, - for numargs parsing - * clients/upssched.c: clients/upssched.c: use (and print) size_t - where it should be, for numargs parsing - * clients/upsmon.c: clients/upsmon.c: use size_t where it should be, - for numargs parsing - * clients/upsset.c: clients/upsset.c: use size_t where it should be, - for numargs parsing - * server/conf.c: server/conf.c: use size_t where it should be, for - numargs parsing - * drivers/snmp-ups.c: drivers/snmp-ups.c: whitespace fix - * drivers/snmp-ups.c: drivers/snmp-ups.c: use size_t where it should - be, for numargs parsing - * common/state.c, include/state.h, server/sstate.c: common and server - state.c: use size_t where it should be, for numargs and numflags - parsing - * drivers/clone-outlet.c: drivers/clone-outlet.c: use size_t where it - should be, for numargs parsing - * drivers/clone.c: drivers/clone.c: use size_t where it should be, - for numargs parsing - * server/netssl.c: server/netssl.c: avoid implicit size_t (arch- - dependent) vs. PRInt32 (Mozilla NSS) integer conversion - * clients/upsclient.c: clients/upsclient.c: avoid implicit size_t - (arch-dependent) vs. PRInt32 (Mozilla NSS) integer conversion - -2020-12-02 Jim Klimov - - * drivers/solis.c: Update solis.c Shuffle the comparison in the if- - clause to certainly bail out if we did not read from the port. - -2020-11-30 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: fix up int types to - avoid implicit conversions, and pre-initialize to avoid - uninitialized use - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: initialize - variable to avoid potential uninitialized use - * drivers/blazer.c: drivers/blazer.c: initialize variable to avoid - potential uninitialized use and convey an error if that happens - * drivers/powerpanel.c: drivers/powerpanel.c: initialize variable to - avoid potential uninitialized use and convey an error if that - happens - * drivers/solis.c: drivers/solis.c: initialize variable to avoid - potential uninitialized use and convey an error if that happens - * drivers/rhino.c: drivers/rhino.c: initialize variable to avoid - potential uninitialized use and convey an error if that happens - * drivers/bestfortress.c: drivers/bestfortress.c: initialize - variables to avoid potential uninitialized use and null-pointer - dereference if data processing fails - -2020-12-02 Jim Klimov - - * include/nut_float.h: Update nut_float.h Consider equality to - epsilon to be also treated as zero - * include/nut_float.h: Update nut_float.h Fix copyright line - -2020-11-30 Jim Klimov - - * drivers/cps-hid.c: drivers/cps-hid.c: employ nut_float.h for safer - floating point comparisons - * drivers/snmp-ups.c: drivers/snmp-ups.c: employ nut_float.h for - safer floating point comparisons - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: - employ nut_float.h for safer floating point comparisons - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: employ - nut_float.h for safer floating point comparisons - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: employ nut_float.h for - safer floating point comparisons - * drivers/blazer.c: drivers/blazer.c: employ nut_float.h for safer - floating point comparisons - * drivers/upscode2.c: drivers/upscode2.c: employ nut_float.h for - safer floating point comparisons - * drivers/solis.c: drivers/solis.c: employ nut_float.h for safer - floating point comparisons - * drivers/rhino.c: drivers/rhino.c: employ nut_float.h for safer - floating point comparisons - * drivers/metasys.c: drivers/metasys.c: employ nut_float.h for safer - floating point comparisons - * drivers/mge-hid.c: drivers/mge-hid.c: employ nut_float.h for safer - floating point comparisons - * configure.ac, include/Makefile.am, include/nut_float.h: Introduce - nut_float.h and check more carefully for presence of math.h and/or - float.h in the build system - * drivers/tripplitesu.c: drivers/tripplitesu.c: avoid "bad function - cast" by casting explicitly the return value of the function - * drivers/tripplite.c: drivers/tripplite.c: avoid "bad function cast" - by casting explicitly the return value of the function - * drivers/mge-xml.c: drivers/mge-xml.c: avoid "bad function cast" by - casting explicitly the return value of the function - * drivers/bestfortress.c: drivers/bestfortress.c: avoid "bad function - cast" by casting explicitly the return value of the function - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix snprintf() target - buffer size from bogus sizeof() determination (#926) - -2020-11-29 Jim Klimov - - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: fix const - qualifier usage - * drivers/snmp-ups.c: drivers/snmp-ups.c: fix const qualifier usage - * drivers/snmp-ups.h: drivers/snmp-ups.h: remove const qualifiers - from strings in snmp_info_t, we have code that writes into them - * drivers/dstate.c: drivers/dstate.c: dstate_tree_dump(): fix const - qualifier usage - * drivers/bestfcom.c: drivers/bestfcom.c: avoid "bad function cast" - by casting explicitly the return value of the function - * drivers/libshut.c: drivers/libshut.c: avoid alignment issues with - buffer used actually for different variable types - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN to quiesce warnings - about a value we anyway receive a pointer to - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN - -2020-11-25 Jim Klimov - - * drivers/solis.c: drivers/solis.c: avoid variable-length arrays, - their support became optional after C99 - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: avoid variable-length - arrays, their support became optional after C99 - * drivers/apcsmart.c: drivers/apcsmart.c: avoid variable-length - arrays, their support became optional after C99 - * drivers/rhino.c: drivers/rhino.c: upsdrv_shutdown(): use sendshut() - * drivers/rhino.c: drivers/rhino.c: sendshut(): handle negative - returns from send_command() - * drivers/rhino.c: drivers/rhino.c: fix mismatched signedness in - comparison - * drivers/rhino.c: drivers/rhino.c: avoid variable-length arrays, - their support became optional after C99 - -2020-11-29 Jim Klimov - - * server/sstate.c: server/sstate.c: sstate_dead(): do not shadow - global varname "maxage" with same-named func argument - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_ups_get(): do not shadow - function-scope varname "value" with temporary-scope namesake - * drivers/snmp-ups.c: drivers/snmp-ups.c: snmp_ups_walk(): do not - shadow global varnames "(input|output|bypass)_phases" with same- - named func local variables - * drivers/upscode2.c: drivers/upscode2.c: check_uppm(): do not shadow - function-scope varname "val" with temporary-scope namesake - * drivers/libhid.c: drivers/libhid.c: new_report_buffer(): do not - shadow global varname "pDesc" with same-named func argument - * drivers/libshut.c: drivers/libshut.c: do not shadow global varnames - "upsfd" and "device_path" with same-named func arguments in - numerous routines - * drivers/dummy-ups.c: drivers/dummy-ups.c: parse_data_file(): do not - shadow global varname "upsfd" with same-named func argument (unused - for good measure) - * clients/upsset.c: clients/upsset.c: print_rw(): do not shadow - global varname "upsname" with same-named func argument - * drivers/riello_usb.c: drivers/riello_usb.c: fix array initializers - for sentinel entries - * drivers/blazer_usb.c: drivers/blazer_usb.c: fix array initializers - for sentinel entries - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: fix - array initializers for sentinel entries - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: fix array initializers - for sentinel entries - * drivers/apcsmart_tabs.c: drivers/apcsmart_tabs.c: fix array - initializers for sentinel entries - * drivers/apcsmart_tabs.c: drivers/apcsmart_tabs.c: fix numeric 0 - into pointer NULL - * drivers/apcsmart.c: drivers/apcsmart.c: fix array initializers for - sentinel entries - * drivers/blazer_ser.c: drivers/blazer_ser.c: fix array initializers - for sentinel entries - * drivers/blazer.c: drivers/blazer.c: fix array initializers for - sentinel entries - * drivers/powerp-txt.c: drivers/powerp-txt.c: fix array initializers - for sentinel entries - * drivers/powerp-bin.c: drivers/powerp-bin.c: fix array initializers - for sentinel entries - * drivers/mge-hid.c: drivers/mge-hid.c: fix array initializers for - sentinel entries - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: upsdrv_initinfo(): - fix array initializer; small whitespace clean-up - * server/upsd.c: server/upsd.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * drivers/powerp-bin.c: drivers/powerp-bin.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * drivers/upscode2.c: drivers/upscode2.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT to - reinforce the defensive programming patterns - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * drivers/dstate.c: drivers/dstate.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * drivers/main.c: drivers/main.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * clients/upssched.c: clients/upssched.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * clients/upsmon.c: clients/upsmon.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * server/upsd.c: server/upsd.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES to quiesce a - system definition of signal routines - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM - * tools/nut-scanner/nutscan-ip.c: tools/nut-scanner/nutscan-ip.c: - whitespace/formatting fixes - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: - whitespace/formatting fixes - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM to quiesce a - thirdparty-strange usecase of enum - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - whitespace/formatting fixes - * tools/nut-scanner/nutscan-ip.h: tools/nut-scanner/nutscan-ip.h: - whitespace/formatting fixes - * tools/nut-scanner/nutscan-device.c: tools/nut-scanner/nutscan- - device.c: whitespace/formatting fixes - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - drop semicolons after scope braces - -2020-11-28 Jim Klimov - - * ci_build.sh: ci_build.sh: consider "gdlib" pkg-config presence - equivalent to "libgd" There is a discrepancy between OS distro - packaging names and the delivered .pc file name... - * .travis.yml: .travis.yml: mark "gnu*-nowarn-x86-32bit" test cases - evergreen - -2020-11-27 Jim Klimov - - * drivers/bcmxcp.c, drivers/bcmxcp.h: drivers/bcmxcp.{h,c}: typo fix - CAPASITOR=>CAPACITOR - * tests/cpputest.cpp: cpputest.cpp: be sure to be able to handle - exception objects - -2020-11-26 Jim Klimov - - * drivers/blazer_usb.c: drivers/blazer_usb.c: annotate - #if/#else/#endif relevant to TESTING builds - * scripts/Solaris/precheck.py: scripts/Solaris/precheck.py: quote - shell vars, and report mismatches if any - -2020-11-27 Jim Klimov - - * .travis.yml: .travis.yml: xenial@s390x does not have "time" for us - (missed one beat) - -2020-11-26 Jim Klimov - - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: copy-paste - typo fix about unreachable code - * drivers/libusb.c: drivers/libusb.c: copy-paste typo fix about - unreachable code - -2020-11-27 Jim Klimov - - * .travis.yml: .travis.yml: from 32-bit build envs, drop amd64 libs - that confuse the linker - * .travis.yml: .travis.yml: tell the linker to go 32-bit too - -2020-11-23 Jim Klimov - - * .travis.yml: .travis.yml: work around poor packaging of multilib - perl in ubuntu - * .travis.yml: .travis.yml: define a &deps_driverlibs_cross_i386 list - for cross-builds (x86 32-bit) - * .travis.yml: .travis.yml: for x86-32 builds with gnu17 standard, - try to change install order for g++-multilib - * .travis.yml: .travis.yml: for x86-32 builds with gnu99 standard, - avoid g++-multilib - -2020-11-20 Jim Klimov - - * .travis.yml: .travis.yml: explicit support on 64-bit Debianish - systems for "gcc -m32" at least appears with gcc-multilib and - g++-multilib packages - -2020-11-03 Jim Klimov - - * .travis.yml: .travis.yml: comment for exploring ways to get 32-bit - travis builds - * .travis.yml: Issue #823 follow-up: add explicitly x86 32-bit builds - in Travis CI - -2020-11-27 Jim Klimov - - * ci_build.sh: ci_build.sh: relax the naming of libgd options seen in - the wild - -2020-11-23 Jim Klimov - - * ci_build.sh: ci_build.sh: warn if libgd is not seen and a "default- - all-errors" build might go without CGI binaries - -2020-11-17 Jim Klimov - - * drivers/phoenixcontact_modbus.c: drivers/phoenixcontact_modbus.c: - mrir(): do not shadow global varname "ctx" with same-named func - argument - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: possibly_supported(): - do not shadow global varname "hd" with func argument "hd" - -2020-11-25 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: drop semicolons after scope braces - * tools/nut-scanner/nutscan-device.c: tools/nut-scanner/nutscan- - device.c: drop semicolons after scope braces - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: drop - semicolons after scope braces - * drivers/riello.c: drivers/riello.c: drop extra semicolons - * drivers/bcmxcp.c: drivers/bcmxcp.c: drop semicolons after scope - braces - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: drop - semicolons after scope braces - * drivers/powercom.c: drivers/powercom.c: drop semicolons after scope - braces - * drivers/dstate.c: drivers/dstate.c: declare a macro for scoped - block in a way that semicolon may follow - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - mark up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: mark - up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: mark up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: mark - up NUT_UNUSED_VARIABLEs - -2020-11-27 Jim Klimov - - * clients/Makefile.am: clients/Makefile.am: - AM_CXXFLAGS+=-I$(top_srcdir)/include - -2020-11-25 Jim Klimov - - * tests/example.cpp, tests/nutclienttest.cpp: tests/nutclienttest.cpp - example.cpp: wrap into - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS et al to - avoid warnings for CPPUnit macro implementation (boils down to - static vars) - * tests/cpputest.cpp, tests/example.cpp, tests/nutclienttest.cpp, - tests/nutlogtest.c: tests/*.{c,cpp}: update legaleze headings - * tests/example.cpp: tests/example.cpp: fix casting - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: fix CPPUNIT - assert after nullptr - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: fix NULL => - nullptr - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: fix casting - * tests/Makefile.am: tests/Makefile.am: fix delivery and tracking of - CPPUNITTEST(ER)SRC - * tests/nutlogtest.c: tests/nutlogtest.c: add more tests to - investigate NUT_STRARG() behaviors - * configure.ac, include/str.h, m4/ax_c_pragmas.m4: - m4/ax_c_pragmas.m4, str.h => common.h: introduce - HAVE_PRINTF_STRING_NULL and NUT_STRARG(x) macro (for issue #904) - * tests/nutlogtest.c: tests/nutlogtest.c: use - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW detection to - quiesce warnings about "%s" resolving from NULL pointer First shot - at issue NUT #904 - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: introduce - HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW detection First - shot at issue NUT #904 - * tests/cpputest.cpp: tests/cpputest.cpp: print final result code - more comprehensibly (especially since process exit code is - inverted) - * clients/Makefile.am: clients/Makefile.am: be sure to use NUT - libcommon for CXX client builds - * clients/nutclient.cpp, clients/nutclient.h: - clients/nutclient.{h,cpp}: move virtual destructors of exception - classes into CPP file to bolt a linker unit (avoid Weak Vtables - warnings and related build overheads) - * clients/nutclient.cpp: clients/nutclient.cpp: (presumed) typo fix - - line ended with comma not semicolon - * clients/nutclient.cpp: clients/nutclient.cpp: quiesce warning and - make visible the unused variable - * clients/Makefile.am: clients/Makefile.am: define HAVE_NUTCOMMON for - NUT C++ builds - * clients/nutclient.cpp: clients/nutclient.cpp: use pragmas for - -Wexit-time-destructors and -Wglobal-constructors handling for an - std:string static variable - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: define pragmas for -Wexit- - time-destructors and -Wglobal-constructors handling - * clients/nutclient.cpp, clients/nutclient.h: - clients/nutclient.{h,cpp}: align strarr_alloc() type with xcalloc() - it uses => size_t - * clients/nutclient.cpp: clients/nutclient.cpp: fix old-style C casts - into static_cast<>s - * clients/nutclient.cpp, clients/nutclient.h: clients/nutclient.cpp: - for (clang) c++ builds with C++11/17/20, avoid warnings about C++98 - compatibility that we do not claim anyway - quiesce in C++ source - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: for (clang) c++ builds with - C++11/17/20, avoid warnings about C++98 compatibility that we do - not claim anyway - check that we have pragmas for that - * clients/nutclient.h: clients/nutclient.h: align method docs with - param names - -2020-11-26 Bastien Nocera - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: Reindent upower rules - header This piece of the code was really confusing because it - looked like, at a glance (and at more than a glance), that the line - which we'd have read in the generated rules file was commented out. - Turns out that beginning of lines in the generated rules could be - in the middle of the line in the code that generated it. Reindent - everything so that each line in the output corresponds to one line - in the input, except for empty lines. There are no differences in - output between the versions before and after this change. - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: Simplify exit path Why - "!= usb" when we're already checking for usb and other values - above? Always go to the end label if we didn't already jump to the - section containing the actual rules. - -2020-11-25 Jim Klimov - - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: do - not wrap variable definitions into parentheses like function - pointers - * drivers/al175.c: drivers/al175.c: declare function(void) prototypes - explicitly - * drivers/netxml-ups.c: drivers/netxml-ups.c: - netxml_alarm_subscribe(): explicitly cast range-limited int - conversions - * drivers/powercom.c: drivers/powercom.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * drivers/powerman-pdu.c: drivers/powerman-pdu.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/powercom.c: drivers/powercom.c: annotate upsdrv_shutdown() - with noreturn attr - * drivers/riello_usb.c: drivers/riello_usb.c: annotate shutdown*() - with noreturn attr - * drivers/powercom.c: drivers/powercom.c: annotate shutdown*() with - noreturn attr - * drivers/al175.c: drivers/al175.c: annotate upsdrv_shutdown() with - noreturn attr - * clients/upsmon.c: clients/upsmon.c: annotate forceshutdown() with - noreturn attr - * clients/upsimage.c: clients/upsimage.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * clients/upsimage.c: clients/upsimage.c: annotate lots of routines - with noreturn attr - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - mark up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: mark - up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: mark up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: mark - up NUT_UNUSED_VARIABLEs - * drivers/netxml-ups.c: drivers/netxml-ups.c: align method docs with - param names - * drivers/netxml-ups.c: drivers/netxml-ups.c: align method docs with - supported keywords - * drivers/al175.c: drivers/al175.c: align method docs with param - names - * drivers/hidparser.c: drivers/hidparser.c: satisfy pedantic macro - parser (defined vs. used value) - * drivers/libshut.c: drivers/libshut.c: satisfy pedantic macro parser - (defined vs. used value) - -2020-11-26 Jim Klimov - - * drivers/libusb.c: drivers/libusb.c: copy-paste typo fix about - unreachable code - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: copy-paste - typo fix about unreachable code - -2020-11-25 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - -2020-11-26 Jim Klimov - - * drivers/nutdrv_qx_blazer-common.c: drivers/nutdrv_qx_blazer- - common.c: remove overly-eager protection from nonliteral format - strings - -2020-11-26 Bastien Nocera - - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: Fix handling of "bind" - events See https://lwn.net/Articles/837033/ for an in-depth - explanation of how "bind" events should be handled in udev rules. - In short: " The ACTION line causes the entire file to be skipped - for anything other than ADD or CHANGE events; in particular, that - is what will happen with BIND events. That will cause properties - associated with those events to be lost — and the device in - question to be set up improperly (if at all). " - -2020-11-26 Jim Klimov - - * .travis.yml: .travis.yml: mark "gnu*-nowarn-s390x" test cases - evergreen - -2020-11-25 Jim Klimov - - * .travis.yml: .travis.yml: xenial@s390x does not have "time" for us - -2020-11-24 Jim Klimov - - * .travis.yml: Issue #823 follow-up: add s390x (BigEndian) builds in - Travis CI - -2020-11-25 Jim Klimov - - * drivers/riello_usb.c: drivers/riello_usb.c: do not hijack system - "errno" definition, and no use for local var of that name found - anyway - * drivers/powerman-pdu.c: drivers/powerman-pdu.c: do not assign - invalid value not from enum range, especially when for no reason - other than to have an un-used initial value - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: cover all values - of enum in a switch() Note: everything not covered before this PR - got aliased into default cases. I do not know the hardware and - models to rule this out otherwise, possibly assignments of binary - and/or smart protocol (lack of?) support are now wrong. - * drivers/powerp-bin.c: drivers/powerp-bin.c: cover all values of - enum in a switch() - * drivers/bestfcom.c: drivers/bestfcom.c: do not "break" just after - "fatalx()" - * drivers/bcmxcp.c: drivers/bcmxcp.c: do not "break" just after - "return" - * common/strerror.c: common/strerror.c: do not warn about unreachable - code in the web of ifdef built blocks - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: fix indentation - -2020-11-20 Jim Klimov - - * common/upsconf.c: common/upsconf.c: conf_args(): fix numargs type - * common/str.c: common/str.c: str_to_{u,}short{,_strict}() routines: - explicit cast from temporary variable to return-value type - * common/common.c: common/common.c: common/common.c: snprintfcat(): - replace asserts by negative returns (and errno where applicable) - * common/common.c: common/common.c: common/common.c: snprintfcat(): - sort out the messy return types (avoid implicit cast in - verification assert) - -2020-11-25 Jim Klimov - - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: do not warn - about nonliteral format string in this case - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: do not warn about - nonliteral format string in this case - * drivers/snmp-ups.c: drivers/snmp-ups.c: various routines: do not - warn about nonliteral format string in these cases - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: - various routines: do not warn about nonliteral format string in - these cases - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: do not warn about - nonliteral format string in this case - * drivers/powerp-bin.c: drivers/powerp-bin.c: do not warn about - nonliteral format string in this case - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: do not warn about - nonliteral format string in this case - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: do not warn about - nonliteral format string in these cases - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: rename scope-local - 'val' variables that shadow another from same routine - * drivers/belkinunv.c: drivers/belkinunv.c: do not warn about - nonliteral format string in this case - * drivers/bcmxcp.c: drivers/bcmxcp.c: do not warn about nonliteral - format string in this case - * drivers/serial.c: drivers/serial.c: various routines: do not warn - about nonliteral format string in these cases - * clients/upsset.c: clients/drivers: error_page(): do not warn about - nonliteral format string in this case - * clients/upsmon.c: clients/drivers: do_notify(): do not warn about - nonliteral format string in this case - * clients/upsimage.c: clients/drivers: drawbar() noimage(): do not - warn about nonliteral format string in this case - * clients/upsclient.c: clients/upsclient.c: build_cmd(): do not warn - about nonliteral format string in this case - * clients/upsclient.c: clients/upsclient.c: upscli_strerror(): do not - warn about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * clients/nutclient.h: clients/nutclient.h: declare strarr routines - to be seen - -2020-11-25 Jim Klimov - - * tools/nut-scanner/nutscan-display.c: tools/nut-scanner/nutscan- - display.c: declare nutscan_device_type_string[] file-local variable - as static, and fix its indentation - -2020-11-23 Jim Klimov - - * drivers/snmp-ups.c, drivers/snmp-ups.h: drivers/snmp-ups*.{c,h}: - export *_info vars to avoid not-used allegations - * drivers/apcupsd-ups.h: drivers/apcupsd-ups.h: comment away - status_info[] as currently un-used - * drivers/riello.c, drivers/riello.h, drivers/riello_ser.c, - drivers/riello_usb.c: drivers/riello*.{c,h}: properly export - variables shared between driver subtypes - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: comment away - ipmi_config as currently un-used - * drivers/mge-xml.c, drivers/netxml-ups.c, drivers/netxml-ups.h: - drivers/netxml/mge-xml*.{c,h}: export shutdown_duration more - usefully - * drivers/riello.h, drivers/riello_ser.c, drivers/riello_usb.c: - drivers/riello*.{c,h}: export get_ups_statuscode() to avoid not- - used allegations - * drivers/libshut.c: drivers/libshut.c: fix pre-declaration of - LIBshut_set_report() - * drivers/al175.c: drivers/al175.c: declare ACT methods to keep - compiler happy even if some are not currently used - * drivers/bcmxcp.c: drivers/bcmxcp.c: comment away FreqTol as - currently un-used - * tools/nut-scanner/nutscan-display.c: tools/nut-scanner/nutscan- - display.c: use nut-scan.h header - * tools/nut-scanner/nutscan-init.c: tools/nut-scanner/nutscan-init.h: - use its own header - -2020-11-22 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: expose load_library() routine - -2020-11-23 Jim Klimov - - * server/netcmds.h: server/netcmds.h: declare function(non-void!) - prototype explicitly - -2020-11-22 Jim Klimov - - * server/netcmds.h: server/netcmds.h: declare function(void) - prototype explicitly - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - expose load_library() routine - * clients/upslog.h: clients/upslog.h: declare function(non-void*) - prototype explicitly - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: declare multiple file-local routines - as static - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - expose load_library() routine - * tools/nut-scanner/scan_usb.c: tools/nut-scanner/scan_usb.c: expose - load_library() routine - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: - declare a file-local routine as static - * tools/nut-scanner/scan_nut.c: tools/nut-scanner/scan_nut.c: expose - load_library() routine - * tools/nut-scanner/scan_ipmi.c: tools/nut-scanner/scan_ipmi.c: - expose load_library() routine - * drivers/nut-ipmi.h: drivers/nut-ipmi.h: declare function(void) - prototype explicitly - * drivers/apcsmart.c: drivers/apcsmart.c: declare multiple file-local - routines as static - * drivers/powercom.c: drivers/powercom.c: declare multiple file-local - variables as static - * drivers/oneac.c: drivers/oneac.c: declare multiple file-local - routines as static - * drivers/libshut.c: drivers/libshut.c: declare multiple file-local - routines as static - * drivers/microdowell.c: drivers/microdowell.c: rectify whitespaces - (indentations and blank lines) - * drivers/microdowell.c: drivers/microdowell.c: declare multiple - file-local routines as static - * drivers/microdowell.c: drivers/microdowell.c: declare a driver- - local variable as static - * drivers/metasys.c: drivers/metasys.c: declare multiple file-local - routines as static - * drivers/isbmex.c: drivers/isbmex.c: declare multiple file-local - routines as static - * drivers/gamatronic.c: drivers/gamatronic.c: do not mark common - routine as static - * drivers/gamatronic.c: drivers/gamatronic.c: declare multiple file- - local routines as static - * drivers/bestfortress.c: drivers/bestfortress.c: declare a file- - local routine as static - * drivers/bestfcom.c: drivers/bestfcom.c: declare multiple file-local - routines as static - * drivers/bestfcom.c: drivers/bestfcom.c: declare a driver-local - variable as static - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: declare a file-local - routine as static - * drivers/al175.c: drivers/al175.c: declare multiple file-local - routines as static - * server/conf.c: server/conf.c: declare a file-local variable as - static - * server/user.c: server/user.c: declare multiple file-local variables - as static, and fix their indentation - * server/upsd.c: server/upsd.c: declare multiple file-local routines - as static - * server/upsd.c: server/upsd.c: declare multiple file-local variables - as static, and fix their indentation - * server/netcmds.h: server/netcmds.h: declare a file-local variable - as static - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: declare a file-local variable as static - * tools/nut-scanner/nut-scan.h: tools/nut-scanner/nut-scan.h: declare - function(void) prototype explicitly - * tools/nut-scanner/nutscan-device.h: tools/nut-scanner/nutscan- - device.h: declare function(void) prototype explicitly - * tools/nut-scanner/scan_snmp.c: tools/nut-scanner/scan_snmp.c: - declare multiple file-local variables as static - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - declare a file-local routine as static - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - declare multiple file-local variables as static - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: declare - function(void) prototype explicitly - * drivers/nut-libfreeipmi.c: drivers/nut-libfreeipmi.c: declare - multiple file-local variables as static - * drivers/nut-ipmipsu.c: drivers/nut-ipmipsu.c: declare multiple - file-local variables as static - * drivers/powerman-pdu.c: drivers/powerman-pdu.c: declare multiple - file-local variables as static - * drivers/netxml-ups.c: drivers/netxml-ups.c: declare a driver-local - variable as static - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: declare multiple file- - local variables as static - * drivers/apc-hid.c: drivers/apc-hid.c: declare multiple file-local - variables as static - * drivers/emerson-avocent-pdu-mib.c: drivers/emerson-avocent-pdu- - mib.c: declare multiple file-local variables as static - * drivers/masterguard.c: drivers/masterguard.c: declare multiple - file-local variables as static - * drivers/Makefile.am, drivers/bcmxcp_ser.c, drivers/bcmxcp_ser.h, - tools/nut-scanner/scan_eaton_serial.c: Introduce bcmxcp_ser.h to - provide as extern some variables from the driver also used in nut- - scanner - * drivers/raritan-px2-mib.c: drivers/raritan-px2-mib.c: declare a - driver-local variable as static - * drivers/snmp-ups.h: clients/snmp-ups.h: declare some setter/getter - routines to be seen - * drivers/snmp-ups.h: drivers/snmp-ups.h: declare function(void) - prototype explicitly - * drivers/snmp-ups.c: drivers/snmp-ups.c: declare multiple file-local - routines as static - * drivers/snmp-ups.c: drivers/snmp-ups.c: declare multiple file-local - variables as static - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: declare - multiple file-local variables as static - * drivers/riello_usb.c: drivers/riello_usb.c: declare multiple file- - local routines as static - * drivers/riello_usb.c: drivers/riello_usb.c: declare multiple file- - local variables as static - * drivers/riello_ser.c: drivers/riello_ser.c: declare multiple file- - local routines as static - * drivers/riello_ser.c: drivers/riello_ser.c: declare multiple file- - local variables as static - * drivers/riello.h: drivers/riello.h: declare function(void) - prototype explicitly - * drivers/riello.c: drivers/riello.c: declare multiple file-local - variables as static - * drivers/apcupsd-ups.h: drivers/apcupsd-ups.h: declare a driver- - local variable as static - * drivers/apcsmart-old.h: drivers/apcsmart-old.h: declare multiple - file-local variables as static - * drivers/victronups.c: drivers/victronups.c: declare multiple file- - local variables as static - * drivers/mge-hid.c: drivers/mge-hid.c: declare multiple file-local - variables as static - * drivers/mge-hid.c: drivers/mge-hid.c: end all info_lkp_t arrays - with sentinel entries - * drivers/apc-hid.h, drivers/libhid.h: Move "extern int - max_report_size;" declaration from drivers/apc-hid.h to more - suitable drivers/libhid.h - * drivers/mge-utalk.c: drivers/mge-utalk.c: declare a driver-local - variable as static - * drivers/mge-utalk.h: drivers/mge-utalk.h: declare a driver-local - variable as static - * drivers/metasys.c: drivers/metasys.c: declare multiple file-local - variables as static - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: declare multiple - file-local routines as static - -2020-11-20 Jim Klimov - - * drivers/genericups.h: drivers/genericups.h: declare a driver-local - variable as static - * drivers/gamatronic.h: drivers/gamatronic.h: declare multiple file- - local variables as static - * drivers/bestuferrups.c: drivers/bestuferrups.c: declare a driver- - local variable as static - * drivers/dummy-ups.c: drivers/dummy-ups.c: declare multiple file- - local variables as static - * drivers/dummy-ups.h: drivers/dummy-ups.h: declare a driver-local - variable as static - * drivers/bestuferrups.c: drivers/bestuferrups.c: declare a file- - local variable as static - * drivers/bestfortress.c: drivers/bestfortress.c: declare a file- - local variable as static - * drivers/belkinunv.c: drivers/belkinunv.c: declare multiple file- - local variables as static - * drivers/bcmxcp_ser.c: drivers/bcmxcp_ser.c: declare multiple file- - local variables as static - * drivers/bcmxcp.c: drivers/bcmxcp.c: declare multiple file-local - variables as static - * drivers/main.c: drivers/main.c: declare multiple file-local - variables as static, and fix their indentation - * clients/upssched.c: clients/upssched.c: declare multiple file-local - variables as static, and fix their indentation - * clients/upsmon.h: clients/upsmon.h: declare file-local variable as - static: struct notifylist[] - * clients/upsset.c: clients/upsset.c: declare multiple file-local - variables as static, and fix their indentation - * clients/upsimagearg.h: clients/upsimagearg.h: declare file-local - variable as static: struct imgarg[] - * clients/status.h: clients/status.h: declare file-local variable as - static: struct stattab[] - * clients/upslog.h: clients/upslog.h: declare file-local variable as - static: struct logcmds[] - * clients/upsclient.c: clients/upsclient.c: declare file-local - variable as static: struct upscli_errlist[] - -2020-11-17 Jim Klimov - - * drivers/riello_ser.c: drivers/riello_ser.c: riello_serialcomm(): do - not shadow global varname "bufIn" with same-named func argument - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: shut_synchronise(): do not shadow - global varnames "upsfd" (from scan_eaton_serial.c and main.c) with - func argument "upsfd" - -2020-11-25 Jim Klimov - - * clients/nutclient.h, tests/nutclienttest.cpp: - tests/nutclienttest.cpp: add tests on Device, Variable and Command - copying by assignment and by constructor - -2020-11-24 Jim Klimov - - * clients/nutclient.cpp: clients/nutclient.cpp: whitespace fixes - (indentations, blank lines) - * clients/nutclient.h: clients/nutclient.h: whitespace fixes - (indentations) - -2020-11-17 Jim Klimov - - * clients/nutclient.cpp, clients/nutclient.h: nutclient.cpp: match a - copy constructor with a copy assignment operator (Device, Variable, - Command classes) - -2020-11-18 Jim Klimov - - * drivers/tripplite.c: drivers/tripplite.c: upsdrv_initinfo(): use a - literal format string - -2020-11-22 Jim Klimov - - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: fix diags pragmas to use our configured-support macros - for cleaner fencing (nonliteral format strings) - -2020-11-18 Jim Klimov - - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: do not warn about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/nutdrv_qx_voltronic-qs-hex.c: drivers/nutdrv_qx_voltronic- - qs-hex.c: fix diags pragmas to use our configured-support macros - for cleaner fencing (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/nutdrv_qx_voltronic-qs-hex.c: drivers/nutdrv_qx_voltronic- - qs-hex.c: various routines: do not warn about nonliteral format - string in these cases - -2020-11-22 Jim Klimov - - * drivers/nutdrv_qx_voltronic-qs.c: drivers/nutdrv_qx_voltronic-qs.c: - fix diags pragmas to use our configured-support macros for cleaner - fencing (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/nutdrv_qx_voltronic-qs.c: drivers/nutdrv_qx_voltronic-qs.c: - do not warn about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/nutdrv_qx_mecer.c: drivers/nutdrv_qx_mecer.c: fix diags - pragmas to use our configured-support macros for cleaner fencing - (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/nutdrv_qx_mecer.c: drivers/nutdrv_qx_mecer.c: various - routines: do not warn about nonliteral format string in these cases - -2020-11-22 Jim Klimov - - * drivers/nutdrv_qx_blazer-common.c: drivers/nutdrv_qx_blazer- - common.c: fix diags pragmas to use our configured-support macros - for cleaner fencing (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/nutdrv_qx_blazer-common.c: drivers/nutdrv_qx_blazer- - common.c: various routines: do not warn about nonliteral format - string in these cases - -2020-11-22 Jim Klimov - - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: fix diags - pragmas to use our configured-support macros for cleaner fencing - (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/nutdrv_qx_bestups.c: drivers/nutdrv_qx_bestups.c: various - routines: do not warn about nonliteral format string in these cases - -2020-11-22 Jim Klimov - - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: fix diags pragmas to - use our configured-support macros for cleaner fencing (nonliteral - format strings) - -2020-11-18 Jim Klimov - - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: do not warn about - nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/blazer.c: drivers/blazer.c: fix diags pragmas to use our - configured-support macros for cleaner fencing (nonliteral format - strings) - -2020-11-18 Jim Klimov - - * drivers/blazer.c: drivers/blazer.c: various routines: do not warn - about nonliteral format string in these cases - -2020-11-22 Jim Klimov - - * drivers/powerp-txt.c: drivers/powerp-txt.c: fix diags pragmas to - use our configured-support macros for cleaner fencing (nonliteral - format strings) - -2020-11-18 Jim Klimov - - * drivers/powerp-txt.c: drivers/powerp-txt.c: do not warn about - nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/mge-utalk.c: drivers/mge-utalk.c: fix diags pragmas to use - our configured-support macros for cleaner fencing (nonliteral - format strings) - -2020-11-18 Jim Klimov - - * drivers/mge-utalk.c: drivers/mge-utalk.c: various routines: do not - warn about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: fix diags pragmas - to use our configured-support macros for cleaner fencing - (nonliteral format strings) - -2020-11-18 Jim Klimov - - * drivers/bestfortress.c: drivers/bestfortress.c: setinfo_float(): - comment about a casting problem, and do not warn about nonliteral - format string in this case - * drivers/bestfortress.c: drivers/bestfortress.c: do not warn about - nonliteral format string in this case - -2020-11-22 Jim Klimov - - * drivers/serial.c: drivers/serial.c: fix diags pragmas to use our - configured-support macros for cleaner fencing (nonliteral format - strings) - -2020-11-18 Jim Klimov - - * drivers/serial.c: drivers/serial.c: do not warn about nonliteral - format string in this case - -2020-11-22 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: fix diags pragmas to use our - configured-support macros for cleaner fencing (nonliteral format - strings) - -2020-11-18 Jim Klimov - - * drivers/dstate.c: drivers/dstate.c: various routines: do not warn - about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * clients/upssched.c: clients/upssched.c: fix diags pragmas to use - our configured-support macros for cleaner fencing (nonliteral - format strings) - -2020-11-18 Jim Klimov - - * clients/upssched.c: clients/upssched.c: send_to_one(): do not warn - about nonliteral format string in this case - -2020-11-22 Jim Klimov - - * common/common.c: common/common.c: fix diags pragmas to use our - configured-support macros for cleaner fencing (nonliteral format - strings) - -2020-11-20 Jim Klimov - - * common/common.c: common/common.c: various routines: do not warn - about nonliteral format string in these cases - -2020-11-17 Jim Klimov - - * common/common.c: common/common.c: snprintfcat(): do not warn about - nonliteral format string in this case - -2020-11-24 Jim Klimov - - * .travis.yml: .travis.yml: run gnu17-clang-8-nowarn-ARM-64bit case - in fightwarn branches - * .travis.yml: .travis.yml: annotate clearer the different - allowed_failure OS build sections - * .travis.yml: .travis.yml: point all GCC -std=*++99 to *-98 I - thought it was an older GCC quirk, but even new ones complain: - g++: error: unrecognized command-line option '-std=gnu++99'; did - you mean '-std=gnu++98'? g++ (FreeBSD Ports Collection) 10.0.0 - 20191222 (experimental) Copyright (C) 2019 Free Software - Foundation, Inc. This is free software; see the source for copying - conditions. There is NO warranty; not even for MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. - -2020-11-23 Jim Klimov - - * .travis.yml: .travis.yml: mark gnuXX-gcc-*-arm64 test cases as - evergreen - * .travis.yml: .travis.yml: separate ARM64 test case matrices into - ..._viable and ..._fatal subsets - * .travis.yml: .travis.yml: introduce - NUT_MATRIX_TAG="gnu17-gcc-9-nowarn-ARM-64bit" test case - * .travis.yml: .travis.yml: drop gcc-multilib in ARM builds, seems - missing in Debian - * .travis.yml: .travis.yml: drop arm-32bit builds, seems a no-go on - Travis quickly - * .travis.yml: Issue #823 follow-up: add ARM 32-bit and 64-bit builds - in Travis CI - -2020-11-22 Jim Klimov - - * drivers/gamatronic.c: drivers/gamatronic.c: rectify whitespaces - (indentations and blank lines) - -2020-11-20 Jim Klimov - - * drivers/gamatronic.c: drivers/gamatronic.c: fix indentation and - scope whitespace - * drivers/gamatronic.c: drivers/gamatronic.c: fix trailing whitespace - * common/common.c: common/common.c: cleaner macro processing for - BUILD_64 - -2020-11-22 Jim Klimov - - * include/timehead.h: include/timehead.h: satisfy pedantic macro - parser (defined vs. used value) - -2020-11-23 Jim Klimov - - * m4/nut_report_feature.m4: m4/nut_report_feature.m4: report the - compiler tools and flags ultimately applied to this build - * .gitignore: GitIgnore configure-test.docbuild* dirs - * .travis.yml: .travis.yml: separate the matrix for - _matrix_freebsd_gnustd_warn_viable and ..._fatal cases - * .travis.yml: .travis.yml: mark "gnuXX-gcc-freebsd-warn" cases as - evergreen to keep that way - * .travis.yml: .travis.yml: on freebsd, `pkg install libgd` - explicitly (needs sudo) - * .travis.yml: .travis.yml: introduce freebsd test cases with - warnings (typo fix) - -2020-11-22 Jim Klimov - - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: alarm if bogus tests did - not fail - * m4/ax_c_pragmas.m4: m4/ax_c_pragmas.m4: adapt to gcc vs clang CLI - capabilities - * configure.ac, m4/nut_compiler_family.m4: Introduce - m4/nut_compiler_family.m4 detection - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: fix diags pragmas - to use our configured-support macros for cleaner fencing - (unreachable code) - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: fix diags - pragmas to use our configured-support macros for cleaner fencing - (unreachable code) - * drivers/libusb.c: drivers/libusb.c: fix diags pragmas to use our - configured-support macros for cleaner fencing (unreachable code) - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: fix diags pragmas - to use our configured-support macros for cleaner fencing - (unreachable code) - * configure.ac, m4/ax_c_pragmas.m4: Introduce m4/ax_c_pragmas.m4 - * .travis.yml: .travis.yml: curiously, gcc-7 in Travis does not alias - -std=gnu++99 to canonic gnu++98 - * autogen.sh: autogen.sh: do not hide the progress of autoreconf - * ci_build.sh: ci_build.sh: fix whitespace - * ci_build.sh: ci_build.sh: parameterize $CONFIGURE_SCRIPT as it may - be called differently on some platforms - * .travis.yml: .travis.yml: amend cygwin bin files ACLs to let them - execute Thanks https://stackoverflow.com/a/4493653/4715872 for the - hint - * .travis.yml: .travis.yml: use choco bins in PATH also with - /cygdrive/ prefix just in case - * .travis.yml: .travis.yml: use cygwin bins in PATH also with - /cygdrive/ prefix just in case - * .travis.yml: .travis.yml: allow to skip cygwin autotools install if - it was done earlier and cached - -2020-11-21 Jim Klimov - - * .travis.yml: .travis.yml: use cygwin bins as last resort (e.g. for - autoconf) - * .travis.yml: Revert ".travis.yml: run Windows test cases with - cygwin bash" This reverts commit - 4592860aa82a208969eb1ae3ac2ec1f96e77bc07. - -2020-11-19 Jim Klimov - - * .travis.yml: .travis.yml: for windows builds, add - /C/tools/cygwin/bin to PATH - * .travis.yml: .travis.yml: define a NUT_MATRIX_TAG="gnu99-clang-win- - warn" test case for completeness - -2020-11-22 Jim Klimov - - * .travis.yml: .travis.yml: add _matrix_freebsd_gnustd_warn to - _matrix_freebsd - * .travis.yml: .travis.yml: introduce freebsd test cases with nowarn - and gnu17 - * .travis.yml: .travis.yml: introduce freebsd test cases with - warnings - * .travis.yml: .travis.yml: mark "gnu99-gcc-freebsd-nowarn" and - "gnu99-clang-freebsd-nowarn" as required - * ci_build.sh: ci_build.sh: as of now, skip building cgi (needs - libgd) on freebsd too, for "default-all-errors" test cases - * .travis.yml: .travis.yml: define simple freebsd scenarios - -2020-11-20 Jim Klimov - - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: do not warn - about unreachable code where we handle a legacy off-chance that - fatalx() might not exit the program - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: do not warn about - unreachable code where we handle a legacy off-chance that fatalx() - might not exit the program - * drivers/libusb.c: drivers/libusb.c: do not warn about unreachable - code where we handle a legacy off-chance that fatalx() might not - exit the program - * server/upsd.c: server/upsd.c: a move "help" switch() handling to - default case - * server/upsd.c: server/upsd.c: a switch() default needs no break - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: a switch() default needs - no break - * drivers/riello_usb.c: drivers/riello_usb.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * drivers/blazer_usb.c: drivers/blazer_usb.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: wrap unreachable - exit() added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: control_outlet(): - do not warn about syntactic "break;" after returns in conditionals - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: wrap unreachable exit() - added due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * drivers/metasys.c: drivers/metasys.c: a switch() default needs no - break, especially not after fatalx() - * drivers/dummy-ups.c: drivers/dummy-ups.c: a switch() default needs - no break, especially not after fatalx() - * .gitignore: GitIgnore temporary dirs made by configure script - (remain around if it is aborted) - * clients/upsmon.c: clients/upsmon.c: wrap unreachable exit() added - due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * clients/upsmon.c: clients/upsmon.c: wrap unreachable switch()-break - after help() with "ifndef HAVE___ATTRIBUTE__NORETURN" to avoid - warnings - * clients/upslog.c: clients/upslog.c: wrap unreachable switch()-break - after help() with "ifndef HAVE___ATTRIBUTE__NORETURN" to avoid - warnings - * clients/upscmd.c: clients/upscmd.c: wrap unreachable exit() added - due to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * clients/upsc.c: clients/upsc.c: wrap unreachable exit() added due - to earlier compiler warnings with "ifndef - HAVE___ATTRIBUTE__NORETURN" to avoid opposite warnings now - * server/upsd.c: server/upsd.c: wrap unreachable exit() added due to - earlier compiler warnings with "ifndef HAVE___ATTRIBUTE__NORETURN" - to avoid opposite warnings now - * include/attribute.h: include/attribute.h: align with - AX_C___ATTRIBUTE__ autoconf macro - * m4/ax_c___attribute__.m4: m4/ax_c___attribute__.m4: extend to - declare support for certain __attribute__((...)) use-cases of - interest to NUT - * configure.ac, m4/ax_c___attribute__.m4: configure.ac: introduce - AX_C___ATTRIBUTE__ from gnu.org - * server/upsd.c: server/upsd.c: annotate help() with noreturn attr - -2020-11-17 Jim Klimov - - * server/upsd.c: server/upsd.c: help(): do not shadow global varnames - "progname" (from upsd.c and main.c) with func argument "progname" - -2020-11-20 Jim Klimov - - * drivers/nut-ipmipsu.c: drivers/nut-ipmipsu.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: annotate - nutusb_open_error() with noreturn attr - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: fix indenting - whitespace - * drivers/riello_ser.c: drivers/riello_ser.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/blazer.c: drivers/blazer.c: annotate upsdrv_shutdown() with - noreturn attr - * drivers/dummy-ups.c: drivers/dummy-ups.c: annotate - upsdrv_shutdown() with noreturn attr - * clients/upsmon.c: clients/upsmon.c: annotate several routines with - noreturn attrs - * clients/upsmon.c: clients/upsmon.c: help(): do not shadow global - varname "progname" with same-named func argument - * clients/upsset.c: clients/upsset.c: annotate several routines with - noreturn attrs - * clients/upsimage.c: clients/upsimage.c: annotate drawimage() with - noreturn attr - * clients/upslog.c: clients/upslog.c: annotate help() with noreturn - attr - -2020-11-17 Jim Klimov - - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: annotate help() with - noreturn attr - * drivers/macosx-ups.c: drivers/macosx-ups.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: annotate - upsdrv_shutdown() with noreturn attr - * drivers/ivtscd.c: drivers/ivtscd.c: annotate upsdrv_shutdown() with - noreturn attr - * drivers/clone.c: drivers/clone.c: annotate upsdrv_shutdown() with - noreturn attr - * drivers/skel.c: drivers/skel.c: annotate upsdrv_shutdown() with - noreturn attr - * drivers/liebert.c: drivers/liebert.c: annotate upsdrv_shutdown() - with noreturn attr - * drivers/serial.c: drivers/serial.c: annotate ser_open_error() with - noreturn attr - * drivers/dstate.c: drivers/dstate.c: annotate sock_fail() with - noreturn attr - * drivers/main.c: drivers/main.c: annotate forceshutdown() with - noreturn attr - * common/parseconf.c: common/parseconf.c: annotate pconf_fatal() with - noreturn attr - -2020-11-18 Jim Klimov - - * .travis.yml: .travis.yml: fix typo in recent fix for clang warnings - -2020-11-18 Jim Klimov - - * scripts/Solaris/precheck.py: scripts/Solaris/precheck.py: modernize - calling sub-processes for Python 2.6+ and 3+ (keep original way for - older systems compat) - -2020-11-17 Jim Klimov - - * scripts/augeas/gen-nutupsconf-aug.py: scripts/augeas/gen- - nutupsconf-aug.py: drop unused variables Originally PR meant to - drop "global" modifier outside a local function context, but found - that nothing defines or uses these three names. Must be some - leftover from planned but unfinished development. Re-ran - ./autogen.sh and it generates the same file for the build. - -2020-11-18 Jim Klimov - - * drivers/dstate.h: drivers/dstate.h: dstate_setaux(): fix missed - type change for "aux" - * drivers/dstate.c: drivers/dstate.c: dstate_setaux(): fix missed - type change for "aux" - * .gitignore: GitIgnore NetBeans project directory - -2020-11-16 Jim Klimov - - * .gitignore: GitIgnore .gdb_history files - * .gitignore: GitIgnore conf??????/ temporary directories that can - remain if configure script is aborted - * .gitignore: GitIgnore conf_nut_report_feature file (made by - m4/nut_report) - -2020-11-17 Jim Klimov - - * drivers/powerman-pdu.c: drivers/powerman-pdu.c: query_one() - query_all(): do not shadow global varname "pm" with same-named func - argument - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: - subdriver_match_func(): do not shadow global varname "hd" with func - argument "hd" - * drivers/mge-xml.c: drivers/mge-xml.c: numerous routines: do not - shadow global varname "val" (for XML element temp store?) with - same-named func argument - * drivers/netxml-ups.c: drivers/netxml-ups.c: send_http_request(): do - not shadow global varnames "session" and "uri" with func arguments - * drivers/upscode2.c: upscode2.c: upsc_setstatus(): do not shadow - global varname "status" with func argument "status" - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: callback(): do not - shadow global varname "udev" with func argument "udev" - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: callback(): do not - shadow global varname "hd" with func argument "hd" - * drivers/riello.c: drivers/riello.c: riello_calc_CRC(): change data - type to fix comparisons - * drivers/powercom.c: drivers/powercom.c: output_voltage(): avoid a - multiplication overflow by casting - * server/upsd.c: upsd.c: actually include signal.h from system - * common/common.c: common/common.c: upsdebug_hex() / - upsdebug_ascii(): fix const-ness of buf casting - * common/common.c: common/common.c: get_libname(): fix type to - receive strlen() - * common/state.c, drivers/dstate.c, include/state.h, server/netget.c: - state.c dstate.c etc.: fix st_tree_t->aux to "long" as we convert - via strtol() - * common/parseconf.c: common/parseconf.c: addchar(): signedness-aware - trim of ctx->ch range - * common/common.c: common/common.c: mark search_paths[] as a static - array - * common/common.c: common/common.c: snprintfcat(): sort out the messy - return types - * common/common.c: common/common.c: sendsignalfn(): fix pid to "long" - as we convert via strtol() - * common/common.c: common/common.c: writepid(): fix data type for - umask() - * common/parseconf.c: parseconf.c: add_arg_word(): fix argpos to - size_t, we do not expect negative offsets - * clients/upsclient.c, clients/upsclient.h, common/common.c, - drivers/apcsmart.c, drivers/serial.c, drivers/serial.h, - include/common.h: common, serial, upsclient: change read() and - write() operations from "int" to "ssize_t" - * include/attribute.h: include/attribute.h: satisfy pedantic macro - parser (defined vs. used value) - * drivers/powercom.c: drivers/powercom.c: do not check "if model >= - 2000" just after processing "model < 2000" - * drivers/pijuice.c: drivers/pijuice.c: do not check for - "powerInput5vIo <= POWER_PRESENT" twice in a row - * drivers/bcmxcp.c: drivers/bcmxcp.c: do not check for "value>=0" - when we pick it from "unsigned char[]" answer - * common/common.c: common/common.c: search_paths[]: comment the - reasoning (see also issue NUT #805) - * drivers/apcupsd-ups.c: drivers/apcupsd-ups.c: comment about htons() - return value range (why I did not fix an "x<0" check) - * .travis.yml: .travis.yml: run Windows test cases with cygwin bash - * .travis.yml: .travis.yml: add at least a cygwin automake to Windows - test cases - * .travis.yml: .travis.yml: limit builds on xcode7.x to C11 - * include/parseconf.h: include/parseconf.h: fix trailing whitespace - * .travis.yml: .travis.yml: mark clang builds with fatal warnings, - additionally with -Wno-reserved-id-macro -Wno-padded to play around - system header issues - -2020-11-16 Jim Klimov - - * configure.ac: configure.ac: rephrase the notice about looking for - required C library routines which are beyond strict C standards - -2020-11-10 Jim Klimov - - * configure.ac: configure.ac: make checks for "Required C library - routine" not fatal: -Wall -Werror frowns upon the ways autotools - probe the system - * configure.ac: configure.ac: detect routines that may be not - available in constrained standard-C modes - -2020-11-16 Jim Klimov - - * configure.ac, m4/nut_stash_warnings.m4: Introduce - m4/nut_stash_warnings.m4 and NUT_STASH_WARNINGS and - NUT_POP_WARNINGS in configure.ac - -2020-11-17 Jim Klimov - - * drivers/solis.c: drivers/solis.c: convert from localtime() to - localtime_r() which is thread-safe - * drivers/rhino.c: drivers/rhino.c: convert from localtime() to - localtime_r() which is thread-safe - * drivers/microdowell.c: drivers/microdowell.c: convert from - localtime() to localtime_r() which is thread-safe - * drivers/mge-hid.c: drivers/mge-hid.c: convert from localtime() to - localtime_r() which is thread-safe - * clients/upsstats.c: clients/upsstats.c: convert from localtime() to - localtime_r() which is thread-safe - * clients/upslog.c: clients/upslog.c: convert from localtime() to - localtime_r() which is thread-safe - -2020-11-16 Jim Klimov - - * ci_build.sh: ci_build.sh: build_to_only_catch_errors(): also report - on `make check` with the current test case - * .travis.yml: Revert ".travis.yml: DISABLE test case - "gnu99-clang-5.0-nowarn": it has some problem with the recently - changed "tests/" (and runs clang-7 anyway as it does not use the - PPA for 5.0)" This reverts commit - 4749e0b26a33990dbd7bb56ff863cfc30db4245e as we can now have this - test case working again. - * configure.ac: configure.ac: do not pick C++11 support if a standard - is explicitly requested by caller; fixes NUT issue #873 - * .travis.yml: .travis.yml: fix test cases for - NUT_MATRIX_TAG="*-clang-5.0-*" to actually use clang-5.0 explicitly - -2020-11-15 Jim Klimov - - * .travis.yml: .travis.yml: mark test-case "gnu17-gcc-9-warn" as - passing now - * .travis.yml: .travis.yml: add libnss3-dev and libssl-dev to test - against both SSL implems - * .travis.yml: .travis.yml: DISABLE test case - "gnu99-clang-5.0-nowarn": it has some problem with the recently - changed "tests/" (and runs clang-7 anyway as it does not use the - PPA for 5.0) - * drivers/snmp-ups.c, m4/nut_check_libnetsnmp.m4: drivers/snmp-ups.c: - fix the warning about how we get the size of usmAES128PrivProtocol - * ci_build.sh: ci_build.sh: configure_nut(): sleep more before data - dump so interactive devs can react to the broken configure run - * ci_build.sh: ci_build.sh: build_to_only_catch_errors(): report a - SUCCESS when we have one - * ci_build.sh: ci_build.sh: allow caller to customize their - PKG_CONFIG_PATH - * tests/Makefile.am: tests/Makefile.am: fix include dir for - cppunittest - * server/netssl.c: server/netssl.c: comment about non-fatal build - warnings from NSS include names we use - * server/netssl.c: server/netssl.c: mark up NUT_UNUSED_VARIABLEs for - build with Mozilla NSS - * clients/upsclient.c: clients/upsclient.c: mark up - NUT_UNUSED_VARIABLEs for build with Mozilla NSS - * m4/nut_check_libnss.m4: nut_check_libnss.m4 : warn that nss.pc is - more sensitive to matching PKG_CONFIG_PATH and build bitness than - others - * ci_build.sh: ci_build.sh : enable SSL build variants of "default- - all-errors" with both OpenSS and Mozilla NSS - * m4/nut_check_libnetsnmp.m4: m4/nut_check_libnetsnmp.m4: pick - correct bitness net-snmp-config-{32,64} script if available - -2020-11-14 Jim Klimov - - * tests/Makefile.am: tests/Makefile.am: fix include dir for - nutlogtest - -2020-11-10 Jim Klimov - - * .travis.yml: .travis.yml (#823) : green-light several GCC test - cases that now pass even with all warnings enabled as fatal - * clients/upsset.c: clients/upsset.c: refine whitespace - -2020-11-09 Jim Klimov - - * drivers/rhino.c: drivers/rhino.c: drop extraneous parentheses - * drivers/nutdrv_qx.h: drivers/nutdrv_qx.h: avoid a trailing comma in - enum list (C89) - -2020-11-12 Jim Klimov - - * docs/nut.dict: nut.dict: spellcheck new keywords around "fightwarn" - chapter - -2020-11-10 Jim Klimov - - * docs/developers.txt: docs/developers.txt: detail how to use - ci_build.sh intended for Travis CI to work on fixing stuff locally - -2020-11-13 Jim Klimov - - * tests/cpputest.cpp: tests/cpputest.cpp : wrap the test run to catch - exceptions, if any - * tests/cpputest.cpp: tests/cpputest.cpp : comment the progress - through steps - * tests/cpputest.cpp: tests/cpputest.cpp: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * tests/Makefile.am: tests/Makefile.am : comment the cases where we - do not compile CXX tests - * tests/Makefile.am, tests/nutlogtest.c: Introduce tests/nutlogtest.c - for upslog*() and friends - -2020-11-12 Jean-Baptiste Boric - - * drivers/main.c: Fix faulty dump mode logic - -2020-11-12 Jim Klimov - - * docs/nut.dict: Update nut.dict - -2020-11-10 Jim Klimov - - * configure.ac: configure.ac : detect abs() and fabs() funcs - -2020-11-12 Jim Klimov - - * docs/acknowledgements.txt: Update acknowledgements.txt Do not - constrain contribution from EVER Power Systems to one person - -2020-11-11 Jim Klimov - - * docs/developers.txt: docs/developers.txt: document - NUT_UNUSED_VARIABLE() - -2020-11-10 Jim Klimov - - * include/common.h: include/common.h : drop NUT_UNUSED and - NUT_UNUSED_FUNCTION macros as not portable enough - * drivers/mge-hid.c: drivers/mge-hid.c: mark up NUT_UNUSED_VARIABLEs - in the more portable manner - * drivers/tripplite-hid.c: drivers/tripplite-hid.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/serial.c: drivers/serial.c: mark up NUT_UNUSED_VARIABLEs in - the more portable manner - * drivers/bestfcom.c: drivers/bestfcom.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/dummy-ups.c: drivers/dummy-ups.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/apcsmart-old.c: drivers/apcsmart-old.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/cps-hid.c: drivers/cps-hid.c: mark up NUT_UNUSED_VARIABLEs - in the more portable manner - * drivers/apcsmart.c: drivers/apcsmart.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/bestfortress.c: drivers/bestfortress.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/blazer_usb.c: drivers/blazer_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/apc-hid.c: drivers/apc-hid.c: mark up NUT_UNUSED_VARIABLEs - in the more portable manner - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: mark - up NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/riello_usb.c: drivers/riello_usb.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/explore-hid.c: drivers/explore-hid.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * server/upsd.c: server/upsd.c: mark up NUT_UNUSED_VARIABLEs in the - more portable manner - * clients/upssched.c: clients/upssched.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * clients/upsset.c: clients/upsset.c: mark up NUT_UNUSED_VARIABLEs in - the more portable manner - * clients/upsimage.c: clients/upsimage.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * clients/upsstats.c: clients/upsstats.c: mark up - NUT_UNUSED_VARIABLEs in the more portable manner - * clients/upslog.c: clients/upslog.c: mark up NUT_UNUSED_VARIABLEs in - the more portable manner - * clients/upsmon.c: clients/upsmon.c: mark up NUT_UNUSED_VARIABLEs in - the more portable manner - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: mark up NUT_UNUSED_VARIABLEs in the - more portable manner - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - mark up NUT_UNUSED_VARIABLEs in the more portable manner - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - mark up NUT_UNUSED_VARIABLEs in the more portable manner - * drivers/libshut.c, drivers/riello_ser.c, drivers/snmp-ups.c, - tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_snmp.c: libshut.c riello_ser.c nut-scanner bits: - abolish non-standard u_char and u_short Probably standard C99 - "uint8_t" and 16(?) bit short would be more proper, especially for - serial-line protocols. But the original code used types derived - from hardware implementation sized "char" and "short" - so they - stayed this way here. - * drivers/riello_usb.c: drivers/riello_usb.c: avoid implicit switch - fall-through - * clients/upsc.c: clients/upsc.c: avoid implicit switch fall-through - * clients/upscmd.c: clients/upscmd.c: avoid implicit switch fall- - through - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: avoid implicit switch - fall-through - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: avoid implicit switch - fall-through - * drivers/blazer_usb.c: drivers/blazer_usb.c: avoid implicit switch - fall-through - * server/upsd.c: server/upsd.c: add blank lines for readability of - opts processing switch - * server/upsd.c: server/upsd.c: avoid implicit switch fall-through - * clients/upsstats.h: clients/upsstats.h: wrap with include-guards - * clients/upssched.h: clients/upssched.h: wrap with include-guards - * clients/upsmon.h: clients/upsmon.h: wrap with include-guards - * clients/upslog.h: clients/upslog.h: wrap with include-guards - * clients/upsimagearg.h: clients/upsimagearg.h: wrap with include- - guards - * clients/status.h: clients/status.h: wrap with include-guards - * clients/cgilib.h: clients/cgilib.h: wrap with include-guards - * drivers/tripplite.h: drivers/tripplite.h: wrap with include-guards - * drivers/safenet.h: drivers/safenet.h: wrap with include-guards - * drivers/riello.h: drivers/riello.h: reword the wrap with include- - guards - * drivers/powercom.h: drivers/powercom.h: wrap with include-guards - * drivers/mge-utalk.h: include/mge-utalk.h: wrap with include-guards - * drivers/oneac.h: drivers/oneac.h: wrap with include-guards - * drivers/main.h: drivers/main.h: reword the wrap with include-guards - * drivers/libusb.h: drivers/libusb.h: reword the wrap with include- - guards - * drivers/libshut.h: drivers/libshut.h: reword the wrap with include- - guards - * drivers/libhid.h: drivers/libhid.h: reword the wrap with include- - guards - * drivers/hidparser.h: drivers/hidparser.h: reword the wrap with - include-guards - * drivers/genericups.h: drivers/genericups.h: wrap with include- - guards - * drivers/gamatronic.h: drivers/gamatronic.h: wrap with include- - guards and fix trailing whitespace - * drivers/dummy-ups.h: drivers/dummy-ups.h: wrap with include-guards - * drivers/apcupsd-ups.h: drivers/apcupsd-ups.h: wrap with include- - guards - * drivers/apcsmart_tabs.h: drivers/apcsmart_tabs.h: reword the wrap - with include-guards - * drivers/apcsmart.h: drivers/apcsmart.h: reword the wrap with - include-guards - * drivers/apcsmart-old.h: drivers/apcsmart-old.h: wrap with include- - guards - * include/upsconf.h: include/upsconf.h: wrap with include-guards - * include/upsconf.h: include/upsconf.h: add (C) and license header - * include/upsconf.h: include/upsconf.h: refine whitespace - * include/timehead.h: include/timehead.h: add (C) and license header - * include/timehead.h: include/timehead.h: wrap with include-guards - * include/str.h: include/str.h: reword the wrap with include-guards - * include/state.h: include/state.h: reword the wrap with include- - guards - * include/proto.h: include/proto.h: add (C) and license header - * include/proto.h: include/proto.h: reword the wrap with include- - guards - * include/nut_stdint.h: include/nut_stdint.h: reword the wrap with - include-guards - * include/nut_platform.h: include/nut_platform.h: reword the wrap - with include-guards - * include/extstate.h: include/extstate.h: add (C) and license header - * include/extstate.h: include/extstate.h: reword the wrap with - include-guards - * include/extstate.h: include/extstate.h: refine whitespace - * include/common.h: include/common.h: reword the wrap with include- - guards - * include/attribute.h: include/attribute.h: add (C) and license - header - * include/attribute.h: include/attribute.h: reword the wrap with - include-guards - * server/user.h: server/user.h: update (C) and license header - * server/user.h: server/user.h: wrap with include-guards - * server/user-data.h: server/user-data.h: update (C) and license - header - * server/user-data.h: server/user-data.h: wrap with include-guards - * server/upstype.h: server/upstype.h: reword the wrap with include- - guards - * server/stype.h: server/stype.h: reword the wrap with include-guards - * server/sstate.h: server/sstate.h: reword the wrap with include- - guards - * server/nut_ctype.h: server/nut_ctype.h: protect header files for - C++ inclusion - * server/netuser.h: server/netuser.h: wrap with include-guards - * server/netuser.h: server/netuser.h: add (C) and license header - * server/netssl.h: server/netssl.h: reword the wrap with include- - guards - * server/netset.h: server/netset.h: wrap with include-guards - * server/netset.h: server/netset.h: add (C) and license header - * server/netmisc.h: server/netmisc.h: wrap with include-guards - * server/netmisc.h: server/netmisc.h: add (C) and license header - * server/netcmds.h: server/netcmds.h: add (C) and license header - * server/netlist.h: server/netlist.h: wrap with include-guards - * server/netlist.h: server/netlist.h: add (C) and license header - * server/netinstcmd.h: server/netinstcmd.h: wrap with include-guards - * server/netinstcmd.h: server/netinstcmd.h: add (C) and license - header - * server/netget.h: server/netget.h: wrap with include-guards - * server/netget.h: server/netget.h: add (C) and license header - * server/neterr.h: server/neterr.h: protect header files for C++ - inclusion - * server/neterr.h: server/neterr.h: wrap with include-guards - * server/neterr.h: server/neterr.h: add (C) and license header - * server/netcmds.h: server/netcmds.h: wrap with include-guards - * server/desc.h: server/desc.h: add (C) and license header - * server/desc.h: server/desc.h: wrap with include-guards - * server/conf.h: server/conf.h: update (C) and license header - * server/conf.h: server/conf.h: wrap with include-guards - -2020-11-09 Jim Klimov - - * docs/nut.dict: Update nut.dict Add EVER Sinline model name - -2020-11-09 Jim Klimov - - * drivers/asem.c: drivers/al175.c: update Linux i2c include mesh - (thanks to pijuice.c) - * drivers/pijuice.c: drivers/pijuice.c: set_power_off(): drop unused - "data" - * drivers/pijuice.c: drivers/pijuice.c: avoid setting "data" during a - write Compiler warnings resolved this puzzle: [2020-11-09 - 15:10:38] [build-err] pijuice.c:737:2: note: in expansion of macro - ‘I2C_WRITE_BYTE’ [2020-11-09 15:10:38] [build-err] 737 | - I2C_WRITE_BYTE( upsfd, cmd, shutdown_delay, __func__ ) [2020-11-09 - 15:10:38] [build-err] | ^~~~~~~~~~~~~~ [2020-11-09 15:10:38] - [build-err] pijuice.c:710:10: warning: variable ‘data’ set but not - used [-Wunused-but-set-variable] [2020-11-09 15:10:38] [build-err] - 710 | uint8_t data; [2020-11-09 15:10:38] [build-err] | - ^~~~ So we did not need to set it at all, can go to simple - anonymous negative-return check. - * drivers/pijuice.c: drivers/pijuice.c: use "__s32" de-facto in - headers instead of "s32" from manpages - * drivers/pijuice.c: drivers/pijuice.c: rearrange I2C_*() macros to - catch -1 error codes while fetching unsigned ints - * drivers/apcsmart.c: drivers/apcsmart.c: fix variadic macro logx() - call to accomodate modern standards - * drivers/apcsmart.c: drivers/apcsmart.c: fix variadic macro logx() - call to accomodate modern standards - * drivers/apcsmart.c: drivers/apcsmart.c: fix variadic macro debx() - call to accomodate modern standards - * drivers/pijuice.c: drivers/pijuice.c: set_poweroff(): fix limited - value range exceeded - * drivers/pijuice.c: drivers/pijuice.c: replace __FUNCTION__ by - __func__ to avoid warnings error: ISO C does not support - '__FUNCTION__' predefined identifier [-Werror=pedantic] - * drivers/bcmxcp.c: drivers/bcmxcp.c: bump string buffer size to - avoid potential overflows If we have some bug getting outlet - numbers into billions (int at 64-bit) the string might overflow - indeed... - * drivers/al175.c: drivers/al175.c: document a warning to address - later - * drivers/snmp-ups.c: drivers/snmp-ups.c: avoid warning: control may - reach end of non-void function - -2020-11-08 Jim Klimov - - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: avoid - implicit switch fall-through - * .travis.yml: .travis.yml: our code (and checks) should not rely on - specific compiler features; implicit switch FALLTHRU was solved by - explicit goto jumps - * docs/nut.dict: docs/nut.dict: update for conf/upsstats- - single.html.sample - * docs/developers.txt: docs/developers.txt: avoid spellcheck warning - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - rearrange phases_nb and sanity-check the value to debug-log - unexpectancies - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - sanity-check the outlet_group_nb (not negative) - -2020-11-05 Jim Klimov - - * drivers/hidparser.c: drivers/hidparser.c: hide logging check that - never fires hidparser.c:347:28: error: comparison is always false - due to limited range of data type [-Werror=type-limits] 347 | - if(pParser->Data.ReportID >= MAX_REPORT) uint8_t vs "500" CC - @aquette - -2020-11-06 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: drop g_usec_timeout which is not actually - used - * drivers/libusb.c: drivers/libusb.c: fix debug string formatting - -2020-11-05 Jim Klimov - - * drivers/solis.h: drivers/solis.h: swap "const static" => "static - const" Avoids error: 'static' is not at beginning of declaration - [-Werror=old-style-declaration] - * drivers/solis.c: drivers/solis.c: rectify C-style comments - * drivers/isbmex.c: drivers/isbmex.c: comment about magic D() macro - got debug logging vs. upsdebugx() - * drivers/rhino.c: drivers/rhino.c: ScanReceivePack(): rephrase if- - clause to avoid warnings Seems this is a correct change logically: - - if( !( SourceFail ) == RedeAnterior ) + if( RedeAnterior == !( - SourceFail ) ) given this assignment just below the if-clause: - RedeAnterior = !( SourceFail ); to avoid a compiler warning that - "!" might apply not in a way intended by author - * drivers/masterguard.c: drivers/masterguard.c: StringSplit(): use - the maxlen - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: setvar(): find a - use for "val" - -2020-11-04 Jim Klimov - - * clients/upssched.c: clients/upssched.c: main(): find use for argc - * clients/upsmon.c: clients/upsmon.c: sigpipe(): find use for sig - * clients/upsset.c: clients/upsset.c: print_rw(): find use for - upsname - -2020-11-08 Jim Klimov - - * drivers/blazer_usb.c: drivers/blazer_usb.c: upsdrv_initups(): - constrain langid_fix scanned values to fit into signed int - -2020-11-06 Jim Klimov - - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: upsdrv_initups(): - constrain langid_fix scanned values to fit into signed int - -2020-11-08 Jim Klimov - - * drivers/netxml-ups.c: drivers/netxml-ups.c: rearrange sscanf() of - inputs to avoid wrong int values - -2020-11-06 Jim Klimov - - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: avoid - buffer overflows iterating item->info_rw, possible NPE, and fix the - check for hitting the sentinel entry Fix warnings like: - nutdrv_qx_voltronic.c:4037:39: error: division 'sizeof (info_rw_t - *) / sizeof (info_rw_t)' does not compute the number of array - elements [-Werror=sizeof-pointer-div] 4037 | if (i >= - (int)(sizeof(item->info_rw) / sizeof(item->info_rw[0]))) { | - ^ nutdrv_qx_voltronic.c: In function 'voltronic_p31g_set': - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: - voltronic_fault(): avoid buffer overflows with sprintf() - -2020-11-04 Jim Klimov - - * clients/upscmd.c: clients/upscmd.c: increase buffers to avoid - overflow (warnings) - * clients/upsrw.c: clients/upsrw.c: increase buffers to avoid - overflow (warnings) - -2020-11-05 Jim Klimov - - * drivers/bestfcom.c: drivers/bestfcom.c: increase buffers to avoid - overflow (warnings) - * drivers/bcmxcp.c: drivers/bcmxcp.c: setvar(): increase buffers to - avoid overflow (warnings) - -2020-11-04 Jim Klimov - - * clients/upssched.c: clients/upssched.c: increase buffers to avoid - overflow (warnings) - -2020-11-06 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: tools/nut- - scanner/scan_xml_http.c: avoid possible buffer overflow - * drivers/snmp-ups.c: drivers/snmp-ups.c: su_alarm_set(): bump - alarm_info_value size to avoid print overflows - -2020-11-08 Jim Klimov - - * drivers/belkin-hid.c: drivers/belkin-hid.c: use fabs() for - floating-point math - * drivers/belkin-hid.c: drivers/belkin-hid.c: use fabs() for - floating-point math - -2020-11-06 Jim Klimov - - * drivers/upscode2.c: drivers/upscode2.c: use fabs() for floating- - point math - -2020-11-08 Jim Klimov - - * drivers/netxml-ups.c: drivers/netxml-ups.c: instcmd(): find a use - for "extra" - * drivers/riello_usb.c: drivers/riello_usb.c: instcmd(): find a use - for "extra" - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: instcmd(): find a - use for "extra" - -2020-11-06 Jim Klimov - - * drivers/riello_ser.c: drivers/riello_ser.c: instcmd(): find a use - for "extra" - * drivers/apcsmart-old.c: drivers/apcsmart-old.c: instcmd(): find a - use for "extra" - * drivers/ivtscd.c: drivers/ivtscd.c: instcmd(): find a use for - "extra" - * drivers/clone.c: drivers/clone.c: instcmd(): find a use for "extra" - * drivers/powerman-pdu.c: drivers/powerman-pdu.c: instcmd(): find a - use for "extra" - * drivers/powerp-txt.c: drivers/powerp-txt.c: powpan_instcmd(): find - a use for "extra" - * drivers/powerp-bin.c: drivers/powerp-bin.c: powpan_instcmd(): find - a use for "extra" - * drivers/victronups.c: drivers/victronups.c: instcmd(): find a use - for "extra" - -2020-11-05 Jim Klimov - - * drivers/tripplitesu.c: drivers/tripplitesu.c: instcmd(): find a use - for "extra" - * drivers/tripplite.c: drivers/tripplite.c: instcmd(): find a use for - "extra" - * drivers/solis.c: drivers/solis.c: instcmd(): find a use for "extra" - * drivers/nutdrv_siemens_sitop.c: drivers/nutdrv_siemens_sitop.c: - instcmd(): find a use for "extra" - * drivers/safenet.c: drivers/safenet.c: instcmd(): find a use for - "extra" - * drivers/rhino.c: drivers/rhino.c: instcmd(): find a use for "extra" - * drivers/powercom.c: drivers/powercom.c: instcmd(): find a use for - "extra" - * drivers/optiups.c: drivers/optiups.c: instcmd(): find a use for - "extra" - * drivers/mge-utalk.c: drivers/mge-utalk.c: instcmd(): find a use for - "extra" - * drivers/metasys.c: drivers/metasys.c: instcmd(): find a use for - "extra" - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: instcmd(): find a - use for "extra" - * drivers/etapro.c: drivers/etapro.c: instcmd(): find a use for - "extra" - * drivers/dummy-ups.c: drivers/dummy-ups.c: instcmd(): find a use for - "extra" - * drivers/bestups.c: drivers/bestups.c: instcmd(): find a use for - "extra" - * drivers/bestfortress.c: drivers/bestfortress.c: instcmd(): find a - use for "extra" - * drivers/belkinunv.c: drivers/belkinunv.c: instcmd(): find a use for - "extra" - * drivers/belkin.c: drivers/belkin.c: instcmd(): find a use for - "extra" - * drivers/bcmxcp.c: drivers/bcmxcp.c: instcmd(): find a use for - "extra" - -2020-11-04 Jim Klimov - - * drivers/al175.c: drivers/al175.c: instcmd(): find use for "extra" - -2020-11-08 Jim Klimov - - * drivers/mge-xml.c: drivers/mge-xml.c: mark up NUT_UNUSED_VARIABLEs - * drivers/netxml-ups.c: drivers/netxml-ups.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/riello_usb.c: drivers/riello_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/blazer_usb.c: drivers/blazer_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/bcmxcp_usb.c: drivers/bcmxcp_usb.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/tripplite-hid.c: drivers/tripplite-hid.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/explore-hid.c: drivers/explore-hid.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/explore-hid.c: drivers/explore-hid.c: a few whitespace - fixes - * drivers/cps-hid.c: drivers/cps-hid.c: mark up NUT_UNUSED_VARIABLEs - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: mark up - NUT_UNUSED_VARIABLEs - -2020-11-06 Jim Klimov - - * drivers/nutdrv_qx_voltronic.c: drivers/nutdrv_qx_voltronic.c: mark - up NUT_UNUSED_VARIABLEs - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/apcsmart-old.c: drivers/apcsmart-old.c: mark up - NUT_UNUSED_VARIABLEs - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - mark up NUT_UNUSED_VARIABLEs - * server/netuser.c: server/netuser.c: mark up NUT_UNUSED_VARIABLEs - * server/netmisc.c: server/netmisc.c: mark up NUT_UNUSED_VARIABLEs - * server/netssl.c: server/netssl.c: mark up NUT_UNUSED_VARIABLEs - * server/upsd.c: server/upsd.c: mark up NUT_UNUSED_VARIABLEs - * drivers/upsdrvctl.c: drivers/upsdrvctl.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/apcsmart.c: drivers/apcsmart.c: mark up - NUT_UNUSED_VARIABLEs - -2020-11-05 Jim Klimov - - * drivers/mge-hid.c: drivers/mge-hid.c: mark up NUT_UNUSED_VARIABLEs - * drivers/libshut.c: drivers/libshut.c: mark up NUT_UNUSED_VARIABLEs - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/dummy-ups.c: drivers/dummy-ups.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/bestfortress.c: drivers/bestfortress.c: mark up - NUT_UNUSED_VARIABLEs - * drivers/bestfcom.c: drivers/bestfcom.c: mark up - NUT_UNUSED_VARIABLEs - -2020-11-06 Jim Klimov - - * tools/nut-scanner/scan_eaton_serial.c: tools/nut- - scanner/scan_eaton_serial.c: mark up NUT_UNUSED_VARIABLEs - * tools/nut-scanner/scan_avahi.c: tools/nut-scanner/scan_avahi.c: - mark up NUT_UNUSED_VARIABLEs - -2020-11-04 Jim Klimov - - * drivers/serial.c: drivers/serial.c: mark up NUT_UNUSED_VARIABLEs - * clients/upssched.c: clients/upssched.c: mark up - NUT_UNUSED_VARIABLEs - * clients/upsmon.c: clients/upsmon.c: mark up NUT_UNUSED_VARIABLEs - * clients/upsset.c: clients/upsset.c: mark up NUT_UNUSED_VARIABLEs - * clients/upsimage.c, clients/upsstats.c: clients/upsimage.c: mark up - NUT_UNUSED_VARIABLEs - * clients/upsstats.c: clients/upsstats.c: mark up - NUT_UNUSED_VARIABLEs - * clients/upslog.c: clients/upslog.c: mark up NUT_UNUSED_VARIABLEs - * clients/upsclient.c: clients/upsclient.c: mark up - NUT_UNUSED_VARIABLEs for ifdef-ed codepaths - -2020-11-08 Jim Klimov - - * drivers/apc-hid.c: drivers/apc-hid.c: mark up NUT_UNUSED_VARIABLEs - (and comment a FIXME about possible use for that) - -2020-11-04 Jim Klimov - - * include/common.h: include/common.h: introduce NUT_UNUSED* macros to - mark up codebase - -2020-11-08 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c: comment about issue found - by pedantic compiler snmp-ups.c: In function 'nut_snmp_init': - snmp-ups.c:599:66: error: division 'sizeof (oid * {aka long - unsigned int *}) / sizeof (oid {aka long unsigned int})' does not - compute the number of array elements [-Werror=sizeof-pointer-div] - 599 | g_snmp_sess.securityPrivProtoLen = - sizeof(usmAESPrivProtocol)/sizeof(oid); | - ^ In file included from /usr/include/net-snmp/snmpv3_api.h:27, from - /usr/include/net-snmp/net-snmp-includes.h:78, from snmp-ups.h:79, - from snmp-ups.c:39: /usr/include/net- - snmp/library/transform_oids.h:50:26: note: first 'sizeof' operand - was declared here 50 | NETSNMP_IMPORT oid - *usmAES128PrivProtocol; /* backwards compat */ | - ^~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors - make[1]: *** [Makefile:1953: snmp_ups-snmp-ups.o] Error 1 - -2020-11-08 Jim Klimov - - * docs/developers.txt: Update developers.txt Another spellcheck fix - * docs/developers.txt: Update developers.txt Avoid "quiesce" to - satisfy the spellchecker - -2020-11-08 Jim Klimov - - * drivers/apc-hid.c: drivers/apc-hid.c: a few whitespace fixes - * drivers/openups-hid.c: drivers/openups-hid.c: initialize all fields - of info_lkp_t arrays - * drivers/tripplite-hid.c: drivers/tripplite-hid.c: initialize all - fields of info_lkp_t arrays - * drivers/powercom-hid.c: drivers/powercom-hid.c: initialize all - fields of info_lkp_t arrays - * drivers/cps-hid.c: drivers/cps-hid.c: initialize all fields of - info_lkp_t arrays - * drivers/belkin-hid.c: drivers/belkin-hid.c: initialize all fields - of info_lkp_t arrays - * drivers/apc-hid.c: drivers/apc-hid.c: initialize all fields of - info_lkp_t arrays - * drivers/apc-pdu-mib.c: drivers/apc-pdu-mib.c: define - APC_PDU_DEVICE_MODEL macro on top of file - * drivers/apc-pdu-mib.c: drivers/apc-pdu-mib.c: initialize all fields - of mib2nut_info_t arrays - * drivers/apc-pdu-mib.c: drivers/apc-pdu-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/apc-ats-mib.c: drivers/apc-ats-mib.c: initialize all fields - of mib2nut_info_t array - * drivers/apc-ats-mib.c: drivers/apc-ats-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/eaton-ats16-mib.c: drivers/eaton-ats16-mib.c: initialize - all fields of mib2nut_info_t arrays - * drivers/eaton-ats16-mib.c: drivers/eaton-ats16-mib.c: initialize - all fields of info_lkp_t arrays - * drivers/huawei-mib.c: drivers/huawei-mib.c: initialize all fields - of mib2nut_info_t array - * drivers/huawei-mib.c: drivers/huawei-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/hpe-pdu-mib.c: drivers/hpe-pdu-mib.c: initialize all fields - of mib2nut_info_t array - * drivers/hpe-pdu-mib.c: drivers/hpe-pdu-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/eaton-ats30-mib.c: drivers/eaton-ats30-mib.c: initialize - all fields of mib2nut_info_t array - * drivers/eaton-ats30-mib.c: drivers/eaton-ats30-mib.c: initialize - all fields of info_lkp_t arrays - * drivers/delta_ups-mib.c: drivers/delta_ups-mib.c: initialize all - fields of mib2nut_info_t array - * drivers/delta_ups-mib.c: drivers/delta_ups-mib.c: initialize all - fields of info_lkp_t arrays - * drivers/cyberpower-mib.c: drivers/cyberpower-mib.c: initialize all - fields of mib2nut_info_t array - * drivers/cyberpower-mib.c: drivers/cyberpower-mib.c: initialize all - fields of info_lkp_t arrays - * drivers/bestpower-mib.c: drivers/bestpower-mib.c: initialize all - fields of mib2nut_info_t array - * drivers/bestpower-mib.c: drivers/bestpower-mib.c: initialize all - fields of info_lkp_t arrays - * drivers/xppc-mib.c: drivers/xppc-mib.c: initialize all fields of - info_lkp_t arrays, and end sentinel entries to close them off - * docs/developers.txt, docs/nut.dict: Satisfy the spellchecker - * drivers/xppc-mib.c: drivers/xppc-mib.c: initialize all fields of - mib2nut_info_t array - * drivers/raritan-pdu-mib.c: drivers/raritan-pdu-mib.c: initialize - all fields of mib2nut_info_t array - * drivers/raritan-px2-mib.c: drivers/raritan-px2-mib.c: initialize - all fields of mib2nut_info_t array - * drivers/raritan-px2-mib.c: drivers/raritan-px2-mib.c: fix - indentations - * drivers/raritan-px2-mib.c: drivers/raritan-px2-mib.c: initialize - all fields of info_lkp_t arrays, and fix indentations in the table - * drivers/raritan-pdu-mib.c: drivers/raritan-pdu-mib.c: initialize - all fields of info_lkp_t arrays - * drivers/powerware-mib.c: drivers/powerware-mib.c: initialize all - fields of info_lkp_t arrays - * drivers/netvision-mib.c: drivers/netvision-mib.c: initialize all - fields of mib2nut_info_t array - * drivers/netvision-mib.c: drivers/netvision-mib.c: initialize all - fields of info_lkp_t arrays - * drivers/mge-mib.c: drivers/mge-mib.c: initialize all fields of - mib2nut_info_t array - * drivers/mge-mib.c: drivers/mge-mib.c: initialize all fields of - info_lkp_t arrays - * drivers/ietf-mib.c: drivers/ietf-mib.c: initialize all fields of - mib2nut_info_t arrays - * drivers/ietf-mib.c: drivers/ietf-mib.c: initialize all fields of - info_lkp_t arrays - * drivers/emerson-avocent-pdu-mib.c: drivers/emerson-avocent-pdu- - mib.c: initialize all fields of info_lkp_t arrays - * drivers/emerson-avocent-pdu-mib.c: drivers/emerson-avocent-pdu- - mib.c: initialize all fields of mib2nut_info_t array - * drivers/eaton-pdu-revelation-mib.c: drivers/eaton-pdu-revelation- - mib.c: initialize all fields of mib2nut_info_t array - * drivers/eaton-pdu-revelation-mib.c: drivers/eaton-pdu-revelation- - mib.c: initialize all fields of info_lkp_t arrays - * drivers/eaton-pdu-pulizzi-mib.c: drivers/eaton-pdu-pulizzi-mib.c: - initialize all fields of mib2nut_info_t array - * drivers/eaton-pdu-pulizzi-mib.c: drivers/eaton-pdu-pulizzi-mib.c: - initialize all fields of info_lkp_t arrays - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - initialize all fields of mib2nut_info_t array - * drivers/eaton-pdu-marlin-mib.c: drivers/eaton-pdu-marlin-mib.c: - initialize all fields of info_lkp_t arrays - * drivers/eaton-pdu-genesis2-mib.c: drivers/eaton-pdu-genesis2-mib.c: - initialize all fields of mib2nut_info_t array - * drivers/compaq-mib.c: drivers/compaq-mib.c: initialize all fields - of mib2nut_info_t array - * drivers/compaq-mib.c: drivers/compaq-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/baytech-mib.c: drivers/baytech-mib.c: initialize all fields - of mib2nut_info_t array - * drivers/baytech-mib.c: drivers/baytech-mib.c: initialize all fields - of info_lkp_t arrays - * drivers/apc-mib.c: drivers/apc-mib.c: initialize all fields of - mib2nut_info_t array (and comment concern whether the addition was - right?) - * drivers/apc-mib.c: drivers/apc-mib.c: replace verbatim OID string - we seek with a macro APC_UPS_DEVICE_MODEL like elsewhere - * drivers/apc-mib.c: drivers/apc-mib.c: initialize all fields of - info_lkp_t arrays - -2020-11-06 Jim Klimov - - * drivers/apcsmart_tabs.c: drivers/apcsmart_tabs.c: initialize all - fields of upsdrv_info_t array - * drivers/apcsmart_tabs.c: drivers/apcsmart_tabs.c: initialize all - fields of apc_vartab_t arrays - * tools/nut-scanner/nutscan-serial.c: tools/nut-scanner/nutscan- - serial.c: initialize all fields of device_portname_t arrays - * drivers/upscode2.c: drivers/upscode2.c: initialize all fields of - cmd_t and simple_t arrays - -2020-11-05 Jim Klimov - - * drivers/optiups.c: drivers/optiups.c: initialize all fields of - ezfill_t tables - * drivers/mge-hid.c: drivers/mge-hid.c: update arrays of info_lkp_t - with fourth (nuf) field and comment where a real nuf() might be - useful - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: update arrays of - info_lkp_t with fourth (nuf) field and comment where a real nuf() - might be useful - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: update arrays of - info_lkp_t with fourth (nuf) field - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: update HIDDevice_t - object with missing initializer for bcdDevice - * drivers/mge-hid.c: drivers/mge-utalk.c: update arrays of info_lkp_t - with fourth (nuf) field - * drivers/gamatronic.h: drivers/gamatronic.h: initialize the "value" - field in the struct array - * drivers/gamatronic.h: drivers/gamatronic.h: avoid anonymous struct - -2020-11-04 Jim Klimov - - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix info_lkp_t arrays to - consider fourth "nuf" field - -2020-11-08 Jim Klimov - - * drivers/mge-xml.c: drivers/mge-xml.c: avoid implicit switch fall- - through (comment whether that wondering is the right thing to do - though) - -2020-11-06 Jim Klimov - - * drivers/upscode2.c: drivers/upscode2.c: comment the fallthrough in - upsc_simple() switch, so far consider it explicitly desired as it - was before - * drivers/isbmex.c: drivers/isbmex.c: replace FALLTHRU comments with - more portable and reliable goto jumps - -2020-11-05 Jim Klimov - - * drivers/isbmex.c: drivers/isbmex.c: upsdrv_updateinfo(): fix - switch/break - -2020-11-08 Jim Klimov - - * drivers/blazer_usb.c: drivers/blazer_usb.c: avoid implicit switch - fall-through - * drivers/riello_usb.c: drivers/riello_usb.c: avoid implicit switch - fall-through - * drivers/tripplite_usb.c: drivers/tripplite_usb.c: avoid implicit - switch fall-through - -2020-11-06 Jim Klimov - - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - explicit fall through to displaying help - * drivers/nutdrv_qx.c: drivers/nutdrv_qx.c: qx_command(): explicit - fall through the switch - * drivers/mge-hid.c: drivers/mge-hid.c: replace FALLTHRU comments - with same returns as the next default case - -2020-11-05 Jim Klimov - - * drivers/mge-hid.c: drivers/mge-hid.c: quiesce -Wimplicit- - fallthrough=3 warnings about fall-through in switch - -2020-11-06 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: replace FALLTHRU - comments with more portable and reliable goto jumps - -2020-11-05 Jim Klimov - - * drivers/usbhid-ups.c: drivers/usbhid-ups.c: quiesce -Wimplicit- - fallthrough=3 warnings about fall-through in switch - -2020-11-06 Jim Klimov - - * clients/upsc.c: clients/upsc.c: replace FALLTHRU comments with more - portable and reliable goto jumps - -2020-11-04 Jim Klimov - - * clients/upsc.c: clients/upsc.c: quiesce -Wimplicit-fallthrough=3 - warnings about fall-through in switch - -2020-11-06 Jim Klimov - - * common/snprintf.c: common/snprintf.c: replace FALLTHRU comments - with more portable and reliable goto jumps - -2020-11-04 Jim Klimov - - * common/snprintf.c: common/snprintf.c: quiesce -Wimplicit- - fallthrough=3 warnings about fall-through in switch - -2020-11-08 Jim Klimov - - * ci_build.sh: ci_build.sh: refactor to track failing "default-all- - errors" so we can extend it to "configure_nut()" and - "build_to_only_catch_errors()" more variants - * ci_build.sh: ci_build.sh: refactor to have a - build_to_only_catch_errors() routine - * ci_build.sh: ci_build.sh: refactor to have a configure_nut() - routine - * docs/developers.txt: docs/developers.txt: document a valid use-case - of goto for clean switch-case fall-through - -2020-11-04 Jim Klimov - - * include/common.h: include/common.h: introduce NUT_UNUSED* macros to - mark up codebase - -2020-11-05 Jim Klimov - - * .travis.yml: .travis.yml: in NUT_MATRIX test cases, specify - -Werror=implicit-fallthrough=3 to let special comments quiesce the - warning where a FALLTHRU is intentional - * .travis.yml: .travis.yml: in clang test cases, do not insist that - all macros are used, or we can not pass even autoconf - -2020-11-04 Jim Klimov - - * .travis.yml: .travis.yml : enable "-Wextra -Weverything" for clang - (follow-up to issue #823) - * .travis.yml: .travis.yml : enable "-Wextra" for newer gcc versions - on Linux (follow-up to issue #823) - * .travis.yml: .travis.yml : enable "-Wextra" for default gcc - versions on Linux (follow-up to issue #823) - * configure.ac: configure.ac: revise the fix for AC_PROG_LIBTOOL to - only revert settings already passed to the compiler (that older - releases may not understand if we just force them) - * configure.ac: configure.ac : work around libtool weakness seen by - pedantic compilers (did not test for "${CLANG}" so drop it for now) - * configure.ac: configure.ac : work around libtool weakness seen by - pedantic compilers - * ci_build.sh: ci_build.sh: do not hide autogen.sh stderr - * ci_build.sh: ci_build.sh: if configure failed, sleep a bit before - dumping config.log - -2020-11-03 Jim Klimov - - * ci_build.sh: ci_build.sh : if configure script fails, dump its log - before exiting - * .travis.yml: .travis.yml : rephrase some comments - * .travis.yml: .travis.yml : separate the "_matrix_gnustd_nowarn" - * .travis.yml: Issue #823 follow-up: support branches named like - "fightwarn" to build more test cases in Travis CI (actually enable - those build matrices) - * .travis.yml: Issue #823 follow-up: support branches named like - "fightwarn" to build more test cases in Travis CI - -2020-11-07 Jim Klimov - - * drivers/eaton-ats16-mib.c: Update eaton-ats16-mib.c Reworded the - comments - * drivers/nutdrv_qx.c: Update nutdrv_qx.c drivers/nutdrv_qx.c: - rectify indentations - * drivers/tripplite_usb.c: Update tripplite_usb.c - drivers/tripplite_usb.c: drop trailing whitespace - * docs/acknowledgements.txt: Update acknowledgements.txt Acknowledge - a vendor contribution from EVER Power Systems - * drivers/ever-hid.c: Update ever-hid.c Small whitespace fixes - * docs/acknowledgements.txt: Update acknowledgements.txt Add vendor - contribution from AMETEK Powervar for UPM series - * drivers/liebert-hid.c: Update liebert-hid.c Minor whitespace fixes - -2020-11-06 Jim Klimov - - * configure.ac: configure.ac: drop trailing whitespace - * tools/nut-usbinfo.pl: tools/nut-usbinfo.pl: drop trailing - whitespace - * tools/nut-recorder.sh: tools/nut-recorder.sh: drop trailing - whitespace - * tools/nut-ddl-dump.sh: tools/nut-ddl-dump.sh: drop trailing - whitespace - * tests/nutclienttest.cpp: tests/nutclienttest.cpp: drop trailing - whitespace - * server/user.c: server/user.c: drop trailing whitespace - * server/upstype.h: server/upstype.h: drop trailing whitespace - * server/sstate.c: server/sstate.c: drop trailing whitespace - * server/sockdebug.c: server/sockdebug.c: drop trailing whitespace - * server/netlist.c: server/netlist.c: drop trailing whitespace - * server/netinstcmd.c: server/netinstcmd.c: drop trailing whitespace - * server/netget.c: server/netget.c: drop trailing whitespace - * server/conf.c: server/conf.c: drop trailing whitespace - * common/upsconf.c: common/upsconf.c: drop trailing whitespace - * common/state.c: common/state.c: drop trailing whitespace - * common/setenv.c: common/setenv.c: drop trailing whitespace - * common/parseconf.c: common/parseconf.c: drop trailing whitespace - * clients/upsmon.h: clients/upsmon.h: drop trailing whitespace - * clients/upsimagearg.h: clients/upsimagearg.h: rectify whitespace - * clients/upsclient.h: clients/upsclient.h: drop trailing whitespace - * clients/nutclient.cpp, clients/nutclient.h: - clients/nutclient.{cpp,h}: drop trailing whitespace - * clients/cgilib.c: clients/cgilib.c: drop trailing whitespace - * drivers/nut-ipmipsu.c, drivers/nut-libfreeipmi.c: - drivers/nut-*ipmi**.{c,h}: drop trailing whitespace - * drivers/netxml-ups.c, drivers/netxml-ups.h: drivers/netxml- - ups.{c,h}: drop trailing whitespace - * drivers/mge-utalk.h, drivers/mge-xml.c, drivers/mge-xml.h: - drivers/mge*.{c,h}: drop trailing whitespace - * drivers/main.h: drivers/main.h: drop trailing whitespace - * drivers/main.c: Drop exec bit from source file - * drivers/liebert-hid.h, drivers/liebert.c: drivers/liebert*: drop - trailing whitespace - * drivers/libhid.c: drivers/libhid.h: drop trailing whitespace - * drivers/idowell-hid.c: drivers/idowell-hid.h: drop trailing - whitespace - * drivers/hidtypes.h: drivers/hidtypes.h: drop trailing whitespace - * drivers/genericups.h: drivers/genericups.h: drop trailing - whitespace - * drivers/everups.c: drivers/everups.c: drop trailing whitespace - * drivers/eaton-pdu-pulizzi-mib.c: drivers/eaton-pdu-pulizzi-mib.c: - drop trailing whitespace - * drivers/dummy-ups.h: drivers/dummy-ups.h: drop trailing whitespace - * drivers/dstate.c: drivers/dstate.c: drop trailing whitespace - * drivers/delta_ups-mib.c: drivers/delta_ups-mib.c: drop trailing - whitespace - * drivers/cyberpower-mib.c: drivers/cyberpower-mib.c: drop trailing - whitespace - * drivers/blazer.c, drivers/blazer_usb.c: drivers/blazer*.{c,h}: drop - trailing whitespace - * drivers/bestuferrups.c: drivers/bestuferrups.c: rectify - indentations - * drivers/bestuferrups.c: drivers/bestuferrups.c: drop trailing - whitespace - * drivers/belkin-hid.c, drivers/belkin-hid.h: drivers/belkin*.{c,h}: - drop trailing whitespace - * drivers/bcmxcp_io.h, drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c: - drivers/bcmxcp*.{c,h}: drop trailing whitespace - * drivers/baytech-mib.c: drivers/baytech-mib.c: drop trailing - whitespace - * drivers/apc-mib.c: drivers/apc-mib.c: drop trailing whitespace - * drivers/apc-hid.c, drivers/apc-hid.h: drivers/apc-hid.{c,h}: drop - trailing whitespace - * drivers/xppc-mib.c: drivers/xppc-mib.h: drop trailing whitespace - * drivers/tripplite-hid.h: drivers/tripplite-hid.h: drop trailing - whitespace - * drivers/snmp-ups.h: drivers/snmp-ups.h: drop trailing whitespace - * drivers/skel.c: drivers/skel.c: drop trailing whitespace - * drivers/richcomm_usb.c: drivers/richcomm_usb.c: drop trailing - whitespace - * drivers/powerware-mib.c: drivers/powerware-mib.c: drop trailing - whitespace - * drivers/openups-hid.c: drivers/openups-hid.c: drop trailing - whitespace - * drivers/oneac.c, drivers/oneac.h: drivers/oneac.{c,h}: drop - trailing whitespace - * drivers/nutdrv_atcl_usb.c: drivers/nutdrv_atcl_usb.c: drop trailing - whitespace - * drivers/riello.c, drivers/riello_ser.c, drivers/riello_usb.c: - drivers/riello*.{c,h}: drop trailing whitespaces - * drivers/apcsmart-old.c, drivers/apcsmart-old.h: drivers/apcsmart- - old.{c,h}: drop trailing whitespaces - * tools/nut-scanner/nut-scanner.c: tools/nut-scanner/nut-scanner.c: - fix whitespaces - * tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-ip.c, - tools/nut-scanner/nutscan-ip.h, tools/nut-scanner/scan_avahi.c, - tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_ipmi.c, tools/nut-scanner/scan_usb.c: tools/nut- - scanner/*.{c,h}: drop trailing whitespaces - * server/netmisc.c: server/netmisc.c: drop trailing whitespaces - * server/netssl.c: server/netssl.c: drop trailing whitespaces - * server/upsd.c: server/upsd.c: drop trailing whitespaces - * drivers/ivtscd.c: drivers/ivtscd.c: drop trailing whitespaces - * drivers/powerp-bin.h, drivers/powerp-txt.h, drivers/powerpanel.c, - drivers/powerpanel.h: drivers/powerp*.{c,h}: drop trailing - whitespaces - * drivers/powerp-txt.c: drivers/powerp-txt.c: drop trailing - whitespaces - * drivers/powerp-bin.c: drivers/powerp-bin.c: drop trailing - whitespaces - * drivers/victronups.c: drivers/victronups.c: rectify whitespace - * drivers/upscode2.c: drivers/upscode2.c: rectify whitespace - -2020-11-05 Jim Klimov - - * drivers/tripplitesu.c: drivers/tripplitesu.c: drop trailing - whitespaces - * drivers/solis.c, drivers/solis.h: drivers/solis.{c,h}: rectify - whitespaces - * drivers/safenet.c: drivers/safenet.c: drop trailing whitespaces - * drivers/rhino.c: drivers/rhino.c: normalize whitespace heavily - * drivers/powercom.c: drivers/powercom.c: rectify leading whitespaces - * drivers/powercom.c: drivers/powercom.c: drop trailing whitespaces - * drivers/powercom.h: drivers/powercom.h: drop trailing whitespaces - * drivers/optiups.c: drivers/optiups.c: rectify whitespaces - * drivers/hidparser.c: drivers/hidparser.c: drop trailing whitespaces - * drivers/usb-common.c: drivers/usb-common.c: drop trailing - whitespaces - * drivers/libshut.h, drivers/libusb.h, drivers/usb-common.h: - drivers/libshut.h libusb.h usb-common.h: drop trailing whitespaces - * drivers/libshut.c: drivers/libshut.c: rectify whitespaces per style - guide - * drivers/mge-utalk.c: drivers/mge-utalk.c: drop trailing whitespaces - * drivers/metasys.c: drivers/metasys.c: drop trailing whitespaces - * drivers/masterguard.c: drivers/masterguard.c: rectify whitespaces - and drop comments opposing the project style guide - * drivers/masterguard.c: drivers/masterguard.c: drop trailing - whitespaces - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: rectify whitespaces - * drivers/liebert-esp2.c: drivers/liebert-esp2.c: drop trailing - whitespaces - * drivers/isbmex.c: drivers/isbmex.c: rectify whitespaces - * drivers/isbmex.c: drivers/isbmex.c: drop trailing whitespaces - * drivers/gamatronic.h: drivers/gamatronic.h: rectify whitespaces - * drivers/dummy-ups.c: drivers/dummy-ups.c: drop trailing whitespaces - * drivers/bestups.c: drivers/bestups.c: drop trailing whitespaces - * drivers/bestfortress.c: drivers/bestfortress.c: rectify whitespaces - * drivers/bestfcom.c: drivers/bestfcom.c: rectify whitespaces - * drivers/belkinunv.c: drivers/belkin.c: rectify whitespaces - * drivers/belkin.c: drivers/belkin.c: drop trailing whitespaces - * drivers/bcmxcp.c: drivers/bcmxcp.c: fix leading whitespaces - -2020-11-04 Jim Klimov - - * drivers/bcmxcp.c: drivers/bcmxcp.c: drop trailing whitespaces - * drivers/bcmxcp.h: drivers/bcmxcp.h: drop trailing whitespaces - * drivers/serial.c: drivers/serial.c: drop trailing whitespaces - * clients/upssched.c: clients/upssched.c: drop trailing whitespaces - * clients/upsmon.c: clients/upsmon.c: drop trailing whitespaces - * clients/upsset.c: clients/upsset.c: drop trailing whitespaces - * clients/upsimage.c: clients/upsimage.c: drop indented whitespaces - * clients/upsstats.c: clients/upsstats.c: drop trailing whitespaces - * clients/upslog.c: clients/upslog.c: drop trailing whitespaces - * clients/upsc.c: clients/upsc.c: drop trailing whitespaces - * clients/upsclient.c: clients/upsclient.c: drop trailing whitespaces - * common/snprintf.c: common/snprintf.c: rectify whitespace - -2020-11-06 amccartney - - * drivers/powervar-hid.c: Final clean up and edits for Powervar UPM - support - -2020-11-04 Jim Klimov - - * configure.ac: Fix issue #833 for (sys/)termios.h on BSD ...And - generally check if we CAN build serial drivers before trying to - (and/or guessing if we should try). - -2020-11-04 Jim Klimov - - * drivers/solis.c: Update solis.c Drop temporary unicode comment for - PR - * drivers/nutdrv_qx_voltronic.c: Update nutdrv_qx_voltronic.c Drop - temporary comment with unicode for PR - -2020-11-03 Eric Clappier - - * drivers/eaton-ats16-mib.c: Apply patch "Nut-scanner fix for - discovery ats16 with legacy NMC and newer Network-M2" - -2020-10-26 Arnaud Quette - - * drivers/eaton-pdu-marlin-mib.c: snmp-ups: fix outlet ID on Eaton - ePDU Tie outlet ID to a real OID, to avoid erroneous indexes (-1, - 0) - * docs/nut-names.txt, drivers/eaton-pdu-marlin-mib.c: snmp-ups: fix - Eaton ePDU switch ability Expose a general switchability of the - unit, using outlet.switchability, along with a more suitable per- - outlet mechanism - -2020-10-25 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am : @echo diagnostic - messages without a trace by default - -2020-10-22 Arnaud Quette - - * drivers/main.c: Fix dstate init call WRT data dump Closes: - https://github.com/networkupstools/nut/issues/835 - -2020-10-15 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am : in check-man-* - targets, count the checked files (to see better the cases where - none were available) - * docs/man/Makefile.am: docs/man/Makefile.am : typo fix ">&@" => - ">&2" for stderr - -2020-10-13 Jim Klimov - - * .travis.yml: .travis.yml (#823) : in default builds, disable - whatever is not in "_matrix_required" - * .travis.yml: .travis.yml (#823) : define a _matrix_linux and - _matrix_all groupings - * .travis.yml: .travis.yml (#823) : clarify the distro-dependent - relations of matrix jobs as required and allowfail per distro - -2020-10-12 Jim Klimov - - * docs/man/usbhid-ups.txt: Update usbhid-ups.txt Rearranged lines to - keep "all" block together, and finish the list item with a comma - without much context change ;) - * docs/nut.dict: Update nut.dict for PR #733 Add new product name - and vendor keywords - -2020-10-12 Jim Klimov - - * docs/acknowledgements.txt: docs/acknowledgements.txt: revise the - last paragraph for listing corporate contributors - -2020-10-12 amccartney - - * docs/man/usbhid-ups.txt, drivers/powervar-hid.c: Changes per NUT - review comments. Removed info fields from polling. Added - company/contributor info. Updated docs/man/usbhid-ups.txt - -2020-10-12 Jim Klimov - - * docs/nutdrv_qx-subdrivers.txt: docs/nutdrv_qx-subdrivers.txt: - revise a few typos - * docs/configure.txt: docs/configure.txt: update for gdlib pkg-config - support (follow-up to #809) - * docs/configure.txt: docs/configure.txt: update for gdlib pkg-config - support (follow-up to #809) - -2020-10-12 Jim Klimov - - * configure.ac: Update configure.ac Whitespace mess - -2020-10-12 Jim Klimov - - * docs/man/upsd.conf.txt: docs/man/upsd.conf.txt: mention that - ALLOW_NO_DEVICE envvar (e.g. from nut.conf) can override the - setting in upsd.conf - * conf/nut.conf.sample: conf/nut.conf.sample: fix ALLOW_NO_DEVICE - example to "export" it on a separate line - -2020-10-12 Jim Klimov - - * .travis.yml: .travis.yml (#823) : win bash has no time - -2020-10-12 Konstantin Gizdov - - * drivers/usbhid-ups.c: address some comments - -2020-10-12 Jim Klimov - - * .travis.yml: ci_build.sh (#823) : add gnu99-clang-win-nowarn - * ci_build.sh: ci_build.sh (#823) : only call dpkg on linux - * ci_build.sh: ci_build.sh (#823) : investigate win autogen - * .travis.yml: .travis.yml (#823) : fix delivery of ccache to win - builds - -2020-10-11 Jim Klimov - - * .travis.yml: .travis.yml (#823) : do not cache /usr/local/Cellar on - osx, it is too big and rejected anyway - * .travis.yml: .travis.yml (#823, #828) : extend matrix for osx - builds with -std=gnu* variants that seem to pass - * .travis.yml: .travis.yml (#823) : for osx builds, avoid "brew - update" by default, that since 2.0.0 release involves cleanup - automagically and takes a needless 15-30 minutes hit on a Travis - worker When desired we can set HOMEBREW_NO_AUTO_UPDATE - customizable per run - * .travis.yml: .travis.yml (#823) : for osx builds, add ccache; and - only bother for asciidoc + docbook-xsl if building docs - * .travis.yml: .travis.yml (#823) : cache locations related to Brew - between runs - * .travis.yml: .travis.yml (#823) : for now, enable CI_TRACE on Win - always (to find where ci_build.sh script dies) - * .travis.yml: .travis.yml : set jobs.fast_finish:true - -2020-10-10 Jim Klimov - - * .travis.yml: .travis.yml (#823) : group tests into YAML _matrix-* - lists to pick some easier for particular runs on dev branches - * .travis.yml: .travis.yml (#823) : xcode6.4 is deprecated on Travis, - try a newer oldest alternative (7.3) - * .travis.yml: .travis.yml (#823) : add c99-clang-xcode10.2-warn - * .travis.yml: .travis.yml (#823) : reorder some allowed_failure - tests to group logically - * .travis.yml: .travis.yml (#823) : drop gnu14-gcc-8-nowarn (no C14), - add gnu17-clang-8-nowarn - * .travis.yml: .travis.yml (#823) : drop gnu14 and gnu17 attempts - with gcc-7; try gnu14 with gcc-8 - * .travis.yml: .travis.yml (#823) : mark gnu17-gcc-9-nowarn as OK - * ci_build.sh: .travis.yml (#823) : give up on gdlib (--with-cgi) on - win for now - * .travis.yml: .travis.yml (#823) : add a few MacOS X and - Windows+clang9 build combos for diversity - * .travis.yml: .travis.yml (#823) : add more compilers and standards - to try, to collect max diags: c17-clang-8-warn gnu17-gcc-9-warn - * .travis.yml: .travis.yml (#823) : add more compilers and standards - to try : gnu14-gcc-7-nowarn gnu17-gcc-7-nowarn gnu17-gcc-9-nowarn - c99-clang-3.5-nowarn c17-clang-8-nowarn - * .travis.yml: .travis.yml (#823) : specify "compiler" in our - handmade matrix to hint to Travis which env we want - * .travis.yml: .travis.yml (#823) : comment the reference of C/C++ - standard support by gcc and clang versions used - * .travis.yml: .travis.yml : reshuffle default required builds order - to have the quicker ones more likely to fail in development - iterations to run first - * .travis.yml: .travis.yml : move BUILD_TYPE=default and - BUILD_TYPE=default-tgt:distcheck-light into common stack for - manageability - * .travis.yml: .travis.yml: declare linux "dist" that we want by - default - * ci_build.sh: ci_build.sh: handle runs with unspecified BUILD_TYPE - * ci_build.sh: ci_build.sh: report if PATH includes ccache, and if CC - and CXX understand passed C(XX)FLAGS - * ci_build.sh: ci_build.sh: report values of PATH, CC and CXX (and - versions of the latter) before adding CCACHE into the mix - -2020-10-09 Konstantin Gizdov - - * drivers/usbhid-ups.c: more compact logic - * drivers/usbhid-ups.c: remove leftover lines - * drivers/usbhid-ups.c: lay the groundwork for CyberPower UT - cputquirk - * drivers/usbhid-ups.c: fix indentation style - -2017-10-03 Arnaud Quette - - * docs/configure.txt: Remove an extraneous point - * docs/configure.txt: Update configure documentation for libusb - Document the possibility to override the auto-detection choice, - even though the implementation of this override is not yet - currently working - -2020-10-09 Jim Klimov - - * docs/developers.txt: docs/developers.txt : document coding style - examples for tabs vs spaces - * docs/developers.txt: docs/developers.txt : document a "for loop - initial declarations are only allowed in C99 or C11 mode" - portability offense - * docs/developers.txt: docs/developers.txt : document the official - C99+ standard support and that we have CI to help make sure what is - upheld - * .travis.yml: .travis.yml : update comment for the NUT_MATRIX_TAG - block of tests - * .travis.yml: .travis.yml : fix comment-naming for cDefault-gcc- - default-nowarn/gnu99-gcc-default-nowarn primary not-failing case to - keep up - * .travis.yml: .travis.yml : mark gnu89-gcc-default-nowarn as a not- - failing case to keep up - * drivers/solis.c: drivers/solis.c : fix C89 for-loop var - declarations - * .travis.yml: .travis.yml : mark gnu11-gcc-7-nowarn - gnu99-clang-5.0-nowarn as not-failing cases to keep up - * .travis.yml: .travis.yml : add gnu89-gcc-default-nowarn to the test - matrix to check if at least the basic syntax is okay (note that - current warnings for C89 seem to indicate faults that may be fatal - in binary code) - * .travis.yml: .travis.yml : mark gnu99-gcc-7-nowarn as a not-failing - case to keep up - * .travis.yml: .travis.yml : add gnu99-clang-5.0-nowarn to the test - matrix (hope clang can do GNU C dialect) - * .travis.yml: .travis.yml : add gnu11-gcc-7-nowarn to the test - matrix - -2020-10-08 Alexey Rodionov - - * .../python/app/locale/ru/LC_MESSAGES/NUT-Monitor.mo, - scripts/python/app/locale/ru/ru.po: Fixed two typos and translation - of the term load - -2020-10-08 Jim Klimov - - * .travis.yml: .travis.yml : add c11-clang-5.0-nowarn and - c11-clang-5.0-warn to the matrix - * .travis.yml: .travis.yml : add gnu99-gcc-7-nowarn - c99-clang-5.0-nowarn to test matrix (expected to be green) - * .travis.yml: .travis.yml : warning comment about multitoken CFLAGS - and distcheck - * ci_build.sh: ci_build.sh : spell case statements in consistent - style - * ci_build.sh: ci_build.sh : define default-all-errors separately - from default-alldrv - -2020-08-08 Sean McBride - - * clients/cgilib.c, clients/nutclient.cpp, clients/upsmon.c, - clients/upsset.c, drivers/al175.c, drivers/apcsmart-old.c, - drivers/asem.c, drivers/bcmxcp.c, drivers/belkinunv.c, - drivers/dstate.c, drivers/gamatronic.c, drivers/isbmex.c, - drivers/mge-utalk.c, drivers/nut-libfreeipmi.c, - drivers/nutdrv_qx_voltronic-qs-hex.c, - drivers/nutdrv_qx_voltronic.c, drivers/oneac.c, drivers/powercom.c, - drivers/rhino.c, drivers/riello_ser.c, drivers/snmp-ups.c, - drivers/solis.c, drivers/tripplite_usb.c, drivers/tripplitesu.c, - server/netssl.c, tools/nut-scanner/scan_nut.c: WIP: Fixed various - warnings and errors identified by cppcheck Specifically: - arrayIndexThenCheck,drivers/nutdrv_qx_voltronic-qs- - hex.c:222,style,Array index 'i' is used before limits check. - arrayIndexThenCheck,drivers/oneac.c:176,style,Array index 'i' is - used before limits check. - clarifyCalculation,drivers/belkinunv.c:1063,style,Clarify - calculation precedence for '&' and '?'. - clarifyCalculation,drivers/belkinunv.c:922,style,Clarify - calculation precedence for '&' and '?'. - clarifyCalculation,drivers/powercom.c:677,style,Clarify calculation - precedence for '&' and '?'. - clarifyCalculation,drivers/powercom.c:732,style,Clarify calculation - precedence for '&' and '?'. - clarifyCondition,drivers/asem.c:248,style,Boolean result is used in - bitwise operation. Clarify expression with parentheses. - duplicateConditionalAssign,drivers/solis.c:725,style,The statement - 'if (DaysOnWeek!=DaysOffWeek) DaysOnWeek=DaysOffWeek' is logically - equivalent to 'DaysOnWeek=DaysOffWeek'. - duplicateExpression,clients/cgilib.c:49,style,Same expression on - both sides of '||'. - duplicateExpression,drivers/nutdrv_qx_voltronic.c:270,style,Same - expression on both sides of '||'. - duplicateExpression,drivers/nutdrv_qx_voltronic.c:303,style,Same - expression on both sides of '||'. - duplicateExpression,drivers/nutdrv_qx_voltronic.c:397,style,Same - expression on both sides of '||'. identicalInnerCondition,drivers/t - ripplite_usb.c:579,warning,Identical inner 'if' condition is always - true. incorrectLogicOperator,drivers/dstate.c:1170,warning,Logical - conjunction always evaluates to false: c2 && !c2. - incorrectLogicOperator,drivers/rhino.c:190,warning,Logical - disjunction always evaluates to true: BattVoltage > 129 || - BattVoltage < 144. incorrectStringBooleanError,drivers/mge- - utalk.c:899,warning,Conversion of string literal "\r\n" to bool - always evaluates to true. - invalidPrintfArgType_sint,clients/upsset.c:393,warning,%d in format - string (no. 1) requires 'int' but the argument type is 'unsigned - int'. invalidPrintfArgType_sint,clients/upsset.c:676,warning,%d in - format string (no. 1) requires 'int' but the argument type is - 'unsigned int'. - invalidPrintfArgType_sint,drivers/isbmex.c:178,portability,%d in - format string (no. 1) requires 'int' but the argument type is - 'ssize_t {aka signed long}'. - invalidPrintfArgType_sint,drivers/tripplitesu.c:435,warning,%d in - format string (no. 1) requires 'int' but the argument type is - 'unsigned int'. - knownConditionTrueFalse,clients/upsmon.c:919,style,Condition 'un' - is always true - knownConditionTrueFalse,drivers/gamatronic.c:111,style,Condition - 'ret>=0' is always true - knownConditionTrueFalse,drivers/powercom.c:696,style,Condition - 'battval>bat0' is always true - knownConditionTrueFalse,drivers/solis.c:485,style,Condition - 'AppPower==0' is always false knownConditionTrueFalse,tools/nut- - scanner/scan_nut.c:180,style,Condition 'numa>=3' is always true - memleak,clients/upsset.c:664,error,Memory leak: val - nullPointerRedundantCheck,drivers/snmp-ups.c:1554,warning,Either - the condition 'info_template==NULL' is redundant or there is - possible null pointer dereference: info_template. - pointerLessThanZero,drivers/nut-libfreeipmi.c:864,style,A pointer - can not be negative so it is either pointless or an error to check - if it is. pointerLessThanZero,drivers/nut-libfreeipmi.c:884,style,A - pointer can not be negative so it is either pointless or an error - to check if it is. - postfixOperator,clients/nutclient.cpp:896,performance,Prefer prefix - ++/-- operators for non-primitive types. - redundantInitialization,drivers/al175.c:548,style,Redundant - initialization for 'reply'. The initialized value is overwritten - before it is read. - uninitMemberVar,clients/nutclient.cpp:504,warning,Member variable - 'TcpClient::_timeout' is not initialized in the constructor. - uninitMemberVar,clients/nutclient.cpp:513,warning,Member variable - 'TcpClient::_timeout' is not initialized in the constructor. - uninitvar,server/netssl.c:546,error,Uninitialized variable: ret - unsignedLessThanZero,drivers/apcsmart-old.c:928,style,Checking if - unsigned expression 'sdtype' is less than zero. - unsignedPositive,drivers/bcmxcp.c:785,style,Unsigned expression - 'commandByte' can't be negative so it is unnecessary to test it. - uselessAssignmentPtrArg,drivers/riello_ser.c:105,warning,Assignment - of function parameter has no effect outside the function. Did you - forget dereferencing it? - -2020-10-08 Jim Klimov - - * ci_build.sh: ci_build.sh : revise multi-token CONFIG_OPTS entries - * .travis.yml, ci_build.sh: .travis.yml / ci_build.sh : define a - BUILD_TYPE=default-all-errors specifically to list all files with - errors fatal for current build config (but not list whatever - succeds) - * ci_build.sh: ci_build.sh : allow to stack multi-token CC="ccache - clang" and such - * ci_build.sh: ci_build.sh : recognize is_clang() for ccache wrapping - * ci_build.sh: ci_build.sh : recognize is_clang() - * .travis.yml, ci_build.sh: Issue #823 : Set up Travis CI testing for - more compiler implementations and C/C++ standards - * ci_build.sh: ci_build.sh : fix a few historic typos - * ci_build.sh: ci_build.sh: make sure we build all possible binaries - in default-alldrv mode - -2020-10-08 Alexey Rodionov - - * .../app/locale/ru/LC_MESSAGES/NUT-Monitor.mo, - scripts/python/app/locale/ru/ru.po: Additional corrections of the - Russian translation - * .../app/locale/ru/LC_MESSAGES/NUT-Monitor.mo, - scripts/python/app/locale/ru/ru.po: Fixed typos, made changes - according to comments - -2020-10-08 Jim Klimov - - * drivers/Makefile.am: drivers/Makefile.am : drop redundant - pijuice_SOURCES listed in wrong section - -2020-10-07 Jim Klimov - - * docs/man/snmp-ups.txt, docs/nut.dict: Update snmp-ups manpage for - symmetrathreephase quirk to complete PR #788 - -2020-10-07 Jim Klimov - - * drivers/snmp-ups.c: Update snmp-ups.c Fixed indentation for - multiline if-clause - -2020-10-07 Jim Klimov - - * docs/man/Makefile.am, docs/man/index.txt, docs/man/pijuice.txt, - docs/nut.dict: Add initial manpage for pijuice driver, hastily - ripped off one for asem driver - * drivers/pijuice.c: pijuice.c cleanup : rectify leading indentations - * drivers/pijuice.c: pijuice.c cleanup : rectify tabulation of - definitions - * drivers/pijuice.c: pijuice.c cleanup : comment end of big block of - nested #if macros - * drivers/pijuice.c: pijuice.c cleanup : rectify indentation and - blank-line the default return - * drivers/pijuice.c: pijuice.c cleanup : indent stacked #if* macros - * drivers/pijuice.c: pijuice.c cleanup : trailing whitespaces - -2020-10-07 Jim Klimov - - * clients/upsmon.c: Update upsmon.c Log a warning if an UPS is both - OB+LB+Calibrating so due to this combo we do not tell the host to - shut down gracefully. Comment some ideas to work around such - situation in a smarter way if we have additional info to know if we - are in a safe environment just calibrating, or a known-unsafe one - with a real outage in progress. - * common/state.c: state.c: state_delinfo(): comment on immutables - For `state_delinfo()` not deleting immutable variables, comment - this near the function and log for runtime hits to help - troubleshooting. - -2020-10-06 Arnaud Quette - - * drivers/main.c: Driver datadump improvements Do not switch to - statepath, nor write pidfile, when using the datadump (-s -d) mode - -2020-09-22 Ross Williams - - * clients/upsmon.c, clients/upsmon.h: Do not shutdown if UPS is - performing calibration Some UPS calibration procedures (e.g. - CyberPower) involve discharging the battery below the LB level, but - we don't want systems to shut down if the UPS is only on battery - because it is calibrating. - -2019-04-01 Ross Williams - - * drivers/cyberpower-mib.c: cyberpower-mib: fix instant command - declarations Had desired OID values in default value field. Also, - default value for SU_TYPE_CMD should be NULL. - -2019-03-29 Ross Williams - - * drivers/cyberpower-mib.c: cyberpower-mib: Add instant commands - -2019-04-01 Ross Williams - - * drivers/cyberpower-mib.c: cyberpower-mib: got delay OID wrong Left - off .0 - * drivers/cyberpower-mib.c: cyberpower-mib: Add delay variables Add - some read/write variables affecting the sleep delay and return - delay. - * drivers/cyberpower-mib.c: cyberpower-mib: fix instant command - declarations Had desired OID values in default value field. Also, - default value for SU_TYPE_CMD should be NULL. - * drivers/cyberpower-mib.c: cyberpower-mib: NUT runtime is seconds - not minutes - * drivers/cyberpower-mib.c: cyberpower-mib: clarify status values - * drivers/cyberpower-mib.c: cyberpower-mib: correct sysOID At least - newer CyberPower management cards report a sysOID of CPS-MIB::ups, - not the base CyberPower enterprise MIB that was previously defined. - -2019-03-29 Ross Williams - - * drivers/cyberpower-mib.c: cyberpower-mib: Add instant commands - * drivers/cyberpower-mib.c: cyberpower-mib: add support for battery - status Reports LB, CAL, and RB flags - -2020-08-12 Konstantin Gizdov - - * drivers/usbhid-ups.c: initial patch that works - -2020-07-29 Fabrice Fontaine - - * m4/nut_check_libgd.m4: nut_check_libgd.m4: try to find gd through - pkg-config gdlib-config has been dropped from version 2.3.0 with h - ttps://github.com/libgd/libgd/commit/d62f608c7c4a814c70d4ba777725e3 - e62d9e2cde - -2020-07-21 Luka Kovačič - - * drivers/delta-hid.c: drivers: delta-hid: Update entry flags - appropriately Update entry flags to use HU_FLAG_QUICK_POLL for - status and alarm variables, HU_FLAG_SEMI_STATIC for variables that - can change on user changes and HU_FLAG_STATIC for variables that - don't need to be updated after init. - -2020-07-02 Luka Kovačič - - * drivers/Makefile.am, drivers/delta-hid.c, drivers/delta-hid.h, - drivers/usbhid-ups.c, scripts/upower/95-upower-hid.rules: drivers: - delta-hid: Add Delta HID subdriver Delta HID subdriver is added to - support Delta RT Series, Single Phase, 1/2/3 kVA UPS devices. The - driver was tested and tweaked on Delta RT 3 kVA UPS. - -2020-07-17 Alexey Rodionov - - * .../app/locale/ru/LC_MESSAGES/NUT-Monitor.mo, - scripts/python/app/locale/ru/ru.po: Add Russian translation for - NUT-Monitor - -2020-07-11 Matt Merhar - - * docs/security.txt: Fix typo in TCP Wrappers documentation - -2020-06-15 Florian Bernd - - * drivers/apcupsd-ups.c: Do not overwrite `poll_interval` in - `apcupsd-ups` This commit removes the hardcoded poll-interval of - 60 seconds and instead only makes sure that the user-defined - interval is greater than a minimum-interval. - * drivers/apcupsd-ups.c, drivers/apcupsd-ups.h: Do not call - `dstate_delinfo()` for LB-condition variables This commit fixes - the `ignorelb` flag for the `apcupsd-ups` driver. Previusly - "battery.charge" and "battery.runtime" was cleared before invoking - `status_commit()` which caused the LB-condition to always be - `false`. - * common/state.c: Respect `ST_FLAG_IMMUTABLE` in `dstate_delinfo()` - -2020-06-11 Eric Zinnikas - - * drivers/cyberpower-mib.c: Support CyberPower RMCARD205 - -2020-06-11 Peter Klein - - * clients/nutclient.cpp, clients/nutclient.h: Remove dynamic - exception specifications from clients/nutclient.cpp These are - invalid in c++17 and must be removed for compatibility with modern - compilers. - -2020-06-02 Jim Klimov - - * drivers/apc-ats-mib.c: apc-ats-mib.c : use a ..._MODEL_NAME macro - and bump version to complete earlier fix - -2020-05-31 Timothy Pearson - - * drivers/snmp-ups.c: Fix long-standing transfer threshold read bug - with APCC 3 phase Symmetra units - -2020-05-14 Arnaud Quette - - * tools/nut-scanner/scan_snmp.c: SNMP scan: check the match dup on - 'mib' instead of 'sysoid' This actually avoids duplication when - multiple sysOIDs are declared for the same MIB - -2020-05-01 gprints - - * drivers/liebert-hid.c: Update liebert-hid.c - -2020-04-28 Arnaud Quette - - * drivers/eaton-ats16-mib.c: snmp-ups: cleanup Eaton ATS16 with new - Network-M2 Duplicate the definition, as a workaround to the bugger - scanner data extraction, and point at the same eaton_ats16 name, - since there is no interest in separating mib2nut entries pointing - at the same MIB mapping - -2020-01-15 Clappier, Eric - - * drivers/ietf-mib.c: Issue corection filter ietf mib (cherry picked - from commit 93a64efbdae28355be60329b651d3c42c7ddedf8) - -2020-04-28 Arnaud Quette - - * tools/nut-snmpinfo.py: Fix Python issue in the SNMP scan extractor - -2020-01-15 Clappier, Eric - - * tools/nut-scanner/scan_snmp.c, tools/nut-snmpinfo.py: Fix nutscan - snmp (cherry picked from commit - bc5a6c218e21c0af454007e2929c084129b6f3ed) - * drivers/apc-ats-mib.c: Issue correction no pointer null at - beginning of the SNMP IDs device table (cherry picked from commit - 9d167892a36bf75d30839e7d4d6b53f037751666) - -2020-04-28 Arnaud Quette - - * drivers/huawei-mib.c: Huawei MIB: add a counter check OID This - avoids getting a false result when trying all OIDs, due to the use - of Net SNMP sysOID (.1.3.6.1.4.1.8072.3.2.10), found in various - implementations - -2016-05-25 Jim Klimov - - * drivers/huawei-mib.c: huawei-mib - renamed lookups to have - "huawei_*" prefix (cherry picked from commit - fd29f32b2837588518ec7bea07f414c2631d5c8f) - -2020-04-21 Jim Klimov - - * scripts/augeas/nutupsdconf.aug.in: nutupsdconf.aug.in: complete the - ALLOW_NO_DEVICE definition - * conf/nut.conf.sample, conf/upsd.conf.sample, - docs/man/upsd.conf.txt, scripts/augeas/nutupsdconf.aug.in, - scripts/augeas/tests/test_nut.aug, server/conf.c, server/upsd.c, - server/upsd.h: Rename NUT_NOCONF_ALLOWED to ALLOW_NO_DEVICE as - suggested in PR comments - * conf/nut.conf.sample: nut.conf.sample: update the comment about - NUT_NOCONF_ALLOWED - * server/upsd.c: upsd.c : CONST char* temp "envvar" as we do not - change the string later - -2020-04-17 Jim Klimov - - * conf/upsd.conf.sample, docs/man/upsd.conf.txt: Re-spell "Boolean" - to satisfy spell-checker - * conf/upsd.conf.sample, docs/man/upsd.conf.txt, - scripts/augeas/nutupsdconf.aug.in, - scripts/augeas/tests/test_nut.aug, server/conf.c, server/upsd.c, - server/upsd.h: Allow to configure NUT_NOCONF_ALLOWED option via - upsd.conf - -2020-04-17 Arnaud Quette - - * drivers/eaton-ats16-mib.c, drivers/eaton-ats16-mib.h, drivers/snmp- - ups.c: snmp-ups: add Eaton ATS16 with new Network-M2 Add support - for Eaton ATS16 using the new Network-M2 communication cards, and - including a fixed sysOID fingerprint - -2020-04-03 Jim Klimov - - * clients/nutclient.cpp: clients/nutclient.cpp: sanity-check - getDevicesVariableValues() called with empty device list - -2020-03-14 Jim Klimov - - * docs/nut.dict: nut.dict : fixes for NUT_NOCONF_ALLOWED addition - * scripts/systemd/nut-driver-enumerator.service.in, - scripts/systemd/nut-driver@.service.in, scripts/systemd/nut- - monitor.service.in, scripts/systemd/nut-server.service.in: SystemD - service units: source EnvironmentFile=...nut.conf if available - * conf/nut.conf.sample: nut.conf.sample : prepare an uncommentable - line for NUT_NOCONF_ALLOWED=true - * server/upsd.c: server/upsd.c: introduce support for envvar - NUT_NOCONF_ALLOWED=true to allow starting with 0 ups.conf sections - -2018-09-19 Arnaud Quette - - * server/upsd.c: upsd should return EXIT_FAILURE when -c failed - -2020-02-19 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in: when autostarting/reloading upsd (nut-server), do - it for previously "failed" unit too - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in: do systemctl daemon-reload between editing a unit - definition and auto-starting it - -2018-12-18 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : centralize management of TIMEOUT_CMD and - TIMEOUT_ARGS, and use it for driver stop/start - it hangs too - sometimes - -2020-02-09 Laurent Bigonville - - * scripts/python/app/nut-monitor.appdata.xml, scripts/python/app/nut- - monitor.desktop: Update the appdata file to the latest version of - the specification (#727) * nut-monitor: Update the appdata file to - the latest version of the specification Fixes: #724 * nut- - monitor: Update the desktop file to follow the last version of the - sepcification - -2020-02-09 Jim Klimov - - * docs/Makefile.am, docs/documentation.txt, docs/nut.dict, - docs/solaris-usb.txt, scripts/Solaris/README: Add docs/solaris- - usb.txt for posterity (#755) - -2020-01-08 Fernando Chaves <38504809+fernandolcx@users.noreply.github.com> - - * drivers/apcupsd-ups.h: apcupsd-ups: add real power and current - variables LOAD_W => ups.realpower LOADAPNT => power.percent - OUTCURNT => `output.current` LOAD_VA => `ups.power` NOMAPNT => - `ups.power.nominal` Closes: - https://github.com/networkupstools/nut/pull/753 - -2019-11-06 Charles Lepple - - * data/driver.list.in: HCL: Add PowerWalker VFI 1000 CG PF1 Closes: - https://github.com/networkupstools/nut/issues/648 - -2019-09-18 andrewmccartney - - * drivers/Makefile.am, drivers/libusb.c, drivers/powervar-hid.c, - drivers/powervar-hid.h, drivers/usbhid-ups.c: Changes to add - support for Powervar UPM as usb-hid UPS. Includes adding a report - index to libusb.c in order to handle the composite device in the - UPM. - -2019-09-12 Andrew Anderson - - * drivers/pijuice.c: Conditionally include linux/i2c.h Check for - I2C_FUNC_I2C to avoid errors caused by conflicts between - linux/i2c-dev.h and linux/i2c.h - * configure.ac, drivers/pijuice.c: Add more granular I2C support - checks Accommodate one more variation of SMBUS/I2C support where - both the headers and the libraries exist and are usable. - * drivers/pijuice.c: Pull over the latest development version Clean - up the upsdebugX() labels Pull the conditional I2C support code - closer to the includes block Don't report battery temp as UPS temp - Warn if we adjust shutdown_delay - * drivers/pijuice.c: Fix the length passed into memset() - * drivers/asem.c: Add pijuice I2C driver for PiJuice HAT 4/4 Update - asem.c to complie cleanly by adding an include for - * configure.ac: Add pijuice I2C driver for PiJuice HAT 3/4 Check for - both the i2c-tools 3.x and 4.x include files (i2c-dev.h/smbus.h) - and set flags accordingly. Link with the i2c library file from - i2c-tools 4.x if it is available. - * drivers/Makefile.am: Add pijuice I2C driver for PiJuice HAT 2/4 - Update the driver Makefile.am to add pijuice driver to the - LINUX_I2C_DRIVERLIST - * drivers/pijuice.c: Add pijuice I2C driver for PiJuice HAT 1/4 Add - pijuice driver - -2019-09-02 Laurent Bigonville - - * scripts/python/app/nut-monitor.desktop: nut-monitor: Drop the .png - extension for the Icon in the .desktop file - -2019-08-18 Laurent Bigonville - - * scripts/python/Makefile.am, scripts/python/app/icons/256x256/nut- - monitor.png, .../python/app/{ => icons/48x48}/nut-monitor.png, - scripts/python/app/icons/64x64/nut-monitor.png, - scripts/python/app/icons/scalable/nut-monitor.svg: nut-monitor: Add - scalable, 64x64 and 256x256 icon for nut-monitor FTR, this icon - comes from gnome-icon-theme 2.28 - -2019-07-22 rpvelloso - - * drivers/solis.c: solis: avoid index out of bounds Since the - parameter taken by autonomy_calc() is used to index a couple of - arrays of 5 positions and the variable `im`, which is passed to - autonomy_calc(), can be equal to 4, blindly incrementing it by one, - when it's 4, leads to an index out of bounds. - -2019-07-30 Daniele Pezzini - - * drivers/nutdrv_siemens_sitop.c: nutdrv_siemens_sitop: move to the - new "battery.charge.approx" var - * data/cmdvartab, docs/nut-names.txt: Add and document a new - "battery.charge.approx" var - -2019-07-12 Spencer Shimko - - * drivers/tripplite_usb.c: Report load for Tripp Lite USB 3005 - protocol The debug output for a device using the Tripp Lite 09ae - 3005 protocol seems to show that the ups.debug.L is the load as - noted on mailing list posts. Decode it and report it as ups.load. - Tested on TRIPP LITE SMART500RT1U. - -2019-07-11 Jim Klimov - - * scripts/Solaris/nut-driver.xml.in: Solaris/nut-driver.xml.in : - constrain the impact of managing SMF instances for missing devices - * scripts/systemd/nut-driver@.service.in: nut-driver@.service.in : - fix back templated @SBINDIR@ - * scripts/systemd/nut-driver@.service.in: Problem: Attempts to start - a nut-driver@bogusname actually run upsdrvctl on everything - Solution: First check if service instance name is valid, then use - it Should fix https://github.com/42ity/nut/issues/87 - -2019-07-10 Laurent Bigonville - - * clients/Makefile.am, tools/nut-scanner/Makefile.am: libupsclient, - libnutscan: Only export symbols part of the public API Fixes: #713 - -2019-07-09 Laurent Bigonville - - * clients/upsclient.c, clients/upsmon.c, drivers/apcsmart.c, - drivers/bcmxcp.h, drivers/bestuferrups.c, drivers/main.c, - drivers/masterguard.c, drivers/metasys.c, drivers/mge-hid.c, - drivers/mge-mib.c, drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_q1.h, - drivers/optiups.c, drivers/solis.c, scripts/python/app/NUT-Monitor, - tools/nut-scanner/nut-scanner.c: Fix several typos - * configure.ac, lib/libupsclient.pc.in, m4/nut_check_libnss.m4, - m4/nut_check_libopenssl.m4: Use pkg-config module names instead of - listing the libraries Fixes: #709 - -2019-07-02 Jim Klimov - - * common/common.c: common.c : BUILD_64 not detected in some distros, - needs stdint.h - -2018-05-04 Matthijs ten Berge - - * docs/man/nutdrv_siemens_sitop.txt: Spelling fix - * drivers/nutdrv_siemens_sitop.c: Remove %-sign from variable values - * drivers/nutdrv_siemens_sitop.c: Fix line endings - * docs/man/nutdrv_siemens_sitop.txt: Better explanation of serial - port polling - -2018-04-11 Matthijs ten Berge - - * data/driver.list.in, docs/man/Makefile.am, docs/man/{siemens- - sitop.txt => nutdrv_siemens_sitop.txt}, drivers/Makefile.am, - drivers/{siemens-sitop.c => nutdrv_siemens_sitop.c}: Rename driver - siemens-sitop to nutdrv_siemens_sitop As requested in https://gith - ub.com/networkupstools/nut/pull/545#pullrequestreview-106712942 - -2018-03-26 Matthijs ten Berge - - * drivers/siemens-sitop.c: Various code improvements after review - - The number of delimiter characters is no longer hard-coded, but - will be detected and thrown away at runtime - Discard any remains - in the RX buffer after communication errors - collapse repeating - code - upsdrv_shutdown now uses instcmd (removes duplicate code) - - obsolete ups.* variables removed - poll_interval not hard-coded, - but give a warning when a large value is encountered - option - parsing improved - * docs/man/siemens-sitop.txt: Improve manpage layout - -2018-03-23 Matthijs ten Berge - - * docs/man/siemens-sitop.txt, docs/nut.dict: Spellcheck fixes - * data/driver.list.in, docs/man/Makefile.am, docs/man/siemens- - sitop.txt, drivers/Makefile.am, drivers/siemens-sitop.c: Initial - commit of siemens-sitop: driver for Siemens SITOP UPS500-series - UPSes - -2019-04-26 William Chase - - * drivers/bestfcom.c: Fix for Ferrups FE7000 "off" command (#692) - "off" command for FE7000 required at least 5 seconds for the - command to be accepted. Also should match the off with autostart - or "o" with "a" to be consistent with the manual: - https://www.eaton.com/content/dam/eaton/products/backup-power-ups- - surge-it-power-distribution/backup-power-ups/eaton-ferrups-tower- - ups/eaton-ferrups-FE-QFE-userguide-.pdf (o [time] a is how the - manual references the "short" command) - -2019-04-16 Ross Williams - - * drivers/snmp-ups.c: snmp-ups: add ability to set TimeTicks - correctly (#687) * snmp-ups: add ability to set TimeTicks - correctly Driver had been setting read/write parameters as either - Integer or String, but OIDs that expect TimeTicks cannot be set - using an Integer. snmp-ups already supported getting TimeTicks - correctly and had helper functions for setting TimeTicks, but logic - had not been implemented in su_setOID(). * Missing semicolon ;-( - * snmp-ups: use NUT's str_to_long() in su_setOID() Safer - conversion from provided strings to instant command or read/write - value. Omitted default value if !SU_MODE_INSTCMD because it is not - possible for read/write variable functions to be called without a - value (unlike instant commands). - -2019-04-11 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c, drivers/snmp-ups.c: [DNMY] Fix snmp - templates (#681) * eaton-pdu-marlin-mib.c : move "outlet.count" - query higher * snmp-ups.c : anticipate lack of OIDs in templates - -2019-04-05 Jim Klimov - - * .travis.yml, Makefile.am, ci_build.sh: Introduce shell script - syntax checks (#675) * Introduce shell script syntax checks * - Makefile.am : do not shellcheck/spellcheck by default as it can - fail for external circumstances (e.g. missing tools) * Makefile.am - : visibly separate the "check-scripts-syntax" implementation (with - current system shells) vs "shellcheck" which may get impemented - differently (with external tools) in later iterations * - Makefile.am : update the check-scripts-syntax comment (clarify - text, fix typo) * Makefile.am : clarify the check-scripts-syntax - vs shellcheck comment * .travis.yml and ci_build.sh : leave TBDs - for future shellcheck tool integration * ci_build.sh : call both - shellcheck and check-scripts-syntax targets; it does not duplicate - the work and reports while one calls another for now - and will do - two tests when they become independent - * configure.ac: configure.ac : fix mismatched usage of have_cxx11 - envvar (#689) - * server/conf.c: Problem: isdigit() receives a char* instead of char - (#690) Solution: as a quick fix, pick the first char of the string - we pass. The proper fix would be to use the str_*() API for safe - conversions, in a later iteration. See-also: - https://github.com/networkupstools/nut/issues/676 - -2019-04-01 Jim Klimov - - * include/common.h: common.h : use the common do/while idiom for - macro with if clause - -2019-04-01 Jim Klimov - - * common/common.c, include/common.h: Problem: upsdebug*() pass data - and allocate vars always Solution: wrap old well-known API - routines into macros that check debugging level first, and only - invest into calling routines and passing data later - if that would - not be in vain. - -2019-03-25 Jean-Baptiste Boric - - * tools/nut-scanner/scan_snmp.c: Fix nut-scanner SNMPv3 (#680) - -2019-03-19 Arnaud Quette - - * drivers/compaq-mib.c, drivers/eaton-ats16-mib.c, drivers/eaton-pdu- - marlin-mib.c, drivers/hpe-pdu-mib.c, drivers/netxml-ups.c, - drivers/powerware-mib.c: Refresh firmware information for Eaton/HPE - devices Despite the static nature of these data, firmware can be - updated by various means, and should thus be refreshed by the - driver, without needing a driver restart. A "semi static" approach - should be done in the end, as in usbhid-ups, but is not part of the - present development, though commented in the code. For the time - being, simply remove the STATIC flags to refresh the data (snmp- - ups) and allow to refresh product information (netxml-ups) - -2019-03-19 Jean-Baptiste Boric - - * tools/nut-scanner/scan_snmp.c: Fix SNMPv3 in nut-scanner (#679) - -2019-03-15 Arjen de Korte - - * clients/upsclient.c, clients/upssched.c, - m4/nut_check_libopenssl.m4, server/netssl.c: Add support for - openssl-1.1.0 (#504) * Add support for openssl-1.1.0 * Allow - TLSv1 and higher (not just TLSv1) * Fix check for empty string * - Report TLS handshake in debug mode * Update - nut_check_libopenssl.m4 * Update upsclient.c * Update netssl.c - -2019-03-14 Charles Lepple - - * docs/man/nutupsdrv.txt, docs/man/ups.conf.txt: nutupsdrv: reword - "user" directive section Closes: - https://github.com/networkupstools/nut/issues/336 Closes: - https://github.com/networkupstools/nut/issues/671 - -2019-03-11 Arnaud Quette - - * docs/new-clients.txt: libnutclient: add comments to the code sample - -2019-03-11 Jean-Baptiste Boric - - * clients/nutclient.cpp, clients/nutclient.h, docs/new-clients.txt, - docs/nut.dict: Implement tracking commands in libnutclient (#673) - * Implement tracking commands in libnutclient * Add - TrackingResult::INVALID_ARGUMENT - -2019-02-26 Arnaud Quette - - * drivers/solis.c: Fix regression in solis authors list - -2019-02-26 Roberto Panerai Velloso - - * drivers/solis.c, drivers/solis.h: Added author info for previous - merge https://github.com/networkupstools/nut/pull/511 (#672) * - added author information - -2019-02-26 Arnaud Quette - - * clients/Makefile.am, clients/upsclient.c, clients/upsclient.h, - clients/upscmd.c, clients/upsrw.c, common/snprintf.c, - conf/upsd.conf.sample, docs/man/Makefile.am, - docs/man/upscli_cleanup.txt, docs/man/upscli_readline.txt, - docs/man/upscli_sendline.txt, docs/man/upscmd.txt, - docs/man/upsd.conf.txt, docs/man/upsrw.txt, docs/net-protocol.txt, - docs/nut-names.txt, docs/nut.dict, docs/sock-protocol.txt, - drivers/dstate.c, drivers/upshandler.h, include/common.h, - scripts/augeas/nutupsdconf.aug.in, - scripts/augeas/tests/test_nut.aug, server/conf.c, server/netget.c, - server/netinstcmd.c, server/netset.c, server/nut_ctype.h, - server/sstate.c, server/upsd.c, server/upsd.h, tools/nut- - scanner/nut-scanner.c: INSTCMD and SET VAR status tracking - implementation (#659) * INSTCMD and SET VAR status tracking - implementation This commit implements the instant commands - (instcmd) and variables settings (setvar) status tracking, to get - the actual execution status from the driver * Missing Revision - history * Fix nut-names.txt modification that should not be here - * Augeas support: add CMDSETSTATUSDELAY for upsd.conf * INSTCMD - and SET VAR status tracking completion Following Daniele Pezzini - thorough review, sanitize and improve the code, and also complete - documentation * INSTCMD and SET VAR status tracking completion - implement support for status tracking in upscmd and upsrw * - upscmd/upsrw: delay retries for status tracking * Remove comment - There is no need to condition CMDSET_STATUS commands received by - upsd from the driver, on cmdset_status_enabled, since what matters - is the presence of a list and id * Complete comment * UUID v4 - implementation replaced the initial rxi/uuid4 library used by a - cross platform version. Though more basic, it is enough for our - needs, at least for now * status_info should be static * No - need for else, since fatalx is called before * Suppress \n from - debug output * Group sanity checks * Get rid of dynamic memory - allocation * Improve and enforce the use of UUID4_LEN * Comment - on the size of dest for nut_uuid_v4() * Move structures and - defines to more appropriate places * Add functions with timeout - Add upscli_sendline_timeout and upscli_readline_timeout, beside - from the classic blocking versions. Also make a common define for - timeout, and use it in upsclient and nut-scanner * upscmd/upsrw: - add a timeout option * Basic homebrew UUID v4 implementation * - Prefer to use static buffer for UUID * log actual result of - instcmd / setvar * Fix tracking ID reporting due to static memory - changes * upsclient: use unsigned int for timeouts Also, - explicit that upscli_cleanup() takes no argument. * upscmd/upsrw: - use unsigned int for timeout + our str_to_uint() for it Also, - slightly reword the help message for `-t` (timeout) option, in - order to clarify which is the unit (seconds) used for the provided - value. * upscmd/upsrw: don't sleep after receiving a non-PENDING - CMDSET_STATUS Also, remove some nesting in do_cmd() and do_set(). - * net-protocol: clarify the format of GET CMDSET_STATUS + - is not optional to get the status of a - command/setvar with CMDSET_STATUS, so drop the [square brackets] - from it. Also drop "quotes" in SET CMDSET_STATUS's , since - it's expected to be a single word. Plus, fix markup of INSTMCD's - parameter. * sock-protocol: align case and markup of - command parameters * dstate: fix handling of INSTCMD's optional - parameters We should still support the old `INSTCMD - []` format, and not only consider when also - `STATUS_ID ` is provided. Also, fix the format of our sock- - protocol commands mentioned in comments, and add function names to - debug info. * common: document the recently added things * upsd: - in INSTCMD/SET handlers, also accept NULL for status_id Plus: - - use a simpler approach to test if status_id is not empty, - align - the way the SET command is built to the one used for the INSTCMD - command. * upsd: drop unnecessary/unused global * upsd: move - sanity checks of cmdset_status_get() after declaration of vars - Also, drop some nesting in that function. * Move from - CMDSET_STATUS / STATUS_ID to TRACKING This is just a big, big - rename, no code changes. * upsd: refine the tracking API Add a - couple of functions to change in a predictable way the value of the - general enablement of tracking and make it visible only inside - upsd.c. Also, move the tracking type (tracking_t) and the list of - items inside upsd.c. * net-protocol: also return TRACKING between - OK and , for INSTCMD/SET VAR * dstate: *really* fix handling - of INSTCMD's optional parameters Erroring out on `INSTCMD - ` doesn't seem like a good idea... * common: massage - default timeouts Rename the default timeout used in network - operations by upsclient and nut-scanner to be more specific: from - DEFAULT_TIMEOUT to DEFAULT_NETWORK_TIMEOUT. Plus, make the default - timeout used when retrieving the result of an INSTCMD/SET VAR with - TRACKING enabled a common #define'd value - (DEFAULT_TRACKING_TIMEOUT), and use it also to publish the default - value of the -t option in the help messages of upscmd and upsrw. - As suggested by Charles Lepple. * upsd: ignore case of UUID4 in - tracking API Also, remove some nesting in tracking_del(). * - libupsclient: generate manpages for - upscli_{read,send}line_timeout() To keep things simple, at least - for now, only generate manpages and not html pages (and, as such, - don't even think of using our linkman AsciiDoc macro with those - functions, to avoid dead links). * libupsclient: bump version as - per recent changes - addition of upscli_{read,send}line_timeout(), - - upscli_cleanup() -> upcli_cleanup(void) Note: only increase - 'current' and not 'age', because the upscli_cleanup() change could - (potentially) make it not compatible with previous versions. * - upscmd/upsrw: warn that also the drivers need to support TRACKING, - for -w * Fix typo and spelling * Add check around atoi() - conversion - -2019-02-25 Roberto Panerai Velloso - - * drivers/solis.c, drivers/solis.h: solis: various improvements and - fixes - fixed two memory leaks (unnecessary strdup's), - removed - ser_flush calls that were causing the driver to desync, - - refactored code, mostly bit mainpulation functions, - other minor - improvements in source code. - -2019-02-23 Jim Klimov - - * clients/Makefile.am: clients/Makefile.am : also consider HAVE_CXX11 - for .la target - * tests/Makefile.am: tests/Makefile.am : explicitly consider - HAVE_CXX11 - * clients/Makefile.am, tests/Makefile.am: tests, clients Makefiles : - consider HAVE_CXX11 - * configure.ac: configure.ac : expose HAVE_CXX11 into automake - * configure.ac: configure.ac : add C++0X as draft C++11 support - detection (older GCC on some systems) - * configure.ac: configure.ac : refactor C++11 detection for - readability - * configure.ac: Problem: OpenBSD mktemp complains on short pattern - Solution: bump from XXXXX to XXXXXXX which did not complain in - another part of the configure script - -2019-02-20 Jim Klimov - - * clients/Makefile.am, tools/nut-scanner/Makefile.am: nut-scanner and - clients Makefile.am : comments about version-information - -2019-02-16 Jim Klimov - - * docs/nut.dict: nut.dict : add words for upsdrvsvcctl doc - -2019-02-08 Jim Klimov - - * common/common.c: Problem: 32-bit builds fail to load 64-bit libs - Solution: Do our best to guess the bitness of a build, and use it - in search paths for get_libname() - -2019-02-03 Daniele Pezzini - - * server/upsd.c: upsd: fix the calling of netcmds items' func() - Since, as per our network protocol, it's perfectly legal to have - single-word commands (and we already have a few, e.g. VER, NETVER, - HELP, ...), we do not do an early check to ensure that at least one - argument was provided to the command. As such, the list of words - generated by parseconf could actually end with the command itself. - That said, trying to access something that should not be there - doesn't seem like a good idea, so, only pass to netcmds items' - func() the list of arguments (which starts at the second item of - the list of words), if there are arguments, otherwise just pass - NULL. - * server/sstate.c: sstate: make sure ADDRANGE/DELRANGE have all the - needed parameters Since ADDRANGE and DELRANGE take 3 arguments - (, , ), we have to ensure all of them - were provided, before attempting to use them. - * drivers/dstate.c: dstate: fix dstate_delrange() socket protocol - command The documented (and used in server-side) command for - deleting a range is `DELRANGE `, not - `DELRANGE " "`, as used in - dstate_delrange(). So, fix that unused (well, at least in NUT) - function to use the correct format. Also, remove an extraneous - additional space in the command used in dstate_addrange(). - -2019-02-01 Arnaud Quette - - * configure.ac, scripts/augeas/Makefile.am: Augeas support: execute - lenses tests if possible This is however disabled for now, while - waiting to fix the reported issue Ref: - https://github.com/networkupstools/nut/issues/657 - * configure.ac: Fix wording that breaks some syntax highlighting - systems - * docs/nut-names.txt: Add the missing delayed versions of some - commands - -2019-01-30 Jean-Baptiste Boric - - * clients/nutclient.cpp, clients/nutclient.h: libnutclient: introduce - getDevicesVariableValues() (#654) A performance bottleneck was - identified within the 42ity project, where querying all variable - values from 300 ePDUs through upsd and libnutclient took 15 seconds - to complete. The new method TcpClient::getDevicesVariableValues() - allows querying device variable values in bulk, by sending all LIST - VAR commands ahead of time and then parsing all the results at - once. Throughput is vastly improved, with the mega-query completing - about 15 times faster. - -2019-01-28 Arnaud Quette - - * clients/Makefile.am, clients/nutclient.h: libnutclient: fix version - and interface * Library version should be updated to reflect - changes, and is now 1:0:0 * Interface should be adapted so that the - additional argument to instant commands can be optional - * drivers/eaton-pdu-marlin-mib.c, drivers/hpe-pdu-mib.c: snmp-ups: - support extra param for instcmd (Eaton/HPE) Add support for extra - parameter for instant commands on Eaton and HPE ePDU - * drivers/snmp-ups.c: snmp-ups: fix potential segfault when using - delayed instant commands, with a NULL default value, and not - providing a value, the driver can segfault - * docs/nut.dict: Fix spellcheck - * clients/nutclient.cpp, clients/nutclient.h, docs/net-protocol.txt: - Add support for extra parameter for instant commands Instant - commands were almost ready for supporting additional parameter. - However, it was not documented, and libnutclient was not supporting - it yet - -2019-01-24 Arnaud Quette - - * drivers/apc-ats-mib.c, drivers/apc-mib.c, drivers/apc-pdu-mib.c, - drivers/baytech-mib.c, drivers/bestpower-mib.c, drivers/compaq- - mib.c, drivers/cyberpower-mib.c, drivers/eaton-ats16-mib.c, - drivers/eaton-ats30-mib.c, drivers/eaton-pdu-genesis2-mib.c, - drivers/eaton-pdu-marlin-mib.c, drivers/eaton-pdu-pulizzi-mib.c, - drivers/eaton-pdu-revelation-mib.c, drivers/emerson-avocent-pdu- - mib.c, drivers/hpe-pdu-mib.c, drivers/ietf-mib.c, drivers/mge- - mib.c, drivers/netvision-mib.c, drivers/powerware-mib.c, - drivers/raritan-pdu-mib.c, drivers/raritan-px2-mib.c, drivers/snmp- - ups.c, drivers/snmp-ups.h, scripts/subdriver/gen-snmp-subdriver.sh: - snmp-ups: Rework instant commands handling Use snmp_info_t->dfl, - which is a char*, instead of snmp_info_t->info_len for instant - commands default value. This allows to distinguish between commands - that do not require a mandatory value. For instcmd requiring a - parameter (such as *.delay), a NULL snmp_info_t->dfl and no - extradata will result in STAT_INSTCMD_INVALID value returned Also - adapt subdrivers and gen-snmp-subdriver.sh to match this - * drivers/delta_ups-mib.c, drivers/eaton-pdu-marlin-mib.c, - drivers/huawei-mib.c, drivers/snmp-ups.c, drivers/snmp-ups.h, - drivers/xppc-mib.c, scripts/subdriver/gen-snmp-subdriver.sh: snmp- - ups: Simplify the mapping structure * snmp_info_t->setvar is not - used anymore, so drop it, * hence, also delete flag SU_FLAG_SETINT - and references to it, * adapt subdrivers and gen-snmp-subdriver.sh - to match this - -2019-01-23 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: Fix warnings (memset-elt- - size/pointer-sign) - * drivers/snmp-ups.c: snmp-ups: Actually fix commands offset (off by - 1) The last fix was wrongly setting the offset to negative, and - substracting it again from the current device number, which - resulted in an addition, not a substraction - * drivers/mge-hid.c, drivers/usbhid-ups.c: usbhid-ups / MGE: bump - versions to reflect changes - -2019-01-22 Arnaud Quette - - * drivers/mge-hid.c, drivers/usbhid-ups.c, drivers/usbhid-ups.h: - usbhid-ups: Fix erroneous OB report on Eaton UPS Also created a - read accessor on status bits and move the related definitions to - the driver header - -2019-01-22 Jean-Baptiste Boric - - * drivers/mge-xml.c, drivers/netxml-ups.c, drivers/netxml-ups.h: - netxml-ups: Report calibration status (#650) - -2019-01-22 Arnaud Quette - - * data/driver.list.in, drivers/Makefile.am, drivers/hpe-pdu-mib.c, - drivers/hpe-pdu-mib.h, drivers/snmp-ups.c: snmp-ups: Add support - for HPE ePDU - -2019-01-21 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: Improve ALARM flag handling - -2019-01-17 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: Fix ALARM flag on non-daisychained - devices - * drivers/snmp-ups.c: snmp-ups: Fix erroneous integration of hpe_pdu - * drivers/snmp-ups.c: snmp-ups: Fix commands offset (off by 1) - * drivers/snmp-ups.c: snmp-ups: Fix detection and display of hex - strings - -2019-01-11 Arnaud Quette - - * drivers/compaq-mib.c: snmp-ups: Add firmware version for new - Network card Also bump HPE/Compaq subdriver version to 1.62 - -2018-12-04 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh : note to not skip full "main" evaluation in daemon - mode - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh : support SIGHUP causing a quick reconfig when - received both during the sleep and processing in-progress - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh : avoid continuous reconfiguration (esp. in daemon - mode) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : for many discovered changes, avoid the lag of - running systemctl daemon-reload for every item in the loop - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : in single-run, daemon and full-reconfig modes, - take note if the config file had changed while we were running - - re-sync services vs sections ASAP then - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : introduce calc_md5_file() and comment calc_md5() - a bit better - -2018-12-07 Scott Shambarger - - * clients/upsmon.c, clients/upssched.c, common/parseconf.c: Add - FD_CLOEXEC flag to config files, pipes and sockets File - descriptors are leaking to processes spawned by upsmod and - upssched, leading to SELinux errors when (for example) sendmail - attempts to read from fd #4. - -2018-12-01 mjan - - * drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_hunnox.c, drivers/nutdrv_qx_hunnox.h: Add support - for Hunnox HNX-850 - -2018-11-19 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : critical typo fix (Environment is valid in - section Service, not Unit) - -2018-11-16 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : refactor upsconf_getSection_content() to have - one place of logic to add the parsed section line - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test--ups.conf, tests/nut-driver-enumerator-test.sh: - nut-driver-enumerator.sh.in : section-name brackets should contain - a single token and not be inside another string - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : refactor upslist_normalizeFile_filter() into a - more readable standalone routine - -2018-11-13 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : update the list of config factors that mean an - USB nutdrv_qx device - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test.sh: nut-driver-enumerator-test.sh / nut-driver- - enumerator-test--ups.conf / nut-driver-enumerator.sh.in : extend - upsconf_getValue() to query for several values in the same call to - more efficiently check if any key/flag is set - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test--ups.conf, tests/nut-driver-enumerator-test.sh: - nut-driver-enumerator-test.sh / nut-driver-enumerator-test-- - ups.conf / nut-driver-enumerator.sh.in : do not ignore driver flags - followed by a comment - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : fix \t into TABCHAR - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : show the expected vs actual diff in any shell interpreter - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : add a disclaimer about config parser (probable - non-)conformity to NUT binary definitions - * tests/nut-driver-enumerator-test--ups.conf: nut-driver-enumerator- - test--ups.conf : test a section with indented name - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test--ups.conf, tests/nut-driver-enumerator-test.sh: - nut-driver-enumerator-test.sh / nut-driver-enumerator-test-- - ups.conf / nut-driver-enumerator.sh.in : in section-name lines, - ignore anything outside the first set of brackets - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : show a diff of expected vs actual, if the shell allows in-place - docs - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : suggest to a dev how to re-run the failed test verbosely - -2018-11-05 Jim Klimov - - * tools/Makefile.am, tools/nut-scanner/Makefile.am: tools/ Makefiles - : refactor with clarifications from DMF branch (#636) - -2018-11-04 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : fix svcprop queries to base service level - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : consider "unknown" systemd unit state as one to - be restarted - * scripts/upsdrvsvcctl/upsdrvsvcctl.in: upsdrvsvcctl.in : fix -D for - debugging level - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test--ups.conf, tests/nut-driver-enumerator-test.sh: - nut-driver-enumerator-test.sh / nut-driver-enumerator.sh.in : - support USB and Serial modes for nutdrv_qx - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : track changes of global config and restart - drivers and nut-server if that happened - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test.sh: nut-driver-enumerator-test.sh / nut-driver- - enumerator.sh.in : in upslist_debug() show also the global config - section - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in, tests/nut-driver- - enumerator-test--ups.conf, tests/nut-driver-enumerator-test.sh: - nut-driver-enumerator-test.sh / nut-driver-enumerator.sh.in : - support flag values (line is a single token) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : do not use an "other" section as a magic value - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : "break" the loop, not return from it (artefact - of moving code from a sub-shell) - -2018-11-01 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh : Use a timeout to restart/reload nut-server - (systemd) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh : Do not restart/reload nut-server if not already - running (systemd) - -2018-10-22 Robert W. Cashman - - * drivers/cyberpower-mib.c: Added UPS load, battery charge, input - voltage/frequency, and output voltage, MIB mappings to cyberpower- - mib.c - -2018-10-12 Jim Klimov - - * .travis.yml: .travis.yml : move nut-driver-enumerator-test jobs - lower in stack - we want slow jobs to start first - * .travis.yml: .travis.yml : matrix job seems to require having at - least two items - -2018-10-11 Jim Klimov - - * tests/nut-driver-enumerator-test.sh: Update nut-driver-enumerator- - test.sh Standardize the testing setup - -2018-10-11 Jim Klimov - - * builds/nut-driver-enumerator-test/ci_build.sh: builds/nut-driver- - enumerator-test/ci_build.sh : use the "selftest" dummy service - framework if systemd is not available in the testing OS environment - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : support a "selftest" dummy service framework - * builds/nut-driver-enumerator-test/ci_build.sh: builds/nut-driver- - enumerator-test/ci_build.sh : let the tests have some - SERVICE_FRAMEWORK - * tests/nut-driver-enumerator-test.sh: tests/nut-driver-enumerator- - test.sh : update envvar processing - * builds/nut-driver-enumerator-test/ci_build.sh: builds/nut-driver- - enumerator-test/ci_build.sh : export BUILDDIR SRCDIR for the test - script - * builds/nut-driver-enumerator-test/ci_build.sh: builds/nut-driver- - enumerator-test/ci_build.sh : debug the testing script itself - * .travis.yml, builds/nut-driver-enumerator-test/ci_build.sh, - tests/nut-driver-enumerator-test.sh: Problem: nut-driver-enumerator - not Travised Solution: Add call to its selftest - -2018-10-10 Jim Klimov - - * docs/nut.dict: nut.dict : add components of --show-all-configs - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : echo if there is nothing to reconfigure (add - timestamp, do not spam in daemonized loop by default) - * scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in: - Solaris preremove.in postinstall.in : pass the last-active nut- - driver-enumerator instance across package upgrades done over a - short timeframe - * scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in: - Solaris preremove.in postinstall.in : less spam from "svcadm clear" - of not-failed services - * scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in: - Solaris preremove.in postinstall.in : support the multi-instance - nut-driver-enumerator service now - * tests/Makefile.am: tests/Makefile.am : EXTRA_DIST the new nut- - driver-enumerator-test script and config - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : echo if there is nothing to reconfigure (early - on or after the loop has done some changes) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : update comments regarding SMF service instance - wrapping - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : test for changed sections before testing for - changed set of section vs service names - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : small sanity check in - upslist_checksums_unchanged() - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : update comments regarding new support for - detection of changed device section contents - * scripts/upsdrvsvcctl/upsdrvsvcctl.in: upsdrvsvcctl.in : SMF service - management should wait for completion, to be same as systemd - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : optimize loop work - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : basic support for detecting changes in ups.conf - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : commented a couple of FIXMEs illustrated by the test expected - data - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : call testcase_upslist_debug() last in the suite - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : store SECTION_CONTENT in a variable and spit it - out once - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : update tests for only trimming whitespace around first "=" - character - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : refer to systemd unit via SVCINST not $1 when - registering - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : update comments - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : drop unneeded assignment in calc_md5() - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : in upslist_normalizeFile() only trim whitespace - around first "=" character (do not touch subsequent ones in value - part) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : optimize upsconf_getValue() since we use pre- - normalized data - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : add DEBUG=trace - * tests/nut-driver-enumerator-test--ups.conf, tests/nut-driver- - enumerator-test.sh: nut-driver-enumerator-test.sh : add a test case - for dummy-ups proxying to a localhost "remote" device; add examples - of quoted key values with spaces - -2018-10-09 Jim Klimov - - * tests/nut-driver-enumerator-test--ups.conf, tests/nut-driver- - enumerator-test.sh: nut-driver-enumerator-test.sh : add a test case - for querying global config pseudo-section - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : support getting global config values (when - device section value is empty) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : zsh not supported - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : add a test case for config value that was quoted - * tests/nut-driver-enumerator-test.sh: nut-driver-enumerator-test.sh - : control values of section and device name checksums in - upsconf_debug() - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : expose section and device name checksums in - upsconf_debug() - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : introduce upsconf_getSection_MD5() to checksum - the normalized payload of a config section - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : in --reconfigure should exit() not return() - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : in systemd_validFullUnitName() add the .service - suffix if needed - * tests/.gitignore, tests/nut-driver-enumerator-test--ups.conf, - tests/nut-driver-enumerator-test.sh: Introduce simple unit tests - for nut-driver-enumerator.sh - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : expose upsconf_debug() and upslist_debug() to - CLI - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : avoid direct exit during loop processing - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : use a variable SYSTEMD_CONFPATH - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : use UPSCONF_DATA_SDP and rearrange getSection() - routines for certain use-cases - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : use upslist_readFile_once() in command-line - tools to avoid re-parsing the config many times - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : use cached UPSCONF_DATA in upsconf_getSection() - rather than FS access every time - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : rearrange and document the initial slurping and - normalization of ups.conf, reducing the work done - * docs/man/nut-driver-enumerator.txt, scripts/upsdrvsvcctl/nut- - driver-enumerator.sh.in, scripts/upsdrvsvcctl/upsdrvsvcctl.in: nut- - driver-enumerator.sh.in : add --show-configs to expose UPSCONF_DATA - with normalized content of ups.conf - -2018-10-05 Jim Klimov - - * scripts/upsdrvsvcctl/upsdrvsvcctl.in: upsdrvsvcctl.in : add - "reconf(igure)" call to pass into nut-driver-enumerator.sh - * scripts/upsdrvsvcctl/upsdrvsvcctl.in: upsdrvsvcctl.in : update - usage() - * docs/man/nut-driver-enumerator.txt, scripts/upsdrvsvcctl/nut- - driver-enumerator.sh.in: nut-driver-enumerator.txt : make - spellchecker happy - * scripts/Solaris/postinstall.in: solaris postinstall : - REPORT_RESTART_42=no when reconfiguring - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : update message for reconfig dropping of old - service - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : fix fall-through daemonization for DASH - * scripts/Solaris/README: Solaris README : update about two nut- - driver-enumerator instances - * docs/man/nut-driver-enumerator.txt: nut-driver-enumerator.txt : add - recently introduced options into manpage - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : typo fix - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : typo fix - * scripts/Solaris/nut-driver-enumerator.xml.in: nut-driver- - enumerator.xml.in : support daemonization into background (contract - service) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : support daemonization into background - * scripts/Solaris/nut-driver-enumerator.xml.in: nut-driver- - enumerator.xml.in : typo fix - * scripts/Solaris/nut-driver-enumerator.xml.in: nut-driver- - enumerator.xml.in : avoid creating default service twice - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : support SIGHUP for the daemon - * scripts/Solaris/README, scripts/Solaris/nut-driver- - enumerator.xml.in: nut-driver-enumerator : use --daemon(=freq) in - Solaris SMF service, implement it as an option (two prepackaged - services, with and without loop) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator : add --daemon(=freq) to monitor ups.conf vs. services - changes ourselves in a loop - * scripts/Solaris/postinstall.in: nut-driver-enumerator : use - --reconfigure to remake units from scratch in Solaris postinstall - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator : add --reconfigure to remake units from scratch - -2018-10-04 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : for network-depending connections, wait for - ifplugd to set up physical network, if enabled - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : for network-depending connections, wait for DNS - resolver to appear - * scripts/systemd/nut-driver-enumerator.service.in: nut-driver- - enumerator.service.in : do NOT remain active when done, allow nut- - driver-enumerator.path to start this again - * scripts/Solaris/README: Solaris README : note that there is no - dynamic refresh when ups.conf is changed - * scripts/Solaris/README: Solaris README : update reference to - upsdrvsvcctl directory - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : when removing a systemd instance, also remove - systemd complaints about it (if any) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : less ambiguity - manage ".service" instances as - such - -2018-10-03 Jim Klimov - - * common/common.c: get_libname() : support more 64-bit pathname - patterns (#609) - -2018-09-08 Jim Klimov - - * drivers/usbhid-ups.c: usbhid-ups.c : libusb/libshut tracing debug - text - -2018-10-02 Jim Klimov - - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : in systemd use-case, fall back to rude restart - if reload-or-restart of nut-server stalled and failed - -2018-09-28 Jim Klimov - - * scripts/systemd/nutshutdown.in: Update nutshutdown.in No strict - restrictions for fallback timeout - -2018-09-27 Jim Klimov - - * scripts/Solaris/nut-server.xml.in, scripts/Solaris/svc-nut- - server.in, scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut- - driver-enumerator.sh.in / nut-server.xml.in / svc-nut-server.in : - reload the running upsd instead of restarting it fully when - possible (Solaris SMF) - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : reload the running upsd instead of restarting it - fully when possible (Linux SystemD) - -2018-09-26 Jim Klimov - - * scripts/systemd/nut-driver-enumerator.path.in: nut-driver- - enumerator.path.in : typo fix for CONFDIR => CONFPATH - * docs/man/Makefile.am: docs/man/Makefile.am : handle other - nutclient*.3 manpages that are mass-implemented by some - libnutclient*.txt - * scripts/systemd/nutshutdown.in: nutshutdown.in : fallback short - timeout if config is absent or not parsable - * scripts/systemd/nutshutdown.in: nutshutdown.in : check that needed - programs exist first - -2018-09-19 Jim Klimov - - * configure.ac: configure.ac : syntactic sugar - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - reformatted - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - also the values registered - with comm_driver structure - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - reformatted - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - also the values registered - with comm_driver structure - * drivers/usbhid-ups.c: usbhid-ups.c : report the libusb version - involved in the driver at this time - * tools/Makefile.am, tools/nut-scanner/Makefile.am: Update comments - in tools(/nut-scanner)/Makefile.am regarding new more proper - dependency definitions - -2018-09-17 Daniele Pezzini - - * data/driver.list.in: HCL: update support level of some Meta System - devices As per the provided protocol: see nut-website's - 66d30c90401ff7929b25e5a87f9299b728f861ea - -2018-09-08 Jim Klimov - - * tools/Makefile.am: tools/Makefile.am : GENERATED_USB_FILES also - depend on nutdrv_qx.c - * tools/Makefile.am: tools/Makefile.am : generalize - GENERATED_SNMP_FILES too for consistency - * tools/Makefile.am: Makefile.am : fix back calling scripts from - distdir while being in builddir - -2018-09-07 Jim Klimov - - * tools/Makefile.am, tools/nut-snmpinfo.py, tools/nut-usbinfo.pl: - tools/nut-snmpinfo.py tools/nut-usbinfo.pl tools/Makefile : use - TOP_SRCDIR/TOP_BUILDDIR to pass with distcheck too - -2018-09-08 Jim Klimov - - * scripts/Solaris/postinstall.in: Solaris/postinstall.in : clarify - tests for present vs non-empty config files - * scripts/Solaris/postinstall.in, scripts/Solaris/postremove.in, - scripts/Solaris/preinstall.in, scripts/Solaris/preremove.in: Insert - or update header comments in Solaris pre/post-install/remove - scripts - -2018-09-07 Jim Klimov - - * tools/Makefile.am: tools/Makefile.am : update dependency on C - sources - * Makefile.am: Makefile.am : "dist" drivers/*.c before tools (which - generates further files from that) - * drivers/libusb0.c, drivers/libusb1.c: libusb0/1.c : ease debugging - by trace messages - * drivers/libusb1.c: libusb1.c : inverted order of - usb_communication_subdriver_t name/ver fields - * drivers/libusb0.c: libusb.c : inverted order of - usb_communication_subdriver_t name/ver fields - * configure.ac: configure.ac : syntactic sugar - * drivers/libusb.c: libusb.c : inverted order of - usb_communication_subdriver_t name/ver fields - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : fix initial setup with 0 service instances - present - * scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in: nut-driver- - enumerator.sh.in : try to enable "nut-server" when restarting it - * tools/Makefile.am: tools/Makefile.am : avoid rebuilding generated - files after "make dist" over and over - * tools/nut-scanner/Makefile.am: tools/nut-scanner/Makefile.am : - structurally arrange built dependencies, reduce hardcoded - references to their names - -2018-09-06 Jim Klimov - - * drivers/libshut.c, drivers/libusb.c, drivers/usbhid-ups.c: libusb - tracing debug text - -2018-09-06 Daniele Pezzini - - * data/driver.list.in: HCL: add some Legrand devices supported by - nutdrv_qx Also, specify that Legrand Multiplug is USB-only. - * data/driver.list.in: HCL: update support level of some Meta System - devices As per the provided protocol: see nut-website's - 570c1e5e9f1fb4f82abef9359897b5159e88fc50 Also, fix name of "HF Line - /2". - -2018-09-06 Gabriele Taormina - - * drivers/metasys.c: metasys: retrieve also battery charge and - runtime The added command is only supported by devices with an 'id - code' >= 14, while for other, older, models the command is not - enabled by default, and the user has to perform a specific - procedure via serial to enable it (where supported). - -2018-09-05 Daniele Pezzini - - * drivers/metasys.c: metasys: remove useless initialisation of vars - -2018-08-27 Gabriele Taormina - - * data/driver.list.in, drivers/metasys.c: metasys: support some newer - Meta System and Legrand devices Add to the metasys driver a few - new models (Meta System DHEA, and others now branded Legrand) - speaking the Meta System UPS protocol. - * drivers/metasys.c: metasys: treat any '\0' in the serial number as - a '0' - * drivers/metasys.c: metasys: for bypass mode, call status_set() with - "BYPASS", not "BY" - * drivers/metasys.c: metasys: fix handling of errors/special values - As per protocol documentation, data is sent by the device with - unsigned integers of 8, 16 or 32 bits, with errors/special values - being: - for uint16: 0xFFFF and 0xFFFE, - for uint32: 0xFFFFFFFF. - Alas, those values are (and, probably, have always been) actually - reported in the documentation (mostly) as if their types were not - unsigned (so, in decimal: -1, and -2) and the metasys driver used - them like that, converting the values to non-fixed width signed - types (int and long) and then expecting a value of -1 or -2 to - signal a particular event, but this only happens on platforms where - int is exactly 16 bits, and long 32 bits. So, leave values as - unsigned types (adjusting all the printf formats accordingly), and - use the right hex values, instead. - * data/driver.list.in, drivers/Makefile.am, drivers/legrand-hid.c, - drivers/legrand-hid.h, drivers/usbhid-ups.c: usbhid-ups: add - Legrand subdriver - * data/driver.list.in, drivers/nutdrv_qx.c: nutdrv_qx: add support - for some Legrand USB devices - -2018-08-29 Jim Klimov - - * scripts/systemd/Makefile.am: EXTRA_DIST scripts/systemd/nut.target - also - -2018-08-21 Jim Klimov - - * m4/nut_check_libneon.m4: nut_check_libneon.m4 : shell typo fix - * m4/nut_check_libneon.m4: nut_check_libneon.m4 : do not AC_MSG_WARN - inside a standard message chain - * m4/nut_check_libneon.m4: nut_check_libneon.m4 : provide fallback - defaults when pkg-config fails - -2018-08-14 Jim Klimov - - * m4/nut_check_libneon.m4: nut_check_libneon.m4 : comment about - detecting without pkgconfig as a fallback - * m4/nut_check_libavahi.m4: nut_check_libavahi.m4 : typo fix - -2018-08-19 Daniele Pezzini - - * configure.ac: configure: fix messages of pkg-config checks The - PKG_*() macros we use there already print messages, therefore we - can't use AC_MSG_CHECKING() before calling them, and - AC_MSG_RESULT() after, or we will get something like: checking for - autoconf macro support of pkg-config... checking for pkg-config... - /usr/bin/pkg-config ^^^ AC_MSG_CHECKING() - ^^^ PKG_*() macro output checking pkg-config is at least version - 0.9.0... yes ^^^ PKG_*() macro output -- continuation ok ^^^ - AC_MSG_RESULT() checking for autoconf macro support of pkg-config - module checker... checking for dummy_PKG_CONFIG... yes ^^^ - AC_MSG_CHECKING() ^^^ - PKG_*() macro output ok ^^^ AC_MSG_RESULT() ...which is not - exactly desirable. So, move the messages to AC_MSG_NOTICE(), with - the result being explicitly printed only on failure (AC_MSG_WARN() - call). - * docs/man/Makefile.am: docs/man: fix man8 target for linux/i2c - * docs/man/Makefile.am, drivers/Makefile.am: nutdrv_qx: don't - duplicate make targets Since nutdrv_qx is both a serial and a USB - driver, up until now, its executable and manpages appeared in two - lists: serial and USB drivers, in order to be built in both cases, - when ./configure'd for only one of them... but, by doing this, when - ./configure'd for both, we ended up with dupes, which could - potentially cause problems, e.g. when installing them (and this - just happened). For the executable, luckily, libtool calls install - one file at a time, so this was not, and it still should not be, a - problem. For the manpages, we were previously saved by automake, - which splits the list of files to be installed in different calls - if they are too many (see automake's am__install_max var, currently - set to 40), so the two nutdrv_qx entries ended up in different - calls to install, but the 8b75b03 commit, by adding more manpages - before nutdrv_qx's ones, pushed also the first occurrence to the - second call to install, which already contained the other one, - causing an error. While other alternative, more flexible, but also - less portable, ways for solving this exist (e.g. using GNU make's - $(sort) on the generated lists), at least for now, prefer a more - portable solution, adding new intermediate lists for serial/USB - drivers and using simple automake conditionals. Close - https://github.com/networkupstools/nut/issues/594 - -2018-08-14 Jim Klimov - - * .gitignore, Makefile.am, README, common/Makefile.am, configure.ac, - docs/FAQ.txt, docs/config-notes.txt, docs/developers.txt, - docs/features.txt, docs/man/Makefile.am, docs/man/index.txt, - docs/man/nut-driver-enumerator.txt, docs/man/upsdrvctl.txt, - docs/man/upsdrvsvcctl.txt, docs/net-protocol.txt, docs/nut.dict, - include/Makefile.am, scripts/Aix/.gitignore, scripts/Aix/nut.init, - scripts/Aix/nut.init.in, scripts/Makefile.am, - scripts/Solaris/.gitignore, scripts/Solaris/Makefile.am, - scripts/Solaris/README, scripts/Solaris/makelocal.sh, - scripts/Solaris/nut-driver-enumerator.xml.in, scripts/Solaris/nut- - driver.xml.in, scripts/Solaris/nut-monitor.xml.in, - scripts/Solaris/nut-server.xml.in, scripts/Solaris/nut.in, - scripts/Solaris/nut.xml.in, scripts/Solaris/pkginfo.in, - scripts/Solaris/postinstall.in, scripts/Solaris/postremove, - scripts/Solaris/postremove.in, scripts/Solaris/preinstall, - scripts/Solaris/preinstall.in, scripts/Solaris/prepackage.py, - scripts/Solaris/{preproto.pl => preproto.pl.in}, - scripts/Solaris/preremove.in, scripts/Solaris/svc-nut-monitor.in, - scripts/Solaris/svc-nut-server.in, scripts/systemd/.gitignore, - scripts/systemd/Makefile.am, scripts/systemd/README, - scripts/systemd/nut-driver-enumerator.path.in, scripts/systemd/nut- - driver-enumerator.service.in, scripts/systemd/nut- - driver.service.in, scripts/systemd/nut-driver.target, - scripts/systemd/nut-driver@.service.in, scripts/systemd/nut- - monitor.service.in, scripts/systemd/nut-server.service.in, - scripts/systemd/nut.target, scripts/systemd/nutshutdown.in, - scripts/upsdrvsvcctl/.gitignore, scripts/upsdrvsvcctl/Makefile.am, - scripts/upsdrvsvcctl/README, scripts/upsdrvsvcctl/nut-driver- - enumerator.sh.in, scripts/upsdrvsvcctl/upsdrvsvcctl.in: Use target - for drivers in Linux systemd (updated) and SMF instances for - drivers in new Solaris-like systems (and bring AIX initscript into - better shape) (#330) * Use target for drivers in systemd This - allows much better granularity and better monitoring in case of - multiple UPSes. * nut-driver.target improvements suggested by - @peterhoeg in PR#229 * systemd units dependencies revised and - commented * nut-driver-enumerator.sh initial commit * nut- - driver@.service.in : integrate comments from @peterhoeg about - extending unit requirements * WIP : initial integration of nut- - driver-enumerator.sh/service into makefiles etc. * nut-driver- - enumerator.sh renamed into nut-driver-enumerator.sh.in as it has - processable templates in code * nut-driver-enumerator.sh.in : add - its own config-file support to set the variables used inside (if - not via command-line env) * nut-driver-enumerator.sh.in : fix up - the copyright header * Subject: Fix systemd service file for - Debian From: Laurent Bigonville Forwarded: not- - needed * nut-driver-enumerator.sh.in : complete the Solaris SMF - support in the helper script * EXTRA_DIST the scripts/systemd/nut- - driver.target (non-templated) file * nut-driver-enumerator.sh.in : - updated comments (esp. about usage and exit-codes) and runtime - messages * nut-driver-enumerator.service.in : define an actual - service payload * nut-driver-enumerator.sh.in : refactor the logic - of MAIN PROGRAM into smaller routines for readability * nut- - driver-enumerator.sh.in : introduce routines to help define custom - dependencies of particular drivers on other services * nut-driver- - enumerator.sh.in : allow custom NUT_CONF_DIR from envvar, to - facilitate testing * nut-server.service.in : typo fix in comments - * nut-driver-enumerator.sh.in : support the concept of localhost - networking dependencies, and define vars with lists of services to - depend on * nut-driver-enumerator.sh.in : use proper FMRI:instance - separator for SMF * nut-driver-enumerator.sh.in : added variables - for dependency type on third-party service units * nut-driver- - enumerator.sh.in : change upsconf_getDriverMedia() output from tab- - separated to multiline; add upsconf_getMedia() and upsconf_debug() - and upslist_debug() * nut-driver-enumerator.sh.in : refactor with - upsconf_getValue() and cached pre-cooked ups.conf data; - infrastructure to configure service dependencies when adding the - service instance * Remove hardcoded dependencies on udev and - network from provided systemd units; add comments about extending - via drop-in files and that nut-driver-enumerator will do this for - nut-drivers * nutshutdown.in : mark executable * nut-driver- - enumerator.sh.in : complete the systemd drop-in support for custom - dependencies for a driver * nut-driver-enumerator.sh.in : complete - the SMF drop-in support for custom dependencies for a driver * - nut-driver-enumerator.sh.in : comment-away upslist_debug() in - default runs * WIP Adding Solaris SMF manifests for NUT * - Sanitize Solaris SVR4 packaging rules * Sanitize Solaris packaging - scripts some more * Add configure options for Solaris packaging - variants * Sanitize Solaris packaging scripts some more - consider - DESTDIR for installation root * Turn solaris preproto.pl into a - template so it uses proper (configured) user/group strings * - Makefile.am : ensure there is a DESTDIR set before packaging * - Makefile.am : use $(MAKE) $(AM_MAKEFLAGS) instead of explicit - "make" (mostly in packaging recipe) * makelocal.sh : commented and - revised * Solaris/Makefile.am : put generated SVR4 package into - builddir (not srcdir that may be readonly) to match other OS - recipes * Makefile.am : ensure the DESTDIR is used for packaging - purposes (when calling sub-makes) * Solaris/pkginfo.in : ARCH is - CPU_TYPE, not OS_NAME * GitIgnore built Solaris/NUT*.local.gz - product * GitIgnore built systemd files * GitIgnore - _install_pkgprotodir * Makefile.am : ensure only the custom - DESTDIR is used for packaging purposes * Makefile.am : convert the - big packaging "if" into "case"; link steps with "&&"; retain - DESTDIR if Solaris packaging fails; ensure the correct custom - DESTDIR is absent before packaging (and after Solaris packaging) * - Solaris/Makefile.am : Revise recipe-names and comments for Solaris - packaging variants * Solaris/Makefile.am and *.xml.in : relocate - SMF methods and manifests under NUT DATADIR to package compactly * - Solaris-SMF : svc-nut.in svc-nut-client.in : use @RUN_AS_*@ and - @PIDPATH@ vars instead of hardcoding * Solaris/Makefile.am : list - helper scripts and installation scripts and data in variables and - depend on them in packaging; chmod +x the scripts after copying - over to proto area * GitIgnore config.cache * Remove - Solaris/prepackage.py (unreferenced duplicate of precheck.py) * - Solaris/nut.in : sanitize the default init-script * - Solaris/Makefile.am : put init-scripts under NUT share (DATADIR) to - package it compactly; copy to OS dirs in postinstall * Makefile.am - .gitignore etc. relocate successfully built package files to - abs_top_builddir * Change Aix/nut.init to a .in template * svc- - nut.in svc-nut-client.in : consider nut.conf if available * - Solaris/Makefile.am and SVR4 scripts : install augeas lenses as - part of NUT package (in DATADIR at least) * configure.ac : comment - about sysconfdir for NUT * Sanitize Aix/nut.init.in * More - standardization of Solaris initscripts and SMF methods; use - LD_LIBRARY_PATH to prefer NUT provided libs in case of conflicts - (facilitate bundling with third-party packages) * - Solaris/Makefile.am : add ability to "make check" something here, - e.g. validate manifest XMLs * Solaris SMF XML manifests : fix - "dependent" definitions, and add dependencies on required config - files * configure.ac : fix a manually crafted "Checking for" into - using AC_MSG routines * Solaris SVR4 packaging should now take - care of SMF service registration/teardown * Solaris preremove.in - postinstall.in : Usage of @datadir@ caused "${prefix}" strings to - pop up - define the vars * Solaris scripts : use lower-cased - @datadir@ in templates processed by configure * - Solaris/preremove.in : fix FMRI pattern when removing package * - Solaris/postinstall.in : fix SMF manifest dir * - Solaris/postremove.in : fix verbose RM; wipe the /var/run/nut dir - too * Solaris/preremove.in : fix commands when removing package * - Solaris/postinstall.in : enable SMF services if configs are already - available (esp. create nut-driver instances) * - Solaris/preremove.in : fix commands when removing package * - Solaris/postinstall.in : enable SMF services if configs are already - available (esp. create nut-driver instances) - verbosity * - Solaris/nut-driver-enumerator.xml.in : use a unique dependency name - (avoid conflict in nut-driver instances chain of deps) * systemd - and Solaris : fix up embedded ${prefix} in service files and SMF - manifests after generation * systemd/README : add recent authors - * Define a NUT_DATADIR and NUT_LIBEXECDIR with expanded path values - to use in service manifests * Solaris : packaged service - addition/removal more verbose * nut-driver-enumerator.xml.in nut- - driver.xml.in : do not block startup of nut server * nut.xml.in : - do not block startup of nut server due to failed nut-driver- - enumerator * nut-driver-enumerator.sh.in : improve portability by - using TAB char as is (not regex \t which gets misinterpreted by - some tools) * nut-driver-enumerator.sh.in : comment the caveats * - nut-driver-enumerator.sh.in : apcsmart is serial only * nut- - driver-enumerator.sh.in : By default, update wrapping of devices - into services... but keep the door open to other uses of the script - * nut-driver-enumerator.sh.in : refactor a bit and add externally - callable actions * Introduce upsdrvsvcctl with semantics similar - to upsdrvctl, but managing stop/start of SMF or systemd unit - instances * nut-driver-enumerator.sh.in : consider possible - difference of device and service instance names * nut-driver- - enumerator.sh.in : refactor md5 * nut-driver-enumerator.xml.in : - add REFRESH action and do not die on RESTART * Mention nut-driver- - enumerator and upsdrvsvcctl in (systemd/|Solaris/)README * - upsdrvsvcctl.in : updated comments * upsdrvsvcctl.in : added a - resync option * Rename Solaris SMF services to match systemd - patterns and ease life for sysadmins * Add systemd nut.target to - manage the bundle of NUT services * config-notes.txt : document - the systemd and SMF support in NUT * nut.dict : update - spellchecker * Solaris/Makefile.am : support copying where attrs - can not be preserved * Solaris postinstall : report if services - were not instantly enabled due to missing config files * - upsdrvsvcctl.in : reformat prettily * nut-driver-enumerator.sh.in - : wrap usage() * nut-driver-enumerator.sh.in : added --list- - services-for-devices * nut-driver@.service.in : comment about - aligning timeouts with ups.conf maxstartdelay * nut.xml.in : - Revise comments * nut-driver-enumerator.sh.in : when amending - service unit instance config for systemd, update the Description to - state the NUT device section name * nut-driver-enumerator.sh.in : - support common NUT_CONFPATH envvar * Add upsdrvsvcctl.txt manpage - and references to upsdrvsvcctl in other docs * upsdrvsvcctl.txt - manpage : refer to service management system logs * upsdrvsvcctl : - support "list upsname" CLI action to help troubleshooting * - upsdrvsvcctl : add handling for "shutdown" command * Docs about - upsdrvsvcctl - clarify that it may not be preinstalled with non- - SMF/non-systemd OS packages * Pass spellcheck for upsdrvsvcctl doc - updates * Solaris packaging of nut-driver-enumerator.sh : deliver - into libexecdir same as in Linux * Move nut-driver- - enumerator.sh.in and upsdrvsvcctl.in into scripts/upsdrvsvcctl to - share on par between Linux and Solaris (for starters) * Use - @NUT_LIBEXECDIR@ for nut-driver-enumerator.sh * Introduce nut- - driver-enumerator.path.in for systemd * nut-driver- - enumerator.service.in : be part of nut.target, not common multi- - user * Systemd services : be PartOf=nut.target to propagate - service stops * postinstall.in : use NUT_DATADIR * nut- - monitor.xml.in : depend on nut-server (if locally running) * - nut.xml.in : fix path (use pre-eval-ed version) * nut-driver- - enumerator.sh.in : add a way to print out just an instance suffix - name * nut-driver-enumerator.sh.in : when printing full instance - name, do not add stuff if the argument is already a full name * - nut-driver-enumerator.sh.in : implement --get-device-for-service * - nut-driver (systemd/SMF) : use "nut-driver-enumerator.sh --get- - device-for-service" for current service instance name * nut.xml.in - : this service is transient * upsdrvsvcctl.in : fix parameter - passing * upsdrvsvcctl.in : "clear" the SMF service state when - stopping/starting, just in case it was failed * nut-driver- - enumerator.sh.in : restart upsd IFF the set of known-device - mappings was changed * Revise and relax some dependencies for - Solaris SMF services * nut-driver-enumerator.sh.in : info messages - go to stderr; reply for request only goes to stdout * nut-driver- - enumerator.sh.in : complete the upslist_equals() method * - nut.xml.in : never fail on stop (if component services did not - stop, it is their problem) * Solaris preremove.in SMF : clear - sevices before stopping them, just in case * upsdrvsvcctl.in : - post-process clearing of SMF service instances if any have failed - * nut.xml.in : never fail on stop (if component services did not - stop, it is their problem) * Solaris preremove.in SMF : remove nut - before services it depends on * main.c upsdrvctl.c : make debug - messages a bit more useful * Solaris preremove.in SMF : do not - block stopping NUT driver services, but follow up with - upsdrv(svc)ctl stop of everything * Solaris preremove.in SMF : - sleep after stopping drivers before removing their services * - Solaris preremove.in SMF : force-remove services of drivers * nut- - driver.xml.in : rename a dependency to avoid conflicts * Solaris - nut.xml.in : add a refresh action handler * Solaris postinstall.in - SMF : first use nut-driver-enumerator.sh.in to just register the - mappings, no autostarts * Solaris preremove.in SMF : stop drivers - with common method (and use NUT_SBINDIR) before going one by one * - Solaris postinstall.in SMF : start the drivers via upsdrvsvcctl - after registering (so the mapping is stable) * Solaris - postinstall.in preremove.in : NUT_SBINDIR => SBINDIR * Add manpage - for nut-driver-enumerator[8] * Handle EXTRA_DIST of - scripts/upsdrvsvcctl/ with their own Makefile * nut-driver- - enumerator.txt : change to be more like other page sources * - Spellcheck nut-driver-enumerator.txt * Add - scripts/upsdrvsvcctl/README * Update gitignores * List new - manpages upsdrvsvcctl nut-driver-enumerator in index * Add - upsdrvsvcctl do scripts/Makefile.am SUBDIRS * upsdrvsvcctl.in nut- - driver-enumerator.sh.in : Add a way to show configs per device * - nut-driver-enumerator.sh.in : fix upsconf_getValue() to return - success if key was found, or report an error if not * nut-driver- - enumerator.sh.in : expose upsconf_getValue() as --show-device- - config-value * nut-driver-enumerator.sh.in : NOTE on top about the - choice of simplified shell * nut-driver-enumerator.sh.in : in - upsconf_getSection() stop after printing out the section contents - * nut-driver-enumerator.sh.in : refactor upsconf_getValue() to use - upsconf_getSection() * nut-driver-enumerator.sh.in : update - comment in header * nut-driver-enumerator.service.in : do not fail - the systemd unit, it cannot restart * Fix references for - configure.in to point to configure.ac nowadays * nut-driver- - enumerator.sh.in : use fully-pathed SMF svccfg in all parts of code - consistently * nut-driver-enumerator.sh.in : comment about not- - detecting reconfigurations of existing sections currently - * docs/man/Makefile.am, scripts/subdriver/gen-snmp-subdriver.sh: - Upstream smaller fixes from 42ity NUT (#587) * gen-snmp- - subdriver.sh : replace multiline "echo" with questional tabbing by - a single-string "printf" * docs/man/Makefile.am : fix merge error - that broke manpage packaging - -2018-07-31 Daniele Pezzini - - * tools/nut-scanner/nut-scanner.c: nutscanner: get debug level early - (for nutscan_init()) and restore options (#541) * Revert "Problem: - nutscan_init() called before debug is enabled" This reverts commit - f613d45f78c96c290a1d63d4a2c3f28385d90d42. When parsing the command - line (or showing help), many options rely on a nutscan_avail_* var - already initialized by nutscan_init() -- moving that call after the - parsing of opts renders those options unavailable. * nutscanner: - parse debug level opts separately before anything else In order to - have early the value of the desired debug level (needed to - correctly debug nutscan_init()), split the parsing of command line - options into two loops: - the first one, before the call to - nutscan_init(), will only care about debug level, - the second one, - after the call to nutscan_init(), will consider the remaining (and - possibly depending on a nutscan_avail_* var already initialized by - nutscan_init()) arguments (and moan in case of errors). Closes - https://github.com/networkupstools/nut/issues/500 - -2018-07-28 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: support USB devices that don't - close their replies with a CR Since some devices, when - communicating via USB, don't close their replies to our - commands/queries with the expected (and mandated by the specs) CR, - rendering the driver almost useless as protocols get one less - character than they expect, update the various USB subdrivers - (leaving out the ones that rely on a CR to stop reading from the - device) to add the missing terminating CR in such cases (as long as - we get anything usable). This is a bit of a cheat, but, at least - for now, it will do -- not to mention the fact that it is way less - invasive than touching all the places of the driver that expect a - closing CR and all the qx2nut tables of the various protocols. - Close https://github.com/networkupstools/nut/issues/441 - -2018-07-25 mbastiaan <35669404+mbastiaan@users.noreply.github.com> - - * drivers/tripplite_usb.c: input_voltage_nominal, added case 6 - SMX500RT1U 230V requires case 6. - * drivers/tripplite_usb.c: Update tripplite_usb.c Incremented driver - version for pull request #584 - * data/driver.list.in: Update driver.list.in Added new line for - SMX500RT1U with product ID 0001. Updated line for other product IDs - -2018-07-24 mbastiaan <35669404+mbastiaan@users.noreply.github.com> - - * drivers/tripplite_usb.c: Update tripplite_usb.c Added - battery.charge status for 3005 protocol. Tested on SMX500RT1U, - charge level seems ok-ish considering how it's calculated and the - voltage jumping up and down. - -2018-06-17 Links - - * drivers/mge-hid.c: get PowerWalker VFI 2000 TGS working, read - values correctly - -2018-03-17 Steve Gilbert - - * drivers/libhid.c: In HIDGetEvents.c call to get_interrupt, increase - timeout from 250 to 750 ms to allow more time for UPS response - (cherry picked from commit 5cea18c04a79cd873347efeffb6bb869edd8643e - --@clepple) Closes: - https://github.com/networkupstools/nut/pull/543 Closes: - https://github.com/networkupstools/nut/issues/542 - -2018-05-24 Charles Lepple - - * drivers/tripplite-hid.c: usbhid-ups: Add support for - Delta/Minuteman UPS - https://github.com/networkupstools/nut/issues/555 - -2018-05-22 Jim Klimov - - * .travis.yml, ci_build.sh: Change the Travis test-case for - NO_PKG_CONFIG==true - -2018-05-18 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: Improve the SNMP subdriver - generation script Provide a 3rd mode to allow an offline creation - for a complete MIB walk. In this mode, we get data from 1 file - (numeric snmpwalk dump of the whole SNMP tree). The sysOID is - extracted from the dump, and only the pointed subtree is used. A - MIB file MUST be provided, and is used to produce the string SNMP - walk. Also reformatted the whole script using tab only, and - reconciled with the DMF version. - -2018-05-15 Bernhard M. Wiedemann - - * tools/nut-snmpinfo.py, tools/nut-usbinfo.pl: Sort input file list - (#528) so that nut builds in a reproducible way in spite of - indeterministic filesystem readdir order and - http://bugs.python.org/issue30461 See https://reproducible- - builds.org/ for why this is good. - -2018-05-02 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: in 'sgs' USB subdriver, use - #define'd value for USB timeouts - -2018-03-15 Daniele Pezzini - - * tools/nut-scanner/scan_usb.c: nutscanner: in scan_usb.c, nullify - free()'d pointers that are later reused We assign 'device_name', - 'serialnumber' and 'vendor_name' only if the analyzed device - provides that data and, since we use these pointers also to check - if those items are available so that we can store and free() them, - after free()'ing them we must make them NULL, or the next device, - if it does not provide that data, will inherit the old (now - free()'d) pointer and will attempt to access it and re-free() it. - * drivers/libusb1.c: libusb1: don't use the same var to iterate both - devices and interface descriptor From our old libusb.c, libusb1.c - inherited a for loop that iterates over the interface descriptor in - order to try and find the HID descriptor among its 'extra' bytes. - Unluckily, it uses the same var (i) that's now used, at the same - time, for the iteration through the device list, in which it - happens to be nested. Since this obviously spells disaster, make - these vars unique (and add a bit of debugging info). - -2018-03-14 Daniele Pezzini - - * data/cmdvartab, docs/nut-names.txt: libusb: update example of - driver.version.usb and add it to cmdvartab - * drivers/libusb1.c: libusb1: publish actual libusb version - * tools/nut-scanner/scan_usb.c: libusb: in nutscanner, free busname - also on nutscan_new_device() errors or when done with it - * drivers/bcmxcp_usb.c, drivers/libusb0.c, drivers/libusb1.c, - drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, tools/nut- - scanner/scan_usb.c: libusb: improve handling of errors when - allocating new memory - libusb 0.1 (when not shared with libusb - 1.0): prefer our xstrdup() function -- on errors, it'll - automatically call fatal*(), - libusb 1.0 (and nutscanner): don't - use our x{malloc,strdup,...}() functions, so that we can free the - list of devices (and close the device and call libusb_exit() in - nutscanner) before exiting. - * drivers/libusb1.c: libusb1: publish the interface we are actually - using - * drivers/richcomm_usb.c: richcomm_usb: use the local USB device - handle in usb_device_open() Although at that point of - usb_device_open(), both the local (handle) and the global (udev) - device handles point to the same thing, prefer the local one to - make things clearer. - * drivers/bcmxcp_usb.c, drivers/libusb0.c, drivers/libusb1.c, - drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c, tools/nut- - scanner/scan_usb.c: libusb: clean up after ourselves libusb 1.0: - - a device list allocated with libusb_get_device_list() must be - deallocated with a call to libusb_free_device_list(), - ditto for - the config descriptor. libusb 0.1 and 1.0: - release (commented- - out) interfaces when done with them, - remove unnecessary goto's - after calls to fatal*() functions, - nutscanner: also close the USB - device handle (and libusb_exit() for libusb 1.0) on errors. - -2018-03-13 Daniele Pezzini - - * drivers/bcmxcp_usb.c, drivers/tripplite_usb.c: usb drivers: free - USBDevice_t's dynamically allocated items when cleaning - -2018-03-13 Georg Altmann - - * docs/nut.dict: doc: update nut.dict - * INSTALL.nut: doc: Update installation instructions for FreeBSD - Details usb device permissions. Also pkg and new port config style. - -2018-03-10 Patrik Dufresne - - * drivers/powerp-txt.c: Fix tabs - * drivers/powerp-txt.c: Change status line parsing for CyberPower - OR1500LCDRTXL2U Add a new way to parse the status line in - powerpanel text driver to support CyberPower model OR1500LCDRTXL2U - with serial cable. This model doesn't provide temperature, but does - provide runtime. - -2018-03-09 Jim Klimov - - * drivers/main.c, drivers/upsdrvctl.c: main.c upsdrvctl.c : make - debug messages a bit more useful - -2018-03-05 Daniele Pezzini - - * drivers/richcomm_usb.c: richcomm_usb: don't libusb_exit() when - closing a previously opened device - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: don't libusb_exit() - when closing a previously opened device - * drivers/libusb1.c: libusb1: don't libusb_exit() when closing a - previously opened device - * drivers/riello_usb.c: riello_usb: use libusb_bulk_transfer() for - bulk operations - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: add missing 'inline' - keyword - -2018-03-04 Charles Lepple - - * drivers/usbhid-ups.c: usbhid-ups: fix instcmd logging before - fallback check The hidups_item pointer needs to be checked for - NULL before dereferencing. - -2018-02-28 Jim Klimov - - * drivers/snmp-ups.c: Fix the recently added update for Avocent - support (#532) * Problem: snmp-ups segfaults Solution: - base_snmp_template_index() prevented from processing empty argument - * Problem: index has to be counted for any device not just for - daisychain Solution: counted for both * Problem: debug info - needs improvement Solution: added * drivers/snmp-ups.c : bump - the version for public-release driver fix * snmp-ups.c : Fix - indentation for recent fixes - -2018-02-20 Bernhard M. Wiedemann - - * tools/nut-usbinfo.pl: Cleanup usbinfo code to reduce code - duplication and solve an associated FIXME - -2018-02-16 Arnaud Quette - - * data/driver.list.in, drivers/Makefile.am, drivers/emerson-avocent- - pdu-mib.c, drivers/emerson-avocent-pdu-mib.h, drivers/snmp-ups.c: - snmp-ups: Add support for Emerson Avocent PM3000 PDU - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: various - improvements This prepares the addition of newer devices - -2018-01-11 Daniele Pezzini - - * m4/nut_check_libusb.m4: autoconf: support libusb 0.1 - implementations identified as 'libusb-0.1' Make NUT_CHECK_LIBUSB - macro aware of those libusb 0.1 implementations named in their pkg- - config files as 'libusb-0.1', instead of just 'libusb' (e.g. on - FreeBSD). - -2018-01-10 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: update USB errors handling to - support both libusb 0.1 and 1.0 - -2018-01-02 Charles Lepple - - * configure.ac: Fix AC_MSG_*() quoting The autoconf quote characters - are `[` and `]` - no need for `"`. - -2018-01-01 Charles Lepple - - * m4/nut_check_libusb.m4: Add autoconf check for libusb_strerror() - Closes: https://github.com/networkupstools/nut/issues/509 - * docs/man/nutdrv_qx.txt, docs/man/snmp-ups.txt, - docs/man/ups.conf.txt, docs/man/usbhid-ups.txt: doc: Clean up - description of `pollfreq` and USB interrupts Closes: - https://github.com/networkupstools/nut/issues/476 - -2017-12-05 Jim Klimov - - * .travis.yml: .travis.yml : add a test-case for builds in absence of - pkg-config in the OS - -2017-11-29 Arnaud Quette - - * docs/configure.txt, docs/man/nutupsdrv.txt, docs/man/upsd.txt: doc: - missing documentation for NUT_* env vars Complete documentation - for upsd and drivers related to the environment variables - NUT_CONFPATH, NUT_STATEPATH and NUT_ALTPIDPATH - -2017-04-08 Sam Varshavchik - - * docs/man/Makefile.am: Fix creation of documentation from - libnutclient_misc.txt A simple .txt.3 rule doesn't understand that - libnutclient_misc.txt creates a bunch of .3. A parallel build, say - 'make -j 10' results in make trying to figure out how to build - nutclient_authenticate.3 before building libnutclient_misc.3, and - without a corresponding .txt in sight it gives up. Rebased onto - master by Charles Lepple clepple+nut@gmail.com Closes: - https://github.com/networkupstools/nut/pull/418 - -2017-11-28 Arnaud Quette - - * docs/man/usbhid-ups.txt: doc: minor formatting in usbhid-ups man - page - -2017-11-27 Arnaud Quette - - * docs/man/nutupsdrv.txt: doc: reword nutupsdrv man page Reference: - https://github.com/networkupstools/nut/issues/476 - -2017-11-27 Jim Klimov - - * tools/nut-scanner/nut-scanner.c: Problem: nutscan_init() called - before debug is enabled Solution: Move the call to this stateless - function to the point after we parse arguments and just before we'd - start the actual scans. Later this can be extended to also consider - which scans were requested and so which libs to load. Thanks to - @clepple for research in - https://github.com/networkupstools/nut/issues/500 - -2017-11-26 Charles Lepple - - * docs/man/usbhid-ups.txt: doc: reword other parts of usbhid-ups man - page - * docs/man/usbhid-ups.txt: doc: mention CPS delay quirks in usbhid- - ups man page Closes: - https://github.com/networkupstools/nut/issues/432 - * tools/nut-scanner/scan_usb.c: nut-scanner: update - usb_get_string_simple() for libusb-1.0 API Closes: - https://github.com/networkupstools/nut/issues/499 - * drivers/libusb1.c: libusb1: const-ify the USB interface number - Remove a few "magic numbers" from USB/HID-related calls. - * drivers/libusb1.c: libusb1: LBYL approach to - libusb_set_auto_detach_kernel_driver() Switch to look-before-you- - leap (LBYL) approach to calling - libusb_set_auto_detach_kernel_driver(), since FreeBSD (11.0 and - 11.1; probably others) requires root privileges to attempt the - kernel driver detach (even if no detach operation is needed). - * m4/nut_check_libusb.m4: libusb1: check for - libusb_kernel_driver_active() - -2017-11-21 Charles Lepple - - * data/driver.list.in: HCL: Change Riello IDG/IPG support level to 4 - The IDG and IPG models were not included in the protocol - documentation provided to the NUT project. Some values are also - returned as 0xFF/0xFFF/0xFFFF - see the HCL for details. Source: - http://lists.alioth.debian.org/pipermail/nut- - upsdev/2017-November/007357.html - -2017-11-17 Arnaud Quette - - * docs/man/nutupsdrv.txt, docs/man/usbhid-ups.txt: man pages: - clarification on polling parameters Explain difference between - pollfreq and pollinterval in usbhid-ups, and highlight the - pollinterval parameter use from ups.conf in nutupsdrv Closes: - https://github.com/networkupstools/nut/issues/476 - * data/driver.list.in: HCL: Eaton 9PX supported by mge-shut, usbhid- - ups and netxml-ups - * data/driver.list.in: HCL: Eaton ATS 30 supported by snmp-ups - * drivers/Makefile.am, drivers/mge-hid.c: mge-shut/usbhid-ups: - compute Output load for Eaton UPS When HID data - UPS.PowerConverter.Output.ActivePower is not present, compute a - realpower approximation using available data. This is needed for - Eaton 5E and some other units Closes: - https://github.com/networkupstools/nut/issues/484 - -2017-10-30 Michal Marek - - * Makefile.am, configure.ac, scripts/systemd/Makefile.am: - configure.ac: Fix systemd shutdown directory detection The - configure script assumes that systemd is installed below ${libdir}, - which is not true on many biarch Linux distros with /lib64. Instead - of guessing, use pkg-config to find the path and provide a --with- - systemdshutdowndir option so that make distcheck can override it. - Also, rename the internal varable to systemdshutdowndir to rhyme - with the respective systemd.pc variable. - -2017-10-20 Jim Klimov - - * configure.ac: Problem: configure fails on system without pkg-config - Solution: detect presence and usability of pkg-config program and - autotools macros (they end up as unexpanded tokens if pkg-config is - not installed), and use this knowledge to proceed with search for - libcppunit - or not. When the test is optional, we should not kill - the build if we can not make it due to missing tools. - -2017-10-11 Jim Klimov - - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : line- - breaks for readability and 80-col standard - pass 2 - * drivers/eaton-pdu-marlin-mib.c: eaton-pdu-marlin-mib.c : line- - breaks for readability and 80-col standard - -2017-10-08 Charles Lepple - - * docs/hid-subdrivers.txt: hid-subdrivers.txt: fix explore command - line Also reformat some surrounding text. Closes: - https://github.com/networkupstools/nut/issues/436 - * docs/hid-subdrivers.txt: hid-subdrivers.txt: clarify Tripp-Lite USB - reference Closes: - https://github.com/networkupstools/nut/issues/452 - * docs/man/powerpanel.txt: powerpanel: emphasize that this driver is - serial-only Apparently, the PowerPanel Plus vendor tool also has - USB support. - * docs/man/belkin.txt, docs/man/belkinunv.txt: belkin/belkinunv: add - links to man pages for other Belkin drivers - * docs/man/tripplite_usb.txt: tripplite_usb: update man page * Fix - link to tripplitesu(8) * Add 3005 protocol * Update protocol - variable name - * docs/man/dummy-ups.txt: dummy-ups: last state should be "OB LB" to - match text Also corrected a typo. - -2017-10-03 Arnaud Quette - - * docs/configure.txt: Update configure documentation for libusb - Document the possibility to override the auto-detection choice - -2017-10-04 Daniele Pezzini - - * configure.ac, m4/nut_check_libusb.m4: libusb 1.0 port: directly use - `--with-usb` to choose the library - -2017-10-03 Arnaud Quette - - * docs/configure.txt: Remove an extraneous point - * docs/configure.txt: Update configure documentation for libusb - Document the possibility to override the auto-detection choice, - even though the implementation of this override is not yet - currently working - -2017-10-02 Daniele Pezzini - - * docs/configure.txt, m4/nut_check_libusb.m4: libusb 1.0 port: - support libusb 0.1/-compat even when 1.0 is available Since libusb - 1.0 can happily coexist with libusb 0.1/libusb-compat, rework our - NUT_CHECK_LIBUSB macro so that, if both are available, libusb 1.0 - precedence can be overridden passing to `configure` appropriate - values for `--with-usb-includes` and `--with-usb-libs` (i.e. libusb - 0.1/libusb-compat-only settings). - * m4/nut_check_libusb.m4: libusb 1.0 port: expand a bit the - introductory comment of libusb ac macro - * m4/nut_check_libusb.m4: libusb 1.0 port: use only one AC_DEFINE'd - variable for libusb 0.1/-compat Libusb 0.1/libusb-compat can be - found with both pkg-config and with its own libusb-config, but, - regardless of how we found it, we need to use the same AC_DEFINE'd - variable to signal its presence. - * m4/nut_check_libusb.m4: libusb 1.0 port: don't check if libusb is - usable, if it's not available Since LIBUSB_VERSION is always non- - empty ('none', if libusb is not found), testing for non-emptiness - will always fail and libusb 0.1/libusb-compat checks will always be - performed. So, test instead that it is not 'none'. - -2017-03-22 Arnaud Quette - - * drivers/libusb1.c, drivers/nut_libusb.h, tools/nut- - scanner/scan_usb.c: Fix spacers - -2016-11-09 Charles Lepple - - * docs/nut-names.txt, drivers/libusb0.c, drivers/libusb1.c: Add - `driver.version.usb` variable Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-09-25 Charles Lepple - - * drivers/libusb1.c: libusb1: use return code from libusb_open() Per - , the handle is only populated when the return code - is 0. This fixes a crash during device detection where more than - one HID UPS is available, and the driver needs to skip the first - one. - -2016-09-02 Arnaud Quette - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/libusb1.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c: libusb 1.0 port: fix - return code for interrupt ops libusb 1.0 returns on success, the - number of bytes actually transferred or otherwise an error code, - except for interrupt transfers, where the actual transfer size is - stored in a separate variable. The libusb 1.0 implementation in NUT - thus needed to be fixed to behave the same way than the libusb 0.1 - implementation Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-31 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0 port: remove the check on USB device - count With the port to libusb 1.0, a sanity check was done on the - available number of USB devices to try. This however caused a - behavior regression, since the only device that NUT may have access - to can be the only UPS connected. In this case, the driver may exit - upon trying to reconnect if the device is transiently not available - Reference: https://github.com/networkupstools/nut/issues/300 - * drivers/libusb1.c, drivers/richcomm_usb.c: libusb 1.0 port: - complete usb_set_altinterface code usb_set_altinterface allows to - force the USB code to call `libusb_set_interface_alt_setting (0, - 0)` (equivalent to `libusb_set_altinterface(0)` in libusb 0.1), as - was done in NUT 2.7.2 and earlier. However, the libusb 1.0 - implementation was still missing the related code Reference: - https://github.com/networkupstools/nut/issues/300 - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: libusb 1.0 port: - fix kernel driver detachment Following the recent modification for - the kernel driver detachment, and the related functions - availability depending on the platforms, nutdrv_atcl_usb and - richcomm_usb were using the wrong macro for - libusb_set_auto_detach_kernel_driver and were missing the libusb - 1.0 code for explicit kernel driver detachment Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-17 Arnaud Quette - - * drivers/libusb1.c, m4/nut_check_libusb.m4: libusb 1.0 port: rework - the kernel driver detachment libusb 1.0 has introduced a new - function (libusb_set_auto_detach_kernel_driver), beside from the - explicit kernel driver detachment request - (libusb_detach_kernel_driver). However, the former is not available - on all systems. As an example, FreeBSD 10.1-10.3 does not have - this. The detachment and interface claiming has been reworked to - handle this case (reported by Charles Lepple) Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-12 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0: remove unused typesafe_control_msg() - workaround For libusb 0.1 implementation, we had to workaround a - libusb API goofs, by wrapping the base function usb_control_msg(), - and casting the variables to the right type. This is not needed for - libusb 1.0 implementation, but was wrongly left in the code - (reported by Charles Lepple) - -2016-08-11 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: fix a warning on unused variable - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: simplify bus publication - bus publication was wrongly listing both the bus and the portname, - instead of the bus only. This may have caused some issue when - trying to match the port - * drivers/usbhid-ups.c: usbhid-ups/mge-shut: forgotten version bump - * drivers/usbhid-ups.c: usbhid-ups/mge-shut: rework errno/errors - handling libusb 1.0 has its own set of return codes, and error - interface. Rework the common HID core (shared between usbhid-ups - and mge-shut) so that error handling can work with both, and using - either libusb 0.1 or 1.0 for usbhid-ups - * tools/nut-scanner/scan_usb.c: nut-scanner: missing symbols lookup - for libusb 1.0 A few symbols from libusb 1.0 were wrongly used - directly, instead of being looked up and loaded at init time - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: add missing libusb_exit() - calls - * tools/nut-scanner/nutscan-init.c, tools/nut-scanner/scan_usb.c, - tools/nut-usbinfo.pl: nut-scanner: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: Remove redundant - variable - * drivers/tripplite_usb.c: tripplite_usb: remove extraneous comment - char - * drivers/nut_libusb.h: permute typedef order of usb_dev_handle - * drivers/nutdrv_qx.c: nutdrv_qx: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/richcomm_usb.c: richcomm_usb: missing function remap for - libusb 0.1 usb_strerror was not remapped for libusb 0.1 - implementation - * drivers/tripplite_usb.c: tripplite_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/riello_usb.c: riello_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - -2016-08-10 Arnaud Quette - - * drivers/richcomm_usb.c: richcomm_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: add the missing detach - call libusb 1.0 provide its own routine for detaching kernel - driver - * drivers/Makefile.am, drivers/libhid.c, drivers/nut_libusb.h: - Forgotten occurences of libusb.h renaming NUT internal header - "libusb.h" was renamed, since it collides with the libusb 1.0 - header, which has the same name. A few occurences of reference and - documentation were however missing - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: initial port to libusb - 1.0 The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/blazer_usb.c: blazer_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/bcmxcp_usb.c: bcmxcp_usb: code cleanup - -2016-08-09 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * docs/configure.txt, drivers/Makefile.am, drivers/libhid.c, - drivers/libhid.h, drivers/{libusb.c => libusb0.c}, - drivers/libusb1.c, drivers/{libusb.h => nut_libusb.h}, drivers/usb- - common.h, drivers/usbhid-ups.c: ushid-ups: complete the port to - libusb 1.0 The port to libusb 1.0 is now complete for usbhid-ups. - Other USB drivers (bcmxcp_usb, blazer_usb, nutdrv_atcl_usb, - richcomm_usb, riello_usb, tripplite_usb, nutdrv_qx) have still to - be addressed - -2016-08-01 Arnaud Quette - - * configure.ac, m4/nut_check_libusb.m4: Initial port to libusb 1.0 - Starting with the configure checks, to detect if libusb 1.0 if - available, and otherwise fall back to the libusb 0.1 backend - -2017-09-17 Jim Klimov - - * configure.ac, tests/Makefile.am: Improve configure script and - recipe for CPPUNIT and C++11 detection * Detect C++11 support and - its use for CPPUNIT tests through configure.ac - should address - issue #472 * Report after detecting C++11 support, presence of - libcppunit, and request for valgrind, whether we'd build the - cppunit tests * Update relevant comments in configure.ac - * drivers/libusb0.c, drivers/libusb1.c: libusb0.c / libusb1.c : - report more visibly if we encountered errors accessing the device - (issue #477) - * drivers/libusb0.c, drivers/libusb1.c: libusb0.c / libusb1.c : - sanitize indentation and break up long-lines - -2017-09-21 Spiros Ioannou - - * drivers/phoenixcontact_modbus.c: phoenixcontact_modbus: fix stale - data detection Also mark driver as DRV_BETA Source: - http://lists.alioth.debian.org/pipermail/nut- - upsdev/2017-September/007331.html - -2017-09-17 Jim Klimov - - * configure.ac: configure.ac : look for CPPUNIT after detecting pkg- - config presence, can help vs. issue #478 - -2017-09-06 Jim Klimov - - * common/common.c: common.c : dflt_statepath() / altpidpath() : - support defined-but-empty envvars to have same effect as not- - defined - * common/common.c: common.c : altpidpath() : support priority of an - envvar, like statepath does - -2017-09-05 Jim Klimov - - * drivers/main.c: main.c : update usage message with hints about - running as unprivileged user - -2017-08-28 Jim Klimov - - * .travis.yml, clients/upsclient.c, drivers/dstate.h, drivers/eaton- - pdu-marlin-mib.c, tests/Makefile.am: A few small fixes for cleaner - codebase and compilations (#466) * dstate.h : use our timehead.h - to have "struct timeval" defined * eaton-marlin : cosmetic - whitespace fixes * tests/Makefile.am : cppunit should build with - C++11 * .travis.yml : make sure to use "docker" env with its - gcc-4.8+ for support of C++11 in cppunit tests - -2017-08-24 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am : fix up access rights for other - files in docs too (some PNGs end up inaccessible otherwise) - -2017-08-23 Arnaud Quette - - * docs/nut-names.txt, docs/nut.dict, drivers/eaton-ats16-mib.c: snmp- - ups: add support for input.phase.shift (#433) * snmp-ups: add - support for input.phase.shift ATS can now publish the electrical - dephasing between input sources * Make spellchecker happy about - "dephasing" - -2017-08-23 Christian Ehrhardt - - * drivers/Makefile.am: automake: only pass net-snmp cflags to snmp- - ups (#464) Other than formerly assumed in the makefile cflags can - be more than includes. And some of them need to be in sync in - regard to CFLAGS and LDFLAGS - for example usage of -fPIE. This - conflicts with a current assumption in the makefile "In any case, - CFLAGS are only -I options, so there is no harm". On a - Distribution where PIE is enabled by default, but disabled for - special cases (like net-snmp) the configure detection gets them as: - LIBNETSNMP_CFLAGS = -DNETSNMP_ENABLE_IPV6 -fno-strict-aliasing -g - -O2 -fdebug-prefix-map=/build/net-snmp-nlMQSZ/net-snmp-5.7.3+dfsg=. - -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector- - strong -Wformat -Werror=format-security -DNETSNMP_USE_INLINE - -Ulinux -Dlinux=linux -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv - -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE - -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE - -Wdate-time -D_FORTIFY_SOURCE=2 -I/usr/include LIBNETSNMP_LIBS = - -Wl,-Bsymbolic-functions -specs=/usr/share/dpkg/no-pie-link.specs - -Wl,-z,relro -Wl,-z,now -L/usr/lib/x86_64-linux-gnu -lnetsnmp - -lcrypto -lm Of importance are: -specs=/usr/share/dpkg/no-pie- - compile.specs -specs=/usr/share/dpkg/no-pie-link.specs Now when - compiling the non-snmp objects incorrectly get the - "-specs=/usr/share/dpkg/no-pie-compile.specs" due to the assumption - that it is safe to add up all CFLAGS to the global one. LDFLAGS - imported that way are only added to snmp. snmp_ups_LDADD = - $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS) [...] snmp-ups$(EXEEXT): - $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES) - $(EXTRA_snmp_ups_DEPENDENCIES) @rm -f snmp-ups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD) $(LIBS) - That leads to other (all non snmp_ups) objects in drivers failing - to build. They get the no-pie-compile.specs (incorrect) spec but - not the no-pie-link.specs on the link step. Some other parts like - mge_shut and nutdrv_qx already have custom CFLAGS/LDFLAGS that are - not added to the global CFLAGS. So despite the commend in the - makefile this doesn't seem to be new in general to nut. I don't - want to mess too much with your build system for now as I don't - know many of its implications. So I chose not the full drop of that - global CFLAGS merge, but a minimal patch for now which fixes the - issue described. Thereby closes #463 - -2017-08-23 Jim Klimov - - * docs/snmp-subdrivers.txt, drivers/Makefile.am, drivers/eaton-mib.h, - drivers/eaton-pdu-genesis2-mib.c, drivers/eaton-pdu-genesis2-mib.h, - drivers/{eaton-mib.c => eaton-pdu-marlin-mib.c}, drivers/eaton-pdu- - marlin-mib.h, drivers/eaton-pdu-pulizzi-mib.c, drivers/eaton-pdu- - pulizzi-mib.h, drivers/eaton-pdu-revelation-mib.c, drivers/eaton- - pdu-revelation-mib.h, drivers/snmp-ups.c: Eaton ePDU SNMP MIB file - split in four (#465) * snmp-subdrivers.txt : reference the - multitude of eaton subdrivers * eaton-mib.h renamed into separate - constituent headers * eaton-mib.c renamed into separate - constituent sources, earlier history retained in eaton-pdu- - genesis2-mib.c * eaton-pdu-revelation-mib.c eaton-pdu-pulizzi- - mib.c eaton-pdu-genesis2-mib.c : no use to include dstate.h here * - eaton-pdu-marlin-mib.c eaton-pdu-revelation-mib.c : port the - renamed structure names from original eaton-mib.c evolution - -2017-08-16 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix the rounding / truncation of some - values The multiplier system of the snmp-ups driver resulted in - some values being rounded to the nearby integer value, thus causing - a loss of the decimals and the value precision in general. This was - mainly visible on the value of currents, but also on some voltages - -2017-08-07 Tobby - - * drivers/apcupsd-ups.c: apcupsd-ups: interpret "SHUTTING DOWN" as - "LB" Fix issue https://github.com/networkupstools/nut/issues/460 - so NUT with apcupsd-ups driver will correctly initiate a shut down - on low battery. Bump version to 0.5 Closes: - https://github.com/networkupstools/nut/issues/460 Closes: - https://github.com/networkupstools/nut/issues/461 - -2017-08-10 Arnaud Quette - - * drivers/apc-ats-mib.c, drivers/apc-ats-mib.h: Remove exec bits on - SNMP subdrivers - -2017-08-02 Charles Lepple - - * drivers/cps-hid.c: CPS HID: add input.frequency and - output.frequency (0.5) Suggested by Andy Jan: - http://lists.alioth.debian.org/pipermail/nut- - upsuser/2017-August/010856.html - -2017-08-04 Arnaud Quette - - * docs/nut-names.txt: NUT namespace: fix an extraneous character - insertion A character was wrongly inserted during the previous - commit, triggering a spellcheck error - * drivers/eaton-mib.c: snmp-ups: Publish outlet.n.name for Eaton ePDU - * docs/nut-names.txt: Extend namespace for iPDU and outlets Extend - NUT namespace to also publish the name of an outlet, using - "outlet.n.name", beside from the existing "outlet.n.desc" - -2017-08-03 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: Fix the phase of outlet groups for - Eaton PDU Compute the phase to which an outlet group is connected - WRT the total number of phase(s) and the considered outlet group - number. - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: Introduce values - lookup functions As already used in other drivers, such as usbhid- - ups, introduce optional values lookup functions, beside from values - lookup mapping. This allows to have a more powerful and generic - values processing before publication - -2017-07-22 Charles Lepple - - * drivers/openups-hid.c: usbhid-ups: only check iOEMInformation once - for openups2 This prevents the 'libusb_get_string: invalid - argument' message from being logged continously. Patch provided by - Alphonse - http://lists.alioth.debian.org/pipermail/nut- - upsdev/2017-July/007314.html - -2017-02-02 Daniel Schaal - - * drivers/main.c: Add foreground option to drivers - * docs/man/upsd.txt, scripts/systemd/nut-server.service.in, - server/upsd.c: Add foreground option to upsd - -2016-12-17 Daniel Schaal - - * clients/upsmon.c, docs/man/upsmon.txt, scripts/systemd/nut- - monitor.service.in: Add option to run upsmon in foreground - -2017-06-26 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am : Suffice to have - prebuilt docs in dist-ed sources only if DOC_INSTALL_DISTED_MANS is - enabled - * docs/man/Makefile.am: docs/man/Makefile.am : Fix up dist-ed manpage - source timestamps regardless of DOC_INSTALL_DISTED_MANS value - * docs/man/Makefile.am: docs/man/Makefile.am : Fix up manpage source - timestamps when dist-ing - * docs/Makefile.am: docs/Makefile.am : make sure the builddir copy of - docbook-xsl.css is writeable (file is copied from OS, some distros - have it 444 and not 644) - * docs/man/Makefile.am: docs/man/Makefile.am : do not rebuild docs - and do not error out if a prebuilt copy is among sources (not only - in builddir as before) - * configure.ac, docs/man/Makefile.am: configure.ac - docs/man/Makefile.am : track DOC_INSTALL_DISTED_MANS fallback - behavior - * configure.ac, m4/nut_check_asciidoc.m4: m4/nut_check_asciidoc.m4 - configure.ac : parametrize the required minimum versions - (asciidoc/a2x, dblatex) - * configure.ac: configure.ac : refer to detailed doc from --with-doc - help text; preset explicit nut_with_doc=man=auto value - * docs/man/Makefile.am: docs/man/Makefile.am : small typo in comment - * configure.ac: configure.ac : move comment to a more relevant line - -2017-06-25 Charles Lepple - - * tools/gitlog2changelog.py: gitlog2changelog: log parse errors for - Author and Date Suggested by Jim Klimov. - * tools/gitlog2changelog.py: gitlog2changelog: Date header only - occurs at start of line Alternative to - https://github.com/networkupstools/nut/pull/427 - -2017-06-13 Arnaud Quette - - * drivers/main.c: all drivers: update inline help for '-d ' - -2017-06-12 Arnaud Quette - - * drivers/powerware-mib.c: snmp-ups: add input.bypass.frequency for - Eaton 3ph - -2017-06-12 EVER-PowerSystems - - * drivers/ever-hid.c: fixed status names, added comments, fixed - duplicates - * drivers/ever-hid.c: fixed NUT names - -2017-06-12 Arnaud Quette - - * docs/man/nutupsdrv.txt, drivers/main.c: all drivers: change - dump_data from flag to variable The new option '-d dump_data' can - now accept the number of update loops requested as its value - -2017-06-09 Arnaud Quette - - * drivers/main.c: all drivers: add '-d' data dump option Add '-d' - option to the driver-core, which causes the driver to dump the data - tree in upsc-like format to stdout, and exit - -2017-06-09 Arnaud Quette - - * docs/man/nutupsdrv.txt, drivers/dstate.c, drivers/dstate.h, - drivers/main.c: all drivers: add '-d' data dump option Add '-d' - option to the driver-core, which causes the driver to dump the data - tree in upsc-like format to stdout, and exit - -2017-06-12 Emilien Kia (Eaton) - - * docs/man/nutupsdrv.txt, drivers/main.c: Add option to run driver on - standalone mode. (#423) When a driver is launched with '-s ' - instead of '-a ', the driver does not read ups.conf and only - looks for parameters on command line arguments (-x =). At - least, 'port' parameter shall be specified. - -2017-06-03 Charles Lepple - - * drivers/belkin-hid.c: usbhid-ups: add Liebert GXT4 USB VID:PID - [10AF:0000] Source: http://lists.alioth.debian.org/pipermail/nut- - upsuser/2017-June/010682.html Voltage and ConfigVoltage appear to - be scaled improperly per the debug output. - -2017-05-24 Arnaud Quette - - * docs/nut-names.txt, drivers/eaton-mib.c, drivers/snmp-ups.c: snmp- - ups: add support for outlet.group phase (#422) * snmp-ups: fix - oid2info value lookup When oid2info returns NULL, don't publish - the variable. Previously, this was returning "UNKNOWN" which was - not suitable * snmp-ups: add support for outlet.group phase - Outlets groups can now publish the electrical phase to which the - physical outlets group (Gang) is connected to. This is useful for - 3ph ePDU - -2017-05-21 Charles Lepple - - * data/driver.list.in: HCL: CPS EC750G Source: - http://lists.alioth.debian.org/pipermail/nut- - upsuser/2016-December/010461.html - * data/driver.list.in: HCL: CPS PR2200LCDRT2U (SNMP) - -2017-05-20 Charles Lepple - - * data/driver.list.in: HCL: Add APC Back-UPS CS; edit other APC USB - entries Closes: https://github.com/networkupstools/nut/issues/365 - * data/driver.list.in: HCL: CyberPower EC350G supported by usbhid-ups - (v2.7.3) Per @aurimasv on GitHub: > Test results: Tested on - FreeNAS 9.10.1. Unplugged the UPS and the system > shutdown after - 30 seconds. Closes: - https://github.com/networkupstools/nut/issues/347 Also sorted CPS - entries. - * data/driver.list.in: HCL: Powercool 350VA to 1600VA USB (v2.7.2+) - Closes: https://github.com/networkupstools/nut/issues/203 - * data/driver.list.in: HCL: Numeric Digital 800 plus works with - nutdrv_qx Closes: - https://github.com/networkupstools/nut/issues/115 (~ 2.7.4) - -2017-05-08 EVER-PowerSystems - - * drivers/Makefile.am: fixed errors in makefile - * drivers/Makefile.am, drivers/ever-hid.c, drivers/ever-hid.h, - drivers/usbhid-ups.c, scripts/upower/95-upower-hid.rules: add EVER - hid ups - -2017-04-21 Jim Klimov - - * docs/Makefile.am: docs: build cables html documentation Don't skip - cables from html documentation. - -2017-04-09 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am : typo fix not-building - FAQ.chunked - -2017-04-21 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am : make the working directory - contents writable before running a2x, so it can manage files copied - as read-only in earlier steps - -2017-04-10 Jim Klimov - - * docs/Makefile.am, docs/man/Makefile.am: Some systems detect html- - pages as "XML" - please them too - * docs/man/Makefile.am: Some systems detect man-pages as "ASCII text" - - please them - -2017-04-10 Jim Klimov - - * docs/man/Makefile.am: Update Makefile.am Some systems detect text - sources as "ISO-8859 English" text - please them. - -2017-04-09 Jim Klimov - - * docs/man/Makefile.am: docs/man/Makefile.am : fix check-man-html for - distcheck - * docs/man/Makefile.am: docs/man/Makefile.am : fix check-man-pages - for distcheck - * docs/man/Makefile.am: docs/man/Makefile.am : fix check-man-txt for - distcheck - * configure.ac, docs/Makefile.am, docs/man/Makefile.am: Add "make - check" for generated (or "released" pre-built) docs - * docs/Makefile.am: docs/Makefile.am : typo fix not-building - FAQ.chunked - * configure.ac: configure.ac : add --with- - doc(s)=all={yes,no,skip,auto} to manch e.g. man=skip etc. syntax - -2017-04-05 Arnaud Quette - - * data/driver.list.in: Add support for Eaton 9PX Split Phase 6/8/10 - kVA Using netxml-ups, usbhid-ups and mge-shut - * drivers/netxml-ups.c: netxml-ups: bump driver version In order to - reflect update for 2phases, bump driver version - * drivers/dstate.c: dstate_detect_phasecount: update for 2phases - Update the code to be able to handle 2phases devices, also known as - "split phases" - -2017-04-04 Arnaud Quette - - * MAINTAINERS, data/driver.list.in, docs/man/nutupsdrv.txt, - drivers/Makefile.am, drivers/mge-shut.c, drivers/mge-shut.h: - oldmge-shut: final deprecation and removal oldmge-shut is not - anymore part of the distribution, and is replaced by mge-shut - -2017-04-04 Arnaud Quette - - * clients/upsclient.c, drivers/gamatronic.c, drivers/openups-hid.c, - drivers/snmp-ups.c, server/netssl.c, tools/nut-scanner/nutscan- - ip.c, tools/nut-scanner/nutscan-serial.c, tools/nut- - scanner/scan_eaton_serial.c, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_xml_http.c: - Cppcheck improvements (#405) Fix all Cppcheck errors, using - standard c89: * Uninitialized variables, * Memory leak, * Brackets - balancing, * Common realloc mistake, * Possible null pointer - dereference, * Array index out of bounds, * Not null-terminated - string - -2017-03-31 Nash Kaminski - - * docs/man/liebert-esp2.txt, docs/nut.dict, drivers/liebert-esp2.c: - liebert-esp2 changes: Correct battery V scaling, update docs, - implement split-phase unit support (#412) * Update liebert-esp2 - documentation, include note that port on GXT2 series does not fully - follow RS-232 specs. * Refactor output format of liebert-esp2 - driver to follow that of other drivers to fix the nut-cgi interface - as well as for overall consistency. Implement support for 2 phase - i.e. split phase input Liebert GXT2 series units. Correct battery - voltage scaling for GXT2 series units as well. * Update nut.dict - * Update nut.dict - -2017-03-30 Jim Klimov - - * .travis.yml: Problem: NUT tests in Travis CI often wait for - default-withdoc Solution in .travis.yml : since Travis cloud - starts the jobs as soon as it has resources, move the bulk of - quicker matrix jobs to start after the longest withdocs build. - Experimental note: we still need one job defined in the simple - matrix for default environment, but can keep others in a single - explicitly ordered list. Now the "Running for" time got cut from - 8-9 to 5.5-6 minutes. - -2017-03-29 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am : update comment about - spellcheck-sortdict post-processing, to make it more relevant - * docs/man/upsd.conf.txt, docs/nut.dict: Fix some more typos and add - nut.dict exceptions - -2017-03-29 Arnaud Quette - - * docs/man/upsd.conf.txt: upsd.conf.txt: fix a typo from the previous - commit - * conf/upsd.conf.sample, docs/man/upsd.conf.txt: upsd.conf: - clarification on the LISTEN directive - -2017-03-22 Arnaud Quette - - * drivers/libusb1.c, drivers/nut_libusb.h, tools/nut- - scanner/scan_usb.c: Fix spacers - -2016-11-09 Charles Lepple - - * docs/nut-names.txt, drivers/libusb0.c, drivers/libusb1.c: Add - `driver.version.usb` variable Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-09-25 Charles Lepple - - * drivers/libusb1.c: libusb1: use return code from libusb_open() Per - , the handle is only populated when the return code - is 0. This fixes a crash during device detection where more than - one HID UPS is available, and the driver needs to skip the first - one. - -2016-09-02 Arnaud Quette - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/libusb1.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c: libusb 1.0 port: fix - return code for interrupt ops libusb 1.0 returns on success, the - number of bytes actually transferred or otherwise an error code, - except for interrupt transfers, where the actual transfer size is - stored in a separate variable. The libusb 1.0 implementation in NUT - thus needed to be fixed to behave the same way than the libusb 0.1 - implementation Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-31 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0 port: remove the check on USB device - count With the port to libusb 1.0, a sanity check was done on the - available number of USB devices to try. This however caused a - behavior regression, since the only device that NUT may have access - to can be the only UPS connected. In this case, the driver may exit - upon trying to reconnect if the device is transiently not available - Reference: https://github.com/networkupstools/nut/issues/300 - * drivers/libusb1.c, drivers/richcomm_usb.c: libusb 1.0 port: - complete usb_set_altinterface code usb_set_altinterface allows to - force the USB code to call `libusb_set_interface_alt_setting (0, - 0)` (equivalent to `libusb_set_altinterface(0)` in libusb 0.1), as - was done in NUT 2.7.2 and earlier. However, the libusb 1.0 - implementation was still missing the related code Reference: - https://github.com/networkupstools/nut/issues/300 - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: libusb 1.0 port: - fix kernel driver detachment Following the recent modification for - the kernel driver detachment, and the related functions - availability depending on the platforms, nutdrv_atcl_usb and - richcomm_usb were using the wrong macro for - libusb_set_auto_detach_kernel_driver and were missing the libusb - 1.0 code for explicit kernel driver detachment Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-17 Arnaud Quette - - * drivers/libusb1.c, m4/nut_check_libusb.m4: libusb 1.0 port: rework - the kernel driver detachment libusb 1.0 has introduced a new - function (libusb_set_auto_detach_kernel_driver), beside from the - explicit kernel driver detachment request - (libusb_detach_kernel_driver). However, the former is not available - on all systems. As an example, FreeBSD 10.1-10.3 does not have - this. The detachment and interface claiming has been reworked to - handle this case (reported by Charles Lepple) Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-12 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0: remove unused typesafe_control_msg() - workaround For libusb 0.1 implementation, we had to workaround a - libusb API goofs, by wrapping the base function usb_control_msg(), - and casting the variables to the right type. This is not needed for - libusb 1.0 implementation, but was wrongly left in the code - (reported by Charles Lepple) - -2016-08-11 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: fix a warning on unused variable - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: simplify bus publication - bus publication was wrongly listing both the bus and the portname, - instead of the bus only. This may have caused some issue when - trying to match the port - * drivers/usbhid-ups.c: usbhid-ups/mge-shut: rework errno/errors - handling libusb 1.0 has its own set of return codes, and error - interface. Rework the common HID core (shared between usbhid-ups - and mge-shut) so that error handling can work with both, and using - either libusb 0.1 or 1.0 for usbhid-ups - * tools/nut-scanner/scan_usb.c: nut-scanner: missing symbols lookup - for libusb 1.0 A few symbols from libusb 1.0 were wrongly used - directly, instead of being looked up and loaded at init time - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: add missing libusb_exit() - calls - * tools/nut-scanner/nutscan-init.c, tools/nut-scanner/scan_usb.c, - tools/nut-usbinfo.pl: nut-scanner: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: Remove redundant - variable - * drivers/tripplite_usb.c: tripplite_usb: remove extraneous comment - char - * drivers/nut_libusb.h: permute typedef order of usb_dev_handle - * drivers/nutdrv_qx.c: nutdrv_qx: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/richcomm_usb.c: richcomm_usb: missing function remap for - libusb 0.1 usb_strerror was not remapped for libusb 0.1 - implementation - * drivers/tripplite_usb.c: tripplite_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/riello_usb.c: riello_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - -2016-08-10 Arnaud Quette - - * drivers/richcomm_usb.c: richcomm_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: add the missing detach - call libusb 1.0 provide its own routine for detaching kernel - driver - * drivers/Makefile.am, drivers/libhid.c, drivers/nut_libusb.h: - Forgotten occurences of libusb.h renaming NUT internal header - "libusb.h" was renamed, since it collides with the libusb 1.0 - header, which has the same name. A few occurences of reference and - documentation were however missing - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: initial port to libusb - 1.0 The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/blazer_usb.c: blazer_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/bcmxcp_usb.c: bcmxcp_usb: code cleanup - -2016-08-09 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * docs/configure.txt, drivers/Makefile.am, drivers/libhid.c, - drivers/libhid.h, drivers/{libusb.c => libusb0.c}, - drivers/libusb1.c, drivers/{libusb.h => nut_libusb.h}, drivers/usb- - common.h, drivers/usbhid-ups.c: ushid-ups: complete the port to - libusb 1.0 The port to libusb 1.0 is now complete for usbhid-ups. - Other USB drivers (bcmxcp_usb, blazer_usb, nutdrv_atcl_usb, - richcomm_usb, riello_usb, tripplite_usb, nutdrv_qx) have still to - be addressed - -2016-08-01 Arnaud Quette - - * configure.ac, m4/nut_check_libusb.m4: Initial port to libusb 1.0 - Starting with the configure checks, to detect if libusb 1.0 if - available, and otherwise fall back to the libusb 0.1 backend - -2017-03-22 Arnaud Quette - - * clients/upssched-cmd, conf/upssched.conf.sample.in: upssched: align - documentation and sample files Align documentation and sample - configuration and script, so that the whole is more coherent - -2017-03-21 Arnaud Quette - - * docs/scheduling.txt: upssched: some clarification on TIMER - -2017-03-20 Charles Lepple - - * docs/nut.dict: Re-sort nut.dict (#406) * Re-sort nut.dict * - nut.dict header line - -2017-03-13 Spiros Ioannou - - * configure.ac, data/driver.list.in, docs/man/Makefile.am, - docs/man/index.txt, docs/man/phoenixcontact_modbus.txt, - docs/nut.dict, drivers/Makefile.am, - drivers/phoenixcontact_modbus.c, m4/nut_check_libmodbus.m4: - phoenixcontact_modbus driver Closes: - https://github.com/networkupstools/nut/pull/404 - -2017-03-14 Spiros Ioannou - - * .travis.yml: added libmodbus-dev to travis configuration - -2017-03-15 Jim Klimov - - * docs/config-notes.txt: config-notes.txt : small clarifications in - the text - * docs/developers.txt: developers.txt : small clarifications in the - text and line-wrapping and backticks - * docs/config-notes.txt: config-notes.txt : small clarifications in - the text and line-wrapping - * docs/cables.txt: cables.txt : line-wrapping - * docs/asciidoc.txt: asciidoc.txt : line-wrapping - * docs/acknowledgements.txt: acknowledgements.txt : line-wrapping - * docs/support.txt: support.txt : small clarifications in the text - and line-wrapping - * docs/security.txt: security.txt : small clarifications in the text - and line-wrapping - * docs/outlets.txt: outlets.txt : line-wrapping - * docs/new-drivers.txt: new-drivers.txt : line-wrapping - * docs/net-protocol.txt: net-protocol.txt : line-wrapping - * docs/maintainer-guide.txt: maintainer-guide.txt : small - clarifications in the text and line-wrapping and backticks - * docs/macros.txt: macros.txt : line-wrapping - * docs/history.txt: history.txt : line-wrapping - * docs/features.txt: features.txt : small clarifications in the text - and line-wrapping and backticks - * docs/download.txt: download.txt : line-wrapping - * docs/developers.txt: developers.txt : small clarifications in the - text and line-wrapping and backticks - * docs/daisychain.txt: daisychain.txt : small clarifications in the - text and line-wrapping - * docs/configure.txt: configure.txt : small clarifications in the - text - * docs/config-notes.txt: config-notes.txt : small clarifications in - the text - * docs/acknowledgements.txt: acknowledgements.txt : small - clarifications in the text - * docs/FAQ.txt, docs/nutdrv_qx-subdrivers.txt: nutdrv_qx- - subdrivers.txt : small clarifications in the text - -2017-03-13 Jim Klimov - - * docs/nut.dict: nut.dict : add "distros" slangey - * docs/configure.txt, docs/contact-closure.txt, docs/daisychain.txt, - docs/developers.txt, docs/features.txt, docs/history.txt, docs/net- - protocol.txt, docs/new-drivers.txt, docs/nut-names.txt, docs/nut- - qa.txt, docs/nutdrv_qx-subdrivers.txt, docs/outlets.txt, docs/sock- - protocol.txt: docs/*.txt : cleanup long-dash (use double-minus) - * docs/acknowledgements.txt, docs/cables.txt, docs/configure.txt, - docs/contact-closure.txt, docs/design.txt, docs/developer- - guide.txt, docs/developers.txt, docs/documentation.txt, - docs/download.txt, docs/features.txt, docs/hid-subdrivers.txt, - docs/history.txt, docs/macros.txt, docs/maintainer-guide.txt, - docs/net-protocol.txt, docs/new-clients.txt, docs/new-drivers.txt, - docs/nut-names.txt, docs/nut-qa.txt, docs/outlets.txt, - docs/packager-guide.txt, docs/snmp-subdrivers.txt, docs/snmp.txt, - docs/sock-protocol.txt, docs/support.txt, docs/user-manual.txt: - docs/*.txt : cleanup trailing whitespace - -2017-03-13 Arnaud Quette - - * scripts/systemd/nutshutdown.in: Prefer @CONFPATH@ over @sysconfdir@ - Otherwise, the generated nutshutdown script can end up with a non - fully expanded path like "${prefix}/etc/nut.conf" when not - specifying --sysconfdir and using default flags - -2017-01-28 Laurent Bigonville - - * scripts/systemd/nutshutdown.in: Add support for POWEROFF_WAIT - parameter Use "systemctl reboot --force --force" to reboot the - machine has not been shutdown after the POWEROFF_WAIT delay. - Closes: #382 - -2017-03-04 Jim Klimov - - * drivers/snmp-ups.c: snmp-ups.c : presumed typo fix : NUT var for - bypass mapping is "input.bypass" (fix the caller too) - -2017-03-15 Jim Klimov - - * docs/nut.dict: nut.dict : know of "nowait" - -2017-01-28 Jim Klimov - - * docs/man/ups.conf.txt, docs/man/upsdrvctl.txt, drivers/upsdrvctl.c: - From: Arnaud Quette Date: Sat, 7 Jun 2014 - 02:27:15 +0200 Subject: [PATCH] Add 'nowait' option for upsdrvctl - in ups.conf The nowait flag allow to tell upsdrvctl to not wait at - all for the driver(s) to execute the request command. The default - behavior, when this variable is omitted, is to wait 'maxstartdelay' - seconds - -2017-03-13 Arnaud Quette - - * scripts/systemd/nutshutdown.in: Prefer @CONFPATH@ over @sysconfdir@ - Otherwise, the generated nutshutdown script can end up with a non - fully expanded path like "${prefix}/etc/nut.conf" when not - specifying --sysconfdir and using default flags - * docs/scheduling.txt: Disambiguate FHS - Filesystem Hierarchy - Standard - * docs/security.txt: Missing space - -2017-03-13 Jim Klimov - - * docs/FAQ.txt, docs/config-notes.txt, docs/scheduling.txt, - docs/security.txt: Some docs/ files revised to backtick pathnames, - clean up trailing whitespace, and use double-minuses for long-dash - in sentences - * docs/nut.dict: docs/nut.dict : add "FHS" - -2017-03-04 Arnaud Quette - - * docs/FAQ.txt, docs/config-notes.txt, docs/scheduling.txt, - docs/security.txt: Try to adapt paths in documentation - Documentation still widely uses the default paths source when - compiled from source. While it is feasible to adapt some at - compilation time, it is not desirable since, for example, the - online documentation on networkupstools.org has to be generic. So - try to make these paths more generic when possible, and otherwise - make a note - -2017-03-04 Jim Klimov - - * docs/hid-subdrivers.txt, docs/nut.dict: spellcheck: "futher" is a - mistaken exception in custom dictionary - * docs/nut.dict: nut.dict bumped to support nut-website documents - with words that Travis does not know - * drivers/snmp-ups.c: snmp-ups.c : presumed typo fix : NUT var for - bypass mapping is "input.bypass" (fix the caller too) - * docs/nut.dict: nut.dict bumped to support nut-website documents - with words that Travis does not know - * docs/nut.dict: nut.dict bumped to support nut-website documents - -2017-03-02 Arnaud Quette - - * tools/nut-ddl-dump.sh: nut-ddl-dump.sh: various improvements - Improve the script to generate NUT device dumps by adding: * a - header line that mentions the generation source (automatic) and - date * add upsrw dump as comments * add upscmd dump as comments - * drivers/eaton-ats16-mib.c: snmp-ups: ATS16 fixes for ambient sensor - values Values for the attached ambient sensor to an ATS16 were - erroneously multiplied by 10 - -2017-03-01 Jim Klimov - - * drivers/mge-xml.c: Update mge-xml.c Include drivers/main.h to get - testvar() declared properly - -2017-03-01 Jim Klimov - - * docs/man/upscli_init.txt: docs/man/upscli_init.txt : rephrase the - text to pass spellcheck (and human readability) and wrap some long - lines - * drivers/snmp-ups.c: snmp-ups.c : presumed typo fix : NUT var for - bypass mapping is "input.bypass" - * drivers/snmp-ups.c: snmp-ups.c : added comments about some - daisychain global vars - -2017-02-28 Jim Klimov - - * drivers/snmp-ups.c: drivers/snmp-ups.c : in snmp_ups_walk(), report - in log if aborting because of exit_flag - * drivers/snmp-ups.c: drivers/snmp-ups.c : in snmp_ups_walk(), update - some comments - * drivers/snmp-ups.c: drivers/snmp-ups.c : presumed typo fix in - comment about daisy (should be "1..N" not "2..N" in final code) - * drivers/snmp-ups.c: drivers/snmp-ups.c : comment in snmp_ups_walk() - about daisychains vs unitary devices - * drivers/snmp-ups.c: drivers/snmp-ups.c : comment in snmp_ups_walk() - about daisychains vs unitary devices - * drivers/snmp-ups.c: drivers/snmp-ups.c : fix trailing whitespace - * drivers/dstate.c, drivers/dstate.h, drivers/usbhid-ups.h: - drivers/dstate.c : in dstate_detect_phasecount() do not hardcode a - buf[] size but use a macro - * drivers/dstate.c: drivers/dstate.c : extend a comment about 2-phase - devices into dstate_detect_phasecount() - -2017-02-12 Jim Klimov - - * drivers/dstate.c: dstate.c : catch a few more zero value - representation and comment about others - -2017-02-10 Jim Klimov - - * drivers/dstate.c: dstate.c : refactor dstate_detect_phasecount() : - change the report about calculated values to use common format with - __func__ - * drivers/dstate.c: dstate.c : refactor dstate_detect_phasecount() : - change the no-longer-sexy overgrown one-liners with a readable - macro - * drivers/dstate.c: dstate.c : important typo fixed for - dstate_detect_phasecount() - * drivers/dstate.c: dstate.c : revise comment for - dstate_detect_phasecount() - * drivers/dstate.c: dstate.c : address code style (move var - declarations to top of scope) - * drivers/dstate.c: dstate.c : address some nit-picks - -2017-02-09 Jim Klimov - - * drivers/dstate.c, drivers/dstate.h, drivers/mge-xml.c: Refactor - dstate_detect_phasecount(), adding a read-only mode (so the caller - can query the guesswork logic without changing active dstates) - * drivers/dstate.c, drivers/dstate.h, drivers/mge-xml.c: Refactor the - dstate guesswork and setting for 1/3 phases, move it to common - dstate.c/.h and rename to dstate_detect_phasecount() - * drivers/mge-xml.c: Refactor recent logic into a common - set_phasecount() - * drivers/mge-xml.c: Drop an empty line - * drivers/mge-xml.c: mge-xml.c : calculate - (input|bypass|output).phases number (1 or 3) based on available - non-zero measurements - typo fix for "INPUT.bypass." - * drivers/mge-xml.c: mge-xml.c : calculate - (input|bypass|output).phases number (1 or 3) based on available - non-zero measurements - consider absence of Lx values for 1-phase - case - * drivers/mge-xml.c: mge-xml.c : calculate - (input|bypass|output).phases number (1 or 3) based on available - non-zero measurements - also consider current (amps) - * drivers/mge-xml.c: mge-xml.c : calculate - (input|bypass|output).phases number (1 or 3) based on available - non-zero measurements - -2017-02-28 Jim Klimov - - * docs/man/netxml-ups.txt, drivers/mge-xml.c, drivers/netxml-ups.c: - mge-xml / netxml-ups : reimplement do_convert_deci as a simple - VAR_FLAG setting - -2017-02-27 Jim Klimov - - * drivers/mge-xml.c: mge-xml.c : add debug logging of values which - were converted - * docs/man/netxml-ups.txt, docs/nut.dict, drivers/mge-xml.c, - drivers/netxml-ups.c: netxml-ups and mge-xml : allow users to - reenable legacy convert_deci() behavior at run-time, with a - configuration toggle (documented) - * drivers/mge-xml.c: mge-xml.c : updated comment about convert_deci() - pre-history - -2017-02-21 Jim Klimov - - * drivers/mge-xml.c: drivers/mge-xml.c : when reporting deprecation - of convert_deci(), do it once visibly with details like issue - tracker URL, and in regular debug messages refer to that line - -2017-02-20 Jim Klimov - - * drivers/mge-xml.c: drivers/mge-xml.c : in convert_deci() now report - it is deprecated (with debug level 5) so we get reports if - deprecation bites anyone in reality - * drivers/mge-xml.c: drivers/mge-xml.c : bump subdriver version - * drivers/mge-xml.c: drivers/mge-xml.c : bump copyrights - -2017-02-18 Jim Klimov - - * drivers/mge-xml.c: Disable convert_deci() that was needed a decade - ago Left the old code in place, commented away. If devices with - old NetXML pop up (those which served in XML 10x the measured - value), fixes can be applied based on voltage and amps and power - (order of magnitude comparison), or perhaps model names and/or - firmware versions or release dates, if we get those. - -2017-02-27 Jim Klimov - - * drivers/netxml-ups.c: netxml-ups.c : typo fix (shutdwon => - shutdown) - * docs/man/netxml-ups.txt: docs/man/netxml-ups.txt : trailing - whitespace fixes - -2017-02-28 Jim Klimov - - * data/Makefile.am: data/Makefile.am : did not link back to - "spellcheck-sortdict" - -2017-02-04 Steven Bell - - * docs/nut.dict: Removed line left over from merge conflict. Ooops! - -2017-01-28 Laurent Bigonville - - * scripts/systemd/nutshutdown.in: Add support for POWEROFF_WAIT - parameter Use "systemctl reboot --force --force" to reboot the - machine has not been shutdown after the POWEROFF_WAIT delay. - Closes: #382 - -2017-01-28 Jim Klimov - - * drivers/eaton-ats30-mib.c: drivers/eaton-ats30-mib.c : fix - whitespace - * drivers/snmp-ups.c: drivers/snmp-ups.c : fix trailing whitespaces - * docs/nut.dict: nut.dict : know of "nowait" - * docs/Makefile.am: docs/Makefile.am : after spellcheck-interactive, - advise how to review the dictionary changes and avoid regressions - * conf/upsd.conf.sample, conf/upsmon.conf.sample.in, - conf/upssched.conf.sample.in, docs/nut.dict: Spellchecked the conf/ - sample files - * Makefile.am, conf/Makefile.am: Spellcheck the conf/ directory - * conf/upsd.users.sample, conf/upsmon.conf.sample.in: - upsmon.conf.sample.in : clarify nuances of master/slave systems, - and special use-cases of SHUTDOWNCMD and powervalue==0 - * conf/hosts.conf.sample, conf/nut.conf.sample, conf/ups.conf.sample, - conf/upsd.conf.sample, conf/upsd.users.sample, - conf/upsmon.conf.sample.in, conf/upssched.conf.sample.in, - conf/upsset.conf.sample, conf/upsstats.html.sample: Sample - configuration files : fix leading and trailing whitespace (mix of - tab/space) - * conf/ups.conf.sample: ups.conf.sample : move maxretry example - higher in the file so it is before driver-block examples - * drivers/apc-pdu-mib.c: Date: Fri Aug 19 02:43:44 2016 +0200 apc- - pdu-mib.c fixes : * added trailing NULLs for proper structure size; - * fixed some items' flags; * fixed whitespace; * bumped MIBmap - version - * data/driver.list.in, drivers/Makefile.am, drivers/apc-pdu-mib.c, - drivers/apc-pdu-mib.h, drivers/snmp-ups.c: From: Arnaud Quette - Date: Fri, 8 Apr 2016 14:40:00 +0200 - Subject: [PATCH] snmp-ups: support APC PDU Based on initial work - and data from Opengear, using SNMP subdriver creation script, add - support for the more recent APC PDU. This was tested with a - AP8958, but should cover other models - * docs/man/ups.conf.txt, docs/man/upsdrvctl.txt, drivers/upsdrvctl.c: - From: Arnaud Quette Date: Sat, 7 Jun 2014 - 02:27:15 +0200 Subject: [PATCH] Add 'nowait' option for upsdrvctl - in ups.conf The nowait flag allow to tell upsdrvctl to not wait at - all for the driver(s) to execute the request command. The default - behavior, when this variable is omitted, is to wait 'maxstartdelay' - seconds - * conf/ups.conf.sample: Document and pre-set the "maxretry" option in - ups.conf.sample - -2017-01-27 Jim Klimov - - * drivers/eaton-ats16-mib.c, drivers/eaton-ats30-mib.c: Prefix - structures in eaton-atsXY-mib.c files with an eaton_atsXY rather - than just atsXY - * README: README: not asciidoc, and redistributed - do not link to - volatile build status - -2017-01-27 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: Fix counter OID matching In case of - multiple similar sysOID (i.e. same sysOID in different subdrivers), - there is a counter matching OID (generally using the model OID). - However, the matching was causing a crash of snmp-ups in case where - it was not the right MIB mapping and the OID for model entry was - not available - -2017-01-27 Steven Bell - - * docs/man/upscli_connect.txt, docs/nut.dict: Fixed issues with - documentation for automated spellcheck during CI check. - -2017-01-27 Jim Klimov - - * docs/nut.dict: docs/nut.dict : sorted to facilitate further - maintenance - -2017-01-27 Arnaud Quette - - * Makefile.am, data/Makefile.am, data/cmdvartab: Integrate cmdvartab - to the spellcheck target This also includes 2 spelling fixes - -2017-01-27 Jim Klimov - - * NEWS, docs/nut.dict: Spellcheck : Fixed typo in Tore O*r*petveit's - name - * README: README : embed a Travis status image link for NUT Master - branch - * Makefile.am, docs/.gitignore, docs/Makefile.am, - docs/man/Makefile.am: Spellcheck : add a recipe to keep nut.dict - sorted so git diffs are clearer - * Makefile.am: Makefile.am : when calling spellcheck or spellcheck- - interactive for several subdirs, do not stop after the first failed - sub-make - -2017-01-27 Steven Bell - - * docs/man/upscli_add_host_cert.txt, docs/man/upscli_connect.txt, - docs/man/upscli_init.txt: Updated and corrected documentation. - -2017-01-27 Arnaud Quette - - * drivers/Makefile.am, drivers/eaton-ats16-mib.c, drivers/eaton- - ats16-mib.h, drivers/snmp-ups.c: snmp-ups: rename Eaton ATS16 - resources Rename the subdriver files along with the structure and - entries, to make a clear difference with the newly added - eaton_ats30. This completes the previous commit, where some files - was erroneously committed - * drivers/{eaton-ats-mib.c => eaton-ats16-mib.c}, drivers/{eaton-ats- - mib.h => eaton-ats16-mib.h}, drivers/eaton-ats30-mib.c: Fix - unterminated comment, from previous commit - * tools/nut-scanner/scan_snmp.c: nut-scanner: force numeric - resolution of OIDs As done in snmp-ups, force the numeric - resolution of OIDs, to ensure correct OID matching in all cases - * drivers/snmp-ups.c: Only free variable when needed in - su_setvar/su_setOID Previously, we tried to free temporary - pointers in all cases. However, this pointer may ever point at the - static structure, in case we do not need to instantiate variable - (outlet.* collection), and which causes a crash of the driver - * drivers/eaton-ats30-mib.c: Add a comment on the unused OIDs - * drivers/snmp-ups.c: Fix spacing - * drivers/eaton-ats30-mib.c, drivers/eaton-ats30-mib.h: Fix legal - information - -2017-01-26 Tomas Halman - - * drivers/Makefile.am, drivers/eaton-ats30-mib.c, drivers/eaton- - ats30-mib.h, drivers/snmp-ups.c: snmp-ups: support Eaton Automatic - Transfer Switch ATS30 ATS30 MIB differs from previously integrated - EATON ATS driver. - -2016-09-14 Jim Klimov - - * common/common.c: common.c : revised upsdebugx() and upslogx() calls - to not trail an extra newline - * common/common.c, configure.ac: Add support for system library - directories with names based on short target/build/host OS spec too - -2017-01-24 Jim Klimov - - * common/common.c, configure.ac: Add support for system library - directories with names based on target/build/host OS spec (for GCC - at least) - -2016-09-14 Jim Klimov - - * common/common.c: common.c : added logging and small optimizations - during get_libname() - * common/common.c: common.c : add /usr/local/lib64 to search path - -2017-01-19 Jim Klimov - - * tools/nut-scanner/nutscan-init.c: nutscan-init.c : We can also use - libusb-compat from newer libusb-1.0 releases (issue #361) - -2016-09-14 Jim Klimov - - * tools/nut-scanner/nutscan-init.c: nut-scanner : support libneon- - gnutls.so as an alternative name - -2016-07-12 Carlos Dominguez - - * common/common.c, include/common.h, tools/nut-scanner/nutscan- - init.c: Arnaud's patch applied, dynamic library bug fixed, tested! - -2016-07-04 Arnaud Quette - - * common/common.c, include/common.h, tools/nut-scanner/nutscan- - init.c: Move get_libname() to common This function, originally - created for nut-scanner, to be able to lookup for libraries loaded - using libtool loader, is now also useful for the DMF support. This - last loads libneon at runtime, to load DMF structure (including the - one for nut-scanner) and unload it once the file were read - -2017-01-23 Jim Klimov - - * drivers/mge-hid.c, drivers/nutdrv_qx.h, - drivers/nutdrv_qx_bestups.c: Fix the non-ASCII quote character away - from C sources - * docs/daisychain.txt, docs/man/al175.txt, docs/man/apcsmart.txt, - docs/man/apcupsd-ups.txt, docs/man/bcmxcp_usb.txt, - docs/man/bestups.txt, docs/man/blazer-common.txt, - docs/man/clone.txt, docs/man/libnutclient_commands.txt, - docs/man/libnutclient_misc.txt, docs/man/libnutclient_tcp.txt, - docs/man/libnutclient_variables.txt, docs/man/macosx-ups.txt, - docs/man/mge-shut.txt, docs/man/nut-scanner.txt, - docs/man/nutdrv_qx.txt, docs/man/nutscan_add_device_to_device.txt, - docs/man/nutscan_add_option_to_device.txt, - docs/man/nutscan_cidr_to_ip.txt, - docs/man/nutscan_get_serial_ports_list.txt, docs/man/nutupsdrv.txt, - docs/man/skel.txt, docs/man/snmp-ups.txt, docs/man/solis.txt, - docs/man/ups.conf.txt, docs/man/upscode2.txt, - docs/man/upsd.conf.txt, docs/man/upsd.txt, - docs/man/upsmon.conf.txt, docs/man/upsmon.txt, docs/man/upsrw.txt, - docs/man/upssched.conf.txt, docs/man/upsstats.html.txt, - docs/man/usbhid-ups.txt, docs/nut.dict: Update nut.dict and manpage - sources after initial spellchecking integration - * Makefile.am, ci_build.sh, docs/man/Makefile.am: - docs/man/Makefile.am : track all manpage sources in a separate - variable and use that for spellchecker - * docs/Makefile.am: docs/Makefile.am : add daisychain to ALL_TXT_SRC - * docs/Makefile.am: docs/Makefile.am : revised TODOs for spellchecker - -2017-01-20 Jim Klimov - - * .travis.yml: Enable valgrind in travis matrix - -2017-01-21 Jim Klimov - - * indent.sh: Initial commit of indent.sh helper - -2017-01-20 Jim Klimov - - * Makefile.am, tests/Makefile.am: VALGRIND: abuse distcheck to run - tested programs in debug mode under valgrind - * configure.ac: valgrind config fix - * ci_build.sh: Travis : make spellcheck failures fatal now - * docs/nut.dict: docs/nut.dict : add another word missed by earlier - private dict - * docs/nut.dict: docs/nut.dict : try to enable UTF8 contributor names - * docs/Makefile.am: docs/Makefile.am : try to enable UTF8 in args and - env - * .travis.yml, ci_build.sh: Travis : enable i2c tests - * .travis.yml: .travis.yml : rearrange apt deps and special case for - doc/spell tests in the matrix - * .travis.yml, ci_build.sh: Travis: port the test-script structure - from DMF brach (better case than if) - -2017-01-19 Jim Klimov - - * docs/nut.dict: docs/nut.dict : add some words not in dictionaries - available to Travis CI; add some developer names to the dictionary - * NEWS, TODO, UPGRADING, common/parseconf.c, docs/FAQ.txt, - docs/acknowledgements.txt, docs/cables/sms.txt, docs/config- - notes.txt, docs/download.txt, docs/hid-subdrivers.txt, docs/new- - drivers.txt, docs/nut-qa.txt, docs/nut.dict, docs/nutdrv_qx- - subdrivers.txt, docs/packager-guide.txt, docs/snmp-subdrivers.txt, - lib/README, scripts/augeas/README: Spellchecker : Fix or rephrase - issues found by spellchecker, and update the NUT custom dictionary - * docs/developers.txt: docs/developers.txt : fix non-ASCII tick - character - * docs/acknowledgements.txt, docs/packager-guide.txt: Added myself to - docs/acknowledgements.txt docs/packager-guide.txt - * docs/nut-qa.txt: docs/nut-qa.txt : rearranged the paragraph with CI - (to fit in 80 cols) and added link to Travis CI dashboard for NUT - branches - * docs/packager-guide.txt: docs/packager-guide.txt : rearranged the - paragraph with recommended package description (to fit in 80 cols) - * docs/developers.txt: docs/developers.txt : mention the recently - added Travis CI integration - * docs/developers.txt: docs/developers.txt : reformat the paragraph - on distcheck-light, and mention the recently added option to skip - building docs - * Makefile.am: Makefile.am : allow to call from workspace root the - docs/Makefile for targets: spellcheck spellcheck-interactive doc - -2017-01-19 Jim Klimov - - * docs/Makefile.am: docs/Makefile.am : parametrize aspell common - args; add togglable debugging of aspell setup - -2017-01-19 Jim Klimov - - * ci_build.sh, docs/Makefile.am: docs/Makefile.am + Travis : support - a SPELLCHECK_ERROR_FATAL toggle, and use it from Travis for now * - docs/Makefile.am : also report if the build succeeds despite - spellcheck errors (due to this setting) - * docs/Makefile.am: docs/Makefile.am : name the en lang explicitly - * docs/Makefile.am: docs/Makefile.am : big reorganization of - spellcheck * spellcheck targets should fail the build not only if - the last document failed the test * make sure to use custom - spellcheck dictionary from NUT source tree; revise erroring out if - automatic aspell finds issues * also set LC_ALL=C for aspell * - revised spellcheck failure message to suggest next steps for the - human * comment the spellcheck test; use more portable shell test - (instead of bracket); do not fail on empty aspell outputs - -2016-09-07 Jim Klimov - - * configure.ac: configure.ac : add potential usage of valgrind, - optional and configurable/detectable - -2017-01-19 Jim Klimov - - * .travis.yml, ci_build.sh: Travis CI should call spellcheck as a - separate spellchecking job (parallelize, optimize for speed, - separate error causes/reports) - * .travis.yml: .travis.yml : add libcppunit to travis env, so tests - in NUT will be enabled - -2017-01-11 Jim Klimov - - * .travis.yml: .travis.yml : drop comment for PR #354 - -2016-11-21 Jim Klimov - - * common/snprintf.c: common/snprintf.c : avoid a few compilation - warnings and a possible crash due to padded ints in variadic - functions - * common/snprintf.c, configure.ac: common/snprintf.c and configure.ac - : avoid a few compilation warnings - -2017-01-06 Daniele Pezzini - - * common/state.c: state: consider also ST_FLAG_NUMBER flags - * drivers/dstate.c: dstate: report ST_FLAG_NUMBERs also in response - to a DUMPALL request - * drivers/dstate.c: dstate: when dealing with ranges, don't lose - already-set flags Ranges are now explicitly flagged as numbers, - but the use of dstate_setflags() means that we substitute any - previously-set flag with the ones we pass to that function, losing, - for example, an already-set r/w status, with the result of making - an affected var unchangeable. Use instead the newly added - dstate_addflags() function, which preserves already-set flags. - * drivers/dstate.c, drivers/dstate.h: dstate: add a couple of - functions to ease the manipulation of flags - -2017-01-10 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix device.type setting in daisychain - mode device.type was not set due to a coding error, but pushed to - device.model (reported by Evgeny "Jim" Klimov from Eaton) - * drivers/main.c: drivers: set the default device.type even earlier - device.type default setting to "ups" has to be done prior to the - initups() call, otherwise some devices (such as daisychained PDUs) - will not be able to override it - -2017-01-04 Jim Klimov - - * ci_build.sh: ci_build.sh : list contents of installation directory - * ci_build.sh: ci_build.sh : fix installation directories for /etc - and udev, devd and hotplug (not hardcoded root paths) - * ci_build.sh: ci_build.sh : list contents of installation directory - * ci_build.sh: ci_build.sh : fix installation directories for /etc - and udev, devd and hotplug (not hardcoded root paths) - * .travis.yml, ci_build.sh: Travis : take advantage of "--with- - doc=skip" support recently added in configure and Makefiles - -2016-09-13 Jim Klimov - - * configure.ac, docs/man/Makefile.am: configure.ac, - docs/man/Makefile.am - support SKIP_MANS as an explicit non-fatal - situation - -2017-01-04 Jim Klimov - - * ci_build.sh: ci_build.sh : comment about missing i2c - * ci_build.sh: ci_build.sh : generalize the skipping of distcheck and - make it more comprehensible in script code - * .travis.yml: .travis.yml : include the headers needed for i2c - * .travis.yml: .travis.yml : use specific libgd - * .travis.yml: .travis.yml : add graphics pkgs for CGI builds - * ci_build.sh: .travis.yml / ci_build.sh : speed up with parallel - build (fall back to sequential if this fails) - * .travis.yml, ci_build.sh: .travis.yml / ci_build.sh : current NUT - does not skip docs safely, so enable just manpages in default build - * .travis.yml: .travis.yml : add libipmimonitoring packages too - * .travis.yml: .travis.yml : older freeipmi in Travis Ubuntu 12.04.5 - * ci_build.sh: ci_build.sh : fix the doc-skipping option - * .travis.yml: .travis.yml : apparently, libfreeipmi16 pkg requires - extra invitation - * .travis.yml, ci_build.sh: Travis : require docs tools only for - "default-withdoc" builds; change "default" to skip the docs (and - try to pass distcheck) - * .travis.yml: .travis.yml : only define default-alldrv once - * .travis.yml, ci_build.sh: Initial integration of a travis matrix - build (different scenarios) - * .gitignore, .travis.yml, ci_build.sh, docs/Makefile.am: Initial - commits of config and script files for Travis CI automatic - validation (simply do a compile and distcheck) - -2017-01-04 Arnaud Quette - - * m4/nut_check_asciidoc.m4: Minor typo fixes - -2017-01-04 Jim Klimov - - * configure.ac: configure.ac : switch default option to "--with- - doc=man=auto" so ordinary builds succeed by default on any system - * configure.ac: configure.ac alias - * configure.ac: configure.ac : add the "--with-docs" as alias to "-- - with-doc" - * configure.ac, m4/ax_compare_version.m4, m4/nut_check_asciidoc.m4: - Refactor nut_check_asciidoc.m4 and configure.ac to check all doc- - tools in one place (and also only once), and fix comments and some - coding issues - -2016-12-29 Charles Lepple - - * docs/new-drivers.txt: docs: reword/reformat new-drivers.txt - Distinguish HID PDC from Q*, etc. - -2016-11-29 Florian Bruhin - - * tools/gitlog2changelog.py: Fix gitlog2changelog.py on python 3 - * scripts/augeas/gen-nutupsconf-aug.py: Make gen-nutupsconf-aug.py - work with Python 3 This makes the script work with Python 2.6+. - Fixes #345. - -2016-11-28 Daniele Pezzini - - * configure.ac: configure: fix checks for a2x-built docs Since, - starting from commit d4a55ed, we now check that documents are - buildable in an 'external' directory, we need to call a2x with '-- - destination-dir' pointing to that directory, otherwise a2x will put - the generated documents in the same directory where source files - are and then testing the non-existent files under our 'external' - directory will always fail, meaning that we will never pass these - checks. - -2016-11-21 Jim Klimov - - * docs/Makefile.am: EXTRA_DIST the docs/asciidoc.txt as used in - configure script checks - * configure.ac: configure.ac : avoid nonportable "mktemp --tmpdir" - option - -2016-11-17 Michal Soltys - - * autogen.sh: autogen.sh: minor script fixup In case any of the perl - / python parts fails (for example if system default is python3, the - script will complain about print), cd ../.. won't be executed. - Furthermore - if any of those scripts fail, there's no point in - continuing as both files are mandatory. - * docs/man/apcsmart.txt, drivers/apcsmart.c, drivers/apcsmart.h: - apcsmart: CS "hack" updates This patch adds cshdelay option (with - default set to 3.5s) between "simulate power failure" and "soft - hibernate" commands. - -2016-11-16 Arnaud Quette - - * drivers/mge-hid.c: sbhid-ups: fix Eaton/MGE mapping for beeper - handling Two HID Paths exists for handling beeper status and - commands. However, only one historic was implement, which was not - actually suitable for issuing the commands on newer units (such as - 3S, 5P*, ...) (reported by Sergey Talchuk) Closes: - https://github.com/networkupstools/nut/issues/9 - * drivers/usbhid-ups.c: usbhid-ups: adjust debuging info - -2016-11-09 Charles Lepple - - * docs/nut-names.txt, drivers/libusb0.c, drivers/libusb1.c: Add - `driver.version.usb` variable Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-11-03 Charles Lepple - - * data/driver.list.in: HCL: CP1500EPFCLCD Source: - https://github.com/networkupstools/nut/issues/337 - -2016-11-02 Charles Lepple - - * data/driver.list.in: HCL: Eaton 5E2200VA Reference: - https://github.com/networkupstools/nut/issues/335 - * data/driver.list.in: HCL: Eaton Ellipse PRO 650 VA (USB) supported - by usbhid-ups Closes: - https://github.com/networkupstools/nut/issues/255 - -2016-10-21 Charles Lepple - - * docs/download.txt: download.txt: Add Slackware link - -2016-10-12 Kirill Ovchinnikov - - * drivers/apc-mib.c, drivers/snmp-ups.c: apc-mib.c modified for - ups.delay.{start,shutdown} to include SU_TYPE_TIME - -2016-10-11 Yann E. MORIN - - * clients/upsclient.c: client/ups: add missing include struct - timeval is declared in sys/time.h, so we need to #include it. - -2016-10-11 Arnaud Quette - - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c: - Remove unimplement nut-scanner option The -F --fingerprints-file - option, used to provide an additional list of SNMP fingerprints, - was never implemented, but made its way into the code. Remove it, - at least while waiting for an actual implementation - * docs/man/nut-scanner.txt: Update nut-scanner manual page - * tools/nut-scanner/nutscan-device.c, tools/nut- - scanner/scan_xml_http.c: Fix c++ style comments - -2016-04-03 Alica - - * conf/upsstats.html.sample: upsstats.html: Conform to HTML 4.01 - Strict Closes: https://github.com/networkupstools/nut/pull/278 - * conf/upsstats-single.html.sample: upsstats-single.html: Conform to - HTML 4.01 Strict - -2016-10-05 Arnaud Quette - - * common/common.c: Fix c++ style comments - * drivers/snmp-ups.c: Fix exit code for --list - -2016-09-28 Jim Klimov - - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/scan_xml_http.c: nut-scanner : implement single- - IP and IP-range UDP NetXML device discovery - * tools/nut-scanner/scan_snmp.c: scan_xml_http.c : fix leading - whitespaces (SPACE vs TABs mixed in code) - * tools/nut-scanner/scan_snmp.c: scan_xml_http.c : replace some - fprintf with upsdebugx - * tools/nut-scanner/nut-scanner.c: nut-scanner.c : increased debug- - tracing messages of nut-scanner progress - * tools/nut-scanner/nut-scanner.c: nut-scanner.c : replaced printq() - with standard upsdebugx(), added "-D" option to increase debug - verbosity as common in NUT, moved the help text printout to its own - function - -2016-09-27 Jim Klimov - - * common/common.c, include/common.h: common.c/.h : simplify the - upsdebugx() enhancement (no need to fight with warnings/pragmas) - -2016-09-26 Arnaud Quette - - * scripts/systemd/nut-server.service.in: systemd: add reload support - for nut-server / upsd Add ExecReload entry to execute a - configuration reload of upsd, using the available 'upsd -c reload' - -2016-09-25 Charles Lepple - - * drivers/libusb1.c: libusb1: use return code from libusb_open() Per - , the handle is only populated when the return code - is 0. This fixes a crash during device detection where more than - one HID UPS is available, and the driver needs to skip the first - one. - -2016-09-21 Jim Klimov - - * include/common.h: common.h : rearranged the - ENABLE_WARNING/DISABLE_WARNING macro definitions so they are only - called for supported compilers and generate empty macros (no-op) - for others - -2016-09-20 Jim Klimov - - * common/common.c: common.c : move anti-warning macros out of the - function body, some compilers do not like that - -2016-09-19 Jim Klimov - - * tools/nut-scanner/scan_xml_http.c: scan_xml_http.c : do not suggest - NetXML support for ePDUs (almost exclusively they are XMLv4 and do - not work with current NUT) - -2016-09-18 Jim Klimov - - * common/common.c: common.c : in upsdebugx() added "[Dx]" prefix : do - not add it for level 0 - -2016-09-17 Jim Klimov - - * common/common.c, include/common.h: common.c : augment upsdebugx() - and upsdebug_with_errno() by prepending the debug-level to logged - messages - * common/common.c: common.c : fix whitespaces - -2016-09-17 Jim Klimov - - * configure.ac: configure.ac : do not fail configuration if a doctype - picked with "auto" can not be built on this system - just skip it - -2016-09-15 Jim Klimov - - * drivers/snmp-ups.c: Added and documented an snmp-ups argument to - list currently loaded MIB-to-NUT mappings (typo fix) - * docs/man/snmp-ups.txt, drivers/snmp-ups.c: Added and documented an - snmp-ups argument to list currently loaded MIB-to-NUT mappings - * drivers/snmp-ups.c: snmp-ups.c : small typo fix - * docs/man/snmp-ups.txt, drivers/ietf-mib.c: Mention tripplite - mapping in snmp-ups manpage; updated some comments about it in - ietf-mib.c - * configure.ac: configure.ac : when verifying ability to build docs, - consider out-of-tree builds too - -2016-09-14 Jim Klimov - - * configure.ac: configure.ac : verify that we can actually build a - simple or chunked HTML document, beside having nominal versions of - software - * configure.ac: configure.ac : verify that we can actually build a - manpage document, beside having nominal versions of software - * configure.ac: configure.ac : verify that we can actually build a - simple PDF document, beside having nominal versions of software - -2016-09-13 Jim Klimov - - * drivers/ietf-mib.c: Give the Tripplite SNMP MIB a name, do not - duplicate "ietf" entries - -2016-09-02 Arnaud Quette - - * drivers/bcmxcp_usb.c, drivers/blazer_usb.c, drivers/libusb1.c, - drivers/nutdrv_atcl_usb.c, drivers/nutdrv_qx.c, - drivers/richcomm_usb.c, drivers/riello_usb.c: libusb 1.0 port: fix - return code for interrupt ops libusb 1.0 returns on success, the - number of bytes actually transferred or otherwise an error code, - except for interrupt transfers, where the actual transfer size is - stored in a separate variable. The libusb 1.0 implementation in NUT - thus needed to be fixed to behave the same way than the libusb 0.1 - implementation Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-31 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0 port: remove the check on USB device - count With the port to libusb 1.0, a sanity check was done on the - available number of USB devices to try. This however caused a - behavior regression, since the only device that NUT may have access - to can be the only UPS connected. In this case, the driver may exit - upon trying to reconnect if the device is transiently not available - Reference: https://github.com/networkupstools/nut/issues/300 - * drivers/libusb1.c, drivers/richcomm_usb.c: libusb 1.0 port: - complete usb_set_altinterface code usb_set_altinterface allows to - force the USB code to call `libusb_set_interface_alt_setting (0, - 0)` (equivalent to `libusb_set_altinterface(0)` in libusb 0.1), as - was done in NUT 2.7.2 and earlier. However, the libusb 1.0 - implementation was still missing the related code Reference: - https://github.com/networkupstools/nut/issues/300 - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: libusb 1.0 port: - fix kernel driver detachment Following the recent modification for - the kernel driver detachment, and the related functions - availability depending on the platforms, nutdrv_atcl_usb and - richcomm_usb were using the wrong macro for - libusb_set_auto_detach_kernel_driver and were missing the libusb - 1.0 code for explicit kernel driver detachment Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-17 Arnaud Quette - - * drivers/libusb1.c, m4/nut_check_libusb.m4: libusb 1.0 port: rework - the kernel driver detachment libusb 1.0 has introduced a new - function (libusb_set_auto_detach_kernel_driver), beside from the - explicit kernel driver detachment request - (libusb_detach_kernel_driver). However, the former is not available - on all systems. As an example, FreeBSD 10.1-10.3 does not have - this. The detachment and interface claiming has been reworked to - handle this case (reported by Charles Lepple) Reference: - https://github.com/networkupstools/nut/issues/300 - -2016-08-16 Arnaud Quette - - * clients/upsrw.c: upsrw: display the variable type beside ENUM / - RANGE upsrw now displays more information, beside the ENUM and - RANGE, such as the variable type (NUMBER or STRING), and the - maximum length for STRING Closes: - https://github.com/networkupstools/nut/issues/267 - * include/extstate.h: Add an explicit type NONE (ST_FLAG_NONE) - Reference: https://github.com/networkupstools/nut/issues/267 - * server/netget.c: Modify server side publication for variable type - ENUM can be either NUMBER or STRING, which was previously not - published. Reference: - https://github.com/networkupstools/nut/issues/267 - * drivers/dstate.c: Automatically set the "NUMBER" flag for ranges - Ranges, added through dstate_addrange(), only support numeric - ranges. So automatically add the ST_FLAG_NUMBER flag to range - Reference: https://github.com/networkupstools/nut/issues/267 - * drivers/dstate.c: Support ST_FLAG_NUMBER in dstate_setflags() - Allow the drivers to explicitly use ST_FLAG_NUMBER through - dstate_setflags() Reference: - https://github.com/networkupstools/nut/issues/267 - * include/extstate.h: Add an explicit type NUMBER (ST_FLAG_NUMBER) - Beside from the existing ST_FLAG_STRING, a need has arise to have - an explicit type NUMBER, and thus a flag for this type, can be used - generally, and more specifically with the driver primitive - dstate_setflags() Reference: - https://github.com/networkupstools/nut/issues/267 - -2016-08-12 Arnaud Quette - - * drivers/libusb1.c: libusb 1.0: remove unused typesafe_control_msg() - workaround For libusb 0.1 implementation, we had to workaround a - libusb API goofs, by wrapping the base function usb_control_msg(), - and casting the variables to the right type. This is not needed for - libusb 1.0 implementation, but was wrongly left in the code - (reported by Charles Lepple) - * clients/upsrw.c: upsrw: display current values of NUMBER variables - References: https://github.com/networkupstools/nut/issues/267 - * drivers/snmp-ups.c: snmp-ups: discard decimals when set to "0" - Publish values as integer when decimals are set to "0". This at - least makes sense for some values that are real integers (phases - and outlets counts for example), but also with many other values - that have not sufficient precision to provide decimals - -2016-08-11 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: fix a warning on unused variable - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: simplify bus publication - bus publication was wrongly listing both the bus and the portname, - instead of the bus only. This may have caused some issue when - trying to match the port - * drivers/usbhid-ups.c: usbhid-ups/mge-shut: forgotten version bump - * drivers/usbhid-ups.c: usbhid-ups/mge-shut: rework errno/errors - handling libusb 1.0 has its own set of return codes, and error - interface. Rework the common HID core (shared between usbhid-ups - and mge-shut) so that error handling can work with both, and using - either libusb 0.1 or 1.0 for usbhid-ups - * tools/nut-scanner/scan_usb.c: nut-scanner: missing symbols lookup - for libusb 1.0 A few symbols from libusb 1.0 were wrongly used - directly, instead of being looked up and loaded at init time - * drivers/bcmxcp_usb.c, drivers/libusb1.c, drivers/nutdrv_atcl_usb.c, - drivers/richcomm_usb.c: libusb 1.0 port: add missing libusb_exit() - calls - * tools/nut-scanner/nutscan-init.c, tools/nut-scanner/scan_usb.c, - tools/nut-usbinfo.pl: nut-scanner: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c, drivers/richcomm_usb.c: Remove redundant - variable - * drivers/tripplite_usb.c: tripplite_usb: remove extraneous comment - char - * drivers/nut_libusb.h: permute typedef order of usb_dev_handle - * drivers/nutdrv_qx.c: nutdrv_qx: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/richcomm_usb.c: richcomm_usb: missing function remap for - libusb 0.1 usb_strerror was not remapped for libusb 0.1 - implementation - * drivers/tripplite_usb.c: tripplite_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/riello_usb.c: riello_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - -2016-08-10 Arnaud Quette - - * drivers/richcomm_usb.c: richcomm_usb: initial port to libusb 1.0 - The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: add the missing detach - call libusb 1.0 provide its own routine for detaching kernel - driver - * drivers/Makefile.am, drivers/libhid.c, drivers/nut_libusb.h: - Forgotten occurences of libusb.h renaming NUT internal header - "libusb.h" was renamed, since it collides with the libusb 1.0 - header, which has the same name. A few occurences of reference and - documentation were however missing - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: initial port to libusb - 1.0 The port to libusb 1.0 is complete, at least from a build - perspective. This now needs to be tested with devices - * drivers/blazer_usb.c: blazer_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * drivers/bcmxcp_usb.c: bcmxcp_usb: code cleanup - -2016-08-09 Arnaud Quette - - * drivers/bcmxcp_usb.c: bcmxcp_usb: initial port to libusb 1.0 The - port to libusb 1.0 is complete, at least from a build perspective. - This now needs to be tested with devices - * docs/configure.txt, drivers/Makefile.am, drivers/libhid.c, - drivers/libhid.h, drivers/{libusb.c => libusb0.c}, - drivers/libusb1.c, drivers/{libusb.h => nut_libusb.h}, drivers/usb- - common.h, drivers/usbhid-ups.c: ushid-ups: complete the port to - libusb 1.0 The port to libusb 1.0 is now complete for usbhid-ups. - Other USB drivers (bcmxcp_usb, blazer_usb, nutdrv_atcl_usb, - richcomm_usb, riello_usb, tripplite_usb, nutdrv_qx) have still to - be addressed - -2016-08-06 Jim Klimov - - * docs/man/dummy-ups.txt: dummy-ups.txt : noted the sleep between - loops - * docs/man/dummy-ups.txt: dummy-ups.txt : text and formatting revised - to be clearer to the uninitiated - -2016-08-04 Arnaud Quette - - * docs/man/snmp-ups.txt: snmp-ups: document the use of non-standard - port SNMP agent may publish data over a non-standard port, i.e. - not 161. This feature is supported since the origin, but was not - explicitly documented nor usable - -2016-08-01 Arnaud Quette - - * configure.ac, m4/nut_check_libusb.m4: Initial port to libusb 1.0 - Starting with the configure checks, to detect if libusb 1.0 if - available, and otherwise fall back to the libusb 0.1 backend - -2016-07-11 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix device.type publication In - daisychain mode at least, device.type was not set to its actual - value, using the current mapping structure, but defaulting to "ups" - (reported by Tomas Halman, from Eaton) - * drivers/snmp-ups.c: snmp-ups: fix and improve match_sysoid The - function was returning FALSE instead of NULL in one case. Also - retry at most 3 times to get the sysOID - -2016-07-07 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix instant commands publication - With non-daisychain setup, there was a bug that created an infinite - test loop when trying to add instant commands - -2016-06-30 Tomas Halman - - * clients/nutclient.cpp: nutclient: fix library segmentation fault if - device name doesn't exists. If device doesn't exist, getClient() - returns NULL. Then calling the method like - getClient()->getDeviceDescription(getName()) causes segfault. We - rather check the status and throw an exception in this case. - -2016-06-25 Charles Lepple - - * docs/acknowledgements.txt: doc: fix acknowledgements link to GitHub - -2016-06-23 Timothy Pearson - - * drivers/libhid.c, drivers/tripplite-hid.c, drivers/usbhid-ups.c, - scripts/upower/95-upower-hid.rules: Add support for SU3000LCD2UHV - Note that protocol 1330 does not respond to requests for - UPS.OutletSystem.Outlet.DelayBeforeReboot, therefore those requests - needed to be bypassed in the driver. - -2016-06-23 Arnaud Quette - - * drivers/mge-xml.c: netxml-ups: detect the unsupported XML v4 - protocol The XML/PDC protocol had an update with version 4, for - ePDU. However, this version is not supported by netxml-ups. We now - detect this version, and explicitly exit with an "XML v4 protocol - is not supported!" message - * drivers/netxml-ups.c: netxml-ups: fix a segmentation fault - netxml_get_page() was not checking if page is NULL, hence resulting - in a segmentation fault with Eaton ePDU, which use the unsupported - version 4 of the XML/PDC protocol. Bump the driver version to 0.41 - -2016-06-13 Tomas Halman - - * clients/nutclient.cpp: NUT client library: internal::Socket class - must close socket in destructor. - -2016-04-16 Charles Lepple - - * data/driver.list.in, drivers/mge-hid.c, scripts/upower/95-upower- - hid.rules: usbhid-ups: add IBM USB VID Reference: - http://article.gmane.org/gmane.comp.monitoring.nut.user/7721 and - http://news.gmane.org/find- - root.php?message_id=5712AB29.6040001%40delphinidae.org.uk - -2016-06-09 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: 2nd pass on fixing memory leaks Fix - some remaining memory leaks reported by Coverity scan - * drivers/snmp-ups.c: snmp-ups: fix memory leaks and incorrect - expression Following the registration of NUT in Coverity scan, a - number of issues were identified. This is the very first set of QA - fixes related to this static code analysis - -2016-06-08 Arnaud Quette - - * Makefile.am: AIX package: reference the exact tarball version - -2016-06-07 Charles Lepple - - * docs/download.txt: Update VMware ESXi package link (from René - Garcia) - -2016-06-07 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix some regression due to daisychain - A few issues were remaining, following the daisychain support - addition. Issues were related to, at least, 3ph initialization and - data not being published, and identified with Eaton 3ph units, - using the "pw" MIB (reported by Yves Clauzel, from Eaton) - -2016-06-05 Timothy Pearson - - * drivers/powerp-txt.c: Add deep battery test for CyberPower - OL3000RMXL2U - -2016-05-31 Arnaud Quette - - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: support - daisychain commands and settings Daisychain commands and settings - on subdevices are now supported. Since 95% of the code of these two - functions was similar, a new function called su_setOID() was - created, and is now called by su_setvar and su_instcmd. This new - function is also daisychain-aware - * drivers/dstate.c: dstate: adapt daisychain devices functions For - daisychain devices, we increase the counter when alarms are present - on a subdevice, but don't decrease the count when the buffer is - empty. Otherwise, we may not get the ALARM flag in ups.status, - while there are some alarms present on device.X - * drivers/eaton-mib.c: snmp-ups: fix input.L2.voltage on Eaton G2/G3 - PDU This data entry was missing the daisychain formatting - directive, which resulted in this data not being published - (reported by Vyskocil Michal from Eaton) - -2016-05-27 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix regression related to daisychain - Fix a few regression with unitary devices, related to the - daisychain changes of the SNMP core engine - * drivers/dstate.c: dstate: enforce underflow to not generate false - alarm The newly introduced daisychain mechanism, with alarm - counters (not just boolean) introduced a potential underflow on - alarm_commit, which resulted in false positive "ALARM" flag - publication in ups.status - * drivers/snmp-ups.c: snmp-ups: update for daisychain Update the - daisychain implementation, as per the latest specification, - including considerations on "device.0". Alarms are also handled for - the daisychain devices. Initial code for settings and commands is - also present, but will be completed in subsequent commits, along - with a final cleanup and potential composite settings and commands - on "device.0" (that are then applied to all daisychain devices) - * drivers/eaton-mib.c: snmp-ups: fix some daisychain data for Eaton - PDU Some data (outlet.%i.current, outlet.%i.power, - outlet.%i.load.{off,on,cycle} and - outlet.group.%i.load.{off,on,cycle}) were missing the daisychain - formatting string, and were hence not published - * docs/daisychain.txt, drivers/dstate.c, drivers/dstate.h: dstate: - add functions to address daisychain alarms Add 2 new functions, - device_alarm_init() and device_alarm_commit(), to address - daisychain devices: these acts as the standard alarm_{init,commit}, - but only clearing / committing the alarm buffer, and not - reinitializing the main alarm counter. Hence, the "device.0" (whole - daisychain) knows if it has to publish the "ALARM" flag in - ups.status - -2016-05-25 Arnaud Quette - - * docs/new-drivers.txt: daisychain: add a reference for drivers and - alarms - * docs/daisychain.txt: daisychain: update specification for alarms - handling - * drivers/eaton-mib.c, drivers/snmp-ups.c, drivers/snmp-ups.h: snmp- - ups: daisychain update, fix and completion Following the - specification update on "device.0" consideration, adapt the current - implementation. For now, the whole daisychain will only publish - device.{mfr,model,count}. Initial support for settings and commands - was also added, and will be expanded to "device.0" - * docs/daisychain.txt: daisychain: update and fix specification - * docs/daisychain.txt: daisychain: update specification as per - discussion - -2016-05-23 Arnaud Quette - - * docs/Makefile.am, docs/daisychain.txt, docs/developer-guide.txt, - docs/user-manual.txt: daisychain documentation: fix documentation - building The daisychain documentation was missing from the build - rules, and from the documentation integration, which resulted in - documentation build being broken (reported by Charles Lepple). As a - side note, the documentation (both user and developer) will need - some update and cleanup, now that there is more content Closes: - https://github.com/networkupstools/nut/issues/291 - * drivers/eaton-mib.c: snmp-ups: Eaton Aphel Revelation updates - Update Eaton Aphel Revelation MIB mapping, by fixing outlets - switchability publication and adding "device.revision". This last - data still has to be submitted as an RFC for extending NUT - variables namespace - -2016-05-19 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix daisychain regression A bug was - discovered with the new daisychain code and non-daisychained - device, resulting in data not being published - -2016-05-18 Arnaud Quette - - * drivers/compaq-mib.c, drivers/ietf-mib.c, drivers/mge-mib.c, - drivers/netvision-mib.c, drivers/powerware-mib.c, drivers/snmp- - ups.c, drivers/snmp-ups.h: snmp-ups: daisychain handling of 1ph / - 3ph phases Per device phases management is now available in - daisychain mode, for input, output and bypass. The overall - mechanism for phase determination has also changed to something - more generic, and not requiring the SU_FLAG_SETINT flag - * drivers/eaton-mib.c: snmp-ups: fix input.phases for Eaton G2 / G3 - ePDU The current implementation was using the number of input, not - the number of phase(s) - -2016-05-17 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: initial daisychain support for Eaton - PDU Following the base implementation for daisychain support in - the SNMP driver core (snmp-ups), add support for daisychain for - Eaton PDU. Commands definitions are disabled for now, and will be - addressed in a subsequent commit - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: base daisychain - support This commit includes the initial support for daisychain. - There are however a number of limitations that still need to be - addressed, such as: * {input,output,bypass}.phase handling: for - now, mixed / hybrid daisychains are not supported * All devices - alarms are pushed to "ups.alarm" without discriminant (i.e. not - "device.X" appended to the alarm) * commands and settings are not - yet handled * non-regression testing on unitary devices have to be - done - * README, docs/outlets.txt, docs/user-manual.txt: Documentation - adjustments - * docs/daisychain.txt, docs/nut-names.txt: daisychain: initial - specification and documentation - * drivers/mge-hid.c: mge-shut/usbhid-ups: list AEG PROTECT NAS vendor - 06da AEG PROTECT NAS were previously using VendorID / ProductID - 0x2b2d / 0xffff, and are now using 0x06da / 0xffff. Also bump the - mge-hid subdriver version to 1.40 - -2016-05-13 Arnaud Quette - - * docs/man/nutupsdrv.txt: Mention explicitly the default pollinterval - As in ups.conf manual page, mention the default poll interval, to - make it clear - -2016-05-10 Arnaud Quette - - * docs/nut-qa.txt: NUT QA: add Coverity static code analysis - information NUT is now a registered Coverity project, and can thus - get static code analysis from it. This is just a first step, and - actions are needed to address the actual defects and complete the - project configuration. Due thanks to Synopsys, Inc., mother firm of - Coverity, for providing this service to Opensource project - -2016-05-09 Arnaud Quette - - * drivers/apc-mib.c, drivers/snmp-ups.h: snmp-ups: remove the - redundant SU_TYPE_STRING define SU_TYPE_STRING was originally - created to expose a required cast to string. However, it is - redundant with ST_FLAG_STRING, and not useful in the end. The only - subdriver that was using it is apc-mib (UPS support) and this was a - no-op - * README: Fix wrong link reference The "NUT outlets management and - PDU notes" were wrongly referred to as "Configuring automatic UPS - shutdowns - -2016-05-04 Jim Klimov - - * .gitignore, docs/.gitignore: GitIgnore some built documents - -2016-05-03 Jim Klimov - - * configure.ac: configure.ac : prefer "/usr/share/augeas/lenses/dist" - over "/usr/share/augeas/lenses" if present - -2016-05-03 Arnaud Quette - - * docs/configure.txt: Document Augeas lenses configure option Add - documentation on the new configure option --with-augeas-lenses- - dir=PATH - -2016-05-03 Jim Klimov - - * docs/Makefile.am, docs/man/Makefile.am: Follow-up to NUT PR#281 - - notice for the future - * docs/Makefile.am, docs/man/Makefile.am: Revert toxic commit: "a2x - says "--destination-dir" is only valid for HTML... so let us reduce - complaints reported in build" This reverts commit - fe17861c4ea12679b3ebfefa8a6d692d79d99f2d because in fact asciidoc - (8.6.9) lies about not supporting the flag, and it is reqired for - `ASCIIDOC_VERBOSE=-v make distcheck-light` to pass. So let's keep - it complaining but working. - * Makefile.am, configure.ac, scripts/augeas/Makefile.am: Allow "make - install" to deliver Augeas lenses into the path defined by - configure (defaults to /usr/share/augeas/lenses) - -2016-05-02 Jim Klimov - - * docs/Makefile.am, docs/man/Makefile.am: a2x says "--destination- - dir" is only valid for HTML... so let us reduce complaints reported - in build - * configure.ac: configure.ac : by default, "--with-doc=man=yes" to - match legacy expectations, and permit "make dist" out of the box - -2016-04-26 Arnaud Quette - - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c: nut- - scanner: Force numeric OIDs resolution Force numeric OIDs - resolution (ie, do not resolve to textual names) and disable MIB - loading. This is mostly for the convenience of debug and results - output - * scripts/subdriver/gen-snmp-subdriver.sh: SNMP subdriver generator: - add a FIXME - -2016-04-11 Michal Vyskocil - - * drivers/netvision-mib.c: netvision-mib: uses 0 as dfl Change to - NULL as other subdrivers does - -2016-04-11 Arnaud Quette - - * tools/nut-scanner/nutscan-init.c: nut-scanner: additional search - path Prepend "/usr/" to the provided --libdir, in case this one - points at "/lib/..." or similar, and not to "/usr/lib/..." - -2016-04-09 Émilien Kia - - * clients/nutclient.cpp: Correctly increment pointer in - stringset_to_strarr and stringvector_to_strarr. Fix bug #232 - * tests/Makefile.am, tests/nutclienttest.cpp: Create unit test - (failing for now) to test bug #232 (nutclient: - stringset_to_strarr() and stringvector_to_strarr() only work for - one element). - * clients/nutclient.cpp: Make string[set|vector]_to_strarr public to - be accessible to unit tests. - * clients/nutclient.h: Make nut::Client::~Client virtual. Prevent - compilation warning [-Wdelete-non-virtual-dtor]. - -2016-03-23 Jim Klimov - - * configure.ac, docs/configure.txt, docs/man/Makefile.am: Added - WITH_MANS support (to toggle generation of manpages) and revised - other documentation formats - -2016-04-08 Jim Klimov - - * configure.ac, docs/configure.txt: configure.ac : do not inspect - systemdunitdir with pkg-info if we asked not to use it at all - -2016-04-07 Arnaud Quette - - * drivers/raritan-px2-mib.c: snmp-ups: fix a missing field in - raritan_px2 mapping The default value (dfl field) was missing, and - thus producing a compilation warning - -2016-04-07 Jim Klimov - - * docs/configure.txt, m4/nut_check_libgd.m4, - m4/nut_check_libnetsnmp.m4: Allow to customize path to gdlib-config - and net-snmp-config programs - -2016-04-06 Arnaud Quette - - * data/driver.list.in, docs/man/snmp-ups.txt, drivers/Makefile.am, - drivers/raritan-px2-mib.c, drivers/raritan-px2-mib.h, drivers/snmp- - ups.c: snmp-ups: support Raritan Dominion PX2 PDU Based on initial - work and data from Opengear, using SNMP subdriver creation script, - add support for the more recent Raritan PDU, model PX2. This was - tested with a PX2-1486 (Metered Input), but should cover all PX2 - models - * scripts/subdriver/gen-snmp-subdriver.sh: SNMP subdriver creation - script: minor updates - -2016-03-23 Jim Klimov - - * configure.ac: Fix "--with-doc=auto" to use present doc-gens * - configure.ac : when using "--with-doc" do actually proceed if some - supported methods are found and some are not... build what we can - on this platform * configure.ac : revised upon peer review : - yes==all, default(empty)==no as documented in --help, auto guesser - must be explicit - -2016-03-24 Kirill Ovchinnikov - - * drivers/snmp-ups.c, drivers/snmp-ups.h: Added a feature of power on - and power off delay time writing to UPS configuration; Added - support of writing "timeticks" values to su_setvar() routine - -2016-03-23 Michal Vyskocil - - * drivers/eaton-mib.c: Bumb version of eaton-mib - -2016-03-23 Arnaud Quette - - * docs/man/snmp-ups.txt, docs/snmp.txt: Fix references to the SNMP - section of protocols - -2016-03-22 Michal Vyskocil - - * drivers/snmp-ups.h: snmp-ups: mark SU_FLAG_OK as internal to the - driver - * drivers/eaton-mib.c: snmp-ups: add outlet type to Eaton Marlin MIB - -2016-03-22 Arnaud Quette - - * configure.ac: Remove the extraneous GNU in front of FreeIPMI - Messages are now more homogeneous - * docs/configure.txt: Clarify multiple specifier for --with-doc - * docs/configure.txt: Update FreeIPMI requirements The documented - requirements were out of date, compared to the tests done at - configure time - -2016-03-22 Michal Vyskocil - - * drivers/snmp-ups.h: snmp-ups: enhance documentation of some flags - Mark SU_FLAG_OK as deprecated and SU_FLAG_STALE as internal to - driver. This helps new developers to write or extend snmp - subdrivers. - * docs/nut-names.txt: Document outlet.n.type Add and document - outlet.n.type variable, which provides information about physical - outlet type. - -2016-03-19 Charles Lepple - - * configure.ac: Version to 2.7.4.1 for snapshots - -2016-03-18 Marty R - - * docs/download.txt: Update OpenWRT package information The previous - link is over 5 years old, nut is now maintained in the packages - repository on GitHub. - -2016-03-10 Arnaud Quette - - * tools/nut-scanner/Makefile.am: Fix nut-scanner compilation in some - environments Following the commits 5187dab (common: add some - string-related functions) and e767df5 (common: consolidate some - string-related functions), the build rules of nut-scanner were not - updated to also use str.c. Since the libcommon.la dependency was - still there, some environments managed to build cleanly, while - other are failing. Update build dependencies to fix this situation - * drivers/powerware-mib.c: snmp-ups: Eaton 3ph UPS improvements Fix - the battery test status reporting, and start to simplify the - mapping layout by getting rid of some #define. Also add the - following: - battery test result "Unknown" - last battery - replacement date (battery.date) - output.voltage thresholds (high - and low) and nominal value - * drivers/snmp-ups.c: snmp-ups: add a debug trace on - nut_snmp_get_int() - -2016-03-09 Arnaud Quette - - * configure.ac: Fix autoreconf on Debian For some reason, Automake - doesn't search the current directory correctly when searching for - helper scripts, when 'nut' is running as a git-submodule, as it is - the case with the website repository - * configure.ac: update version to 2.7.4 - * drivers/apc-ats-mib.c: snmp-ups: add APC ATS input.source - * drivers/snmp-ups.c: snmp-ups: fix the matching OID tests For both - sysOID and classic methods, we used to test one of the two OIDs - provided in the mib2nut structures. However, these two OIDs - (oid_pwr_status and oid_auto_check) tend to be redundant and - confusing. Replace these matching by an extraction of - {ups,device}.model - * drivers/nut-libfreeipmi.c: nut-ipmipsu: fix compilation warnings - * NEWS, UPGRADING, docs/FAQ.txt, docs/net-protocol.txt, docs/new- - drivers.txt, docs/nut-names.txt, docs/nutdrv_qx-subdrivers.txt, - docs/packager-guide.txt, docs/snmp-subdrivers.txt, lib/README, - scripts/augeas/README: Fix spelling and typo errors Following the - spell-checking scope expansion, do a spell-checking pass - * docs/documentation.txt: Update documentation as per the new devices - scope - * docs/features.txt, docs/user-manual.txt: Update documentation as - per the new devices scope - * docs/Makefile.am: Expand spell-checking scope Add more documents, - outside of the docs/ directory Closes: - https://github.com/networkupstools/nut/issues/222 - -2016-03-08 Arnaud Quette - - * configure.ac, tools/Makefile.am, tools/driver-list-format.sh: Check - driver.list[.in] format at make dist time Instead of checking - driver.list.in at configure time, move the checking and - modification into a script that is called at make dist time. The - script can also be called manually, and will try to fix both - driver.list.in and driver.list - -2016-03-07 Arnaud Quette - - * drivers/powerware-mib.c: Remove an erroneous test This was made - test the enumerated values registration in snmp-ups, and should not - have been committed - * data/driver.list.in: HCL: APC ATS AP7724 supported by snmp-ups - These Automatic Transfer Switch should be supported by snmp-ups, - however this was not tested at all Reference: - https://github.com/networkupstools/nut/issues/260 - * NEWS, UPGRADING: Update for release 2.7.4 - * drivers/Makefile.am, drivers/apc-ats-mib.c, drivers/apc-ats-mib.h, - drivers/snmp-ups.c: snmp-ups: support APC Automatic Transfer Switch - Following the recent extension of NUT scope and variable namespace, - to support Automatic Transfer Switch (ATS), implement SNMP support - for APC ATS (with help from "maaboo" through github) Reference: - https://github.com/networkupstools/nut/issues/260 - -2016-03-04 Arnaud Quette - - * drivers/baytech-mib.c, drivers/bestpower-mib.c, drivers/compaq- - mib.c, drivers/cyberpower-mib.c, drivers/eaton-mib.c, drivers/mge- - mib.c, drivers/netvision-mib.c, drivers/powerware-mib.c, - drivers/raritan-pdu-mib.c: snmp-ups: fix mib2nut structures Non - existent OIDs, for testing MIB selection, must be expressed as NULL - and not as empty string ("") for the algorithm to work - -2016-03-03 Daniele Pezzini - - * docs/download.txt: docs: update several download links - -2016-03-03 Arnaud Quette - - * docs/man/upsrw.txt, docs/net-protocol.txt: Clarification on NUMBER - type float values Clarify a bit more documentation on how to - express float values, when using upsrw. That is to say, using - decimal (base 10) english-based representation, so using a dot, in - non-scientific notation. So hexadecimal, exponents, and comma for - thousands separator are forbiden - * clients/upsrw.c, docs/net-protocol.txt, server/netget.c: Prefer - NUMBER to NUMERIC for variable type As per discussion on the - Github pull request, NUMBER would be more suitable than NUMERIC - -2015-11-22 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: increase timeouts in 'sgs' USB - subdriver Apparently the previously used timeouts in the 'sgs' USB - subdriver were not always enough, so increase them. - -2015-11-11 Daniele Pezzini - - * data/driver.list.in: HCL: various TS Shara UPSes supported by - nutdrv_qx Protocol: 'megatec' USB subdriver: 'sgs' - * drivers/nutdrv_qx.c: nutdrv_qx: make sure 'sgs' USB subdriver uses - only what it reads Since, in 'sgs' USB subdriver, we read only 8 - bytes at a time and we expect the first byte to tell us the length - of the data that follows, make sure we don't use more than what we - read from the device in case the first byte is not what we expect - it to be. - -2015-03-04 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: increase verbosity of 'sgs' USB - subdriver In 'sgs' USB subdriver: - be more verbose when - debugging, - always print the return code when dealing with an - error. - -2014-01-31 Daniele Pezzini - - * docs/man/nutdrv_qx.txt: nutdrv_qx: update man page for new 'sgs' - USB subdriver - -2014-01-31 Ronaldo Yamada - - * drivers/nutdrv_qx.c: nutdrv_qx: add new 'sgs' USB subdriver to - support TS Shara units - -2016-03-02 Arnaud Quette - - * data/driver.list.in: HCL: added Eaton Powerware 9125-5000g - Supported with the additional USB card, with the bcmxcp_usb driver - * docs/man/upsrw.txt, docs/net-protocol.txt: Clarification on NUMERIC - type float values Clarify documentation on how to express float - values, when using upsrw. That is to say, using decimal english- - based representation, so using a dot - * drivers/mge-xml.c: netxml-ups: fix Eaton XML published data Some - raw protocol data were wrongly published, and are now commented. - Also add some R/W flags to ambient thresholds Closes: - https://github.com/networkupstools/nut/issues/201 - * tools/nut-scanner/nut-scanner.c: nut-scanner: fix thread attachment - Add a test to have the right thread waiting for the scan to be - complete (patch from Michal Hlavinka, Red Hat) - * configure.ac, tools/nut-scanner/nutscan-init.c, tools/nut- - scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: nut-scanner: - don't depend on development libraries nut-scanner was previously - trying to use directly libXXX.so (libusb-0.1, libfreeipmi, - libnetsnmp, libavahi-client, libneon, libupsclient}. However, these - files are generally provided by the development packages. nut- - scanner now tries to look at some known paths, including the one - provided through --libdir, to find the correct libraries Closes: - https://github.com/networkupstools/nut/issues/233 - -2016-03-01 Arnaud Quette - - * clients/upsrw.c, docs/net-protocol.txt, server/netget.c: Default to - type NUMERIC for variables Any variable that is not STRING, RANGE - or ENUM is just a simple numeric value. The protocol documentation - (net-protocol.txt) was previously stating that "The default , - when omitted, is integer." which was not fully true, since a - variable could also be a float. Hence, the wording was changed to - advertise this, and that each driver is then responsible for - handling values as either integer or float. Moreover, instead of - returning a TYPE "UNKNOWN", return "NUMERIC", which is more - suitable, and aligned with the NUT protocol specification - * tools/nut-snmpinfo.py: SNMP subdriver generator: fix output - formatting - * tools/nut-snmpinfo.py: SNMP subdriver generator: discard commented - lines Discard any commented mib2nut_info_t declaration, which - should thus not be taken into account - -2016-02-26 Arnaud Quette - - * data/driver.list.in, drivers/Makefile.am, drivers/eaton-ats-mib.c, - drivers/eaton-ats-mib.h, drivers/snmp-ups.c: snmp-ups: support - Eaton Automatic Transfer Switch Following the recent extension of - NUT scope and variable namespace, to support Automatic Transfer - Switch (ATS), implement SNMP support for Eaton ATS. Note that this - device can also be supported through Eaton XML/PDC (XML over HTTP) - protocol, supported by the NUT netxml-ups driver - * data/cmdvartab, docs/nut-names.txt: Extend namespace for Automatic - Transfer Switch (ATS) Extend NUT namespace to support a new type - of power device: ATS - Automatic Transfer Switch. These devices - are used to setup 2 power systems, such as UPS, to power a single - power supply system, and be able to automatically transfer between - the input sources in case of failure of the primary one. The added - variable are for now limited to 'input.source' and - 'input.source.preferred', but may be extended if needed - -2016-02-25 C Fraire - - * docs/scheduling.txt: Fix docs location of upssched to sbin - -2016-02-25 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: snmp-ups: add the last - missing element in the structure - * drivers/apc-mib.c, drivers/bestpower-mib.c, drivers/compaq-mib.c, - drivers/cyberpower-mib.c, drivers/delta_ups-mib.c, drivers/huawei- - mib.c, drivers/ietf-mib.c, drivers/mge-mib.c, drivers/netvision- - mib.c, drivers/powerware-mib.c, drivers/xppc-mib.c, - scripts/subdriver/gen-snmp-subdriver.sh: snmp-ups: fix values - lookup terminating element The terminating element should really - be NULL, and not the string "NULL", as it was originally done, back - in 2002 - * drivers/snmp-ups.c: snmp-ups: revert order of the NULL/"NULL" test - Fix a segfault when doing first the string comparison test - * drivers/snmp-ups.c: snmp-ups: register values enumerations - Whenever there is a values lookup structure for read/write data, - push the values as enumerations for upsrw - * drivers/snmp-ups.c: snmp-ups: try to lookup values for numeric - elements Numeric elements can also use the value resolution - mechanism - * drivers/snmp-ups.c: snmp-ups: counter test sysOID with a test OID - Some devices have buggy sysOID exposed. Allow to counter test - another OID, to be able to select between different mapping - structures - -2016-02-24 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: SNMP subdriver creation - script: allow sysOID override Allow to use -s to override buggy - sysOID in some device FW. In this case, the sysOID entry in the - mib2nut structure should be set to NULL - -2016-02-11 Arnaud Quette - - * drivers/raritan-pdu-mib.c: snmp-ups: fix macaddr support for - Raritan PDU Raritan MIB was fixed to expose macaddr on - device.macaddr instead of ups.macaddr - * drivers/baytech-mib.c: snmp-ups: fix macaddr support for Baytech - PDU Baytech MIB was fixed to expose macaddr on device.macaddr - instead of ups.macaddr - * drivers/eaton-mib.c: snmp-ups: fix and complete macaddr support for - Eaton Eaton G2 and G3 can now expose the MAC address of the - device, using device.macaddr. Eaton G1 Aphel was fixed to expose - this data on device.macaddr instead of ups.macaddr - * drivers/snmp-ups.c: snmp-ups: add support for hexadecimal octet - strings - * drivers/snmp-ups.c: snmp-ups: fallback for classic MIB detection - If the sysOID matching has failed, then snmp-ups uses ups.model to - get an OID to test. In case ups.model is not available, fallback to - trying to use device.model instead - * docs/images/nut_layering.png, docs/images/nut_layering.svg: Refresh - and complete NUT architecture diagram - -2016-02-08 Arnaud Quette - - * drivers/powerware-mib.c: snmp-ups: extend Eaton 3ph outputSource - values map Add the new status values for xupsOutputSource - (.1.3.6.1.4.1.534.1.4.5.0), that maps to both ups.status and - ups.type - -2016-02-03 Arnaud Quette - - * drivers/powerware-mib.c: snmp-ups: improve support for Eaton 3ph - Improve support for temperature and humidity data, including: - - ups.temperature now available - fixing ambient.temperature - (previously pointing at a wrong OID) - ambient.humidity now - available - the following settings now available: * - ups.temperature.low * ups.temperature.high * ambient.humidity.high - * ambient.humidity.low * ambient.temperature.high * - ambient.temperature.low - -2016-02-01 Daniele Pezzini - - * data/driver.list.in: HCL: various APCUPSD-controlled APC devices - via apcupsd-ups Originally reported by GitHub user @Thermionix. - Reference: https://github.com/networkupstools/nut/pull/215 - -2016-01-31 Charles Lepple - - * docs/man/nutdrv_atcl_usb.txt: man/nutdrv_atcl_usb: point to - nutdrv_qx (fuji) for 0001:0000 Also update best guess for the USB- - to-serial converter situation. - * docs/FAQ.txt: FAQ: udevadm for fixing permissions - -2016-01-30 Charles Lepple - - * drivers/nut-libfreeipmi.c: FreeIPMI: do not split function - arguments with a conditional Alternate approach to suggestion by - Romero B. de S. Malaquias Closes: - https://github.com/networkupstools/nut/pull/250 - -2016-01-24 Charles Lepple - - * docs/config-notes.txt: Documentation: fix formatting Put syntax - examples in verbatim mode, and remove spaces from ends of lines. - * drivers/apc-hid.c: usbhid-ups: handle missing USB strings in APC - code Closes: https://github.com/networkupstools/nut/issues/258 - Might fix: - https://bugs.launchpad.net/ubuntu/+source/nut/+bug/1483615 - -2016-01-23 Charles Lepple - - * data/driver.list.in: HCL: added NHS Laser Senoidal 5000VA Source: - http://article.gmane.org/gmane.comp.monitoring.nut.devel/7123 - Closes: https://github.com/networkupstools/nut/issues/254 - -2016-01-14 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix staleness detection With some - ePDUs or devices using template for outlet and outlet.group, - communication loss with the device were not detected, due to the - handling mechanism. Simply skipping commands for templates, after - the init time, is sufficient to avoid this issue - -2016-01-05 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: improve stale communication recovery - Disable the 10 iterations to retry communicating with stale device. - This was leading up to 10 x 30 seconds, so 5mn, before being able - to get data again - * docs/new-drivers.txt, docs/nut-names.txt: Document - battery.charger.status This will in time replace the historic CHRG - and DISCHRG flags published in ups.status. Closes - https://github.com/networkupstools/nut/issues/196 - -2016-01-03 Charles Lepple - - * data/driver.list.in: HCL: Sweex model P220 via blazer_usb - Reference: https://github.com/networkupstools/nut/issues/251 - -2016-01-04 Arnaud Quette - - * drivers/ietf-mib.c, drivers/ietf-mib.h, drivers/snmp-ups.c: snmp- - ups: add support for Tripplite units on IETF mib These devices - expose ".1.3.6.1.4.1.850.1", which could be supported through this - specific MIB. For now, just link that to the IETF MIB, to provide - a first level of support Reference: - https://github.com/networkupstools/nut/issues/171 - -2015-12-30 Arnaud Quette - - * configure.ac: First stab at checking driver.list.in format - -2015-12-29 Charles Lepple - - * scripts/upower/95-upower-hid.rules: upower: update for AEG - -2015-12-29 Arnaud Quette - - * drivers/powercom.c: Fix the processing of output voltage for KIN - units The processing of output voltage requires to also take into - account the line voltage, as reported by Patrik Dufresne. This may - still need some further adjustments Reference: - https://github.com/networkupstools/nut/issues/187 - * drivers/powercom.c: Fix the processing of input voltage for KIN - units The processing of input voltage requires to also take into - account the line voltage, as reported by Patrik Dufresne. Also bump - the driver version to 0.16, since 0.15 was already used, but not - set Reference: https://github.com/networkupstools/nut/issues/187 - * drivers/mge-hid.c: Fix letter case for AEG USB VendorID The letter - case of this VendorID may be important for generated files, such as - the udev ones (reported by Charles Lepple) - -2015-12-28 Arnaud Quette - - * data/driver.list.in, drivers/mge-hid.c: HCL: AEG PROTECT B / NAS - supported by usbhid-ups Reference: - https://github.com/networkupstools/nut/issues/249 - -2015-12-17 Daniele Pezzini - - * data/driver.list.in: HCL: Legrand Keor Multiplug supported by - nutdrv_qx Reference: - https://github.com/networkupstools/nut/issues/248 - -2015-12-09 Andrey Jr. Melnikov - - * drivers/bcmxcp_usb.c: Don't call usb_close() after reset - -2015-12-08 Andrey Jr. Melnikov - - * drivers/bcmxcp_usb.c: Call usb_reset() when driver unable to claim - device - * drivers/bcmxcp.h, drivers/bcmxcp_usb.c: Refactor get_answer() - routine, make it properly deal with multi-packets responses. Lower - stack usage. - -2015-07-27 Daniele Pezzini - - * common/common.c, common/str.c, drivers/bcmxcp.c, drivers/blazer.c, - drivers/blazer_ser.c, drivers/blazer_usb.c, drivers/libhid.c, - drivers/mge-xml.c, drivers/nutdrv_qx.c, drivers/powerp-bin.c, - drivers/powerp-txt.c, drivers/powerpanel.c, drivers/tripplitesu.c, - drivers/upscode2.c, include/common.h, include/str.h, server/upsd.c, - tools/nut-scanner/scan_usb.c: common: consolidate some string- - related functions Move *trim*() functions from common to str. - Prepend the 'str_' common prefix. Bailout early if string is NULL - or empty. In *trim_m() functions, make sure the string containing - characters to be removed is not NULL and bailout early if empty. - Add new str_trim[_m]() functions to remove both leading and - trailing characters at the same time. Update all the tree - accordingly; versioning where appropriate. - * common/Makefile.am, common/str.c, include/Makefile.am, - include/common.h, include/str.h: common: add some string-related - functions - -2015-11-10 Charles Lepple - - * data/driver.list.in: HCL: Electrys UPS 2500 (nutdrv_qx and - blazer_ser) Closes - https://github.com/networkupstools/nut/issues/241 - * data/driver.list.in: HCL: Eaton E Series DX UPS 1-20 kVA uses - blazer_ser Closes - https://github.com/networkupstools/nut/issues/238 - -2015-11-09 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: add number of outlets in Eaton ePDU - groups - * docs/nut-names.txt: Add a variable for the number of outlets in a - group Added 'outlet.group.n.count' which provides the number of - outlets in the outlet group 'n' - -2015-11-06 Daniele Pezzini - - * drivers/nutdrv_qx_voltronic-qs.c: nutdrv_qx: update 'voltronic-qs' - subdriver Since, for devices supported by 'voltronic-qs' - subdriver, in reality: - invalid commands or queries are echoed - back, - accepted commands are followed by action without any - further reply, update the subdriver interface accordingly. Also: - - change slightly the way we publish protocol as ups.firmware.aux, - - update F's reply examples and some info_type (ratings; - output.frequency) in QX to NUT table to reflect reality, - increase - version number. - -2015-10-19 Daniele Pezzini - - * drivers/nutdrv_qx_voltronic-qs-hex.c: nutdrv_qx: improve 'T' - protocol support in 'voltronic-qs-hex' subdriver Since the last - byte of the reply to the QS query (before the trailing CR) of - devices that implement the 'T' protocol holds in reality ratings - informations (nominal output frequency/voltage and nominal battery - voltage) in its bits, change the 'voltronic-qs-hex' subdriver - accordingly. Also: - change slightly the way we publish protocol as - ups.firmware.aux, - increase version number. - * drivers/nutdrv_qx_voltronic-qs-hex.c: nutdrv_qx: simplify - {in,out}put voltage conversion in 'voltronic-qs-hex' In - 'voltronic-qs-hex' subdriver, instead of calculating separately the - fractional and integer part of input and output voltage, do it at - once. Also, increase version number. - * drivers/nutdrv_qx_voltronic-qs-hex.c: nutdrv_qx: improve protocol - identification in 'voltronic-qs-hex' Since 'V' protocol, in - reality, never happens to use the encoded version of the reply to - the QS query, but it always uses the plain version already - implemented in 'voltronic-qs' subdriver, remove it from the - identification process of 'voltronic-qs-hex' subdriver. Also, - remove some non-significant entries from the testing table and - increase version number. - * drivers/nutdrv_qx_voltronic-qs-hex.c: nutdrv_qx: harmonize - declarations/definitions in 'voltronic-qs-hex' In 'voltronic-qs- - hex' subdriver, the scope of support functions is limited to the - subdriver as rightly stated in forward declarations, so correct - their definitions to reflect that. Also, increase version number. - -2015-10-09 Arnaud Quette - - * docs/nut-qa.txt: Reference Black Duck OpenHUB in QA documentation - Closes networkupstools/nut#192 - -2015-10-08 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: also use __func__ for additional - traces - * drivers/powerware-mib.c: powerware-mib: more comments for RFC - device.event Add more comments on the need to RFC device.event for - some data that are currently published under ups.alarm - * drivers/powerware-mib.c: snmp-ups: improve Eaton 3-phase UPS alarms - reporting Eaton 3phase UPS, using the Powerware MIB, can expose - many new alarms. Also use the standard driver "X.YY" versioning, - and bump subdriver release to "0.85" - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: fix and improve - the ups.alarms mechanism This mechanism allows to walk a subtree - (array) of alarms, composed of OID references. The object - referenced should not be accessible, but rather when present, this - means that the alarm condition is TRUE. Both ups.status and/or - ups.alarm values can be provided - * drivers/snmp-ups.c: snmp-ups: fix on some snprintf calls Some - snprintf calls are using dynamically allocated variables, which - doesn't work with sizeof - * drivers/snmp-ups.c: snmp-ups: use __func__ in debug messages - * drivers/snmp-ups.c: snmp-ups: nut_snmp_get_oid() returns TRUE on - success - * drivers/snmp-ups.c: snmp-ups: only use snprintf calls instead of - sprintf - * drivers/eaton-mib.c, drivers/snmp-ups.c: snmp-ups: simplify - handling of other alarms outlet, outlet groups and phase alarms - are now using a simplified approach that does not require specific - lookup structure to adapt alarm messages. This applies to Eaton - ePDU G2/G3 - -2015-09-22 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix a typo error in debug message - Unknown is spelled with an ending N (reported by Evgeny "Jim" - Klimov, from Eaton) - * drivers/snmp-ups.c: snmp-ups: optimize phase number extraction - efficiency Since we know that we are processing an alarm for a - phase "Lx", don't use strchr, but simply index (reported by Evgeny - "Jim" Klimov, from Eaton) - * docs/nut-names.txt, drivers/eaton-mib.c: snmp-ups: use dash- - separator for out-of-range For the sake of coherence with other - status relative to thresholds, "out of range" frequency status now - also use dash as separator, instead of space - * drivers/eaton-mib.c: Fix a spelling error in comments - * drivers/eaton-mib.c: snmp-ups: fix a typo error on Eaton ePDU G2/G3 - MIB Critical is really spelled critical, and not cricital, as used - in the various status thresholds value-lookup structures (reported - by Evgeny "Jim" Klimov, from Eaton) - * data/cmdvartab: Mention the unit for ambient humidity information - Add an explicit mention that ambient information related to - humidity use the "(percent)" unit - * data/cmdvartab, docs/nut-names.txt: Mention the unit for input - voltage information Add an explicit mention that input information - related to voltage use the "Volts (V)" unit - * data/cmdvartab: Mention the unit for ambient temperature - information Add an explicit mention that ambient information - related to temperature use the "degrees C" unit - -2015-09-18 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: add outlet group identifier for - Eaton ePDU Eaton ePDU can now publish the parent group of each - outlet - * docs/nut-names.txt: Extend outlet collection namespace with group - ID An outlet can now publish the group to which it belongs to - * drivers/snmp-ups.c: snmp-ups: complete nut_snmp_get_{str,int} - These methods now allow to get the value of an OID returned by the - source OID (as for the sysOID). In case of failure (non existent - OID), the functions return the last part of the returned OID (ex: - 1.2.3 => 3) - * drivers/snmp-ups.c: snmp-ups: create a nut_snmp_get_oid() function - This method allows to get the value of an OID which is also an OID - (as for the sysOID), without trying to get the value of the pointed - OID. This will allow to use nut_snmp_get_{int,str}() the get the - value of the pointed OID - -2015-09-17 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: outlet groups type handling for - Eaton ePDU Eaton ePDU can now publish the type of outlet group - * docs/nut-names.txt: Extend outlet group collection namespace with - type The type of outlet group can now be published, part of the - new outlet.group data collection - * drivers/eaton-mib.c: snmp-ups: outlet groups commands for Eaton - ePDU Eaton ePDU can now handle commands outlet groups, including - on, off and reboot (cycle) - * drivers/snmp-ups.c: snmp-ups: fix commands handling for outlet - groups The su_instcmd() function of snmp-ups is now adapted to - support outlet groups - * drivers/eaton-mib.c: Advanced outlets groups alarm handling for - Eaton ePDU Eaton ePDU can now handle alarms on outlets groups, for - voltage and current, relative to the configured thresholds - * drivers/snmp-ups.c: snmp-ups: improvements for outlet groups and - alarms Improve the code for general template management, including - outlets and outlets groups for now, and add alarm management for - outlet groups, the same way as for outlets - -2015-09-16 Arnaud Quette - - * drivers/snmp-ups.c: snmp-ups: fix set variable for outlet groups - The setvar() function of snmp-ups is now adapted to support outlet - groups - * drivers/eaton-mib.c: snmp-ups: outlet groups handling for Eaton - ePDU Eaton ePDU can now handle outlet groups, including voltage - and current (with thresholds and status relative to the configured - thresholds), along with power and realpower. A subsequent commit - will address the alarms, settings and commands. Bump subdriver - version to 0.30 - * drivers/snmp-ups.c: snmp-ups: update debug message The template - guestimation function name was changed, but the debug message was - left with the old function name - -2015-09-15 Arnaud Quette - - * docs/nut-names.txt: Extend NUT namespace with outlet.group - collection A new data collection, called "outlet.group", is now - available. It provides grouped management for a set of outlets. The - same principles and data than the outlet collection apply to - outlet.group - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: adapt template - mechanisms for outlet groups The template handling mechanisms, - originally created for outlets, is now adapted to also manage - outlet groups - -2015-09-14 root - - * docs/nut-names.txt: Add a note on the outlet.count variable - -2015-09-14 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: add nominal input current for Eaton - ePDU snmp-ups now provides input.[Lx.]current.nominal for Eaton - ePDU G2/G3, both for 1phase and 3phase - * drivers/eaton-mib.c: snmp-ups: better input.power handling for - Eaton ePDUs Improve the way we declare and process input.power, as - previously done for input.realpower, in order to address the - variations between Eaton ePDUs G2 and G3 - -2015-09-11 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: publish part number for Eaton ePDU - device.part was standardized in NUT namespace, so enable the - declaration for Eaton ePDU - * drivers/eaton-mib.c: snmp-ups: 3-phase alarm handling for Eaton - ePDU Eaton ePDU can now handle alarms on 3-phase, currently - limited to voltage and current, relative to the configured - thresholds - * drivers/snmp-ups.c: snmp-ups: implement 3-phase alarm handling - snmp-ups now allows to publish 3-phase alarms in ups.alarm, the - same way as with outlet. Declaration of such alarms are done using - "Lx.alarm". info_lkp_t structures messages are shared templates - with outlets, and use the string formats to include the context - (outlet or phase) and the number (of the outlet or phase) in alarm - messages. These alarms are then published in "ups.alarm", with the - standard mechanism for alarm publication - * docs/nut-names.txt: Extend 3-phase collection namespace with alarms - 3-phase data collection now allows to specify alarms, the same way - than with the outlet collection ("outlet.n.alarm"), but using - "Lx.alarm" (for example "L1.alarm"). These alarms are then - published in "ups.alarm", with the standard mechanism for alarm - publication - * drivers/eaton-mib.c: Advanced threshold handling for Eaton 3-phase - ePDU Eaton ePDU can now handle warning and critical thresholds - settings and status for input voltage and current on 3-phase units. - Alarms are however still to be implement - * docs/nut-names.txt: Extend 3-phase collection namespace with - threshold 3-phase data collection now allows to specify low / high - warning and critical thresholds for voltage and current. Status - relative to the thresholds also exist for these data - -2015-09-07 Arnaud Quette - - * drivers/snmp-ups.c, drivers/snmp-ups.h: snmp-ups: fix loss of - precision when setting values su_setvar() was losing precision - when converting and casting the provided values to send to the SNMP - agent. As an example, with an OID in millivolt (multiplier set to - 0.001), when providing 238 (V) using upsrw, the value sent to the - SNMP agent was 237999, so leaking 0.1 volt - -2015-09-04 Arnaud Quette - - * drivers/dstate.c: Extend ups.alarm internal buffer to 1024 chars - Currently, ups.alarm can hold up to 256 chars to expose alarms. - With the recent outlet alarms handling addition, the buffer may - quickly be to small. Thus, increase to 1024, which may still not - be sufficient but already provides a bit more room - * drivers/eaton-mib.c: snmp-ups: outlet alarm handling for Eaton ePDU - Eaton ePDU can now handle alarms on outlets, currently limited to - outlet voltage and current, relative to the configured thresholds - * drivers/snmp-ups.c: snmp-ups: implement outlets / PDU alarm - handling snmp-ups now allows to publish outlets and PDU alarms in - ups.alarm, the same way as with ups.status. Declaration of such - alarms are done using the outlet template mechanism - ("outlet.%i.alarm"). info_lkp_t structures messages can also use - the string formats to include the outlet number in alarm messages. - These alarms are then published in "ups.alarm", with the standard - mechanism for alarm publication - * docs/nut-names.txt: Extend outlet collection namespace with alarms - Outlet data collection now allows to specify alarms, using the - template definitions ("outlet.n.alarm"). These alarms are then - published in "ups.alarm", with the standard mechanism for alarm - publication - -2015-09-02 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: outlet threshold handling for Eaton - ePDU Eaton ePDU can now handle warning and critical thresholds - settings and status for outlet voltage and current - * docs/nut-names.txt: Extend outlet collection namespace with - threshold Outlet data collection now allows to specify low / high - warning and critical thresholds for voltage and current. Status - relative to the thresholds also exist for these data - -2015-09-01 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: alarms handling for Eaton ePDU - Eaton ePDU can now publish alarms, related to input status - (voltage, frequency and current) and ambient status (temperature - and humidity). Note that alarms are still published under - ups.alarms, though these should belong to either pdu.alarms or - better device.alarms - * drivers/eaton-mib.c: Advanced input threshold handling for Eaton - ePDU Eaton ePDU can now handle warning and critical thresholds - settings and status for input voltage and current, along with the - frequency status - * data/cmdvartab, docs/nut-names.txt: Extend input collection - namespace with threshold Input data collection now allows to - specify low / high warning and critical thresholds for voltage and - current. Status relative to the thresholds also exist for these - data, and for the frequency - -2015-08-31 Arnaud Quette - - * drivers/eaton-mib.c: snmp-ups: ambient dry contacts support for - Eaton ePDU Eaton ambient modules, connected on ePDU, now publish - the status of the connected dry contacts sensors - * data/cmdvartab, docs/nut-names.txt: Extend ambient collection - namespace with dry contacts Ambient data collection now allow to - specify dry contacts sensor status - * drivers/eaton-mib.c: snmp-ups: fix Eaton Pulizzi Switched PDU - multiplier As per the previous commit, to well handle integer RW - variables - * drivers/eaton-mib.c: snmp-ups: ambient threshold handling for Eaton - ePDU Eaton ePDU can now handle warning and critical thresholds and - status for both humidity and temperature - * data/cmdvartab, docs/nut-names.txt: Extend ambient collection - namespace with threshold Ambient data collection now allow to - specify warning and critical thresholds - * drivers/eaton-mib.c: snmp-ups: publish presence of Eaton ambient - sensor Publish the actual presence of ambient sensor for Eaton - ePDU G2 and G3 - * data/cmdvartab, docs/nut-names.txt: Publish the actual presence of - an ambient sensor A new data was created (ambient.present) to - publish the actual presence of an ambient sensor - -2015-10-06 Charles Lepple - - * data/driver.list.in: HCL: Asium P700, Micropower LCD 1000 and Eaton - 5E1100iUSB - -2015-10-06 Daniele Pezzini - - * data/driver.list.in: HCL: LYONN CTB-800V supported by nutdrv_qx - Protocol: 'voltronic-qs-hex' Reference: - https://github.com/networkupstools/nut/pull/230 - -2015-08-22 Mariano - - * drivers/nutdrv_qx_voltronic-qs-hex.c: nutdrv_qx: add support for - LYONN CTB-800V Small protocol validation change in 'voltronic-qs- - hex' subdriver to add support for the protocol used by the LYONN - CTB-800V UPS. - -2015-09-28 Arnaud Quette - - * docs/new-drivers.txt: Fix spacing error - -2015-09-22 Charles Lepple - - * drivers/solis.c, drivers/solis.h: solis: remove additional warnings - The "Waiting" flag is always zero, and several other variables were - not used. - * drivers/solis.c, drivers/solis.h: solis: clean up warnings Comment - out unused constants, and add 'static' and 'const' wherever - possible. - -2015-09-20 Charles Lepple - - * drivers/Makefile.am, drivers/solis.c: solis: math fixes As - mentioned here: https://github.com/networkupstools/nut/pull/235 - -2015-09-19 bsalvador - - * drivers/solis.c, drivers/solis.h: solis: patch for Microsol Back- - Ups BZ1200-BR patch for correct reading for Microsol Back-Ups - BZ1200-BR (rebased onto solis_debug branch, and cleaned up - whitespace. -- CFL) Closes - https://github.com/networkupstools/nut/pull/235 and Closes - https://github.com/networkupstools/nut/pull/236 - -2015-09-16 Arnaud Quette - - * data/driver.list.in, docs/man/snmp-ups.txt, drivers/powerware- - mib.c, drivers/powerware-mib.h, drivers/snmp-ups.c: snmp-ups: add - Eaton Power Xpert Gateway UPS Card This newer generation of SNMP - card is used for BladeUPS or other UPS, and is serving the same - XUPS MIB, as in the "pw" subdriver - * scripts/subdriver/gen-snmp-subdriver.sh: Update SNMP subdriver - generation script Complete the documentation, by adding some notes - and examples ; Fix the MIBs directories list and the "keep - temporary files" option - -2015-09-11 Arnaud Quette - - * drivers/snmp-ups.c: Improve log/debug output trace - -2015-09-08 Charles Lepple - - * drivers/solis.c: solis: resync with end-of-packet character (0.64) - Suggested by @rpvelloso in https://github.com/networkupstools/nut/i - ssues/231#issuecomment-134795747 Note that the driver could - possibly get out-of-sync after initial detection. - -2015-09-07 Charles Lepple - - * docs/man/macosx-ups.txt, drivers/macosx-ups.c: macosx-ups: - gracefully handle disconnection of UPS Tested on 10.9.5 and - 10.10.5. Returns "data stale" when UPS disappears. - -2015-09-07 Arnaud Quette - - * drivers/powerware-mib.c: Bump Powerware SNMP subdriver version - -2015-09-04 Charles Lepple - - * Makefile.am, docs/configure.txt, docs/new-clients.txt, tools/nut- - scanner/README: doc: correct remaining `--with-lib` references - Credit: Paul Vermeer - -2015-09-01 Arnaud Quette - - * drivers/snmp-ups.h: Minor updates to TODO comments - * drivers/snmp-ups.c: Implement ups.alarm for SNMP snmp-ups now - allows to publish alarms in ups.alarm, the same way as with - ups.status - -2015-08-31 Arnaud Quette - - * drivers/snmp-ups.c: Proper handling of integer RW variables RW - variables were previously supposed to always be strings. Thus, the - multiplier (using the info_len field) was not applied. Also allow - setting float values, not only integer - * drivers/snmp-ups.c, drivers/snmp-ups.h: Fix default SNMP retries - and timeout The previous patch was using the default values from - Net-SNMP, which are set to -1. When the user was not providing - overriden values, this was causing the driver to not be able to - establish the communication with the device. The default values are - now fixed, as per documented (i.e. 5 retries and timeout of 1 - second). Also bump the driver version to 0.74 - * docs/man/ups.conf.txt, drivers/dstate.c: Make more obvious the - socket write failure Document the error that require the use of - the 'synchronous' flag. Also use debug level 1 instead of 2 for the - debug message - -2015-08-23 Charles Lepple - - * drivers/solis.c: solis: Add upsdebug*() and upslogx() calls for - diagnostics - -2015-08-18 Kenny Root - - * drivers/powerware-mib.c: Add ups.start.auto for Powerware SNMP Use - the IETF UPS MIB to indicate to Powerware devices that it should - restart when mains power is applied. - * drivers/powerware-mib.c: Fix some indentation problems in PowerWare - SNMP - * drivers/powerware-mib.c: Add shutdown.return for Powerware SNMP - The Powerware MIB supports the concept of shutting down with a - delay and then returning when line power is restored. The delay is - set to 0 seconds currently. - * drivers/powerware-mib.c: Add load.{off,on}.delay for Powerware SNMP - The commands to shut down with delay have existed since the first - version of the Powerware MIB so add the newer commands - "load.off.delay" and "load.on.delay" to aid in shutdown scripts. - -2015-08-07 Arnaud Quette - - * drivers/dummy-ups.c, drivers/dummy-ups.h: Fix dummy-ups for - external value changes dummy-ups allow to change the values of the - publicated variables through the standard upsrw tool. This method - is handy to script value changes, in a controlled way, compared to - the dynamic version (using the TIMER keyword in .dev files), which - changes the values in a non controlled way. Bump driver version to - 0.14 - * m4/nut_check_libnss.m4: Fully check for a working Mozilla NSS - Rework the NSS tests so that just having runtime libraries - installed is not enough. Moreover, since GNU libc6 also provides a - nss.h header, the test now checks for both nss.h and ssl.h Closes - networkupstools/nut#184 - * docs/download.txt: Fix Red Hat / Fedora packages repository URL - -2015-08-03 Tomas Halman - - * clients/nutclient.cpp: Problem: nutclient library sometimes reads - socket closed by server. Solution: proper read return value - evaluation - -2015-08-04 Arnaud Quette - - * tools/nut-scanner/scan_snmp.c: Fix a crash on a 2nd call to - libnutscan on behalf of Tomas Halman, from Eaton Opensource Team - -2015-07-24 Nash Kaminski - - * drivers/tripplitesu.c: tripplitesu: Fix initialization when - tripplite firmware is buggy With some Tripplite SU1000RT2U (and - possibly more) UPS's, a firmware bug causes a malformed response to - the very first command that is sent after the serial port is opened - following a warm or cold boot of the system. My theory is that this - related to either the RS232 data lines or handshaking lines being - pulled high once the server's UART is powered however I have not - determined precisely if this is related to the data line being - pulled high or the handshaking lines being asserted. However, I - have been able to consistently reproduce the issue where the driver - fails to start on the first attempt after a cold/warm boot across 3 - different machines and 2 SU1000RT2U UPS's. To workaround this, the - initial enumeration is repeated a 2nd time after 300ms(to allow all - garbage data to arrive) if the first attempt fails, which allows - the driver to consistently startup successfully on the 1st attempt. - Closes networkupstools/nut#220 - -2015-07-24 Tim Smith - - * INSTALL.nut: Spelling fixes Spelling fixes and capitalization of - SUSE - -2015-07-23 Arnaud Quette - - * scripts/augeas/nutupsconf.aug.tpl: Update Augeas lens for ups.conf - Add the various missing global directives and ups fields - -2015-07-20 Daniele Pezzini - - * data/driver.list.in: HCL: fix case and spacing - -2015-07-18 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: when targeting 'UPS No Ack' - consider also the trailing CR In 'fabula' and 'krauler' USB - subdrivers, take into account also the trailing CR in the reply - while looking for a 'UPS No Ack'. - * drivers/nutdrv_qx.c: nutdrv_qx: stay true to return code in - 'fabula' USB subdriver In 'fabula' USB subdriver, when reading - 'UPS No Ack' from device, since we already mimic a timeout, also - empty the reply. - -2015-07-11 Charles Lepple - - * data/driver.list.in: HCL: Fideltronic INIGO Viper 1200 supported by - nutdrv_qx - -2015-07-02 Charles Lepple - - * drivers/usbhid-ups.c: usbhid-ups: bump version to 0.41 Both the - eaton_dual_reportdesc and usbhid_ups_input_vs_feature branches - claimed version 0.40, so let's disambiguate the merged version. - -2015-07-02 Arnaud Quette - - * drivers/libhid.c: Add a debug trace for the number of HID objects - found - * drivers/hidtypes.h: Fix testing typo MAX_REPORT is really 500 (HID - objects), not 50! - * drivers/hidparser.c: Report when there are further unprocessed HID - objects Following the last commits, and especially the MAX_REPORT - one, warn whenever there are remaining HID objects that were not - processed. This may serve - * drivers/hidtypes.h: Increase the maximum number of HID objects The - previous value (300) was causing a trim of the remaining objects. - Increase the value to 500, which should give a bit of time - * drivers/libshut.c, drivers/libshut.h, drivers/libusb.c, - drivers/usb-common.h, drivers/usbhid-ups.c: Add support for Eaton - dual HID report descriptor All devices use HID descriptor at index - 0. However, some newer Eaton units have a light HID descriptor at - index 0, and the full version is at index 1 (in which case, - bcdDevice == 0x0202). This dual report descriptor approach is due - to the fact that the main report descriptor is now too heavy, and - cause some BIOS to hang. A light version is thus provided at the - default index, solving this BIOS issues - -2015-06-27 Charles Lepple - - * drivers/macosx-ups.c: macosx-ups: fix for 10.10 (Yosemite); v1.1 - In OS X 10.9 and earlier, IOPSGetPowerSourcesInfo() returned a - CFDictionary. In 10.10 it returns a CFArray. Programmers are - supposed to use IOPSGetPowerSourceDescription() to gloss over this - distinction. However, this does not make it easy to distinguish - between a laptop battery and an UPS. So the "port" driver option no - longer has any effect. https://developer.apple.com/library/mac/doc - umentation/IOKit/Reference/IOPowerSources_header_reference/#//apple - _ref/c/func/IOPSGetPowerSourceDescription - -2015-06-22 Arnaud Quette - - * scripts/upower/95-upower-hid.rules, tools/nut-usbinfo.pl: Update - UPower HID rules and generator - -2015-06-11 Charles Lepple - - * drivers/usbhid-ups.c: usbhid-ups.c: fall back to HID Input type if - not a Feature - -2015-06-07 Charles Lepple - - * drivers/tripplite-hid.c: tripplite-hid.c: device.part is static - (version 0.82) - -2015-06-04 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: make sure processed item's - boundaries are not wrong - -2015-04-26 Nick Mayerhofer - - * docs/nutdrv_qx-subdrivers.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx.h: nutdrv_qx: improve documentation for some - methods - -2015-06-04 Daniele Pezzini - - * docs/nutdrv_qx-subdrivers.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx.h: nutdrv_qx: remove redundant comments and - update docs - -2015-04-28 Nick Mayerhofer - - * drivers/nutdrv_qx_voltronic.c: nutdrv_qx: move var declaration in - 'voltronic' subdriver Move variable declaration to fulfill - condition '3.3. Portability' of the developer guide. Bump version. - * drivers/libhid.c: libhid: replace "flush loop" with memset Move to - the C way of setting memory (memset), replacing a for loop with a - few anti-patterns in it: - for (...; ; i++) - for (...; i < - MAGIC_NUMBER; ...) - for (...) array[i] = 0 - -2015-05-18 Daniele Pezzini - - * docs/nutdrv_qx-subdrivers.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx.h, drivers/nutdrv_qx_bestups.c, - drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_megatec-old.c, - drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_mustek.c, - drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_voltronic-qs-hex.c, - drivers/nutdrv_qx_voltronic-qs.c, drivers/nutdrv_qx_voltronic.c, - drivers/nutdrv_qx_zinto.c: nutdrv_qx: give subdrivers a last chance - to process the command Add (and document) a new function - ('preprocess_command()') to preprocess the command to be sent to - the device, just before the actual sending and, in case of instant - commands/setvars, after the 'preprocess()' function has been - triggered (if appropriate). As an example, this function can be - useful to add to all commands (both queries and instant - commands/setvars) a CRC or to fill the command of a query with some - data. Also, in qx_process(), address buf size vs item->answer size - earlier. Update all subdrivers accordingly, bump versions. - -2015-06-01 Arnaud Quette - - * docs/man/snmp-ups.txt, drivers/snmp-ups.c, drivers/snmp-ups.h: - Provide access to Net-SNMP timeout and retries Two new extra - arguments are now available to allow overriding Net-SNMP number of - retries (snmp_retries) and timeout per retry (snmp_timeout). These - respectively maps to snmpcmd "-r retries" and "-t timeout" - -2015-05-29 Arnaud Quette - - * scripts/upower/95-upower-hid.rules: Update UPower HID rules - * tools/nut-usbinfo.pl: Fix UPower device matching for recent kernels - As per the UPower patch below referenced, hiddev* devices now have - class "usbmisc", rather than "usb". See - http://cgit.freedesktop.org/upower/commit/rules/95-upower- - hid.rules?id=9f31068707fc79744961cea7258b0eb262effbf1 - -2015-05-28 Arnaud Quette - - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/nutscan-device.c, tools/nut-scanner/nutscan- - device.h, tools/nut-scanner/nutscan-display.c, tools/nut- - scanner/nutscan-init.c, tools/nut-scanner/nutscan-init.h, - tools/nut-scanner/nutscan-ip.c, tools/nut-scanner/nutscan-ip.h, - tools/nut-scanner/nutscan-serial.c, tools/nut-scanner/nutscan- - serial.h, tools/nut-scanner/scan_avahi.c, tools/nut- - scanner/scan_eaton_serial.c, tools/nut-scanner/scan_ipmi.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: - Fix legal information on source-code headers Copyright and author - were not mentioned as it should be. Most of the nut-scanner - copyright belongs to EATON, apart from few parts. Files - descriptions are now also in Doxygen format - -2015-05-18 Daniele Pezzini - - * docs/nutdrv_qx-subdrivers.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx.h, drivers/nutdrv_qx_bestups.c, - drivers/nutdrv_qx_blazer-common.c, drivers/nutdrv_qx_blazer- - common.h, drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_megatec- - old.c, drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_mustek.c, - drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_voltronic-qs-hex.c, - drivers/nutdrv_qx_voltronic-qs.c, drivers/nutdrv_qx_voltronic.c, - drivers/nutdrv_qx_zinto.c: nutdrv_qx: make preprocessed value's - size_t a const There's no need to intervene on the passed-to-the- - function value of a preprocessed value's size_t, so clarify it is a - const. Update all subdrivers accordingly, bump versions. - * drivers/nutdrv_qx.c: nutdrv_qx: make sure an answer is not reused - if preprocess_answer() fails If an item's preprocess_answer() - function fails, the answer should not be considered valid and - inherited by the following items with the same command. Therefore, - on failure, clear the answer so that the following items are forced - to query the device and preprocess the answer anew, if appropriate. - -2015-05-13 Arnaud Quette - - * docs/download.txt: Update NUT packages for Windows to 2.6.5-6 - -2015-05-07 Arnaud Quette - - * scripts/systemd/nut-server.service.in: Restore systemd relationship - with nut-driver service The Requires directive from nut-server to - nut-driver was previously removed, since it was preventing upsd - from starting whenever one or more drivers, among several, was - failing to start. Use the Wants directive, a weaker version of - Requires, which will start upsd even if the nut-driver unit fails - to start. closes https://github.com/networkupstools/nut/issues/200 - -2015-04-23 Arnaud Quette - - * Makefile.am: Cleanup GPG signature before generation - -2015-04-22 Arnaud Quette - - * configure.ac: bump version back to 2.7.3.1 - * configure.ac: Restore version 2.7.3 for release - * docs/security.txt: Missing link reference update The filename of - the previous GPG release key was not updated, leading to pointing - to the current release key - -2015-04-08 Nick Mayerhofer - - * docs/nutdrv_qx-subdrivers.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx.h: nutdrv_qx: clarify docs/inline comments - -2015-04-16 Arnaud Quette - - * configure.ac: bump version to 2.7.3.1 - -2015-04-15 Arnaud Quette - - * configure.ac: update version to 2.7.3 - * docs/security.txt: Update release signature verification The - release manager key has change. Update the documentation to reflect - it, along with keeping necessary for checking the previous releases - * docs/download.txt: Fix formatting issue - * NEWS, UPGRADING: Final update for release 2.7.3 Complete the - release information for NUT 2.7.3 - * docs/maintainer-guide.txt: Store some comments for latter - processing - -2015-04-10 Arnaud Quette - - * drivers/mge-hid.c: Improve Eaton ABM support for USB/HID units As - per clarifications from David G. Miller (Eaton ABM expert) and - customers request, when ABM is enabled, we now both publish the - following as per the ABM information: - the 5 status bits - {charging, discharging, floating, resting, off} under - battery.charger.status - the 2 historical status bits {CHRG, - DISCHRG} under ups.status When ABM is disabled, we just publish the - 2 historical status bits {CHRG, DISCHRG} under ups.status, as per - UPS.PowerSummary.PresentStatus.{Charging,Discharging}, as done - previously - -2015-04-02 Arnaud Quette - - * conf/ups.conf.sample, docs/man/ups.conf.txt, drivers/dstate.c, - drivers/dstate.h, drivers/main.c: Improve synchronous driver flag - implementation The previous commit was suffering a number of - issues. The present commit fixes these, along with adding more - documentation and a better and more understandable implementation - code. Thanks to Daniele Pezzini for the thorough review Closes: - https://github.com/networkupstools/nut/issues/197 - -2015-04-01 Arnaud Quette - - * docs/man/ups.conf.txt, drivers/dstate.c, drivers/dstate.h, - drivers/main.c: Implement synchronous driver flag As per issue - #197, NUT drivers work by default in asynchronous mode. This means - that all data are pushed by the driver on the communication socket - to upsd (Unix socket on Unix, Named pipe on Windows) without - waiting for these data to be actually consumed. With some HW, such - as ePDUs, that can produce a lot of data, asynchronous mode may - cause some congestion, resulting in the socket to be full, and the - driver to appear as not connected. By enabling the 'synchronous' - flag, the driver will wait for data to be consumed by upsd, prior - to publishing more. This can be enabled either globally or per - driver. - -2015-04-07 Arnaud Quette - - * scripts/systemd/nut-server.service.in: Do not Require systemd nut- - driver for nut-server Put the Requires=nut-driver.service in - comment for nut-server systemd unit file. Thus we don't require - drivers to be successfully started! This was a change of behavior - compared to init SysV, and could prevent from accessing - successfully started drivers, or at least to audit a system - Closes: https://github.com/networkupstools/nut/issues/200 - -2015-04-04 Charles Lepple - - * UPGRADING: UPGRADING: mention SSL permissions (#199) - * docs/security.txt: NSS SSL documentation Addresses new behavior as - part of the NSS forking fix (#199). Formatting and wording fixed as - well. - -2015-04-04 Émilien Kia - - * server/upsd.c: Initialize SSL after deamonize and downgrade to - user. Fix issue #190 - upsd: NSS SSL only working in debug mode - https://github.com/networkupstools/nut/issues/190 - -2015-04-02 Arnaud Quette - - * drivers/eaton-mib.c: Better input.realpower handling for Eaton - ePDUs G2/G3 Improve the way we declare and process - input.realpower, in order to address the variations between Eaton - ePDUs G2 and G3 - -2015-03-19 Arnaud Quette - - * docs/nut-names.txt: Document new variables and commands addition - The variables and commands that were added were not described in - the NUT namespace document. These are: input.transfer.delay - - battery.energysave.load - battery.energysave.delay - - battery.charger.status - outlet.1.shutdown.return - - outlet.2.shutdown.return - * drivers/bcmxcp.c: Fix the letter case of ABM and outlets status - For more coherence with NUT status publication, these status are - now lower case - * drivers/bcmxcp.c: Add missing Author - -2014-10-10 gavrilov-i - - * data/cmdvartab, drivers/bcmxcp.c, drivers/bcmxcp.h: drivers/bcmxcp: - advanced features Closes: #158 Added setvar function exec result - parsing Add command to turn load on after shutdown.stayoff and - shutdown.return. Outlet control changed. Outlet control via - commands "outlet.n.load.on/off" like in other drivers. Variable - outlet.n.staus now only for reading. Some code changes in - outlet.n.shutdown.return command - now supporting more than 3 - outlets (up to 9). Add descriptions to new and some old variables - and commands. Add "bypass.start" command, for enabling bypass. For - returning in On-Line mode exec "load.on" command. Additional - checks of UPS vars. Now add zero var only if it could be changed. - -2015-04-01 Arnaud Quette - - * drivers/eaton-mib.c: Workaround input.{power,realpower} for Eaton - ePDUs Add variable declarations to handle missing - input.{power,realpower} on Eaton ePDUs G2 and G3 1phase. On 3phase, - these variables point at SNMP OIDs that sum up the 3 phases - information. These OIDs should also be present on 1phase, however - it's actually not the case. So simply duplicate the L1 declaration - -2015-03-31 Arnaud Quette - - * drivers/powerware-mib.c: Implement battery.charger.status for Eaton - SNMP This new official variable now replaces the historic - 'vendor.specific.abmstatus', as per other similar implementations - (in usbhid-ups and bcmxcp drivers) - -2015-03-27 Arnaud Quette - - * drivers/mge-hid.c: Implement Eaton ABM support for USB/HID units - Add support for Eaton Advanced Battery Monitoring, for USB/HID - units. Information are provided through the new - battery.charger.status. For now, at least, when ABM is enabled, the - historic CHRG and DISCHRG flags are not published anymore in - ups.status - -2015-03-26 Stuart Henderson - - * data/driver.list.in, docs/man/snmp-ups.txt, docs/snmp- - subdrivers.txt, drivers/Makefile.am, drivers/huawei-mib.c, - drivers/huawei-mib.h, drivers/snmp-ups.c: snmp-ups: new subdriver - for Huawei "Hi, the [commit] below adds a new subdriver for snmp- - ups to support Huawei UPS, based on an observed walk from a - UPS5000-E with a few bits filled in from the MIBs (copy at - http://junkpile.org/HUAWEI_UPS_MIB/)." http://news.gmane.org/find- - root.php?message_id=slrnmh6npf.tg7.stu%40naiad.spacehopper.org - -2015-03-25 Daniele Pezzini - - * drivers/nutdrv_qx_voltronic.c: nutdrv_qx: add support in - 'voltronic' subdriver for P13 protocol - -2015-03-24 Arnaud Quette - - * drivers/mge-hid.c: Complementary Energy Saving data for Eaton USB - devices Add a 2nd HID path for battery.energysave.delay. Depending - on the exact device model, different implementations may be used - -2015-03-22 Daniele Pezzini - - * NEWS: nutdrv_qx: update NEWS about new 'fuji' USB subdriver - -2015-03-21 Daniele Pezzini - - * drivers/nutdrv_qx.c, drivers/nutdrv_qx.h: nutdrv_qx: typedef - testing_t only if TESTING is #defined First reported by GitHub - user @nickma82 - * docs/man/nutdrv_qx.txt, docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: - document 'voltronic-qs-hex' subdriver in man pages - * docs/man/nutdrv_qx.txt, drivers/nutdrv_qx_bestups.c, - drivers/nutdrv_qx_blazer-common.c, drivers/nutdrv_qx_blazer- - common.h, drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_megatec- - old.c, drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_mustek.c, - drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_voltronic-qs-hex.c, - drivers/nutdrv_qx_voltronic-qs.c, drivers/nutdrv_qx_zinto.c: - nutdrv_qx: add 'ignoresab' flag to support bogus devices Some - UPSes incorrectly report the 'Shutdown Active' bit (7th bit of the - 'status byte') as always on (=1), consequently making the driver - believe the UPS is nearing a shutdown (and, as a result, ups.status - always contains FSD). To workaround this issue, add a new - 'ignoresab' flag that makes the driver do just what its name tells - (IGNORE Status Active Bit) skipping the relative item in qx2nut - tables. References: - - http://lists.alioth.debian.org/pipermail/nut- - upsdev/2015-March/006896.html - - https://github.com/networkupstools/nut/issues/195 - -2015-03-11 Arnaud Quette - - * data/cmdvartab, docs/nut-names.txt: Add some new variable names, - related to ePDUs Add new variables names, related to ePDUs, such - as input.*.load, input.*.realpower and input.*.power - * drivers/eaton-mib.c: Minor update to comments - -2015-02-04 Arnaud Quette - - * drivers/eaton-mib.c: Fix outlet.{power,realpower} data mapping - According to the new mapping using the input collection, these two - data mapping were targeting at the wrong OIDs. - -2015-02-03 Arnaud Quette - - * drivers/eaton-mib.c: Fix and complete a bit Eaton ePDUs support - Add some new data mapping to improve support for Eaton ePDUs. This - commit includes some new NUT data names that requires approval - before being merged - -2015-03-19 Arnaud Quette - - * data/cmdvartab, docs/nut-names.txt, drivers/mge-hid.c: Add more - Energy Saving features for Eaton USB devices Add two new Energy - Saving features: - battery.energysave.delay: to configure the delay - before switching off the UPS if running on battery and load level - low (in minutes) - battery.energysave.realpower: to switch off the - UPS if running on battery and power consumption on UPS output is - lower than this value (expressed in Watts). Note that documentation - in nut-names.txt and cmdvartab was limited to difference with an - upcoming branch merge, that will add the others - * drivers/mge-hid.c: Align Energy Saving variable names Change - ups.load.energysave to battery.energysave.load, to be coherent with - the latest commit made in the bcmxcp driver - -2015-03-10 Arnaud Quette - - * data/cmdvartab, drivers/mge-hid.c: Add a new EnergySaving threshold - for Eaton UPSs Add 'ups.load.energysave' parameter, to enable - energy saving when the power consumption on the UPS output drops - below this value (in percent). This new variable however requires - to go through the NUT RFC process to get approved - -2015-03-19 Arnaud Quette - - * tools/Makefile.am: Also distribute nut-ddl-dump.sh helper script - -2015-03-18 Daniele Pezzini - - * data/driver.list.in: HCL: EUROCASE EA200N 2000VA supported by - nutdrv_qx Protocol: 'megatec' USB subdriver: 'fuji' Reference: ht - tp://thread.gmane.org/gmane.comp.monitoring.nut.user/8808/focus=908 - 1 - * drivers/nutdrv_qx_bestups.c, drivers/nutdrv_qx_blazer-common.c, - drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_megatec-old.c, - drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_mustek.c, - drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_voltronic-qs-hex.c, - drivers/nutdrv_qx_voltronic-qs.c, drivers/nutdrv_qx_zinto.c: - nutdrv_qx: remove redundancy in blazer-common-dependent subdrivers - Since main nutdrv_qx driver already sets an alarm when FSD arises - (see nutdrv_qx.c>ups_alarm_set()), there is no need to do so in the - various subdrivers. So, in order to prevent a duplicated alarm - message, remove all unneeded code from the affected subdrivers (all - the ones that depend on nutdrv_qx_blazer-common). - -2015-03-17 Daniele Pezzini - - * data/driver.list.in: HCL: update Mecer ME-1000-WTU (supported by - nutdrv_qx) Tested by @sliverc (Oliver Sauder) on NUT 2.7.1 - Reference: https://github.com/networkupstools/nut/issues/148 - -2015-03-16 Daniele Pezzini - - * docs/man/nutdrv_qx.txt: nutdrv_qx: document USB subdrivers' - glitches - * drivers/nutdrv_qx.c: nutdrv_qx: add workaround in 'fuji' subdriver - to support all shutdown.returns As 'fuji' subdriver discards all - the commands of more than 3 characters, in order to support 'SnRm' - shutdown.returns (and hence the standard 'S.5R0003' shutdown.return - with DEFAULT_{ON,OFF}DELAYs) map 'SnRm' shutdown.returns to the - corresponding 'Sn' commands, meanwhile ignoring ups.delay.start and - making the UPS turn on the load as soon as power is back. - * drivers/nutdrv_qx.c: nutdrv_qx: fix command handling in 'fuji' - subdriver 'fuji' subdriver supported devices only allow one 8 - bytes interrupt as a command/query: make the subdriver discard (and - echo back) all the too long commands. - -2014-11-08 Daniele Pezzini - - * docs/man/nutdrv_qx.txt: nutdrv_qx: update man for the new 'fabula' - and 'fuji' USB subdrivers - -2014-06-26 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: add new 'fuji' USB subdriver Add a - new USB subdriver ('fuji') to support models manufactured by Fuji - (and others) and accompained by UPSmart2000I software. - -2015-03-15 Charles Lepple - - * docs/developers.txt, docs/new-drivers.txt: doc: document build - dependencies, etc. Closes: - https://github.com/networkupstools/nut/issues/189 - * docs/nutdrv_qx-subdrivers.txt: doc: fold a few long preformatted - lines in nutdrv_qx developer guide - * docs/FAQ.txt: docs: FAQ update This addresses several issues: * - https://github.com/networkupstools/nut/issues/19 * - https://github.com/networkupstools/nut/issues/191 and Closes: - https://github.com/networkupstools/nut/issues/161 - * docs/man/Makefile.am: docs/man: provide additional detail for - missing asciidoc/a2x error - * configure.ac: configure: indicate required version of - Asciidoc/A2X/dblatex Still doesn't address data-only packages like - docbook-xsl, so leaving this issue open. Reference: - https://github.com/networkupstools/nut/issues/162 - * docs/Makefile.am, docs/man/Makefile.am: Pass --nonet to xsltproc - This prevents xsltproc from downloading DocBook XSL files for each - step in the documentation build process. Reference: - https://github.com/networkupstools/nut/issues/172 Still need to - document what to do if the build fails. - -2015-03-10 Arnaud Quette - - * docs/documentation.txt: Reference DDL on the Documentation page - Add a reference to the NUT Devices Dumps Library (DDL) on the - Documentation page, both for the website and the distributed - documentation. There are separate references, to distinguish the - DDL interest from a user and a developer point of view - -2015-03-06 Arnaud Quette - - * tools/nut-ddl-dump.sh: First stab at a helper script to generate - device dumps This preliminary version only generates .dev (static) - dump files. However, a merge with nut-recorder.sh, which generates - .seq files (dynamic simulation) is to be considered, along with an - improved version for the newer .nds format - -2015-02-24 Charles Lepple - - * data/driver.list.in: HCL: CPS Value 1500ELCD-RU @ 2.6.3 Source: - http://news.gmane.org/find- - root.php?message_id=1423241134.6830.8.camel%40ignatev - * data/driver.list.in: HCL: JAWAN JW-UPSLC02 with blazer_usb @ 2.7.2 - Source: http://news.gmane.org/find-root.php?message_id=SNT404%2dEAS - 8312A94DDAF0FAD4B7702BA52A0%40phx.gbl - -2015-02-22 Charles Lepple - - * scripts/python/app/NUT-Monitor, scripts/python/app/gui-1.3.glade: - NUT-Monitor: updated version to 1.3.1 - -2015-02-14 Charles Lepple - - * NEWS, UPGRADING: NEWS/UPGRADING for 2.7.3 - -2015-02-14 Daniele Pezzini - - * docs/man/nutdrv_qx.txt: nutdrv_qx: specify 'bestups' ranges in man - pages - -2015-01-03 Daniele Pezzini - - * drivers/nutdrv_qx_bestups.c: nutdrv_qx: bestups - add support for - 'M' query - -2014-11-02 Daniele Pezzini - - * docs/man/nutdrv_qx.txt, docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: - update man pages for new 'bestups' subdriver - * drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_bestups.c, drivers/nutdrv_qx_bestups.h: - nutdrv_qx: add BestUPS subdriver (protocol=bestups) A subdriver - using Best Power/Sola Australia protocol as described in - http://www.networkupstools.org/protocols/sola.html Based also on - bestups.c and meant to eventually replace it. - -2015-02-14 Michael Fincham - - * scripts/python/app/NUT-Monitor: Correct unsafe permissions on - ~/.nut-monitor (Debian #777706) fix-permissions-on-start.debdiff - from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=777706#24 - Closes: https://github.com/networkupstools/nut/issues/185 - -2015-02-14 Michal Soltys - - * drivers/apcsmart.c: apcsmart: fix SEGV in apc_getcaps() ups ... - -2015-02-13 Michal Soltys - - * drivers/apcsmart.c, drivers/apcsmart.h: apcsmart: fix command set - parsing for protocol version 4 The issue was discovered with - Smart-UPS RT 10000 XL by surr, see - https://github.com/networkupstools/nut/issues/180 When protocol - version is 4, command set query returns string with additional - section after another '.' . This patch updates the code to handle - such string as well. - -2015-02-10 Charles Lepple - - * configure.ac: configure.ac: bump version to 2.7.2.6 for snapshots - * scripts/upower/95-upower-hid.rules: upower: regenerate for Powercom - PID 0001 (PR #121) - * configure.ac: configure.ac: add bug report URL Should be - compatible with Autoconf 2.59 and newer. - -2015-02-04 Arnaud Quette - - * drivers/netvision-mib.c: Improve support for on-battery detection - Add support for upsAlarmOnBattery OID, to better detect on-battery - events (reported by Henning Fehrmann) - * drivers/libhid.c, drivers/libhid.h: Fix compilation warning related - to sign comparison - -2015-01-31 Ryan Underwood - - * drivers/apc-hid.c, scripts/upower/95-upower-hid.rules: Add a - product ID for APC AP9584 USB kit. Resolves - networkupstools/nut#181 - -2015-01-12 Charles Lepple - - * scripts/upower/95-upower-hid.rules: upower: regenerate rules file - for OpenUPS PID 0xd005 - * Makefile.am: Add systemd unit dir fix for 'make distcheck' - -2015-01-11 Sergey Kvachonok - - * configure.ac: Undo ${systemdsystemunitdir} mangling. Running sed - 's/\/lib/\${libdir}/' destroys any ${systemdsystemunitdir} values - that don't start with '/lib' e.g. '/usr/lib64/systemd/system' - becomes '/usr/usr/lib6464/systemd/system'. If a local installation - prefix is needed use appropriately prefixed --with- - systemdsystemunitdir='' parameter instead. - -2015-01-02 Charles Lepple - - * docs/cables.txt, docs/config-notes.txt, docs/configure.txt, - docs/features.txt, docs/history.txt, docs/man/nutdrv_qx.txt, - docs/nut-names.txt, docs/scheduling.txt, docs/security.txt: docs: - typo fixes - -2015-01-01 Charles Lepple - - * docs/cables.txt: docs: MGE NMC pinout Closes - https://github.com/networkupstools/nut/issues/141 - * docs/cables.txt: docs: Best Power cable pinout Closes - https://github.com/networkupstools/nut/issues/164 - * INSTALL.nut: docs: clarify group ownership of directory in - INSTALL.nut Closes - https://github.com/networkupstools/nut/issues/151 - * docs/man/dummy-ups.txt: docs: dummy-ups repeater mode requires `@` - in port name Also reworded parts of the man page. - -2014-12-17 bsalvador - - * drivers/solis.c: Update solis.c to force ScanReceivePack() - -2014-12-12 Andy Juniper - - * clients/upslog.c, docs/man/upslog.txt: upslog: break out of sleep - on SIGUSR1 and log immediately Reference: - http://news.gmane.org/find- - root.php?message_id=54863D44.3000902%40freeuk.com - -2014-11-25 Charles Lepple - - * data/driver.list.in: HCL: additional NHS models - -2014-11-17 Charles Lepple - - * data/driver.list.in: HCL: NHS Sistemas de Energia: Expert C - Isolador series Source: http://news.gmane.org/find-root.php?messag - e_id=CADe06rfE5MA%3dyWDZzofPsC7TOgGOU4TRSoi67uMXedymA9L7ow%40mail.g - mail.com - -2014-11-07 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: Various minor fixes to the - SNMP subdriver generator - -2014-11-06 Charles Lepple - - * drivers/openups-hid.c: openups-hid: Fix scale factors for 0xd005 - (0.4) Previous commit had extra scale factors applied. - * drivers/openups-hid.c, drivers/openups-hid.h: openups-hid: voltage - scale factors based on product IDs - * drivers/openups-hid.c: openups-hid: remove a const; this will - require more thought The USB matching routines should have their - parameters marked as "const" to indicate that they do not modify - the matching tables, but that will require more invasive changes. - Roll this back for now. - -2014-11-05 Charles Lepple - - * drivers/openups-hid.c: openups-hid: const and float/double fixups - (0.2) - * drivers/openups-hid.c: openups-hid: add USB ProductID d005 for - OpenUPS2 - -2014-11-05 Arnaud Quette - - * Makefile.am: Store the git start point as a variable For - ChangeLog, we now store the git start point (older reference) in a - separate variable, to make the process more clear - -2014-10-31 Charles Lepple - - * docs/download.txt: Update VMware ESXi package link (from René - Garcia) - -2014-10-29 Charles Lepple - - * scripts/upower/95-upower-hid.rules: upower: Update Belkin and - Liebert rules Follow-up to issue #159. - * drivers/belkin-hid.c, drivers/liebert-hid.c: usbhid-ups: comments - describing Belkin/Liebert/Phoenixtec situation Follow-up to issue - #159. - * data/driver.list.in: HCL: Rucelf UPOII-3000-96-EL supported by - blazer_ser Manufacturer: - http://www.rucelf.ua/en/catalog/upoii-3000-96-el/ Closes: - https://github.com/networkupstools/nut/issues/165 - -2014-10-28 Elio Parisi - - * drivers/riello_usb.c: riello_usb: explicitly claim USB interface - Reference: http://news.gmane.org/find-root.php?message_id=7731ed2f9 - 8014b8a90e695a06d077970%40AM3PR07MB289.eurprd07.prod.outlook.com - and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=738122 - -2014-10-20 Elio Parisi - - * drivers/riello_usb.c: riello_usb: timeouts and error handling - (0.03) Small changes in riello_usb.c that solved some problem with - managing transmission errors between the Raspberry Pi and Riello - ups (thanks to Fredrik Öberg): introducing timeout in reading ups - data in cypress_command; enhanced handling error codes - http://news.gmane.org/find-root.php?message_id=f5294e5579574bcbaf5c - dd95523e0b68%40AM3PR07MB289.eurprd07.prod.outlook.com - * drivers/riello_ser.c: riello_ser: enhanced handling error codes - (0.03) - -2014-10-20 Charles Lepple - - * docs/.gitignore: docs: docinfo.xml is now auto-generated - -2014-10-20 Nik Soggia - - * drivers/Makefile.am: missing -lm in drivers/Makefile.am Both - bcmxcp and bcmxcp_usb use ldexp(), so both need `-lm`. - http://news.gmane.org/find- - root.php?message_id=544515BA.4060804%40niksoggia.it - -2014-10-10 Paul Chavent - - * drivers/belkin-hid.c: drivers : add Liebert GXT3 device. - * drivers/main.c: drivers : fix possible memory leak. In arguments - parsing, if user option is passed. - -2014-09-30 Michal Soltys - - * drivers/apcsmart.c: apcsmart: increase passes in setvar_enum() - Current 6 is not enough for bigger units - especially if we swap to - the value directly preceeding the current setting. - -2014-09-27 Daniele Pezzini - - * configure.ac, docs/Makefile.am, docs/docinfo.xml, - docs/docinfo.xml.in: docs: add NUT version number/date in PDF - documents Reference: - https://github.com/networkupstools/nut/issues/150 - * docs/chunked.xsl, docs/common.xsl, docs/xhtml.xsl: docs: move - DocBook options common to html stylesheets to common.xsl - * docs/Makefile.am, docs/common.xsl: docs: add NUT version - number/date into footer of HTML pages Reference: - https://github.com/networkupstools/nut/issues/150 - -2014-09-28 Arnaud Quette - - * docs/configure.txt: Clarify a bit more Avahi build requirements - * tools/nut-scanner/Makefile.am: Don't reference subdir-object with - $(top_srcdir) Replace references to objects in separate - directories that were using $(top_srcdir) by the expanded version - '../../'. The variable was otherwise part of the path, resulting in - build failures. This completes commit f8abb9b Closes - networkupstools/nut#155 - * configure.ac: Explicitly use subdir-objects in automake init - Closes networkupstools/nut#155 - -2014-09-27 Arnaud Quette - - * configure.ac, m4/nut_check_asciidoc.m4: Also check for source- - highlight at configure time source-highlight is used for - documentation generation. It's however optional, so we just check - for the sake of completion - -2014-09-27 Arnaud Quette - - * docs/man/Makefile.am, docs/man/asciidoc.conf: Add NUT version - number into footer of HTML man pages Override AsciiDoc default for - footer-txt to include NUT version number into footer of HTML man - pages. This commit addresses the 2nd point of - networkupstools/nut#150 - -2014-09-26 Charles Lepple - - * drivers/tripplite_usb.c: tripplite_usb: set input.voltage.nominal - back to 230V (0.30) Keeps the input.voltage and output.voltage - scaling from 0.28 Discussion: - http://article.gmane.org/gmane.comp.monitoring.nut.user/8719 - -2014-09-26 Arnaud Quette - - * conf/upsmon.conf.sample.in, docs/man/nut.conf.txt, - docs/man/upsmon.conf.txt, docs/packager-guide.txt: Replace outdated - references to shutdown.txt shutdown.txt was merged into config- - notes.txt during the AsciiDoc conversion of the whole documentation - and website. This content is now available in the docs/config- - notes.txt file, section [[UPS_shutdown]] "Configuring automatic - shutdowns for low battery events" - * conf/upsmon.conf.sample.in: Fix default value of POWERDOWNFLAG - POWERDOWNFLAG path changed from the hard-coded value /etc/killpower - to the build-time generated @CONFPATH@/killpower. This resulted in - an unexpected value '/etc/nut/killpower', at least on Debian. - (reported by Laurent Bigonville) Closes networkupstools/nut#74 - -2014-09-25 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: move to ltrim_m()/rtrim_m() - functions - * common/common.c, include/common.h: Add ltrim_m()/rtrim_m() - functions to trim several chars at the same time Also, make - ltrim() / rtrim() wrappers around ltrim_m() / rtrim_m(). - * common/common.c: Make ltrim() modify the input string Also, always - check string length in both ltrim() and rtrim(). Reference: - https://github.com/networkupstools/nut/issues/154 - -2014-09-25 Charles Lepple - - * data/driver.list.in: HCL: sort Tripp Lite models by name, then - increasing power I know this doesn't allow the cell merging code - to do as much, but this should make it easier to find models. - * data/driver.list.in: HCL: add Tripp Lite OMNIVSINT800 - (tripplite_usb) Source: - http://article.gmane.org/gmane.comp.monitoring.nut.user/8713 - * drivers/tripplite_usb.c: tripplite_usb: scale min/max voltages for - SMART protocol (0.29) Observed in a dump file from driver version - 0.11. Scale input.voltage.minimum and input.voltage.maximum the - same way as other voltages. - * drivers/tripplite_usb.c: tripplite_usb: fix voltage scaling for - 240V/1001 (0.28) Reported by Dave Williams: - http://article.gmane.org/gmane.comp.monitoring.nut.user/8713 The - input.voltage and output.voltage scaling for Protocol 1001 did not - factor in the input_voltage_scaled value. - -2014-09-24 Arnaud Quette - - * scripts/python/app/nut-monitor.appdata.xml: Fix compliance of NUT- - Monitor FreeDesktop AppData file Following the upstream update (by - David Goncalves), update the screenshots width and height to - conform to AppData specification: - http://people.freedesktop.org/~hughsient/appdata/ Closes - networkupstools/nut#127 - -2014-05-18 Charles Lepple - - * drivers/genericups.c: genericups: log cable type overrides as they - are parsed Fixes networkupstools/nut#28 Better than nothing, but - without a unit to test against, I don't want to make any more - intrusive changes. - -2014-09-17 Arnaud Quette - - * docs/nut-qa.txt: Minor update and completion Use the new Debian - package tracker URL and add Redhat / Fedora bug tracker - -2014-09-15 Daniele Pezzini - - * data/driver.list.in: HCL: add devices supported by nutdrv_qx - - Fideltronik LUPUS 500 USB Protocol: 'megatec' USB subdriver: - 'fabula' Reference: http://lists.alioth.debian.org/pipermail/nut- - upsuser/2014-June/009059.html - FTUPS FT-1000BS(T) / Voltronic - Power Apex 1KVA Protocol: 'voltronic-qs-hex' USB devices -> USB - subdriver: 'cypress' - FTUPS FT-1000BS / Voltronic Power Imperial - 1KVA Protocol: 'voltronic-qs' USB devices -> USB subdriver: - 'cypress' - -2014-07-11 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: improve the USB matching procedure - Consider also the iManufacturer/iProduct strings when checking - devices (if subdriver is not specified) to assign the right - subdriver in case the VID:PID couple is not specific enough. - -2014-06-30 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: add new 'fabula' USB subdriver Add - a new USB subdriver ('fabula') to support models - manufactured/rebranded by Fideltronik and accompained by - UPSilon2000 software. Reference: - http://lists.alioth.debian.org/pipermail/nut- - upsuser/2014-June/009059.html - -2014-09-03 Daniele Pezzini - - * drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_voltronic-qs-hex.c, drivers/nutdrv_qx_voltronic- - qs-hex.h: nutdrv_qx: add Voltronic-QS-Hex subdriver - (protocol=voltronic-qs-hex) A subdriver using a protocol, specific - to UPSes manufactured by Voltronic Power, partially Hex-encoded - (e.g. 'QS' reply) and supporting some megatec commands. - * docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: update docs about added - support for more complex UPS answers - * drivers/nutdrv_qx.c, drivers/nutdrv_qx.h, - drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_megatec-old.c, - drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_mustek.c, - drivers/nutdrv_qx_q1.c, drivers/nutdrv_qx_voltronic-qs.c, - drivers/nutdrv_qx_voltronic.c, drivers/nutdrv_qx_zinto.c: - nutdrv_qx: add basic support for more complex UPS answers Add - support (also in 'TESTING' mode) for '\0' chars in raw UPS answers - and the ability to preprocess answers before anything else (e.g.: - for CRC, decoding, ...). Increase verbosity of USB subdrivers and - serial communication. Always print also the return code when - dealing with an error. Update all subdrivers accordingly, bump - versions. - -2014-09-08 Charles Lepple - - * docs/documentation.txt: docs: Add link to Roger Price's openSUSE - writeup - -2014-09-04 Daniele Pezzini - - * drivers/nutdrv_qx.c: nutdrv_qx: prevent a vicious loop when - unexpected answers happen If a 'QX_FLAG_QUICK_POLL' item gets an - unexpected (non-empty) answer and, after returning from - 'qx_ups_walk()', it is not followed by at least one item using a - different 'command', the driver will loop endlessly using the same - 'broken' answer instead of trying to get a new one from the UPS. To - solve this issue, make sure to have an empty 'previous_item' when - starting 'qx_ups_walk()'. Also, bail out of 'qx_ups_walk()' when a - 'QX_FLAG_QUICK_POLL' item can't be preprocessed properly through - 'ups_infoval_set()'. - -2014-09-04 Charles Lepple - - * docs/man/asem.txt: docs: recommend I2C bus name for asem driver - -2014-09-03 Arnaud Quette - - * docs/man/nut-scanner.txt: Fix typo error in nut-scanner doc The - example network range scanned when using 192.168.0.0/25 is actually - 192.168.0.0 to 192.168.0.12*7* not (i.e. not .128) as previously - stated (reported by Evgeny 'Jim' Klimov) Closes - networkupstools/nut#144 - -2014-09-02 Charles Lepple - - * data/driver.list.in, drivers/belkin-hid.c: HCL: Belkin Regulator - PRO-USB 050d:0f51 (0.17) - https://github.com/networkupstools/nut/issues/149 - -2014-08-22 Charles Lepple - - * data/driver.list.in: HCL: Mecer ME-100-WTU with blazer_usb USB - VID:PID = 0665:5161 Tested by @silvec (Oliver Sauder) on NUT 2.6.3 - Reference: https://github.com/networkupstools/nut/issues/148 - -2014-08-19 Charles Lepple - - * docs/documentation.txt: docs: update links for two articles - -2014-08-17 Charles Lepple - - * tools/nut-usbinfo.pl: nut-usbinfo: fix FreeBSD devd.conf to use - $cdev - * scripts/upower/95-upower-hid.rules: 95-upower-hid.rules: updated by - nut-usbinfo.pl URL updated in previous commit. - * tools/nut-usbinfo.pl: nut-usbinfo: change link from Alioth SVN to - GitHub - * scripts/udev/.gitignore: udev: ignore 62-nut-usbups.rules Follow- - up commit to networkupstools/nut#140 - -2014-08-17 Yann E. MORIN - - * conf/Makefile.am: conf/: fix parallel install Do not reference the - upsmon.conf.sample twice, otherwise install, with a high number of - make jobs, may fail, like so: http://autobuild.buildroot.net/result - s/256/2567e13cd5bc702bc3a38a1d6fc8e34022cc7db5/build-end.log --- - This is not a rare occurence, as my testing managed to trigger the - issue in about 1 test out of 10 on average, on a not-so-fast - machine. - -2014-08-16 Charles Lepple - - * tools/nut-usbinfo.pl: nut-usbinfo: ignore *.orig files - -2014-08-14 Émilien Kia - - * configure.ac, docs/man/Makefile.am, m4/nut_check_asciidoc.m4: Test - presence of xmllint for manpages doc generation. - * configure.ac, docs/man/Makefile.am, m4/nut_check_asciidoc.m4: Test - presence of xsltproc for manpages doc generation. - -2014-08-04 Charles Lepple - - * docs/man/ups.conf.txt, drivers/libusb.c: Remove redundant - usb_set_altinterface(), unless user requests it Adds flag/value to - USB driver options. Closes networkupstools/nut#138 - -2014-08-09 Charles Lepple - - * drivers/blazer_usb.c, drivers/libusb.c, drivers/nutdrv_qx.c, - drivers/tripplite_usb.c, drivers/usb-common.h, drivers/usbhid- - ups.c: libusb.c: consolidate USB-related addvar() calls - * drivers/cps-hid.c: usbhid-ups (CPS): determine battery.voltage - scale factor at runtime If the battery.voltage reading is greater - than 1.4x battery.voltage.nominal, apply a scale factor of 2/3 to - bring the voltage back in line. Closes networkupstools/nut#142 - -2014-08-08 Arnaud Quette - - * docs/man/nut-scanner.txt: Fix typo error Fix a typo error on "-B" - option (reported by Evgeny 'Jim' Klimov) - -2014-08-05 Arnaud Quette - - * scripts/python/Makefile.am: Distribute FreeDesktop AppData file for - NUT Monitor FreeDesktop AppData file for NUT Monitor was not - distributed, waiting for some approval - -2014-08-01 Arnaud Quette - - * scripts/udev/Makefile.am, scripts/udev/README: Fix USB permission - issues related to Linux / udev Rename udev rules file to 62-nut- - usbups.rules, to prevent NUT USB privileges from being overwritten - Closes #140 - * docs/cables.txt: Fix typo error on Eaton / MGE USB-RJ45 cable - -2014-07-14 Charles Lepple - - * scripts/Aix/.gitignore: Ignore generated AIX spec file - -2014-07-14 Giuseppe Corbelli - - * AUTHORS, docs/man/asem.txt: asem: additional documentation - http://article.gmane.org/gmane.comp.monitoring.nut.devel/6741 - -2014-07-13 Charles Lepple - - * docs/man/upscli_get.txt: upscli_get(): mention SIGPIPE handling - Closes: #132 - * data/driver.list.in: HCL: distinguish between Tripp Lite old and - new protocol 3005 - -2014-07-13 Arnaud Quette - - * scripts/python/app/nut-monitor.appdata.xml: Complete FreeDesktop - AppData file for NUT Monitor As per Richard Hughes comments, in - #127, complete the description field - -2014-07-12 Arnaud Quette - - * scripts/Aix/nut-aix.spec.in: Minor adjustments as per Github - comments - * docs/configure.txt: Add missing documentation for configure option - The new asem driver introduced --with-linux_i2c, for which - documentation was missing in configure documentation - -2014-07-11 Charles Lepple - - * NEWS, data/driver.list.in, docs/man/Makefile.am, docs/man/asem.txt, - docs/man/index.txt: asem: documentation - -2014-07-07 Giuseppe Corbelli - - * configure.ac, data/driver.list.in, drivers/Makefile.am, - drivers/asem.c: Support for ASEM UPS on Linux/i2c Patch from - http://article.gmane.org/gmane.comp.monitoring.nut.devel/6723 - Thread: http://news.gmane.org/find- - root.php?message_id=53A83FCB.1080808%40copanitalia.com Builds on - Ubuntu 12.10 and 14.04; requires libi2c-dev - -2014-07-05 Charles Lepple - - * drivers/tripplite_usb.c: tripplite_usb: fix typos in bin2d() and - control_outlet() (0.27) - * drivers/tripplite_usb.c: tripplite_usb: control_outlet() for - protocol 3005 (0.26) - * drivers/tripplite_usb.c: tripplite_usb: Additional 3005 protocol - support (0.25) http://news.gmane.org/find-root.php?message_id=CAFe - iwyG8HCfg%2dQqxcwhnm1Yo0z0F0BLyOPCYX%2d4yMMFg8sB4QQ%40mail.gmail.co - m - * drivers/tripplite_usb.c: tripplite_usb: basic support for 3005 - binary protocol (0.24) Based on logs from SMART500RT1U - -2014-07-04 vesnn - - * drivers/powercom.c: Update powercom.c Fix Powercom Imperial - initialization for models since 2009 with USB interface. - -2014-06-23 Arnaud Quette - - * scripts/python/app/nut-monitor.appdata.xml: Create a FreeDesktop - AppData file for NUT Monitor appData files provide to users long - descriptions, screenshots and other useful information on - application. This will mainly serve for Software Center like - applications - -2014-06-19 Charles Lepple - - * data/driver.list.in: HCL: Lacerda New Orion 800VA with blazer_usb - http://news.gmane.org/find-root.php?message_id=CANDysWwqgTUMYU03QbP - T8JxEtLd38mvwfTMMhZqS%3d%2diGpdvJDA%40mail.gmail.com - -2014-06-17 Charles Lepple - - * data/driver.list.in: HCL: add APC-Microsol entry for solis - * drivers/solis.c: solis: silence clang warnings about extra - parentheses Since we're in the neighborhood (#133)... Typically, - the idiom is either: if ( a == b ) for equality checking, or: if - ( ( a = b ) ) for assignment with a comparison. - * drivers/solis.c, drivers/solis.h: solis: eliminate fixed-length - string buffer for model name The new APC model name overflows the - buffer. (#133) - -2014-06-16 bsalvador - - * drivers/solis.c: Update on solis.c to add more support to Back-UPS - 1200BR - * drivers/solis.c: Update solis.c to support Microsol-APC Unit. - Added support to Back-UPS 1200BR (Microsol-APC) unit. - -2014-06-15 Charles Lepple - - * docs/man/upscli_get.txt, docs/man/upscli_list_next.txt, - docs/man/upscli_list_start.txt: docs: synchronize upscli_* - numq/numa with header There were a few leftover signed int - parameters in the man pages, but the headers and implementation use - 'unsigned int'. Closes: - https://github.com/networkupstools/nut/issues/131 - * docs/man/solis.txt: docs: mention APC in Microsol driver man page - * docs/man/apcsmart.txt: docs: point APC Microsol users from apcsmart - to solis Also make some of the formatting and grammar self- - consistent. - * drivers/solis.c: solis: recognize APC BZ1200-BR and BZ2200BI-BR - (0.62) Patch suggested by Bruno Salvador for BZ1200-BR, and also - tested by Douglas A. Augusto on BZ2200BI-BR. Reference: * - http://forums.freenas.org/index.php?threads/nobreak-bz1200-br-back- - ups-rs-1200va-600w-bivolt-115-nt.20247/ * - http://news.gmane.org/find-root.php?message_id=CACu22%2d3Nn2R%3dQQe - 9uy%5fPXHRduaPaFgCp2Sw4ra57Ow2qDQcOJQ%40mail.gmail.com - -2014-06-08 Arnaud Quette - - * scripts/subdriver/gen-snmp-subdriver.sh: Inline documentation fixes - -2014-06-03 george - - * scripts/python/module/PyNUT.py: Fixed version description. - * scripts/python/module/PyNUT.py: Added author information, bumped - version. According to the semantic versioning scheme - (http://semver.org/), adding features that do not break backwards - compatibility with previous releases means that the minor version - number should be incremented. - * scripts/python/module/PyNUT.py: Change format of raise keyword. - Fixes PyNUT Python 3 compatibility. - * scripts/python/module/PyNUT.py: PyNUT: Create a custom exception - class. This maintains backwards compatibility, and allows calling - programs to use "except PyNUTError" instead of "except Exception" - when using PyNUT methods. See - https://wiki.python.org/moin/HandlingExceptions for more - information. - * scripts/python/module/PyNUT.py: Fix error when raising without an - Exception. Raising without a valid exception is invalid: >>> - raise Traceback (most recent call last): File "", line 1, in - TypeError: exceptions must be old-style classes or derived - from BaseException, not NoneType >>> raise Exception Traceback - (most recent call last): File "", line 1, in - Exception Changing this to "raise Exception" fixes this problem. - -2014-06-01 Charles Lepple - - * docs/man/tripplite_usb.txt, drivers/tripplite_usb.c: tripplite_usb: - last tweaks, for now. Initialize bv_12V to a dummy value, since - gcc can't see that it is used in the union of both conditionals - where it is set. Also, align the documentation with the strange - definition of empty used by the Tripp Lite state-of-charge - approximation. - * drivers/tripplite_usb.c: tripplite_usb: silence warning (0.23) - Pedantic, to be sure, but someone might try the driver with a - protocol not listed, and sure enough, bv_12V won't be initialized. - * docs/man/tripplite_usb.txt, drivers/tripplite_usb.c: tripplite_usb: - expose battery_min/_max as variables (0.22) - http://news.gmane.org/find- - root.php?message_id=21370.36829.817425.464627%40godel.bruda.ca - -2014-05-27 Charles Lepple - - * data/driver.list.in: HCL: GRAFENTHAL PR-3000-HS supported by snmp- - ups Tested with 2.6.5-3 (0.68) on Windows (IETF MIB 1.4). Some - NUT variables are zero - further testing may be needed. Reference: - http://news.gmane.org/find-root.php?message_id=75FC7A5479BA4A4E8ADF - 76BC3AD3E568581EC753%40MS03.MACLE.DE - -2014-05-23 Charles Lepple - - * drivers/tripplite_usb.c: tripplite_usb: use dv/dq charge - calculation for all models (0.21) - -2014-05-20 Andrew Burdo - - * drivers/powercom-hid.c: Add comments for some values. - * drivers/usbhid-ups.c: Reuse variable. - * drivers/usbhid-ups.c: Add default case. - -2014-05-18 Charles Lepple - - * scripts/upower/95-upower-hid.rules: upower: regenerate rules file - USB VID:PID = 10af:0004 This dependency graph makes my head spin. - * configure.ac: configure.ac: version to 2.7.2.5 for snapshots - -2014-05-13 Daniele Pezzini - - * drivers/compaq-mib.c: compaq-mib: comment out no longer used items - As per 31827d5faa86377efb7a92b7aec322cc4c7a275f - -2014-05-03 Daniele Pezzini - - * docs/download.txt: docs: add Void Linux in download/Binary packages - Reference: https://github.com/networkupstools/nut/issues/125 - -2014-05-03 Charles Lepple - - * docs/Makefile.am: docs: add mge-usb-rj45.jpg to distribution - -2014-05-02 Arnaud Quette - - * docs/images/cables/mge-usb-rj45.jpg: Add MGE information on USB- - RJ45 cable The illustration matching the previous commit was still - needed on the nut repository, and not on the nut-website on - * docs/cables.txt: Add MGE information on USB-RJ45 cable These - information were provided by MGE years ago, and were waiting for - counter testing. Martin De Graaf - Loyer has now fixed this. Note - that the matching illustration will be committed on the new nut- - website repository - -2014-04-29 Andrew Burdo - - * drivers/powercom-hid.c, drivers/usbhid-ups.c: Bump versions. - * data/driver.list.in, docs/man/usbhid-ups.txt: Update documentation. - * drivers/usbhid-ups.c: Reconnect on interrupt read error. - * drivers/libhid.c, drivers/libhid.h, drivers/powercom-hid.c, - drivers/usbhid-ups.c: Reading from the interrupt pipe implies that - you use INPUT flagged objects. - * drivers/powercom-hid.c: Remove erroneous status. - * drivers/powercom-hid.c: Comment non-compliant variables. - -2014-04-17 Andrew Burdo - - * drivers/libhid.c, drivers/libhid.h, drivers/powercom-hid.c, - drivers/usbhid-ups.c: Add support for 0d9f:0001 (USB HID, - Powercom). - -2014-04-17 Arnaud Quette - - * NEWS, UPGRADING, configure.ac: Update for release 2.7.2 Complete - the release information for NUT 2.7.2 - -2014-04-17 Stephen J. Butler - - * drivers/tripplite-hid.c: Scale for SMART1500LCDT - -2014-04-07 Arnaud Quette - - * drivers/compaq-mib.c: Fix erroneous status in HP/Compaq SNMP MIB - Using the most recent HP firmware (1.76), erroneous on-battery - status were reported. Also disable an erroneous low-battery - definition (pointing nowhere), while waiting for actual - improvements (report and patch from Philippe Andersson ; Closes - networkupstools/nut#117) - -2014-04-06 Daniele Pezzini - - * drivers/mge-xml.c: mge-xml: fix compile-time warnings, versioning - -2014-04-05 Charles Lepple - - * data/driver.list.in: HCL: Numeric Digital 800 plus USB VID:PID = - 0665:5161 Reference: networkupstools/nut#115 (blazer_usb @ 2.6.4; - waiting for confirmation with nutdrv_qx) - * data/driver.list.in: HCL: Eaton Powerware 3105 supported by - bcmxcp_usb Closes networkupstools/nut#117 - * data/driver.list.in, drivers/belkin-hid.c: usbhid-ups/belkin-hid: - add support for Emerson Network Power Liebert PSI 1440 USB VID:PID - = 10af:0004 - http://article.gmane.org/gmane.comp.monitoring.nut.user/8479 - -2014-04-05 Arnaud Quette - - * drivers/al175.c: Fix data format warnings on all architectures - Complete commit 7daa0feb6ed4f1c29bfe14c8e491ba198a4ba643, and - actually fix some of the warnings related data format. Also bump - al175 driver revision - * clients/Makefile.am: Update libupsclient library version - information Following the recent export of libcommon functions in - libupsclient, update the library version information to 4:0:0 - -2014-04-04 Arnaud Quette - - * drivers/al175.c: Fix data format warnings Fix a few warnings - related data format, in debug code - * clients/Makefile.am: Add libnutclient library version information - Add the missing LDFLAGS for adding version information - -2014-03-21 Arnaud Quette - - * data/driver.list.in: [HCL] CABAC UPS-1700DV2 supported by - blazer_usb Reported by jammin84 Closes #113 - * clients/Makefile.am, common/Makefile.am: Link libupsclient with - libcommon Fix undefined references related to functions of - libcommon. This issue was reported on Debian: - https://bugs.debian.org/731156 (patch from Matthias Klose ; Closes - Github issue #73) - -2014-03-18 Charles Lepple - - * data/driver.list.in: [HCL] Digitus DN-170014 supported by - richcomm_usb Reference: - http://lists.alioth.debian.org/pipermail/nut- - upsdev/2014-March/006695.html -or- http://news.gmane.org/find-root. - php?message_id=CADq9dvWMx0xBz9XXkVKXCre4ox%2d2kSeHtD7LW39eEDH1RCY8s - Q%40mail.gmail.com - -2014-03-05 Charles Lepple - - * UPGRADING: Added note about --enable-option-checking=fatal Closes - #99 (really) - -2014-03-05 Émilien Kia - - * scripts/Aix/nut-aix.spec.in: Make web source path independant from - specific version. - * scripts/Aix/nut-aix.spec.in: Use configure-dependant variables - instead of statically defined ones for user and group. - * configure.ac: Use $target_cpu instead of calling uname to know cpu - type. Fix crosscompilation. - -2013-06-14 Vaclav Krpec - - * scripts/Aix/nut-aix.spec.in, scripts/Aix/nut.init: AIX: packaging & - init script improvements (cherry picked from commit - ce195e3a2eff1abbd8e192f4d3e278017d7ffb21) - -2013-06-12 Vaclav Krpec - - * scripts/Aix/nut.init: Fixed client startup detection (cherry - picked from commit 23df5e811cc9008bfa0a37bd174b59890a3760a6) - * scripts/Aix/nut-aix.spec.in: Fixed AIX RPM specfile (cherry picked - from commit 11ba37bf36dcda0398c8c62fab838dd00e54c5db) - -2013-06-11 Vaclav Krpec - - * scripts/Aix/nut-aix.spec.in: Allow libneon-based XML driver & - scanning for AIX (cherry picked from commit - 4c2e89ec584b2015b22f4599d1571c26f2f94e3d) - -2013-06-10 Vaclav Krpec - - * clients/Makefile.am: Fix of AIX-specific parseconf linking bug - Added dummy do_upsconf_args to binaries that use libcommon to - satisfy the linker. libcommon links libparseconf, which calls - do_upsconf_args supplied from above as an implementation-specific - routine. (cherry picked from commit - 0078f9383d3a7af4f3edfed6c78de387a12c6b2b) - -2013-04-25 Vaclav Krpec - - * clients/Makefile.am, clients/upsclient.c, configure.ac: - linupsclient: NUT scanning on AIX bugfix 1/ A simmilar bug like in - Solaris is in AIX itself---non-blocking connect may return -1 while - errno == 0. Shall be treated as EINPROGRESS. 2/ Linking of - libupsclent.so on AIX requires libcommon, otherwise scanning for - NUT crashes with SIGSEGV on unresolved usplogx (cherry picked from - commit 16177f99bc995852bb86d2183958f24f11993632) - -2013-03-13 Vaclav Krpec - - * Makefile.am: AIX packages: make package does the trick (cherry - picked from commit 1d25bd2868339decace5b3028c834746f2824670) - -2013-03-12 Vaclav Krpec - - * scripts/Aix/nut-aix.spec.in, scripts/Aix/nut.init: AIX packaging: - nut-client uninstal bugfix Packages clean uninstallation - (lost/forgotten commit) (cherry picked from commit - f6dd1aec5d2157a3ba3654621fa8e2ac88b060f9) - -2013-03-08 Vaclav Krpec - - * clients/upsclient.c, configure.ac: Solaris/i386: non-blocking - connect WA (cherry picked from commit - d2b466b9ee5402074ccbf7f2967433350affdbcc) - -2013-03-04 Vaclav Krpec - - * Makefile.am, configure.ac, scripts/Aix/nut-aix.spec.in, - scripts/Aix/nut.init: AIX packaging AIX init script and RPM spec. - file added (cherry picked from commit - 3851525edcb417f96a5d1c12fb786b85095b54d4) - -2014-03-03 Charles Lepple - - * data/driver.list.in: HCL: various updates * Closes - https://github.com/networkupstools/nut/issues/107 - * http://lists.alioth.debian.org/pipermail/nut- - upsdev/2013-November/006564.html * http://news.gmane.org/find- - root.php?message_id=50D9D460.1080408%40gmail.com - * http://news.gmane.org/find-root.php?message_id=CA%2b4duQ%3dppW%2b - Pz%2bRVPVXJyFLj0HErh1ZOtm5tk8b6n5Nd5kSk0g%40mail.gmail.com * - http://news.gmane.org/find- - root.php?message_id=528EC53C.9000801%40me.com - * docs/nut-qa.txt: NUT QA document: updated and reworded - * docs/nut-qa.txt: NUT QA document: CR->LF - * docs/FAQ.txt: FAQ: minor updates Update the bestfortress entry, - fix the mythicbeasts URL, and reword a few entries. - -2014-02-13 Charles Lepple - - * docs/man/upsimage.cgi.txt: upsimage.cgi(8): update GD homepage - -2014-03-03 Émilien Kia - - * drivers/nutdrv_qx.h: Detect if TRUE (and FALSE) are already defined - and define bool_t accordingly. - -2014-02-27 Arnaud Quette - - * UPGRADING: Add a note on Hardware Abstraction Layer removal - * INSTALL.nut, autogen.sh, configure.ac, docs/Makefile.am, - docs/configure.txt, docs/developers.txt, docs/features.txt, - docs/macros.txt, docs/new-drivers.txt, docs/nut-hal.txt, - docs/packager-guide.txt, drivers/Makefile.am, drivers/dstate-hal.c, - drivers/dstate-hal.h, drivers/main-hal.c, drivers/main-hal.h, - m4/nut_check_libhal.m4, m4/nut_config_libhal.m4: Remove the - remaining HAL files and references Remove the remaining build - rules, source code and documentation related to the FreeDesktop - Hardware Abstraction Layer (HAL) support. For the record, with this - HAL implementation, NUT drivers were sending data over DBus - (Closes: #99) - -2014-02-24 Charles Lepple - - * drivers/blazer_usb.c, drivers/libusb.c, drivers/nutdrv_qx.c, - drivers/riello_usb.c, drivers/usbhid-ups.c: OpenBSD ports tree - patches for EPROTO Closes networkupstools/nut#44 - -2014-02-26 Arnaud Quette - - * scripts/Makefile.am, scripts/README, scripts/hal/.gitignore, - scripts/hal/Makefile.am, tools/nut-usbinfo.pl: Remove the - generation of HAL support files Remove the code supporting the - generation of HAL FDI file. This is the first commit of a set to - address Github issue #99 - * drivers/snmp-ups.c: Fix snmp-ups segmentation fault A basic sanity - check was missing in the core code of snmp-ups, causing a driver - crash under some specific circumstances, at driver initialisation - time. Hence, this does not affect production systems - * README, UPGRADING, docs/FAQ.txt, docs/config-notes.txt, - drivers/Makefile.am, scripts/Solaris/nut.in, - scripts/Solaris/postinstall.in, scripts/Solaris/preremove.in, - scripts/systemd/nut-driver.service.in, - scripts/systemd/nutshutdown.in: Closes #96: Install upsdrvctl to - $prefix/sbin Install upsdrvctl to $prefix/sbin rather than - $driverexec. upsdrvctl has been historically standing beside the - drivers. It now resides in the system binaries ($prefix/sbin) - directory - -2014-02-25 Arnaud Quette - - * drivers/mge-hid.c: Add improved support for Eaton 5P Add the - necessary hooks to improve support for Eaton 5P range. This - includes post-processing of the model name, along with handling - rules for battery voltage (actual and nominal) - -2014-02-19 Daniele Pezzini - - * docs/Makefile.am, docs/chunked.xsl, docs/common.xsl, - docs/xhtml.xsl: docs: prevent smartphones from being too smart - (docbook) Add HTML tag to not auto-create telephone number - links on mobile browsers also in docbook processed documents. - Reference: https://github.com/networkupstools/nut/issues/78 XSL - files source: - - https://github.com/asciidoc/asciidoc/blob/master/docbook- - xsl/common.xsl - - https://github.com/asciidoc/asciidoc/blob/master/docbook- - xsl/xhtml.xsl - - https://github.com/asciidoc/asciidoc/blob/master/docbook- - xsl/chunked.xsl - * docs/man/asciidoc.conf: docs: prevent smartphones from being too - smart Add HTML tag to not auto-create telephone number - links on mobile browsers. Reference: - https://github.com/networkupstools/nut/issues/78 - -2014-02-15 Arnaud Quette - - * docs/acknowledgements.txt: Update NUT team membership for Daniele - Pezzini Daniele Pezzini is a now a NUT senior developer - -2014-02-14 Arnaud Quette - - * docs/acknowledgements.txt, docs/website/news.txt: Formalizing the - end of the relationship with Eaton The situation of the - relationship with Eaton has evolved, and since 2011 Eaton does not - support NUT anymore. This may still evolve in the future. But for - now, please do not consider anymore that buying Eaton products will - provide you with official support from Eaton, or a better level of - device support in NUT. - -2014-02-14 Charles Lepple - - * Makefile.am: devd: use staging directory for distcheck - * drivers/Makefile.am, drivers/snmp-ups.c, drivers/xppc-mib.c, - drivers/xppc-mib.h: snmp-ups: add XPPC-MIB for Tripp Lite - SU10KRT3/1X - * scripts/subdriver/gen-snmp-subdriver.sh: gen-snmp-subdriver.sh: - documentation updates - -2014-02-10 Charles Lepple - - * scripts/subdriver/gen-snmp-subdriver.sh: gen-snmp-subdriver.sh: fix - option typos * Use '-M' for MIB directories, to match snmpwalk and - the help text. * Add space before '-c' in snmpwalk (not sure how - this worked before) - * scripts/Makefile.am: cosmetic: Indent scripts/Makefile.am - EXTRA_DIST continuation lines - * scripts/Makefile.am: Add gen-snmp-subdriver.sh to distribution - tarball - -2014-02-14 Arnaud Quette - - * docs/acknowledgements.txt: Update NUT team membership for Frédéric - Bohe Frederic Bohe, NUT senior developer and Eaton contractor from - 2009 to 2013, is now a retired member. Thanks for all the hard work - on the Windows port, nut-scanner, Unix packaging, support, ... Also - update the developers membership page, from Alioth to GitHub - -2013-02-24 Charles Lepple - - * autogen.sh, configure.ac, scripts/Makefile.am, - scripts/devd/.gitignore, scripts/devd/Makefile.am, - scripts/devd/README, tools/nut-usbinfo.pl: FreeBSD: generate - devd.conf files for USB UPSes This adds a --with-devd-dir=PATH - option to ./configure, which defaults to /usr/local/etc/devd (or - /etc/devd, whichever is found first). Unlike udev, there does not - seem to be a way to re-trigger rules at runtime. This means you - will likely need to unplug and replug your UPS after installing the - new nut-usb.conf file. - -2014-02-13 Arnaud Quette - - * .gitignore, server/.gitignore: Minor completion to gitignore files - Add a few more exotic targets, related to debug or official - distribution - -2014-02-11 Daniele Pezzini - - * .gitignore, clients/.gitignore, common/.gitignore, conf/.gitignore, - data/.gitignore, data/html/.gitignore, docs/.gitignore, - docs/man/.gitignore, docs/website/.gitignore, - docs/website/scripts/.gitignore, drivers/.gitignore, - include/.gitignore, lib/.gitignore, m4/.gitignore, - scripts/.gitignore, scripts/HP-UX/.gitignore, - scripts/Solaris/.gitignore, scripts/augeas/.gitignore, - scripts/avahi/.gitignore, scripts/hal/.gitignore, - scripts/hotplug/.gitignore, scripts/python/.gitignore, - scripts/systemd/.gitignore, scripts/udev/.gitignore, - scripts/ufw/.gitignore, server/.gitignore, tests/.gitignore, - tools/.gitignore, tools/nut-scanner/.gitignore: Simplify gitignore - files Remove redundancies and old/svn things. Limit the scope - wherever it makes sense. Ignore all cscope files and test logs. - Make ignoring generated files easier to maintain. - -2014-02-11 Charles Lepple - - * drivers/libshut.c: libshut: partially revert PnP/RTS change - Reported by Baruch Even. It is unclear how this will work after - running nut-scanner, but it is more important to keep the drivers - working. Reference: 65db105 / - 2013-09-24T08:18:00Z!fredericbohe@eaton.com Closes: - networkupstools/nut#91 - -2014-02-09 Daniele Pezzini - - * docs/man/nutdrv_qx.txt: nutdrv_qx: update manpage for the newly - supported Voltronic Power P98 units - * drivers/nutdrv_qx.c, drivers/nutdrv_qx_mecer.c, - drivers/nutdrv_qx_mecer.h: nutdrv_qx: improve support for - '(ACK/(NAK' and Voltronic Power P98 UPSes In 'mecer' subdriver's - claim function try to get protocol (QPI, for Voltronic Power - devices) used by the UPS: - supported devices are Voltronic Power's - P98 units - if the UPS doesn't support the QPI command, use its - reply to identify whether it uses '(ACK\r'/'(NAK\r' replies This - way we can catch '(ACK/(NAK' devices, while previously the 'mecer' - subdriver was 'hidden' by the 'megatec' (echo back/'ACK/NAK') one. - Plus Q1 units with 'ACK'/'NAK' replies or echoing back not - supported and rejected commands are no longer wrongly 'claimed' by - the 'mecer' subdriver. - -2014-02-03 Daniele Pezzini - - * docs/.gitignore, docs/Makefile.am, docs/documentation.txt: docs: - build PDF also for cables.txt - -2014-02-02 Daniele Pezzini - - * Makefile.am, configure.ac, docs/.gitignore, docs/Makefile.am, - docs/man/.gitignore, docs/man/Makefile.am, docs/stable-hcl.txt, - docs/user-manual.txt, docs/website/.gitignore, - docs/website/Makefile.am, docs/website/css/ie-overrides.css, - docs/website/css/web-layout.css, - docs/website/css/xhtml11-quirks.css, docs/website/css/xhtml11.css, - docs/website/faviconut.ico, docs/website/faviconut.png, - docs/website/news.txt, docs/website/old-news.txt, - docs/website/projects.txt, docs/website/scripts/.gitignore, - docs/website/scripts/filter_png.js, docs/website/scripts/jquery.js, - docs/website/scripts/nut_jquery.js, docs/website/scripts/toc.js, - docs/website/ups-protocols.txt, docs/website/web-layout.conf, - docs/website/website.txt, tools/Makefile.am, tools/nut-hclinfo.py: - website: move to a standalone website - -2014-01-18 Daniele Pezzini - - * docs/net-protocol.txt: docs: fix a couple of asciidoc errors in - net-protocols.txt - * server/netlist.c: net-protocol: fix closing line of LIST RANGE - -2014-01-16 Charles Lepple - - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: fix permissions-based - crash, and enable vendor variable (1.1) - -2014-01-13 Charles Lepple - - * .gitignore: Ignore cscope.out - * docs/man/.gitignore, docs/man/nutdrv_atcl_usb.txt, - drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: documentation and - logging (v1.0) - -2014-01-11 Charles Lepple - - * drivers/apc-mib.c: snmp-ups: APC SmartBoost and SmartTrim are OL - SmartBoost and SmartTrim are voltage regulation functions that - prevent the UPS from using the battery during brownouts and - overvoltages, so the BOOST and TRIM states are also mapped to OL. - Reference: - http://article.gmane.org/gmane.comp.monitoring.nut.devel/6583 - * data/driver.list.in: [HCL] MicroDowell B.Box LP 500: genericups - type 7 Closes networkupstools/nut#83 From @lxp: UPS shutdown - only works when on-battery and has a delay of about 1min until - execution (something between 50sec to 1min 30sec on mine). - References: http://www.ezdirect.it/pdf/lp500.pdf - https://forums.gentoo.org/viewtopic-t-730172-start-0.html - -2014-01-11 Daniele Pezzini - - * drivers/blazer_ser.c, drivers/blazer_usb.c: blazer: fix man page - references - -2014-01-11 Charles Lepple - - * docs/man/nutdrv_atcl_usb.txt, drivers/nutdrv_atcl_usb.c: - nutdrv_atcl: match iManufacturer (vendor) string - * docs/man/snmp-ups.txt: snmp-ups: update and edit documentation - -2014-01-11 Daniele Pezzini - - * data/driver.list.in: HCL: add Atlantis Land/Voltronic Power units - supported by nutdrv_qx - * drivers/nutdrv_qx_blazer-common.c, drivers/nutdrv_qx_blazer- - common.h: nutdrv_qx: fix nutdrv_qx_blazer-common.{c,h} header - comments - * docs/man/nutdrv_qx.txt, docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: - update manuals for new 'voltronic-qs' subdriver - -2013-12-05 Daniele Pezzini - - * drivers/Makefile.am, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_voltronic-qs.c, drivers/nutdrv_qx_voltronic-qs.h: - nutdrv_qx: add Voltronic-QS subdriver (nutdrv_qx - protocol=voltronic-qs) A subdriver using a protocol, specific to - UPSes manufactured by Voltronic Power, based on the 'mustek' one - (i.e. 'QS'). - -2014-01-01 Charles Lepple - - * drivers/nutdrv_atcl_usb.c: nutdrv_atcl_usb: adjusted logging and - retries (v0.02) - * data/driver.list.in, docs/man/Makefile.am, docs/man/index.txt, - docs/man/nutdrv_atcl_usb.txt: nutdrv_atcl_usb: man page and HCL - entries - -2013-12-31 Charles Lepple - - * drivers/.gitignore, drivers/Makefile.am, drivers/nutdrv_atcl_usb.c, - tools/nut-usbinfo.pl: nutdrv_atcl_usb: 'ATCL FOR UPS' new driver - Reference: http://news.gmane.org/find- - root.php?message_id=%3c52B4C54E.1050106%40ariwainer.com.ar%3e - * drivers/libusb.c, drivers/usb-common.h: Move USB_TIMEOUT to usb- - common.h - -2013-12-31 Laurent Bigonville - - * .gitignore, INSTALL => INSTALL.nut, Makefile.am, docs/FAQ.txt, - docs/Makefile.am, docs/configure.txt, docs/packager-guide.txt, - docs/user-manual.txt: Rename INSTALL to INSTALL.nut Rename it to - INSTALL.nut so autoreconf will not try to overwrite it. In Debian - tools like dh_autoreconf calls autoreconf with -f which overwrite - the INSTALL file. - -2013-12-27 Charles Lepple - - * scripts/subdriver/gen-usbhid-subdriver.sh: usbhid-ups: fix call to - is_usb_device_supported() The is_usb_device_supported() function - now takes a USBDevice_t* instead of a pair of USB ID values. - -2013-12-22 Florian Bruhin - - * data/driver.list.in, docs/man/powercom.txt, drivers/powercom.c: Add - OptiUPS VS 575C support to PowerCom Reference: - http://news.gmane.org/find- - root.php?message_id=%3c20131126085646.GM28832%40lupin%3e - -2013-12-11 Denis Yantarev - - * drivers/blazer_usb.c, drivers/nutdrv_qx.c: Fixed incorrectly - reported Ippon response length - -2013-11-30 Daniele Pezzini - - * docs/man/nutdrv_qx.txt, drivers/nutdrv_qx.c, - drivers/nutdrv_qx_blazer-common.c, drivers/nutdrv_qx_blazer- - common.h, drivers/nutdrv_qx_megatec-old.c, - drivers/nutdrv_qx_mustek.c, drivers/nutdrv_qx_q1.c: nutdrv_qx: fix - 'megatec/old' and 'mustek' subdrivers' claim functions Address, - for 'megatec/old' and 'mustek' subdrivers, the same problem fixed - in commit 720975f4de910b270ba705a7f2981c2ee33ca2eb for Q1-based - ones: - Make the claim function of 'megatec/old' and 'mustek' - subdrivers not poll the UPS for 'vendor' informations as they are - not really needed to set these protocols apart from the other ones - (i.e. the 'status' poll is specific enough, at the time of - writing). - Move common 'light' claim function to nutdrv_qx_blazer- - common.{c,h}. - Update manual. - Versioning. - -2013-11-24 Daniele Pezzini - - * docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: improve developer manual - Get rid of useless tables. Fix minor errors/typos. - * drivers/nutdrv_qx.c: nutdrv_qx: versioning - * docs/man/nutdrv_qx.txt, docs/nutdrv_qx-subdrivers.txt: nutdrv_qx: - update manuals for new Q1 subdriver and improve readability - -2013-11-23 Daniele Pezzini - - * drivers/Makefile.am, drivers/nutdrv_qx.c, drivers/nutdrv_qx_q1.c, - drivers/nutdrv_qx_q1.h: nutdrv_qx: add new 'fallback' Q1 subdriver - Add new 'Q1' subdriver. This subdriver implements the same protocol - as the one used by the 'megatec' subdriver minus the vendor (I) and - ratings (F) queries. In the claim function: - it doesn't even try - to get 'vendor' informations (I) - it checks only status (Q1), - through 'input.voltage' variable Therefore it should be able to - work even if the UPS doesn't support vendor/ratings *and* the user - doesn't use the 'novendor'/'norating' flags, as long as: - the UPS - replies a Q1-compliant answer (i.e. not necessary filled with all - of the Q1-required data, but at least of the right length and with - not available data filled with some replacement character) - the - UPS reports a valid input.voltage (used in the claim function) - - the UPS reports valid status bits (1st, 2nd, 3rd, 6th, 7th are the - mandatory ones) This commit reintroduces a functionality of the - blazer subdrivers that was lost because now, in order to tell - whether a device is supported by a subdriver or not, if the user - doesn't call the driver with the 'novendor' flag, both the status - (Q1) and the vendor (I/FW?) queries are needed (that's to better - discern the subdrivers). Reference: - http://lists.alioth.debian.org/pipermail/nut- - upsuser/2013-November/008692.html - -2013-11-23 Charles Lepple - - * configure.in => configure.ac: Rename configure.in to configure.ac - autoconf has been warning about this for a while - let's fix it - before too many branches get created with the old name. - * configure.in: configure.in: bump version to 2.7.1.5 Some packaging - systems don't like the -pre# system. - -2013-11-21 Laurent Bigonville - - * docs/man/ups.conf.txt, docs/man/upsdrvctl.txt, drivers/upsdrvctl.c: - Provide retry options for upsdrvctl and driver(s) As recently seen - in Debian (bugs #694717 and #677143), it may be required to have - upsdrvctl retrying to start the driver in case of failure. More - specifically, a mix of init system (V and systemd), udev and USB - device(s) can result in the /dev entry not being available at - driver startup, thus resulting in a general failure to start NUT. - This commit provides at least a way to overcome this issue. A more - suitable solution will require more work on NUT design. This - patch if based on Arnaud Quette proposal - -2013-11-20 Arnaud Quette - - * Makefile.am: Maintainers targets: distribution signature / hashes - Create some handy targets to ease and automate release publication - 2013-11-19 Charles Lepple * configure.in: configure: update version to 2.7.1 @@ -18601,8 +54,8 @@ environment on ships (and we don't need shutdown there -- in critical situations the system has to operate as long as possible, untill the battery is empty) Also, all of the previous issues - listed below are now fixed in this al175 version: - ‘return’ with - a value, in function returning void (2x) - anonymous variadic + listed below are now fixed in this al175 version: - ‘return’ + with a value, in function returning void (2x) - anonymous variadic macros were introduced in C99 - C++ style comments are not allowed in ISO C90 - ISO C forbids braced-groups within expressions (5x) - ISO C90 forbids specifying subobject to initialize (16x) - ISO C99 @@ -18699,26 +152,27 @@ revert of the voltronic merge * data/driver.list.in: nutdrv_qx: remove superfluous indications from the HCL - * data/driver.list.in, docs/Makefile.am, docs/man/Makefile.am, - docs/man/index.txt, docs/man/{blzr.txt => nutdrv_qx.txt}, - docs/man/nutupsdrv.txt, docs/new-drivers.txt, ...lzr-subdrivers.txt - => nutdrv_qx-subdrivers.txt}, drivers/Makefile.am, drivers/{blzr.c - => nutdrv_qx.c}, drivers/{blzr.h => nutdrv_qx.h}, ...r_blazer- - common.c => nutdrv_qx_blazer-common.c}, ...r_blazer-common.h => - nutdrv_qx_blazer-common.h}, drivers/{blzr_mecer.c => - nutdrv_qx_mecer.c}, drivers/{blzr_mecer.h => nutdrv_qx_mecer.h}, - ...{blzr_megatec-old.c => nutdrv_qx_megatec-old.c}, - ...{blzr_megatec-old.h => nutdrv_qx_megatec-old.h}, - drivers/{blzr_megatec.c => nutdrv_qx_megatec.c}, - drivers/{blzr_megatec.h => nutdrv_qx_megatec.h}, - drivers/{blzr_mustek.c => nutdrv_qx_mustek.c}, - drivers/{blzr_mustek.h => nutdrv_qx_mustek.h}, - .../{blzr_voltronic.c => nutdrv_qx_voltronic.c}, - .../{blzr_voltronic.h => nutdrv_qx_voltronic.h}, - drivers/{blzr_zinto.c => nutdrv_qx_zinto.c}, drivers/{blzr_zinto.h - => nutdrv_qx_zinto.h}, tools/nut-usbinfo.pl: nutdrv_qx: rename - 'blzr' driver to 'nutdrv_qx' Reference: - http://lists.alioth.debian.org/pipermail/nut- + * data/driver.list.in, docs/Makefile.am, docs/blzr-subdrivers.txt, + docs/man/Makefile.am, docs/man/blzr.txt, docs/man/index.txt, + docs/man/nutdrv_qx.txt, docs/man/nutupsdrv.txt, docs/new- + drivers.txt, docs/nutdrv_qx-subdrivers.txt, drivers/Makefile.am, + drivers/blzr.c, drivers/blzr.h, drivers/blzr_blazer-common.c, + drivers/blzr_blazer-common.h, drivers/blzr_mecer.c, + drivers/blzr_mecer.h, drivers/blzr_megatec-old.c, drivers + /blzr_megatec-old.h, drivers/blzr_megatec.c, + drivers/blzr_megatec.h, drivers/blzr_mustek.c, + drivers/blzr_mustek.h, drivers/blzr_voltronic.c, + drivers/blzr_voltronic.h, drivers/blzr_zinto.c, + drivers/blzr_zinto.h, drivers/nutdrv_qx.c, drivers/nutdrv_qx.h, + drivers/nutdrv_qx_blazer-common.c, drivers/nutdrv_qx_blazer- + common.h, drivers/nutdrv_qx_mecer.c, drivers/nutdrv_qx_mecer.h, + drivers/nutdrv_qx_megatec-old.c, drivers/nutdrv_qx_megatec-old.h, + drivers/nutdrv_qx_megatec.c, drivers/nutdrv_qx_megatec.h, + drivers/nutdrv_qx_mustek.c, drivers/nutdrv_qx_mustek.h, + drivers/nutdrv_qx_voltronic.c, drivers/nutdrv_qx_voltronic.h, + drivers/nutdrv_qx_zinto.c, drivers/nutdrv_qx_zinto.h, tools/nut- + usbinfo.pl: nutdrv_qx: rename 'blzr' driver to 'nutdrv_qx' + Reference: http://lists.alioth.debian.org/pipermail/nut- upsdev/2013-November/006555.html * docs/stable-hcl.txt, docs/website/css/web-layout.css: Address Issue #48 (text-based browsers) Reference: https://github.com/networkups @@ -18749,11 +203,12 @@ 2013-10-16 Daniele Pezzini - * docs/man/Makefile.am, docs/man/{blazer.txt => blazer-common.txt}, - docs/man/blazer_ser.txt, docs/man/blazer_usb.txt, - docs/man/index.txt, docs/man/nutupsdrv.txt: blazer: Fix {usb,ser} - manual Split the old blazer manual in two manuals named after - their executables with a common source. + * docs/man/Makefile.am, docs/man/blazer-common.txt, + docs/man/blazer.txt, docs/man/blazer_ser.txt, + docs/man/blazer_usb.txt, docs/man/index.txt, + docs/man/nutupsdrv.txt: blazer: Fix {usb,ser} manual Split the old + blazer manual in two manuals named after their executables with a + common source. * docs/man/blazer.txt: blazer: Fix user manual Fix minor errors Add ranges Fix test.battery.start (i.e. minutes instead of seconds) * drivers/blazer.c: blazer: Fix shutdown sequence Split stop pending @@ -18828,8 +283,8 @@ docs/man/Makefile.am, docs/man/blzr.txt, docs/man/index.txt, docs/man/nutupsdrv.txt, docs/new-drivers.txt, drivers/Makefile.am, drivers/blzr.c, drivers/blzr.h, drivers/blzr_blazer-common.c, - drivers/blzr_blazer-common.h, drivers/blzr_megatec-old.c, - drivers/blzr_megatec-old.h, drivers/blzr_megatec.c, + drivers/blzr_blazer-common.h, drivers/blzr_megatec-old.c, drivers + /blzr_megatec-old.h, drivers/blzr_megatec.c, drivers/blzr_megatec.h, drivers/blzr_mustek.c, drivers/blzr_mustek.h, drivers/blzr_voltronic.c, drivers/blzr_voltronic.h, drivers/blzr_zinto.c, @@ -19124,10 +579,10 @@ Solaris * tools/nut-scanner/nutscan-device.c, tools/nut-scanner/nutscan- device.h, tools/nut-scanner/scan_avahi.c, tools/nut- - scanner/scan_eaton_serial.c, tools/nut-scanner/scan_ipmi.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: - [nut-scanner] Make sure to return the first device of the list. + scanner/scan_eaton_serial.c, tools/nut-scanner/scan_ipmi.c, tools + /nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- + scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: [nut- + scanner] Make sure to return the first device of the list. 2013-07-22 Charles Lepple @@ -19489,10 +944,10 @@ scripts/java/jNutWebAPI/README, scripts/java/jNutWebAPI/pom.xml, .../jnutwebapi/NutRestProvider.java, .../jnutwebapi/RestWSApplication.java, - .../jnutwebapi/ScannerProvider.java, - .../jNutWebAPI/src/main/webapp/WEB-INF/web.xml: Remove java related - files (jNut) which will be moved to a separated repository. See - issues: - https://github.com/networkupstools/nut/issues/2 - + .../jnutwebapi/ScannerProvider.java, .../jNutWebAPI/src/main/webapp + /WEB-INF/web.xml: Remove java related files (jNut) which will be + moved to a separated repository. See issues: - + https://github.com/networkupstools/nut/issues/2 - https://github.com/networkupstools/nut/issues/22 2013-03-26 Alex Lov @@ -19704,17 +1159,17 @@ docs/man/nutscan_scan_eaton_serial.txt, docs/man/nutscan_scan_ipmi.txt, docs/man/nutscan_scan_nut.txt, docs/man/nutscan_scan_snmp.txt, docs/man/nutscan_scan_usb.txt, - docs/man/nutscan_scan_xml_http.txt, include/nut_platform.h, - tools/nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, - tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan- - device.h, tools/nut-scanner/nutscan-display.c, tools/nut- - scanner/nutscan-serial.c, tools/nut-scanner/nutscan-serial.h, - tools/nut-scanner/scan_eaton_serial.c, tools/nut- - scanner/scan_nut.c: Add nut-scanner support for Eaton serial units - nut-scanner and libnutscan now provides respectively an option and - functions to detect Eaton serial devices. The following protocols - are supported: SHUT, XCP and Q1 (patch from Frederic Bohe, with - parts from Arnaud Quette, both for Eaton) + docs/man/nutscan_scan_xml_http.txt, include/nut_platform.h, tools + /nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, tools/nut- + scanner/nut-scanner.c, tools/nut-scanner/nutscan-device.h, tools + /nut-scanner/nutscan-display.c, tools/nut-scanner/nutscan-serial.c, + tools/nut-scanner/nutscan-serial.h, tools/nut- + scanner/scan_eaton_serial.c, tools/nut-scanner/scan_nut.c: Add nut- + scanner support for Eaton serial units nut-scanner and libnutscan + now provides respectively an option and functions to detect Eaton + serial devices. The following protocols are supported: SHUT, XCP + and Q1 (patch from Frederic Bohe, with parts from Arnaud Quette, + both for Eaton) * configure.in: Fix for pthread on HP-UX pthread is compiled on a stub when -lpthread is not explicitly added. This commit is a duplicate of [[SVN:3801]], from Frederic Bohe (for Eaton) @@ -19885,11 +1340,11 @@ * conf/.gitignore: Subversion ignored files completion Mark upsmon.conf.sample as Subversion ignored, since it is now generated from a .in template file (no functional changes) - * conf/Makefile.am, conf/{upsmon.conf.sample => - upsmon.conf.sample.in}, configure.in: Adapt upsmon.conf sample to - use configured values The sample upsmon.conf provided now adapts - RUN_AS_USER value, and NOTIFYCMD / POWERDOWNFLAG base path to the - user configured values + * conf/Makefile.am, conf/upsmon.conf.sample, + conf/upsmon.conf.sample.in, configure.in: Adapt upsmon.conf sample + to use configured values The sample upsmon.conf provided now + adapts RUN_AS_USER value, and NOTIFYCMD / POWERDOWNFLAG base path + to the user configured values 2012-11-28 Arnaud Quette @@ -19899,11 +1354,11 @@ device.mfr was also changed in both drivers, and revisions were bumped to 0.02 (patch from Elio Parisi, Riello) * data/driver.list.in, drivers/Makefile.am, drivers/openups-hid.c, - drivers/openups-hid.h, drivers/usbhid-ups.c, - scripts/upower/95-upower-hid.rules: Official support for Minibox - openUPS Intelligent UPS Add a new usbhid-ups subdriver to handle - Minibox openUPS Intelligent UPS (USB ID 0x04d8:0xd004) (patch from - Nicu Pavel, Mini-Box.Com) + drivers/openups-hid.h, drivers/usbhid-ups.c, scripts/upower/95 + -upower-hid.rules: Official support for Minibox openUPS Intelligent + UPS Add a new usbhid-ups subdriver to handle Minibox openUPS + Intelligent UPS (USB ID 0x04d8:0xd004) (patch from Nicu Pavel, + Mini-Box.Com) 2012-11-28 Charles Lepple @@ -19935,12 +1390,12 @@ * data/driver.list.in, docs/man/.gitignore, docs/man/Makefile.am, docs/man/riello_ser.txt, docs/man/riello_usb.txt, drivers/.gitignore, drivers/Makefile.am, drivers/riello.c, - drivers/riello.h, drivers/riello_ser.c, drivers/riello_usb.c, - tools/nut-usbinfo.pl: Official support for Riello serial and USB - devices Add two new drivers, riello_ser and riello_usb, to support - the whole ranges of Riello devices: IDG, IPG, WPG, NPW, NDG, DVT, - DVR, DVD, VST, VSD, SEP, SDH, SDL, SPW, SPT, MCT, MST, MCM, MCT, - MHT, MPT and MPM. This completes the official Riello protocols + drivers/riello.h, drivers/riello_ser.c, drivers/riello_usb.c, tools + /nut-usbinfo.pl: Official support for Riello serial and USB devices + Add two new drivers, riello_ser and riello_usb, to support the + whole ranges of Riello devices: IDG, IPG, WPG, NPW, NDG, DVT, DVR, + DVD, VST, VSD, SEP, SDH, SDL, SPW, SPT, MCT, MST, MCM, MCT, MHT, + MPT and MPM. This completes the official Riello protocols publication, that happened in May 2012 (developed by Elio Parisi, from Riello) @@ -20044,8 +1499,8 @@ * drivers/cps-hid.c, drivers/idowell-hid.c, scripts/subdriver/gen- usbhid-subdriver.sh: Replace missing occurrences in previous commit * docs/hid-subdrivers.txt, drivers/libhid.c, scripts/Makefile.am, - scripts/subdriver/{path-to-subdriver.sh => gen-usbhid- - subdriver.sh}: Rename usbhid subdriver generation script This + scripts/subdriver/gen-usbhid-subdriver.sh, scripts/subdriver/path- + to-subdriver.sh: Rename usbhid subdriver generation script This script was previously named path-to-subdriver.sh, which was not enough meaningful. The renaming to gen-usbhid-subdriver.sh also makes sense with a potential gen-snmp-subdriver.sh @@ -20086,14 +1541,14 @@ 2012-10-10 Arnaud Quette * README: Spell check fix (test) - * .gitignore, configure.in, docs/.gitignore, docs/Makefile.am, - docs/nut-qa.txt, docs/nut.dict: Spell checking framework - implementation Implement a framework to spell check documentation - source files, using Aspell. This includes an interactive build - target (make spellcheck-interactive), and an automated one (make - spellcheck), mainly for QA / Buildbot purpose. Note that a base NUT - dictionnary is also available (docs/nut.dict), providing a glossary - of terms related to power devices and management + * .gitignore, configure.in, docs/.gitignore, docs/Makefile.am, docs + /nut-qa.txt, docs/nut.dict: Spell checking framework implementation + Implement a framework to spell check documentation source files, + using Aspell. This includes an interactive build target (make + spellcheck-interactive), and an automated one (make spellcheck), + mainly for QA / Buildbot purpose. Note that a base NUT dictionnary + is also available (docs/nut.dict), providing a glossary of terms + related to power devices and management * drivers/tripplite_usb.c: Remove POD ("Plain Old Documentation") With the approval of the author (Charles Lepple), remove POD ("Plain Old Documentation"). This embedded documentation was @@ -20109,8 +1564,8 @@ 2012-10-04 Arnaud Quette - * docs/man/nut-scanner.txt, drivers/nut-ipmipsu.c, tools/nut- - scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, tools/nut- + * docs/man/nut-scanner.txt, drivers/nut-ipmipsu.c, tools/nut-scanner + /nut-scan.h, tools/nut-scanner/nut-scanner.c, tools/nut- scanner/scan_ipmi.c: Support power supplies scan over the network nut-scanner can now scan for power supplies with IPMI over LAN. This is currently limited to IPMI 1.5 only @@ -20194,14 +1649,13 @@ docs/man/macosx-ups.txt, docs/man/mge-shut.txt, docs/man/nutscan.txt, docs/man/nutscan_scan_avahi.txt, docs/man/powercom.txt, docs/man/skel.txt, docs/nut-names.txt, - docs/website/.gitignore, docs/website/Makefile.am, - docs/website/css/web-layout.css, docs/website/news.txt, - docs/website/old-news.txt, docs/website/projects.txt, - docs/website/web-layout.conf, drivers/.gitignore, - drivers/Makefile.am, drivers/macosx-ups.c, drivers/mge-hid.c, - drivers/powercom-hid.c, drivers/skel.c, drivers/usbhid-ups.c, - drivers/usbhid-ups.h, m4/nut_check_libltdl.m4: Merge from trunk - [[SVN:3679]] to [[SVN:3718]] to ssl-nss-port + docs/website/.gitignore, docs/website/Makefile.am, docs/website/css + /web-layout.css, docs/website/news.txt, docs/website/old-news.txt, + docs/website/projects.txt, docs/website/web-layout.conf, + drivers/.gitignore, drivers/Makefile.am, drivers/macosx-ups.c, + drivers/mge-hid.c, drivers/powercom-hid.c, drivers/skel.c, drivers + /usbhid-ups.c, drivers/usbhid-ups.h, m4/nut_check_libltdl.m4: Merge + from trunk [[SVN:3679]] to [[SVN:3718]] to ssl-nss-port 2012-08-09 Arnaud Quette @@ -20339,10 +1793,10 @@ 2012-07-19 Emilien Kia - * server/Makefile.am, server/conf.c, server/netcmds.h, server/{ssl.c - => netssl.c}, server/{ssl.h => netssl.h}, server/upsd.c: Replace - server/ssl.[h|c] by server/netssl.[h|c] in order to prepare nss - branch merging. + * server/Makefile.am, server/conf.c, server/netcmds.h, + server/netssl.c, server/netssl.h, server/ssl.c, server/ssl.h, + server/upsd.c: Replace server/ssl.[h|c] by server/netssl.[h|c] in + order to prepare nss branch merging. 2012-07-18 Emilien Kia @@ -20360,14 +1814,14 @@ docs/documentation.txt, docs/download.txt, docs/features.txt, docs/images/advanced.png, docs/images/bigbox.png, docs/images/bizarre.png, docs/images/nut-logo.png, - docs/images/nut.svg, docs/images/simple.png, docs/macros.txt, - docs/maintainer-guide.txt, docs/man/.gitignore, - docs/man/Makefile.am, docs/man/apcsmart-old.txt, - docs/man/apcsmart.txt, docs/man/bcmxcp.txt, docs/man/belkinunv.txt, - docs/man/blazer.txt, docs/man/dummy-ups.txt, docs/man/index.txt, - docs/man/metasys.txt, docs/man/nut-ipmipsu.txt, docs/man/nut- - recorder.txt, docs/man/nut-scanner.txt, docs/man/nut.conf.txt, - docs/man/nutscan.txt, docs/man/nutscan_add_device_to_device.txt, + docs/images/nut.svg, docs/images/simple.png, docs/macros.txt, docs + /maintainer-guide.txt, docs/man/.gitignore, docs/man/Makefile.am, + docs/man/apcsmart-old.txt, docs/man/apcsmart.txt, + docs/man/bcmxcp.txt, docs/man/belkinunv.txt, docs/man/blazer.txt, + docs/man/dummy-ups.txt, docs/man/index.txt, docs/man/metasys.txt, + docs/man/nut-ipmipsu.txt, docs/man/nut-recorder.txt, docs/man/nut- + scanner.txt, docs/man/nut.conf.txt, docs/man/nutscan.txt, + docs/man/nutscan_add_device_to_device.txt, docs/man/nutscan_add_option_to_device.txt, docs/man/nutscan_cidr_to_ip.txt, docs/man/nutscan_display_parsable.txt, @@ -20387,8 +1841,8 @@ layout.css, docs/website/faviconut.ico, docs/website/faviconut.png, docs/website/news.txt, docs/website/projects.txt, docs/website/ups- protocols.txt, docs/website/web-layout.conf, drivers/.gitignore, - drivers/Makefile.am, drivers/apc-hid.c, drivers/apc-mib.c, - drivers/apcsmart-old.c, drivers/apcsmart-old.h, drivers/apcsmart.c, + drivers/Makefile.am, drivers/apc-hid.c, drivers/apc-mib.c, drivers + /apcsmart-old.c, drivers/apcsmart-old.h, drivers/apcsmart.c, drivers/apcsmart.h, drivers/apcsmart_tabs.c, drivers/apcsmart_tabs.h, drivers/bcmxcp.c, drivers/bcmxcp.h, drivers/bcmxcp_ser.c, drivers/bcmxcp_usb.c, drivers/belkin-hid.c, @@ -20401,28 +1855,27 @@ drivers/etapro.c, drivers/gamatronic.c, drivers/genericups.c, drivers/ietf-mib.c, drivers/isbmex.c, drivers/libhid.c, drivers/libshut.c, drivers/liebert-esp2.c, drivers/liebert-hid.c, - drivers/main.c, drivers/masterguard.c, drivers/metasys.c, - drivers/mge-hid.c, drivers/mge-mib.c, drivers/mge-shut.c, - drivers/mge-utalk.c, drivers/microdowell.c, drivers/netvision- - mib.c, drivers/netxml-ups.c, drivers/nut-ipmi.h, drivers/nut- - ipmipsu.c, drivers/nut-libfreeipmi.c, drivers/oneac.c, - drivers/oneac.h, drivers/powercom-hid.c, drivers/powercom.c, - drivers/powercom.h, drivers/powerware-mib.c, drivers/raritan-pdu- - mib.c, drivers/rhino.c, drivers/safenet.c, drivers/snmp-ups.c, - drivers/snmp-ups.h, drivers/solis.c, drivers/tripplite-hid.c, - drivers/tripplite_usb.c, drivers/tripplitesu.c, drivers/upscode2.c, - drivers/upshandler.h, drivers/usb-common.c, drivers/usbhid-ups.c, - include/.gitignore, include/Makefile.am, include/common.h, - include/extstate.h, include/nut_stdint.h, include/parseconf.h, - include/state.h, lib/.gitignore, lib/Makefile.am, lib/README, - lib/libnutscan.pc.in, lib/libupsclient-config.in, - lib/libupsclient.pc.in, m4/ax_create_stdint_h.m4, - m4/nut_check_libavahi.m4, m4/nut_check_libfreeipmi.m4, - m4/nut_check_libltdl.m4, m4/nut_check_libwrap.m4, - m4/nut_check_os.m4, m4/nut_report_feature.m4, scripts/HP- - UX/.gitignore, scripts/HP-UX/makedepot.sh, scripts/HP- - UX/nut.psf.in, scripts/Makefile.am, scripts/README, - scripts/augeas/Makefile.am, scripts/augeas/README, + drivers/main.c, drivers/masterguard.c, drivers/metasys.c, drivers + /mge-hid.c, drivers/mge-mib.c, drivers/mge-shut.c, drivers/mge- + utalk.c, drivers/microdowell.c, drivers/netvision-mib.c, drivers + /netxml-ups.c, drivers/nut-ipmi.h, drivers/nut-ipmipsu.c, drivers + /nut-libfreeipmi.c, drivers/oneac.c, drivers/oneac.h, drivers + /powercom-hid.c, drivers/powercom.c, drivers/powercom.h, drivers + /powerware-mib.c, drivers/raritan-pdu-mib.c, drivers/rhino.c, + drivers/safenet.c, drivers/snmp-ups.c, drivers/snmp-ups.h, + drivers/solis.c, drivers/tripplite-hid.c, drivers/tripplite_usb.c, + drivers/tripplitesu.c, drivers/upscode2.c, drivers/upshandler.h, + drivers/usb-common.c, drivers/usbhid-ups.c, include/.gitignore, + include/Makefile.am, include/common.h, include/extstate.h, + include/nut_stdint.h, include/parseconf.h, include/state.h, + lib/.gitignore, lib/Makefile.am, lib/README, lib/libnutscan.pc.in, + lib/libupsclient-config.in, lib/libupsclient.pc.in, + m4/ax_create_stdint_h.m4, m4/nut_check_libavahi.m4, + m4/nut_check_libfreeipmi.m4, m4/nut_check_libltdl.m4, + m4/nut_check_libwrap.m4, m4/nut_check_os.m4, + m4/nut_report_feature.m4, scripts/HP-UX/.gitignore, scripts/HP- + UX/makedepot.sh, scripts/HP-UX/nut.psf.in, scripts/Makefile.am, + scripts/README, scripts/augeas/Makefile.am, scripts/augeas/README, scripts/avahi/nut.service.in, scripts/java/Makefile.am, scripts/java/README, scripts/java/jNut/README, scripts/java/jNut/pom.xml, @@ -20440,41 +1893,40 @@ scripts/java/jNutWebAPI/README, scripts/java/jNutWebAPI/pom.xml, .../jnutwebapi/NutRestProvider.java, .../jnutwebapi/RestWSApplication.java, - .../jnutwebapi/ScannerProvider.java, - .../jNutWebAPI/src/main/webapp/WEB-INF/web.xml, - scripts/logrotate/nutlogd, scripts/python/module/PyNUT.py, - scripts/systemd/Makefile.am, scripts/systemd/README, - scripts/systemd/nut-driver.service.in, scripts/systemd/nut- - monitor.service.in, scripts/systemd/nut-server.service.in, - scripts/systemd/nutshutdown.in, scripts/udev/.gitignore, - scripts/udev/Makefile.am, scripts/udev/README, scripts/udev/nut- - ipmipsu.rules.in, scripts/ufw/README, - scripts/ufw/nut.ufw.profile.in, scripts/upower/95-upower-hid.rules, - server/Makefile.am, server/netcmds.h, server/netget.c, - server/netget.h, server/netinstcmd.c, server/netinstcmd.h, - server/netlist.c, server/netlist.h, server/netmisc.c, - server/netmisc.h, server/netset.c, server/netset.h, - server/netssl.c, server/netssl.h, server/netuser.c, - server/netuser.h, server/{ctype.h => nut_ctype.h}, server/sstate.c, - server/sstate.h, server/upsd.c, server/upsd.h, server/user.c, - tests/Makefile.am, tests/cpputest.cpp, tests/example.cpp, - tools/Makefile.am, tools/git-svn.authors, tools/nut-hclinfo.py, - tools/{device-recorder.sh => nut-recorder.sh}, tools/nut- - scanner/Makefile.am, tools/nut-scanner/README, tools/nut- + .../jnutwebapi/ScannerProvider.java, .../jNutWebAPI/src/main/webapp + /WEB-INF/web.xml, scripts/logrotate/nutlogd, + scripts/python/module/PyNUT.py, scripts/systemd/Makefile.am, + scripts/systemd/README, scripts/systemd/nut-driver.service.in, + scripts/systemd/nut-monitor.service.in, scripts/systemd/nut- + server.service.in, scripts/systemd/nutshutdown.in, + scripts/udev/.gitignore, scripts/udev/Makefile.am, + scripts/udev/README, scripts/udev/nut-ipmipsu.rules.in, + scripts/ufw/README, scripts/ufw/nut.ufw.profile.in, + scripts/upower/95-upower-hid.rules, server/Makefile.am, + server/ctype.h, server/netcmds.h, server/netget.c, server/netget.h, + server/netinstcmd.c, server/netinstcmd.h, server/netlist.c, + server/netlist.h, server/netmisc.c, server/netmisc.h, + server/netset.c, server/netset.h, server/netssl.c, server/netssl.h, + server/netuser.c, server/netuser.h, server/nut_ctype.h, + server/sstate.c, server/sstate.h, server/upsd.c, server/upsd.h, + server/user.c, tests/Makefile.am, tests/cpputest.cpp, + tests/example.cpp, tools/Makefile.am, tools/device-recorder.sh, + tools/git-svn.authors, tools/nut-hclinfo.py, tools/nut-recorder.sh, + tools/nut-scanner/Makefile.am, tools/nut-scanner/README, tools/nut- scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/nutscan-device.c, tools/nut-scanner/nutscan-device.h, - tools/nut-scanner/nutscan-display.c, tools/nut-scanner/nutscan- - init.c, tools/nut-scanner/nutscan-init.h, tools/nut- - scanner/nutscan-ip.c, tools/nut-scanner/nutscan-ip.h, tools/nut- - scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, tools/nut- - scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- - scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c, tools/nut- - snmpinfo.py, tools/nut-usbinfo.pl, tools/svn2cl.authors: Merge from - trunk [[SVN:2848]] to [[SVN:3679]] to ssl-nss-port. Note: a - problem is occurring for server/ssl.[h|c]: they have been moved to - server/netssl.[h|c] but consider them as removed. For the branch - merging to trunk, consider paying attention to the case of these - files (removing them by hand). + scanner/nutscan-device.c, tools/nut-scanner/nutscan-device.h, tools + /nut-scanner/nutscan-display.c, tools/nut-scanner/nutscan-init.c, + tools/nut-scanner/nutscan-init.h, tools/nut-scanner/nutscan-ip.c, + tools/nut-scanner/nutscan-ip.h, tools/nut-scanner/scan_avahi.c, + tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_nut.c, tools + /nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, tools/nut- + scanner/scan_xml_http.c, tools/nut-snmpinfo.py, tools/nut- + usbinfo.pl, tools/svn2cl.authors: Merge from trunk [[SVN:2848]] to + [[SVN:3679]] to ssl-nss-port. Note: a problem is occurring for + server/ssl.[h|c]: they have been moved to server/netssl.[h|c] but + consider them as removed. For the branch merging to trunk, + consider paying attention to the case of these files (removing them + by hand). 2012-07-17 Arnaud Quette @@ -20498,8 +1950,8 @@ 2012-07-16 Arnaud Quette * drivers/nut-ipmipsu.c, drivers/nut-libfreeipmi.c, - m4/nut_check_libfreeipmi.m4, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/scan_ipmi.c: Support for FreeIPMI 1.1.x and 1.2.x + m4/nut_check_libfreeipmi.m4, tools/nut-scanner/nut-scanner.c, tools + /nut-scanner/scan_ipmi.c: Support for FreeIPMI 1.1.x and 1.2.x Prepare for supporting API changes in FreeIPMI 1.1.x and 1.2.x. This is mostly related to SDR API simplifications. A 2nd iteration will probably address code redundancy, whenever possible @@ -20678,11 +2130,11 @@ 2012-05-29 Prachi Gandhi - * Makefile.am, configure.in, tools/nut-scanner/Makefile.am, - tools/nut-scanner/nut-scan.h, tools/nut-scanner/nutscan-init.c, - tools/nut-scanner/nutscan-init.h, tools/nut-scanner/scan_snmp.c: - Changes in nut-scanner to remove Sparc 'usmAESPrivProtocol' error - while creating package + * Makefile.am, configure.in, tools/nut-scanner/Makefile.am, tools + /nut-scanner/nut-scan.h, tools/nut-scanner/nutscan-init.c, tools + /nut-scanner/nutscan-init.h, tools/nut-scanner/scan_snmp.c: Changes + in nut-scanner to remove Sparc 'usmAESPrivProtocol' error while + creating package 2012-05-29 Arnaud Quette @@ -20993,16 +2445,16 @@ * tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-init.c, tools/nut-scanner/nutscan-init.h, tools/nut-scanner/scan_avahi.c, - tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, - tools/nut-scanner/scan_xml_http.c: Cleaner exit for nut-scanner + tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_nut.c, tools + /nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, tools/nut- + scanner/scan_xml_http.c: Cleaner exit for nut-scanner 2012-04-23 Frederic Bohe * tools/nut-scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: Be - more verbose when failing to dynamically load a library + tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools + /nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: Be more + verbose when failing to dynamically load a library 2012-04-14 Arnaud Quette @@ -21016,8 +2468,8 @@ in Kelvin Check if raw value is in the Kelvin range, to detect buggy values that are already expressed in Celsius degrees, as found on some HP devices - * docs/developer-guide.txt, tools/Makefile.am, tools/{device- - recorder.sh => nut-recorder.sh}: Rename device-recorder to nut- + * docs/developer-guide.txt, tools/Makefile.am, tools/device- + recorder.sh, tools/nut-recorder.sh: Rename device-recorder to nut- recorder * data/driver.list.in: HCL: Reorder Dell devices by connection type @@ -21523,18 +2975,18 @@ docs/man/nutscan_scan_usb.txt, docs/man/nutscan_scan_xml_http.txt: Update documentation * tools/nut-scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: - Make sure not to call any non-initialized function pointers. - * tools/nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, - tools/nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-init.c, - tools/nut-scanner/nutscan-init.h, tools/nut-scanner/scan_avahi.c, - tools/nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: - Keep the same API whatever the library are at compile time... - ...(so some scan functions may be stub only) Add an init function + - variable to know the available scan method at run time. Update - nut-scanner accordingly. + tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools + /nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: Make + sure not to call any non-initialized function pointers. + * tools/nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, tools + /nut-scanner/nut-scanner.c, tools/nut-scanner/nutscan-init.c, tools + /nut-scanner/nutscan-init.h, tools/nut-scanner/scan_avahi.c, tools + /nut-scanner/scan_ipmi.c, tools/nut-scanner/scan_snmp.c, tools/nut- + scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: Keep the + same API whatever the library are at compile time... ...(so some + scan functions may be stub only) Add an init function + variable to + know the available scan method at run time. Update nut-scanner + accordingly. 2011-12-09 Arnaud Quette @@ -21602,11 +3054,11 @@ libltdl/m4/argz.m4, libltdl/m4/autobuild.m4, libltdl/m4/libtool.m4, libltdl/m4/ltdl.m4, libltdl/m4/ltoptions.m4, libltdl/m4/ltsugar.m4, libltdl/m4/ltversion.in, libltdl/m4/ltversion.m4, - libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libltdl/stamp-mk, - tools/nut-scanner/Makefile.am, tools/nut-scanner/scan_avahi.c, - tools/nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, - tools/nut-scanner/scan_xml_http.c: First set of modification to - include libltdl + libltdl/m4/lt~obsolete.m4, libltdl/slist.c, libltdl/stamp-mk, tools + /nut-scanner/Makefile.am, tools/nut-scanner/scan_avahi.c, tools + /nut-scanner/scan_snmp.c, tools/nut-scanner/scan_usb.c, tools/nut- + scanner/scan_xml_http.c: First set of modification to include + libltdl 2011-12-05 Arnaud Quette @@ -21719,9 +3171,8 @@ scripts/java/jNutWebAPI/pom.xml, .../jnutwebapi/NutRestProvider.java, .../jnutwebapi/RestWSApplication.java, - .../jnutwebapi/ScannerProvider.java, - .../jNutWebAPI/src/main/webapp/WEB-INF/web.xml: Initial commit of - jNutWebAPI. + .../jnutwebapi/ScannerProvider.java, .../jNutWebAPI/src/main/webapp + /WEB-INF/web.xml: Initial commit of jNutWebAPI. * scripts/java/jNut/.gitignore, scripts/java/jNut/src/main/java/org/n etworkupstools/jnut/Scanner.java: Fix a little bug with function namming (get instead of set). @@ -21817,15 +3268,15 @@ * docs/configure.txt: Add missing --with-avahi documentation * docs/Makefile.am, docs/developer-guide.txt, tools/nut- - scanner/.gitignore, tools/nut-scanner/README, tools/nut- - scanner/nut-scan.h: Add a 'NUT device discovery' chapter to the - developer guide, ... ...to document libnutscan + scanner/.gitignore, tools/nut-scanner/README, tools/nut-scanner + /nut-scan.h: Add a 'NUT device discovery' chapter to the developer + guide, ... ...to document libnutscan * configure.in: Enable Avahi automatic support, upon detection * docs/man/.gitignore, docs/man/Makefile.am, docs/man/index.txt, docs/man/nutscan.txt: Add an overview manpage for libnutscan - * configure.in, docs/Makefile.am, docs/{download.txt.in => - download.txt}: Revert [[SVN:3272]], which breaks distribution - check, ... ...while waiting for a suitable solution + * configure.in, docs/Makefile.am, docs/download.txt, + docs/download.txt.in: Revert [[SVN:3272]], which breaks + distribution check, ... ...while waiting for a suitable solution 2011-10-13 Charles Lepple @@ -21842,8 +3293,8 @@ 2011-10-11 Arnaud Quette - * configure.in, docs/Makefile.am, docs/{download.txt => - download.txt.in}: Automate generation of the stable release + * configure.in, docs/Makefile.am, docs/download.txt, + docs/download.txt.in: Automate generation of the stable release information, in the Download section 2011-10-10 Arnaud Quette @@ -21938,12 +3389,12 @@ 2011-09-20 Arnaud Quette - * server/Makefile.am, server/netcmds.h, server/netget.c, - server/netget.h, server/netinstcmd.c, server/netinstcmd.h, - server/netlist.c, server/netlist.h, server/netmisc.c, - server/netmisc.h, server/netset.c, server/netset.h, - server/netuser.c, server/netuser.h, server/{ctype.h => - nut_ctype.h}, server/ssl.c, server/ssl.h, server/upsd.c, + * server/Makefile.am, server/ctype.h, server/netcmds.h, + server/netget.c, server/netget.h, server/netinstcmd.c, + server/netinstcmd.h, server/netlist.c, server/netlist.h, + server/netmisc.c, server/netmisc.h, server/netset.c, + server/netset.h, server/netuser.c, server/netuser.h, + server/nut_ctype.h, server/ssl.c, server/ssl.h, server/upsd.c, server/upsd.h: Rename upsd internal client structure and header from ctype_t to nut_ctype_t. This avoids namespace conflict on AIX, and is more suitable in general @@ -22065,8 +3516,8 @@ * docs/FAQ.txt, docs/config-notes.txt, docs/download.txt, docs/man/Makefile.am, docs/man/apcsmart-old.txt, docs/man/apcsmart.txt, docs/stable-hcl.txt, docs/website/web- - layout.conf, drivers/Makefile.am, drivers/apcsmart-old.c, - drivers/apcsmart-old.h, drivers/apcsmart.c, drivers/apcsmart.h, + layout.conf, drivers/Makefile.am, drivers/apcsmart-old.c, drivers + /apcsmart-old.h, drivers/apcsmart.c, drivers/apcsmart.h, drivers/apcsmart_tabs.c, drivers/apcsmart_tabs.h, drivers/eaton- mib.c, drivers/eaton-mib.h, drivers/snmp-ups.c: Merge with trunk from [[SVN:3196]] @@ -22147,8 +3598,8 @@ docs/website/news.txt, docs/website/projects.txt, drivers/apc- mib.c, drivers/bestpower-mib.c, drivers/eaton-mib.c, drivers/ietf- mib.c, drivers/mge-hid.c, drivers/mge-mib.c, drivers/netvision- - mib.c, drivers/powerware-mib.c, drivers/raritan-pdu-mib.c, - drivers/snmp-ups.c, drivers/snmp-ups.h, scripts/Makefile.am, + mib.c, drivers/powerware-mib.c, drivers/raritan-pdu-mib.c, drivers + /snmp-ups.c, drivers/snmp-ups.h, scripts/Makefile.am, scripts/README, scripts/java/Makefile.am, scripts/java/README, scripts/java/jNut/README, scripts/java/jNut/pom.xml, .../main/java/org/networkupstools/jnut/Client.java, @@ -22258,8 +3709,8 @@ drivers/microdowell.c, drivers/nut-ipmi.h, drivers/nut-ipmipsu.c, drivers/nut-libfreeipmi.c, drivers/powercom.c, drivers/powercom.h, drivers/rhino.c, drivers/snmp-ups.c, drivers/solis.c, drivers/usb- - common.c, drivers/usb-common.h, include/Makefile.am, - lib/libupsclient-config.in, lib/libupsclient.pc.in, + common.c, drivers/usb-common.h, include/Makefile.am, lib + /libupsclient-config.in, lib/libupsclient.pc.in, m4/ax_create_stdint_h.m4, m4/nut_check_libfreeipmi.m4, m4/nut_report_feature.m4, scripts/Makefile.am, scripts/augeas/README, scripts/avahi/nut.service.in, @@ -22286,9 +3737,9 @@ * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, tools/nut-scanner/scan_snmp.c: More API cleaning - * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nutscan-ip.c, - tools/nut-scanner/nutscan-ip.h, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c: Consolidating API + * tools/nut-scanner/nut-scan.h, tools/nut-scanner/nutscan-ip.c, tools + /nut-scanner/nutscan-ip.h, tools/nut-scanner/scan_nut.c, tools/nut- + scanner/scan_snmp.c: Consolidating API * configure.in, m4/nut_check_libavahi.m4, tools/nut- scanner/Makefile.am, tools/nut-scanner/nut-scan.h, tools/nut- scanner/nut-scanner.c, tools/nut-scanner/scan_avahi.c: Add avahi @@ -22343,16 +3794,17 @@ 2011-08-16 Frederic Bohe - * tools/nut-scanner/.gitignore, tools/nut-scanner/Makefile.am, + * tools/nut-scanner/.gitignore, tools/nut-scanner/Makefile.am, tools + /nut-scanner/device.c, tools/nut-scanner/device.h, tools/nut- + scanner/display.c, tools/nut-scanner/ip.c, tools/nut-scanner/ip.h, tools/nut-scanner/nut-scan.h, tools/nut-scanner/nut-scanner.c, - tools/nut-scanner/{device.c => nutscan-device.c}, tools/nut- - scanner/{device.h => nutscan-device.h}, tools/nut- - scanner/{display.c => nutscan-display.c}, tools/nut-scanner/{ip.c - => nutscan-ip.c}, tools/nut-scanner/{ip.h => nutscan-ip.h}, - tools/nut-scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, - tools/nut-scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, - tools/nut-scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: - More consistent API naming + tools/nut-scanner/nutscan-device.c, tools/nut-scanner/nutscan- + device.h, tools/nut-scanner/nutscan-display.c, tools/nut-scanner + /nutscan-ip.c, tools/nut-scanner/nutscan-ip.h, tools/nut- + scanner/scan_avahi.c, tools/nut-scanner/scan_ipmi.c, tools/nut- + scanner/scan_nut.c, tools/nut-scanner/scan_snmp.c, tools/nut- + scanner/scan_usb.c, tools/nut-scanner/scan_xml_http.c: More + consistent API naming 2011-08-05 Charles Lepple @@ -22443,9 +3895,8 @@ 2011-07-08 Frederic Bohe - * tools/nut-scanner/ip.c, tools/nut-scanner/ip.h, tools/nut- - scanner/nut-scanner.c: Add an helper function to decode CIDR - notation. + * tools/nut-scanner/ip.c, tools/nut-scanner/ip.h, tools/nut-scanner + /nut-scanner.c: Add an helper function to decode CIDR notation. 2011-07-08 Charles Lepple @@ -22592,9 +4043,9 @@ 2011-06-27 Frederic Bohe - * tools/nut-scanner/device.h, tools/nut-scanner/nut-scan.h, - tools/nut-scanner/nut-scanner.c, tools/nut-scanner/scan_nut.c, - tools/nut-scanner/scan_snmp.c: Add NUT server scan. + * tools/nut-scanner/device.h, tools/nut-scanner/nut-scan.h, tools + /nut-scanner/nut-scanner.c, tools/nut-scanner/scan_nut.c, tools + /nut-scanner/scan_snmp.c: Add NUT server scan. 2011-06-22 Frederic Bohe @@ -22607,8 +4058,8 @@ * tools/nut-scanner/scan_xml_http.c: Use NUT const * tools/nut-scanner/ip.c, tools/nut-scanner/ip.h: Forgot to commit the new files for iterator - * tools/nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, - tools/nut-scanner/scan_snmp.c: Factorize IP iterator + * tools/nut-scanner/Makefile.am, tools/nut-scanner/nut-scan.h, tools + /nut-scanner/scan_snmp.c: Factorize IP iterator * tools/nut-scanner/Makefile.am: Remove unneeded reference to *.h files * tools/Makefile.am, tools/nut-scanner/nutscan-snmp.h, tools/nut- @@ -22680,10 +4131,10 @@ scanner/display.c, tools/nut-scanner/scan_usb.c, tools/nut- scanner/scan_xml_http.c: More flexible way to manage optional parameter of each devices... ...via a simple linked list - * tools/nut-scanner/display.h, tools/nut-scanner/{scan_usb.h => nut- - scan.h}, tools/nut-scanner/nut-scanner.c, tools/nut- - scanner/scan_avahi.h, tools/nut-scanner/scan_ipmi.h, tools/nut- - scanner/scan_nut.h, tools/nut-scanner/scan_snmp.h, tools/nut- + * tools/nut-scanner/display.h, tools/nut-scanner/nut-scan.h, tools + /nut-scanner/nut-scanner.c, tools/nut-scanner/scan_avahi.h, tools + /nut-scanner/scan_ipmi.h, tools/nut-scanner/scan_nut.h, tools/nut- + scanner/scan_snmp.h, tools/nut-scanner/scan_usb.h, tools/nut- scanner/scan_xml_http.h: Keep only one file for nut-scan library interface * tools/nut-scanner/display.h: typo @@ -22695,8 +4146,8 @@ 2011-06-03 Arnaud Quette - * tools/nut-scanner/Makefile.am, tools/nut-scanner/device.c, - tools/nut-scanner/device.h, tools/nut-scanner/display.c, tools/nut- + * tools/nut-scanner/Makefile.am, tools/nut-scanner/device.c, tools + /nut-scanner/device.h, tools/nut-scanner/display.c, tools/nut- scanner/display.h, tools/nut-scanner/nut-scanner.c, tools/nut- scanner/scan_avahi.c, tools/nut-scanner/scan_avahi.h, tools/nut- scanner/scan_ipmi.c, tools/nut-scanner/scan_ipmi.h, tools/nut- @@ -23101,13 +4552,13 @@ * COPYING, INSTALL, Makefile.am, NEWS, README, UPGRADING, autogen.sh, clients/Makefile.am, configure.in, data/.gitignore, data/Makefile.am, data/driver.list.in, data/epdu-managed.dev, - data/{evolution500.dev => evolution500.seq}, docs/.gitignore, - docs/Makefile.am, docs/config-notes.txt, docs/configure.txt, - docs/developer-guide.txt, docs/docinfo.xml, docs/documentation.txt, + data/evolution500.dev, data/evolution500.seq, docs/.gitignore, + docs/Makefile.am, docs/config-notes.txt, docs/configure.txt, docs + /developer-guide.txt, docs/docinfo.xml, docs/documentation.txt, docs/download.txt, docs/history.txt, docs/images/old-cgi.png, - docs/man/.gitignore, docs/nut-names.txt, docs/{website => }/stable- - hcl.txt, docs/support.txt, docs/user-manual.txt, - docs/website/Makefile.am, docs/website/news.txt, + docs/man/.gitignore, docs/nut-names.txt, docs/stable-hcl.txt, + docs/support.txt, docs/user-manual.txt, docs/website/Makefile.am, + docs/website/news.txt, docs/website/stable-hcl.txt, docs/website/website.txt, drivers/.gitignore, drivers/Makefile.am, drivers/idowell-hid.c, drivers/idowell-hid.h, drivers/usbhid-ups.c, m4/nut_check_libhal.m4, m4/nut_check_libneon.m4, @@ -23227,55 +4678,49 @@ 2010-12-21 Emilien Kia - * INSTALL, Makefile.am, README, docs/ideas.txt => TODO, UPGRADING, - clients/upsclient.c, clients/upsclient.h, clients/upscmd.c, - clients/upsrw.c, conf/upsd.conf.sample, conf/upsd.users.sample, - configure.in, data/Makefile.am, data/driver.list, - data/driver.list.in, docs/.gitignore, docs/FAQ, docs/FAQ.txt, - docs/Makefile.am, docs/README, docs/acknowledgements.txt, - docs/acpi.txt, docs/asciidoc.txt, docs/big-servers.txt, - docs/cables.txt, docs/chroot.txt, docs/commands.txt, docs/config- - files.txt, docs/config-notes.txt, docs/configure.txt, docs/contact- - closure.txt, docs/data-room.txt, docs/design.txt, docs/developer- - guide.txt, docs/developers.txt, docs/documentation.txt, - docs/download.txt, docs/features.txt, docs/hid-subdrivers.txt, - docs/history.txt, docs/images/advanced.png, - docs/images/asciidoc.png, docs/images/bigbox.png, - docs/images/bizarre.png, docs/images/blue-arrow.png, - docs/images/cables/73-0724.png, docs/images/cables/940-0024C.jpg, + * INSTALL, Makefile.am, README, TODO, UPGRADING, clients/upsclient.c, + clients/upsclient.h, clients/upscmd.c, clients/upsrw.c, + conf/upsd.conf.sample, conf/upsd.users.sample, configure.in, + data/Makefile.am, data/driver.list, data/driver.list.in, + docs/.gitignore, docs/FAQ, docs/FAQ.txt, docs/Makefile.am, + docs/README, docs/acknowledgements.txt, docs/acpi.txt, + docs/asciidoc.txt, docs/big-servers.txt, docs/cables.txt, + docs/chroot.txt, docs/commands.txt, docs/config-files.txt, docs + /config-notes.txt, docs/configure.txt, docs/contact-closure.txt, + docs/data-room.txt, docs/design.txt, docs/developer-guide.txt, + docs/developers.txt, docs/documentation.txt, docs/download.txt, + docs/features.txt, docs/hid-subdrivers.txt, docs/history.txt, + docs/ideas.txt, docs/images/advanced.png, docs/images/asciidoc.png, + docs/images/bigbox.png, docs/images/bizarre.png, docs/images/blue- + arrow.png, docs/images/cables/73-0724.png, + docs/images/cables/940-0024C.jpg, docs/images/cables/Lansafecable.jpg, docs/images/cables/SOLA-330.png, docs/images/cables/belkin-f6cx- rkm-xu-cable.jpg, docs/images/cables/mac-940-0024C.png, docs/images/cables/mge-66049.png, docs/images/cables/mge- - db9-rj12.jpg, docs/images/cables/mge-db9-rj45.jpg, - docs/images/eaton-logo.png, docs/images/note.png, docs/images/nut- - banner.png, docs/images/nut_layering.png, - docs/images/nut_layering.svg, docs/images/simple.png, - docs/images/warning.png, docs/macros.txt, docs/man/Makefile.am, - man/apcsmart.8 => docs/man/apcsmart.txt, docs/man/asciidoc.conf, - docs/man/bcmxcp.txt, man/bcmxcp_usb.8 => docs/man/bcmxcp_usb.txt, - man/belkin.8 => docs/man/belkin.txt, docs/man/belkinunv.txt, - man/bestfcom.8 => docs/man/bestfcom.txt, docs/man/bestfortress.txt, - docs/man/bestuferrups.txt, man/bestups.8 => docs/man/bestups.txt, - man/blazer.8 => docs/man/blazer.txt, man/clone.8 => - docs/man/clone.txt, man/dummy-ups.8 => docs/man/dummy-ups.txt, - docs/man/etapro.txt, docs/man/everups.txt, man/gamatronic.8 => - docs/man/gamatronic.txt, man/genericups.8 => - docs/man/genericups.txt, man/hosts.conf.5 => + db9-rj12.jpg, docs/images/cables/mge-db9-rj45.jpg, docs/images + /eaton-logo.png, docs/images/note.png, docs/images/nut-banner.png, + docs/images/nut_layering.png, docs/images/nut_layering.svg, + docs/images/simple.png, docs/images/warning.png, docs/macros.txt, + docs/man/Makefile.am, docs/man/apcsmart.txt, + docs/man/asciidoc.conf, docs/man/bcmxcp.txt, + docs/man/bcmxcp_usb.txt, docs/man/belkin.txt, + docs/man/belkinunv.txt, docs/man/bestfcom.txt, + docs/man/bestfortress.txt, docs/man/bestuferrups.txt, + docs/man/bestups.txt, docs/man/blazer.txt, docs/man/clone.txt, + docs/man/dummy-ups.txt, docs/man/etapro.txt, docs/man/everups.txt, + docs/man/gamatronic.txt, docs/man/genericups.txt, docs/man/hosts.conf.txt, docs/man/index.txt, docs/man/isbmex.txt, - docs/man/ivtscd.txt, docs/man/libupsclient-config.txt, - docs/man/liebert-esp2.txt, docs/man/liebert.txt, - docs/man/masterguard.txt, man/megatec.8 => docs/man/megatec.txt, - docs/man/megatec_usb.txt, man/metasys.8 => docs/man/metasys.txt, - docs/man/mge-shut.txt, docs/man/mge-utalk.txt, - docs/man/microdowell.txt, docs/man/netxml-ups.txt, man/nut.conf.5 - => docs/man/nut.conf.txt, docs/man/nutupsdrv.txt, man/oneac.8 => - docs/man/oneac.txt, docs/man/optiups.txt, docs/man/powercom.txt, - docs/man/powerman-pdu.txt, man/powerpanel.8 => - docs/man/powerpanel.txt, docs/man/rhino.txt, + docs/man/ivtscd.txt, docs/man/libupsclient-config.txt, docs/man + /liebert-esp2.txt, docs/man/liebert.txt, docs/man/masterguard.txt, + docs/man/megatec.txt, docs/man/megatec_usb.txt, + docs/man/metasys.txt, docs/man/mge-shut.txt, docs/man/mge- + utalk.txt, docs/man/microdowell.txt, docs/man/netxml-ups.txt, + docs/man/nut.conf.txt, docs/man/nutupsdrv.txt, docs/man/oneac.txt, + docs/man/optiups.txt, docs/man/powercom.txt, docs/man/powerman- + pdu.txt, docs/man/powerpanel.txt, docs/man/rhino.txt, docs/man/richcomm_usb.txt, docs/man/safenet.txt, docs/man/skel.txt, - man/snmp-ups.8 => docs/man/snmp-ups.txt, docs/man/solis.txt, - man/tripplite.8 => docs/man/tripplite.txt, + docs/man/snmp-ups.txt, docs/man/solis.txt, docs/man/tripplite.txt, docs/man/tripplite_usb.txt, docs/man/tripplitesu.txt, docs/man/ups.conf.txt, docs/man/upsc.txt, docs/man/upscli_connect.txt, docs/man/upscli_disconnect.txt, @@ -23284,61 +4729,67 @@ docs/man/upscli_readline.txt, docs/man/upscli_sendline.txt, docs/man/upscli_splitaddr.txt, docs/man/upscli_splitname.txt, docs/man/upscli_ssl.txt, docs/man/upscli_strerror.txt, - docs/man/upscli_upserror.txt, docs/man/upsclient.txt, man/upscmd.8 - => docs/man/upscmd.txt, docs/man/upscode2.txt, man/upsd.conf.5 => - docs/man/upsd.conf.txt, docs/man/upsd.txt, man/upsd.users.5 => - docs/man/upsd.users.txt, man/upsdrvctl.8 => docs/man/upsdrvctl.txt, - docs/man/upsimage.cgi.txt, docs/man/upslog.txt, man/upsmon.conf.5 - => docs/man/upsmon.conf.txt, man/upsmon.8 => docs/man/upsmon.txt, - man/upsrw.8 => docs/man/upsrw.txt, docs/man/upssched.conf.txt, - man/upssched.8 => docs/man/upssched.txt, man/upsset.cgi.8 => - docs/man/upsset.cgi.txt, man/upsset.conf.5 => - docs/man/upsset.conf.txt, man/upsstats.cgi.8 => - docs/man/upsstats.cgi.txt, docs/man/upsstats.html.txt, man/usbhid- - ups.8 => docs/man/usbhid-ups.txt, docs/man/victronups.txt, - docs/megatec.txt, docs/net-protocol.txt, docs/new-clients.txt, - docs/new-drivers.txt, docs/new-names.txt, docs/nut-names.txt, - docs/nut-qa.txt, docs/osd-notify.txt, docs/outlets.txt, - docs/packager-guide.txt, docs/pager.txt, docs/powersaving.txt, - docs/protocol.txt, docs/{upssched.txt => scheduling.txt}, - docs/security.txt, docs/shutdown.txt, docs/sock-protocol.txt, - docs/ssl.txt, docs/support.txt, docs/suspend-to-disk.txt, - docs/user-manual.txt, docs/website/Makefile.am, - docs/website/css/ie-overrides.css, docs/website/css/web-layout.css, + docs/man/upscli_upserror.txt, docs/man/upsclient.txt, + docs/man/upscmd.txt, docs/man/upscode2.txt, docs/man/upsd.conf.txt, + docs/man/upsd.txt, docs/man/upsd.users.txt, docs/man/upsdrvctl.txt, + docs/man/upsimage.cgi.txt, docs/man/upslog.txt, + docs/man/upsmon.conf.txt, docs/man/upsmon.txt, docs/man/upsrw.txt, + docs/man/upssched.conf.txt, docs/man/upssched.txt, + docs/man/upsset.cgi.txt, docs/man/upsset.conf.txt, + docs/man/upsstats.cgi.txt, docs/man/upsstats.html.txt, docs/man + /usbhid-ups.txt, docs/man/victronups.txt, docs/megatec.txt, docs + /net-protocol.txt, docs/new-clients.txt, docs/new-drivers.txt, docs + /new-names.txt, docs/nut-names.txt, docs/nut-qa.txt, docs/osd- + notify.txt, docs/outlets.txt, docs/packager-guide.txt, + docs/pager.txt, docs/powersaving.txt, docs/protocol.txt, + docs/scheduling.txt, docs/security.txt, docs/shutdown.txt, docs + /sock-protocol.txt, docs/ssl.txt, docs/support.txt, docs/suspend- + to-disk.txt, docs/upssched.txt, docs/user-manual.txt, + docs/website/Makefile.am, docs/website/css/ie-overrides.css, + docs/website/css/web-layout.css, docs/website/css/xhtml11-quirks.css, docs/website/css/xhtml11.css, docs/website/faviconut.ico, docs/website/faviconut.png, docs/website/news.txt, docs/website/projects.txt, docs/website/scripts/filter_png.js, docs/website/scripts/jquery.js, docs/website/scripts/nut_jquery.js, docs/website/scripts/toc.js, docs/website/stable-hcl.txt, docs/website/ups-protocols.txt, - docs/website/web-layout.conf, docs/website/website.txt, - drivers/apc-hid.c, drivers/belkin.c, drivers/belkin.h, - drivers/ietf-mib.c, drivers/libhid.c, drivers/mge-utalk.c, - drivers/powerp-bin.c, drivers/powerware-mib.c, drivers/skel.c, - drivers/snmp-ups.c, drivers/snmp-ups.h, m4/ax_compare_version.m4, + docs/website/web-layout.conf, docs/website/website.txt, drivers + /apc-hid.c, drivers/belkin.c, drivers/belkin.h, drivers/ietf-mib.c, + drivers/libhid.c, drivers/mge-utalk.c, drivers/powerp-bin.c, + drivers/powerware-mib.c, drivers/skel.c, drivers/snmp-ups.c, + drivers/snmp-ups.h, m4/ax_compare_version.m4, m4/nut_check_asciidoc.m4, m4/nut_check_libnss.m4, m4/nut_check_libopenssl.m4, m4/nut_check_libssl.m4, - m4/nut_report_feature.m4, man/Makefile.am, man/bcmxcp.8, - man/belkinunv.8, man/bestfortress.8, man/bestuferrups.8, - man/etapro.8, man/everups.8, man/isbmex.8, man/ivtscd.8, - man/libupsclient-config.1, man/liebert-esp2.8, man/liebert.8, - man/masterguard.8, man/megatec_usb.8, man/mge-shut.8, man/mge- - utalk.8, man/microdowell.8, man/netxml-ups.8, man/nutupsdrv.8, - man/optiups.8, man/powercom.8, man/powerman-pdu.8, man/rhino.8, - man/richcomm_usb.8, man/safenet.8, man/skel.8, man/solis.8, - man/tripplite_usb.8, man/tripplitesu.8, man/ups.conf.5, man/upsc.8, + m4/nut_report_feature.m4, man/Makefile.am, man/apcsmart.8, + man/bcmxcp.8, man/bcmxcp_usb.8, man/belkin.8, man/belkinunv.8, + man/bestfcom.8, man/bestfortress.8, man/bestuferrups.8, + man/bestups.8, man/blazer.8, man/clone.8, man/dummy-ups.8, + man/etapro.8, man/everups.8, man/gamatronic.8, man/genericups.8, + man/hosts.conf.5, man/isbmex.8, man/ivtscd.8, man/libupsclient- + config.1, man/liebert-esp2.8, man/liebert.8, man/masterguard.8, + man/megatec.8, man/megatec_usb.8, man/metasys.8, man/mge-shut.8, + man/mge-utalk.8, man/microdowell.8, man/netxml-ups.8, + man/nut.conf.5, man/nutupsdrv.8, man/oneac.8, man/optiups.8, + man/powercom.8, man/powerman-pdu.8, man/powerpanel.8, man/rhino.8, + man/richcomm_usb.8, man/safenet.8, man/skel.8, man/snmp-ups.8, + man/solis.8, man/tripplite.8, man/tripplite_usb.8, + man/tripplitesu.8, man/ups.conf.5, man/upsc.8, man/upscli_connect.3, man/upscli_disconnect.3, man/upscli_fd.3, man/upscli_get.3, man/upscli_list_next.3, man/upscli_list_start.3, man/upscli_readline.3, man/upscli_sendline.3, man/upscli_splitaddr.3, man/upscli_splitname.3, man/upscli_ssl.3, man/upscli_strerror.3, man/upscli_upserror.3, man/upsclient.3, - man/upscode2.8, man/upsd.8, man/upsimage.cgi.8, man/upslog.8, - man/upssched.conf.5, man/upsstats.html.5, man/victronups.8, - scripts/upower/95-upower-hid.rules, server/Makefile.am, - server/conf.c, server/ctype.h, server/netcmds.h, server/{netssl.c - => ssl.c}, server/{netssl.h => ssl.h}, server/upsd.c, - tools/Makefile.am, tools/nut-hclinfo.py, tools/nut-usbinfo.pl, - tools/svn2cl.authors: Merge from trunk ([[SVN:2761]]) + man/upscmd.8, man/upscode2.8, man/upsd.8, man/upsd.conf.5, + man/upsd.users.5, man/upsdrvctl.8, man/upsimage.cgi.8, + man/upslog.8, man/upsmon.8, man/upsmon.conf.5, man/upsrw.8, + man/upssched.8, man/upssched.conf.5, man/upsset.cgi.8, + man/upsset.conf.5, man/upsstats.cgi.8, man/upsstats.html.5, man + /usbhid-ups.8, man/victronups.8, scripts/upower/95-upower- + hid.rules, server/Makefile.am, server/conf.c, server/ctype.h, + server/netcmds.h, server/netssl.c, server/netssl.h, server/ssl.c, + server/ssl.h, server/upsd.c, tools/Makefile.am, tools/nut- + hclinfo.py, tools/nut-usbinfo.pl, tools/svn2cl.authors: Merge from + trunk ([[SVN:2761]]) 2010-11-30 Arnaud Quette @@ -23348,9 +4799,9 @@ 2010-11-29 Arjen de Korte - * server/Makefile.am, server/conf.c, server/netcmds.h, server/{ssl.c - => netssl.c}, server/{ssl.h => netssl.h}, server/upsd.c: Resolve - namespace conflict with nss_compat_ossl + * server/Makefile.am, server/conf.c, server/netcmds.h, + server/netssl.c, server/netssl.h, server/ssl.c, server/ssl.h, + server/upsd.c: Resolve namespace conflict with nss_compat_ossl 2010-11-28 Arjen de Korte diff --git a/INSTALL b/INSTALL index 8865734..7762f5b 100644 --- a/INSTALL +++ b/INSTALL @@ -1,368 +1,320 @@ -Installation Instructions -************************* - - Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software -Foundation, Inc. - - Copying and distribution of this file, with or without modification, -are permitted in any medium without royalty provided the copyright -notice and this notice are preserved. This file is offered as-is, -without warranty of any kind. - -Basic Installation -================== - - Briefly, the shell command './configure && make && make install' -should configure, build, and install this package. The following -more-detailed instructions are generic; see the 'README' file for -instructions specific to this package. Some packages provide this -'INSTALL' file but do not implement all of the features documented -below. The lack of an optional feature in a given package is not -necessarily a bug. More recommendations for GNU packages can be found -in *note Makefile Conventions: (standards)Makefile Conventions. - - The 'configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a 'Makefile' in each directory of the package. -It may also create one or more '.h' files containing system-dependent -definitions. Finally, it creates a shell script 'config.status' that -you can run in the future to recreate the current configuration, and a -file 'config.log' containing compiler output (useful mainly for -debugging 'configure'). - - It can also use an optional file (typically called 'config.cache' and -enabled with '--cache-file=config.cache' or simply '-C') that saves the -results of its tests to speed up reconfiguring. Caching is disabled by -default to prevent problems with accidental use of stale cache files. - - If you need to do unusual things to compile the package, please try -to figure out how 'configure' could check whether to do them, and mail -diffs or instructions to the address given in the 'README' so they can -be considered for the next release. If you are using the cache, and at -some point 'config.cache' contains results you don't want to keep, you -may remove or edit it. - - The file 'configure.ac' (or 'configure.in') is used to create -'configure' by a program called 'autoconf'. You need 'configure.ac' if -you want to change it or regenerate 'configure' using a newer version of -'autoconf'. - - The simplest way to compile this package is: - - 1. 'cd' to the directory containing the package's source code and type - './configure' to configure the package for your system. - - Running 'configure' might take a while. While running, it prints - some messages telling which features it is checking for. - - 2. Type 'make' to compile the package. - - 3. Optionally, type 'make check' to run any self-tests that come with - the package, generally using the just-built uninstalled binaries. - - 4. Type 'make install' to install the programs and any data files and - documentation. When installing into a prefix owned by root, it is - recommended that the package be configured and built as a regular - user, and only the 'make install' phase executed with root - privileges. - - 5. Optionally, type 'make installcheck' to repeat any self-tests, but - this time using the binaries in their final installed location. - This target does not install anything. Running this target as a - regular user, particularly if the prior 'make install' required - root privileges, verifies that the installation completed - correctly. - - 6. You can remove the program binaries and object files from the - source code directory by typing 'make clean'. To also remove the - files that 'configure' created (so you can compile the package for - a different kind of computer), type 'make distclean'. There is - also a 'make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - - 7. Often, you can also type 'make uninstall' to remove the installed - files again. In practice, not all packages have tested that - uninstallation works correctly, even though it is required by the - GNU Coding Standards. - - 8. Some packages, particularly those that use Automake, provide 'make - distcheck', which can by used by developers to test that all other - targets like 'make install' and 'make uninstall' work correctly. - This target is generally not run by end users. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the 'configure' script does not know about. Run './configure --help' -for details on some of the pertinent environment variables. - - You can give 'configure' initial values for configuration parameters -by setting variables in the command line or in the environment. Here is -an example: - - ./configure CC=c99 CFLAGS=-g LIBS=-lposix - - *Note Defining Variables::, for more details. - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you can use GNU 'make'. 'cd' to the -directory where you want the object files and executables to go and run -the 'configure' script. 'configure' automatically checks for the source -code in the directory that 'configure' is in and in '..'. This is known -as a "VPATH" build. - - With a non-GNU 'make', it is safer to compile the package for one -architecture at a time in the source code directory. After you have -installed the package for one architecture, use 'make distclean' before -reconfiguring for another architecture. - - On MacOS X 10.5 and later systems, you can create libraries and -executables that work on multiple system types--known as "fat" or -"universal" binaries--by specifying multiple '-arch' options to the -compiler but only a single '-arch' option to the preprocessor. Like -this: - - ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ - CPP="gcc -E" CXXCPP="g++ -E" - - This is not guaranteed to produce working output in all cases, you -may have to build one architecture at a time and combine the results -using the 'lipo' tool if you have problems. - -Installation Names -================== - - By default, 'make install' installs the package's commands under -'/usr/local/bin', include files under '/usr/local/include', etc. You -can specify an installation prefix other than '/usr/local' by giving -'configure' the option '--prefix=PREFIX', where PREFIX must be an -absolute file name. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -pass the option '--exec-prefix=PREFIX' to 'configure', the package uses -PREFIX as the prefix for installing programs and libraries. -Documentation and other data files still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like '--bindir=DIR' to specify different values for particular -kinds of files. Run 'configure --help' for a list of the directories -you can set and what kinds of files go in them. In general, the default -for these options is expressed in terms of '${prefix}', so that -specifying just '--prefix' will affect all of the other directory -specifications that were not explicitly provided. - - The most portable way to affect installation locations is to pass the -correct locations to 'configure'; however, many packages provide one or -both of the following shortcuts of passing variable assignments to the -'make install' command line to change installation locations without -having to reconfigure or recompile. - - The first method involves providing an override variable for each -affected directory. For example, 'make install -prefix=/alternate/directory' will choose an alternate location for all -directory configuration variables that were expressed in terms of -'${prefix}'. Any directories that were specified during 'configure', -but not in terms of '${prefix}', must each be overridden at install time -for the entire installation to be relocated. The approach of makefile -variable overrides for each directory variable is required by the GNU -Coding Standards, and ideally causes no recompilation. However, some -platforms have known limitations with the semantics of shared libraries -that end up requiring recompilation when using this method, particularly -noticeable in packages that use GNU Libtool. - - The second method involves providing the 'DESTDIR' variable. For -example, 'make install DESTDIR=/alternate/directory' will prepend -'/alternate/directory' before all installation names. The approach of -'DESTDIR' overrides is not required by the GNU Coding Standards, and -does not work on platforms that have drive letters. On the other hand, -it does better at avoiding recompilation issues, and works well even -when some directory options were not specified in terms of '${prefix}' -at 'configure' time. - -Optional Features -================= - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving 'configure' the -option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. - - Some packages pay attention to '--enable-FEATURE' options to -'configure', where FEATURE indicates an optional part of the package. -They may also pay attention to '--with-PACKAGE' options, where PACKAGE -is something like 'gnu-as' or 'x' (for the X Window System). The -'README' should mention any '--enable-' and '--with-' options that the -package recognizes. - - For packages that use the X Window System, 'configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the 'configure' options '--x-includes=DIR' and -'--x-libraries=DIR' to specify their locations. - - Some packages offer the ability to configure how verbose the -execution of 'make' will be. For these packages, running './configure ---enable-silent-rules' sets the default to minimal output, which can be -overridden with 'make V=1'; while running './configure ---disable-silent-rules' sets the default to verbose, which can be -overridden with 'make V=0'. - -Particular systems -================== - - On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC -is not installed, it is recommended to use the following options in -order to use an ANSI C compiler: - - ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" - -and if that doesn't work, install pre-built binaries of GCC for HP-UX. - - HP-UX 'make' updates targets which have the same time stamps as their -prerequisites, which makes it generally unusable when shipped generated -files such as 'configure' are involved. Use GNU 'make' instead. - - On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot -parse its '' header file. The option '-nodtk' can be used as a -workaround. If GNU CC is not installed, it is therefore recommended to -try - - ./configure CC="cc" - -and if that doesn't work, try - - ./configure CC="cc -nodtk" - - On Solaris, don't put '/usr/ucb' early in your 'PATH'. This -directory contains several dysfunctional programs; working variants of -these programs are available in '/usr/bin'. So, if you need '/usr/ucb' -in your 'PATH', put it _after_ '/usr/bin'. - - On Haiku, software installed for all users goes in '/boot/common', -not '/usr/local'. It is recommended to use the following options: - - ./configure --prefix=/boot/common - -Specifying the System Type -========================== - - There may be some features 'configure' cannot figure out -automatically, but needs to determine by the type of machine the package -will run on. Usually, assuming the package is built to be run on the -_same_ architectures, 'configure' can figure that out, but if it prints -a message saying it cannot guess the machine type, give it the -'--build=TYPE' option. TYPE can either be a short name for the system -type, such as 'sun4', or a canonical name which has the form: - - CPU-COMPANY-SYSTEM - -where SYSTEM can have one of these forms: - - OS - KERNEL-OS - - See the file 'config.sub' for the possible values of each field. If -'config.sub' isn't included in this package, then this package doesn't -need to know the machine type. - - If you are _building_ compiler tools for cross-compiling, you should -use the option '--target=TYPE' to select the type of system they will -produce code for. - - If you want to _use_ a cross compiler, that generates code for a -platform different from the build platform, you should specify the -"host" platform (i.e., that on which the generated programs will -eventually be run) with '--host=TYPE'. - -Sharing Defaults -================ +Installation instructions +========================= - If you want to set default values for 'configure' scripts to share, -you can create a site shell script called 'config.site' that gives -default values for variables like 'CC', 'cache_file', and 'prefix'. -'configure' looks for 'PREFIX/share/config.site' if it exists, then -'PREFIX/etc/config.site' if it exists. Or, you can set the -'CONFIG_SITE' environment variable to the location of the site script. -A warning: not all 'configure' scripts look for a site script. +This chapter describe the various methods for installing Network UPS Tools. -Defining Variables -================== +Whenever it is possible, prefer <>. +Packagers have done an excellent and hard work at improving NUT integration into +their system. - Variables not defined in a site shell script can be set in the -environment passed to 'configure'. However, some packages may run -configure again during the build, and the customized values of these -variables may be lost. In order to avoid this problem, you should set -them in the 'configure' command line, using 'VAR=value'. For example: +[[Installing_source]] +Installing from source +---------------------- - ./configure CC=/usr/local2/bin/gcc +These are the essential steps for compiling and installing this software. -causes the specified 'gcc' to be used as the C compiler (unless it is -overridden in the site shell script). +The NUT linkdoc:packager-guide[Packager Guide], which presents the best +practices for installing and integrating NUT, is also a good reading. -Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an -Autoconf limitation. Until the limitation is lifted, you can use this -workaround: +[NOTE] +.Keep in mind that... +================================================================================ - CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash +- the paths shown below are the default values you get by just calling +configure by itself. If you have used --prefix or similar, things will be +different. Also, if you didn't install this program from source yourself, the +paths will probably have a number of differences. -'configure' Invocation -====================== +- by default, your system probably won't find the man pages, since they +install to /usr/local/ups/man. You can fix this by editing your MANPATH, or +just do this: - 'configure' recognizes the following options to control how it -operates. + man -M /usr/local/ups/man -'--help' -'-h' - Print a summary of all of the options to 'configure', and exit. +- if your favorite system offers up to date binary packages, you should always +prefer these over a source installation. Along with the known advantages of such +systems for installation, upgrade and removal, there are many integration issues +that have been addressed. -'--help=short' -'--help=recursive' - Print a summary of the options unique to this package's - 'configure', and exit. The 'short' variant lists options used only - in the top level, while the 'recursive' variant lists options also - present in any nested packages. +================================================================================ -'--version' -'-V' - Print the version of Autoconf used to generate the 'configure' - script, and exit. -'--cache-file=FILE' - Enable the cache: use and save the results of the tests in FILE, - traditionally 'config.cache'. FILE defaults to '/dev/null' to - disable caching. - -'--config-cache' -'-C' - Alias for '--cache-file=config.cache'. - -'--quiet' -'--silent' -'-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to '/dev/null' (any error - messages will still be shown). - -'--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - 'configure' can determine that directory automatically. - -'--prefix=DIR' - Use DIR as the installation prefix. *note Installation Names:: for - more details, including other options available for fine-tuning the - installation locations. - -'--no-create' -'-n' - Run the configure checks, but stop before creating any output - files. - -'configure' also accepts some other, not widely useful, options. Run -'configure --help' for more details. +Prepare your system +~~~~~~~~~~~~~~~~~~~~ + +System User creation +^^^^^^^^^^^^^^^^^^^^ + +Create at least one system user and a group for running this software. You +might call them "ups" and "nut". The exact names aren't important as +long as you are consistent. + +The process for doing this varies from one system to the next, and +explaining how to add users is beyond the scope of this document. + +For the purposes of this document, the user name and group name +will be 'ups' and 'nut' respectively. + +Be sure the new user is a member of the new group! If you forget to +do this, you will have problems later on when you try to start upsd. + + +Build and install +~~~~~~~~~~~~~~~~~ + +[[Configuration]] +Configuration +^^^^^^^^^^^^^ + +Configure the source tree for your system. Add the '--with-user' and +'--with-group' switch to set the user name and group that you created +above. + + ./configure --with-user=ups --with-group=nut + +If you need any other switches for configure, add them here. For example: + +* to build and install USB drivers, add '--with-usb' (note that you + need to install libusb development package or files). + +* to build and install SNMP drivers, add '--with-snmp' (note that + you need to install libsnmp development package or files). + +* to build and install CGI scripts, add '--with-cgi'. + +See <> from the User Manual, +docs/configure.txt or './configure --help' for all the available +options. + +If you alter paths with additional switches, be sure to use those +new paths while reading the rest of the steps. + +Reference: <> from the +User Manual. + + +Build the programs +^^^^^^^^^^^^^^^^^^ + + make + +This will build the NUT client and server programs and the +selected drivers. It will also build any other features that were +selected during <> step above. + + +Installation +^^^^^^^^^^^^ + +[NOTE] +===================================================================== + +you should now gain privileges for installing software if necessary: + + su + +===================================================================== + +Install the files to a system level directory: + + make install + +This will install the compiled programs and man pages, as well as +some data files required by NUT. Any optional features selected +during configuration will also be installed. + +This will also install sample versions of the NUT configuration +files. Sample files are installed with names like ups.conf.sample +so they will not overwrite any existing real config files you may +have created. + +If you are packaging this software, then you will probably want to +use the DESTDIR variable to redirect the build into another place, +i.e.: + + make DESTDIR=/tmp/package install + make DESTDIR=/tmp/package install-conf + +[[StatePath]] +State path creation +^^^^^^^^^^^^^^^^^^^ + +Create the state path directory for the driver(s) and server to use +for storing UPS status data and other auxiliary files, and make it +owned by the user you created. + + mkdir -p /var/state/ups + chmod 0770 /var/state/ups + chown root:nut /var/state/ups + +[[Ownership]] +Ownership and permissions +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Set ownership data and permissions on your serial or USB ports +that go to your UPS hardware. Be sure to limit access to just +the user you created earlier. + +These examples assume the second serial port (ttyS1) on a typical +Slackware system. On FreeBSD, that would be cuaa1. Serial ports +vary greatly, so yours may be called something else. + + chmod 0660 /dev/ttyS1 + chown root:nut /dev/ttyS1 + +//////////////////////////////////////////////////////////////////////////////// +FIXME: TBR +//////////////////////////////////////////////////////////////////////////////// + +The setup for USB ports is slightly more complicated. Device files +for USB devices, such as /proc/bus/usb/002/001, are usually +created "on the fly" when a device is plugged in, and disappear +when the device is disconnected. Moreover, the names of these +device files can change randomly. To set up the correct +permissions for the USB device, you may need to set up (operating +system dependent) hotplugging scripts. Sample scripts and +information are provided in the scripts/hotplug and +scripts/udev directories. For most users, the hotplugging scripts +will be installed automatically by "make install". + +(If you want to try if a driver works without setting up +hotplugging, you can add the "-u root" option to upsd, upsmon, and +drivers; this should allow you to follow the below +instructions. However, don't forget to set up the correct +permissions later!). + +NOTE: if you are using something like devfs or udev, make sure +these permissions stay set across a reboot. If they revert to the +old values, your drivers may fail to start. + + +You are now ready to configure NUT, and start testing and using it. + +You can jump directly to the <>. + + +[[Installing_packages]] +Installing from packages +------------------------ + +This chapter describes the specific installation steps when using +binary packages that exist on various major systems. + +[[Debian]] +Debian, Ubuntu and other derivatives +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +NOTE: NUT is packaged and well maintained in these systems. +The official Debian packager is part of the NUT Team. + +Using your prefered method (apt-get, aptitude, Synaptic, ...), install +the 'nut' package, and optionaly the following: + +- 'nut-cgi', if you need the CGI (HTML) option, +- 'nut-snmp', if you need the snmp-ups driver, +- 'nut-xml', for the netxml-ups driver, +- 'nut-powerman-pdu', to control the PowerMan daemon (PDU management) +- 'nut-dev', if you need the development files. + +//////////////////////////////////////////////////////////////////////////////// +- nut-client +- nut-hal-drivers +//////////////////////////////////////////////////////////////////////////////// + +Configuration files are located in /etc/nut. +linkman:nut.conf[5] must be edited to be able to invoke /etc/init.d/nut + +NOTE: Ubuntu users can access the APT URL installation by clicking on link:apt://nut[this link]. + + +[[Mandriva]] +Mandriva +~~~~~~~~ + +NOTE: NUT is packaged and well maintained in these systems. +The official Mandriva packager is part of the NUT Team. + +Using your prefered method (urpmi, RPMdrake, ...), install one of the two below +packages: + +- 'nut-server' if you have a 'standalone' or 'netserver' installation, +- 'nut' if you have a 'netclient' installation. + +Optionaly, you can also install the following: + +- 'nut-cgi', if you need the CGI (HTML) option, +- 'nut-devel', if you need the development files. + + +[[Suse]] +Suse / Opensuse +~~~~~~~~~~~~~~~ + +NOTE: NUT is packaged and well maintained in these systems. +The official Suse packager is part of the NUT Team. + +Install the 'nut-classic' package, and optionaly the following: + +- 'nut-drivers-net', if you need the snmp-ups or the netxml-ups drivers, +- 'nut-cgi', if you need the CGI (HTML) option, +- 'nut-devel', if you need the development files, + +NOTE: Suse and Opensuse users can use the +link:http://software.opensuse.org/search?baseproject=ALL&p=1&q=nut[one-click install method] +to install NUT. + + +[[RedHat]] +Red Hat, Fedora and CentOS +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +NOTE: NUT is packaged and well maintained in these systems. +The official Red Hat packager is part of the NUT Team. + +Using your prefered method (yum, Add/Remove Software, ...), install one of the +two below packages: + +- 'nut' if you have a 'standalone' or 'netserver' installation, +- 'nut-client' if you have a 'netclient' installation. + +Optionaly, you can also install the following: + +- 'nut-cgi', if you need the CGI (HTML) option, +- 'nut-xml', if you need the netxml-ups driver, +- 'nut-devel', if you need the development files. + + +[[FreeBSD]] +FreeBSD +~~~~~~~ + +You can either install NUT as a binary package or as a port. + +Binary package +^^^^^^^^^^^^^^ + +To install the main component, use the following command: + + # pkg_add -r nut + +Port +^^^^ + +The port is located under /usr/ports/sysutils/nut. +To install it, use the following command: + + # cd /usr/ports/sysutils/nut/ && make install clean + +You have to define WITH_NUT_CGI to build the optional CGI scripts. + +Optionaly, you can also install the following ports: + +- sysutils/nut-snmp, for the SNMP driver, +- sysutils/nut-usb, for the USB drivers, +- sysutils/nut-libupsclient, for the upsclient library. + + +You are now ready to configure NUT, and start testing and using it. + +You can jump directly to the +<>. diff --git a/INSTALL.nut b/INSTALL.nut deleted file mode 100644 index cd8ce6b..0000000 --- a/INSTALL.nut +++ /dev/null @@ -1,350 +0,0 @@ -Installation instructions -========================= - -This chapter describes the various methods for installing Network UPS Tools. - -Whenever it is possible, prefer <>. -Packagers have done an excellent and hard work at improving NUT integration into -their system. On the other hand, distributions and appliances tend to package -"official releases" of projects such as NUT, and so do not deliver latest and -greatest fixes, new drivers, bugs and other features. - -[[Installing_source]] -Installing from source ----------------------- - -These are the essential steps for compiling and installing this software. - -The NUT linkdoc:packager-guide[Packager Guide], which presents the best -practices for installing and integrating NUT, is also a good reading. - -The link:config-prereqs.txt[Prerequisites for building NUT on different OSes] -document suggests prerequisite packages with tools and dependencies -available and needed to build and test as much as possible of NUT on -numerous platforms, written from perspective of CI testing (if you -are interested in getting updated drivers for a particular device, -you might select a sub-set of those suggestions). - -[NOTE] -.Keep in mind that... -================================================================================ - -- the paths shown below are the default values you get by just calling -configure by itself. If you have used --prefix or similar, things will be -different. Also, if you didn't install this program from source yourself, the -paths will probably have a number of differences. - -- by default, your system probably won't find the man pages, since they -install to /usr/local/ups/man. You can fix this by editing your MANPATH, or -just do this: - - man -M /usr/local/ups/man - -- if your favorite system offers up to date binary packages, you should always -prefer these over a source installation. Along with the known advantages of such -systems for installation, upgrade and removal, there are many integration issues -that have been addressed. - -================================================================================ - - -Prepare your system -~~~~~~~~~~~~~~~~~~~~ - -System User creation -^^^^^^^^^^^^^^^^^^^^ - -Create at least one system user and a group for running this software. You -might call them "ups" and "nut". The exact names aren't important as -long as you are consistent. - -The process for doing this varies from one system to the next, and -explaining how to add users is beyond the scope of this document. - -For the purposes of this document, the user name and group name -will be 'ups' and 'nut' respectively. - -Be sure the new user is a member of the new group! If you forget to -do this, you will have problems later on when you try to start upsd. - - -Build and install -~~~~~~~~~~~~~~~~~ - -[[Configuration]] -Configuration -^^^^^^^^^^^^^ - -Configure the source tree for your system. Add the '--with-user' and -'--with-group' switch to set the user name and group that you created -above. - - ./configure --with-user=ups --with-group=nut - -If you need any other switches for configure, add them here. For example: - -* to build and install USB drivers, add '--with-usb' (note that you - need to install libusb development package or files). - -* to build and install SNMP drivers, add '--with-snmp' (note that - you need to install libsnmp development package or files). - -* to build and install CGI scripts, add '--with-cgi'. - -See <> from the User Manual, -docs/configure.txt or './configure --help' for all the available -options. - -If you alter paths with additional switches, be sure to use those -new paths while reading the rest of the steps. - -Reference: <> from the -User Manual. - - -Build the programs -^^^^^^^^^^^^^^^^^^ - - make - -This will build the NUT client and server programs and the -selected drivers. It will also build any other features that were -selected during <> step above. - - -Installation -^^^^^^^^^^^^ - -[NOTE] -===================================================================== - -you should now gain privileges for installing software if necessary: - - su - -===================================================================== - -Install the files to a system level directory: - - make install - -This will install the compiled programs and man pages, as well as -some data files required by NUT. Any optional features selected -during configuration will also be installed. - -This will also install sample versions of the NUT configuration -files. Sample files are installed with names like ups.conf.sample -so they will not overwrite any existing real config files you may -have created. - -If you are packaging this software, then you will probably want to -use the DESTDIR variable to redirect the build into another place, -i.e.: - - make DESTDIR=/tmp/package install - make DESTDIR=/tmp/package install-conf - -[[StatePath]] -State path creation -^^^^^^^^^^^^^^^^^^^ - -Create the state path directory for the driver(s) and server to use -for storing UPS status data and other auxiliary files, and make it -group-writable by the group of the system user you created. - - mkdir -p /var/state/ups - chmod 0770 /var/state/ups - chown root:nut /var/state/ups - -[[Ownership]] -Ownership and permissions -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Set ownership data and permissions on your serial or USB ports -that go to your UPS hardware. Be sure to limit access to just -the user you created earlier. - -These examples assume the second serial port (ttyS1) on a typical -Slackware system. On FreeBSD, that would be cuaa1. Serial ports -vary greatly, so yours may be called something else. - - chmod 0660 /dev/ttyS1 - chown root:nut /dev/ttyS1 - -//////////////////////////////////////////////////////////////////////////////// -FIXME: TBR -//////////////////////////////////////////////////////////////////////////////// - -The setup for USB ports is slightly more complicated. Device files -for USB devices, such as /proc/bus/usb/002/001, are usually -created "on the fly" when a device is plugged in, and disappear -when the device is disconnected. Moreover, the names of these -device files can change randomly. To set up the correct -permissions for the USB device, you may need to set up (operating -system dependent) hotplugging scripts. Sample scripts and -information are provided in the scripts/hotplug and -scripts/udev directories. For most users, the hotplugging scripts -will be installed automatically by "make install". - -(If you want to try if a driver works without setting up -hotplugging, you can add the "-u root" option to upsd, upsmon, and -drivers; this should allow you to follow the below -instructions. However, don't forget to set up the correct -permissions later!). - -NOTE: if you are using something like udev or devd, make sure -these permissions stay set across a reboot. If they revert to the -old values, your drivers may fail to start. - - -You are now ready to configure NUT, and start testing and using it. - -You can jump directly to the <>. - - -[[Installing_packages]] -Installing from packages ------------------------- - -This chapter describes the specific installation steps when using -binary packages that exist on various major systems. - -[[Debian]] -Debian, Ubuntu and other derivatives -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -NOTE: NUT is packaged and well maintained in these systems. -The official Debian packager is part of the NUT Team. - -Using your preferred method (apt-get, aptitude, Synaptic, ...), install -the 'nut' package, and optionally the following: - -- 'nut-cgi', if you need the CGI (HTML) option, -- 'nut-snmp', if you need the snmp-ups driver, -- 'nut-xml', for the netxml-ups driver, -- 'nut-powerman-pdu', to control the PowerMan daemon (PDU management) -- 'nut-dev', if you need the development files. - -//////////////////////////////////////////////////////////////////////////////// -- nut-client -//////////////////////////////////////////////////////////////////////////////// - -Configuration files are located in /etc/nut. -linkman:nut.conf[5] must be edited to be able to invoke /etc/init.d/nut - -NOTE: Ubuntu users can access the APT URL installation by clicking on link:apt://nut[this link]. - - -[[Mandriva]] -Mandriva -~~~~~~~~ - -NOTE: NUT is packaged and well maintained in these systems. -The official Mandriva packager is part of the NUT Team. - -Using your preferred method (urpmi, RPMdrake, ...), install one of the two below -packages: - -- 'nut-server' if you have a 'standalone' or 'netserver' installation, -- 'nut' if you have a 'netclient' installation. - -Optionally, you can also install the following: - -- 'nut-cgi', if you need the CGI (HTML) option, -- 'nut-devel', if you need the development files. - - -[[SUSE]] -SUSE / openSUSE -~~~~~~~~~~~~~~~ - -NOTE: NUT is packaged and well maintained in these systems. -The official SUSE packager is part of the NUT Team. - -Install the 'nut-classic' package, and optionally the following: - -- 'nut-drivers-net', if you need the snmp-ups or the netxml-ups drivers, -- 'nut-cgi', if you need the CGI (HTML) option, -- 'nut-devel', if you need the development files, - -NOTE: SUSE and openSUSE users can use the -link:http://software.opensuse.org/search?baseproject=ALL&p=1&q=nut[one-click install method] -to install NUT. - - -[[RedHat]] -Red Hat, Fedora and CentOS -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -NOTE: NUT is packaged and well maintained in these systems. -The official Red Hat packager is part of the NUT Team. - -Using your preferred method (yum, Add/Remove Software, ...), install one of the -two below packages: - -- 'nut' if you have a 'standalone' or 'netserver' installation, -- 'nut-client' if you have a 'netclient' installation. - -Optionally, you can also install the following: - -- 'nut-cgi', if you need the CGI (HTML) option, -- 'nut-xml', if you need the netxml-ups driver, -- 'nut-devel', if you need the development files. - - -[[FreeBSD]] -FreeBSD -~~~~~~~ - -You can either install NUT as a binary package or as a port. - -Binary package -^^^^^^^^^^^^^^ - -To install NUT as a package execute: - - # pkg install nut - -Port -^^^^ - -The port is located under +sysutils/nut+. -Use +make config+ to select configuration options, e.g. to build the optional CGI scripts. -To install it, use: - - # make install clean - -USB UPS on FreeBSD -^^^^^^^^^^^^^^^^^^ - -For USB UPS devices the NUT package/port installs devd rules in +/usr/local/etc/devd/nut-usb.conf+ to set USB device permissions. 'devd' needs to be restarted for these rules to apply: - - # service devd restart - -(Re-)connect the device after restarting 'devd' and check that the USB device has the proper -permissions. Check the last entries of the system message buffer. You should -find an entry like - - # dmesg | tail - [...] - ugen0.2: at usbus0 - -The device file must be owned by group +uucp+ and must be group -read-/writable. In the example from above this would be - - # ls -Ll /dev/ugen0.2 - crw-rw---- 1 root uucp 0xa5 Mar 12 10:33 /dev/ugen0.2 - -If the permissions are not correct, verify that your device is registered in -+/usr/local/etc/devd/nut-usb.conf+. The vendor and product id can be found -using: - - # usbconfig -u 0 -a 2 dump_device_desc - -where +-u+ specifies the USB bus number and +-a+ specifies the USB device index. - - -You are now ready to configure NUT, and start testing and using it. - -You can jump directly to the -<>. diff --git a/MAINTAINERS b/MAINTAINERS index b2fcaf8..b86fd4b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -38,7 +38,7 @@ S: Maintained: apcsmart, belkin, bestups, cyberpower, dummycons, P: Arnaud Quette M: aquette.dev@gmail.com M: ArnaudQuette@eaton.com -S: Maintained or Supported: dummy-ups, usbhid-ups, mge-shut +S: Maintained or Supported: dummy-ups, usbhid-ups, mge-shut, newmge-shut mge-utalk, snmp-ups, ... P: Fabio Di Niro diff --git a/Makefile.am b/Makefile.am index 2ea7d7f..316c0ca 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,44 +5,28 @@ ACLOCAL_AMFLAGS = -I m4 # subdirectories to build and distribute. The order matters, as # several subdirectories depend on stuff in "common" or tools being built first -SUBDIRS = include common clients conf data docs drivers tools \ +SUBDIRS = include common clients conf data tools docs drivers \ lib scripts server tests -# Automatically update the libtool script if it becomes out-of-date -# See https://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status libtool - # COPYING is included automatically. -EXTRA_DIST = INSTALL.nut LICENSE-GPL2 LICENSE-GPL3 MAINTAINERS UPGRADING +EXTRA_DIST = LICENSE-GPL2 LICENSE-GPL3 MAINTAINERS UPGRADING # ---------------------------------------------------------------------- # flags to pass to ./configure when calling "make distcheck" and "make # distcheck-light". Try to check as many features as possible! Also -# need to give augeas-lenses-dir, hotplug-dir and udev-dir, so that -# staged install does not fail. +# need to give hotplug-dir and udev-dir, so that staged install does +# not fail. DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto -DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --with-valgrind CXXFLAGS='$(CXXFLAGS) -g' CFLAGS='$(CFLAGS) -g' DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ - --with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \ - --with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \ - --with-systemdtmpfilesdir='$${prefix}/usr/lib/tmpfiles.d' \ - --with-augeas-lenses-dir='$${prefix}/usr/share/augeas/lenses' \ --with-hotplug-dir='$${prefix}/etc/hotplug' \ - --with-udev-dir='$${prefix}/etc/udev' \ - --with-devd-dir='$${prefix}/etc/devd' + --with-udev-dir='$${prefix}/etc/udev' distcheck-light: $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_FLAGS)" distcheck -# Make a distcheck (and check in particular) with enabled valgrind and debug info -memcheck distcheck-valgrind: - $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_VALGRIND_FLAGS)" distcheck - # workaround the dist generated files that are also part of the distribution # Note that distcleancheck is disabled for now, while waiting for a proper # solution, that do not break older unix systems @@ -51,184 +35,25 @@ memcheck distcheck-valgrind: distcleancheck: @: -# Quick alias for root dir recipe: -realclean: maintainer-clean - -# Files made by our targets: -CLEANFILES = *-spellchecked cppcheck*.xml -DISTCLEANFILES = ChangeLog - -# Most of the files generated by custom rules in the configure script -# or by autogen.sh are cleaned by the Makefile.am in their directories. -# Files below are re-created by running `configure` script and may be -# wiped by a `make distclean`: -DISTCLEANFILES += config.log configure~ -#???# configure.ac~ -DISTCLEANFILES += include/config.h.in~ - -# Files made by autotools and common rituals of the configure script, -# these are needed to run the configure script itself so are not wiped -# by a mere `make distclean`; most of these are copied by autotools -# from their installation, or made by `automake` etc. on the system -# which generates `configure`; rebuilding NUT after deleting these -# requires `autogen.sh` script to be re-run (and tools available): -MAINTAINERCLEANFILES = INSTALL -MAINTAINERCLEANFILES += aclocal.m4 config.guess config.sub -MAINTAINERCLEANFILES += configure -MAINTAINERCLEANFILES += depcomp install-sh ltmain.sh test-driver -MAINTAINERCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 -MAINTAINERCLEANFILES += Makefile.in .dirstamp include/config.h.in - -# Executed after default rules -maintainer-clean-local: - rm -f missing || true - -# Do not let $SUBDIRS/Makefile rules delete their local .deps because -# this breaks our ability to clean up (e.g. some common/.../*.Plo files -# are included by generated Makefiles from other subdirectories, so they -# should be available during their clean-up). Just in case, we make sure -# here that their sub-distcleans complete first. -distclean-local: - @for DIR in $(SUBDIRS) ; do \ - if test -f "$${DIR}/Makefile" ; then \ - echo " DISTCLEAN in $${DIR}" >&2 ; \ - ( cd "$${DIR}" && $(MAKE) -s distclean ) || exit ; \ - fi ; \ - done - rm -rf .inst tmp autom4te.cache - find "$(builddir)" -type d -name '.deps' | while read DIR ; do rm -rf "$${DIR}" ; done - -# Hook the documentation building and validating recipes -# Note: these are optionally available (as determined during configure runs) -spellcheck spellcheck-interactive: - @RES=0; \ - (cd $(builddir)/docs && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/docs/man && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/conf && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/data && $(MAKE) -s $@) || RES=$$? ; \ - exit $$RES - -# Note: the "all-docs" and "check-docs" targets may require tools not -# found by `configure` script (and so avoided by conventional recipes) -# such as PDF generators, so it should only be called at developer's -# discretion, choice and risk. The "check-man" targets covers source -# texts, man pages and HTML rendering of man pages, as enabled by tools. -doc spellcheck-sortdict \ -all-docs check-docs \ -man all-man man-man check-man man-html all-html: - cd $(builddir)/docs && $(MAKE) $@ - -check-NIT check-NIT-devel: - cd $(builddir)/tests/NIT && $(MAKE) $@ - -# This target adds syntax-checking for committed shell script files, -# to avoid surprises and delays in finding fatal typos after packaging -### -### Note: currently, shellcheck target calls check-scripts-syntax -### so when both are invoked at once, in the end the check is only -### executed once. Later it is anticipated that shellcheck would -### be implemented by requiring, configuring and calling the tool -### named "shellcheck" for even more code inspection and details. -### Still, there remains value in also checking the script syntax -### by the very version of the shell interpreter that would run -### these scripts in production usage of the resulting packages. -### -check-scripts-syntax: - @echo 'NOTE: modern bash complains about scripts using backticks (warning not error), which we ignore in NUT codebase for portability reasons: `...` obsolete, use $$(...)' - @RUNBASH=bash; if [ -x /bin/bash ]; then RUNBASH=/bin/bash ; else if [ -x /usr/bin/env ] ; then RUNBASH="/usr/bin/env bash"; fi; fi ; \ - for F in `git ls-files || find . -type f` ; do \ - case "`file "$$F"`" in \ - *"Bourne-Again shell script"*) ( set -x ; $$RUNBASH -n "$$F" ; ) ;; \ - *"POSIX shell script"*|*"shell script"*) ( set -x ; /bin/sh -n "$$F" ; ) ;; \ - esac || { RES=$$? ; echo "ERROR: Syntax check failed for script file: $$F" >&2 ; exit $$RES ; } ; \ - done - @echo 'SUCCESS: Shell scripts syntax is acceptable, no fatal issues were found' - -shellcheck-disclaimer: - @echo "===============================================================================" - @echo "NOTICE: 'make shellcheck' is currently an alias for 'make check-scripts-syntax'" - @echo "Later it may become a call to the real shellcheck tool (if available on the" - @echo "build system during the configure phase)" - @echo "===============================================================================" - -# Note: currently not part of shellcheck target, because the script below -# can test the logic with numerous SHELL_PROGS in a CI setting, and because -# check-scripts-syntax probably has checked the basic syntax above already. -shellcheck-nde: - cd $(srcdir)/tests && SERVICE_FRAMEWORK="selftest" ./nut-driver-enumerator-test.sh - -shellcheck: shellcheck-disclaimer check-scripts-syntax - -CPPCHECK = @CPPCHECK@ -if HAVE_CPPCHECK -cppcheck: cppcheck-cxx11.xml cppcheck-c99.xml - -# Let the analysis get regenerated due to any change in source; -# but note that with our different make implementations to support, -# we can not either $(shell find ...) nor blindly say e.g. *.cpp -# for each FS structure layer because e.g. there are no ./*.cpp -# in the root dir of the codebase (and so make complains there is -# `No rule to make target `*.cpp', needed by `cppcheck-cxx11.xml'`) -# -# Note that the actual `cppcheck` scan finds all files it likes -# (so if CPPCHECK_SRC_* misses something, it just won't trigger -# automagically a rebuild of the XML in developer working cycles). -CPPCHECK_SRC_H = $(top_srcdir)/*/*.h $(top_srcdir)/*/*/*.h -# CPPCHECK_SRC_H += $(top_srcdir)/*.h - -CPPCHECK_SRC_C = $(top_srcdir)/*/*.c $(top_srcdir)/*/*/*.c -# CPPCHECK_SRC_C += $(top_srcdir)/*.cpp - -CPPCHECK_SRC_CXX = $(top_srcdir)/*/*.cpp -# CPPCHECK_SRC_CXX += $(top_srcdir)/*.cpp $(top_srcdir)/*/*/*.cpp - -cppcheck-cxx11.xml: $(CPPCHECK_SRC_CXX) $(CPPCHECK_SRC_H) - $(CPPCHECK) --std=c++11 --enable=all --inconclusive --xml --xml-version=2 . 2>$@ - -cppcheck-c99.xml: $(CPPCHECK_SRC_C) $(CPPCHECK_SRC_H) - $(CPPCHECK) --std=c99 --enable=all --inconclusive --xml --xml-version=2 . 2>$@ -else !HAVE_CPPCHECK -cppcheck: - @echo "CPPCHECK analysis not available since 'cppcheck' was not found." -endif !HAVE_CPPCHECK - -# ---------------------------------------------------------------------- # Automatically generate the ChangeLog from Git logs: -MAINTAINERCLEANFILES += ChangeLog - -# Older boundary of the ChangeLog commits range -# It can be a tag ('v2.2.0'), a commit hash, a date, ... -# See gitrevisions for more information on specifying ranges -GITLOG_START_POINT=v2.6.0 - +MAINTAINERCLEAN_FILES = ChangeLog # Force ChangeLog regeneration upon make dist (due to nonexistant 'dummy-stamp'), # in case it has already been generated previously -# Note that the script is hard-coded to generate "ChangeLog" in the current dir dummy-stamp: ChangeLog: tools/gitlog2changelog.py dummy-stamp - cd $(top_builddir) && \ - ./tools/gitlog2changelog.py $(GITLOG_START_POINT) || \ - { echo "gitlog2changelog.py failed to generate the ChangeLog. See https://github.com/networkupstools/nut/commits/master" > $@ ; } + $(top_srcdir)/tools/gitlog2changelog.py v2.6.0 || \ + echo "gitlog2changelog.py failed to generate the ChangeLog. See https://github.com/networkupstools/nut/commits/master" > $@ -nut_version.h include/nut_version.h: - cd $(abs_top_builddir)/include && $(MAKE) nut_version.h - -tools/gitlog2changelog.py: tools/gitlog2changelog.py.in - cd $(@D) && $(MAKE) -s $(@F) - -# ---------------------------------------------------------------------- -# Maintainers targets: distribution signature and hashes -nut-@PACKAGE_VERSION@.tar.gz: dist -nut-@PACKAGE_VERSION@.tar.gz.sig: dist-sig -nut-@PACKAGE_VERSION@.tar.gz.md5 nut-@PACKAGE_VERSION@.tar.gz.sha256: dist-hash - -dist-sig: nut-@PACKAGE_VERSION@.tar.gz - rm -f nut-@PACKAGE_VERSION@.tar.gz.sig - gpg --detach-sign nut-@PACKAGE_VERSION@.tar.gz - -dist-hash: nut-@PACKAGE_VERSION@.tar.gz - md5sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.md5 - sha256sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.sha256 +if HAVE_ASCIIDOC +website: + cd docs; $(MAKE) $(AM_MAKEFLAGS) website + cd docs/man; $(MAKE) $(AM_MAKEFLAGS) html-man + cd tools; $(MAKE) $(AM_MAKEFLAGS) website + cd docs/website; $(MAKE) $(AM_MAKEFLAGS) website +else !HAVE_ASCIIDOC +website: + @echo "Not building website since 'asciidoc' was not found." +endif !HAVE_ASCIIDOC # ---------------------------------------------------------------------- # targets from old build system (pre-automake). @@ -268,14 +93,14 @@ install-dirs: @echo "Warning: 'make install-dirs' is deprecated." @echo "Use 'make installdirs' instead." @echo $(WARN) - $(MAKE) installdirs + make installdirs cgi build-cgi install-cgi install-cgi-dir install-cgi-bin \ install-cgi-man install-cgi-conf install-cgi-html: @echo "Error: 'make $@' no longer exists." @echo "Use './configure --with-cgi' instead." install-lib: @echo "Error: 'make $@' no longer exists." - @echo "Use './configure --with-dev' instead." + @echo "Use './configure --with-lib' instead." usb build-usb install-usb: @echo "Error: 'make $@' no longer exists." @echo "Use './configure --with-usb' instead." @@ -284,65 +109,20 @@ snmp build-snmp install-snmp install-snmp-mgr install-snmp-man: @echo "Use './configure --with-snmp' instead." setver: @echo "Error: 'make setver' no longer exists." - @echo "Edit configure.ac to set version number." - -# Clean the dist tarball and packages -MAINTAINERCLEANFILES_DISTBALL = nut-*.tar.gz -# HP-UX: -MAINTAINERCLEANFILES_PACKAGES = NUT_HPUX_package@PACKAGE_VERSION@.depot -# AIX as below, and RedHat-compatible (cover binary and source packages): -MAINTAINERCLEANFILES_PACKAGES += nut*rpm -# Debian-compatible (cover binary and source packages): -MAINTAINERCLEANFILES_PACKAGES += nut*deb -# Solaris SVR4 package archives: -MAINTAINERCLEANFILES_PACKAGES += NUT_solaris_*_package@PACKAGE_VERSION@.local.gz -# Newer Solaris IPS (aka "pkg(5)" format archives) -MAINTAINERCLEANFILES_PACKAGES += *.p5p - -MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_DISTBALL) -MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_PACKAGES) - -package: dist - DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \ - rm -rf "$$DESTDIR"; \ - case "`uname -s`" in \ - "HP-UX") \ - ( cd scripts/HP-UX && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" package && \ - mv NUT_HPUX_package.depot $(abs_top_builddir)/NUT_HPUX_package@PACKAGE_VERSION@.depot ) ;; \ - "SunOS") \ - $(MAKE) $(AM_MAKEFLAGS) && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" install && \ - ( cd scripts/Solaris && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" package ) && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" uninstall && \ - rm -rf "$$DESTDIR" || \ - { echo "FAILED to produce SunOS packages, inspect '$$DESTDIR' for clues" >&2 ; exit 1; } ;; \ - "AIX") \ - if test -d /usr/src/packages/SPECS -a -w /usr/src/packages/SPECS ; then : ; else echo "Can not write to /usr/src/packages/SPECS" >&2 ; exit 1; fi ; \ - if test -d /usr/src/packages/SOURCES -a -w /usr/src/packages/SOURCES ; then : ; else echo "Can not write to /usr/src/packages/SOURCES" >&2 ; exit 1; fi ; \ - $(MAKE) $(AM_MAKEFLAGS) dist && \ - cp scripts/Aix/nut-aix.spec /usr/src/packages/SPECS && \ - cp scripts/Aix/nut.init nut-@PACKAGE_VERSION@.tar.gz /usr/src/packages/SOURCES && \ - rpm -ba /usr/src/packages/SPECS/nut-aix.spec && \ - mv /usr/src/packages/RPMS/nut*rpm $(abs_top_builddir)/ ;; \ - *) echo "Unsupported OS for 'make $@' (no recipe bound)" >&2; exit 1;; \ - esac - -print-MAINTAINERCLEANFILES print-REALCLEANFILES: - @echo $(MAINTAINERCLEANFILES) - -print-DISTCLEANFILES: - @echo $(DISTCLEANFILES) - -# TODO: Recursive mode to consider patterns defined in sub-dir makefiles -git-realclean-check: - @if test -e .git && (command -v git); then \ - git status --ignored || while read F ; do \ - for P in $(MAINTAINERCLEANFILES) ; do \ - case "$$F" in \ - */$$P) exit 1 ;; \ - esac ; \ - done; \ - done ; \ - fi + @echo "Edit configure.in to set version number." +package: + if test `uname -s` = "HP-UX"; then \ + cd scripts/HP-UX; \ + make package; \ + mv NUT_HPUX_package.depot NUT_HPUX_package@PACKAGE_VERSION@.depot; \ + else \ + if test `uname -s` = "SunOS"; then \ + make; \ + rm -rf @prefix@; \ + make install; \ + cd scripts/Solaris; \ + make package; \ + make uninstall; \ + rm -rf @prefix@; \ + fi; \ + fi; diff --git a/Makefile.in b/Makefile.in index 2919b26..5857fc4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,61 +17,23 @@ # top-level Makefile for NUT VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,24 +54,26 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(top_srcdir)/configure \ + $(top_srcdir)/scripts/HP-UX/nut.psf.in \ + $(top_srcdir)/scripts/HP-UX/postinstall.in \ + $(top_srcdir)/scripts/avahi/nut.service.in \ + $(top_srcdir)/scripts/ufw/nut.ufw.profile.in AUTHORS COPYING \ + ChangeLog INSTALL NEWS TODO compile config.guess config.sub \ + depcomp install-sh ltmain.sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -117,52 +82,28 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ - $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = scripts/Aix/nut-aix.spec \ - scripts/avahi/nut.service scripts/HP-UX/nut.psf \ - scripts/python/module/PyNUT.py scripts/Aix/nut.init \ - scripts/HP-UX/postinstall \ - scripts/python/app/NUT-Monitor-py2gtk2 \ - scripts/python/app/NUT-Monitor-py3qt5 \ - scripts/python/module/test_nutclient.py +CONFIG_CLEAN_FILES = scripts/avahi/nut.service scripts/HP-UX/nut.psf \ + scripts/HP-UX/postinstall scripts/ufw/nut.ufw.profile CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -170,45 +111,12 @@ am__can_run_installinfo = \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - cscope distdir distdir-am dist dist-all distcheck -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck ETAGS = etags CTAGS = ctags -CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/scripts/Aix/nut-aix.spec.in \ - $(top_srcdir)/scripts/Aix/nut.init.in \ - $(top_srcdir)/scripts/HP-UX/nut.psf.in \ - $(top_srcdir)/scripts/HP-UX/postinstall.in \ - $(top_srcdir)/scripts/avahi/nut.service.in \ - $(top_srcdir)/scripts/python/app/NUT-Monitor-py2gtk2.in \ - $(top_srcdir)/scripts/python/app/NUT-Monitor-py3qt5.in \ - $(top_srcdir)/scripts/python/module/PyNUT.py.in \ - $(top_srcdir)/scripts/python/module/test_nutclient.py.in \ - AUTHORS COPYING ChangeLog INSTALL NEWS README TODO compile \ - config.guess config.sub depcomp install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) @@ -218,7 +126,6 @@ am__remove_distdir = \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi -am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ @@ -246,9 +153,6 @@ am__relativize = \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best -DIST_TARGETS = dist-gzip -# Exists only to be overridden by the user if desired. -AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' @@ -256,11 +160,9 @@ distcleancheck_listfiles = find . -type f -print A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -271,7 +173,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -285,7 +186,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -298,8 +198,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -309,15 +212,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -328,32 +230,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ - -# Automatically update the libtool script if it becomes out-of-date -# See https://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -373,9 +264,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -384,16 +272,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -407,7 +291,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -418,12 +301,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -442,21 +321,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -472,93 +348,32 @@ ACLOCAL_AMFLAGS = -I m4 # subdirectories to build and distribute. The order matters, as # several subdirectories depend on stuff in "common" or tools being built first -SUBDIRS = include common clients conf data docs drivers tools \ +SUBDIRS = include common clients conf data tools docs drivers \ lib scripts server tests # COPYING is included automatically. -EXTRA_DIST = INSTALL.nut LICENSE-GPL2 LICENSE-GPL3 MAINTAINERS UPGRADING +EXTRA_DIST = LICENSE-GPL2 LICENSE-GPL3 MAINTAINERS UPGRADING # ---------------------------------------------------------------------- # flags to pass to ./configure when calling "make distcheck" and "make # distcheck-light". Try to check as many features as possible! Also -# need to give augeas-lenses-dir, hotplug-dir and udev-dir, so that -# staged install does not fail. +# need to give hotplug-dir and udev-dir, so that staged install does +# not fail. DISTCHECK_FLAGS = --with-all --with-ssl --with-doc=auto DISTCHECK_LIGHT_FLAGS = --with-all=auto --with-ssl=auto --with-doc=auto -DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --with-valgrind CXXFLAGS='$(CXXFLAGS) -g' CFLAGS='$(CFLAGS) -g' DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ - --with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \ - --with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \ - --with-systemdtmpfilesdir='$${prefix}/usr/lib/tmpfiles.d' \ - --with-augeas-lenses-dir='$${prefix}/usr/share/augeas/lenses' \ --with-hotplug-dir='$${prefix}/etc/hotplug' \ - --with-udev-dir='$${prefix}/etc/udev' \ - --with-devd-dir='$${prefix}/etc/devd' + --with-udev-dir='$${prefix}/etc/udev' -# Files made by our targets: -CLEANFILES = *-spellchecked cppcheck*.xml - -# Most of the files generated by custom rules in the configure script -# or by autogen.sh are cleaned by the Makefile.am in their directories. -# Files below are re-created by running `configure` script and may be -# wiped by a `make distclean`: -#???# configure.ac~ -DISTCLEANFILES = ChangeLog config.log configure~ include/config.h.in~ - -# Files made by autotools and common rituals of the configure script, -# these are needed to run the configure script itself so are not wiped -# by a mere `make distclean`; most of these are copied by autotools -# from their installation, or made by `automake` etc. on the system -# which generates `configure`; rebuilding NUT after deleting these -# requires `autogen.sh` script to be re-run (and tools available): - -# ---------------------------------------------------------------------- # Automatically generate the ChangeLog from Git logs: -MAINTAINERCLEANFILES = INSTALL aclocal.m4 config.guess config.sub \ - configure depcomp install-sh ltmain.sh test-driver \ - m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 \ - m4/lt~obsolete.m4 Makefile.in .dirstamp include/config.h.in \ - ChangeLog $(MAINTAINERCLEANFILES_DISTBALL) \ - $(MAINTAINERCLEANFILES_PACKAGES) - -# Let the analysis get regenerated due to any change in source; -# but note that with our different make implementations to support, -# we can not either $(shell find ...) nor blindly say e.g. *.cpp -# for each FS structure layer because e.g. there are no ./*.cpp -# in the root dir of the codebase (and so make complains there is -# `No rule to make target `*.cpp', needed by `cppcheck-cxx11.xml'`) -# -# Note that the actual `cppcheck` scan finds all files it likes -# (so if CPPCHECK_SRC_* misses something, it just won't trigger -# automagically a rebuild of the XML in developer working cycles). -@HAVE_CPPCHECK_TRUE@CPPCHECK_SRC_H = $(top_srcdir)/*/*.h $(top_srcdir)/*/*/*.h -# CPPCHECK_SRC_H += $(top_srcdir)/*.h -@HAVE_CPPCHECK_TRUE@CPPCHECK_SRC_C = $(top_srcdir)/*/*.c $(top_srcdir)/*/*/*.c -# CPPCHECK_SRC_C += $(top_srcdir)/*.cpp -@HAVE_CPPCHECK_TRUE@CPPCHECK_SRC_CXX = $(top_srcdir)/*/*.cpp - -# Older boundary of the ChangeLog commits range -# It can be a tag ('v2.2.0'), a commit hash, a date, ... -# See gitrevisions for more information on specifying ranges -GITLOG_START_POINT = v2.6.0 +MAINTAINERCLEAN_FILES = ChangeLog # ---------------------------------------------------------------------- # targets from old build system (pre-automake). # supported for a period of time for backward "compatibility". WARN = "----------------------------------------------------------------------" - -# Clean the dist tarball and packages -MAINTAINERCLEANFILES_DISTBALL = nut-*.tar.gz -# HP-UX: -# AIX as below, and RedHat-compatible (cover binary and source packages): -# Debian-compatible (cover binary and source packages): -# Solaris SVR4 package archives: -# Newer Solaris IPS (aka "pkg(5)" format archives) -MAINTAINERCLEANFILES_PACKAGES = \ - NUT_HPUX_package@PACKAGE_VERSION@.depot nut*rpm nut*deb \ - NUT_solaris_*_package@PACKAGE_VERSION@.local.gz *.p5p all: all-recursive .SUFFIXES: @@ -577,14 +392,15 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -595,23 +411,13 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): -scripts/Aix/nut-aix.spec: $(top_builddir)/config.status $(top_srcdir)/scripts/Aix/nut-aix.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ scripts/avahi/nut.service: $(top_builddir)/config.status $(top_srcdir)/scripts/avahi/nut.service.in cd $(top_builddir) && $(SHELL) ./config.status $@ scripts/HP-UX/nut.psf: $(top_builddir)/config.status $(top_srcdir)/scripts/HP-UX/nut.psf.in cd $(top_builddir) && $(SHELL) ./config.status $@ -scripts/python/module/PyNUT.py: $(top_builddir)/config.status $(top_srcdir)/scripts/python/module/PyNUT.py.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -scripts/Aix/nut.init: $(top_builddir)/config.status $(top_srcdir)/scripts/Aix/nut.init.in - cd $(top_builddir) && $(SHELL) ./config.status $@ scripts/HP-UX/postinstall: $(top_builddir)/config.status $(top_srcdir)/scripts/HP-UX/postinstall.in cd $(top_builddir) && $(SHELL) ./config.status $@ -scripts/python/app/NUT-Monitor-py2gtk2: $(top_builddir)/config.status $(top_srcdir)/scripts/python/app/NUT-Monitor-py2gtk2.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -scripts/python/app/NUT-Monitor-py3qt5: $(top_builddir)/config.status $(top_srcdir)/scripts/python/app/NUT-Monitor-py3qt5.in - cd $(top_builddir) && $(SHELL) ./config.status $@ -scripts/python/module/test_nutclient.py: $(top_builddir)/config.status $(top_srcdir)/scripts/python/module/test_nutclient.py.in +scripts/ufw/nut.ufw.profile: $(top_builddir)/config.status $(top_srcdir)/scripts/ufw/nut.ufw.profile.in cd $(top_builddir) && $(SHELL) ./config.status $@ mostlyclean-libtool: @@ -624,25 +430,22 @@ distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -657,12 +460,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -678,7 +526,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -690,11 +543,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -703,36 +560,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscope: cscope.files - test ! -s cscope.files \ - || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) -clean-cscope: - -rm -f cscope.files -cscope.files: clean-cscope cscopelist -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -rm -f cscope.out cscope.in.out cscope.po.out cscope.files -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -797,47 +629,41 @@ distdir-am: $(DISTFILES) ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz - $(am__post_remove_distdir) + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 - $(am__post_remove_distdir) + $(am__remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz - $(am__post_remove_distdir) + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz - $(am__post_remove_distdir) - -dist-zstd: distdir - tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst - $(am__post_remove_distdir) + $(am__remove_distdir) dist-tarZ: distdir - @echo WARNING: "Support for distribution archives compressed with" \ - "legacy program 'compress' is deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__post_remove_distdir) + $(am__remove_distdir) dist-shar: distdir - @echo WARNING: "Support for shar distribution archives is" \ - "deprecated." >&2 - @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 - shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz - $(am__post_remove_distdir) + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) - $(am__post_remove_distdir) + $(am__remove_distdir) -dist dist-all: - $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' - $(am__post_remove_distdir) +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another @@ -845,9 +671,11 @@ dist dist-all: distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ @@ -855,27 +683,24 @@ distcheck: dist *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ - eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ - *.tar.zst*) \ - zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac - chmod -R a-w $(distdir) - chmod u+w $(distdir) - mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst + chmod -R a-w $(distdir); chmod u+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ - && $(am__cd) $(distdir)/_build/sub \ - && ../../configure \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ - --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ @@ -896,7 +721,7 @@ distcheck: dist && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 - $(am__post_remove_distdir) + $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' @@ -944,17 +769,14 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am @@ -963,7 +785,7 @@ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ - distclean-local distclean-tags + distclean-tags dvi: dvi-recursive @@ -1007,8 +829,7 @@ maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic \ - maintainer-clean-local +maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive @@ -1024,38 +845,29 @@ ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--refresh check check-am clean clean-cscope clean-generic \ - clean-libtool cscope cscopelist-am ctags ctags-am dist \ - dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ - dist-xz dist-zip dist-zstd distcheck distclean \ - distclean-generic distclean-libtool distclean-local \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic \ - maintainer-clean-local mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-generic \ + clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \ + dist-gzip dist-lzip dist-lzma dist-shar dist-tarZ dist-xz \ + dist-zip distcheck distclean distclean-generic \ + distclean-libtool distclean-tags distcleancheck distdir \ + distuninstallcheck dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am tags tags-recursive uninstall uninstall-am -.PRECIOUS: Makefile - -libtool: $(LIBTOOL_DEPS) - $(SHELL) ./config.status libtool distcheck-light: $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_LIGHT_FLAGS)" distcheck -# Make a distcheck (and check in particular) with enabled valgrind and debug info -memcheck distcheck-valgrind: - $(MAKE) $(AM_MAKEFLAGS) DISTCHECK_FLAGS="$(DISTCHECK_VALGRIND_FLAGS)" distcheck - # workaround the dist generated files that are also part of the distribution # Note that distcleancheck is disabled for now, while waiting for a proper # solution, that do not break older unix systems @@ -1063,128 +875,20 @@ memcheck distcheck-valgrind: # find . -type f -exec sh -c 'test -f $(srcdir)/{} || echo {}' ';' distcleancheck: @: - -# Quick alias for root dir recipe: -realclean: maintainer-clean - -# Executed after default rules -maintainer-clean-local: - rm -f missing || true - -# Do not let $SUBDIRS/Makefile rules delete their local .deps because -# this breaks our ability to clean up (e.g. some common/.../*.Plo files -# are included by generated Makefiles from other subdirectories, so they -# should be available during their clean-up). Just in case, we make sure -# here that their sub-distcleans complete first. -distclean-local: - @for DIR in $(SUBDIRS) ; do \ - if test -f "$${DIR}/Makefile" ; then \ - echo " DISTCLEAN in $${DIR}" >&2 ; \ - ( cd "$${DIR}" && $(MAKE) -s distclean ) || exit ; \ - fi ; \ - done - rm -rf .inst tmp autom4te.cache - find "$(builddir)" -type d -name '.deps' | while read DIR ; do rm -rf "$${DIR}" ; done - -# Hook the documentation building and validating recipes -# Note: these are optionally available (as determined during configure runs) -spellcheck spellcheck-interactive: - @RES=0; \ - (cd $(builddir)/docs && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/docs/man && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/conf && $(MAKE) -s $@) || RES=$$? ; \ - (cd $(builddir)/data && $(MAKE) -s $@) || RES=$$? ; \ - exit $$RES - -# Note: the "all-docs" and "check-docs" targets may require tools not -# found by `configure` script (and so avoided by conventional recipes) -# such as PDF generators, so it should only be called at developer's -# discretion, choice and risk. The "check-man" targets covers source -# texts, man pages and HTML rendering of man pages, as enabled by tools. -doc spellcheck-sortdict \ -all-docs check-docs \ -man all-man man-man check-man man-html all-html: - cd $(builddir)/docs && $(MAKE) $@ - -check-NIT check-NIT-devel: - cd $(builddir)/tests/NIT && $(MAKE) $@ - -# This target adds syntax-checking for committed shell script files, -# to avoid surprises and delays in finding fatal typos after packaging -### -### Note: currently, shellcheck target calls check-scripts-syntax -### so when both are invoked at once, in the end the check is only -### executed once. Later it is anticipated that shellcheck would -### be implemented by requiring, configuring and calling the tool -### named "shellcheck" for even more code inspection and details. -### Still, there remains value in also checking the script syntax -### by the very version of the shell interpreter that would run -### these scripts in production usage of the resulting packages. -### -check-scripts-syntax: - @echo 'NOTE: modern bash complains about scripts using backticks (warning not error), which we ignore in NUT codebase for portability reasons: `...` obsolete, use $$(...)' - @RUNBASH=bash; if [ -x /bin/bash ]; then RUNBASH=/bin/bash ; else if [ -x /usr/bin/env ] ; then RUNBASH="/usr/bin/env bash"; fi; fi ; \ - for F in `git ls-files || find . -type f` ; do \ - case "`file "$$F"`" in \ - *"Bourne-Again shell script"*) ( set -x ; $$RUNBASH -n "$$F" ; ) ;; \ - *"POSIX shell script"*|*"shell script"*) ( set -x ; /bin/sh -n "$$F" ; ) ;; \ - esac || { RES=$$? ; echo "ERROR: Syntax check failed for script file: $$F" >&2 ; exit $$RES ; } ; \ - done - @echo 'SUCCESS: Shell scripts syntax is acceptable, no fatal issues were found' - -shellcheck-disclaimer: - @echo "===============================================================================" - @echo "NOTICE: 'make shellcheck' is currently an alias for 'make check-scripts-syntax'" - @echo "Later it may become a call to the real shellcheck tool (if available on the" - @echo "build system during the configure phase)" - @echo "===============================================================================" - -# Note: currently not part of shellcheck target, because the script below -# can test the logic with numerous SHELL_PROGS in a CI setting, and because -# check-scripts-syntax probably has checked the basic syntax above already. -shellcheck-nde: - cd $(srcdir)/tests && SERVICE_FRAMEWORK="selftest" ./nut-driver-enumerator-test.sh - -shellcheck: shellcheck-disclaimer check-scripts-syntax -@HAVE_CPPCHECK_TRUE@cppcheck: cppcheck-cxx11.xml cppcheck-c99.xml -# CPPCHECK_SRC_CXX += $(top_srcdir)/*.cpp $(top_srcdir)/*/*/*.cpp - -@HAVE_CPPCHECK_TRUE@cppcheck-cxx11.xml: $(CPPCHECK_SRC_CXX) $(CPPCHECK_SRC_H) -@HAVE_CPPCHECK_TRUE@ $(CPPCHECK) --std=c++11 --enable=all --inconclusive --xml --xml-version=2 . 2>$@ - -@HAVE_CPPCHECK_TRUE@cppcheck-c99.xml: $(CPPCHECK_SRC_C) $(CPPCHECK_SRC_H) -@HAVE_CPPCHECK_TRUE@ $(CPPCHECK) --std=c99 --enable=all --inconclusive --xml --xml-version=2 . 2>$@ -@HAVE_CPPCHECK_FALSE@cppcheck: -@HAVE_CPPCHECK_FALSE@ @echo "CPPCHECK analysis not available since 'cppcheck' was not found." - # Force ChangeLog regeneration upon make dist (due to nonexistant 'dummy-stamp'), # in case it has already been generated previously -# Note that the script is hard-coded to generate "ChangeLog" in the current dir dummy-stamp: ChangeLog: tools/gitlog2changelog.py dummy-stamp - cd $(top_builddir) && \ - ./tools/gitlog2changelog.py $(GITLOG_START_POINT) || \ - { echo "gitlog2changelog.py failed to generate the ChangeLog. See https://github.com/networkupstools/nut/commits/master" > $@ ; } + $(top_srcdir)/tools/gitlog2changelog.py v2.6.0 || \ + echo "gitlog2changelog.py failed to generate the ChangeLog. See https://github.com/networkupstools/nut/commits/master" > $@ -nut_version.h include/nut_version.h: - cd $(abs_top_builddir)/include && $(MAKE) nut_version.h - -tools/gitlog2changelog.py: tools/gitlog2changelog.py.in - cd $(@D) && $(MAKE) -s $(@F) - -# ---------------------------------------------------------------------- -# Maintainers targets: distribution signature and hashes -nut-@PACKAGE_VERSION@.tar.gz: dist -nut-@PACKAGE_VERSION@.tar.gz.sig: dist-sig -nut-@PACKAGE_VERSION@.tar.gz.md5 nut-@PACKAGE_VERSION@.tar.gz.sha256: dist-hash - -dist-sig: nut-@PACKAGE_VERSION@.tar.gz - rm -f nut-@PACKAGE_VERSION@.tar.gz.sig - gpg --detach-sign nut-@PACKAGE_VERSION@.tar.gz - -dist-hash: nut-@PACKAGE_VERSION@.tar.gz - md5sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.md5 - sha256sum nut-@PACKAGE_VERSION@.tar.gz > nut-@PACKAGE_VERSION@.tar.gz.sha256 +@HAVE_ASCIIDOC_TRUE@website: +@HAVE_ASCIIDOC_TRUE@ cd docs; $(MAKE) $(AM_MAKEFLAGS) website +@HAVE_ASCIIDOC_TRUE@ cd docs/man; $(MAKE) $(AM_MAKEFLAGS) html-man +@HAVE_ASCIIDOC_TRUE@ cd tools; $(MAKE) $(AM_MAKEFLAGS) website +@HAVE_ASCIIDOC_TRUE@ cd docs/website; $(MAKE) $(AM_MAKEFLAGS) website +@HAVE_ASCIIDOC_FALSE@website: +@HAVE_ASCIIDOC_FALSE@ @echo "Not building website since 'asciidoc' was not found." build: @echo $(WARN) @@ -1218,14 +922,14 @@ install-dirs: @echo "Warning: 'make install-dirs' is deprecated." @echo "Use 'make installdirs' instead." @echo $(WARN) - $(MAKE) installdirs + make installdirs cgi build-cgi install-cgi install-cgi-dir install-cgi-bin \ install-cgi-man install-cgi-conf install-cgi-html: @echo "Error: 'make $@' no longer exists." @echo "Use './configure --with-cgi' instead." install-lib: @echo "Error: 'make $@' no longer exists." - @echo "Use './configure --with-dev' instead." + @echo "Use './configure --with-lib' instead." usb build-usb install-usb: @echo "Error: 'make $@' no longer exists." @echo "Use './configure --with-usb' instead." @@ -1234,52 +938,23 @@ snmp build-snmp install-snmp install-snmp-mgr install-snmp-man: @echo "Use './configure --with-snmp' instead." setver: @echo "Error: 'make setver' no longer exists." - @echo "Edit configure.ac to set version number." - -package: dist - DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \ - rm -rf "$$DESTDIR"; \ - case "`uname -s`" in \ - "HP-UX") \ - ( cd scripts/HP-UX && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" package && \ - mv NUT_HPUX_package.depot $(abs_top_builddir)/NUT_HPUX_package@PACKAGE_VERSION@.depot ) ;; \ - "SunOS") \ - $(MAKE) $(AM_MAKEFLAGS) && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" install && \ - ( cd scripts/Solaris && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" package ) && \ - $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" uninstall && \ - rm -rf "$$DESTDIR" || \ - { echo "FAILED to produce SunOS packages, inspect '$$DESTDIR' for clues" >&2 ; exit 1; } ;; \ - "AIX") \ - if test -d /usr/src/packages/SPECS -a -w /usr/src/packages/SPECS ; then : ; else echo "Can not write to /usr/src/packages/SPECS" >&2 ; exit 1; fi ; \ - if test -d /usr/src/packages/SOURCES -a -w /usr/src/packages/SOURCES ; then : ; else echo "Can not write to /usr/src/packages/SOURCES" >&2 ; exit 1; fi ; \ - $(MAKE) $(AM_MAKEFLAGS) dist && \ - cp scripts/Aix/nut-aix.spec /usr/src/packages/SPECS && \ - cp scripts/Aix/nut.init nut-@PACKAGE_VERSION@.tar.gz /usr/src/packages/SOURCES && \ - rpm -ba /usr/src/packages/SPECS/nut-aix.spec && \ - mv /usr/src/packages/RPMS/nut*rpm $(abs_top_builddir)/ ;; \ - *) echo "Unsupported OS for 'make $@' (no recipe bound)" >&2; exit 1;; \ - esac - -print-MAINTAINERCLEANFILES print-REALCLEANFILES: - @echo $(MAINTAINERCLEANFILES) - -print-DISTCLEANFILES: - @echo $(DISTCLEANFILES) - -# TODO: Recursive mode to consider patterns defined in sub-dir makefiles -git-realclean-check: - @if test -e .git && (command -v git); then \ - git status --ignored || while read F ; do \ - for P in $(MAINTAINERCLEANFILES) ; do \ - case "$$F" in \ - */$$P) exit 1 ;; \ - esac ; \ - done; \ - done ; \ - fi + @echo "Edit configure.in to set version number." +package: + if test `uname -s` = "HP-UX"; then \ + cd scripts/HP-UX; \ + make package; \ + mv NUT_HPUX_package.depot NUT_HPUX_package@PACKAGE_VERSION@.depot; \ + else \ + if test `uname -s` = "SunOS"; then \ + make; \ + rm -rf @prefix@; \ + make install; \ + cd scripts/Solaris; \ + make package; \ + make uninstall; \ + rm -rf @prefix@; \ + fi; \ + fi; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/NEWS b/NEWS index 895b2ed..b8a34f9 100644 --- a/NEWS +++ b/NEWS @@ -1,646 +1,7 @@ If you're upgrading from an earlier version, see the UPGRADING file. For a complete and more detailed list of changes, please refer to the -ChangeLog file (generated for release archives), or to the Git version -control history for "live" codebase. - ---------------------------------------------------------------------------- -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 ` request, - and falling back to `MASTER ` 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. - ---------------------------------------------------------------------------- -Release notes for NUT 2.7.4 - what's new since 2.7.3: - - - New class of device supported: ATS - Automatic Transfer Switch are now - supported in NUT. Eaton ATS are supported, and APC ones should be too. Users - are welcomed to test and provide feedback - - - NUT command and variable naming scheme: - * Document battery.charger.status, which will in time replace the historic - CHRG and DISCHRG flags published in ups.status - * Many extensions to support outlets groups, thresholds / alarms (ambient, - input, output, outlet and outlet.group) - - - support for new devices: - AEG PROTECT B / NAS - APC ATS AP7724 (should be supported) - Asium P700 - Eaton ATS - Eaton 5E 1100iUSB - Eaton E Series DX UPS 1-20 kVA - Eaton Powerware 9125-5000g - Electrys UPS 2500 - Fideltronic INIGO Viper 1200 - Legrand Keor Multiplug - LYONN CTB-800V - Micropower LCD 1000 - NHS Laser Senoidal 5000VA - Sweex model P220 - TS Shara - Various APCUPSD-controlled APC devices - - - snmp-ups: - * Improve automatic detection algorithm - * Provide access to Net-SNMP timeout and retries - * Proper handling of integer RW variables - * Implement support for alarms, through ups.alarm and outlet.n.alarm - * Improve log/debug output trace - * Fix loss of precision when setting values, using upsrw - * Support for outlets group management - * Many improvements and simplification - * Add support for Tripplite units using IETF mib - * Improve communication staleness detection and recovery - * Add devices MAC address publication - * Register values enumerations, when available - * Many improvements and fixes to the SNMP subdriver creation script - - - Eaton: - * 3ph SNMP: - Many improvements to Powerware / XUPS MIB, for data and commands - Add support for Eaton Power Xpert Gateway UPS Card - Improve support for temperature and humidity, including low / high values - Alarms handling - * ePDU (G2 and G3): - Improve support for ambient sensor, including thresholds and dry contacts - Outlet groups handling, including data, thresholds, settings and commands - Alarms handling - * XML/PDC (netxml-ups): - Fix Eaton XML published data - Add some settings (R/W flags) on ambient thresholds - - - bcmxcp_usb: improvements for device claiming and multi-packets responses - - - dummy-ups: allow any variable to be modified - - - libnutclient: Fix for reads when the socket was closed by NUT server - - - macosx-ups: - * fix for 10.10 (Yosemite), v1.1 - * gracefully handle disconnection of UPS (return "data stale") - - - nutdrv_atcl_usb: point to nutdrv_qx (fuji) for 0001:0000 - - - nutdrv_qx: - * Add new 'sgs' USB subdriver to support TS Shara units - * various improvements and simplification, to the code and documentation - - - nut-ipmipsu: improve FreeIPMI support - - - nut-scanner: - * Don't depend on development libraries, by looking at some known paths, - including the one provided through --libdir, to find the correct libraries - * Fix a crash on a 2nd call to libnutscan with SNMP method - - - powercom: fix the processing of input and output voltage for KIN units - - - solis: - * many improvements and cleanup - * resync with end-of-packet character - * fixes for Microsol Back-Ups BZ1200-BR - - - tripplitesu: Fix initialization when tripplite firmware is buggy (for - Tripplite SU1000RT2U and possibly more) - - - usbhid-ups: - * various minor improvements - * support for Eaton UPS with dual HID report descriptor in HID Parser - * handle missing USB strings in APC code - - - SSL support through Mozilla NSS: Rework the NSS tests to ensure that NSS is - actually installed and usable for enabling SSL support in NUT - - - Augeas support: Augeas lens for ups.conf was updated to add various missing - global directives and ups fields - - - scripts/systemd/nut-server.service.in: Restore systemd relationship since it - was preventing upsd from starting whenever one or more drivers, among several, - was failing to start - - - Fix UPower device matching for recent kernels, since hiddev* devices now have - class "usbmisc", rather than "usb" - - - Network protocol information: default to type NUMBER for variables that are - not flagged as STRING . This point is subject to improvements or change in - the next release 2.7.5. Refer to docs/net-protocol.txt for more information - - - As usual, more bugfixes, cleanup and improvements, on both source code - and documentation. - ---------------------------------------------------------------------------- -Release notes for NUT 2.7.3 - what's new since 2.7.2: - - - reverted POWERDOWNFLAG to /etc/killpower as in 2.6.5 (packagers may want to - put this in another filesystem, though) - - - configure/make fixes for ${systemdsystemunitdir} - - - apcsmart: fix command set parsing for protocol version 4 (e.g. Smart-UPS - RT 10000 XL) - - - upslog: SIGUSR1 forces an immediate log entry - - - riello_usb/_ser: USB interface claim fix; improved error handling - - - usbhid-ups: add support for OpenUPS2 (PID: D005), Liebert GXT3 (PID: 0008) - APC AP9584 Serial->USB kit (PID: 0000), and some Powercom models - (PID: 0001). Fixed scaling for Cyberpower 0764:0501. - - - USB core: do not call usb_set_altinterface(0) by default - - - nutdrv_qx: added fabula, fuji USB and Voltronic-QS-HEX subdrivers; add - bestups subdriver to supersede the old standalone bestups driver - - - NUT Monitor: added FreeDesktop AppData file (including screenshots) - - - renamed udev rules file to 62-nut-usbups.rules (permissions fix) - - - added AIX packaging - - - asem: added a driver for the UPS in ASEM PB1300 embedded PCs - - - solis: updated to support APC Microsol units sold in Brazil - - - tripplite_usb: updated to use dv/dq charge calculation for all models (also - exposes battery_min and battery max as configuration variables); added - binary 3005 protocol support (such as for SMART500RT1U) - - - genericups: better debugging while parsing the cable description flags - - - all drivers: a new 'synchronous' driver flag is available for very verbose - units, such as some ePDUs - - - Eaton: - * Add support for EnergySaving features for Eaton UPSs (HID USB/SHUT and - XCP USB/serial) - * Fix and complete Eaton ePDUs G2/G3 support - * ABM (Advanced Battery Monitoring) support through battery.charger.status - in HID (USB and SHUT), XCP (USB and serial) and SNMP (Powerware XUPS - MIB) - - - support for new devices: - APC Back-UPS 1200BR and Back-UPS BZ2200BI-BR (Microsol) - ASEM SPA PB1300 UPS - Belkin Regulator PRO-USB - Cyber Power Systems Value 1500ELCD-RU - EUROCASE EA200N 2000VA - Fideltronik LUPUS 500 - Flight Technic & International (FTUPS) FT-1000BS and FT-1000BS(T) - Grafenthal PR-3000-HS - JAWAN JW-UPSLC02 - Lacerda New Orion 800VA - Mecer ME-1000-WTU - NHS Sistemas de Energia Expert C Online 6000/8000/10000 - NHS Sistemas de Energia Expert S Online 6000/8000/10000 - Powercom BNT-xxxAP (USB product id: 0001) - Rucelf UPOII-3000-96-EL - Tripp Lite OMNIVSINT800 - Voltronic Power Apex 1KVA and Imperial 1KVA - ---------------------------------------------------------------------------- -Release notes for NUT 2.7.2 - what's new since 2.7.1: - - - This release is the second interim release of the 2.7 testing series. - - - libupsclient had undefined references related to functions of libcommon. - This issue was reported on Debian (bug #731156) and is now fixed - - - support for new devices: - CABAC UPS-1700DV2 - Eaton Powerware 3105 - Emerson Network Power Liebert PSI 1440 - MicroDowell B.Box LP 500 - Numeric Digital 800 plus - OptiUPS VS 575C - Tripp Lite SU10KRT3/1X - - - FreeDesktop Hardware Abstraction Layer (HAL) support was removed. - - - nutdrv_atcl_usb: new driver for 'ATCL FOR UPS' - - - al175: re-introduced this driver (actually, it was in 2.7.1) - - - upsdrvctl now provides retry options for upsdrvctl and driver(s) - - - snmp-ups: add support for XPPC-MIB and Tripp Lite SU10KRT3/1X. - Also fix erroneous status in HP/Compaq SNMP MIB (with the most recent HP - firmware (1.76) ; improved various MIBs (APC, HP/Compaq, ...) - - - nutdrv_qx: add new 'fallback' Q1 subdriver, with minimal 'Q1' support. - General improvements on all subdrivers. - - - mge-shut: partially revert PnP/RTS change, for initializing the - communication with the UPS. Note that nut-scanner similar function was - not modified however. - - - FreeBSD DEVD support: generate devd.conf files for USB UPSes - This adds a --with-devd-dir=PATH option to ./configure - - - The NUT website was moved to a standalone website. A separate code - repository and source archive are now available. - - - As usual, more bugfixes, cleanup and improvements, on both source code - and documentation. +ChangeLog file. --------------------------------------------------------------------------- Release notes for NUT 2.7.1 - what's new since 2.6.5: @@ -691,7 +52,7 @@ Release notes for NUT 2.7.1 - what's new since 2.6.5: - libnutclient has been added as a C++ alternative to libupsclient. - Packaging files for Solaris and HP-UX (sponsored by Eaton) - + - Fix shutdown of Eaton HID, using usbhid-ups and mge-shut - usbhid-ups: final fix for APC Back UPS ES. APC Back UPS ES devices have @@ -714,11 +75,11 @@ Release notes for NUT 2.7.1 - what's new since 2.6.5: related to power devices and management - Improve systemd integration - + - snmp-ups: Fixed a crash on outlet management, and added delta_ups MIB support. Also fixed mappings for upsBypassVoltage, upsBypassCurrent, and upsBypassPower in three-phase IETF MIB. - + --------------------------------------------------------------------------- Release notes for NUT 2.6.5 - what's new since 2.6.4: @@ -755,7 +116,7 @@ Release notes for NUT 2.6.5 - what's new since 2.6.4: VMware ESXI 5.0, through a native VIB package. This is, for the time being, an external effort from René Garcia (refer to the Download section on NUT website). But work is underway to improve this integration, and - include it in the NUT source tree + include it in the NUT source tree - IPMI support (nut-ipmipsu driver and nut-scanner): prepare for supporting API changes in upcoming FreeIPMI versions 1.1.x and 1.2.x. @@ -780,7 +141,7 @@ Release notes for NUT 2.6.4 - what's new since 2.6.3: especially from the network. Non printable characters were missed from strings operation (such as strlen), but still copied to the buffer, causing an overflow. - Thus, fix NUT parser, to only allow the subset of ASCII charset from + Thus, fix NUT parser, to only allow the subset Ascii charset from Space to ~ (Reported by Sebastian Pohle, Alioth bug #313636, CVE-2012-2944) @@ -830,7 +191,7 @@ Release notes for NUT 2.6.4 - what's new since 2.6.3: PowerShield Defender 1200VA PowerWalker Online VFI LCD, Line-Interactive VI LCD and Line-Interactive VI Riello Netman Plus 102 SNMP Card - Tripp-Lite OMNISMART500 + Tripp-Lite OMNISMART500 - apcsmart has received some fixes to work better on Mac OS X, and in general @@ -842,12 +203,12 @@ Release notes for NUT 2.6.4 - what's new since 2.6.3: - blazer_ser and blazer_usb now try to automatically estimate high and low voltages, to be able to calculate battery charge ; support for online Innova UPS (T, RT and 3/1 T) has been added ; Best UPS support has been - improved, to prepare for superseding bestups driver + improved, to prepare for superseeding bestups driver - bestups has also received some care, though users are encouraged to switch to blazer_ser, since bestups will soon be deprecated. - - newmge-shut has been heavily improved. However, replacement of the + - newmge-shut has been heavilly improved. However, replacement of the current mge-shut has been postponed to the next release, due to the CVE issue. @@ -874,19 +235,19 @@ Release notes for NUT 2.6.4 - what's new since 2.6.3: - Riello protocols have been officially published in NUT protocols library: http://www.networkupstools.org/ups-protocols.html#_riello - + - Duplicate instances of upsd / upsmon are now detected upon startup - NUT variables namespace has been completed with missing variables and commands that are already known and standard - - upslog now comes with a companion file, for logrotate configuration + - upslog now comes with a companion file, for logrotate configuration - more devices embed NUT for power protection, now including Thecus NAS range - more bugfixes, cleanup and improvements, on both source code and documentation, with a good bunch from Greg A. Woods. - + --------------------------------------------------------------------------- Release notes for NUT 2.6.3 - what's new since 2.6.2: @@ -933,7 +294,7 @@ Release notes for NUT 2.6.3 - what's new since 2.6.2: - Base files for HPUX packaging have been added. This is still a work in progress. - - Compilation on IBM AIX has been fixed (namespace conflict with ctypes). + - Compilation on IBM Aix has been fixed (namespace conflict with ctypes). - more bugfixes, cleanup and improvements, on both source code and documentation. @@ -956,7 +317,7 @@ Release notes for NUT 2.6.2 - what's new since 2.6.1: * SNMP, * XML/HTTP (from Eaton), * NUT servers, using the classic connect or Avahi / mDNS methods. - + IPMI support will be added in the next release. A separate library, called 'libnutscan', is also available to provide these feature. Future NUT releases will provides binding for the supported @@ -968,10 +329,10 @@ Release notes for NUT 2.6.2 - what's new since 2.6.1: the future. For more info, refer to nut/scripts/java/README, or the developer guide (chapter 'Creating new client'). Javadoc documentation is also provided, - along with Java archives (.jar) in the Download section. + along with Java archives (.jar) in the Download section. - - support for new devices: Eaton 3S ; Cyber Power Systems CP1000AVRLCD ; - various APC models equipped with APC AP9618 management card, including APC + - support for new devices: Eaton 3S ; Cyber Power Systems CP1000AVRLCD ; + various APC models equiped with APC AP9618 management card, including APC Smart-UPS RT XL ; Orvaldi 750 / 900SP ; POWEREX VI 1000 LED ; PowerWalker VI 850 LCD ; SVEN Power Pro+ series (USB ID ffff:0000). @@ -996,9 +357,9 @@ Release notes for NUT 2.6.2 - what's new since 2.6.1: the default 3 seconds. - snmp-ups.c has a new initialization method, that uses sysObjectID, which is - a pointer to the preferred MIB of the device, to detect supported devices. + a pointer to the prefered MIB of the device, to detect supported devices. This speeds up even more init stage and should render void the use of 'mib' - option. SNMP v3 session initialization has also been fixed, and Eaton PDU + option. SNMP v3 session initialisation has also been fixed, and Eaton PDU support has been completed. - Initial support has been added for systemd, the System and Service Manager @@ -1010,7 +371,7 @@ Release notes for NUT 2.6.2 - what's new since 2.6.1: - Finally, after years of dedication to NUT, Arjen de Korte is now retired. Sincere thanks to you Arjen from us all. - + --------------------------------------------------------------------------- Release notes for NUT 2.6.1 - what's new since 2.6.0: @@ -1041,9 +402,9 @@ Release notes for NUT 2.6.1 - what's new since 2.6.0: - usbhid-ups has completed a bit supported variables for APC and Eaton / MGE. - - on the quality assurance side, Eaton has worked on fixing a few - non-conformance issues, like C++ style comments and warnings, using - a newly developed verification tool (Prachi Gandhi). + - on the quality assurance side, Eaton has worked on fixing a few non + conformances, like C++ style comments and warnings, using a newly developed + verification tool (Prachi Gandhi). - fix remaining references to LIBSSL_LDFLAGS, instead of LIBSSL_LIBS, which cause unresolved symbol on libupsclient users (Fabrice Coutadeur). @@ -1102,7 +463,7 @@ Release notes for NUT 2.6.0 - what's new since 2.4.3: - improve configure time dependencies checking and processing. - - improve older Unix systems support (HP-UX, AIX, ...) for missing functions. + - improve older Unix systems support (HP-UX, Aix, ...) for missing functions. - refresh and improve USB helper files (udev and UPower). @@ -1173,8 +534,8 @@ Release notes for NUT 2.4.1 - what's new since 2.4.0: version 1.1. - the situation of the build toolchain has been fixed, with regard to the - "make clean" target and the wrongly removed generated USB files. This broke - further configure call. + "make clean" target and the wrongly removed generated USB files. This brokes + further configure call. --------------------------------------------------------------------------- Release notes for NUT 2.4.0 - what's new since 2.2.2: @@ -1185,7 +546,7 @@ Release notes for NUT 2.4.0 - what's new since 2.2.2: including: Eaton ePDUs (Managed and Monitored), some Aphel models, some Raritan PDUs, and the whole list of Powerman supported devices: http://powerman.sourceforge.net/supported.html - + - support for new devices: the various PDUs cited above, Chloride Desk Power 650, Cyber Power Systems Value 400E/600E/800E (USB models), Delta GES602N, Digitus DN-170020, the whole Eaton ranges (mostly composed of MGE Office @@ -1215,8 +576,8 @@ Release notes for NUT 2.4.0 - what's new since 2.2.2: - NUT now ships a bash completion function for 'upsc' command (scripts/misc/nut.bash_completion). Simply copy it to /etc/bash_completion.d - - - many internal changes to improve maintainability, while lowering the + + - many internal changes to improve maintenability, while lowering the maintenance cost (thus allowing developers to focus on what matters: the code!). Examples of this are: - the USB information automatic extraction to generate the various USB helper @@ -1233,7 +594,7 @@ Release notes for NUT 2.2.2 - what's new since 2.2.1: - support for new devices: APC BACK-UPS XS LCD, Atlantis Land, Mustek Powermust Office 650, Oneac XAU models, Powerware PW5115 and PW9120 (USB), Nitram Elite 2005 - + - Integrated Power Management (NUT HAL integration) has reached a major milestone: it is now the most advanced UPS integration into Power Management layer known in existing OSs. It has received many @@ -1252,15 +613,15 @@ Release notes for NUT 2.2.2 - what's new since 2.2.1: - the netxml-ups driver has appeared to support MGE* network HTTP/XML cards. - + - NUT now distributes by default the shared version of libupsclient (version 1.0.0), and use this for the provided clients (upsmon, upsc, upsrw, upscmd). This is part of an effort to reduce NUT's footprint, both on disk and in memory. - + - powerpanel has reach a new step toward the replacement of nitram and cpsups drivers. The final step is scheduled for NUT 2.4. - + - many changes, cleanup and fixes to the NUT core and various drivers. --------------------------------------------------------------------------- @@ -1280,7 +641,7 @@ Release notes for NUT 2.2.1 - what's new since 2.2.0: - the megatec and megatec_usb drivers have also been backported from the development (trunk) version. - + - the client development files have also received some care: the upsclient pkg-config file has been fixed, and the upsclient.h file allows older NUT clients to continue using the UPSCONN structure. @@ -1332,7 +693,7 @@ Release notes for NUT 2.0.5 - what's new since 2.0.4: This release is a backport of the development version. Many changes have already been backported previously. Thus it is more a - synchronization release, though it includes many bugfixes and support + synchronisation release, though it includes many bugfixes and support for new models. - support for new devices: APC Smart-UPS with 6TI firmware; Belkin @@ -1355,7 +716,7 @@ Release notes for NUT 2.0.5 - what's new since 2.0.4: - solis: shutdown programming, support new cables, Solaris support - - tripplite_usb: updated SMARTPRO support, fixed OL/OB reporting, + - tripplite_usb: updated SMARTPRO support, fixed OL/OB reporting, better error handling, some memory bugs - new dummy-ups driver simulator @@ -1366,12 +727,12 @@ Release notes for NUT 2.0.5 - what's new since 2.0.4: Release notes for NUT 2.0.4 - what's new since 2.0.3: - The newhidups critical bug (segmentation fault) has been fixed. It has - also received some more care, like bugfixes and new models support and + also received some more care, like buxfixes and new models support and enhancement for Solaris. [Peter Selinger and Arnaud Quette] - A bug has been fixed in NUT core to support resuming from suspend-to-disk. - This should also fix other similar issues, like time synchronization + This should also fix other similar issues, like time synchronisation through the NTP - Network Time Protocol. [Arjen de Korte] @@ -1394,7 +755,7 @@ Release notes for NUT 2.0.4 - what's new since 2.0.3: [Carlos Rodrigues] - The new rhino driver was added to support Microsol Rhino UPS hardware - The solis has also been improved for Solaris compatibility, and + The solis has also been improved for solaris compatibility, and internal / external shutdown programming. solis can now save external shutdown programming to ups, and support new cables for solis 3 [Silvino B. Magalhães] @@ -1434,7 +795,7 @@ Release notes for NUT 2.0.3 - what's new since 2.0.2: ups.model retrieval for some specific case (release 0.65) - The drivers don't change to the "statepath" directory anymore at - initialization time if called using -k. This avoid unneeded + initialisation time if called using -k. This avoid unneeded failure to poweroff the UPS if /var is already unmounted. [Gaspar Bakos] @@ -1454,7 +815,7 @@ Release notes for NUT 2.0.3 - what's new since 2.0.2: - The packaging files for Red Hat have received various fixes [Thomas Jarosch] - - The solis driver has been fixed to avoid a naming collision and + - The solis driver has been fixed to avoid a naming colision and compile on Solaris [Paweł Kierdelewicz] @@ -1496,7 +857,7 @@ Release notes for NUT 2.0.2 - what's new since 2.0.1: [Thanos Chatziathanassiou, Olli Salvia] - The bcmxcp driver is back with support for Powerware UPSs. - [Tore Ørpetveit, Kjell Claesson] + [Tore Øpetveit, Kjell Claesson] - The cyberpower driver now supports CyberPower 1000AVR. [Dave Huang] @@ -1507,7 +868,7 @@ Release notes for NUT 2.0.2 - what's new since 2.0.1: - The apcsmart driver has fixed APC600 support. - - The etapro driver fixes brokenness due to ser_get_line use + - The etapro driver fixes brokeness due to ser_get_line use [Marek Michalkiewicz] - The new upscode2 driver supports Fiskars, Compaq and Powerware @@ -1546,7 +907,7 @@ Release notes for NUT 2.0.1 - what's new since 2.0.0: - The everups driver now supports types 73-76 (NET 700/1000/1400/500-DPC) [hunter] - - The new metasys driver supports Meta System models: Line, + - The new metasys driver supports Meta System models: Line, HF Millennium, HF Top Line, ECO Network, ECO, Ally HF, Megaline [BlaXwan] @@ -1559,7 +920,7 @@ Release notes for NUT 2.0.1 - what's new since 2.0.0: and bypass control. [Gert Lynge] - - The tripplite driver has received a major overhaul to bring it up to + - The tripplite driver has recieved a major overhaul to bring it up to working condition for the 2.0 tree, including code cleanups, several new variables, commands, and user-definable parameters. See ChangeLog for more. @@ -1598,7 +959,7 @@ Release notes for NUT 2.0.1 - what's new since 2.0.0: [Arnaud Quette] - The fentonups driver now recognizes several more Megatec protocol - units: + units: SuperPower HP360, Hope-550 [Denis Zaika] Unitek Alpha 1000is [Antoine Cuvellard] @@ -1612,7 +973,7 @@ Release notes for NUT 2.0.1 - what's new since 2.0.0: - upssched's CANCEL events were broken following the change to text-based socket messages in 1.5 and have been fixed. - [Steven Schoch] + [Steven Schoch] - Calls to varargs functions with raw strings from the config files without an intervening "%s" have been fixed in upsmon, upssched, @@ -1631,8 +992,8 @@ Release notes for NUT 2.0.0 - what's new since 1.4.x: interim compatibility hacks have been removed. - New serial handling code has been added, with greatly simplified - operations. The old mess involving repeated calls to sigaction, - alarm, and read has been condensed to a select-read loop. + operations. The old mess involving repeated calls to sigaction, + alarm, and read has been condensed to a select-read loop. This change allows drivers which don't do any serial communications at all (hidups, snmp-ups) to drop that baggage, so they are a bit @@ -1683,13 +1044,13 @@ Release notes for NUT 2.0.0 - what's new since 1.4.x: [Viktor T. Toth] - The newhidups driver has been merged as the first step towards - portable USB UPS support. This will eventually replace the old + portable USB UPS support. This will eventually replace the old Linux-only hidups driver. The newhidups driver is tagged experimental since it is under active development. [Arnaud Quette, Charles Lepple] - The newapc driver has been renamed to apcsmart, replacing the old - driver with that name. If you used the newapc driver, be sure to + driver with that name. If you used the newapc driver, be sure to delete the old binary and fix your ups.conf. - The apcsmart driver now supports asynchronous notification data @@ -1718,7 +1079,7 @@ Release notes for NUT 2.0.0 - what's new since 1.4.x: instcmds. - Effekta MT 2000 RM hardware is now supported by the fentonups driver. - [Christoph Moar] + [christoph moar] - The new safenet driver supports UPS hardware that uses the protocol of the same name. This includes models from many manufacturers, @@ -1782,20 +1143,20 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: - upssched now explicitly confirms reception of timer commands before exiting. This was done to avoid a race where one process would - exit right when another one was starting. The second one would - believe its command had been handled when it had been lost. + exit right when another one was starting. The second one would + believe its command had been handled when it had been lost. - upslog has been reworked to use standard getopt parsing to provide the monitoring settings. The old way of specifying arguments is still supported for backwards compatibility. upslog has also been changed to only parse the format string once, - rather than doing it every time through the loop. This should - provide a minuscule drop in CPU utilization. + rather than doing it every time through the loop. This should + provide a minuscule drop in CPU utilization. - Usernames are now required in upsmon and upsd. This means that you must add a username to your MONITOR lines in upsmon.conf and then - create a matching user in upsd.users. + create a matching user in upsd.users. Installations from the 1.2 era probably already use usernames, so this mostly affects those from 1.0 and before. @@ -1832,14 +1193,14 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: - Signal handlers no longer do any significant amount of work. Some of the programs used to do numerous things in there, raising concerns - about reentrancy. They now set flags and allow the main loop to do + about reentrancy. They now set flags and allow the main loop to do the actual work from there. - A bug in upsmon where NOTIFYFLAG settings could be ignored was fixed. - Group handling has been changed. configure no longer accepts --with-group, and the programs no longer setgid() to a hardcoded - value. They now setgid() to the primary group of whatever the + value. They now setgid() to the primary group of whatever the user value may be. This may be compiled in with --with-user as before, and many programs @@ -1866,7 +1227,7 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: battery tests were also added. - The dummyups testing driver has been removed. The dummycons testing - driver can do everything that dummyups once did and much more. + driver can do everything that dummyups once did and much more. dummycons is also now built by default for easier testing. - The newapc driver has been reworked to take advantage of the new @@ -1881,7 +1242,7 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: a shutdown sequence, and more. [Arnaud Quette] - - The mge-utalk driver had trouble establishing communications in + - The mge-utalk driver had trouble establishing communications in some cases due to the RTS line being set. This has been fixed. The mge-shut driver has been added to the tree, and has replaced @@ -1897,7 +1258,7 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: others before long. [Arnaud Quette] - - KIN-2200AP hardware is now recognized by the powercom driver. + - KIN-2200AP hardware is now recognized by the powercom driver. This change may also support other KIN-xxxxAP equipment. [Preston A. Elder] @@ -1975,7 +1336,7 @@ Release notes for NUT 1.4.0 - what's new since 1.2.x: - The inline keyword is now handled properly on systems which do not support it or have it specified as another name. This was breaking compiles on some systems. - [Petter Reinholdtsen] + [Petter Reinholdtsen] --------------------------------------------------------------------------- Release notes for NUT 1.2.2 - what's new since 1.2.1: @@ -2013,7 +1374,7 @@ Release notes for NUT 1.2.2 - what's new since 1.2.1: [Alex Cichowski] - The liebert driver also now uses debouncing logic on the status - lines. It was possible to get false readings that would start a + lines. It was possible to get false readings that would start a shutdown or just annoy users with excessive onbatt/online notify messages. The new code forces the status to settle down for 3 polls before accepting the new value. @@ -2060,7 +1421,7 @@ Release notes for NUT 1.2.2 - what's new since 1.2.1: - upsd no longer tries to reference a deleted client structure if the client disconnects at the wrong time. Previously, it tried to use - that pointer after the sendback() function had already failed on + that pointer after the sendback() function had already failed on write and deleted the client. This could cause upsd to segfault depending on what areas were accessed. [Patrik Schindler] @@ -2082,7 +1443,7 @@ Release notes for NUT 1.2.1 - what's new since 1.2.0: - The old multilink driver is back with a new name: liebert. It supports Liebert UPStation GXE hardware with the contact-closure cable. This is currently an experimental driver as there is no - way to power down the load. + way to power down the load. - configure now picks up the right flags for gd automatically if gd 2.0.8 or higher is installed. This greatly simplifies the CGI build diff --git a/README b/README index c57dd89..2aa864e 100644 --- a/README +++ b/README @@ -102,7 +102,7 @@ This package is broken down into several categories: - *clients* - They talk to upsd and do things with the status data. - *cgi-bin* - Special class of clients that you can use with your web server. - *scripts* - Contains various scripts, like the Perl and Python binding, -integration bits and applications. +integration bits and applications. Drivers ------- @@ -120,28 +120,16 @@ The entry in `ups.conf` looks like this: driver = apcsmart port = /dev/ttyS1 -To start and stop drivers, use upsdrvctl of upsdrvsvcctl (installed on -operating systems with a service management framework supported by NUT). -By default, it will start or stop every UPS in the config file: +To start and stop drivers, use upsdrvctl. By default, it will start or +stop every UPS in the config file: - /usr/local/ups/sbin/upsdrvctl start - /usr/local/ups/sbin/upsdrvctl stop + /usr/local/ups/bin/upsdrvctl start + /usr/local/ups/bin/upsdrvctl stop However, you can also just start or stop one by adding its name: - /usr/local/ups/sbin/upsdrvctl start sparky - /usr/local/ups/sbin/upsdrvctl stop sparky - -On operating systems with a supported service management framework, -you might wrap your NUT drivers into individual services instances -with: - - /usr/local/ups/sbin/upsdrvsvcctl resync - -and then manage those service instances with commands like: - - /usr/local/ups/sbin/upsdrvsvcctl start sparky - /usr/local/ups/sbin/upsdrvsvcctl stop sparky + /usr/local/ups/bin/upsdrvctl start sparky + /usr/local/ups/bin/upsdrvctl stop sparky To find the driver name for your device, refer to the section below called "HARDWARE SUPPORT TABLE". @@ -235,8 +223,8 @@ upsdrvctl can also shut down (power down) all of your UPS hardware. WARNING: if you play around with this command, expect your filesystems to die. Don't power off your computers unless they're ready for it: - /usr/local/ups/sbin/upsdrvctl shutdown - /usr/local/ups/sbin/upsdrvctl shutdown sparky + /usr/local/ups/bin/upsdrvctl shutdown + /usr/local/ups/bin/upsdrvctl shutdown sparky You should read the <> chapter to learn more about when to use this feature. If called at the wrong @@ -248,8 +236,8 @@ Power distribution unit management NUT also provides an advanced support for power distribution units. -You should read the <> -chapter to learn more about when to use this feature. +You should read the <> +chapter to learn more about when to use this feature. Network Server -------------- @@ -273,52 +261,32 @@ separate section in the documentation since it is so important. You configure it by telling it about UPSes that you want to monitor in upsmon.conf. Each UPS can be defined as one of two possible types: -a "primary" or "secondary". -Primary -~~~~~~~ +Master +~~~~~~ -The monitored UPS possibly supplies power to this system running `upsmon`, -but more importantly -- this system can manage the UPS (typically, this -instance of `upsmon` runs on the same system as the `upsd` and driver(s)): -it is capable and responsible for shutting it down when the battery is -depleted (or in another approach, lingering to deplete it or to tell the -UPS to reboot its load after too much time has elapsed and this system -is still alive -- meaning wall power returned at a "wrong" moment). +This UPS supplies power to the system running `upsmon`, and this system is also +responsible for shutting it down when the battery is depleted. This occurs +after any slave systems have disconnected safely. -The shutdown of this (primary) system itself, as well as eventually an -UPS shutdown, occurs after any secondary systems ordered to shut down -first have disconnected, or a critical urgency threshold was passed. - -If your UPS is plugged directly into a system's serial or USB port, the -`upsmon` process on that system should define its relation to that UPS -as a primary. It may be more complicated for higher-end UPSes with a -shared network management capability (typically via SNMP) or several -serial/USB ports that can be used simultaneously, and depends on what -vendors and drivers implement. Setups with several competing primaries -(for redundancy) are technically possible, if each one runs its own -full stack of NUT, but results can be random (currently NUT does not -provide a way to coordinate several entities managing the same device). +If your UPS is plugged directly into a system's serial port, the `upsmon` +process on that system should define that UPS as a master. For a typical home user, there's one computer connected to one UPS. -That means you would run on the same computer the whole NUT stack -- -a suitable driver, `upsd`, and `upsmon` in primary mode. +That means you run a driver, `upsd`, and `upsmon` in master mode. -Secondary -~~~~~~~~~ +Slave +~~~~~ -The monitored UPS may supply power to the system running `upsmon` (or -alternatively, it may be a monitoring station with zero PSUs fed by -that UPS), but more importantly, this system can't manage the UPS -- -e.g. shut it down directly (through a locally running NUT driver). +This UPS may supply power to the system running `upsmon`, but this system can't +shut it down directly. -Use this mode when you run multiple computers on the same UPS. -Obviously, only one can be connected to the serial or USB port -on a typical UPS, and that system is the primary. Everything -else is a secondary. +Use this mode when you run multiple computers on the same UPS. Obviously, only +one can be connected to the serial port on the UPS, and that system is the +master. Everything else is a slave. For a typical home user, there's one computer connected to one UPS. -That means you run a driver, `upsd`, and `upsmon` in primary mode. +That means you run a driver, upsd, and upsmon in master mode. Additional Information ~~~~~~~~~~~~~~~~~~~~~~ @@ -508,11 +476,7 @@ The past stable trees were 1.0, 1.2, 1.4, 2.0, 2.2 and 2.4, with the latest stable tree designated 2.6. The development trees were 1.1, 1.3, 1.5, 2.1 and 2.3. As of the 2.4 release, there is no real development branch anymore since the code is available through a revision control -system (namely Subversion) and snapshots. Since 2.7 line of releases, -sources are tracked in Git revision control system, with the project -ecosystem being hosted on GitHub, and improvements or other contributions -merged through common pull request approach and custom NUT CI testing -on multiple platforms. +system (namely Subversion) and snapshots. Major release jumps are mostly due to large changes to the features list. There have also been a number of architectural changes which @@ -522,11 +486,11 @@ may not be noticeable to most users, but which can impact developers. Backwards and Forwards Compatibility ------------------------------------ -The old network code spans a range from about 0.41.1 when TCP support +The old network code spans a range from about 0.41.1 when TCP support was introduced up to the recent 1.4 series. It used variable names like STATUS, UTILITY, and LOADPCT. Many of these names go back to the earliest prototypes of this software from 1997. At that point there -was no way to know that so many drivers would come along and introduce +was no way to know that so many drivers would come along and introduce so many new variables and commands. The resulting mess grew out of control over the years. @@ -558,9 +522,9 @@ Here's a table to make it easier to visualize: |============================================= Version 2.0, and more recent, do not contain backwards compatibility for -the old protocol and variable/command names. As a result, 2.0 clients can't -talk to anything older than a 1.4 server. If you ask a 2.0 client to -fetch "STATUS", it will fail. You'll have to ask for "ups.status" +the old protocol and variable/command names. As a result, 2.0 clients can't +talk to anything older than a 1.4 server. If you ask a 2.0 client to +fetch "STATUS", it will fail. You'll have to ask for "ups.status" instead. Authors of separate monitoring programs should have used the 1.4 series diff --git a/TODO b/TODO index 81a601f..1c45636 100644 --- a/TODO +++ b/TODO @@ -13,7 +13,7 @@ Roadmap ^^^ This release is focused on the website and documentation rewrite, using -the excellent link:https://asciidoc.org/[AsciiDoc]. +the excellent link:http://www.methods.co.nz/asciidoc[AsciiDoc]. 2.8 ^^^ @@ -113,6 +113,6 @@ and https://alioth.debian.org/tracker/?atid=411545&group_id=30602&func=browse[fe solar panel driver, and the powerman internal approach of a generic engine with a scripting interface is a cool idea. Ref http://powerman.svn.sourceforge.net/viewvc/powerman/trunk/etc/apcpdu.dev?revision=969&view=markup -- integrate the (future) new powerman LUA engine (maybe/must-be used for the driver above?) +- integrate the (future) new powerman LUA engine (maybe/mustbe used for the driver above?) for native PDU support - see how we can help and collaborate with DeviceKit-power diff --git a/UPGRADING b/UPGRADING index 1584e92..33e6ed5 100644 --- a/UPGRADING +++ b/UPGRADING @@ -7,187 +7,6 @@ This file lists changes that affect users who installed older versions of this software. When upgrading from an older version, be sure to check this file to see if you need to make changes to your system. -Changes from 2.7.4 to 2.8.0 ---------------------------- - -- Note to distribution packagers: this version hopefully learns from many - past mistakes, so many custom patches may be no longer needed. If some - remain, please consider making pull requests for upstream NUT codebase - to share the fixes consistently across the ecosystem. Also note that - some new types of drivers (so package groups with unique dependencies) - could have appeared since your packaging was written (e.g. with modbus), - as well as new features in systemd integration (`nut-driver@instances` - and the `nut-driver-enumerator` to manage their population), as well as - updated Python 2 and Python 3 support (again, maybe dictating different - package groups) as detailed below. - -- 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. - -- libusb-1.0: NUT now defaults to building against libusb-1.0 API version - if the configure script finds the development headers, falling back to - libusb-0.1 if not. Please report any regressions. - -- apcupsd-ups: When monitoring a remote apcupsd server, interpret "SHUTTING - DOWN" as a NUT "LB" status. If you were relying on the previous behavior - (for instance, in a monitor-only situation), please adjust your upsmon - settings. Reference: https://github.com/networkupstools/nut/issues/460 - -- Packagers: 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). Please double-check that we did not - break anything (see docs/configure.txt for options). - -- Driver core: options added for standalone mode (scanning for devices without - requiring ups.conf) - see docs/man/nutupsdrv.txt for details. - -- oldmge-shut has been removed, and replaced by mge-shut. - -- New drivers for devices with "Qx" (also known as "Megatec Q*") family of - protocols should be developed as sub-drivers in the `nutdrv_qx` framework - for USB and Serial connected devices, not as updates/clones of older e.g. - `blazer` family and `bestups`. Sources, man pages and start-up messages - of such older drivers were marked with "OBSOLETION WARNING". - -- liebert-esp2: some multi-phase variable names have been updated to match the - rest of NUT. - -- netxml-ups: if you have old firmware, or were relying on values being off by - a factor of 10, consider the `do_convert_deci` flag. See - docs/man/netxml-ups.txt for details. - -- snmp-ups: detection of Net-SNMP has been updated to use `pkg-config` by - default (if present), rather than `net-snmp-config(-32|-64)` script(s) as - the only option available previously. The scripts tend to specify a lot - of options (sometimes platform-specific) in suggested `CFLAGS` and `LIBS` - compared to the packaged `pkg-config` information which also works and is - more portable. If this change bites your distribution, please bring it up - in https://github.com/networkupstools/nut/issues or better yet, post a PR. - Also note that `./configure --with-netsnmp-config(=yes)` should set up the - preference of the detected script over `pkg-config` information, if both - are available, and `--with-netsnmp-config=/path/name` would as well. - -- snmp-ups: bit mask values for flags in earlier codebase were defined in a - way that caused logically different items to have same numeric values. - This was fixed to surely use different definitions (so changing numbers - behind some of those macro symbols), and testing with UPS, ePDU and ATS - hardware which was available did not expose any practical differences. - -- usbhid-ups: numeric data conversion from wire protocol to CPU representation - in GetValue() was completely reworked, aiming to be correct on all CPU types. - That said, regressions are possible and feedback is welcome. - -- nut-scanner: Packagers, take note of the changes to the library - search code in common/common.c. Please file an issue if this does not work - with your platform. - -- 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] - - * Note this can break third-party test scripts which expected `*.dev` - files to work as a looping sequence with a `TIMER` keywords to change - values slowly; now such files should get processed to the end once. - Specify `mode=dummy-loop` driver option or rename the data file used - in the `port` option for legacy behavior. - Use/Test-cases which modified such files content externally should - not be impacted. - -- Python: scripts have been updated to work with Python 3 as well as 2. - - * PyNUT module (protocol binding) supports both Python generations. - - * NUT-Monitor (desktop UI client) got separated into two projects: - one with support for Python2 and GTK2, and another for Python3 and Qt5. - On operating systems that serve both environments, either of these - implementation should be usable. For distributions that deprecated - and removed Python2 support, it is a point to consider in NUT packages - and their build-time and installation dependencies. - The historic filenames for desktop integration (`NUT-Monitor` script - and `nut-monitor.desktop`) are still delivered, but now cover a wrapper - script which detects the environment capabilities and launches the best - suitable UI implementation (if both are available). - -- apcsmart: updates to CS "hack" (see docs/man/apcsmart.txt for details) - -- upsdebugx(): added `[D#]` prefix to log entries with level > 0 - so if any scripts or other tools relied on parsing those messages - making some assumptions, they should be updated - -- upsdebugx() and related methods are now macros, optionally calling similarly - named implementations like s_upsdebugx() as a slight optimization; this may - show up in linking of binaries for some customized build scenarios - -- libraries, tools and protocol now support a `TRACKING` ID to be used with - an `INSTCMD` or `SET VAR` requests; for details see docs/net-protocol.txt - and docs/sock-protocol.txt - -- upsrw: display the variable type beside ENUM / RANGE - -- Augeas: new `--with-augeas-lenses-dir` configure option. - -Changes from 2.7.3 to 2.7.4 ---------------------------- - -- scripts/systemd/nut-server.service.in: Restore systemd relationship since it - was preventing upsd from starting whenever one or more drivers, among several, - was failing to start - -- Fix UPower device matching for recent kernels, since hiddev* devices now have - class "usbmisc", rather than "usb" - -- macosx-ups: the "port" driver option no longer has any effect - -- Network protocol information: default to type NUMBER for variables that are - not flagged as STRING . This point is subject to improvements or change in - the next release 2.7.5. Refer to docs/net-protocol.txt for more information - -Changes from 2.7.2 to 2.7.3 ---------------------------- - -- The linkman:nutdrv_qx[8] driver will eventually supersede linkman:bestups[8]. - It has been tested on a U-series Patriot Pro II. Please test the new driver - on your hardware during your next maintenance window, and report any bugs. - -- If you are upgrading from a new install of 2.7.1 or 2.7.2, double-check the - value of POWERDOWNFLAG in $prefix/etc/upsmon.conf - it has been restored to - /etc/killpower as in 2.6.5 and earlier. - -- If you use upslog with a large sleep value, you may be interested in adding - `killall -SIGUSR1 upslog` to any OB/OL script actions. This will force - upslog to write a log entry to catch short power transients. - -- Be sure that your SSL keys are readable by the NUT system user. The SSL - subsystem is now initialized after `upsd` forks, to work around issues in the - NSS library. - -- The systemd nut-server.service does not Require nut-driver to be started - successfully. This was previously preventing upsd startup, even for just - one driver failure among many. This also matches the behavior of sysV - initscripts. - -Changes from 2.7.1 to 2.7.2 ---------------------------- - -- upsdrvctl is now installed to $prefix/sbin rather than $driverexec. - This usually means moving from /bin to /sbin, apart from few exceptions. - In all cases, please adapt your scripts. - -- FreeDesktop Hardware Abstraction Layer (HAL) support was removed. - Please adapt your packaging files, if you used to distribute the - nut-hal-drivers package. - -- This is a good time to point out that for stricter packaging systems, it may - be beneficial to add "--enable-option-checking=fatal" to the ./configure - command line, in order to quickly pick up any other removed option flags. - Changes from 2.6.5 to 2.7.1 --------------------------- @@ -297,7 +116,7 @@ Changes from 2.2.1 to 2.2.2 This enable the additional build and distribution of the static version of libupsclient, along with the pkg-config helper and manual pages. The default configure option is to distribute only the shared -version of libupsclient. This can be overridden by using the +version of libupsclient. This can be overriden by using the "--disable-shared" configure option (distribute static only binaries). - The UPS poweroff handling of the usbhid-ups driver has been reworked. Though regression is not expected, users of this driver are @@ -308,7 +127,7 @@ Changes from 2.2.0 to 2.2.1 --------------------------- - nothing that affects upgraded systems. -(The below message is repeated due to previous omission) +(The below message is repetead due to previous omission) - Developers of external client application using libupsclient are encouraged to rename their "UPSCONN" client structure to "UPSCONN_t" since the former will disappear by the release of NUT 2.4. @@ -333,7 +152,7 @@ automake). Refer to packaging/debian/ for an example of migration. ie not using upsdrvctl. - Developers of external client application using libupsclient are encouraged to rename the "UPSCONN" client structure to "UPSCONN_t" -since the former will disappear by the release of NUT 2.4. +since the former will disapear by the release of NUT 2.4. Changes from 2.0.4 to 2.0.5 --------------------------- diff --git a/aclocal.m4 b/aclocal.m4 index ee7ee0a..f22b2ab 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,8 @@ -# generated automatically by aclocal 1.16.3 -*- Autoconf -*- - -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# generated automatically by aclocal 1.11.6 -*- Autoconf -*- +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, +# Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,72 +12,147 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically 'autoreconf'.])]) +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 12 (pkg-config-0.29.2) +# longlong.m4 serial 14 +dnl Copyright (C) 1999-2007, 2009-2010 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. -dnl Copyright © 2004 Scott James Remnant . -dnl Copyright © 2012-2015 Dan Nicholson -dnl -dnl This program is free software; you can redistribute it and/or modify -dnl it under the terms of the GNU General Public License as published by -dnl the Free Software Foundation; either version 2 of the License, or -dnl (at your option) any later version. -dnl -dnl This program is distributed in the hope that it will be useful, but -dnl WITHOUT ANY WARRANTY; without even the implied warranty of -dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -dnl General Public License for more details. -dnl -dnl You should have received a copy of the GNU General Public License -dnl along with this program; if not, write to the Free Software -dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -dnl 02111-1307, USA. -dnl -dnl As a special exception to the GNU General Public License, if you -dnl distribute this file as part of a program that contains a -dnl configuration script generated by Autoconf, you may include it under -dnl the same distribution terms that you use for the rest of that -dnl program. +dnl From Paul Eggert. -dnl PKG_PREREQ(MIN-VERSION) -dnl ----------------------- -dnl Since: 0.29 -dnl -dnl Verify that the version of the pkg-config macros are at least -dnl MIN-VERSION. Unlike PKG_PROG_PKG_CONFIG, which checks the user's -dnl installed version of pkg-config, this checks the developer's version -dnl of pkg.m4 when generating configure. -dnl -dnl To ensure that this macro is defined, also add: -dnl m4_ifndef([PKG_PREREQ], -dnl [m4_fatal([must install pkg-config 0.29 or later before running autoconf/autogen])]) -dnl -dnl See the "Since" comment for each macro you use to see what version -dnl of the macros you require. -m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.2]) -m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, - [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) -])dnl PKG_PREREQ +# Define HAVE_LONG_LONG_INT if 'long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. -dnl PKG_PROG_PKG_CONFIG([MIN-VERSION]) -dnl ---------------------------------- -dnl Since: 0.16 -dnl -dnl Search for the pkg-config tool and set the PKG_CONFIG variable to -dnl first found in the path. Checks that the version of pkg-config found -dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is -dnl used since that's the first version where most current features of -dnl pkg-config existed. +# Note: If the type 'long long int' exists but is only 32 bits large +# (as on some very old compilers), HAVE_LONG_LONG_INT will not be +# defined. In this case you can treat 'long long int' like 'long int'. + +AC_DEFUN([AC_TYPE_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for long long int], [ac_cv_type_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [dnl This catches a bug in Tandem NonStop Kernel (OSS) cc -O circa 2004. + dnl If cross compiling, assume the bug isn't important, since + dnl nobody cross compiles for this platform as far as we know. + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[@%:@include + @%:@ifndef LLONG_MAX + @%:@ define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + @%:@ define LLONG_MAX (HALF - 1 + HALF) + @%:@endif]], + [[long long int n = 1; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0;]])], + [ac_cv_type_long_long_int=yes], + [ac_cv_type_long_long_int=no], + [ac_cv_type_long_long_int=yes])], + [ac_cv_type_long_long_int=no])]) + if test $ac_cv_type_long_long_int = yes; then + AC_DEFINE([HAVE_LONG_LONG_INT], [1], + [Define to 1 if the system has the type `long long int'.]) + fi +]) + +# Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works. +# This fixes a bug in Autoconf 2.61, but can be removed once we +# assume 2.62 everywhere. + +# Note: If the type 'unsigned long long int' exists but is only 32 bits +# large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT +# will not be defined. In this case you can treat 'unsigned long long int' +# like 'unsigned long int'. + +AC_DEFUN([AC_TYPE_UNSIGNED_LONG_LONG_INT], +[ + AC_CACHE_CHECK([for unsigned long long int], + [ac_cv_type_unsigned_long_long_int], + [AC_LINK_IFELSE( + [_AC_TYPE_LONG_LONG_SNIPPET], + [ac_cv_type_unsigned_long_long_int=yes], + [ac_cv_type_unsigned_long_long_int=no])]) + if test $ac_cv_type_unsigned_long_long_int = yes; then + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], + [Define to 1 if the system has the type `unsigned long long int'.]) + fi +]) + +# Expands to a C program that can be used to test for simultaneous support +# of 'long long' and 'unsigned long long'. We don't want to say that +# 'long long' is available if 'unsigned long long' is not, or vice versa, +# because too many programs rely on the symmetry between signed and unsigned +# integer types (excluding 'bool'). +AC_DEFUN([_AC_TYPE_LONG_LONG_SNIPPET], +[ + AC_LANG_PROGRAM( + [[/* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63;]], + [[/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull));]]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# serial 1 (pkg-config-0.24) +# +# Copyright © 2004 Scott James Remnant . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$]) @@ -98,19 +174,18 @@ if test -n "$PKG_CONFIG"; then PKG_CONFIG="" fi fi[]dnl -])dnl PKG_PROG_PKG_CONFIG +])# PKG_PROG_PKG_CONFIG -dnl PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------------------------------- -dnl Since: 0.18 -dnl -dnl Check to see whether a particular set of modules exists. Similar to -dnl PKG_CHECK_MODULES(), but does not set variables or print errors. -dnl -dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -dnl only at the first occurence in configure.ac, so if the first place -dnl it's called might be skipped (such as if it is within an "if", you -dnl have to call PKG_CHECK_EXISTS manually +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +# only at the first occurence in configure.ac, so if the first place +# it's called might be skipped (such as if it is within an "if", you +# have to call PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ @@ -120,10 +195,8 @@ m4_ifvaln([$3], [else $3])dnl fi]) -dnl _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) -dnl --------------------------------------------- -dnl Internal wrapper calling pkg-config via PKG_CONFIG and setting -dnl pkg_failed based on the result. +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" @@ -135,11 +208,10 @@ m4_define([_PKG_CONFIG], else pkg_failed=untried fi[]dnl -])dnl _PKG_CONFIG +])# _PKG_CONFIG -dnl _PKG_SHORT_ERRORS_SUPPORTED -dnl --------------------------- -dnl Internal check to see if pkg-config supports short errors. +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -147,24 +219,26 @@ if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then else _pkg_short_errors_supported=no fi[]dnl -])dnl _PKG_SHORT_ERRORS_SUPPORTED +])# _PKG_SHORT_ERRORS_SUPPORTED -dnl PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl -------------------------------------------------------------- -dnl Since: 0.4.0 -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES might not happen, you should be sure to include an -dnl explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $2]) +AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -174,11 +248,11 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs @@ -195,7 +269,7 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -211,107 +285,27 @@ else AC_MSG_RESULT([yes]) $3 fi[]dnl -])dnl PKG_CHECK_MODULES +])# PKG_CHECK_MODULES - -dnl PKG_CHECK_MODULES_STATIC(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], -dnl [ACTION-IF-NOT-FOUND]) -dnl --------------------------------------------------------------------- -dnl Since: 0.29 -dnl -dnl Checks for existence of MODULES and gathers its build flags with -dnl static libraries enabled. Sets VARIABLE-PREFIX_CFLAGS from --cflags -dnl and VARIABLE-PREFIX_LIBS from --libs. -dnl -dnl Note that if there is a possibility the first call to -dnl PKG_CHECK_MODULES_STATIC might not happen, you should be sure to -dnl include an explicit call to PKG_PROG_PKG_CONFIG in your -dnl configure.ac. -AC_DEFUN([PKG_CHECK_MODULES_STATIC], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -_save_PKG_CONFIG=$PKG_CONFIG -PKG_CONFIG="$PKG_CONFIG --static" -PKG_CHECK_MODULES($@) -PKG_CONFIG=$_save_PKG_CONFIG[]dnl -])dnl PKG_CHECK_MODULES_STATIC - - -dnl PKG_INSTALLDIR([DIRECTORY]) -dnl ------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable pkgconfigdir as the location where a module -dnl should install pkg-config .pc files. By default the directory is -dnl $libdir/pkgconfig, but the default can be changed by passing -dnl DIRECTORY. The user can override through the --with-pkgconfigdir -dnl parameter. -AC_DEFUN([PKG_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([pkgconfigdir], - [AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],, - [with_pkgconfigdir=]pkg_default) -AC_SUBST([pkgconfigdir], [$with_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_INSTALLDIR - - -dnl PKG_NOARCH_INSTALLDIR([DIRECTORY]) -dnl -------------------------------- -dnl Since: 0.27 -dnl -dnl Substitutes the variable noarch_pkgconfigdir as the location where a -dnl module should install arch-independent pkg-config .pc files. By -dnl default the directory is $datadir/pkgconfig, but the default can be -dnl changed by passing DIRECTORY. The user can override through the -dnl --with-noarch-pkgconfigdir parameter. -AC_DEFUN([PKG_NOARCH_INSTALLDIR], -[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])]) -m4_pushdef([pkg_description], - [pkg-config arch-independent installation directory @<:@]pkg_default[@:>@]) -AC_ARG_WITH([noarch-pkgconfigdir], - [AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],, - [with_noarch_pkgconfigdir=]pkg_default) -AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir]) -m4_popdef([pkg_default]) -m4_popdef([pkg_description]) -])dnl PKG_NOARCH_INSTALLDIR - - -dnl PKG_CHECK_VAR(VARIABLE, MODULE, CONFIG-VARIABLE, -dnl [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -dnl ------------------------------------------- -dnl Since: 0.28 -dnl -dnl Retrieves the value of the pkg-config variable for the given module. -AC_DEFUN([PKG_CHECK_VAR], -[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl -AC_ARG_VAR([$1], [value of $3 for $2, overriding pkg-config])dnl - -_PKG_CONFIG([$1], [variable="][$3]["], [$2]) -AS_VAR_COPY([$1], [pkg_cv_][$1]) - -AS_VAR_IF([$1], [""], [$5], [$4])dnl -])dnl PKG_CHECK_VAR - -# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software +# Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], -[am__api_version='1.16' +[am__api_version='1.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.16.3], [], +m4_if([$1], [1.11.6], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -327,22 +321,24 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.16.3])dnl +[AM_AUTOMAKE_VERSION([1.11.6])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets -# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to -# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and @@ -361,7 +357,7 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually -# harmless because $srcdir is '.', but things will broke when you +# harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, @@ -379,26 +375,30 @@ _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], -[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 9 + # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], -[AC_PREREQ([2.52])dnl - m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], - [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl @@ -417,14 +417,16 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, +# 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 12 -# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing @@ -434,7 +436,7 @@ fi])]) # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. -# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was @@ -447,13 +449,12 @@ AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl -m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], - [$1], [CXX], [depcc="$CXX" am_compiler_list=], - [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], - [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], - [$1], [UPC], [depcc="$UPC" am_compiler_list=], - [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], - [depcc="$$1" am_compiler_list=]) +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], @@ -461,8 +462,8 @@ AC_CACHE_CHECK([dependency style of $depcc], # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -502,16 +503,16 @@ AC_CACHE_CHECK([dependency style of $depcc], : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with '-c' and '-o' for the sake of the "dashmstdout" + # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -520,8 +521,8 @@ AC_CACHE_CHECK([dependency style of $depcc], test "$am__universal" = false || continue ;; nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else @@ -529,7 +530,7 @@ AC_CACHE_CHECK([dependency style of $depcc], fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has + # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -577,7 +578,7 @@ AM_CONDITIONAL([am__fastdep$1], [ # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. -# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl @@ -587,13 +588,9 @@ AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], -[AC_ARG_ENABLE([dependency-tracking], [dnl -AS_HELP_STRING( - [--enable-dependency-tracking], - [do not reject slow dependency extractors]) -AS_HELP_STRING( - [--disable-dependency-tracking], - [speeds up one-time build])]) +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' @@ -608,56 +605,67 @@ _AM_SUBST_NOTMAKE([am__nodep])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +#serial 5 + # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ - # Older Autoconf quotes --file arguments for eval, but not when files + # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - # TODO: see whether this extra hack can be removed once we start - # requiring Autoconf 2.70 or later. - AS_CASE([$CONFIG_FILES], - [*\'*], [eval set x "$CONFIG_FILES"], - [*], [set x $CONFIG_FILES]) + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac shift - # Used to flag and report bootstrapping failures. - am_rc=0 - for am_mf + for mf do # Strip MF so we end up with the name of the file. - am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile which includes - # dependency-tracking related rules and includes. - # Grep'ing the whole file directly is not great: AIX grep has a line + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ - || continue - am_dirpart=`AS_DIRNAME(["$am_mf"])` - am_filepart=`AS_BASENAME(["$am_mf"])` - AM_RUN_LOG([cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles]) || am_rc=$? + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done done - if test $am_rc -ne 0; then - AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. If GNU make was not used, consider - re-running the configure script with MAKE="gmake" (or whatever is - necessary). You can also try re-running configure with the - '--disable-dependency-tracking' option to at least be able to build - the package (albeit without support for automatic dependency tracking).]) - fi - AS_UNSET([am_dirpart]) - AS_UNSET([am_filepart]) - AS_UNSET([am_mf]) - AS_UNSET([am_rc]) - rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -666,31 +674,29 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # -# This code is only required when automatic dependency tracking is enabled. -# This creates each '.Po' and '.Plo' makefile fragment that we'll need in -# order to bootstrap the dependency handling code. +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], - [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) # Do all the work for Automake. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 16 + # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. -dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. -m4_define([AC_PROG_CC], -m4_defn([AC_PROG_CC]) -[_AM_PROG_CC_C_O -]) - # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- @@ -703,7 +709,7 @@ m4_defn([AC_PROG_CC]) # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], -[AC_PREREQ([2.65])dnl +[AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl @@ -732,42 +738,33 @@ AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], -[AC_DIAGNOSE([obsolete], - [$0: two- and three-arguments forms are deprecated.]) -m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. -m4_if( - m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), - [ok:ok],, +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, -[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) - AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl -AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) -AM_MISSING_PROG([AUTOCONF], [autoconf]) -AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) -AM_MISSING_PROG([AUTOHEADER], [autoheader]) -AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl -AC_REQUIRE([AC_PROG_MKDIR_P])dnl -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -AC_SUBST([mkdir_p], ['$(MKDIR_P)']) -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl @@ -776,82 +773,34 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], - [_AM_DEPENDENCIES([CC])], - [m4_define([AC_PROG_CC], - m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], - [_AM_DEPENDENCIES([CXX])], - [m4_define([AC_PROG_CXX], - m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], - [_AM_DEPENDENCIES([OBJC])], - [m4_define([AC_PROG_OBJC], - m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl -AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], - [_AM_DEPENDENCIES([OBJCXX])], - [m4_define([AC_PROG_OBJCXX], - m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) -AC_REQUIRE([AM_SILENT_RULES])dnl -dnl The testsuite driver may need to know about EXEEXT, so add the -dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This -dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl - -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) - fi -fi -dnl The trailing newline in this macro's definition is deliberate, for -dnl backward compatibility and to allow trailing 'dnl'-style comments -dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) -dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. @@ -873,18 +822,21 @@ for _am_header in $config_headers :; do done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -if test x"${install_sh+set}" != xset; then +if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -892,14 +844,16 @@ if test x"${install_sh+set}" != xset; then install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi -AC_SUBST([install_sh])]) +AC_SUBST(install_sh)]) -# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], @@ -916,17 +870,20 @@ AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008, +# 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 5 + # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. -# Default is to disable them, unless 'enable' is passed literally. -# For symmetry, 'disable' may be passed as well. Anyway, the user +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), @@ -937,11 +894,10 @@ AC_DEFUN([AM_MAINTAINER_MODE], AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], - [AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode], - am_maintainer_other[ make rules and dependencies not useful - (and sometimes confusing) to the casual installer])], - [USE_MAINTAINER_MODE=$enableval], - [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE @@ -949,57 +905,106 @@ AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) ] ) +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + # Check to see how 'make' treats includes. -*- Autoconf -*- -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 4 + # AM_MAKE_INCLUDE() # ----------------- -# Check whether make has an 'include' directive that can support all -# the idioms we need for our automatic dependency tracking code. +# Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], -[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) -cat > confinc.mk << 'END' +[am_make=${MAKE-make} +cat > confinc << 'END' am__doit: - @echo this is the am__doit target >confinc.out + @echo this is the am__doit target .PHONY: am__doit END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= -# BSD make does it like this. -echo '.include "confinc.mk" # ignored' > confmf.BSD -# Other make implementations (GNU, Solaris 10, AIX) do it like this. -echo 'include confinc.mk # ignored' > confmf.GNU -_am_result=no -for s in GNU BSD; do - AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) - AS_CASE([$?:`cat confinc.out 2>/dev/null`], - ['0:this is the am__doit target'], - [AS_CASE([$s], - [BSD], [am__include='.include' am__quote='"'], - [am__include='include' am__quote=''])]) - if test "$am__include" != "#"; then - _am_result="yes ($s style)" - break - fi -done -rm -f confinc.* confmf.* -AC_MSG_RESULT([${_am_result}]) -AC_SUBST([am__include])]) -AC_SUBST([am__quote])]) +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) -# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- - -# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], @@ -1007,33 +1012,71 @@ AC_DEFUN([AM_MISSING_PROG], $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) + # AM_MISSING_HAS_RUN # ------------------ -# Define MISSING if not defined so far and test if it is modern enough. -# If it is, set am_missing_run to use it, otherwise, to nothing. +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac fi # Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " else am_missing_run= - AC_MSG_WARN(['missing' script is too old or missing]) + AC_MSG_WARN([`missing' script is too old or missing]) fi ]) -# Helper functions for option handling. -*- Autoconf -*- - -# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, +# Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 1 + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software +# Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], @@ -1043,7 +1086,7 @@ AC_DEFUN([_AM_MANGLE_OPTION], # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], -[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ @@ -1057,82 +1100,24 @@ AC_DEFUN([_AM_SET_OPTIONS], AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) -# Copyright (C) 1999-2020 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# _AM_PROG_CC_C_O -# --------------- -# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC -# to automatically call this. -AC_DEFUN([_AM_PROG_CC_C_O], -[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl -AC_REQUIRE_AUX_FILE([compile])dnl -AC_LANG_PUSH([C])dnl -AC_CACHE_CHECK( - [whether $CC understands -c and -o together], - [am_cv_prog_cc_c_o], - [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i]) -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -AC_LANG_POP([C])]) - -# For backward compatibility. -AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) - -# Copyright (C) 2001-2020 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# AM_RUN_LOG(COMMAND) -# ------------------- -# Run COMMAND, save the exit status in ac_status, and log it. -# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) -AC_DEFUN([AM_RUN_LOG], -[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD - ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - (exit $ac_status); }]) - # Check to make sure that the build environment is sane. -*- Autoconf -*- -# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 5 + # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -1143,40 +1128,32 @@ case `pwd` in esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) - AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac -# Do 'set' in a subshell so we don't clobber the current shell's +# Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$[*]" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$[*]" != "X $srcdir/configure conftest.file" \ - && test "$[*]" != "X conftest.file $srcdir/configure"; then + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken - alias in your environment]) - fi - if test "$[2]" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done test "$[2]" = conftest.file ) then @@ -1186,118 +1163,46 @@ else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi -AC_MSG_RESULT([yes]) -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi -AC_CONFIG_COMMANDS_PRE( - [AC_MSG_CHECKING([that generated files are newer than configure]) - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - AC_MSG_RESULT([done])]) -rm -f conftest.file -]) +AC_MSG_RESULT(yes)]) -# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# AM_SILENT_RULES([DEFAULT]) -# -------------------------- -# Enable less verbose build rules; with the default set to DEFAULT -# ("yes" being less verbose, "no" or empty being verbose). -AC_DEFUN([AM_SILENT_RULES], -[AC_ARG_ENABLE([silent-rules], [dnl -AS_HELP_STRING( - [--enable-silent-rules], - [less verbose build output (undo: "make V=1")]) -AS_HELP_STRING( - [--disable-silent-rules], - [verbose build output (undo: "make V=0")])dnl -]) -case $enable_silent_rules in @%:@ ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; -esac -dnl -dnl A few 'make' implementations (e.g., NonStop OS and NextStep) -dnl do not support nested variable expansions. -dnl See automake bug#9928 and bug#10237. -am_make=${MAKE-make} -AC_CACHE_CHECK([whether $am_make supports nested variables], - [am_cv_make_support_nested_variables], - [if AS_ECHO([['TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi]) -if test $am_cv_make_support_nested_variables = yes; then - dnl Using '$V' instead of '$(V)' breaks IRIX make. - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AC_SUBST([AM_V])dnl -AM_SUBST_NOTMAKE([AM_V])dnl -AC_SUBST([AM_DEFAULT_V])dnl -AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl -AC_SUBST([AM_DEFAULT_VERBOSITY])dnl -AM_BACKSLASH='\' -AC_SUBST([AM_BACKSLASH])dnl -_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl -]) - -# Copyright (C) 2001-2020 Free Software Foundation, Inc. -# -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. +# serial 1 # AM_PROG_INSTALL_STRIP # --------------------- -# One issue with vendor 'install' (even GNU) is that you can't +# One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we -# always use install-sh in "make install-strip", and initialize +# always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. -dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) -# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 3 + # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. @@ -1311,16 +1216,18 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- -# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. +# serial 2 + # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. -# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory @@ -1330,123 +1237,81 @@ AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar -# AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' - m4_if([$1], [v7], - [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac - [m4_case([$1], - [ustar], - [# The POSIX 1988 'ustar' format is defined with fixed-size fields. - # There is notably a 21 bits limit for the UID and the GID. In fact, - # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 - # and bug#13588). - am_max_uid=2097151 # 2^21 - 1 - am_max_gid=$am_max_uid - # The $UID and $GID variables are not portable, so we need to resort - # to the POSIX-mandated id(1) utility. Errors in the 'id' calls - # below are definitely unexpected, so allow the users to see them - # (that is, avoid stderr redirection). - am_uid=`id -u || echo unknown` - am_gid=`id -g || echo unknown` - AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) - if test $am_uid -le $am_max_uid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi - AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) - if test $am_gid -le $am_max_gid; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - _am_tools=none - fi], + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break - [pax], - [], - - [m4_fatal([Unknown tar format])]) - - AC_MSG_CHECKING([how to create a $1 tar archive]) - - # Go ahead even if we have the value already cached. We do so because we - # need to set the values for the 'am__tar' and 'am__untar' variables. - _am_tools=${am_cv_prog_tar_$1-$_am_tools} - - for _am_tool in $_am_tools; do - case $_am_tool in - gnutar) - for _am_tar in tar gnutar gtar; do - AM_RUN_LOG([$_am_tar --version]) && break - done - am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' - am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' - am__untar="$_am_tar -xf -" - ;; - plaintar) - # Must skip GNU tar: if it does not support --format= it doesn't create - # ustar tarball either. - (tar --version) >/dev/null 2>&1 && continue - am__tar='tar chf - "$$tardir"' - am__tar_='tar chf - "$tardir"' - am__untar='tar xf -' - ;; - pax) - am__tar='pax -L -x $1 -w "$$tardir"' - am__tar_='pax -L -x $1 -w "$tardir"' - am__untar='pax -r' - ;; - cpio) - am__tar='find "$$tardir" -print | cpio -o -H $1 -L' - am__tar_='find "$tardir" -print | cpio -o -H $1 -L' - am__untar='cpio -i -H $1 -d' - ;; - none) - am__tar=false - am__tar_=false - am__untar=false - ;; - esac - - # If the value was cached, stop now. We just wanted to have am__tar - # and am__untar set. - test -n "${am_cv_prog_tar_$1}" && break - - # tar/untar a dummy directory, and stop if the command works. - rm -rf conftest.dir - mkdir conftest.dir - echo GrepMe > conftest.dir/file - AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) - rm -rf conftest.dir - if test -s conftest.tar; then - AM_RUN_LOG([$am__untar /dev/null 2>&1 && break - fi - done + # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir - AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) - AC_MSG_RESULT([$am_cv_prog_tar_$1])]) - +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR -m4_include([m4/ax_c___attribute__.m4]) -m4_include([m4/ax_c_pragmas.m4]) -m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/ax_compare_version.m4]) -m4_include([m4/ax_run_or_link_ifelse.m4]) m4_include([m4/libtool.m4]) m4_include([m4/ltoptions.m4]) m4_include([m4/ltsugar.m4]) @@ -1454,13 +1319,11 @@ m4_include([m4/ltversion.m4]) m4_include([m4/lt~obsolete.m4]) m4_include([m4/nut_arg_with.m4]) m4_include([m4/nut_check_asciidoc.m4]) -m4_include([m4/nut_check_cppcheck.m4]) -m4_include([m4/nut_check_headers_windows.m4]) m4_include([m4/nut_check_libavahi.m4]) m4_include([m4/nut_check_libfreeipmi.m4]) m4_include([m4/nut_check_libgd.m4]) +m4_include([m4/nut_check_libhal.m4]) m4_include([m4/nut_check_libltdl.m4]) -m4_include([m4/nut_check_libmodbus.m4]) m4_include([m4/nut_check_libneon.m4]) m4_include([m4/nut_check_libnetsnmp.m4]) m4_include([m4/nut_check_libnss.m4]) @@ -1469,10 +1332,6 @@ m4_include([m4/nut_check_libpowerman.m4]) m4_include([m4/nut_check_libusb.m4]) m4_include([m4/nut_check_libwrap.m4]) m4_include([m4/nut_check_os.m4]) -m4_include([m4/nut_check_pkgconfig.m4]) -m4_include([m4/nut_check_python.m4]) -m4_include([m4/nut_compiler_family.m4]) -m4_include([m4/nut_func_getnameinfo_argtypes.m4]) +m4_include([m4/nut_config_libhal.m4]) m4_include([m4/nut_report_feature.m4]) -m4_include([m4/nut_stash_warnings.m4]) m4_include([m4/nut_type_socklen_t.m4]) diff --git a/clients/Makefile.am b/clients/Makefile.am index e9d7e3c..7199ec2 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -1,19 +1,7 @@ # Network UPS Tools: clients -EXTRA_DIST = - -# nutclient.cpp for some legacy reason (maybe initial detached development?) -# optionally includes "common.h" with the NUT build setup - and this option -# was never triggered in fact, not until pushed through command line like this: -AM_CXXFLAGS = -DHAVE_NUTCOMMON=1 -I$(top_srcdir)/include - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libcommonclient.la \ -$(top_builddir)/common/libparseconf.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) # by default, link programs in this directory with libcommon.a -LDADD = $(top_builddir)/common/libcommon.la libupsclient.la $(NETLIBS) +LDADD = ../common/libcommon.la libupsclient.la $(NETLIBS) if WITH_SSL LDADD += $(LIBSSL_LIBS) endif @@ -32,13 +20,9 @@ endif bin_PROGRAMS = upsc upslog upsrw upscmd dist_bin_SCRIPTS = upssched-cmd sbin_PROGRAMS = upsmon upssched -lib_LTLIBRARIES = libupsclient.la -if HAVE_CXX11 - lib_LTLIBRARIES += libnutclient.la - lib_LTLIBRARIES += libnutclientstub.la -endif +lib_LTLIBRARIES = libupsclient.la libnutclient.la if WITH_DEV - include_HEADERS = upsclient.h ../include/parseconf.h nutclient.h nutclientmem.h + include_HEADERS = upsclient.h ../include/parseconf.h nutclient.h endif if WITH_CGI cgiexec_PROGRAMS = upsstats.cgi upsimage.cgi upsset.cgi @@ -51,7 +35,7 @@ upslog_SOURCES = upslog.c upsclient.h upslog.h upsmon_SOURCES = upsmon.c upsmon.h upsclient.h upssched_SOURCES = upssched.c upssched.h -upssched_LDADD = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la $(NETLIBS) +upssched_LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) upsimage_cgi_SOURCES = upsimage.c upsclient.h upsimagearg.h cgilib.c cgilib.h upsimage_cgi_LDADD = $(LDADD) $(LIBGD_LDFLAGS) @@ -62,44 +46,14 @@ upsstats_cgi_SOURCES = upsstats.c upsclient.h status.h upsstats.h \ # not LDADD. libupsclient_la_SOURCES = upsclient.c upsclient.h -libupsclient_la_LIBADD = $(top_builddir)/common/libcommonclient.la +libupsclient_la_LIBADD = ../common/libparseconf.la if WITH_SSL libupsclient_la_LIBADD += $(LIBSSL_LIBS) endif -# Below we set API versions of public libraries -# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -# Note that changes here may have to be reflected in packaging (the shared -# object .so names would differ) - # libupsclient version information -libupsclient_la_LDFLAGS = -version-info 6:0:0 -export-symbols-regex ^upscli_ +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +libupsclient_la_LDFLAGS = -version-info 3:1:0 -if HAVE_CXX11 -# libnutclient version information and build libnutclient_la_SOURCES = nutclient.h nutclient.cpp -libnutclient_la_LDFLAGS = -version-info 2:0:0 -# Needed in not-standalone builds with -DHAVE_NUTCOMMON=1 -# which is defined for in-tree CXX builds above: -libnutclient_la_LIBADD = $(top_builddir)/common/libcommonclient.la -else -EXTRA_DIST += nutclient.h nutclient.cpp -endif -if HAVE_CXX11 -# libnutclientstub version information and build -libnutclientstub_la_SOURCES = nutclientmem.h nutclientmem.cpp -libnutclientstub_la_LDFLAGS = -version-info 1:0:0 -libnutclientstub_la_LIBADD = libnutclient.la -else -EXTRA_DIST += nutclientmem.h nutclientmem.cpp -endif - -dummy: - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps diff --git a/clients/Makefile.in b/clients/Makefile.in index e7cb07e..67554eb 100644 --- a/clients/Makefile.in +++ b/clients/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,65 +15,29 @@ @SET_MAKE@ +# Network UPS Tools: clients + VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -98,31 +63,24 @@ target_triplet = @target@ bin_PROGRAMS = upsc$(EXEEXT) upslog$(EXEEXT) upsrw$(EXEEXT) \ upscmd$(EXEEXT) sbin_PROGRAMS = upsmon$(EXEEXT) upssched$(EXEEXT) -@HAVE_CXX11_TRUE@am__append_4 = libnutclient.la libnutclientstub.la @WITH_CGI_TRUE@cgiexec_PROGRAMS = upsstats.cgi$(EXEEXT) \ @WITH_CGI_TRUE@ upsimage.cgi$(EXEEXT) upsset.cgi$(EXEEXT) -@WITH_SSL_TRUE@am__append_5 = $(LIBSSL_LIBS) -@HAVE_CXX11_FALSE@am__append_6 = nutclient.h nutclient.cpp \ -@HAVE_CXX11_FALSE@ nutclientmem.h nutclientmem.cpp +@WITH_SSL_TRUE@am__append_4 = $(LIBSSL_LIBS) subdir = clients +DIST_COMMON = $(am__include_HEADERS_DIST) $(dist_bin_SCRIPTS) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -131,26 +89,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(dist_bin_SCRIPTS) \ - $(am__include_HEADERS_DIST) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cgiexecdir)" \ - "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)" -PROGRAMS = $(bin_PROGRAMS) $(cgiexec_PROGRAMS) $(sbin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -178,156 +126,100 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(cgiexecdir)" "$(DESTDIR)$(sbindir)" \ + "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) -@HAVE_CXX11_TRUE@libnutclient_la_DEPENDENCIES = \ -@HAVE_CXX11_TRUE@ $(top_builddir)/common/libcommonclient.la -am__libnutclient_la_SOURCES_DIST = nutclient.h nutclient.cpp -@HAVE_CXX11_TRUE@am_libnutclient_la_OBJECTS = nutclient.lo +libnutclient_la_LIBADD = +am_libnutclient_la_OBJECTS = nutclient.lo libnutclient_la_OBJECTS = $(am_libnutclient_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libnutclient_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(libnutclient_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@HAVE_CXX11_TRUE@am_libnutclient_la_rpath = -rpath $(libdir) -@HAVE_CXX11_TRUE@libnutclientstub_la_DEPENDENCIES = libnutclient.la -am__libnutclientstub_la_SOURCES_DIST = nutclientmem.h nutclientmem.cpp -@HAVE_CXX11_TRUE@am_libnutclientstub_la_OBJECTS = nutclientmem.lo -libnutclientstub_la_OBJECTS = $(am_libnutclientstub_la_OBJECTS) -libnutclientstub_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ - $(AM_CXXFLAGS) $(CXXFLAGS) $(libnutclientstub_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -@HAVE_CXX11_TRUE@am_libnutclientstub_la_rpath = -rpath $(libdir) am__DEPENDENCIES_1 = @WITH_SSL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -libupsclient_la_DEPENDENCIES = \ - $(top_builddir)/common/libcommonclient.la \ +libupsclient_la_DEPENDENCIES = ../common/libparseconf.la \ $(am__DEPENDENCIES_2) am_libupsclient_la_OBJECTS = upsclient.lo libupsclient_la_OBJECTS = $(am_libupsclient_la_OBJECTS) -libupsclient_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(AM_CFLAGS) $(CFLAGS) $(libupsclient_la_LDFLAGS) $(LDFLAGS) \ - -o $@ +libupsclient_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libupsclient_la_LDFLAGS) $(LDFLAGS) -o $@ +PROGRAMS = $(bin_PROGRAMS) $(cgiexec_PROGRAMS) $(sbin_PROGRAMS) am_upsc_OBJECTS = upsc.$(OBJEXT) upsc_OBJECTS = $(am_upsc_OBJECTS) upsc_LDADD = $(LDADD) -upsc_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upsc_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upscmd_OBJECTS = upscmd.$(OBJEXT) upscmd_OBJECTS = $(am_upscmd_OBJECTS) upscmd_LDADD = $(LDADD) -upscmd_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upscmd_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upsimage_cgi_OBJECTS = upsimage.$(OBJEXT) cgilib.$(OBJEXT) upsimage_cgi_OBJECTS = $(am_upsimage_cgi_OBJECTS) -am__DEPENDENCIES_3 = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +am__DEPENDENCIES_3 = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) upsimage_cgi_DEPENDENCIES = $(am__DEPENDENCIES_3) \ $(am__DEPENDENCIES_1) am_upslog_OBJECTS = upslog.$(OBJEXT) upslog_OBJECTS = $(am_upslog_OBJECTS) upslog_LDADD = $(LDADD) -upslog_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upslog_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upsmon_OBJECTS = upsmon.$(OBJEXT) upsmon_OBJECTS = $(am_upsmon_OBJECTS) upsmon_LDADD = $(LDADD) -upsmon_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upsmon_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upsrw_OBJECTS = upsrw.$(OBJEXT) upsrw_OBJECTS = $(am_upsrw_OBJECTS) upsrw_LDADD = $(LDADD) -upsrw_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upsrw_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upssched_OBJECTS = upssched.$(OBJEXT) upssched_OBJECTS = $(am_upssched_OBJECTS) -upssched_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - $(top_builddir)/common/libparseconf.la $(am__DEPENDENCIES_1) +upssched_DEPENDENCIES = ../common/libcommon.la \ + ../common/libparseconf.la $(am__DEPENDENCIES_1) am_upsset_cgi_OBJECTS = upsset.$(OBJEXT) cgilib.$(OBJEXT) upsset_cgi_OBJECTS = $(am_upsset_cgi_OBJECTS) upsset_cgi_LDADD = $(LDADD) -upsset_cgi_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upsset_cgi_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_upsstats_cgi_OBJECTS = upsstats.$(OBJEXT) cgilib.$(OBJEXT) upsstats_cgi_OBJECTS = $(am_upsstats_cgi_OBJECTS) upsstats_cgi_LDADD = $(LDADD) -upsstats_cgi_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - libupsclient.la $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) +upsstats_cgi_DEPENDENCIES = ../common/libcommon.la libupsclient.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) SCRIPTS = $(dist_bin_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/cgilib.Po ./$(DEPDIR)/nutclient.Plo \ - ./$(DEPDIR)/nutclientmem.Plo ./$(DEPDIR)/upsc.Po \ - ./$(DEPDIR)/upsclient.Plo ./$(DEPDIR)/upscmd.Po \ - ./$(DEPDIR)/upsimage.Po ./$(DEPDIR)/upslog.Po \ - ./$(DEPDIR)/upsmon.Po ./$(DEPDIR)/upsrw.Po \ - ./$(DEPDIR)/upssched.Po ./$(DEPDIR)/upsset.Po \ - ./$(DEPDIR)/upsstats.Po +am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(libnutclient_la_SOURCES) $(libnutclientstub_la_SOURCES) \ - $(libupsclient_la_SOURCES) $(upsc_SOURCES) $(upscmd_SOURCES) \ - $(upsimage_cgi_SOURCES) $(upslog_SOURCES) $(upsmon_SOURCES) \ - $(upsrw_SOURCES) $(upssched_SOURCES) $(upsset_cgi_SOURCES) \ +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libnutclient_la_SOURCES) $(libupsclient_la_SOURCES) \ + $(upsc_SOURCES) $(upscmd_SOURCES) $(upsimage_cgi_SOURCES) \ + $(upslog_SOURCES) $(upsmon_SOURCES) $(upsrw_SOURCES) \ + $(upssched_SOURCES) $(upsset_cgi_SOURCES) \ $(upsstats_cgi_SOURCES) -DIST_SOURCES = $(am__libnutclient_la_SOURCES_DIST) \ - $(am__libnutclientstub_la_SOURCES_DIST) \ - $(libupsclient_la_SOURCES) $(upsc_SOURCES) $(upscmd_SOURCES) \ - $(upsimage_cgi_SOURCES) $(upslog_SOURCES) $(upsmon_SOURCES) \ - $(upsrw_SOURCES) $(upssched_SOURCES) $(upsset_cgi_SOURCES) \ +DIST_SOURCES = $(libnutclient_la_SOURCES) $(libupsclient_la_SOURCES) \ + $(upsc_SOURCES) $(upscmd_SOURCES) $(upsimage_cgi_SOURCES) \ + $(upslog_SOURCES) $(upsmon_SOURCES) $(upsrw_SOURCES) \ + $(upssched_SOURCES) $(upsset_cgi_SOURCES) \ $(upsstats_cgi_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -335,37 +227,17 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__include_HEADERS_DIST = upsclient.h ../include/parseconf.h \ - nutclient.h nutclientmem.h + nutclient.h HEADERS = $(include_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -376,7 +248,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -390,7 +261,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -403,8 +273,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -414,15 +287,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -433,29 +305,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -475,9 +339,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -486,16 +347,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -509,7 +366,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -520,12 +376,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -544,21 +396,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -569,16 +418,8 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -# Network UPS Tools: clients -EXTRA_DIST = $(am__append_6) - -# nutclient.cpp for some legacy reason (maybe initial detached development?) -# optionally includes "common.h" with the NUT build setup - and this option -# was never triggered in fact, not until pushed through command line like this: -AM_CXXFLAGS = -DHAVE_NUTCOMMON=1 -I$(top_srcdir)/include - # by default, link programs in this directory with libcommon.a -LDADD = $(top_builddir)/common/libcommon.la libupsclient.la $(NETLIBS) \ +LDADD = ../common/libcommon.la libupsclient.la $(NETLIBS) \ $(am__append_1) # Avoid per-target CFLAGS, because this will prevent re-use of object @@ -586,15 +427,15 @@ LDADD = $(top_builddir)/common/libcommon.la libupsclient.la $(NETLIBS) \ # but only add them if we really use the target. AM_CFLAGS = -I$(top_srcdir)/include $(am__append_2) $(am__append_3) dist_bin_SCRIPTS = upssched-cmd -lib_LTLIBRARIES = libupsclient.la $(am__append_4) -@WITH_DEV_TRUE@include_HEADERS = upsclient.h ../include/parseconf.h nutclient.h nutclientmem.h +lib_LTLIBRARIES = libupsclient.la libnutclient.la +@WITH_DEV_TRUE@include_HEADERS = upsclient.h ../include/parseconf.h nutclient.h upsc_SOURCES = upsc.c upsclient.h upscmd_SOURCES = upscmd.c upsclient.h upsrw_SOURCES = upsrw.c upsclient.h upslog_SOURCES = upslog.c upsclient.h upslog.h upsmon_SOURCES = upsmon.c upsmon.h upsclient.h upssched_SOURCES = upssched.c upssched.h -upssched_LDADD = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la $(NETLIBS) +upssched_LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) upsimage_cgi_SOURCES = upsimage.c upsclient.h upsimagearg.h cgilib.c cgilib.h upsimage_cgi_LDADD = $(LDADD) $(LIBGD_LDFLAGS) upsset_cgi_SOURCES = upsset.c upsclient.h cgilib.c cgilib.h @@ -604,29 +445,12 @@ upsstats_cgi_SOURCES = upsstats.c upsclient.h status.h upsstats.h \ # not LDADD. libupsclient_la_SOURCES = upsclient.c upsclient.h -libupsclient_la_LIBADD = $(top_builddir)/common/libcommonclient.la \ - $(am__append_5) - -# Below we set API versions of public libraries -# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -# Note that changes here may have to be reflected in packaging (the shared -# object .so names would differ) +libupsclient_la_LIBADD = ../common/libparseconf.la $(am__append_4) # libupsclient version information -libupsclient_la_LDFLAGS = -version-info 6:0:0 -export-symbols-regex ^upscli_ - -# libnutclient version information and build -@HAVE_CXX11_TRUE@libnutclient_la_SOURCES = nutclient.h nutclient.cpp -@HAVE_CXX11_TRUE@libnutclient_la_LDFLAGS = -version-info 2:0:0 -# Needed in not-standalone builds with -DHAVE_NUTCOMMON=1 -# which is defined for in-tree CXX builds above: -@HAVE_CXX11_TRUE@libnutclient_la_LIBADD = $(top_builddir)/common/libcommonclient.la - -# libnutclientstub version information and build -@HAVE_CXX11_TRUE@libnutclientstub_la_SOURCES = nutclientmem.h nutclientmem.cpp -@HAVE_CXX11_TRUE@libnutclientstub_la_LDFLAGS = -version-info 1:0:0 -@HAVE_CXX11_TRUE@libnutclientstub_la_LIBADD = libnutclient.la -MAINTAINERCLEANFILES = Makefile.in .dirstamp +# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html +libupsclient_la_LDFLAGS = -version-info 3:1:0 +libnutclient_la_SOURCES = nutclient.h nutclient.cpp all: all-am .SUFFIXES: @@ -643,13 +467,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu clients/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu clients/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -660,154 +485,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -install-cgiexecPROGRAMS: $(cgiexec_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(cgiexec_PROGRAMS)'; test -n "$(cgiexecdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(cgiexecdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(cgiexecdir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(cgiexecdir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(cgiexecdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-cgiexecPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(cgiexec_PROGRAMS)'; test -n "$(cgiexecdir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(cgiexecdir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(cgiexecdir)" && rm -f $$files - -clean-cgiexecPROGRAMS: - @list='$(cgiexec_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -install-sbinPROGRAMS: $(sbin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-sbinPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(sbindir)" && rm -f $$files - -clean-sbinPROGRAMS: - @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -834,59 +511,181 @@ uninstall-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libnutclient.la: $(libnutclient_la_OBJECTS) $(libnutclient_la_DEPENDENCIES) $(EXTRA_libnutclient_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libnutclient_la_LINK) $(am_libnutclient_la_rpath) $(libnutclient_la_OBJECTS) $(libnutclient_la_LIBADD) $(LIBS) - -libnutclientstub.la: $(libnutclientstub_la_OBJECTS) $(libnutclientstub_la_DEPENDENCIES) $(EXTRA_libnutclientstub_la_DEPENDENCIES) - $(AM_V_CXXLD)$(libnutclientstub_la_LINK) $(am_libnutclientstub_la_rpath) $(libnutclientstub_la_OBJECTS) $(libnutclientstub_la_LIBADD) $(LIBS) - + $(CXXLINK) -rpath $(libdir) $(libnutclient_la_OBJECTS) $(libnutclient_la_LIBADD) $(LIBS) libupsclient.la: $(libupsclient_la_OBJECTS) $(libupsclient_la_DEPENDENCIES) $(EXTRA_libupsclient_la_DEPENDENCIES) - $(AM_V_CCLD)$(libupsclient_la_LINK) -rpath $(libdir) $(libupsclient_la_OBJECTS) $(libupsclient_la_LIBADD) $(LIBS) + $(libupsclient_la_LINK) -rpath $(libdir) $(libupsclient_la_OBJECTS) $(libupsclient_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +install-cgiexecPROGRAMS: $(cgiexec_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(cgiexec_PROGRAMS)'; test -n "$(cgiexecdir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(cgiexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(cgiexecdir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(cgiexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(cgiexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-cgiexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(cgiexec_PROGRAMS)'; test -n "$(cgiexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(cgiexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(cgiexecdir)" && rm -f $$files + +clean-cgiexecPROGRAMS: + @list='$(cgiexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(sbindir)" && rm -f $$files + +clean-sbinPROGRAMS: + @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list upsc$(EXEEXT): $(upsc_OBJECTS) $(upsc_DEPENDENCIES) $(EXTRA_upsc_DEPENDENCIES) @rm -f upsc$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsc_OBJECTS) $(upsc_LDADD) $(LIBS) - + $(LINK) $(upsc_OBJECTS) $(upsc_LDADD) $(LIBS) upscmd$(EXEEXT): $(upscmd_OBJECTS) $(upscmd_DEPENDENCIES) $(EXTRA_upscmd_DEPENDENCIES) @rm -f upscmd$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upscmd_OBJECTS) $(upscmd_LDADD) $(LIBS) - + $(LINK) $(upscmd_OBJECTS) $(upscmd_LDADD) $(LIBS) upsimage.cgi$(EXEEXT): $(upsimage_cgi_OBJECTS) $(upsimage_cgi_DEPENDENCIES) $(EXTRA_upsimage_cgi_DEPENDENCIES) @rm -f upsimage.cgi$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsimage_cgi_OBJECTS) $(upsimage_cgi_LDADD) $(LIBS) - + $(LINK) $(upsimage_cgi_OBJECTS) $(upsimage_cgi_LDADD) $(LIBS) upslog$(EXEEXT): $(upslog_OBJECTS) $(upslog_DEPENDENCIES) $(EXTRA_upslog_DEPENDENCIES) @rm -f upslog$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upslog_OBJECTS) $(upslog_LDADD) $(LIBS) - + $(LINK) $(upslog_OBJECTS) $(upslog_LDADD) $(LIBS) upsmon$(EXEEXT): $(upsmon_OBJECTS) $(upsmon_DEPENDENCIES) $(EXTRA_upsmon_DEPENDENCIES) @rm -f upsmon$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsmon_OBJECTS) $(upsmon_LDADD) $(LIBS) - + $(LINK) $(upsmon_OBJECTS) $(upsmon_LDADD) $(LIBS) upsrw$(EXEEXT): $(upsrw_OBJECTS) $(upsrw_DEPENDENCIES) $(EXTRA_upsrw_DEPENDENCIES) @rm -f upsrw$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsrw_OBJECTS) $(upsrw_LDADD) $(LIBS) - + $(LINK) $(upsrw_OBJECTS) $(upsrw_LDADD) $(LIBS) upssched$(EXEEXT): $(upssched_OBJECTS) $(upssched_DEPENDENCIES) $(EXTRA_upssched_DEPENDENCIES) @rm -f upssched$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upssched_OBJECTS) $(upssched_LDADD) $(LIBS) - + $(LINK) $(upssched_OBJECTS) $(upssched_LDADD) $(LIBS) upsset.cgi$(EXEEXT): $(upsset_cgi_OBJECTS) $(upsset_cgi_DEPENDENCIES) $(EXTRA_upsset_cgi_DEPENDENCIES) @rm -f upsset.cgi$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsset_cgi_OBJECTS) $(upsset_cgi_LDADD) $(LIBS) - + $(LINK) $(upsset_cgi_OBJECTS) $(upsset_cgi_LDADD) $(LIBS) upsstats.cgi$(EXEEXT): $(upsstats_cgi_OBJECTS) $(upsstats_cgi_DEPENDENCIES) $(EXTRA_upsstats_cgi_DEPENDENCIES) @rm -f upsstats.cgi$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsstats_cgi_OBJECTS) $(upsstats_cgi_LDADD) $(LIBS) + $(LINK) $(upsstats_cgi_OBJECTS) $(upsstats_cgi_LDADD) $(LIBS) install-dist_binSCRIPTS: $(dist_bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ @@ -929,73 +728,60 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgilib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutclient.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutclientmem.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsc.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsclient.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upscmd.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsimage.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upslog.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsmon.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsrw.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upssched.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsset.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsstats.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgilib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutclient.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsclient.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upscmd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsimage.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upslog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsmon.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsrw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upssched.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsstats.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< .cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -1024,15 +810,26 @@ uninstall-includeHEADERS: files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -1044,11 +841,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -1057,29 +858,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1111,11 +894,11 @@ distdir-am: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(SCRIPTS) $(HEADERS) +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(SCRIPTS) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cgiexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(cgiexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -1148,7 +931,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-cgiexecPROGRAMS clean-generic \ @@ -1156,19 +938,7 @@ clean-am: clean-binPROGRAMS clean-cgiexecPROGRAMS clean-generic \ mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/cgilib.Po - -rm -f ./$(DEPDIR)/nutclient.Plo - -rm -f ./$(DEPDIR)/nutclientmem.Plo - -rm -f ./$(DEPDIR)/upsc.Po - -rm -f ./$(DEPDIR)/upsclient.Plo - -rm -f ./$(DEPDIR)/upscmd.Po - -rm -f ./$(DEPDIR)/upsimage.Po - -rm -f ./$(DEPDIR)/upslog.Po - -rm -f ./$(DEPDIR)/upsmon.Po - -rm -f ./$(DEPDIR)/upsrw.Po - -rm -f ./$(DEPDIR)/upssched.Po - -rm -f ./$(DEPDIR)/upsset.Po - -rm -f ./$(DEPDIR)/upsstats.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1216,19 +986,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/cgilib.Po - -rm -f ./$(DEPDIR)/nutclient.Plo - -rm -f ./$(DEPDIR)/nutclientmem.Plo - -rm -f ./$(DEPDIR)/upsc.Po - -rm -f ./$(DEPDIR)/upsclient.Plo - -rm -f ./$(DEPDIR)/upscmd.Po - -rm -f ./$(DEPDIR)/upsimage.Po - -rm -f ./$(DEPDIR)/upslog.Po - -rm -f ./$(DEPDIR)/upsmon.Po - -rm -f ./$(DEPDIR)/upsrw.Po - -rm -f ./$(DEPDIR)/upssched.Po - -rm -f ./$(DEPDIR)/upsset.Po - -rm -f ./$(DEPDIR)/upsstats.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1251,41 +1009,26 @@ uninstall-am: uninstall-binPROGRAMS uninstall-cgiexecPROGRAMS \ .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-binPROGRAMS clean-cgiexecPROGRAMS clean-generic \ - clean-libLTLIBRARIES clean-libtool clean-sbinPROGRAMS \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-cgiexecPROGRAMS install-data \ - install-data-am install-dist_binSCRIPTS install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-includeHEADERS install-info \ - install-info-am install-libLTLIBRARIES install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-cgiexecPROGRAMS \ - uninstall-dist_binSCRIPTS uninstall-includeHEADERS \ - uninstall-libLTLIBRARIES uninstall-sbinPROGRAMS +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-cgiexecPROGRAMS clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-sbinPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-binPROGRAMS install-cgiexecPROGRAMS \ + install-data install-data-am install-dist_binSCRIPTS \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-includeHEADERS \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-sbinPROGRAMS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-cgiexecPROGRAMS uninstall-dist_binSCRIPTS \ + uninstall-includeHEADERS uninstall-libLTLIBRARIES \ + uninstall-sbinPROGRAMS -.PRECIOUS: Makefile - - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libcommonclient.la \ -$(top_builddir)/common/libparseconf.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dummy: - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/clients/cgilib.c b/clients/cgilib.c index 88cebfa..2eb9ce8 100644 --- a/clients/cgilib.c +++ b/clients/cgilib.c @@ -46,12 +46,9 @@ static char *unescape(char *buf) hex[1] = buf[++i]; hex[2] = '\0'; if (!isxdigit((unsigned char) hex[0]) - || !isxdigit((unsigned char) hex[1])) + || !isxdigit((unsigned char) hex[0])) fatalx(EXIT_FAILURE, "bad escape char"); - long l = strtol(hex, NULL, 16); - assert(l>=0); - assert(l<=255); - ch = (char)l; /* FIXME: Loophole about non-ASCII symbols in top 128 values, or negatives for signed char... */ + ch = strtol(hex, NULL, 16); if ((ch == 10) || (ch == 13)) ch = ' '; @@ -92,7 +89,7 @@ void extractcgiargs(void) continue; } - + *eq = '\0'; value = eq + 1; amp = strchr(value, '&'); @@ -104,7 +101,7 @@ void extractcgiargs(void) ptr = NULL; cleanvar = unescape(varname); - cleanval = unescape(value); + cleanval = unescape(value); parsearg(cleanvar, cleanval); free(cleanvar); free(cleanval); @@ -202,4 +199,4 @@ int checkhost(const char *host, char **desc) pconf_finish(&ctx); return 0; /* not found: access denied */ -} +} diff --git a/clients/cgilib.h b/clients/cgilib.h index 32b6001..1b620c3 100644 --- a/clients/cgilib.h +++ b/clients/cgilib.h @@ -17,9 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_CGILIB_H_SEEN -#define NUT_CGILIB_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -44,4 +41,3 @@ int checkhost(const char *host, char **desc); /* *INDENT-ON* */ #endif -#endif /* NUT_CGILIB_H_SEEN */ diff --git a/clients/nutclient.cpp b/clients/nutclient.cpp index 6dfbe3a..dcf0c2d 100644 --- a/clients/nutclient.cpp +++ b/clients/nutclient.cpp @@ -28,7 +28,7 @@ /* Windows/Linux Socket compatibility layer: */ /* Thanks to Benjamin Roux (http://broux.developpez.com/articles/c/sockets/) */ #ifdef WIN32 -# include +# include #else # include # include @@ -39,7 +39,7 @@ # include # define INVALID_SOCKET -1 # define SOCKET_ERROR -1 -# define closesocket(s) close(s) +# define closesocket(s) close(s) typedef int SOCKET; typedef struct sockaddr_in SOCKADDR_IN; typedef struct sockaddr SOCKADDR; @@ -60,23 +60,6 @@ static inline void *xrealloc(void *ptr, size_t size){return realloc(ptr, size);} static inline char *xstrdup(const char *string){return strdup(string);} #endif /* HAVE_NUTCOMMON */ -/* To stay in line with modern C++, we use nullptr (not numeric NULL - * or shim __null on some systems) which was defined after C++98. - * The NUT C++ interface is intended for C++11 and newer, so we - * quiesce these warnigns if possible. - * An idea might be to detect if we do build with old C++ standard versions - * and define a nullptr like https://stackoverflow.com/a/44517878/4715872 - * but again - currently we do not intend to support that officially. - */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT -#pragma GCC diagnostic ignored "-Wc++98-compat" -#endif namespace nut { @@ -98,23 +81,6 @@ std::string SystemException::err() } } -/* Implemented out-of-line to avoid "Weak vtables" warnings and related overheads - * But now with clang-9 C++11 linter (though not C++17) they complain with - * error: definition of implicit copy constructor for 'NutException' - * is deprecated because it has a user-declared destructor - * This is fixed in header with declarations like: - * NutException(const NutException&) = default; - * and assignment operator to accompany the copy constructor, per - * https://lgtm.com/rules/2165180572/ like: - * NutException& operator=(NutException& rhs) = default; - */ -NutException::~NutException() {} -SystemException::~SystemException() {} -IOException::~IOException() {} -UnknownHostException::~UnknownHostException() {} -NotConnectedException::~NotConnectedException() {} -TimeoutException::~TimeoutException() {} - namespace internal { @@ -122,27 +88,26 @@ namespace internal /** * Internal socket wrapper. * Provides only client socket functions. - * + * * Implemented as separate internal class to easily hide plateform specificities. */ class Socket { public: Socket(); - ~Socket(); - void connect(const std::string& host, uint16_t port); + void connect(const std::string& host, int port)throw(nut::IOException); void disconnect(); bool isConnected()const; - void setTimeout(time_t timeout); + void setTimeout(long timeout); bool hasTimeout()const{return _tv.tv_sec>=0;} - size_t read(void* buf, size_t sz); - size_t write(const void* buf, size_t sz); + size_t read(void* buf, size_t sz)throw(nut::IOException); + size_t write(const void* buf, size_t sz)throw(nut::IOException); - std::string read(); - void write(const std::string& str); + std::string read()throw(nut::IOException); + void write(const std::string& str)throw(nut::IOException); private: @@ -159,17 +124,12 @@ _tv() _tv.tv_usec = 0; } -Socket::~Socket() -{ - disconnect(); -} - -void Socket::setTimeout(time_t timeout) +void Socket::setTimeout(long timeout) { _tv.tv_sec = timeout; } -void Socket::connect(const std::string& host, uint16_t port) +void Socket::connect(const std::string& host, int port)throw(nut::IOException) { int sock_fd; struct addrinfo hints, *res, *ai; @@ -186,7 +146,7 @@ void Socket::connect(const std::string& host, uint16_t port) throw nut::UnknownHostException(); } - snprintf(sport, sizeof(sport), "%ju", static_cast(port)); + snprintf(sport, sizeof(sport), "%hu", (unsigned short int)port); memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; @@ -209,7 +169,7 @@ void Socket::connect(const std::string& host, uint16_t port) } } - for (ai = res; ai != nullptr; ai = ai->ai_next) { + for (ai = res; ai != NULL; ai = ai->ai_next) { sock_fd = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); @@ -218,7 +178,7 @@ void Socket::connect(const std::string& host, uint16_t port) { case EAFNOSUPPORT: case EINVAL: - break; + break; default: throw nut::SystemException(); } @@ -236,11 +196,11 @@ void Socket::connect(const std::string& host, uint16_t port) if(errno == EINPROGRESS) { FD_ZERO(&wfds); FD_SET(sock_fd, &wfds); - select(sock_fd+1, nullptr, &wfds, nullptr, hasTimeout() ? &_tv : nullptr); + select(sock_fd+1,NULL,&wfds,NULL, hasTimeout()?&_tv:NULL); if (FD_ISSET(sock_fd, &wfds)) { error_size = sizeof(error); - getsockopt(sock_fd, SOL_SOCKET, SO_ERROR, - &error, &error_size); + getsockopt(sock_fd,SOL_SOCKET,SO_ERROR, + &error,&error_size); if( error == 0) { /* connect successful */ v = 0; @@ -296,10 +256,10 @@ void Socket::connect(const std::string& host, uint16_t port) #ifdef OLD - struct hostent *hostinfo = nullptr; + struct hostent *hostinfo = NULL; SOCKADDR_IN sin = { 0 }; hostinfo = ::gethostbyname(host.c_str()); - if(hostinfo == nullptr) /* Host doesnt exist */ + if(hostinfo == NULL) /* Host doesnt exist */ { throw nut::UnknownHostException(); } @@ -338,7 +298,7 @@ bool Socket::isConnected()const return _sock!=INVALID_SOCKET; } -size_t Socket::read(void* buf, size_t sz) +size_t Socket::read(void* buf, size_t sz)throw(nut::IOException) { if(!isConnected()) { @@ -350,7 +310,7 @@ size_t Socket::read(void* buf, size_t sz) fd_set fds; FD_ZERO(&fds); FD_SET(_sock, &fds); - int ret = select(_sock+1, &fds, nullptr, nullptr, &_tv); + int ret = select(_sock+1, &fds, NULL, NULL, &_tv); if (ret < 1) { throw nut::TimeoutException(); } @@ -362,10 +322,10 @@ size_t Socket::read(void* buf, size_t sz) disconnect(); throw nut::IOException("Error while reading on socket"); } - return static_cast(res); + return (size_t) res; } -size_t Socket::write(const void* buf, size_t sz) +size_t Socket::write(const void* buf, size_t sz)throw(nut::IOException) { if(!isConnected()) { @@ -377,7 +337,7 @@ size_t Socket::write(const void* buf, size_t sz) fd_set fds; FD_ZERO(&fds); FD_SET(_sock, &fds); - int ret = select(_sock+1, nullptr, &fds, nullptr, &_tv); + int ret = select(_sock+1, NULL, &fds, NULL, &_tv); if (ret < 1) { throw nut::TimeoutException(); } @@ -389,10 +349,10 @@ size_t Socket::write(const void* buf, size_t sz) disconnect(); throw nut::IOException("Error while writing on socket"); } - return static_cast(res); + return (size_t) res; } -std::string Socket::read() +std::string Socket::read()throw(nut::IOException) { std::string res; char buff[256]; @@ -414,16 +374,11 @@ std::string Socket::read() // Read new buffer size_t sz = read(&buff, 256); - if(sz==0) - { - disconnect(); - throw nut::IOException("Server closed connection unexpectedly"); - } _buffer.assign(buff, sz); } } -void Socket::write(const std::string& str) +void Socket::write(const std::string& str)throw(nut::IOException) { // write(str.c_str(), str.size()); // write("\n", 1); @@ -440,24 +395,6 @@ void Socket::write(const std::string& str) * */ -/* Pedantic builds complain about the static variable below... - * It is assumed safe to ignore since it is a std::string with - * no complex teardown at program exit. - */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic push -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS -# pragma GCC diagnostic ignored "-Wglobal-constructors" -# endif -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS -# pragma GCC diagnostic ignored "-Wexit-time-destructors" -# endif -#endif -const Feature Client::TRACKING = "TRACKING"; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic pop -#endif - Client::Client() { } @@ -466,84 +403,59 @@ Client::~Client() { } -bool Client::hasDevice(const std::string& dev) +bool Client::hasDevice(const std::string& dev)throw(NutException) { std::set devs = getDeviceNames(); return devs.find(dev) != devs.end(); } -Device Client::getDevice(const std::string& name) +Device Client::getDevice(const std::string& name)throw(NutException) { if(hasDevice(name)) return Device(this, name); else - return Device(nullptr, ""); + return Device(NULL, ""); } -std::set Client::getDevices() +std::set Client::getDevices()throw(NutException) { std::set res; std::set devs = getDeviceNames(); for(std::set::iterator it=devs.begin(); it!=devs.end(); ++it) { - res.insert(Device(this, *it)); + res.insert(Device(this, *it)); } return res; } -bool Client::hasDeviceVariable(const std::string& dev, const std::string& name) +bool Client::hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException) { std::set names = getDeviceVariableNames(dev); return names.find(name) != names.end(); } -std::map > Client::getDeviceVariableValues(const std::string& dev) +std::map > Client::getDeviceVariableValues(const std::string& dev)throw(NutException) { - std::map > res; + std::map > res; - std::set names = getDeviceVariableNames(dev); - for(std::set::iterator it=names.begin(); it!=names.end(); ++it) - { - const std::string& name = *it; - res[name] = getDeviceVariableValue(dev, name); - } + std::set names = getDeviceVariableNames(dev); + for(std::set::iterator it=names.begin(); it!=names.end(); ++it) + { + const std::string& name = *it; + res[name] = getDeviceVariableValue(dev, name); + } - return res; + return res; } -std::map > > Client::getDevicesVariableValues(const std::set& devs) +bool Client::hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException) { - std::map > > res; - - for(std::set::const_iterator it=devs.cbegin(); it!=devs.cend(); ++it) - { - res[*it] = getDeviceVariableValues(*it); - } - - return res; + std::set names = getDeviceCommandNames(dev); + return names.find(name) != names.end(); } -bool Client::hasDeviceCommand(const std::string& dev, const std::string& name) -{ - std::set names = getDeviceCommandNames(dev); - return names.find(name) != names.end(); -} - -bool Client::hasFeature(const Feature& feature) -{ - try - { - // If feature is known, querying it won't throw an exception. - isFeatureEnabled(feature); - return true; - } - catch(...) - { - return false; - } -} /* * @@ -555,15 +467,13 @@ TcpClient::TcpClient(): Client(), _host("localhost"), _port(3493), -_timeout(0), _socket(new internal::Socket) { // Do not connect now } -TcpClient::TcpClient(const std::string& host, uint16_t port): +TcpClient::TcpClient(const std::string& host, int port)throw(IOException): Client(), -_timeout(0), _socket(new internal::Socket) { connect(host, port); @@ -574,14 +484,14 @@ TcpClient::~TcpClient() delete _socket; } -void TcpClient::connect(const std::string& host, uint16_t port) +void TcpClient::connect(const std::string& host, int port)throw(IOException) { _host = host; _port = port; connect(); } -void TcpClient::connect() +void TcpClient::connect()throw(nut::IOException) { _socket->connect(_host, _port); } @@ -591,7 +501,7 @@ std::string TcpClient::getHost()const return _host; } -uint16_t TcpClient::getPort()const +int TcpClient::getPort()const { return _port; } @@ -606,29 +516,30 @@ void TcpClient::disconnect() _socket->disconnect(); } -void TcpClient::setTimeout(time_t timeout) +void TcpClient::setTimeout(long timeout) { _timeout = timeout; } -time_t TcpClient::getTimeout()const +long TcpClient::getTimeout()const { return _timeout; } void TcpClient::authenticate(const std::string& user, const std::string& passwd) + throw(NutException) { detectError(sendQuery("USERNAME " + user)); detectError(sendQuery("PASSWORD " + passwd)); } -void TcpClient::logout() +void TcpClient::logout()throw(NutException) { detectError(sendQuery("LOGOUT")); _socket->disconnect(); } -Device TcpClient::getDevice(const std::string& name) +Device TcpClient::getDevice(const std::string& name)throw(NutException) { try { @@ -637,14 +548,14 @@ Device TcpClient::getDevice(const std::string& name) catch(NutException& ex) { if(ex.str()=="UNKNOWN-UPS") - return Device(nullptr, ""); + return Device(NULL, ""); else throw; } return Device(this, name); } -std::set TcpClient::getDeviceNames() +std::set TcpClient::getDeviceNames()throw(NutException) { std::set res; @@ -660,15 +571,15 @@ std::set TcpClient::getDeviceNames() return res; } -std::string TcpClient::getDeviceDescription(const std::string& name) +std::string TcpClient::getDeviceDescription(const std::string& name)throw(NutException) { - return get("UPSDESC", name)[0]; + return get("UPSDESC", name)[0]; } -std::set TcpClient::getDeviceVariableNames(const std::string& dev) +std::set TcpClient::getDeviceVariableNames(const std::string& dev)throw(NutException) { std::set set; - + std::vector > res = list("VAR", dev); for(size_t n=0; n TcpClient::getDeviceVariableNames(const std::string& dev) return set; } -std::set TcpClient::getDeviceRWVariableNames(const std::string& dev) +std::set TcpClient::getDeviceRWVariableNames(const std::string& dev)throw(NutException) { std::set set; - + std::vector > res = list("RW", dev); for(size_t n=0; n TcpClient::getDeviceRWVariableNames(const std::string& dev return set; } -std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name) +std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException) { return get("DESC", dev + " " + name)[0]; } -std::vector TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name) +std::vector TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException) { return get("VAR", dev + " " + name); } -std::map > TcpClient::getDeviceVariableValues(const std::string& dev) +std::map > TcpClient::getDeviceVariableValues(const std::string& dev)throw(NutException) { std::map > map; - + std::vector > res = list("VAR", dev); for(size_t n=0; n > TcpClient::getDeviceVariableValu return map; } -std::map > > TcpClient::getDevicesVariableValues(const std::set& devs) -{ - std::map > > map; - - if (devs.empty()) - { - // This request might come from processing the empty valid - // response of an upsd server which was allowed to start - // with no device sections in its ups.conf - return map; - } - - std::vector queries; - for (std::set::const_iterator it=devs.cbegin(); it!=devs.cend(); ++it) - { - queries.push_back("LIST VAR " + *it); - } - sendAsyncQueries(queries); - - for (std::set::const_iterator it=devs.cbegin(); it!=devs.cend(); ++it) - { - try - { - std::map > map2; - std::vector > res = parseList("VAR " + *it); - for (std::vector >::iterator it2=res.begin(); it2!=res.end(); ++it2) - { - std::vector& vals = *it2; - std::string var = vals[0]; - vals.erase(vals.begin()); - map2[var] = vals; - } - map[*it] = map2; - } - catch (NutException&) - { - // We sent a bunch of queries, we need to process them all to clear up the backlog. - } - } - - if (map.empty()) - { - // We may fail on some devices, but not on ALL devices. - throw NutException("Invalid device"); - } - - return map; -} - -TrackingID TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) +void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException) { std::string query = "SET VAR " + dev + " " + name + " " + escape(value); - return sendTrackingQuery(query); + detectError(sendQuery(query)); } -TrackingID TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values) +void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException) { std::string query = "SET VAR " + dev + " " + name; for(size_t n=0; n TcpClient::getDeviceCommandNames(const std::string& dev) +std::set TcpClient::getDeviceCommandNames(const std::string& dev)throw(NutException) { std::set cmds; @@ -796,122 +658,40 @@ std::set TcpClient::getDeviceCommandNames(const std::string& dev) return cmds; } -std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name) +std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException) { return get("CMDDESC", dev + " " + name)[0]; } -TrackingID TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name, const std::string& param) +void TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException) { - return sendTrackingQuery("INSTCMD " + dev + " " + name + " " + param); + detectError(sendQuery("INSTCMD " + dev + " " + name)); } -void TcpClient::deviceLogin(const std::string& dev) +void TcpClient::deviceLogin(const std::string& dev)throw(NutException) { detectError(sendQuery("LOGIN " + dev)); } -/* NOTE: "master" is deprecated since NUT v2.8.0 in favor of "primary". - * For the sake of old/new server/client interoperability, - * practical implementations should try to use one and fall - * back to the other, and only fail if both return "ERR". - */ -void TcpClient::deviceMaster(const std::string& dev) +void TcpClient::deviceMaster(const std::string& dev)throw(NutException) { - try { - detectError(sendQuery("MASTER " + dev)); - } catch (NutException &exOrig) { - try { - detectError(sendQuery("PRIMARY " + dev)); - } catch (NutException &exRetry) { - NUT_UNUSED_VARIABLE(exRetry); - throw exOrig; - } - } + detectError(sendQuery("MASTER " + dev)); } -void TcpClient::devicePrimary(const std::string& dev) -{ - try { - detectError(sendQuery("PRIMARY " + dev)); - } catch (NutException &exOrig) { - try { - detectError(sendQuery("MASTER " + dev)); - } catch (NutException &exRetry) { - NUT_UNUSED_VARIABLE(exRetry); - throw exOrig; - } - } -} - -void TcpClient::deviceForcedShutdown(const std::string& dev) +void TcpClient::deviceForcedShutdown(const std::string& dev)throw(NutException) { detectError(sendQuery("FSD " + dev)); } -int TcpClient::deviceGetNumLogins(const std::string& dev) +int TcpClient::deviceGetNumLogins(const std::string& dev)throw(NutException) { std::string num = get("NUMLOGINS", dev)[0]; return atoi(num.c_str()); } -TrackingResult TcpClient::getTrackingResult(const TrackingID& id) -{ - if (id.empty()) - { - return TrackingResult::SUCCESS; - } - - std::string result = sendQuery("GET TRACKING " + id); - - if (result == "PENDING") - { - return TrackingResult::PENDING; - } - else if (result == "SUCCESS") - { - return TrackingResult::SUCCESS; - } - else if (result == "ERR UNKNOWN") - { - return TrackingResult::UNKNOWN; - } - else if (result == "ERR INVALID-ARGUMENT") - { - return TrackingResult::INVALID_ARGUMENT; - } - else - { - return TrackingResult::FAILURE; - } -} - -bool TcpClient::isFeatureEnabled(const Feature& feature) -{ - std::string result = sendQuery("GET " + feature); - detectError(result); - - if (result == "ON") - { - return true; - } - else if (result == "OFF") - { - return false; - } - else - { - throw NutException("Unknown feature result " + result); - } -} -void TcpClient::setFeature(const Feature& feature, bool status) -{ - std::string result = sendQuery("SET " + feature + " " + (status ? "ON" : "OFF")); - detectError(result); -} std::vector TcpClient::get - (const std::string& subcmd, const std::string& params) + (const std::string& subcmd, const std::string& params) throw(NutException) { std::string req = subcmd; if(!params.empty()) @@ -924,28 +704,19 @@ std::vector TcpClient::get { throw NutException("Invalid response"); } - + return explode(res, req.size()); } std::vector > TcpClient::list - (const std::string& subcmd, const std::string& params) + (const std::string& subcmd, const std::string& params) throw(NutException) { std::string req = subcmd; if(!params.empty()) { req += " " + params; } - std::vector query; - query.push_back("LIST " + req); - sendAsyncQueries(query); - return parseList(req); -} - -std::vector > TcpClient::parseList - (const std::string& req) -{ - std::string res = _socket->read(); + std::string res = sendQuery("LIST " + req); detectError(res); if(res != ("BEGIN LIST " + req)) { @@ -972,21 +743,13 @@ std::vector > TcpClient::parseList } } -std::string TcpClient::sendQuery(const std::string& req) +std::string TcpClient::sendQuery(const std::string& req)throw(IOException) { _socket->write(req); return _socket->read(); } -void TcpClient::sendAsyncQueries(const std::vector& req) -{ - for (std::vector::const_iterator it = req.cbegin(); it != req.cend(); ++it) - { - _socket->write(*it); - } -} - -void TcpClient::detectError(const std::string& req) +void TcpClient::detectError(const std::string& req)throw(NutException) { if(req.substr(0,3)=="ERR") { @@ -1053,7 +816,7 @@ std::vector TcpClient::explode(const std::string& str, size_t begin else { temp += c; - } + } break; case QUOTED_STRING: if(c=='\\') @@ -1108,7 +871,7 @@ std::vector TcpClient::explode(const std::string& str, size_t begin std::string TcpClient::escape(const std::string& str) { std::string res = "\""; - + for(size_t n=0; n res = explode(reply); - - if (res.size() == 1 && res[0] == "OK") - { - return TrackingID(""); - } - else if (res.size() == 3 && res[0] == "OK" && res[1] == "TRACKING") - { - return TrackingID(res[2]); - } - else - { - throw NutException("Unknown query result"); - } + return res; } /* @@ -1162,17 +905,6 @@ _name(dev._name) { } -Device& Device::operator=(const Device& dev) -{ - // Self assignment? - if (this==&dev) - return *this; - - _client = dev._client; - _name = dev._name; - return *this; -} - Device::~Device() { } @@ -1194,12 +926,12 @@ Client* Device::getClient() bool Device::isOk()const { - return _client!=nullptr && !_name.empty(); + return _client!=NULL && !_name.empty(); } Device::operator bool()const { - return isOk(); + return isOk(); } bool Device::operator!()const @@ -1214,97 +946,89 @@ bool Device::operator==(const Device& dev)const bool Device::operator<(const Device& dev)const { - return getName()getDeviceDescription(getName()); } std::vector Device::getVariableValue(const std::string& name) + throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); return getClient()->getDeviceVariableValue(getName(), name); } std::map > Device::getVariableValues() + throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); return getClient()->getDeviceVariableValues(getName()); } -std::set Device::getVariableNames() +std::set Device::getVariableNames()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - return getClient()->getDeviceVariableNames(getName()); + return getClient()->getDeviceVariableNames(getName()); } -std::set Device::getRWVariableNames() +std::set Device::getRWVariableNames()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - return getClient()->getDeviceRWVariableNames(getName()); + return getClient()->getDeviceRWVariableNames(getName()); } -void Device::setVariable(const std::string& name, const std::string& value) +void Device::setVariable(const std::string& name, const std::string& value)throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - getClient()->setDeviceVariable(getName(), name, value); + getClient()->setDeviceVariable(getName(), name, value); } void Device::setVariable(const std::string& name, const std::vector& values) + throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - getClient()->setDeviceVariable(getName(), name, values); + getClient()->setDeviceVariable(getName(), name, values); } -Variable Device::getVariable(const std::string& name) +Variable Device::getVariable(const std::string& name)throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - if(getClient()->hasDeviceVariable(getName(), name)) - return Variable(this, name); - else - return Variable(nullptr, ""); + if(getClient()->hasDeviceVariable(getName(), name)) + return Variable(this, name); + else + return Variable(NULL, ""); } -std::set Device::getVariables() +std::set Device::getVariables()throw(NutException) { std::set set; - if (!isOk()) throw NutException("Invalid device"); - std::set names = getClient()->getDeviceVariableNames(getName()); - for(std::set::iterator it=names.begin(); it!=names.end(); ++it) - { + std::set names = getClient()->getDeviceVariableNames(getName()); + for(std::set::iterator it=names.begin(); it!=names.end(); ++it) + { set.insert(Variable(this, *it)); - } + } return set; } -std::set Device::getRWVariables() +std::set Device::getRWVariables()throw(NutException) { std::set set; - if (!isOk()) throw NutException("Invalid device"); - std::set names = getClient()->getDeviceRWVariableNames(getName()); - for(std::set::iterator it=names.begin(); it!=names.end(); ++it) - { + std::set names = getClient()->getDeviceRWVariableNames(getName()); + for(std::set::iterator it=names.begin(); it!=names.end(); ++it) + { set.insert(Variable(this, *it)); - } + } return set; } -std::set Device::getCommandNames() +std::set Device::getCommandNames()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - return getClient()->getDeviceCommandNames(getName()); + return getClient()->getDeviceCommandNames(getName()); } -std::set Device::getCommands() +std::set Device::getCommands()throw(NutException) { std::set cmds; @@ -1317,49 +1041,36 @@ std::set Device::getCommands() return cmds; } -Command Device::getCommand(const std::string& name) +Command Device::getCommand(const std::string& name)throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - if(getClient()->hasDeviceCommand(getName(), name)) - return Command(this, name); - else - return Command(nullptr, ""); + if(getClient()->hasDeviceCommand(getName(), name)) + return Command(this, name); + else + return Command(NULL, ""); } -TrackingID Device::executeCommand(const std::string& name, const std::string& param) +void Device::executeCommand(const std::string& name)throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - return getClient()->executeDeviceCommand(getName(), name, param); + getClient()->executeDeviceCommand(getName(), name); } -void Device::login() +void Device::login()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - getClient()->deviceLogin(getName()); + getClient()->deviceLogin(getName()); } -/* Note: "master" is deprecated, but supported - * for mixing old/new client/server combos: */ -void Device::master() +void Device::master()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - getClient()->deviceMaster(getName()); + getClient()->deviceMaster(getName()); } -void Device::primary() -{ - if (!isOk()) throw NutException("Invalid device"); - getClient()->devicePrimary(getName()); -} - -void Device::forcedShutdown() +void Device::forcedShutdown()throw(NutException) { } -int Device::getNumLogins() +int Device::getNumLogins()throw(NutException) { - if (!isOk()) throw NutException("Invalid device"); - return getClient()->deviceGetNumLogins(getName()); + return getClient()->deviceGetNumLogins(getName()); } /* @@ -1380,17 +1091,6 @@ _name(var._name) { } -Variable& Variable::operator=(const Variable& var) -{ - // Self assignment? - if (this==&var) - return *this; - - _device = var._device; - _name = var._name; - return *this; -} - Variable::~Variable() { } @@ -1412,7 +1112,7 @@ Device* Variable::getDevice() bool Variable::isOk()const { - return _device!=nullptr && !_name.empty(); + return _device!=NULL && !_name.empty(); } @@ -1436,22 +1136,22 @@ bool Variable::operator<(const Variable& var)const return getName() Variable::getValue() +std::vector Variable::getValue()throw(NutException) { - return getDevice()->getClient()->getDeviceVariableValue(getDevice()->getName(), getName()); + return getDevice()->getClient()->getDeviceVariableValue(getDevice()->getName(), getName()); } -std::string Variable::getDescription() +std::string Variable::getDescription()throw(NutException) { - return getDevice()->getClient()->getDeviceVariableDescription(getDevice()->getName(), getName()); + return getDevice()->getClient()->getDeviceVariableDescription(getDevice()->getName(), getName()); } -void Variable::setValue(const std::string& value) +void Variable::setValue(const std::string& value)throw(NutException) { getDevice()->setVariable(getName(), value); } -void Variable::setValues(const std::vector& values) +void Variable::setValues(const std::vector& values)throw(NutException) { getDevice()->setVariable(getName(), values); } @@ -1475,17 +1175,6 @@ _name(cmd._name) { } -Command& Command::operator=(const Command& cmd) -{ - // Self assignment? - if (this==&cmd) - return *this; - - _device = cmd._device; - _name = cmd._name; - return *this; -} - Command::~Command() { } @@ -1507,7 +1196,8 @@ Device* Command::getDevice() bool Command::isOk()const { - return _device!=nullptr && !_name.empty(); + return _device!=NULL && !_name.empty(); + } Command::operator bool()const @@ -1530,14 +1220,14 @@ bool Command::operator<(const Command& cmd)const return getName()getClient()->getDeviceCommandDescription(getDevice()->getName(), getName()); } -void Command::execute(const std::string& param) +void Command::execute()throw(NutException) { - getDevice()->executeCommand(getName(), param); + getDevice()->executeCommand(getName()); } } /* namespace nut */ @@ -1549,22 +1239,17 @@ void Command::execute(const std::string& param) extern "C" { -strarr strarr_alloc(size_t count) +strarr strarr_alloc(unsigned short count) { - strarr arr = static_cast(xcalloc(count+1, sizeof(char*))); - - if (arr == nullptr) { - throw nut::NutException("Out of memory"); - } - - arr[count] = nullptr; + strarr arr = (strarr)xcalloc(count+1, sizeof(char*)); + arr[count] = NULL; return arr; } void strarr_free(strarr arr) { char** pstr = arr; - while(*pstr!=nullptr) + while(*pstr!=NULL) { free(*pstr); ++pstr; @@ -1572,53 +1257,52 @@ void strarr_free(strarr arr) free(arr); } -strarr stringset_to_strarr(const std::set& strset) + +static strarr stringset_to_strarr(const std::set& strset) { strarr arr = strarr_alloc(strset.size()); strarr pstr = arr; for(std::set::const_iterator it=strset.begin(); it!=strset.end(); ++it) { *pstr = xstrdup(it->c_str()); - pstr++; } - return arr; + return arr; } -strarr stringvector_to_strarr(const std::vector& strset) +static strarr stringvector_to_strarr(const std::vector& strset) { strarr arr = strarr_alloc(strset.size()); strarr pstr = arr; for(std::vector::const_iterator it=strset.begin(); it!=strset.end(); ++it) { *pstr = xstrdup(it->c_str()); - pstr++; } - return arr; + return arr; } -NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, uint16_t port) + +NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, unsigned short port) { nut::TcpClient* client = new nut::TcpClient; try { client->connect(host, port); - return static_cast(client); + return (NUTCLIENT_TCP_t)client; } catch(nut::NutException& ex) { // TODO really catch it - NUT_UNUSED_VARIABLE(ex); delete client; - return nullptr; + return NULL; } - + } void nutclient_destroy(NUTCLIENT_t client) { if(client) { - delete static_cast(client); + delete (nut::Client*)client; } } @@ -1626,7 +1310,7 @@ int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client) { if(client) { - nut::TcpClient* cl = dynamic_cast(static_cast(client)); + nut::TcpClient* cl = dynamic_cast((nut::Client*)client); if(cl) { return cl->isConnected() ? 1 : 0; @@ -1639,7 +1323,7 @@ void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client) { if(client) { - nut::TcpClient* cl = dynamic_cast(static_cast(client)); + nut::TcpClient* cl = dynamic_cast((nut::Client*)client); if(cl) { cl->disconnect(); @@ -1647,11 +1331,12 @@ void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client) } } + int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client) { if(client) { - nut::TcpClient* cl = dynamic_cast(static_cast(client)); + nut::TcpClient* cl = dynamic_cast((nut::Client*)client); if(cl) { try @@ -1665,11 +1350,11 @@ int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client) return -1; } -void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout) +void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, long timeout) { if(client) { - nut::TcpClient* cl = dynamic_cast(static_cast(client)); + nut::TcpClient* cl = dynamic_cast((nut::Client*)client); if(cl) { cl->setTimeout(timeout); @@ -1677,11 +1362,11 @@ void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout) } } -time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client) +long nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client) { if(client) { - nut::TcpClient* cl = dynamic_cast(static_cast(client)); + nut::TcpClient* cl = dynamic_cast((nut::Client*)client); if(cl) { return cl->getTimeout(); @@ -1690,11 +1375,12 @@ time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client) return -1; } + void nutclient_authenticate(NUTCLIENT_t client, const char* login, const char* passwd) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1710,7 +1396,7 @@ void nutclient_logout(NUTCLIENT_t client) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1726,7 +1412,7 @@ void nutclient_device_login(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1742,7 +1428,7 @@ int nutclient_get_device_num_logins(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1755,13 +1441,12 @@ int nutclient_get_device_num_logins(NUTCLIENT_t client, const char* dev) return -1; } -/* Note: "master" is deprecated, but supported - * for mixing old/new client/server combos: */ + void nutclient_device_master(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1773,27 +1458,11 @@ void nutclient_device_master(NUTCLIENT_t client, const char* dev) } } -void nutclient_device_primary(NUTCLIENT_t client, const char* dev) -{ - if(client) - { - nut::Client* cl = static_cast(client); - if(cl) - { - try - { - cl->devicePrimary(dev); - } - catch(...){} - } - } -} - void nutclient_device_forced_shutdown(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1809,7 +1478,7 @@ strarr nutclient_get_devices(NUTCLIENT_t client) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1819,14 +1488,14 @@ strarr nutclient_get_devices(NUTCLIENT_t client) catch(...){} } } - return nullptr; + return NULL; } int nutclient_has_device(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1843,7 +1512,7 @@ char* nutclient_get_device_description(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1853,14 +1522,14 @@ char* nutclient_get_device_description(NUTCLIENT_t client, const char* dev) catch(...){} } } - return nullptr; + return NULL; } strarr nutclient_get_device_variables(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1870,14 +1539,14 @@ strarr nutclient_get_device_variables(NUTCLIENT_t client, const char* dev) catch(...){} } } - return nullptr; + return NULL; } strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1887,14 +1556,14 @@ strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, const char* dev) catch(...){} } } - return nullptr; + return NULL; } int nutclient_has_device_variable(NUTCLIENT_t client, const char* dev, const char* var) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1911,7 +1580,7 @@ char* nutclient_get_device_variable_description(NUTCLIENT_t client, const char* { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1921,14 +1590,14 @@ char* nutclient_get_device_variable_description(NUTCLIENT_t client, const char* catch(...){} } } - return nullptr; + return NULL; } strarr nutclient_get_device_variable_values(NUTCLIENT_t client, const char* dev, const char* var) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1938,14 +1607,14 @@ strarr nutclient_get_device_variable_values(NUTCLIENT_t client, const char* dev, catch(...){} } } - return nullptr; + return NULL; } void nutclient_set_device_variable_value(NUTCLIENT_t client, const char* dev, const char* var, const char* value) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1961,13 +1630,13 @@ void nutclient_set_device_variable_values(NUTCLIENT_t client, const char* dev, c { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try { std::vector vals; - strarr pstr = static_cast(values); + strarr pstr = (strarr)values; while(*pstr) { vals.push_back(std::string(*pstr)); @@ -1981,11 +1650,13 @@ void nutclient_set_device_variable_values(NUTCLIENT_t client, const char* dev, c } } + + strarr nutclient_get_device_commands(NUTCLIENT_t client, const char* dev) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -1995,14 +1666,15 @@ strarr nutclient_get_device_commands(NUTCLIENT_t client, const char* dev) catch(...){} } } - return nullptr; + return NULL; } + int nutclient_has_device_command(NUTCLIENT_t client, const char* dev, const char* cmd) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -2015,11 +1687,12 @@ int nutclient_has_device_command(NUTCLIENT_t client, const char* dev, const char return 0; } + char* nutclient_get_device_command_description(NUTCLIENT_t client, const char* dev, const char* cmd) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try @@ -2029,27 +1702,25 @@ char* nutclient_get_device_command_description(NUTCLIENT_t client, const char* d catch(...){} } } - return nullptr; + return NULL; } -void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd, const char* param) +void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd) { if(client) { - nut::Client* cl = static_cast(client); + nut::Client* cl = (nut::Client*)client; if(cl) { try { - cl->executeDeviceCommand(dev, cmd, param); + cl->executeDeviceCommand(dev, cmd); } catch(...){} } } } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT -#pragma GCC diagnostic pop -#endif - } /* extern "C" */ + + diff --git a/clients/nutclient.h b/clients/nutclient.h index e1020f2..ed2ea44 100644 --- a/clients/nutclient.h +++ b/clients/nutclient.h @@ -28,13 +28,6 @@ #include #include #include -#include -#include - -/* See include/common.h for details behind this */ -#ifndef NUT_UNUSED_VARIABLE -#define NUT_UNUSED_VARIABLE(x) (void)(x) -#endif namespace nut { @@ -58,11 +51,9 @@ class NutException : public std::exception { public: NutException(const std::string& msg):_msg(msg){} - NutException(const NutException&) = default; - NutException& operator=(NutException& rhs) = default; - virtual ~NutException() override; - virtual const char * what() const noexcept override {return this->_msg.c_str();} - virtual std::string str() const noexcept {return this->_msg;} + virtual ~NutException() throw() {} + virtual const char * what() const throw() {return this->_msg.c_str();} + virtual std::string str() const throw() {return this->_msg;} private: std::string _msg; }; @@ -74,9 +65,7 @@ class SystemException : public NutException { public: SystemException(); - SystemException(const SystemException&) = default; - SystemException& operator=(SystemException& rhs) = default; - virtual ~SystemException() override; + virtual ~SystemException() throw() {} private: static std::string err(); }; @@ -89,9 +78,7 @@ class IOException : public NutException { public: IOException(const std::string& msg):NutException(msg){} - IOException(const IOException&) = default; - IOException& operator=(IOException& rhs) = default; - virtual ~IOException() override; + virtual ~IOException() throw() {} }; /** @@ -101,9 +88,7 @@ class UnknownHostException : public IOException { public: UnknownHostException():IOException("Unknown host"){} - UnknownHostException(const UnknownHostException&) = default; - UnknownHostException& operator=(UnknownHostException& rhs) = default; - virtual ~UnknownHostException() override; + virtual ~UnknownHostException() throw() {} }; /** @@ -113,9 +98,7 @@ class NotConnectedException : public IOException { public: NotConnectedException():IOException("Not connected"){} - NotConnectedException(const NotConnectedException&) = default; - NotConnectedException& operator=(NotConnectedException& rhs) = default; - virtual ~NotConnectedException() override; + virtual ~NotConnectedException() throw() {} }; /** @@ -125,30 +108,9 @@ class TimeoutException : public IOException { public: TimeoutException():IOException("Timeout"){} - TimeoutException(const TimeoutException&) = default; - TimeoutException& operator=(TimeoutException& rhs) = default; - virtual ~TimeoutException() override; + virtual ~TimeoutException() throw() {} }; -/** - * Cookie given when performing async action, used to redeem result at a later date. - */ -typedef std::string TrackingID; - -/** - * Result of an async action. - */ -typedef enum -{ - UNKNOWN, - PENDING, - SUCCESS, - INVALID_ARGUMENT, - FAILURE, -} TrackingResult; - -typedef std::string Feature; - /** * A nut client is the starting point to dialog to NUTD. * It can connect to an NUTD then retrieve its device list. @@ -160,7 +122,7 @@ class Client friend class Variable; friend class Command; public: - virtual ~Client(); + ~Client(); /** * Intend to authenticate to a NUTD server. @@ -170,13 +132,13 @@ public: * \todo Is his method is global to all connection protocol or is it specific to TCP ? * \note Actually, authentication fails only if already set, not if bad values are sent. */ - virtual void authenticate(const std::string& user, const std::string& passwd) = 0; + virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException)=0; /** * Disconnect from the NUTD server. * \todo Is his method is global to all connection protocol or is it specific to TCP ? */ - virtual void logout() = 0; + virtual void logout()throw(NutException)=0; /** * Device manipulations. @@ -189,29 +151,29 @@ public: * \param name Name of the device. * \return The device. */ - virtual Device getDevice(const std::string& name); + virtual Device getDevice(const std::string& name)throw(NutException); /** * Retrieve the list of all devices supported by UPSD server. * \return The set of supported devices. */ - virtual std::set getDevices(); + virtual std::set getDevices()throw(NutException); /** * Test if a device is supported by the NUTD server. * \param dev Device name. * \return true if supported, false otherwise. */ - virtual bool hasDevice(const std::string& dev); + virtual bool hasDevice(const std::string& dev)throw(NutException); /** * Retrieve names of devices supported by NUTD server. * \return The set of names of supported devices. */ - virtual std::set getDeviceNames() = 0; + virtual std::set getDeviceNames()throw(NutException)=0; /** * Retrieve the description of a device. * \param name Device name. * \return Device description. */ - virtual std::string getDeviceDescription(const std::string& name) = 0; + virtual std::string getDeviceDescription(const std::string& name)throw(NutException)=0; /** \} */ /** @@ -224,60 +186,54 @@ public: * \param dev Device name * \return Variable names */ - virtual std::set getDeviceVariableNames(const std::string& dev) = 0; + virtual std::set getDeviceVariableNames(const std::string& dev)throw(NutException)=0; /** * Retrieve names of read/write variables supported by a device. * \param dev Device name * \return RW variable names */ - virtual std::set getDeviceRWVariableNames(const std::string& dev) = 0; + virtual std::set getDeviceRWVariableNames(const std::string& dev)throw(NutException)=0; /** * Test if a variable is supported by a device. * \param dev Device name * \param name Variable name * \return true if the variable is supported. */ - virtual bool hasDeviceVariable(const std::string& dev, const std::string& name); + virtual bool hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException); /** * Retrieve the description of a variable. * \param dev Device name * \param name Variable name * \return Variable description if provided. */ - virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name) = 0; + virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException)=0; /** * Retrieve values of a variable. * \param dev Device name * \param name Variable name * \return Variable values (usually one) if available. */ - virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name) = 0; + virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException)=0; /** * Retrieve values of all variables of a device. * \param dev Device name * \return Variable values indexed by variable names. */ - virtual std::map > getDeviceVariableValues(const std::string& dev); - /** - * Retrieve values of all variables of a set of devices. - * \param devs Device names - * \return Variable values indexed by variable names, indexed by device names. - */ - virtual std::map > > getDevicesVariableValues(const std::set& devs); + virtual std::map > getDeviceVariableValues(const std::string& dev)throw(NutException); /** * Intend to set the value of a variable. * \param dev Device name * \param name Variable name * \param value Variable value - */ - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) = 0; + */ + virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException)=0; /** * Intend to set the value of a variable. * \param dev Device name * \param name Variable name - * \param values Vector of variable values - */ - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values) = 0; + * \param value Variable value + */ + virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException)=0; /** \} */ /** @@ -290,28 +246,27 @@ public: * \param dev Device name * \return Command names */ - virtual std::set getDeviceCommandNames(const std::string& dev) = 0; + virtual std::set getDeviceCommandNames(const std::string& dev)throw(NutException)=0; /** * Test if a command is supported by a device. * \param dev Device name * \param name Command name * \return true if the command is supported. */ - virtual bool hasDeviceCommand(const std::string& dev, const std::string& name); + virtual bool hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException); /** * Retrieve the description of a command. * \param dev Device name * \param name Command name * \return Command description if provided. */ - virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name) = 0; + virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException)=0; /** * Intend to execute a command. * \param dev Device name * \param name Command name - * \param param Additional command parameter */ - virtual TrackingID executeDeviceCommand(const std::string& dev, const std::string& name, const std::string& param="") = 0; + virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException)=0; /** \} */ /** @@ -322,33 +277,15 @@ public: * Log the current user (if authenticated) for a device. * \param dev Device name. */ - virtual void deviceLogin(const std::string& dev) = 0; + virtual void deviceLogin(const std::string& dev)throw(NutException)=0; /** - * Retrieve the number of user logged-in for the specified device. + * Retrieve the number of user longged in the specified device. * \param dev Device name. * \return Number of logged-in users. */ - virtual int deviceGetNumLogins(const std::string& dev) = 0; - /* NOTE: "master" is deprecated since NUT v2.8.0 in favor of "primary". - * For the sake of old/new server/client interoperability, - * practical implementations should try to use one and fall - * back to the other, and only fail if both return "ERR". - */ - virtual void deviceMaster(const std::string& dev) = 0; - virtual void devicePrimary(const std::string& dev) = 0; - virtual void deviceForcedShutdown(const std::string& dev) = 0; - - /** - * Retrieve the result of a tracking ID. - * \param id Tracking ID. - */ - virtual TrackingResult getTrackingResult(const TrackingID& id) = 0; - - virtual bool hasFeature(const Feature& feature); - virtual bool isFeatureEnabled(const Feature& feature) = 0; - virtual void setFeature(const Feature& feature, bool status) = 0; - - static const Feature TRACKING; + virtual int deviceGetNumLogins(const std::string& dev)throw(NutException)=0; + virtual void deviceMaster(const std::string& dev)throw(NutException)=0; + virtual void deviceForcedShutdown(const std::string& dev)throw(NutException)=0; protected: Client(); @@ -360,11 +297,6 @@ protected: */ class TcpClient : public Client { - /* We have a number of direct-call methods we do not expose - * generally, but still want covered with integration tests - */ - friend class NutActiveClientTest; - public: /** * Construct a nut TcpClient object. @@ -377,21 +309,21 @@ public: * \param host Server host name. * \param port Server port. */ - TcpClient(const std::string& host, uint16_t port = 3493); - ~TcpClient() override; + TcpClient(const std::string& host, int port = 3493)throw(nut::IOException); + ~TcpClient(); /** * Connect it to the specified server. * \param host Server host name. * \param port Server port. */ - void connect(const std::string& host, uint16_t port = 3493); + void connect(const std::string& host, int port = 3493)throw(nut::IOException); /** * Connect to the server. * Host name and ports must have already set (usefull for reconnection). */ - void connect(); + void connect()throw(nut::IOException); /** * Test if the connection is active. @@ -407,13 +339,13 @@ public: * Set the timeout in seconds. * \param timeout Timeout n seconds, negative to block operations. */ - void setTimeout(time_t timeout); + void setTimeout(long timeout); /** * Retrieve the timeout. * \returns Current timeout in seconds. */ - time_t getTimeout()const; + long getTimeout()const; /** * Retriueve the host name of the server the client is connected to. @@ -424,64 +356,53 @@ public: * Retriueve the port of host of the server the client is connected to. * \return Server port */ - uint16_t getPort()const; + int getPort()const; - virtual void authenticate(const std::string& user, const std::string& passwd) override; - virtual void logout() override; + virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException); + virtual void logout()throw(NutException); + + virtual Device getDevice(const std::string& name)throw(NutException); + virtual std::set getDeviceNames()throw(NutException); + virtual std::string getDeviceDescription(const std::string& name)throw(NutException); - virtual Device getDevice(const std::string& name) override; - virtual std::set getDeviceNames() override; - virtual std::string getDeviceDescription(const std::string& name) override; + virtual std::set getDeviceVariableNames(const std::string& dev)throw(NutException); + virtual std::set getDeviceRWVariableNames(const std::string& dev)throw(NutException); + virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException); + virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException); + virtual std::map > getDeviceVariableValues(const std::string& dev)throw(NutException); + virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException); + virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException); - virtual std::set getDeviceVariableNames(const std::string& dev) override; - virtual std::set getDeviceRWVariableNames(const std::string& dev) override; - virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name) override; - virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name) override; - virtual std::map > getDeviceVariableValues(const std::string& dev) override; - virtual std::map > > getDevicesVariableValues(const std::set& devs) override; - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) override; - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values) override; + virtual std::set getDeviceCommandNames(const std::string& dev)throw(NutException); + virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException); + virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException); - virtual std::set getDeviceCommandNames(const std::string& dev) override; - virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name) override; - virtual TrackingID executeDeviceCommand(const std::string& dev, const std::string& name, const std::string& param="") override; - - virtual void deviceLogin(const std::string& dev) override; - /* FIXME: Protocol update needed to handle master/primary alias - * and probably an API bump also, to rename/alias the routine. - */ - virtual void deviceMaster(const std::string& dev) override; - virtual void devicePrimary(const std::string& dev) override; - virtual void deviceForcedShutdown(const std::string& dev) override; - virtual int deviceGetNumLogins(const std::string& dev) override; - - virtual TrackingResult getTrackingResult(const TrackingID& id) override; - - virtual bool isFeatureEnabled(const Feature& feature) override; - virtual void setFeature(const Feature& feature, bool status) override; + virtual void deviceLogin(const std::string& dev)throw(NutException); + virtual void deviceMaster(const std::string& dev)throw(NutException); + virtual void deviceForcedShutdown(const std::string& dev)throw(NutException); + virtual int deviceGetNumLogins(const std::string& dev)throw(NutException); protected: - std::string sendQuery(const std::string& req); - void sendAsyncQueries(const std::vector& req); - static void detectError(const std::string& req); - TrackingID sendTrackingQuery(const std::string& req); + std::string sendQuery(const std::string& req)throw(nut::IOException); + static void detectError(const std::string& req)throw(nut::NutException); - std::vector get(const std::string& subcmd, const std::string& params = ""); + std::vector get(const std::string& subcmd, const std::string& params = "") + throw(nut::NutException); - std::vector > list(const std::string& subcmd, const std::string& params = ""); - - std::vector > parseList(const std::string& req); + std::vector > list(const std::string& subcmd, const std::string& params = "") + throw(nut::NutException); static std::vector explode(const std::string& str, size_t begin=0); static std::string escape(const std::string& str); private: std::string _host; - uint16_t _port; - time_t _timeout; + int _port; + long _timeout; internal::Socket* _socket; }; + /** * Device attached to a client. * Device is a lightweight class which can be copied easily. @@ -490,14 +411,9 @@ class Device { friend class Client; friend class TcpClient; - friend class TcpClientMock; -#ifdef _NUTCLIENTTEST_BUILD - friend class NutClientTest; -#endif public: ~Device(); Device(const Device& dev); - Device& operator=(const Device& dev); /** * Retrieve the name of the device. @@ -519,117 +435,112 @@ public: bool isOk()const; /** * Test if the device is valid (has a name and is attached to a client). - * @see Device::isOk() + * @see Device::isOk() */ operator bool()const; /** * Test if the device is not valid (has no name or is not attached to any client). - * @see Device::isOk() + * @see Device::isOk() */ bool operator!()const; /** * Test if the two devices are sames (same name ad same client attached to). */ bool operator==(const Device& dev)const; - /** - * Comparison operator. - */ - bool operator<(const Device& dev)const; + /** + * Comparison operator. + */ + bool operator<(const Device& dev)const; /** * Retrieve the description of the devce if specified. */ - std::string getDescription(); + std::string getDescription()throw(NutException); /** * Intend to retrieve the value of a variable of the device. * \param name Name of the variable to get. - * \return Value of the variable, if available. + * \return Value of the variable, if available. */ - std::vector getVariableValue(const std::string& name); + std::vector getVariableValue(const std::string& name)throw(NutException); /** * Intend to retrieve values of all variables of the devices. * \return Map of all variables values indexed by their names. */ - std::map > getVariableValues(); + std::map > getVariableValues()throw(NutException); /** * Retrieve all variables names supported by the device. * \return Set of available variable names. */ - std::set getVariableNames(); + std::set getVariableNames()throw(NutException); /** * Retrieve all Read/Write variables names supported by the device. * \return Set of available Read/Write variable names. */ - std::set getRWVariableNames(); + std::set getRWVariableNames()throw(NutException); /** * Intend to set the value of a variable of the device. * \param name Variable name. * \param value New variable value. */ - void setVariable(const std::string& name, const std::string& value); + void setVariable(const std::string& name, const std::string& value)throw(NutException); /** * Intend to set values of a variable of the device. * \param name Variable name. - * \param values Vector of new variable values. + * \param value New variable values. */ - void setVariable(const std::string& name, const std::vector& values); + void setVariable(const std::string& name, const std::vector& values)throw(NutException); /** * Retrieve a Variable object representing the specified variable. - * \param name Variable name. + * \param name Variable name. * \return Variable object. */ - Variable getVariable(const std::string& name); + Variable getVariable(const std::string& name)throw(NutException); /** * Retrieve Variable objects representing all variables available for the device. * \return Set of Variable objects. */ - std::set getVariables(); + std::set getVariables()throw(NutException); /** * Retrieve Variable objects representing all Read/Write variables available for the device. * \return Set of Variable objects. */ - std::set getRWVariables(); + std::set getRWVariables()throw(NutException); /** * Retrieve names of all commands supported by the device. * \return Set of available command names. */ - std::set getCommandNames(); + std::set getCommandNames()throw(NutException); /** * Retrieve objects for all commands supported by the device. * \return Set of available Command objects. */ - std::set getCommands(); + std::set getCommands()throw(NutException); /** * Retrieve an object representing a command of the device. * \param name Command name. * \return Command object. */ - Command getCommand(const std::string& name); + Command getCommand(const std::string& name)throw(NutException); /** * Intend to execute a command on the device. * \param name Command name. - * \param param Additional command parameter */ - TrackingID executeCommand(const std::string& name, const std::string& param=""); + void executeCommand(const std::string& name)throw(NutException); /** * Login current client's user for the device. */ - void login(); - /* FIXME: Protocol update needed to handle master/primary alias - * and probably an API bump also, to rename/alias the routine. - */ - void master(); - void primary(); - void forcedShutdown(); + void login()throw(NutException); + void master()throw(NutException); + void forcedShutdown()throw(NutException); /** * Retrieve the number of logged user for the device. * \return Number of users. */ - int getNumLogins(); + int getNumLogins()throw(NutException); protected: Device(Client* client, const std::string& name); @@ -647,15 +558,10 @@ class Variable { friend class Device; friend class TcpClient; - friend class TcpClientMock; -#ifdef _NUTCLIENTTEST_BUILD - friend class NutClientTest; -#endif public: ~Variable(); Variable(const Variable& var); - Variable& operator=(const Variable& var); /** * Retrieve variable name. @@ -697,23 +603,23 @@ public: * Intend to retrieve variable value. * \return Value of the variable. */ - std::vector getValue(); + std::vector getValue()throw(NutException); /** * Intend to retireve variable description. * \return Variable description if provided. */ - std::string getDescription(); + std::string getDescription()throw(NutException); /** * Intend to set a value to the variable. * \param value New variable value. */ - void setValue(const std::string& value); + void setValue(const std::string& value)throw(NutException); /** * Intend to set (multiple) values to the variable. - * \param values Vector of new variable values. + * \param value New variable values. */ - void setValues(const std::vector& values); + void setValues(const std::vector& values)throw(NutException); protected: Variable(Device* dev, const std::string& name); @@ -731,15 +637,10 @@ class Command { friend class Device; friend class TcpClient; - friend class TcpClientMock; -#ifdef _NUTCLIENTTEST_BUILD - friend class NutClientTest; -#endif public: ~Command(); Command(const Command& cmd); - Command& operator=(const Command& cmd); /** * Retrieve command name. @@ -782,13 +683,13 @@ public: * Intend to retireve command description. * \return Command description if provided. */ - std::string getDescription(); + std::string getDescription()throw(NutException); /** - * Intend to execute the instant command on device. - * \param param Optional additional command parameter + * Intend to retrieve command description. + * \return Command description if provided. */ - void execute(const std::string& param=""); + void execute()throw(NutException); protected: Command(Device* dev, const std::string& name); @@ -821,19 +722,13 @@ typedef char** strarr; /** * Alloc an array of string. */ -strarr strarr_alloc(size_t count); +strarr strarr_alloc(unsigned short count); /** * Free an array of string. */ void strarr_free(strarr arr); -/** - * Convert C++ types into an array of string. - */ -strarr stringvector_to_strarr(const std::vector& strset); -strarr stringset_to_strarr(const std::set& strset); - /** * Nut general client types and functions. @@ -843,7 +738,7 @@ strarr stringset_to_strarr(const std::set& strset); typedef void* NUTCLIENT_t; /** - * Destroy a client. + * Destroy a client. * \param client Nut client handle. */ void nutclient_destroy(NUTCLIENT_t client); @@ -881,11 +776,7 @@ int nutclient_get_device_num_logins(NUTCLIENT_t client, const char* dev); * \param client Nut client handle. * \param dev Device name to test. */ -/* FIXME: Protocol update needed to handle master/primary alias - * and probably an API bump also, to rename/alias the routine. - */ void nutclient_device_master(NUTCLIENT_t client, const char* dev); -void nutclient_device_primary(NUTCLIENT_t client, const char* dev); /** * Set the FSD flag for the device. @@ -1010,7 +901,7 @@ char* nutclient_get_device_command_description(NUTCLIENT_t client, const char* d * \param dev Device name. * \param cmd Command name. */ -void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd, const char* param=""); +void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd); /** \} */ @@ -1020,7 +911,7 @@ void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const * \{ */ /** - * Hidden structure representing a TCP connection to NUTD. + * Hidden structure representing a TCP connection to NUTD. * NUTCLIENT_TCP_t is back compatible to NUTCLIENT_t. */ typedef NUTCLIENT_t NUTCLIENT_TCP_t; @@ -1029,9 +920,9 @@ typedef NUTCLIENT_t NUTCLIENT_TCP_t; * Create a client to NUTD using a TCP connection. * \param host Host name to connect to. * \param port Host port. - * \return New client or nullptr if failed. + * \return New client or NULL if failed. */ -NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, uint16_t port); +NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, unsigned short port); /** * Test if a nut TCP client is connected. * \param client Nut TCP client handle. @@ -1054,12 +945,12 @@ int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client); * Set the timeout value for the TCP connection. * \param timeout Timeout in seconds, negative for blocking. */ -void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout); +void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, long timeout); /** * Retrieve the timeout value for the TCP connection. * \return Timeout value in seconds. */ -time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); +long nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); /** \} */ diff --git a/clients/nutclientmem.cpp b/clients/nutclientmem.cpp deleted file mode 100644 index df97cb3..0000000 --- a/clients/nutclientmem.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* nutclientmem.cpp - nutclientmem C++ library implementation - - Copyright (C) 2021 Eric Clappier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "nutclientmem.h" -#include - -namespace nut -{ - -/* - * - * Memory Client stub implementation - * - */ - -Device MemClientStub::getDevice(const std::string& name) -{ - NUT_UNUSED_VARIABLE(name); - throw NutException("Not implemented"); -} - -std::set MemClientStub::getDeviceNames() -{ - throw NutException("Not implemented"); -} - -std::string MemClientStub::getDeviceDescription(const std::string& name) -{ - NUT_UNUSED_VARIABLE(name); - throw NutException("Not implemented"); -} - -std::set MemClientStub::getDeviceVariableNames(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -std::set MemClientStub::getDeviceRWVariableNames(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -std::string MemClientStub::getDeviceVariableDescription(const std::string& dev, const std::string& name) -{ - NUT_UNUSED_VARIABLE(dev); - NUT_UNUSED_VARIABLE(name); - throw NutException("Not implemented"); -} - -ListValue MemClientStub::getDeviceVariableValue(const std::string& dev, const std::string& name) -{ - ListValue res; - auto it_dev = _values.find(dev); - if (it_dev != _values.end()) - { - auto map = it_dev->second; - auto it_map = map.find(name); - if (it_map != map.end()) - { - res = it_map->second; - } - } - return res; -} - -ListObject MemClientStub::getDeviceVariableValues(const std::string& dev) -{ - ListObject res; - auto it_dev = _values.find(dev); - if (it_dev != _values.end()) - { - res = it_dev->second; - } - return res; -} - -ListDevice MemClientStub::getDevicesVariableValues(const std::set& devs) -{ - ListDevice res; - for (auto itr = devs.begin(); itr != devs.end(); itr++) - { - std::string dev = *itr; - auto it_dev = _values.find(dev); - if (it_dev != _values.end()) - { - res.insert(std::pair(dev, it_dev->second)); - } - } - return res; -} - -TrackingID MemClientStub::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) -{ - auto it_dev = _values.find(dev); - if (it_dev == _values.end()) - { - ListObject list; - _values.emplace(dev, list); - it_dev = _values.find(dev); - } - if (it_dev != _values.end()) - { - auto map = &(it_dev->second); - auto it_map = map->find(name); - if (it_map != map->end()) - { - it_map->second[0] = value; - } - else - { - ListValue list_value; - list_value.push_back(value); - map->emplace(name, list_value); - } - } - return ""; -} - -TrackingID MemClientStub::setDeviceVariable(const std::string& dev, const std::string& name, const ListValue& values) -{ - auto it_dev = _values.find(dev); - if (it_dev != _values.end()) - { - auto map = &(it_dev->second); - auto it_map = map->find(name); - if (it_map != map->end()) - { - it_map->second = values; - } - else - { - map->emplace(name, values); - } - } - return ""; -} - -std::set MemClientStub::getDeviceCommandNames(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -std::string MemClientStub::getDeviceCommandDescription(const std::string& dev, const std::string& name) -{ - NUT_UNUSED_VARIABLE(dev); - NUT_UNUSED_VARIABLE(name); - throw NutException("Not implemented"); -} - -TrackingID MemClientStub::executeDeviceCommand(const std::string& dev, const std::string& name, const std::string& param) -{ - NUT_UNUSED_VARIABLE(dev); - NUT_UNUSED_VARIABLE(name); - NUT_UNUSED_VARIABLE(param); - throw NutException("Not implemented"); -} - -void MemClientStub::deviceLogin(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -/* Note: "master" is deprecated, but supported - * for mixing old/new client/server combos: */ -void MemClientStub::deviceMaster(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -void MemClientStub::devicePrimary(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -void MemClientStub::deviceForcedShutdown(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -int MemClientStub::deviceGetNumLogins(const std::string& dev) -{ - NUT_UNUSED_VARIABLE(dev); - throw NutException("Not implemented"); -} - -TrackingResult MemClientStub::getTrackingResult(const TrackingID& id) -{ - NUT_UNUSED_VARIABLE(id); - throw NutException("Not implemented"); - //return TrackingResult::SUCCESS; -} - -bool MemClientStub::isFeatureEnabled(const Feature& feature) -{ - NUT_UNUSED_VARIABLE(feature); - throw NutException("Not implemented"); -} - -void MemClientStub::setFeature(const Feature& feature, bool status) -{ - NUT_UNUSED_VARIABLE(feature); - NUT_UNUSED_VARIABLE(status); - throw NutException("Not implemented"); -} - -} /* namespace nut */ - -/** - * C nutclient API. - */ -extern "C" { - -NUTCLIENT_MEM_t nutclient_mem_create_client() -{ - nut::MemClientStub* client = new nut::MemClientStub; - try - { - return static_cast(client); - } - catch(nut::NutException& ex) - { - // TODO really catch it - NUT_UNUSED_VARIABLE(ex); - delete client; - return nullptr; - } -} - -} /* extern "C" */ diff --git a/clients/nutclientmem.h b/clients/nutclientmem.h deleted file mode 100644 index 3bd2243..0000000 --- a/clients/nutclientmem.h +++ /dev/null @@ -1,118 +0,0 @@ -/* nutclientmem.h - definitions for nutclientmem C/C++ library - - Copyright (C) 2021 Eric Clappier - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUTCLIENTMEM_HPP_SEEN -#define NUTCLIENTMEM_HPP_SEEN - -/* Begin of C++ nutclient library declaration */ -#ifdef __cplusplus - -#include "nutclient.h" - -namespace nut -{ - -typedef std::vector ListValue; -typedef std::map ListObject; -typedef std::map ListDevice; - -/** - * Memory client stub. - * Class to stub TCPClient for test (data store in local memory). - */ -class MemClientStub : public Client -{ -public: - /** - * Construct a nut MemClientStub object. - */ - MemClientStub() {} - ~MemClientStub() override {} - - virtual void authenticate(const std::string& user, const std::string& passwd) override { - NUT_UNUSED_VARIABLE(user); - NUT_UNUSED_VARIABLE(passwd); - } - virtual void logout() override {} - - virtual Device getDevice(const std::string& name) override; - virtual std::set getDeviceNames() override; - virtual std::string getDeviceDescription(const std::string& name) override; - - virtual std::set getDeviceVariableNames(const std::string& dev) override; - virtual std::set getDeviceRWVariableNames(const std::string& dev) override; - virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name) override; - virtual ListValue getDeviceVariableValue(const std::string& dev, const std::string& name) override; - virtual ListObject getDeviceVariableValues(const std::string& dev) override; - virtual ListDevice getDevicesVariableValues(const std::set& devs) override; - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) override; - virtual TrackingID setDeviceVariable(const std::string& dev, const std::string& name, const ListValue& values) override; - - virtual std::set getDeviceCommandNames(const std::string& dev) override; - virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name) override; - virtual TrackingID executeDeviceCommand(const std::string& dev, const std::string& name, const std::string& param="") override; - - virtual void deviceLogin(const std::string& dev) override; - /* Note: "master" is deprecated, but supported - * for mixing old/new client/server combos: */ - virtual void deviceMaster(const std::string& dev) override; - virtual void devicePrimary(const std::string& dev) override; - virtual void deviceForcedShutdown(const std::string& dev) override; - virtual int deviceGetNumLogins(const std::string& dev) override; - - virtual TrackingResult getTrackingResult(const TrackingID& id) override; - - virtual bool isFeatureEnabled(const Feature& feature) override; - virtual void setFeature(const Feature& feature, bool status) override; - -private: - ListDevice _values; -}; - -} /* namespace nut */ - -#endif /* __cplusplus */ -/* End of C++ nutclient library declaration */ - -/* Begin of C nutclient library declaration */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * Nut MEM client dedicated types and functions - */ -/** - * Hidden structure representing a MEM connection. - * NUTCLIENT_MEM_t is back compatible to NUTCLIENT_t. - */ -typedef NUTCLIENT_t NUTCLIENT_MEM_t; - -/** - * Create a client to NUTD using memory. - * \return New client or nullptr if failed. - */ -NUTCLIENT_MEM_t nutclient_mem_create_client(); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -/* End of C nutclient library declaration */ - -#endif /* NUTCLIENTMOCK_HPP_SEEN */ diff --git a/clients/status.h b/clients/status.h index c643351..c98c489 100644 --- a/clients/status.h +++ b/clients/status.h @@ -17,19 +17,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_STATUS_H_SEEN -#define NUT_STATUS_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -/* This is only used in upsstats.c, but might it also have external consumers?.. - * To move or not to move?.. - */ -static struct { +struct { char *name; char *desc; int severity; @@ -54,4 +48,3 @@ static struct { /* *INDENT-ON* */ #endif -#endif /* NUT_STATUS_H_SEEN */ diff --git a/clients/upsc.c b/clients/upsc.c index 550b74a..ae584d3 100644 --- a/clients/upsc.c +++ b/clients/upsc.c @@ -1,4 +1,4 @@ -/* upsc - simple "client" to test communications +/* upsc - simple "client" to test communications Copyright (C) 1999 Russell Kroll Copyright (C) 2012 Arnaud Quette @@ -25,7 +25,6 @@ #include #include -#include "nut_stdint.h" #include "upsclient.h" static char *upsname = NULL, *hostname = NULL; @@ -59,7 +58,7 @@ static void usage(const char *prog) static void printvar(const char *var) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -87,7 +86,7 @@ static void printvar(const char *var) } if (numa < numq) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least %zu)", numa, numq); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least %d)", numa, numq); } printf("%s\n", answer[3]); @@ -96,7 +95,7 @@ static void printvar(const char *var) static void list_vars(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -120,7 +119,7 @@ static void list_vars(void) /* VAR */ if (numa < 4) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 4)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } printf("%s: %s\n", answer[2], answer[3]); @@ -130,7 +129,7 @@ static void list_vars(void) static void list_upses(int verbose) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -138,7 +137,7 @@ static void list_upses(int verbose) numq = 1; ret = upscli_list_start(ups, numq, query); - + if (ret < 0) { /* check for an old upsd */ if (upscli_upserror(ups) == UPSCLI_ERR_UNKCOMMAND) { @@ -152,7 +151,7 @@ static void list_upses(int verbose) /* UPS */ if (numa < 3) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 3)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 3)", numa); } if(verbose) { @@ -166,7 +165,7 @@ static void list_upses(int verbose) static void list_clients(const char *devname) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -189,7 +188,7 @@ static void list_clients(const char *devname) /* CLIENT
*/ if (numa < 3) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 3)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 3)", numa); } printf("%s\n", answer[2]); @@ -209,8 +208,7 @@ static void clean_exit(void) int main(int argc, char **argv) { - int i; - uint16_t port; + int i, port; int varlist = 0, clientlist = 0, verbose = 0; const char *prog = xbasename(argv[0]); @@ -220,9 +218,7 @@ int main(int argc, char **argv) { case 'L': verbose = 1; - goto fallthrough_case_l; case 'l': - fallthrough_case_l: varlist = 1; break; case 'c': @@ -231,9 +227,6 @@ int main(int argc, char **argv) case 'V': fatalx(EXIT_SUCCESS, "Network UPS Tools upscmd %s", UPS_VERSION); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_SUCCESS); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif case 'h': default: diff --git a/clients/upsclient.c b/clients/upsclient.c index 2787783..797786b 100644 --- a/clients/upsclient.c +++ b/clients/upsclient.c @@ -20,12 +20,11 @@ */ #include "config.h" /* safe because it doesn't contain prototypes */ -#include "nut_platform.h" #ifdef HAVE_PTHREAD /* this include is needed on AIX to have errno stored in thread local storage */ #include -#endif +#endif #include #include @@ -38,24 +37,9 @@ #include #include -#include "common.h" -#include "nut_stdint.h" -#include "timehead.h" #include "upsclient.h" - -/* WA for Solaris/i386 bug: non-blocking connect sets errno to ENOENT */ -#if (defined NUT_PLATFORM_SOLARIS) - #define SOLARIS_i386_NBCONNECT_ENOENT(status) ( (!strcmp("i386", CPU_TYPE)) ? (ENOENT == (status)) : 0 ) -#else - #define SOLARIS_i386_NBCONNECT_ENOENT(status) (0) -#endif /* end of Solaris/i386 WA for non-blocking connect */ - -/* WA for AIX bug: non-blocking connect sets errno to 0 */ -#if (defined NUT_PLATFORM_AIX) - #define AIX_NBCONNECT_0(status) (0 == (status)) -#else - #define AIX_NBCONNECT_0(status) (0) -#endif /* end of AIX WA for non-blocking connect */ +#include "common.h" +#include "timehead.h" #ifdef WITH_NSS #include @@ -76,7 +60,7 @@ #define shutdown_how 2 #endif -static struct { +struct { int flags; const char *str; } upscli_errlist[] = @@ -132,7 +116,7 @@ typedef struct HOST_CERT_s { const char *certname; int certverify; int forcessl; - + struct HOST_CERT_s *next; } HOST_CERT_t; static HOST_CERT_t* upscli_find_host_cert(const char* hostname); @@ -154,7 +138,7 @@ static char* nsscertpasswd = NULL; static void ssl_debug(void) { - unsigned long e; + int e; char errmsg[SMALLBUF]; while ((e = ERR_get_error()) != 0) { @@ -163,36 +147,32 @@ static void ssl_debug(void) } } -static int ssl_error(SSL *ssl, ssize_t ret) +static int ssl_error(SSL *ssl, int ret) { int e; - if (ret >= INT_MAX) { - upslogx(LOG_ERR, "ssl_error() ret=%zd would not fit in an int", ret); - return -1; - } - e = SSL_get_error(ssl, (int)ret); + e = SSL_get_error(ssl, ret); switch (e) { case SSL_ERROR_WANT_READ: - upslogx(LOG_ERR, "ssl_error() ret=%zd SSL_ERROR_WANT_READ", ret); + upslogx(LOG_ERR, "ssl_error() ret=%d SSL_ERROR_WANT_READ", ret); break; case SSL_ERROR_WANT_WRITE: - upslogx(LOG_ERR, "ssl_error() ret=%zd SSL_ERROR_WANT_WRITE", ret); + upslogx(LOG_ERR, "ssl_error() ret=%d SSL_ERROR_WANT_WRITE", ret); break; case SSL_ERROR_SYSCALL: if (ret == 0 && ERR_peek_error() == 0) { upslogx(LOG_ERR, "ssl_error() EOF from client"); } else { - upslogx(LOG_ERR, "ssl_error() ret=%zd SSL_ERROR_SYSCALL", ret); + upslogx(LOG_ERR, "ssl_error() ret=%d SSL_ERROR_SYSCALL", ret); } break; default: - upslogx(LOG_ERR, "ssl_error() ret=%zd SSL_ERROR %d", ret, e); + upslogx(LOG_ERR, "ssl_error() ret=%d SSL_ERROR %d", ret, e); ssl_debug(); } @@ -201,12 +181,9 @@ static int ssl_error(SSL *ssl, ssize_t ret) #elif defined(WITH_NSS) /* WITH_OPENSSL */ -static char *nss_password_callback(PK11SlotInfo *slot, PRBool retry, +static char *nss_password_callback(PK11SlotInfo *slot, PRBool retry, void *arg) { - NUT_UNUSED_VARIABLE(retry); - NUT_UNUSED_VARIABLE(arg); - upslogx(LOG_INFO, "Intend to retrieve password for %s / %s: password %sconfigured", PK11_GetSlotName(slot), PK11_GetTokenName(slot), nsscertpasswd?"":"not "); return nsscertpasswd ? PL_strdup(nsscertpasswd) : NULL; @@ -241,10 +218,6 @@ static SECStatus AuthCertificateDontVerify(CERTCertDBHandle *arg, PRFileDesc *fd PRBool checksig, PRBool isServer) { UPSCONN_t *ups = (UPSCONN_t *)SSL_RevealPinArg(fd); - NUT_UNUSED_VARIABLE(arg); - NUT_UNUSED_VARIABLE(checksig); - NUT_UNUSED_VARIABLE(isServer); - upslogx(LOG_INFO, "Do not intend to authenticate server %s", ups?ups->host:""); return SECSuccess; @@ -253,8 +226,6 @@ static SECStatus AuthCertificateDontVerify(CERTCertDBHandle *arg, PRFileDesc *fd static SECStatus BadCertHandler(UPSCONN_t *arg, PRFileDesc *fd) { HOST_CERT_t* cert; - NUT_UNUSED_VARIABLE(fd); - upslogx(LOG_WARNING, "Certificate validation failed for %s", (arg&&arg->host)?arg->host:""); /* BadCertHandler is called when the NSS certificate validation is failed. @@ -302,63 +273,49 @@ static SECStatus GetClientAuthData(UPSCONN_t *arg, PRFileDesc *fd, static void HandshakeCallback(PRFileDesc *fd, UPSCONN_t *client_data) { - NUT_UNUSED_VARIABLE(fd); - upslogx(LOG_INFO, "SSL handshake done successfully with server %s", client_data->host); } #endif /* WITH_OPENSSL | WITH_NSS */ -int upscli_init(int certverify, const char *certpath, +int upscli_init(int certverify, const char *certpath, const char *certname, const char *certpasswd) { #ifdef WITH_OPENSSL - long ret; - int ssl_mode = SSL_VERIFY_NONE; - NUT_UNUSED_VARIABLE(certname); - NUT_UNUSED_VARIABLE(certpasswd); + int ret, ssl_mode = SSL_VERIFY_NONE; +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + const SSL_METHOD *ssl_method; +#else + SSL_METHOD *ssl_method; +#endif #elif defined(WITH_NSS) /* WITH_OPENSSL */ SECStatus status; -#else - NUT_UNUSED_VARIABLE(certverify); - NUT_UNUSED_VARIABLE(certpath); - NUT_UNUSED_VARIABLE(certname); - NUT_UNUSED_VARIABLE(certpasswd); #endif /* WITH_OPENSSL | WITH_NSS */ + if (upscli_initialized == 1) { upslogx(LOG_WARNING, "upscli already initialized"); return -1; } - + #ifdef WITH_OPENSSL - -#if OPENSSL_VERSION_NUMBER < 0x10100000L - SSL_load_error_strings(); + SSL_library_init(); + SSL_load_error_strings(); - ssl_ctx = SSL_CTX_new(SSLv23_client_method()); -#else - ssl_ctx = SSL_CTX_new(TLS_client_method()); -#endif + ssl_method = TLSv1_client_method(); + if (!ssl_method) { + return 0; + } + + ssl_ctx = SSL_CTX_new(ssl_method); if (!ssl_ctx) { upslogx(LOG_ERR, "Can not initialize SSL context"); return -1; } - -#if OPENSSL_VERSION_NUMBER < 0x10100000L - /* set minimum protocol TLSv1 */ - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); -#else - ret = SSL_CTX_set_min_proto_version(ssl_ctx, TLS1_VERSION); - if (ret != 1) { - upslogx(LOG_ERR, "Can not set minimum protocol to TLSv1"); - return -1; - } -#endif - + if (!certpath) { if (certverify == 1) { upslogx(LOG_ERR, "Can not verify certificate if any is specified"); @@ -381,13 +338,13 @@ int upscli_init(int certverify, const char *certpath, return -1; } - SSL_CTX_set_verify(ssl_ctx, ssl_mode, NULL); + SSL_CTX_set_verify(ssl_ctx, ssl_mode, NULL); } #elif defined(WITH_NSS) /* WITH_OPENSSL */ PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - + PK11_SetPasswordFunc(nss_password_callback); - + if (certpath) { upslogx(LOG_INFO, "Init SSL with cerificate database located at %s", certpath); status = NSS_Init(certpath); @@ -400,16 +357,16 @@ int upscli_init(int certverify, const char *certpath, nss_error("upscli_init / NSS_[NoDB]_Init"); return -1; } - + status = NSS_SetDomesticPolicy(); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not initialize SSL policy"); nss_error("upscli_init / NSS_SetDomesticPolicy"); return -1; } - + SSL_ClearSessionCache(); - + status = SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not enable SSLv3"); @@ -435,13 +392,8 @@ int upscli_init(int certverify, const char *certpath, nsscertpasswd = xstrdup(certpasswd); } verify_certificate = certverify; -#else - /* Note: historically we do not return with error here, - * just fall through to below and treat as initialized. - */ - upslogx(LOG_ERR, "upscli_init called but SSL wasn't compiled in"); #endif /* WITH_OPENSSL | WITH_NSS */ - + upscli_initialized = 1; return 1; } @@ -456,11 +408,6 @@ void upscli_add_host_cert(const char* hostname, const char* certname, int certve cert->certverify = certverify; cert->forcessl = forcessl; first_host_cert = cert; -#else - NUT_UNUSED_VARIABLE(hostname); - NUT_UNUSED_VARIABLE(certname); - NUT_UNUSED_VARIABLE(certverify); - NUT_UNUSED_VARIABLE(forcessl); #endif /* WITH_NSS */ } @@ -476,13 +423,11 @@ static HOST_CERT_t* upscli_find_host_cert(const char* hostname) cert = cert->next; } } -#else - NUT_UNUSED_VARIABLE(hostname); #endif /* WITH_NSS */ return NULL; } -int upscli_cleanup(void) +int upscli_cleanup() { #ifdef WITH_OPENSSL if (ssl_ctx) { @@ -492,7 +437,7 @@ int upscli_cleanup(void) #endif /* WITH_OPENSSL */ -#ifdef WITH_NSS +#ifdef WITH_NSS /* Called to force cache clearing to prevent NSS shutdown failures. * http://www.mozilla.org/projects/security/pki/nss/ref/ssl/sslfnc.html#1138601 */ @@ -505,7 +450,7 @@ int upscli_cleanup(void) */ PL_ArenaFinish(); #endif /* WITH_NSS */ - + upscli_initialized = 0; return 1; } @@ -517,16 +462,6 @@ const char *upscli_strerror(UPSCONN_t *ups) char sslbuf[UPSCLI_ERRBUF_LEN]; #endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - if (!ups) { return upscli_errlist[UPSCLI_ERR_INVALIDARG].str; } @@ -567,12 +502,12 @@ const char *upscli_strerror(UPSCONN_t *ups) if (PR_GetErrorTextLength() < UPSCLI_ERRBUF_LEN) { PR_GetErrorText(ups->errbuf); } else { - snprintf(ups->errbuf, UPSCLI_ERRBUF_LEN, + snprintf(ups->errbuf, UPSCLI_ERRBUF_LEN, "SSL error #%ld, message too long to be displayed", (long)PR_GetError()); } #else - snprintf(ups->errbuf, UPSCLI_ERRBUF_LEN, + snprintf(ups->errbuf, UPSCLI_ERRBUF_LEN, "SSL error, but SSL wasn't enabled at compile-time"); #endif /* WITH_OPENSSL | WITH_NSS */ return ups->errbuf; @@ -584,10 +519,6 @@ const char *upscli_strerror(UPSCONN_t *ups) return ups->errbuf; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - /* fallthrough */ snprintf(ups->errbuf, UPSCLI_ERRBUF_LEN, "Unknown error flag %d", @@ -599,9 +530,9 @@ const char *upscli_strerror(UPSCONN_t *ups) /* Read up to buflen bytes from fd and return the number of bytes read. If no data is available within d_sec + d_usec, return 0. On error, a value < 0 is returned (errno indicates error). */ -static ssize_t upscli_select_read(const int fd, void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec) +static int upscli_select_read(const int fd, void *buf, const size_t buflen, const long d_sec, const long d_usec) { - ssize_t ret; + int ret; fd_set fds; struct timeval tv; @@ -620,37 +551,17 @@ static ssize_t upscli_select_read(const int fd, void *buf, const size_t buflen, return read(fd, buf, buflen); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif /* internal: abstract the SSL calls for the other functions */ -static ssize_t net_read(UPSCONN_t *ups, char *buf, size_t buflen, const time_t timeout) +static int net_read(UPSCONN_t *ups, char *buf, size_t buflen) { - ssize_t ret = -1; + int ret; #ifdef WITH_SSL if (ups->ssl) { #ifdef WITH_OPENSSL - /* SSL_* routines deal with int type for return and buflen - * We might need to window our I/O if we exceed 2GB (in - * 32-bit builds)... Not likely to exceed in 64-bit builds, - * but smaller systems with 16-bits might be endangered :) - */ - assert(buflen <= INT_MAX); - int iret = SSL_read(ups->ssl, buf, (int)buflen); - assert(iret <= SSIZE_MAX); - ret = (ssize_t)iret; + ret = SSL_read(ups->ssl, buf, buflen); #elif defined(WITH_NSS) /* WITH_OPENSSL */ - /* PR_* routines deal in PRInt32 type - * We might need to window our I/O if we exceed 2GB :) */ - assert(buflen <= PR_INT32_MAX); - ret = PR_Read(ups->ssl, buf, (PRInt32)buflen); + ret = PR_Read(ups->ssl, buf, buflen); #endif /* WITH_OPENSSL | WITH_NSS*/ if (ret < 1) { @@ -661,7 +572,7 @@ static ssize_t net_read(UPSCONN_t *ups, char *buf, size_t buflen, const time_t t } #endif - ret = upscli_select_read(ups->fd, buf, buflen, timeout, 0); + ret = upscli_select_read(ups->fd, buf, buflen, 5, 0); /* error reading data, server disconnected? */ if (ret < 0) { @@ -676,16 +587,13 @@ static ssize_t net_read(UPSCONN_t *ups, char *buf, size_t buflen, const time_t t return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif /* Write up to buflen bytes to fd and return the number of bytes written. If no data is available within d_sec + d_usec, return 0. On error, a value < 0 is returned (errno indicates error). */ -static ssize_t upscli_select_write(const int fd, const void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec) +static int upscli_select_write(const int fd, const void *buf, const size_t buflen, const long d_sec, const long d_usec) { - ssize_t ret; + int ret; fd_set fds; struct timeval tv; @@ -704,37 +612,17 @@ static ssize_t upscli_select_write(const int fd, const void *buf, const size_t b return write(fd, buf, buflen); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif /* internal: abstract the SSL calls for the other functions */ -static ssize_t net_write(UPSCONN_t *ups, const char *buf, size_t buflen, const time_t timeout) +static int net_write(UPSCONN_t *ups, const char *buf, size_t buflen) { - ssize_t ret = -1; + int ret; #ifdef WITH_SSL if (ups->ssl) { #ifdef WITH_OPENSSL - /* SSL_* routines deal with int type for return and buflen - * We might need to window our I/O if we exceed 2GB (in - * 32-bit builds)... Not likely to exceed in 64-bit builds, - * but smaller systems with 16-bits might be endangered :) - */ - assert(buflen <= INT_MAX); - int iret = SSL_write(ups->ssl, buf, (int)buflen); - assert(iret <= SSIZE_MAX); - ret = (ssize_t)iret; + ret = SSL_write(ups->ssl, buf, buflen); #elif defined(WITH_NSS) /* WITH_OPENSSL */ - /* PR_* routines deal in PRInt32 type - * We might need to window our I/O if we exceed 2GB :) */ - assert(buflen <= PR_INT32_MAX); - ret = PR_Write(ups->ssl, buf, (PRInt32)buflen); + ret = PR_Write(ups->ssl, buf, buflen); #endif /* WITH_OPENSSL | WITH_NSS */ if (ret < 1) { @@ -745,7 +633,7 @@ static ssize_t net_write(UPSCONN_t *ups, const char *buf, size_t buflen, const t } #endif - ret = upscli_select_write(ups->fd, buf, buflen, timeout, 0); + ret = upscli_select_write(ups->fd, buf, buflen, 0, 0); /* error writing data, server disconnected? */ if (ret < 0) { @@ -760,9 +648,6 @@ static ssize_t net_write(UPSCONN_t *ups, const char *buf, size_t buflen, const t return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif #ifdef WITH_SSL @@ -770,7 +655,7 @@ static ssize_t net_write(UPSCONN_t *ups, const char *buf, size_t buflen, const t /* * 1 : OK * -1 : ERROR - * 0 : SSL NOT SUPPORTED + * 0 : SSL NOT SUPPORTED */ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) { @@ -779,7 +664,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) #elif defined(WITH_NSS) /* WITH_OPENSSL */ SECStatus status; PRFileDesc *socket; - HOST_CERT_t *cert; + HOST_CERT_t *cert; #endif /* WITH_OPENSSL | WITH_NSS */ char buf[UPSCLI_NETBUF_LEN]; @@ -791,7 +676,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) "force initialisation without SSL configuration"); upscli_init(0, NULL, NULL, NULL); } - + /* see if upsd even talks SSL/TLS */ snprintf(buf, sizeof(buf), "STARTTLS\n"); @@ -808,7 +693,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) } /* upsd is happy, so let's crank up the client */ - + #ifdef WITH_OPENSSL if (!ssl_ctx) { @@ -837,7 +722,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) switch(res) { case 1: - upsdebugx(3, "SSL connected (%s)", SSL_get_version(ups->ssl)); + upsdebugx(3, "SSL connected"); break; case 0: upslog_with_errno(1, "SSL_connect do not accept handshake."); @@ -847,7 +732,7 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) upslog_with_errno(1, "Unknown return value from SSL_connect %d", res); ssl_error(ups->ssl, res); return -1; - } + } return 1; @@ -864,12 +749,12 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) nss_error("upscli_sslinit / SSL_ImportFD"); return -1; } - + if (SSL_SetPKCS11PinArg(ups->ssl, ups) == -1){ nss_error("upscli_sslinit / SSL_SetPKCS11PinArg"); return -1; } - + if (verifycert) { status = SSL_AuthCertificateHook(ups->ssl, (SSLAuthCertificate)AuthCertificate, CERT_GetDefaultCertDB()); @@ -881,19 +766,19 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) nss_error("upscli_sslinit / SSL_AuthCertificateHook"); return -1; } - + status = SSL_BadCertHook(ups->ssl, (SSLBadCertHandler)BadCertHandler, ups); if (status != SECSuccess) { nss_error("upscli_sslinit / SSL_BadCertHook"); return -1; } - + status = SSL_GetClientAuthDataHook(ups->ssl, (SSLGetClientAuthData)GetClientAuthData, ups); if (status != SECSuccess) { nss_error("upscli_sslinit / SSL_GetClientAuthDataHook"); return -1; } - + status = SSL_HandshakeCallback(ups->ssl, (SSLHandshakeCallback)HandshakeCallback, ups); if (status != SECSuccess) { nss_error("upscli_sslinit / SSL_HandshakeCallback"); @@ -930,9 +815,9 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) /* TODO : Close the connection. */ return -1; } - + return 1; - + #endif /* WITH_OPENSSL | WITH_NSS */ } @@ -940,15 +825,12 @@ static int upscli_sslinit(UPSCONN_t *ups, int verifycert) static int upscli_sslinit(UPSCONN_t *ups, int verifycert) { - NUT_UNUSED_VARIABLE(ups); - NUT_UNUSED_VARIABLE(verifycert); - return 0; /* not supported */ } #endif /* WITH_SSL */ -int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags, struct timeval * timeout) +int upscli_tryconnect(UPSCONN_t *ups, const char *host, int port, int flags,struct timeval * timeout) { int sock_fd; struct addrinfo hints, *res, *ai; @@ -974,7 +856,7 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags return -1; } - snprintf(sport, sizeof(sport), "%ju", (uintmax_t)port); + snprintf(sport, sizeof(sport), "%hu", (unsigned short int)port); memset(&hints, 0, sizeof(hints)); @@ -1034,7 +916,7 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags } while ((v = connect(sock_fd, ai->ai_addr, ai->ai_addrlen)) < 0) { - if(errno == EINPROGRESS || SOLARIS_i386_NBCONNECT_ENOENT(errno) || AIX_NBCONNECT_0(errno)) { + if(errno == EINPROGRESS) { FD_ZERO(&wfds); FD_SET(sock_fd, &wfds); select(sock_fd+1,NULL,&wfds,NULL, @@ -1108,7 +990,7 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags ups->port = port; hostcert = upscli_find_host_cert(host); - + if (hostcert != NULL) { /* An host security rule is specified. */ certverify = hostcert->certverify; @@ -1118,39 +1000,39 @@ int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags forcessl = (flags & UPSCLI_CONN_REQSSL) != 0 ? 1 : 0; } tryssl = (flags & UPSCLI_CONN_TRYSSL) != 0 ? 1 : 0; - + if (tryssl || forcessl) { ret = upscli_sslinit(ups, certverify); if (forcessl && ret != 1) { - upslogx(LOG_ERR, "Can not connect to NUT server %s in SSL, disconnect", host); + upslogx(LOG_ERR, "Can not connect to %s in SSL, disconnect", host); ups->upserror = UPSCLI_ERR_SSLFAIL; upscli_disconnect(ups); return -1; } else if (tryssl && ret == -1) { - upslogx(LOG_NOTICE, "Error while connecting to NUT server %s, disconnect", host); + upslogx(LOG_NOTICE, "Error while connecting to %s, disconnect", host); upscli_disconnect(ups); return -1; } else if (tryssl && ret == 0) { if (certverify != 0) { - upslogx(LOG_NOTICE, "Can not connect to NUT server %s in SSL and " + upslogx(LOG_NOTICE, "Can not connect to %s in SSL and " "certificate is needed, disconnect", host); upscli_disconnect(ups); return -1; } - upsdebugx(3, "Can not connect to NUT server %s in SSL, continue unencrypted", host); + upsdebugx(3, "Can not connect to %s in SSL, continue uncrypted", host); } else { - upslogx(LOG_INFO, "Connected to NUT server %s in SSL", host); + upslogx(LOG_INFO, "Connected to %s in SSL", host); if (certverify == 0) { /* you REALLY should set CERTVERIFY to 1 if using SSL... */ upslogx(LOG_WARNING, "Certificate verification is disabled"); } } } - + return 0; } -int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags) +int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags) { return upscli_tryconnect(ups,host,port,flags,NULL); } @@ -1161,7 +1043,7 @@ static struct { const char *text; } upsd_errlist[] = { - { UPSCLI_ERR_VARNOTSUPP, "VAR-NOT-SUPPORTED" }, + { UPSCLI_ERR_VARNOTSUPP, "VAR-NOT-SUPPORTED" }, { UPSCLI_ERR_UNKNOWNUPS, "UNKNOWN-UPS" }, { UPSCLI_ERR_ACCESSDENIED, "ACCESS-DENIED" }, { UPSCLI_ERR_PWDREQUIRED, "PASSWORD-REQUIRED" }, @@ -1186,7 +1068,7 @@ static struct { { UPSCLI_ERR_INVPASSWORD, "INVALID-PASSWORD" }, { UPSCLI_ERR_USERREQUIRED, "USERNAME-REQUIRED" }, { UPSCLI_ERR_DRVNOTCONN, "DRIVER-NOT-CONNECTED" }, - + { 0, NULL, } }; @@ -1223,9 +1105,9 @@ static int upscli_errcheck(UPSCONN_t *ups, char *buf) } static void build_cmd(char *buf, size_t bufsize, const char *cmdname, - size_t numarg, const char **arg) + int numarg, const char **arg) { - size_t i; + int i; size_t len; char enc[UPSCLI_NETBUF_LEN]; const char *format; @@ -1245,20 +1127,8 @@ static void build_cmd(char *buf, size_t bufsize, const char *cmdname, /* snprintfcat would tie us to common */ len = strlen(buf); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(buf + len, bufsize - len, format, + snprintf(buf + len, bufsize - len, format, pconf_encode(arg[i], enc, sizeof(enc))); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } len = strlen(buf); @@ -1266,9 +1136,9 @@ static void build_cmd(char *buf, size_t bufsize, const char *cmdname, } /* make sure upsd is giving us what we asked for */ -static int verify_resp(size_t num, const char **q, char **a) +static int verify_resp(int num, const char **q, char **a) { - size_t i; + int i; for (i = 0; i < num; i++) { if (strcasecmp(q[i], a[i]) != 0) { @@ -1281,11 +1151,11 @@ static int verify_resp(size_t num, const char **q, char **a) return 1; /* OK */ } -int upscli_get(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) +int upscli_get(UPSCONN_t *ups, unsigned int numq, const char **query, + unsigned int *numa, char ***answer) { char cmd[UPSCLI_NETBUF_LEN], tmp[UPSCLI_NETBUF_LEN]; - + if (!ups) { return -1; } @@ -1334,7 +1204,7 @@ int upscli_get(UPSCONN_t *ups, size_t numq, const char **query, return 0; } -int upscli_list_start(UPSCONN_t *ups, size_t numq, const char **query) +int upscli_list_start(UPSCONN_t *ups, unsigned int numq, const char **query) { char cmd[UPSCLI_NETBUF_LEN], tmp[UPSCLI_NETBUF_LEN]; @@ -1392,8 +1262,8 @@ int upscli_list_start(UPSCONN_t *ups, size_t numq, const char **query) return 0; } -int upscli_list_next(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) +int upscli_list_next(UPSCONN_t *ups, unsigned int numq, const char **query, + unsigned int *numa, char ***answer) { char tmp[UPSCLI_NETBUF_LEN]; @@ -1441,9 +1311,9 @@ int upscli_list_next(UPSCONN_t *ups, size_t numq, const char **query, return 1; } -ssize_t upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, const time_t timeout) +int upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen) { - ssize_t ret; + int ret; if (!ups) { return -1; @@ -1464,7 +1334,7 @@ ssize_t upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, return -1; } - ret = net_write(ups, buf, buflen, timeout); + ret = net_write(ups, buf, buflen); if (ret < 1) { upscli_disconnect(ups); @@ -1474,14 +1344,9 @@ ssize_t upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, return 0; } -ssize_t upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen) +int upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen) { - return upscli_sendline_timeout(ups, buf, buflen, 0); -} - -ssize_t upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, const time_t timeout) -{ - ssize_t ret; + int ret; size_t recv; if (!ups) { @@ -1507,17 +1372,14 @@ ssize_t upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, const if (ups->readidx == ups->readlen) { - ret = net_read(ups, ups->readbuf, sizeof(ups->readbuf), timeout); + ret = net_read(ups, ups->readbuf, sizeof(ups->readbuf)); if (ret < 1) { upscli_disconnect(ups); return -1; } - /* Here ret is safe to cast since it is >=1 and certainly - * fits under SIZE_MAX being it signed sibling - */ - ups->readlen = (size_t)ret; + ups->readlen = ret; ups->readidx = 0; } @@ -1532,13 +1394,8 @@ ssize_t upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, const return 0; } -ssize_t upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen) -{ - return upscli_readline_timeout(ups, buf, buflen, DEFAULT_NETWORK_TIMEOUT); -} - /* split upsname[@hostname[:port]] into separate components */ -int upscli_splitname(const char *buf, char **upsname, char **hostname, uint16_t *port) +int upscli_splitname(const char *buf, char **upsname, char **hostname, int *port) { char *s, tmp[SMALLBUF], *last = NULL; @@ -1574,10 +1431,9 @@ int upscli_splitname(const char *buf, char **upsname, char **hostname, uint16_t } /* split hostname[:port] into separate components */ -int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port) +int upscli_splitaddr(const char *buf, char **hostname, int *port) { char *s, tmp[SMALLBUF], *last = NULL; - long l; /* paranoia */ if ((!buf) || (!hostname) || (!port)) { @@ -1620,13 +1476,10 @@ int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port) } } - /* Check that "long" port fits in an "uint16_t" so is in IP range - * (under 65536) */ - if ((*(++s) == '\0') || ((l = strtol(s, NULL, 10)) < 1 ) || (l > 65535)) { + if ((*(++s) == '\0') || ((*port = strtol(s, NULL, 10)) < 1 )) { fprintf(stderr, "upscli_splitaddr: no port specified after ':' separator\n"); return -1; } - *port = (uint16_t)l; return 0; } @@ -1650,7 +1503,7 @@ int upscli_disconnect(UPSCONN_t *ups) return 0; } - net_write(ups, "LOGOUT\n", 7, 0); + net_write(ups, "LOGOUT\n", 7); #ifdef WITH_OPENSSL if (ups->ssl) { diff --git a/clients/upsclient.h b/clients/upsclient.h index 08574b8..ac5fb5d 100644 --- a/clients/upsclient.h +++ b/clients/upsclient.h @@ -21,26 +21,13 @@ #define UPSCLIENT_H_SEEN #ifdef WITH_OPENSSL - #include - #include + #include + #include #elif defined(WITH_NSS) /* WITH_OPENSSL */ #include #include #endif /* WITH_OPENSSL | WITH_NSS */ -/* Not including nut_stdint.h because this is part of end-user API */ -#if defined HAVE_INTTYPES_H - #include -#endif - -#if defined HAVE_STDINT_H - #include -#endif - -#if defined HAVE_LIMITS_H - #include -#endif - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -54,7 +41,7 @@ extern "C" { typedef struct { char *host; - uint16_t port; + int port; int fd; int flags; int upserror; @@ -82,33 +69,31 @@ typedef struct { const char *upscli_strerror(UPSCONN_t *ups); int upscli_init(int certverify, const char *certpath, const char *certname, const char *certpasswd); -int upscli_cleanup(void); +int upscli_cleanup(); -int upscli_tryconnect(UPSCONN_t *ups, const char *host, uint16_t port, int flags, struct timeval *tv); -int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags); +int upscli_tryconnect(UPSCONN_t *ups, const char *host, int port, int flags, struct timeval *tv); +int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags); void upscli_add_host_cert(const char* hostname, const char* certname, int certverify, int forcessl); /* --- functions that only use the new names --- */ -int upscli_get(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer); +int upscli_get(UPSCONN_t *ups, unsigned int numq, const char **query, + unsigned int *numa, char ***answer); -int upscli_list_start(UPSCONN_t *ups, size_t numq, const char **query); +int upscli_list_start(UPSCONN_t *ups, unsigned int numq, const char **query); -int upscli_list_next(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer); +int upscli_list_next(UPSCONN_t *ups, unsigned int numq, const char **query, + unsigned int *numa, char ***answer); -ssize_t upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, const time_t timeout); -ssize_t upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen); +int upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen); -ssize_t upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, const time_t timeout); -ssize_t upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen); +int upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen); int upscli_splitname(const char *buf, char **upsname, char **hostname, - uint16_t *port); + int *port); -int upscli_splitaddr(const char *buf, char **hostname, uint16_t *port); +int upscli_splitaddr(const char *buf, char **hostname, int *port); int upscli_disconnect(UPSCONN_t *ups); @@ -118,7 +103,7 @@ int upscli_fd(UPSCONN_t *ups); int upscli_upserror(UPSCONN_t *ups); /* returns 1 if SSL mode is active for this connection */ -int upscli_ssl(UPSCONN_t *ups); +int upscli_ssl(UPSCONN_t *ups); /* upsclient error list */ diff --git a/clients/upscmd.c b/clients/upscmd.c index c057303..f4990a8 100644 --- a/clients/upscmd.c +++ b/clients/upscmd.c @@ -1,8 +1,6 @@ /* upscmd - simple "client" to test instant commands via upsd - Copyright (C) - 2000 Russell Kroll - 2019 EATON (author: Arnaud Quette ) + Copyright (C) 2000 Russell Kroll This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,13 +26,10 @@ #include #include -#include "nut_stdint.h" #include "upsclient.h" -static char *upsname = NULL, *hostname = NULL; +static char *upsname = NULL, *hostname = NULL; static UPSCONN_t *ups = NULL; -static int tracking_enabled = 0; -static unsigned int timeout = DEFAULT_TRACKING_TIMEOUT; struct list_t { char *name; @@ -46,16 +41,13 @@ static void usage(const char *prog) printf("Network UPS Tools upscmd %s\n\n", UPS_VERSION); printf("usage: %s [-h]\n", prog); printf(" %s [-l ]\n", prog); - printf(" %s [-u ] [-p ] [-w] [-t ] []\n\n", prog); + printf(" %s [-u ] [-p ] []\n\n", prog); printf("Administration program to initiate instant commands on UPS hardware.\n"); printf("\n"); printf(" -h display this help text\n"); printf(" -l show available commands on UPS \n"); printf(" -u set username for command authentication\n"); printf(" -p set password for command authentication\n"); - printf(" -w wait for the completion of command by the driver\n"); - printf(" and return its actual result from the device\n"); - printf(" -t set a timeout when using -w (in seconds, default: %u)\n", DEFAULT_TRACKING_TIMEOUT); printf("\n"); printf(" UPS identifier - [@[:]]\n"); printf(" Valid instant command - test.panel.start, etc.\n"); @@ -65,7 +57,7 @@ static void usage(const char *prog) static void print_cmd(char *cmdname) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -88,7 +80,7 @@ static void print_cmd(char *cmdname) static void listcmds(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; struct list_t *lhead = NULL, *llast = NULL, *ltmp, *lnext; @@ -113,7 +105,7 @@ static void listcmds(void) /* CMD */ if (numa < 3) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 3)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 3)", numa); } /* we must first read the entire list of commands, @@ -144,21 +136,9 @@ static void listcmds(void) } } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif static void do_cmd(char **argv, const int argc) { - int cmd_complete = 0; char buf[SMALLBUF]; - char tracking_id[UUID4_LEN]; - time_t start, now; if (argc > 1) { snprintf(buf, sizeof(buf), "INSTCMD %s %s %s\n", upsname, argv[0], argv[1]); @@ -174,88 +154,13 @@ static void do_cmd(char **argv, const int argc) fatalx(EXIT_FAILURE, "Instant command failed: %s", upscli_strerror(ups)); } - /* verify answer */ + /* FUTURE: status cookies will tie in here */ if (strncmp(buf, "OK", 2) != 0) { fatalx(EXIT_FAILURE, "Unexpected response from upsd: %s", buf); } - /* check for status tracking id */ - if ( - !tracking_enabled || - /* sanity check on the size: "OK TRACKING " + UUID4_LEN */ - strlen(buf) != (UUID4_LEN - 1 + strlen("OK TRACKING ")) - ) { - /* reply as usual */ - fprintf(stderr, "%s\n", buf); - return; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif - /* From the check above, we know that we have exactly UUID4_LEN chars - * (aka sizeof(tracking_id)) in the buf after "OK TRACKING " prefix, - * plus the null-byte. - */ - assert (UUID4_LEN == 1 + snprintf(tracking_id, sizeof(tracking_id), "%s", buf + strlen("OK TRACKING "))); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif - time(&start); - - /* send status tracking request, looping if status is PENDING */ - while (!cmd_complete) { - - /* check for timeout */ - time(&now); - if (difftime(now, start) >= timeout) - fatalx(EXIT_FAILURE, "Can't receive status tracking information: timeout"); - - snprintf(buf, sizeof(buf), "GET TRACKING %s\n", tracking_id); - - if (upscli_sendline(ups, buf, strlen(buf)) < 0) - fatalx(EXIT_FAILURE, "Can't send status tracking request: %s", upscli_strerror(ups)); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -/* Note for gating macros above: unsuffixed HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - * means support of contexts both inside and outside function body, so the push - * above and pop below (outside this finction) are not used. - */ -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -/* Note that the individual warning pragmas for use inside function bodies - * are named without a _INSIDEFUNC suffix, for simplicity and legacy reasons - */ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* and get status tracking reply */ - assert(timeout < LONG_MAX); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - if (upscli_readline_timeout(ups, buf, sizeof(buf), (long)timeout) < 0) - fatalx(EXIT_FAILURE, "Can't receive status tracking information: %s", upscli_strerror(ups)); - - if (strncmp(buf, "PENDING", 7)) - cmd_complete = 1; - else - /* wait a second before retrying */ - sleep(1); - } - fprintf(stderr, "%s\n", buf); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif static void clean_exit(void) { @@ -270,14 +175,12 @@ static void clean_exit(void) int main(int argc, char **argv) { - int i; - uint16_t port; - ssize_t ret; + int i, ret, port; int have_un = 0, have_pw = 0, cmdlist = 0; - char buf[SMALLBUF * 2], username[SMALLBUF], password[SMALLBUF]; + char buf[SMALLBUF], username[SMALLBUF], password[SMALLBUF]; const char *prog = xbasename(argv[0]); - while ((i = getopt(argc, argv, "+lhu:p:t:wV")) != -1) { + while ((i = getopt(argc, argv, "+lhu:p:V")) != -1) { switch (i) { @@ -295,20 +198,8 @@ int main(int argc, char **argv) have_pw = 1; break; - case 't': - if (!str_to_uint(optarg, &timeout, 10)) - fatal_with_errno(EXIT_FAILURE, "Could not convert the provided value for timeout ('-t' option) to unsigned int"); - break; - - case 'w': - tracking_enabled = 1; - break; - case 'V': fatalx(EXIT_SUCCESS, "Network UPS Tools upscmd %s", UPS_VERSION); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_SUCCESS); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif case 'h': default: @@ -422,25 +313,6 @@ int main(int argc, char **argv) fatalx(EXIT_FAILURE, "Set password failed: %s", upscli_strerror(ups)); } - /* enable status tracking ID */ - if (tracking_enabled) { - - snprintf(buf, sizeof(buf), "SET TRACKING ON\n"); - - if (upscli_sendline(ups, buf, strlen(buf)) < 0) { - fatalx(EXIT_FAILURE, "Can't enable command status tracking: %s", upscli_strerror(ups)); - } - - if (upscli_readline(ups, buf, sizeof(buf)) < 0) { - fatalx(EXIT_FAILURE, "Enabling command status tracking failed: %s", upscli_strerror(ups)); - } - - /* Verify the result */ - if (strncmp(buf, "OK", 2) != 0) { - fatalx(EXIT_FAILURE, "Enabling command status tracking failed. upsd answered: %s", buf); - } - } - do_cmd(&argv[1], argc - 1); exit(EXIT_SUCCESS); diff --git a/clients/upsimage.c b/clients/upsimage.c index d49156c..3d6a51d 100644 --- a/clients/upsimage.c +++ b/clients/upsimage.c @@ -37,7 +37,6 @@ */ #include "common.h" -#include "nut_stdint.h" #include "upsclient.h" #include "cgilib.h" #include @@ -50,7 +49,7 @@ static char *monhost = NULL, *cmd = NULL; -static uint16_t port; +static int port; static char *upsname, *hostname; static UPSCONN_t ups; @@ -61,7 +60,7 @@ static UPSCONN_t ups; void parsearg(char *var, char *value) { - long long i, v; /* Be big enough to fit all expected inputs; truncate later */ + int i, v; /* avoid bogus junk from evil people */ if ((strlen(var) > MAX_CGI_STRLEN) || (strlen(value) > MAX_CGI_STRLEN)) @@ -83,20 +82,17 @@ void parsearg(char *var, char *value) for (i = 0; imgarg[i].name != NULL; i++) { if (!strcmp(imgarg[i].name, var)) { if (!strncmp(value, "0x", 2)) - v = (long long)strtoul(value + 2, (char **)NULL, 16); + v = strtoul(value + 2, (char **)NULL, 16); else - v = (long long)atoi(value); + v = atoi(value); /* avoid false numbers from bad people */ if (v < imgarg[i].min) imgarg[i].val = imgarg[i].min; else if (v > imgarg[i].max) imgarg[i].val = imgarg[i].max; - else { - assert (v < INT_MAX); - assert (v > INT_MIN); - imgarg[i].val = (int)v; - } + else + imgarg[i].val = v; return; } } @@ -115,9 +111,6 @@ static int get_imgarg(const char *name) } /* write the HTML header then have gd dump the image */ -static void drawimage(gdImagePtr im) - __attribute__((noreturn)); - static void drawimage(gdImagePtr im) { printf("Pragma: no-cache\n"); @@ -198,7 +191,7 @@ static void drawscale( if (level % step5 == 0) gdImageLine(im, 5, y, width - 5, y, col2); else - gdImageLine(im, 10, y, width - 10, y, col2); + gdImageLine(im, 10, y, width - 10, y, col2); } } @@ -207,25 +200,13 @@ static void drawscale( if (level % step10 == 0) { y = scale_height * (lvlhi - level) / range; snprintf(lbltxt, sizeof(lbltxt), "%d", level); - gdImageString(im, gdFontMediumBold, - width - (int)(strlen(lbltxt)) * gdFontMediumBold->w, - y, (unsigned char *) lbltxt, scale_num_color); + gdImageString(im, gdFontMediumBold, width - strlen(lbltxt)*gdFontMediumBold->w, y, + (unsigned char *) lbltxt, scale_num_color); } } } /* draws the bar style indicator */ -static void drawbar( - int lvllo, int lvlhi, /* min and max numbers on the scale */ - int step, int step5, int step10, /* steps for minor, submajor and major dashes */ - int redlo1, int redhi1, /* first red zone start and end */ - int redlo2, int redhi2, /* second red zone start and end */ - int grnlo, int grnhi, /* green zone start and end */ - double value, /* UPS variable value to draw */ - const char *format /* printf style format to be used when rendering summary text */ -) - __attribute__((noreturn)); - static void drawbar( int lvllo, int lvlhi, /* min and max numbers on the scale */ int step, int step5, int step10, /* steps for minor, submajor and major dashes */ @@ -259,7 +240,7 @@ static void drawbar( summary_color = color_alloc(im, get_imgarg("summary_col")); /* rescale UPS value to fit in the scale */ - bar_y = (int)((1.0 - (value - lvllo) / (lvlhi - lvllo)) * scale_height); + bar_y = (1 - (value - lvllo) / (lvlhi - lvllo)) * scale_height; /* sanity checks: */ @@ -276,21 +257,9 @@ static void drawbar( bar_color); /* stick the text version of the value at the bottom center */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(text, sizeof(text), format, value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif gdImageString(im, gdFontMediumBold, - (width - (int)(strlen(text))*gdFontMediumBold->w)/2, + (width - strlen(text)*gdFontMediumBold->w)/2, height - gdFontMediumBold->h, (unsigned char *) text, summary_color); @@ -300,9 +269,6 @@ static void drawbar( } /* draws the error image */ -static void noimage(const char *fmt, ...) - __attribute__((noreturn)); - static void noimage(const char *fmt, ...) { gdImagePtr im; @@ -312,19 +278,7 @@ static void noimage(const char *fmt, ...) va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(msg, sizeof(msg), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); width = get_imgarg("width"); @@ -339,23 +293,17 @@ static void noimage(const char *fmt, ...) if (width > height) gdImageString(im, gdFontMediumBold, - (width - (int)(strlen(msg))*gdFontMediumBold->w)/2, + (width - strlen(msg)*gdFontMediumBold->w)/2, (height - gdFontMediumBold->h)/2, (unsigned char *) msg, summary_color); else gdImageStringUp(im, gdFontMediumBold, (width - gdFontMediumBold->h)/2, - (height + (int)(strlen(msg))*gdFontMediumBold->w)/2, + (height + strlen(msg)*gdFontMediumBold->w)/2, (unsigned char *) msg, summary_color); drawimage(im); - /* NOTE: Earlier code called noimage() and then exit(EXIT_FAILURE); - * to signal an error via process exit code. Now that drawimage() - * always ends with exit(EXIT_SUCCESS) - which might make webserver - * feel good - the command-line use if any suffers no error returns. - */ - /* NOTREACHED */ } @@ -363,10 +311,6 @@ static void noimage(const char *fmt, ...) UPS variable can be determined. deviation < 0 means that values below nom should be grey instead of green */ -static void drawgeneralbar(double var, int min, int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - static void drawgeneralbar(double var, int min, int nom, int max, int deviation, const char *format) { @@ -426,10 +370,6 @@ static void drawgeneralbar(double var, int min, int nom, int max, } /* draws input and output voltage bar style indicators */ -static void draw_utility(double var, int min, int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - static void draw_utility(double var, int min, int nom, int max, int deviation, const char *format) { @@ -465,7 +405,7 @@ static void draw_utility(double var, int min, int nom, int max, /* Acceptable range of voltage is 85%-110% of nominal voltage * in EU at least. Be conservative and say +-10% */ - deviation = (int)(nom * 0.1); + deviation = nom*0.1; drawgeneralbar(var, min, nom, max, deviation, format); @@ -473,17 +413,9 @@ static void draw_utility(double var, int min, int nom, int max, } /* draws battery.percent bar style indicator */ -static void draw_battpct(double var, int min, int nom, - int max, int deviation, const char *format) - __attribute__((noreturn)); - -static void draw_battpct(double var, int min, int nom, - int max, int deviation, const char *format) +static void draw_battpct(double var, int min, int nom, int max, + int deviation, const char *format) { - NUT_UNUSED_VARIABLE(nom); - NUT_UNUSED_VARIABLE(max); - NUT_UNUSED_VARIABLE(deviation); - if (min < 0) { min = 50; } @@ -492,10 +424,6 @@ static void draw_battpct(double var, int min, int nom, } /* draws battery.voltage bar style indicator */ -static void draw_battvolt(double var, int min, int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - static void draw_battvolt(double var, int min, int nom, int max, int deviation, const char *format) { @@ -522,17 +450,18 @@ static void draw_battvolt(double var, int min, int nom, int max, } if(min == -1) { - min = (int)(nom/2*1.6+1); /* Assume a 2V cell is dead at 1.6V */ + min = nom/2*1.6+1; /* Assume a 2V cell is dead at 1.6V */ } if(max == -1) { - max = (int)(nom/2*2.3+1); /* Assume 2.3V float charge voltage */ + max = nom/2*2.3+1; /* Assume 2.3V float charge voltage */ } if (nom < min || nom > max) - nom = -1; + nom = -1; - deviation = (int)(-nom*0.05); /* 5% deviation from nominal voltage */ + + deviation = -(nom*0.05); /* 5% deviation from nominal voltage */ if(deviation==0) { deviation = -1; } @@ -541,57 +470,33 @@ static void draw_battvolt(double var, int min, int nom, int max, } /* draws ups.load bar style indicator */ -static void draw_upsload(double var, int min, - int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - -static void draw_upsload(double var, int min, - int nom, int max, +static void draw_upsload(double var, int min, int nom, int max, int deviation, const char *format) { - NUT_UNUSED_VARIABLE(min); - NUT_UNUSED_VARIABLE(nom); - NUT_UNUSED_VARIABLE(max); - NUT_UNUSED_VARIABLE(deviation); - drawbar(0, 125, 5, 5, 25, 100, 125, -1, -1, 0, 50, var, format); } /* draws temperature bar style indicator */ -static void draw_temperature(double var, int min, int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - static void draw_temperature(double var, int min, int nom, int max, int deviation, const char *format) { int hi = get_imgarg("tempmax"); int lo = get_imgarg("tempmin"); - NUT_UNUSED_VARIABLE(nom); - NUT_UNUSED_VARIABLE(deviation); drawbar(lo, hi, 1, 5, 10, lo, min, max, hi, -1, -1, var, format); } /* draws humidity bar style indicator */ -static void draw_humidity(double var, int min, int nom, int max, - int deviation, const char *format) - __attribute__((noreturn)); - static void draw_humidity(double var, int min, int nom, int max, int deviation, const char *format) { - NUT_UNUSED_VARIABLE(nom); - NUT_UNUSED_VARIABLE(deviation); - drawbar(0, 100, 2, 10, 20, 0, min, max, 100, -1, -1, var, format); } static int get_var(const char *var, char *buf, size_t buflen) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -618,8 +523,6 @@ int main(int argc, char **argv) char str[SMALLBUF]; int i, min, nom, max; double var = 0; - NUT_UNUSED_VARIABLE(argc); - NUT_UNUSED_VARIABLE(argv); extractcgiargs(); @@ -634,17 +537,13 @@ int main(int argc, char **argv) if (upscli_splitname(monhost, &upsname, &hostname, &port) != 0) { noimage("Invalid UPS definition (upsname[@hostname[:port]])\n"); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif + exit(EXIT_FAILURE); } if (upscli_connect(&ups, hostname, port, 0) < 0) { noimage("Can't connect to server:\n%s\n", upscli_strerror(&ups)); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif + exit(EXIT_FAILURE); } for (i = 0; imgvar[i].name; i++) @@ -654,9 +553,7 @@ int main(int argc, char **argv) registered with this variable */ if (!imgvar[i].drawfunc) { noimage("Draw function N/A"); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif + exit(EXIT_FAILURE); } /* get the variable value */ @@ -667,9 +564,7 @@ int main(int argc, char **argv) snprintf(str, sizeof(str), "%s N/A", imgvar[i].name); noimage(str); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif + exit(EXIT_FAILURE); } /* when getting minimum, nominal and maximum values, @@ -722,9 +617,7 @@ int main(int argc, char **argv) } noimage("Unknown display"); -#ifndef HAVE___ATTRIBUTE__NORETURN exit(EXIT_FAILURE); -#endif } imgvar_t imgvar[] = { diff --git a/clients/upsimagearg.h b/clients/upsimagearg.h index 7064b7f..9483d8d 100644 --- a/clients/upsimagearg.h +++ b/clients/upsimagearg.h @@ -17,32 +17,25 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_UPSIMAGEARG_H_SEEN -#define NUT_UPSIMAGEARG_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -/* This is used in upsstats.c and in upsimage.c, but compiler complains about - * non-extern definition if this is not "static". To move or not to move?.. - * Do we have cases of building binaries refering to only one of those objects? - */ -static struct { +struct { char *name; int val; /* hex digits, ala HTML */ int min; /* minimum reasonable value */ int max; /* maximum reasonable value */ -} imgarg[] = +} imgarg[] = { { "width", 100, 50, 200 }, { "height", 350, 100, 500 }, { "scale_height", 300, 100, 500 }, { "back_col", 0x000000, 0x000000, 0xffffff }, { "scale_num_col", 0xffff00, 0x000000, 0xffffff }, - { "summary_col", 0xffff00, 0x000000, 0xffffff }, + { "summary_col", 0xffff00, 0x000000, 0xffffff }, { "ok_zone_maj_col", 0x00ff00, 0x000000, 0xffffff }, { "ok_zone_min_col", 0x007800, 0x000000, 0xffffff }, { "neutral_zone_maj_col", 0xffffff, 0x000000, 0xffffff }, @@ -54,20 +47,20 @@ static struct { { "tempmax", 40, -100, 150 }, { "nom_in_freq", 50, 0, 100 }, { "nom_out_freq", 50, 0, 100 }, - { NULL, 0, 0, 0 } + { NULL, 0, 0, 0 } }; typedef struct { char *name; /* name of the UPS variable */ char *minimum; /* name of minimum value UPS variable - or variable in imgarg table */ + or variable in imgarg table */ char *nominal; /* as above, only for nominal value */ char *maximum; /* as above, only for maximum value */ int deviation; /* variable deviation - width of green zone */ char *format; /* format string to generate summary text */ /* pointer to drawing function */ - void (*drawfunc)(double, int, int, int, int, const char*); + void (*drawfunc)(double, int, int, int, int, const char*); } imgvar_t; extern imgvar_t imgvar[]; @@ -78,4 +71,3 @@ extern imgvar_t imgvar[]; /* *INDENT-ON* */ #endif -#endif /* NUT_UPSIMAGEARG_H_SEEN */ diff --git a/clients/upslog.c b/clients/upslog.c index a0ebeaa..7c534c7 100644 --- a/clients/upslog.c +++ b/clients/upslog.c @@ -20,12 +20,12 @@ /* Basic theory of operation: * * First we go through and parse as much of the status format string as - * possible. We used to do this parsing run every time, but that's a + * possible. We used to do this parsing run every time, but that's a * waste of CPU since it can't change during the program's run. * * This version does the parsing pass once, and creates a linked list of * pointers to the functions that do the work and the arg they get. - * + * * That means the main loop just has to run the linked list and call * anything it finds in there. Everything happens from there, and we * don't have to pointlessly reparse the string every time around. @@ -37,11 +37,9 @@ #include "config.h" #include "timehead.h" -#include "nut_stdint.h" #include "upslog.h" - static int reopen_flag = 0, exit_flag = 0; - static uint16_t port; + static int port, reopen_flag = 0, exit_flag = 0; static char *upsname, *hostname; static UPSCONN_t ups; @@ -79,13 +77,6 @@ static void set_exit_flag(int sig) exit_flag = sig; } -static void set_print_now_flag(int sig) -{ - NUT_UNUSED_VARIABLE(sig); - - /* no need to do anything, the signal will cause sleep to be interrupted */ -} - /* handlers: reload on HUP, exit on INT/QUIT/TERM */ static void setup_signals(void) { @@ -106,15 +97,8 @@ static void setup_signals(void) fatal_with_errno(EXIT_FAILURE, "Can't install SIGQUIT handler"); if (sigaction(SIGTERM, &sa, NULL) < 0) fatal_with_errno(EXIT_FAILURE, "Can't install SIGTERM handler"); - - sa.sa_handler = set_print_now_flag; - if (sigaction(SIGUSR1, &sa, NULL) < 0) - fatal_with_errno(EXIT_FAILURE, "Can't install SIGUSR1 handler"); } -static void help(const char *prog) - __attribute__((noreturn)); - static void help(const char *prog) { printf("UPS status logger.\n"); @@ -125,9 +109,7 @@ static void help(const char *prog) printf(" -f - Log format. See below for details.\n"); printf(" - Use -f \"\" so your shell doesn't break it up.\n"); printf(" -i - Time between updates, in seconds\n"); - printf(" -l - Log file name, or - for stdout (foreground by default)\n"); - printf(" -F - stay foregrounded even if logging into a file\n"); - printf(" -B - stay backgrounded even if logging to stdout\n"); + printf(" -l - Log file name, or - for stdout\n"); printf(" -p - Base name for PID file (defaults to \"%s\")\n", prog); printf(" -s - Monitor UPS - @[:]\n"); printf(" - Example: -s myups@server\n"); @@ -155,7 +137,6 @@ static void do_host(const char *arg) { int ret; char hn[LARGEBUF]; - NUT_UNUSED_VARIABLE(arg); ret = gethostname(hn, sizeof(hn)); @@ -169,15 +150,11 @@ static void do_host(const char *arg) static void do_upshost(const char *arg) { - NUT_UNUSED_VARIABLE(arg); - snprintfcat(logbuffer, sizeof(logbuffer), "%s", monhost); } static void do_pid(const char *arg) { - NUT_UNUSED_VARIABLE(arg); - snprintfcat(logbuffer, sizeof(logbuffer), "%ld", (long)getpid()); } @@ -186,7 +163,6 @@ static void do_time(const char *arg) unsigned int i; char timebuf[SMALLBUF], *format; time_t tod; - struct tm tmbuf; format = xstrdup(arg); @@ -196,7 +172,7 @@ static void do_time(const char *arg) format[i] = '%'; time(&tod); - strftime(timebuf, sizeof(timebuf), format, localtime_r(&tod, &tmbuf)); + strftime(timebuf, sizeof(timebuf), format, localtime(&tod)); snprintfcat(logbuffer, sizeof(logbuffer), "%s", timebuf); @@ -206,7 +182,7 @@ static void do_time(const char *arg) static void getvar(const char *var) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -250,7 +226,6 @@ static void do_var(const char *arg) static void do_etime(const char *arg) { time_t tod; - NUT_UNUSED_VARIABLE(arg); time(&tod); snprintfcat(logbuffer, sizeof(logbuffer), "%ld", (unsigned long) tod); @@ -285,7 +260,7 @@ static void add_call(void (*fptr)(const char *arg), const char *arg) tmp->next = NULL; if (last) - last->next = tmp; + last->next = tmp; else fhead = tmp; } @@ -293,9 +268,8 @@ static void add_call(void (*fptr)(const char *arg), const char *arg) /* turn the format string into a list of function calls with args */ static void compile_format(void) { - size_t i; - int j, found; - size_t ofs; + unsigned int i; + int j, found, ofs; char *cmd, *arg, *ptr; for (i = 0; i < strlen(logformat); i++) { @@ -347,7 +321,7 @@ static void compile_format(void) /* see if we know how to handle this command */ for (j = 0; logcmds[j].name != NULL; j++) { - if (strncasecmp(cmd, logcmds[j].name, + if (strncasecmp(cmd, logcmds[j].name, strlen(logcmds[j].name)) == 0) { add_call(logcmds[j].func, arg); @@ -395,7 +369,7 @@ static void run_flist(void) int main(int argc, char **argv) { - int interval = 30, i, foreground = -1; + int interval = 30, i; const char *prog = xbasename(argv[0]); time_t now, nextpoll = 0; const char *user = NULL; @@ -407,13 +381,11 @@ int main(int argc, char **argv) printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); - while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:FB")) != -1) { + while ((i = getopt(argc, argv, "+hs:l:i:f:u:Vp:")) != -1) { switch(i) { case 'h': help(prog); -#ifndef HAVE___ATTRIBUTE__NORETURN break; -#endif case 's': monhost = optarg; @@ -441,14 +413,6 @@ int main(int argc, char **argv) case 'p': pidfilebase = optarg; break; - - case 'F': - foreground = 1; - break; - - case 'B': - foreground = 0; - break; } } @@ -489,7 +453,7 @@ int main(int argc, char **argv) if (!logformat) fatalx(EXIT_FAILURE, "No format defined - but this should be impossible"); - printf("logging status of %s to %s (%is intervals)\n", + printf("logging status of %s to %s (%is intervals)\n", monhost, logfn, interval); if (upscli_splitname(monhost, &upsname, &hostname, &port) != 0) { @@ -497,7 +461,7 @@ int main(int argc, char **argv) } if (upscli_connect(&ups, hostname, port, UPSCLI_CONN_TRYSSL) < 0) - fprintf(stderr, "Warning: initial connect failed: %s\n", + fprintf(stderr, "Warning: initial connect failed: %s\n", upscli_strerror(&ups)); if (strcmp(logfn, "-") == 0) @@ -511,19 +475,10 @@ int main(int argc, char **argv) /* now drop root if we have it */ new_uid = get_user_pwent(user); - open_syslog(prog); + open_syslog(prog); - if (foreground < 0) { - if (logfile == stdout) { - foreground = 1; - } else { - foreground = 0; - } - } - - if (!foreground) { + if (logfile != stdout) background(); - } setup_signals(); @@ -538,7 +493,7 @@ int main(int argc, char **argv) if (nextpoll > now) { /* there is still time left, so sleep it off */ - sleep((unsigned int)(difftime(nextpoll, now))); + sleep(difftime(nextpoll, now)); nextpoll += interval; } else { /* we spent more time in polling than the interval allows */ @@ -546,7 +501,7 @@ int main(int argc, char **argv) } if (reopen_flag) { - upslogx(LOG_INFO, "Signal %d: reopening log file", + upslogx(LOG_INFO, "Signal %d: reopening log file", reopen_flag); reopen_log(); reopen_flag = 0; @@ -571,7 +526,7 @@ int main(int argc, char **argv) fclose(logfile); upscli_disconnect(&ups); - + exit(EXIT_SUCCESS); } diff --git a/clients/upslog.h b/clients/upslog.h index 2e31ec4..4d0596f 100644 --- a/clients/upslog.h +++ b/clients/upslog.h @@ -1,8 +1,5 @@ /* upslog.h - table of functions for handling various logging functions */ -#ifndef NUT_UPSLOG_H_SEEN -#define NUT_UPSLOG_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -23,10 +20,7 @@ static void do_time(const char *arg); static void do_var(const char *arg); static void do_etime(const char *arg); -/* This is only used in upslog.c, but refers to routines declared here... - * To move or not to move?.. - */ -static struct { +struct { const char *name; void (*func)(const char *arg); } logcmds[] = @@ -37,7 +31,7 @@ static struct { { "TIME", do_time }, { "VAR", do_var }, { "ETIME", do_etime }, - { NULL, (void(*)(const char*))(NULL) } + { NULL, (void(*)())(NULL) } }; #ifdef __cplusplus @@ -46,4 +40,3 @@ static struct { /* *INDENT-ON* */ #endif -#endif /* NUT_UPSLOG_H_SEEN */ diff --git a/clients/upsmon.c b/clients/upsmon.c index 4b65fc1..12823fa 100644 --- a/clients/upsmon.c +++ b/clients/upsmon.c @@ -24,10 +24,7 @@ #include #include #include -#include -#include -#include "nut_stdint.h" #include "upsclient.h" #include "upsmon.h" #include "parseconf.h" @@ -40,19 +37,16 @@ static char *shutdowncmd = NULL, *notifycmd = NULL; static char *powerdownflag = NULL, *configfile = NULL; -static unsigned int minsupplies = 1, sleepval = 5; - - /* sum of all power values from config file */ -static unsigned int totalpv = 0; - - /* default TTL of a device gone AWOL, 3 x polling interval = 15 sec */ -static int deadtime = 15; +static int minsupplies = 1, sleepval = 5, deadtime = 15; /* default polling interval = 5 sec */ -static unsigned int pollfreq = 5, pollfreqalert = 5; +static int pollfreq = 5, pollfreqalert = 5; - /* secondary hosts are given 15 sec by default to logout from upsd */ -static int hostsync = 15; + /* slave hosts are given 15 sec by default to logout from upsd */ +static int hostsync = 15; + + /* sum of all power values from config file */ +static int totalpv = 0; /* default replace battery warning interval (seconds) */ static int rbwarntime = 43200; @@ -61,7 +55,7 @@ static int rbwarntime = 43200; static int nocommwarntime = 300; /* default interval between the shutdown warning and the shutdown */ -static unsigned int finaldelay = 5; +static int finaldelay = 5; /* set by SIGHUP handler, cleared after reload finishes */ static int reload_flag = 0; @@ -89,20 +83,12 @@ static int opt_af = AF_UNSPEC; static struct sigaction sa; static sigset_t nut_upsmon_sigmask; -/* Users can pass a -D[...] option to enable debugging. - * For the service tracing purposes, also the upsmon.conf - * can define a debug_min value in the global section, - * to set the minimal debug level (CLI provided value less - * than that would not have effect, can only have more). - */ -static int nut_debug_level_global = -1; - static void setflag(int *val, int flag) { *val |= flag; } -static void clearflag(int *val, int flag) +static void clearflag(int *val, int flag) { *val ^= (*val & flag); } @@ -125,9 +111,9 @@ static void wall(const char *text) fprintf(wf, "%s\n", text); pclose(wf); -} +} -static void notify(const char *notice, int flags, const char *ntype, +static void notify(const char *notice, int flags, const char *ntype, const char *upsname) { char exec[LARGEBUF]; @@ -185,24 +171,11 @@ static void do_notify(const utype_t *ups, int ntype) for (i = 0; notifylist[i].name != NULL; i++) { if (notifylist[i].type == ntype) { - upsdebugx(2, "%s: ntype 0x%04x (%s)", __func__, ntype, + upsdebugx(2, "%s: ntype 0x%04x (%s)", __func__, ntype, notifylist[i].name); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(msg, sizeof(msg), - notifylist[i].msg ? notifylist[i].msg : notifylist[i].stockmsg, + snprintf(msg, sizeof(msg), notifylist[i].msg ? notifylist[i].msg : notifylist[i].stockmsg, ups ? ups->sys : ""); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - notify(msg, notifylist[i].flags, notifylist[i].name, + notify(msg, notifylist[i].flags, notifylist[i].name, upsname); return; } @@ -211,40 +184,26 @@ static void do_notify(const utype_t *ups, int ntype) /* not found ?! */ } -/* check if we need "primary" mode (managerial permissions) - * on the server for this ups, and apply for them then. - * Returns 0 in case of error, 1 otherwise (including when - * we do not need to try becoming a primary). This currently - * propagates further as the return value of do_upsd_auth(). - */ -/* TODO: Includes API change in NUT 2.8.0 to replace deprecated - * keywords "MASTER" with "PRIMARY", and "SLAVE" with "SECONDARY", - * (and backwards-compatible alias handling) - */ -static int apply_for_primary(utype_t *ups) +/* check for master permissions on the server for this ups */ +static int checkmaster(utype_t *ups) { char buf[SMALLBUF]; - char upscli_readraw_error; - /* don't bother if we're not configured as a primary for this ups */ - if (!flag_isset(ups->status, ST_PRIMARY)) + /* don't bother if we're not configured as a master for this ups */ + if (!flag_isset(ups->status, ST_MASTER)) return 1; /* this shouldn't happen (LOGIN checks it earlier) */ if ((ups->upsname == NULL) || (strlen(ups->upsname) == 0)) { - upslogx(LOG_ERR, "Set primary managerial mode on UPS [%s] failed: empty upsname", + upslogx(LOG_ERR, "Set master on UPS [%s] failed: empty upsname", ups->sys); return 0; } - /* Use PRIMARY first but if talking to older server, retry with MASTER */ - snprintf(buf, sizeof(buf), "PRIMARY %s\n", ups->upsname); + snprintf(buf, sizeof(buf), "MASTER %s\n", ups->upsname); if (upscli_sendline(&ups->conn, buf, strlen(buf)) < 0) { - /* File descriptor not suitable, net_write() errors, etc. - * Not connected to issues with PRIMARY vs. MASTER keyword. - */ - upslogx(LOG_ALERT, "Can't set primary managerial mode on UPS [%s] - %s", + upslogx(LOG_ALERT, "Can't set master mode on UPS [%s] - %s", ups->sys, upscli_strerror(&ups->conn)); return 0; } @@ -253,41 +212,14 @@ static int apply_for_primary(utype_t *ups) if (!strncmp(buf, "OK", 2)) return 1; - /* Try the older keyword */ - upsdebugx(3, - "%s: Server did not grant PRIMARY mode on UPS [%s], " - "retry with older MASTER keyword", - __func__, ups->upsname); - snprintf(buf, sizeof(buf), "MASTER %s\n", ups->upsname); - - if (upscli_sendline(&ups->conn, buf, strlen(buf)) < 0) { - upslogx(LOG_ALERT, "Can't set primary managerial mode on UPS [%s] - %s", - ups->sys, upscli_strerror(&ups->conn)); - return 0; - } - - if (upscli_readline(&ups->conn, buf, sizeof(buf)) == 0) { - if (!strncmp(buf, "OK", 2)) - return 1; - - upscli_readraw_error = 0; - } - else { - upscli_readraw_error = 1; - } - } - else { - upscli_readraw_error = 1; - } - - if (upscli_readraw_error == 0) { /* not ERR, but not caught by readline either? */ - upslogx(LOG_ALERT, "Primary managerial privileges unavailable on UPS [%s]", + + upslogx(LOG_ALERT, "Master privileges unavailable on UPS [%s]", ups->sys); upslogx(LOG_ALERT, "Response: [%s]", buf); } else { /* something caught by readraw's parsing call */ - upslogx(LOG_ALERT, "Primary managerial privileges unavailable on UPS [%s]", + upslogx(LOG_ALERT, "Master privileges unavailable on UPS [%s]", ups->sys); upslogx(LOG_ALERT, "Reason: %s", upscli_strerror(&ups->conn)); } @@ -373,8 +305,8 @@ static int do_upsd_auth(utype_t *ups) upsdebugx(1, "Logged into UPS %s", ups->sys); setflag(&ups->status, ST_LOGIN); - /* now see if we also need to test primary managerial-mode permissions */ - return apply_for_primary(ups); + /* now see if we also need to test master permissions */ + return checkmaster(ups); } /* set flags and make announcements when a UPS has been checked successfully */ @@ -433,7 +365,7 @@ static void ups_on_batt(utype_t *ups) sleepval = pollfreqalert; /* bump up polling frequency */ - ups->linestate = 0; + ups->linestate = 0; upsdebugx(3, "%s: %s (first time)", __func__, ups->sys); @@ -484,11 +416,10 @@ static void set_pdflag(void) } /* the actual shutdown procedure */ -static void doshutdown(void) - __attribute__((noreturn)); - static void doshutdown(void) { + int ret; + /* this should probably go away at some point */ upslogx(LOG_CRIT, "Executing automatic power-fail shutdown"); wall("Executing automatic power-fail shutdown\n"); @@ -500,25 +431,20 @@ static void doshutdown(void) /* in the pipe model, we let the parent do this for us */ if (use_pipe) { char ch; - ssize_t wret; ch = 1; - wret = write(pipefd[1], &ch, 1); - - if (wret < 1) - upslogx(LOG_ERR, "Unable to call parent pipe for shutdown"); + ret = write(pipefd[1], &ch, 1); } else { /* one process model = we do all the work here */ - int sret; if (geteuid() != 0) upslogx(LOG_WARNING, "Not root, shutdown may fail"); set_pdflag(); - sret = system(shutdowncmd); + ret = system(shutdowncmd); - if (sret != 0) + if (ret != 0) upslogx(LOG_ERR, "Unable to call shutdown command: %s", shutdowncmd); } @@ -530,7 +456,7 @@ static void doshutdown(void) static void setfsd(utype_t *ups) { char buf[SMALLBUF]; - ssize_t ret; + int ret; /* this shouldn't happen */ if (!ups->upsname) { @@ -573,21 +499,14 @@ static void set_alarm(void) static void clear_alarm(void) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif signal(SIGALRM, SIG_IGN); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif alarm(0); } static int get_var(utype_t *ups, const char *var, char *buf, size_t bufsize) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -638,7 +557,7 @@ static int get_var(utype_t *ups, const char *var, char *buf, size_t bufsize) if (numa < numq) { upslogx(LOG_ERR, "%s: Error: insufficient data " - "(got %zu args, need at least %zu)", + "(got %d args, need at least %d)", var, numa, numq); return -1; } @@ -647,16 +566,12 @@ static int get_var(utype_t *ups, const char *var, char *buf, size_t bufsize) return 0; } -/* Called by upsmon which is the primary on some UPS(es) to wait - * until all secondaries log out from it on the shared upsd server - * or the HOSTSYNC timeout expires - */ -static void sync_secondaries(void) +static void slavesync(void) { utype_t *ups; char temp[SMALLBUF]; time_t start, now; - long maxlogins, logins; + int maxlogins, logins; time(&start); @@ -665,8 +580,8 @@ static void sync_secondaries(void) for (ups = firstups; ups != NULL; ups = ups->next) { - /* only check login count on devices we are the primary for */ - if (!flag_isset(ups->status, ST_PRIMARY)) + /* only check login count on our master(s) */ + if (!flag_isset(ups->status, ST_MASTER)) continue; set_alarm(); @@ -681,15 +596,11 @@ static void sync_secondaries(void) clear_alarm(); } - /* if no UPS has more than 1 login (that would be us), - * then secondaries are all gone */ - /* TO THINK: how about redundant setups with several primary-mode - * clients managing an UPS, or possibly differend UPSes, with the - * same upsd? */ + /* if no UPS has more than 1 login (us), then slaves are gone */ if (maxlogins <= 1) return; - /* after HOSTSYNC seconds, assume secondaries are stuck - and bail */ + /* after HOSTSYNC seconds, assume slaves are stuck and bail */ time(&now); if ((now - start) > hostsync) { @@ -701,34 +612,31 @@ static void sync_secondaries(void) } } -static void forceshutdown(void) - __attribute__((noreturn)); - static void forceshutdown(void) { utype_t *ups; - int isaprimary = 0; + int isamaster = 0; - upsdebugx(1, "Shutting down any UPSes in PRIMARY mode..."); + upsdebugx(1, "Shutting down any UPSes in MASTER mode..."); - /* set FSD on any "primary" UPS entries (forced shutdown in progress) */ + /* set FSD on any "master" UPS entries (forced shutdown in progress) */ for (ups = firstups; ups != NULL; ups = ups->next) - if (flag_isset(ups->status, ST_PRIMARY)) { - isaprimary = 1; + if (flag_isset(ups->status, ST_MASTER)) { + isamaster = 1; setfsd(ups); } - /* if we're not a primary on anything, we should shut down now */ - if (!isaprimary) + /* if we're not a master on anything, we should shut down now */ + if (!isamaster) doshutdown(); - /* we must be the primary now */ - upsdebugx(1, "This system is a primary... waiting for secondaries to logout..."); + /* must be the master now */ + upsdebugx(1, "This system is a master... waiting for slave logout..."); - /* wait up to HOSTSYNC seconds for secondaries to logout */ - sync_secondaries(); + /* wait up to HOSTSYNC seconds for slaves to logout */ + slavesync(); - /* time expired or all the secondaries are gone, so shutdown */ + /* time expired or all the slaves are gone, so shutdown */ doshutdown(); } @@ -736,10 +644,7 @@ static int is_ups_critical(utype_t *ups) { time_t now; - /* FSD = the primary is forcing a shutdown, or a driver forwarded the flag - * from a smarter UPS depending on vendor protocol, ability and settings - * (e.g. is charging but battery too low to guarantee safety to the load) - */ + /* FSD = the master is forcing a shutdown */ if (flag_isset(ups->status, ST_FSD)) return 1; @@ -750,37 +655,24 @@ static int is_ups_critical(utype_t *ups) /* must be OB+LB now */ - /* if UPS is calibrating, don't declare it critical */ - /* FIXME: Consider UPSes where we can know if they have other power - * circuits (bypass, etc.) and whether those do currently provide - * wall power to the host - and that we do not have both calibration - * and a real outage, when we still should shut down right now. - */ - if (flag_isset(ups->status, ST_CAL)) { - upslogx(LOG_WARNING, "%s: seems that UPS [%s] is OB+LB now, but " - "it is also calibrating - not declaring a critical state", - __func__, ups->upsname); - return 0; - } - - /* if we're a primary, declare it critical so we set FSD on it */ - if (flag_isset(ups->status, ST_PRIMARY)) + /* if we're a master, declare it critical so we set FSD on it */ + if (flag_isset(ups->status, ST_MASTER)) return 1; - /* must be a secondary now */ + /* must be a slave now */ - /* FSD isn't set, so the primary hasn't seen it yet */ + /* FSD isn't set, so the master hasn't seen it yet */ time(&now); - /* give the primary up to HOSTSYNC seconds before shutting down */ + /* give the master up to HOSTSYNC seconds before shutting down */ if ((now - ups->lastnoncrit) > hostsync) { - upslogx(LOG_WARNING, "Giving up on the primary for UPS [%s]", + upslogx(LOG_WARNING, "Giving up on the master for UPS [%s]", ups->sys); return 1; } - /* there's still time left, maybe OB+LB will go away next time we look? */ + /* there's still time left */ return 0; } @@ -788,7 +680,7 @@ static int is_ups_critical(utype_t *ups) static void recalc(void) { utype_t *ups; - unsigned int val_ol = 0; + int val_ol = 0; time_t now; time(&now); @@ -815,8 +707,8 @@ static void recalc(void) ups = ups->next; } - upsdebugx(3, "Current power value: %u", val_ol); - upsdebugx(3, "Minimum power value: %u", minsupplies); + upsdebugx(3, "Current power value: %d", val_ol); + upsdebugx(3, "Minimum power value: %d", minsupplies); if (val_ol < minsupplies) forceshutdown(); @@ -849,21 +741,6 @@ static void upsreplbatt(utype_t *ups) } } -static void ups_cal(utype_t *ups) -{ - if (flag_isset(ups->status, ST_CAL)) { /* no change */ - upsdebugx(4, "%s: %s (no change)", __func__, ups->sys); - return; - } - - upsdebugx(3, "%s: %s (first time)", __func__, ups->sys); - - /* must have changed from !CAL to CAL, so notify */ - - do_notify(ups, NOTIFY_CAL); - setflag(&ups->status, ST_CAL); -} - static void ups_fsd(utype_t *ups) { if (flag_isset(ups->status, ST_FSD)) { /* no change */ @@ -893,13 +770,13 @@ static void drop_connection(utype_t *ups) } /* change some UPS parameters during reloading */ -static void redefine_ups(utype_t *ups, unsigned int pv, const char *un, - const char *pw, const char *managerialOption) +static void redefine_ups(utype_t *ups, int pv, const char *un, + const char *pw, const char *master) { ups->retain = 1; if (ups->pv != pv) { - upslogx(LOG_INFO, "UPS [%s]: redefined power value to %d", + upslogx(LOG_INFO, "UPS [%s]: redefined power value to %d", ups->sys, pv); ups->pv = pv; } @@ -915,14 +792,14 @@ static void redefine_ups(utype_t *ups, unsigned int pv, const char *un, ups->un = xstrdup(un); - /* + /* * if not logged in force a reconnection since this * may have been redefined to make a login work */ if (!flag_isset(ups->status, ST_LOGIN)) { upslogx(LOG_INFO, "UPS [%s]: retrying connection", - ups->sys); + ups->sys); drop_connection(ups); } @@ -943,7 +820,7 @@ static void redefine_ups(utype_t *ups, unsigned int pv, const char *un, if (!flag_isset(ups->status, ST_LOGIN)) { upslogx(LOG_INFO, "UPS [%s]: retrying connection", - ups->sys); + ups->sys); drop_connection(ups); } @@ -972,75 +849,45 @@ static void redefine_ups(utype_t *ups, unsigned int pv, const char *un, } } - /* secondary|slave -> primary|master */ - if ( ( (!strcasecmp(managerialOption, "primary")) - || (!strcasecmp(managerialOption, "master")) ) - && (!flag_isset(ups->status, ST_PRIMARY)) ) { - upslogx(LOG_INFO, "UPS [%s]: redefined as a primary", ups->sys); - setflag(&ups->status, ST_PRIMARY); + /* slave -> master */ + if ((!strcasecmp(master, "master")) && (!flag_isset(ups->status, ST_MASTER))) { + upslogx(LOG_INFO, "UPS [%s]: redefined as master", ups->sys); + setflag(&ups->status, ST_MASTER); - /* reset connection to ensure primary mode gets checked */ + /* reset connection to ensure master mode gets checked */ drop_connection(ups); return; } - /* primary|master -> secondary|slave */ - if ( ( (!strcasecmp(managerialOption, "secondary")) - || (!strcasecmp(managerialOption, "slave")) ) - && (flag_isset(ups->status, ST_PRIMARY)) ) { - upslogx(LOG_INFO, "UPS [%s]: redefined as a secondary", ups->sys); - clearflag(&ups->status, ST_PRIMARY); + /* master -> slave */ + if ((!strcasecmp(master, "slave")) && (flag_isset(ups->status, ST_MASTER))) { + upslogx(LOG_INFO, "UPS [%s]: redefined as slave", ups->sys); + clearflag(&ups->status, ST_MASTER); return; } } -static void addups(int reloading, const char *sys, const char *pvs, - const char *un, const char *pw, const char *managerialOption) +static void addups(int reloading, const char *sys, const char *pvs, + const char *un, const char *pw, const char *master) { - unsigned int pv; + int pv; utype_t *tmp, *last; /* the username is now required - no more host-based auth */ - if ((!sys) || (!pvs) || (!pw) || (!managerialOption) || (!un)) { + if ((!sys) || (!pvs) || (!pw) || (!master) || (!un)) { upslogx(LOG_WARNING, "Ignoring invalid MONITOR line in %s!", configfile); upslogx(LOG_WARNING, "MONITOR configuration directives require five arguments."); return; } - long lpv = strtol(pvs, (char **) NULL, 10); + pv = strtol(pvs, (char **) NULL, 10); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wtautological-compare" -# pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* Different platforms, different sizes, none fits all... */ - if (lpv < 0 || (sizeof(long) > sizeof(unsigned int) && lpv > (long)UINT_MAX)) { -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - upslogx(LOG_WARNING, "UPS [%s]: ignoring invalid power value [%s]", + if (pv < 0) { + upslogx(LOG_WARNING, "UPS [%s]: ignoring invalid power value [%s]", sys, pvs); return; } - pv = (unsigned int)lpv; last = tmp = firstups; @@ -1050,7 +897,7 @@ static void addups(int reloading, const char *sys, const char *pvs, /* check for duplicates */ if (!strcmp(tmp->sys, sys)) { if (reloading) - redefine_ups(tmp, pv, un, pw, managerialOption); + redefine_ups(tmp, pv, un, pw, master); else upslogx(LOG_WARNING, "Warning: ignoring duplicate" " UPS [%s]", sys); @@ -1067,7 +914,10 @@ static void addups(int reloading, const char *sys, const char *pvs, /* build this up so the user doesn't run with bad settings */ totalpv += tmp->pv; - tmp->un = xstrdup(un); + if (un) + tmp->un = xstrdup(un); + else + tmp->un = NULL; tmp->pw = xstrdup(pw); tmp->status = 0; @@ -1082,10 +932,8 @@ static void addups(int reloading, const char *sys, const char *pvs, tmp->lastrbwarn = 0; tmp->lastncwarn = 0; - if ( (!strcasecmp(managerialOption, "primary")) - || (!strcasecmp(managerialOption, "master")) ) { - setflag(&tmp->status, ST_PRIMARY); - } + if (!strcasecmp(master, "master")) + setflag(&tmp->status, ST_MASTER); tmp->next = NULL; @@ -1095,15 +943,15 @@ static void addups(int reloading, const char *sys, const char *pvs, firstups = tmp; if (tmp->pv) - upslogx(LOG_INFO, "UPS: %s (%s) (power value %d)", tmp->sys, - flag_isset(tmp->status, ST_PRIMARY) ? "primary" : "secondary", + upslogx(LOG_INFO, "UPS: %s (%s) (power value %d)", tmp->sys, + flag_isset(tmp->status, ST_MASTER) ? "master" : "slave", tmp->pv); else upslogx(LOG_INFO, "UPS: %s (monitoring only)", tmp->sys); tmp->upsname = tmp->hostname = NULL; - if (upscli_splitname(tmp->sys, &tmp->upsname, &tmp->hostname, + if (upscli_splitname(tmp->sys, &tmp->upsname, &tmp->hostname, &tmp->port) != 0) { upslogx(LOG_ERR, "Error: unable to split UPS name [%s]", tmp->sys); @@ -1112,7 +960,7 @@ static void addups(int reloading, const char *sys, const char *pvs, if (!tmp->upsname) upslogx(LOG_WARNING, "Warning: UPS [%s]: no upsname set!", tmp->sys); -} +} static void set_notifymsg(const char *name, const char *msg) { @@ -1182,7 +1030,7 @@ static void set_notifyflag(const char *ntype, char *flags) } /* in split mode, the parent doesn't hear about reloads */ -static void checkmode(char *cfgentry, char *oldvalue, char *newvalue, +static void checkmode(char *cfgentry, char *oldvalue, char *newvalue, int reloading) { /* nothing to do if in "all as root" mode */ @@ -1206,7 +1054,7 @@ static void checkmode(char *cfgentry, char *oldvalue, char *newvalue, } /* returns 1 if used, 0 if not, so we can complain about bogus configs */ -static int parse_conf_arg(size_t numargs, char **arg) +static int parse_conf_arg(int numargs, char **arg) { /* using up to arg[1] below */ if (numargs < 2) @@ -1233,7 +1081,7 @@ static int parse_conf_arg(size_t numargs, char **arg) arg[1]); return 1; - } + } /* NOTIFYCMD */ if (!strcmp(arg[0], "NOTIFYCMD")) { @@ -1244,23 +1092,13 @@ static int parse_conf_arg(size_t numargs, char **arg) /* POLLFREQ */ if (!strcmp(arg[0], "POLLFREQ")) { - int ipollfreq = atoi(arg[1]); - if (ipollfreq < 0) { - upsdebugx(0, "Ignoring invalid POLLFREQ value: %d", ipollfreq); - } else { - pollfreq = (unsigned int)ipollfreq; - } + pollfreq = atoi(arg[1]); return 1; } /* POLLFREQALERT */ if (!strcmp(arg[0], "POLLFREQALERT")) { - int ipollfreqalert = atoi(arg[1]); - if (ipollfreqalert < 0) { - upsdebugx(0, "Ignoring invalid POLLFREQALERT value: %d", ipollfreqalert); - } else { - pollfreqalert = (unsigned int)ipollfreqalert; - } + pollfreqalert = atoi(arg[1]); return 1; } @@ -1278,12 +1116,7 @@ static int parse_conf_arg(size_t numargs, char **arg) /* MINSUPPLIES */ if (!strcmp(arg[0], "MINSUPPLIES")) { - int iminsupplies = atoi(arg[1]); - if (iminsupplies < 0) { - upsdebugx(0, "Ignoring invalid MINSUPPLIES value: %d", iminsupplies); - } else { - minsupplies = (unsigned int)iminsupplies; - } + minsupplies = atoi(arg[1]); return 1; } @@ -1301,17 +1134,12 @@ static int parse_conf_arg(size_t numargs, char **arg) /* FINALDELAY */ if (!strcmp(arg[0], "FINALDELAY")) { - int ifinaldelay = atoi(arg[1]); - if (ifinaldelay < 0) { - upsdebugx(0, "Ignoring invalid FINALDELAY value: %d", ifinaldelay); - } else { - finaldelay = (unsigned int)ifinaldelay; - } + finaldelay = atoi(arg[1]); return 1; } /* RUN_AS_USER */ - if (!strcmp(arg[0], "RUN_AS_USER")) { + if (!strcmp(arg[0], "RUN_AS_USER")) { free(run_as_user); run_as_user = xstrdup(arg[1]); return 1; @@ -1336,18 +1164,6 @@ static int parse_conf_arg(size_t numargs, char **arg) return 1; } - /* DEBUG_MIN (NUM) */ - /* debug_min (NUM) also acceptable, to be on par with ups.conf */ - if (!strcasecmp(arg[0], "DEBUG_MIN")) { - int lvl = -1; // typeof common/common.c: int nut_debug_level - if ( str_to_int (arg[1], &lvl, 10) && lvl >= 0 ) { - nut_debug_level_global = lvl; - } else { - upslogx(LOG_INFO, "WARNING : Invalid DEBUG_MIN value found in upsmon.conf global settings"); - } - return 1; - } - /* using up to arg[2] below */ if (numargs < 3) return 0; @@ -1362,7 +1178,7 @@ static int parse_conf_arg(size_t numargs, char **arg) if (!strcmp(arg[0], "NOTIFYFLAG")) { set_notifyflag(arg[1], arg[2]); return 1; - } + } /* CERTIDENT */ if (!strcmp(arg[0], "CERTIDENT")) { @@ -1372,7 +1188,7 @@ static int parse_conf_arg(size_t numargs, char **arg) certpasswd = xstrdup(arg[2]); return 1; } - + /* using up to arg[4] below */ if (numargs < 5) return 0; @@ -1393,7 +1209,7 @@ static int parse_conf_arg(size_t numargs, char **arg) fatalx(EXIT_FAILURE, "Fatal error: unusable configuration"); } - /* ("primary"|"master" | "secondary"|"slave") */ + /* ("master" | "slave") */ addups(reload_flag, arg[1], arg[2], arg[3], arg[4], arg[5]); return 1; } @@ -1425,13 +1241,6 @@ static void loadconfig(void) fatalx(EXIT_FAILURE, "%s", ctx.errmsg); } - if (reload_flag == 1) { - /* if upsmon.conf added or changed - * (or commented away) the debug_min - * setting, detect that */ - nut_debug_level_global = -1; - } - while (pconf_file_next(&ctx)) { if (pconf_parse_error(&ctx)) { upslogx(LOG_ERR, "Parse error: %s:%d: %s", @@ -1446,34 +1255,25 @@ static void loadconfig(void) unsigned int i; char errmsg[SMALLBUF]; - snprintf(errmsg, sizeof(errmsg), + snprintf(errmsg, sizeof(errmsg), "%s line %d: invalid directive", configfile, ctx.linenum); for (i = 0; i < ctx.numargs; i++) - snprintfcat(errmsg, sizeof(errmsg), " %s", + snprintfcat(errmsg, sizeof(errmsg), " %s", ctx.arglist[i]); upslogx(LOG_WARNING, "%s", errmsg); } } - if (reload_flag == 1) { - if (nut_debug_level_global > -1) { - upslogx(LOG_INFO, - "Applying debug_min=%d from upsmon.conf", - nut_debug_level_global); - nut_debug_level = nut_debug_level_global; - } - } - - pconf_finish(&ctx); + pconf_finish(&ctx); } /* SIGPIPE handler */ static void sigpipe(int sig) { - upsdebugx(1, "SIGPIPE: dazed and confused, but continuing after signal %i...", sig); + upsdebugx(1, "SIGPIPE: dazed and confused, but continuing..."); } /* SIGQUIT, SIGTERM handler */ @@ -1529,16 +1329,12 @@ static void user_fsd(int sig) static void set_reload_flag(int sig) { - NUT_UNUSED_VARIABLE(sig); - reload_flag = 1; } /* handler for alarm when getupsvarfd times out */ static void read_timeout(int sig) { - NUT_UNUSED_VARIABLE(sig); - /* don't do anything here, just return */ } @@ -1574,10 +1370,9 @@ static void setup_signals(void) /* remember the last time the ups was not critical (OB + LB) */ static void update_crittimer(utype_t *ups) { - /* if !OB, !LB, or CAL, then it's not critical, so log the time */ - if ((!flag_isset(ups->status, ST_ONBATT)) || - (!flag_isset(ups->status, ST_LOWBATT)) || - (flag_isset(ups->status, ST_CAL))) { + /* if !OB or !LB, then it's not critical, so log the time */ + if ((!flag_isset(ups->status, ST_ONBATT)) || + (!flag_isset(ups->status, ST_LOWBATT))) { time(&ups->lastnoncrit); return; @@ -1596,7 +1391,7 @@ static int try_connect(utype_t *ups) clearflag(&ups->status, ST_CONNECTED); /* force it if configured that way, just try it otherwise */ - if (forcessl == 1) + if (forcessl == 1) flags |= UPSCLI_CONN_REQSSL; else flags |= UPSCLI_CONN_TRYSSL; @@ -1637,9 +1432,6 @@ static int try_connect(utype_t *ups) /* we're definitely connected now */ setflag(&ups->status, ST_CONNECTED); - /* prevent connection leaking to NOTIFYCMD */ - fcntl(upscli_fd(&ups->conn), F_SETFD, FD_CLOEXEC); - /* now try to authenticate to upsd */ ret = do_upsd_auth(ups); @@ -1664,7 +1456,7 @@ static void parse_status(utype_t *ups, char *status) upsdebugx(2, "%s: [%s]", __func__, status); /* empty response is the same as a dead ups */ - if (status == NULL || status[0] == '\0') { + if (!strcmp(status, "")) { ups_is_gone(ups); return; } @@ -1695,8 +1487,6 @@ static void parse_status(utype_t *ups, char *status) ups_low_batt(ups); if (!strcasecmp(statword, "RB")) upsreplbatt(ups); - if (!strcasecmp(statword, "CAL")) - ups_cal(ups); /* do it last to override any possible OL */ if (!strcasecmp(statword, "FSD")) @@ -1705,7 +1495,7 @@ static void parse_status(utype_t *ups, char *status) update_crittimer(ups); statword = ptr; - } + } } /* see what the status of the UPS is and handle any changes */ @@ -1740,12 +1530,12 @@ static void pollups(utype_t *ups) case UPSCLI_ERR_UNKNOWNUPS: upslogx(LOG_ERR, "Poll UPS [%s] failed - [%s] " - "does not exist on server %s", + "does not exist on server %s", ups->sys, ups->upsname, ups->hostname); break; default: - upslogx(LOG_ERR, "Poll UPS [%s] failed - %s", + upslogx(LOG_ERR, "Poll UPS [%s] failed - %s", ups->sys, upscli_strerror(&ups->conn)); break; } @@ -1782,7 +1572,7 @@ static int pdflag_status(void) fclose(pdf); /* reasoning: say upsmon.conf is world-writable (!) and some nasty - * user puts something "important" as the power flag file. This + * user puts something "important" as the power flag file. This * keeps upsmon from utterly trashing it when starting up or powering * down at the expense of not shutting down the UPS. * @@ -1793,7 +1583,7 @@ static int pdflag_status(void) return 1; /* exists and looks good */ return -1; /* error: something else is in there */ -} +} /* only remove the flag file if it's actually from us */ static void clear_pdflag(void) @@ -1844,23 +1634,17 @@ static int check_pdflag(void) return EXIT_SUCCESS; } -static void help(const char *arg_progname) - __attribute__((noreturn)); - -static void help(const char *arg_progname) +static void help(const char *progname) { printf("Monitors UPS servers and may initiate shutdown if necessary.\n\n"); - printf("usage: %s [OPTIONS]\n\n", arg_progname); - printf(" -c send command to running process\n"); + printf("usage: %s [OPTIONS]\n\n", progname); + printf(" -c send command to running process\n"); printf(" commands:\n"); - printf(" - fsd: shutdown all primary-mode UPSes (use with caution)\n"); + printf(" - fsd: shutdown all master UPSes (use with caution)\n"); printf(" - reload: reread configuration\n"); printf(" - stop: stop monitoring and exit\n"); - printf(" -P send the signal above to specified PID (bypassing PID file)\n"); - printf(" -D raise debugging level (and stay foreground by default)\n"); - printf(" -F stay foregrounded even if no debugging is enabled\n"); - printf(" -B stay backgrounded even if debugging is bumped\n"); + printf(" -D raise debugging level\n"); printf(" -h display this help\n"); printf(" -K checks POWERDOWNFLAG, sets exit code to 0 if set\n"); printf(" -p always run privileged (disable privileged parent)\n"); @@ -1871,26 +1655,15 @@ static void help(const char *arg_progname) exit(EXIT_SUCCESS); } -static void runparent(int fd) - __attribute__((noreturn)); - static void runparent(int fd) { - ssize_t ret; - int sret; + int ret; char ch; /* handling signals is the child's job */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif signal(SIGHUP, SIG_IGN); signal(SIGUSR1, SIG_IGN); signal(SIGUSR2, SIG_IGN); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif ret = read(fd, &ch, 1); @@ -1907,9 +1680,9 @@ static void runparent(int fd) /* have to do this here - child is unprivileged */ set_pdflag(); - sret = system(shutdowncmd); + ret = system(shutdowncmd); - if (sret != 0) + if (ret != 0) upslogx(LOG_ERR, "parent: Unable to call shutdown command: %s", shutdowncmd); @@ -1937,15 +1710,10 @@ static void start_pipe(void) close(pipefd[1]); runparent(pipefd[0]); -#ifndef HAVE___ATTRIBUTE__NORETURN exit(EXIT_FAILURE); /* NOTREACHED */ -#endif } close(pipefd[0]); - - /* prevent pipe leaking to NOTIFYCMD */ - fcntl(pipefd[1], F_SETFD, FD_CLOEXEC); } static void delete_ups(utype_t *target) @@ -1984,7 +1752,7 @@ static void delete_ups(utype_t *target) /* shouldn't happen */ upslogx(LOG_ERR, "delete_ups: UPS not found"); -} +} /* see if we can open a file */ static int check_file(const char *fn) @@ -2046,7 +1814,7 @@ static void reload_conf(void) upslogx(LOG_CRIT, "Fatal error: total power value (%d) less " "than MINSUPPLIES (%d)", totalpv, minsupplies); - fatalx(EXIT_FAILURE, "Impossible power configuration, unable to continue"); + fatalx(EXIT_FAILURE, "Impossible power configuation, unable to continue"); } /* finally clear the flag */ @@ -2078,7 +1846,7 @@ static void check_parent(void) time(&now); /* complain every 2 minutes */ - if ((now - lastwarn) < 120) + if ((now - lastwarn) < 120) return; lastwarn = now; @@ -2088,11 +1856,10 @@ static void check_parent(void) upslogx(LOG_ALERT, "Parent died - shutdown impossible"); } -int main(int argc, char *argv[]) +int main(int argc, char *argv[]) { const char *prog = xbasename(argv[0]); - int i, cmd = 0, cmdret = -1, checking_flag = 0, foreground = -1; - pid_t oldpid = -1; + int i, cmd = 0, checking_flag = 0; printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); @@ -2103,7 +1870,7 @@ int main(int argc, char *argv[]) run_as_user = xstrdup(RUN_AS_USER); - while ((i = getopt(argc, argv, "+DFBhic:P:f:pu:VK46")) != -1) { + while ((i = getopt(argc, argv, "+Dhic:f:pu:VK46")) != -1) { switch (i) { case 'c': if (!strncmp(optarg, "fsd", strlen(optarg))) @@ -2117,30 +1884,16 @@ int main(int argc, char *argv[]) if (cmd == 0) help(argv[0]); break; - - case 'P': - if ((oldpid = parsepid(optarg)) < 0) - help(argv[0]); - break; - case 'D': nut_debug_level++; break; - case 'F': - foreground = 1; - break; - case 'B': - foreground = 0; - break; case 'f': free(configfile); configfile = xstrdup(optarg); break; case 'h': help(argv[0]); -#ifndef HAVE___ATTRIBUTE__NORETURN break; -#endif case 'K': checking_flag = 1; break; @@ -2162,56 +1915,22 @@ int main(int argc, char *argv[]) break; default: help(argv[0]); -#ifndef HAVE___ATTRIBUTE__NORETURN break; -#endif - } - } - - if (foreground < 0) { - if (nut_debug_level > 0) { - foreground = 1; - } else { - foreground = 0; } } if (cmd) { - if (oldpid < 0) { - cmdret = sendsignal(prog, cmd); - } else { - cmdret = sendsignalpid(oldpid, cmd); - } - /* exit(EXIT_SUCCESS); */ - exit((cmdret == 0)?EXIT_SUCCESS:EXIT_FAILURE); + sendsignal(prog, cmd); + exit(EXIT_SUCCESS); } /* otherwise, we are being asked to start. * so check if a previous instance is running by sending signal '0' * (Ie 'kill 0') */ - if (oldpid < 0) { - cmdret = sendsignal(prog, 0); - } else { - cmdret = sendsignalpid(oldpid, 0); - } - switch (cmdret) { - case 0: + if (sendsignal(prog, 0) == 0) { printf("Fatal error: A previous upsmon instance is already running!\n"); printf("Either stop the previous instance first, or use the 'reload' command.\n"); exit(EXIT_FAILURE); - - case -3: - case -2: - upslogx(LOG_WARNING, "Could not %s PID file " - "to see if previous upsmon instance is " - "already running!\n", - (cmdret == -3 ? "find" : "parse")); - break; - - case -1: - default: - /* Just failed to send signal, no competitor running */ - break; } argc -= optind; @@ -2221,14 +1940,6 @@ int main(int argc, char *argv[]) loadconfig(); - /* CLI debug level can not be smaller than debug_min specified - * in upsmon.conf. Note that non-zero debug_min does not impact - * foreground running mode. - */ - if (nut_debug_level_global > nut_debug_level) - nut_debug_level = nut_debug_level_global; - upsdebugx(1, "debug level is '%d'", nut_debug_level); - if (checking_flag) exit(check_pdflag()); @@ -2251,14 +1962,12 @@ int main(int argc, char *argv[]) exit(EXIT_FAILURE); } - if (!foreground) { + if (nut_debug_level < 1) { background(); - } - - if (nut_debug_level >= 1) { + } else { upsdebugx(1, "debug level is '%d'", nut_debug_level); } - + /* only do the pipe stuff if the user hasn't disabled it */ if (use_pipe) { struct passwd *new_uid = get_user_pwent(run_as_user); @@ -2272,14 +1981,14 @@ int main(int argc, char *argv[]) become_user(new_uid); } else { upslogx(LOG_INFO, "Warning: running as one big root process by request (upsmon -p)"); - + writepid(prog); } - + if (upscli_init(certverify, certpath, certname, certpasswd) < 0) { exit(EXIT_FAILURE); } - + /* prep our signal handlers */ setup_signals(); diff --git a/clients/upsmon.h b/clients/upsmon.h index d60720b..2504370 100644 --- a/clients/upsmon.h +++ b/clients/upsmon.h @@ -17,23 +17,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_UPSMON_H_SEEN -#define NUT_UPSMON_H_SEEN 1 - /* flags for ups->status */ -#define ST_ONLINE (1 << 0) /* UPS is on line (OL) */ -#define ST_ONBATT (1 << 1) /* UPS is on battery (OB) */ -#define ST_LOWBATT (1 << 2) /* UPS has a low battery (LB) */ -#define ST_FSD (1 << 3) /* primary has set forced shutdown flag */ -#define ST_PRIMARY (1 << 4) /* we are the primary (manager) of this UPS */ -#define ST_MASTER ST_PRIMARY /* legacy alias */ -#define ST_LOGIN (1 << 5) /* we are logged into this UPS */ -#define ST_CONNECTED (1 << 6) /* upscli_connect returned OK */ -#define ST_CAL (1 << 7) /* UPS calibration in progress (CAL) */ +#define ST_ONLINE (1 << 0) /* UPS is on line (OL) */ +#define ST_ONBATT (1 << 1) /* UPS is on battery (OB) */ +#define ST_LOWBATT (1 << 2) /* UPS has a low battery (LB) */ +#define ST_FSD (1 << 3) /* master has set forced shutdown flag */ +#define ST_MASTER (1 << 4) /* we are the master on this UPS */ +#define ST_LOGIN (1 << 5) /* we are logged into this UPS */ +#define ST_CONNECTED (1 << 6) /* upscli_connect returned OK */ /* required contents of flag file */ -#define SDMAGIC "upsmon-shutdown-file" +#define SDMAGIC "upsmon-shutdown-file" #ifdef __cplusplus /* *INDENT-OFF* */ @@ -49,9 +44,9 @@ typedef struct { char *sys; /* raw system name from .conf */ char *upsname; /* just upsname */ char *hostname; /* just hostname */ - uint16_t port; /* just the port */ + int port; /* just the port */ - unsigned int pv; /* power value from conf */ + int pv; /* power value from conf */ char *un; /* username (optional for now) */ char *pw; /* password from conf */ int status; /* status (see flags above) */ @@ -70,17 +65,16 @@ typedef struct { /* notify identifiers */ -#define NOTIFY_ONLINE 0 /* UPS went on-line */ -#define NOTIFY_ONBATT 1 /* UPS went on battery */ -#define NOTIFY_LOWBATT 2 /* UPS went to low battery */ -#define NOTIFY_FSD 3 /* Primary upsmon set FSD flag */ -#define NOTIFY_COMMOK 4 /* Communication established */ -#define NOTIFY_COMMBAD 5 /* Communication lost */ -#define NOTIFY_SHUTDOWN 6 /* System shutdown in progress */ -#define NOTIFY_REPLBATT 7 /* UPS battery needs to be replaced */ -#define NOTIFY_NOCOMM 8 /* UPS hasn't been contacted in a while */ -#define NOTIFY_NOPARENT 9 /* privileged parent process died */ -#define NOTIFY_CAL 10 /* UPS is performing calibration */ +#define NOTIFY_ONLINE 0 /* UPS went on-line */ +#define NOTIFY_ONBATT 1 /* UPS went on battery */ +#define NOTIFY_LOWBATT 2 /* UPS went to low battery */ +#define NOTIFY_FSD 3 /* Master upsmon set FSD flag */ +#define NOTIFY_COMMOK 4 /* Communication established */ +#define NOTIFY_COMMBAD 5 /* Communication lost */ +#define NOTIFY_SHUTDOWN 6 /* System shutdown in progress */ +#define NOTIFY_REPLBATT 7 /* UPS battery needs to be replaced */ +#define NOTIFY_NOCOMM 8 /* UPS hasn't been contacted in awhile */ +#define NOTIFY_NOPARENT 9 /* privileged parent process died */ /* notify flag values */ @@ -92,10 +86,7 @@ typedef struct { /* flags are set to NOTIFY_SYSLOG | NOTIFY_WALL at program init */ /* the user can override with NOTIFYFLAGS in the upsmon.conf */ -/* This is only used in upsmon.c, but might it also have external consumers?.. - * To move or not to move?.. - */ -static struct { +struct { int type; const char *name; char *msg; /* NULL until overridden */ @@ -113,7 +104,6 @@ static struct { { NOTIFY_REPLBATT, "REPLBATT", NULL, "UPS %s battery needs to be replaced", NOTIFY_SYSLOG | NOTIFY_WALL }, { NOTIFY_NOCOMM, "NOCOMM", NULL, "UPS %s is unavailable", NOTIFY_SYSLOG | NOTIFY_WALL }, { NOTIFY_NOPARENT, "NOPARENT", NULL, "upsmon parent process died - shutdown impossible", NOTIFY_SYSLOG | NOTIFY_WALL }, - { NOTIFY_CAL, "CAL", NULL, "UPS %s: calibration in progress", NOTIFY_SYSLOG }, { 0, NULL, NULL, NULL, 0 } }; @@ -132,5 +122,3 @@ static struct { } /* *INDENT-ON* */ #endif - -#endif /* NUT_UPSMON_H_SEEN */ diff --git a/clients/upsrw.c b/clients/upsrw.c index 2789f9a..8113690 100644 --- a/clients/upsrw.c +++ b/clients/upsrw.c @@ -1,8 +1,6 @@ /* upsrw - simple client for read/write variable access (formerly upsct2) - Copyright (C) - 1999 Russell Kroll - 2019 EATON (author: Arnaud Quette ) + Copyright (C) 1999 Russell Kroll This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,14 +25,10 @@ #include #include -#include "nut_stdint.h" #include "upsclient.h" -#include "extstate.h" -static char *upsname = NULL, *hostname = NULL; +static char *upsname = NULL, *hostname = NULL; static UPSCONN_t *ups = NULL; -static int tracking_enabled = 0; -static unsigned int timeout = DEFAULT_TRACKING_TIMEOUT; struct list_t { char *name; @@ -45,22 +39,18 @@ static void usage(const char *prog) { printf("Network UPS Tools %s %s\n\n", prog, UPS_VERSION); printf("usage: %s [-h]\n", prog); - printf(" %s [-s ] [-u ] [-p ] [-w] [-t ] \n\n", prog); + printf(" %s [-s ] [-u ] [-p ] \n\n", prog); printf("Demo program to set variables within UPS hardware.\n"); printf("\n"); printf(" -h display this help text\n"); printf(" -s specify variable to be changed\n"); printf(" use -s VAR=VALUE to avoid prompting for value\n"); - printf(" -l show all possible read/write variables.\n"); printf(" -u set username for command authentication\n"); printf(" -p set password for command authentication\n"); - printf(" -w wait for the completion of setting by the driver\n"); - printf(" and return its actual result from the device\n"); - printf(" -t set a timeout when using -w (in seconds, default: %u)\n", DEFAULT_TRACKING_TIMEOUT); printf("\n"); printf(" UPS identifier - [@[:]]\n"); printf("\n"); - printf("Call without -s to show all possible read/write variables (same as -l).\n"); + printf("Call without -s to show all possible read/write variables.\n"); } static void clean_exit(void) @@ -74,21 +64,9 @@ static void clean_exit(void) free(ups); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif static void do_set(const char *varname, const char *newval) { - int cmd_complete = 0; char buf[SMALLBUF], enc[SMALLBUF]; - char tracking_id[UUID4_LEN]; - time_t start, now; snprintf(buf, sizeof(buf), "SET VAR %s %s \"%s\"\n", upsname, varname, pconf_encode(newval, enc, sizeof(enc))); @@ -100,92 +78,17 @@ static void do_set(const char *varname, const char *newval) fatalx(EXIT_FAILURE, "Set variable failed: %s", upscli_strerror(ups)); } - /* verify answer */ + /* FUTURE: status cookies will tie in here */ if (strncmp(buf, "OK", 2) != 0) { fatalx(EXIT_FAILURE, "Unexpected response from upsd: %s", buf); } - /* check for status tracking id */ - if ( - !tracking_enabled || - /* sanity check on the size: "OK TRACKING " + UUID4_LEN */ - strlen(buf) != (UUID4_LEN - 1 + strlen("OK TRACKING ")) - ) { - /* reply as usual */ - fprintf(stderr, "%s\n", buf); - return; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif - /* From the check above, we know that we have exactly UUID4_LEN chars - * (aka sizeof(tracking_id)) in the buf after "OK TRACKING " prefix, - * plus the null-byte. - */ - assert (UUID4_LEN == 1 + snprintf(tracking_id, sizeof(tracking_id), "%s", buf + strlen("OK TRACKING "))); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif - time(&start); - - /* send status tracking request, looping if status is PENDING */ - while (!cmd_complete) { - - /* check for timeout */ - time(&now); - if (difftime(now, start) >= timeout) - fatalx(EXIT_FAILURE, "Can't receive status tracking information: timeout"); - - snprintf(buf, sizeof(buf), "GET TRACKING %s\n", tracking_id); - - if (upscli_sendline(ups, buf, strlen(buf)) < 0) - fatalx(EXIT_FAILURE, "Can't send status tracking request: %s", upscli_strerror(ups)); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -/* Note for gating macros above: unsuffixed HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - * means support of contexts both inside and outside function body, so the push - * above and pop below (outside this finction) are not used. - */ -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -/* Note that the individual warning pragmas for use inside function bodies - * are named without a _INSIDEFUNC suffix, for simplicity and legacy reasons - */ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* and get status tracking reply */ - assert(timeout < LONG_MAX); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - if (upscli_readline_timeout(ups, buf, sizeof(buf), (long)timeout) < 0) - fatalx(EXIT_FAILURE, "Can't receive status tracking information: %s", upscli_strerror(ups)); - - if (strncmp(buf, "PENDING", 7)) - cmd_complete = 1; - else - /* wait a second before retrying */ - sleep(1); - } - fprintf(stderr, "%s\n", buf); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif static void do_setvar(const char *varname, char *uin, const char *pass) { - char newval[SMALLBUF], temp[SMALLBUF * 2], user[SMALLBUF], *ptr; + char newval[SMALLBUF], temp[SMALLBUF], user[SMALLBUF], *ptr; struct passwd *pw; if (uin) { @@ -274,32 +177,13 @@ static void do_setvar(const char *varname, char *uin, const char *pass) fatalx(EXIT_FAILURE, "Error: old variable names are not supported"); } - /* enable status tracking ID */ - if (tracking_enabled) { - - snprintf(temp, sizeof(temp), "SET TRACKING ON\n"); - - if (upscli_sendline(ups, temp, strlen(temp)) < 0) { - fatalx(EXIT_FAILURE, "Can't enable set variable status tracking: %s", upscli_strerror(ups)); - } - - if (upscli_readline(ups, temp, sizeof(temp)) < 0) { - fatalx(EXIT_FAILURE, "Enabling set variable status tracking failed: %s", upscli_strerror(ups)); - } - - /* Verify the result */ - if (strncmp(temp, "OK", 2) != 0) { - fatalx(EXIT_FAILURE, "Enabling set variable status tracking failed. upsd answered: %s", temp); - } - } - do_set(varname, newval); } static const char *get_data(const char *type, const char *varname) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer; const char *query[4]; @@ -319,7 +203,7 @@ static const char *get_data(const char *type, const char *varname) return answer[3]; } -static void do_string(const char *varname, const long len) +static void do_string(const char *varname, const int len) { const char *val; @@ -330,34 +214,14 @@ static void do_string(const char *varname, const long len) } printf("Type: STRING\n"); - printf("Maximum length: %ld\n", len); + printf("Maximum length: %d\n", len); printf("Value: %s\n", val); } -static void do_number(const char *varname) -{ - const char *val; - - val = get_data("VAR", varname); - - if (!val) { - fatalx(EXIT_FAILURE, "do_number: can't get current value of %s", varname); - } - - printf("Type: NUMBER\n"); - printf("Value: %s\n", val); -} - -/** - * Display ENUM information - * @param varname the name of the NUT variable - * @param vartype the type of the NUT variable (ST_FLAG_STRING, ST_FLAG_NUMBER - * @param len the length of the NUT variable, if type == ST_FLAG_STRING - */ -static void do_enum(const char *varname, const int vartype, const long len) +static void do_enum(const char *varname) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer, buf[SMALLBUF]; const char *query[4], *val; @@ -383,21 +247,14 @@ static void do_enum(const char *varname, const int vartype, const long len) ret = upscli_list_next(ups, numq, query, &numa, &answer); - /* Fallback for older upsd versions */ - if (vartype != ST_FLAG_NONE) - printf("Type: ENUM %s\n", (vartype == ST_FLAG_STRING)?"STRING":"NUMBER"); - else - printf("Type: ENUM\n"); - - if (vartype == ST_FLAG_STRING) - printf("Maximum length: %ld\n", len); + printf("Type: ENUM\n"); while (ret == 1) { /* ENUM */ if (numa < 4) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 4)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } printf("Option: \"%s\"", answer[3]); @@ -415,7 +272,7 @@ static void do_enum(const char *varname, const int vartype, const long len) static void do_range(const char *varname) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer; const char *query[4], *val; int ival, min, max; @@ -442,15 +299,14 @@ static void do_range(const char *varname) ret = upscli_list_next(ups, numq, query, &numa, &answer); - /* Ranges implies a type "NUMBER" */ - printf("Type: RANGE NUMBER\n"); + printf("Type: RANGE\n"); while (ret == 1) { /* RANGE */ if (numa < 5) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 4)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } min = atoi(answer[3]); @@ -471,8 +327,7 @@ static void do_range(const char *varname) static void do_type(const char *varname) { int ret; - int is_enum = 0; /* 1 if ENUM; FIXME: add a boolean type in common.h */ - size_t i, numq, numa; + unsigned int i, numq, numa; char **answer; const char *query[4]; @@ -484,18 +339,16 @@ static void do_type(const char *varname) ret = upscli_get(ups, numq, query, &numa, &answer); if ((ret < 0) || (numa < numq)) { - printf("Unknown type\n"); + printf("Unknown type\n"); return; } /* TYPE ... */ for (i = 3; i < numa; i++) { - /* ENUM can be NUMBER or STRING - * just flag it for latter processing */ if (!strcasecmp(answer[i], "ENUM")) { - is_enum = 1; - continue; + do_enum(varname); + return; } if (!strcasecmp(answer[i], "RANGE")) { @@ -506,24 +359,13 @@ static void do_type(const char *varname) if (!strncasecmp(answer[i], "STRING:", 7)) { char *len = answer[i] + 7; - long length = strtol(len, NULL, 10); + int length = strtol(len, NULL, 10); - if (is_enum == 1) - do_enum(varname, ST_FLAG_STRING, length); - else - do_string(varname, length); + do_string(varname, length); return; } - if (!strcasecmp(answer[i], "NUMBER")) { - if (is_enum == 1) - do_enum(varname, ST_FLAG_NUMBER, 0); - else - do_number(varname); - return; - } - /* ignore this one */ if (!strcasecmp(answer[i], "RW")) { continue; @@ -531,10 +373,6 @@ static void do_type(const char *varname) printf("Type: %s (unrecognized)\n", answer[i]); } - /* Fallback for older upsd versions, where STRING|NUMBER is not - * appended to ENUM */ - if (is_enum == 1) - do_enum(varname, ST_FLAG_NONE, 0); } static void print_rw(const char *varname) @@ -559,7 +397,7 @@ static void print_rw(const char *varname) static void print_rwlist(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[2]; char **answer; struct list_t *lhead, *llast, *ltmp, *lnext; @@ -593,7 +431,7 @@ static void print_rwlist(void) /* RW */ if (numa < 4) { - fatalx(EXIT_FAILURE, "Error: insufficient data (got %zu args, need at least 4)", numa); + fatalx(EXIT_FAILURE, "Error: insufficient data (got %d args, need at least 4)", numa); } /* sock this entry away for later */ @@ -630,36 +468,22 @@ static void print_rwlist(void) int main(int argc, char **argv) { - int i; - uint16_t port; + int i, port; const char *prog = xbasename(argv[0]); char *password = NULL, *username = NULL, *setvar = NULL; - while ((i = getopt(argc, argv, "+hls:p:t:u:wV")) != -1) { + while ((i = getopt(argc, argv, "+hs:p:u:V")) != -1) { switch (i) { case 's': setvar = optarg; break; - case 'l': - if (setvar) { - upslogx(LOG_WARNING, "Listing mode requested, overriding setvar specified earlier!"); - setvar = NULL; - } - break; case 'p': password = optarg; break; - case 't': - if (!str_to_uint(optarg, &timeout, 10)) - fatal_with_errno(EXIT_FAILURE, "Could not convert the provided value for timeout ('-t' option) to unsigned int"); - break; case 'u': username = optarg; break; - case 'w': - tracking_enabled = 1; - break; case 'V': printf("Network UPS Tools %s %s\n", prog, UPS_VERSION); exit(EXIT_SUCCESS); diff --git a/clients/upssched-cmd b/clients/upssched-cmd index 893cd49..63255df 100755 --- a/clients/upssched-cmd +++ b/clients/upssched-cmd @@ -11,19 +11,8 @@ # from your AT lines. case $1 in - onbattwarn) - # Send a notification mail - echo "The UPS has been on battery for awhile" \ - | mail -s"UPS monitor" bofh@pager.example.com - # Create a flag-file on the filesystem, for your own processing - /usr/bin/touch /some/path/ups-on-battery - ;; - ups-back-on-power) - # Delete the flag-file on the filesystem - /bin/rm -f /some/path/ups-on-battery - ;; upsgone) - logger -t upssched-cmd "The communication with UPS has been gone for awhile" + logger -t upssched-cmd "The UPS has been gone for awhile" ;; *) logger -t upssched-cmd "Unrecognized command: $1" diff --git a/clients/upssched.c b/clients/upssched.c index 8bb3547..97b3ed4 100644 --- a/clients/upssched.c +++ b/clients/upssched.c @@ -46,12 +46,9 @@ #include #include #include -#include -#include #include "upssched.h" #include "timehead.h" -#include "nut_stdint.h" typedef struct ttype_s { char *name; @@ -59,13 +56,14 @@ typedef struct ttype_s { struct ttype_s *next; } ttype_t; -static ttype_t *thead = NULL; -static conn_t *connhead = NULL; -static char *cmdscript = NULL, *pipefn = NULL, *lockfn = NULL; -static int verbose = 0; /* use for debugging */ + ttype_t *thead = NULL; + static conn_t *connhead = NULL; + char *cmdscript = NULL, *pipefn = NULL, *lockfn = NULL; + int verbose = 0; /* use for debugging */ -/* ups name and notify type (string) as received from upsmon */ -static const char *upsname, *notify_type; + + /* ups name and notify type (string) as received from upsmon */ + const char *upsname, *notify_type; #define PARENT_STARTED -2 #define PARENT_UNNECESSARY -3 @@ -181,7 +179,7 @@ static void checktimers(void) static void start_timer(const char *name, const char *ofsstr) { time_t now; - long ofs; + int ofs; ttype_t *tmp, *last; /* get the time */ @@ -196,7 +194,7 @@ static void start_timer(const char *name, const char *ofsstr) } if (verbose) - upslogx(LOG_INFO, "New timer: %s (%ld seconds)", name, ofs); + upslogx(LOG_INFO, "New timer: %s (%d seconds)", name, ofs); /* now add to the queue */ tmp = last = thead; @@ -242,7 +240,7 @@ static void cancel_timer(const char *name, const char *cname) static void us_serialize(int op) { static int pipefd[2]; - ssize_t ret; + int ret; char ch; switch(op) { @@ -272,7 +270,6 @@ static int open_sock(void) int ret, fd; struct sockaddr_un ssaddr; - check_unix_socket_filename(pipefn); fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) @@ -300,9 +297,6 @@ static int open_sock(void) if (ret < 0) fatal_with_errno(EXIT_FAILURE, "listen(%d, %d) failed", fd, US_LISTEN_BACKLOG); - /* don't leak socket to CMDSCRIPT */ - fcntl(fd, F_SETFD, FD_CLOEXEC); - return fd; } @@ -335,40 +329,17 @@ static void conn_del(conn_t *target) static int send_to_one(conn_t *conn, const char *fmt, ...) { - ssize_t ret; - size_t buflen; + int ret; va_list ap; char buf[US_SOCK_BUF_LEN]; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(buf, sizeof(buf), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); - buflen = strlen(buf); - if (buflen >= SSIZE_MAX) { - /* Can't compare buflen to ret */ - upsdebugx(2, "send_to_one(): buffered message too large"); + ret = write(conn->fd, buf, strlen(buf)); - close(conn->fd); - conn_del(conn); - - return 0; /* failed */ - } - ret = write(conn->fd, buf, buflen); - - if ((ret < 1) || (ret != (ssize_t) buflen)) { + if ((ret < 1) || (ret != (int) strlen(buf))) { upsdebugx(2, "write to fd %d failed", conn->fd); close(conn->fd); @@ -385,7 +356,7 @@ static void conn_add(int sockfd) int acc, ret; conn_t *tmp, *last; struct sockaddr_un saddr; -#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) +#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) int salen; #else socklen_t salen; @@ -399,9 +370,6 @@ static void conn_add(int sockfd) return; } - /* don't leak connection to CMDSCRIPT */ - fcntl(acc, F_SETFD, FD_CLOEXEC); - /* enable nonblocking I/O */ ret = fcntl(acc, F_GETFL, 0); @@ -472,20 +440,19 @@ static int sock_arg(conn_t *conn) return 0; } -static void log_unknown(size_t numarg, char **arg) +static void log_unknown(int numarg, char **arg) { - size_t i; + int i; upslogx(LOG_INFO, "Unknown command on socket: "); for (i = 0; i < numarg; i++) - upslogx(LOG_INFO, "arg %zu: %s", i, arg[i]); + upslogx(LOG_INFO, "arg %d: %s", i, arg[i]); } static int sock_read(conn_t *conn) { - int i; - ssize_t ret; + int i, ret; char ch; for (i = 0; i < US_MAX_READ; i++) { @@ -498,19 +465,13 @@ static int sock_read(conn_t *conn) if ((ret == -1) && (errno == EAGAIN)) return 0; - /* O_NDELAY with zero bytes means nothing to read but - * since read() follows a succesful select() with - * ready file descriptor, ret shouldn't be 0. */ - if (ret == 0) - continue; - /* some other problem */ return -1; /* error */ } ret = pconf_char(&conn->ctx, ch); - if (ret == 0) /* nothing to parse yet */ + if (ret == 0) /* nothing to parse yet */ continue; if (ret == -1) { @@ -633,8 +594,6 @@ static int try_connect(void) int pipefd, ret; struct sockaddr_un saddr; - check_unix_socket_filename(pipefn); - memset(&saddr, '\0', sizeof(saddr)); saddr.sun_family = AF_UNIX; snprintf(saddr.sun_path, sizeof(saddr.sun_path), "%s", pipefn); @@ -700,15 +659,28 @@ static int check_parent(const char *cmd, const char *arg2) exit(EXIT_FAILURE); } +static void read_timeout(int sig) +{ + /* ignore this */ + return; +} + +static void setup_sigalrm(void) +{ + struct sigaction sa; + sigset_t nut_upssched_sigmask; + + sigemptyset(&nut_upssched_sigmask); + sa.sa_mask = nut_upssched_sigmask; + sa.sa_flags = 0; + sa.sa_handler = read_timeout; + sigaction(SIGALRM, &sa, NULL); +} + static void sendcmd(const char *cmd, const char *arg1, const char *arg2) { - int i, pipefd; - ssize_t ret; - size_t enclen, buflen; - char buf[SMALLBUF], enc[SMALLBUF + 8]; - int ret_s; - struct timeval tv; - fd_set fdread; + int i, pipefd, ret; + char buf[SMALLBUF], enc[SMALLBUF]; /* insanity */ if (!arg1) @@ -724,14 +696,6 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) snprintf(enc, sizeof(enc), "%s\n", buf); - /* Sanity checks, for static analyzers to sleep well */ - enclen = strlen(enc); - buflen = strlen(buf); - if (enclen >= SSIZE_MAX || buflen >= SSIZE_MAX) { - /* Can't compare enclen to ret below */ - fatalx(EXIT_FAILURE, "Unable to connect to daemon: buffered message too large"); - } - /* see if the parent needs to be started (and maybe start it) */ for (i = 0; i < MAX_TRIES; i++) { @@ -739,6 +703,7 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) pipefd = check_parent(cmd, arg2); if (pipefd == PARENT_STARTED) { + /* loop back and try to connect now */ usleep(250000); continue; @@ -750,41 +715,23 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) /* we're connected now */ - ret = write(pipefd, enc, enclen); + ret = write(pipefd, enc, strlen(enc)); /* if we can't send the whole thing, loop back and try again */ - if ((ret < 1) || (ret != (ssize_t)enclen)) { + if ((ret < 1) || (ret != (int) strlen(enc))) { upslogx(LOG_ERR, "write failed, trying again"); close(pipefd); continue; } - /* select on child's pipe fd */ - do { - /* set timeout every time before call select() */ - tv.tv_sec = 1; - tv.tv_usec = 0; + /* ugh - probably should use select here... */ + setup_sigalrm(); - FD_ZERO(&fdread); - FD_SET(pipefd, &fdread); + alarm(2); + ret = read(pipefd, buf, sizeof(buf)); + alarm(0); - ret_s = select(pipefd + 1, &fdread, NULL, NULL, &tv); - switch(ret_s) { - /* select error */ - case -1: - upslogx(LOG_DEBUG, "parent select error: %s", strerror(errno)); - break; - - /* nothing to read */ - case 0: - break; - - /* available data to read */ - default: - ret = read(pipefd, buf, sizeof(buf)); - break; - } - } while (ret_s <= 0); + signal(SIGALRM, SIG_IGN); close(pipefd); @@ -800,7 +747,7 @@ static void sendcmd(const char *cmd, const char *arg1, const char *arg2) upslogx(LOG_ERR, "read confirmation got [%s]", buf); /* try again ... */ - } /* loop until MAX_TRIES if no success above */ + } fatalx(EXIT_FAILURE, "Unable to connect to daemon and unable to start daemon"); } @@ -847,7 +794,7 @@ static void parse_at(const char *ntype, const char *un, const char *cmd, } if (!strcmp(cmd, "EXECUTE")) { - if (ca1[0] == '\0') { + if (ca1 == '\0') { upslogx(LOG_ERR, "Empty EXECUTE command argument"); return; } @@ -862,7 +809,7 @@ static void parse_at(const char *ntype, const char *un, const char *cmd, upslogx(LOG_ERR, "Invalid command: %s", cmd); } -static int conf_arg(size_t numargs, char **arg) +static int conf_arg(int numargs, char **arg) { if (numargs < 2) return 0; @@ -953,15 +900,9 @@ static void checkconf(void) int main(int argc, char **argv) { - const char *prog = NULL; - /* More a use for argc to avoid warnings than a real need: */ - if (argc > 0) { - xbasename(argv[0]); - } else { - xbasename("upssched"); - } + const char *prog = xbasename(argv[0]); - verbose = 1; /* TODO: remove when done testing, or add -D */ + verbose = 1; /* TODO: remove when done testing */ /* normally we don't have stderr, so get this going to syslog early */ open_syslog(prog); diff --git a/clients/upssched.h b/clients/upssched.h index 1b7e8f1..db0c25d 100644 --- a/clients/upssched.h +++ b/clients/upssched.h @@ -1,8 +1,5 @@ /* upssched.h - supporting structures */ -#ifndef NUT_UPSSCHED_H_SEEN -#define NUT_UPSSCHED_H_SEEN 1 - #include #define SERIALIZE_INIT 1 @@ -28,4 +25,3 @@ typedef struct conn_s { /* *INDENT-ON* */ #endif -#endif /* NUT_UPSSCHED_H_SEEN */ diff --git a/clients/upsset.c b/clients/upsset.c index 788b201..8f18b7c 100644 --- a/clients/upsset.c +++ b/clients/upsset.c @@ -24,7 +24,6 @@ #include #include -#include "nut_stdint.h" #include "upsclient.h" #include "cgilib.h" #include "parseconf.h" @@ -40,12 +39,12 @@ struct list_t { #define HARD_UPSVAR_LIMIT_NUM 64 #define HARD_UPSVAR_LIMIT_LEN 256 -static char *monups, *username, *password, *function, *upscommand; + char *monups, *username, *password, *function, *upscommand; -/* set once the MAGIC_ENABLE_STRING is found in the upsset.conf */ -static int magic_string_set = 0; + /* set once the MAGIC_ENABLE_STRING is found in the upsset.conf */ + int magic_string_set = 0; -static uint16_t port; +static int port; static char *upsname, *hostname; static UPSCONN_t ups; @@ -55,7 +54,7 @@ typedef struct { void *next; } uvtype_t; -static uvtype_t *firstuv = NULL; + uvtype_t *firstuv = NULL; void parsearg(char *var, char *value) { @@ -135,7 +134,7 @@ static void do_header(const char *title) printf("\n"); printf("upsset: %s\n", title); - printf("\n"); + printf("\n"); printf("\n"); printf("","
\n"); @@ -145,7 +144,7 @@ static void start_table(void) { printf("\n"); printf("\n"); } @@ -159,12 +158,12 @@ static void do_hidden(const char *next) password); if (next) - printf("\n", + printf("\n", next); } /* generate SELECT chooser from hosts.conf entries */ -static void upslist_arg(size_t numargs, char **arg) +static void upslist_arg(int numargs, char **arg) { if (numargs < 3) return; @@ -223,7 +222,7 @@ static void do_pickups(const char *currfunc) continue; } - upslist_arg(ctx.numargs, ctx.arglist); + upslist_arg(ctx.numargs, ctx.arglist); } pconf_finish(&ctx); @@ -254,10 +253,6 @@ static void do_pickups(const char *currfunc) printf("\n"); } -static void error_page(const char *next, const char *title, - const char *fmt, ...) - __attribute__((noreturn)); - static void error_page(const char *next, const char *title, const char *fmt, ...) { @@ -265,19 +260,7 @@ static void error_page(const char *next, const char *title, va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(msg, sizeof(msg), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); do_header(title); @@ -299,9 +282,6 @@ static void error_page(const char *next, const char *title, exit(EXIT_SUCCESS); } -static void loginscreen(void) - __attribute__((noreturn)); - static void loginscreen(void) { do_header("Login"); @@ -351,7 +331,7 @@ static void upsd_connect(void) static void print_cmd(const char *cmd) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer; const char *query[4]; @@ -374,7 +354,7 @@ static void print_cmd(const char *cmd) static void showcmds(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[2]; char **answer; struct list_t *lhead, *llast, *ltmp, *lnext; @@ -411,7 +391,7 @@ static void showcmds(void) /* CMD upsname cmdname */ if (numa < 3) { fprintf(stderr, "Error: insufficient data " - "(got %zu args, need at least 3)\n", numa); + "(got %d args, need at least 3)\n", numa); return; } @@ -486,7 +466,7 @@ static void showcmds(void) upscli_disconnect(&ups); exit(EXIT_SUCCESS); -} +} /* handle setting authentication data in the server */ static void send_auth(const char *next) @@ -511,7 +491,7 @@ static void send_auth(const char *next) "upsd version too old - USERNAME not supported"); } - error_page(next, "Can't set user name", + error_page(next, "Can't set user name", "Set user name failed: %s", upscli_strerror(&ups)); } @@ -524,10 +504,7 @@ static void send_auth(const char *next) if (upscli_readline(&ups, buf, sizeof(buf)) < 0) error_page(next, "Can't set password", "Password set failed: %s", upscli_strerror(&ups)); -} - -static void docmd(void) - __attribute__((noreturn)); +} static void docmd(void) { @@ -538,13 +515,13 @@ static void docmd(void) "Access to that host is not authorized"); /* the user is messing with us */ - if (!upscommand) - error_page("showcmds", "Form error", + if (!upscommand) + error_page("showcmds", "Form error", "No instant command selected"); /* (l)user took the default blank option */ if (strlen(upscommand) == 0) - error_page("showcmds", "Form error", + error_page("showcmds", "Form error", "No instant command selected"); upsd_connect(); @@ -618,7 +595,7 @@ static void docmd(void) static const char *get_data(const char *type, const char *varname) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer; const char *query[4]; @@ -656,7 +633,7 @@ static void do_string(const char *varname, int maxlen) static void do_enum(const char *varname) { int ret; - size_t numq, numa; + unsigned int numq, numa; char **answer, *val; const char *query[4], *tmp; @@ -682,9 +659,8 @@ static void do_enum(const char *varname) if (ret < 0) { printf("Unavailable\n"); - fprintf(stderr, "Error doing ENUM %s %s: %s\n", + fprintf(stderr, "Error doing ENUM %s %s: %s\n", upsname, varname, upscli_strerror(&ups)); - free(val); return; } @@ -698,7 +674,7 @@ static void do_enum(const char *varname) if (numa < 4) { fprintf(stderr, "Error: insufficient data " - "(got %zu args, need at least 4)\n", numa); + "(got %d args, need at least 4)\n", numa); free(val); return; @@ -721,7 +697,7 @@ static void do_enum(const char *varname) static void do_type(const char *varname) { int ret; - size_t i, numq, numa; + unsigned int i, numq, numa; char **answer; const char *query[4]; @@ -733,7 +709,7 @@ static void do_type(const char *varname) ret = upscli_get(&ups, numq, query, &numa, &answer); if ((ret < 0) || (numa < numq)) { - printf("Unknown type\n"); + printf("Unknown type\n"); return; } @@ -751,9 +727,7 @@ static void do_type(const char *varname) /* split out the : data */ ptr = strchr(answer[i], ':'); *ptr++ = '\0'; - long l = strtol(ptr, (char **) NULL, 10); - assert(l <= 127); /* FIXME: Loophole about longer numbers? Why are we limited to char at all here? */ - len = (char)l; + len = strtol(ptr, (char **) NULL, 10); do_string(varname, len); return; @@ -767,12 +741,10 @@ static void do_type(const char *varname) } } -static void print_rw(const char *arg_upsname, const char *varname) +static void print_rw(const char *upsname, const char *varname) { const char *tmp; - printf("\n", arg_upsname); - printf("\n"); printf("\n"); } -static void showsettings(void) - __attribute__((noreturn)); - static void showsettings(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[2]; char **answer, *desc = NULL; struct list_t *lhead, *llast, *ltmp, *lnext; @@ -938,16 +907,13 @@ static int setvar(const char *var, const char *val) } /* turn a form submission of settings into SET commands for upsd */ -static void savesettings(void) - __attribute__((noreturn)); - static void savesettings(void) { int changed = 0; char *desc; uvtype_t *upsvar; - if (!checkhost(monups, &desc)) + if (!checkhost(monups, &desc)) error_page("showsettings", "Access denied", "Access to that host is not authorized"); @@ -987,9 +953,6 @@ static void savesettings(void) exit(EXIT_SUCCESS); } -static void initial_pickups(void) - __attribute__((noreturn)); - static void initial_pickups(void) { do_header("Select a UPS"); @@ -1064,12 +1027,10 @@ static void check_conf(void) fprintf(stderr, "upsset.conf does not permit execution\n"); exit(EXIT_FAILURE); -} +} int main(int argc, char **argv) { - NUT_UNUSED_VARIABLE(argc); - NUT_UNUSED_VARIABLE(argv); username = password = function = monups = NULL; printf("Content-type: text/html\n\n"); @@ -1079,16 +1040,15 @@ int main(int argc, char **argv) /* see if there's anything waiting .. the server my not close STDIN properly */ if (1) { - fd_set fds; - struct timeval tv; + fd_set fds; + struct timeval tv; - FD_ZERO(&fds); - FD_SET(STDIN_FILENO, &fds); - tv.tv_sec = 0; - tv.tv_usec = 250000; /* wait for up to 250ms for a POST response */ - - if ((select(STDIN_FILENO+1, &fds, 0, 0, &tv)) > 0) - extractpostargs(); + FD_ZERO(&fds); + FD_SET(STDIN_FILENO, &fds); + tv.tv_sec = 0; + tv.tv_usec = 250000; /* wait for up to 250ms for a POST response */ + if ((select(STDIN_FILENO+1, &fds, 0, 0, &tv)) > 0) + extractpostargs(); } if ((!username) || (!password) || (!function)) loginscreen(); @@ -1114,6 +1074,6 @@ int main(int argc, char **argv) docmd(); printf("Error: Unhandled function name [%s]\n", function); - + return 0; } diff --git a/clients/upsstats.c b/clients/upsstats.c index 4b7f754..07ab6ea 100644 --- a/clients/upsstats.c +++ b/clients/upsstats.c @@ -19,12 +19,11 @@ */ #include "common.h" -#include "nut_stdint.h" -#include "timehead.h" #include "upsclient.h" #include "status.h" #include "cgilib.h" #include "parseconf.h" +#include "timehead.h" #include "upsstats.h" #include "upsimagearg.h" @@ -37,7 +36,7 @@ static int use_celsius = 1, refreshdelay = -1, treemode = 0; /* from cgilib's checkhost() */ static char *monhostdesc = NULL; -static uint16_t port; +static int port; static char *upsname, *hostname; static char *upsimgpath="upsimage.cgi", *upsstatpath="upsstats.cgi"; static UPSCONN_t ups; @@ -104,7 +103,7 @@ static int check_ups_fd(int do_report) static int get_var(const char *var, char *buf, size_t buflen, int verbose) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -135,7 +134,7 @@ static int get_var(const char *var, char *buf, size_t buflen, int verbose) if (numa < numq) { if (verbose) printf("[Invalid response]\n"); - + return 0; } @@ -196,10 +195,9 @@ static int do_date(const char *buf) { char datebuf[SMALLBUF]; time_t tod; - struct tm tmbuf; time(&tod); - if (strftime(datebuf, sizeof(datebuf), buf, localtime_r(&tod, &tmbuf))) { + if (strftime(datebuf, sizeof(datebuf), buf, localtime(&tod))) { printf("%s", datebuf); return 1; } @@ -293,12 +291,12 @@ static int do_img(char *buf) /* only allow known types through */ - if (!strcmp(type, "input.voltage") - || !strcmp(type, "input.L1-N.voltage") - || !strcmp(type, "input.L2-N.voltage") + if (!strcmp(type, "input.voltage") + || !strcmp(type, "input.L1-N.voltage") + || !strcmp(type, "input.L2-N.voltage") || !strcmp(type, "input.L3-N.voltage") - || !strcmp(type, "input.L1-L2.voltage") - || !strcmp(type, "input.L2-L3.voltage") + || !strcmp(type, "input.L1-L2.voltage") + || !strcmp(type, "input.L2-L3.voltage") || !strcmp(type, "input.L3-L1.voltage")) { return get_img_val(type, "Input voltage", imgargs); } @@ -310,11 +308,11 @@ static int do_img(char *buf) return get_img_val(type, "Battery charge", imgargs); if (!strcmp(type, "output.voltage") - || !strcmp(type, "output.L1-N.voltage") - || !strcmp(type, "output.L2-N.voltage") + || !strcmp(type, "output.L1-N.voltage") + || !strcmp(type, "output.L2-N.voltage") || !strcmp(type, "output.L3-N.voltage") - || !strcmp(type, "output.L1-L2.voltage") - || !strcmp(type, "output.L2-L3.voltage") + || !strcmp(type, "output.L1-L2.voltage") + || !strcmp(type, "output.L2-L3.voltage") || !strcmp(type, "output.L3-L1.voltage")) { return get_img_val(type, "Output voltage", imgargs); } @@ -351,7 +349,7 @@ static void ups_connect(void) { static ulist_t *lastups = NULL; char *newups, *newhost; - uint16_t newport; + int newport; /* try to minimize reconnects */ if (lastups) { @@ -365,13 +363,13 @@ static void ups_connect(void) /* see if it's just on the same host */ newups = newhost = NULL; - if (upscli_splitname(currups->sys, &newups, &newhost, + if (upscli_splitname(currups->sys, &newups, &newhost, &newport) != 0) { printf("Unusable UPS definition [%s]\n", currups->sys); - fprintf(stderr, "Unusable UPS definition [%s]\n", + fprintf(stderr, "Unusable UPS definition [%s]\n", currups->sys); exit(EXIT_FAILURE); - } + } if ((!strcmp(newhost, hostname)) && (port == newport)) { free(upsname); @@ -566,7 +564,7 @@ static void do_upsimgpath(const char *s) { static void do_temp(const char *var) { char tempc[SMALLBUF]; - double tempf; + float tempf; if (!get_var(var, tempc, sizeof(tempc), 1)) return; @@ -809,8 +807,7 @@ static int do_command(char *cmd) static void parse_line(const char *buf) { char cmd[SMALLBUF]; - size_t i, len; - char do_cmd = 0; + int i, len, do_cmd = 0; for (i = 0; buf[i]; i += len) { @@ -827,10 +824,9 @@ static void parse_line(const char *buf) i++; /* skip over the '@' character */ continue; } - assert (len < INT_MAX); if (do_cmd) { - snprintf(cmd, sizeof(cmd), "%.*s", (int)len, &buf[i]); + snprintf(cmd, sizeof(cmd), "%.*s", len, &buf[i]); continue; } @@ -840,13 +836,13 @@ static void parse_line(const char *buf) } /* pass it trough */ - printf("%.*s", (int)len, &buf[i]); + printf("%.*s", len, &buf[i]); } } static void display_template(const char *tfn) { - char fn[SMALLBUF], buf[LARGEBUF]; + char fn[SMALLBUF], buf[LARGEBUF]; snprintf(fn, sizeof(fn), "%s/%s", confpath(), tfn); @@ -869,7 +865,7 @@ static void display_template(const char *tfn) static void display_tree(int verbose) { - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -894,7 +890,7 @@ static void display_tree(int verbose) printf("\n"); printf("upsstat: data tree of %s\n", currups->desc); - printf("\n"); + printf("\n"); printf("
\n"); - printf("Network UPS Tools upsset %s\n", + printf("Network UPS Tools upsset %s\n", UPS_VERSION); printf("
"); @@ -793,13 +765,10 @@ static void print_rw(const char *arg_upsname, const char *varname) printf("
\n"); printf("\n"); - + printf("\n", answer[2]); printf("\n"); printf("\n", answer[3]); @@ -940,7 +936,7 @@ static void add_ups(char *sys, char *desc) tmp = last = ulhead; - while (tmp) { + while (tmp) { last = tmp; tmp = tmp->next; } @@ -1045,12 +1041,9 @@ static void display_single(void) int main(int argc, char **argv) { - NUT_UNUSED_VARIABLE(argc); - NUT_UNUSED_VARIABLE(argv); - extractcgiargs(); - printf("Content-type: text/html\n"); + printf("Content-type: text/html\n"); printf("Pragma: no-cache\n"); printf("\n"); diff --git a/clients/upsstats.h b/clients/upsstats.h index 92ed932..84ca8ad 100644 --- a/clients/upsstats.h +++ b/clients/upsstats.h @@ -17,9 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_UPSSTATS_H_SEEN -#define NUT_UPSSTATS_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -38,4 +35,3 @@ typedef struct { /* *INDENT-ON* */ #endif -#endif /* NUT_UPSSTATS_H_SEEN */ diff --git a/common/Makefile.am b/common/Makefile.am index 5ce88ab..6dda04a 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -2,48 +2,14 @@ AM_CFLAGS = -I$(top_srcdir)/include -noinst_LTLIBRARIES = libparseconf.la libcommon.la libcommonclient.la +noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c # do not hard depend on '../include/nut_version.h', since it blocks # 'dist', and is only required for actual build, in which case # BUILT_SOURCES (in ../include) will ensure nut_version.h will -# be built before anything else... but do depend on its build area: -if BUILDING_IN_TREE -# No need for symlink hack -common.c: $(top_builddir)/include/nut_version.h -else -# Surprisingly, for some "make" implementations this dependency means -# that the "common.c" required for builds below will be seeked in the -# current directory. So for out-of-tree builds like distcheck, we have -# to symlink the "real" source to build area: -common.c: $(top_builddir)/include/nut_version.h $(srcdir)/common.c - test -s "$@" || ln -s -f "$(top_srcdir)/common/common.c" "$@" -endif - -$(top_builddir)/include/nut_version.h: - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -libcommon_la_SOURCES = state.c str.c upsconf.c -libcommonclient_la_SOURCES = state.c str.c -if BUILDING_IN_TREE -libcommon_la_SOURCES += common.c -libcommonclient_la_SOURCES += common.c -else -nodist_libcommon_la_SOURCES = common.c -nodist_libcommonclient_la_SOURCES = common.c -CLEANFILES = $(top_builddir)/common/common.c -BUILT_SOURCES = common.c -endif - +# be built before anything else +libcommon_la_SOURCES = common.c state.c upsconf.c # ensure inclusion of local implementation of missing systems functions -# using LTLIBOBJS. Refer to configure.in/.ac -> AC_REPLACE_FUNCS +# using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ -libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps diff --git a/common/Makefile.in b/common/Makefile.in index a6eb968..5095cb2 100644 --- a/common/Makefile.in +++ b/common/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,61 +18,23 @@ # Network UPS Tools: common VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,27 +54,21 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@BUILDING_IN_TREE_TRUE@am__append_1 = common.c -@BUILDING_IN_TREE_TRUE@am__append_2 = common.c subdir = common +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in atexit.c \ + setenv.c snprintf.c strerror.c ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -120,123 +77,52 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libcommon_la_DEPENDENCIES = libparseconf.la @LTLIBOBJS@ -am__libcommon_la_SOURCES_DIST = state.c str.c upsconf.c common.c -@BUILDING_IN_TREE_TRUE@am__objects_1 = common.lo -am_libcommon_la_OBJECTS = state.lo str.lo upsconf.lo $(am__objects_1) -@BUILDING_IN_TREE_FALSE@nodist_libcommon_la_OBJECTS = common.lo -libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) \ - $(nodist_libcommon_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libcommonclient_la_DEPENDENCIES = libparseconf.la @LTLIBOBJS@ -am__libcommonclient_la_SOURCES_DIST = state.c str.c common.c -am_libcommonclient_la_OBJECTS = state.lo str.lo $(am__objects_1) -@BUILDING_IN_TREE_FALSE@nodist_libcommonclient_la_OBJECTS = common.lo -libcommonclient_la_OBJECTS = $(am_libcommonclient_la_OBJECTS) \ - $(nodist_libcommonclient_la_OBJECTS) +am_libcommon_la_OBJECTS = common.lo state.lo upsconf.lo +libcommon_la_OBJECTS = $(am_libcommon_la_OBJECTS) libparseconf_la_LIBADD = am_libparseconf_la_OBJECTS = parseconf.lo libparseconf_la_OBJECTS = $(am_libparseconf_la_OBJECTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = $(DEPDIR)/atexit.Plo $(DEPDIR)/setenv.Plo \ - $(DEPDIR)/snprintf.Plo $(DEPDIR)/strerror.Plo \ - ./$(DEPDIR)/common.Plo ./$(DEPDIR)/parseconf.Plo \ - ./$(DEPDIR)/state.Plo ./$(DEPDIR)/str.Plo \ - ./$(DEPDIR)/upsconf.Plo +am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libcommon_la_SOURCES) $(nodist_libcommon_la_SOURCES) \ - $(libcommonclient_la_SOURCES) \ - $(nodist_libcommonclient_la_SOURCES) \ - $(libparseconf_la_SOURCES) -DIST_SOURCES = $(am__libcommon_la_SOURCES_DIST) \ - $(am__libcommonclient_la_SOURCES_DIST) \ - $(libparseconf_la_SOURCES) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libcommon_la_SOURCES) $(libparseconf_la_SOURCES) +DIST_SOURCES = $(libcommon_la_SOURCES) $(libparseconf_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp atexit.c \ - setenv.c snprintf.c strerror.c DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -247,7 +133,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -261,7 +146,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -274,8 +158,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -285,15 +172,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -304,29 +190,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -346,9 +224,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -357,16 +232,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -380,7 +251,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -391,12 +261,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -415,21 +281,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -440,22 +303,18 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ AM_CFLAGS = -I$(top_srcdir)/include -noinst_LTLIBRARIES = libparseconf.la libcommon.la libcommonclient.la +noinst_LTLIBRARIES = libparseconf.la libcommon.la libparseconf_la_SOURCES = parseconf.c -libcommon_la_SOURCES = state.c str.c upsconf.c $(am__append_1) -libcommonclient_la_SOURCES = state.c str.c $(am__append_2) -@BUILDING_IN_TREE_FALSE@nodist_libcommon_la_SOURCES = common.c -@BUILDING_IN_TREE_FALSE@nodist_libcommonclient_la_SOURCES = common.c -@BUILDING_IN_TREE_FALSE@CLEANFILES = $(top_builddir)/common/common.c -@BUILDING_IN_TREE_FALSE@BUILT_SOURCES = common.c +# do not hard depend on '../include/nut_version.h', since it blocks +# 'dist', and is only required for actual build, in which case +# BUILT_SOURCES (in ../include) will ensure nut_version.h will +# be built before anything else +libcommon_la_SOURCES = common.c state.c upsconf.c # ensure inclusion of local implementation of missing systems functions -# using LTLIBOBJS. Refer to configure.in/.ac -> AC_REPLACE_FUNCS +# using LTLIBOBJS. Refer to configure.in -> AC_REPLACE_FUNCS libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ -libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ -MAINTAINERCLEANFILES = Makefile.in .dirstamp -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am +all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj @@ -471,13 +330,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu common/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu common/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -491,23 +351,16 @@ $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libcommon.la: $(libcommon_la_OBJECTS) $(libcommon_la_DEPENDENCIES) $(EXTRA_libcommon_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) - -libcommonclient.la: $(libcommonclient_la_OBJECTS) $(libcommonclient_la_DEPENDENCIES) $(EXTRA_libcommonclient_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libcommonclient_la_OBJECTS) $(libcommonclient_la_LIBADD) $(LIBS) - + $(LINK) $(libcommon_la_OBJECTS) $(libcommon_la_LIBADD) $(LIBS) libparseconf.la: $(libparseconf_la_OBJECTS) $(libparseconf_la_DEPENDENCIES) $(EXTRA_libparseconf_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libparseconf_la_OBJECTS) $(libparseconf_la_LIBADD) $(LIBS) + $(LINK) $(libparseconf_la_OBJECTS) $(libparseconf_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -515,45 +368,35 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/atexit.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/setenv.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/snprintf.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strerror.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parseconf.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsconf.Plo@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/atexit.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/setenv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/snprintf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/strerror.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parseconf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsconf.Plo@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -561,15 +404,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -581,11 +435,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -594,29 +452,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -647,14 +487,11 @@ distdir-am: $(DISTFILES) fi; \ done check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am +check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-exec-am +install: install-am +install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -675,7 +512,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -684,23 +520,13 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am - -rm -f $(DEPDIR)/atexit.Plo - -rm -f $(DEPDIR)/setenv.Plo - -rm -f $(DEPDIR)/snprintf.Plo - -rm -f $(DEPDIR)/strerror.Plo - -rm -f ./$(DEPDIR)/common.Plo - -rm -f ./$(DEPDIR)/parseconf.Plo - -rm -f ./$(DEPDIR)/state.Plo - -rm -f ./$(DEPDIR)/str.Plo - -rm -f ./$(DEPDIR)/upsconf.Plo + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -746,15 +572,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f $(DEPDIR)/atexit.Plo - -rm -f $(DEPDIR)/setenv.Plo - -rm -f $(DEPDIR)/snprintf.Plo - -rm -f $(DEPDIR)/strerror.Plo - -rm -f ./$(DEPDIR)/common.Plo - -rm -f ./$(DEPDIR)/parseconf.Plo - -rm -f ./$(DEPDIR)/state.Plo - -rm -f ./$(DEPDIR)/str.Plo - -rm -f ./$(DEPDIR)/upsconf.Plo + -rm -rf $(DEPDIR) ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -773,45 +591,21 @@ ps-am: uninstall-am: -.MAKE: all check install install-am install-exec install-strip +.MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am -.PRECIOUS: Makefile - - -# do not hard depend on '../include/nut_version.h', since it blocks -# 'dist', and is only required for actual build, in which case -# BUILT_SOURCES (in ../include) will ensure nut_version.h will -# be built before anything else... but do depend on its build area: -# No need for symlink hack -@BUILDING_IN_TREE_TRUE@common.c: $(top_builddir)/include/nut_version.h -# Surprisingly, for some "make" implementations this dependency means -# that the "common.c" required for builds below will be seeked in the -# current directory. So for out-of-tree builds like distcheck, we have -# to symlink the "real" source to build area: -@BUILDING_IN_TREE_FALSE@common.c: $(top_builddir)/include/nut_version.h $(srcdir)/common.c -@BUILDING_IN_TREE_FALSE@ test -s "$@" || ln -s -f "$(top_srcdir)/common/common.c" "$@" - -$(top_builddir)/include/nut_version.h: - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/common/common.c b/common/common.c index f664d99..ce3c573 100644 --- a/common/common.c +++ b/common/common.c @@ -1,7 +1,6 @@ /* common.c - common useful functions Copyright (C) 2000 Russell Kroll - Copyright (C) 2021-2022 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,11 +21,8 @@ #include #include -#include #include #include -#include -#include /* the reason we define UPS_VERSION as a static string, rather than a macro, is to make dependency tracking easier (only common.o depends @@ -36,52 +32,6 @@ #include "nut_version.h" const char *UPS_VERSION = NUT_VERSION_MACRO; -#include - -/* Know which bitness we were built for, - * to adjust the search paths for get_libname() */ -#include "nut_stdint.h" -#if UINTPTR_MAX == 0xffffffffffffffffULL -# define BUILD_64 1 -#else -# ifdef BUILD_64 -# undef BUILD_64 -# endif -#endif - -/* https://stackoverflow.com/a/12844426/4715872 */ -#include -#include -#include -pid_t get_max_pid_t() -{ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - if (sizeof(pid_t) == sizeof(short)) return (pid_t)SHRT_MAX; - if (sizeof(pid_t) == sizeof(int)) return (pid_t)INT_MAX; - if (sizeof(pid_t) == sizeof(long)) return (pid_t)LONG_MAX; -#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || (defined _STDC_C99) || (defined __C99FEATURES__) /* C99+ build mode */ -# if defined(LLONG_MAX) /* since C99 */ - if (sizeof(pid_t) == sizeof(long long)) return (pid_t)LLONG_MAX; -# endif -#endif - abort(); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif -} - int nut_debug_level = 0; int nut_log_level = 0; static int upslog_flags = UPSLOG_STDERR; @@ -101,7 +51,7 @@ static int xbit_test(int val, int flag) return ((val & flag) == flag); } -/* enable writing upslog_with_errno() and upslogx() type messages to +/* enable writing upslog_with_errno() and upslogx() type messages to the syslog */ void syslogbit_set(void) { @@ -176,7 +126,7 @@ void background(void) close(1); close(2); - if (pid != 0) + if (pid != 0) _exit(EXIT_SUCCESS); /* parent */ /* child */ @@ -213,32 +163,8 @@ struct passwd *get_user_pwent(const char *name) fatalx(EXIT_FAILURE, "user %s not found", name); else fatal_with_errno(EXIT_FAILURE, "getpwnam(%s)", name); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN) ) -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -# ifdef HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN -# pragma clang diagnostic ignored "-Wunreachable-code-return" -# endif -#endif - /* Oh joy, adding unreachable "return" to make one compiler happy, - * and pragmas around to make other compilers happy, all at once! */ - return NULL; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN) ) -#pragma GCC diagnostic pop -#endif + + return NULL; /* to make the compiler happy */ } /* change to the user defined in the struct */ @@ -282,7 +208,7 @@ void writepid(const char *name) { char fn[SMALLBUF]; FILE *pidf; - mode_t mask; + int mask; /* use full path if present, else build filename in PIDPATH */ if (*name == '/') @@ -294,9 +220,7 @@ void writepid(const char *name) pidf = fopen(fn, "w"); if (pidf) { - intmax_t pid = (intmax_t)getpid(); - upsdebugx(1, "Saving PID %jd into %s", pid, fn); - fprintf(pidf, "%jd\n", pid); + fprintf(pidf, "%d\n", (int) getpid()); fclose(pidf); } else { upslog_with_errno(LOG_NOTICE, "writepid: fopen %s", fn); @@ -305,17 +229,30 @@ void writepid(const char *name) umask(mask); } -/* send sig to pid, returns -1 for error, or - * zero for a successfully sent signal - */ -int sendsignalpid(pid_t pid, int sig) +/* open pidfn, get the pid, then send it sig */ +int sendsignalfn(const char *pidfn, int sig) { - int ret; + char buf[SMALLBUF]; + FILE *pidf; + int pid, ret; - if (pid < 2 || pid > get_max_pid_t()) { - upslogx(LOG_NOTICE, - "Ignoring invalid pid number %" PRIdMAX, - (intmax_t) pid); + pidf = fopen(pidfn, "r"); + if (!pidf) { + upslog_with_errno(LOG_NOTICE, "fopen %s", pidfn); + return -1; + } + + if (fgets(buf, sizeof(buf), pidf) == NULL) { + upslogx(LOG_NOTICE, "Failed to read pid from %s", pidfn); + fclose(pidf); + return -1; + } + + pid = strtol(buf, (char **)NULL, 10); + + if (pid < 2) { + upslogx(LOG_NOTICE, "Ignoring invalid pid number %d", pid); + fclose(pidf); return -1; } @@ -324,78 +261,21 @@ int sendsignalpid(pid_t pid, int sig) if (ret < 0) { perror("kill"); + fclose(pidf); return -1; } - if (sig != 0) { - /* now actually send it */ - ret = kill(pid, sig); + /* now actually send it */ + ret = kill(pid, sig); - if (ret < 0) { - perror("kill"); - return -1; - } - } - - return 0; -} - -/* parses string buffer into a pid_t if it passes - * a few sanity checks; returns -1 on error - */ -pid_t parsepid(const char *buf) -{ - pid_t pid = -1; - - /* assuming 10 digits for a long */ - intmax_t _pid = strtol(buf, (char **)NULL, 10); - if (_pid <= get_max_pid_t()) { - pid = (pid_t)_pid; - } else { - upslogx(LOG_NOTICE, "Received a pid number too big for a pid_t: %" PRIdMAX, _pid); - } - - return pid; -} - -/* open pidfn, get the pid, then send it sig - * returns negative codes for errors, or - * zero for a successfully sent signal - */ -int sendsignalfn(const char *pidfn, int sig) -{ - char buf[SMALLBUF]; - FILE *pidf; - pid_t pid = -1; - int ret = -1; - - pidf = fopen(pidfn, "r"); - if (!pidf) { - upslog_with_errno(LOG_NOTICE, "fopen %s", pidfn); - return -3; - } - - if (fgets(buf, sizeof(buf), pidf) == NULL) { - upslogx(LOG_NOTICE, "Failed to read pid from %s", pidfn); + if (ret < 0) { + perror("kill"); fclose(pidf); - return -2; - } - /* TOTHINK: Original code only closed pidf before - * exiting the method, on error or "normally". - * Why not here? Do we want an (exclusive?) hold - * on it while being active in the method? - */ - - /* this method actively reports errors, if any */ - pid = parsepid(buf); - - if (pid >= 0) { - /* this method actively reports errors, if any */ - ret = sendsignalpid(pid, sig); + return -1; } fclose(pidf); - return ret; + return 0; } int snprintfcat(char *dst, size_t size, const char *fmt, ...) @@ -405,46 +285,14 @@ int snprintfcat(char *dst, size_t size, const char *fmt, ...) int ret; size--; - if (len > size) { - /* Do not truncate existing string */ - errno = ERANGE; - return -1; - } + assert(len <= size); va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - /* Note: this code intentionally uses a caller-provided format string */ ret = vsnprintf(dst + len, size - len, fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); dst[size] = '\0'; - - /* Note: there is a standards loophole here: strlen() must return size_t - * and printf() family returns a signed int with negatives for errors. - * In theory it can overflow a 64-vs-32 bit range, or signed-vs-unsigned. - * In practice we hope to not have gigabytes-long config strings. - */ - if (ret < 0) { - return ret; - } -#ifdef INT_MAX - if ( ( (unsigned long long)len + (unsigned long long)ret ) >= (unsigned long long)INT_MAX ) { - errno = ERANGE; - return -1; - } -#endif - return (int)len + ret; + return len + ret; } /* lazy way to send a signal if the program uses the PIDPATH */ @@ -471,27 +319,7 @@ static void vupslog(int priority, const char *fmt, va_list va, int use_strerror) int ret; char buf[LARGEBUF]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" -#pragma clang diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(buf, sizeof(buf), fmt, va); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif if ((ret < 0) || (ret >= (int) sizeof(buf))) syslog(LOG_WARNING, "vupslog: vsnprintf needed more than %d bytes", @@ -501,20 +329,20 @@ static void vupslog(int priority, const char *fmt, va_list va, int use_strerror) snprintfcat(buf, sizeof(buf), ": %s", strerror(errno)); if (nut_debug_level > 0) { - static struct timeval start = { 0, 0 }; + static struct timeval start = { 0 }; struct timeval now; - + gettimeofday(&now, NULL); - + if (start.tv_sec == 0) { start = now; } - + if (start.tv_usec > now.tv_usec) { now.tv_usec += 1000000; now.tv_sec -= 1; } - + fprintf(stderr, "%4.0f.%06ld\t", difftime(now.tv_sec, start.tv_sec), (long)(now.tv_usec - start.tv_usec)); } @@ -525,7 +353,7 @@ static void vupslog(int priority, const char *fmt, va_list va, int use_strerror) } /* Return the default path for the directory containing configuration files */ -const char * confpath(void) +const char * confpath(void) { const char * path; @@ -536,82 +364,33 @@ const char * confpath(void) } /* Return the default path for the directory containing state files */ -const char * dflt_statepath(void) +const char * dflt_statepath(void) { const char * path; - path = getenv("NUT_STATEPATH"); - if ( (path == NULL) || (*path == '\0') ) + if ((path = getenv("NUT_STATEPATH")) == NULL) path = STATEPATH; return path; } -/* Return the alternate path for pid files, for processes running as non-root - * Per documentation and configure script, the fallback value is the - * state-file path as the daemon and drivers can write there too. - * Note that this differs from PIDPATH that higher-privileged daemons, such - * as upsmon, tend to use. - */ -const char * altpidpath(void) +/* Return the alternate path for pid files */ +const char * altpidpath(void) { - const char * path; - - path = getenv("NUT_ALTPIDPATH"); - if ( (path == NULL) || (*path == '\0') ) - path = getenv("NUT_STATEPATH"); - - if ( (path != NULL) && (*path != '\0') ) - return path; - #ifdef ALTPIDPATH return ALTPIDPATH; #else -/* We assume, here and elsewhere, that at least STATEPATH is always defined */ - return STATEPATH; + return dflt_statepath(); #endif } -/* Die with a standard message if socket filename is too long */ -void check_unix_socket_filename(const char *fn) { - struct sockaddr_un ssaddr; - if (strlen(fn) < sizeof(ssaddr.sun_path)) - return; - - /* Avoid useless truncated pathnames that - * other driver instances would conflict - * with, and upsd can not discover. - * Note this is quite short on many OSes - * varying 104-108 bytes (UNIX_PATH_MAX) - * as opposed to PATH_MAX or MAXPATHLEN - * typically of a kilobyte range. - */ - fatalx(EXIT_FAILURE, - "Can't create a unix domain socket: pathname '%s' " - "is too long (%zu) for 'struct sockaddr_un->sun_path' " - "on this system (%zu)", - fn, strlen(fn), sizeof(ssaddr.sun_path)); -} - /* logs the formatted string to any configured logging devices + the output of strerror(errno) */ void upslog_with_errno(int priority, const char *fmt, ...) { va_list va; va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vupslog(priority, fmt, va, 1); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); } @@ -621,115 +400,44 @@ void upslogx(int priority, const char *fmt, ...) va_list va; va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vupslog(priority, fmt, va, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); } -void s_upsdebug_with_errno(int level, const char *fmt, ...) +void upsdebug_with_errno(int level, const char *fmt, ...) { va_list va; - char fmt2[LARGEBUF]; - - /* Note: Thanks to macro wrapping, we do not quite need this - * test now, but we still need the "level" value to report - * below - when it is not zero. - */ + if (nut_debug_level < level) return; -/* For debugging output, we want to prepend the debug level so the user can - * e.g. lower the level (less -D's on command line) to retain just the amount - * of logging info he needs to see at the moment. Using '-DDDDD' all the time - * is too brutal and needed high-level overview can be lost. This [D#] prefix - * can help limit this debug stream quicker, than experimentally picking ;) */ - if (level > 0) { - int ret; - ret = snprintf(fmt2, sizeof(fmt2), "[D%d] %s", level, fmt); - if ((ret < 0) || (ret >= (int) sizeof(fmt2))) { - syslog(LOG_WARNING, "upsdebug_with_errno: snprintf needed more than %d bytes", - LARGEBUF); - } else { - fmt = (const char *)fmt2; - } - } - va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vupslog(LOG_DEBUG, fmt, va, 1); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); } -void s_upsdebugx(int level, const char *fmt, ...) +void upsdebugx(int level, const char *fmt, ...) { va_list va; - char fmt2[LARGEBUF]; - + if (nut_debug_level < level) return; -/* See comments above in upsdebug_with_errno() - they apply here too. */ - if (level > 0) { - int ret; - ret = snprintf(fmt2, sizeof(fmt2), "[D%d] %s", level, fmt); - if ((ret < 0) || (ret >= (int) sizeof(fmt2))) { - syslog(LOG_WARNING, "upsdebugx: snprintf needed more than %d bytes", - LARGEBUF); - } else { - fmt = (const char *)fmt2; - } - } - va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vupslog(LOG_DEBUG, fmt, va, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); } /* dump message msg and len bytes from buf to upsdebugx(level) in hexadecimal. (This function replaces Philippe Marzouk's original dump_hex() function) */ -void s_upsdebug_hex(int level, const char *msg, const void *buf, size_t len) +void upsdebug_hex(int level, const char *msg, const void *buf, int len) { char line[100]; int n; /* number of characters currently in line */ - size_t i; /* number of bytes output from buffer */ + int i; /* number of bytes output from buffer */ - n = snprintf(line, sizeof(line), "%s: (%zu bytes) =>", msg, len); - if (n < 0) goto failed; + n = snprintf(line, sizeof(line), "%s: (%d bytes) =>", msg, len); for (i = 0; i < len; i++) { @@ -739,16 +447,9 @@ void s_upsdebug_hex(int level, const char *msg, const void *buf, size_t len) } n = snprintfcat(line, sizeof(line), n ? " %02x" : "%02x", - ((const unsigned char *)buf)[i]); - - if (n < 0) goto failed; + ((unsigned char *)buf)[i]); } - - s_upsdebugx(level, "%s", line); - return; - -failed: - s_upsdebugx(level, "%s", "Failed to print a hex dump for debug"); + upsdebugx(level, "%s", line); } /* taken from www.asciitable.com */ @@ -788,37 +489,29 @@ static const char* ascii_symb[] = { }; /* dump message msg and len bytes from buf to upsdebugx(level) in ascii. */ -void s_upsdebug_ascii(int level, const char *msg, const void *buf, size_t len) +void upsdebug_ascii(int level, const char *msg, const void *buf, int len) { char line[256]; - int n; /* number of characters currently in line */ - size_t i; /* number of bytes output from buffer */ + int i; unsigned char ch; if (nut_debug_level < level) return; /* save cpu cycles */ - n = snprintf(line, sizeof(line), "%s", msg); - if (n < 0) goto failed; + snprintf(line, sizeof(line), "%s", msg); for (i=0; i= 0x80) - n = snprintfcat(line, sizeof(line), "%02Xh ", ch); + snprintfcat(line, sizeof(line), "%02Xh ", ch); else - n = snprintfcat(line, sizeof(line), "'%c' ", ch); - - if (n < 0) goto failed; + snprintfcat(line, sizeof(line), "'%c' ", ch); } - s_upsdebugx(level, "%s", line); - return; - -failed: - s_upsdebugx(level, "%s", "Failed to print an ASCII data dump for debug"); + upsdebugx(level, "%s", line); } static void vfatal(const char *fmt, va_list va, int use_strerror) @@ -828,19 +521,7 @@ static void vfatal(const char *fmt, va_list va, int use_strerror) if (xbit_test(upslog_flags, UPSLOG_SYSLOG_ON_FATAL)) xbit_set(&upslog_flags, UPSLOG_SYSLOG); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vupslog(LOG_ERR, fmt, va, use_strerror); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } void fatal_with_errno(int status, const char *fmt, ...) @@ -848,19 +529,7 @@ void fatal_with_errno(int status, const char *fmt, ...) va_list va; va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vfatal(fmt, va, (errno > 0) ? 1 : 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); exit(status); @@ -871,19 +540,7 @@ void fatalx(int status, const char *fmt, ...) va_list va; va_start(va, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vfatal(fmt, va, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(va); exit(status); @@ -927,10 +584,40 @@ char *xstrdup(const char *string) return p; } +/* modify in - strip all trailing instances of */ +char *rtrim(char *in, const char sep) +{ + char *p; + + if (in) { + p = &in[strlen(in) - 1]; + + while ((p >= in) && (*p == sep)) + *p-- = '\0'; + } + return in; +} + +/* modify in - strip all leading instances of */ +char* ltrim(char *in, const char sep) +{ + char *p; + + if (in) { + p = in; + + while ((*p != '\0') && (*p == sep)) + *p++ = *in++; + + p = '\0'; + } + return in; +} + /* Read up to buflen bytes from fd and return the number of bytes read. If no data is available within d_sec + d_usec, return 0. On error, a value < 0 is returned (errno indicates error). */ -ssize_t select_read(const int fd, void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec) +int select_read(const int fd, void *buf, const size_t buflen, const long d_sec, const long d_usec) { int ret; fd_set fds; @@ -954,7 +641,7 @@ ssize_t select_read(const int fd, void *buf, const size_t buflen, const time_t d /* Write up to buflen bytes to fd and return the number of bytes written. If no data is available within d_sec + d_usec, return 0. On error, a value < 0 is returned (errno indicates error). */ -ssize_t select_write(const int fd, const void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec) +int select_write(const int fd, const void *buf, const size_t buflen, const long d_sec, const long d_usec) { int ret; fd_set fds; @@ -974,106 +661,3 @@ ssize_t select_write(const int fd, const void *buf, const size_t buflen, const t return write(fd, buf, buflen); } - - -/* FIXME: would be good to get more from /etc/ld.so.conf[.d] and/or - * LD_LIBRARY_PATH and a smarter dependency on build bitness; also - * note that different OSes can have their pathnames set up differently - * with regard to default/preferred bitness (maybe a "32" in the name - * should also be searched explicitly - again, IFF our build is 32-bit). - * - * General premise for this solution is that some parts of NUT (e.g. the - * nut-scanner tool, or DMF feature code) must be pre-built and distributed - * in binary packages, but only at run-time it gets to know which third-party - * libraries it should use for particular operations. This differs from e.g. - * distribution packages which group NUT driver binaries explicitly dynamically - * linked against certain OS-provided libraries for accessing this or that - * communications media and/or vendor protocol. - */ -static const char * search_paths[] = { - /* Use the library path (and bitness) provided during ./configure first */ - LIBDIR, - "/usr"LIBDIR, - "/usr/local"LIBDIR, -#ifdef BUILD_64 - /* Fall back to explicit preference of 64-bit paths as named on some OSes */ - "/usr/lib/64", - "/usr/lib64", -#endif - "/usr/lib", -#ifdef BUILD_64 - "/lib/64", - "/lib64", -#endif - "/lib", -#ifdef BUILD_64 - "/usr/local/lib/64", - "/usr/local/lib64", -#endif - "/usr/local/lib", -#ifdef AUTOTOOLS_TARGET_SHORT_ALIAS - "/usr/lib/" AUTOTOOLS_TARGET_SHORT_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_TARGET_SHORT_ALIAS, -#else -# ifdef AUTOTOOLS_HOST_SHORT_ALIAS - "/usr/lib/" AUTOTOOLS_HOST_SHORT_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_HOST_SHORT_ALIAS, -# else -# ifdef AUTOTOOLS_BUILD_SHORT_ALIAS - "/usr/lib/" AUTOTOOLS_BUILD_SHORT_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_BUILD_SHORT_ALIAS, -# endif -# endif -#endif -#ifdef AUTOTOOLS_TARGET_ALIAS - "/usr/lib/" AUTOTOOLS_TARGET_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_TARGET_ALIAS, -#else -# ifdef AUTOTOOLS_HOST_ALIAS - "/usr/lib/" AUTOTOOLS_HOST_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_HOST_ALIAS, -# else -# ifdef AUTOTOOLS_BUILD_ALIAS - "/usr/lib/" AUTOTOOLS_BUILD_ALIAS, - "/usr/lib/gcc/" AUTOTOOLS_BUILD_ALIAS, -# endif -# endif -#endif - NULL -}; - -char * get_libname(const char* base_libname) -{ - DIR *dp; - struct dirent *dirp; - int index = 0; - char *libname_path = NULL; - char current_test_path[LARGEBUF]; - size_t base_libname_length = strlen(base_libname); - - for(index = 0 ; (search_paths[index] != NULL) && (libname_path == NULL) ; index++) - { - memset(current_test_path, 0, LARGEBUF); - - if ((dp = opendir(search_paths[index])) == NULL) - continue; - - upsdebugx(2,"Looking for lib %s in directory #%d : %s", base_libname, index, search_paths[index]); - while ((dirp = readdir(dp)) != NULL) - { - upsdebugx(5,"Comparing lib %s with dirpath %s", base_libname, dirp->d_name); - int compres = strncmp(dirp->d_name, base_libname, base_libname_length); - if(compres == 0) { - snprintf(current_test_path, LARGEBUF, "%s/%s", search_paths[index], dirp->d_name); - libname_path = realpath(current_test_path, NULL); - upsdebugx(2,"Candidate path for lib %s is %s (realpath %s)", base_libname, current_test_path, (libname_path!=NULL)?libname_path:"NULL"); - if (libname_path != NULL) - break; - } - } - closedir(dp); - } - - upsdebugx(1,"Looking for lib %s, found %s", base_libname, (libname_path!=NULL)?libname_path:"NULL"); - return libname_path; -} diff --git a/common/parseconf.c b/common/parseconf.c index 7c284b7..7073eb1 100644 --- a/common/parseconf.c +++ b/common/parseconf.c @@ -26,7 +26,7 @@ * There is now a context buffer, and you call pconf_init to set it up. * All subsequent calls must have it as the first argument. There are * two entry points for parsing lines. You can have it read a file - * (pconf_file_begin and pconf_file_next), take lines directly from + * (pconf_file_begin and pconf_file_next), take lines directly from * the caller (pconf_line), or go along a character at a time (pconf_char). * The parsing is identical no matter how you feed it. * @@ -38,7 +38,7 @@ * * Fatal errors are those that involve memory allocation. If the user * defines an error handler when calling pconf_init, that function will - * be called with the error message before parseconf exits. By default + * be called with the error message before parseconf exits. By default * it will just write the message to stderr before exiting. * * Input vs. Output: @@ -57,12 +57,12 @@ * also allows you to join lines, allowing you to have logical lines * that span physical lines, just like you can do in some shells. * - * Lines normally end with a newline, but reaching EOF will also force + * Lines normally end with a newline, but reaching EOF will also force * parsing on what's been scanned so far. - * + * * Design: * - * Characters are read one at a time to drive the state machine. + * Characters are read one at a time to drive the state machine. * As words are completed (by hitting whitespace or ending a "" item), * they are committed to the next buffer in the arglist. realloc is * used, so the buffer can grow to handle bigger words. @@ -76,20 +76,15 @@ * */ -#include "common.h" - #include #include #include #include #include -#include +#include #include -#include #include "parseconf.h" -#include "attribute.h" -#include "nut_stdint.h" /* possible states */ @@ -102,9 +97,6 @@ #define STATE_ENDOFLINE 7 #define STATE_PARSEERR 8 -static void pconf_fatal(PCONF_CTX_t *ctx, const char *errtxt) - __attribute__((noreturn)); - static void pconf_fatal(PCONF_CTX_t *ctx, const char *errtxt) { if (ctx->errhandler) @@ -117,7 +109,7 @@ static void pconf_fatal(PCONF_CTX_t *ctx, const char *errtxt) static void add_arg_word(PCONF_CTX_t *ctx) { - size_t argpos; + int argpos; size_t wbuflen; /* this is where the new value goes */ @@ -130,13 +122,13 @@ static void add_arg_word(PCONF_CTX_t *ctx) ctx->maxargs = ctx->numargs; /* resize the lists */ - ctx->arglist = realloc(ctx->arglist, + ctx->arglist = realloc(ctx->arglist, sizeof(char *) * ctx->numargs); if (!ctx->arglist) pconf_fatal(ctx, "realloc arglist failed"); - ctx->argsize = realloc(ctx->argsize, + ctx->argsize = realloc(ctx->argsize, sizeof(size_t) * ctx->numargs); if (!ctx->argsize) @@ -179,7 +171,7 @@ static void addchar(PCONF_CTX_t *ctx) wbuflen = strlen(ctx->wordbuf); - /* CVE-2012-2944: only allow the subset of ASCII charset from Space to ~ */ + /* CVE-2012-2944: only allow the subset Ascii charset from Space to ~ */ if ((ctx->ch < 0x20) || (ctx->ch > 0x7f)) { fprintf(stderr, "addchar: discarding invalid character (0x%02x)!\n", ctx->ch); @@ -207,7 +199,7 @@ static void addchar(PCONF_CTX_t *ctx) ctx->wordptr = &ctx->wordbuf[wbuflen]; } - *ctx->wordptr++ = (char)ctx->ch; + *ctx->wordptr++ = ctx->ch; *ctx->wordptr = '\0'; } @@ -242,8 +234,8 @@ static int findwordstart(PCONF_CTX_t *ctx) return STATE_FINDEOL; /* space = not in a word yet, so loop back */ - if (isspace((size_t)ctx->ch)) - return STATE_FINDWORDSTART; + if (isspace(ctx->ch)) + return STATE_FINDWORDSTART; /* \ = literal = accept the next char blindly */ if (ctx->ch == '\\') @@ -263,7 +255,7 @@ static int findwordstart(PCONF_CTX_t *ctx) } return STATE_COLLECT; -} +} /* eat characters until the end of the line is found */ static int findeol(PCONF_CTX_t *ctx) @@ -282,7 +274,7 @@ static void pconf_seterr(PCONF_CTX_t *ctx, const char *errmsg) snprintf(ctx->errmsg, PCONF_ERR_LEN, "%s", errmsg); ctx->error = 1; -} +} /* quote characters inside a word bounded by "quotes" */ static int quotecollect(PCONF_CTX_t *ctx) @@ -299,7 +291,7 @@ static int quotecollect(PCONF_CTX_t *ctx) /* another " means we're done with this word */ if (ctx->ch == '"') { endofword(ctx); - + return STATE_FINDWORDSTART; } @@ -342,7 +334,7 @@ static int collect(PCONF_CTX_t *ctx) } /* space means the word is done */ - if (isspace((size_t)ctx->ch)) { + if (isspace(ctx->ch)) { endofword(ctx); return STATE_FINDWORDSTART; @@ -451,9 +443,6 @@ int pconf_file_begin(PCONF_CTX_t *ctx, const char *fn) return 0; } - /* prevent fd leaking to child processes */ - fcntl(fileno(ctx->f), F_SETFD, FD_CLOEXEC); - return 1; /* OK */ } @@ -582,7 +571,7 @@ int pconf_line(PCONF_CTX_t *ctx, const char *line) /* deal with any lingering characters */ /* still building a word? */ - if (ctx->wordptr != ctx->wordbuf) + if (ctx->wordptr != ctx->wordbuf) endofword(ctx); /* tie it off */ return 1; diff --git a/common/setenv.c b/common/setenv.c index 85b8974..00f7a6b 100644 --- a/common/setenv.c +++ b/common/setenv.c @@ -9,14 +9,13 @@ int nut_setenv(const char *name, const char *value, int overwrite) char *val; char *buffer; int rv; - + if (overwrite == 0) { val = getenv(name); if (val != NULL) { return 0; } } - buffer = xmalloc(strlen(value) + strlen(name) + 2); strcpy(buffer, name); strcat(buffer, "="); diff --git a/common/snprintf.c b/common/snprintf.c index 0caa04e..a180269 100644 --- a/common/snprintf.c +++ b/common/snprintf.c @@ -35,9 +35,9 @@ * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. - * + * * Thomas Roessler 01/27/98 for mutt 0.89i - * The PGP code was using unsigned hexadecimal formats. + * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 @@ -54,7 +54,7 @@ #include "config.h" #include -#include +# include #include #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) @@ -102,14 +102,14 @@ /*int snprintf (char *str, size_t count, const char *fmt, ...);*/ /*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/ -static void dopr (char *buffer, size_t maxlen, const char *format, +static void dopr (char *buffer, size_t maxlen, const char *format, va_list args); static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max); + char *value, int flags, int min, int max); static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags); + long value, int base, int min, int max, int flags); static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - LDOUBLE fvalue, int min, int max, int flags); + LDOUBLE fvalue, int min, int max, int flags); static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); /* @@ -137,26 +137,10 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); /* Conversion Flags */ #define DP_C_SHORT 1 -/* Note: Originally DP_C_SHORT converted to "short int" types, but modernish - * (C99+ or even earlier) standards require that the minimal type passed - * through variadic args '...' is an int, and smaller types are padded up - * to it - so value shifts in memory and erroneous access crashes can occur - * if smaller data is accessed blindly. Code below has been fixed to not pass - * "short int" anymore - it just casts the int to desired smaller type (and - * so drops the padding bits). */ #define DP_C_LONG 2 #define DP_C_LDOUBLE 3 #define DP_C_LLONG 4 -#ifdef C89PLUS -#undef C89PLUS -#endif - -#if defined(__STDC__) || defined(__STDC_VERSION__) -/* C89+ and C90+ code respectively */ -#define C89PLUS 1 -#endif - #define char_to_int(p) ((p)- '0') #define MAX(p,q) (((p) >= (q)) ? (p) : (q)) @@ -172,7 +156,7 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) int flags; int cflags; size_t currlen; - + state = DP_S_DEFAULT; currlen = flags = cflags = min = 0; max = -1; @@ -180,259 +164,237 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) while (state != DP_S_DONE) { - if ((ch == '\0') || (currlen >= maxlen)) + if ((ch == '\0') || (currlen >= maxlen)) state = DP_S_DONE; - switch(state) + switch(state) { case DP_S_DEFAULT: - if (ch == '%') - state = DP_S_FLAGS; - else - dopr_outch (buffer, &currlen, maxlen, ch); + if (ch == '%') + state = DP_S_FLAGS; + else + dopr_outch (buffer, &currlen, maxlen, ch); ch = *format++; break; case DP_S_FLAGS: - switch (ch) + switch (ch) { case '-': - flags |= DP_F_MINUS; + flags |= DP_F_MINUS; ch = *format++; - break; + break; case '+': - flags |= DP_F_PLUS; + flags |= DP_F_PLUS; ch = *format++; - break; + break; case ' ': - flags |= DP_F_SPACE; + flags |= DP_F_SPACE; ch = *format++; - break; + break; case '#': - flags |= DP_F_NUM; + flags |= DP_F_NUM; ch = *format++; - break; + break; case '0': - flags |= DP_F_ZERO; + flags |= DP_F_ZERO; ch = *format++; - break; + break; default: - state = DP_S_MIN; - break; + state = DP_S_MIN; + break; } break; case DP_S_MIN: - if (isdigit((unsigned char)ch)) + if (isdigit((unsigned char)ch)) { - min = 10*min + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') + min = 10*min + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') { - min = va_arg (args, int); - ch = *format++; - state = DP_S_DOT; - } - else - state = DP_S_DOT; + min = va_arg (args, int); + ch = *format++; + state = DP_S_DOT; + } + else + state = DP_S_DOT; break; case DP_S_DOT: - if (ch == '.') + if (ch == '.') { - state = DP_S_MAX; - ch = *format++; - } - else - state = DP_S_MOD; + state = DP_S_MAX; + ch = *format++; + } + else + state = DP_S_MOD; break; case DP_S_MAX: - if (isdigit((unsigned char)ch)) + if (isdigit((unsigned char)ch)) { - if (max < 0) - max = 0; - max = 10*max + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') + if (max < 0) + max = 0; + max = 10*max + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') { - max = va_arg (args, int); - ch = *format++; - state = DP_S_MOD; - } - else - state = DP_S_MOD; + max = va_arg (args, int); + ch = *format++; + state = DP_S_MOD; + } + else + state = DP_S_MOD; break; case DP_S_MOD: - switch (ch) + switch (ch) { case 'h': - cflags = DP_C_SHORT; - ch = *format++; - break; + cflags = DP_C_SHORT; + ch = *format++; + break; case 'l': - cflags = DP_C_LONG; - ch = *format++; - if (ch == 'l') { /* It's a long long */ - cflags = DP_C_LLONG; - ch = *format++; - } - break; + cflags = DP_C_LONG; + ch = *format++; + if (ch == 'l') { /* It's a long long */ + cflags = DP_C_LLONG; + ch = *format++; + } + break; case 'L': - cflags = DP_C_LDOUBLE; - ch = *format++; - break; + cflags = DP_C_LDOUBLE; + ch = *format++; + break; default: - break; + break; } state = DP_S_CONV; break; case DP_S_CONV: - switch (ch) + switch (ch) { case 'd': case 'i': - if (cflags == DP_C_SHORT) -#ifdef C89PLUS - value = (short int)va_arg (args, int); -#else - value = va_arg (args, short int); -#endif - else if (cflags == DP_C_LONG) - value = va_arg (args, long int); - else if (cflags == DP_C_LLONG) - value = va_arg (args, LLONG); - else - value = va_arg (args, int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; + if (cflags == DP_C_SHORT) + value = va_arg (args, short int); + else if (cflags == DP_C_LONG) + value = va_arg (args, long int); + else if (cflags == DP_C_LLONG) + value = va_arg (args, LLONG); + else + value = va_arg (args, int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; case 'o': - flags |= DP_F_UNSIGNED; - if (cflags == DP_C_SHORT) -#ifdef C89PLUS - value = (unsigned short int)va_arg (args, unsigned int); -#else - value = va_arg (args, unsigned short int); -#endif - else if (cflags == DP_C_LONG) - value = (long)va_arg (args, unsigned long int); - else if (cflags == DP_C_LLONG) - value = (long)va_arg (args, unsigned LLONG); - else - value = (long)va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); - break; + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = (long)va_arg (args, unsigned long int); + else if (cflags == DP_C_LLONG) + value = (long)va_arg (args, unsigned LLONG); + else + value = (long)va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); + break; case 'u': - flags |= DP_F_UNSIGNED; - if (cflags == DP_C_SHORT) -#ifdef C89PLUS - value = (unsigned short int)va_arg (args, unsigned int); -#else - value = va_arg (args, unsigned short int); -#endif - else if (cflags == DP_C_LONG) - value = (long)va_arg (args, unsigned long int); - else if (cflags == DP_C_LLONG) - value = (LLONG)va_arg (args, unsigned LLONG); - else - value = (long)va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = (long)va_arg (args, unsigned long int); + else if (cflags == DP_C_LLONG) + value = (LLONG)va_arg (args, unsigned LLONG); + else + value = (long)va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; case 'X': - flags |= DP_F_UP; - goto fallthrough_case_x; + flags |= DP_F_UP; case 'x': - fallthrough_case_x: - flags |= DP_F_UNSIGNED; - if (cflags == DP_C_SHORT) -#ifdef C89PLUS - value = (unsigned short int)va_arg (args, unsigned int); -#else - value = va_arg (args, unsigned short int); -#endif - else if (cflags == DP_C_LONG) - value = (long)va_arg (args, unsigned long int); - else if (cflags == DP_C_LLONG) - value = (LLONG)va_arg (args, unsigned LLONG); - else - value = (long)va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); - break; + flags |= DP_F_UNSIGNED; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned short int); + else if (cflags == DP_C_LONG) + value = (long)va_arg (args, unsigned long int); + else if (cflags == DP_C_LLONG) + value = (LLONG)va_arg (args, unsigned LLONG); + else + value = (long)va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); + break; case 'f': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, LDOUBLE); - else - fvalue = va_arg (args, double); - /* um, floating point? */ - fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); - break; + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, LDOUBLE); + else + fvalue = va_arg (args, double); + /* um, floating point? */ + fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); + break; case 'E': - flags |= DP_F_UP; - goto fallthrough_case_e; + flags |= DP_F_UP; case 'e': - fallthrough_case_e: - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, LDOUBLE); - else - fvalue = va_arg (args, double); - break; + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, LDOUBLE); + else + fvalue = va_arg (args, double); + break; case 'G': - flags |= DP_F_UP; - goto fallthrough_case_g; + flags |= DP_F_UP; case 'g': - fallthrough_case_g: - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, LDOUBLE); - else - fvalue = va_arg (args, double); - break; + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, LDOUBLE); + else + fvalue = va_arg (args, double); + break; case 'c': - dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); - break; + dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); + break; case 's': - strvalue = va_arg (args, char *); - if (max < 0) - max = maxlen; /* ie, no max */ - fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); - break; + strvalue = va_arg (args, char *); + if (max < 0) + max = maxlen; /* ie, no max */ + fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); + break; case 'p': - strvalue = va_arg (args, void *); - fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); - break; + strvalue = va_arg (args, void *); + fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); + break; case 'n': - if (cflags == DP_C_SHORT) - { - short int *num; - num = va_arg (args, short int *); - *num = currlen; + if (cflags == DP_C_SHORT) + { + short int *num; + num = va_arg (args, short int *); + *num = currlen; + } + else if (cflags == DP_C_LONG) + { + long int *num; + num = va_arg (args, long int *); + *num = (long int)currlen; + } + else if (cflags == DP_C_LLONG) + { + LLONG *num; + num = va_arg (args, LLONG *); + *num = (LLONG)currlen; + } + else + { + int *num; + num = va_arg (args, int *); + *num = currlen; } - else if (cflags == DP_C_LONG) - { - long int *num; - num = va_arg (args, long int *); - *num = (long int)currlen; - } - else if (cflags == DP_C_LLONG) - { - LLONG *num; - num = va_arg (args, LLONG *); - *num = (LLONG)currlen; - } - else - { - int *num; - num = va_arg (args, int *); - *num = currlen; - } - break; + break; case '%': - dopr_outch (buffer, &currlen, maxlen, ch); - break; + dopr_outch (buffer, &currlen, maxlen, ch); + break; case 'w': - /* not supported yet, treat as next char */ - ch = *format++; - break; + /* not supported yet, treat as next char */ + ch = *format++; + break; default: - /* Unknown, skip */ - break; + /* Unknown, skip */ + break; } ch = *format++; state = DP_S_DEFAULT; @@ -446,18 +408,18 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) break; /* some picky compilers need this */ } } - if (currlen < maxlen - 1) + if (currlen < maxlen - 1) buffer[currlen] = '\0'; - else + else buffer[maxlen - 1] = '\0'; } static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max) + char *value, int flags, int min, int max) { int padlen, strln; /* amount to pad */ int cnt = 0; - + if (value == 0) { value = ""; @@ -465,23 +427,23 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ - while ((padlen > 0) && (cnt < max)) + while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; ++cnt; } - while (*value && (cnt < max)) + while (*value && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, *value++); ++cnt; } - while ((padlen < 0) && (cnt < max)) + while ((padlen < 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; @@ -492,7 +454,7 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, /* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags) + long value, int base, int min, int max, int flags) { int signvalue = 0; unsigned long uvalue; @@ -501,7 +463,7 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; - + if (max < 0) max = 0; @@ -515,12 +477,12 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, } else if (flags & DP_F_PLUS) /* Do a sign (+/i) */ - signvalue = '+'; + signvalue = '+'; else if (flags & DP_F_SPACE) - signvalue = ' '; + signvalue = ' '; } - + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { @@ -541,27 +503,27 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF printf("zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", - zpadlen, spadlen, min, max, place); + zpadlen, spadlen, min, max, place); #endif /* Spaces */ - while (spadlen > 0) + while (spadlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --spadlen; } /* Sign */ - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); /* Zeros */ - if (zpadlen > 0) + if (zpadlen > 0) { while (zpadlen > 0) { @@ -571,9 +533,9 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, } /* Digits */ - while (place > 0) + while (place > 0) dopr_outch (buffer, currlen, maxlen, convert[--place]); - + /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); @@ -581,7 +543,6 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, } } -#ifndef HAVE_ABS_VAL static LDOUBLE abs_val (LDOUBLE value) { LDOUBLE result = value; @@ -591,13 +552,7 @@ static LDOUBLE abs_val (LDOUBLE value) return result; } -#endif -#ifndef HAVE_FCVT -/* The two routines that may get defined below are only used if we also don't - * have a fcvt() in the system. Defining and not using the routines may be a - * warning (fatal with -Werror), so we hide them here. */ -# ifndef HAVE_POW10 static LDOUBLE pow10 (int exp) { LDOUBLE result = 1; @@ -607,12 +562,10 @@ static LDOUBLE pow10 (int exp) result *= 10; exp--; } - + return result; } -# endif -# ifndef HAVE_ROUND static long round (LDOUBLE value) { long intpart; @@ -624,11 +577,9 @@ static long round (LDOUBLE value) return intpart; } -# endif -#endif /* HAVE_FCVT */ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - LDOUBLE fvalue, int min, int max, int flags) + LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; LDOUBLE ufvalue; @@ -650,14 +601,12 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ - int zpadlen = 0; -#ifndef HAVE_FCVT + int zpadlen = 0; int caps = 0; long intpart; long fracpart; -#endif - - /* + + /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ @@ -673,7 +622,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, signvalue = '+'; else if (flags & DP_F_SPACE) - signvalue = ' '; + signvalue = ' '; #if 0 if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ @@ -682,8 +631,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, #ifndef HAVE_FCVT intpart = (long)ufvalue; - /* - * Sorry, we only support 9 digits past the decimal because of our + /* + * Sorry, we only support 9 digits past the decimal because of our * conversion method */ if (max > 9) @@ -701,8 +650,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, } #ifdef DEBUG_SNPRINTF - printf("fmtfp: %g %d.%d min=%d max=%d\n", - (double)fvalue, intpart, fracpart, min, max); + printf("fmtfp: %g %d.%d min=%d max=%d\n", + (double)fvalue, intpart, fracpart, min, max); #endif /* Convert integer part */ @@ -758,38 +707,38 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, fconvert[fplace++] = result[--r_length]; while ((dec_pt < 0) && (fplace < max)) { - fconvert[fplace++] = '0'; - dec_pt++; - } + fconvert[fplace++] = '0'; + dec_pt++; + } } else { int c; iplace=0; for(c=dec_pt; c; iconvert[iplace++] = result[--c]) - ; + ; iconvert[iplace] = '\0'; result += dec_pt; fplace = 0; - + for(c=(r_length-dec_pt); c; fconvert[fplace++] = result[--c]) - ; + ; } #endif /* fcvt */ - + /* -1 for decimal point, another -1 if we are printing a sign */ - padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ - if ((flags & DP_F_ZERO) && (padlen > 0)) + if ((flags & DP_F_ZERO) && (padlen > 0)) { - if (signvalue) + if (signvalue) { dopr_outch (buffer, currlen, maxlen, signvalue); --padlen; @@ -806,10 +755,10 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, dopr_outch (buffer, currlen, maxlen, ' '); --padlen; } - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); - while (iplace > 0) + while (iplace > 0) dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); @@ -822,10 +771,10 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, * char to print out. */ if (max > 0) { - dopr_outch (buffer, currlen, maxlen, '.'); + dopr_outch (buffer, currlen, maxlen, '.'); - while (fplace > 0) - dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); } while (zpadlen > 0) @@ -834,7 +783,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, --zpadlen; } - while (padlen < 0) + while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; @@ -871,7 +820,7 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) char *fmt; #endif VA_LOCAL_DECL; - + VA_START (fmt); VA_SHIFT (str, char *); VA_SHIFT (count, size_t ); @@ -911,7 +860,7 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) "%.1f", NULL }; - double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, + double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 6442452944.1234, 0}; char *int_fmt[] = { "%-1.5d", @@ -939,9 +888,9 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - fp_fmt[x], buf1, buf2); - fail++; + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + fp_fmt[x], buf1, buf2); + fail++; } num++; } @@ -953,9 +902,9 @@ static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - int_fmt[x], buf1, buf2); - fail++; + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + int_fmt[x], buf1, buf2); + fail++; } num++; } diff --git a/common/state.c b/common/state.c index 280eac5..cb79e0f 100644 --- a/common/state.c +++ b/common/state.c @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be first */ - #include #include #include @@ -126,10 +124,7 @@ static void st_tree_node_add(st_tree_t **nptr, st_tree_t *sptr) *nptr = sptr; } -/* remove a variable from a tree - * except for variables with ST_FLAG_IMMUTABLE - * (for override.* to survive) per issue #737 - */ +/* remove a variable from a tree */ int state_delinfo(st_tree_t **nptr, const char *var) { while (*nptr) { @@ -146,11 +141,6 @@ int state_delinfo(st_tree_t **nptr, const char *var) continue; } - if (node->flags & ST_FLAG_IMMUTABLE) { - upsdebugx(6, "%s: not deleting immutable variable [%s]", __func__, var); - return 0; - } - /* whatever is on the left, hang it off current right */ st_tree_node_add(&node->right, node->left); @@ -163,7 +153,7 @@ int state_delinfo(st_tree_t **nptr, const char *var) } return 0; /* not found */ -} +} /* interface */ @@ -228,7 +218,7 @@ static int st_tree_enum_add(enum_t **list, const char *enc) list = &(*list)->next; continue; } - + return 0; /* duplicate */ } @@ -313,7 +303,7 @@ int state_addrange(st_tree_t *root, const char *var, const int min, const int ma int state_setaux(st_tree_t *root, const char *var, const char *auxs) { st_tree_t *sttmp; - long aux; + int aux; /* find the tree node for var */ sttmp = state_tree_find(root, var); @@ -364,7 +354,7 @@ int state_getflags(st_tree_t *root, const char *var) return sttmp->flags; } -long state_getaux(st_tree_t *root, const char *var) +int state_getaux(st_tree_t *root, const char *var) { st_tree_t *sttmp; @@ -406,9 +396,9 @@ const range_t *state_getrangelist(st_tree_t *root, const char *var) return sttmp->range_list; } -void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **flag) -{ - size_t i; +void state_setflags(st_tree_t *root, const char *var, int numflags, char **flag) +{ + int i; st_tree_t *sttmp; /* find the tree node for var */ @@ -434,11 +424,6 @@ void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **fl continue; } - if (!strcasecmp(flag[i], "NUMBER")) { - sttmp->flags |= ST_FLAG_NUMBER; - continue; - } - upsdebugx(2, "Unrecognized flag [%s]", flag[i]); } } diff --git a/common/str.c b/common/str.c deleted file mode 100644 index 295f450..0000000 --- a/common/str.c +++ /dev/null @@ -1,629 +0,0 @@ -/* str.c - Common string-related functions - * - * Copyright (C) - * 2000 Russell Kroll - * 2015 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "config.h" /* must be first */ - -#include -#include -#include - -#ifdef HAVE_STRING_H -#include /* for strdup() and many others */ -#endif - -#ifdef HAVE_STRINGS_H -#include /* for strncasecmp() and strcasecmp() */ -#endif - -#include "nut_stdint.h" -#include "str.h" - -char *str_trim(char *string, const char character) -{ - return str_rtrim(str_ltrim(string, character), character); -} - -char *str_trim_m(char *string, const char *characters) -{ - return str_rtrim_m(str_ltrim_m(string, characters), characters); -} - -char *str_ltrim(char *string, const char character) -{ - char characters[2] = { character, '\0' }; - - return str_ltrim_m(string, characters); -} - -char *str_ltrim_m(char *string, const char *characters) -{ - if ( - string == NULL || - *string == '\0' || - characters == NULL || - *characters == '\0' - ) - return string; - - while ( - *string != '\0' && - strchr(characters, *string) != NULL - ) - memmove(string, string + 1, strlen(string)); - - return string; -} - -char *str_rtrim(char *string, const char character) -{ - char characters[2] = { character, '\0' }; - - return str_rtrim_m(string, characters); -} - -char *str_rtrim_m(char *string, const char *characters) -{ - char *ptr; - - if ( - string == NULL || - *string == '\0' || - characters == NULL || - *characters == '\0' - ) - return string; - - ptr = &string[strlen(string) - 1]; - - while ( - ptr >= string && - strchr(characters, *ptr) != NULL - ) - *ptr-- = '\0'; - - return string; -} - -char *str_trim_space(char *string) -{ - return str_rtrim_space(str_ltrim_space(string)); -} - -char *str_ltrim_space(char *string) -{ - if ( - string == NULL || - *string == '\0' - ) - return string; - - while ( - *string != '\0' && - isspace((size_t)*string) - ) - memmove(string, string + 1, strlen(string)); - - return string; -} - -char *str_rtrim_space(char *string) -{ - char *ptr; - - if ( - string == NULL || - *string == '\0' - ) - return string; - - ptr = &string[strlen(string) - 1]; - - while ( - ptr >= string && - isspace((size_t)*ptr) - ) - *ptr-- = '\0'; - - return string; -} - -int str_is_short(const char *string, const int base) -{ - short number; - - return str_to_short(string, &number, base); -} - -int str_is_short_strict(const char *string, const int base) -{ - short number; - - return str_to_short_strict(string, &number, base); -} - -int str_is_ushort(const char *string, const int base) -{ - unsigned short number; - - return str_to_ushort(string, &number, base); -} - -int str_is_ushort_strict(const char *string, const int base) -{ - unsigned short number; - - return str_to_ushort_strict(string, &number, base); -} - -int str_is_int(const char *string, const int base) -{ - int number; - - return str_to_int(string, &number, base); -} - -int str_is_int_strict(const char *string, const int base) -{ - int number; - - return str_to_int_strict(string, &number, base); -} - -int str_is_uint(const char *string, const int base) -{ - unsigned int number; - - return str_to_uint(string, &number, base); -} - -int str_is_uint_strict(const char *string, const int base) -{ - unsigned int number; - - return str_to_uint_strict(string, &number, base); -} - -int str_is_long(const char *string, const int base) -{ - long number; - - return str_to_long(string, &number, base); -} - -int str_is_long_strict(const char *string, const int base) -{ - long number; - - return str_to_long_strict(string, &number, base); -} - -int str_is_ulong(const char *string, const int base) -{ - unsigned long number; - - return str_to_ulong(string, &number, base); -} - -int str_is_ulong_strict(const char *string, const int base) -{ - unsigned long number; - - return str_to_ulong_strict(string, &number, base); -} - -int str_is_double(const char *string, const int base) -{ - double number; - - return str_to_double(string, &number, base); -} - -int str_is_double_strict(const char *string, const int base) -{ - double number; - - return str_to_double_strict(string, &number, base); -} - -int str_to_short(const char *string, short *number, const int base) -{ - long num; - - *number = 0; - - if (!str_to_long(string, &num, base)) - return 0; - - if ( - num < SHRT_MIN || - num > SHRT_MAX - ) { - errno = ERANGE; - return 0; - } - - *number = (short)num; - return 1; -} - -int str_to_short_strict(const char *string, short *number, const int base) -{ - long num; - - *number = 0; - - if (!str_to_long_strict(string, &num, base)) - return 0; - - if ( - num < SHRT_MIN || - num > SHRT_MAX - ) { - errno = ERANGE; - return 0; - } - - *number = (short)num; - return 1; -} - -int str_to_ushort(const char *string, unsigned short *number, const int base) -{ - unsigned long num; - - *number = 0; - - if (!str_to_ulong(string, &num, base)) - return 0; - - if (num > USHRT_MAX) { - errno = ERANGE; - return 0; - } - - *number = (unsigned short)num; - return 1; -} - -int str_to_ushort_strict(const char *string, unsigned short *number, const int base) -{ - unsigned long num; - - *number = 0; - - if (!str_to_ulong_strict(string, &num, base)) - return 0; - - if (num > USHRT_MAX) { - errno = ERANGE; - return 0; - } - - *number = (unsigned short)num; - return 1; -} - -int str_to_int(const char *string, int *number, const int base) -{ - long num; /* long >= int, make sure we fit well */ - - *number = 0; - - if (!str_to_long(string, &num, base)) - return 0; - - if ( - num < INT_MIN || - num > INT_MAX - ) { - errno = ERANGE; - return 0; - } - - *number = (int)num; - return 1; -} - -int str_to_int_strict(const char *string, int *number, const int base) -{ - long num; /* long >= int, make sure we fit well */ - - *number = 0; - - if (!str_to_long_strict(string, &num, base)) - return 0; - - if ( - num < INT_MIN || - num > INT_MAX - ) { - errno = ERANGE; - return 0; - } - - *number = (int)num; - return 1; -} - -int str_to_uint(const char *string, unsigned int *number, const int base) -{ - unsigned long num; /* long >= int, make sure we fit well */ - - *number = 0; - - if (!str_to_ulong(string, &num, base)) - return 0; - - if (num > UINT_MAX) { - errno = ERANGE; - return 0; - } - - *number = (unsigned int)num; - return 1; -} - -int str_to_uint_strict(const char *string, unsigned int *number, const int base) -{ - unsigned long num; /* long >= int, make sure we fit well */ - - *number = 0; - - if (!str_to_ulong_strict(string, &num, base)) - return 0; - - if (num > UINT_MAX) { - errno = ERANGE; - return 0; - } - - *number = (unsigned int)num; - return 1; -} - -int str_to_long(const char *string, long *number, const int base) -{ - char *str; - - *number = 0; - - if ( - string == NULL || - *string == '\0' - ) { - errno = EINVAL; - return 0; - } - - str = strdup(string); - if (str == NULL) - return 0; - - str_trim_space(str); - - if (!str_to_long_strict(str, number, base)) { - free(str); - return 0; - } - - free(str); - return 1; -} - -int str_to_long_strict(const char *string, long *number, const int base) -{ - char *ptr = NULL; - - *number = 0; - - if ( - string == NULL || - *string == '\0' || - isspace((size_t)*string) - ) { - errno = EINVAL; - return 0; - } - - errno = 0; - *number = strtol(string, &ptr, base); - - if ( - errno == EINVAL || - *ptr != '\0' - ) { - *number = 0; - errno = EINVAL; - return 0; - } - - if (errno == ERANGE) { - *number = 0; - return 0; - } - - return 1; -} - -int str_to_ulong(const char *string, unsigned long *number, const int base) -{ - char *str; - - *number = 0; - - if ( - string == NULL || - *string == '\0' - ) { - errno = EINVAL; - return 0; - } - - str = strdup(string); - if (str == NULL) - return 0; - - str_trim_space(str); - - if (!str_to_ulong_strict(str, number, base)) { - free(str); - return 0; - } - - free(str); - return 1; -} - -int str_to_ulong_strict(const char *string, unsigned long *number, const int base) -{ - char *ptr = NULL; - - *number = 0; - - if ( - string == NULL || - *string == '\0' || - *string == '+' || - *string == '-' || - isspace((size_t)*string) - ) { - errno = EINVAL; - return 0; - } - - errno = 0; - *number = strtoul(string, &ptr, base); - - if ( - errno == EINVAL || - *ptr != '\0' - ) { - *number = 0; - errno = EINVAL; - return 0; - } - - if (errno == ERANGE) { - *number = 0; - return 0; - } - - return 1; -} - -int str_to_double(const char *string, double *number, const int base) -{ - char *str; - - *number = 0; - - if ( - string == NULL || - *string == '\0' - ) { - errno = EINVAL; - return 0; - } - - str = strdup(string); - if (str == NULL) - return 0; - - str_trim_space(str); - - if (!str_to_double_strict(str, number, base)) { - free(str); - return 0; - } - - free(str); - return 1; -} - -int str_to_double_strict(const char *string, double *number, const int base) -{ - char *ptr = NULL; - - *number = 0; - - if ( - string == NULL || - *string == '\0' || - isspace((size_t)*string) - ) { - errno = EINVAL; - return 0; - } - - switch (base) - { - case 0: - break; - case 10: - if (strlen(string) != strspn(string, "-+.0123456789Ee")) { - errno = EINVAL; - return 0; - } - break; - case 16: - if (strlen(string) != strspn(string, "-+.0123456789ABCDEFabcdefXxPp")) { - errno = EINVAL; - return 0; - } - break; - default: - errno = EINVAL; - return 0; - } - - errno = 0; - *number = strtod(string, &ptr); - - if ( - errno == EINVAL || - *ptr != '\0' - ) { - *number = 0; - errno = EINVAL; - return 0; - } - - if (errno == ERANGE) { - *number = 0; - return 0; - } - - return 1; -} - -int str_ends_with(const char *s, const char *suff) { - size_t slen; - size_t sufflen; - - if (!s) return 0; /* null string does not end with anything */ - if (!suff) return 1; /* null suffix tails anything */ - - slen = strlen(s); - sufflen = strlen(suff); - - return (slen >= sufflen) && (!memcmp(s + slen - sufflen, suff, sufflen)); -} diff --git a/common/strerror.c b/common/strerror.c index e00f208..b5cecb9 100644 --- a/common/strerror.c +++ b/common/strerror.c @@ -11,16 +11,6 @@ char *strerror(int errnum) { static char buf[32]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif - switch (errnum) { #if defined (EPERM) case EPERM: @@ -508,11 +498,6 @@ char *strerror(int errnum) /* Fallback: just print the error number */ snprintf(buf, sizeof(buf), "Error %d", errnum); return buf; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - } #endif /* HAVE_STRERROR */ diff --git a/common/upsconf.c b/common/upsconf.c index bb7fd35..867163b 100644 --- a/common/upsconf.c +++ b/common/upsconf.c @@ -17,8 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -31,14 +29,14 @@ static char *ups_section; /* handle arguments separated by parseconf */ -static void conf_args(size_t numargs, char **arg) +static void conf_args(int numargs, char **arg) { if (numargs < 1) return; /* look for section headers - [upsname] */ if ((arg[0][0] == '[') && (arg[0][strlen(arg[0])-1] == ']')) { - + free(ups_section); arg[0][strlen(arg[0])-1] = '\0'; diff --git a/conf/Makefile.am b/conf/Makefile.am index 847c299..681f33c 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -2,7 +2,7 @@ INSTALL_0600 = $(INSTALL) -m 0600 -SECFILES = upsd.conf.sample upsd.users.sample +SECFILES = upsmon.conf.sample upsd.conf.sample upsd.users.sample PUBFILES = nut.conf.sample ups.conf.sample CGIPUB = hosts.conf.sample upsset.conf.sample upsstats.html.sample \ upsstats-single.html.sample @@ -15,27 +15,3 @@ endif dist_sysconf_DATA = $(SECFILES) $(PUBFILES) $(CGI_INSTALL) nodist_sysconf_DATA = upssched.conf.sample upsmon.conf.sample - -SPELLCHECK_SRC = $(dist_sysconf_DATA) \ - upssched.conf.sample.in upsmon.conf.sample.in - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here -# by a wildcard target in case the make implementation can put the two together. -*-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - -.sample.sample-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -.in.in-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_DIR="$(srcdir)" $@ - - -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *.pdf *.html *-spellchecked diff --git a/conf/Makefile.in b/conf/Makefile.in index 7858703..888998f 100644 --- a/conf/Makefile.in +++ b/conf/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,61 +18,23 @@ # Network UPS Tools: conf VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -92,24 +55,21 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = conf +DIST_COMMON = $(am__dist_sysconf_DATA_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/upsmon.conf.sample.in \ + $(srcdir)/upssched.conf.sample.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -118,34 +78,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_sysconf_DATA_DIST) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = upsmon.conf.sample upssched.conf.sample CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -153,9 +95,9 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__dist_sysconf_DATA_DIST = upsd.conf.sample upsd.users.sample \ - nut.conf.sample ups.conf.sample hosts.conf.sample \ - upsset.conf.sample upsstats.html.sample \ +am__dist_sysconf_DATA_DIST = upsmon.conf.sample upsd.conf.sample \ + upsd.users.sample nut.conf.sample ups.conf.sample \ + hosts.conf.sample upsset.conf.sample upsstats.html.sample \ upsstats-single.html.sample am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -186,19 +128,13 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(sysconfdir)" "$(DESTDIR)$(sysconfdir)" DATA = $(dist_sysconf_DATA) $(nodist_sysconf_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/upsmon.conf.sample.in \ - $(srcdir)/upssched.conf.sample.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -209,7 +145,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -223,7 +158,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -236,8 +170,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -247,15 +184,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -266,29 +202,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -308,9 +236,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -319,16 +244,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -342,7 +263,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -353,12 +273,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -377,21 +293,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -402,7 +315,7 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ INSTALL_0600 = $(INSTALL) -m 0600 -SECFILES = upsd.conf.sample upsd.users.sample +SECFILES = upsmon.conf.sample upsd.conf.sample upsd.users.sample PUBFILES = nut.conf.sample ups.conf.sample CGIPUB = hosts.conf.sample upsset.conf.sample upsstats.html.sample \ upsstats-single.html.sample @@ -411,15 +324,9 @@ CGIPUB = hosts.conf.sample upsset.conf.sample upsstats.html.sample \ @WITH_CGI_TRUE@CGI_INSTALL = $(CGIPUB) dist_sysconf_DATA = $(SECFILES) $(PUBFILES) $(CGI_INSTALL) nodist_sysconf_DATA = upssched.conf.sample upsmon.conf.sample -SPELLCHECK_SRC = $(dist_sysconf_DATA) \ - upssched.conf.sample.in upsmon.conf.sample.in - -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *.pdf *.html *-spellchecked all: all-am .SUFFIXES: -.SUFFIXES: .in .in-spellchecked .sample .sample-spellchecked $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -432,13 +339,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu conf/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu conf/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -501,17 +409,14 @@ uninstall-nodist_sysconfDATA: @list='$(nodist_sysconf_DATA)'; test -n "$(sysconfdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(sysconfdir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -570,7 +475,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -579,7 +483,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -649,39 +552,18 @@ uninstall-am: uninstall-dist_sysconfDATA uninstall-nodist_sysconfDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-dist_sysconfDATA install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man \ - install-nodist_sysconfDATA install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_sysconfDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-nodist_sysconfDATA install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-dist_sysconfDATA \ - uninstall-nodist_sysconfDATA + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-dist_sysconfDATA uninstall-nodist_sysconfDATA -.PRECIOUS: Makefile - - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here -# by a wildcard target in case the make implementation can put the two together. -*-spellchecked: Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - -.sample.sample-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -.in.in-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_DIR="$(srcdir)" $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/conf/hosts.conf.sample b/conf/hosts.conf.sample index 24beb82..9a4b669 100644 --- a/conf/hosts.conf.sample +++ b/conf/hosts.conf.sample @@ -22,7 +22,7 @@ # # MONITOR "" # -# Examples: +# Examples: # # MONITOR myups@localhost "Local UPS" # MONITOR su2200@10.64.1.1 "Finance department" diff --git a/conf/nut.conf.sample b/conf/nut.conf.sample index ebf6c04..9309825 100644 --- a/conf/nut.conf.sample +++ b/conf/nut.conf.sample @@ -14,7 +14,7 @@ # The values of MODE can be: # - none: NUT is not configured, or use the Integrated Power Management, or use # some external system to startup NUT components. So nothing is to be started. -# - standalone: This mode address a local only configuration, with 1 UPS +# - standalone: This mode address a local only configuration, with 1 UPS # protecting the local system. This implies to start the 3 NUT layers (driver, # upsd and upsmon) and the matching configuration files. This mode can also # address UPS redundancy. @@ -26,14 +26,7 @@ # - netclient: this mode only requires upsmon. # # IMPORTANT NOTE: -# This file is intended to be sourced by standard POSIX shell scripts (so -# there is no guaranteed `export VAR=VAL` syntax) and by systemd on Linux. +# This file is intended to be sourced by shell scripts. # You MUST NOT use spaces around the equal sign! MODE=none - -# Uncomment this to allow starting the service even if ups.conf has no device -# sections at the moment. This environment variable overrides the built-in -# "false" and an optional same-named default flag that can be set in upsd.conf: -#ALLOW_NO_DEVICE=true -#export ALLOW_NO_DEVICE diff --git a/conf/ups.conf.sample b/conf/ups.conf.sample index a86a845..365a6f7 100644 --- a/conf/ups.conf.sample +++ b/conf/ups.conf.sample @@ -2,7 +2,7 @@ # # --- SECURITY NOTE --- # -# If you use snmp-ups and set a community string in here, you +# If you use snmp-ups and set a community string in here, you # will have to secure this file to keep other users from obtaining # that string. It needs to be readable by upsdrvctl and any drivers, # and by upsd. @@ -14,169 +14,71 @@ # USB devices and SNMP devices are also supported. # # This file is used by upsdrvctl to start and stop your driver(s), and -# is also used by upsd to determine which drivers to monitor. The +# is also used by upsd to determine which drivers to monitor. The # drivers themselves also read this file for configuration directives. # # The general form is: -# +# # [upsname] # driver = # port = -# < any other directives here > +# < any other directives here > # # The section header ([upsname]) can be just about anything as long as -# it is a single word inside brackets. upsd uses this to uniquely +# it is a single word inside brackets. upsd uses this to uniquely # identify a UPS on this system. # # If you have a UPS called snoopy, your section header would be "[snoopy]". # On a system called "doghouse", the line in your upsmon.conf to monitor -# and manage it would look something like this: +# it would look something like this: # -# MONITOR snoopy@doghouse 1 upsmonuser mypassword primary +# MONITOR snoopy@doghouse 1 upsmonuser mypassword master # -# It might look like this if monitoring in "secondary" mode (without any -# ability to directly manage the UPS) from a different system: +# It might look like this if monitoring in slave mode: # -# MONITOR snoopy@doghouse 1 upsmonuser mypassword secondary +# MONITOR snoopy@doghouse 1 upsmonuser mypassword slave # # Configuration directives # ------------------------ -# -# These directives are used by upsdrvctl only and should be specified outside -# of a driver definition: -# -# maxretry: OPTIONAL. Specify the number of attempts to start the driver(s), -# in case of failure, before giving up. A delay of 'retrydelay' is -# inserted between each attempt. Caution should be taken when using -# this option, since it can impact the time taken by your system to -# start. -# -# The built-in default is 1 attempt. -# -# retrydelay: OPTIONAL. Specify the delay between each restart attempt of the -# driver(s), as specified by 'maxretry'. Caution should be taken -# when using this option, since it can impact the time taken by your -# system to start. -# -# The default is 5 seconds. -# -# chroot: OPTIONAL. Used for securing. See man page for details. -# -# driverpath: OPTIONAL. Used for custom setups. See man page for details. -# -# nowait: OPTIONAL. Tell upsdrvctl to not wait at all for the driver(s) -# to execute the requested command. Fire and forget. -# -# pollinterval: OPTIONAL. The status of the UPS will be refreshed after a -# maximum delay which is controlled by this setting (default -# 2 seconds). This may be useful if the driver is creating too -# much of a load on your system or network. -# Note that some drivers also have an option called *pollfreq* -# which controls how frequently some of the less critical -# parameters are polled. See respective driver man pages. -# - -# Set maxretry to 3 by default, this should mitigate race with slow devices: -maxretry = 3 - -# These directives can be set outside and inside a driver definition, with -# slightly different meanings per context: -# -# maxstartdelay: OPTIONAL. This can be set as a global variable -# above your first UPS definition and it can also be -# set in a UPS section. This value controls how long -# upsdrvctl will wait for the driver to finish starting. -# This keeps your system from getting stuck due to a -# broken driver or UPS. -# The default is 45 seconds. -# -# debug_min: OPTIONAL. Specify a minimum debug level for all driver daemons -# (when specified at global level), or for this driver daemon -# (when specified in a driver section), e.g. for troubleshooting -# a deployment. This does not directly impact the foreground or -# background running mode. If both the global and driver level -# `debug_min` are set, the driver-level setting takes precedence. -# Command-line option `-D` can only increase this verbosity level. -# -# user, group: OPTIONAL. Overrides the compiled-in (also global-section, -# when used in driver section) default unprivileged user/group -# name for NUT device driver. Impacts access rights used for -# the socket file access (group) and communication ports (user). -# -# synchronous: OPTIONAL. The driver work by default in asynchronous -# mode (like *no*) with fallback to synchronous if sending -# fails (i.e *synchronous=auto*). This means that all data -# are pushed by the driver on the communication socket to -# upsd (Unix socket on Unix, Named pipe on Windows) without -# waiting for these data to be actually consumed. With -# some HW, such as ePDUs, that can produce a lot of data, -# asynchronous mode may cause some congestion, resulting in -# the socket to be full, and the driver to appear as not -# connected. By enabling the 'synchronous' flag -# (value = 'yes'), the driver will wait for data to be -# consumed by upsd, prior to publishing more. This can be -# enabled either globally or per driver. -# -# The default is 'no' (i.e. asynchronous mode) for backward -# compatibility of the driver behavior. -# - +# # These directives are common to all drivers that support ups.conf: # -# driver: REQUIRED. Specify the program to run to talk to this UPS. +# driver: REQUIRED. Specify the program to run to talk to this UPS. # apcsmart, bestups, and sec are some examples. # -# port: REQUIRED. The serial port where your UPS is connected. +# port: REQUIRED. The serial port where your UPS is connected. # /dev/ttyS0 is usually the first port on Linux boxes, for example. # -# sdorder: OPTIONAL. When you have multiple UPSes on your system, you +# sdorder: optional. When you have multiple UPSes on your system, you # usually need to turn them off in a certain order. upsdrvctl # shuts down all the 0s, then the 1s, 2s, and so on. To exclude # a UPS from the shutdown sequence, set this to -1. # # The default value for this parameter is 0. # -# desc: optional, to keep a note of the UPS purpose, location, etc. -# # nolock: optional, and not recommended for use in this file. # # If you put nolock in here, the driver will not lock the -# serial port every time it starts. This may allow other -# processes to seize the port if you start more than one by +# serial port every time it starts. This may allow other +# processes to seize the port if you start more than one by # mistake. # # This is only intended to be used on systems where locking # absolutely must be disabled for the software to work. # -# ignorelb: OPTIONAL. Ignore low battery condition reported by device, -# and evaluate remaining battery charge or runtime instead. -# See man page for details. +# maxstartdelay: optional. This can be set as a global variable +# above your first UPS definition and it can also be +# set in a UPS section. This value controls how long +# upsdrvctl will wait for the driver to finish starting. +# This keeps your system from getting stuck due to a +# broken driver or UPS. # -# usb_set_altinterface(=num): OPTIONAL. Require that NUT calls this method -# to set the interface, even if 0 (default). Some devices require -# the call to initialize; others however can get stuck due to it - -# so it is not called by default. Yet others can be composite -# devices which use a non-zero interface to represent the UPS. +# The default is 45 seconds. # -# default.: OPTIONAL. Set a default value for which is -# used in case the UPS doesn't provide a value, but which will be -# overwritten if a value is available from the UPS, e.g.: -# default.input.voltage.nominal = 230 -# will report the nominal input voltage to be 230, unless the UPS -# eventually tells us differently. -# -# override.: OPTIONAL. Set a value for that overrides -# (for NUT) any value that may be read from the UPS. -# Used for overriding values from the UPS that are clearly wrong -# (e.g. some devices report wrong values for battery voltage): -# override.battery.voltage.nominal = 12 -# Use with caution! This will only change the appearance of the -# variable to the outside world (and NUT calculations), internally -# in the UPS the original value is used. # # Anything else is passed through to the hardware-specific part of # the driver. -# +# # Examples # -------- # @@ -184,19 +86,19 @@ maxretry = 3 # driver on /dev/ttyS0 is: # # [powerpal] -# driver = blazer_ser -# port = /dev/ttyS0 -# desc = "Web server" +# driver = blazer_ser +# port = /dev/ttyS0 +# desc = "Web server" # # If your UPS driver requires additional settings, you can specify them # here. For example, if it supports a setting of "1234" for the # variable "cable", it would look like this: -# +# # [myups] -# driver = mydriver -# port = /dev/ttyS1 -# cable = 1234 -# desc = "Something descriptive" +# driver = mydriver +# port = /dev/ttyS1 +# cable = 1234 +# desc = "Something descriptive" # # To find out if your driver supports any extra settings, start it with # the -h option and/or read the driver's documentation. diff --git a/conf/upsd.conf.sample b/conf/upsd.conf.sample index fb420e3..7292777 100644 --- a/conf/upsd.conf.sample +++ b/conf/upsd.conf.sample @@ -5,8 +5,6 @@ # It should only be readable by the user that upsd becomes. See the FAQ. # # Each entry below provides usage and default value. -# -# For more information, refer to upsd.conf manual page. # ======================================================================= # MAXAGE @@ -21,29 +19,6 @@ # the data fresh within the normal 15 second interval. Watch the syslog # for notifications from upsd about staleness. -# ======================================================================= -# TRACKINGDELAY -# TRACKINGDELAY 3600 -# -# This defaults to 1 hour. When instant commands and variables setting status -# tracking is enabled, status execution information are kept during this -# amount of time, and then cleaned up. - -# ======================================================================= -# ALLOW_NO_DEVICE -# ALLOW_NO_DEVICE true -# -# Normally upsd requires that at least one device section is defined in ups.conf -# when the daemon starts, to serve its data. For automatically managed services -# it may be preferred to have upsd always running, and reload the configuration -# when power devices become defined. -# -# Boolean values 'true', 'yes', 'on' and '1' mean that the server would not -# refuse to start with zero device sections found in ups.conf. -# -# Boolean values 'false', 'no', 'off' and '0' mean that the server should refuse -# to start if zero device sections were found in ups.conf. This is the default. - # ======================================================================= # STATEPATH # STATEPATH /var/run/nut @@ -52,17 +27,15 @@ # than the default that was compiled into the program. # ======================================================================= -# LISTEN [] +# LISTEN
[] # LISTEN 127.0.0.1 3493 # LISTEN ::1 3493 -# LISTEN myhostname 83493 -# LISTEN myhostname.mydomain # # This defaults to the localhost listening addresses and port 3493. # In case of IP v4 or v6 disabled kernel, only the available one will be used. # -# You may specify each interface IP address or name that you want upsd to -# listen on for connections, optionally with a port number. +# You may specify each interface you want upsd to listen on for connections, +# optionally with a port number. # # You may need this if you have multiple interfaces on your machine and # you don't want upsd to listen to all interfaces (for instance on a @@ -101,9 +74,9 @@ # # When compiled with SSL support with NSS backend, # you can enter the certificate path here. -# Certificates are stored in a dedicated database (split into 3 files). +# Certificates are stored in a dedicated database (splitted in 3 files). # Specify the path of the database directory. -# +# # See 'docs/security.txt' or the Security chapter of NUT user manual # for more information on the SSL support in NUT. @@ -115,7 +88,7 @@ # you can specify the certificate name to retrieve from database to # authenticate itself and the password # required to access certificate related private key. -# +# # See 'docs/security.txt' or the Security chapter of NUT user manual # for more information on the SSL support in NUT. @@ -130,39 +103,7 @@ # - 0 to not request to clients to provide any certificate # - 1 to require to all clients a certificate # - 2 to require to all clients a valid certificate -# +# # See 'docs/security.txt' or the Security chapter of NUT user manual # for more information on the SSL support in NUT. -# ======================================================================= -# DISABLE_WEAK_SSL -# DISABLE_WEAK_SSL true -# -# Tell upsd to disable older/weak SSL/TLS protocols and ciphers. -# -# With relatively recent versions of OpenSSL or NSS it will be restricted -# to TLSv1.2 or better. -# -# Unless you have really ancient clients, you probably want to enable this. -# Currently disabled by default to ensure compatibility with existing setups. - -# ======================================================================= -# DEBUG_MIN -# DEBUG_MIN 2 -# -# Optionally specify a minimum debug level for `upsd` data daemon, e.g. for -# troubleshooting a deployment, without impacting foreground or background -# running mode directly, and without need to edit init-scripts or service -# unit definitions. Note that command-line option `-D` can only increase -# this verbosity level. -# -# NOTE: if the running daemon receives a `reload` command, presence of the -# `DEBUG_MIN NUMBER` value in the configuration file can be used to tune -# debugging verbosity in the running service daemon (it is recommended to -# comment it away or set the minimum to explicit zero when done, to avoid -# huge journals and I/O system abuse). Keep in mind that for this run-time -# tuning, the `DEBUG_MIN` value *present* in *reloaded* configuration files -# is applied instantly and overrides any previously set value, from file -# or CLI options, regardless of older logging level being higher or lower -# than the newly found number; a missing (or commented away) value however -# does not change the previously active logging verbosity. diff --git a/conf/upsd.users.sample b/conf/upsd.users.sample index c6b9f36..ec78eb5 100644 --- a/conf/upsd.users.sample +++ b/conf/upsd.users.sample @@ -18,25 +18,25 @@ # # -------------------------------------------------------------------------- # -# actions: Let the user do certain things with upsd. -# +# actions: Let the user do certain things with upsd. +# # Valid actions are: # -# SET - change the value of certain variables in the UPS +# SET - change the value of certain variables in the UPS # FSD - set the "forced shutdown" flag in the UPS -# +# # -------------------------------------------------------------------------- # # instcmds: Let the user initiate specific instant commands. Use "ALL" -# to grant all commands automatically. There are many possible +# to grant all commands automatically. There are many possible # commands, so use 'upscmd -l' to see what your hardware supports. Here # are a few examples: # -# test.panel.start - Start a front panel test -# test.battery.start - Start battery test -# test.battery.stop - Stop battery test -# calibrate.start - Start calibration -# calibrate.stop - Stop calibration +# test.panel.start - Start a front panel test +# test.battery.start - Start battery test +# test.battery.stop - Stop battery test +# calibrate.start - Start calibration +# calibrate.stop - Stop calibration # # -------------------------------------------------------------------------- # @@ -61,15 +61,12 @@ # # To add a user for your upsmon, use this example: # -# [upsmon] -# password = pass -# upsmon primary +# [upsmon] +# password = pass +# upsmon master # or -# upsmon secondary +# upsmon slave # # The matching MONITOR line in your upsmon.conf would look like this: # -# MONITOR myups@localhost 1 upsmon pass primary (or secondary) -# -# See comments in the upsmon.conf(.sample) file for details about this -# keyword and the difference of NUT secondary and primary systems. +# MONITOR myups@localhost 1 upsmon pass master (or slave) diff --git a/conf/upsmon.conf.sample b/conf/upsmon.conf.sample new file mode 100644 index 0000000..10f378a --- /dev/null +++ b/conf/upsmon.conf.sample @@ -0,0 +1,377 @@ +# Network UPS Tools: example upsmon configuration +# +# This file contains passwords, so keep it secure. + +# -------------------------------------------------------------------------- +# RUN_AS_USER +# +# By default, upsmon splits into two processes. One stays as root and +# waits to run the SHUTDOWNCMD. The other one switches to another userid +# and does everything else. +# +# The default nonprivileged user is set at compile-time with +# 'configure --with-user=...'. +# +# You can override it with '-u ' when starting upsmon, or just +# define it here for convenience. +# +# Note: if you plan to use the reload feature, this file (upsmon.conf) +# must be readable by this user! Since it contains passwords, DO NOT +# make it world-readable. Also, do not make it writable by the upsmon +# user, since it creates an opportunity for an attack by changing the +# SHUTDOWNCMD to something malicious. +# +# For best results, you should create a new normal user like "nutmon", +# and make it a member of a "nut" group or similar. Then specify it +# here and grant read access to the upsmon.conf for that group. +# +# This user should not have write access to upsmon.conf. +# +# RUN_AS_USER nobody + +# -------------------------------------------------------------------------- +# MONITOR ("master"|"slave") +# +# List systems you want to monitor. Not all of these may supply power +# to the system running upsmon, but if you want to watch it, it has to +# be in this section. +# +# You must have at least one of these declared. +# +# is a UPS identifier in the form @[:] +# like ups@localhost, su700@mybox, etc. +# +# Examples: +# +# - "su700@mybox" means a UPS called "su700" on a system called "mybox" +# +# - "fenton@bigbox:5678" is a UPS called "fenton" on a system called +# "bigbox" which runs upsd on port "5678". +# +# The UPS names like "su700" and "fenton" are set in your ups.conf +# in [brackets] which identify a section for a particular driver. +# +# If the ups.conf on host "doghouse" has a section called "snoopy", the +# identifier for it would be "snoopy@doghouse". +# +# is an integer - the number of power supplies that this UPS +# feeds on this system. Most computers only have one power supply, so this +# is normally set to 1. You need a pretty big or special box to have any +# other value here. +# +# You can also set this to 0 for a system that doesn't supply any power, +# but you still want to monitor. Use this when you want to hear about +# changes for a given UPS without shutting down when it goes critical, +# unless is 0. +# +# and must match an entry in that system's +# upsd.users. If your username is "monmaster" and your password is +# "blah", the upsd.users would look like this: +# +# [monmaster] +# password = blah +# upsmon master (or slave) +# +# "master" means this system will shutdown last, allowing the slaves +# time to shutdown first. +# +# "slave" means this system shuts down immediately when power goes critical. +# +# Examples: +# +# MONITOR myups@bigserver 1 monmaster blah master +# MONITOR su700@server.example.com 1 upsmon secretpass slave +# MONITOR myups@localhost 1 upsmon pass master (or slave) + +# -------------------------------------------------------------------------- +# MINSUPPLIES +# +# Give the number of power supplies that must be receiving power to keep +# this system running. Most systems have one power supply, so you would +# put "1" in this field. +# +# Large/expensive server type systems usually have more, and can run with +# a few missing. The HP NetServer LH4 can run with 2 out of 4, for example, +# so you'd set that to 2. The idea is to keep the box running as long +# as possible, right? +# +# Obviously you have to put the redundant supplies on different UPS circuits +# for this to make sense! See big-servers.txt in the docs subdirectory +# for more information and ideas on how to use this feature. + +MINSUPPLIES 1 + +# -------------------------------------------------------------------------- +# SHUTDOWNCMD "" +# +# upsmon runs this command when the system needs to be brought down. +# +# This should work just about everywhere ... if it doesn't, well, change it. + +SHUTDOWNCMD "/sbin/shutdown -h +0" + +# -------------------------------------------------------------------------- +# NOTIFYCMD +# +# upsmon calls this to send messages when things happen +# +# This command is called with the full text of the message as one argument. +# The environment string NOTIFYTYPE will contain the type string of +# whatever caused this event to happen. +# +# Note that this is only called for NOTIFY events that have EXEC set with +# NOTIFYFLAG. See NOTIFYFLAG below for more details. +# +# Making this some sort of shell script might not be a bad idea. For more +# information and ideas, see docs/scheduling.txt +# +# Example: +# NOTIFYCMD /usr/local/ups/bin/notifyme + +# -------------------------------------------------------------------------- +# POLLFREQ +# +# Polling frequency for normal activities, measured in seconds. +# +# Adjust this to keep upsmon from flooding your network, but don't make +# it too high or it may miss certain short-lived power events. + +POLLFREQ 5 + +# -------------------------------------------------------------------------- +# POLLFREQALERT +# +# Polling frequency in seconds while UPS on battery. +# +# You can make this number lower than POLLFREQ, which will make updates +# faster when any UPS is running on battery. This is a good way to tune +# network load if you have a lot of these things running. +# +# The default is 5 seconds for both this and POLLFREQ. + +POLLFREQALERT 5 + +# -------------------------------------------------------------------------- +# HOSTSYNC - How long upsmon will wait before giving up on another upsmon +# +# The master upsmon process uses this number when waiting for slaves to +# disconnect once it has set the forced shutdown (FSD) flag. If they +# don't disconnect after this many seconds, it goes on without them. +# +# Similarly, upsmon slave processes wait up to this interval for the +# master upsmon to set FSD when a UPS they are monitoring goes critical - +# that is, on battery and low battery. If the master doesn't do its job, +# the slaves will shut down anyway to avoid damage to the file systems. +# +# This "wait for FSD" is done to avoid races where the status changes +# to critical and back between polls by the master. + +HOSTSYNC 15 + +# -------------------------------------------------------------------------- +# DEADTIME - Interval to wait before declaring a stale ups "dead" +# +# upsmon requires a UPS to provide status information every few seconds +# (see POLLFREQ and POLLFREQALERT) to keep things updated. If the status +# fetch fails, the UPS is marked stale. If it stays stale for more than +# DEADTIME seconds, the UPS is marked dead. +# +# A dead UPS that was last known to be on battery is assumed to have gone +# to a low battery condition. This may force a shutdown if it is providing +# a critical amount of power to your system. +# +# Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT. +# Otherwise you'll have "dead" UPSes simply because upsmon isn't polling +# them quickly enough. Rule of thumb: take the larger of the two +# POLLFREQ values, and multiply by 3. + +DEADTIME 15 + +# -------------------------------------------------------------------------- +# POWERDOWNFLAG - Flag file for forcing UPS shutdown on the master system +# +# upsmon will create a file with this name in master mode when it's time +# to shut down the load. You should check for this file's existence in +# your shutdown scripts and run 'upsdrvctl shutdown' if it exists. +# +# See the shutdown.txt file in the docs subdirectory for more information. + +POWERDOWNFLAG /usr/local/ups/etc/killpower + +# -------------------------------------------------------------------------- +# NOTIFYMSG - change messages sent by upsmon when certain events occur +# +# You can change the default messages to something else if you like. +# +# NOTIFYMSG "message" +# +# NOTIFYMSG ONLINE "UPS %s on line power" +# NOTIFYMSG ONBATT "UPS %s on battery" +# NOTIFYMSG LOWBATT "UPS %s battery is low" +# NOTIFYMSG FSD "UPS %s: forced shutdown in progress" +# NOTIFYMSG COMMOK "Communications with UPS %s established" +# NOTIFYMSG COMMBAD "Communications with UPS %s lost" +# NOTIFYMSG SHUTDOWN "Auto logout and shutdown proceeding" +# NOTIFYMSG REPLBATT "UPS %s battery needs to be replaced" +# NOTIFYMSG NOCOMM "UPS %s is unavailable" +# NOTIFYMSG NOPARENT "upsmon parent process died - shutdown impossible" +# +# Note that %s is replaced with the identifier of the UPS in question. +# +# Possible values for : +# +# ONLINE : UPS is back online +# ONBATT : UPS is on battery +# LOWBATT : UPS has a low battery (if also on battery, it's "critical") +# FSD : UPS is being shutdown by the master (FSD = "Forced Shutdown") +# COMMOK : Communications established with the UPS +# COMMBAD : Communications lost to the UPS +# SHUTDOWN : The system is being shutdown +# REPLBATT : The UPS battery is bad and needs to be replaced +# NOCOMM : A UPS is unavailable (can't be contacted for monitoring) +# NOPARENT : The process that shuts down the system has died (shutdown impossible) + +# -------------------------------------------------------------------------- +# NOTIFYFLAG - change behavior of upsmon when NOTIFY events occur +# +# By default, upsmon sends walls (global messages to all logged in users) +# and writes to the syslog when things happen. You can change this. +# +# NOTIFYFLAG [+][+] ... +# +# NOTIFYFLAG ONLINE SYSLOG+WALL +# NOTIFYFLAG ONBATT SYSLOG+WALL +# NOTIFYFLAG LOWBATT SYSLOG+WALL +# NOTIFYFLAG FSD SYSLOG+WALL +# NOTIFYFLAG COMMOK SYSLOG+WALL +# NOTIFYFLAG COMMBAD SYSLOG+WALL +# NOTIFYFLAG SHUTDOWN SYSLOG+WALL +# NOTIFYFLAG REPLBATT SYSLOG+WALL +# NOTIFYFLAG NOCOMM SYSLOG+WALL +# NOTIFYFLAG NOPARENT SYSLOG+WALL +# +# Possible values for the flags: +# +# SYSLOG - Write the message in the syslog +# WALL - Write the message to all users on the system +# EXEC - Execute NOTIFYCMD (see above) with the message +# IGNORE - Don't do anything +# +# If you use IGNORE, don't use any other flags on the same line. + +# -------------------------------------------------------------------------- +# RBWARNTIME - replace battery warning time in seconds +# +# upsmon will normally warn you about a battery that needs to be replaced +# every 43200 seconds, which is 12 hours. It does this by triggering a +# NOTIFY_REPLBATT which is then handled by the usual notify structure +# you've defined above. +# +# If this number is not to your liking, override it here. + +RBWARNTIME 43200 + +# -------------------------------------------------------------------------- +# NOCOMMWARNTIME - no communications warning time in seconds +# +# upsmon will let you know through the usual notify system if it can't +# talk to any of the UPS entries that are defined in this file. It will +# trigger a NOTIFY_NOCOMM by default every 300 seconds unless you +# change the interval with this directive. + +NOCOMMWARNTIME 300 + +# -------------------------------------------------------------------------- +# FINALDELAY - last sleep interval before shutting down the system +# +# On a master, upsmon will wait this long after sending the NOTIFY_SHUTDOWN +# before executing your SHUTDOWNCMD. If you need to do something in between +# those events, increase this number. Remember, at this point your UPS is +# almost depleted, so don't make this too high. +# +# Alternatively, you can set this very low so you don't wait around when +# it's time to shut down. Some UPSes don't give much warning for low +# battery and will require a value of 0 here for a safe shutdown. +# +# Note: If FINALDELAY on the slave is greater than HOSTSYNC on the master, +# the master will give up waiting for the slave to disconnect. + +FINALDELAY 5 + +# -------------------------------------------------------------------------- +# CERTPATH - path to certificates (database directory or directory with CA's) +# +# When compiled with SSL support, you can enter the certificate path here. +# +# With NSS: +# Certificates are stored in a dedicated database (splitted in 3 files). +# Specify the path of the database directory. +# +# CERTPATH /usr/local/ups/etc/cert/upsmon +# +# With OpenSSL: +# Directory containing CA certificates in PEM format, used to verify +# the server certificate presented by the upsd server. The files each +# contain one CA certificate. The files are looked up by the CA subject +# name hash value, which must hence be available. +# +# CERTPATH /usr/ssl/certs +# +# See 'docs/security.txt' or the Security chapter of NUT user manual +# for more information on the SSL support in NUT. + +# -------------------------------------------------------------------------- +# CERTIDENT - self certificate name and database password +# CERTIDENT +# +# When compiled with SSL support with NSS, you can specify the certificate +# name to retrieve from database to authenticate itself and the password +# required to access certificate related private key. +# +# CERTIDENT "my nut monitor" "MyPasSw0rD" +# +# See 'docs/security.txt' or the Security chapter of NUT user manual +# for more information on the SSL support in NUT. + +# -------------------------------------------------------------------------- +# CERTHOST - security properties for an host +# CERTHOST +# +# When compiled with SSL support with NSS, you can specify security directive +# for each server you can contact. +# Each entry maps server name with the expected certificate name and flags +# indicating if the server certificate is verified and if the connection +# must be secure. +# +# CERTHOST localhost "My nut server" 1 1 +# +# See 'docs/security.txt' or the Security chapter of NUT user manual +# for more information on the SSL support in NUT. + +# -------------------------------------------------------------------------- +# CERTVERIFY - make upsmon verify all connections with certificates +# CERTVERIFY 1 +# +# When compiled with SSL support, make upsmon verify all connections with +# certificates. +# Without this, there is no guarantee that the upsd is the right host. +# Enabling this greatly reduces the risk of man in the middle attacks. +# This effectively forces the use of SSL, so don't use this unless +# all of your upsd hosts are ready for SSL and have their certificates +# in order. +# When compiled with NSS support of SSL, can be overriden for host +# specified with a CERTHOST directive. + + +# -------------------------------------------------------------------------- +# FORCESSL - force upsmon to use SSL +# FORCESSL 1 +# +# When compiled with SSL, specify that a secured connection must be used +# to communicate with upsd. +# If you don't use 'CERTVERIFY 1', then this will at least make sure +# that nobody can sniff your sessions without a large effort. Setting +# this will make upsmon drop connections if the remote upsd doesn't +# support SSL, so don't use it unless all of them have it running. +# When compiled with NSS support of SSL, can be overriden for host +# specified with a CERTHOST directive. diff --git a/conf/upsmon.conf.sample.in b/conf/upsmon.conf.sample.in index aeec849..6bb6a04 100644 --- a/conf/upsmon.conf.sample.in +++ b/conf/upsmon.conf.sample.in @@ -9,9 +9,9 @@ # waits to run the SHUTDOWNCMD. The other one switches to another userid # and does everything else. # -# The default unprivileged user is set at compile-time with the option -# 'configure --with-user=...' -# +# The default nonprivileged user is set at compile-time with +# 'configure --with-user=...'. +# # You can override it with '-u ' when starting upsmon, or just # define it here for convenience. # @@ -30,19 +30,19 @@ # RUN_AS_USER @RUN_AS_USER@ # -------------------------------------------------------------------------- -# MONITOR ("primary"|"secondary") +# MONITOR ("master"|"slave") # # List systems you want to monitor. Not all of these may supply power # to the system running upsmon, but if you want to watch it, it has to # be in this section. -# +# # You must have at least one of these declared. # # is a UPS identifier in the form @[:] # like ups@localhost, su700@mybox, etc. -# +# # Examples: -# +# # - "su700@mybox" means a UPS called "su700" on a system called "mybox" # # - "fenton@bigbox:5678" is a UPS called "fenton" on a system called @@ -54,67 +54,34 @@ # If the ups.conf on host "doghouse" has a section called "snoopy", the # identifier for it would be "snoopy@doghouse". # -# is an integer - the number of power supplies that this UPS -# feeds on this system. Most personal computers only have one power supply, -# so this value is normally set to 1, while most modern servers have at least -# two. You need a pretty big or special box to have any other value here. +# is an integer - the number of power supplies that this UPS +# feeds on this system. Most computers only have one power supply, so this +# is normally set to 1. You need a pretty big or special box to have any +# other value here. # -# You can also set this to 0 for a system that doesn't take any power -# from the MONITORed supply, which you still want to monitor (e.g. for an -# administrative workstation fed from a different circuit than the datacenter -# servers it monitors). Use if 0 when you want to hear about -# changes for a given UPS without shutting down when it goes critical. +# You can also set this to 0 for a system that doesn't supply any power, +# but you still want to monitor. Use this when you want to hear about +# changes for a given UPS without shutting down when it goes critical, +# unless is 0. # # and must match an entry in that system's -# upsd.users. If your username is "upsmon" and your password is +# upsd.users. If your username is "monmaster" and your password is # "blah", the upsd.users would look like this: # -# [upsmon] +# [monmaster] # password = blah -# upsmon primary # (or secondary) +# upsmon master (or slave) +# +# "master" means this system will shutdown last, allowing the slaves +# time to shutdown first. # -# "primary" means this system will shutdown last, allowing the secondary -# systems time to shutdown first. +# "slave" means this system shuts down immediately when power goes critical. # -# "secondary" means this system shuts down immediately when power goes -# critical and less than MINSUPPLIES power sources have reliable input feeds. +# Examples: # -# The general assumption is that the "primary" system is the one with direct -# connection to an UPS (such as serial or USB cable), so the primary system -# runs the NUT driver and 'upsd' server locally and can manage the device, -# and it would often tell the UPS to completely power itself off as a step -# in power-race avoidance (see POWERDOWNFLAG for details). -# -# Also, since the primary system stays up the longest, it suffers higher risks -# of ungraceful shutdown if the estimation of remaining runtime (or of the -# time it takes to shut down this system) was guessed wrong. By consequence, -# the "secondary" systems typically monitor the power environment state -# through the 'upsd' processes running on the remote (often "primary") systems -# and do not directly interact with an UPS (no local NUT drivers are running -# on the secondary systems). As such, secondaries typically shut down as -# soon as there is a sufficiently long power outage, or a low-battery alert -# from the UPS, or a loss of connection to the primary while the power was -# last known to be missing. -# -# This assumption and configuration can also make sense for networked UPSes, -# where a rack full of servers might overload the communications capacity -# of the networked management card on the UPS - in this case you might either -# reduce the 'snmp-ups' or 'netxml-ups' driver polling rate, or dedicate a -# "primary" server and set up the rest as "secondary" systems. -# -# In case of such large setups as mentioned above, beware also that shutdown -# times of the rack done all at once can substantially differ from smaller -# scale experiments with single-server shutdowns, since systems can compete -# for shared storage and other limited resources as they go down (and also -# not everyone may safely shut down simultaneously - e.g. a NAS or DB server -# would better go down after all its clients). You would be well served by -# higher-end UPSes with manageable thresholds to declare a critical state. -# -# Examples: -# -# MONITOR myups@bigserver 1 upswired blah primary -# MONITOR su700@server.example.com 1 upsmon secretpass secondary -# MONITOR myups@localhost 1 upsmon pass primary # (or secondary) +# MONITOR myups@bigserver 1 monmaster blah master +# MONITOR su700@server.example.com 1 upsmon secretpass slave +# MONITOR myups@localhost 1 upsmon pass master (or slave) # -------------------------------------------------------------------------- # MINSUPPLIES @@ -124,7 +91,7 @@ # put "1" in this field. # # Large/expensive server type systems usually have more, and can run with -# a few missing. Some of these can run with 2 out of 4, for example, +# a few missing. The HP NetServer LH4 can run with 2 out of 4, for example, # so you'd set that to 2. The idea is to keep the box running as long # as possible, right? # @@ -139,15 +106,7 @@ MINSUPPLIES 1 # # upsmon runs this command when the system needs to be brought down. # -# This should work just about everywhere ... if it doesn't, well, change it, -# perhaps to a more complicated custom script. -# -# Note that while you experiment with the initial setup and want to test how -# your configuration reacts to power state changes and ultimately when power -# is reported to go critical, but do not want your system to actually turn -# off, consider setting the SHUTDOWNCMD temporarily to do something benign - -# such as posting a message with 'logger' or 'wall' or 'mailx'. Do be careful -# to plug the UPS back into the wall in a timely fashion. +# This should work just about everywhere ... if it doesn't, well, change it. SHUTDOWNCMD "/sbin/shutdown -h +0" @@ -156,32 +115,25 @@ SHUTDOWNCMD "/sbin/shutdown -h +0" # # upsmon calls this to send messages when things happen # -# This command is called with the full text of the message (from NOTIFYMSG) -# as one argument. -# +# This command is called with the full text of the message as one argument. # The environment string NOTIFYTYPE will contain the type string of # whatever caused this event to happen. # -# The environment string UPSNAME will contain the name of the system/device -# that generated the change. -# # Note that this is only called for NOTIFY events that have EXEC set with # NOTIFYFLAG. See NOTIFYFLAG below for more details. # -# Making this some sort of shell script might not be a bad idea. -# Alternately you can use the upssched program as your NOTIFYCMD for some -# more complex setups (e.g. to ease handling of notification storms). -# For more information and ideas, see docs/scheduling.txt +# Making this some sort of shell script might not be a bad idea. For more +# information and ideas, see docs/scheduling.txt # # Example: # NOTIFYCMD @BINDIR@/notifyme # -------------------------------------------------------------------------- -# POLLFREQ +# POLLFREQ # # Polling frequency for normal activities, measured in seconds. # -# Adjust this to keep upsmon from flooding your network, but don't make +# Adjust this to keep upsmon from flooding your network, but don't make # it too high or it may miss certain short-lived power events. POLLFREQ 5 @@ -192,8 +144,8 @@ POLLFREQ 5 # Polling frequency in seconds while UPS on battery. # # You can make this number lower than POLLFREQ, which will make updates -# faster when any UPS is running on battery. This is a good way to tune -# network load if you have a lot of these things running. +# faster when any UPS is running on battery. This is a good way to tune +# network load if you have a lot of these things running. # # The default is 5 seconds for both this and POLLFREQ. @@ -202,17 +154,17 @@ POLLFREQALERT 5 # -------------------------------------------------------------------------- # HOSTSYNC - How long upsmon will wait before giving up on another upsmon # -# The primary upsmon process uses this number when waiting for secondary -# systems to disconnect once it has set the forced shutdown (FSD) flag. -# If they don't disconnect after this many seconds, it goes on without them. +# The master upsmon process uses this number when waiting for slaves to +# disconnect once it has set the forced shutdown (FSD) flag. If they +# don't disconnect after this many seconds, it goes on without them. # -# Similarly, upsmon secondary processes wait up to this interval for the -# primary upsmon to set FSD when an UPS they are monitoring goes critical - -# that is, on battery and low battery. If the primary doesn't do its job, -# the secondaries will shut down anyway to avoid damage to the file systems. +# Similarly, upsmon slave processes wait up to this interval for the +# master upsmon to set FSD when a UPS they are monitoring goes critical - +# that is, on battery and low battery. If the master doesn't do its job, +# the slaves will shut down anyway to avoid damage to the file systems. # # This "wait for FSD" is done to avoid races where the status changes -# to critical and back between polls by the primary. +# to critical and back between polls by the master. HOSTSYNC 15 @@ -236,19 +188,15 @@ HOSTSYNC 15 DEADTIME 15 # -------------------------------------------------------------------------- -# POWERDOWNFLAG - Flag file for forcing UPS shutdown on the primary system +# POWERDOWNFLAG - Flag file for forcing UPS shutdown on the master system # -# upsmon will create a file with this name in primary mode when it's time +# upsmon will create a file with this name in master mode when it's time # to shut down the load. You should check for this file's existence in -# your shutdown scripts and run 'upsdrvctl shutdown' if it exists, to tell -# the UPS(es) to power off. +# your shutdown scripts and run 'upsdrvctl shutdown' if it exists. # -# See the config-notes.txt file in the docs subdirectory for more information. -# Refer to the section: -# [[UPS_shutdown]] "Configuring automatic shutdowns for low battery events" -# or refer to the online version. +# See the shutdown.txt file in the docs subdirectory for more information. -POWERDOWNFLAG /etc/killpower +POWERDOWNFLAG @CONFPATH@/killpower # -------------------------------------------------------------------------- # NOTIFYMSG - change messages sent by upsmon when certain events occur @@ -275,7 +223,7 @@ POWERDOWNFLAG /etc/killpower # ONLINE : UPS is back online # ONBATT : UPS is on battery # LOWBATT : UPS has a low battery (if also on battery, it's "critical") -# FSD : UPS is being shutdown by the primary (FSD = "Forced Shutdown") +# FSD : UPS is being shutdown by the master (FSD = "Forced Shutdown") # COMMOK : Communications established with the UPS # COMMBAD : Communications lost to the UPS # SHUTDOWN : The system is being shutdown @@ -304,7 +252,7 @@ POWERDOWNFLAG /etc/killpower # # Possible values for the flags: # -# SYSLOG - Write the message in the syslog +# SYSLOG - Write the message in the syslog # WALL - Write the message to all users on the system # EXEC - Execute NOTIFYCMD (see above) with the message # IGNORE - Don't do anything @@ -318,7 +266,7 @@ POWERDOWNFLAG /etc/killpower # every 43200 seconds, which is 12 hours. It does this by triggering a # NOTIFY_REPLBATT which is then handled by the usual notify structure # you've defined above. -# +# # If this number is not to your liking, override it here. RBWARNTIME 43200 @@ -328,7 +276,7 @@ RBWARNTIME 43200 # # upsmon will let you know through the usual notify system if it can't # talk to any of the UPS entries that are defined in this file. It will -# trigger a NOTIFY_NOCOMM by default every 300 seconds unless you +# trigger a NOTIFY_NOCOMM by default every 300 seconds unless you # change the interval with this directive. NOCOMMWARNTIME 300 @@ -336,20 +284,17 @@ NOCOMMWARNTIME 300 # -------------------------------------------------------------------------- # FINALDELAY - last sleep interval before shutting down the system # -# On a primary, upsmon will wait this long after sending the NOTIFY_SHUTDOWN +# On a master, upsmon will wait this long after sending the NOTIFY_SHUTDOWN # before executing your SHUTDOWNCMD. If you need to do something in between -# those events, increase this number. Remember, at this point your UPS is -# almost depleted, so don't make this too high. If needed, on high-end UPS -# devices you can usually configure when the low-battery state is announced -# based on estimated remaining run-time or on charge level of the batteries. +# those events, increase this number. Remember, at this point your UPS is +# almost depleted, so don't make this too high. # # Alternatively, you can set this very low so you don't wait around when # it's time to shut down. Some UPSes don't give much warning for low # battery and will require a value of 0 here for a safe shutdown. # -# Note: If FINALDELAY on the secondary is greater than HOSTSYNC on the -# primary, the primary will give up waiting for that secondary system -# to disconnect. +# Note: If FINALDELAY on the slave is greater than HOSTSYNC on the master, +# the master will give up waiting for the slave to disconnect. FINALDELAY 5 @@ -359,9 +304,9 @@ FINALDELAY 5 # When compiled with SSL support, you can enter the certificate path here. # # With NSS: -# Certificates are stored in a dedicated database (split into 3 files). +# Certificates are stored in a dedicated database (splitted in 3 files). # Specify the path of the database directory. -# +# # CERTPATH @CONFPATH@/cert/upsmon # # With OpenSSL: @@ -371,7 +316,7 @@ FINALDELAY 5 # name hash value, which must hence be available. # # CERTPATH /usr/ssl/certs -# +# # See 'docs/security.txt' or the Security chapter of NUT user manual # for more information on the SSL support in NUT. @@ -384,7 +329,7 @@ FINALDELAY 5 # required to access certificate related private key. # # CERTIDENT "my nut monitor" "MyPasSw0rD" -# +# # See 'docs/security.txt' or the Security chapter of NUT user manual # for more information on the SSL support in NUT. @@ -407,14 +352,14 @@ FINALDELAY 5 # CERTVERIFY - make upsmon verify all connections with certificates # CERTVERIFY 1 # -# When compiled with SSL support, make upsmon verify all connections with +# When compiled with SSL support, make upsmon verify all connections with # certificates. # Without this, there is no guarantee that the upsd is the right host. # Enabling this greatly reduces the risk of man in the middle attacks. # This effectively forces the use of SSL, so don't use this unless # all of your upsd hosts are ready for SSL and have their certificates # in order. -# When compiled with NSS support of SSL, can be overridden for host +# When compiled with NSS support of SSL, can be overriden for host # specified with a CERTHOST directive. @@ -428,26 +373,5 @@ FINALDELAY 5 # that nobody can sniff your sessions without a large effort. Setting # this will make upsmon drop connections if the remote upsd doesn't # support SSL, so don't use it unless all of them have it running. -# When compiled with NSS support of SSL, can be overridden for host +# When compiled with NSS support of SSL, can be overriden for host # specified with a CERTHOST directive. - -# -------------------------------------------------------------------------- -# DEBUG_MIN - specify minimal debugging level for upsmon daemon -# e.g. DEBUG_MIN 6 -# -# Optionally specify a minimum debug level for `upsmon` daemon, e.g. for -# troubleshooting a deployment, without impacting foreground or background -# running mode directly, and without need to edit init-scripts or service -# unit definitions. Note that command-line option `-D` can only increase -# this verbosity level. -# -# NOTE: if the running daemon receives a `reload` command, presence of the -# `DEBUG_MIN NUMBER` value in the configuration file can be used to tune -# debugging verbosity in the running service daemon (it is recommended to -# comment it away or set the minimum to explicit zero when done, to avoid -# huge journals and I/O system abuse). Keep in mind that for this run-time -# tuning, the `DEBUG_MIN` value *present* in *reloaded* configuration files -# is applied instantly and overrides any previously set value, from file -# or CLI options, regardless of older logging level being higher or lower -# than the newly found number; a missing (or commented away) value however -# does not change the previously active logging verbosity. diff --git a/conf/upssched.conf.sample.in b/conf/upssched.conf.sample.in index 541dea8..c7e625d 100644 --- a/conf/upssched.conf.sample.in +++ b/conf/upssched.conf.sample.in @@ -25,7 +25,7 @@ CMDSCRIPT @BINDIR@/upssched-cmd # normal users can't create the file, due to the possibility of symlinking # and other evil. # -# Note: if you are running Solaris or similar, the permissions that +# Note: if you are running Solaris or similar, the permissions that # upssched sets on this file *are not enough* to keep you safe. If # your OS ignores the permissions on a FIFO, then you MUST put this in # a protected directory! @@ -67,9 +67,9 @@ CMDSCRIPT @BINDIR@/upssched-cmd # can be the special value * to apply this handler to every # possible value of . # -# Run the command via your CMDSCRIPT when it happens. +# Run the command via your CMDSCRIPT when it happens. # -# Note that any AT that matches both the and the +# Note that any AT that matches both the and the # for the current event will be used. # ============================================================================ @@ -83,15 +83,9 @@ CMDSCRIPT @BINDIR@/upssched-cmd # argument. # # Example: -# 1) Start a timer that will execute when communication with any UPS (*) has -# been gone for 10 seconds +# Start a timer that'll execute when any UPS (*) has been gone 10 seconds # # AT COMMBAD * START-TIMER upsgone 10 -# -# 2) Start a timer that will execute when any UPS (*) has been running -# on battery for 30 seconds -# -# AT ONBATT * START-TIMER onbattwarn 30 # ----------------------------------------------------------------------- # @@ -101,15 +95,10 @@ CMDSCRIPT @BINDIR@/upssched-cmd # has passed then pass the optional argument to CMDSCRIPT. # # Example: -# 1) If a specific UPS (myups@localhost) communication is restored, then stop -# the timer before it triggers -# +# If a specific UPS (myups@localhost) comes back online, then stop the +# timer before it triggers +# # AT COMMOK myups@localhost CANCEL-TIMER upsgone -# -# 2) If any UPS (*) reverts to utility power, then stop the timer before it -# triggers -# -# AT ONLINE * CANCEL-TIMER onbattwarn # ----------------------------------------------------------------------- # diff --git a/conf/upsset.conf.sample b/conf/upsset.conf.sample index 921a20a..56795ba 100644 --- a/conf/upsset.conf.sample +++ b/conf/upsset.conf.sample @@ -2,12 +2,12 @@ # # This file is provided to ensure that you do not expose your upsd server # to the world upon installing the CGI programs. Specifically, it keeps -# the upsset.cgi program from running until you have assured it that you +# the upsset.cgi program from running until you have assured it that you # have secured your web server's CGI directory. # # By default, your web server will probably let anyone access upsset.cgi # once it is installed. This means that anyone could attempt to crack -# upsd logins since they would appear to be coming from your web server, +# upsd logins since they would appear to be coming from your web server, # rather than the outside world, slipping through any ACL/ACCESS definitions. # # For this reason, you *MUST* first secure your CGI programs before @@ -17,17 +17,17 @@ # For Apache, the .htaccess file can be used in the directory with the # programs. You'll need something like this: # -# -# deny from all -# allow from your.network.addresses -# +# +# deny from all +# allow from your.network.addresses +# # # You will probably have to set "AllowOverride Limit" for this directory in # your server-level configuration file as well. # # If this doesn't make sense, then stop reading and leave this program alone. # -# Assuming you have all this done (and it works), then you may uncomment +# Assuming you have all this done (and it works), then you may uncomment # the line below and start using upsset.cgi through your web browser. # diff --git a/conf/upsstats-single.html.sample b/conf/upsstats-single.html.sample index 4c2a6a8..4d34421 100644 --- a/conf/upsstats-single.html.sample +++ b/conf/upsstats-single.html.sample @@ -17,8 +17,8 @@ @UPSSTATSPATH upsstats.cgi@ @UPSIMAGEPATH upsimage.cgi@ - + @@ -26,16 +26,10 @@ @REFRESH@ @HOSTDESC@ : @VAR ups.model@ on @HOST@ - - + -
\n"); @@ -914,12 +910,12 @@ static void display_tree(int verbose) if (numa < 4) { if (verbose) printf("[Invalid response]\n"); - + return; } printf("
%s:%s
+
@@ -57,7 +51,7 @@ table{background:#000;} -","
Network UPS Tools upsstats @VERSION@ - @HOSTDESC@ - @VAR ups.model@ on @HOST@
+ @@ -201,7 +195,7 @@ table{background:#000;} @IFSUPP ambient.temperature@ @IFSUPP ambient.humidity@ -","
+ @@ -209,21 +203,21 @@ table{background:#000;} @ELSE@ @IFSUPP ambient.temperature@ - @ELSE@ @IFSUPP ambient.humidity@ - @ENDIF@ - - - - - -
Temperature
@IMG ambient.temperature tempmin=0 tempmax=50 width=90@
Humidity
@IMG ambient.humidity width=90@
+
Temperature
@IMG ambient.temperature tempmin=0 tempmax=50@
+
Humidity
@IMG ambient.humidity@
+ @IFSUPP battery.charge@ @IFSUPP battery.voltage@ @@ -238,7 +232,7 @@ table{background:#000;}
+ @IFSUPP input.L2-L3.voltage@ @@ -255,7 +249,7 @@ table{background:#000;}
L1-L2
@IMG input.L1-L2.voltage width=68@
+ @IFSUPP output.L2-L3.voltage@ @@ -272,7 +266,7 @@ table{background:#000;}
L1-L2
@IMG output.L1-L2.voltage width=68@
+ @IFSUPP output.L2.power.percent@ @@ -292,12 +286,9 @@ table{background:#000;}
L1
@IMG output.L1.power.percent width=68@
-
Valid CSS -Valid HTML 4.01 Strict
+Valid HTML 4.0 Transitional + diff --git a/conf/upsstats.html.sample b/conf/upsstats.html.sample index 23442e0..e25a829 100644 --- a/conf/upsstats.html.sample +++ b/conf/upsstats.html.sample @@ -1,6 +1,6 @@ - @REFRESH@ - + - +
-
- +
- - + @@ -73,20 +65,20 @@ th, td{padding:0.5ex;} @FOREACHUPS@ - - + - - - - - - - - @@ -188,9 +180,11 @@ th, td{padding:0.5ex;}
+ -Network UPS Tools upsstats +Network UPS Tools upsstats @VERSION@ - +
@DATE %a %b %d %X %Z %Y@ @@ -58,7 +50,7 @@ th, td{padding:0.5ex;}
System Model Status
+
@HOSTLINK@ + @VAR ups.model@ + @STATUS@ + @IFSUPP battery.charge@ @VAR battery.charge@ % @@ -97,18 +89,18 @@ th, td{padding:0.5ex;} @IFBETWEEN input.transfer.low input.transfer.high input.L1-L2.voltage@ @IFBETWEEN input.transfer.low input.transfer.high input.L2-L3.voltage@ @IFBETWEEN input.transfer.low input.transfer.high input.L3-L1.voltage@ - + @ELSE@ @IFSUPP input.L2-N.voltage@ @IFBETWEEN input.transfer.low input.transfer.high input.L1-N.voltage@ @IFBETWEEN input.transfer.low input.transfer.high input.L2-N.voltage@ @IFBETWEEN input.transfer.low input.transfer.high input.L3-N.voltage@ - + @ELSE@ @IFBETWEEN input.transfer.low input.transfer.high input.voltage@ - + @ELSE@ - + @ENDIF@ @IFSUPP input.L2-L3.voltage@ @@ -126,7 +118,7 @@ th, td{padding:0.5ex;} @ENDIF@ + @IFSUPP output.L2-L3.voltage@ @VAR output.L1-L2.voltage@ @VAR output.L2-L3.voltage@ @@ -142,7 +134,7 @@ th, td{padding:0.5ex;} @ENDIF@ + @IFSUPP output.L2.power.percent@ @VAR output.L1.power.percent@ @VAR output.L2.power.percent@ @@ -159,7 +151,7 @@ th, td{padding:0.5ex;} @ENDIF@ + @IFSUPP ups.temperature@ @UPSTEMP@ @DEGREES@ @@ -170,13 +162,13 @@ th, td{padding:0.5ex;} @ENDIF@ + @IFSUPP battery.runtime@ @RUNTIME@ @ENDIF@ + @TREELINK@
-
-Valid CSS! -Valid HTML 4.01 Strict +
+Valid CSS! +
diff --git a/config.guess b/config.guess index f50dcdb..d622a44 100755 --- a/config.guess +++ b/config.guess @@ -1,12 +1,14 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2018-02-24' +timestamp='2012-02-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -15,22 +17,24 @@ timestamp='2018-02-24' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. # -# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. # # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess -# -# Please send patches to . - +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD me=`echo "$0" | sed -e 's,.*/,,'` @@ -39,7 +43,7 @@ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. -Options: +Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -50,7 +54,9 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -107,9 +113,9 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > "$dummy.c" ; + ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do - if ($c -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; @@ -132,37 +138,9 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -case "$UNAME_SYSTEM" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval "$set_cc_for_build" - cat <<-EOF > "$dummy.c" - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`" - - # If ldd exists, use it to detect musl libc. - if command -v ldd >/dev/null && \ - ldd --version 2>&1 | grep -q ^musl - then - LIBC=musl - fi - ;; -esac - # Note: order is significant - the case branches are not exclusive. -case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -175,31 +153,21 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ - "/sbin/$sysctl" 2>/dev/null || \ - "/usr/sbin/$sysctl" 2>/dev/null || \ - echo unknown)` - case "$UNAME_MACHINE_ARCH" in + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; - earmv*) - arch=`echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,'` - endian=`echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p'` - machine="${arch}${endian}"-unknown - ;; - *) machine="$UNAME_MACHINE_ARCH"-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently (or will in the future) and ABI. - case "$UNAME_MACHINE_ARCH" in - earm*) - os=netbsdelf - ;; + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval "$set_cc_for_build" + eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then @@ -214,67 +182,40 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in os=netbsd ;; esac - # Determine ABI tags. - case "$UNAME_MACHINE_ARCH" in - earm*) - expr='s/^earmv[0-9]/-eabi/;s/eb$//' - abi=`echo "$UNAME_MACHINE_ARCH" | sed -e "$expr"` - ;; - esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. - case "$UNAME_VERSION" in + case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) - release=`echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2` + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "$machine-${os}${release}${abi}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + echo "${machine}-${os}${release}" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" - exit ;; - *:LibertyBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` - echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" - exit ;; - *:MidnightBSD:*:*) - echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; *:ekkoBSD:*:*) - echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) - echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + echo powerpc-unknown-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) - echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; - *:Sortix:*:*) - echo "$UNAME_MACHINE"-unknown-sortix - exit ;; - *:Redox:*:*) - echo "$UNAME_MACHINE"-unknown-redox - exit ;; - mips:OSF1:*.*) - echo mips-dec-osf1 - exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -291,54 +232,63 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV4.5 (21064)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "LCA4 (21066/21068)") - UNAME_MACHINE=alpha ;; + UNAME_MACHINE="alpha" ;; "EV5 (21164)") - UNAME_MACHINE=alphaev5 ;; + UNAME_MACHINE="alphaev5" ;; "EV5.6 (21164A)") - UNAME_MACHINE=alphaev56 ;; + UNAME_MACHINE="alphaev56" ;; "EV5.6 (21164PC)") - UNAME_MACHINE=alphapca56 ;; + UNAME_MACHINE="alphapca56" ;; "EV5.7 (21164PC)") - UNAME_MACHINE=alphapca57 ;; + UNAME_MACHINE="alphapca57" ;; "EV6 (21264)") - UNAME_MACHINE=alphaev6 ;; + UNAME_MACHINE="alphaev6" ;; "EV6.7 (21264A)") - UNAME_MACHINE=alphaev67 ;; + UNAME_MACHINE="alphaev67" ;; "EV6.8CB (21264C)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8AL (21264B)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.8CX (21264D)") - UNAME_MACHINE=alphaev68 ;; + UNAME_MACHINE="alphaev68" ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE=alphaev69 ;; + UNAME_MACHINE="alphaev69" ;; "EV7 (21364)") - UNAME_MACHINE=alphaev7 ;; + UNAME_MACHINE="alphaev7" ;; "EV7.9 (21364A)") - UNAME_MACHINE=alphaev79 ;; + UNAME_MACHINE="alphaev79" ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-amigaos + echo ${UNAME_MACHINE}-unknown-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) - echo "$UNAME_MACHINE"-unknown-morphos + echo ${UNAME_MACHINE}-unknown-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition @@ -350,9 +300,9 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix"$UNAME_RELEASE" + echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) + arm:riscos:*:*|arm:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -377,38 +327,38 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) - echo "$UNAME_MACHINE"-ibm-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2"`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`" + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux"$UNAME_RELEASE" + echo i386-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval "$set_cc_for_build" - SUN_ARCH=i386 + eval $set_cc_for_build + SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH=x86_64 + SUN_ARCH="x86_64" fi fi - echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in @@ -417,25 +367,25 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos"`echo "$UNAME_RELEASE"|sed -e 's/-/_/'`" + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit ;; sun3*:SunOS:*:*) - echo m68k-sun-sunos"$UNAME_RELEASE" + echo m68k-sun-sunos${UNAME_RELEASE} exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) - echo m68k-sun-sunos"$UNAME_RELEASE" + echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) - echo sparc-sun-sunos"$UNAME_RELEASE" + echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit ;; aushp:SunOS:*:*) - echo sparc-auspex-sunos"$UNAME_RELEASE" + echo sparc-auspex-sunos${UNAME_RELEASE} exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not @@ -446,44 +396,44 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint"$UNAME_RELEASE" + echo m68k-atari-mint${UNAME_RELEASE} exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint"$UNAME_RELEASE" + echo m68k-milan-mint${UNAME_RELEASE} exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint"$UNAME_RELEASE" + echo m68k-hades-mint${UNAME_RELEASE} exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint"$UNAME_RELEASE" + echo m68k-unknown-mint${UNAME_RELEASE} exit ;; m68k:machten:*:*) - echo m68k-apple-machten"$UNAME_RELEASE" + echo m68k-apple-machten${UNAME_RELEASE} exit ;; powerpc:machten:*:*) - echo powerpc-apple-machten"$UNAME_RELEASE" + echo powerpc-apple-machten${UNAME_RELEASE} exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) - echo mips-dec-ultrix"$UNAME_RELEASE" + echo mips-dec-ultrix${UNAME_RELEASE} exit ;; VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix"$UNAME_RELEASE" + echo vax-dec-ultrix${UNAME_RELEASE} exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix"$UNAME_RELEASE" + echo clipper-intergraph-clix${UNAME_RELEASE} exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { @@ -492,23 +442,23 @@ case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && - dummyarg=`echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`"$dummy" "$dummyarg"` && + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos"$UNAME_RELEASE" + echo mips-mips-riscos${UNAME_RELEASE} exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax @@ -534,17 +484,17 @@ EOF AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ "$UNAME_PROCESSOR" = mc88100 ] || [ "$UNAME_PROCESSOR" = mc88110 ] + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then - if [ "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx ] || \ - [ "$TARGET_BINARY_INTERFACE"x = x ] + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] then - echo m88k-dg-dgux"$UNAME_RELEASE" + echo m88k-dg-dgux${UNAME_RELEASE} else - echo m88k-dg-dguxbcs"$UNAME_RELEASE" + echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else - echo i586-dg-dgux"$UNAME_RELEASE" + echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) @@ -561,7 +511,7 @@ EOF echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) - echo mips-sgi-irix"`echo "$UNAME_RELEASE"|sed -e 's/-/_/g'`" + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id @@ -573,14 +523,14 @@ EOF if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi - echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include main() @@ -591,7 +541,7 @@ EOF exit(0); } EOF - if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` then echo "$SYSTEM_NAME" else @@ -605,27 +555,26 @@ EOF exit ;; *:AIX:*:[4567]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi - if [ -x /usr/bin/lslpp ] ; then - IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | - awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` else - IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi - echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; - ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx @@ -640,28 +589,28 @@ EOF echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - case "$UNAME_MACHINE" in - 9000/31?) HP_ARCH=m68000 ;; - 9000/[34]??) HP_ARCH=m68k ;; + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "$sc_cpu_version" in - 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 - 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 - case "$sc_kernel_bits" in - 32) HP_ARCH=hppa2.0n ;; - 64) HP_ARCH=hppa2.0w ;; - '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi - if [ "$HP_ARCH" = "" ]; then - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include @@ -694,13 +643,13 @@ EOF exit (0); } EOF - (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=`"$dummy"` + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ "$HP_ARCH" = hppa2.0w ] + if [ ${HP_ARCH} = "hppa2.0w" ] then - eval "$set_cc_for_build" + eval $set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler @@ -711,23 +660,23 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH=hppa2.0w + HP_ARCH="hppa2.0w" else - HP_ARCH=hppa64 + HP_ARCH="hppa64" fi fi - echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit ;; ia64:HP-UX:*:*) - HPUX_REV=`echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux"$HPUX_REV" + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} exit ;; 3050*:HI-UX:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #include int main () @@ -752,11 +701,11 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=`"$dummy"` && + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) @@ -765,7 +714,7 @@ EOF *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) @@ -773,9 +722,9 @@ EOF exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then - echo "$UNAME_MACHINE"-unknown-osf1mk + echo ${UNAME_MACHINE}-unknown-osf1mk else - echo "$UNAME_MACHINE"-unknown-osf1 + echo ${UNAME_MACHINE}-unknown-osf1 fi exit ;; parisc*:Lites*:*:*) @@ -800,109 +749,124 @@ EOF echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) - echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) - echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) - echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | sed -e 's/ /_/'` + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` - FUJITSU_REL=`echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi"$UNAME_RELEASE" + echo sparc-unknown-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) - echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` - case "$UNAME_PROCESSOR" in + case ${UNAME_PROCESSOR} in amd64) - UNAME_PROCESSOR=x86_64 ;; - i386) - UNAME_PROCESSOR=i586 ;; + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac - echo "$UNAME_PROCESSOR"-unknown-freebsd"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" exit ;; i*:CYGWIN*:*) - echo "$UNAME_MACHINE"-pc-cygwin - exit ;; - *:MINGW64*:*) - echo "$UNAME_MACHINE"-pc-mingw64 + echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW*:*) - echo "$UNAME_MACHINE"-pc-mingw32 + echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - *:MSYS*:*) - echo "$UNAME_MACHINE"-pc-msys + i*:MSYS*:*) + echo ${UNAME_MACHINE}-pc-msys + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) - echo "$UNAME_MACHINE"-pc-pw32 + echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) - case "$UNAME_MACHINE" in + case ${UNAME_MACHINE} in x86) - echo i586-pc-interix"$UNAME_RELEASE" + echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix"$UNAME_RELEASE" + echo x86_64-unknown-interix${UNAME_RELEASE} exit ;; IA64) - echo ia64-unknown-interix"$UNAME_RELEASE" + echo ia64-unknown-interix${UNAME_RELEASE} exit ;; esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; i*:UWIN*:*) - echo "$UNAME_MACHINE"-pc-uwin + echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-unknown-cygwin exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`" + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; *:GNU:*:*) # the GNU system - echo "`echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,'`-unknown-$LIBC`echo "$UNAME_RELEASE"|sed -e 's,/.*$,,'`" + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo "$UNAME_MACHINE-unknown-`echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`-$LIBC" + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu exit ;; i*86:Minix:*:*) - echo "$UNAME_MACHINE"-pc-minix + echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -915,64 +879,63 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC=gnulibc1 ; fi - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit ;; arm*:Linux:*:*) - eval "$set_cc_for_build" + eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + echo ${UNAME_MACHINE}-unknown-linux-gnueabi else - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + echo ${UNAME_MACHINE}-unknown-linux-gnueabihf fi fi exit ;; avr32*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; cris:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; crisv32:Linux:*:*) - echo "$UNAME_MACHINE"-axis-linux-"$LIBC" - exit ;; - e2k:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-axis-linux-gnu exit ;; frv:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; hexagon:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:Linux:*:*) - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" exit ;; ia64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - k1om:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m32r*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; m68*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; mips:Linux:*:* | mips64:Linux:*:*) - eval "$set_cc_for_build" - sed 's/^ //' << EOF > "$dummy.c" + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el @@ -986,74 +949,55 @@ EOF #endif #endif EOF - eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`" - test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; } + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; - mips64el:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-"$LIBC" - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + or32:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-"$LIBC" + echo sparc-unknown-linux-gnu exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-"$LIBC" + echo hppa64-unknown-linux-gnu exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-"$LIBC" ;; - PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; - *) echo hppa-unknown-linux-"$LIBC" ;; + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-"$LIBC" + echo powerpc64-unknown-linux-gnu exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-"$LIBC" - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-"$LIBC" - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-"$LIBC" - exit ;; - riscv32:Linux:*:* | riscv64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo powerpc-unknown-linux-gnu exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + echo ${UNAME_MACHINE}-ibm-linux exit ;; sh64*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sh*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; tile*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; vax:Linux:*:*) - echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + echo ${UNAME_MACHINE}-dec-linux-gnu exit ;; x86_64:Linux:*:*) - if objdump -f /bin/sh | grep -q elf32-x86-64; then - echo "$UNAME_MACHINE"-pc-linux-"$LIBC"x32 - else - echo "$UNAME_MACHINE"-pc-linux-"$LIBC" - fi + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; xtensa*:Linux:*:*) - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + echo ${UNAME_MACHINE}-unknown-linux-gnu exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1067,34 +1011,34 @@ EOF # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. - echo "$UNAME_MACHINE"-pc-sysv4.2uw"$UNAME_VERSION" + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. - echo "$UNAME_MACHINE"-pc-os2-emx + echo ${UNAME_MACHINE}-pc-os2-emx exit ;; i*86:XTS-300:*:STOP) - echo "$UNAME_MACHINE"-unknown-stop + echo ${UNAME_MACHINE}-unknown-stop exit ;; i*86:atheos:*:*) - echo "$UNAME_MACHINE"-unknown-atheos + echo ${UNAME_MACHINE}-unknown-atheos exit ;; i*86:syllable:*:*) - echo "$UNAME_MACHINE"-pc-syllable + echo ${UNAME_MACHINE}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos"$UNAME_RELEASE" + echo i386-unknown-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) - echo "$UNAME_MACHINE"-pc-msdosdjgpp + echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; - i*86:*:4.*:*) - UNAME_REL=`echo "$UNAME_RELEASE" | sed 's/\/MP$//'` + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else - echo "$UNAME_MACHINE"-pc-sysv"$UNAME_REL" + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; i*86:*:5:[678]*) @@ -1104,12 +1048,12 @@ EOF *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac - echo "$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}" + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 @@ -1119,9 +1063,9 @@ EOF && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 - echo "$UNAME_MACHINE"-pc-sco"$UNAME_REL" + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else - echo "$UNAME_MACHINE"-pc-sysv32 + echo ${UNAME_MACHINE}-pc-sysv32 fi exit ;; pc:*:*:*) @@ -1129,7 +1073,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configure will decide that + # prints for the "djgpp" host, or else GDB configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1141,9 +1085,9 @@ EOF exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) @@ -1163,9 +1107,9 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; @@ -1174,28 +1118,28 @@ EOF test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos"$UNAME_RELEASE" + echo m68k-unknown-lynxos${UNAME_RELEASE} exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos"$UNAME_RELEASE" + echo sparc-unknown-lynxos${UNAME_RELEASE} exit ;; rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos"$UNAME_RELEASE" + echo rs6000-unknown-lynxos${UNAME_RELEASE} exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos"$UNAME_RELEASE" + echo powerpc-unknown-lynxos${UNAME_RELEASE} exit ;; SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv"$UNAME_RELEASE" + echo mips-dde-sysv${UNAME_RELEASE} exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 @@ -1206,7 +1150,7 @@ EOF *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo "$UNAME_MACHINE"-sni-sysv4 + echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi @@ -1226,23 +1170,23 @@ EOF exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. - echo "$UNAME_MACHINE"-stratus-vos + echo ${UNAME_MACHINE}-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) - echo m68k-apple-aux"$UNAME_RELEASE" + echo m68k-apple-aux${UNAME_RELEASE} exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then - echo mips-nec-sysv"$UNAME_RELEASE" + echo mips-nec-sysv${UNAME_RELEASE} else - echo mips-unknown-sysv"$UNAME_RELEASE" + echo mips-unknown-sysv${UNAME_RELEASE} fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. @@ -1257,97 +1201,66 @@ EOF BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-haiku exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; SX-4:SUPER-UX:*:*) - echo sx4-nec-superux"$UNAME_RELEASE" + echo sx4-nec-superux${UNAME_RELEASE} exit ;; SX-5:SUPER-UX:*:*) - echo sx5-nec-superux"$UNAME_RELEASE" + echo sx5-nec-superux${UNAME_RELEASE} exit ;; SX-6:SUPER-UX:*:*) - echo sx6-nec-superux"$UNAME_RELEASE" + echo sx6-nec-superux${UNAME_RELEASE} exit ;; SX-7:SUPER-UX:*:*) - echo sx7-nec-superux"$UNAME_RELEASE" + echo sx7-nec-superux${UNAME_RELEASE} exit ;; SX-8:SUPER-UX:*:*) - echo sx8-nec-superux"$UNAME_RELEASE" + echo sx8-nec-superux${UNAME_RELEASE} exit ;; SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux"$UNAME_RELEASE" - exit ;; - SX-ACE:SUPER-UX:*:*) - echo sxace-nec-superux"$UNAME_RELEASE" + echo sx8r-nec-superux${UNAME_RELEASE} exit ;; Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody"$UNAME_RELEASE" + echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) - echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval "$set_cc_for_build" - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test "`echo "$UNAME_RELEASE" | sed -e 's/\..*//'`" -le 10 ; then - if [ "$CC_FOR_BUILD" != no_compiler_found ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc - if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ - (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_PPC >/dev/null - then - UNAME_PROCESSOR=powerpc - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = x86; then + if test "$UNAME_PROCESSOR" = "x86"; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi - echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} exit ;; *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-*:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk"$UNAME_RELEASE" + NEO-?:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk${UNAME_RELEASE} exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk"$UNAME_RELEASE" + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-*:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSV-*:NONSTOP_KERNEL:*:*) - echo nsv-tandem-nsk"$UNAME_RELEASE" - exit ;; - NSX-*:NONSTOP_KERNEL:*:*) - echo nsx-tandem-nsk"$UNAME_RELEASE" + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux @@ -1356,18 +1269,18 @@ EOF echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) - echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = 386; then + if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi - echo "$UNAME_MACHINE"-unknown-plan9 + echo ${UNAME_MACHINE}-unknown-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 @@ -1388,14 +1301,14 @@ EOF echo pdp10-unknown-its exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux"$UNAME_RELEASE" + echo mips-sei-seiux${UNAME_RELEASE} exit ;; *:DragonFly:*:*) - echo "$UNAME_MACHINE"-unknown-dragonfly"`echo "$UNAME_RELEASE"|sed -e 's/[-(].*//'`" + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; *:*VMS:*:*) UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "$UNAME_MACHINE" in + case "${UNAME_MACHINE}" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; @@ -1404,48 +1317,185 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo "$UNAME_MACHINE"-pc-skyos"`echo "$UNAME_RELEASE" | sed -e 's/ .*$//'`" + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) - echo "$UNAME_MACHINE"-pc-rdos + echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) - echo "$UNAME_MACHINE"-pc-aros + echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) - echo "$UNAME_MACHINE"-unknown-esx - exit ;; - amd64:Isilon\ OneFS:*:*) - echo x86_64-unknown-onefs + echo ${UNAME_MACHINE}-unknown-esx exit ;; esac -echo "$0: unable to guess system type" >&2 +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 -case "$UNAME_MACHINE:$UNAME_SYSTEM" in - mips:Linux | mips64:Linux) - # If we got here on MIPS GNU/Linux, output extra information. - cat >&2 <$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif -NOTE: MIPS GNU/Linux systems require a C compiler to fully recognize -the system type. Please install a C compiler and try again. +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} EOF - ;; -esac + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi cat >&2 < in order to provide the needed +information to handle your system. config.guess timestamp = $timestamp @@ -1464,16 +1514,16 @@ hostinfo = `(hostinfo) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` -UNAME_MACHINE = "$UNAME_MACHINE" -UNAME_RELEASE = "$UNAME_RELEASE" -UNAME_SYSTEM = "$UNAME_SYSTEM" -UNAME_VERSION = "$UNAME_VERSION" +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: -# eval: (add-hook 'write-file-functions 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/config.sub b/config.sub index 1d8e98b..6205f84 100755 --- a/config.sub +++ b/config.sub @@ -1,31 +1,36 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2018 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. -timestamp='2018-02-22' +timestamp='2012-04-18' -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that -# program. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). +# the same distribution terms that you use for the rest of that program. -# Please send patches to . +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -33,7 +38,7 @@ timestamp='2018-02-22' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,11 +58,12 @@ timestamp='2018-02-22' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS Canonicalize a configuration name. -Options: +Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit @@ -67,7 +73,9 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2018 Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, +2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 +Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -94,7 +102,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. - echo "$1" + echo $1 exit ;; * ) @@ -112,24 +120,24 @@ esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ - kopensolaris*-gnu* | cloudabi*-eabi* | \ + linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android - basic_machine=`echo "$1" | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) - basic_machine=`echo "$1" | sed 's/-[^-]*$//'` - if [ "$basic_machine" != "$1" ] - then os=`echo "$1" | sed 's/.*-/-/'` + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac @@ -148,7 +156,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) + -apple | -axis | -knuth | -cray | -microblaze) os= basic_machine=$1 ;; @@ -178,44 +186,44 @@ case $os in ;; -sco6) os=-sco5v6 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 @@ -227,7 +235,10 @@ case $os in os=-lynxos ;; -ptx*) - basic_machine=`echo "$1" | sed -e 's/86-.*/86-sequent/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos @@ -248,25 +259,21 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | ba \ - | be32 | be64 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | be32 | be64 \ | bfin \ - | c4x | c8051 | clipper \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ - | e2k | epiphany \ - | fido | fr30 | frv | ft32 \ + | epiphany \ + | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia16 | ia64 \ + | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ + | maxq | mb | microblaze | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -280,30 +287,26 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ + | nios | nios2 \ | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pj | pjl \ + | open8 \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pru \ | pyramid \ - | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -311,8 +314,7 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | visium \ - | wasm32 \ + | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown @@ -326,14 +328,11 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - leon|leon[3-9]) - basic_machine=sparc-$basic_machine - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65) + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown @@ -362,7 +361,7 @@ case $basic_machine in ;; # Object if more than one company name word. *-*-*) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. @@ -371,29 +370,26 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ - | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | e2k-* | elxsi-* \ + | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -407,34 +403,28 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ + | nios-* | nios2-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ - | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pru-* \ | pyramid-* \ - | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -442,8 +432,6 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ - | visium-* \ - | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -457,7 +445,7 @@ case $basic_machine in # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) - basic_machine=i386-pc + basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) @@ -491,7 +479,7 @@ case $basic_machine in basic_machine=x86_64-pc ;; amd64-*) - basic_machine=x86_64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl @@ -520,9 +508,6 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; - asmjs) - basic_machine=asmjs-unknown - ;; aux) basic_machine=m68k-apple os=-aux @@ -536,7 +521,7 @@ case $basic_machine in os=-linux ;; blackfin-*) - basic_machine=bfin-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) @@ -544,13 +529,13 @@ case $basic_machine in os=-cnk ;; c54x-*) - basic_machine=tic54x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) - basic_machine=tic55x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) - basic_machine=tic6x-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray @@ -639,18 +624,10 @@ case $basic_machine in basic_machine=rs6000-bull os=-bosx ;; - dpx2*) + dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; - e500v[12]) - basic_machine=powerpc-unknown - os=$os"spe" - ;; - e500v[12]-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` - os=$os"spe" - ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -740,6 +717,9 @@ case $basic_machine in hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; + hppa-next) + os=-nextstep3 + ;; hppaosf) basic_machine=hppa1.1-hp os=-osf @@ -752,26 +732,26 @@ case $basic_machine in basic_machine=i370-ibm ;; i*86v32) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) - basic_machine=`echo "$1" | sed -e 's/86.*/86-pc/'` + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; - vsta) + i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; @@ -789,17 +769,17 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; - leon-*|leon[3-9]-*) - basic_machine=sparc-`echo "$basic_machine" | sed 's/-.*//'` - ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) - basic_machine=m68k-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; + m88k-omron*) + basic_machine=m88k-omron + ;; magnum | m3230) basic_machine=mips-mips os=-sysv @@ -808,15 +788,11 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze*) + microblaze) basic_machine=microblaze-xilinx ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; mingw32) - basic_machine=i686-pc + basic_machine=i386-pc os=-mingw32 ;; mingw32ce) @@ -831,10 +807,10 @@ case $basic_machine in os=-mint ;; mips3*-*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'` + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) - basic_machine=`echo "$basic_machine" | sed -e 's/mips3/mips64/'`-unknown + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k @@ -844,19 +820,15 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) - basic_machine=`echo "$basic_machine" | sed -e 's/ms1-/mt-/'` + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i686-pc + basic_machine=i386-pc os=-msys ;; mvs) @@ -895,7 +867,7 @@ case $basic_machine in basic_machine=v70-nec os=-sysv ;; - next | m*-next) + next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) @@ -940,12 +912,6 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; - nsv-tandem) - basic_machine=nsv-tandem - ;; - nsx-tandem) - basic_machine=nsx-tandem - ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -978,7 +944,7 @@ case $basic_machine in os=-linux ;; parisc-*) - basic_machine=hppa-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) @@ -994,7 +960,7 @@ case $basic_machine in basic_machine=i386-pc ;; pc98-*) - basic_machine=i386-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc @@ -1009,16 +975,16 @@ case $basic_machine in basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) - basic_machine=i786-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould @@ -1028,23 +994,23 @@ case $basic_machine in ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) - basic_machine=powerpc-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle) + ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; - ppc64-*) basic_machine=powerpc64-`echo "$basic_machine" | sed 's/^[^-]*-//'` + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little) + ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm @@ -1053,11 +1019,7 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) + rdos) basic_machine=i386-pc os=-rdos ;; @@ -1098,10 +1060,17 @@ case $basic_machine in sequent) basic_machine=i386-sequent ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; sh5el) basic_machine=sh5le-unknown ;; - simso-wrs) + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; @@ -1120,7 +1089,7 @@ case $basic_machine in os=-sysv4 ;; strongarm-* | thumb-*) - basic_machine=arm-`echo "$basic_machine" | sed 's/^[^-]*-//'` + basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun @@ -1242,9 +1211,6 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; - x64) - basic_machine=x86_64-pc - ;; xbox) basic_machine=i686-pc os=-mingw32 @@ -1253,12 +1219,20 @@ case $basic_machine in basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) - basic_machine=`echo "$basic_machine" | sed 's/^xscale/arm/'` + basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; none) basic_machine=none-none os=-none @@ -1287,6 +1261,10 @@ case $basic_machine in vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; @@ -1296,6 +1274,9 @@ case $basic_machine in sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; cydra) basic_machine=cydra-cydrome ;; @@ -1315,7 +1296,7 @@ case $basic_machine in # Make sure to match an already-canonicalized machine name. ;; *) - echo Invalid configuration \`"$1"\': machine \`"$basic_machine"\' not recognized 1>&2 + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac @@ -1323,10 +1304,10 @@ esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) - basic_machine=`echo "$basic_machine" | sed 's/digital.*/dec/'` + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) - basic_machine=`echo "$basic_machine" | sed 's/commodore.*/cbm/'` + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; @@ -1337,8 +1318,8 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases that might get confused - # with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux @@ -1349,48 +1330,45 @@ case $os in -solaris) os=-solaris2 ;; + -svr4*) + os=-sysv4 + ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; - # es1800 is here to avoid being matched by es* (a different OS) - -es1800*) - os=-ose - ;; - # Now accept the basic system types. + # First accept the basic system types. # The portable systems comes first. - # Each alternative MUST end in a * to match a version number. + # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ + | -sym* | -kopensolaris* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* | -cloudabi* | -sortix* \ + | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ + | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* \ + | -mingw32* | -linux-gnu* | -linux-android* \ + | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -windiss* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ - | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox* | -bme* \ - | -midnightbsd*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1407,12 +1385,12 @@ case $os in -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; - -sim | -xray | -os68k* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* \ + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) - os=`echo "$os" | sed -e 's|mac|macos|'` + os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc @@ -1421,10 +1399,10 @@ case $os in os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) - os=`echo "$os" | sed -e 's|sunos5|solaris2|'` + os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) - os=`echo "$os" | sed -e 's|sunos6|solaris3|'` + os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition @@ -1435,6 +1413,12 @@ case $os in -wince*) os=-wince ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; -utek*) os=-bsd ;; @@ -1459,7 +1443,7 @@ case $os in -nova*) os=-rtmk-nova ;; - -ns2) + -ns2 ) os=-nextstep2 ;; -nsk*) @@ -1481,7 +1465,7 @@ case $os in -oss*) os=-sysv3 ;; - -svr4*) + -svr4) os=-sysv4 ;; -svr3) @@ -1496,38 +1480,35 @@ case $os in -ose*) os=-ose ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; - -pikeos*) - # Until real need of OS specific support for - # particular features comes up, bare metal - # configurations are quite functional. - case $basic_machine in - arm*) - os=-eabi - ;; - *) - os=-elf - ;; - esac - ;; -nacl*) ;; - -ios) - ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`"$1"\': system \`"$os"\' not recognized 1>&2 + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac @@ -1562,9 +1543,6 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; - c8051-*) - os=-elf - ;; hexagon-*) os=-elf ;; @@ -1617,12 +1595,12 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; - pru-*) - os=-elf - ;; *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; @@ -1662,7 +1640,7 @@ case $basic_machine in m88k-omron*) os=-luna ;; - *-next) + *-next ) os=-nextstep ;; *-sequent) @@ -1677,6 +1655,9 @@ case $basic_machine in i370-*) os=-mvs ;; + *-next) + os=-nextstep3 + ;; *-gould) os=-sysv ;; @@ -1786,15 +1767,15 @@ case $basic_machine in vendor=stratus ;; esac - basic_machine=`echo "$basic_machine" | sed "s/unknown/$vendor/"` + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac -echo "$basic_machine$os" +echo $basic_machine$os exit # Local variables: -# eval: (add-hook 'write-file-functions 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" diff --git a/configure b/configure index f2af308..877578c 100755 --- a/configure +++ b/configure @@ -1,8 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for nut 2.8.0. -# -# Report bugs to . +# Generated by GNU Autoconf 2.69 for nut 2.7.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -274,11 +272,10 @@ fi $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: https://github.com/networkupstools/nut/issues about -$0: your system, including any error possibly output before -$0: this message. Then install a modern shell, or manually -$0: run the script under such a shell if you do have one." + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." fi exit 1 fi @@ -590,9 +587,9 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='nut' PACKAGE_TARNAME='nut' -PACKAGE_VERSION='2.8.0' -PACKAGE_STRING='nut 2.8.0' -PACKAGE_BUGREPORT='https://github.com/networkupstools/nut/issues' +PACKAGE_VERSION='2.7.1' +PACKAGE_STRING='nut 2.7.1' +PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="server/upsd.c" @@ -634,21 +631,15 @@ ac_includes_default="\ #endif" ac_config_libobj_dir=common -ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS -BUILDING_IN_TREE_FALSE -BUILDING_IN_TREE_TRUE udevdir hotplugdir -auglensdir -systemdtmpfilesdir -systemdshutdowndir +systemdsystemshutdowndir systemdsystemunitdir pkgconfigdir driverexecdir -devddir cgiexecdir WORDS_BIGENDIAN SUN_LIBUSB @@ -657,9 +648,6 @@ RUN_AS_USER PORT SBINDIR DRVPATH -NUT_LIBEXECDIR -NUT_DATADIR -LIBDIR BINDIR CONFPATH STATEPATH @@ -669,16 +657,19 @@ NETLIBS DRIVER_INSTALL_TARGET DRIVER_MAN_LIST DRIVER_BUILD_LIST +LIBHAL_LIBS +LIBHAL_CFLAGS +HAL_CALLOUTS_PATH +HAL_FDI_PATH +HAL_DEVICE_MATCH_KEY +HAL_USER LIBLTDL_LIBS LIBLTDL_CFLAGS LIBWRAP_LIBS LIBWRAP_CFLAGS -DOC_CHECK_LIST DOC_BUILD_LIST LIBIPMI_LIBS LIBIPMI_CFLAGS -LIBMODBUS_LIBS -LIBMODBUS_CFLAGS LIBPOWERMAN_LIBS LIBPOWERMAN_CFLAGS LIBAVAHI_LIBS @@ -691,56 +682,29 @@ LIBNETSNMP_LIBS LIBNETSNMP_CFLAGS LIBGD_LDFLAGS LIBGD_CFLAGS -LIBSSL_REQUIRES LIBSSL_LIBS LIBSSL_CFLAGS NUT_NETVERSION TREE_VERSION OS_NAME -now -HAVE_SNMP_FALSE -HAVE_SNMP_TRUE -WITH_SNMP_FALSE -WITH_SNMP_TRUE -WITH_VALGRIND_FALSE -WITH_VALGRIND_TRUE -HAVE_VALGRIND_FALSE -HAVE_VALGRIND_TRUE -VALGRIND -SYSTEM_AIX_FALSE -SYSTEM_AIX_TRUE -WITH_DEVD_FALSE -WITH_DEVD_TRUE +HAVE_ASPELL_FALSE +HAVE_ASPELL_TRUE +ASPELL +MANUALUPDATE_FALSE +MANUALUPDATE_TRUE WITH_UDEV_FALSE WITH_UDEV_TRUE WITH_HOTPLUG_FALSE WITH_HOTPLUG_TRUE -HAVE_AUGPARSE_FALSE -HAVE_AUGPARSE_TRUE -AUGPARSE -WITH_AUGLENS_FALSE -WITH_AUGLENS_TRUE -HAVE_CPPUNIT_FALSE -HAVE_CPPUNIT_TRUE -CPPUNIT_LIBS -CPPUNIT_CFLAGS -HAVE_CXX11_FALSE -HAVE_CXX11_TRUE HAVE_SYSTEMD_FALSE HAVE_SYSTEMD_TRUE -WITH_SOLARIS_PKG_IPS_FALSE -WITH_SOLARIS_PKG_IPS_TRUE -WITH_SOLARIS_PKG_SVR4_FALSE -WITH_SOLARIS_PKG_SVR4_TRUE -WITH_SOLARIS_SMF_FALSE -WITH_SOLARIS_SMF_TRUE WITH_PKG_CONFIG_FALSE WITH_PKG_CONFIG_TRUE +SOME_DRIVERS_FALSE +SOME_DRIVERS_TRUE WITH_DEV_FALSE WITH_DEV_TRUE -LIBTOOL_DEPS CXXCPP -LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO @@ -750,6 +714,7 @@ MANIFEST_TOOL ac_ct_AR DLLTOOL OBJDUMP +LN_S NM ac_ct_DUMPBIN DUMPBIN @@ -757,41 +722,17 @@ LD FGREP SED LIBTOOL -DOC_INSTALL_DISTED_MANS_FALSE -DOC_INSTALL_DISTED_MANS_TRUE -SKIP_MANS_FALSE -SKIP_MANS_TRUE -WITH_MANS_FALSE -WITH_MANS_TRUE -WITH_DOCS_FALSE -WITH_DOCS_TRUE -WITH_ASCIIDOC_FALSE -WITH_ASCIIDOC_TRUE HAVE_ASCIIDOC_FALSE HAVE_ASCIIDOC_TRUE -HAVE_ASPELL_FALSE -HAVE_ASPELL_TRUE -ASPELL -HAVE_SOURCE_HIGHLIGHT_FALSE -HAVE_SOURCE_HIGHLIGHT_TRUE -SOURCE_HIGHLIGHT -XMLLINT -XSLTPROC +WITH_ASCIIDOC_FALSE +WITH_ASCIIDOC_TRUE DBLATEX A2X -MANUALUPDATE_FALSE -MANUALUPDATE_TRUE ASCIIDOC -WITH_CHECK_NIT_FALSE -WITH_CHECK_NIT_TRUE -WITH_CPPCHECK_FALSE -WITH_CPPCHECK_TRUE -HAVE_CPPCHECK_FALSE -HAVE_CPPCHECK_TRUE -CPPCHECK +WITH_HAL_FALSE +WITH_HAL_TRUE WITH_CGI_FALSE WITH_CGI_TRUE -GDLIB_CONFIG WITH_LIBLTDL_FALSE WITH_LIBLTDL_TRUE WITH_WRAP_FALSE @@ -802,62 +743,40 @@ WITH_OPENSSL_FALSE WITH_OPENSSL_TRUE WITH_NSS_FALSE WITH_NSS_TRUE -WITH_LINUX_I2C_FALSE -WITH_LINUX_I2C_TRUE WITH_MACOSX_FALSE WITH_MACOSX_TRUE WITH_FREEIPMI_FALSE WITH_FREEIPMI_TRUE WITH_IPMI_FALSE WITH_IPMI_TRUE -WITH_MODBUS_FALSE -WITH_MODBUS_TRUE WITH_LIBPOWERMAN_FALSE WITH_LIBPOWERMAN_TRUE WITH_AVAHI_FALSE WITH_AVAHI_TRUE -HAVE_NEON_FALSE -HAVE_NEON_TRUE WITH_NEON_FALSE WITH_NEON_TRUE +WITH_SNMP_FALSE +WITH_SNMP_TRUE WITH_USB_FALSE WITH_USB_TRUE -WITH_LIBUSB_0_1_FALSE -WITH_LIBUSB_0_1_TRUE -WITH_LIBUSB_1_0_FALSE -WITH_LIBUSB_1_0_TRUE WITH_SERIAL_FALSE WITH_SERIAL_TRUE -NET_SNMP_CONFIG -LIBUSB_CONFIG -SOME_DRIVERS_FALSE -SOME_DRIVERS_TRUE -HAVE_PYTHON3_FALSE -HAVE_PYTHON3_TRUE -PYTHON3 -HAVE_PYTHON2_FALSE -HAVE_PYTHON2_TRUE -PYTHON2 -HAVE_PYTHON_FALSE -HAVE_PYTHON_TRUE -PYTHON +HAVE_CPPUNIT_FALSE +HAVE_CPPUNIT_TRUE +CPPUNIT_LIBS +CPPUNIT_CFLAGS +PKG_CONFIG_LIBDIR +PKG_CONFIG_PATH +PKG_CONFIG LIBOBJS -LN_S_R RANLIB AR -LN_S am__fastdepCXX_FALSE am__fastdepCXX_TRUE CXXDEPMODE ac_ct_CXX CXXFLAGS CXX -dummy_PKG_CONFIG_LIBS -dummy_PKG_CONFIG_CFLAGS -PKG_CONFIG_LIBDIR -PKG_CONFIG_PATH -PKG_CONFIG -dummy_PKG_CONFIG MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE @@ -871,6 +790,7 @@ am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE +am__quote am__include DEPDIR OBJEXT @@ -880,10 +800,6 @@ CPPFLAGS LDFLAGS CFLAGS CC -AM_BACKSLASH -AM_DEFAULT_VERBOSITY -AM_DEFAULT_V -AM_V am__untar am__tar AMTAR @@ -938,7 +854,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -957,45 +872,36 @@ PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR -SHELL -am__quote' +SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking -enable_silent_rules enable_dependency_tracking enable_maintainer_mode -with_pkg_config -enable_Wcolor -with_python -with_python2 -with_python3 -with_drivers with_all with_dev -with_docs -with_doc -enable_warnings -enable_Werror with_serial with_usb -with_libusb_config -with_usb_includes -with_usb_libs -with_snmp -with_net_snmp_config +with_doc +with_avahi with_snmp_includes with_snmp_libs +with_usb_includes +with_usb_libs +with_hal +with_hal_includes +with_hal_libs +with_hal_user +with_hal_device_match_key +with_hal_callouts_path +with_hal_fdi_path +with_snmp with_neon with_neon_includes with_neon_libs with_powerman with_powerman_includes with_powerman_libs -with_modbus -with_modbus_includes -with_modbus_libs -with_avahi with_avahi_includes with_avahi_libs with_ipmi @@ -1003,7 +909,6 @@ with_freeipmi with_freeipmi_includes with_freeipmi_libs with_macosx_ups -with_linux_i2c with_ssl with_nss with_openssl @@ -1016,16 +921,12 @@ with_libltdl with_libltdl_includes with_libltdl_libs with_cgi -with_gdlib_config with_gd_includes with_gd_libs -enable_cppcheck -enable_check_NIT enable_shared enable_static with_pic enable_fast_install -with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock @@ -1039,20 +940,12 @@ with_port with_user with_group with_logfacility +with_drivers enable_strip with_pkgconfig_dir -with_solaris_smf -with_solaris_pkg_svr4 -with_solaris_pkg_ips with_systemdsystemunitdir -with_systemdshutdowndir -with_systemdtmpfilesdir -enable_cppunit -with_augeas_lenses_dir with_hotplug_dir with_udev_dir -with_devd_dir -with_valgrind ' ac_precious_vars='build_alias host_alias @@ -1063,18 +956,15 @@ LDFLAGS LIBS CPPFLAGS CPP -PKG_CONFIG -PKG_CONFIG_PATH -PKG_CONFIG_LIBDIR -dummy_PKG_CONFIG_CFLAGS -dummy_PKG_CONFIG_LIBS CXX CXXFLAGS CCC -LT_SYS_LIBRARY_PATH -CXXCPP +PKG_CONFIG +PKG_CONFIG_PATH +PKG_CONFIG_LIBDIR CPPUNIT_CFLAGS -CPPUNIT_LIBS' +CPPUNIT_LIBS +CXXCPP' # Initialize some variables set by options. @@ -1113,7 +1003,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1366,15 +1255,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1512,7 +1392,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1625,7 +1505,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures nut 2.8.0 to adapt to many kinds of systems. +\`configure' configures nut 2.7.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1665,7 +1545,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1697,7 +1576,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of nut 2.8.0:";; + short | recursive ) echo "Configuration of nut 2.7.1:";; esac cat <<\_ACEOF @@ -1705,74 +1584,45 @@ Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-silent-rules less verbose build output (undo: "make V=1") - --disable-silent-rules verbose build output (undo: "make V=0") - --enable-dependency-tracking - do not reject slow dependency extractors - --disable-dependency-tracking - speeds up one-time build - --enable-maintainer-mode - enable make rules and dependencies not useful (and - sometimes confusing) to the casual installer - --enable-Wcolor Request that compiler output is colorized (no = - leave it up to compiler defaults) (no) - --enable-warnings enable warning presets that were picked as useful in - maintainership and CI practice (variants include - gcc-minimal, gcc-medium, gcc-hard, clang-minimal, - clang-medium, clang-hard, all; auto-choosers: hard, - medium, minimal, yes=auto='gcc or clang or all at - hardcoded default difficulty') (auto) - --enable-Werror fail the build if compiler emits any warnings (treat - them as errors) (no) - --enable-cppcheck Run a cppcheck on the codebase among checks (no) - --enable-check-NIT Run check-NIT among default checks (no) + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --enable-strip Strip debugging symbols from binaries (no) - --enable-cppunit enable CPPUNIT tests for C++ bindings Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - [--with-pkg-config=/path/to/gdlib-config] - path to program that reports development package - configuration - --with-python Use a particular program name of the python - interpeter (auto) - --with-python2 Use a particular program name of the python2 - interpeter for code that needs that version and is - not compatible with python3 (auto) - --with-python3 Use a particular program name of the python3 - interpeter for code that needs that version and is - not compatible with python2 (auto) - [--with-drivers=driver[,driver]] - Only build specific drivers (all) - --with-all enable serial, usb, snmp, neon, ipmi, powerman, - modbus, cgi, dev, avahi, linux_i2c + --with-all enable serial, usb, snmp, neon, ipmi, powerman, cgi, + dev, avahi --with-dev build and install the development files (no) - --with-docs build and install documentation (alias to - --with-doc) (man=auto) - --with-doc build and install documentation (see - docs/configure.txt for many variants of the option) - (${nut_with_docs}) --with-serial build and install serial drivers (yes) - --with-usb build and install USB drivers, optionally require - build with specified version of libusb library and - API: (auto|libusb-0.1|libusb-1.0) (auto) - [--with-libusb-config=/path/to/libusb-config] - path to program that reports LibUSB configuration - [--with-usb-includes=CFLAGS] - include flags for the libusb library - [--with-usb-libs=LIBS] linker flags for the libusb library - --with-snmp build and install SNMP drivers (auto) - [--with-net-snmp-config=/path/to/net-snmp-config] - path to program that reports Net-SNMP configuration + --with-usb build and install USB drivers (auto) + --with-doc build and install documentation (no) + --with-avahi build and install Avahi support (auto) [--with-snmp-includes=CFLAGS] include flags for the Net-SNMP library [--with-snmp-libs=LIBS] linker flags for the Net-SNMP library + [--with-usb-includes=CFLAGS] + include flags for the libusb library + [--with-usb-libs=LIBS] linker flags for the libusb library + --with-hal build and install HAL support (no) + [--with-hal-includes=CFLAGS] + include flags for the HAL library + [--with-hal-libs=LIBS] linker flags for the HAL library + [--with-hal-user=USER] addons run as user + [--with-hal-device-match-key=KEY] + device match key + [--with-hal-callouts-path=PATH] + installation path for callouts + [--with-hal-fdi-path=PATH] + installation path for device information files + --with-snmp build and install SNMP drivers (auto) --with-neon build and install neon based XML/HTTP driver (auto) [--with-neon-includes=CFLAGS] include flags for the neon library @@ -1782,12 +1632,6 @@ Optional Packages: include flags for the libpowerman library [--with-powerman-libs=LIBS] linker flags for the libpowerman library - --with-modbus build and install modbus drivers (auto) - [--with-modbus-includes=CFLAGS] - include flags for the libmodbus library - [--with-modbus-libs=LIBS] - linker flags for the libmodbus library - --with-avahi build and install Avahi support (auto) [--with-avahi-includes=CFLAGS] include flags for the avahi library [--with-avahi-libs=LIBS] @@ -1800,7 +1644,6 @@ Optional Packages: linker flags for the FreeIPMI library --with-macosx_ups build and install Mac OS X Power Sources meta-driver (auto) - --with-linux_i2c build and install i2c drivers (auto) --with-ssl enable SSL support (either NSS or OpenSSL) (auto) --with-nss enable SSL support using Mozilla NSS (auto) --with-openssl enable SSL support using OpenSSL (auto) @@ -1819,20 +1662,15 @@ Optional Packages: [--with-libltdl-libs=LIBS] linker flags for the libltdl library --with-cgi build and install the CGI programs (no) - [--with-gdlib-config=/path/to/gdlib-config] - path to program that reports GDLIB configuration [--with-gd-includes=CFLAGS] include flags for the gd library [--with-gd-libs=LDFLAGS] linker flags for the gd library --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] - --with-aix-soname=aix|svr4|both - shared library versioning (aka "SONAME") variant to - provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot[=DIR] Search for dependent libraries within DIR (or the - compiler's sysroot if not specified). + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). --with-statepath=PATH path for ups state files (/var/state/ups) --with-altpidpath=PATH path for driver/upsd .pid files () --with-drvpath=PATH where to install UPS drivers (EPREFIX/bin) @@ -1840,35 +1678,20 @@ Optional Packages: --with-htmlpath=PATH where to install HTML files (PREFIX/html) --with-pidpath=PATH path for .pid files (/var/run) --with-port=PORT port for network communications (3493) - --with-user=username user for programs started as root (${RUN_AS_USER}) + --with-user=username user for programs started as root (nobody) --with-group=groupname group membership of user for programs started as - root (${RUN_AS_GROUP}) + root (nogroup) --with-logfacility=FACILITY facility for log messages (LOG_DAEMON) + [--with-drivers=driver[,driver]] + Only build specific drivers (all) --with-pkgconfig-dir=PATH where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig) - --with-solaris-smf=(yes|auto|no) - Enable installation of NUT scripts and manifests for - Solaris Service Management Framework (auto) - --with-solaris-pkg-svr4=(yes|auto|no) - Enable construction of Solaris SVR4 packages (auto) - --with-solaris-pkg-ips=(yes|auto|no) - Enable construction of Solaris IPS packages (auto) --with-systemdsystemunitdir=DIR Directory for systemd service files (auto) - --with-systemdshutdowndir=DIR - Directory for systemd shutdown scripts (auto) - --with-systemdtmpfilesdir=DIR - Directory for systemd tmpfiles scripts (auto) - --with-augeas-lenses-dir=PATH - where to install Augeas configuration-management - lenses (/usr/share/augeas/lenses{/dist,/}) --with-hotplug-dir=PATH where to install hotplug rules (/etc/hotplug) --with-udev-dir=PATH where to install udev rules (/lib/udev or /etc/udev) - --with-devd-dir=PATH where to install devd.conf file (/usr/local/etc/devd - or /etc/devd) - --with-valgrind=PATH whether to use valgrind for memory-leak testing Some influential environment variables: CC C compiler command @@ -1879,29 +1702,23 @@ Some influential environment variables: CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path - dummy_PKG_CONFIG_CFLAGS - C compiler flags for dummy_PKG_CONFIG, overriding pkg-config - dummy_PKG_CONFIG_LIBS - linker flags for dummy_PKG_CONFIG, overriding pkg-config - CXX C++ compiler command - CXXFLAGS C++ compiler flags - LT_SYS_LIBRARY_PATH - User-defined run-time library search path. - CXXCPP C++ preprocessor CPPUNIT_CFLAGS C compiler flags for CPPUNIT, overriding pkg-config CPPUNIT_LIBS linker flags for CPPUNIT, overriding pkg-config + CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to . +Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1964,7 +1781,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -nut configure 2.8.0 +nut configure 2.7.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2123,10 +1940,6 @@ $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ------------------------------------------------------------ ## -## Report this to https://github.com/networkupstools/nut/issues ## -## ------------------------------------------------------------ ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 @@ -2301,94 +2114,6 @@ fi } # ac_fn_c_try_link -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - -# ac_fn_cxx_try_run LINENO -# ------------------------ -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_cxx_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_run - # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly @@ -2556,189 +2281,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type -# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES -# -------------------------------------------- -# Tries to find the compile-time value of EXPR in a program that includes -# INCLUDES, setting VAR accordingly. Returns whether the value could be -# computed -ac_fn_c_compute_int () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if test "$cross_compiling" = yes; then - # Depending upon the size, compute the lo and hi bounds. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=0 ac_mid=0 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid; break -else - as_fn_arith $ac_mid + 1 && ac_lo=$as_val - if test $ac_lo -le $ac_mid; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) < 0)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=-1 ac_mid=-1 - while :; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) >= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_lo=$ac_mid; break -else - as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val - if test $ac_mid -le $ac_hi; then - ac_lo= ac_hi= - break - fi - as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done -else - ac_lo= ac_hi= -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -# Binary search between lo and hi bounds. -while test "x$ac_lo" != "x$ac_hi"; do - as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -static int test_array [1 - 2 * !(($2) <= $ac_mid)]; -test_array [0] = 0; -return test_array [0]; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_hi=$ac_mid -else - as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -done -case $ac_lo in #(( -?*) eval "$3=\$ac_lo"; ac_retval=0 ;; -'') ac_retval=1 ;; -esac - else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -static long int longval () { return $2; } -static unsigned long int ulongval () { return $2; } -#include -#include -int -main () -{ - - FILE *f = fopen ("conftest.val", "w"); - if (! f) - return 1; - if (($2) < 0) - { - long int i = longval (); - if (i != ($2)) - return 1; - fprintf (f, "%ld", i); - } - else - { - unsigned long int i = ulongval (); - if (i != ($2)) - return 1; - fprintf (f, "%lu", i); - } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - echo >>conftest.val; read $3 &5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by nut $as_me 2.8.0, which was +It was created by nut $as_me 2.7.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3059,11 +2647,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " sys/time.h" -as_fn_append ac_header_list " time.h" -as_fn_append ac_header_list " sys/types.h" -as_fn_append ac_header_list " sys/socket.h" -as_fn_append ac_header_list " netdb.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3132,8 +2715,11 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "Network UPS Tools version ${PACKAGE_VERSION}" ac_aux_dir= -for ac_dir in . "$srcdir"/.; do +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" @@ -3149,7 +2735,7 @@ for ac_dir in . "$srcdir"/.; do fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in . \"$srcdir\"/." "$LINENO" 5 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, @@ -3161,9 +2747,6 @@ ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -echo "Network UPS Tools version ${PACKAGE_VERSION}" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 @@ -3275,6 +2858,7 @@ test -n "$target_alias" && NONENONEs,x,x, && program_prefix=${target_alias}- + os_get_name() { case "$1" in (*CentOS*|*CENTOS*) echo 'centos' ;; @@ -3293,7 +2877,7 @@ test -n "$target_alias" && *-aix*) echo 'aix' ;; *-freebsd*) echo 'freebsd' ;; *-darwin*) echo 'darwin' ;; - *solaris*) echo 'Linux unknown + *solaris*) echo 'Linux x86_64 ' ;; *-hpux*) echo 'hpux' ;; esac @@ -3413,74 +2997,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dist_cv_build_flavor" >&5 $as_echo "$dist_cv_build_flavor" >&6; } - - CFLAGS_STASHED_WARNINGS="" - CPPFLAGS_STASHED_WARNINGS="" - CXXFLAGS_STASHED_WARNINGS="" - - if test -z "$CFLAGS"; then : - -else - - TMP="" - for V in ${CFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CFLAGS_STASHED_WARNINGS="${CFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CFLAGS="$TMP" - -fi - if test -n "${CFLAGS_STASHED_WARNINGS}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Stashed CFLAGS warnings to not confuse autotools probes: ${CFLAGS_STASHED_WARNINGS}" >&5 -$as_echo "$as_me: Stashed CFLAGS warnings to not confuse autotools probes: ${CFLAGS_STASHED_WARNINGS}" >&6;} -fi - - if test -z "$CPPFLAGS"; then : - -else - - TMP="" - for V in ${CPPFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CPPFLAGS_STASHED_WARNINGS="${CPPFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CPPFLAGS="$TMP" - -fi - if test -n "${CPPFLAGS_STASHED_WARNINGS}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Stashed CPPFLAGS warnings to not confuse autotools probes: ${CPPFLAGS_STASHED_WARNINGS}" >&5 -$as_echo "$as_me: Stashed CPPFLAGS warnings to not confuse autotools probes: ${CPPFLAGS_STASHED_WARNINGS}" >&6;} -fi - - - if test -z "$CXXFLAGS"; then : - -else - - TMP="" - for V in ${CXXFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CXXFLAGS_STASHED_WARNINGS="${CXXFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CXXFLAGS="$TMP" - -fi - if test -n "${CXXFLAGS_STASHED_WARNINGS}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Stashed CXXFLAGS warnings to not confuse autotools probes: ${CXXFLAGS_STASHED_WARNINGS}" >&5 -$as_echo "$as_me: Stashed CXXFLAGS warnings to not confuse autotools probes: ${CXXFLAGS_STASHED_WARNINGS}" >&6;} -fi - - ac_config_headers="$ac_config_headers include/config.h" -am__api_version='1.16' +am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -3577,6 +3097,9 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' @@ -3587,40 +3110,32 @@ case `pwd` in esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) - as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac -# Do 'set' in a subshell so we don't clobber the current shell's +# Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( - am_has_slept=no - for am_try in 1 2; do - echo "timestamp, slept: $am_has_slept" > conftest.file - set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` - if test "$*" = "X"; then - # -L didn't work. - set X `ls -t "$srcdir/configure" conftest.file` - fi - if test "$*" != "X $srcdir/configure conftest.file" \ - && test "$*" != "X conftest.file $srcdir/configure"; then + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi - # If neither matched, then we have a broken ls. This can happen - # if, for instance, CONFIG_SHELL is bash and it inherits a - # broken ls alias from the environment. This has actually - # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken - alias in your environment" "$LINENO" 5 - fi - if test "$2" = conftest.file || test $am_try -eq 2; then - break - fi - # Just in case. - sleep 1 - am_has_slept=yes - done test "$2" = conftest.file ) then @@ -3632,16 +3147,6 @@ Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } -# If we didn't sleep, we still need to ensure time stamps of config.status and -# generated files are strictly newer. -am_sleep_pid= -if grep 'slept: no' conftest.file >/dev/null 2>&1; then - ( sleep 1 ) & - am_sleep_pid=$! -fi - -rm -f conftest.file - test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. @@ -3652,22 +3157,27 @@ test "$program_suffix" != NONE && ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` -# Expand $ac_aux_dir to an absolute path. -am_aux_dir=`cd "$ac_aux_dir" && pwd` +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then - MISSING="\${SHELL} '$am_aux_dir/missing'" + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac fi # Use eval to expand $SHELL -if eval "$MISSING --is-lightweight"; then - am_missing_run="$MISSING " +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 -$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -if test x"${install_sh+set}" != xset; then +if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; @@ -3676,10 +3186,10 @@ if test x"${install_sh+set}" != xset; then esac fi -# Installed binaries are usually stripped using 'strip' when the user -# run "make install-strip". However 'strip' might not be the right +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake -# will honor the 'STRIP' environment variable to overrule this program. +# will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. @@ -3818,6 +3328,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. @@ -3900,45 +3416,6 @@ else fi rmdir .tst 2>/dev/null -# Check whether --enable-silent-rules was given. -if test "${enable_silent_rules+set}" = set; then : - enableval=$enable_silent_rules; -fi - -case $enable_silent_rules in # ((( - yes) AM_DEFAULT_VERBOSITY=0;; - no) AM_DEFAULT_VERBOSITY=1;; - *) AM_DEFAULT_VERBOSITY=1;; -esac -am_make=${MAKE-make} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 -$as_echo_n "checking whether $am_make supports nested variables... " >&6; } -if ${am_cv_make_support_nested_variables+:} false; then : - $as_echo_n "(cached) " >&6 -else - if $as_echo 'TRUE=$(BAR$(V)) -BAR0=false -BAR1=true -V=1 -am__doit: - @$(TRUE) -.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then - am_cv_make_support_nested_variables=yes -else - am_cv_make_support_nested_variables=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 -$as_echo "$am_cv_make_support_nested_variables" >&6; } -if test $am_cv_make_support_nested_variables = yes; then - AM_V='$(V)' - AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' -else - AM_V=$AM_DEFAULT_VERBOSITY - AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY -fi -AM_BACKSLASH='\' - if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." @@ -3961,7 +3438,7 @@ fi # Define the identity of the package. PACKAGE='nut' - VERSION='2.8.0' + VERSION='2.7.1' cat >>confdefs.h <<_ACEOF @@ -3989,22 +3466,12 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} -# For better backward compatibility. To be removed once Automake 1.9.x -# dies out for good. For more background, see: -# -# -mkdir_p='$(MKDIR_P)' - -# We need awk for the "check" target (and possibly the TAP driver). The -# system "awk" is bad on some platforms. +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' - -# We'll loop over all known methods to create a tar archive until one works. -_am_tools='gnutar pax cpio none' - am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' @@ -4012,49 +3479,6 @@ am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' -# POSIX will say in a future version that running "rm -f" with no argument -# is OK; and we want to be able to make that assumption in our Makefile -# recipes. So use an aggressive probe to check that the usage we want is -# actually supported "in the wild" to an acceptable degree. -# See automake bug#10828. -# To make any issue more visible, cause the running configure to be aborted -# by default if the 'rm' program in use doesn't match our expectations; the -# user can still override this though. -if rm -f && rm -fr && rm -rf; then : OK; else - cat >&2 <<'END' -Oops! - -Your 'rm' program seems unable to run without file operands specified -on the command line, even when the '-f' option is present. This is contrary -to the behaviour of most rm programs out there, and not conforming with -the upcoming POSIX standard: - -Please tell bug-automake@gnu.org about your system, including the value -of your $PATH and any error possibly output before this message. This -can help us improve future automake versions. - -END - if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then - echo 'Configuration will proceed anyway, since you have set the' >&2 - echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 - echo >&2 - else - cat >&2 <<'END' -Aborting the configuration process, to ensure you take notice of the issue. - -You can download and install GNU coreutils to get an 'rm' implementation -that behaves properly: . - -If you want to complete the configuration process using your problematic -'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM -to "yes", and re-run configure. - -END - as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 - fi -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro to enable system extensions" >&5 $as_echo_n "checking for autoconf macro to enable system extensions... " >&6; } @@ -4064,45 +3488,45 @@ $as_echo "yes" >&6; } ac_config_commands="$ac_config_commands depfiles" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 -$as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } -cat > confinc.mk << 'END' + +am_make=${MAKE-make} +cat > confinc << 'END' am__doit: - @echo this is the am__doit target >confinc.out + @echo this is the am__doit target .PHONY: am__doit END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= -# BSD make does it like this. -echo '.include "confinc.mk" # ignored' > confmf.BSD -# Other make implementations (GNU, Solaris 10, AIX) do it like this. -echo 'include confinc.mk # ignored' > confmf.GNU -_am_result=no -for s in GNU BSD; do - { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 - (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - case $?:`cat confinc.out 2>/dev/null` in #( - '0:this is the am__doit target') : - case $s in #( - BSD) : - am__include='.include' am__quote='"' ;; #( - *) : - am__include='include' am__quote='' ;; -esac ;; #( - *) : - ;; +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; esac - if test "$am__include" != "#"; then - _am_result="yes ($s style)" - break - fi -done -rm -f confinc.* confmf.* -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 -$as_echo "${_am_result}" >&6; } +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : @@ -4912,65 +4336,6 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 -$as_echo_n "checking whether $CC understands -c and -o together... " >&6; } -if ${am_cv_prog_cc_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF - # Make sure it works both with $CC and with simple cc. - # Following AC_PROG_CC_C_O, we do the test twice because some - # compilers refuse to overwrite an existing .o file with -o, - # though they will create one. - am_cv_prog_cc_c_o=yes - for am_i in 1 2; do - if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 - ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } \ - && test -f conftest2.$ac_objext; then - : OK - else - am_cv_prog_cc_c_o=no - break - fi - done - rm -f core conftest* - unset am_i -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 -$as_echo "$am_cv_prog_cc_c_o" >&6; } -if test "$am_cv_prog_cc_c_o" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 @@ -4982,8 +4347,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -5018,16 +4383,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with '-c' and '-o' for the sake of the "dashmstdout" + # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -5036,8 +4401,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else @@ -5045,7 +4410,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has + # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -5561,8 +4926,6 @@ $as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. @@ -5589,360 +4952,6 @@ fi - - - - -if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. -set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PKG_CONFIG=$ac_cv_path_PKG_CONFIG -if test -n "$PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 -$as_echo "$PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_PKG_CONFIG"; then - ac_pt_PKG_CONFIG=$PKG_CONFIG - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG -if test -n "$ac_pt_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 -$as_echo "$ac_pt_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_PKG_CONFIG" = x; then - PKG_CONFIG="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - PKG_CONFIG=$ac_pt_PKG_CONFIG - fi -else - PKG_CONFIG="$ac_cv_path_PKG_CONFIG" -fi - -fi -if test -n "$PKG_CONFIG"; then - _pkg_min_version=0.9.0 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 -$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } - if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG="" - fi -fi - -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - - - - TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`" cat >>confdefs.h <<_ACEOF @@ -5950,7 +4959,7 @@ cat >>confdefs.h <<_ACEOF _ACEOF -NUT_NETVERSION="1.3" +NUT_NETVERSION="1.2" cat >>confdefs.h <<_ACEOF #define NUT_NETVERSION "${NUT_NETVERSION}" @@ -5971,13 +4980,6 @@ cgiexecdir='${exec_prefix}/cgi-bin' driverexecdir='${exec_prefix}/bin' htmldir='${prefix}/html' pkgconfigdir='${libdir}/pkgconfig' -auglensdir='/usr/share/augeas/lenses/dist' -if test ! -d "${auglensdir}"; then - auglensdir='/usr/share/augeas/lenses' - if test ! -d "${auglensdir}"; then - auglensdir='' - fi -fi hotplugdir='/etc/hotplug' if test ! -d "${hotplugdir}"; then hotplugdir='' @@ -5990,25 +4992,805 @@ if test ! -d "${udevdir}"; then fi fi -devddir='/usr/local/etc/devd' -if test ! -d "${devddir}"; then - devddir='/etc/devd' - if test ! -d "${devddir}"; then - devddir='' - fi -fi - RUN_AS_USER="nobody" RUN_AS_GROUP="nobody" -if test -n "`getent group nogroup`" && ! test -n "`getent group "${RUN_AS_GROUP}"`"; then : - RUN_AS_GROUP="nogroup" - -fi PIDPATH="/var/run" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -6415,8 +6197,8 @@ else # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up - # making a dummy file named 'D' -- because '-MD' means "put the output - # in D". + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're @@ -6451,16 +6233,16 @@ else : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c - # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with - # Solaris 10 /bin/sh. - echo '/* dummy */' > sub/conftst$i.h + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with '-c' and '-o' for the sake of the "dashmstdout" + # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly - # handle '-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs. + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in @@ -6469,8 +6251,8 @@ else test "$am__universal" = false || continue ;; nosideeffect) - # After this tag, mechanisms are not by side-effect, so they'll - # only be used when explicitly requested. + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else @@ -6478,7 +6260,7 @@ else fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) - # This compiler won't grok '-c -o', but also, the minuso test has + # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} @@ -6532,83 +6314,6 @@ else fi -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX understands -c and -o together" >&5 -$as_echo_n "checking whether $CXX understands -c and -o together... " >&6; } -if ${ac_cv_prog_cxx_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -# We test twice because some compilers refuse to overwrite an existing -# `.o' file with `-o', although they will create one. -ac_try='$CXX $CXXFLAGS -c conftest.$ac_ext -o conftest2.$ac_objext >&5' -rm -f conftest2.* -if { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - ac_cv_prog_cxx_c_o=yes -else - ac_cv_prog_cxx_c_o=no -fi -rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_c_o" >&5 -$as_echo "$ac_cv_prog_cxx_c_o" >&6; } -if test $ac_cv_prog_cxx_c_o = no; then - -$as_echo "#define CXX_NO_MINUS_C_MINUS_O 1" >>confdefs.h - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } @@ -7149,3825 +6854,7 @@ $as_echo "#define HAVE_C_VARARRAYS 1" >>confdefs.h fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CC compiler family is GCC" >&5 -$as_echo_n "checking if CC compiler family is GCC... " >&6; } -if ${nut_cv_GCC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then : - if $CC --version 2>&1 | grep 'Free Software Foundation' > /dev/null; then : - nut_cv_GCC=yes -else - nut_cv_GCC=no -fi -else - as_fn_error $? "CC is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_GCC" >&5 -$as_echo "$nut_cv_GCC" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CXX compiler family is GCC" >&5 -$as_echo_n "checking if CXX compiler family is GCC... " >&6; } -if ${nut_cv_GXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then : - if $CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null; then : - nut_cv_GXX=yes -else - nut_cv_GXX=no -fi -else - as_fn_error $? "CXX is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_GXX" >&5 -$as_echo "$nut_cv_GXX" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CPP preprocessor family is GCC" >&5 -$as_echo_n "checking if CPP preprocessor family is GCC... " >&6; } -if ${nut_cv_GPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CPP"; then : - if $CPP --version 2>&1 | grep 'Free Software Foundation' > /dev/null; then : - nut_cv_GPP=yes -else - nut_cv_GPP=no -fi -else - as_fn_error $? "CPP is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_GPP" >&5 -$as_echo "$nut_cv_GPP" >&6; } - - if test "x$GCC" = "x" && test "$nut_cv_GCC" = yes; then : - GCC=yes -fi - if test "x$GXX" = "x" && test "$nut_cv_GXX" = yes; then : - GXX=yes -fi - if test "x$GPP" = "x" && test "$nut_cv_GPP" = yes; then : - GPP=yes -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CC compiler family is clang" >&5 -$as_echo_n "checking if CC compiler family is clang... " >&6; } -if ${nut_cv_CLANGCC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then : - if $CC --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null; then : - nut_cv_CLANGCC=yes -else - nut_cv_CLANGCC=no -fi -else - as_fn_error $? "CC is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_CLANGCC" >&5 -$as_echo "$nut_cv_CLANGCC" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CXX compiler family is clang" >&5 -$as_echo_n "checking if CXX compiler family is clang... " >&6; } -if ${nut_cv_CLANGXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then : - if $CXX --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null; then : - nut_cv_CLANGXX=yes -else - nut_cv_CLANGXX=no -fi -else - as_fn_error $? "CXX is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_CLANGXX" >&5 -$as_echo "$nut_cv_CLANGXX" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CPP preprocessor family is clang" >&5 -$as_echo_n "checking if CPP preprocessor family is clang... " >&6; } -if ${nut_cv_CLANGPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CPP"; then : - if $CPP --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null; then : - nut_cv_CLANGPP=yes -else - nut_cv_CLANGPP=no -fi -else - as_fn_error $? "CPP is not set" "$LINENO" 5 - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_CLANGPP" >&5 -$as_echo "$nut_cv_CLANGPP" >&6; } - - if test "x$CLANGCC" = "x" && test "$nut_cv_CLANGCC" = yes; then : - CLANGCC=yes -fi - if test "x$CLANGXX" = "x" && test "$nut_cv_CLANGXX" = yes; then : - CLANGXX=yes -fi - if test "x$CLANGPP" = "x" && test "$nut_cv_CLANGPP" = yes; then : - CLANGPP=yes -fi - - # Check whether --enable-Wcolor was given. -if test "${enable_Wcolor+set}" = set; then : - enableval=$enable_Wcolor; nut_enable_Wcolor="${enableval}" -else - nut_enable_Wcolor="no" - -fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: Detecting support for additional compiler flags" >&5 -$as_echo "$as_me: Detecting support for additional compiler flags" >&6;} - - - - - COMPILERFLAG="-Qunused-arguments" - - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CFLAGS="$CFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C++ compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - COMPILERFLAG="-Wno-reserved-identifier" - - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CFLAGS="$CFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C++ compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - if test x"${nut_enable_Wcolor}" = xyes; then : - - - - - COMPILERFLAG="-fdiagnostics-color=always" - - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CFLAGS="$CFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C++ compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: NOT checking for options to request colorized compiler output (pass --enable-Wcolor for that)" >&5 -$as_echo "$as_me: NOT checking for options to request colorized compiler output (pass --enable-Wcolor for that)" >&6;} -fi - - - - COMPILERFLAG="-Wno-unknown-warning-option" - - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CFLAGS="$CFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - CFLAGS="$SAVED_CFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags_-Werror_${COMPILERFLAG}" | $as_tr_sh` -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts ${COMPILERFLAG}" >&5 -$as_echo_n "checking whether C++ compiler accepts ${COMPILERFLAG}... " >&6; } -if eval \${$as_CACHEVAR+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror ${COMPILERFLAG}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - eval "$as_CACHEVAR=no" -else - eval "$as_CACHEVAR=yes" -fi -else - eval "$as_CACHEVAR=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -eval ac_res=\$$as_CACHEVAR - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : - CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : - -else - CXXFLAGS="$SAVED_CXXFLAGS" -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - if test "x$CLANGCC" = xyes -o "x$GCC" = xyes; then : - - if test -d /usr/local/include; then : - CFLAGS="-isystem /usr/local/include $CFLAGS" -fi - if test -d /usr/pkg/include; then : - CFLAGS="-isystem /usr/pkg/include $CFLAGS" -fi - -fi - if test "x$CLANGXX" = xyes -o "x$GXX" = xyes; then : - - if test -d /usr/local/include; then : - CXXFLAGS="-isystem /usr/local/include $CXXFLAGS" -fi - if test -d /usr/pkg/include; then : - CXXFLAGS="-isystem /usr/pkg/include $CXXFLAGS" -fi - -fi - - if test "x$GCC" = xyes -o "x$CLANGCC" = xyes; then : - case "${CFLAGS}" in #( - -std=*) : - ;; #( - *) : - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -std=gnu99" >&5 -$as_echo_n "checking whether C compiler accepts -std=gnu99... " >&6; } -if ${ax_cv_check_cflags__Werror__std_gnu99+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror -std=gnu99" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - ax_cv_check_cflags__Werror__std_gnu99=no -else - ax_cv_check_cflags__Werror__std_gnu99=yes -fi -else - ax_cv_check_cflags__Werror__std_gnu99=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__std_gnu99" >&5 -$as_echo "$ax_cv_check_cflags__Werror__std_gnu99" >&6; } -if test "x$ax_cv_check_cflags__Werror__std_gnu99" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler" >&5 -$as_echo "$as_me: Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler" >&6;} - CFLAGS="$CFLAGS -std=gnu99" - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ;; -esac - -fi - - if test "x$GCC" = xyes -o "x$CLANGCC" = xyes; then : - case "${CXXFLAGS}" in #( - -std=*) : - ;; #( - *) : - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -std=gnu++11" >&5 -$as_echo_n "checking whether C++ compiler accepts -std=gnu++11... " >&6; } -if ${ax_cv_check_cxxflags__Werror__std_gnupp11+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror -std=gnu++11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - ax_cv_check_cxxflags__Werror__std_gnupp11=no -else - ax_cv_check_cxxflags__Werror__std_gnupp11=yes -fi -else - ax_cv_check_cxxflags__Werror__std_gnupp11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__std_gnupp11" >&5 -$as_echo "$ax_cv_check_cxxflags__Werror__std_gnupp11" >&6; } -if test "x$ax_cv_check_cxxflags__Werror__std_gnupp11" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler" >&5 -$as_echo "$as_me: Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler" >&6;} - CXXFLAGS="$CXXFLAGS -std=gnu++11" - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ;; -esac - -fi - - - -if test -z "${nut_have_ax_c_pragmas_seen}"; then - nut_have_ax_c_pragmas_seen="yes" - - CFLAGS_SAVED="${CFLAGS}" - CXXFLAGS_SAVED="${CXXFLAGS}" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - if test "${CLANG}" = "yes"; then : - CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option" - CXXFLAGS="${CXXFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option" -else - if test "${GCC}" = "yes"; then : - CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror" -else - CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror" -fi - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic push and pop (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic push and pop (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_push_pop_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#pragma GCC diagnostic push -#pragma GCC diagnostic pop - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_push_pop_besidefunc=yes -else - ax_cv__pragma__gcc__diags_push_pop_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_push_pop_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma clang diagnostic push and pop (outside functions)" >&5 -$as_echo_n "checking for pragma clang diagnostic push and pop (outside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_push_pop_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_push_pop_besidefunc=yes -else - ax_cv__pragma__clang__diags_push_pop_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_push_pop_besidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_push_pop_besidefunc" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic push and pop (inside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic push and pop (inside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_push_pop_insidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic push -#pragma GCC diagnostic pop -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_push_pop_insidefunc=yes -else - ax_cv__pragma__gcc__diags_push_pop_insidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_push_pop_insidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma clang diagnostic push and pop (inside functions)" >&5 -$as_echo_n "checking for pragma clang diagnostic push and pop (inside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_push_pop_insidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_push_pop_insidefunc=yes -else - ax_cv__pragma__clang__diags_push_pop_insidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_push_pop_insidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_push_pop_insidefunc" >&6; } - - if test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_INSIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_BESIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP 1" >>confdefs.h - - -fi - - if test "${CLANG}" = "yes"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\"" >&5 -$as_echo_n "checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\"... " >&6; } -if ${ax_cv__pragma__clang__diags_ignored_unreachable_code_return+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma clang diagnostic ignored "-Wunreachable-code-return" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_ignored_unreachable_code_return=yes -else - ax_cv__pragma__clang__diags_ignored_unreachable_code_return=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_ignored_unreachable_code_return" >&5 -$as_echo "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" >&6; } - if test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\" (outside functions)" >&5 -$as_echo_n "checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\" (outside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma clang diagnostic ignored "-Wunreachable-code-return" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=yes -else - ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" >&6; } - if test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC 1" >>confdefs.h - - -fi - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunused-function\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunused-function\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unused_function+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunused-function" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unused_function=yes -else - ax_cv__pragma__gcc__diags_ignored_unused_function=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unused_function" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unused_function" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unused_function" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_nonliteral+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_nonliteral=yes -else - ax_cv__pragma__gcc__diags_ignored_format_nonliteral=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_nonliteral" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-security\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-security\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_security+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-security" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_security=yes -else - ax_cv__pragma__gcc__diags_ignored_format_security=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_security" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_security" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-security\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-security\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-security" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-truncation\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-truncation\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_truncation+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-truncation" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_truncation=yes -else - ax_cv__pragma__gcc__diags_ignored_format_truncation=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_truncation" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_truncation" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-truncation\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-truncation\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-truncation" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_stringop_truncation+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wstringop-truncation" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_stringop_truncation=yes -else - ax_cv__pragma__gcc__diags_ignored_stringop_truncation=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_stringop_truncation" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wstringop-truncation" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtype-limits\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtype-limits\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_type_limits+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtype-limits" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_type_limits=yes -else - ax_cv__pragma__gcc__diags_ignored_type_limits=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_type_limits" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_type_limits" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_type_limits" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtype-limits\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtype-limits\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtype-limits" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Warray-bounds\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Warray-bounds\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_array_bounds+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Warray-bounds" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_array_bounds=yes -else - ax_cv__pragma__gcc__diags_ignored_array_bounds=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_array_bounds" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_array_bounds" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_array_bounds" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Warray-bounds\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Warray-bounds\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Warray-bounds" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wsign-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wsign-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-conversion\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-conversion\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_conversion+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wsign-conversion" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_conversion=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_conversion=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_conversion" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-conversion\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-conversion\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wsign-conversion" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_break+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_return+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-overflow\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-overflow\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_overflow+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-overflow" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_overflow=yes -else - ax_cv__pragma__gcc__diags_ignored_format_overflow=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_overflow" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_overflow" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_overflow" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-overflow\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-overflow\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-overflow" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_covered_switch_default+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_covered_switch_default=yes -else - ax_cv__pragma__gcc__diags_ignored_covered_switch_default=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_covered_switch_default" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wextra-semi-stmt" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=yes -else - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wextra-semi-stmt" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcast-align\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcast-align\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cast_align+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wcast-align" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cast_align=yes -else - ax_cv__pragma__gcc__diags_ignored_cast_align=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cast_align" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cast_align" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cast_align" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcast-align\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcast-align\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wcast-align" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_strict_prototypes+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_strict_prototypes=yes -else - ax_cv__pragma__gcc__diags_ignored_strict_prototypes=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_strict_prototypes" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wassign-enum\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wassign-enum\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_assign_enum+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wassign-enum" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_assign_enum=yes -else - ax_cv__pragma__gcc__diags_ignored_assign_enum=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_assign_enum" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_assign_enum" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_assign_enum" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wassign-enum\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wassign-enum\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wassign-enum" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM_BESIDEFUNC 1" >>confdefs.h - - -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wc++98-compat" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_global_constructors+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wglobal-constructors" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_global_constructors=yes -else - ax_cv__pragma__gcc__diags_ignored_global_constructors=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_global_constructors" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_global_constructors" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_global_constructors" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_exit_time_destructors+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wexit-time-destructors" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=yes -else - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wexit-time-destructors" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS_BESIDEFUNC 1" >>confdefs.h - - -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - if test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT 1" >>confdefs.h - - -fi - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"; then : - - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC 1" >>confdefs.h - - -fi - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma BOGUSforTest" >&5 -$as_echo_n "checking for pragma BOGUSforTest... " >&6; } -if ${ax_cv__pragma__bogus+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma BOGUSforTest -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus=yes -else - ax_cv__pragma__bogus=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus" >&5 -$as_echo "$ax_cv__pragma__bogus" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma BOGUSforTest (outside functions)" >&5 -$as_echo_n "checking for pragma BOGUSforTest (outside functions)... " >&6; } -if ${ax_cv__pragma__bogus_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma BOGUSforTest -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_besidefunc=yes -else - ax_cv__pragma__bogus_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_besidefunc" >&5 -$as_echo "$ax_cv__pragma__bogus_besidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\"... " >&6; } -if ${ax_cv__pragma__bogus_diag+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-WBOGUSforTest" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_diag=yes -else - ax_cv__pragma__bogus_diag=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_diag" >&5 -$as_echo "$ax_cv__pragma__bogus_diag" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\" (outside functions)... " >&6; } -if ${ax_cv__pragma__bogus_diag_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-WBOGUSforTest" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_diag_besidefunc=yes -else - ax_cv__pragma__bogus_diag_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_diag_besidefunc" >&5 -$as_echo "$ax_cv__pragma__bogus_diag_besidefunc" >&6; } - - if test "${ax_cv__pragma__bogus}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_besidefunc}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_diag}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_diag_besidefunc}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')" >&2;} -fi - - CFLAGS="${CFLAGS_SAVED}" - CXXFLAGS="${CXXFLAGS_SAVED}" -fi - - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((unused)) for function arguments" >&5 -$as_echo_n "checking for __attribute__((unused)) for function arguments... " >&6; } -if ${ax_cv___attribute__unused_arg+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - static void foo( int); - static void - foo(__attribute__ ((unused)) int i) { - return; - } - -int -main () -{ -func(1); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv___attribute__unused_arg=yes -else - ax_cv___attribute__unused_arg=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv___attribute__unused_arg" >&5 -$as_echo "$ax_cv___attribute__unused_arg" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((unused)) for functions" >&5 -$as_echo_n "checking for __attribute__((unused)) for functions... " >&6; } -if ${ax_cv___attribute__unused_func+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - static void foo(void) __attribute__ ((unused)); - static void - foo(void) { - return; - } - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv___attribute__unused_func=yes -else - ax_cv___attribute__unused_func=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv___attribute__unused_func" >&5 -$as_echo "$ax_cv___attribute__unused_func" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((noreturn))" >&5 -$as_echo_n "checking for __attribute__((noreturn))... " >&6; } -if ${ax_cv___attribute__noreturn+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - static void foo(void) __attribute__ ((noreturn)); - static void - foo(void) { - exit(1); - } - -int -main () -{ -foo(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv___attribute__noreturn=yes -else - ax_cv___attribute__noreturn=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv___attribute__noreturn" >&5 -$as_echo "$ax_cv___attribute__noreturn" >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for at least some __attribute__ support" >&5 -$as_echo_n "checking for at least some __attribute__ support... " >&6; } -if ${ax_cv___attribute__+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$ax_cv___attribute__unused_arg" = "yes" \ - || test "$ax_cv___attribute__unused_func" = "yes" \ - || test "$ax_cv___attribute__noreturn" = "yes" \ - ; then - ax_cv___attribute__=yes - else - ax_cv___attribute__=no - fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv___attribute__" >&5 -$as_echo "$ax_cv___attribute__" >&6; } - - if test "$ax_cv___attribute__unused_arg" = "yes"; then - -$as_echo "#define HAVE___ATTRIBUTE__UNUSED_ARG 1" >>confdefs.h - - fi - - if test "$ax_cv___attribute__unused_func" = "yes"; then - -$as_echo "#define HAVE___ATTRIBUTE__UNUSED_FUNC 1" >>confdefs.h - - fi - if test "$ax_cv___attribute__noreturn" = "yes"; then - -$as_echo "#define HAVE___ATTRIBUTE__NORETURN 1" >>confdefs.h - - fi - - if test "$ax_cv___attribute__" = "yes"; then - -$as_echo "#define HAVE___ATTRIBUTE__ 1" >>confdefs.h - - fi - - -if test -z "${nut_have_ax_c_printf_string_null_seen}"; then - nut_have_ax_c_printf_string_null_seen="yes" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for practical support to pritnf(\"%s\", NULL)" >&5 -$as_echo_n "checking for practical support to pritnf(\"%s\", NULL)... " >&6; } -if ${ax_cv__printf_string_null+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -char buf128; -char *s = NULL; -int res = snprintf(buf, sizeof(buf), "%s", s); -bufsizeof(buf)-1 = '\0'; -if (res < 0) { - printf(stderr, "FAILED to snprintf() a NULL string argument"); - exit 1; -} -if (buf0 == '\0') - printf(stderr, "RETURNED empty string from snprintf() with a NULL string argument"); - exit 0; -} -if (strcasestr(buf, 'null') == NULL) - printf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'", buf); - exit 0; -} -printf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'", buf); -exit 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ax_cv__printf_string_null=yes -else - ax_cv__printf_string_null=no - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include - -int -main () -{ -char buf128; -char *s = NULL; -int res = snprintf(buf, sizeof(buf), "%s", s); -bufsizeof(buf)-1 = '\0'; -if (res < 0) { - printf(stderr, "FAILED to snprintf() a NULL string argument"); - exit 1; -} -if (buf0 == '\0') - printf(stderr, "RETURNED empty string from snprintf() with a NULL string argument"); - exit 0; -} -if (strcasestr(buf, 'null') == NULL) - printf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'", buf); - exit 0; -} -printf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'", buf); -exit 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ax_cv__printf_string_null=yes -else - ax_cv__printf_string_null=no - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__printf_string_null" >&5 -$as_echo "$ax_cv__printf_string_null" >&6; } - - if test "$ax_cv__printf_string_null" = "yes"; then : - - -$as_echo "#define HAVE_PRINTF_STRING_NULL 1" >>confdefs.h - - -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi - -for ac_func in flock lockf fcvt fcvtl pow10 round abs_val abs +for ac_func in flock lockf fcvt fcvtl do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -10979,173 +6866,6 @@ _ACEOF fi done - -ac_fn_c_check_header_mongrel "$LINENO" "float.h" "ac_cv_header_float_h" "$ac_includes_default" -if test "x$ac_cv_header_float_h" = xyes; then : - -$as_echo "#define HAVE_FLOAT_H 1" >>confdefs.h - -fi - - -ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default" -if test "x$ac_cv_header_math_h" = xyes; then : - -$as_echo "#define HAVE_MATH_H 1" >>confdefs.h - -fi - - -for ac_func in fabs fabsf fabsl -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -ac_fn_c_check_header_mongrel "$LINENO" "limits.h" "ac_cv_header_limits_h" "$ac_includes_default" -if test "x$ac_cv_header_limits_h" = xyes; then : - -$as_echo "#define HAVE_LIMITS_H 1" >>confdefs.h - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "signal.h" "ac_cv_header_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_signal_h" = xyes; then : - -$as_echo "#define HAVE_SIGNAL_H 1" >>confdefs.h - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "sys/signal.h" "ac_cv_header_sys_signal_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_signal_h" = xyes; then : - -$as_echo "#define HAVE_SYS_SIGNAL_H 1" >>confdefs.h - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_resource_h" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct rlimit and getrlimit()" >&5 -$as_echo_n "checking for struct rlimit and getrlimit()... " >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include - -int -main () -{ -struct rlimit limit; -getrlimit(RLIMIT_NOFILE, &limit); -/* Do not care about actual return value in this test, - * normally check for non-zero meaning to look in errno */ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE_SYS_RESOURCE_H 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "semaphore.h" "ac_cv_header_semaphore_h" "$ac_includes_default" -if test "x$ac_cv_header_semaphore_h" = xyes; then : - -$as_echo "#define HAVE_SEMAPHORE_H 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sem_t, sem_init() and sem_destroy()" >&5 -$as_echo_n "checking for sem_t, sem_init() and sem_destroy()... " >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include - -int -main () -{ -sem_t semaphore; -sem_init(&semaphore, 0, 4); -sem_destroy(&semaphore); -/* Do not care about actual return value in this test, - * normally check for non-zero meaning to look in errno */ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -$as_echo "#define HAVE_SEMAPHORE 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -fi - - - for ac_func in cfsetispeed tcsendbreak do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -11195,411 +6915,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF -{ $as_echo "$as_me:${as_lineno-$LINENO}: ----------------------------------------------------------------------- -The next few tests look for required C library routines; if something is -not found, you may need to enable a different C standard or extension macro -version. You may also have to configure without extreme warning levels -since autotools tests fail those on their own and assume system lacks -stuff (although note we try to not involve standard -W* flags here). ------------------------------------------------------------------------" >&5 -$as_echo "$as_me: ----------------------------------------------------------------------- -The next few tests look for required C library routines; if something is -not found, you may need to enable a different C standard or extension macro -version. You may also have to configure without extreme warning levels -since autotools tests fail those on their own and assume system lacks -stuff (although note we try to not involve standard -W* flags here). ------------------------------------------------------------------------" >&6;} - for ac_func in strtok_r fileno localtime_r sigemptyset sigaction -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Required C library routine not found; try adding -D_POSIX_C_SOURCE=200112L" >&5 -$as_echo "$as_me: WARNING: Required C library routine not found; try adding -D_POSIX_C_SOURCE=200112L" >&2;} -fi -done - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes; then : - -$as_echo "#define HAVE_STRING_H 1" >>confdefs.h - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "strings.h" "ac_cv_header_strings_h" "$ac_includes_default" -if test "x$ac_cv_header_strings_h" = xyes; then : - -$as_echo "#define HAVE_STRINGS_H 1" >>confdefs.h - -fi - - - -CODE_STRINGINCL='#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif' - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strcasecmp(s1,s2)" >&5 -$as_echo_n "checking for strcasecmp(s1,s2)... " >&6; } -if ${ac_cv_func_strcasecmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -if (strcasecmp("STR1", "str1") != 0) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_strcasecmp=yes -else - ac_cv_func_strcasecmp=no - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -if (strcasecmp("STR1", "str1") != 0) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_strcasecmp=yes -else - ac_cv_func_strcasecmp=no - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strcasecmp" >&5 -$as_echo "$ac_cv_func_strcasecmp" >&6; } -if test x"${ac_cv_func_strcasecmp}" = xyes; then : - -$as_echo "#define HAVE_STRCASECMP 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Required C library routine strcasecmp not found; try adding __EXTENSIONS__" >&5 -$as_echo "$as_me: WARNING: Required C library routine strcasecmp not found; try adding __EXTENSIONS__" >&2;} - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strncasecmp(s1,s2,n)" >&5 -$as_echo_n "checking for strncasecmp(s1,s2,n)... " >&6; } -if ${ac_cv_func_strncasecmp+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -if (strncasecmp("STR1", "strX", 2) != 0) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_strncasecmp=yes -else - ac_cv_func_strncasecmp=no - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -if (strncasecmp("STR1", "strX", 2) != 0) return 1 - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_strncasecmp=yes -else - ac_cv_func_strncasecmp=no - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strncasecmp" >&5 -$as_echo "$ac_cv_func_strncasecmp" >&6; } -if test x"${ac_cv_func_strncasecmp}" = xyes; then : - -$as_echo "#define HAVE_STRNCASECMP 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Required C library routine strncasecmp not found; try adding __EXTENSIONS__" >&5 -$as_echo "$as_me: WARNING: Required C library routine strncasecmp not found; try adding __EXTENSIONS__" >&2;} - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strdup(s)" >&5 -$as_echo_n "checking for strdup(s)... " >&6; } -if ${ac_cv_func_strdup+:} false; then : - $as_echo_n "(cached) " >&6 -else - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -int res = 0; -char *t = "Test"; -char *s = strdup(t); -if (!s || !(s[0]=='T'&&s[1]=='e'&&s[2]=='s'&&s[3]=='t'&&s[4]=='\0') || s == t) res = 1; -if (s) free (s); -if (res != 0) return res -/* autoconf adds ";return 0;" */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_strdup=yes -else - ac_cv_func_strdup=no - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$CODE_STRINGINCL -int -main () -{ -int res = 0; -char *t = "Test"; -char *s = strdup(t); -if (!s || !(s[0]=='T'&&s[1]=='e'&&s[2]=='s'&&s[3]=='t'&&s[4]=='\0') || s == t) res = 1; -if (s) free (s); -if (res != 0) return res -/* autoconf adds ";return 0;" */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_strdup=yes -else - ac_cv_func_strdup=no - -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strdup" >&5 -$as_echo "$ac_cv_func_strdup" >&6; } -if test x"${ac_cv_func_strdup}" = xyes; then : - -$as_echo "#define HAVE_STRDUP 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Required C library routine strdup not found; try adding -D_POSIX_C_SOURCE=200112L" >&5 -$as_echo "$as_me: WARNING: Required C library routine strdup not found; try adding -D_POSIX_C_SOURCE=200112L" >&2;} - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for usleep(us)" >&5 -$as_echo_n "checking for usleep(us)... " >&6; } -if ${ac_cv_func_usleep+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -useconds_t us = 1000; -if (usleep(us) != 0) return 1 /* per doc, no erros are returned actually*/ -/* autoconf adds ";return 0;" */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_func_usleep=yes -else - ac_cv_func_usleep=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_usleep" >&5 -$as_echo "$ac_cv_func_usleep" >&6; } -if test x"${ac_cv_func_usleep}" = xyes; then : - -$as_echo "#define HAVE_USLEEP 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Required C library routine usleep not found; try adding -D_POSIX_C_SOURCE=200112L" >&5 -$as_echo "$as_me: WARNING: Required C library routine usleep not found; try adding -D_POSIX_C_SOURCE=200112L" >&2;} - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -sr works" >&5 -$as_echo_n "checking whether ln -sr works... " >&6; } -LN_S_R="cp -pR" -if test "$as_ln_s" = "ln -s" ; then - LN_S_R="ln" - DIR1="$(mktemp -d "dir1.XXXXXXX")" && \ - DIR2="$(mktemp -d "dir2.XXXXXXX")" && \ - touch "${DIR1}/a" && \ - $as_ln_s -r "${DIR1}/a" "${DIR2}/b" && \ - ls -la "${DIR2}/b" | grep '\.\./' > /dev/null && \ - LN_S_R="$as_ln_s -r" - rm -rf "${DIR1}" "${DIR2}" -fi -LN_S_R=${LN_S_R} - -if test "$LN_S_R" = "ln -s -r" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S_R" >&5 -$as_echo "no, using $LN_S_R" >&6; } -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 -$as_echo_n "checking for unsigned long long int... " >&6; } -if ${ac_cv_type_unsigned_long_long_int+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_type_unsigned_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - /* For now, do not test the preprocessor; as of 2007 there are too many - implementations with broken preprocessors. Perhaps this can - be revisited in 2012. In the meantime, code should not expect - #if to work with literals wider than 32 bits. */ - /* Test literals. */ - long long int ll = 9223372036854775807ll; - long long int nll = -9223372036854775807LL; - unsigned long long int ull = 18446744073709551615ULL; - /* Test constant expressions. */ - typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) - ? 1 : -1)]; - typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 - ? 1 : -1)]; - int i = 63; -int -main () -{ -/* Test availability of runtime routines for shift and division. */ - long long int llmax = 9223372036854775807ll; - unsigned long long int ullmax = 18446744073709551615ull; - return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) - | (llmax / ll) | (llmax % ll) - | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) - | (ullmax / ull) | (ullmax % ull)); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -else - ac_cv_type_unsigned_long_long_int=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_unsigned_long_long_int" >&5 -$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; } - if test $ac_cv_type_unsigned_long_long_int = yes; then - -$as_echo "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h - - fi - for ac_func in vsnprintf snprintf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -11660,47 +6975,75 @@ $as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for long long int" >&5 $as_echo_n "checking for long long int... " >&6; } if ${ac_cv_type_long_long_int+:} false; then : $as_echo_n "(cached) " >&6 else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* For now, do not test the preprocessor; as of 2007 there are too many + implementations with broken preprocessors. Perhaps this can + be revisited in 2012. In the meantime, code should not expect + #if to work with literals wider than 32 bits. */ + /* Test literals. */ + long long int ll = 9223372036854775807ll; + long long int nll = -9223372036854775807LL; + unsigned long long int ull = 18446744073709551615ULL; + /* Test constant expressions. */ + typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll) + ? 1 : -1)]; + typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1 + ? 1 : -1)]; + int i = 63; +int +main () +{ +/* Test availability of runtime routines for shift and division. */ + long long int llmax = 9223372036854775807ll; + unsigned long long int ullmax = 18446744073709551615ull; + return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i) + | (llmax / ll) | (llmax % ll) + | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i) + | (ullmax / ull) | (ullmax % ull)); + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if test "$cross_compiling" = yes; then : ac_cv_type_long_long_int=yes - if test "x${ac_cv_prog_cc_c99-no}" = xno; then - ac_cv_type_long_long_int=$ac_cv_type_unsigned_long_long_int - if test $ac_cv_type_long_long_int = yes; then - if test "$cross_compiling" = yes; then : - : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include - #ifndef LLONG_MAX - # define HALF \ - (1LL << (sizeof (long long int) * CHAR_BIT - 2)) - # define LLONG_MAX (HALF - 1 + HALF) - #endif + #ifndef LLONG_MAX + # define HALF \ + (1LL << (sizeof (long long int) * CHAR_BIT - 2)) + # define LLONG_MAX (HALF - 1 + HALF) + #endif int main () { long long int n = 1; - int i; - for (i = 0; ; i++) - { - long long int m = n << i; - if (m >> i != n) - return 1; - if (LLONG_MAX / 2 < m) - break; - } - return 0; + int i; + for (i = 0; ; i++) + { + long long int m = n << i; + if (m >> i != n) + return 1; + if (LLONG_MAX / 2 < m) + break; + } + return 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : - + ac_cv_type_long_long_int=yes else ac_cv_type_long_long_int=no fi @@ -11708,8 +7051,11 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - fi - fi +else + ac_cv_type_long_long_int=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_long_long_int" >&5 $as_echo "$ac_cv_type_long_long_int" >&6; } @@ -11765,6 +7111,217 @@ fi + + + + + + + + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CPPUNIT" >&5 +$as_echo_n "checking for CPPUNIT... " >&6; } + +if test -n "$CPPUNIT_CFLAGS"; then + pkg_cv_CPPUNIT_CFLAGS="$CPPUNIT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cppunit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CPPUNIT_CFLAGS=`$PKG_CONFIG --cflags "cppunit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$CPPUNIT_LIBS"; then + pkg_cv_CPPUNIT_LIBS="$CPPUNIT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "cppunit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_CPPUNIT_LIBS=`$PKG_CONFIG --libs "cppunit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cppunit" 2>&1` + else + CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cppunit" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$CPPUNIT_PKG_ERRORS" >&5 + + have_cppunit=no +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + have_cppunit=no +else + CPPUNIT_CFLAGS=$pkg_cv_CPPUNIT_CFLAGS + CPPUNIT_LIBS=$pkg_cv_CPPUNIT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + have_cppunit=yes +fi +if test "${have_cppunit}" != "yes" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcppunit not found." >&5 +$as_echo "$as_me: WARNING: libcppunit not found." >&2;} +fi + if test "${have_cppunit}" = "yes"; then + HAVE_CPPUNIT_TRUE= + HAVE_CPPUNIT_FALSE='#' +else + HAVE_CPPUNIT_TRUE='#' + HAVE_CPPUNIT_FALSE= +fi + + +if ( test "${GCC}" = "yes" ) +then + CFLAGS="${CFLAGS} -Wall -Wsign-compare" +fi + case ${target_os} in solaris2* ) CFLAGS="${CFLAGS} -D_REENTRANT" @@ -12041,42 +7598,42 @@ if test "$ac_res" != no; then : fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if ${ac_cv_header_time+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} _ACEOF - +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no fi - -done - - - - - - - - - - - - -if test "$ac_cv_header_sys_time_h" = yes; then : +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h - fi -for ac_header in sys/modem.h stdarg.h varargs.h +for ac_header in sys/modem.h stdarg.h varargs.h sys/termios.h sys/time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default @@ -12091,7 +7648,7 @@ fi done - +# pthread related checks { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5 $as_echo_n "checking for library containing pthread_create... " >&6; } if ${ac_cv_search_pthread_create+:} false; then : @@ -12148,310 +7705,12 @@ if test "$ac_res" != no; then : $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_tryjoin_np" >&5 -$as_echo_n "checking for library containing pthread_tryjoin_np... " >&6; } -if ${ac_cv_search_pthread_tryjoin_np+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pthread_tryjoin_np (); -int -main () -{ -return pthread_tryjoin_np (); - ; - return 0; -} -_ACEOF -for ac_lib in '' pthread; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_pthread_tryjoin_np=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_pthread_tryjoin_np+:} false; then : - break -fi -done -if ${ac_cv_search_pthread_tryjoin_np+:} false; then : - -else - ac_cv_search_pthread_tryjoin_np=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_tryjoin_np" >&5 -$as_echo "$ac_cv_search_pthread_tryjoin_np" >&6; } -ac_res=$ac_cv_search_pthread_tryjoin_np -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -$as_echo "#define HAVE_PTHREAD_TRYJOIN 1" >>confdefs.h - -fi - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for windows.h" >&5 -$as_echo_n "checking for windows.h... " >&6; } -if ${nut_cv_header_windows_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - -int -main () -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - nut_cv_header_windows_h="yes" - -else - - nut_cv_header_windows_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_header_windows_h" >&5 -$as_echo "$nut_cv_header_windows_h" >&6; } - case "$nut_cv_header_windows_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINDOWS_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for winsock2.h" >&5 -$as_echo_n "checking for winsock2.h... " >&6; } -if ${nut_cv_header_winsock2_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - -int -main () -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - nut_cv_header_winsock2_h="yes" - -else - - nut_cv_header_winsock2_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_header_winsock2_h" >&5 -$as_echo "$nut_cv_header_winsock2_h" >&6; } - case "$nut_cv_header_winsock2_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WINSOCK2_H 1 -_ACEOF - - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ws2tcpip.h" >&5 -$as_echo_n "checking for ws2tcpip.h... " >&6; } -if ${nut_cv_header_ws2tcpip_h+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#include - -int -main () -{ - -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WS2TCPIP_H shall not be defined. -#else - int dummy=2*IP_PKTINFO; -#endif - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - nut_cv_header_ws2tcpip_h="yes" - -else - - nut_cv_header_ws2tcpip_h="no" - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_header_ws2tcpip_h" >&5 -$as_echo "$nut_cv_header_ws2tcpip_h" >&6; } - case "$nut_cv_header_ws2tcpip_h" in - yes) - -cat >>confdefs.h <<_ACEOF -#define HAVE_WS2TCPIP_H 1 -_ACEOF - - ;; - esac - - - HEADERS_SOCKLEN_T=' -#undef inline -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -# define GNICALLCONV WSAAPI -# define GNICALLLINK WINSOCK_API_LINKAGE -#else -# ifdef HAVE_SYS_TYPES_H -# include -# endif -# ifdef HAVE_SYS_SOCKET_H -# include -# endif -# ifdef HAVE_NETDB_H -# include -# endif -# define GNICALLCONV -# define GNICALLLINK -#endif -' - ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "${HEADERS_SOCKLEN_T} + ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" "#include +#include " if test "x$ac_cv_type_socklen_t" = xyes; then : @@ -12465,26 +7724,22 @@ else # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - nut_cv_socklen_t_equiv= - for arg1 in "int" "SOCKET"; do - for arg2 in "struct sockaddr" void; do - for arg3 in int size_t unsigned long "unsigned long"; do + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -${HEADERS_SOCKLEN_T} - GNICALLLINK int GNICALLCONV getpeername ($arg1, $arg2 *, $arg3 *); + +#include +#include + + int getpeername (int, $arg2 *, $t *); int main () { - $arg3 len; + $t len; getpeername(0,0,&len); ; @@ -12493,20 +7748,13 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - nut_cv_socklen_t_equiv="$arg3" + nut_cv_socklen_t_equiv="$t" break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done - done done - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "x$nut_cv_socklen_t_equiv" = x; then as_fn_error $? "Cannot find a type to use in place of socklen_t" "$LINENO" 5 @@ -12525,746 +7773,6 @@ fi - for ac_header in sys/types.h sys/socket.h netdb.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for getnameinfo" >&5 -$as_echo_n "checking types of arguments for getnameinfo... " >&6; } -if ${nut_cv_func_getnameinfo_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - - nut_cv_func_getnameinfo_args="unknown" - for gni_arg1 in 'const struct sockaddr *' 'struct sockaddr *' 'void *'; do - for gni_arg2 in 'socklen_t' 'size_t' 'int'; do - for gni_arg46 in 'socklen_t' 'size_t' 'int' 'unsigned int'; do - for gni_arg7 in 'int' 'unsigned int'; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - -#undef inline -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -# define GNICALLCONV WSAAPI -#else -# ifdef HAVE_SYS_TYPES_H -# include -# endif -# ifdef HAVE_SYS_SOCKET_H -# include -# endif -# ifdef HAVE_NETDB_H -# include -# endif -# define GNICALLCONV -#endif - extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, - char *, $gni_arg46, - char *, $gni_arg46, - $gni_arg7); - -int -main () -{ - - $gni_arg2 salen=0; - $gni_arg46 hostlen=0; - $gni_arg46 servlen=0; - $gni_arg7 flags=0; - int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - nut_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" - break 4 - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - done - done - done - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_func_getnameinfo_args" >&5 -$as_echo "$nut_cv_func_getnameinfo_args" >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - if test "$nut_cv_func_getnameinfo_args" = "unknown"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for getnameinfo args" >&5 -$as_echo "$as_me: WARNING: Cannot find proper types to use for getnameinfo args" >&2;} - else - gni_prev_IFS=$IFS; IFS=',' - set dummy `echo "$nut_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` - IFS=$gni_prev_IFS - shift - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG1 $1 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG2 $2 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG46 $3 -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define GETNAMEINFO_TYPE_ARG7 $4 -_ACEOF - - fi - - - - if test -z "${nut_with_python}"; then : - - -# Check whether --with-python was given. -if test "${with_python+set}" = set; then : - withval=$with_python; nut_with_python="${withval}" -else - nut_with_python="auto" - -fi - - - - PYTHON="" - case ${nut_with_python} in #( - auto|yes|"") : - for ac_prog in python python3 python2 -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$PYTHON"; then - ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PYTHON="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PYTHON=$ac_cv_prog_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PYTHON" && break -done -test -n "$PYTHON" || PYTHON="_python_runtime" - ;; #( - no) : - PYTHON="no" ;; #( - *) : - PYTHON="${nut_with_python}" - ;; -esac - - case ${PYTHON} in #( - _python_runtime) : - - PYTHON="/usr/bin/env python" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python program name was not detected during configuration, will default to '$PYTHON' (scripts will fail if that is not in PATH at run time)" >&5 -$as_echo "$as_me: WARNING: A python program name was not detected during configuration, will default to '$PYTHON' (scripts will fail if that is not in PATH at run time)" >&2;} ;; #( - no) : - ;; #( - /*" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - ;; #( - /*) : - ;; #( - *" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - PYTHON="/usr/bin/env ${PYTHON}" - ;; #( - *" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&2;} - PYTHON="/usr/bin/env ${PYTHON}" - ;; #( - *) : - PYTHON="/usr/bin/env ${PYTHON}" - ;; #( - *) : - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python interpeter to call" >&5 -$as_echo_n "checking python interpeter to call... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${PYTHON}" >&5 -$as_echo "${PYTHON}" >&6; } - PYTHON=${PYTHON} - - if test "${PYTHON}" != "no"; then - HAVE_PYTHON_TRUE= - HAVE_PYTHON_FALSE='#' -else - HAVE_PYTHON_TRUE='#' - HAVE_PYTHON_FALSE= -fi - - if test -n "${PYTHON}"; then : - export PYTHON -fi - -fi - - - if test -z "${nut_with_python2}"; then : - - -# Check whether --with-python2 was given. -if test "${with_python2+set}" = set; then : - withval=$with_python2; nut_with_python2="${withval}" -else - nut_with_python2="auto" - -fi - - - - PYTHON2="" - case ${nut_with_python2} in #( - auto|yes|"") : - for ac_prog in python2 python2.7 python-2.7 python -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PYTHON2+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$PYTHON2"; then - ac_cv_prog_PYTHON2="$PYTHON2" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PYTHON2="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PYTHON2=$ac_cv_prog_PYTHON2 -if test -n "$PYTHON2"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON2" >&5 -$as_echo "$PYTHON2" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PYTHON2" && break -done -test -n "$PYTHON2" || PYTHON2="_python2_runtime" - ;; #( - no) : - PYTHON2="no" ;; #( - *) : - PYTHON2="${nut_with_python2}" - ;; -esac - - case ${PYTHON2} in #( - _python2_runtime) : - - PYTHON2="/usr/bin/env python2" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python2 program name was not detected during configuration, will default to '$PYTHON2' (scripts will fail if that is not in PATH at run time)" >&5 -$as_echo "$as_me: WARNING: A python2 program name was not detected during configuration, will default to '$PYTHON2' (scripts will fail if that is not in PATH at run time)" >&2;} ;; #( - no) : - ;; #( - /*" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - ;; #( - /*) : - ;; #( - *" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - PYTHON2="/usr/bin/env ${PYTHON2}" - ;; #( - *" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python2 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python2 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&2;} - PYTHON2="/usr/bin/env ${PYTHON2}" - ;; #( - *) : - PYTHON2="/usr/bin/env ${PYTHON2}" - ;; #( - *) : - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python2 interpeter to call" >&5 -$as_echo_n "checking python2 interpeter to call... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${PYTHON2}" >&5 -$as_echo "${PYTHON2}" >&6; } - PYTHON2=${PYTHON2} - - if test "${PYTHON2}" != "no"; then - HAVE_PYTHON2_TRUE= - HAVE_PYTHON2_FALSE='#' -else - HAVE_PYTHON2_TRUE='#' - HAVE_PYTHON2_FALSE= -fi - - if test -n "${PYTHON2}"; then : - export PYTHON2 -fi - -fi - - - if test -z "${nut_with_python3}"; then : - - -# Check whether --with-python3 was given. -if test "${with_python3+set}" = set; then : - withval=$with_python3; nut_with_python3="${withval}" -else - nut_with_python3="auto" - -fi - - - - PYTHON3="" - case ${nut_with_python3} in #( - auto|yes|"") : - for ac_prog in python3 python3.9 python-3.9 python3.7 python-3.7 python3.5 python-3.5 python -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_PYTHON3+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$PYTHON3"; then - ac_cv_prog_PYTHON3="$PYTHON3" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_PYTHON3="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -PYTHON3=$ac_cv_prog_PYTHON3 -if test -n "$PYTHON3"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON3" >&5 -$as_echo "$PYTHON3" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$PYTHON3" && break -done -test -n "$PYTHON3" || PYTHON3="_python3_runtime" - ;; #( - no) : - PYTHON3="no" ;; #( - *) : - PYTHON3="${nut_with_python3}" - ;; -esac - - case ${PYTHON3} in #( - _python3_runtime) : - - PYTHON3="/usr/bin/env python3" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python3 program name was not detected during configuration, will default to '$PYTHON3' (scripts will fail if that is not in PATH at run time)" >&5 -$as_echo "$as_me: WARNING: A python3 program name was not detected during configuration, will default to '$PYTHON3' (scripts will fail if that is not in PATH at run time)" >&2;} ;; #( - no) : - ;; #( - /*" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - ;; #( - /*) : - ;; #( - *" "*" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable" >&2;} - PYTHON3="/usr/bin/env ${PYTHON3}" - ;; #( - *" "*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A python3 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&5 -$as_echo "$as_me: WARNING: A python3 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable" >&2;} - PYTHON3="/usr/bin/env ${PYTHON3}" - ;; #( - *) : - PYTHON3="/usr/bin/env ${PYTHON3}" - ;; #( - *) : - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python3 interpeter to call" >&5 -$as_echo_n "checking python3 interpeter to call... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${PYTHON3}" >&5 -$as_echo "${PYTHON3}" >&6; } - PYTHON3=${PYTHON3} - - if test "${PYTHON3}" != "no"; then - HAVE_PYTHON3_TRUE= - HAVE_PYTHON3_FALSE='#' -else - HAVE_PYTHON3_TRUE='#' - HAVE_PYTHON3_FALSE= -fi - - if test -n "${PYTHON3}"; then : - export PYTHON3 -fi - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which drivers to build" >&5 -$as_echo_n "checking which drivers to build... " >&6; } - -# Check whether --with-drivers was given. -if test "${with_drivers+set}" = set; then : - withval=$with_drivers; - case "${withval}" in - yes|no|'') - as_fn_error $? "invalid option --with(out)-drivers - see docs/configure.txt" "$LINENO" 5 - ;; - all) - DRIVER_BUILD_LIST="all" - if test -z "${with_serial}"; then with_serial="yes"; fi - if test -z "${with_usb}"; then with_usb="yes"; fi - if test -z "${with_snmp}"; then with_snmp="yes"; fi - if test -z "${with_neon}"; then with_neon="yes"; fi - if test -z "${with_powerman}"; then with_powerman="yes"; fi - if test -z "${with_modbus}"; then with_modbus="yes"; fi - if test -z "${with_ipmi}"; then with_ipmi="yes"; fi - - if test -z "${with_linux_i2c}"; then - case ${target_os} in - linux*) with_linux_i2c="yes";; - *) with_linux_i2c="auto";; - esac - fi - if test -z "${with_macosx_ups}"; then - if test -d /System/Library/Frameworks/IOKit.framework/ ; then - with_macosx_ups="yes" - else - with_macosx_ups="auto" - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_BUILD_LIST}" >&5 -$as_echo "${DRIVER_BUILD_LIST}" >&6; } - ;; - auto) - DRIVER_BUILD_LIST="all" - if test -z "${with_serial}"; then with_serial="${withval}"; fi - if test -z "${with_usb}"; then with_usb="${withval}"; fi - if test -z "${with_snmp}"; then with_snmp="${withval}"; fi - if test -z "${with_neon}"; then with_neon="${withval}"; fi - if test -z "${with_powerman}"; then with_powerman="${withval}"; fi - if test -z "${with_modbus}"; then with_modbus="${withval}"; fi - if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi - if test -z "${with_linux_i2c}"; then with_linux_i2c="${withval}"; fi - if test -z "${with_macosx_ups}"; then with_macosx_ups="${withval}"; fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_BUILD_LIST}" >&5 -$as_echo "${DRIVER_BUILD_LIST}" >&6; } - ;; - *) - DRIVER_BUILD_LIST="`echo ${withval} | sed 's/,/ /g'`" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_BUILD_LIST}" >&5 -$as_echo "${DRIVER_BUILD_LIST}" >&6; } - - if test -n "$DRIVER_BUILD_LIST"; then : - DRVLIST_NAMES=" - SERIAL_DRIVERLIST USB_LIBUSB_DRIVERLIST SERIAL_USB_DRIVERLIST - SNMP_DRIVERLIST NEONXML_DRIVERLIST - MACOSX_DRIVERLIST MODBUS_DRIVERLIST LINUX_I2C_DRIVERLIST - POWERMAN_DRIVERLIST IPMI_DRIVERLIST" - - get_drvlist() ( - LB="["; RB="]" - SPACE="`printf "$LB"' \t'"$RB"`" - SPACES="${SPACE}*" - sed -e "s/${SPACES}""$LB"'+'"$RB"'*='"${SPACES}/=/" \ - -e "s/^${SPACES}//" < drivers/Makefile.am \ - | { - C=false; V=false - while read LINE ; do - case "$LINE" in - *'\') C=true; if $V ; then echo "$LINE" ; fi ;; - *) C=false; V=false ;; - esac - case "$LINE" in - "$1"=*) - echo "$LINE" | sed -e 's,^'"$LB"'^='"$RB"'*=,,' -e 's,\$,,' - V=$C - ;; - esac - done - } | tr '\n' ' ' | sed -e "s,${SPACE}${SPACES}, ," -e "s,${SPACES}\$,," - ) - - for DRVLIST_NAME in $DRVLIST_NAMES; do - OUT="`get_drvlist "$DRVLIST_NAME"`" \ - && test -n "$OUT" || OUT="" - eval $DRVLIST_NAME="\$OUT" - { $as_echo "$as_me:${as_lineno-$LINENO}: Will check custom driver selection against $DRVLIST_NAME=\"$OUT\"" >&5 -$as_echo "$as_me: Will check custom driver selection against $DRVLIST_NAME=\"$OUT\"" >&6;} - done - - for DRV in $DRIVER_BUILD_LIST ; do - - DRV_HITS="" - for DRVLIST_NAME in $DRVLIST_NAMES; do - eval DRVLIST="\${$DRVLIST_NAME}" - - for DN in $DRVLIST ; do - if test x"$DN" = x"$DRV"; then : - - DRV_HITS="$DRV_HITS $DRVLIST_NAME" - case "$DRVLIST_NAME" in #( - SERIAL_DRIVERLIST) : - - if test -z "${with_serial}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-serial=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-serial=yes for driver \"$DRV\"" >&6;} - with_serial=yes - -fi ;; #( - USB_LIBUSB_DRIVERLIST) : - - if test -z "${with_usb}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-usb=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-usb=yes for driver \"$DRV\"" >&6;} - with_usb=yes - -fi ;; #( - SERIAL_USB_DRIVERLIST) : - - if test -z "${with_usb}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-usb=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-usb=yes for driver \"$DRV\"" >&6;} - with_usb=yes - -fi - if test -z "${with_serial}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-serial=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-serial=yes for driver \"$DRV\"" >&6;} - with_serial=yes - -fi ;; #( - SNMP_DRIVERLIST) : - - if test -z "${with_snmp}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-snmp=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-snmp=yes for driver \"$DRV\"" >&6;} - with_snmp=yes - -fi ;; #( - NEONXML_DRIVERLIST) : - - if test -z "${with_neon}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-neon=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-neon=yes for driver \"$DRV\"" >&6;} - with_neon=yes - -fi ;; #( - MACOSX_DRIVERLIST) : - - if test -z "${with_macosx_ups}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-macosx-ups=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-macosx-ups=yes for driver \"$DRV\"" >&6;} - with_macosx_ups=yes - -fi ;; #( - MODBUS_DRIVERLIST) : - - if test -z "${with_modbus}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-modbus=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-modbus=yes for driver \"$DRV\"" >&6;} - with_modbus=yes - -fi ;; #( - LINUX_I2C_DRIVERLIST) : - - if test -z "${with_linux_i2c}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-linux-i2c=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-linux-i2c=yes for driver \"$DRV\"" >&6;} - with_linux_i2c=yes - -fi ;; #( - POWERMAN_DRIVERLIST) : - - if test -z "${with_powerman}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-powerman=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-powerman=yes for driver \"$DRV\"" >&6;} - with_powerman=yes - -fi ;; #( - IPMI_DRIVERLIST) : - - if test -z "${with_ipmi}"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Requiring --with-ipmi=yes for driver \"$DRV\"" >&5 -$as_echo "$as_me: Requiring --with-ipmi=yes for driver \"$DRV\"" >&6;} - with_ipmi=yes - -fi ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unhandled DRVLIST_NAME=$DRVLIST_NAME" >&5 -$as_echo "$as_me: WARNING: Unhandled DRVLIST_NAME=$DRVLIST_NAME" >&2;} - ;; -esac - break - -fi - done - done - if test -z "${DRV_HITS}"; then : - as_fn_error $? "Requested driver '$DRV' is not defined in drivers/Makefile.am (or configure.ac has a bug/lag detecting driver lists)" "$LINENO" 5 -fi - - done - -fi - - ;; - esac - -else - - DRIVER_BUILD_LIST="all" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 -$as_echo "all available" >&6; } - -fi - - if test "${DRIVER_BUILD_LIST}" != "all"; then - SOME_DRIVERS_TRUE= - SOME_DRIVERS_FALSE='#' -else - SOME_DRIVERS_TRUE='#' - SOME_DRIVERS_FALSE= -fi - - -if test "${DRIVER_BUILD_LIST}" != "all"; then - if test -z "${nut_report_feature_flag}"; then - nut_report_feature_flag="1" - ac_clean_files="${ac_clean_files} conf_nut_report_feature" - echo > conf_nut_report_feature - echo "Configuration summary:" >> conf_nut_report_feature - echo "======================" >> conf_nut_report_feature - fi - echo "only build specific drivers: ${DRIVER_BUILD_LIST}" >> conf_nut_report_feature - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-all" >&5 $as_echo_n "checking for --with-all... " >&6; } @@ -13273,32 +7781,15 @@ $as_echo_n "checking for --with-all... " >&6; } if test "${with_all+set}" = set; then : withval=$with_all; if test -n "${withval}"; then - if test -z "${with_serial}"; then with_serial="${withval}"; fi + if test -z "${with_serial}"; then with_serial="${withval}"; fi if test -z "${with_usb}"; then with_usb="${withval}"; fi if test -z "${with_snmp}"; then with_snmp="${withval}"; fi if test -z "${with_neon}"; then with_neon="${withval}"; fi if test -z "${with_powerman}"; then with_powerman="${withval}"; fi - if test -z "${with_modbus}"; then with_modbus="${withval}"; fi - if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi - - if test -z "${with_linux_i2c}"; then - with_linux_i2c="${withval}" - case ${target_os} in - linux*) ;; - *) test x"${withval}" = xno || with_linux_i2c="auto" ;; - esac - fi - if test -z "${with_macosx_ups}"; then - with_macosx_ups="${withval}" - if ! test -d /System/Library/Frameworks/IOKit.framework/ ; then - test x"${withval}" = xno || with_macosx_ups="auto" - fi - fi - - if test -z "${with_cgi}"; then with_cgi="${withval}"; fi + if test -z "${with_cgi}"; then with_cgi="${withval}"; fi if test -z "${with_dev}"; then with_dev="${withval}"; fi if test -z "${with_avahi}"; then with_avahi="${withval}"; fi - + if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: \"${withval}\"" >&5 $as_echo "\"${withval}\"" >&6; } else @@ -13326,48 +7817,6 @@ fi - -# Check whether --with-docs was given. -if test "${with_docs+set}" = set; then : - withval=$with_docs; nut_with_docs="${withval}" -else - nut_with_docs="man=auto" - -fi - - - -# Check whether --with-doc was given. -if test "${with_doc+set}" = set; then : - withval=$with_doc; nut_with_doc="${withval}" -else - nut_with_doc="${nut_with_docs}" - -fi - - - - # Check whether --enable-warnings was given. -if test "${enable_warnings+set}" = set; then : - enableval=$enable_warnings; nut_enable_warnings="${enableval}" -else - nut_enable_warnings="auto" - -fi - - - # Check whether --enable-Werror was given. -if test "${enable_Werror+set}" = set; then : - enableval=$enable_Werror; nut_enable_Werror="${enableval}" -else - nut_enable_Werror="no" - -fi - - - - - # Check whether --with-serial was given. if test "${with_serial+set}" = set; then : withval=$with_serial; nut_with_serial="${withval}" @@ -13378,8 +7827,6 @@ fi - - # Check whether --with-usb was given. if test "${with_usb+set}" = set; then : withval=$with_usb; nut_with_usb="${withval}" @@ -13389,1368 +7836,44 @@ else fi -nut_usb_lib="" - -if test -z "${nut_have_libusb_seen}"; then - nut_have_libusb_seen=yes - -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes +# Check whether --with-doc was given. +if test "${with_doc+set}" = set; then : + withval=$with_doc; nut_with_doc="${withval}" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - + nut_with_doc="no" fi - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 + + +# Check whether --with-avahi was given. +if test "${with_avahi+set}" = set; then : + withval=$with_avahi; nut_with_avahi="${withval}" else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS + nut_with_avahi="auto" - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } fi -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - - CFLAGS_ORIG="${CFLAGS}" - LIBS_ORIG="${LIBS}" - CFLAGS="" - LIBS="" - - nut_usb_lib="" - - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb-1.0 version via pkg-config" >&5 -$as_echo_n "checking for libusb-1.0 version via pkg-config... " >&6; } - LIBUSB_1_0_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb-1.0 2>/dev/null`" \ - && test -n "${LIBUSB_1_0_VERSION}" \ - || LIBUSB_1_0_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_1_0_VERSION} found" >&5 -$as_echo "${LIBUSB_1_0_VERSION} found" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb(-0.1) version via pkg-config" >&5 -$as_echo_n "checking for libusb(-0.1) version via pkg-config... " >&6; } - LIBUSB_0_1_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb 2>/dev/null`" \ - && test -n "${LIBUSB_0_1_VERSION}" \ - || LIBUSB_0_1_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_0_1_VERSION} found" >&5 -$as_echo "${LIBUSB_0_1_VERSION} found" >&6; } - -else - LIBUSB_0_1_VERSION="none" - LIBUSB_1_0_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libusb settings via pkg-config" >&5 -$as_echo "$as_me: can not check libusb settings via pkg-config" >&6;} - - -fi - - for ac_prog in libusb-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_LIBUSB_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $LIBUSB_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_LIBUSB_CONFIG="$LIBUSB_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_LIBUSB_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -LIBUSB_CONFIG=$ac_cv_path_LIBUSB_CONFIG -if test -n "$LIBUSB_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBUSB_CONFIG" >&5 -$as_echo "$LIBUSB_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$LIBUSB_CONFIG" && break -done -test -n "$LIBUSB_CONFIG" || LIBUSB_CONFIG="none" - - - -# Check whether --with-libusb-config was given. -if test "${with_libusb_config+set}" = set; then : - withval=$with_libusb_config; - case "${withval}" in #( - "") : - ;; #( - yes|no) : - - as_fn_error $? "invalid option --with(out)-libusb-config - see docs/configure.txt" "$LINENO" 5 - ;; #( - *) : - LIBUSB_CONFIG="${withval}" - - ;; -esac - - -fi - - - if test x"${LIBUSB_CONFIG}" != xnone; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking via ${LIBUSB_CONFIG}" >&5 -$as_echo_n "checking via ${LIBUSB_CONFIG}... " >&6; } - LIBUSB_CONFIG_VERSION="`$LIBUSB_CONFIG --version 2>/dev/null`" \ - && test -n "${LIBUSB_CONFIG_VERSION}" \ - || LIBUSB_CONFIG_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_CONFIG_VERSION} found" >&5 -$as_echo "${LIBUSB_CONFIG_VERSION} found" >&6; } - -else - LIBUSB_CONFIG_VERSION="none" - -fi - - if test x"${LIBUSB_1_0_VERSION}" != xnone; then : - LIBUSB_VERSION="${LIBUSB_1_0_VERSION}" - nut_usb_lib="(libusb-1.0)" - -else - if test x"${LIBUSB_0_1_VERSION}" != xnone; then : - LIBUSB_VERSION="${LIBUSB_0_1_VERSION}" - nut_usb_lib="(libusb-0.1)" - -else - LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}" - if test x"${LIBUSB_CONFIG_VERSION}" != xnone; then : - nut_usb_lib="(libusb-0.1-config)" -else - nut_usb_lib="" - -fi - -fi - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb preferred version" >&5 -$as_echo_n "checking for libusb preferred version... " >&6; } - case "${nut_with_usb}" in #( - auto) : - ;; #( - yes) : - ;; #( - no) : - ;; #( - libusb-1.0|1.0) : - - if test x"${LIBUSB_1_0_VERSION}" = xnone; then : - as_fn_error $? "option --with-usb=${withval} was required, but this library version was not detected" "$LINENO" 5 - -fi - LIBUSB_VERSION="${LIBUSB_1_0_VERSION}" - nut_usb_lib="(libusb-1.0)" - ;; #( - libusb-0.1|0.1) : - - if test x"${LIBUSB_0_1_VERSION}" = xnone \ - && test x"${LIBUSB_CONFIG_VERSION}" = xnone; then : - as_fn_error $? "option --with-usb=${withval} was required, but this library version was not detected" "$LINENO" 5 - -fi - if test x"${LIBUSB_0_1_VERSION}" != xnone; then : - LIBUSB_VERSION="${LIBUSB_0_1_VERSION}" - nut_usb_lib="(libusb-0.1)" - -else - LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}" - nut_usb_lib="(libusb-0.1-config)" - -fi - ;; #( - *) : - as_fn_error $? "invalid option value --with-usb=${withval} - see docs/configure.txt" "$LINENO" 5 - - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_VERSION} ${nut_usb_lib}" >&5 -$as_echo "${LIBUSB_VERSION} ${nut_usb_lib}" >&6; } - - if test x"${LIBUSB_1_0_VERSION}" != xnone && test x"${nut_usb_lib}" != x"(libusb-1.0)" ; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: libusb-1.0 support was detected, but another was chosen ${nut_usb_lib}" >&5 -$as_echo "$as_me: libusb-1.0 support was detected, but another was chosen ${nut_usb_lib}" >&6;} - -fi - - case ${nut_usb_lib} in #( - "(libusb-1.0)") : - - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb-1.0 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libusb-1.0 2>/dev/null`" - ;; #( - "(libusb-0.1)") : - - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libusb 2>/dev/null`" - ;; #( - "(libusb-0.1-config)") : - - CFLAGS="`$LIBUSB_CONFIG --cflags 2>/dev/null`" - LIBS="`$LIBUSB_CONFIG --libs 2>/dev/null`" - ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Defaulting libusb configuration" >&5 -$as_echo "$as_me: WARNING: Defaulting libusb configuration" >&2;} - LIBUSB_VERSION="none" - CFLAGS="" - LIBS="-lusb" - - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb cflags" >&5 -$as_echo_n "checking for libusb cflags... " >&6; } - -# Check whether --with-usb-includes was given. -if test "${with_usb_includes+set}" = set; then : - withval=$with_usb_includes; - case "${withval}" in #( - yes|no) : - - as_fn_error $? "invalid option --with(out)-usb-includes - see docs/configure.txt" "$LINENO" 5 - ;; #( - *) : - CFLAGS="${withval}" - - ;; -esac - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 -$as_echo "${CFLAGS}" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb ldflags" >&5 -$as_echo_n "checking for libusb ldflags... " >&6; } - -# Check whether --with-usb-libs was given. -if test "${with_usb_libs+set}" = set; then : - withval=$with_usb_libs; - case "${withval}" in #( - yes|no) : - - as_fn_error $? "invalid option --with(out)-usb-libs - see docs/configure.txt" "$LINENO" 5 - ;; #( - *) : - LIBS="${withval}" - - ;; -esac - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 -$as_echo "${LIBS}" >&6; } - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - if test -n "${LIBUSB_VERSION}"; then - test -n "$PKG_CONFIG" \ - && test x"${nut_usb_lib}" = x"(libusb-1.0)" \ - && $PKG_CONFIG --silence-errors --atleast-version=1.0 libusb-1.0 2>/dev/null - if test "$?" = "0"; then - for ac_header in libusb.h -do : - ac_fn_c_check_header_compile "$LINENO" "libusb.h" "ac_cv_header_libusb_h" "$ac_includes_default -" -if test "x$ac_cv_header_libusb_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_H 1 -_ACEOF - nut_have_libusb=yes -else - nut_have_libusb=no -fi - -done - - for ac_func in libusb_init -do : - ac_fn_c_check_func "$LINENO" "libusb_init" "ac_cv_func_libusb_init" -if test "x$ac_cv_func_libusb_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_INIT 1 -_ACEOF - -else - nut_have_libusb=no -fi -done - - for ac_func in libusb_strerror -do : - ac_fn_c_check_func "$LINENO" "libusb_strerror" "ac_cv_func_libusb_strerror" -if test "x$ac_cv_func_libusb_strerror" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_STRERROR 1 -_ACEOF - -else - nut_have_libusb=no; nut_have_libusb_strerror=no -fi -done - - if test "${nut_have_libusb_strerror}" = "no"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libusb_strerror() not found; install libusbx to use libusb 1.0 API. See https://github.com/networkupstools/nut/issues/509" >&5 -$as_echo "$as_me: WARNING: libusb_strerror() not found; install libusbx to use libusb 1.0 API. See https://github.com/networkupstools/nut/issues/509" >&2;} - fi - if test "${nut_have_libusb}" = "yes"; then - for ac_func in libusb_kernel_driver_active -do : - ac_fn_c_check_func "$LINENO" "libusb_kernel_driver_active" "ac_cv_func_libusb_kernel_driver_active" -if test "x$ac_cv_func_libusb_kernel_driver_active" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_KERNEL_DRIVER_ACTIVE 1 -_ACEOF - -fi -done - - for ac_func in libusb_set_auto_detach_kernel_driver -do : - ac_fn_c_check_func "$LINENO" "libusb_set_auto_detach_kernel_driver" "ac_cv_func_libusb_set_auto_detach_kernel_driver" -if test "x$ac_cv_func_libusb_set_auto_detach_kernel_driver" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER 1 -_ACEOF - -fi -done - - for ac_func in libusb_detach_kernel_driver -do : - ac_fn_c_check_func "$LINENO" "libusb_detach_kernel_driver" "ac_cv_func_libusb_detach_kernel_driver" -if test "x$ac_cv_func_libusb_detach_kernel_driver" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_DETACH_KERNEL_DRIVER 1 -_ACEOF - -fi -done - - for ac_func in libusb_detach_kernel_driver_np -do : - ac_fn_c_check_func "$LINENO" "libusb_detach_kernel_driver_np" "ac_cv_func_libusb_detach_kernel_driver_np" -if test "x$ac_cv_func_libusb_detach_kernel_driver_np" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP 1 -_ACEOF - -fi -done - - - for ac_func in usb_detach_kernel_driver_np -do : - ac_fn_c_check_func "$LINENO" "usb_detach_kernel_driver_np" "ac_cv_func_usb_detach_kernel_driver_np" -if test "x$ac_cv_func_usb_detach_kernel_driver_np" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_USB_DETACH_KERNEL_DRIVER_NP 1 -_ACEOF - -fi -done - - fi - else - for ac_header in usb.h -do : - ac_fn_c_check_header_compile "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default -" -if test "x$ac_cv_header_usb_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_USB_H 1 -_ACEOF - nut_have_libusb=yes -else - nut_have_libusb=no -fi - -done - - for ac_func in usb_init -do : - ac_fn_c_check_func "$LINENO" "usb_init" "ac_cv_func_usb_init" -if test "x$ac_cv_func_usb_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_USB_INIT 1 -_ACEOF - -else - - if test "${nut_have_libusb}" = "yes" && test "$LIBUSB_VERSION" = "none" && test -z "$LIBS"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libusb is just present in path" >&5 -$as_echo_n "checking if libusb is just present in path... " >&6; } - LIBS="-L/usr/lib -L/usr/local/lib -lusb" - unset ac_cv_func_usb_init || true - for ac_func in usb_init -do : - ac_fn_c_check_func "$LINENO" "usb_init" "ac_cv_func_usb_init" -if test "x$ac_cv_func_usb_init" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_USB_INIT 1 -_ACEOF - -else - nut_have_libusb=no -fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_have_libusb}" >&5 -$as_echo "${nut_have_libusb}" >&6; } - -else - nut_have_libusb=no - -fi - -fi -done - - if test "${nut_have_libusb}" = "yes"; then - for ac_func in usb_detach_kernel_driver_np -do : - ac_fn_c_check_func "$LINENO" "usb_detach_kernel_driver_np" "ac_cv_func_usb_detach_kernel_driver_np" -if test "x$ac_cv_func_usb_detach_kernel_driver_np" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_USB_DETACH_KERNEL_DRIVER_NP 1 -_ACEOF - -fi -done - - - for ac_func in libusb_kernel_driver_active -do : - ac_fn_c_check_func "$LINENO" "libusb_kernel_driver_active" "ac_cv_func_libusb_kernel_driver_active" -if test "x$ac_cv_func_libusb_kernel_driver_active" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_KERNEL_DRIVER_ACTIVE 1 -_ACEOF - -fi -done - - for ac_func in libusb_set_auto_detach_kernel_driver -do : - ac_fn_c_check_func "$LINENO" "libusb_set_auto_detach_kernel_driver" "ac_cv_func_libusb_set_auto_detach_kernel_driver" -if test "x$ac_cv_func_libusb_set_auto_detach_kernel_driver" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER 1 -_ACEOF - -fi -done - - for ac_func in libusb_detach_kernel_driver -do : - ac_fn_c_check_func "$LINENO" "libusb_detach_kernel_driver" "ac_cv_func_libusb_detach_kernel_driver" -if test "x$ac_cv_func_libusb_detach_kernel_driver" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_DETACH_KERNEL_DRIVER 1 -_ACEOF - -fi -done - - for ac_func in libusb_detach_kernel_driver_np -do : - ac_fn_c_check_func "$LINENO" "libusb_detach_kernel_driver_np" "ac_cv_func_libusb_detach_kernel_driver_np" -if test "x$ac_cv_func_libusb_detach_kernel_driver_np" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP 1 -_ACEOF - -fi -done - - fi - fi - else - nut_have_libusb=no - fi - - if test "${nut_have_libusb}" = "yes"; then : - - - case "${target_os}" in #( - solaris2.1*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Solaris 10 / 11 specific configuration for usb drivers" >&5 -$as_echo_n "checking for Solaris 10 / 11 specific configuration for usb drivers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 -$as_echo_n "checking for library containing nanosleep... " >&6; } -if ${ac_cv_search_nanosleep+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char nanosleep (); -int -main () -{ -return nanosleep (); - ; - return 0; -} -_ACEOF -for ac_lib in '' rt; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_nanosleep=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_nanosleep+:} false; then : - break -fi -done -if ${ac_cv_search_nanosleep+:} false; then : - -else - ac_cv_search_nanosleep=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 -$as_echo "$ac_cv_search_nanosleep" >&6; } -ac_res=$ac_cv_search_nanosleep -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - LIBS="-R/usr/sfw/lib ${LIBS}" - -$as_echo "#define SUN_LIBUSB 1" >>confdefs.h - - SUN_LIBUSB=1 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 -$as_echo "${LIBS}" >&6; } - ;; #( - hpux11*) : - - CFLAGS="${CFLAGS} -lpthread" - - ;; #( - *) : - ;; -esac - -fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - if test "${nut_have_libusb}" = "yes"; then : - - LIBUSB_CFLAGS="${CFLAGS}" - LIBUSB_LIBS="${LIBS}" - -else - - case "${nut_with_usb}" in #( - no|auto) : - ;; #( - yes|1.0|0.1|libusb-1.0|libusb-0.1) : - as_fn_error $? "USB drivers requested, but libusb not found." "$LINENO" 5 - - ;; #( - *) : - ;; -esac - -fi - - if test "${nut_with_usb}" = "no"; then - if test -n "${nut_usb_lib}" && test "${nut_usb_lib}" != none ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: libusb was detected ${nut_usb_lib}, but a build without USB drivers was requested" >&5 -$as_echo "$as_me: libusb was detected ${nut_usb_lib}, but a build without USB drivers was requested" >&6;} - fi - nut_usb_lib="" - else - nut_with_usb="${nut_have_libusb}" - fi - - - if test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-1.0)"; then : - -$as_echo "#define WITH_LIBUSB_1_0 1" >>confdefs.h - -else - -$as_echo "#define WITH_LIBUSB_1_0 0" >>confdefs.h - - -fi - - if test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-0.1)" -o "${nut_usb_lib}" = "(libusb-0.1-config)"; then : - -$as_echo "#define WITH_LIBUSB_0_1 1" >>confdefs.h - -else - -$as_echo "#define WITH_LIBUSB_0_1 0" >>confdefs.h - - -fi - - CFLAGS="${CFLAGS_ORIG}" - LIBS="${LIBS_ORIG}" -fi - - - -# Check whether --with-snmp was given. -if test "${with_snmp+set}" = set; then : - withval=$with_snmp; nut_with_snmp="${withval}" -else - nut_with_snmp="auto" - -fi - if test -z "${nut_have_libnetsnmp_seen}"; then nut_have_libnetsnmp_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - - # The cast to long int works around a bug in the HP C Compiler -# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects -# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. -# This bug is HP SR number 8606223364. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } -if ${ac_cv_sizeof_void_p+:} false; then : - $as_echo_n "(cached) " >&6 -else - if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : - -else - if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "cannot compute sizeof (void *) -See \`config.log' for more details" "$LINENO" 5; } - else - ac_cv_sizeof_void_p=0 - fi -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_VOID_P $ac_cv_sizeof_void_p -_ACEOF - - - NET_SNMP_CONFIG="none" - case "${ac_cv_sizeof_void_p}" in #( - 4) : - for ac_prog in net-snmp-config-32 net-snmp-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_NET_SNMP_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $NET_SNMP_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_NET_SNMP_CONFIG="$NET_SNMP_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_NET_SNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -NET_SNMP_CONFIG=$ac_cv_path_NET_SNMP_CONFIG -if test -n "$NET_SNMP_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NET_SNMP_CONFIG" >&5 -$as_echo "$NET_SNMP_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$NET_SNMP_CONFIG" && break -done -test -n "$NET_SNMP_CONFIG" || NET_SNMP_CONFIG="none" - ;; #( - 8) : - for ac_prog in net-snmp-config-64 net-snmp-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_NET_SNMP_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $NET_SNMP_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_NET_SNMP_CONFIG="$NET_SNMP_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_NET_SNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -NET_SNMP_CONFIG=$ac_cv_path_NET_SNMP_CONFIG -if test -n "$NET_SNMP_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NET_SNMP_CONFIG" >&5 -$as_echo "$NET_SNMP_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$NET_SNMP_CONFIG" && break -done -test -n "$NET_SNMP_CONFIG" || NET_SNMP_CONFIG="none" - ;; #( - *) : - for ac_prog in net-snmp-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_NET_SNMP_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $NET_SNMP_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_NET_SNMP_CONFIG="$NET_SNMP_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_NET_SNMP_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -NET_SNMP_CONFIG=$ac_cv_path_NET_SNMP_CONFIG -if test -n "$NET_SNMP_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NET_SNMP_CONFIG" >&5 -$as_echo "$NET_SNMP_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$NET_SNMP_CONFIG" && break -done -test -n "$NET_SNMP_CONFIG" || NET_SNMP_CONFIG="none" - - ;; -esac - - prefer_NET_SNMP_CONFIG=false - -# Check whether --with-net-snmp-config was given. -if test "${with_net_snmp_config+set}" = set; then : - withval=$with_net_snmp_config; - case "${withval}" in - ""|yes) prefer_NET_SNMP_CONFIG=true ;; - no) - prefer_NET_SNMP_CONFIG=false - ;; - *) - NET_SNMP_CONFIG="${withval}" - prefer_NET_SNMP_CONFIG=true - ;; - esac - -fi - - - if test x"$have_PKG_CONFIG" = xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP version via pkg-config" >&5 -$as_echo_n "checking for Net-SNMP version via pkg-config... " >&6; } - SNMP_VERSION="`$PKG_CONFIG --silence-errors --modversion netsnmp 2>/dev/null`" - if test "$?" = "0" -a -n "${SNMP_VERSION}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SNMP_VERSION} found" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP version via net-snmp-config" >&5 +$as_echo_n "checking for Net-SNMP version via net-snmp-config... " >&6; } + SNMP_VERSION=`net-snmp-config --version 2>/dev/null` + if test "$?" != "0" -o -z "${SNMP_VERSION}"; then + SNMP_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SNMP_VERSION} found" >&5 $as_echo "${SNMP_VERSION} found" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found" >&5 -$as_echo "none found" >&6; } - prefer_NET_SNMP_CONFIG=true - fi - fi - - if test "$NET_SNMP_CONFIG" = none ; then - prefer_NET_SNMP_CONFIG=false - fi - - if "${prefer_NET_SNMP_CONFIG}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP version via ${NET_SNMP_CONFIG}" >&5 -$as_echo_n "checking for Net-SNMP version via ${NET_SNMP_CONFIG}... " >&6; } - SNMP_VERSION="`${NET_SNMP_CONFIG} --version 2>/dev/null`" - if test "$?" != "0" -o -z "${SNMP_VERSION}"; then - SNMP_VERSION="none" - prefer_NET_SNMP_CONFIG=false - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SNMP_VERSION} found" >&5 -$as_echo "${SNMP_VERSION} found" >&6; } - fi - - if test x"$have_PKG_CONFIG" != xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: did not find either net-snmp-config or pkg-config for net-snmp" >&5 -$as_echo "$as_me: WARNING: did not find either net-snmp-config or pkg-config for net-snmp" >&2;} - fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP cflags" >&5 $as_echo_n "checking for Net-SNMP cflags... " >&6; } @@ -14768,16 +7891,7 @@ if test "${with_snmp_includes+set}" = set; then : esac else - if "${prefer_NET_SNMP_CONFIG}"; then : - CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`" -else - if test x"$have_PKG_CONFIG" = xyes; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`" - -fi - -fi - + CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -14799,17 +7913,7 @@ if test "${with_snmp_libs+set}" = set; then : esac else - if "${prefer_NET_SNMP_CONFIG}"; then : - LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`" -else - if test x"$have_PKG_CONFIG" = xyes; then : - LIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`" -else - LIBS="-lnetsnmp" -fi - -fi - + LIBS="`net-snmp-config --libs 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 @@ -14844,475 +7948,512 @@ fi done - if test "${nut_have_libnetsnmp}" = "yes"; then : - + if test "${nut_have_libnetsnmp}" = "yes"; then LIBNETSNMP_CFLAGS="${CFLAGS}" LIBNETSNMP_LIBS="${LIBS}" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmAESPrivProtocol" >&5 -$as_echo_n "checking for defined usmAESPrivProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmAESPrivProtocol; - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmAES128PrivProtocol" >&5 -$as_echo_n "checking for defined usmAES128PrivProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmAES128PrivProtocol; - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmDESPrivProtocol" >&5 -$as_echo_n "checking for defined usmDESPrivProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmDESPrivProtocol; -#ifdef NETSNMP_DISABLE_DES -#error "NETSNMP_DISABLE_DES is defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmHMAC256SHA384AuthProtocol" >&5 -$as_echo_n "checking for defined usmHMAC256SHA384AuthProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmHMAC256SHA384AuthProtocol; -#ifndef HAVE_EVP_SHA384 -#error "HAVE_EVP_SHA384 is NOT defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmHMAC384SHA512AuthProtocol" >&5 -$as_echo_n "checking for defined usmHMAC384SHA512AuthProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmHMAC384SHA512AuthProtocol; -#ifndef HAVE_EVP_SHA384 -#error "HAVE_EVP_SHA384 is NOT defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmHMAC192SHA256AuthProtocol" >&5 -$as_echo_n "checking for defined usmHMAC192SHA256AuthProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmHMAC192SHA256AuthProtocol; -#ifndef HAVE_EVP_SHA224 -#error "HAVE_EVP_SHA224 is NOT defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmAES192PrivProtocol" >&5 -$as_echo_n "checking for defined usmAES192PrivProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmAES192PrivProtocol; -#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04 -#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmAES256PrivProtocol" >&5 -$as_echo_n "checking for defined usmAES256PrivProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmAES256PrivProtocol; -#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04 -#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmHMACMD5AuthProtocol" >&5 -$as_echo_n "checking for defined usmHMACMD5AuthProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmHMACMD5AuthProtocol; -#ifdef NETSNMP_DISABLE_MD5 -#error "NETSNMP_DISABLE_MD5 is defined" -#endif - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined usmHMACSHA1AuthProtocol" >&5 -$as_echo_n "checking for defined usmHMACSHA1AuthProtocol... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -oid * pProto = usmHMACSHA1AuthProtocol; - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for defined NETSNMP_DRAFT_BLUMENTHAL_AES_04" >&5 -$as_echo_n "checking for defined NETSNMP_DRAFT_BLUMENTHAL_AES_04... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -int num = NETSNMP_DRAFT_BLUMENTHAL_AES_04 + 1; /* if defined, NETSNMP_DRAFT_BLUMENTHAL_AES_04 is 1 */ - -int -main () -{ - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 1 -_ACEOF - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -cat >>confdefs.h <<_ACEOF -#define NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 0 -_ACEOF - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - + fi CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" fi +if test -z "${nut_have_libusb_seen}"; then + nut_have_libusb_seen=yes + + CFLAGS_ORIG="${CFLAGS}" + LIBS_ORIG="${LIBS}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb version via pkg-config" >&5 +$as_echo_n "checking for libusb version via pkg-config... " >&6; } + LIBUSB_VERSION="`pkg-config --silence-errors --modversion libusb 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags libusb 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs libusb 2>/dev/null`" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking via libusb-config" >&5 +$as_echo_n "checking via libusb-config... " >&6; } + LIBUSB_VERSION="`libusb-config --version 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then + CFLAGS="`libusb-config --cflags 2>/dev/null`" + LIBS="`libusb-config --libs 2>/dev/null`" + else + LIBUSB_VERSION="none" + CFLAGS="" + LIBS="-lusb" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBUSB_VERSION} found" >&5 +$as_echo "${LIBUSB_VERSION} found" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb cflags" >&5 +$as_echo_n "checking for libusb cflags... " >&6; } + +# Check whether --with-usb-includes was given. +if test "${with_usb_includes+set}" = set; then : + withval=$with_usb_includes; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-usb-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 +$as_echo "${CFLAGS}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libusb ldflags" >&5 +$as_echo_n "checking for libusb ldflags... " >&6; } + +# Check whether --with-usb-libs was given. +if test "${with_usb_libs+set}" = set; then : + withval=$with_usb_libs; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-usb-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } + + for ac_header in usb.h +do : + ac_fn_c_check_header_compile "$LINENO" "usb.h" "ac_cv_header_usb_h" "$ac_includes_default +" +if test "x$ac_cv_header_usb_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_USB_H 1 +_ACEOF + nut_have_libusb=yes +else + nut_have_libusb=no +fi + +done + + for ac_func in usb_init +do : + ac_fn_c_check_func "$LINENO" "usb_init" "ac_cv_func_usb_init" +if test "x$ac_cv_func_usb_init" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_USB_INIT 1 +_ACEOF + +else + nut_have_libusb=no +fi +done + + + if test "${nut_have_libusb}" = "yes"; then + for ac_func in usb_detach_kernel_driver_np +do : + ac_fn_c_check_func "$LINENO" "usb_detach_kernel_driver_np" "ac_cv_func_usb_detach_kernel_driver_np" +if test "x$ac_cv_func_usb_detach_kernel_driver_np" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_USB_DETACH_KERNEL_DRIVER_NP 1 +_ACEOF + +fi +done + + LIBUSB_CFLAGS="${CFLAGS}" + LIBUSB_LIBS="${LIBS}" + fi + + CFLAGS="${CFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" +fi + + +# Check whether --with-hal was given. +if test "${with_hal+set}" = set; then : + withval=$with_hal; nut_with_hal="${withval}" +else + nut_with_hal="no" + +fi + + + +if test -z "${nut_have_libhal_seen}"; then + nut_have_libhal_seen=yes + + CFLAGS_ORIG="${CFLAGS}" + LIBS_ORIG="${LIBS}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal version via pkg-config (0.5.8 minimum required)" >&5 +$as_echo_n "checking for libhal version via pkg-config (0.5.8 minimum required)... " >&6; } + HAL_VERSION="`pkg-config --silence-errors --modversion hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_VERSION}"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none found" >&5 +$as_echo "none found" >&6; } + elif pkg-config --silence-errors --atleast-version=0.5.8 hal 2>/dev/null; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_VERSION} found" >&5 +$as_echo "${HAL_VERSION} found" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ${HAL_VERSION} is too old" >&5 +$as_echo "$as_me: WARNING: ${HAL_VERSION} is too old" >&2;} + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal cflags" >&5 +$as_echo_n "checking for libhal cflags... " >&6; } + +# Check whether --with-hal-includes was given. +if test "${with_hal_includes+set}" = set; then : + withval=$with_hal_includes; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + +else + + CFLAGS="`pkg-config --silence-errors --cflags hal dbus-glib-1 2>/dev/null`" + if test "$?" != "0"; then + CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 +$as_echo "${CFLAGS}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal ldflags" >&5 +$as_echo_n "checking for libhal ldflags... " >&6; } + +# Check whether --with-hal-libs was given. +if test "${with_hal_libs+set}" = set; then : + withval=$with_hal_libs; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + +else + + LIBS="`pkg-config --silence-errors --libs hal dbus-glib-1 2>/dev/null`" + if test "$?" != "0"; then + LIBS="-lhal -ldbus-1 -lpthread" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } + + for ac_header in libhal.h +do : + ac_fn_c_check_header_compile "$LINENO" "libhal.h" "ac_cv_header_libhal_h" "$ac_includes_default +" +if test "x$ac_cv_header_libhal_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBHAL_H 1 +_ACEOF + nut_have_libhal=yes +else + nut_have_libhal=no +fi + +done + + for ac_header in glib.h dbus/dbus-glib.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +else + nut_have_libhal=no +fi + +done + + for ac_func in libhal_device_new_changeset +do : + ac_fn_c_check_func "$LINENO" "libhal_device_new_changeset" "ac_cv_func_libhal_device_new_changeset" +if test "x$ac_cv_func_libhal_device_new_changeset" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBHAL_DEVICE_NEW_CHANGESET 1 +_ACEOF + +else + nut_have_libhal=no +fi +done + + + if test "${nut_have_libhal}" = "yes"; then + for ac_func in g_timeout_add_seconds +do : + ac_fn_c_check_func "$LINENO" "g_timeout_add_seconds" "ac_cv_func_g_timeout_add_seconds" +if test "x$ac_cv_func_g_timeout_add_seconds" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_G_TIMEOUT_ADD_SECONDS 1 +_ACEOF + +fi +done + + LIBHAL_CFLAGS="${CFLAGS}" + LIBHAL_LIBS="${LIBS}" + fi + + CFLAGS="${CFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" +fi + + +if test -z "${nut_have_config_libhal_seen}" -a "${nut_have_libhal}" = "yes"; then + nut_have_config_libhal_seen=yes + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal user" >&5 +$as_echo_n "checking for libhal user... " >&6; } + +# Check whether --with-hal-user was given. +if test "${with_hal_user+set}" = set; then : + withval=$with_hal_user; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-user - see docs/configure.txt" "$LINENO" 5 + ;; + *) + HAL_USER="${withval}" + ;; + esac + +else + + HAL_USER="`pkg-config --silence-errors --variable=haluser hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_USER}"; then + HAL_USER="haldaemon" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_USER}" >&5 +$as_echo "${HAL_USER}" >&6; } + +cat >>confdefs.h <<_ACEOF +#define HAL_USER "${HAL_USER}" +_ACEOF + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal device match key" >&5 +$as_echo_n "checking for libhal device match key... " >&6; } + +# Check whether --with-hal-device-match-key was given. +if test "${with_hal_device_match_key+set}" = set; then : + withval=$with_hal_device_match_key; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-device-match-key - see docs/configure.txt" "$LINENO" 5 + ;; + *) + HAL_DEVICE_MATCH_KEY="${withval}" + ;; + esac + +else + + if pkg-config --silence-errors --atleast-version=0.5.11 hal 2>/dev/null; then + HAL_DEVICE_MATCH_KEY="info.bus" + else + HAL_DEVICE_MATCH_KEY="info.subsystem" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_DEVICE_MATCH_KEY}" >&5 +$as_echo "${HAL_DEVICE_MATCH_KEY}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal Callouts path" >&5 +$as_echo_n "checking for libhal Callouts path... " >&6; } + +# Check whether --with-hal-callouts-path was given. +if test "${with_hal_callouts_path+set}" = set; then : + withval=$with_hal_callouts_path; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-callouts-path - see docs/configure.txt" "$LINENO" 5 + ;; + *) + HAL_CALLOUTS_PATH="${withval}" + ;; + esac + +else + + HAL_CALLOUTS_PATH="`pkg-config --silence-errors --variable=libexecdir hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_CALLOUTS_PATH}"; then + HAL_CALLOUTS_PATH="${libdir}/hal" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_CALLOUTS_PATH}" >&5 +$as_echo "${HAL_CALLOUTS_PATH}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libhal Device Information path" >&5 +$as_echo_n "checking for libhal Device Information path... " >&6; } + +# Check whether --with-hal-fdi-path was given. +if test "${with_hal_fdi_path+set}" = set; then : + withval=$with_hal_fdi_path; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-hal-fdi-path - see docs/configure.txt" "$LINENO" 5 + ;; + *) + HAL_FDI_PATH="${withval}" + ;; + esac + +else + + HAL_FDI_PATH="`pkg-config --silence-errors --variable=hal_fdidir hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_FDI_PATH}"; then + HAL_FDI_PATH="${datarootdir}/hal/fdi/information/20thirdparty" + fi + +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${HAL_FDI_PATH}" >&5 +$as_echo "${HAL_FDI_PATH}" >&6; } +fi + + +# Check whether --with-snmp was given. +if test "${with_snmp+set}" = set; then : + withval=$with_snmp; nut_with_snmp="${withval}" +else + nut_with_snmp="auto" + +fi + + + +if test -z "${nut_have_libnetsnmp_seen}"; then + nut_have_libnetsnmp_seen=yes + + CFLAGS_ORIG="${CFLAGS}" + LIBS_ORIG="${LIBS}" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP version via net-snmp-config" >&5 +$as_echo_n "checking for Net-SNMP version via net-snmp-config... " >&6; } + SNMP_VERSION=`net-snmp-config --version 2>/dev/null` + if test "$?" != "0" -o -z "${SNMP_VERSION}"; then + SNMP_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${SNMP_VERSION} found" >&5 +$as_echo "${SNMP_VERSION} found" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP cflags" >&5 +$as_echo_n "checking for Net-SNMP cflags... " >&6; } + +# Check whether --with-snmp-includes was given. +if test "${with_snmp_includes+set}" = set; then : + withval=$with_snmp_includes; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-snmp-includes - see docs/configure.txt" "$LINENO" 5 + ;; + *) + CFLAGS="${withval}" + ;; + esac + +else + CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 +$as_echo "${CFLAGS}" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Net-SNMP libs" >&5 +$as_echo_n "checking for Net-SNMP libs... " >&6; } + +# Check whether --with-snmp-libs was given. +if test "${with_snmp_libs+set}" = set; then : + withval=$with_snmp_libs; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-snmp-libs - see docs/configure.txt" "$LINENO" 5 + ;; + *) + LIBS="${withval}" + ;; + esac + +else + LIBS="`net-snmp-config --libs 2>/dev/null`" +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 +$as_echo "${LIBS}" >&6; } + + for ac_header in net-snmp/net-snmp-config.h +do : + ac_fn_c_check_header_compile "$LINENO" "net-snmp/net-snmp-config.h" "ac_cv_header_net_snmp_net_snmp_config_h" "$ac_includes_default +" +if test "x$ac_cv_header_net_snmp_net_snmp_config_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NET_SNMP_NET_SNMP_CONFIG_H 1 +_ACEOF + nut_have_libnetsnmp=yes +else + nut_have_libnetsnmp=no +fi + +done + + for ac_func in init_snmp +do : + ac_fn_c_check_func "$LINENO" "init_snmp" "ac_cv_func_init_snmp" +if test "x$ac_cv_func_init_snmp" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_INIT_SNMP 1 +_ACEOF + +else + nut_have_libnetsnmp=no +fi +done + + + if test "${nut_have_libnetsnmp}" = "yes"; then + LIBNETSNMP_CFLAGS="${CFLAGS}" + LIBNETSNMP_LIBS="${LIBS}" + fi + + CFLAGS="${CFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" +fi + # Check whether --with-neon was given. if test "${with_neon+set}" = set; then : @@ -15327,260 +8468,18 @@ fi if test -z "${nut_have_neon_seen}"; then nut_have_neon_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libneon version via pkg-config (0.25.0 minimum required)" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libneon version via pkg-config (0.25.0 minimum required)" >&5 $as_echo_n "checking for libneon version via pkg-config (0.25.0 minimum required)... " >&6; } - NEON_VERSION="`$PKG_CONFIG --silence-errors --modversion neon 2>/dev/null`" - if test "$?" != "0" -o -z "${NEON_VERSION}"; then - NEON_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NEON_VERSION} found" >&5 + NEON_VERSION="`pkg-config --silence-errors --modversion neon 2>/dev/null`" + if test "$?" != "0" -o -z "${NEON_VERSION}"; then + NEON_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NEON_VERSION} found" >&5 $as_echo "${NEON_VERSION} found" >&6; } -else - NEON_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libneon settings via pkg-config" >&5 -$as_echo "$as_me: can not check libneon settings via pkg-config" >&6;} - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libneon cflags" >&5 $as_echo_n "checking for libneon cflags... " >&6; } @@ -15597,14 +8496,7 @@ if test "${with_neon_includes+set}" = set; then : esac else - - if test x"$have_PKG_CONFIG" = xyes; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" || CFLAGS="-I/usr/include/neon -I/usr/local/include/neon" -else - CFLAGS="-I/usr/include/neon -I/usr/local/include/neon" - -fi - + CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -15626,14 +8518,7 @@ if test "${with_neon_libs+set}" = set; then : esac else - - if test x"$have_PKG_CONFIG" = xyes; then : - LIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" || LIBS="-lneon" -else - LIBS="-lneon" - -fi - + LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 @@ -15690,7 +8575,6 @@ done fi - # Check whether --with-powerman was given. if test "${with_powerman+set}" = set; then : withval=$with_powerman; nut_with_powerman="${withval}" @@ -15704,271 +8588,9 @@ fi if test -z "${nut_have_libpowerman_seen}"; then nut_have_libpowerman_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LLNC libpowerman version via pkg-config" >&5 -$as_echo_n "checking for LLNC libpowerman version via pkg-config... " >&6; } - POWERMAN_VERSION="`$PKG_CONFIG --silence-errors --modversion libpowerman 2>/dev/null`" - if test "$?" != "0" ; then # -o -z "${POWERMAN_VERSION}"; then - POWERMAN_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: '${POWERMAN_VERSION}' found" >&5 -$as_echo "'${POWERMAN_VERSION}' found" >&6; } - -else - POWERMAN_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check LLNC libpowerman settings via pkg-config" >&5 -$as_echo "$as_me: can not check LLNC libpowerman settings via pkg-config" >&6;} - - -fi - - if test x"$POWERMAN_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libpowerman 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libpowerman 2>/dev/null`" - -else - CFLAGS="" - LIBS="" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libpowerman cflags" >&5 $as_echo_n "checking for libpowerman cflags... " >&6; } @@ -15984,6 +8606,8 @@ if test "${with_powerman_includes+set}" = set; then : ;; esac +else + CFLAGS="`pkg-config --silence-errors --cflags libpowerman 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -16004,6 +8628,8 @@ if test "${with_powerman_libs+set}" = set; then : ;; esac +else + LIBS="`pkg-config --silence-errors --libs libpowerman 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 @@ -16032,34 +8658,8 @@ if test "x$ac_cv_func_pm_connect" = xyes; then : #define HAVE_PM_CONNECT 1 _ACEOF -else - - if test "${nut_have_libpowerman}" = "yes" && test "$POWERMAN_VERSION" = "none" && test -z "$LIBS"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libpowerman is just present in path" >&5 -$as_echo_n "checking if libpowerman is just present in path... " >&6; } - LIBS="-L/usr/lib -L/usr/local/lib -lpowerman" - unset ac_cv_func_pm_connect || true - for ac_func in pm_connect -do : - ac_fn_c_check_func "$LINENO" "pm_connect" "ac_cv_func_pm_connect" -if test "x$ac_cv_func_pm_connect" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_PM_CONNECT 1 -_ACEOF - else nut_have_libpowerman=no -fi -done - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_have_libpowerman}" >&5 -$as_echo "${nut_have_libpowerman}" >&6; } - -else - nut_have_libpowerman=no - -fi - fi done @@ -16075,3220 +8675,30 @@ done fi - -# Check whether --with-modbus was given. -if test "${with_modbus+set}" = set; then : - withval=$with_modbus; nut_with_modbus="${withval}" -else - nut_with_modbus="auto" - -fi - - - -if test -z "${nut_have_libmodbus_seen}"; then - nut_have_libmodbus_seen=yes - - CFLAGS_ORIG="${CFLAGS}" - LIBS_ORIG="${LIBS}" - -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmodbus version via pkg-config" >&5 -$as_echo_n "checking for libmodbus version via pkg-config... " >&6; } - LIBMODBUS_VERSION="`$PKG_CONFIG --silence-errors --modversion libmodbus 2>/dev/null`" - if test "$?" != "0" -o -z "${LIBMODBUS_VERSION}"; then - LIBMODBUS_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBMODBUS_VERSION} found" >&5 -$as_echo "${LIBMODBUS_VERSION} found" >&6; } - -else - LIBMODBUS_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libmodbus settings via pkg-config" >&5 -$as_echo "$as_me: can not check libmodbus settings via pkg-config" >&6;} - - -fi - - if test x"$LIBMODBUS_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libmodbus 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libmodbus 2>/dev/null`" - -else - CFLAGS="-I/usr/include/modbus" - LIBS="-lmodbus" - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmodbus cflags" >&5 -$as_echo_n "checking for libmodbus cflags... " >&6; } - -# Check whether --with-modbus-includes was given. -if test "${with_modbus_includes+set}" = set; then : - withval=$with_modbus_includes; - case "${withval}" in - yes|no) - as_fn_error $? "invalid option --with(out)-modbus-includes - see docs/configure.txt" "$LINENO" 5 - ;; - *) - CFLAGS="${withval}" - ;; - esac - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 -$as_echo "${CFLAGS}" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libmodbus ldflags" >&5 -$as_echo_n "checking for libmodbus ldflags... " >&6; } - -# Check whether --with-modbus-libs was given. -if test "${with_modbus_libs+set}" = set; then : - withval=$with_modbus_libs; - case "${withval}" in - yes|no) - as_fn_error $? "invalid option --with(out)-modbus-libs - see docs/configure.txt" "$LINENO" 5 - ;; - *) - LIBS="${withval}" - ;; - esac - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 -$as_echo "${LIBS}" >&6; } - - for ac_header in modbus.h -do : - ac_fn_c_check_header_compile "$LINENO" "modbus.h" "ac_cv_header_modbus_h" "$ac_includes_default -" -if test "x$ac_cv_header_modbus_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MODBUS_H 1 -_ACEOF - nut_have_libmodbus=yes -else - nut_have_libmodbus=no -fi - -done - - for ac_func in modbus_new_rtu -do : - ac_fn_c_check_func "$LINENO" "modbus_new_rtu" "ac_cv_func_modbus_new_rtu" -if test "x$ac_cv_func_modbus_new_rtu" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MODBUS_NEW_RTU 1 -_ACEOF - -else - nut_have_libmodbus=no -fi -done - - for ac_func in modbus_new_tcp -do : - ac_fn_c_check_func "$LINENO" "modbus_new_tcp" "ac_cv_func_modbus_new_tcp" -if test "x$ac_cv_func_modbus_new_tcp" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MODBUS_NEW_TCP 1 -_ACEOF - -else - nut_have_libmodbus=no -fi -done - - for ac_func in modbus_set_byte_timeout -do : - ac_fn_c_check_func "$LINENO" "modbus_set_byte_timeout" "ac_cv_func_modbus_set_byte_timeout" -if test "x$ac_cv_func_modbus_set_byte_timeout" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MODBUS_SET_BYTE_TIMEOUT 1 -_ACEOF - -else - nut_have_libmodbus=no -fi -done - - for ac_func in modbus_set_response_timeout -do : - ac_fn_c_check_func "$LINENO" "modbus_set_response_timeout" "ac_cv_func_modbus_set_response_timeout" -if test "x$ac_cv_func_modbus_set_response_timeout" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_MODBUS_SET_RESPONSE_TIMEOUT 1 -_ACEOF - -else - nut_have_libmodbus=no -fi -done - - - if test x"$nut_have_libmodbus" = xyes; then : - -if test -z "${nut_have_ax_c_pragmas_seen}"; then - nut_have_ax_c_pragmas_seen="yes" - - CFLAGS_SAVED="${CFLAGS}" - CXXFLAGS_SAVED="${CXXFLAGS}" - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - if test "${CLANG}" = "yes"; then : - CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option" - CXXFLAGS="${CXXFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option" -else - if test "${GCC}" = "yes"; then : - CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror" -else - CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror" -fi - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic push and pop (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic push and pop (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_push_pop_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#pragma GCC diagnostic push -#pragma GCC diagnostic pop - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_push_pop_besidefunc=yes -else - ax_cv__pragma__gcc__diags_push_pop_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_push_pop_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma clang diagnostic push and pop (outside functions)" >&5 -$as_echo_n "checking for pragma clang diagnostic push and pop (outside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_push_pop_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_push_pop_besidefunc=yes -else - ax_cv__pragma__clang__diags_push_pop_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_push_pop_besidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_push_pop_besidefunc" >&6; } - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic push and pop (inside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic push and pop (inside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_push_pop_insidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic push -#pragma GCC diagnostic pop -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_push_pop_insidefunc=yes -else - ax_cv__pragma__gcc__diags_push_pop_insidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_push_pop_insidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma clang diagnostic push and pop (inside functions)" >&5 -$as_echo_n "checking for pragma clang diagnostic push and pop (inside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_push_pop_insidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_push_pop_insidefunc=yes -else - ax_cv__pragma__clang__diags_push_pop_insidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_push_pop_insidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_push_pop_insidefunc" >&6; } - - if test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_INSIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_BESIDEFUNC 1" >>confdefs.h - - -fi - - if test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP 1" >>confdefs.h - - -fi - - if test "${CLANG}" = "yes"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\"" >&5 -$as_echo_n "checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\"... " >&6; } -if ${ax_cv__pragma__clang__diags_ignored_unreachable_code_return+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma clang diagnostic ignored "-Wunreachable-code-return" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_ignored_unreachable_code_return=yes -else - ax_cv__pragma__clang__diags_ignored_unreachable_code_return=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_ignored_unreachable_code_return" >&5 -$as_echo "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" >&6; } - if test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\" (outside functions)" >&5 -$as_echo_n "checking for pragma CLANG diagnostic ignored \"-Wunreachable-code-return\" (outside functions)... " >&6; } -if ${ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma clang diagnostic ignored "-Wunreachable-code-return" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=yes -else - ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" >&5 -$as_echo "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" >&6; } - if test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC 1" >>confdefs.h - - -fi - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunused-function\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunused-function\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unused_function+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunused-function" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unused_function=yes -else - ax_cv__pragma__gcc__diags_ignored_unused_function=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unused_function" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unused_function" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unused_function" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_nonliteral+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_nonliteral=yes -else - ax_cv__pragma__gcc__diags_ignored_format_nonliteral=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_nonliteral" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-nonliteral\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-security\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-security\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_security+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-security" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_security=yes -else - ax_cv__pragma__gcc__diags_ignored_format_security=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_security" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_security" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-security\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-security\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-security" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-truncation\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-truncation\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_truncation+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-truncation" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_truncation=yes -else - ax_cv__pragma__gcc__diags_ignored_format_truncation=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_truncation" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_truncation" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-truncation\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-truncation\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-truncation" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_stringop_truncation+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wstringop-truncation" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_stringop_truncation=yes -else - ax_cv__pragma__gcc__diags_ignored_stringop_truncation=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_stringop_truncation" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstringop-truncation\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wstringop-truncation" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtype-limits\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtype-limits\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_type_limits+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtype-limits" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_type_limits=yes -else - ax_cv__pragma__gcc__diags_ignored_type_limits=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_type_limits" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_type_limits" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_type_limits" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtype-limits\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtype-limits\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtype-limits" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Warray-bounds\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Warray-bounds\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_array_bounds+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Warray-bounds" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_array_bounds=yes -else - ax_cv__pragma__gcc__diags_ignored_array_bounds=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_array_bounds" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_array_bounds" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_array_bounds" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Warray-bounds\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Warray-bounds\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Warray-bounds" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-type-limit-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-constant-out-of-range-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-unsigned-zero-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wtautological-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wtautological-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wtautological-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-compare\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-compare\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_compare+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wsign-compare" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_compare=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_compare=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_compare" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_compare" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_compare" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-compare\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-compare\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wsign-compare" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-conversion\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-conversion\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_conversion+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wsign-conversion" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_conversion=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_conversion=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_conversion" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wsign-conversion\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wsign-conversion\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wsign-conversion" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_break+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-break\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_return+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code-return\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wunreachable-code\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wunreachable-code\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wunreachable-code" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-overflow\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-overflow\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_overflow+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wformat-overflow" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_overflow=yes -else - ax_cv__pragma__gcc__diags_ignored_format_overflow=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_overflow" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_overflow" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_overflow" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wformat-overflow\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wformat-overflow\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wformat-overflow" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_covered_switch_default+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_covered_switch_default=yes -else - ax_cv__pragma__gcc__diags_ignored_covered_switch_default=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_covered_switch_default" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcovered-switch-default\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wextra-semi-stmt" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=yes -else - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wextra-semi-stmt\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wextra-semi-stmt" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcast-align\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcast-align\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cast_align+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wcast-align" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cast_align=yes -else - ax_cv__pragma__gcc__diags_ignored_cast_align=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cast_align" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cast_align" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cast_align" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wcast-align\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wcast-align\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wcast-align" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_strict_prototypes+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_strict_prototypes=yes -else - ax_cv__pragma__gcc__diags_ignored_strict_prototypes=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_strict_prototypes" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wstrict-prototypes\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wassign-enum\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wassign-enum\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_assign_enum+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wassign-enum" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_assign_enum=yes -else - ax_cv__pragma__gcc__diags_ignored_assign_enum=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_assign_enum" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_assign_enum" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_assign_enum" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-Wassign-enum\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-Wassign-enum\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wassign-enum" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM_BESIDEFUNC 1" >>confdefs.h - - -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat-pedantic\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wc++98-compat\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wc++98-compat" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_global_constructors+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wglobal-constructors" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_global_constructors=yes -else - ax_cv__pragma__gcc__diags_ignored_global_constructors=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_global_constructors" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_global_constructors" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_global_constructors" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wglobal-constructors\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wglobal-constructors" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS_BESIDEFUNC 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\"" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\"... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_exit_time_destructors+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-Wexit-time-destructors" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=yes -else - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS 1" >>confdefs.h - - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\" (outside functions)" >&5 -$as_echo_n "checking for C++ pragma GCC diagnostic ignored \"-Wexit-time-destructors\" (outside functions)... " >&6; } -if ${ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-Wexit-time-destructors" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=yes -else - ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" >&5 -$as_echo "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" >&6; } - if test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" = "yes"; then : - - -$as_echo "#define HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS_BESIDEFUNC 1" >>confdefs.h - - -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - if test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"; then : - - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT 1" >>confdefs.h - - -fi - -fi - - if test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"; then : - - if test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC 1" >>confdefs.h - - -fi - if test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ; then : - - -$as_echo "#define HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC 1" >>confdefs.h - - -fi - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma BOGUSforTest" >&5 -$as_echo_n "checking for pragma BOGUSforTest... " >&6; } -if ${ax_cv__pragma__bogus+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma BOGUSforTest -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus=yes -else - ax_cv__pragma__bogus=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus" >&5 -$as_echo "$ax_cv__pragma__bogus" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma BOGUSforTest (outside functions)" >&5 -$as_echo_n "checking for pragma BOGUSforTest (outside functions)... " >&6; } -if ${ax_cv__pragma__bogus_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma BOGUSforTest -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_besidefunc=yes -else - ax_cv__pragma__bogus_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_besidefunc" >&5 -$as_echo "$ax_cv__pragma__bogus_besidefunc" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\"" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\"... " >&6; } -if ${ax_cv__pragma__bogus_diag+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void func(void) { -#pragma GCC diagnostic ignored "-WBOGUSforTest" -} - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_diag=yes -else - ax_cv__pragma__bogus_diag=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_diag" >&5 -$as_echo "$ax_cv__pragma__bogus_diag" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\" (outside functions)" >&5 -$as_echo_n "checking for pragma GCC diagnostic ignored \"-WBOGUSforTest\" (outside functions)... " >&6; } -if ${ax_cv__pragma__bogus_diag_besidefunc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#pragma GCC diagnostic ignored "-WBOGUSforTest" -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ax_cv__pragma__bogus_diag_besidefunc=yes -else - ax_cv__pragma__bogus_diag_besidefunc=no - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv__pragma__bogus_diag_besidefunc" >&5 -$as_echo "$ax_cv__pragma__bogus_diag_besidefunc" >&6; } - - if test "${ax_cv__pragma__bogus}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_besidefunc}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_diag}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')" >&2;} -fi - - if test "${ax_cv__pragma__bogus_diag_besidefunc}" != "no"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')" >&5 -$as_echo "$as_me: WARNING: A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')" >&2;} -fi - - CFLAGS="${CFLAGS_SAVED}" - CXXFLAGS="${CXXFLAGS_SAVED}" -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for modbus_set_byte_timeout" >&5 -$as_echo_n "checking types of arguments for modbus_set_byte_timeout... " >&6; } -if ${nut_cv_func_modbus_set_byte_timeout_args+:} false; then : - $as_echo_n "(cached) " >&6 -else - nut_cv_func_modbus_set_byte_timeout_args="unknown" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ -modbus_t *ctx; struct timeval to = (struct timeval){0}; -modbus_set_byte_timeout(ctx, &to); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - nut_cv_func_modbus_set_byte_timeout_args="timeval" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ -modbus_t *ctx; uint32_t to_sec = 10, to_usec = 50; -struct timeval to = (struct timeval){0}; -/* TODO: Clarify and detect warning names and - * so pragmas for signed/unsigned assignment (e.g. - * for timeval definitions that have "long" fields) - */ -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION -# pragma GCC diagnostic ignored "-Wsign-conversion" -#endif -to.tv_sec = to_sec; -to.tv_usec = to_usec; -modbus_set_byte_timeout(ctx, &to); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - nut_cv_func_modbus_set_byte_timeout_args="timeval_numeric_fields" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -#include - -int -main () -{ -modbus_t *ctx; struct timeval to = (struct timeval){0}; -/* TODO: Clarify and detect warning names and - * so pragmas for signed/unsigned assignment (e.g. - * for timeval definitions that have "long" fields) - */ -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION -# pragma GCC diagnostic ignored "-Wsign-conversion" -#endif -uint32_t to_sec = to.tv_sec, to_usec = to.tv_usec; -modbus_set_byte_timeout(ctx, to_sec, to_usec); - - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32_cast_timeval_fields" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include - -int -main () -{ -modbus_t *ctx; uint32_t to_sec = 0, to_usec = 0; -modbus_set_byte_timeout(ctx, to_sec, to_usec); - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $nut_cv_func_modbus_set_byte_timeout_args" >&5 -$as_echo "$nut_cv_func_modbus_set_byte_timeout_args" >&6; } - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Found types to use for modbus_set_byte_timeout: ${nut_cv_func_modbus_set_byte_timeout_args}" >&5 -$as_echo "Found types to use for modbus_set_byte_timeout: ${nut_cv_func_modbus_set_byte_timeout_args}" >&6; } - COMMENT="Define to specify timeout method args approach for libmodbus" - case "${nut_cv_func_modbus_set_byte_timeout_args}" in #( - timeval_numeric_fields) : - -$as_echo "#define NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields 1" >>confdefs.h - ;; #( - timeval) : - -$as_echo "#define NUT_MODBUS_TIMEOUT_ARG_timeval 1" >>confdefs.h - ;; #( - sec_usec_uint32_cast_timeval_fields) : - -$as_echo "#define NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields 1" >>confdefs.h - ;; #( - sec_usec_uint32) : - -$as_echo "#define NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32 1" >>confdefs.h - ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find proper types to use for modbus_set_byte_timeout" >&5 -$as_echo "$as_me: WARNING: Cannot find proper types to use for modbus_set_byte_timeout" >&2;} - nut_have_libmodbus=no - ;; -esac - -fi - - if test x"${nut_have_libmodbus}" = x"yes"; then : - LIBMODBUS_CFLAGS="${CFLAGS}" - LIBMODBUS_LIBS="${LIBS}" - -fi - - CFLAGS="${CFLAGS_ORIG}" - LIBS="${LIBS_ORIG}" -fi - - - -# Check whether --with-avahi was given. -if test "${with_avahi+set}" = set; then : - withval=$with_avahi; nut_with_avahi="${withval}" -else - nut_with_avahi="auto" - -fi - - - if test -z "${nut_have_avahi_seen}"; then nut_have_avahi_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avahi-core version via pkg-config (0.6.30 minimum required)" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avahi-core version via pkg-config (0.6.30 minimum required)" >&5 $as_echo_n "checking for avahi-core version via pkg-config (0.6.30 minimum required)... " >&6; } - AVAHI_CORE_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-core 2>/dev/null`" - if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then - AVAHI_CORE_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${AVAHI_CORE_VERSION} found" >&5 + AVAHI_CORE_VERSION="`pkg-config --silence-errors --modversion avahi-core 2>/dev/null`" + if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then + AVAHI_CORE_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${AVAHI_CORE_VERSION} found" >&5 $as_echo "${AVAHI_CORE_VERSION} found" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avahi-client version via pkg-config (0.6.30 minimum required)" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avahi-client version via pkg-config (0.6.30 minimum required)" >&5 $as_echo_n "checking for avahi-client version via pkg-config (0.6.30 minimum required)... " >&6; } - AVAHI_CLIENT_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-client 2>/dev/null`" - if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then - AVAHI_CLIENT_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${AVAHI_CLIENT_VERSION} found" >&5 + AVAHI_CLIENT_VERSION="`pkg-config --silence-errors --modversion avahi-client 2>/dev/null`" + if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then + AVAHI_CLIENT_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${AVAHI_CLIENT_VERSION} found" >&5 $as_echo "${AVAHI_CLIENT_VERSION} found" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check avahi settings via pkg-config" >&5 -$as_echo "$as_me: can not check avahi settings via pkg-config" >&6;} - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for avahi cflags" >&5 $as_echo_n "checking for avahi cflags... " >&6; } @@ -19305,14 +8715,7 @@ if test "${with_avahi_includes+set}" = set; then : esac else - - if test x"$have_PKG_CONFIG" = xyes; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" || CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" -else - CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib" - -fi - + CFLAGS="`pkg-config --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CFLAGS}" >&5 @@ -19334,14 +8737,7 @@ if test "${with_avahi_libs+set}" = set; then : esac else - - if test x"$have_PKG_CONFIG" = xyes; then : - LIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" || LIBS="-lavahi-core -lavahi-client" -else - LIBS="-lavahi-core -lavahi-client" - -fi - + LIBS="`pkg-config --silence-errors --libs avahi-core avahi-client 2>/dev/null`" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 @@ -19417,150 +8813,79 @@ fi -if test "${nut_with_serial}" != "no"; then : - if test "${nut_with_serial}" != "yes"; then : - nut_with_serial="auto" -fi - - CFLAGS_SAVED_SERIAL="${CFLAGS}" - if test "${GCC}" = yes; then : - CFLAGS_SAVED_WERROR="${CFLAGS} -Wall -Werror" - CFLAGS_SAVED_WNOERROR="${CFLAGS} -Wno-error" - +case ${target_os} in + solaris2.1* ) + echo Checking for Solaris 10 / 11 specific configuration for usb drivers + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 +$as_echo_n "checking for library containing nanosleep... " >&6; } +if ${ac_cv_search_nanosleep+:} false; then : + $as_echo_n "(cached) " >&6 else - CFLAGS_SAVED_WERROR="${CFLAGS}" - CFLAGS_SAVED_WNOERROR="${CFLAGS}" - -fi - - - CFLAGS="${CFLAGS_SAVED_WERROR}" - for ac_header in sys/termios.h -do : - ac_fn_c_check_header_compile "$LINENO" "sys/termios.h" "ac_cv_header_sys_termios_h" "$ac_includes_default -" -if test "x$ac_cv_header_sys_termios_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TERMIOS_H 1 -_ACEOF - -else - - CFLAGS="${CFLAGS_SAVED_WNOERROR}" - for ac_header in termios.h -do : - ac_fn_c_check_header_compile "$LINENO" "termios.h" "ac_cv_header_termios_h" "$ac_includes_default -" -if test "x$ac_cv_header_termios_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_TERMIOS_H 1 -_ACEOF - -else - - for ac_header in sys/termios.h -do : - ac_fn_c_check_header_compile "$LINENO" "sys/termios.h" "ac_cv_header_sys_termios_h" "$ac_includes_default -" -if test "x$ac_cv_header_sys_termios_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_TERMIOS_H 1 -_ACEOF - -fi - -done - - -fi - -done - - -fi - -done - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct termios and speed_t" >&5 -$as_echo_n "checking for struct termios and speed_t... " >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if defined(HAVE_SYS_TERMIOS_H) -# include /* for speed_t */ -#else -# if defined(HAVE_TERMIOS_H) -# include -# endif /* HAVE_TERMIOS_H */ -#endif /* HAVE_SYS_TERMIOS_H */ -void getspeed(speed_t* b) { *b = B19200; } - +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char nanosleep (); int main () { -struct termios tio; -if (!tcgetattr(0, &tio)) { return 1; } -speed_t baudrate; -getspeed(&baudrate); - - +return nanosleep (); ; return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } - nut_have_serial_types=yes +for ac_lib in '' rt; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_nanosleep=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_nanosleep+:} false; then : + break +fi +done +if ${ac_cv_search_nanosleep+:} false; then : else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, struct termios and/or speed_t not found in discovered headers" >&5 -$as_echo "no, struct termios and/or speed_t not found in discovered headers" >&6; } - nut_have_serial_types=no - + ac_cv_search_nanosleep=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 +$as_echo "$ac_cv_search_nanosleep" >&6; } +ac_res=$ac_cv_search_nanosleep +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu + + LIBUSB_LIBS="-R/usr/sfw/lib ${LIBUSB_LIBS}" + +$as_echo "#define SUN_LIBUSB 1" >>confdefs.h + + SUN_LIBUSB=1 + ;; + hpux11*) + CFLAGS="${CFLAGS} -lpthread" +esac - CFLAGS="${CFLAGS_SAVED_SERIAL}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we can build serial drivers" >&5 -$as_echo_n "checking whether we can build serial drivers... " >&6; } - if test "${nut_have_serial_types}" = yes; then : - if test "${nut_with_serial}" = "auto"; then : +if test "${nut_with_serial}" != "no"; then nut_with_serial="yes" -fi -else - if test "${nut_with_serial}" = "auto"; then : - nut_with_serial="no" -fi - if test "${nut_with_serial}" = "yes"; then : - as_fn_error $? "no, and were required to" "$LINENO" 5 -fi - -fi - if test "${nut_with_serial}" = "yes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - fi @@ -19596,28 +8921,19 @@ _ACEOF - if test "${nut_usb_lib}" = "(libusb-1.0)"; then - WITH_LIBUSB_1_0_TRUE= - WITH_LIBUSB_1_0_FALSE='#' -else - WITH_LIBUSB_1_0_TRUE='#' - WITH_LIBUSB_1_0_FALSE= +if test "${nut_with_usb}" = "yes" -a "${nut_have_libusb}" != "yes"; then + as_fn_error $? "\"USB drivers requested, but libusb not found.\"" "$LINENO" 5 fi - if test "${nut_usb_lib}" = "(libusb-0.1)" -o "${nut_usb_lib}" = "(libusb-0.1-config)"; then - WITH_LIBUSB_0_1_TRUE= - WITH_LIBUSB_0_1_FALSE='#' -else - WITH_LIBUSB_0_1_TRUE='#' - WITH_LIBUSB_0_1_FALSE= +if test "${nut_with_usb}" != "no"; then + nut_with_usb="${nut_have_libusb}" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build USB drivers" >&5 $as_echo_n "checking whether to build USB drivers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_usb} ${nut_usb_lib}" >&5 -$as_echo "${nut_with_usb} ${nut_usb_lib}" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_usb} " >&5 +$as_echo "${nut_with_usb} " >&6; } if test -z "${nut_report_feature_flag}"; then nut_report_feature_flag="1" ac_clean_files="${ac_clean_files} conf_nut_report_feature" @@ -19625,7 +8941,7 @@ $as_echo "${nut_with_usb} ${nut_usb_lib}" >&6; } echo "Configuration summary:" >> conf_nut_report_feature echo "======================" >> conf_nut_report_feature fi - echo "build USB drivers: ${nut_with_usb} ${nut_usb_lib}" >> conf_nut_report_feature + echo "build USB drivers: ${nut_with_usb} " >> conf_nut_report_feature if test "${nut_with_usb}" = "yes"; then @@ -19646,8 +8962,49 @@ _ACEOF +if test "${nut_with_snmp}" = "yes" -a "${nut_have_libnetsnmp}" != "yes"; then + as_fn_error $? "\"Net-SNMP libraries not found, required for SNMP drivers\"" "$LINENO" 5 +fi + +if test "${nut_with_snmp}" != "no"; then + nut_with_snmp="${nut_have_libnetsnmp}" +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build SNMP drivers" >&5 +$as_echo_n "checking whether to build SNMP drivers... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_snmp} " >&5 +$as_echo "${nut_with_snmp} " >&6; } + if test -z "${nut_report_feature_flag}"; then + nut_report_feature_flag="1" + ac_clean_files="${ac_clean_files} conf_nut_report_feature" + echo > conf_nut_report_feature + echo "Configuration summary:" >> conf_nut_report_feature + echo "======================" >> conf_nut_report_feature + fi + echo "build SNMP drivers: ${nut_with_snmp} " >> conf_nut_report_feature + + + if test "${nut_with_snmp}" = "yes"; then + WITH_SNMP_TRUE= + WITH_SNMP_FALSE='#' +else + WITH_SNMP_TRUE='#' + WITH_SNMP_FALSE= +fi + + if test "${nut_with_snmp}" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define WITH_SNMP 1 +_ACEOF + + fi + + + if test "${nut_with_neon}" = "yes" -a "${nut_have_neon}" != "yes"; then - as_fn_error $? "neon libraries not found, required for neon based XML/HTTP driver" "$LINENO" 5 + as_fn_error $? "\"neon libraries not found, required for neon based XML/HTTP driver\"" "$LINENO" 5 fi if test "${nut_with_neon}" != "no"; then @@ -19685,18 +9042,10 @@ _ACEOF fi - if test "${nut_have_neon}" = "yes"; then - HAVE_NEON_TRUE= - HAVE_NEON_FALSE='#' -else - HAVE_NEON_TRUE='#' - HAVE_NEON_FALSE= -fi - if test "${nut_with_avahi}" = "yes" -a "${nut_have_avahi}" != "yes"; then - as_fn_error $? "avahi libraries not found" "$LINENO" 5 + as_fn_error $? "\"avahi libraries not found\"" "$LINENO" 5 fi if test "${nut_with_avahi}" != "no"; then @@ -19738,7 +9087,7 @@ _ACEOF if test "${nut_with_powerman}" = "yes" -a "${nut_have_libpowerman}" != "yes"; then - as_fn_error $? "Powerman client libraries not found, required for Powerman PDU client driver" "$LINENO" 5 + as_fn_error $? "\"Powerman client libraries not found, required for Powerman PDU client driver\"" "$LINENO" 5 fi if test "${nut_with_powerman}" != "no"; then @@ -19778,46 +9127,6 @@ _ACEOF -if test "${nut_with_modbus}" = "yes" -a "${nut_have_libmodbus}" != "yes"; then - as_fn_error $? "modbus library not found, required for Modbus driver" "$LINENO" 5 -fi - -if test "${nut_with_modbus}" != "no"; then - nut_with_modbus="${nut_have_libmodbus}" -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build Modbus driver" >&5 -$as_echo_n "checking whether to build Modbus driver... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_modbus} " >&5 -$as_echo "${nut_with_modbus} " >&6; } - if test -z "${nut_report_feature_flag}"; then - nut_report_feature_flag="1" - ac_clean_files="${ac_clean_files} conf_nut_report_feature" - echo > conf_nut_report_feature - echo "Configuration summary:" >> conf_nut_report_feature - echo "======================" >> conf_nut_report_feature - fi - echo "build Modbus driver: ${nut_with_modbus} " >> conf_nut_report_feature - - - if test "${nut_with_modbus}" = "yes"; then - WITH_MODBUS_TRUE= - WITH_MODBUS_FALSE='#' -else - WITH_MODBUS_TRUE='#' - WITH_MODBUS_FALSE= -fi - - if test "${nut_with_modbus}" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define WITH_MODBUS 1 -_ACEOF - - fi - - nut_ipmi_lib="" @@ -19847,271 +9156,23 @@ if test "${nut_with_ipmi}" != "no"; then if test -z "${nut_have_libfreeipmi_seen}"; then nut_have_libfreeipmi_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI version via pkg-config" >&5 $as_echo_n "checking for FreeIPMI version via pkg-config... " >&6; } - FREEIPMI_VERSION="`$PKG_CONFIG --silence-errors --modversion libfreeipmi 2>/dev/null`" - if test "$?" != "0" -o -z "${FREEIPMI_VERSION}"; then - FREEIPMI_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${FREEIPMI_VERSION} found" >&5 + FREEIPMI_VERSION="`pkg-config --silence-errors --modversion libfreeipmi 2>/dev/null`" + if test "$?" = "0" -a -n "${FREEIPMI_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" + else + FREEIPMI_VERSION="none" + CFLAGS="" + LIBS="-lfreeipmi -lipmimonitoring" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${FREEIPMI_VERSION} found" >&5 $as_echo "${FREEIPMI_VERSION} found" >&6; } -else - FREEIPMI_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check FreeIPMI settings via pkg-config" >&5 -$as_echo "$as_me: can not check FreeIPMI settings via pkg-config" >&6;} - - -fi - - if test x"$FREEIPMI_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" - -else - CFLAGS="" - LIBS="-lfreeipmi -lipmimonitoring" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI cflags" >&5 $as_echo_n "checking for FreeIPMI cflags... " >&6; } @@ -20559,7 +9620,7 @@ $as_echo "#define HAVE_FREEIPMI_MONITORING 1" >>confdefs.h fi if test "${nut_have_freeipmi}" != "yes"; then - as_fn_error $? "FreeIPMI not found, required for IPMI support" "$LINENO" 5 + as_fn_error $? "\"GNU FreeIPMI not found, required for IPMI support\"" "$LINENO" 5 fi nut_with_ipmi="yes" else @@ -20567,271 +9628,23 @@ fi if test -z "${nut_have_libfreeipmi_seen}"; then nut_have_libfreeipmi_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI version via pkg-config" >&5 $as_echo_n "checking for FreeIPMI version via pkg-config... " >&6; } - FREEIPMI_VERSION="`$PKG_CONFIG --silence-errors --modversion libfreeipmi 2>/dev/null`" - if test "$?" != "0" -o -z "${FREEIPMI_VERSION}"; then - FREEIPMI_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${FREEIPMI_VERSION} found" >&5 + FREEIPMI_VERSION="`pkg-config --silence-errors --modversion libfreeipmi 2>/dev/null`" + if test "$?" = "0" -a -n "${FREEIPMI_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" + else + FREEIPMI_VERSION="none" + CFLAGS="" + LIBS="-lfreeipmi -lipmimonitoring" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${FREEIPMI_VERSION} found" >&5 $as_echo "${FREEIPMI_VERSION} found" >&6; } -else - FREEIPMI_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check FreeIPMI settings via pkg-config" >&5 -$as_echo "$as_me: can not check FreeIPMI settings via pkg-config" >&6;} - - -fi - - if test x"$FREEIPMI_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" - -else - CFLAGS="" - LIBS="-lfreeipmi -lipmimonitoring" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeIPMI cflags" >&5 $as_echo_n "checking for FreeIPMI cflags... " >&6; } @@ -21280,7 +10093,7 @@ fi if test "${nut_have_freeipmi}" != "yes"; then if test "${nut_with_ipmi}" = "yes"; then - as_fn_error $? "FreeIPMI not found, required for IPMI support" "$LINENO" 5 + as_fn_error $? "\"FreeIPMI not found, required for IPMI support\"" "$LINENO" 5 fi nut_with_ipmi="no" else @@ -21351,9 +10164,6 @@ if test "${nut_with_macosx_ups}" != no; then if test -d /System/Library/Frameworks/IOKit.framework/ ; then nut_with_macosx_ups="yes" else - if test "${nut_with_macosx_ups}" = yes; then - as_fn_error $? "macosx-ups was required but can not be fulfilled for this build: not MacOS" "$LINENO" 5 - fi nut_with_macosx_ups="no" fi fi @@ -21391,310 +10201,6 @@ _ACEOF -# Check whether --with-linux_i2c was given. -if test "${with_linux_i2c+set}" = set; then : - withval=$with_linux_i2c; nut_with_linux_i2c="${withval}" -else - nut_with_linux_i2c="auto" - -fi - - -if test "${nut_with_linux_i2c}" != no; then - case ${target_os} in - linux* ) - ac_fn_c_check_header_mongrel "$LINENO" "linux/i2c-dev.h" "ac_cv_header_linux_i2c_dev_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_i2c_dev_h" = xyes; then : - -$as_echo "#define HAVE_LINUX_I2C_DEV_H 1" >>confdefs.h - - -fi - - - ac_fn_c_check_header_mongrel "$LINENO" "i2c/smbus.h" "ac_cv_header_i2c_smbus_h" "$ac_includes_default" -if test "x$ac_cv_header_i2c_smbus_h" = xyes; then : - -$as_echo "#define HAVE_LINUX_SMBUS_H 1" >>confdefs.h - - -fi - - - ac_fn_c_check_decl "$LINENO" "i2c_smbus_access" "ac_cv_have_decl_i2c_smbus_access" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_access" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_ACCESS $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi -ac_fn_c_check_decl "$LINENO" "i2c_smbus_read_byte_data" "ac_cv_have_decl_i2c_smbus_read_byte_data" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_read_byte_data" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_READ_BYTE_DATA $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi -ac_fn_c_check_decl "$LINENO" "i2c_smbus_write_byte_data" "ac_cv_have_decl_i2c_smbus_write_byte_data" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_write_byte_data" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_WRITE_BYTE_DATA $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi -ac_fn_c_check_decl "$LINENO" "i2c_smbus_read_word_data" "ac_cv_have_decl_i2c_smbus_read_word_data" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_read_word_data" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_READ_WORD_DATA $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi -ac_fn_c_check_decl "$LINENO" "i2c_smbus_write_word_data" "ac_cv_have_decl_i2c_smbus_write_word_data" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_write_word_data" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_WRITE_WORD_DATA $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi -ac_fn_c_check_decl "$LINENO" "i2c_smbus_read_block_data" "ac_cv_have_decl_i2c_smbus_read_block_data" "#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - - -" -if test "x$ac_cv_have_decl_i2c_smbus_read_block_data" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_I2C_SMBUS_READ_BLOCK_DATA $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing i2c_smbus_read_byte, i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_datai2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data" >&5 -$as_echo_n "checking for library containing i2c_smbus_read_byte, i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_datai2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data... " >&6; } -if ${ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char i2c_smbus_read_byte, i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_datai2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data (); -int -main () -{ -return i2c_smbus_read_byte, i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_datai2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data (); - ; - return 0; -} -_ACEOF -for ac_lib in '' i2c; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data+:} false; then : - break -fi -done -if ${ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data+:} false; then : - -else - ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data" >&5 -$as_echo "$ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data" >&6; } -ac_res=$ac_cv_search_i2c_smbus_read_byte__i2c_smbus_access__i2c_smbus_read_byte_data__i2c_smbus_write_byte_datai2c_smbus_write_byte_data__i2c_smbus_read_word_data__i2c_smbus_write_word_data__i2c_smbus_read_block_data -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - nut_with_linux_i2c="yes" -else - if test "${nut_with_linux_i2c}" = "yes"; then : - as_fn_error $? "i2c was required but can not be fulfilled for this build" "$LINENO" 5 -else - nut_with_linux_i2c="no" -fi - -fi - - ;; - * ) - if test "${nut_with_linux_i2c}" = yes; then - as_fn_error $? "i2c was required but can not be fulfilled for this build: not linux" "$LINENO" 5 - fi - nut_with_linux_i2c="no" - ;; - esac -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build i2c based drivers" >&5 -$as_echo_n "checking whether to build i2c based drivers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_linux_i2c} " >&5 -$as_echo "${nut_with_linux_i2c} " >&6; } - if test -z "${nut_report_feature_flag}"; then - nut_report_feature_flag="1" - ac_clean_files="${ac_clean_files} conf_nut_report_feature" - echo > conf_nut_report_feature - echo "Configuration summary:" >> conf_nut_report_feature - echo "======================" >> conf_nut_report_feature - fi - echo "build i2c based drivers: ${nut_with_linux_i2c} " >> conf_nut_report_feature - - - if test "${nut_with_linux_i2c}" = "yes"; then - WITH_LINUX_I2C_TRUE= - WITH_LINUX_I2C_FALSE='#' -else - WITH_LINUX_I2C_TRUE='#' - WITH_LINUX_I2C_FALSE= -fi - - if test "${nut_with_linux_i2c}" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define WITH_LINUX_I2C 1 -_ACEOF - - fi - - - nut_ssl_lib="" @@ -21734,284 +10240,23 @@ if test "${nut_with_ssl}" != "no"; then if test -z "${nut_have_libnss_seen}"; then nut_have_libnss_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - SAVED_GCC="$GCC" - SAVED_CC="$CC" - if ( test "${GCC}" = "yes" ) - then - case "$CFLAGS$LDFLAGS" in - *-m32*) CC="$CC -m32" ;; - *-m64*) CC="$CC -m64" ;; - esac - fi - - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS version via pkg-config" >&5 $as_echo_n "checking for Mozilla NSS version via pkg-config... " >&6; } - NSS_VERSION="`$PKG_CONFIG --silence-errors --modversion nss 2>/dev/null`" - if test "$?" != "0" -o -z "${NSS_VERSION}"; then - NSS_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NSS_VERSION} found" >&5 + NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`" + if test "$?" = "0" -a -n "${NSS_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`" + else + NSS_VERSION="none" + CFLAGS="" + LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NSS_VERSION} found" >&5 $as_echo "${NSS_VERSION} found" >&6; } -else - NSS_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libnss settings via pkg-config" >&5 -$as_echo "$as_me: can not check libnss settings via pkg-config" >&6;} - - -fi - - if test x"$NSS_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags nss 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs nss 2>/dev/null`" - REQUIRES="nss" - -else - CFLAGS="" - LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" - REQUIRES="nss" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS cflags" >&5 $as_echo_n "checking for Mozilla NSS cflags... " >&6; } @@ -22052,33 +10297,32 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 $as_echo "${LIBS}" >&6; } - for ac_func in NSS_Init + for ac_header in nss.h +do : + ac_fn_c_check_header_compile "$LINENO" "nss.h" "ac_cv_header_nss_h" "$ac_includes_default +" +if test "x$ac_cv_header_nss_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NSS_H 1 +_ACEOF + nut_have_libnss=yes +else + nut_have_libnss=no +fi + +done + + for ac_func in NSS_Init do : ac_fn_c_check_func "$LINENO" "NSS_Init" "ac_cv_func_NSS_Init" if test "x$ac_cv_func_NSS_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NSS_INIT 1 -_ACEOF - nut_have_libnss=yes -else - nut_have_libnss=no -fi -done - - for ac_header in nss.h ssl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else nut_have_libnss=no fi - done @@ -22093,292 +10337,37 @@ $as_echo "#define WITH_NSS 1" >>confdefs.h LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" - GCC="$SAVED_GCC" - CC="$SAVED_CC" fi if test "${nut_have_libnss}" != "yes"; then - as_fn_error $? "Mozilla NSS not found (required for SSL support)" "$LINENO" 5 + as_fn_error $? "\"Mozilla NSS not found, required for SSL support\"" "$LINENO" 5 fi elif test "${nut_with_openssl}" = "yes"; then if test -z "${nut_have_libopenssl_seen}"; then nut_have_libopenssl_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL version via pkg-config" >&5 $as_echo_n "checking for OpenSSL version via pkg-config... " >&6; } - OPENSSL_VERSION="`$PKG_CONFIG --silence-errors --modversion openssl 2>/dev/null`" - if test "$?" != "0" -o -z "${OPENSSL_VERSION}"; then - OPENSSL_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 + OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`" + if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`" + else + OPENSSL_VERSION="none" + CFLAGS="" + LIBS="-lssl -lcrypto" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 $as_echo "${OPENSSL_VERSION} found" >&6; } -else - OPENSSL_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check OpenSSL settings via pkg-config" >&5 -$as_echo "$as_me: can not check OpenSSL settings via pkg-config" >&6;} - - -fi - - if test x"$OPENSSL_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags openssl 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs openssl 2>/dev/null`" - REQUIRES="openssl" - -else - CFLAGS="" - LIBS="-lssl -lcrypto" - REQUIRES="openssl" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL cflags" >&5 $as_echo_n "checking for OpenSSL cflags... " >&6; } @@ -22434,12 +10423,12 @@ fi done - for ac_func in SSL_CTX_new + for ac_func in SSL_library_init do : - ac_fn_c_check_func "$LINENO" "SSL_CTX_new" "ac_cv_func_SSL_CTX_new" -if test "x$ac_cv_func_SSL_CTX_new" = xyes; then : + ac_fn_c_check_func "$LINENO" "SSL_library_init" "ac_cv_func_SSL_library_init" +if test "x$ac_cv_func_SSL_library_init" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_SSL_CTX_NEW 1 +#define HAVE_SSL_LIBRARY_INIT 1 _ACEOF else @@ -22459,290 +10448,37 @@ $as_echo "#define WITH_OPENSSL 1" >>confdefs.h LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" fi if test "${nut_have_openssl}" != "yes"; then - as_fn_error $? "OpenSSL not found (required for SSL support)" "$LINENO" 5 + as_fn_error $? "\"OpenSSL not found, required for SSL support\"" "$LINENO" 5 fi else if test -z "${nut_have_libopenssl_seen}"; then nut_have_libopenssl_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL version via pkg-config" >&5 $as_echo_n "checking for OpenSSL version via pkg-config... " >&6; } - OPENSSL_VERSION="`$PKG_CONFIG --silence-errors --modversion openssl 2>/dev/null`" - if test "$?" != "0" -o -z "${OPENSSL_VERSION}"; then - OPENSSL_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 + OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`" + if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`" + else + OPENSSL_VERSION="none" + CFLAGS="" + LIBS="-lssl -lcrypto" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OPENSSL_VERSION} found" >&5 $as_echo "${OPENSSL_VERSION} found" >&6; } -else - OPENSSL_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check OpenSSL settings via pkg-config" >&5 -$as_echo "$as_me: can not check OpenSSL settings via pkg-config" >&6;} - - -fi - - if test x"$OPENSSL_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags openssl 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs openssl 2>/dev/null`" - REQUIRES="openssl" - -else - CFLAGS="" - LIBS="-lssl -lcrypto" - REQUIRES="openssl" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL cflags" >&5 $as_echo_n "checking for OpenSSL cflags... " >&6; } @@ -22798,12 +10534,12 @@ fi done - for ac_func in SSL_CTX_new + for ac_func in SSL_library_init do : - ac_fn_c_check_func "$LINENO" "SSL_CTX_new" "ac_cv_func_SSL_CTX_new" -if test "x$ac_cv_func_SSL_CTX_new" = xyes; then : + ac_fn_c_check_func "$LINENO" "SSL_library_init" "ac_cv_func_SSL_library_init" +if test "x$ac_cv_func_SSL_library_init" = xyes; then : cat >>confdefs.h <<_ACEOF -#define HAVE_SSL_CTX_NEW 1 +#define HAVE_SSL_LIBRARY_INIT 1 _ACEOF else @@ -22823,12 +10559,10 @@ $as_echo "#define WITH_OPENSSL 1" >>confdefs.h LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" fi if test "${nut_have_openssl}" != "yes"; then @@ -22836,284 +10570,23 @@ fi if test -z "${nut_have_libnss_seen}"; then nut_have_libnss_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - SAVED_GCC="$GCC" - SAVED_CC="$CC" - if ( test "${GCC}" = "yes" ) - then - case "$CFLAGS$LDFLAGS" in - *-m32*) CC="$CC -m32" ;; - *-m64*) CC="$CC -m64" ;; - esac - fi - - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS version via pkg-config" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS version via pkg-config" >&5 $as_echo_n "checking for Mozilla NSS version via pkg-config... " >&6; } - NSS_VERSION="`$PKG_CONFIG --silence-errors --modversion nss 2>/dev/null`" - if test "$?" != "0" -o -z "${NSS_VERSION}"; then - NSS_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NSS_VERSION} found" >&5 + NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`" + if test "$?" = "0" -a -n "${NSS_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`" + else + NSS_VERSION="none" + CFLAGS="" + LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${NSS_VERSION} found" >&5 $as_echo "${NSS_VERSION} found" >&6; } -else - NSS_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libnss settings via pkg-config" >&5 -$as_echo "$as_me: can not check libnss settings via pkg-config" >&6;} - - -fi - - if test x"$NSS_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags nss 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs nss 2>/dev/null`" - REQUIRES="nss" - -else - CFLAGS="" - LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" - REQUIRES="nss" - - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Mozilla NSS cflags" >&5 $as_echo_n "checking for Mozilla NSS cflags... " >&6; } @@ -23154,33 +10627,32 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LIBS}" >&5 $as_echo "${LIBS}" >&6; } - for ac_func in NSS_Init + for ac_header in nss.h +do : + ac_fn_c_check_header_compile "$LINENO" "nss.h" "ac_cv_header_nss_h" "$ac_includes_default +" +if test "x$ac_cv_header_nss_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_NSS_H 1 +_ACEOF + nut_have_libnss=yes +else + nut_have_libnss=no +fi + +done + + for ac_func in NSS_Init do : ac_fn_c_check_func "$LINENO" "NSS_Init" "ac_cv_func_NSS_Init" if test "x$ac_cv_func_NSS_Init" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_NSS_INIT 1 -_ACEOF - nut_have_libnss=yes -else - nut_have_libnss=no -fi -done - - for ac_header in nss.h ssl.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF else nut_have_libnss=no fi - done @@ -23195,22 +10667,18 @@ $as_echo "#define WITH_NSS 1" >>confdefs.h LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" - GCC="$SAVED_GCC" - CC="$SAVED_CC" fi if test "${nut_have_libnss}" != "yes"; then if test "${nut_with_ssl}" = "yes"; then - as_fn_error $? "Neither Mozilla NSS nor OpenSSL was found, but one is needed for the requested SSL support." "$LINENO" 5 + as_fn_error $? "\"Mozilla NSS and OpenSSL neither found, but are needed for the requested SSL support\"" "$LINENO" 5 else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Neither Mozilla NSS nor OpenSSL was found (required for SSL support)" >&5 -$as_echo "$as_me: WARNING: Neither Mozilla NSS nor OpenSSL was found (required for SSL support)" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"Mozilla NSS and OpenSSL neither found, required for SSL support\"" >&5 +$as_echo "$as_me: WARNING: \"Mozilla NSS and OpenSSL neither found, required for SSL support\"" >&2;} fi nut_with_ssl="no" else @@ -23367,12 +10835,6 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing request_init" >&5 $as_echo_n "checking for library containing request_init... " >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -23427,12 +10889,6 @@ rm -f core conftest.err conftest.$ac_objext \ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - if test "${nut_have_libwrap}" = "yes"; then @@ -23448,7 +10904,7 @@ fi fi if test "${nut_with_wrap}" = "yes" -a "${nut_have_libwrap}" != "yes"; then - as_fn_error $? "libwrap not found" "$LINENO" 5 + as_fn_error $? "\"libwrap not found\"" "$LINENO" 5 fi if test "${nut_with_wrap}" != "no"; then @@ -23636,7 +11092,7 @@ fi fi if test "${nut_with_libltdl}" = "yes" -a "${nut_have_libltdl}" != "yes"; then - as_fn_error $? "libltdl not found" "$LINENO" 5 + as_fn_error $? "\"libltdl not found\"" "$LINENO" 5 fi if test "${nut_with_libltdl}" != "no"; then @@ -23702,369 +11158,38 @@ if test "${nut_with_cgi}" != "no"; then if test -z "${nut_have_libgd_seen}"; then nut_have_libgd_seen=yes -if test -z "${nut_have_pkg_config_seen}"; then : - - nut_have_pkg_config_seen=yes - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG was already detected by autoconf" >&5 -$as_echo_n "checking whether usable PKG_CONFIG was already detected by autoconf... " >&6; } - if test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${PKG_CONFIG}" >&5 -$as_echo "yes: ${PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - - if test x"${PKG_CONFIG-}" = x"false"; then : - have_PKG_CONFIG=yes - # Extract the first word of "pkg-config", so it can be a program name with args. -set dummy pkg-config; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_dummy_PKG_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $dummy_PKG_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_dummy_PKG_CONFIG="$dummy_PKG_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_dummy_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -dummy_PKG_CONFIG=$ac_cv_path_dummy_PKG_CONFIG -if test -n "$dummy_PKG_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dummy_PKG_CONFIG" >&5 -$as_echo "$dummy_PKG_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - -# Check whether --with-pkg-config was given. -if test "${with_pkg_config+set}" = set; then : - withval=$with_pkg_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-pkg-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether usable PKG_CONFIG is present in PATH or was set by caller" >&5 -$as_echo_n "checking whether usable PKG_CONFIG is present in PATH or was set by caller... " >&6; } - if test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - -else - if $dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes: ${dummy_PKG_CONFIG}" >&5 -$as_echo "yes: ${dummy_PKG_CONFIG}" >&6; } - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - PKG_CONFIG=false - have_PKG_CONFIG=no - - -fi - -fi - -fi - - have_PKG_CONFIG_MACROS=no - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config (${PKG_CONFIG})" >&6;} - dummy_RES=0 - - - if test "${dummy_RES}" = 0; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for autoconf macro support of pkg-config module checker" >&5 -$as_echo "$as_me: checking for autoconf macro support of pkg-config module checker" >&6;} - - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pkg-config" >&5 -$as_echo_n "checking for pkg-config... " >&6; } - -if test -n "$dummy_PKG_CONFIG_CFLAGS"; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS="$dummy_PKG_CONFIG_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_CFLAGS=`$PKG_CONFIG --cflags "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$dummy_PKG_CONFIG_LIBS"; then - pkg_cv_dummy_PKG_CONFIG_LIBS="$dummy_PKG_CONFIG_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"pkg-config\""; } >&5 - ($PKG_CONFIG --exists --print-errors "pkg-config") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_dummy_PKG_CONFIG_LIBS=`$PKG_CONFIG --libs "pkg-config" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "pkg-config" 2>&1` - else - dummy_PKG_CONFIG_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "pkg-config" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$dummy_PKG_CONFIG_PKG_ERRORS" >&5 - - as_fn_error $? "Package requirements (pkg-config) were not met: - -$dummy_PKG_CONFIG_PKG_ERRORS - -Consider adjusting the PKG_CONFIG_PATH environment variable if you -installed software in a non-standard prefix. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details." "$LINENO" 5 -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it -is in your PATH or set the PKG_CONFIG environment variable to the full -path to pkg-config. - -Alternatively, you may set the environment variables dummy_PKG_CONFIG_CFLAGS -and dummy_PKG_CONFIG_LIBS to avoid the need to call pkg-config. -See the pkg-config man page for more details. - -To get pkg-config, see . -See \`config.log' for more details" "$LINENO" 5; } -else - dummy_PKG_CONFIG_CFLAGS=$pkg_cv_dummy_PKG_CONFIG_CFLAGS - dummy_PKG_CONFIG_LIBS=$pkg_cv_dummy_PKG_CONFIG_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_PKG_CONFIG_MACROS=yes -fi - - -fi - -fi - - if test x"$have_PKG_CONFIG" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&5 -$as_echo "$as_me: WARNING: pkg-config program is needed to look for further dependencies (will be skipped)" >&2;} - PKG_CONFIG="false" - -else - if test x"$have_PKG_CONFIG_MACROS" = xno; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&5 -$as_echo "$as_me: WARNING: pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly" >&2;} - -fi - -fi - - -fi - CFLAGS_ORIG="${CFLAGS}" LDFLAGS_ORIG="${LDFLAGS}" LIBS_ORIG="${LIBS}" - CFLAGS="" - LDFLAGS="" - LIBS="" - if test x"$have_PKG_CONFIG" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gd version via pkg-config" >&5 -$as_echo_n "checking for gd version via pkg-config... " >&6; } - GD_VERSION="`$PKG_CONFIG --silence-errors --modversion gdlib 2>/dev/null`" - if test "$?" != "0" -o -z "${GD_VERSION}"; then - GD_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${GD_VERSION} found" >&5 + CFLAGS="" + LDFLAGS="-L/usr/X11R6/lib" + LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gd version via gdlib-config" >&5 +$as_echo_n "checking for gd version via gdlib-config... " >&6; } + GD_VERSION=`gdlib-config --version 2>/dev/null` + if test "$?" != "0" -o -z "${GD_VERSION}"; then + GD_VERSION="none" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${GD_VERSION} found" >&5 $as_echo "${GD_VERSION} found" >&6; } -else - GD_VERSION="none" - { $as_echo "$as_me:${as_lineno-$LINENO}: can not check libgd settings via pkg-config" >&5 -$as_echo "$as_me: can not check libgd settings via pkg-config" >&6;} - - -fi - - if test x"$GD_VERSION" != xnone; then : - CFLAGS="`$PKG_CONFIG --silence-errors --cflags gdlib 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs gdlib 2>/dev/null`" - -else - CFLAGS="" - LDFLAGS="-L/usr/X11R6/lib" - LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" - - for ac_prog in gdlib-config -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_GDLIB_CONFIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $GDLIB_CONFIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_GDLIB_CONFIG="$GDLIB_CONFIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_GDLIB_CONFIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -GDLIB_CONFIG=$ac_cv_path_GDLIB_CONFIG -if test -n "$GDLIB_CONFIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GDLIB_CONFIG" >&5 -$as_echo "$GDLIB_CONFIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$GDLIB_CONFIG" && break -done -test -n "$GDLIB_CONFIG" || GDLIB_CONFIG="none" - - -# Check whether --with-gdlib-config was given. -if test "${with_gdlib_config+set}" = set; then : - withval=$with_gdlib_config; - case "${withval}" in - "") ;; - yes|no) - as_fn_error $? "invalid option --with(out)-gdlib-config - see docs/configure.txt" "$LINENO" 5 - ;; - *) - GDLIB_CONFIG="${withval}" - ;; - esac - -fi - - - if test x"$GDLIB_CONFIG" != xnone; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gd version via ${GDLIB_CONFIG}" >&5 -$as_echo_n "checking for gd version via ${GDLIB_CONFIG}... " >&6; } - GD_VERSION="`${GDLIB_CONFIG} --version 2>/dev/null`" - if test "$?" != "0" -o -z "${GD_VERSION}"; then - GD_VERSION="none" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${GD_VERSION} found" >&5 -$as_echo "${GD_VERSION} found" >&6; } - -else - GD_VERSION="none" - -fi - - case "${GD_VERSION}" in - none) - ;; - 2.0.5 | 2.0.6 | 2.0.7) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script" >&5 -$as_echo "$as_me: WARNING: gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs" >&5 + case "${GD_VERSION}" in + none) + ;; + 2.0.5 | 2.0.6 | 2.0.7) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gd ${GD_VERSION} detected, unable to use gdlib-config script" >&5 +$as_echo "$as_me: WARNING: gd ${GD_VERSION} detected, unable to use gdlib-config script" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs" >&5 $as_echo "$as_me: WARNING: If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs" >&2;} - ;; - *) - CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`" - LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`" - LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`" - ;; - esac - - -fi + ;; + *) + CFLAGS="`gdlib-config --includes 2>/dev/null`" + LDFLAGS="`gdlib-config --ldflags 2>/dev/null`" + LIBS="`gdlib-config --libs 2>/dev/null`" + ;; + esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gd include flags" >&5 $as_echo_n "checking for gd include flags... " >&6; } @@ -24178,86 +11303,7 @@ if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for more gd library flags" >&5 -$as_echo_n "checking for more gd library flags... " >&6; } - if test -n "${with_gd_libs}" || test x"$have_PKG_CONFIG" != xyes; then : nut_have_libgd=no -else - - _LIBS_PRIVATE="`$PKG_CONFIG --silence-errors --libs gdlib --static 2>/dev/null`" - if test -z "${_LIBS_PRIVATE}"; then : - nut_have_libgd=no -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking with gdlib.pc Libs.private" >&5 -$as_echo_n "checking with gdlib.pc Libs.private... " >&6; } - LDFLAGS="$LDFLAGS $_LIBS_PRIVATE" - unset ac_cv_search_gdImagePng - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gdImagePng" >&5 -$as_echo_n "checking for library containing gdImagePng... " >&6; } -if ${ac_cv_search_gdImagePng+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char gdImagePng (); -int -main () -{ -return gdImagePng (); - ; - return 0; -} -_ACEOF -for ac_lib in '' gd; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_gdImagePng=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_gdImagePng+:} false; then : - break -fi -done -if ${ac_cv_search_gdImagePng+:} false; then : - -else - ac_cv_search_gdImagePng=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gdImagePng" >&5 -$as_echo "$ac_cv_search_gdImagePng" >&6; } -ac_res=$ac_cv_search_gdImagePng -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -else - nut_have_libgd=no -fi - - -fi - unset _LIBS_PRIVATE - -fi - fi @@ -24317,201 +11363,67 @@ _ACEOF +if test "${nut_with_hal}" = "yes" -a "${nut_have_libhal}" != "yes"; then + as_fn_error $? "\"libhal not found, required for HAL support\"" "$LINENO" 5 +fi - # Check whether --enable-cppcheck was given. -if test "${enable_cppcheck+set}" = set; then : - enableval=$enable_cppcheck; nut_enable_cppcheck="${enableval}" +if test "${nut_with_hal}" = "yes" -a "${nut_have_libusb}" != "yes"; then + as_fn_error $? "\"libusb not found, required for HAL support\"" "$LINENO" 5 +fi + +if test "${nut_with_hal}" != "no"; then + if test "${nut_have_libhal}" = "yes" -a "${nut_have_libusb}" = "yes"; then + nut_with_hal="yes" + else + nut_with_hal="no" + fi +fi + + if test "${nut_with_hal}" = "yes"; then + WITH_HAL_TRUE= + WITH_HAL_FALSE='#' else - nut_enable_cppcheck="no" - + WITH_HAL_TRUE='#' + WITH_HAL_FALSE= fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable HAL support" >&5 +$as_echo_n "checking whether to enable HAL support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_hal} " >&5 +$as_echo "${nut_with_hal} " >&6; } + if test -z "${nut_report_feature_flag}"; then + nut_report_feature_flag="1" + ac_clean_files="${ac_clean_files} conf_nut_report_feature" + echo > conf_nut_report_feature + echo "Configuration summary:" >> conf_nut_report_feature + echo "======================" >> conf_nut_report_feature + fi + echo "enable HAL support: ${nut_with_hal} " >> conf_nut_report_feature -if test -z "${nut_have_cppcheck_seen}"; then - nut_have_cppcheck_seen=yes - CPPCHECK_MIN_VERSION="1.0" - for ac_prog in cppcheck -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_CPPCHECK+:} false; then : - $as_echo_n "(cached) " >&6 + if test "${nut_with_hal}" = "yes"; then + WITH_HAL_TRUE= + WITH_HAL_FALSE='#' else - case $CPPCHECK in - [\\/]* | ?:[\\/]*) - ac_cv_path_CPPCHECK="$CPPCHECK" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_CPPCHECK="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -CPPCHECK=$ac_cv_path_CPPCHECK -if test -n "$CPPCHECK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPPCHECK" >&5 -$as_echo "$CPPCHECK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + WITH_HAL_TRUE='#' + WITH_HAL_FALSE= fi + if test "${nut_with_hal}" = "yes"; then - test -n "$CPPCHECK" && break -done +cat >>confdefs.h <<_ACEOF +#define WITH_HAL 1 +_ACEOF - if test -n "${CPPCHECK}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cppcheck version" >&5 -$as_echo_n "checking for cppcheck version... " >&6; } - CPPCHECK_VERSION="`${CPPCHECK} --version 2>/dev/null`" - CPPCHECK_VERSION="${CPPCHECK_VERSION##* }" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${CPPCHECK_VERSION} found" >&5 -$as_echo "${CPPCHECK_VERSION} found" >&6; } - fi + fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cppcheck version is okay (minimum required ${CPPCHECK_MIN_VERSION})" >&5 -$as_echo_n "checking if cppcheck version is okay (minimum required ${CPPCHECK_MIN_VERSION})... " >&6; } - - - - # Used to indicate true or false condition - ax_compare_version=false - - # Convert the two version strings to be compared into a format that - # allows a simple string comparison. The end result is that a version - # string of the form 1.12.5-r617 will be converted to the form - # 0001001200050617. In other words, each number is zero padded to four - # digits, and non digits are removed. - - ax_compare_version_A=`echo "${CPPCHECK_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version_B=`echo "${CPPCHECK_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version=`echo "x$ax_compare_version_A -x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` - - - - if test "$ax_compare_version" = "true" ; then - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - nut_have_cppcheck="yes" - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - nut_have_cppcheck="no" - - fi - - - if test "${nut_have_cppcheck}" = "yes"; then - HAVE_CPPCHECK_TRUE= - HAVE_CPPCHECK_FALSE='#' -else - HAVE_CPPCHECK_TRUE='#' - HAVE_CPPCHECK_FALSE= -fi - -fi - - -case "${nut_enable_cppcheck}" in - yes) if test "${nut_have_cppcheck}" = "no" ; then - as_fn_error $? "Requested to --enable-cppcheck but did not find a good one" "$LINENO" 5 - fi - WITH_CPPCHECK=yes - ;; - no) WITH_CPPCHECK=no ;; - auto) if test "${nut_have_cppcheck}" = "yes" ; then - WITH_CPPCHECK=no - else - WITH_CPPCHECK=no - fi - ;; -esac - - if test "${WITH_CPPCHECK}" = "yes"; then - WITH_CPPCHECK_TRUE= - WITH_CPPCHECK_FALSE='#' -else - WITH_CPPCHECK_TRUE='#' - WITH_CPPCHECK_FALSE= -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to run NIT among default make check target" >&5 -$as_echo_n "checking whether to run NIT among default make check target... " >&6; } -nut_enable_check_NIT="no" -# Check whether --enable-check-NIT was given. -if test "${enable_check_NIT+set}" = set; then : - enableval=$enable_check_NIT; - case "${enableval}" in - no) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - nut_enable_check_NIT="yes" - ;; - esac - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi - - - if test "${nut_enable_check_NIT}" = "yes"; then - WITH_CHECK_NIT_TRUE= - WITH_CHECK_NIT_FALSE='#' -else - WITH_CHECK_NIT_TRUE='#' - WITH_CHECK_NIT_FALSE= -fi if test -z "${nut_have_asciidoc_seen}"; then nut_have_asciidoc_seen=yes - # Note: this is for both asciidoc and a2x at this time - ASCIIDOC_MIN_VERSION="8.6.3" - # Note: this is checked in the configure script if PDF is of interest at all - DBLATEX_MIN_VERSION="0.2.5" for ac_prog in asciidoc do @@ -24566,14 +11478,6 @@ $as_echo_n "checking for asciiDoc version... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ASCIIDOC_VERSION} found" >&5 $as_echo "${ASCIIDOC_VERSION} found" >&6; } fi - if test -n "${ASCIIDOC}"; then - MANUALUPDATE_TRUE= - MANUALUPDATE_FALSE='#' -else - MANUALUPDATE_TRUE='#' - MANUALUPDATE_FALSE= -fi - for ac_prog in a2x do @@ -24683,228 +11587,26 @@ $as_echo_n "checking for dblatex version... " >&6; } $as_echo "${DBLATEX_VERSION} found" >&6; } fi - for ac_prog in xsltproc -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XSLTPROC+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XSLTPROC in - [\\/]* | ?:[\\/]*) - ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -XSLTPROC=$ac_cv_path_XSLTPROC -if test -n "$XSLTPROC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5 -$as_echo "$XSLTPROC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$XSLTPROC" && break -done - - if test -n "${XSLTPROC}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xsltproc version" >&5 -$as_echo_n "checking for xsltproc version... " >&6; } - XSLTPROC_VERSION="`${XSLTPROC} --version 2>/dev/null`" - XSLTPROC_VERSION="${XSLTPROC_VERSION##* }" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${XSLTPROC_VERSION} found" >&5 -$as_echo "${XSLTPROC_VERSION} found" >&6; } fi - for ac_prog in xmllint -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_XMLLINT+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $XMLLINT in - [\\/]* | ?:[\\/]*) - ac_cv_path_XMLLINT="$XMLLINT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - ;; +case "${nut_with_doc}" in + yes|all|auto) + nut_doc_build_list="html-single html-chunked pdf" + ;; + no) + nut_doc_build_list="" + ;; + *) + nut_doc_build_list="`echo ${nut_with_doc} | sed 's/,/ /g'`" + ;; esac -fi -XMLLINT=$ac_cv_path_XMLLINT -if test -n "$XMLLINT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XMLLINT" >&5 -$as_echo "$XMLLINT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - test -n "$XMLLINT" && break -done - - if test -n "${XMLLINT}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmllint version" >&5 -$as_echo_n "checking for xmllint version... " >&6; } - XMLLINT_VERSION="`${XMLLINT} --version 2>/dev/null`" - XMLLINT_VERSION="${XMLLINT_VERSION##* }" - if test -z "${XMLLINT_VERSION}" ; then - XMLLINT_VERSION="`${XMLLINT} --version 2>&1 | grep version`" - XMLLINT_VERSION="${XMLLINT_VERSION##* }" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${XMLLINT_VERSION} found" >&5 -$as_echo "${XMLLINT_VERSION} found" >&6; } - fi - - for ac_prog in source-highlight -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SOURCE_HIGHLIGHT+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $SOURCE_HIGHLIGHT in - [\\/]* | ?:[\\/]*) - ac_cv_path_SOURCE_HIGHLIGHT="$SOURCE_HIGHLIGHT" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_SOURCE_HIGHLIGHT="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -SOURCE_HIGHLIGHT=$ac_cv_path_SOURCE_HIGHLIGHT -if test -n "$SOURCE_HIGHLIGHT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SOURCE_HIGHLIGHT" >&5 -$as_echo "$SOURCE_HIGHLIGHT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$SOURCE_HIGHLIGHT" && break -done - - if test -n "$SOURCE_HIGHLIGHT"; then - HAVE_SOURCE_HIGHLIGHT_TRUE= - HAVE_SOURCE_HIGHLIGHT_FALSE='#' -else - HAVE_SOURCE_HIGHLIGHT_TRUE='#' - HAVE_SOURCE_HIGHLIGHT_FALSE= -fi - - - for ac_prog in aspell -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ASPELL+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ASPELL in - [\\/]* | ?:[\\/]*) - ac_cv_path_ASPELL="$ASPELL" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ASPELL="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ASPELL=$ac_cv_path_ASPELL -if test -n "$ASPELL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ASPELL" >&5 -$as_echo "$ASPELL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ASPELL" && break -done - - if test -n "$ASPELL"; then - HAVE_ASPELL_TRUE= - HAVE_ASPELL_FALSE='#' -else - HAVE_ASPELL_TRUE='#' - HAVE_ASPELL_FALSE= -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asciidoc version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})" >&5 -$as_echo_n "checking if asciidoc version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})... " >&6; } +for nut_doc_build_target in ${nut_doc_build_list}; do + case "${nut_doc_build_target}" in + html-single) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asciidoc version can build ${nut_doc_build_target}" >&5 +$as_echo_n "checking if asciidoc version can build ${nut_doc_build_target}... " >&6; } @@ -24924,7 +11626,7 @@ $as_echo_n "checking if asciidoc version can build manpages (minimum required ${ -e 's/[^0-9]//g'` - ax_compare_version_B=`echo "${ASCIIDOC_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + ax_compare_version_B=`echo "8.6.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ @@ -24938,20 +11640,22 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version if test "$ax_compare_version" = "true" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - nut_have_asciidoc="yes" + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - nut_have_asciidoc="no" + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" fi + ;; - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if a2x version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})" >&5 -$as_echo_n "checking if a2x version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})... " >&6; } + html-chunked) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if a2x version can build ${nut_doc_build_target}" >&5 +$as_echo_n "checking if a2x version can build ${nut_doc_build_target}... " >&6; } @@ -24971,7 +11675,7 @@ $as_echo_n "checking if a2x version can build manpages (minimum required ${ASCII -e 's/[^0-9]//g'` - ax_compare_version_B=`echo "${ASCIIDOC_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + ax_compare_version_B=`echo "8.6.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ @@ -24985,64 +11689,180 @@ x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version if test "$ax_compare_version" = "true" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - nut_have_asciidoc="no" + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" + + fi + + ;; + + pdf) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dblatex version can build ${nut_doc_build_target}" >&5 +$as_echo_n "checking if dblatex version can build ${nut_doc_build_target}... " >&6; } + + + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + + ax_compare_version_A=`echo "${DBLATEX_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version_B=`echo "0.2.5" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version=`echo "x$ax_compare_version_A +x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` + + + + if test "$ax_compare_version" = "true" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" + + fi + + ;; + esac +done + +case "${nut_with_doc}" in +auto) + if test -n "${DOC_BUILD_LIST}"; then + nut_with_doc="yes" + else + nut_with_doc="no" + fi + ;; +no) + ;; +*) + if test -z "${DOC_NOBUILD_LIST}"; then + nut_with_doc="yes" + else + as_fn_error $? "\"Unable to build ${DOC_NOBUILD_LIST} documentation\"" "$LINENO" 5 + fi + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if asciidoc version can build website (minimum required 8.6.3)" >&5 +$as_echo_n "checking if asciidoc version can build website (minimum required 8.6.3)... " >&6; } + + + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + + ax_compare_version_A=`echo "${ASCIIDOC_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version_B=`echo "8.6.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version=`echo "x$ax_compare_version_A +x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` + + + + if test "$ax_compare_version" = "true" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + nut_have_asciidoc="yes" + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + nut_have_asciidoc="no" fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if xsltproc is present (mandatory for man page regeneration)" >&5 -$as_echo_n "checking if xsltproc is present (mandatory for man page regeneration)... " >&6; } - if test -n "${XSLTPROC}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if a2x version can build website (minimum required 8.6.3)" >&5 +$as_echo_n "checking if a2x version can build website (minimum required 8.6.3)... " >&6; } + + + + # Used to indicate true or false condition + ax_compare_version=false + + # Convert the two version strings to be compared into a format that + # allows a simple string comparison. The end result is that a version + # string of the form 1.12.5-r617 will be converted to the form + # 0001001200050617. In other words, each number is zero padded to four + # digits, and non digits are removed. + + ax_compare_version_A=`echo "${A2X_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version_B=`echo "8.6.3" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ + -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ + -e 's/[^0-9]//g'` + + + ax_compare_version=`echo "x$ax_compare_version_A +x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` + + + + if test "$ax_compare_version" = "true" ; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - nut_have_asciidoc="no" - fi + nut_have_asciidoc="no" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if xmllint is present (mandatory for man page regeneration)" >&5 -$as_echo_n "checking if xmllint is present (mandatory for man page regeneration)... " >&6; } - if test -n "${XMLLINT}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - nut_have_asciidoc="no" - fi - - if test "${nut_have_asciidoc}" = "yes"; then - HAVE_ASCIIDOC_TRUE= - HAVE_ASCIIDOC_FALSE='#' -else - HAVE_ASCIIDOC_TRUE='#' - HAVE_ASCIIDOC_FALSE= -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we have all the tools mandatory for man page regeneration" >&5 -$as_echo_n "checking if we have all the tools mandatory for man page regeneration... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_have_asciidoc}" >&5 -$as_echo "${nut_have_asciidoc}" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if source-highlight is present (preferable for documentation generation)" >&5 -$as_echo_n "checking if source-highlight is present (preferable for documentation generation)... " >&6; } - if test -n "${SOURCE_HIGHLIGHT}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - -fi + fi @@ -25077,429 +11897,28 @@ _ACEOF fi -DOC_INSTALL_DISTED_MANS=no - -case "${nut_with_doc}" in - yes|all|all=yes) - nut_doc_build_list="man html-single html-chunked pdf" - ;; - auto|all=auto) - nut_doc_build_list="man=auto html-single=auto html-chunked=auto pdf=auto" - ;; - skip|all=skip) - nut_doc_build_list="man=skip html-single=skip html-chunked=skip pdf=skip" - ;; - no|all=no) - nut_doc_build_list="" - ;; - "") - nut_doc_build_list="" - { $as_echo "$as_me:${as_lineno-$LINENO}: Got explicit empty list of document formats to build; nothing will be generated" >&5 -$as_echo "$as_me: Got explicit empty list of document formats to build; nothing will be generated" >&6;} - ;; - *) - nut_doc_build_list="`echo ${nut_with_doc} | sed 's/,/ /g'`" - { $as_echo "$as_me:${as_lineno-$LINENO}: Got explicit list of document formats to build or not: ${nut_doc_build_list}; formats not listed will be silently skipped" >&5 -$as_echo "$as_me: Got explicit list of document formats to build or not: ${nut_doc_build_list}; formats not listed will be silently skipped" >&6;} - ;; -esac - -if test -z "${abs_srcdir}" ; then - case "${srcdir}" in - /*) abs_srcdir="${srcdir}";; - "") as_fn_error $? "Can not detect 'srcdir'" "$LINENO" 5 ;; - *) abs_srcdir="$(cd "${srcdir}" && pwd)" || as_fn_error $? "Can not detect 'srcdir'" "$LINENO" 5 ;; - esac + if test "${nut_have_asciidoc}" = "yes"; then + HAVE_ASCIIDOC_TRUE= + HAVE_ASCIIDOC_FALSE='#' +else + HAVE_ASCIIDOC_TRUE='#' + HAVE_ASCIIDOC_FALSE= fi -DOCTESTDIR="$(mktemp -d configure-test.docbuild.$$.XXXXXXX)" && \ -DOCTESTDIR="$(cd "$DOCTESTDIR" && pwd)" - -for nut_doc_build_target in $nut_doc_build_list; do - case "${nut_doc_build_target}" in - *=*=*) rm -rf "${DOCTESTDIR}" - as_fn_error $? "Invalid documentation format option: ${nut_doc_build_target}" "$LINENO" 5 ;; - *=*) - nut_doc_build_target_base="`echo "${nut_doc_build_target}" | sed 's,=.*$,,'`" - nut_doc_build_target_flag="`echo "${nut_doc_build_target}" | sed 's,^.*=,,'`" - ;; - *) - nut_doc_build_target_base="${nut_doc_build_target}" - nut_doc_build_target_flag="yes" - ;; - esac - case "${nut_doc_build_target_flag}" in - yes|no|auto|skip) ;; - "") nut_doc_build_target_flag="yes" ;; - *) rm -rf "${DOCTESTDIR}" - as_fn_error $? "Invalid documentation format option: ${nut_doc_build_target}" "$LINENO" 5 ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking desire and ability to build ${nut_doc_build_target_base} documentation" >&5 -$as_echo_n "checking desire and ability to build ${nut_doc_build_target_base} documentation... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_doc_build_target_flag}" >&5 -$as_echo "${nut_doc_build_target_flag}" >&6; } - - case "${nut_doc_build_target}" in - *=no|*=skip) - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - ;; - html-single*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if asciidoc version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})" >&5 -$as_echo_n "checking if asciidoc version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})... " >&6; } - can_build_doc_html_single=no - - - - # Used to indicate true or false condition - ax_compare_version=false - - # Convert the two version strings to be compared into a format that - # allows a simple string comparison. The end result is that a version - # string of the form 1.12.5-r617 will be converted to the form - # 0001001200050617. In other words, each number is zero padded to four - # digits, and non digits are removed. - - ax_compare_version_A=`echo "${ASCIIDOC_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version_B=`echo "${ASCIIDOC_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version=`echo "x$ax_compare_version_A -x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` - - - - if test "$ax_compare_version" = "true" ; then - - ( cd "$DOCTESTDIR" && ${A2X} --attribute=xhtml11_format --format=xhtml --xsl-file="${abs_srcdir}"/docs/xhtml.xsl --destination-dir=. "${abs_srcdir}"/docs/asciidoc.txt && test -s asciidoc.html ) && can_build_doc_html_single=yes - rm -f "$DOCTESTDIR"/asciidoc*.htm* - - fi - - if test "${can_build_doc_html_single}" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&2;} - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - html-chunked*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if a2x version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})" >&5 -$as_echo_n "checking if a2x version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})... " >&6; } - can_build_doc_html_chunked=no - - - - # Used to indicate true or false condition - ax_compare_version=false - - # Convert the two version strings to be compared into a format that - # allows a simple string comparison. The end result is that a version - # string of the form 1.12.5-r617 will be converted to the form - # 0001001200050617. In other words, each number is zero padded to four - # digits, and non digits are removed. - - ax_compare_version_A=`echo "${A2X_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version_B=`echo "${ASCIIDOC_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version=`echo "x$ax_compare_version_A -x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` - - - - if test "$ax_compare_version" = "true" ; then - - ( cd "$DOCTESTDIR" && ${A2X} --attribute=chunked_format --format=chunked --xsl-file="${abs_srcdir}"/docs/chunked.xsl --destination-dir=. "${abs_srcdir}"/docs/FAQ.txt && test -s FAQ.chunked/index.html ) && can_build_doc_html_chunked=yes - rm -rf "${DOCTESTDIR}"/FAQ*.chunked* - - fi - - if test "${can_build_doc_html_chunked}" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&2;} - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - pdf*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if dblatex version can build ${nut_doc_build_target_base} (minimum required ${DBLATEX_MIN_VERSION})" >&5 -$as_echo_n "checking if dblatex version can build ${nut_doc_build_target_base} (minimum required ${DBLATEX_MIN_VERSION})... " >&6; } - can_build_doc_pdf=no - - - - # Used to indicate true or false condition - ax_compare_version=false - - # Convert the two version strings to be compared into a format that - # allows a simple string comparison. The end result is that a version - # string of the form 1.12.5-r617 will be converted to the form - # 0001001200050617. In other words, each number is zero padded to four - # digits, and non digits are removed. - - ax_compare_version_A=`echo "${DBLATEX_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version_B=`echo "${DBLATEX_MIN_VERSION}" | sed -e 's/\([0-9]*\)/Z\1Z/g' \ - -e 's/Z\([0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/Z\([0-9][0-9][0-9]\)Z/Z0\1Z/g' \ - -e 's/[^0-9]//g'` - - - ax_compare_version=`echo "x$ax_compare_version_A -x$ax_compare_version_B" | sed 's/^ *//' | sort -r | sed "s/x${ax_compare_version_A}/true/;s/x${ax_compare_version_B}/false/;1q"` - - - - if test "$ax_compare_version" = "true" ; then - - ( cd "$DOCTESTDIR" && ${A2X} --format=pdf --destination-dir=. "${abs_srcdir}"/docs/asciidoc.txt && test -s asciidoc.pdf ) && can_build_doc_pdf=yes - rm -f "${DOCTESTDIR}"/asciidoc.pdf - - fi - - if test "${can_build_doc_pdf}" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&2;} - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - man*) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can build ${nut_doc_build_target_base}" >&5 -$as_echo_n "checking if we can build ${nut_doc_build_target_base}... " >&6; } - can_build_doc_man=no - if test "${nut_have_asciidoc}" = yes ; then - ( cd "$DOCTESTDIR" && ${A2X} --format manpage --destination-dir=. --xsltproc-opts="--nonet" "${abs_srcdir}"/docs/man/snmp-ups.txt && test -s snmp-ups.8 ) && can_build_doc_man=yes - rm -f "${DOCTESTDIR}"/snmp-ups.8 - fi - if test "${can_build_doc_man}" = yes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation which you requested" >&2;} - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - if test "${nut_doc_build_target_flag}" = "auto" ; then - if test -s "${abs_srcdir}"/docs/man/snmp-ups.8 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation, but can install pre-built distributed copies" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation, but can install pre-built distributed copies" >&2;} - DOC_INSTALL_DISTED_MANS="yes" - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to build ${nut_doc_build_target_base} documentation, and unable to install pre-built distributed copies because they are absent" >&5 -$as_echo "$as_me: WARNING: Unable to build ${nut_doc_build_target_base} documentation, and unable to install pre-built distributed copies because they are absent" >&2;} - fi - fi # Other variants include "no", "skip"... - fi - fi - ;; - - *) rm -rf "${DOCTESTDIR}" - as_fn_error $? "--with-doc option refers to unknown documentation format: $nut_doc_build_target" "$LINENO" 5 ;; - - esac -done -rm -rf "${DOCTESTDIR}" - -case "${nut_with_doc}" in -auto) - if test -n "${DOC_BUILD_LIST}"; then - nut_with_doc="yes" - else - nut_with_doc="no" - fi - ;; -no) - ;; -*) - if test -n "${DOC_CANNOTBUILD_LIST}"; then - as_fn_error $? "Unable to build${DOC_CANNOTBUILD_LIST} documentation (check for 'no' results above)" "$LINENO" 5 - fi - - if test -n "${DOC_SKIPBUILD_LIST}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: Skipping build of${DOC_SKIPBUILD_LIST} documentation (check for 'skip' results above)" >&5 -$as_echo "$as_me: Skipping build of${DOC_SKIPBUILD_LIST} documentation (check for 'skip' results above)" >&6;} - fi - - if test -n "${DOC_BUILD_LIST}"; then - nut_with_doc="yes" - else - nut_with_doc="no" - fi - ;; -esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build specific documentation format(s)" >&5 -$as_echo_n "checking whether to build specific documentation format(s)... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_doc} ${DOC_BUILD_LIST}" >&5 -$as_echo "${nut_with_doc} ${DOC_BUILD_LIST}" >&6; } - if test -z "${nut_report_feature_flag}"; then +if test "${nut_with_doc}" = "yes"; then + if test -z "${nut_report_feature_flag}"; then nut_report_feature_flag="1" ac_clean_files="${ac_clean_files} conf_nut_report_feature" echo > conf_nut_report_feature echo "Configuration summary:" >> conf_nut_report_feature echo "======================" >> conf_nut_report_feature fi - echo "build specific documentation format(s): ${nut_with_doc} ${DOC_BUILD_LIST}" >> conf_nut_report_feature + echo "only build specific documentation format: ${DOC_BUILD_LIST}" >> conf_nut_report_feature - - if test "${nut_with_doc}" = "yes"; then - WITH_DOCS_TRUE= - WITH_DOCS_FALSE='#' -else - WITH_DOCS_TRUE='#' - WITH_DOCS_FALSE= -fi - - if test "${nut_with_doc}" = "yes"; then - -cat >>confdefs.h <<_ACEOF -#define WITH_DOCS 1 -_ACEOF - - fi - - -# To cater for less portable make's, precalculate the target list -# for "make check" in "docs/" here... -DOC_CHECK_LIST="" -if test "${nut_with_doc}" = yes ; then - for V in $DOC_BUILD_LIST ; do - DOC_CHECK_LIST="$DOC_CHECK_LIST check-$V" - done -fi - -WITH_MANS=no -SKIP_MANS=no -if echo "${DOC_BUILD_LIST}" | grep -w "man" >/dev/null || test "${DOC_INSTALL_DISTED_MANS}" = "yes" ; then - WITH_MANS=yes -fi -if echo "${DOC_SKIPBUILD_LIST}" | grep -w "man" >/dev/null ; then - SKIP_MANS=yes -fi - if test "${WITH_MANS}" = "yes"; then - WITH_MANS_TRUE= - WITH_MANS_FALSE='#' -else - WITH_MANS_TRUE='#' - WITH_MANS_FALSE= -fi - - if test "${SKIP_MANS}" = "yes"; then - SKIP_MANS_TRUE= - SKIP_MANS_FALSE='#' -else - SKIP_MANS_TRUE='#' - SKIP_MANS_FALSE= -fi - - if test "${DOC_INSTALL_DISTED_MANS}" = "yes"; then - DOC_INSTALL_DISTED_MANS_TRUE= - DOC_INSTALL_DISTED_MANS_FALSE='#' -else - DOC_INSTALL_DISTED_MANS_TRUE='#' - DOC_INSTALL_DISTED_MANS_FALSE= fi - -if ( test "${GCC}" = "yes" ) -then - - CFLAGS_SAVED_NOPEDANTIC="$CFLAGS" - case "${CFLAGS}" in #( - *"-pedantic"*) : - CFLAGS="${CFLAGS} -Wno-pedantic" ;; #( - *) : - ;; -esac - case "${CFLAGS}" in #( - *"-Werror"*) : - CFLAGS="${CFLAGS} -Wno-error" ;; #( - *) : - ;; -esac - case "${CFLAGS}" in #( - *"-flto"*) : - CFLAGS="${CFLAGS} -ffat-lto-objects" ;; #( - *) : - ;; -esac -fi - - -SAVED_GCC="$GCC" -SAVED_CC="$CC" -if ( test "${GCC}" = "yes" ) -then - case "$CFLAGS$LDFLAGS" in - *-m32*) CC="$CC -m32" ;; - *-m64*) CC="$CC -m64" ;; - esac -fi case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 @@ -25508,8 +11927,8 @@ esac -macro_version='2.4.6' -macro_revision='2.4.6' +macro_version='2.4.2' +macro_revision='1.3337' @@ -25523,7 +11942,7 @@ macro_revision='2.4.6' -ltmain=$ac_aux_dir/ltmain.sh +ltmain="$ac_aux_dir/ltmain.sh" # Backslashify metacharacters that are still active within # double-quoted strings. @@ -25572,7 +11991,7 @@ func_echo_all () $ECHO "" } -case $ECHO in +case "$ECHO" in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 @@ -25765,19 +12184,19 @@ test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld -if test yes = "$GCC"; then +if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw + # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; @@ -25791,7 +12210,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; } while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done - test -z "$LD" && LD=$ac_prog + test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. @@ -25802,7 +12221,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; } with_gnu_ld=unknown ;; esac -elif test yes = "$with_gnu_ld"; then +elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else @@ -25813,32 +12232,32 @@ if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog + lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } @@ -25881,38 +12300,33 @@ if ${lt_cv_path_NM+:} false; then : else if test -n "$NM"; then # Let the user override the test. - lt_cv_path_NM=$NM + lt_cv_path_NM="$NM" else - lt_nm_to_check=${ac_tool_prefix}nm + lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" - break 2 + break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" - break 2 + break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but @@ -25923,15 +12337,15 @@ else esac fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : @@ -26037,9 +12451,9 @@ esac fi fi - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" + DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: @@ -26047,8 +12461,8 @@ fi esac fi - if test : != "$DUMPBIN"; then - NM=$DUMPBIN + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm @@ -26081,6 +12495,17 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } @@ -26088,7 +12513,7 @@ if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 - teststring=ABCD + teststring="ABCD" case $build_os in msdosdjgpp*) @@ -26128,7 +12553,7 @@ else lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -26179,22 +12604,22 @@ else *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do + for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough + test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring @@ -26212,7 +12637,7 @@ else fi -if test -n "$lt_cv_sys_max_cmd_len"; then +if test -n $lt_cv_sys_max_cmd_len ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else @@ -26230,6 +12655,30 @@ max_cmd_len=$lt_cv_sys_max_cmd_len : ${MV="mv -f"} : ${RM="rm -f"} +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else @@ -26352,13 +12801,13 @@ esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) - if test yes != "$GCC"; then + if test "$GCC" != yes; then reload_cmds=false fi ;; darwin*) - if test yes = "$GCC"; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi @@ -26486,13 +12935,13 @@ lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. +# `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) @@ -26519,7 +12968,8 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -26615,8 +13065,8 @@ newos6*) lt_cv_deplibs_check_method=pass_all ;; -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' @@ -26669,9 +13119,6 @@ sysv4 | sysv4.3*) tpf*) lt_cv_deplibs_check_method=pass_all ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; esac fi @@ -26829,8 +13276,8 @@ else case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib @@ -26842,7 +13289,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO + lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac @@ -26959,7 +13406,7 @@ esac fi : ${AR=ar} -: ${AR_FLAGS=cr} +: ${AR_FLAGS=cru} @@ -26996,7 +13443,7 @@ if ac_fn_c_try_compile "$LINENO"; then : ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - if test 0 -eq "$ac_status"; then + if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 @@ -27004,7 +13451,7 @@ if ac_fn_c_try_compile "$LINENO"; then : ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } - if test 0 -ne "$ac_status"; then + if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi @@ -27017,7 +13464,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } -if test no = "$lt_cv_ar_at_file"; then +if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file @@ -27234,7 +13681,7 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in - bitrig* | openbsd*) + openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) @@ -27324,7 +13771,7 @@ cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; @@ -27357,44 +13804,14 @@ case `$NM -V 2>&1` in symcode='[ABCDGIRSTW]' ;; esac -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -27412,24 +13829,21 @@ for ac_symprfx in "" "_"; do # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" @@ -27460,8 +13874,11 @@ _LT_EOF test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm - $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&5 - if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&5 && test -s "$nlist"; then + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -27474,11 +13891,11 @@ _LT_EOF if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST -#elif defined __osf__ +#elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else @@ -27504,7 +13921,7 @@ lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; @@ -27524,13 +13941,13 @@ _LT_EOF mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext + LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest$ac_exeext; then + test $ac_status = 0; } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS @@ -27551,7 +13968,7 @@ _LT_EOF rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then + if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= @@ -27593,16 +14010,6 @@ fi - - - - - - - - - - @@ -27626,9 +14033,9 @@ fi lt_sysroot= -case $with_sysroot in #( +case ${with_sysroot} in #( yes) - if test yes = "$GCC"; then + if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( @@ -27638,8 +14045,8 @@ case $with_sysroot in #( no|'') ;; #( *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 -$as_echo "$with_sysroot" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac @@ -27651,99 +14058,18 @@ $as_echo "${lt_sysroot:-no}" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 -$as_echo_n "checking for a working dd... " >&6; } -if ${ac_cv_path_lt_DD+:} false; then : - $as_echo_n "(cached) " >&6 -else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -if test -z "$lt_DD"; then - ac_path_lt_DD_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in dd; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_lt_DD" || continue -if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi - $ac_path_lt_DD_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_lt_DD"; then - : - fi -else - ac_cv_path_lt_DD=$lt_DD -fi - -rm -f conftest.i conftest2.i conftest.out -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 -$as_echo "$ac_cv_path_lt_DD" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 -$as_echo_n "checking how to truncate binary pipes... " >&6; } -if ${lt_cv_truncate_bin+:} false; then : - $as_echo_n "(cached) " >&6 -else - printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" -fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 -$as_echo "$lt_cv_truncate_bin" >&6; } - - - - - - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi -test no = "$enable_libtool_lock" || enable_libtool_lock=yes +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -27752,25 +14078,24 @@ ia64-*-hpux*) test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) - HPUX_IA64_MODE=32 + HPUX_IA64_MODE="32" ;; *ELF-64*) - HPUX_IA64_MODE=64 + HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. + # Find out which ABI we are using. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - if test yes = "$lt_cv_prog_gnu_ld"; then + if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" @@ -27799,50 +14124,9 @@ ia64-*-hpux*) rm -rf conftest* ;; -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - emul=elf - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -27865,10 +14149,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ;; esac ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) + ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -27887,10 +14168,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) + ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -27908,7 +14186,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS + SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } @@ -27948,14 +14226,13 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } - if test yes != "$lt_cv_cc_needs_belf"; then + if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS + CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 @@ -27967,7 +14244,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } case $lt_cv_prog_gnu_ld in yes*) case $host in - i?86-*-solaris*|x86_64-*-solaris*) + i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) @@ -27976,7 +14253,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 + LD="${LD-ld}_sol2" fi ;; *) @@ -27992,7 +14269,7 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } ;; esac -need_locks=$enable_libtool_lock +need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. @@ -28103,7 +14380,7 @@ else fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test yes != "$lt_cv_path_mainfest_tool"; then +if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi @@ -28606,7 +14883,7 @@ if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then + if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the @@ -28624,7 +14901,7 @@ else cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 @@ -28663,7 +14940,7 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 @@ -28680,8 +14957,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cr libconftest.a conftest.o" >&5 - $AR cr libconftest.a conftest.o 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF @@ -28692,7 +14969,7 @@ _LT_EOF _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&5 @@ -28705,32 +14982,32 @@ fi $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[912]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[012][,.]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*|11.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac - if test yes = "$lt_cv_apple_cc_single_mod"; then + if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -28738,41 +15015,6 @@ $as_echo "$lt_cv_ld_force_load" >&6; } ;; esac -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default @@ -28788,11 +15030,12 @@ done + func_stripname_cnf () { - case $2 in - .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; - *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf @@ -28819,14 +15062,14 @@ if test "${enable_shared+set}" = set; then : *) enable_shared=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac else @@ -28850,14 +15093,14 @@ if test "${enable_static+set}" = set; then : *) enable_static=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac else @@ -28881,14 +15124,14 @@ if test "${with_pic+set}" = set; then : *) pic_mode=default # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac else @@ -28896,6 +15139,8 @@ else fi +test -z "$pic_mode" && pic_mode=default + @@ -28911,14 +15156,14 @@ if test "${enable_fast_install+set}" = set; then : *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac else @@ -28932,63 +15177,11 @@ fi - shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[5-9]*,yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 -$as_echo_n "checking which variant of shared library versioning to provide... " >&6; } - -# Check whether --with-aix-soname was given. -if test "${with_aix_soname+set}" = set; then : - withval=$with_aix_soname; case $withval in - aix|svr4|both) - ;; - *) - as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname -else - if ${lt_cv_with_aix_soname+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_with_aix_soname=aix -fi - - with_aix_soname=$lt_cv_with_aix_soname -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 -$as_echo "$with_aix_soname" >&6; } - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr - fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - - - - - - - # This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain +LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' @@ -29037,7 +15230,7 @@ test -z "$LN_S" && LN_S="ln -s" -if test -n "${ZSH_VERSION+set}"; then +if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi @@ -29076,7 +15269,7 @@ aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then + if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -29087,14 +15280,14 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a -with_gnu_ld=$lt_cv_prog_gnu_ld +with_gnu_ld="$lt_cv_prog_gnu_ld" -old_CC=$CC -old_CFLAGS=$CFLAGS +old_CC="$CC" +old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc @@ -29103,8 +15296,15 @@ test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o -func_cc_basename $compiler -cc_basename=$func_cc_basename_result +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it @@ -29119,22 +15319,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then : else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/${ac_tool_prefix}file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -29157,13 +15357,13 @@ _LT_EOF break fi done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi -MAGIC_CMD=$lt_cv_path_MAGIC_CMD +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } @@ -29185,22 +15385,22 @@ if ${lt_cv_path_MAGIC_CMD+:} false; then : else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/file"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -29223,13 +15423,13 @@ _LT_EOF break fi done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac fi -MAGIC_CMD=$lt_cv_path_MAGIC_CMD +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } @@ -29250,7 +15450,7 @@ esac # Use C for the default configuration in the libtool script -lt_save_CC=$CC +lt_save_CC="$CC" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -29312,7 +15512,7 @@ if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= -if test yes = "$GCC"; then +if test "$GCC" = yes; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; @@ -29328,7 +15528,7 @@ else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + lt_compiler_flag="-fno-rtti -fno-exceptions" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -29358,7 +15558,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } -if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : @@ -29376,18 +15576,17 @@ lt_prog_compiler_pic= lt_prog_compiler_static= - if test yes = "$GCC"; then + if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi - lt_prog_compiler_pic='-fPIC' ;; amigaos*) @@ -29398,8 +15597,8 @@ lt_prog_compiler_static= ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -29415,11 +15614,6 @@ lt_prog_compiler_static= # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac ;; darwin* | rhapsody*) @@ -29490,7 +15684,7 @@ lt_prog_compiler_static= case $host_os in aix*) lt_prog_compiler_wl='-Wl,' - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else @@ -29498,29 +15692,10 @@ lt_prog_compiler_static= fi ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - esac - ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static='$wl-static' - ;; - esac ;; hpux9* | hpux10* | hpux11*) @@ -29536,7 +15711,7 @@ lt_prog_compiler_static= ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='$wl-a ${wl}archive' + lt_prog_compiler_static='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) @@ -29547,18 +15722,12 @@ lt_prog_compiler_static= linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. + # old Intel for x86_64 which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; - # flang / f18. f95 an alias for gfortran or flang on Debian - flang* | f18* | f95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -29578,12 +15747,6 @@ lt_prog_compiler_static= lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -29681,7 +15844,7 @@ lt_prog_compiler_static= ;; sysv4*MP*) - if test -d /usr/nec; then + if test -d /usr/nec ;then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi @@ -29710,7 +15873,7 @@ lt_prog_compiler_static= fi case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: + # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; @@ -29742,7 +15905,7 @@ else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -29772,7 +15935,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } -if test yes = "$lt_cv_prog_compiler_pic_works"; then +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; @@ -29804,7 +15967,7 @@ if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -29823,13 +15986,13 @@ else fi fi $RM -r conftest* - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } -if test yes = "$lt_cv_prog_compiler_static_works"; then +if test x"$lt_cv_prog_compiler_static_works" = xyes; then : else lt_prog_compiler_static= @@ -29949,8 +16112,8 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } @@ -29962,9 +16125,9 @@ $as_echo_n "checking if we can lock with hard links... " >&6; } ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } - if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -30007,9 +16170,9 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if @@ -30024,7 +16187,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. - if test yes != "$GCC"; then + if test "$GCC" != yes; then with_gnu_ld=no fi ;; @@ -30032,7 +16195,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; - openbsd* | bitrig*) + openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) @@ -30045,7 +16208,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility @@ -30067,24 +16230,24 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie esac fi - if test yes = "$lt_use_gnu_ld_interface"; then + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' + wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - export_dynamic_flag_spec='$wl--export-dynamic' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -30097,7 +16260,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then + if test "$host_cpu" != ia64; then ld_shlibs=no cat <<_LT_EOF 1>&2 @@ -30116,7 +16279,7 @@ _LT_EOF case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) @@ -30132,7 +16295,7 @@ _LT_EOF allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs=no fi @@ -30142,7 +16305,7 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='$wl--export-all-symbols' + export_dynamic_flag_spec='${wl}--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes @@ -30150,89 +16313,61 @@ _LT_EOF exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs=yes ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes - ;; - interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no - if test linux-dietlibc = "$host_os"; then + if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" + && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -30243,47 +16378,42 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then + if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in - tcc*) - export_dynamic_flag_spec='-rdynamic' - ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then + if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -30297,8 +16427,8 @@ _LT_EOF archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -30316,8 +16446,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -30329,7 +16459,7 @@ _LT_EOF ld_shlibs=no cat <<_LT_EOF 1>&2 -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify @@ -30344,9 +16474,9 @@ _LT_EOF # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi @@ -30363,15 +16493,15 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac - if test no = "$ld_shlibs"; then + if test "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= @@ -30387,7 +16517,7 @@ _LT_EOF # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported @@ -30395,57 +16525,34 @@ _LT_EOF ;; aix[4-9]*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag= + no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive + # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi ;; esac @@ -30464,21 +16571,13 @@ _LT_EOF hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes - file_list_spec='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct=no - hardcode_direct_absolute=no - ;; - esac + file_list_spec='${wl}-f,' - if test yes = "$GCC"; then + if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` + collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -30497,42 +16596,36 @@ _LT_EOF ;; esac shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' + link_all_deplibs=no else # not using gcc - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' else - shared_flag='$wl-bM:SRE' + shared_flag='${wl}-bM:SRE' fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' fi fi - export_dynamic_flag_spec='$wl-bexpall' + export_dynamic_flag_spec='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then + if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : @@ -30567,7 +16660,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib + lt_cv_aix_libpath_="/usr/lib:/lib" fi fi @@ -30575,17 +16668,17 @@ fi aix_libpath=$lt_cv_aix_libpath_ fi - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then + if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : @@ -30620,7 +16713,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=/usr/lib:/lib + lt_cv_aix_libpath_="/usr/lib:/lib" fi fi @@ -30628,33 +16721,21 @@ fi aix_libpath=$lt_cv_aix_libpath_ fi - hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - no_undefined_flag=' $wl-bernotok' - allow_undefined_flag=' $wl-berok' - if test yes = "$with_gnu_ld"; then + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes - archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -30663,7 +16744,7 @@ fi case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) @@ -30693,17 +16774,16 @@ fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes @@ -30712,18 +16792,18 @@ fi # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # Assume MSVC wrapper @@ -30732,7 +16812,7 @@ fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -30751,24 +16831,24 @@ fi hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes - allow_undefined_flag=$_lt_dar_allow_undefined + allow_undefined_flag="$_lt_dar_allow_undefined" case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; + ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac - if test yes = "$_lt_dar_can_shared"; then + if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" else ld_shlibs=no @@ -30810,33 +16890,33 @@ fi ;; hpux9*) - if test yes = "$GCC"; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi - hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes - export_dynamic_flag_spec='$wl-E' + export_dynamic_flag_spec='${wl}-E' ;; hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' + export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes @@ -30844,25 +16924,25 @@ fi ;; hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) - archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) - archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) @@ -30874,7 +16954,7 @@ if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -30893,14 +16973,14 @@ else fi fi $RM -r conftest* - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } -if test yes = "$lt_cv_prog_compiler__b"; then - archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi @@ -30908,8 +16988,8 @@ fi ;; esac fi - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec='$wl+b $wl$libdir' + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: case $host_cpu in @@ -30920,7 +17000,7 @@ fi *) hardcode_direct=yes hardcode_direct_absolute=yes - export_dynamic_flag_spec='$wl-E' + export_dynamic_flag_spec='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. @@ -30931,8 +17011,8 @@ fi ;; irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. @@ -30942,8 +17022,8 @@ $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " > if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else - save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } @@ -30955,35 +17035,24 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test yes = "$lt_cv_irix_exported_symbol"; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi - link_all_deplibs=no else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - ld_shlibs=yes - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out @@ -30998,7 +17067,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; @@ -31006,19 +17075,27 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } *nto* | *qnx*) ;; - openbsd* | bitrig*) + openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' - export_dynamic_flag_spec='$wl-E' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' else - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='$wl-rpath,$libdir' + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac fi else ld_shlibs=no @@ -31029,53 +17106,33 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported - shrext_cmds=.dll - archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes=yes + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - allow_undefined_flag=' $wl-expect_unresolved $wl\*' - archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' else allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' @@ -31086,24 +17143,24 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } solaris*) no_undefined_flag=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' - archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) - wlarc='$wl' - archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi @@ -31113,11 +17170,11 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', + # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi @@ -31127,10 +17184,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } ;; sunos4*) - if test sequent = "$host_vendor"; then + if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. - archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi @@ -31179,43 +17236,43 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='$wl-z,text' + no_undefined_flag='${wl}-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not + # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - no_undefined_flag='$wl-z,text' - allow_undefined_flag='$wl-z,nodefs' + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_flag_spec='${wl}-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes - export_dynamic_flag_spec='$wl-Bexport' + export_dynamic_flag_spec='${wl}-Bexport' runpath_var='LD_RUN_PATH' - if test yes = "$GCC"; then - archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; @@ -31230,10 +17287,10 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } ;; esac - if test sni = "$host_vendor"; then + if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='$wl-Blargedynsym' + export_dynamic_flag_spec='${wl}-Blargedynsym' ;; esac fi @@ -31241,7 +17298,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } -test no = "$ld_shlibs" && can_build_shared=no +test "$ld_shlibs" = no && can_build_shared=no with_gnu_ld=$with_gnu_ld @@ -31267,7 +17324,7 @@ x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes - if test yes,yes = "$GCC,$enable_shared"; then + if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. @@ -31482,14 +17539,14 @@ esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } -if test yes = "$GCC"; then +if test "$GCC" = yes; then case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in @@ -31505,35 +17562,28 @@ if test yes = "$GCC"; then ;; esac # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... + # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; + lt_foo="/" $lt_i lt_foo; } else { lt_count--; } @@ -31547,7 +17597,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + $SED 's,/\([A-Za-z]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else @@ -31556,7 +17606,7 @@ fi library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=.so +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -31573,16 +17623,14 @@ hardcode_into_libs=no # flags to be left without arguments need_version=unknown - - case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' + soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) @@ -31590,91 +17638,41 @@ aix[4-9]*) need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' + if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi shlibpath_var=LIBPATH fi ;; @@ -31684,18 +17682,18 @@ amigaos*) powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) - library_names_spec='$libname$shared_ext' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -31703,8 +17701,8 @@ beos*) bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" @@ -31716,7 +17714,7 @@ bsdi[45]*) cygwin* | mingw* | pw32* | cegcc*) version_type=windows - shrext_cmds=.dll + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -31725,8 +17723,8 @@ cygwin* | mingw* | pw32* | cegcc*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ @@ -31742,17 +17740,17 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' @@ -31761,8 +17759,8 @@ cygwin* | mingw* | pw32* | cegcc*) *,cl*) # Native MSVC libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' case $build_os in mingw*) @@ -31789,7 +17787,7 @@ cygwin* | mingw* | pw32* | cegcc*) sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) - sys_lib_search_path_spec=$LIB + sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` @@ -31802,8 +17800,8 @@ cygwin* | mingw* | pw32* | cegcc*) esac # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' @@ -31816,7 +17814,7 @@ cygwin* | mingw* | pw32* | cegcc*) *) # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac @@ -31829,8 +17827,8 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' @@ -31843,8 +17841,8 @@ dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -31862,13 +17860,12 @@ freebsd* | dragonfly*) version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -31898,10 +17895,10 @@ haiku*) need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no + shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -31919,15 +17916,14 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -31935,8 +17931,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; @@ -31945,8 +17941,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... @@ -31959,8 +17955,8 @@ interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -31971,7 +17967,7 @@ irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) - if test yes = "$lt_cv_prog_gnu_ld"; then + if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix @@ -31979,8 +17975,8 @@ irix5* | irix6* | nonstopux*) esac need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= @@ -31999,8 +17995,8 @@ irix5* | irix6* | nonstopux*) esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; @@ -32009,33 +18005,13 @@ linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec='-L$libdir' - ;; - # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -32079,12 +18055,7 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -32116,12 +18087,12 @@ netbsd*) need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -32131,7 +18102,7 @@ netbsd*) newsos6) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -32140,68 +18111,58 @@ newsos6) version_type=qnx need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; -openbsd* | bitrig*) +openbsd*) version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi ;; os2*) libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no + shrext_cmds=".dll" need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' + shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) @@ -32212,8 +18173,8 @@ solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -32223,11 +18184,11 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes @@ -32235,8 +18196,8 @@ sunos4*) sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -32257,24 +18218,24 @@ sysv4 | sysv4.3*) ;; sysv4*MP*) - if test -d /usr/nec; then + if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco + version_type=freebsd-elf need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' @@ -32292,7 +18253,7 @@ tpf*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes @@ -32300,8 +18261,8 @@ tpf*) uts4*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -32311,35 +18272,20 @@ uts4*) esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no +test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then +if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - - - - - - @@ -32436,15 +18382,15 @@ $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || - test yes = "$hardcode_automatic"; then + test "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. - if test no != "$hardcode_direct" && + if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && - test no != "$hardcode_minus_L"; then + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else @@ -32459,12 +18405,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } -if test relink = "$hardcode_action" || - test yes = "$inherit_rpath"; then +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi @@ -32474,7 +18420,7 @@ fi - if test yes != "$enable_dlopen"; then + if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown @@ -32484,23 +18430,23 @@ else case $host_os in beos*) - lt_cv_dlopen=load_add_on + lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary + lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) - lt_cv_dlopen=dlopen + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) - # if libdl is installed we need to link against it + # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : @@ -32538,10 +18484,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else - lt_cv_dlopen=dyld + lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes @@ -32549,18 +18495,10 @@ fi ;; - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen=shl_load + lt_cv_dlopen="shl_load" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } @@ -32599,11 +18537,11 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen=dlopen + lt_cv_dlopen="dlopen" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } @@ -32642,7 +18580,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } @@ -32681,7 +18619,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } @@ -32720,7 +18658,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -32741,21 +18679,21 @@ fi ;; esac - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else + if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes + else + enable_dlopen=no fi case $lt_cv_dlopen in dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS=$LIBS + save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 @@ -32763,7 +18701,7 @@ $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else - if test yes = "$cross_compiling"; then : + if test "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -32810,9 +18748,9 @@ else # endif #endif -/* When -fvisibility=hidden is used, assume the code has been annotated +/* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -32842,7 +18780,7 @@ _LT_EOF (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -32862,14 +18800,14 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } - if test yes = "$lt_cv_dlopen_self"; then + if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else - if test yes = "$cross_compiling"; then : + if test "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -32916,9 +18854,9 @@ else # endif #endif -/* When -fvisibility=hidden is used, assume the code has been annotated +/* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -32948,7 +18886,7 @@ _LT_EOF (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -32969,9 +18907,9 @@ fi $as_echo "$lt_cv_dlopen_self_static" >&6; } fi - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" ;; esac @@ -33015,7 +18953,7 @@ else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) - if test -n "$STRIP"; then + if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 @@ -33043,7 +18981,7 @@ fi - # Report what library types will actually be built + # Report which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 @@ -33051,13 +18989,13 @@ $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } - test no = "$can_build_shared" && enable_shared=no + test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test yes = "$enable_shared" && enable_static=no + test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' @@ -33065,12 +19003,8 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } ;; aix[4-9]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no fi ;; esac @@ -33080,7 +19014,7 @@ $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes + test "$enable_shared" = yes || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } @@ -33094,11 +19028,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -CC=$lt_save_CC +CC="$lt_save_CC" - if test -n "$CXX" && ( test no != "$CXX" && - ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || - (test g++ != "$CXX"))); then + if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -33277,7 +19211,7 @@ objext_CXX=$objext # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_caught_CXX_error"; then +if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" @@ -33338,39 +19272,46 @@ $RM -r conftest* CFLAGS=$CXXFLAGS compiler=$CC compiler_CXX=$CC - func_cc_basename $compiler -cc_basename=$func_cc_basename_result + for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately - if test yes = "$GXX"; then + if test "$GXX" = yes; then lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' else lt_prog_compiler_no_builtin_flag_CXX= fi - if test yes = "$GXX"; then + if test "$GXX" = yes; then # Set up default GNU C++ configuration # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld -if test yes = "$GCC"; then +if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw + # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; @@ -33384,7 +19325,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; } while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done - test -z "$LD" && LD=$ac_prog + test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. @@ -33395,7 +19336,7 @@ $as_echo_n "checking for ld used by $CC... " >&6; } with_gnu_ld=unknown ;; esac -elif test yes = "$with_gnu_ld"; then +elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else @@ -33406,32 +19347,32 @@ if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog + lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } @@ -33467,22 +19408,22 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. - if test yes = "$with_gnu_ld"; then - archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + if test "$with_gnu_ld" = yes; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) - wlarc='$wl' + wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec_CXX= fi @@ -33501,7 +19442,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -33519,30 +19460,18 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ld_shlibs_CXX=no ;; aix[4-9]*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag= + no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive + # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do case $ld_flag in @@ -33552,13 +19481,6 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie ;; esac done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi ;; esac @@ -33577,21 +19499,13 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie hardcode_direct_absolute_CXX=yes hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes - file_list_spec_CXX='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - hardcode_direct_CXX=no - hardcode_direct_absolute_CXX=no - ;; - esac + file_list_spec_CXX='${wl}-f,' - if test yes = "$GXX"; then + if test "$GXX" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` + collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -33609,44 +19523,36 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie fi esac shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag=$shared_flag' $wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' else # not using gcc - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' else - shared_flag='$wl-bM:SRE' + shared_flag='${wl}-bM:SRE' fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' fi fi - export_dynamic_flag_spec_CXX='$wl-bexpall' + export_dynamic_flag_spec_CXX='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. always_export_symbols_CXX=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. - # The "-G" linker flag allows undefined symbols. - no_undefined_flag_CXX='-bernotok' + allow_undefined_flag_CXX='-berok' # Determine the default libpath from the value encoded in an empty # executable. - if test set = "${lt_cv_aix_libpath+set}"; then + if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : @@ -33681,7 +19587,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=/usr/lib:/lib + lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi @@ -33689,18 +19595,18 @@ fi aix_libpath=$lt_cv_aix_libpath__CXX fi - hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else - if test ia64 = "$host_cpu"; then - hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. - if test set = "${lt_cv_aix_libpath+set}"; then + if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath__CXX+:} false; then : @@ -33735,7 +19641,7 @@ fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=/usr/lib:/lib + lt_cv_aix_libpath__CXX="/usr/lib:/lib" fi fi @@ -33743,34 +19649,22 @@ fi aix_libpath=$lt_cv_aix_libpath__CXX fi - hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' $wl-bernotok' - allow_undefined_flag_CXX=' $wl-berok' - if test yes = "$with_gnu_ld"; then + no_undefined_flag_CXX=' ${wl}-bernotok' + allow_undefined_flag_CXX=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec_CXX='$convenience' fi archive_cmds_need_lc_CXX=yes - archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared - # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + # This is similar to how AIX traditionally builds its shared + # libraries. + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -33780,7 +19674,7 @@ fi allow_undefined_flag_CXX=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else ld_shlibs_CXX=no fi @@ -33808,58 +19702,57 @@ fi # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' enable_shared_with_static_runtimes_CXX=yes # Don't use ranlib old_postinstall_cmds_CXX='chmod 644 $oldlib' postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' allow_undefined_flag_CXX=unsupported always_export_symbols_CXX=no enable_shared_with_static_runtimes_CXX=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs_CXX=no fi @@ -33873,27 +19766,27 @@ fi hardcode_direct_CXX=no hardcode_automatic_CXX=yes hardcode_shlibpath_var_CXX=unsupported - if test yes = "$lt_cv_ld_force_load"; then - whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec_CXX='' fi link_all_deplibs_CXX=yes - allow_undefined_flag_CXX=$_lt_dar_allow_undefined + allow_undefined_flag_CXX="$_lt_dar_allow_undefined" case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; + ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac - if test yes = "$_lt_dar_can_shared"; then + if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" - if test yes != "$lt_cv_apple_cc_single_mod"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + if test "$lt_cv_apple_cc_single_mod" != "yes"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi else @@ -33902,34 +19795,6 @@ fi ;; - os2*) - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_minus_L_CXX=yes - allow_undefined_flag_CXX=unsupported - shrext_cmds=.dll - archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - enable_shared_with_static_runtimes_CXX=yes - ;; - dgux*) case $cc_basename in ec++*) @@ -33965,14 +19830,14 @@ fi ;; haiku*) - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' link_all_deplibs_CXX=yes ;; hpux9*) - hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='$wl-E' + export_dynamic_flag_spec_CXX='${wl}-E' hardcode_direct_CXX=yes hardcode_minus_L_CXX=yes # Not in the search PATH, # but as the default @@ -33984,7 +19849,7 @@ fi ld_shlibs_CXX=no ;; aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -33993,11 +19858,11 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes = "$GXX"; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + if test "$GXX" = yes; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support ld_shlibs_CXX=no @@ -34007,15 +19872,15 @@ fi ;; hpux10*|hpux11*) - if test no = "$with_gnu_ld"; then - hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + if test $with_gnu_ld = no; then + hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' hardcode_libdir_separator_CXX=: case $host_cpu in hppa*64*|ia64*) ;; *) - export_dynamic_flag_spec_CXX='$wl-E' + export_dynamic_flag_spec_CXX='${wl}-E' ;; esac fi @@ -34041,13 +19906,13 @@ fi aCC*) case $host_cpu in hppa*64*) - archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists @@ -34058,20 +19923,20 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -34086,22 +19951,22 @@ fi interix[3-9]*) hardcode_direct_CXX=no hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl-E' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -34110,17 +19975,17 @@ fi old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi link_all_deplibs_CXX=yes ;; esac - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: inherit_rpath_CXX=yes ;; @@ -34133,8 +19998,8 @@ fi # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -34143,10 +20008,10 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. @@ -34160,59 +20025,59 @@ fi # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [1-5].* | *pgcpp\ [1-5].*) prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac - hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec_CXX='-rpath $libdir' @@ -34226,18 +20091,18 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' - export_dynamic_flag_spec_CXX='$wl--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec_CXX='${wl}--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) @@ -34245,10 +20110,10 @@ fi *Sun\ C*) # Sun C++ 5.9 no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' compiler_needs_object_CXX=yes # Not sure whether something based on @@ -34306,17 +20171,22 @@ fi ld_shlibs_CXX=yes ;; - openbsd* | bitrig*) + openbsd2*) + # C++ shared libraries are fairly broken + ld_shlibs_CXX=no + ;; + + openbsd*) if test -f /usr/libexec/ld.so; then hardcode_direct_CXX=yes hardcode_shlibpath_var_CXX=no hardcode_direct_absolute_CXX=yes archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='$wl-E' - whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='${wl}-E' + whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else @@ -34332,9 +20202,9 @@ fi # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' hardcode_libdir_separator_CXX=: # Archives containing C++ object files must be created using @@ -34352,17 +20222,17 @@ fi cxx*) case $host in osf3*) - allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' - archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' ;; *) allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ - $RM $lib.exp' + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' hardcode_libdir_flag_spec_CXX='-rpath $libdir' ;; esac @@ -34377,27 +20247,27 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes,no = "$GXX,$with_gnu_ld"; then - allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac - hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' hardcode_libdir_separator_CXX=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -34437,9 +20307,9 @@ fi # Sun C++ 4.2, 5.x and Centerline C++ archive_cmds_need_lc_CXX=yes no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' hardcode_libdir_flag_spec_CXX='-R$libdir' hardcode_shlibpath_var_CXX=no @@ -34447,7 +20317,7 @@ fi solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' ;; @@ -34464,42 +20334,42 @@ fi ;; gcx*) # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker - if test yes,no = "$GXX,$with_gnu_ld"; then - no_undefined_flag_CXX=' $wl-z ${wl}defs' + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + no_undefined_flag_CXX=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else - # g++ 2.7 appears to require '-G' NOT '-shared' on this + # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. - archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi - hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) - whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi @@ -34508,52 +20378,52 @@ fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='$wl-z,text' + no_undefined_flag_CXX='${wl}-z,text' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) - archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not + # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - no_undefined_flag_CXX='$wl-z,text' - allow_undefined_flag_CXX='$wl-z,nodefs' + no_undefined_flag_CXX='${wl}-z,text' + allow_undefined_flag_CXX='${wl}-z,nodefs' archive_cmds_need_lc_CXX=no hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' hardcode_libdir_separator_CXX=':' link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='$wl-Bexport' + export_dynamic_flag_spec_CXX='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ - '"$old_archive_cmds_CXX" + '"$old_archive_cmds_CXX" reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ - '"$reload_cmds_CXX" + '"$reload_cmds_CXX" ;; *) - archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; @@ -34585,10 +20455,10 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } - test no = "$ld_shlibs_CXX" && can_build_shared=no + test "$ld_shlibs_CXX" = no && can_build_shared=no - GCC_CXX=$GXX - LD_CXX=$LD + GCC_CXX="$GXX" + LD_CXX="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -34632,13 +20502,13 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $prev$p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. - if test x-L = "$p" || - test x-R = "$p"; then + if test $p = "-L" || + test $p = "-R"; then prev=$p continue fi @@ -34654,16 +20524,16 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac - if test no = "$pre_test_object_deps_done"; then - case $prev in + if test "$pre_test_object_deps_done" = no; then + case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX=$prev$p + compiler_lib_search_path_CXX="${prev}${p}" else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" fi ;; # The "-l" case would never come before the object being @@ -34671,9 +20541,9 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 esac else if test -z "$postdeps_CXX"; then - postdeps_CXX=$prev$p + postdeps_CXX="${prev}${p}" else - postdeps_CXX="${postdeps_CXX} $prev$p" + postdeps_CXX="${postdeps_CXX} ${prev}${p}" fi fi prev= @@ -34688,15 +20558,15 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 continue fi - if test no = "$pre_test_object_deps_done"; then + if test "$pre_test_object_deps_done" = no; then if test -z "$predep_objects_CXX"; then - predep_objects_CXX=$p + predep_objects_CXX="$p" else predep_objects_CXX="$predep_objects_CXX $p" fi else if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX=$p + postdep_objects_CXX="$p" else postdep_objects_CXX="$postdep_objects_CXX $p" fi @@ -34726,6 +20596,51 @@ interix[3-9]*) postdep_objects_CXX= postdeps_CXX= ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + postdeps_CXX='-library=Cstd -library=Crun' + fi + ;; + esac + ;; esac @@ -34734,7 +20649,7 @@ case " $postdeps_CXX " in esac compiler_lib_search_dirs_CXX= if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi @@ -34773,18 +20688,17 @@ lt_prog_compiler_static_CXX= # C++ specific cases for pic, static, wl, etc. - if test yes = "$GXX"; then + if test "$GXX" = yes; then lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_static_CXX='-static' case $host_os in aix*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' fi - lt_prog_compiler_pic_CXX='-fPIC' ;; amigaos*) @@ -34795,8 +20709,8 @@ lt_prog_compiler_static_CXX= ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -34811,11 +20725,6 @@ lt_prog_compiler_static_CXX= # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - case $host_os in - os2*) - lt_prog_compiler_static_CXX='$wl-static' - ;; - esac ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -34865,7 +20774,7 @@ lt_prog_compiler_static_CXX= case $host_os in aix[4-9]*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static_CXX='-Bstatic' else @@ -34905,14 +20814,14 @@ lt_prog_compiler_static_CXX= case $cc_basename in CC*) lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='$wl-a ${wl}archive' - if test ia64 != "$host_cpu"; then + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then lt_prog_compiler_pic_CXX='+Z' fi ;; aCC*) lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default @@ -34949,7 +20858,7 @@ lt_prog_compiler_static_CXX= lt_prog_compiler_pic_CXX='-fPIC' ;; ecpc* ) - # old Intel C++ for x86_64, which still supported -KPIC. + # old Intel C++ for x86_64 which still supported -KPIC. lt_prog_compiler_wl_CXX='-Wl,' lt_prog_compiler_pic_CXX='-KPIC' lt_prog_compiler_static_CXX='-static' @@ -35094,7 +21003,7 @@ lt_prog_compiler_static_CXX= fi case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: + # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic_CXX= ;; @@ -35126,7 +21035,7 @@ else lt_cv_prog_compiler_pic_works_CXX=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -35156,7 +21065,7 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } -if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then +if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then case $lt_prog_compiler_pic_CXX in "" | " "*) ;; *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; @@ -35182,7 +21091,7 @@ if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -35201,13 +21110,13 @@ else fi fi $RM -r conftest* - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 $as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } -if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then +if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then : else lt_prog_compiler_static_CXX= @@ -35321,8 +21230,8 @@ $as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } -hard_links=nottested -if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } @@ -35334,9 +21243,9 @@ $as_echo_n "checking if we can lock with hard links... " >&6; } ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } - if test no = "$hard_links"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi else @@ -35353,21 +21262,17 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie case $host_os in aix[4-9]*) # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) - export_symbols_cmds_CXX=$ltdll_cmds + export_symbols_cmds_CXX="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in @@ -35390,7 +21295,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 $as_echo "$ld_shlibs_CXX" >&6; } -test no = "$ld_shlibs_CXX" && can_build_shared=no +test "$ld_shlibs_CXX" = no && can_build_shared=no with_gnu_ld_CXX=$with_gnu_ld @@ -35407,7 +21312,7 @@ x|xyes) # Assume -lc should be added archive_cmds_need_lc_CXX=yes - if test yes,yes = "$GCC,$enable_shared"; then + if test "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds_CXX in *'~'*) # FIXME: we may have to deal with multi-command sequences. @@ -35535,7 +21440,7 @@ $as_echo_n "checking dynamic linker characteristics... " >&6; } library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=.so +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -35552,16 +21457,14 @@ hardcode_into_libs=no # flags to be left without arguments need_version=unknown - - case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' + soname_spec='${libname}${release}${shared_ext}$major' ;; aix[4-9]*) @@ -35569,91 +21472,41 @@ aix[4-9]*) need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' + if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a(lib.so.V)' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi shlibpath_var=LIBPATH fi ;; @@ -35663,18 +21516,18 @@ amigaos*) powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) - library_names_spec='$libname$shared_ext' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -35682,8 +21535,8 @@ beos*) bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" @@ -35695,7 +21548,7 @@ bsdi[45]*) cygwin* | mingw* | pw32* | cegcc*) version_type=windows - shrext_cmds=.dll + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -35704,8 +21557,8 @@ cygwin* | mingw* | pw32* | cegcc*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ @@ -35721,16 +21574,16 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' @@ -35739,8 +21592,8 @@ cygwin* | mingw* | pw32* | cegcc*) *,cl*) # Native MSVC libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' case $build_os in mingw*) @@ -35767,7 +21620,7 @@ cygwin* | mingw* | pw32* | cegcc*) sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) - sys_lib_search_path_spec=$LIB + sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` @@ -35780,8 +21633,8 @@ cygwin* | mingw* | pw32* | cegcc*) esac # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' @@ -35794,7 +21647,7 @@ cygwin* | mingw* | pw32* | cegcc*) *) # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac @@ -35807,8 +21660,8 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' @@ -35820,8 +21673,8 @@ dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -35839,13 +21692,12 @@ freebsd* | dragonfly*) version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -35875,10 +21727,10 @@ haiku*) need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no + shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -35896,15 +21748,14 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -35912,8 +21763,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; @@ -35922,8 +21773,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... @@ -35936,8 +21787,8 @@ interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -35948,7 +21799,7 @@ irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) - if test yes = "$lt_cv_prog_gnu_ld"; then + if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix @@ -35956,8 +21807,8 @@ irix5* | irix6* | nonstopux*) esac need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= @@ -35976,8 +21827,8 @@ irix5* | irix6* | nonstopux*) esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; @@ -35986,33 +21837,13 @@ linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - hardcode_libdir_flag_spec_CXX='-L$libdir' - ;; - # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -36056,12 +21887,7 @@ fi # before this can be enabled. hardcode_into_libs=yes - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -36093,12 +21919,12 @@ netbsd*) need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -36108,7 +21934,7 @@ netbsd*) newsos6) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -36117,68 +21943,58 @@ newsos6) version_type=qnx need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; -openbsd* | bitrig*) +openbsd*) version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi ;; os2*) libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no + shrext_cmds=".dll" need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' + shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) @@ -36189,8 +22005,8 @@ solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -36200,11 +22016,11 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes @@ -36212,8 +22028,8 @@ sunos4*) sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -36234,24 +22050,24 @@ sysv4 | sysv4.3*) ;; sysv4*MP*) - if test -d /usr/nec; then + if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco + version_type=freebsd-elf need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' @@ -36269,7 +22085,7 @@ tpf*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes @@ -36277,8 +22093,8 @@ tpf*) uts4*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -36288,32 +22104,20 @@ uts4*) esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } -test no = "$dynamic_linker" && can_build_shared=no +test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then +if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - - - @@ -36356,15 +22160,15 @@ $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action_CXX= if test -n "$hardcode_libdir_flag_spec_CXX" || test -n "$runpath_var_CXX" || - test yes = "$hardcode_automatic_CXX"; then + test "X$hardcode_automatic_CXX" = "Xyes" ; then # We can hardcode non-existent directories. - if test no != "$hardcode_direct_CXX" && + if test "$hardcode_direct_CXX" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && - test no != "$hardcode_minus_L_CXX"; then + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && + test "$hardcode_minus_L_CXX" != no; then # Linking always hardcodes the temporary library directory. hardcode_action_CXX=relink else @@ -36379,12 +22183,12 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 $as_echo "$hardcode_action_CXX" >&6; } -if test relink = "$hardcode_action_CXX" || - test yes = "$inherit_rpath_CXX"; then +if test "$hardcode_action_CXX" = relink || + test "$inherit_rpath_CXX" = yes; then # Fast installation is not supported enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi @@ -36407,7 +22211,7 @@ fi lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test yes != "$_lt_caught_CXX_error" +fi # test "$_lt_caught_CXX_error" != yes ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -36438,14 +22242,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -GCC="$SAVED_GCC" -CC="$SAVED_CC" - -if ( test "${GCC}" = "yes" ) -then - CFLAGS="$CFLAGS_SAVED_NOPEDANTIC" -fi - if test "${nut_with_dev}" != "no"; then nut_with_dev="yes" else @@ -36458,14 +22254,14 @@ if test "${enable_static+set}" = set; then : *) enable_static=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac else @@ -36774,9 +22570,9 @@ _ACEOF $as_echo "${RUN_AS_GROUP}" >&6; } if test "${nut_user_given}" = "yes" -a "${nut_group_given}" = "no"; then - as_fn_error $? "If you specify --with-user, you also must specify --with-group" "$LINENO" 5 + as_fn_error $? "\"If you specify --with-user, you also must specify --with-group\"" "$LINENO" 5 elif test "${nut_user_given}" = "no" -a "${nut_group_given}" = "yes"; then - as_fn_error $? "If you specify --with-group, you also must specify --with-user" "$LINENO" 5 + as_fn_error $? "\"If you specify --with-group, you also must specify --with-user\"" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking facility for syslog" >&5 @@ -36808,27 +22604,67 @@ _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${LOGFACILITY}" >&5 $as_echo "${LOGFACILITY}" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking which drivers to build" >&5 +$as_echo_n "checking which drivers to build... " >&6; } + +# Check whether --with-drivers was given. +if test "${with_drivers+set}" = set; then : + withval=$with_drivers; + case "${withval}" in + yes|no) + as_fn_error $? "invalid option --with(out)-drivers - see docs/configure.txt" "$LINENO" 5 + ;; + *) + DRIVER_BUILD_LIST=`echo ${withval} | sed "s/,/ /g"` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_BUILD_LIST}" >&5 +$as_echo "${DRIVER_BUILD_LIST}" >&6; } + ;; + esac + +else + + DRIVER_BUILD_LIST="all" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 +$as_echo "all available" >&6; } + +fi + + if test "${DRIVER_BUILD_LIST}" != "all"; then + SOME_DRIVERS_TRUE= + SOME_DRIVERS_FALSE='#' +else + SOME_DRIVERS_TRUE='#' + SOME_DRIVERS_FALSE= +fi + + +if test "${DRIVER_BUILD_LIST}" != "all"; then + if test -z "${nut_report_feature_flag}"; then + nut_report_feature_flag="1" + ac_clean_files="${ac_clean_files} conf_nut_report_feature" + echo > conf_nut_report_feature + echo "Configuration summary:" >> conf_nut_report_feature + echo "======================" >> conf_nut_report_feature + fi + echo "only build specific drivers: ${DRIVER_BUILD_LIST}" >> conf_nut_report_feature + +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which driver man pages to install" >&5 $as_echo_n "checking which driver man pages to install... " >&6; } -if test "${WITH_MANS}" = "yes"; then - if test "${DRIVER_BUILD_LIST}" = "all"; then - DRIVER_MAN_LIST=all - { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 +if test "${DRIVER_BUILD_LIST}" = "all"; then + DRIVER_MAN_LIST=all + { $as_echo "$as_me:${as_lineno-$LINENO}: result: all available" >&5 $as_echo "all available" >&6; } - else - DRIVER_MAN_LIST="" - for i in ${DRIVER_BUILD_LIST}; do - if test -f ${srcdir}/docs/man/$i.8; then - DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8" - fi - done - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_MAN_LIST}" >&5 -$as_echo "${DRIVER_MAN_LIST}" >&6; } - fi else DRIVER_MAN_LIST="" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none (manpages disabled)" >&5 -$as_echo "none (manpages disabled)" >&6; } + for i in ${DRIVER_BUILD_LIST}; do + if test -f ${srcdir}/docs/man/$i.8; then + DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8" + fi + done + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${DRIVER_MAN_LIST}" >&5 +$as_echo "${DRIVER_MAN_LIST}" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to strip debug symbols" >&5 @@ -36836,7 +22672,7 @@ $as_echo_n "checking whether to strip debug symbols... " >&6; } # Check whether --enable-strip was given. if test "${enable_strip+set}" = set; then : enableval=$enable_strip; - case "${enableval}" in + case "${withval}" in no) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } @@ -36891,674 +22727,25 @@ else fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install Solaris SMF files" >&5 -$as_echo_n "checking whether to install Solaris SMF files... " >&6; } -solarissmf="auto" -# Check whether --with-solaris-smf was given. -if test "${with_solaris_smf+set}" = set; then : - withval=$with_solaris_smf; - case "${withval}" in - auto|"") - solarissmf="auto" - ;; - yes|no) - solarissmf="${withval}" - ;; - *) - as_fn_error $? "Unexpected argument for --with-solaris-smf=${withval}" "$LINENO" 5 - ;; - esac -fi -if test x"$solarissmf" = xauto ; then - if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then - solarissmf="yes" - else - solarissmf="no" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${solarissmf}" >&5 -$as_echo "${solarissmf}" >&6; } - if test x"$solarissmf" = x"yes"; then - WITH_SOLARIS_SMF_TRUE= - WITH_SOLARIS_SMF_FALSE='#' -else - WITH_SOLARIS_SMF_TRUE='#' - WITH_SOLARIS_SMF_FALSE= -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to make Solaris SVR4 packages" >&5 -$as_echo_n "checking whether to make Solaris SVR4 packages... " >&6; } -solarispkg_svr4="auto" -# Check whether --with-solaris-pkg-svr4 was given. -if test "${with_solaris_pkg_svr4+set}" = set; then : - withval=$with_solaris_pkg_svr4; - case "${withval}" in - auto|"") - solarispkg_svr4="auto" - ;; - yes|no) - solarispkg_svr4="${withval}" - ;; - *) - as_fn_error $? "Unexpected argument for --with-solaris-pkg-svr4=${withval}" "$LINENO" 5 - ;; - esac - -fi - - -if test x"$solarispkg_svr4" = xauto ; then - if test -x /usr/bin/pkgtrans && test -x /usr/bin/pkgmk && test -x /usr/bin/pkgproto ; then - solarispkg_svr4="yes" - else - solarispkg_svr4="no" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${solarispkg_svr4}" >&5 -$as_echo "${solarispkg_svr4}" >&6; } - if test x"$solarispkg_svr4" = x"yes"; then - WITH_SOLARIS_PKG_SVR4_TRUE= - WITH_SOLARIS_PKG_SVR4_FALSE='#' -else - WITH_SOLARIS_PKG_SVR4_TRUE='#' - WITH_SOLARIS_PKG_SVR4_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to make Solaris IPS packages" >&5 -$as_echo_n "checking whether to make Solaris IPS packages... " >&6; } -solarispkg_ips="auto" - -# Check whether --with-solaris-pkg-ips was given. -if test "${with_solaris_pkg_ips+set}" = set; then : - withval=$with_solaris_pkg_ips; - case "${withval}" in - auto|"") - solarispkg_ips="auto" - ;; - yes|no) - solarispkg_ips="${withval}" - ;; - *) - as_fn_error $? "Unexpected argument for --with-solaris-pkg-ips=${withval}" "$LINENO" 5 - ;; - esac - -fi - - -if test x"$solarispkg_ips" = xauto ; then - if test -x /usr/bin/pkg && test -x /usr/bin/pkgmogrify && test -x /usr/bin/pkgdepend ; then - solarispkg_ips="yes" - else - solarispkg_ips="no" - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${solarispkg_ips}" >&5 -$as_echo "${solarispkg_ips}" >&6; } - if test x"$solarispkg_ips" = x"yes"; then - WITH_SOLARIS_PKG_IPS_TRUE= - WITH_SOLARIS_PKG_IPS_FALSE='#' -else - WITH_SOLARIS_PKG_IPS_TRUE='#' - WITH_SOLARIS_PKG_IPS_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install systemd unit files" >&5 -$as_echo_n "checking whether to install systemd unit files... " >&6; } - -# Check whether --with-systemdsystemunitdir was given. -if test "${with_systemdsystemunitdir+set}" = set; then : - withval=$with_systemdsystemunitdir; systemdsystemunitdir="${withval}" -else - systemdsystemunitdir="auto" -fi - -case "${systemdsystemunitdir}" in - yes|auto|"") - if test x"$have_PKG_CONFIG" = xyes; then : - systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`" && test -n "$systemdsystemunitdir" || systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir libsystemd 2>/dev/null`" -else - if test "${withval}" = yes; then : - as_fn_error $? "--with-systemdsystemunitdir=${withval} was requested, but PKG_CONFIG could not be queried for the system settings" "$LINENO" 5 -fi - systemdsystemunitdir="" - -fi - ;; - no) - systemdsystemunitdir="" - ;; - *) - systemdsystemunitdir="${withval}" - ;; -esac -if test "${systemdsystemunitdir}" = "auto" ; then systemdsystemunitdir=""; fi -if test -n "${systemdsystemunitdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${systemdsystemunitdir}" >&5 -$as_echo "using ${systemdsystemunitdir}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test "$systemdsystemunitdir" != ""; then - HAVE_SYSTEMD_TRUE= - HAVE_SYSTEMD_FALSE='#' -else - HAVE_SYSTEMD_TRUE='#' - HAVE_SYSTEMD_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install systemd shutdown files" >&5 -$as_echo_n "checking whether to install systemd shutdown files... " >&6; } - -# Check whether --with-systemdshutdowndir was given. -if test "${with_systemdshutdowndir+set}" = set; then : - withval=$with_systemdshutdowndir; systemdshutdowndir="${withval}" -else - systemdshutdowndir="auto" -fi - -if test -n "${systemdsystemunitdir}"; then - case "${systemdshutdowndir}" in - yes|auto|"") - if test x"$have_PKG_CONFIG" = xyes; then : - systemdshutdowndir="`$PKG_CONFIG --variable=systemdshutdowndir systemd 2>/dev/null`" && test -n "$systemdshutdowndir" || systemdshutdowndir="`$PKG_CONFIG --variable=systemdshutdowndir libsystemd 2>/dev/null`" -else - if test "${systemdshutdowndir}" = yes; then : - as_fn_error $? "--with-systemdshutdowndir=${systemdshutdowndir} was requested, but PKG_CONFIG could not be queried for the system settings" "$LINENO" 5 -fi - systemdshutdowndir="" - -fi - ;; - no) - systemdshutdowndir="" - ;; - *) - systemdshutdowndir="${withval}" - ;; - esac -fi -if test "${systemdshutdowndir}" = "auto" ; then systemdshutdowndir=""; fi -if test -n "${systemdshutdowndir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${systemdshutdowndir}" >&5 -$as_echo "using ${systemdshutdowndir}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install systemd tmpfiles files" >&5 -$as_echo_n "checking whether to install systemd tmpfiles files... " >&6; } - -# Check whether --with-systemdtmpfilesdir was given. -if test "${with_systemdtmpfilesdir+set}" = set; then : - withval=$with_systemdtmpfilesdir; systemdtmpfilesdir="${withval}" -else - systemdtmpfilesdir="auto" -fi - -case "${systemdtmpfilesdir}" in - yes|auto|"") - if test x"$have_PKG_CONFIG" = xyes; then : - systemdtmpfilesdir="`$PKG_CONFIG --variable=tmpfilesdir systemd 2>/dev/null`" && test -n "$systemdtmpfilesdir" || systemdtmpfilesdir="`$PKG_CONFIG --variable=tmpfilesdir libsystemd 2>/dev/null`" -else - if test "${systemdtmpfilesdir}" = yes; then : - as_fn_error $? "--with-systemdtmpfilesdir=${systemdtmpfilesdir} was requested, but PKG_CONFIG could not be queried for the system settings" "$LINENO" 5 -fi - systemdtmpfilesdir="" - -fi - ;; - no) - systemdtmpfilesdir="" - ;; - *) - systemdtmpfilesdir="${withval}" - ;; -esac -if test "${systemdtmpfilesdir}" = "auto" ; then systemdtmpfilesdir=""; fi -if test -n "${systemdtmpfilesdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${systemdtmpfilesdir}" >&5 -$as_echo "using ${systemdtmpfilesdir}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C++11 support in current compiler" >&5 -$as_echo_n "checking for C++11 support in current compiler... " >&6; } -have_cxx11=unknown -my_CXXFLAGS="$CXXFLAGS" -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - -CPLUSPLUS_DECL=' -#include -#if __cplusplus < 201103L - #error This library needs at least a C++11 compliant compiler -#endif -' -CPLUSPLUS_MAIN='printf("%ld\n", __cplusplus);' - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -${CPLUSPLUS_DECL} -int -main () -{ -${CPLUSPLUS_MAIN} - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, out of the box" >&5 -$as_echo "yes, out of the box" >&6; } - have_cxx11=yes -else - case "${CXXFLAGS}" in #( - *"-std="*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, not with the standard already set in CXXFLAGS='${CXXFLAGS}'" >&5 -$as_echo "no, not with the standard already set in CXXFLAGS='${CXXFLAGS}'" >&6; } - have_cxx11=no, - ;; #( - *) : - - CXXFLAGS="$CXXFLAGS -std=c++11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -${CPLUSPLUS_DECL} -int -main () -{ -${CPLUSPLUS_MAIN} - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, GCC-style (as C++11)" >&5 -$as_echo "yes, GCC-style (as C++11)" >&6; } - have_cxx11=yes -else - CXXFLAGS="$CXXFLAGS -std=c++0x" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -${CPLUSPLUS_DECL} -int -main () -{ -${CPLUSPLUS_MAIN} - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, GCC-style (as C++0X)" >&5 -$as_echo "yes, GCC-style (as C++0X)" >&6; } - have_cxx11=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - CXXFLAGS="$my_CXXFLAGS" - have_cxx11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ;; -esac -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "${have_cxx11}" = "yes"; then - HAVE_CXX11_TRUE= - HAVE_CXX11_FALSE='#' -else - HAVE_CXX11_TRUE='#' - HAVE_CXX11_FALSE= -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -unset CPLUSPLUS_MAIN -unset CPLUSPLUS_DECL - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for have_cppunit" >&5 -$as_echo_n "checking for have_cppunit... " >&6; } -have_cppunit="no" -CPPUNIT_NUT_CXXFLAGS="" -if test x"$have_PKG_CONFIG" = xyes; then : - if test x"${have_cxx11}" = xyes; then : - -pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cppunit" >&5 -$as_echo_n "checking for cppunit... " >&6; } - -if test -n "$CPPUNIT_CFLAGS"; then - pkg_cv_CPPUNIT_CFLAGS="$CPPUNIT_CFLAGS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cppunit") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CPPUNIT_CFLAGS=`$PKG_CONFIG --cflags "cppunit" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$CPPUNIT_LIBS"; then - pkg_cv_CPPUNIT_LIBS="$CPPUNIT_LIBS" - elif test -n "$PKG_CONFIG"; then - if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"cppunit\""; } >&5 - ($PKG_CONFIG --exists --print-errors "cppunit") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_CPPUNIT_LIBS=`$PKG_CONFIG --libs "cppunit" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi - - - -if test $pkg_failed = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then - _pkg_short_errors_supported=yes -else - _pkg_short_errors_supported=no -fi - if test $_pkg_short_errors_supported = yes; then - CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "cppunit" 2>&1` - else - CPPUNIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "cppunit" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$CPPUNIT_PKG_ERRORS" >&5 - - have_cppunit=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - have_cppunit=no -else - CPPUNIT_CFLAGS=$pkg_cv_CPPUNIT_CFLAGS - CPPUNIT_LIBS=$pkg_cv_CPPUNIT_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - have_cppunit=yes -fi - if test "${have_cppunit}" != "yes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: libcppunit not found - those C++ tests will not be built." >&5 -$as_echo "$as_me: WARNING: libcppunit not found - those C++ tests will not be built." >&2;} - have_cppunit=no -else - if test -n "$CXX"; then : - if $CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null; then : - CPPUNIT_NUT_CXXFLAGS="-g -O0" -fi -fi - -fi - -fi - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found, can not look properly for libcppunit - those C++ tests will not be built." >&5 -$as_echo "$as_me: WARNING: pkg-config not found, can not look properly for libcppunit - those C++ tests will not be built." >&2;} - have_cppunit=no - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${have_cppunit}" >&5 -$as_echo "${have_cppunit}" >&6; } - -if test "${have_cppunit}" = "yes"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if current toolkit can build and run cppunit tests (e.g. no ABI issues, related segfaults, etc.)" >&5 -$as_echo_n "checking if current toolkit can build and run cppunit tests (e.g. no ABI issues, related segfaults, etc.)... " >&6; } - CPLUSPLUS_DECL=' -#include -#include -#include -#include -#include - -class ExampleTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE( ExampleTest ); - CPPUNIT_TEST( testOne ); - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {}; - void tearDown() {}; - void testOne(); -}; -CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTest ); -void ExampleTest::testOne() -{ - int i = 1; - float f = 1.0; - int cast = static_cast(f); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Casted float is not the expected int (assert_eq)", i, cast ); - CPPUNIT_ASSERT_MESSAGE("Casted float is not the expected int (assert)", (i == cast) ); -} -' - - CPLUSPLUS_MAIN=' -CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); -CppUnit::TextUi::TestRunner runner; -runner.addTest( suite ); -runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); -bool res = runner.run(); -return res ? 0 : 1; -' - - my_CXXFLAGS="$CXXFLAGS" - my_LDFLAGS="$LDFLAGS" - my_LIBS="$LIBS" - CXXFLAGS="$myCXXFLAGS $pkg_cv_CPPUNIT_CFLAGS $pkg_cv_CPPUNIT_CXXFLAGS" - LDFLAGS="$my_LDFLAGS $pkg_cv_CPPUNIT_LDFLAGS" - LIBS="$my_LIBS $pkg_cv_CPPUNIT_LIBS" - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - - if test "$cross_compiling" = yes; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&5 -$as_echo "$as_me: WARNING: Current build is a cross-build, so not running test binaries, just linking them" >&2;} - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -${CPLUSPLUS_DECL} -int -main () -{ -${CPLUSPLUS_MAIN} - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - have_cppunit=yes -else - have_cppunit=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -${CPLUSPLUS_DECL} -int -main () -{ -${CPLUSPLUS_MAIN} - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_run "$LINENO"; then : - have_cppunit=yes -else - have_cppunit=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - - CXXFLAGS="$my_CXXFLAGS" - LDFLAGS="$my_LDFLAGS" - LIBS="$my_LIBS" - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - unset CPLUSPLUS_MAIN - unset CPLUSPLUS_DECL - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${have_cppunit}" >&5 -$as_echo "${have_cppunit}" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for impact from --enable-cppunit option - should we build cppunit tests?" >&5 -$as_echo_n "checking for impact from --enable-cppunit option - should we build cppunit tests?... " >&6; } -# Check whether --enable-cppunit was given. -if test "${enable_cppunit+set}" = set; then : - enableval=$enable_cppunit; case "${enableval}" in #( - "yes") : - if test x"${have_cppunit}" = xyes; then : - -else - as_fn_error $? "--with-cppunit=yes can not be satisfied" "$LINENO" 5 -fi ;; #( - "no") : - have_cppunit=no - ;; #( - *) : - ;; -esac -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ${have_cppunit}" >&5 -$as_echo "${have_cppunit}" >&6; } - - if test "${have_cppunit}" = "yes"; then - HAVE_CPPUNIT_TRUE= - HAVE_CPPUNIT_FALSE='#' -else - HAVE_CPPUNIT_TRUE='#' - HAVE_CPPUNIT_FALSE= -fi - - -cat >>confdefs.h <<_ACEOF -#define CPPUNIT_NUT_CXXFLAGS $CPPUNIT_NUT_CXXFLAGS -_ACEOF - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install Augeas configuration-management lenses" >&5 -$as_echo_n "checking whether to install Augeas configuration-management lenses... " >&6; } - -# Check whether --with-augeas-lenses-dir was given. -if test "${with_augeas_lenses_dir+set}" = set; then : - withval=$with_augeas_lenses_dir; - case "${withval}" in - yes) - if test -z "${auglensdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "augeas lenses directory requested but not found in default location" "$LINENO" 5 - fi - if ! test -s scripts/augeas/nutupsconf.aug.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "augeas lenses directory requested but a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive" "$LINENO" 5 - fi - ;; - auto) - if ! test -s scripts/augeas/nutupsconf.aug.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: augeas lenses directory skipped because a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive" >&5 -$as_echo "$as_me: WARNING: augeas lenses directory skipped because a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive" >&2;} - auglensdir="" - fi - ;; - no) - auglensdir="" - ;; - *) - auglensdir="${withval}" - ;; - esac - -fi - -if test -n "${auglensdir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${auglensdir}" >&5 -$as_echo "using ${auglensdir}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test -n "${auglensdir}"; then - WITH_AUGLENS_TRUE= - WITH_AUGLENS_FALSE='#' -else - WITH_AUGLENS_TRUE='#' - WITH_AUGLENS_FALSE= -fi - - -for ac_prog in augparse -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_AUGPARSE+:} false; then : +if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else - case $AUGPARSE in + case $PKG_CONFIG in [\\/]* | ?:[\\/]*) - ac_cv_path_AUGPARSE="$AUGPARSE" # Let the user override the test with a path. + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -37568,7 +22755,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_AUGPARSE="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -37579,37 +22766,123 @@ IFS=$as_save_IFS ;; esac fi -AUGPARSE=$ac_cv_path_AUGPARSE -if test -n "$AUGPARSE"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AUGPARSE" >&5 -$as_echo "$AUGPARSE" >&6; } +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$AUGPARSE" && break -done -test -n "$AUGPARSE" || AUGPARSE="none" - - if test "x${AUGPARSE}" != "xnone"; then - HAVE_AUGPARSE_TRUE= - HAVE_AUGPARSE_FALSE='#' +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 else - HAVE_AUGPARSE_TRUE='#' - HAVE_AUGPARSE_FALSE= + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable Augeas configuration-management lenses tests" >&5 -$as_echo_n "checking whether to enable Augeas configuration-management lenses tests... " >&6; } -if test "x${AUGPARSE}" != xnone ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi +fi +systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install systemd files" >&5 +$as_echo_n "checking whether to install systemd files... " >&6; } + +# Check whether --with-systemdsystemunitdir was given. +if test "${with_systemdsystemunitdir+set}" = set; then : + withval=$with_systemdsystemunitdir; + case "${withval}" in + yes|auto) + ;; + no) + systemdsystemunitdir="" + ;; + *) + systemdsystemunitdir="${withval}" + ;; + esac + +fi + +if test -n "${systemdsystemunitdir}"; then + systemdsystemshutdowndir="${libdir}/systemd/system-shutdown" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${systemdsystemunitdir}" >&5 +$as_echo "using ${systemdsystemunitdir}" >&6; } + systemdsystemunitdir="`echo ${systemdsystemunitdir} | sed 's/\/lib/\${libdir}/'`" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi + if test "$systemdsystemunitdir" != ""; then + HAVE_SYSTEMD_TRUE= + HAVE_SYSTEMD_FALSE='#' +else + HAVE_SYSTEMD_TRUE='#' + HAVE_SYSTEMD_FALSE= +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install hotplug rules" >&5 @@ -37623,7 +22896,7 @@ if test "${with_hotplug_dir+set}" = set; then : if test -z "${hotplugdir}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "hotplug directory requested but not found" "$LINENO" 5 + as_fn_error $? "\"hotplug directory requested but not found\"" "$LINENO" 5 fi ;; auto) @@ -37665,20 +22938,10 @@ if test "${with_udev_dir+set}" = set; then : if test -z "${udevdir}"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } - as_fn_error $? "udev directory requested but not found" "$LINENO" 5 - fi - if test "${nut_with_usb}" = yes && ! test -s scripts/udev/nut-usbups.rules.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "udev directory and USB driver support requested but a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive" "$LINENO" 5 + as_fn_error $? "\"udev directory requested but not found\"" "$LINENO" 5 fi ;; auto) - if test "${nut_with_usb}" = yes && ! test -s scripts/udev/nut-usbups.rules.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: udev directory skipped because a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive" >&5 -$as_echo "$as_me: WARNING: udev directory skipped because a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive" >&2;} - udevdir="" - fi ;; no) udevdir="" @@ -37706,87 +22969,18 @@ else fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to install FreeBSD devd.conf file" >&5 -$as_echo_n "checking whether to install FreeBSD devd.conf file... " >&6; } - -# Check whether --with-devd-dir was given. -if test "${with_devd_dir+set}" = set; then : - withval=$with_devd_dir; - case "${withval}" in - yes) - if test -z "${devddir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "devd directory requested but not found" "$LINENO" 5 - fi - if test "${nut_with_usb}" = yes && ! test -s scripts/devd/nut-usbups.rules.in -a -s scripts/devd/nut-usb.conf.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "devd directory and USB driver support requested but non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive" "$LINENO" 5 - fi - ;; - auto) - if test "${nut_with_usb}" = yes && ! test -s scripts/devd/nut-usbups.rules.in -a -s scripts/devd/nut-usb.conf.in ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: devd directory skipped because non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive" >&5 -$as_echo "$as_me: WARNING: devd directory skipped because non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive" >&2;} - devddir="" - fi - ;; - no) - devddir="" - ;; - *) - devddir="${withval}" - ;; - esac - -fi - -if test -n "${devddir}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${devddir}" >&5 -$as_echo "using ${devddir}" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - if test -n "${devddir}"; then - WITH_DEVD_TRUE= - WITH_DEVD_FALSE='#' -else - WITH_DEVD_TRUE='#' - WITH_DEVD_FALSE= -fi - - - - if test "xAIX" = "x`uname -s 2>/dev/null`"; then - SYSTEM_AIX_TRUE= - SYSTEM_AIX_FALSE='#' -else - SYSTEM_AIX_TRUE='#' - SYSTEM_AIX_FALSE= -fi - - - -cat >>confdefs.h <<_ACEOF -#define CPU_TYPE "$target_cpu" -_ACEOF - - -for ac_prog in valgrind +for ac_prog in asciidoc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_VALGRIND+:} false; then : +if ${ac_cv_path_ASCIIDOC+:} false; then : $as_echo_n "(cached) " >&6 else - case $VALGRIND in + case $ASCIIDOC in [\\/]* | ?:[\\/]*) - ac_cv_path_VALGRIND="$VALGRIND" # Let the user override the test with a path. + ac_cv_path_ASCIIDOC="$ASCIIDOC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -37796,7 +22990,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_VALGRIND="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_ASCIIDOC="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -37807,76 +23001,40 @@ IFS=$as_save_IFS ;; esac fi -VALGRIND=$ac_cv_path_VALGRIND -if test -n "$VALGRIND"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 -$as_echo "$VALGRIND" >&6; } +ASCIIDOC=$ac_cv_path_ASCIIDOC +if test -n "$ASCIIDOC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ASCIIDOC" >&5 +$as_echo "$ASCIIDOC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$VALGRIND" && break + test -n "$ASCIIDOC" && break done -test -n "$VALGRIND" || VALGRIND="none" +test -n "$ASCIIDOC" || ASCIIDOC="none" -if test -n "${VALGRIND}"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether valgrind is usable on current platform" >&5 -$as_echo_n "checking whether valgrind is usable on current platform... " >&6; } - if ( ${VALGRIND} --help >/dev/null 2>/dev/null ); then : - if ( ${VALGRIND} /bin/sh -c true >/dev/null 2>/dev/null ); then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + if test "x$ASCIIDOC" != "xnone"; then + MANUALUPDATE_TRUE= + MANUALUPDATE_FALSE='#' else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - VALGRIND="none" - -fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - VALGRIND="none" - + MANUALUPDATE_TRUE='#' + MANUALUPDATE_FALSE= fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use valgrind for memory-leak testing" >&5 -$as_echo_n "checking whether to use valgrind for memory-leak testing... " >&6; } - -# Check whether --with-valgrind was given. -if test "${with_valgrind+set}" = set; then : - withval=$with_valgrind; - case "${withval}" in - yes) - if test "x$VALGRIND" = "xnone"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "valgrind requested but not found" "$LINENO" 5 - fi - with_valgrind="yes" - ;; - auto) - with_valgrind="auto" - ;; - no) - with_valgrind="no" - ;; - *) - for ac_prog in "${withval}" +for ac_prog in a2x do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_VALGRIND+:} false; then : +if ${ac_cv_path_A2X+:} false; then : $as_echo_n "(cached) " >&6 else - case $VALGRIND in + case $A2X in [\\/]* | ?:[\\/]*) - ac_cv_path_VALGRIND="$VALGRIND" # Let the user override the test with a path. + ac_cv_path_A2X="$A2X" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -37886,7 +23044,7 @@ do test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_VALGRIND="$as_dir/$ac_word$ac_exec_ext" + ac_cv_path_A2X="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi @@ -37897,76 +23055,76 @@ IFS=$as_save_IFS ;; esac fi -VALGRIND=$ac_cv_path_VALGRIND -if test -n "$VALGRIND"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $VALGRIND" >&5 -$as_echo "$VALGRIND" >&6; } +A2X=$ac_cv_path_A2X +if test -n "$A2X"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $A2X" >&5 +$as_echo "$A2X" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - test -n "$VALGRIND" && break + test -n "$A2X" && break done -test -n "$VALGRIND" || VALGRIND="none" - - if test "x$VALGRIND" = "xnone"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "valgrind requested but not found" "$LINENO" 5 - fi - with_valgrind="yes" - ;; - esac - -fi +test -n "$A2X" || A2X="none" -if test "x${with_valgrind}" = xauto; then - if test "x$VALGRIND" = "xnone"; then - with_valgrind="no" - else - with_valgrind="yes" - fi -fi - -if test "x${with_valgrind}" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using ${VALGRIND}" >&5 -$as_echo "using ${VALGRIND}" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: Do not forget to build with debug (e.g. pass '-g' in CFLAGS for GCC) for best results with valgrind tests" >&5 -$as_echo "$as_me: Do not forget to build with debug (e.g. pass '-g' in CFLAGS for GCC) for best results with valgrind tests" >&6;} +for ac_prog in aspell +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ASPELL+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + case $ASPELL in + [\\/]* | ?:[\\/]*) + ac_cv_path_ASPELL="$ASPELL" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ASPELL="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ASPELL=$ac_cv_path_ASPELL +if test -n "$ASPELL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ASPELL" >&5 +$as_echo "$ASPELL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi - if test "x${VALGRIND}" != "xnone"; then - HAVE_VALGRIND_TRUE= - HAVE_VALGRIND_FALSE='#' -else - HAVE_VALGRIND_TRUE='#' - HAVE_VALGRIND_FALSE= -fi - - if test "x${with_valgrind}" = "xyes"; then - WITH_VALGRIND_TRUE= - WITH_VALGRIND_FALSE='#' -else - WITH_VALGRIND_TRUE='#' - WITH_VALGRIND_FALSE= -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build cppunit tests using valgrind support" >&5 -$as_echo_n "checking whether to build cppunit tests using valgrind support... " >&6; } -if test "x${with_valgrind}" = xyes && test "x${have_cppunit}" = xyes ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } + test -n "$ASPELL" && break +done +test -n "$ASPELL" || ASPELL="none" + + if test "x$ASPELL" != "xnone"; then + HAVE_ASPELL_TRUE= + HAVE_ASPELL_FALSE='#' else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } + HAVE_ASPELL_TRUE='#' + HAVE_ASPELL_FALSE= fi + conftemp="${sysconfdir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" @@ -37981,7 +23139,6 @@ conftemp="${datadir}" eval conftemp=\"${conftemp}\" eval conftemp=\"${conftemp}\" DATADIR=${conftemp} -NUT_DATADIR=${conftemp} cat >>confdefs.h <<_ACEOF #define DATADIR "${conftemp}" @@ -38008,147 +23165,47 @@ cat >>confdefs.h <<_ACEOF _ACEOF -conftemp="${libdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -LIBDIR=${conftemp} -cat >>confdefs.h <<_ACEOF -#define LIBDIR "${conftemp}" -_ACEOF -conftemp="${libexecdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -LIBEXECDIR=${conftemp} -cat >>confdefs.h <<_ACEOF -#define LIBEXECDIR "${conftemp}" -_ACEOF -if test "${nut_with_snmp}" = "yes" -a "${nut_have_libnetsnmp}" != "yes"; then - as_fn_error $? "Net-SNMP libraries not found, required for SNMP drivers" "$LINENO" 5 -fi -if test "${nut_with_snmp}" != "no"; then - nut_with_snmp="${nut_have_libnetsnmp}" -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build SNMP drivers" >&5 -$as_echo_n "checking whether to build SNMP drivers... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${nut_with_snmp} " >&5 -$as_echo "${nut_with_snmp} " >&6; } - if test -z "${nut_report_feature_flag}"; then - nut_report_feature_flag="1" - ac_clean_files="${ac_clean_files} conf_nut_report_feature" - echo > conf_nut_report_feature - echo "Configuration summary:" >> conf_nut_report_feature - echo "======================" >> conf_nut_report_feature - fi - echo "build SNMP drivers: ${nut_with_snmp} " >> conf_nut_report_feature - if test "${nut_with_snmp}" = "yes"; then - WITH_SNMP_TRUE= - WITH_SNMP_FALSE='#' -else - WITH_SNMP_TRUE='#' - WITH_SNMP_FALSE= -fi - if test "${nut_with_snmp}" = "yes"; then -cat >>confdefs.h <<_ACEOF -#define WITH_SNMP 1 -_ACEOF - fi - if test "${nut_have_libsnmp}" = "yes"; then - HAVE_SNMP_TRUE= - HAVE_SNMP_FALSE='#' -else - HAVE_SNMP_TRUE='#' - HAVE_SNMP_FALSE= -fi -if test -n "${host_alias}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_HOST_ALIAS "${host_alias}" -_ACEOF -else - if test -n "${host}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_HOST_ALIAS "${host}" -_ACEOF - fi -fi -if test -n "${build_alias}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_BUILD_ALIAS "${build_alias}" -_ACEOF -else - if test -n "${build}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_BUILD_ALIAS "${build}" -_ACEOF - fi -fi -if test -n "${target_alias}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_TARGET_ALIAS "${target_alias}" -_ACEOF -else - if test -n "${target}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_TARGET_ALIAS "${target}" -_ACEOF - fi -fi -if test -n "${host_cpu}" -a -n "${host_os}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_HOST_SHORT_ALIAS "${host_cpu}-${host_os}" -_ACEOF -fi -if test -n "${build_cpu}" -a -n "${build_os}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_BUILD_SHORT_ALIAS "${build_cpu}-${build_os}" -_ACEOF -fi -if test -n "${target_cpu}" -a -n "${target_os}" ; then -cat >>confdefs.h <<_ACEOF -#define AUTOTOOLS_TARGET_SHORT_ALIAS "${target_cpu}-${target_os}" -_ACEOF -fi -now=`TZ=UTC date +%Y-%m-%d` @@ -38163,777 +23220,7 @@ now=`TZ=UTC date +%Y-%m-%d` - - - - - - - - - - - - - - - - - - - - - - - - - - -NUT_DATADIR=`eval echo "${DATADIR}"` - -NUT_LIBEXECDIR=`eval echo "${LIBEXECDIR}"` - - - - - - - - - - - - - - - - - - - - - - if test "x$GCC" = xyes -o "x$CLANGCC" = xyes; then : - case "${CFLAGS}" in #( - *-std=*) : - ;; #( - *) : - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -std=gnu99" >&5 -$as_echo_n "checking whether C compiler accepts -std=gnu99... " >&6; } -if ${ax_cv_check_cflags__Werror__std_gnu99+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CFLAGS - CFLAGS="$CFLAGS -Werror -std=gnu99" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - ax_cv_check_cflags__Werror__std_gnu99=no -else - ax_cv_check_cflags__Werror__std_gnu99=yes -fi -else - ax_cv_check_cflags__Werror__std_gnu99=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags__Werror__std_gnu99" >&5 -$as_echo "$ax_cv_check_cflags__Werror__std_gnu99" >&6; } -if test "x$ax_cv_check_cflags__Werror__std_gnu99" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler" >&5 -$as_echo "$as_me: Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler" >&6;} - CFLAGS="$CFLAGS -std=gnu99" - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ;; -esac - -fi - - if test "x$GCC" = xyes -o "x$CLANGCC" = xyes; then : - case "${CXXFLAGS}" in #( - *-std=*) : - ;; #( - *) : - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts -std=gnu++11" >&5 -$as_echo_n "checking whether C++ compiler accepts -std=gnu++11... " >&6; } -if ${ax_cv_check_cxxflags__Werror__std_gnupp11+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ax_check_save_flags=$CXXFLAGS - CXXFLAGS="$CXXFLAGS -Werror -std=gnu++11" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - if grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null; then : - ax_cv_check_cxxflags__Werror__std_gnupp11=no -else - ax_cv_check_cxxflags__Werror__std_gnupp11=yes -fi -else - ax_cv_check_cxxflags__Werror__std_gnupp11=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - CXXFLAGS=$ax_check_save_flags -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cxxflags__Werror__std_gnupp11" >&5 -$as_echo "$ax_cv_check_cxxflags__Werror__std_gnupp11" >&6; } -if test "x$ax_cv_check_cxxflags__Werror__std_gnupp11" = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler" >&5 -$as_echo "$as_me: Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler" >&6;} - CXXFLAGS="$CXXFLAGS -std=gnu++11" - -else - : -fi - - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - ;; -esac - -fi - - - -nut_warning_difficulty="medium" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to pre-set warnings (from '${nut_enable_warnings}')" >&5 -$as_echo_n "checking whether to pre-set warnings (from '${nut_enable_warnings}')... " >&6; } -case "${nut_enable_warnings}" in #( - no|all|gcc-legacy|gcc-minimal|clang-minimal|gcc-medium|clang-medium|gcc-hard|clang-hard) : - ;; #( - clang) : - nut_enable_warnings="${nut_enable_warnings}-${nut_warning_difficulty}" ;; #( - gcc) : - - case "${CFLAGS}" in #( - *89*|*90*|*ansi*) : - nut_enable_warnings="${nut_enable_warnings}-minimal" ;; #( - *) : - nut_enable_warnings="${nut_enable_warnings}-${nut_warning_difficulty}" - ;; -esac ;; #( - yes|auto|"") : - - if test "${CLANGCC}" = "yes"; then : - nut_enable_warnings="clang-${nut_warning_difficulty}" -else - if test "${GCC}" = "yes"; then : - - case "${CFLAGS}" in #( - *89*|*90*|*ansi*) : - nut_enable_warnings="gcc-minimal" ;; #( - *) : - case "`$CC --version | grep -i gcc`" in #( - *" "1.*|*" "2.*|3.*|*" "4.0*|*" "4.1*|*" "4.2*|*" "4.3*) : - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Very old GCC in use, disabling warnings" >&5 -$as_echo "$as_me: WARNING: Very old GCC in use, disabling warnings" >&2;} - nut_enable_Werror="no" - nut_enable_warnings="no" ;; #( - *" "4.4*|*" "4.5*|*" "4.6*|*" "4.7*|*" "4.8*) : - nut_enable_warnings="gcc-legacy" ;; #( - *) : - nut_enable_warnings="gcc-${nut_warning_difficulty}" - ;; -esac - ;; -esac -else - nut_enable_warnings="all" -fi - -fi - ;; #( - hard|auto-hard|auto=hard) : - - if test "${CLANGCC}" = "yes"; then : - nut_enable_warnings="clang-hard" -else - if test "${GCC}" = "yes"; then : - nut_enable_warnings="gcc-hard" -else - nut_enable_warnings="all" -fi - -fi - ;; #( - medium|auto-medium|auto=medium) : - - if test "${CLANGCC}" = "yes"; then : - nut_enable_warnings="clang-medium" -else - if test "${GCC}" = "yes"; then : - nut_enable_warnings="gcc-medium" -else - nut_enable_warnings="all" -fi - -fi - ;; #( - minimal|auto-minimal|auto=minimal) : - - if test "${CLANGCC}" = "yes"; then : - nut_enable_warnings="clang-minimal" -else - if test "${GCC}" = "yes"; then : - nut_enable_warnings="gcc-minimal" -else - nut_enable_warnings="all" -fi - -fi - ;; #( - legacy) : - if test "${GCC}" = "yes"; then : - nut_enable_warnings="gcc-legacy" -else - nut_enable_warnings="no" -fi ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unsupported variant for --enable-warnings=${nut_enable_warnings}, ignored" >&5 -$as_echo "$as_me: WARNING: Unsupported variant for --enable-warnings=${nut_enable_warnings}, ignored" >&2;} - nut_enable_warnings="no" - - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"${nut_enable_warnings}\"" >&5 -$as_echo "\"${nut_enable_warnings}\"" >&6; } - -case "${nut_enable_warnings}" in #( - all) : - - CFLAGS="${CFLAGS} -Wall" - CXXFLAGS="${CXXFLAGS} -Wall" - ;; #( - clang-hard) : - - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -pedantic" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat" - ;; #( - clang-medium) : - - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -pedantic -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat" - ;; #( - clang-minimal) : - - CFLAGS="${CFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation" - ;; #( - gcc-legacy) : - CFLAGS="${CFLAGS} -Wall -Wsign-compare" ;; #( - gcc-minimal) : - - CFLAGS="${CFLAGS} -Wall -Wsign-compare" - CXXFLAGS="${CXXFLAGS} -Wall -Wextra" - case "${CFLAGS}" in #( - *89*|*90*|*ansi*) : - ;; #( - *) : - CFLAGS="${CFLAGS} -Wextra -pedantic" - ;; -esac - ;; #( - gcc-medium|gcc-hard) : - - CFLAGS="${CFLAGS} -Wno-system-headers -Wall -Wextra -Wsign-compare" - CXXFLAGS="${CXXFLAGS} -Wno-system-headers -Wall -Wextra" - case "${CFLAGS}" in #( - *89*|*90*|*ansi*) : - ;; #( - *) : - CFLAGS="${CFLAGS} -pedantic" - ;; -esac - - ;; #( - *) : - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to make warnings fatal" >&5 -$as_echo_n "checking whether to make warnings fatal... " >&6; } -case "${nut_enable_Werror}" in #( - yes|auto) : - - CFLAGS="${CFLAGS} -Werror" - CXXFLAGS="${CXXFLAGS} -Werror" - ;; #( - no) : - - CFLAGS="${CFLAGS} -Wno-error" - CXXFLAGS="${CXXFLAGS} -Wno-error" - - ;; #( - *) : - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"${nut_enable_Werror}\"" >&5 -$as_echo "\"${nut_enable_Werror}\"" >&6; } - -ac_fn_c_check_header_mongrel "$LINENO" "string.h" "ac_cv_header_string_h" "$ac_includes_default" -if test "x$ac_cv_header_string_h" = xyes; then : - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - CFLAGS_SAVED="${CFLAGS}" - CFLAGS_BUILTIN_STR="-fno-builtin-strchr -fno-builtin-strcmp -fno-builtin-strncmp" - CFLAGS="${CFLAGS} -Werror -Wunreachable-code ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we should disable string built-ins" >&5 -$as_echo_n "checking whether we should disable string built-ins... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -char *s = "v1", c = '%'; -if (strcmp(s, "v1") != 0) return 1; -if (strchr(s, '1') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, they are not a problem" >&5 -$as_echo "no, they are not a problem" >&6; } -else - CFLAGS="${CFLAGS_BUILTIN_STR} ${CFLAGS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -char *s = "v1", c = '%'; -if (strcmp(s, "v1") != 0) return 1; -if (strchr(s, '1') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_BUILTIN_STR} ${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, this solves a problem" >&5 -$as_echo "yes, this solves a problem" >&6; } -else - CFLAGS="${CFLAGS_SAVED} -Werror -Wno-unreachable-code ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -char *s = "mibs", c = '%'; -/* Macro version of strcmp() has problems with strings shorter than - * 3 or 4 bytes, so to avoid nailing "-Warray-bounds" as well, - * here we just test for longer strings - existing NUT sources were - * fixed for this situation already */ -if (strcmp(s, "mibs") != 0) return 1; -if (strchr(s, 'b') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_SAVED}" - LIBLTDL_CFLAGS="${LIBLTDL_CFLAGS} -Wno-unreachable-code" - LIBNETSNMP_CFLAGS="${LIBNETSNMP_CFLAGS} -Wno-unreachable-code" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, but -Wno-unreachable-code solves the problem for this compiler" >&5 -$as_echo "no, but -Wno-unreachable-code solves the problem for this compiler" >&6; } -else - CFLAGS="${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, this does not solve the problem or is not supported" >&5 -$as_echo "no, this does not solve the problem or is not supported" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi - - - -ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = xyes; then : - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - CFLAGS_SAVED="${CFLAGS}" - CFLAGS_BUILTIN_NTOHL="-fno-builtin-htonl -fno-builtin-ntohl" - CFLAGS="${CFLAGS} -Werror -Wunreachable-code -Wshadow ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we should disable htonl/ntohl built-ins" >&5 -$as_echo_n "checking whether we should disable htonl/ntohl built-ins... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) -/* no ";return 0;" here - autoconf adds one */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, they are not a problem" >&5 -$as_echo "no, they are not a problem" >&6; } -else - CFLAGS="${CFLAGS_BUILTIN_NTOHL} ${CFLAGS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) -/* no ";return 0;" here - autoconf adds one */ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_BUILTIN_NTOHL} ${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, this solves a problem" >&5 -$as_echo "yes, this solves a problem" >&6; } -else - CFLAGS="${CFLAGS_SAVED} -Werror -Wno-shadow ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - CFLAGS="${CFLAGS_SAVED}" - LIBLTDL_CFLAGS="${LIBLTDL_CFLAGS} -Wno-shadow" - LIBNETSNMP_CFLAGS="${LIBNETSNMP_CFLAGS} -Wno-shadow" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, but -Wno-shadow solves the problem for this compiler" >&5 -$as_echo "no, but -Wno-shadow solves the problem for this compiler" >&6; } -else - CFLAGS="${CFLAGS_SAVED}" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, this does not solve the problem or is not supported" >&5 -$as_echo "no, this does not solve the problem or is not supported" >&6; } - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -fi - - - - - if test -n "${CFLAGS_STASHED_WARNINGS}"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: Applying back the stashed CFLAGS warnings" >&5 -$as_echo "$as_me: Applying back the stashed CFLAGS warnings" >&6;} - CFLAGS="${CFLAGS} ${CFLAGS_STASHED_WARNINGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: Ended up with: '${CFLAGS}'" >&5 -$as_echo "$as_me: Ended up with: '${CFLAGS}'" >&6;} - -fi - - if test -n "${CPPFLAGS_STASHED_WARNINGS}"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: Applying back the stashed CPPFLAGS warnings" >&5 -$as_echo "$as_me: Applying back the stashed CPPFLAGS warnings" >&6;} - CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_STASHED_WARNINGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: Ended up with: '${CPPFLAGS}'" >&5 -$as_echo "$as_me: Ended up with: '${CPPFLAGS}'" >&6;} - -fi - - if test -n "${CXXFLAGS_STASHED_WARNINGS}"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: Applying back the stashed CXXFLAGS warnings" >&5 -$as_echo "$as_me: Applying back the stashed CXXFLAGS warnings" >&6;} - CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_STASHED_WARNINGS}" - { $as_echo "$as_me:${as_lineno-$LINENO}: Ended up with: '${CXXFLAGS}'" >&5 -$as_echo "$as_me: Ended up with: '${CXXFLAGS}'" >&6;} - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for top build dir for this configure run" >&5 -$as_echo_n "checking for top build dir for this configure run... " >&6; } -TOP_BUILDDIR="" -if test -n "${ac_abs_top_builddir}" && test -d "${ac_abs_top_builddir}"; then : - TOP_BUILDDIR="${ac_abs_top_builddir}" -else - if test -n "${ac_pwd}" && test -d "${ac_pwd}"; then : - TOP_BUILDDIR="${ac_pwd}" -else - TOP_BUILDDIR="`dirname "$0"`" - TOP_BUILDDIR="`cd "$TOP_BUILDDIR" && pwd`" || as_fn_error $? "Can not detect TOP_BUILDDIR" "$LINENO" 5 - -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: \"${TOP_BUILDDIR}\"" >&5 -$as_echo "\"${TOP_BUILDDIR}\"" >&6; } - -ABS_TOP_BUILDDIR="`cd "${TOP_BUILDDIR}" && pwd`" || as_fn_error $? "Can not detect ABS_TOP_BUILDDIR" "$LINENO" 5 -ABS_TOP_SRCDIR="`cd "${abs_srcdir}" && pwd`" || as_fn_error $? "Can not detect ABS_TOP_SRCDIR" "$LINENO" 5 - if test "${ABS_TOP_BUILDDIR}" = "${ABS_TOP_SRCDIR}"; then - BUILDING_IN_TREE_TRUE= - BUILDING_IN_TREE_FALSE='#' -else - BUILDING_IN_TREE_TRUE='#' - BUILDING_IN_TREE_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to customize ${TOP_BUILDDIR}/scripts/systemd/nut-common.tmpfiles.in for this system" >&5 -$as_echo_n "checking whether to customize ${TOP_BUILDDIR}/scripts/systemd/nut-common.tmpfiles.in for this system... " >&6; } -if test -n "$systemdtmpfilesdir"; then : - mkdir -p "${TOP_BUILDDIR}"/scripts/systemd - cat > "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -# State file (e.g. upsd to driver) and pidfile location for NUT: -d @STATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @STATEPATH@/nut -EOF - if test "$STATEPATH" != "$PIDPATH"; then : - cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @PIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @PIDPATH@/nut -EOF -fi - if test -n "$ALTPIDPATH" && test "$STATEPATH" != "$ALTPIDPATH" && test "$PIDPATH" != "$ALTPIDPATH"; then : - cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @ALTPIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @ALTPIDPATH@/nut -EOF -fi - if test -n "$ALTSTATEPATH" && test "$STATEPATH" != "$ALTSTATEPATH" && test "$ALTSTATEPATH" != "$ALTPIDPATH" && test "$PIDPATH" != "$ALTSTATEPATH"; then : - cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @ALTSTATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @ALTSTATEPATH@/nut -EOF -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: Generating \"data\" files from templates, see below for executable scripts" >&5 -$as_echo "$as_me: Generating \"data\" files from templates, see below for executable scripts" >&6;} -ac_config_files="$ac_config_files clients/Makefile common/Makefile conf/Makefile conf/upsmon.conf.sample conf/upssched.conf.sample data/html/header.html data/html/Makefile data/Makefile data/driver.list docs/Makefile docs/cables/Makefile docs/docinfo.xml docs/man/Makefile drivers/Makefile include/Makefile lib/libupsclient-config lib/libupsclient.pc lib/libnutclient.pc lib/libnutclientstub.pc lib/libnutscan.pc lib/Makefile scripts/Aix/nut-aix.spec scripts/augeas/Makefile scripts/augeas/nutnutconf.aug scripts/augeas/nutupsdconf.aug scripts/augeas/nutupsdusers.aug scripts/augeas/nutupsmonconf.aug scripts/augeas/nutupsschedconf.aug scripts/augeas/nuthostsconf.aug scripts/augeas/nutupssetconf.aug scripts/avahi/nut.service scripts/devd/Makefile scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/HP-UX/nut.psf scripts/python/Makefile scripts/python/module/PyNUT.py scripts/upsdrvsvcctl/Makefile scripts/systemd/Makefile scripts/systemd/nut-common.tmpfiles scripts/systemd/nut-driver@.service scripts/systemd/nut-monitor.service scripts/systemd/nut-server.service scripts/systemd/nut-driver-enumerator.service scripts/systemd/nut-driver-enumerator.path scripts/Solaris/nut-driver-enumerator.xml scripts/Solaris/nut-driver.xml scripts/Solaris/nut-monitor.xml scripts/Solaris/nut-server.xml scripts/Solaris/nut.xml scripts/Solaris/Makefile scripts/Solaris/pkginfo scripts/udev/Makefile scripts/udev/nut-ipmipsu.rules scripts/ufw/Makefile scripts/ufw/nut.ufw.profile scripts/Makefile server/Makefile tools/Makefile tools/nut-scanner/Makefile tests/Makefile tests/NIT/Makefile Makefile" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: Generating templated script files that should be marked executable" >&5 -$as_echo "$as_me: Generating templated script files that should be marked executable" >&6;} - - ac_config_files="$ac_config_files scripts/Aix/nut.init" - - - ac_config_files="$ac_config_files scripts/HP-UX/postinstall" - - - ac_config_files="$ac_config_files scripts/python/app/NUT-Monitor-py2gtk2" - - - ac_config_files="$ac_config_files scripts/python/app/NUT-Monitor-py3qt5" - - - ac_config_files="$ac_config_files scripts/augeas/gen-nutupsconf-aug.py" - - - ac_config_files="$ac_config_files scripts/python/module/test_nutclient.py" - - - ac_config_files="$ac_config_files scripts/upsdrvsvcctl/nut-driver-enumerator.sh" - - - ac_config_files="$ac_config_files scripts/upsdrvsvcctl/upsdrvsvcctl" - - - ac_config_files="$ac_config_files scripts/systemd/nutshutdown" - - - ac_config_files="$ac_config_files scripts/Solaris/svc-nut-server" - - - ac_config_files="$ac_config_files scripts/Solaris/svc-nut-monitor" - - - ac_config_files="$ac_config_files scripts/Solaris/precheck.py" - - - ac_config_files="$ac_config_files scripts/Solaris/preinstall" - - - ac_config_files="$ac_config_files scripts/Solaris/postinstall" - - - ac_config_files="$ac_config_files scripts/Solaris/preremove" - - - ac_config_files="$ac_config_files scripts/Solaris/postremove" - - - ac_config_files="$ac_config_files scripts/Solaris/preproto.pl" - - - ac_config_files="$ac_config_files scripts/Solaris/nut" - - - ac_config_files="$ac_config_files tools/gitlog2changelog.py" - - - ac_config_files="$ac_config_files tools/nut-snmpinfo.py" - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: Generating templated script files whose templates might have been generated (or not) by autogen.sh calling our helper scripts" >&5 -$as_echo "$as_me: Generating templated script files whose templates might have been generated (or not) by autogen.sh calling our helper scripts" >&6;} - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to generate scripts/augeas/nutupsconf.aug" >&5 -$as_echo_n "checking whether to generate scripts/augeas/nutupsconf.aug... " >&6; } - if test -s scripts/augeas/nutupsconf.aug.in && ! test -f scripts/augeas/nutupsconf.aug.in.AUTOGEN_WITHOUT; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ac_config_files="$ac_config_files scripts/augeas/nutupsconf.aug" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to generate scripts/udev/nut-usbups.rules" >&5 -$as_echo_n "checking whether to generate scripts/udev/nut-usbups.rules... " >&6; } - if test -s scripts/udev/nut-usbups.rules.in && ! test -f scripts/udev/nut-usbups.rules.in.AUTOGEN_WITHOUT; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ac_config_files="$ac_config_files scripts/udev/nut-usbups.rules" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to generate scripts/devd/nut-usb.conf" >&5 -$as_echo_n "checking whether to generate scripts/devd/nut-usb.conf... " >&6; } - if test -s scripts/devd/nut-usb.conf.in && ! test -f scripts/devd/nut-usb.conf.in.AUTOGEN_WITHOUT; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - ac_config_files="$ac_config_files scripts/devd/nut-usb.conf" - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - -fi - +ac_config_files="$ac_config_files clients/Makefile common/Makefile conf/Makefile conf/upsmon.conf.sample conf/upssched.conf.sample data/html/header.html data/html/Makefile data/Makefile data/driver.list docs/Makefile docs/man/Makefile docs/website/Makefile drivers/Makefile include/Makefile lib/libupsclient-config lib/libupsclient.pc lib/libnutclient.pc lib/libnutscan.pc lib/Makefile scripts/augeas/Makefile scripts/augeas/nutnutconf.aug scripts/augeas/nutupsconf.aug scripts/augeas/nutupsdconf.aug scripts/augeas/nutupsdusers.aug scripts/augeas/nutupsmonconf.aug scripts/augeas/nutupsschedconf.aug scripts/augeas/nuthostsconf.aug scripts/augeas/nutupssetconf.aug scripts/avahi/nut.service scripts/hal/Makefile scripts/hal/ups-nut-device.fdi scripts/hotplug/Makefile scripts/hotplug/libhidups scripts/HP-UX/nut.psf scripts/HP-UX/postinstall scripts/python/Makefile scripts/systemd/Makefile scripts/systemd/nut-driver.service scripts/systemd/nut-monitor.service scripts/systemd/nut-server.service scripts/systemd/nutshutdown scripts/Solaris/Makefile scripts/Solaris/pkginfo scripts/Solaris/postinstall scripts/Solaris/preremove scripts/Solaris/nut scripts/udev/Makefile scripts/udev/nut-ipmipsu.rules scripts/udev/nut-usbups.rules scripts/ufw/nut.ufw.profile scripts/Makefile server/Makefile tools/Makefile tools/nut-scanner/Makefile tests/Makefile Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -39044,14 +23331,6 @@ LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 -$as_echo_n "checking that generated files are newer than configure... " >&6; } - if test -n "$am_sleep_pid"; then - # Hide warnings about reused PIDs. - wait $am_sleep_pid 2>/dev/null - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 -$as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' @@ -39072,49 +23351,33 @@ if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_PYTHON_TRUE}" && test -z "${HAVE_PYTHON_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PYTHON\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_PYTHON2_TRUE}" && test -z "${HAVE_PYTHON2_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PYTHON2\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_PYTHON3_TRUE}" && test -z "${HAVE_PYTHON3_FALSE}"; then - as_fn_error $? "conditional \"HAVE_PYTHON3\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${SOME_DRIVERS_TRUE}" && test -z "${SOME_DRIVERS_FALSE}"; then - as_fn_error $? "conditional \"SOME_DRIVERS\" was never defined. +if test -z "${HAVE_CPPUNIT_TRUE}" && test -z "${HAVE_CPPUNIT_FALSE}"; then + as_fn_error $? "conditional \"HAVE_CPPUNIT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_SERIAL_TRUE}" && test -z "${WITH_SERIAL_FALSE}"; then as_fn_error $? "conditional \"WITH_SERIAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_LIBUSB_1_0_TRUE}" && test -z "${WITH_LIBUSB_1_0_FALSE}"; then - as_fn_error $? "conditional \"WITH_LIBUSB_1_0\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_LIBUSB_0_1_TRUE}" && test -z "${WITH_LIBUSB_0_1_FALSE}"; then - as_fn_error $? "conditional \"WITH_LIBUSB_0_1\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${WITH_USB_TRUE}" && test -z "${WITH_USB_FALSE}"; then as_fn_error $? "conditional \"WITH_USB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_NEON_TRUE}" && test -z "${WITH_NEON_FALSE}"; then - as_fn_error $? "conditional \"WITH_NEON\" was never defined. +if test -z "${WITH_SNMP_TRUE}" && test -z "${WITH_SNMP_FALSE}"; then + as_fn_error $? "conditional \"WITH_SNMP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_NEON_TRUE}" && test -z "${HAVE_NEON_FALSE}"; then - as_fn_error $? "conditional \"HAVE_NEON\" was never defined. +if test -z "${WITH_NEON_TRUE}" && test -z "${WITH_NEON_FALSE}"; then + as_fn_error $? "conditional \"WITH_NEON\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_AVAHI_TRUE}" && test -z "${WITH_AVAHI_FALSE}"; then @@ -39125,10 +23388,6 @@ if test -z "${WITH_LIBPOWERMAN_TRUE}" && test -z "${WITH_LIBPOWERMAN_FALSE}"; th as_fn_error $? "conditional \"WITH_LIBPOWERMAN\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_MODBUS_TRUE}" && test -z "${WITH_MODBUS_FALSE}"; then - as_fn_error $? "conditional \"WITH_MODBUS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${WITH_IPMI_TRUE}" && test -z "${WITH_IPMI_FALSE}"; then as_fn_error $? "conditional \"WITH_IPMI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -39141,10 +23400,6 @@ if test -z "${WITH_MACOSX_TRUE}" && test -z "${WITH_MACOSX_FALSE}"; then as_fn_error $? "conditional \"WITH_MACOSX\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_LINUX_I2C_TRUE}" && test -z "${WITH_LINUX_I2C_FALSE}"; then - as_fn_error $? "conditional \"WITH_LINUX_I2C\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${WITH_NSS_TRUE}" && test -z "${WITH_NSS_FALSE}"; then as_fn_error $? "conditional \"WITH_NSS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -39169,52 +23424,20 @@ if test -z "${WITH_CGI_TRUE}" && test -z "${WITH_CGI_FALSE}"; then as_fn_error $? "conditional \"WITH_CGI\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_CPPCHECK_TRUE}" && test -z "${HAVE_CPPCHECK_FALSE}"; then - as_fn_error $? "conditional \"HAVE_CPPCHECK\" was never defined. +if test -z "${WITH_HAL_TRUE}" && test -z "${WITH_HAL_FALSE}"; then + as_fn_error $? "conditional \"WITH_HAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_CPPCHECK_TRUE}" && test -z "${WITH_CPPCHECK_FALSE}"; then - as_fn_error $? "conditional \"WITH_CPPCHECK\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_CHECK_NIT_TRUE}" && test -z "${WITH_CHECK_NIT_FALSE}"; then - as_fn_error $? "conditional \"WITH_CHECK_NIT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${MANUALUPDATE_TRUE}" && test -z "${MANUALUPDATE_FALSE}"; then - as_fn_error $? "conditional \"MANUALUPDATE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_SOURCE_HIGHLIGHT_TRUE}" && test -z "${HAVE_SOURCE_HIGHLIGHT_FALSE}"; then - as_fn_error $? "conditional \"HAVE_SOURCE_HIGHLIGHT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_ASPELL_TRUE}" && test -z "${HAVE_ASPELL_FALSE}"; then - as_fn_error $? "conditional \"HAVE_ASPELL\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_ASCIIDOC_TRUE}" && test -z "${HAVE_ASCIIDOC_FALSE}"; then - as_fn_error $? "conditional \"HAVE_ASCIIDOC\" was never defined. +if test -z "${WITH_HAL_TRUE}" && test -z "${WITH_HAL_FALSE}"; then + as_fn_error $? "conditional \"WITH_HAL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_ASCIIDOC_TRUE}" && test -z "${WITH_ASCIIDOC_FALSE}"; then as_fn_error $? "conditional \"WITH_ASCIIDOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_DOCS_TRUE}" && test -z "${WITH_DOCS_FALSE}"; then - as_fn_error $? "conditional \"WITH_DOCS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_MANS_TRUE}" && test -z "${WITH_MANS_FALSE}"; then - as_fn_error $? "conditional \"WITH_MANS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${SKIP_MANS_TRUE}" && test -z "${SKIP_MANS_FALSE}"; then - as_fn_error $? "conditional \"SKIP_MANS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${DOC_INSTALL_DISTED_MANS_TRUE}" && test -z "${DOC_INSTALL_DISTED_MANS_FALSE}"; then - as_fn_error $? "conditional \"DOC_INSTALL_DISTED_MANS\" was never defined. +if test -z "${HAVE_ASCIIDOC_TRUE}" && test -z "${HAVE_ASCIIDOC_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ASCIIDOC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${WITH_DEV_TRUE}" && test -z "${WITH_DEV_FALSE}"; then @@ -39225,42 +23448,18 @@ if test -z "${WITH_DEV_TRUE}" && test -z "${WITH_DEV_FALSE}"; then as_fn_error $? "conditional \"WITH_DEV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${SOME_DRIVERS_TRUE}" && test -z "${SOME_DRIVERS_FALSE}"; then + as_fn_error $? "conditional \"SOME_DRIVERS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${WITH_PKG_CONFIG_TRUE}" && test -z "${WITH_PKG_CONFIG_FALSE}"; then as_fn_error $? "conditional \"WITH_PKG_CONFIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_SOLARIS_SMF_TRUE}" && test -z "${WITH_SOLARIS_SMF_FALSE}"; then - as_fn_error $? "conditional \"WITH_SOLARIS_SMF\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_SOLARIS_PKG_SVR4_TRUE}" && test -z "${WITH_SOLARIS_PKG_SVR4_FALSE}"; then - as_fn_error $? "conditional \"WITH_SOLARIS_PKG_SVR4\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_SOLARIS_PKG_IPS_TRUE}" && test -z "${WITH_SOLARIS_PKG_IPS_FALSE}"; then - as_fn_error $? "conditional \"WITH_SOLARIS_PKG_IPS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${HAVE_SYSTEMD_TRUE}" && test -z "${HAVE_SYSTEMD_FALSE}"; then as_fn_error $? "conditional \"HAVE_SYSTEMD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${HAVE_CXX11_TRUE}" && test -z "${HAVE_CXX11_FALSE}"; then - as_fn_error $? "conditional \"HAVE_CXX11\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_CPPUNIT_TRUE}" && test -z "${HAVE_CPPUNIT_FALSE}"; then - as_fn_error $? "conditional \"HAVE_CPPUNIT\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_AUGLENS_TRUE}" && test -z "${WITH_AUGLENS_FALSE}"; then - as_fn_error $? "conditional \"WITH_AUGLENS\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_AUGPARSE_TRUE}" && test -z "${HAVE_AUGPARSE_FALSE}"; then - as_fn_error $? "conditional \"HAVE_AUGPARSE\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${WITH_HOTPLUG_TRUE}" && test -z "${WITH_HOTPLUG_FALSE}"; then as_fn_error $? "conditional \"WITH_HOTPLUG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -39269,32 +23468,12 @@ if test -z "${WITH_UDEV_TRUE}" && test -z "${WITH_UDEV_FALSE}"; then as_fn_error $? "conditional \"WITH_UDEV\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${WITH_DEVD_TRUE}" && test -z "${WITH_DEVD_FALSE}"; then - as_fn_error $? "conditional \"WITH_DEVD\" was never defined. +if test -z "${MANUALUPDATE_TRUE}" && test -z "${MANUALUPDATE_FALSE}"; then + as_fn_error $? "conditional \"MANUALUPDATE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -if test -z "${SYSTEM_AIX_TRUE}" && test -z "${SYSTEM_AIX_FALSE}"; then - as_fn_error $? "conditional \"SYSTEM_AIX\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_VALGRIND_TRUE}" && test -z "${HAVE_VALGRIND_FALSE}"; then - as_fn_error $? "conditional \"HAVE_VALGRIND\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_VALGRIND_TRUE}" && test -z "${WITH_VALGRIND_FALSE}"; then - as_fn_error $? "conditional \"WITH_VALGRIND\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${WITH_SNMP_TRUE}" && test -z "${WITH_SNMP_FALSE}"; then - as_fn_error $? "conditional \"WITH_SNMP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${HAVE_SNMP_TRUE}" && test -z "${HAVE_SNMP_FALSE}"; then - as_fn_error $? "conditional \"HAVE_SNMP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi -if test -z "${BUILDING_IN_TREE_TRUE}" && test -z "${BUILDING_IN_TREE_FALSE}"; then - as_fn_error $? "conditional \"BUILDING_IN_TREE\" was never defined. +if test -z "${HAVE_ASPELL_TRUE}" && test -z "${HAVE_ASPELL_FALSE}"; then + as_fn_error $? "conditional \"HAVE_ASPELL\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi @@ -39694,7 +23873,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by nut $as_me 2.8.0, which was +This file was extended by nut $as_me 2.7.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -39754,13 +23933,13 @@ $config_headers Configuration commands: $config_commands -Report bugs to ." +Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -nut config.status 2.8.0 +nut config.status 2.7.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -39879,7 +24058,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # -AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout @@ -39895,7 +24074,6 @@ enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' @@ -39945,13 +24123,10 @@ compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' @@ -40016,8 +24191,7 @@ finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' -configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' @@ -40122,12 +24296,9 @@ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -lt_cv_nm_interface \ nm_file_list_spec \ -lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ @@ -40193,7 +24364,7 @@ postdeps_CXX \ compiler_lib_search_path_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -40220,8 +24391,7 @@ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ -configure_time_dlsearch_path \ -configure_time_lt_sys_library_path \ +sys_lib_dlsearch_path_spec \ reload_cmds_CXX \ old_archive_cmds_CXX \ old_archive_from_new_cmds_CXX \ @@ -40235,7 +24405,7 @@ prelink_cmds_CXX \ postlink_cmds_CXX; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -40244,16 +24414,19 @@ postlink_cmds_CXX; do done ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' -# See if we are running on zsh, and set the options that allow our +# See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}"; then +if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' @@ -40283,20 +24456,18 @@ do "data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;; "data/driver.list") CONFIG_FILES="$CONFIG_FILES data/driver.list" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; - "docs/cables/Makefile") CONFIG_FILES="$CONFIG_FILES docs/cables/Makefile" ;; - "docs/docinfo.xml") CONFIG_FILES="$CONFIG_FILES docs/docinfo.xml" ;; "docs/man/Makefile") CONFIG_FILES="$CONFIG_FILES docs/man/Makefile" ;; + "docs/website/Makefile") CONFIG_FILES="$CONFIG_FILES docs/website/Makefile" ;; "drivers/Makefile") CONFIG_FILES="$CONFIG_FILES drivers/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "lib/libupsclient-config") CONFIG_FILES="$CONFIG_FILES lib/libupsclient-config" ;; "lib/libupsclient.pc") CONFIG_FILES="$CONFIG_FILES lib/libupsclient.pc" ;; "lib/libnutclient.pc") CONFIG_FILES="$CONFIG_FILES lib/libnutclient.pc" ;; - "lib/libnutclientstub.pc") CONFIG_FILES="$CONFIG_FILES lib/libnutclientstub.pc" ;; "lib/libnutscan.pc") CONFIG_FILES="$CONFIG_FILES lib/libnutscan.pc" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; - "scripts/Aix/nut-aix.spec") CONFIG_FILES="$CONFIG_FILES scripts/Aix/nut-aix.spec" ;; "scripts/augeas/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/augeas/Makefile" ;; "scripts/augeas/nutnutconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutnutconf.aug" ;; + "scripts/augeas/nutupsconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsconf.aug" ;; "scripts/augeas/nutupsdconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsdconf.aug" ;; "scripts/augeas/nutupsdusers.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsdusers.aug" ;; "scripts/augeas/nutupsmonconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsmonconf.aug" ;; @@ -40304,61 +24475,33 @@ do "scripts/augeas/nuthostsconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nuthostsconf.aug" ;; "scripts/augeas/nutupssetconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupssetconf.aug" ;; "scripts/avahi/nut.service") CONFIG_FILES="$CONFIG_FILES scripts/avahi/nut.service" ;; - "scripts/devd/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/devd/Makefile" ;; + "scripts/hal/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/hal/Makefile" ;; + "scripts/hal/ups-nut-device.fdi") CONFIG_FILES="$CONFIG_FILES scripts/hal/ups-nut-device.fdi" ;; "scripts/hotplug/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/hotplug/Makefile" ;; "scripts/hotplug/libhidups") CONFIG_FILES="$CONFIG_FILES scripts/hotplug/libhidups" ;; "scripts/HP-UX/nut.psf") CONFIG_FILES="$CONFIG_FILES scripts/HP-UX/nut.psf" ;; + "scripts/HP-UX/postinstall") CONFIG_FILES="$CONFIG_FILES scripts/HP-UX/postinstall" ;; "scripts/python/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/python/Makefile" ;; - "scripts/python/module/PyNUT.py") CONFIG_FILES="$CONFIG_FILES scripts/python/module/PyNUT.py" ;; - "scripts/upsdrvsvcctl/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/upsdrvsvcctl/Makefile" ;; "scripts/systemd/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/systemd/Makefile" ;; - "scripts/systemd/nut-common.tmpfiles") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-common.tmpfiles" ;; - "scripts/systemd/nut-driver@.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-driver@.service" ;; + "scripts/systemd/nut-driver.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-driver.service" ;; "scripts/systemd/nut-monitor.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-monitor.service" ;; "scripts/systemd/nut-server.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-server.service" ;; - "scripts/systemd/nut-driver-enumerator.service") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-driver-enumerator.service" ;; - "scripts/systemd/nut-driver-enumerator.path") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nut-driver-enumerator.path" ;; - "scripts/Solaris/nut-driver-enumerator.xml") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut-driver-enumerator.xml" ;; - "scripts/Solaris/nut-driver.xml") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut-driver.xml" ;; - "scripts/Solaris/nut-monitor.xml") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut-monitor.xml" ;; - "scripts/Solaris/nut-server.xml") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut-server.xml" ;; - "scripts/Solaris/nut.xml") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut.xml" ;; + "scripts/systemd/nutshutdown") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nutshutdown" ;; "scripts/Solaris/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/Makefile" ;; "scripts/Solaris/pkginfo") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/pkginfo" ;; + "scripts/Solaris/postinstall") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/postinstall" ;; + "scripts/Solaris/preremove") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/preremove" ;; + "scripts/Solaris/nut") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut" ;; "scripts/udev/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/udev/Makefile" ;; "scripts/udev/nut-ipmipsu.rules") CONFIG_FILES="$CONFIG_FILES scripts/udev/nut-ipmipsu.rules" ;; - "scripts/ufw/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/ufw/Makefile" ;; + "scripts/udev/nut-usbups.rules") CONFIG_FILES="$CONFIG_FILES scripts/udev/nut-usbups.rules" ;; "scripts/ufw/nut.ufw.profile") CONFIG_FILES="$CONFIG_FILES scripts/ufw/nut.ufw.profile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "server/Makefile") CONFIG_FILES="$CONFIG_FILES server/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "tools/nut-scanner/Makefile") CONFIG_FILES="$CONFIG_FILES tools/nut-scanner/Makefile" ;; "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; - "tests/NIT/Makefile") CONFIG_FILES="$CONFIG_FILES tests/NIT/Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "scripts/Aix/nut.init") CONFIG_FILES="$CONFIG_FILES scripts/Aix/nut.init" ;; - "scripts/HP-UX/postinstall") CONFIG_FILES="$CONFIG_FILES scripts/HP-UX/postinstall" ;; - "scripts/python/app/NUT-Monitor-py2gtk2") CONFIG_FILES="$CONFIG_FILES scripts/python/app/NUT-Monitor-py2gtk2" ;; - "scripts/python/app/NUT-Monitor-py3qt5") CONFIG_FILES="$CONFIG_FILES scripts/python/app/NUT-Monitor-py3qt5" ;; - "scripts/augeas/gen-nutupsconf-aug.py") CONFIG_FILES="$CONFIG_FILES scripts/augeas/gen-nutupsconf-aug.py" ;; - "scripts/python/module/test_nutclient.py") CONFIG_FILES="$CONFIG_FILES scripts/python/module/test_nutclient.py" ;; - "scripts/upsdrvsvcctl/nut-driver-enumerator.sh") CONFIG_FILES="$CONFIG_FILES scripts/upsdrvsvcctl/nut-driver-enumerator.sh" ;; - "scripts/upsdrvsvcctl/upsdrvsvcctl") CONFIG_FILES="$CONFIG_FILES scripts/upsdrvsvcctl/upsdrvsvcctl" ;; - "scripts/systemd/nutshutdown") CONFIG_FILES="$CONFIG_FILES scripts/systemd/nutshutdown" ;; - "scripts/Solaris/svc-nut-server") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/svc-nut-server" ;; - "scripts/Solaris/svc-nut-monitor") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/svc-nut-monitor" ;; - "scripts/Solaris/precheck.py") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/precheck.py" ;; - "scripts/Solaris/preinstall") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/preinstall" ;; - "scripts/Solaris/postinstall") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/postinstall" ;; - "scripts/Solaris/preremove") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/preremove" ;; - "scripts/Solaris/postremove") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/postremove" ;; - "scripts/Solaris/preproto.pl") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/preproto.pl" ;; - "scripts/Solaris/nut") CONFIG_FILES="$CONFIG_FILES scripts/Solaris/nut" ;; - "tools/gitlog2changelog.py") CONFIG_FILES="$CONFIG_FILES tools/gitlog2changelog.py" ;; - "tools/nut-snmpinfo.py") CONFIG_FILES="$CONFIG_FILES tools/nut-snmpinfo.py" ;; - "scripts/augeas/nutupsconf.aug") CONFIG_FILES="$CONFIG_FILES scripts/augeas/nutupsconf.aug" ;; - "scripts/udev/nut-usbups.rules") CONFIG_FILES="$CONFIG_FILES scripts/udev/nut-usbups.rules" ;; - "scripts/devd/nut-usb.conf") CONFIG_FILES="$CONFIG_FILES scripts/devd/nut-usb.conf" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac @@ -40955,38 +25098,32 @@ $as_echo "$as_me: executing $ac_file commands" >&6;} case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Older Autoconf quotes --file arguments for eval, but not when files + # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. - # TODO: see whether this extra hack can be removed once we start - # requiring Autoconf 2.70 or later. - case $CONFIG_FILES in #( - *\'*) : - eval set x "$CONFIG_FILES" ;; #( - *) : - set x $CONFIG_FILES ;; #( - *) : - ;; -esac + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac shift - # Used to flag and report bootstrapping failures. - am_rc=0 - for am_mf + for mf do # Strip MF so we end up with the name of the file. - am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile which includes - # dependency-tracking related rules and includes. - # Grep'ing the whole file directly is not great: AIX grep has a line + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ - || continue - am_dirpart=`$as_dirname -- "$am_mf" || -$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$am_mf" : 'X\(//\)[^/]' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$am_mf" | + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -41004,100 +25141,108 @@ $as_echo X"$am_mf" | q } s/.*/./; q'` - am_filepart=`$as_basename -- "$am_mf" || -$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ - X"$am_mf" : 'X\(//\)$' \| \ - X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$am_mf" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } - /^X\/\(\/\/\)$/{ + /^X\(\/\/\)[^/].*/{ s//\1/ q } - /^X\/\(\/\).*/{ + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` - { echo "$as_me:$LINENO: cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles" >&5 - (cd "$am_dirpart" \ - && sed -e '/# am--include-marker/d' "$am_filepart" \ - | $MAKE -f - am--depfiles) >&5 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } || am_rc=$? + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done done - if test $am_rc -ne 0; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "Something went wrong bootstrapping makefile fragments - for automatic dependency tracking. If GNU make was not used, consider - re-running the configure script with MAKE=\"gmake\" (or whatever is - necessary). You can also try re-running configure with the - '--disable-dependency-tracking' option to at least be able to build - the package (albeit without support for automatic dependency tracking). -See \`config.log' for more details" "$LINENO" 5; } - fi - { am_dirpart=; unset am_dirpart;} - { am_filepart=; unset am_filepart;} - { am_mf=; unset am_mf;} - { am_rc=; unset am_rc;} - rm -f conftest-deps.mk } ;; "libtool":C) - # See if we are running on zsh, and set the options that allow our + # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}"; then + if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi - cfgfile=${ofile}T + cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL -# Generated automatically by $as_me ($PACKAGE) $VERSION + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. - -# Provide generalized library-building support services. -# Written by Gordon Matzigkeit, 1996 - -# Copyright (C) 2014 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or -# (at your option) any later version. # -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program or library that is built -# using GNU Libtool, you may include this file under the same -# distribution terms that you use for the rest of that program. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 # -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. -available_tags='CXX ' - -# Configured defaults for sys_lib_dlsearch_path munging. -: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} +available_tags="CXX " # ### BEGIN LIBTOOL CONFIG @@ -41117,9 +25262,6 @@ pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install -# Shared archive member basename,for filename based shared library versioning on AIX. -shared_archive_member_spec=$shared_archive_member_spec - # Shell to use when invoking shell scripts. SHELL=$lt_SHELL @@ -41237,27 +25379,18 @@ global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl -# Transform the output of nm into a list of symbols to manually relocate. -global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import - # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix -# The name lister interface. -nm_interface=$lt_lt_cv_nm_interface - # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec -# The root where to search for dependent libraries,and where our libraries should be installed. +# The root where to search for dependent libraries,and in which our libraries should be installed. lt_sysroot=$lt_sysroot -# Command to truncate a binary pipe. -lt_truncate_bin=$lt_lt_cv_truncate_bin - # The name of the directory that contains temporary libtool files. objdir=$objdir @@ -41348,11 +25481,8 @@ hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec -# Detected run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path - -# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. -configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen @@ -41445,13 +25575,13 @@ hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute @@ -41515,65 +25645,6 @@ compiler_lib_search_path=$lt_compiler_lib_search_path # ### END LIBTOOL CONFIG -_LT_EOF - - cat <<'_LT_EOF' >> "$cfgfile" - -# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE - -# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x$2 in - x) - ;; - *:) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" - ;; - x:*) - eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" - ;; - *) - eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" - ;; - esac -} - - -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in $*""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} - - -# ### END FUNCTIONS SHARED WITH CONFIGURE - _LT_EOF case $host_os in @@ -41582,7 +25653,7 @@ _LT_EOF # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. -if test set != "${COLLECT_NAMES+set}"; then +if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -41591,7 +25662,7 @@ _LT_EOF esac -ltmain=$ac_aux_dir/ltmain.sh +ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if @@ -41601,6 +25672,165 @@ ltmain=$ac_aux_dir/ltmain.sh sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -41687,13 +25917,13 @@ hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct_CXX -# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes # DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute_CXX @@ -41759,26 +25989,6 @@ compiler_lib_search_path=$lt_compiler_lib_search_path_CXX _LT_EOF ;; - "scripts/Aix/nut.init":F) chmod +x "scripts/Aix/nut.init" ;; - "scripts/HP-UX/postinstall":F) chmod +x "scripts/HP-UX/postinstall" ;; - "scripts/python/app/NUT-Monitor-py2gtk2":F) chmod +x "scripts/python/app/NUT-Monitor-py2gtk2" ;; - "scripts/python/app/NUT-Monitor-py3qt5":F) chmod +x "scripts/python/app/NUT-Monitor-py3qt5" ;; - "scripts/augeas/gen-nutupsconf-aug.py":F) chmod +x "scripts/augeas/gen-nutupsconf-aug.py" ;; - "scripts/python/module/test_nutclient.py":F) chmod +x "scripts/python/module/test_nutclient.py" ;; - "scripts/upsdrvsvcctl/nut-driver-enumerator.sh":F) chmod +x "scripts/upsdrvsvcctl/nut-driver-enumerator.sh" ;; - "scripts/upsdrvsvcctl/upsdrvsvcctl":F) chmod +x "scripts/upsdrvsvcctl/upsdrvsvcctl" ;; - "scripts/systemd/nutshutdown":F) chmod +x "scripts/systemd/nutshutdown" ;; - "scripts/Solaris/svc-nut-server":F) chmod +x "scripts/Solaris/svc-nut-server" ;; - "scripts/Solaris/svc-nut-monitor":F) chmod +x "scripts/Solaris/svc-nut-monitor" ;; - "scripts/Solaris/precheck.py":F) chmod +x "scripts/Solaris/precheck.py" ;; - "scripts/Solaris/preinstall":F) chmod +x "scripts/Solaris/preinstall" ;; - "scripts/Solaris/postinstall":F) chmod +x "scripts/Solaris/postinstall" ;; - "scripts/Solaris/preremove":F) chmod +x "scripts/Solaris/preremove" ;; - "scripts/Solaris/postremove":F) chmod +x "scripts/Solaris/postremove" ;; - "scripts/Solaris/preproto.pl":F) chmod +x "scripts/Solaris/preproto.pl" ;; - "scripts/Solaris/nut":F) chmod +x "scripts/Solaris/nut" ;; - "tools/gitlog2changelog.py":F) chmod +x "tools/gitlog2changelog.py" ;; - "tools/nut-snmpinfo.py":F) chmod +x "tools/nut-snmpinfo.py" ;; esac done # for ac_tag @@ -41821,12 +26031,3 @@ fi cat conf_nut_report_feature - echo "------------------" - echo "Compiler settings:" - printf 'CC \t:%s\n' "$CC" - printf 'CFLAGS \t:%s\n' "$CFLAGS" - printf 'CXX \t:%s\n' "$CXX" - printf 'CXXFLAGS\t:%s\n' "$CXXFLAGS" - printf 'CPP \t:%s\n' "$CPP" - printf 'CPPFLAGS\t:%s\n' "$CPPFLAGS" - diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 3aa26c2..0000000 --- a/configure.ac +++ /dev/null @@ -1,2969 +0,0 @@ -dnl +------------------------------------------------------------------+ -dnl | Network UPS Tools: configure.ac | -dnl +------------------------------------------------------------------+ - -dnl NUT version number is defined here, with a Git suffixed macro like -dnl NUT_VERSION_MACRO "2.7.4-2838-gdfc3ac08" -dnl in include/nut_version.h (generated by make) -AC_INIT([nut],[2.8.0],[https://github.com/networkupstools/nut/issues]) -AC_CONFIG_AUX_DIR([.]) -AC_CONFIG_SRCDIR(server/upsd.c) -AC_CONFIG_MACRO_DIR([m4]) -echo "Network UPS Tools version ${PACKAGE_VERSION}" -AC_CANONICAL_TARGET -NUT_CHECK_OS -NUT_STASH_WARNINGS -AC_CONFIG_HEADERS([include/config.h]) -AC_PREFIX_DEFAULT(/usr/local/ups) -AM_INIT_AUTOMAKE([subdir-objects]) - -dnl we need Autoconf 2.61 or better to enable features of Posix that are extensions to C -dnl (and actually 2.64 or better for m4/ax_check_compile_flag.m4 when it is sourced) -AC_MSG_CHECKING(for autoconf macro to enable system extensions) -m4_version_prereq(2.61, [ - AC_MSG_RESULT(yes) - AC_USE_SYSTEM_EXTENSIONS -], [ - AC_MSG_RESULT(no) -]) - -AC_PREREQ([2.64]) - -dnl Use "./configure --enable-maintainer-mode" to keep Makefile.in and Makefile -dnl in sync after Git updates. -AM_MAINTAINER_MODE - -dnl Some systems have older autotools without direct macro support for PKG_CONF* -NUT_CHECK_PKGCONFIG - - -dnl Various version related processing -dnl ---------------------------------- - -dnl # the following is commented out, because the UPS_VERSION macro now -dnl # resides in include/nut_version.h, which is generated by Makefile.am, -dnl # rather than in include/config.h, which is generated by configure. The -dnl # reason is that the SVN revision should be computed at compile time, -dnl # not configure time. -dnl AC_DEFINE_UNQUOTED(UPS_VERSION, "${PACKAGE_VERSION}", [NUT version]) - -dnl However, automatically define the tree version (mostly for AC_SUBST) -TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`" -AC_DEFINE_UNQUOTED(TREE_VERSION, "${TREE_VERSION}", [NUT tree version]) - -dnl Should not be necessary, since old servers have well-defined errors for -dnl unsupported commands: -NUT_NETVERSION="1.3" -AC_DEFINE_UNQUOTED(NUT_NETVERSION, "${NUT_NETVERSION}", [NUT network protocol version]) - - -dnl Fix this early so we can expand with eval later -test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" -test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}' - -CFLAGS=${CFLAGS-"-O"} - -dnl NOTE: for definition of NUT_* autoconf macros, see m4/ directory -dnl and docs/macros.txt - -dnl +------------------------------------------------------------------+ -dnl | default values for things later on (can be overridden) | - -STATEPATH="/var/state/ups" - -cgiexecdir='${exec_prefix}/cgi-bin' -driverexecdir='${exec_prefix}/bin' -htmldir='${prefix}/html' -pkgconfigdir='${libdir}/pkgconfig' -auglensdir='/usr/share/augeas/lenses/dist' -if test ! -d "${auglensdir}"; then - auglensdir='/usr/share/augeas/lenses' - if test ! -d "${auglensdir}"; then - auglensdir='' - fi -fi -hotplugdir='/etc/hotplug' -if test ! -d "${hotplugdir}"; then - hotplugdir='' -fi -udevdir='/lib/udev' -if test ! -d "${udevdir}"; then - udevdir='/etc/udev' - if test ! -d "${udevdir}"; then - udevdir='' - fi -fi - -devddir='/usr/local/etc/devd' -if test ! -d "${devddir}"; then - devddir='/etc/devd' - if test ! -d "${devddir}"; then - devddir='' - fi -fi - -RUN_AS_USER="nobody" -RUN_AS_GROUP="nobody" -AS_IF([test -n "`getent group nogroup`" && ! test -n "`getent group "${RUN_AS_GROUP}"`"], - [RUN_AS_GROUP="nogroup"] -) -PIDPATH="/var/run" - -dnl Define directory where LIBOBJS replacement functions are -AC_CONFIG_LIBOBJ_DIR([common]) - -dnl +------------------------------------------------------------------- - -dnl AC_PROG_CC -dnl Macro AC_PROG_CC_C99 is obsolete; use AC_PROG_CC -dnl Note that NUT does not support building with C89 anyway -dnl AC_PROG_CC_C99 -dnl Needed for per-target flags -AM_PROG_CC_C_O -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_CXX_C_O -AC_PROG_INSTALL -AC_PROG_MKDIR_P -AC_PROG_LN_S -AC_PROG_EGREP -AC_PATH_PROG(AR, ar) -AC_CHECK_TOOL(RANLIB, ranlib, :) -dnl Postpone call to LT_INIT/AC_CONFIG_FILES to allow disabling static lib -AC_C_BIGENDIAN -AC_C_INLINE -AC_C_FLEXIBLE_ARRAY_MEMBER -AC_C_VARARRAYS -dnl Note: the compiler/pragma/attr methods below are custom for NUT codebase: -NUT_COMPILER_FAMILY -dnl Help find warning/error details in a wall of text (must be processed before NUT_COMPILER_FAMILY_FLAGS): -NUT_ARG_ENABLE([Wcolor], - [Request that compiler output is colorized (no = leave it up to compiler defaults)], - [no]) -NUT_COMPILER_FAMILY_FLAGS -AX_C_PRAGMAS -AX_C___ATTRIBUTE__ -AX_C_PRINTF_STRING_NULL -AC_CHECK_FUNCS(flock lockf fcvt fcvtl pow10 round abs_val abs) - -AC_CHECK_HEADER([float.h], - [AC_DEFINE([HAVE_FLOAT_H], [1], - [Define to 1 if you have .])]) -AC_CHECK_HEADER([math.h], - [AC_DEFINE([HAVE_MATH_H], [1], - [Define to 1 if you have .])]) -AC_CHECK_FUNCS(fabs fabsf fabsl, [], [], -[#ifdef HAVE_MATH_H -# include -#endif -#ifdef HAVE_FLOAT_H -# include -#endif]) - -AC_CHECK_HEADER([limits.h], - [AC_DEFINE([HAVE_LIMITS_H], [1], - [Define to 1 if you have .])]) - -AC_CHECK_HEADER([signal.h], - [AC_DEFINE([HAVE_SIGNAL_H], [1], - [Define to 1 if you have .])]) - -AC_CHECK_HEADER([sys/signal.h], - [AC_DEFINE([HAVE_SYS_SIGNAL_H], [1], - [Define to 1 if you have .])]) - -AC_CHECK_HEADER([sys/resource.h], - [AC_MSG_CHECKING([for struct rlimit and getrlimit()]) - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -], -[struct rlimit limit; -getrlimit(RLIMIT_NOFILE, &limit); -/* Do not care about actual return value in this test, - * normally check for non-zero meaning to look in errno */ -] - )], - [AC_DEFINE([HAVE_SYS_RESOURCE_H], [1], - [Define to 1 if you have with usable struct rlimit and getrlimit().]) - AC_MSG_RESULT([ok]) - ], - [AC_MSG_RESULT([no])] - ) - AC_LANG_POP([C]) - ] -) - -AC_CHECK_HEADER([semaphore.h], - [AC_DEFINE([HAVE_SEMAPHORE_H], [1], - [Define to 1 if you have .]) - AC_MSG_CHECKING([for sem_t, sem_init() and sem_destroy()]) - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -], -[sem_t semaphore; -sem_init(&semaphore, 0, 4); -sem_destroy(&semaphore); -/* Do not care about actual return value in this test, - * normally check for non-zero meaning to look in errno */ -] - )], - [AC_DEFINE([HAVE_SEMAPHORE], [1], - [Define to 1 if you have with usable sem_t sem_init() and sem_destroy().]) - AC_MSG_RESULT([ok]) - ], - [AC_MSG_RESULT([no])] - ) - AC_LANG_POP([C]) - ] -) - -AC_CHECK_FUNCS(cfsetispeed tcsendbreak) -AC_CHECK_FUNCS(seteuid setsid getpassphrase) -AC_CHECK_FUNCS(on_exit strptime setlogmask) -AC_CHECK_DECLS(LOG_UPTO, [], [], [#include ]) - -dnl These common routines are not available in strict C standard library -dnl compilation modes (not part of ANSI or later standard), only in GNU, -dnl POSIX or other extension modes. Note that on modern systems they are -dnl available, just hidden in headers - so AC_CHECK_FUNCS() finds them -dnl by adding a declaration, while the "real" codebase can't use them. -AC_MSG_NOTICE( -[----------------------------------------------------------------------- -The next few tests look for required C library routines; if something is -not found, you may need to enable a different C standard or extension macro -version. You may also have to configure without extreme warning levels -since autotools tests fail those on their own and assume system lacks -stuff (although note we try to not involve standard -W* flags here). ------------------------------------------------------------------------]) -dnl# AC_CHECK_FUNCS(strcasecmp strncasecmp, -dnl# [], [AC_MSG_WARN([Required C library routine not found; try adding __EXTENSIONS__])]) -dnl These appear with CFLAGS="-std=c99 -D_POSIX_C_SOURCE=200112L": -dnl# Methods below currently do not cause build errors for C99+ modes so are -dnl# not tested as thoroughly as those further below: - AC_CHECK_FUNCS(strtok_r fileno localtime_r sigemptyset sigaction, - [], [AC_MSG_WARN([Required C library routine not found; try adding -D_POSIX_C_SOURCE=200112L])]) - -AC_LANG_PUSH([C]) - -AC_CHECK_HEADER([string.h], - [AC_DEFINE([HAVE_STRING_H], [1], - [Define to 1 if you have .])]) - -AC_CHECK_HEADER([strings.h], - [AC_DEFINE([HAVE_STRINGS_H], [1], - [Define to 1 if you have .])]) - -CODE_STRINGINCL='#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_STRINGS_H -#include -#endif' - -AC_CACHE_CHECK([for strcasecmp(s1,s2)], - [ac_cv_func_strcasecmp], - [AX_RUN_OR_LINK_IFELSE( - [AC_LANG_PROGRAM([$CODE_STRINGINCL], - [if (strcasecmp("STR1", "str1") != 0) return 1])], - [ac_cv_func_strcasecmp=yes], [ac_cv_func_strcasecmp=no] - )]) -AS_IF([test x"${ac_cv_func_strcasecmp}" = xyes], - [AC_DEFINE([HAVE_STRCASECMP], 1, [defined if standard library has, and C standard allows, the strcasecmp(s1,s2) method])], - [AC_MSG_WARN([Required C library routine strcasecmp not found; try adding __EXTENSIONS__])] - ) - -AC_CACHE_CHECK([for strncasecmp(s1,s2,n)], - [ac_cv_func_strncasecmp], - [AX_RUN_OR_LINK_IFELSE( - [AC_LANG_PROGRAM([$CODE_STRINGINCL], - [if (strncasecmp("STR1", "strX", 2) != 0) return 1])], - [ac_cv_func_strncasecmp=yes], [ac_cv_func_strncasecmp=no] - )]) -AS_IF([test x"${ac_cv_func_strncasecmp}" = xyes], - [AC_DEFINE([HAVE_STRNCASECMP], 1, [defined if standard library has, and C standard allows, the strncasecmp(s1,s2,n) method])], - [AC_MSG_WARN([Required C library routine strncasecmp not found; try adding __EXTENSIONS__])] - ) - -AC_CACHE_CHECK([for strdup(s)], - [ac_cv_func_strdup], - [AX_RUN_OR_LINK_IFELSE( - [AC_LANG_PROGRAM([$CODE_STRINGINCL], - [[int res = 0; -char *t = "Test"; -char *s = strdup(t); -if (!s || !(s[0]=='T'&&s[1]=='e'&&s[2]=='s'&&s[3]=='t'&&s[4]=='\0') || s == t) res = 1; -if (s) free (s); -if (res != 0) return res -/* autoconf adds ";return 0;" */ -]])], - [ac_cv_func_strdup=yes], [ac_cv_func_strdup=no] - )]) -AS_IF([test x"${ac_cv_func_strdup}" = xyes], - [AC_DEFINE([HAVE_STRDUP], 1, [defined if standard library has, and C standard allows, the strdup(s) method])], - [AC_MSG_WARN([Required C library routine strdup not found; try adding -D_POSIX_C_SOURCE=200112L])] - ) - -AC_CACHE_CHECK([for usleep(us)], - [ac_cv_func_usleep], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include - ]], - [[useconds_t us = 1000; -if (usleep(us) != 0) return 1 /* per doc, no erros are returned actually*/ -/* autoconf adds ";return 0;" */ -]])], - [ac_cv_func_usleep=yes], [ac_cv_func_usleep=no] - )]) -AS_IF([test x"${ac_cv_func_usleep}" = xyes], - [AC_DEFINE([HAVE_USLEEP], 1, [defined if standard library has, and C standard allows, the usleep(us) method])], - [AC_MSG_WARN([Required C library routine usleep not found; try adding -D_POSIX_C_SOURCE=200112L])] - ) - -AC_LANG_POP([C]) - -dnl These routines' arg types differ in strict C standard mode -dnl from what they use in the modes expected by NUT codebase: -dnl bind() : /usr/include/x86_64-linux-gnu/sys/socket.h:123:12: note: expected '__CONST_SOCKADDR_ARG {aka union }' but argument is of type 'struct sockaddr *' -dnl accept() : /usr/include/x86_64-linux-gnu/sys/socket.h:243:12: note: expected '__SOCKADDR_ARG {aka union }' but argument is of type 'struct sockaddr *' -dnl connect() : /usr/include/x86_64-linux-gnu/sys/socket.h:137:12: note: expected '__CONST_SOCKADDR_ARG {aka union }' but argument is of type 'const struct sockaddr *' -dnl sendto() : /usr/include/x86_64-linux-gnu/sys/socket.h:163:16: note: expected '__CONST_SOCKADDR_ARG {aka union }' but argument is of type 'struct sockaddr *' -dnl recvfrom() : /usr/include/x86_64-linux-gnu/bits/socket2.h:64:1: note: expected '__SOCKADDR_ARG {aka union }' but argument is of type 'struct sockaddr *' - -AC_MSG_CHECKING([whether ln -sr works]) -dnl We need to relative-symlink some files. Or hardlink. Or copy... -LN_S_R="cp -pR" -if test "$as_ln_s" = "ln -s" ; then - LN_S_R="ln" - DIR1="$(mktemp -d "dir1.XXXXXXX")" && \ - DIR2="$(mktemp -d "dir2.XXXXXXX")" && \ - touch "${DIR1}/a" && \ - $as_ln_s -r "${DIR1}/a" "${DIR2}/b" && \ - ls -la "${DIR2}/b" | grep '\.\./' > /dev/null && \ - LN_S_R="$as_ln_s -r" - rm -rf "${DIR1}" "${DIR2}" -fi -AC_SUBST([LN_S_R], [${LN_S_R}]) -if test "$LN_S_R" = "ln -s -r" ; then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no, using $LN_S_R]) -fi - -dnl the following may add stuff to LIBOBJS (is this still needed?) -AC_CHECK_FUNCS(vsnprintf snprintf, [], [ - AC_LIBOBJ(snprintf) - AC_TYPE_LONG_DOUBLE - AC_TYPE_LONG_LONG_INT -]) - -AC_REPLACE_FUNCS(setenv strerror atexit) - -case ${target_os} in - solaris2* ) - dnl On Solaris, this allows errno to use thread local storage - CFLAGS="${CFLAGS} -D_REENTRANT" - ;; - aix* ) - dnl On AIX, this allows errno to use thread local storage - CFLAGS="${CFLAGS} -D_REENTRANT" - ;; - hpux11* ) - dnl It seems like the thread safe string functions will not be included - dnl on 64 bit HP-UX unless we define _REENTRANT - CFLAGS="${CFLAGS} -D_REENTRANT" - ;; -esac - -dnl optind handling: -dnl need to check if unistd.h is enough, else try getopt.h, else need decls -AC_CHECK_DECLS(optind, [], [ - AC_CHECK_HEADERS(getopt.h, [ - AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed]) - ], [ - AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations]) - ], [AC_INCLUDES_DEFAULT]) -], [AC_INCLUDES_DEFAULT]) - -dnl do a 2nd check to ensure inclusion of getopt.h, in case optind is known -AC_CHECK_HEADERS(getopt.h, [ - AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed]) -], [ - AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations]) -], [AC_INCLUDES_DEFAULT]) - -dnl also check for getopt_long -AC_CHECK_FUNCS(getopt_long) - -dnl FreeBSD serial locking compatibility - look for uu_lock in libutil.h -AC_CHECK_DECLS(uu_lock, [ - AC_DEFINE(HAVE_UU_LOCK, 1, [Use uu_lock for locking (FreeBSD)]) - SERLIBS="-lutil" - dnl put in some better defaults for FreeBSD - RUN_AS_USER="uucp" -], [ - SERLIBS="" -], [ -#include -#include -]) - -AC_CHECK_DECLS(__func__, [], [ - AC_CHECK_DECLS(__FUNCTION__, [ - AC_DEFINE(__func__, __FUNCTION__, [Replace missing __func__ declaration]) - ], [ - AC_DEFINE(__func__, __LINE__, [Replace missing __func__ declaration]) - ], [AC_INCLUDES_DEFAULT]) -], [AC_INCLUDES_DEFAULT]) - -dnl Solaris compatibility - check for -lnsl and -lsocket -AC_SEARCH_LIBS(gethostbyname, nsl) -AC_SEARCH_LIBS(connect, socket) - -dnl All current systems provide time.h; it need not be checked for. -dnl Not all systems provide sys/time.h, but those that do, all allow -dnl you to include it and time.h simultaneously. -dnl NUT codebase provides the include/timehead.h to wrap these nuances. -AC_CHECK_HEADERS_ONCE([sys/time.h time.h sys/types.h sys/socket.h netdb.h]) -AS_IF([test "$ac_cv_header_sys_time_h" = yes], - [AC_DEFINE([TIME_WITH_SYS_TIME],[1],[Define to 1 if you can safely include both - and . This macro is deemed obsolete by autotools.]) - ], []) - -AC_CHECK_HEADERS(sys/modem.h stdarg.h varargs.h, [], [], [AC_INCLUDES_DEFAULT]) - - -dnl pthread related checks -dnl Note: pthread_tryjoin_np() should be available since glibc 2.3.3, according -dnl to https://man7.org/linux/man-pages/man3/pthread_tryjoin_np.3.html -AC_SEARCH_LIBS([pthread_create], [pthread], - [AC_DEFINE(HAVE_PTHREAD, 1, [Define to enable pthread support code]) - AC_SEARCH_LIBS([pthread_tryjoin_np], [pthread], - [AC_DEFINE(HAVE_PTHREAD_TRYJOIN, 1, [Define to enable pthread_tryjoin support code])], - []) - ], - []) - -dnl ---------------------------------------------------------------------- -dnl Check for types and define possible replacements -NUT_TYPE_SOCKLEN_T -NUT_FUNC_GETNAMEINFO_ARGTYPES - -dnl ---------------------------------------------------------------------- -dnl Check for python binary program names per language version -dnl to embed into scripts and Make rules -NUT_CHECK_PYTHON -NUT_CHECK_PYTHON2 -NUT_CHECK_PYTHON3 - -dnl ---------------------------------------------------------------------- -dnl check for --with-drivers=all (or --with-drivers=name[,name...]) flag - -dnl Autoconf versions before 2.62 do not allow consecutive quadrigraphs -dnl (square brackets), so the help string depends on the version used -AC_MSG_CHECKING(which drivers to build) -AC_ARG_WITH(drivers, - AS_HELP_STRING([m4_version_prereq(2.62, - [@<:@--with-drivers=driver@<:@,driver@:>@@:>@], - [[[[--with-drivers=driver@<:@,driver@:>@]]]])], - [Only build specific drivers (all)]), -[ - case "${withval}" in - yes|no|'') - AC_MSG_ERROR(invalid option --with(out)-drivers - see docs/configure.txt) - ;; - all) - dnl Explicit request to build all drivers (unless specified), or fail - DRIVER_BUILD_LIST="all" - if test -z "${with_serial}"; then with_serial="yes"; fi - if test -z "${with_usb}"; then with_usb="yes"; fi - if test -z "${with_snmp}"; then with_snmp="yes"; fi - if test -z "${with_neon}"; then with_neon="yes"; fi - if test -z "${with_powerman}"; then with_powerman="yes"; fi - if test -z "${with_modbus}"; then with_modbus="yes"; fi - if test -z "${with_ipmi}"; then with_ipmi="yes"; fi - - dnl Platform-dependent snowflakes that are required or auto: - if test -z "${with_linux_i2c}"; then - case ${target_os} in - linux*) with_linux_i2c="yes";; - *) with_linux_i2c="auto";; - esac - fi - if test -z "${with_macosx_ups}"; then - if test -d /System/Library/Frameworks/IOKit.framework/ ; then - with_macosx_ups="yes" - else - with_macosx_ups="auto" - fi - fi - AC_MSG_RESULT(${DRIVER_BUILD_LIST}) - ;; - auto) - dnl Explicit request to build all drivers that we can - DRIVER_BUILD_LIST="all" - if test -z "${with_serial}"; then with_serial="${withval}"; fi - if test -z "${with_usb}"; then with_usb="${withval}"; fi - if test -z "${with_snmp}"; then with_snmp="${withval}"; fi - if test -z "${with_neon}"; then with_neon="${withval}"; fi - if test -z "${with_powerman}"; then with_powerman="${withval}"; fi - if test -z "${with_modbus}"; then with_modbus="${withval}"; fi - if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi - if test -z "${with_linux_i2c}"; then with_linux_i2c="${withval}"; fi - if test -z "${with_macosx_ups}"; then with_macosx_ups="${withval}"; fi - AC_MSG_RESULT(${DRIVER_BUILD_LIST}) - ;; - *) - DRIVER_BUILD_LIST="`echo ${withval} | sed 's/,/ /g'`" - AC_MSG_RESULT(${DRIVER_BUILD_LIST}) - - AS_IF([test -n "$DRIVER_BUILD_LIST"], - [dnl DRVLIST is occasionally synced with drivers/Makefile.am - dnl NOTE: Currently "USB_DRIVERLIST" is not used standalone: - DRVLIST_NAMES=" - SERIAL_DRIVERLIST USB_LIBUSB_DRIVERLIST SERIAL_USB_DRIVERLIST - SNMP_DRIVERLIST NEONXML_DRIVERLIST - MACOSX_DRIVERLIST MODBUS_DRIVERLIST LINUX_I2C_DRIVERLIST - POWERMAN_DRIVERLIST IPMI_DRIVERLIST" - - get_drvlist() ( - dnl Note escaped brackets - "against" m4 parser - m4_version_prereq(2.62, - [LB="@<:@"; RB="@:>@"], - [LB="[["; RB="]]"] - ) - SPACE="`printf "$LB"' \t'"$RB"`" - SPACES="${SPACE}*" - sed -e "s/${SPACES}""$LB"'+'"$RB"'*='"${SPACES}/=/" \ - -e "s/^${SPACES}//" < drivers/Makefile.am \ - | { - C=false; V=false - while read LINE ; do - case "$LINE" in - *'\') C=true; if $V ; then echo "$LINE" ; fi ;; - *) C=false; V=false ;; - esac - case "$LINE" in - "$1"=*) - echo "$LINE" | sed -e 's,^'"$LB"'^='"$RB"'*=,,' -e 's,\$,,' - V=$C - ;; - esac - done - } | tr '\n' ' ' | sed -e "s,${SPACE}${SPACES}, ," -e "s,${SPACES}\$,," - ) - - for DRVLIST_NAME in $DRVLIST_NAMES; do - OUT="`get_drvlist "$DRVLIST_NAME"`" \ - && test -n "$OUT" || OUT="" - eval $DRVLIST_NAME="\$OUT" - AC_MSG_NOTICE([Will check custom driver selection against $DRVLIST_NAME="$OUT"]) - done - - dnl Note: do not quote the expansion below to keep it multi-token: - for DRV in $DRIVER_BUILD_LIST ; do - - DRV_HITS="" - dnl #DEVEL-DEBUG# AC_MSG_NOTICE([= Checking DRV="$DRV"]) - for DRVLIST_NAME in $DRVLIST_NAMES; do - dnl #DEVEL-DEBUG# AC_MSG_NOTICE([== Checking DRVLIST_NAME="$DRVLIST_NAME"]) - eval DRVLIST="\${$DRVLIST_NAME}" - dnl #DEVEL-DEBUG# AC_MSG_NOTICE([== Contents DRVLIST="$DRVLIST"]) - - for DN in $DRVLIST ; do - dnl #DEVEL-DEBUG# AC_MSG_NOTICE([=== Checking DN="$DN"]) - AS_IF([test x"$DN" = x"$DRV"], [ - DRV_HITS="$DRV_HITS $DRVLIST_NAME" - AS_CASE(["$DRVLIST_NAME"], - - [SERIAL_DRIVERLIST], [ - AS_IF([test -z "${with_serial}"], - [AC_MSG_NOTICE([Requiring --with-serial=yes for driver "$DRV"]) - with_serial=yes] - )], - [USB_LIBUSB_DRIVERLIST], [ - AS_IF([test -z "${with_usb}"], - [AC_MSG_NOTICE([Requiring --with-usb=yes for driver "$DRV"]) - with_usb=yes] - )], - [SERIAL_USB_DRIVERLIST], [ - dnl e.g. nutdrv_qx that can do both - AS_IF([test -z "${with_usb}"], - [AC_MSG_NOTICE([Requiring --with-usb=yes for driver "$DRV"]) - with_usb=yes] - ) - AS_IF([test -z "${with_serial}"], - [AC_MSG_NOTICE([Requiring --with-serial=yes for driver "$DRV"]) - with_serial=yes] - )], - [SNMP_DRIVERLIST], [ - AS_IF([test -z "${with_snmp}"], - [AC_MSG_NOTICE([Requiring --with-snmp=yes for driver "$DRV"]) - with_snmp=yes] - )], - [NEONXML_DRIVERLIST], [ - AS_IF([test -z "${with_neon}"], - [AC_MSG_NOTICE([Requiring --with-neon=yes for driver "$DRV"]) - with_neon=yes] - )], - [MACOSX_DRIVERLIST], [ - dnl NOTE: This one is a bit special, - dnl just one certain driver so far - AS_IF([test -z "${with_macosx_ups}"], - [AC_MSG_NOTICE([Requiring --with-macosx-ups=yes for driver "$DRV"]) - with_macosx_ups=yes] - )], - [MODBUS_DRIVERLIST], [ - AS_IF([test -z "${with_modbus}"], - [AC_MSG_NOTICE([Requiring --with-modbus=yes for driver "$DRV"]) - with_modbus=yes] - )], - [LINUX_I2C_DRIVERLIST], [ - AS_IF([test -z "${with_linux_i2c}"], - [AC_MSG_NOTICE([Requiring --with-linux-i2c=yes for driver "$DRV"]) - with_linux_i2c=yes] - )], - [POWERMAN_DRIVERLIST], [ - AS_IF([test -z "${with_powerman}"], - [AC_MSG_NOTICE([Requiring --with-powerman=yes for driver "$DRV"]) - with_powerman=yes] - )], - [IPMI_DRIVERLIST], [ - AS_IF([test -z "${with_ipmi}"], - [AC_MSG_NOTICE([Requiring --with-ipmi=yes for driver "$DRV"]) - with_ipmi=yes] - )], - - [AC_MSG_WARN([Unhandled DRVLIST_NAME=$DRVLIST_NAME])] - ) - break - dnl Break once, maybe a driver hits several categories - ]) - done - done - AS_IF([test -z "${DRV_HITS}"], - [AC_MSG_ERROR([Requested driver '$DRV' is not defined in drivers/Makefile.am (or configure.ac has a bug/lag detecting driver lists)])]) - - done - ]) - - ;; - esac -], [ - dnl Implicit request to build whatever is enabled; - dnl do not force --with-all here: - DRIVER_BUILD_LIST="all" - AC_MSG_RESULT(all available) -]) -AM_CONDITIONAL(SOME_DRIVERS, test "${DRIVER_BUILD_LIST}" != "all") - -if test "${DRIVER_BUILD_LIST}" != "all"; then - NUT_REPORT([only build specific drivers], [${DRIVER_BUILD_LIST}]) -fi - -dnl ---------------------------------------------------------------------- -dnl check for --with-all (or --without-all, or --with-all=auto) flag - -AC_MSG_CHECKING(for --with-all) -AC_ARG_WITH(all, - AS_HELP_STRING([--with-all], [enable serial, usb, snmp, neon, ipmi, powerman, modbus, cgi, dev, avahi, linux_i2c]), -[ - if test -n "${withval}"; then - dnl Note: we allow "no" as a positive value, because - dnl this is what the user expects from --without-all - dnl Note: these settings do not touch generation of - dnl "--with-docs=...", that is handled separately - if test -z "${with_serial}"; then with_serial="${withval}"; fi - if test -z "${with_usb}"; then with_usb="${withval}"; fi - if test -z "${with_snmp}"; then with_snmp="${withval}"; fi - if test -z "${with_neon}"; then with_neon="${withval}"; fi - if test -z "${with_powerman}"; then with_powerman="${withval}"; fi - if test -z "${with_modbus}"; then with_modbus="${withval}"; fi - if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi - - dnl Platform-dependent snowflakes that are required or auto: - if test -z "${with_linux_i2c}"; then - with_linux_i2c="${withval}" - case ${target_os} in - linux*) ;; - *) test x"${withval}" = xno || with_linux_i2c="auto" ;; - esac - fi - if test -z "${with_macosx_ups}"; then - with_macosx_ups="${withval}" - if ! test -d /System/Library/Frameworks/IOKit.framework/ ; then - test x"${withval}" = xno || with_macosx_ups="auto" - fi - fi - - dnl These are not driver families, but other features: - if test -z "${with_cgi}"; then with_cgi="${withval}"; fi - if test -z "${with_dev}"; then with_dev="${withval}"; fi - if test -z "${with_avahi}"; then with_avahi="${withval}"; fi - - AC_MSG_RESULT("${withval}") - else - AC_MSG_RESULT(not given) - fi -], [ - AC_MSG_RESULT(not given) -]) - -dnl ---------------------------------------------------------------------- -dnl declare a number of --with-FEATURE options. Do this early, so that -dnl they are listed near the top by "./configure --help"; however, -dnl note that options with further investigation methods are listed -dnl a bit below to be grouped with their additional with/enable help. - -NUT_ARG_WITH([dev], [build and install the development files], [no]) - -dnl The NUT legacy option was --with-doc; however to simplify configuration -dnl in some common packaging frameworks, we also allow --with-docs as -dnl a second-class citizen (if both are set, the old option name wins). -dnl Also note that the legacy default was "man=yes" due to requirements -dnl of the "make distcheck", but it was reduced to "man=auto" so that -dnl the usual builds can pass by default on systems without asciidoc. -NUT_ARG_WITH([docs], [build and install documentation (alias to --with-doc)], [man=auto]) -NUT_ARG_WITH([doc], [build and install documentation (see docs/configure.txt for many variants of the option)], [${nut_with_docs}]) - -dnl NOTE: Until X-Mas 2021, the default was "legacy" (now "medium") -NUT_ARG_ENABLE([warnings], - [enable warning presets that were picked as useful in maintainership and CI practice (variants include gcc-minimal, gcc-medium, gcc-hard, clang-minimal, clang-medium, clang-hard, all; auto-choosers: hard, medium, minimal, yes=auto='gcc or clang or all at hardcoded default difficulty')], - [auto]) -NUT_ARG_ENABLE([Werror], - [fail the build if compiler emits any warnings (treat them as errors)], - [no]) -dnl To help find warning/error details in a wall of text, see --enable-Wcolor handled above - -dnl ---------------------------------------------------------------------- -dnl Check for presence and compiler flags of various libraries - -NUT_ARG_WITH([serial], [build and install serial drivers], [yes]) - -dnl These checks are performed unconditionally, even if the corresponding -dnl --with-* options are not given. This is because we cannot predict -dnl what will be in the --with-drivers argument. - -NUT_ARG_WITH([usb], [build and install USB drivers, optionally require build with specified version of libusb library and API: (auto|libusb-0.1|libusb-1.0)], [auto]) -nut_usb_lib="" -NUT_CHECK_LIBUSB - -NUT_ARG_WITH([snmp], [build and install SNMP drivers], [auto]) -NUT_CHECK_LIBNETSNMP - -NUT_ARG_WITH([neon], [build and install neon based XML/HTTP driver], [auto]) -NUT_CHECK_LIBNEON - -NUT_ARG_WITH([powerman], [build and install Powerman PDU client driver], [auto]) -NUT_CHECK_LIBPOWERMAN - -NUT_ARG_WITH([modbus], [build and install modbus drivers], [auto]) -NUT_CHECK_LIBMODBUS - -NUT_ARG_WITH([avahi], [build and install Avahi support], [auto]) -NUT_CHECK_LIBAVAHI - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-serial - -dnl ${nut_with_serial}: any value except "yes" or "no" is treated as "auto". -dnl Below we try to detect if we can build serial drivers, and if we must? -AS_IF([test "${nut_with_serial}" != "no"], - [AS_IF([test "${nut_with_serial}" != "yes"],[nut_with_serial="auto"]) - - CFLAGS_SAVED_SERIAL="${CFLAGS}" - AS_IF([test "${GCC}" = yes], - [CFLAGS_SAVED_WERROR="${CFLAGS} -Wall -Werror" - CFLAGS_SAVED_WNOERROR="${CFLAGS} -Wno-error" - ], - [CFLAGS_SAVED_WERROR="${CFLAGS}" - CFLAGS_SAVED_WNOERROR="${CFLAGS}" - ]) - - dnl At least recent *BSD distros have deprecated sys/termios.h and spew - dnl warnings that termios.h should be used instead. This is redundantly - dnl fatal for pedantic builds where we aim to have no warnings in code. - dnl So there AC_CHECK_HEADERS does find the header, but we don't really - dnl want to use it unless we have no choice: if there is a warning while - dnl trying sys/ version, try the plain header path (without fatal warnings), - dnl and only if that is missing - retry with the sys/ version again (and - dnl no warnings still). - - CFLAGS="${CFLAGS_SAVED_WERROR}" - AC_CHECK_HEADERS(sys/termios.h, [], [ - CFLAGS="${CFLAGS_SAVED_WNOERROR}" - AC_CHECK_HEADERS(termios.h, [], [ - AC_CHECK_HEADERS(sys/termios.h, [], [], [AC_INCLUDES_DEFAULT]) - ], [AC_INCLUDES_DEFAULT]) - ], [AC_INCLUDES_DEFAULT]) - - dnl CFLAGS at this point suffice for surviving a compilation with termios.h - - dnl Don't mind the stupid code below, it just probes the tokens and - dnl sails around compiler warnings - AC_MSG_CHECKING([for struct termios and speed_t]) - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#if defined(HAVE_SYS_TERMIOS_H) -# include /* for speed_t */ -#else -# if defined(HAVE_TERMIOS_H) -# include -# endif /* HAVE_TERMIOS_H */ -#endif /* HAVE_SYS_TERMIOS_H */ -void getspeed(speed_t* b) { *b = B19200; } -], -[struct termios tio; -if (!tcgetattr(0, &tio)) { return 1; } -speed_t baudrate; -getspeed(&baudrate); -] - )], - [AC_MSG_RESULT([ok]) - nut_have_serial_types=yes - ], - [AC_MSG_RESULT([no, struct termios and/or speed_t not found in discovered headers]) - nut_have_serial_types=no - ] - ) - AC_LANG_POP([C]) - - dnl Restore common set-or-discovered CFLAGS - CFLAGS="${CFLAGS_SAVED_SERIAL}" - - AC_MSG_CHECKING([whether we can build serial drivers]) - AS_IF([test "${nut_have_serial_types}" = yes], - [AS_IF([test "${nut_with_serial}" = "auto"],[nut_with_serial="yes"])], - [AS_IF([test "${nut_with_serial}" = "auto"],[nut_with_serial="no"]) - AS_IF([test "${nut_with_serial}" = "yes"],[AC_MSG_ERROR([no, and were required to])]) - ]) - AS_IF([test "${nut_with_serial}" = "yes"], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no])]) -]) - -NUT_REPORT_FEATURE([build serial drivers], [${nut_with_serial}], [], - [WITH_SERIAL], [Define to enable serial support]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-usb are in its m4 file and NUT_CHECK_LIBUSB() called above - -dnl Note: there is no libusb-config script (and variable) for libusb-1.0 -AM_CONDITIONAL(WITH_LIBUSB_1_0, test "${nut_usb_lib}" = "(libusb-1.0)") -AM_CONDITIONAL(WITH_LIBUSB_0_1, test "${nut_usb_lib}" = "(libusb-0.1)" -o "${nut_usb_lib}" = "(libusb-0.1-config)") - -NUT_REPORT_FEATURE([build USB drivers], [${nut_with_usb}], [${nut_usb_lib}], - [WITH_USB], [Define to enable USB support]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-neon - -dnl ${nut_with_neon}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_neon}" = "yes" -a "${nut_have_neon}" != "yes"; then - AC_MSG_ERROR([neon libraries not found, required for neon based XML/HTTP driver]) -fi - -if test "${nut_with_neon}" != "no"; then - nut_with_neon="${nut_have_neon}" -fi - -NUT_REPORT_FEATURE([build neon based XML driver], [${nut_with_neon}], [], - [WITH_NEON], [Define to enable Neon HTTP support]) -AM_CONDITIONAL([HAVE_NEON], [test "${nut_have_neon}" = "yes"]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-avahi - -dnl ${nut_with_avahi}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_avahi}" = "yes" -a "${nut_have_avahi}" != "yes"; then - AC_MSG_ERROR([avahi libraries not found]) -fi - -if test "${nut_with_avahi}" != "no"; then - nut_with_avahi="${nut_have_avahi}" -fi - -NUT_REPORT_FEATURE([enable Avahi support], [${nut_with_avahi}], [], - [WITH_AVAHI], [Define to enable Avahi support]) - -dnl ---------------------------------------------------------------------- - -dnl checks related to --with-powerman - -dnl ${nut_with_powerman}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_powerman}" = "yes" -a "${nut_have_libpowerman}" != "yes"; then - AC_MSG_ERROR([Powerman client libraries not found, required for Powerman PDU client driver]) -fi - -if test "${nut_with_powerman}" != "no"; then - nut_with_powerman="${nut_have_libpowerman}" -fi - -NUT_REPORT_FEATURE([build Powerman PDU client driver], [${nut_with_powerman}], [], - [WITH_LIBPOWERMAN], [Define to enable Powerman PDU support]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-modbus - -dnl ${nut_with_modbus}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_modbus}" = "yes" -a "${nut_have_libmodbus}" != "yes"; then - AC_MSG_ERROR([modbus library not found, required for Modbus driver]) -fi - -if test "${nut_with_modbus}" != "no"; then - nut_with_modbus="${nut_have_libmodbus}" -fi - -NUT_REPORT_FEATURE([build Modbus driver], [${nut_with_modbus}], [], - [WITH_MODBUS], [Define to enable Modbus support]) -dnl ---------------------------------------------------------------------- -dnl Check for with-ipmi, and --with-freeipmi (or --with-openipmi) -dnl Only one can be enabled at a time, with a preference for FreeIPMI -dnl if both are available (since it is the only one supported ATM!!) - -nut_ipmi_lib="" - -NUT_ARG_WITH([ipmi], [build and install IPMI PSU driver], [auto]) -NUT_ARG_WITH([freeipmi], [enable IPMI support using FreeIPMI], [auto]) -dnl NUT_ARG_WITH([openipmi], [enable IPMI support using OpenIPMI], [auto]) - -dnl ${nut_with_ipmi}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_ipmi}" != "no"; then - dnl check if FreeIPMI (and maybe later OpenIPMI) was explicitly requested - if test "${nut_with_freeipmi}" = "yes"; then - NUT_CHECK_LIBFREEIPMI - if test "${nut_have_freeipmi}" != "yes"; then - AC_MSG_ERROR([FreeIPMI not found, required for IPMI support]) - fi - dnl Implies --with-ipmi - nut_with_ipmi="yes" - dnl elif test "${nut_with_openipmi}" = "yes"; then - dnl AC_MSG_ERROR([OpenIPMI is not yet supported]) - dnl NUT_CHECK_LIBOPENIPMI - dnl if test "${nut_have_openipmi}" != "yes"; then - dnl AC_MSG_ERROR([OpenIPMI not found, required for IPMI support]) - dnl fi - dnl Implies --with-ipmi - dnl nut_with_ipmi="yes" - dnl AC_DEFINE(WITH_OPENIPMI, 1, [Define to enable IPMI support using OpenIPMI]) - else - dnl Prefer FreeIPMI over OpenIPMI otherwise - NUT_CHECK_LIBFREEIPMI - if test "${nut_have_freeipmi}" != "yes"; then - if test "${nut_with_ipmi}" = "yes"; then - AC_MSG_ERROR([FreeIPMI not found, required for IPMI support]) - fi - nut_with_ipmi="no" - dnl NUT_CHECK_OPENIPMI - dnl if test "${nut_have_openipmi}" != "yes"; then - dnl if test "${nut_with_ipmi}" = "yes"; then - dnl AC_MSG_ERROR([Neither GNU FreeIPMI nor OpenIPMI was found (required for IPMI support)]) - dnl fi - dnl nut_with_ipmi="no" - dnl else - dnl Implies --with-ipmi - dnl nut_with_ipmi="yes" - dnl nut_with_openipmi="yes" - dnl fi - else - dnl Implies --with-ipmi - nut_with_ipmi="yes" - nut_with_freeipmi="yes" - AC_DEFINE(WITH_FREEIPMI, 1, [Define to enable IPMI support using FreeIPMI]) - fi - fi -fi - - -NUT_REPORT_FEATURE([build IPMI driver], [${nut_with_ipmi}], [${nut_ipmi_lib}], - [WITH_IPMI], [Define to enable IPMI support]) - -dnl Note: we still have to manually enable complementary AC_DEFINEs (see above) -dnl and AM_CONDITIONALs (see below)... -AM_CONDITIONAL(WITH_FREEIPMI, test "${nut_with_freeipmi}" = "yes") -dnl AM_CONDITIONAL(WITH_OPENIPMI, test "${nut_with_openipmi}" = "yes") - - -dnl ---------------------------------------------------------------------- -dnl The Mac OS X meta-driver looks at IOKit Power Sources keys managed by -dnl the internal USB UPS driver. -dnl -dnl FIXME: be slightly more clever here: - -NUT_ARG_WITH([macosx_ups], [build and install Mac OS X Power Sources meta-driver], [auto]) -if test "${nut_with_macosx_ups}" != no; then - if test -d /System/Library/Frameworks/IOKit.framework/ ; then - nut_with_macosx_ups="yes" - else - if test "${nut_with_macosx_ups}" = yes; then - AC_MSG_ERROR([macosx-ups was required but can not be fulfilled for this build: not MacOS]) - fi - nut_with_macosx_ups="no" - fi -fi - -NUT_REPORT_FEATURE([build Mac OS X meta-driver], - [${nut_with_macosx_ups}], [${nut_macosx_ups_lib}], - [WITH_MACOSX], [Define to enable Mac OS X meta-driver]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with_linux_i2c -dnl Check for i2c header on Linux, used for ASEM UPS driver -NUT_ARG_WITH([linux_i2c], [build and install i2c drivers], [auto]) -if test "${nut_with_linux_i2c}" != no; then - case ${target_os} in - linux* ) - AC_CHECK_HEADER( - [linux/i2c-dev.h], - [AC_DEFINE([HAVE_LINUX_I2C_DEV_H], [1], - [Define to 1 if you have .])] - ) - AC_CHECK_HEADER( - [i2c/smbus.h], - [AC_DEFINE([HAVE_LINUX_SMBUS_H], [1], - [Define to 1 if you have .])] - ) - AC_CHECK_DECLS( - [i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data], - [], dnl # nut_with_linux_i2c="yes" - [AS_IF([test "${nut_with_linux_i2c}" = "yes"], - [AC_MSG_ERROR(i2c was required but can not be fulfilled for this build)], - [nut_with_linux_i2c="no"])], - [#include - #ifdef HAVE_LINUX_I2C_DEV_H - #include - #endif - #ifdef HAVE_LINUX_SMBUS_H - #include - #endif - ] - ) - dnl Builds for bitness/arch other than system default can be - dnl "compromised" by lack of respective binary library, so - dnl even if we have the right headers, ultimate link fails. - dnl Note: here we keep the verdict from above, or make it worse. - AC_SEARCH_LIBS([i2c_smbus_read_byte, i2c_smbus_access, i2c_smbus_read_byte_data, i2c_smbus_write_byte_datai2c_smbus_write_byte_data, i2c_smbus_read_word_data, i2c_smbus_write_word_data, i2c_smbus_read_block_data], - [i2c], - [nut_with_linux_i2c="yes"], - [AS_IF([test "${nut_with_linux_i2c}" = "yes"], - [AC_MSG_ERROR(i2c was required but can not be fulfilled for this build)], - [nut_with_linux_i2c="no"]) - ]) - ;; - * ) - if test "${nut_with_linux_i2c}" = yes; then - AC_MSG_ERROR([i2c was required but can not be fulfilled for this build: not linux]) - fi - nut_with_linux_i2c="no" - ;; - esac -fi -NUT_REPORT_FEATURE( - [build i2c based drivers], - [${nut_with_linux_i2c}], - [], - [WITH_LINUX_I2C], - [Define to enable I2C support] -) - -dnl ---------------------------------------------------------------------- -dnl Check for with-ssl, and --with-nss or --with-openssl -dnl Only one can be enabled at a time, with a preference for OpenSSL -dnl if both are available - -nut_ssl_lib="" - -NUT_ARG_WITH([ssl], [enable SSL support (either NSS or OpenSSL)], [auto]) -NUT_ARG_WITH([nss], [enable SSL support using Mozilla NSS], [auto]) -NUT_ARG_WITH([openssl], [enable SSL support using OpenSSL], [auto]) - -dnl ${nut_with_ssl}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_ssl}" != "no"; then - dnl check if either NSS or OpenSSL was explicitly requested - if test "${nut_with_nss}" = "yes"; then - NUT_CHECK_LIBNSS - if test "${nut_have_libnss}" != "yes"; then - AC_MSG_ERROR([Mozilla NSS not found (required for SSL support)]) - fi - elif test "${nut_with_openssl}" = "yes"; then - NUT_CHECK_LIBOPENSSL - if test "${nut_have_openssl}" != "yes"; then - AC_MSG_ERROR([OpenSSL not found (required for SSL support)]) - fi - else - dnl Prefer OpenSSL over NSS otherwise - NUT_CHECK_LIBOPENSSL - if test "${nut_have_openssl}" != "yes"; then - NUT_CHECK_LIBNSS - if test "${nut_have_libnss}" != "yes"; then - dnl Only abort if SSL has been explicitly requested by the user - if test "${nut_with_ssl}" = "yes"; then - AC_MSG_ERROR([Neither Mozilla NSS nor OpenSSL was found, but one is needed for the requested SSL support.]) - else - AC_MSG_WARN([Neither Mozilla NSS nor OpenSSL was found (required for SSL support)]) - fi - nut_with_ssl="no" - else - nut_with_nss="${nut_have_libnss}" - fi - else - nut_with_openssl="${nut_have_openssl}" - fi - fi -fi - -AM_CONDITIONAL(WITH_NSS, test "${nut_with_nss}" = "yes") -AM_CONDITIONAL(WITH_OPENSSL, test "${nut_with_openssl}" = "yes") - -NUT_REPORT_FEATURE([enable SSL support], [${nut_with_ssl}], [${nut_ssl_lib}], - [WITH_SSL], [Define to enable SSL]) - -dnl ---------------------------------------------------------------------- -dnl Check for --with-wrap - -NUT_ARG_WITH([wrap], [enable libwrap (tcp-wrappers) support], [auto]) - -dnl ${nut_with_wrap}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_wrap}" != "no"; then - dnl check for libwrap compiler flags - NUT_CHECK_LIBWRAP -fi - -if test "${nut_with_wrap}" = "yes" -a "${nut_have_libwrap}" != "yes"; then - AC_MSG_ERROR([libwrap not found]) -fi - -if test "${nut_with_wrap}" != "no"; then - nut_with_wrap="${nut_have_libwrap}" -fi - -NUT_REPORT_FEATURE([enable libwrap (tcp-wrappers) support], [${nut_with_wrap}], [], - [WITH_WRAP], [Define to enable libwrap (tcp-wrappers) support]) - - -dnl ---------------------------------------------------------------------- -dnl Check for --with-libltdl - -NUT_ARG_WITH([libltdl], [enable libltdl (Libtool dlopen abstraction) support], [auto]) - -dnl ${nut_with_libltdl}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_libltdl}" != "no"; then - dnl check for libltdl compiler flags - NUT_CHECK_LIBLTDL -fi - -if test "${nut_with_libltdl}" = "yes" -a "${nut_have_libltdl}" != "yes"; then - AC_MSG_ERROR([libltdl not found]) -fi - -if test "${nut_with_libltdl}" != "no"; then - nut_with_libltdl="${nut_have_libltdl}" -fi - -NUT_REPORT_FEATURE([enable libltdl (Libtool dlopen abstraction) support], [${nut_with_libltdl}], [], - [WITH_LIBLTDL], [Define to enable libltdl (Libtool dlopen abstraction) support]) - -dnl Explicitly report if we are building nut-scanner or not -dnl since it requires libltdl -NUT_REPORT([build nut-scanner], [${nut_with_libltdl}]) - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-cgi - -NUT_ARG_WITH([cgi], [build and install the CGI programs], [no]) - -dnl ${nut_with_cgi}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_cgi}" != "no"; then - dnl check for libgd compiler flags - NUT_CHECK_LIBGD -fi - -if test "${nut_with_cgi}" = "yes" -a "${nut_have_libgd}" != "yes"; then - AC_MSG_ERROR([libgd not found, required for CGI build]) -fi - -if test "${nut_with_cgi}" != "no"; then - nut_with_cgi="${nut_have_libgd}" -fi - -NUT_REPORT_FEATURE([build CGI programs], [${nut_with_cgi}], [], - [WITH_CGI], [Define to enable CGI (HTTP) support]) - - -dnl ---------------------------------------------------------------------- -dnl checks related to --enable-cppcheck - -dnl Currently this is experimental; maybe change default to auto in the future -dnl At that point, see also defaults in ci_build.sh then (to avoid the workload -dnl unless desired). -NUT_ARG_ENABLE([cppcheck], [Run a cppcheck on the codebase among checks], [no]) -NUT_CHECK_CPPCHECK - -case "${nut_enable_cppcheck}" in - yes) if test "${nut_have_cppcheck}" = "no" ; then - AC_MSG_ERROR([Requested to --enable-cppcheck but did not find a good one]) - fi - WITH_CPPCHECK=yes - ;; - no) WITH_CPPCHECK=no ;; - auto) if test "${nut_have_cppcheck}" = "yes" ; then - WITH_CPPCHECK=no - else - WITH_CPPCHECK=no - fi - ;; -esac - -AM_CONDITIONAL(WITH_CPPCHECK, test "${WITH_CPPCHECK}" = "yes") - -dnl ---------------------------------------------------------------------- -dnl checks related to --enable-check-NIT - -AC_MSG_CHECKING(whether to run NIT among default make check target) -nut_enable_check_NIT="no" -AC_ARG_ENABLE([check-NIT], - AS_HELP_STRING([--enable-check-NIT], [Run check-NIT among default checks (no)]), -[ - case "${enableval}" in - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - nut_enable_check_NIT="yes" - ;; - esac -], [ - AC_MSG_RESULT(no) -]) - -AM_CONDITIONAL(WITH_CHECK_NIT, test "${nut_enable_check_NIT}" = "yes") - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-doc - -dnl Always check for AsciiDoc prerequisites, since even if --with-doc -dnl is set to 'no', we may still want to build some doc targets manually -dnl (so enable the Makefile recipes for those targets if tools are available) -NUT_CHECK_ASCIIDOC - -NUT_REPORT_FEATURE([build and install documentation], [${nut_with_doc}], [], - [WITH_ASCIIDOC], [Define to enable Asciidoc support]) - -DOC_INSTALL_DISTED_MANS=no - -case "${nut_with_doc}" in - yes|all|all=yes) - nut_doc_build_list="man html-single html-chunked pdf" - ;; - auto|all=auto) - nut_doc_build_list="man=auto html-single=auto html-chunked=auto pdf=auto" - ;; - skip|all=skip) - nut_doc_build_list="man=skip html-single=skip html-chunked=skip pdf=skip" - ;; - no|all=no) - nut_doc_build_list="" - ;; -dnl If user passed --with-doc='' they they want nothing, right? - "") - nut_doc_build_list="" - AC_MSG_NOTICE([Got explicit empty list of document formats to build; nothing will be generated]) - ;; - *) - nut_doc_build_list="`echo ${nut_with_doc} | sed 's/,/ /g'`" - AC_MSG_NOTICE([Got explicit list of document formats to build or not: ${nut_doc_build_list}; formats not listed will be silently skipped]) - ;; -esac - -if test -z "${abs_srcdir}" ; then - case "${srcdir}" in - /*) abs_srcdir="${srcdir}";; - "") AC_MSG_ERROR([Can not detect 'srcdir']) ;; - *) abs_srcdir="$(cd "${srcdir}" && pwd)" || AC_MSG_ERROR([Can not detect 'srcdir']) ;; - esac -fi -DOCTESTDIR="$(mktemp -d configure-test.docbuild.$$.XXXXXXX)" && \ -DOCTESTDIR="$(cd "$DOCTESTDIR" && pwd)" - -dnl Note: Do not cover ${nut_doc_build_list} in braces or quotes here, -dnl to ensure that it is processed as several space-separated tokens -for nut_doc_build_target in $nut_doc_build_list; do - case "${nut_doc_build_target}" in - *=*=*) rm -rf "${DOCTESTDIR}" - AC_MSG_ERROR([Invalid documentation format option: ${nut_doc_build_target}]) ;; - *=*) - nut_doc_build_target_base="`echo "${nut_doc_build_target}" | sed 's,=.*$,,'`" - nut_doc_build_target_flag="`echo "${nut_doc_build_target}" | sed 's,^.*=,,'`" - ;; - *) - nut_doc_build_target_base="${nut_doc_build_target}" - nut_doc_build_target_flag="yes" - ;; - esac - case "${nut_doc_build_target_flag}" in - yes|no|auto|skip) ;; - "") nut_doc_build_target_flag="yes" ;; - *) rm -rf "${DOCTESTDIR}" - AC_MSG_ERROR([Invalid documentation format option: ${nut_doc_build_target}]) ;; - esac - AC_MSG_CHECKING([desire and ability to build ${nut_doc_build_target_base} documentation]) - AC_MSG_RESULT([${nut_doc_build_target_flag}]) - - case "${nut_doc_build_target}" in - *=no|*=skip) - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - ;; - -dnl Notes: Document options below assume either no flag value (which -dnl by default means "yes"), "yes" which is a requirement, or "auto" -dnl to detect if we can build the wanted documentation format and yet -dnl not fail if we have no tools to generate it (so add to SKIP list). - - html-single*) - AC_MSG_CHECKING([if asciidoc version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})]) - can_build_doc_html_single=no - AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [ - ( cd "$DOCTESTDIR" && ${A2X} --attribute=xhtml11_format --format=xhtml --xsl-file="${abs_srcdir}"/docs/xhtml.xsl --destination-dir=. "${abs_srcdir}"/docs/asciidoc.txt && test -s asciidoc.html ) && can_build_doc_html_single=yes - rm -f "$DOCTESTDIR"/asciidoc*.htm* - ], []) - if test "${can_build_doc_html_single}" = yes ; then - AC_MSG_RESULT(yes) - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - AC_MSG_RESULT(no) - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation which you requested]) - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - html-chunked*) - AC_MSG_CHECKING([if a2x version can build ${nut_doc_build_target_base} (minimum required ${ASCIIDOC_MIN_VERSION})]) - can_build_doc_html_chunked=no - AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [ - ( cd "$DOCTESTDIR" && ${A2X} --attribute=chunked_format --format=chunked --xsl-file="${abs_srcdir}"/docs/chunked.xsl --destination-dir=. "${abs_srcdir}"/docs/FAQ.txt && test -s FAQ.chunked/index.html ) && can_build_doc_html_chunked=yes - rm -rf "${DOCTESTDIR}"/FAQ*.chunked* - ], []) - if test "${can_build_doc_html_chunked}" = yes ; then - AC_MSG_RESULT(yes) - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - AC_MSG_RESULT(no) - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation which you requested]) - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - pdf*) - AC_MSG_CHECKING([if dblatex version can build ${nut_doc_build_target_base} (minimum required ${DBLATEX_MIN_VERSION})]) - can_build_doc_pdf=no - AX_COMPARE_VERSION([${DBLATEX_VERSION}], [ge], [${DBLATEX_MIN_VERSION}], [ - ( cd "$DOCTESTDIR" && ${A2X} --format=pdf --destination-dir=. "${abs_srcdir}"/docs/asciidoc.txt && test -s asciidoc.pdf ) && can_build_doc_pdf=yes - rm -f "${DOCTESTDIR}"/asciidoc.pdf - ], []) - if test "${can_build_doc_pdf}" = yes ; then - AC_MSG_RESULT(yes) - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - AC_MSG_RESULT(no) - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation which you requested]) - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - fi - fi - ;; - - man*) - AC_MSG_CHECKING([if we can build ${nut_doc_build_target_base}]) - can_build_doc_man=no - if test "${nut_have_asciidoc}" = yes ; then - ( cd "$DOCTESTDIR" && ${A2X} --format manpage --destination-dir=. --xsltproc-opts="--nonet" "${abs_srcdir}"/docs/man/snmp-ups.txt && test -s snmp-ups.8 ) && can_build_doc_man=yes - rm -f "${DOCTESTDIR}"/snmp-ups.8 - fi - if test "${can_build_doc_man}" = yes ; then - AC_MSG_RESULT(yes) - DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target_base}" - else - AC_MSG_RESULT(no) - if test "${nut_doc_build_target_flag}" = "yes" ; then - DOC_CANNOTBUILD_LIST="${DOC_CANNOTBUILD_LIST} ${nut_doc_build_target_base}" - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation which you requested]) - else - DOC_SKIPBUILD_LIST="${DOC_SKIPBUILD_LIST} ${nut_doc_build_target_base}" - if test "${nut_doc_build_target_flag}" = "auto" ; then -dnl Test that groff files exist (building from distributed tarball, not git repo) - if test -s "${abs_srcdir}"/docs/man/snmp-ups.8 ; then - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation, but can install pre-built distributed copies]) - DOC_INSTALL_DISTED_MANS="yes" - else - AC_MSG_WARN([Unable to build ${nut_doc_build_target_base} documentation, and unable to install pre-built distributed copies because they are absent]) - fi - fi # Other variants include "no", "skip"... - fi - fi - ;; - - *) rm -rf "${DOCTESTDIR}" - AC_MSG_ERROR([--with-doc option refers to unknown documentation format: $nut_doc_build_target]) ;; - - esac -done -rm -rf "${DOCTESTDIR}" - -case "${nut_with_doc}" in -auto) - if test -n "${DOC_BUILD_LIST}"; then - nut_with_doc="yes" - else - nut_with_doc="no" - fi - ;; -no) - ;; -*) - if test -n "${DOC_CANNOTBUILD_LIST}"; then - AC_MSG_ERROR([Unable to build${DOC_CANNOTBUILD_LIST} documentation (check for 'no' results above)]) - fi - - if test -n "${DOC_SKIPBUILD_LIST}"; then - AC_MSG_NOTICE([Skipping build of${DOC_SKIPBUILD_LIST} documentation (check for 'skip' results above)]) - fi - - if test -n "${DOC_BUILD_LIST}"; then - nut_with_doc="yes" - else - nut_with_doc="no" - fi - ;; -esac - -NUT_REPORT_FEATURE([build specific documentation format(s)], [${nut_with_doc}], [${DOC_BUILD_LIST}], - [WITH_DOCS], [Define to enable overall documentation generation]) - -# To cater for less portable make's, precalculate the target list -# for "make check" in "docs/" here... -DOC_CHECK_LIST="" -if test "${nut_with_doc}" = yes ; then - for V in $DOC_BUILD_LIST ; do - DOC_CHECK_LIST="$DOC_CHECK_LIST check-$V" - done -fi - -WITH_MANS=no -SKIP_MANS=no -if echo "${DOC_BUILD_LIST}" | grep -w "man" >/dev/null || test "${DOC_INSTALL_DISTED_MANS}" = "yes" ; then - WITH_MANS=yes -fi -if echo "${DOC_SKIPBUILD_LIST}" | grep -w "man" >/dev/null ; then - SKIP_MANS=yes -fi -dnl Generally WITH_MANS=no is intentionally fatal for "make distcheck" -dnl But some larger distcheck suites check mans once and then focus on -dnl other aspects of the project, so they can explicitly skip docs (or -dnl just mans) instead. Note that for WITH_MANS=yes the SKIP_MANS value -dnl is effectively ignored by docs/man/Makefile.am at this time. -AM_CONDITIONAL(WITH_MANS, test "${WITH_MANS}" = "yes") -AM_CONDITIONAL(SKIP_MANS, test "${SKIP_MANS}" = "yes") -AM_CONDITIONAL(DOC_INSTALL_DISTED_MANS, test "${DOC_INSTALL_DISTED_MANS}" = "yes") - -dnl ---------------------------------------------------------------------- -dnl checks related to --with-dev - -dnl We only init libtool there to allow AC_DISABLE_STATIC -if ( test "${GCC}" = "yes" ) -then - dnl # Avoid new compilers' warnings/errors about libtool distro flaws in this test like: - dnl # error: ISO C forbids conversion of function pointer to object pointer type [-Werror=pedantic] - dnl # {"nm_test_func", (void *) &nm_test_func}, - dnl # or ones about LTO (-flto -fno-common) as discussed and suggested - dnl # in https://www.mail-archive.com/libtool@gnu.org/msg14037.html - - dnl # all leading to undefined "global_symbol_pipe" in the generated - dnl # libtool script, and resulting in errors like `... | | ...` below : - dnl # libtool: link: /usr/bin/nm -B .libs/upsclient.o \ - dnl # ../common/.libs/libcommonclient.a | | /usr/bin/sed 's/.* //' \ - dnl # | sort | uniq > .libs/libupsclient.exp - dnl # ../libtool: syntax error: `|' unexpected - - CFLAGS_SAVED_NOPEDANTIC="$CFLAGS" - AS_CASE(["${CFLAGS}"],[*"-pedantic"*],[CFLAGS="${CFLAGS} -Wno-pedantic"]) - AS_CASE(["${CFLAGS}"],[*"-Werror"*],[CFLAGS="${CFLAGS} -Wno-error"]) - AS_CASE(["${CFLAGS}"],[*"-flto"*],[CFLAGS="${CFLAGS} -ffat-lto-objects"]) -fi - -dnl See https://www.gnu.org/software/libtool/manual/html_node/LT_005fINIT.html -dnl #OBSOLETED:# LT_INIT and AC_PROG_LIBTOOL - -dnl # Hack around the libtool script: as of version 58 (current in 2021), -dnl # they use code like below to detect library paths: -dnl # if test yes = "$GCC"; then ... lt_search_path_spec=`$CC -print-search-dirs | ... -dnl # which explodes when non-default architecture is used for the build, -dnl # where e.g. "CC=gcc" and "CFLAGS=-m32" on a 64-bit capable system. -dnl # And similarly for compilation-checks to link third-party libraries. -SAVED_GCC="$GCC" -SAVED_CC="$CC" -if ( test "${GCC}" = "yes" ) -then - case "$CFLAGS$LDFLAGS" in - *-m32*) CC="$CC -m32" ;; - *-m64*) CC="$CC -m64" ;; - esac -fi -LT_INIT -AC_SUBST([LIBTOOL_DEPS]) -GCC="$SAVED_GCC" -CC="$SAVED_CC" - -if ( test "${GCC}" = "yes" ) -then - CFLAGS="$CFLAGS_SAVED_NOPEDANTIC" -fi - -dnl ${nut_with_dev}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_dev}" != "no"; then - nut_with_dev="yes" -else - AC_DISABLE_STATIC -fi -AM_CONDITIONAL(WITH_DEV, test "${nut_with_dev}" = "yes") -NUT_REPORT_FEATURE([build and install the development files], [${nut_with_dev}], [], - [WITH_DEV], [Define to enable development files support]) - -dnl ---------------------------------------------------------------------- - - -AC_MSG_CHECKING(state path) -AC_ARG_WITH(statepath, - AS_HELP_STRING([--with-statepath=PATH], [path for ups state files (/var/state/ups)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-statepath - see docs/configure.txt) - ;; - *) - STATEPATH="${withval}" - ;; - esac -], []) -AC_DEFINE_UNQUOTED(STATEPATH, "${STATEPATH}", [Path for UPS driver state files]) -AC_MSG_RESULT(${STATEPATH}) - -dnl --------------------------------------------------------------------- -dnl The 'alt pid path' is used by the drivers (via main.c) and upsd, since -dnl ideally they do not run as root and will not be able to write to the usual -dnl /var/run path. This defaults to the STATEPATH since they should be -dnl able to write there. -dnl - -AC_MSG_CHECKING(alt pid path) -AC_ARG_WITH(altpidpath, - AS_HELP_STRING([--with-altpidpath=PATH], [path for driver/upsd .pid files ()]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt) - ;; - *) - ALTPIDPATH="${withval}" - ;; - esac -], [ - ALTPIDPATH="${STATEPATH}" -]) -AC_DEFINE_UNQUOTED(ALTPIDPATH, "${ALTPIDPATH}", [Path for pid files of drivers and upsd (usually STATEPATH)]) -AC_MSG_RESULT(${ALTPIDPATH}) - -AC_MSG_CHECKING(driver path) -AC_ARG_WITH(drvpath, - AS_HELP_STRING([--with-drvpath=PATH], [where to install UPS drivers (EPREFIX/bin)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-drvpath - see docs/configure.txt) - ;; - *) - driverexecdir="${withval}" - ;; - esac -], []) -conftemp="${driverexecdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -AC_DEFINE_UNQUOTED(DRVPATH, "${conftemp}", [Default path for UPS drivers]) -AC_MSG_RESULT(${driverexecdir}) - -AC_MSG_CHECKING(cgi path) -AC_ARG_WITH(cgipath, - AS_HELP_STRING([--with-cgipath=PATH], [where to install CGI programs (EPREFIX/cgi-bin)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt) - ;; - *) - cgiexecdir="${withval}" - ;; - esac -], []) -conftemp="${cgiexecdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -AC_DEFINE_UNQUOTED(CGIPATH, "${conftemp}", [Default path for CGI programs]) -AC_MSG_RESULT(${cgiexecdir}) - -AC_MSG_CHECKING(html path) -AC_ARG_WITH(htmlpath, - AS_HELP_STRING([--with-htmlpath=PATH], [where to install HTML files (PREFIX/html)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt) - ;; - *) - htmldir="${withval}" - ;; - esac -], []) -conftemp="${htmldir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -AC_DEFINE_UNQUOTED(HTMLPATH, "${conftemp}", [Default path for HTML files]) -AC_MSG_RESULT(${htmldir}) - -AC_MSG_CHECKING(pidpath) -AC_ARG_WITH(pidpath, - AS_HELP_STRING([--with-pidpath=PATH], [path for .pid files (/var/run)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt) - ;; - *) - PIDPATH="${withval}" - ;; - esac -], []) -AC_DEFINE_UNQUOTED(PIDPATH, "${PIDPATH}", [Path where the pid files should go]) -AC_MSG_RESULT(${PIDPATH}) - -AC_MSG_CHECKING(network port number) -AC_ARG_WITH(port, - AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt) - ;; - *) - PORT="${withval}" - ;; - esac -], [ - PORT="3493" -]) -AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) -AC_MSG_RESULT(${PORT}) - -AC_MSG_CHECKING(user to run as) -AC_ARG_WITH(user, - AS_HELP_STRING([--with-user=username], [user for programs started as root (${RUN_AS_USER})]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt) - ;; - *) - RUN_AS_USER="${withval}" - nut_user_given=yes - ;; - esac -], [ - nut_user_given=no -]) -AC_DEFINE_UNQUOTED(RUN_AS_USER, "${RUN_AS_USER}", [User to switch to if started as root]) -AC_MSG_RESULT(${RUN_AS_USER}) - -AC_MSG_CHECKING(group membership of user to run as) -AC_ARG_WITH(group, - AS_HELP_STRING([--with-group=groupname], [group membership of user for programs started as root (${RUN_AS_GROUP})]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt) - ;; - *) - RUN_AS_GROUP="${withval}" - nut_group_given=yes - ;; - esac -], [ - nut_group_given=no -]) -AC_DEFINE_UNQUOTED(RUN_AS_GROUP, "${RUN_AS_GROUP}", [Group membership of user to switch to if started as root]) -AC_MSG_RESULT(${RUN_AS_GROUP}) - -dnl check that --with-user is given if --with-group is given. -if test "${nut_user_given}" = "yes" -a "${nut_group_given}" = "no"; then - AC_MSG_ERROR([If you specify --with-user, you also must specify --with-group]) -elif test "${nut_user_given}" = "no" -a "${nut_group_given}" = "yes"; then - AC_MSG_ERROR([If you specify --with-group, you also must specify --with-user]) -fi - -AC_MSG_CHECKING(facility for syslog) -AC_ARG_WITH(logfacility, - AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), -[ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt) - ;; - *) - LOGFACILITY="${withval}" - ;; - esac -], [ - LOGFACILITY="LOG_DAEMON" -]) -AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)]) -AC_MSG_RESULT(${LOGFACILITY}) - -AC_MSG_CHECKING(which driver man pages to install) -if test "${WITH_MANS}" = "yes"; then - if test "${DRIVER_BUILD_LIST}" = "all"; then - DRIVER_MAN_LIST=all - AC_MSG_RESULT(all available) - else - DRIVER_MAN_LIST="" - for i in ${DRIVER_BUILD_LIST}; do - if test -f ${srcdir}/docs/man/$i.8; then - DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8" - fi - done - AC_MSG_RESULT(${DRIVER_MAN_LIST}) - fi -else - DRIVER_MAN_LIST="" - AC_MSG_RESULT([none (manpages disabled)]) -fi - -AC_MSG_CHECKING(whether to strip debug symbols) -AC_ARG_ENABLE(strip, - AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]), -[ - case "${enableval}" in - no) - AC_MSG_RESULT(no) - ;; - *) - AC_MSG_RESULT(yes) - CFLAGS="${CFLAGS} -s" - ;; - esac -], [ - AC_MSG_RESULT(no) -]) - -AC_MSG_CHECKING(whether to install pkg-config *.pc files) -AC_ARG_WITH(pkgconfig-dir, - AS_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig)]), -[ - case "${withval}" in - yes|auto) - ;; - no) - pkgconfigdir="" - ;; - *) - pkgconfigdir="${withval}" - ;; - esac -], []) -if test -n "${pkgconfigdir}"; then - AC_MSG_RESULT(using ${pkgconfigdir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}") - -AC_MSG_CHECKING(whether to install Solaris SMF files) -solarissmf="auto" -AC_ARG_WITH([solaris-smf], - AS_HELP_STRING([--with-solaris-smf=(yes|auto|no)], [Enable installation of NUT scripts and manifests for Solaris Service Management Framework (auto)]), -[ - case "${withval}" in - auto|"") - solarissmf="auto" - ;; - yes|no) - solarissmf="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-smf=${withval}]) - ;; - esac -], []) - -if test x"$solarissmf" = xauto ; then - if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then - solarissmf="yes" - else - solarissmf="no" - fi -fi -AC_MSG_RESULT([${solarissmf}]) -AM_CONDITIONAL(WITH_SOLARIS_SMF, test x"$solarissmf" = x"yes") - -AC_MSG_CHECKING(whether to make Solaris SVR4 packages) -solarispkg_svr4="auto" -AC_ARG_WITH([solaris-pkg-svr4], - AS_HELP_STRING([--with-solaris-pkg-svr4=(yes|auto|no)], [Enable construction of Solaris SVR4 packages (auto)]), -[ - case "${withval}" in - auto|"") - solarispkg_svr4="auto" - ;; - yes|no) - solarispkg_svr4="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-svr4=${withval}]) - ;; - esac -], []) - -if test x"$solarispkg_svr4" = xauto ; then - if test -x /usr/bin/pkgtrans && test -x /usr/bin/pkgmk && test -x /usr/bin/pkgproto ; then - solarispkg_svr4="yes" - else - solarispkg_svr4="no" - fi -fi -AC_MSG_RESULT([${solarispkg_svr4}]) -AM_CONDITIONAL(WITH_SOLARIS_PKG_SVR4, test x"$solarispkg_svr4" = x"yes") - -AC_MSG_CHECKING(whether to make Solaris IPS packages) -solarispkg_ips="auto" -AC_ARG_WITH([solaris-pkg-ips], - AS_HELP_STRING([--with-solaris-pkg-ips=(yes|auto|no)], [Enable construction of Solaris IPS packages (auto)]), -[ - case "${withval}" in - auto|"") - solarispkg_ips="auto" - ;; - yes|no) - solarispkg_ips="${withval}" - ;; - *) - AC_MSG_ERROR([Unexpected argument for --with-solaris-pkg-ips=${withval}]) - ;; - esac -], []) - -if test x"$solarispkg_ips" = xauto ; then - if test -x /usr/bin/pkg && test -x /usr/bin/pkgmogrify && test -x /usr/bin/pkgdepend ; then - solarispkg_ips="yes" - else - solarispkg_ips="no" - fi -fi -AC_MSG_RESULT([${solarispkg_ips}]) -AM_CONDITIONAL(WITH_SOLARIS_PKG_IPS, test x"$solarispkg_ips" = x"yes") - -dnl Note: Currently there is no reliable automatic detection - -dnl users have to ask they want systemd units installed, or -dnl risk auto-detection like seen below. -AC_MSG_CHECKING(whether to install systemd unit files) -AC_ARG_WITH([systemdsystemunitdir], - AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto)]), - [systemdsystemunitdir="${withval}"], - [systemdsystemunitdir="auto"]) -case "${systemdsystemunitdir}" in - yes|auto|"") - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir systemd 2>/dev/null`" && test -n "$systemdsystemunitdir" || systemdsystemunitdir="`$PKG_CONFIG --variable=systemdsystemunitdir libsystemd 2>/dev/null`"], - [AS_IF([test "${withval}" = yes], - [AC_MSG_ERROR([--with-systemdsystemunitdir=${withval} was requested, but PKG_CONFIG could not be queried for the system settings])]) - systemdsystemunitdir="" - ]) - ;; - no) - systemdsystemunitdir="" - ;; - *) - systemdsystemunitdir="${withval}" - ;; -esac -if test "${systemdsystemunitdir}" = "auto" ; then systemdsystemunitdir=""; fi -if test -n "${systemdsystemunitdir}"; then - AC_MSG_RESULT(using ${systemdsystemunitdir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") -dnl This option is only provided so that make distcheck can override it, -dnl otherwise we ask pkg-config whenever --with-systemdsystemunitdir is -dnl given - -AC_MSG_CHECKING(whether to install systemd shutdown files) -AC_ARG_WITH([systemdshutdowndir], - AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]), - [systemdshutdowndir="${withval}"], - [systemdshutdowndir="auto"]) -dnl Note: this option is enabled only if systemdsystemunitdir is not trivial -if test -n "${systemdsystemunitdir}"; then - case "${systemdshutdowndir}" in - yes|auto|"") - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [systemdshutdowndir="`$PKG_CONFIG --variable=systemdshutdowndir systemd 2>/dev/null`" && test -n "$systemdshutdowndir" || systemdshutdowndir="`$PKG_CONFIG --variable=systemdshutdowndir libsystemd 2>/dev/null`"], - [AS_IF([test "${systemdshutdowndir}" = yes], - [AC_MSG_ERROR([--with-systemdshutdowndir=${systemdshutdowndir} was requested, but PKG_CONFIG could not be queried for the system settings])]) - systemdshutdowndir="" - ]) - ;; - no) - systemdshutdowndir="" - ;; - *) - systemdshutdowndir="${withval}" - ;; - esac -fi -if test "${systemdshutdowndir}" = "auto" ; then systemdshutdowndir=""; fi -if test -n "${systemdshutdowndir}"; then - AC_MSG_RESULT(using ${systemdshutdowndir}) -else - AC_MSG_RESULT(no) -fi - -dnl Note: if (systemd-)tmpfiles tech is present, it can be useful even for -dnl daemons starting not as systemd units, to pre-create /var/run/nut etc. -AC_MSG_CHECKING([whether to install systemd tmpfiles files]) -AC_ARG_WITH([systemdtmpfilesdir], - AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], [Directory for systemd tmpfiles scripts (auto)]), - [systemdtmpfilesdir="${withval}"], - [systemdtmpfilesdir="auto"]) -case "${systemdtmpfilesdir}" in - yes|auto|"") - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [systemdtmpfilesdir="`$PKG_CONFIG --variable=tmpfilesdir systemd 2>/dev/null`" && test -n "$systemdtmpfilesdir" || systemdtmpfilesdir="`$PKG_CONFIG --variable=tmpfilesdir libsystemd 2>/dev/null`"], - [AS_IF([test "${systemdtmpfilesdir}" = yes], - [AC_MSG_ERROR([--with-systemdtmpfilesdir=${systemdtmpfilesdir} was requested, but PKG_CONFIG could not be queried for the system settings])]) - systemdtmpfilesdir="" - ]) - ;; - no) - systemdtmpfilesdir="" - ;; - *) - systemdtmpfilesdir="${withval}" - ;; -esac -if test "${systemdtmpfilesdir}" = "auto" ; then systemdtmpfilesdir=""; fi -if test -n "${systemdtmpfilesdir}"; then - AC_MSG_RESULT(using ${systemdtmpfilesdir}) -else - AC_MSG_RESULT(no) -fi - -dnl -dnl Tests for CppUnit availability and usability (will be built if we can, -dnl and if valgrind is enabled for this configuration - reported below). -dnl Using CppUnit implies C++ support! -dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++... -dnl AM_PATH_CPPUNIT(1.9.6) - -dnl # Tests with gcc-4.8 require this C++11 option to be provided explicitly -dnl # gcc-4.6 does not support this yet; newer gcc's should be ok by default. -dnl # Could use `AX_CXX_COMPILE_STDCXX_11([noext], [optional])` if it were -dnl # available everywhere. Or AX_CHECK_COMPILE_FLAG if it was ubiquitous: -dnl ###AX_CHECK_COMPILE_FLAG([-std=c++11], -dnl ### [CXXFLAGS="$CXXFLAGS -std=c++11" -dnl ### have_cxx11=yes], -dnl ### [have_cxx11=no]) - -AC_MSG_CHECKING(for C++11 support in current compiler) -have_cxx11=unknown -my_CXXFLAGS="$CXXFLAGS" -AC_LANG_PUSH([C++]) - -CPLUSPLUS_DECL=' -#include -#if __cplusplus < 201103L - #error This library needs at least a C++11 compliant compiler -#endif -' -CPLUSPLUS_MAIN='printf("%ld\n", __cplusplus);' - -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[${CPLUSPLUS_DECL}]], [[${CPLUSPLUS_MAIN}]])], - [AC_MSG_RESULT([yes, out of the box]) - have_cxx11=yes], - [AS_CASE(["${CXXFLAGS}"], - [*"-std="*], [ - AC_MSG_RESULT([no, not with the standard already set in CXXFLAGS='${CXXFLAGS}']) - have_cxx11=no, - ],[ - CXXFLAGS="$CXXFLAGS -std=c++11" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[${CPLUSPLUS_DECL}]], [[${CPLUSPLUS_MAIN}]])], - [AC_MSG_RESULT([yes, GCC-style (as C++11)]) - have_cxx11=yes], - [CXXFLAGS="$CXXFLAGS -std=c++0x" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[${CPLUSPLUS_DECL}]], [[${CPLUSPLUS_MAIN}]])], - [AC_MSG_RESULT([yes, GCC-style (as C++0X)]) - have_cxx11=yes], - [AC_MSG_RESULT([no]) - CXXFLAGS="$my_CXXFLAGS" - have_cxx11=no])])])]) -AM_CONDITIONAL(HAVE_CXX11, test "${have_cxx11}" = "yes") -AC_LANG_POP([C++]) -unset CPLUSPLUS_MAIN -unset CPLUSPLUS_DECL - -AC_MSG_CHECKING(for have_cppunit) -have_cppunit="no" -CPPUNIT_NUT_CXXFLAGS="" -AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AS_IF([test x"${have_cxx11}" = xyes], - [ifdef([PKG_CHECK_MODULES], [PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no)], [have_cppunit=no]) - AS_IF([test "${have_cppunit}" != "yes"], - [AC_MSG_WARN([libcppunit not found - those C++ tests will not be built.]) - have_cppunit=no], - [AS_IF([test -n "$CXX"], - [AS_IF([$CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null], - [CPPUNIT_NUT_CXXFLAGS="-g -O0"])]) - ]) - ]) - ], [AC_MSG_WARN([pkg-config not found, can not look properly for libcppunit - those C++ tests will not be built.]) - have_cppunit=no] -) -AC_MSG_RESULT(${have_cppunit}) - -dnl On some systems, CppUnit inexplicably fails with trivial assertions -dnl so it should not be enabled with those environments, corrupting the -dnl test results with misleading errors. -dnl Tracked in https://github.com/networkupstools/nut/issues/1126 -dnl One such situation was e.g. "clang++ + arm64(QEMU) + -m64" while -dnl this was not seen with other compilers or bitness on same system. -AS_IF([test "${have_cppunit}" = "yes"], - [AC_MSG_CHECKING([if current toolkit can build and run cppunit tests (e.g. no ABI issues, related segfaults, etc.)]) - dnl Code below is largely a stripped variant of our tests/example.cpp and cpputest.cpp - CPLUSPLUS_DECL=' -#include -#include -#include -#include -#include - -class ExampleTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE( ExampleTest ); - CPPUNIT_TEST( testOne ); - CPPUNIT_TEST_SUITE_END(); -public: - void setUp() {}; - void tearDown() {}; - void testOne(); -}; -CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTest ); -void ExampleTest::testOne() -{ - int i = 1; - float f = 1.0; - int cast = static_cast(f); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Casted float is not the expected int (assert_eq)", i, cast ); - CPPUNIT_ASSERT_MESSAGE("Casted float is not the expected int (assert)", (i == cast) ); -} -' - - CPLUSPLUS_MAIN=' -CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); -CppUnit::TextUi::TestRunner runner; -runner.addTest( suite ); -runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); -bool res = runner.run(); -return res ? 0 : 1; -' - - my_CXXFLAGS="$CXXFLAGS" - my_LDFLAGS="$LDFLAGS" - my_LIBS="$LIBS" - CXXFLAGS="$myCXXFLAGS $pkg_cv_CPPUNIT_CFLAGS $pkg_cv_CPPUNIT_CXXFLAGS" - LDFLAGS="$my_LDFLAGS $pkg_cv_CPPUNIT_LDFLAGS" - LIBS="$my_LIBS $pkg_cv_CPPUNIT_LIBS" - AC_LANG_PUSH([C++]) - AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([[${CPLUSPLUS_DECL}]], [[${CPLUSPLUS_MAIN}]])], - [have_cppunit=yes], [have_cppunit=no]) - CXXFLAGS="$my_CXXFLAGS" - LDFLAGS="$my_LDFLAGS" - LIBS="$my_LIBS" - AC_LANG_POP([C++]) - unset CPLUSPLUS_MAIN - unset CPLUSPLUS_DECL - ]) -AC_MSG_RESULT(${have_cppunit}) - -dnl # By default keep the originally detected have_cppunit value -AC_MSG_CHECKING(for impact from --enable-cppunit option - should we build cppunit tests?) -AC_ARG_ENABLE(cppunit, - [AS_HELP_STRING([--enable-cppunit], [enable CPPUNIT tests for C++ bindings])], - [AS_CASE(["${enableval}"], - ["yes"], [AS_IF([test x"${have_cppunit}" = xyes], [], [AC_MSG_ERROR([--with-cppunit=yes can not be satisfied])])], - ["no"], [have_cppunit=no] - )]) -AC_MSG_RESULT(${have_cppunit}) - -AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes") -AC_DEFINE_UNQUOTED(CPPUNIT_NUT_CXXFLAGS, $CPPUNIT_NUT_CXXFLAGS, [Compiler flags for cppunit tests]) - -AC_MSG_CHECKING(whether to install Augeas configuration-management lenses) -AC_ARG_WITH(augeas-lenses-dir, - AS_HELP_STRING([--with-augeas-lenses-dir=PATH], [where to install Augeas configuration-management lenses (/usr/share/augeas/lenses{/dist,/})]), -[ - case "${withval}" in - yes) - if test -z "${auglensdir}"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([augeas lenses directory requested but not found in default location]) - fi - if ! test -s scripts/augeas/nutupsconf.aug.in ; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([augeas lenses directory requested but a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if ! test -s scripts/augeas/nutupsconf.aug.in ; then - AC_MSG_WARN([augeas lenses directory skipped because a non-trivial scripts/augeas/nutupsconf.aug.in was not provided by autogen.sh or dist archive]) - auglensdir="" - fi - ;; - no) - auglensdir="" - ;; - *) - auglensdir="${withval}" - ;; - esac -], []) -if test -n "${auglensdir}"; then - AC_MSG_RESULT(using ${auglensdir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(WITH_AUGLENS, test -n "${auglensdir}") - -AC_PATH_PROGS([AUGPARSE], [augparse], [none]) -AM_CONDITIONAL([HAVE_AUGPARSE], [test "x${AUGPARSE}" != "xnone"]) -AC_MSG_CHECKING([whether to enable Augeas configuration-management lenses tests]) -if test "x${AUGPARSE}" != xnone ; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - - -AC_MSG_CHECKING(whether to install hotplug rules) -AC_ARG_WITH(hotplug-dir, - AS_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]), -[ - case "${withval}" in - yes) - if test -z "${hotplugdir}"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([hotplug directory requested but not found]) - fi - ;; - auto) - ;; - no) - hotplugdir="" - ;; - *) - hotplugdir="${withval}" - ;; - esac -], []) -if test -n "${hotplugdir}"; then - AC_MSG_RESULT(using ${hotplugdir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(WITH_HOTPLUG, test -n "${hotplugdir}") - -AC_MSG_CHECKING(whether to install udev rules) -AC_ARG_WITH(udev-dir, - AS_HELP_STRING([--with-udev-dir=PATH], [where to install udev rules (/lib/udev or /etc/udev)]), -[ - case "${withval}" in - yes) - if test -z "${udevdir}"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([udev directory requested but not found]) - fi - if test "${nut_with_usb}" = yes && ! test -s scripts/udev/nut-usbups.rules.in ; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([udev directory and USB driver support requested but a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if test "${nut_with_usb}" = yes && ! test -s scripts/udev/nut-usbups.rules.in ; then - AC_MSG_WARN([udev directory skipped because a non-trivial scripts/udev/nut-usbups.rules.in was not provided by autogen.sh or dist archive]) - udevdir="" - fi - ;; - no) - udevdir="" - ;; - *) - udevdir="${withval}" - ;; - esac -], []) -if test -n "${udevdir}"; then - AC_MSG_RESULT(using ${udevdir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(WITH_UDEV, test -n "${udevdir}") - -dnl FreeBSD devd support: - -AC_MSG_CHECKING(whether to install FreeBSD devd.conf file) -AC_ARG_WITH(devd-dir, - AS_HELP_STRING([--with-devd-dir=PATH], [where to install devd.conf file (/usr/local/etc/devd or /etc/devd)]), -[ - case "${withval}" in - yes) - if test -z "${devddir}"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([devd directory requested but not found]) - fi - if test "${nut_with_usb}" = yes && ! test -s scripts/devd/nut-usbups.rules.in -a -s scripts/devd/nut-usb.conf.in ; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([devd directory and USB driver support requested but non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) - fi - ;; - auto) - if test "${nut_with_usb}" = yes && ! test -s scripts/devd/nut-usbups.rules.in -a -s scripts/devd/nut-usb.conf.in ; then - AC_MSG_WARN([devd directory skipped because non-trivial scripts/devd/nut-usbups.rules.in and scripts/devd/nut-usb.conf.in were not provided by autogen.sh or dist archive]) - devddir="" - fi - ;; - no) - devddir="" - ;; - *) - devddir="${withval}" - ;; - esac -], []) -if test -n "${devddir}"; then - AC_MSG_RESULT(using ${devddir}) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL(WITH_DEVD, test -n "${devddir}") - -dnl - -dnl AIX system -AM_CONDITIONAL([SYSTEM_AIX], [test "xAIX" = "x`uname -s 2>/dev/null`"]) - -dnl processor type -AC_DEFINE_UNQUOTED(CPU_TYPE, ["$target_cpu"], [Define processor type]) - -dnl Can use valgrind for memory-leak testing, if present -AC_PATH_PROGS([VALGRIND], [valgrind], [none]) -dnl Even if the tool is installed, it may be not usable on build platform. -dnl QEMU may further complicate things, providing CPUs that formally match -dnl a supported family but crash in practice, or hopefully rejected early: -dnl valgrind: fatal error: unsupported CPU. -dnl Supported CPUs are: -dnl * x86 (practically any; Pentium-I or above), AMD Athlon or above) -dnl * AMD Athlon64/Opteron -dnl * ARM (armv7) -dnl * MIPS (mips32 and above; mips64 and above) -dnl * PowerPC (most; ppc405 and above) -dnl * System z (64bit only - s390x; z990 and above) -dnl Even if the tool does basically start, on some QEMU systems it crashes -dnl later (e.g. claims Signal 11 in tear-down after a successful test), so -dnl we support an explicit --without-valgrind (aka --with-valgrind=no) too. -AS_IF([test -n "${VALGRIND}"], [ - AC_MSG_CHECKING([whether valgrind is usable on current platform]) - AS_IF([( ${VALGRIND} --help >/dev/null 2>/dev/null )], - [AS_IF([( ${VALGRIND} /bin/sh -c true >/dev/null 2>/dev/null )], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - VALGRIND="none" - ])], - [AC_MSG_RESULT([no]) - VALGRIND="none" - ]) -]) -AC_MSG_CHECKING(whether to use valgrind for memory-leak testing) -AC_ARG_WITH(valgrind, - AS_HELP_STRING([--with-valgrind=PATH], [whether to use valgrind for memory-leak testing]), -[ - dnl ### echo "Caller said: '${withval}'... Discovered tool: '${VALGRIND}'... " - case "${withval}" in - yes) - if test "x$VALGRIND" = "xnone"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([valgrind requested but not found]) - fi - with_valgrind="yes" - ;; - auto) - with_valgrind="auto" - ;; - no) - with_valgrind="no" - ;; - *) - AC_PATH_PROGS([VALGRIND], ["${withval}"], [none]) - if test "x$VALGRIND" = "xnone"; then - AC_MSG_RESULT(no) - AC_MSG_ERROR([valgrind requested but not found]) - fi - with_valgrind="yes" - ;; - esac -], []) - -if test "x${with_valgrind}" = xauto; then - if test "x$VALGRIND" = "xnone"; then - with_valgrind="no" - else - with_valgrind="yes" - fi -fi - -if test "x${with_valgrind}" = xyes; then - AC_MSG_RESULT(using ${VALGRIND}) - AC_MSG_NOTICE([Do not forget to build with debug (e.g. pass '-g' in CFLAGS for GCC) for best results with valgrind tests]) -else - AC_MSG_RESULT(no) -fi -AM_CONDITIONAL([HAVE_VALGRIND], [test "x${VALGRIND}" != "xnone"]) -AM_CONDITIONAL([WITH_VALGRIND], [test "x${with_valgrind}" = "xyes"]) - -AC_MSG_CHECKING([whether to build cppunit tests using valgrind support]) -if test "x${with_valgrind}" = xyes && test "x${have_cppunit}" = xyes ; then - AC_MSG_RESULT(yes) -else - AC_MSG_RESULT(no) -fi - -dnl expand ${sysconfdir} and write it out - note that most packages -dnl override it to be /etc/nut, /etc/ups or similar, while the -dnl autotools default would be $prefix/etc -conftemp="${sysconfdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -CONFPATH=${conftemp} -AC_DEFINE_UNQUOTED(CONFPATH, "${conftemp}", [Default path for configuration files]) - -dnl same for datadir -conftemp="${datadir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -DATADIR=${conftemp} -NUT_DATADIR=${conftemp} -AC_DEFINE_UNQUOTED(DATADIR, "${conftemp}", [Default path for data files]) - -dnl same for bindir -conftemp="${bindir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -BINDIR=${conftemp} -AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", [Default path for user executables]) - -dnl same for sbindir -conftemp="${sbindir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -SBINDIR=${conftemp} -AC_DEFINE_UNQUOTED(SBINDIR, "${conftemp}", [Default path for system executables]) - -dnl same for libdir -conftemp="${libdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -LIBDIR=${conftemp} -AC_DEFINE_UNQUOTED(LIBDIR, "${conftemp}", [Default path for system libraries]) - -dnl same for libexecdir -conftemp="${libexecdir}" -eval conftemp=\"${conftemp}\" -eval conftemp=\"${conftemp}\" -LIBEXECDIR=${conftemp} -AC_DEFINE_UNQUOTED(LIBEXECDIR, "${conftemp}", [Default path for system exec-libraries]) - - -dnl checks related to --with-snmp enabled on command-line - -dnl ${nut_with_snmp}: any value except "yes" or "no" is treated as "auto". -if test "${nut_with_snmp}" = "yes" -a "${nut_have_libnetsnmp}" != "yes"; then - AC_MSG_ERROR([Net-SNMP libraries not found, required for SNMP drivers]) -fi - -if test "${nut_with_snmp}" != "no"; then - nut_with_snmp="${nut_have_libnetsnmp}" -fi - -NUT_REPORT_FEATURE([build SNMP drivers], [${nut_with_snmp}], [], - [WITH_SNMP], [Define to enable SNMP support]) -AM_CONDITIONAL([HAVE_SNMP], [test "${nut_have_libsnmp}" = "yes"]) - - -if test -n "${host_alias}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_HOST_ALIAS, "${host_alias}", [host env spec we run on]) -else - if test -n "${host}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_HOST_ALIAS, "${host}", [host env spec we run on]) - fi -fi -if test -n "${build_alias}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_BUILD_ALIAS, "${build_alias}", [host env spec we built on]) -else - if test -n "${build}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_BUILD_ALIAS, "${build}", [host env spec we built on]) - fi -fi -if test -n "${target_alias}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_TARGET_ALIAS, "${target_alias}", [host env spec we built for]) -else - if test -n "${target}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_TARGET_ALIAS, "${target}", [host env spec we built for]) - fi -fi - -if test -n "${host_cpu}" -a -n "${host_os}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_HOST_SHORT_ALIAS, "${host_cpu}-${host_os}", [host OS short spec we run on]) -fi -if test -n "${build_cpu}" -a -n "${build_os}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_BUILD_SHORT_ALIAS, "${build_cpu}-${build_os}", [host OS short spec we built on]) -fi -if test -n "${target_cpu}" -a -n "${target_os}" ; then - AC_DEFINE_UNQUOTED(AUTOTOOLS_TARGET_SHORT_ALIAS, "${target_cpu}-${target_os}", [host OS short spec we built for]) -fi - -dnl ---------------------------------------------------------------------- - -dnl Current date -now=`TZ=UTC date +%Y-%m-%d` - -AC_SUBST(now) -AC_SUBST(OS_NAME) -AC_SUBST(TREE_VERSION) -AC_SUBST(NUT_NETVERSION) -AC_SUBST(LIBSSL_CFLAGS) -AC_SUBST(LIBSSL_LIBS) -AC_SUBST(LIBSSL_REQUIRES) -AC_SUBST(LIBGD_CFLAGS) -AC_SUBST(LIBGD_LDFLAGS) -AC_SUBST(LIBNETSNMP_CFLAGS) -AC_SUBST(LIBNETSNMP_LIBS) -AC_SUBST(LIBUSB_CFLAGS) -AC_SUBST(LIBUSB_LIBS) -AC_SUBST(LIBNEON_CFLAGS) -AC_SUBST(LIBNEON_LIBS) -AC_SUBST(LIBAVAHI_CFLAGS) -AC_SUBST(LIBAVAHI_LIBS) -AC_SUBST(LIBPOWERMAN_CFLAGS) -AC_SUBST(LIBPOWERMAN_LIBS) -AC_SUBST(LIBMODBUS_CFLAGS) -AC_SUBST(LIBMODBUS_LIBS) -AC_SUBST(LIBIPMI_CFLAGS) -AC_SUBST(LIBIPMI_LIBS) -AC_SUBST(DOC_BUILD_LIST) -AC_SUBST(DOC_CHECK_LIST) -AC_SUBST(LIBWRAP_CFLAGS) -AC_SUBST(LIBWRAP_LIBS) -AC_SUBST(LIBLTDL_CFLAGS) -AC_SUBST(LIBLTDL_LIBS) -AC_SUBST(DRIVER_BUILD_LIST) -AC_SUBST(DRIVER_MAN_LIST) -AC_SUBST(DRIVER_INSTALL_TARGET) -AC_SUBST(NETLIBS) -AC_SUBST(SERLIBS) -AC_SUBST(PIDPATH) -AC_SUBST(STATEPATH) -AC_SUBST(CONFPATH) -AC_SUBST(BINDIR) -AC_SUBST(LIBDIR) -AC_SUBST(NUT_DATADIR, [`eval echo "${DATADIR}"`]) -AC_SUBST(NUT_LIBEXECDIR, [`eval echo "${LIBEXECDIR}"`]) -AC_SUBST(DRVPATH) -AC_SUBST(SBINDIR) -AC_SUBST(PORT) -AC_SUBST(RUN_AS_USER) -AC_SUBST(RUN_AS_GROUP) -AC_SUBST(SUN_LIBUSB) -AC_SUBST(WORDS_BIGENDIAN) -AC_SUBST(cgiexecdir) -AC_SUBST(devddir) -AC_SUBST(driverexecdir) -AC_SUBST(htmldir) -AC_SUBST(pkgconfigdir) -AC_SUBST(systemdsystemunitdir) -AC_SUBST(systemdshutdowndir) -AC_SUBST(systemdtmpfilesdir) -AC_SUBST(auglensdir) -AC_SUBST(hotplugdir) -AC_SUBST(udevdir) - -dnl On a related note to warning setup below, we limit the minimum C and C++ -dnl standard versions to ones we actively strive to support (C99 and C++11, -dnl GNU dialects tend to work on more systems if supported by compiler there). -dnl It is assumed that on very old systems whose compilers do not know these -dnl standards (only support ANSI/C89/C90 or older), as well as for builds -dnl that explicitly specify a CFLAGS="-std=..." (for GCC/CLANG toolkits), -dnl nothing should get added to CFLAGS/CXXFLAGS by this method: -NUT_COMPILER_FAMILY_FLAGS_DEFAULT_STANDARD - -dnl Filter through known variants first, so automatic choices can be made. -dnl Note that clang identifies as gcc-compatible so should be probed first. -dnl TODO: Flip this default to "hard" when we clear existing codebase. -dnl Note: the "gcc-legacy" option is intentionally undocumented, it acts as -dnl least-surprise default if caller did not specify any --enable-warnings. -dnl Note: Currently the "gcc-minimal" mode below adapts to builds with -dnl C89/C90/ANSI mode to be less noisy. Keep this in mind if changing the -dnl default "nut_warning_difficulty" and/or the case handling below. -dnl NOTE: Until X-Mas 2021, the default was "minimal" (now "medium") -nut_warning_difficulty="medium" -AC_MSG_CHECKING([whether to pre-set warnings (from '${nut_enable_warnings}')]) -AS_CASE(["${nut_enable_warnings}"], - [no|all|gcc-legacy|gcc-minimal|clang-minimal|gcc-medium|clang-medium|gcc-hard|clang-hard], [], - [clang], [nut_enable_warnings="${nut_enable_warnings}-${nut_warning_difficulty}"], - [gcc], [ - AS_CASE(["${CFLAGS}"], - [*89*|*90*|*ansi*], [nut_enable_warnings="${nut_enable_warnings}-minimal"], - [nut_enable_warnings="${nut_enable_warnings}-${nut_warning_difficulty}"] - )], - [yes|auto|""], [ - AS_IF([test "${CLANGCC}" = "yes"], [nut_enable_warnings="clang-${nut_warning_difficulty}"], - [AS_IF([test "${GCC}" = "yes"], [ - AS_CASE(["${CFLAGS}"], - [*89*|*90*|*ansi*], [nut_enable_warnings="gcc-minimal"], - [AS_CASE(["`$CC --version | grep -i gcc`"], - [*" "1.*|*" "2.*|3.*|*" "4.0*|*" "4.1*|*" "4.2*|*" "4.3*], [ - AC_MSG_WARN([Very old GCC in use, disabling warnings]) - dnl #AS_IF([test x"${nut_enable_Werror}" = xauto], [nut_enable_Werror="no"]) - nut_enable_Werror="no" - nut_enable_warnings="no"], - [*" "4.4*|*" "4.5*|*" "4.6*|*" "4.7*|*" "4.8*], [nut_enable_warnings="gcc-legacy"], - [nut_enable_warnings="gcc-${nut_warning_difficulty}"] - )] - )], [nut_enable_warnings="all"]) - ]) - ], - [hard|auto-hard|auto=hard], [ - AS_IF([test "${CLANGCC}" = "yes"], [nut_enable_warnings="clang-hard"], - [AS_IF([test "${GCC}" = "yes"], [nut_enable_warnings="gcc-hard"], [nut_enable_warnings="all"]) - ]) - ], - [medium|auto-medium|auto=medium], [ - AS_IF([test "${CLANGCC}" = "yes"], [nut_enable_warnings="clang-medium"], - [AS_IF([test "${GCC}" = "yes"], [nut_enable_warnings="gcc-medium"], [nut_enable_warnings="all"]) - ]) - ], - [minimal|auto-minimal|auto=minimal], [ - AS_IF([test "${CLANGCC}" = "yes"], [nut_enable_warnings="clang-minimal"], - [AS_IF([test "${GCC}" = "yes"], [nut_enable_warnings="gcc-minimal"], [nut_enable_warnings="all"]) - ]) - ], - [legacy], [AS_IF([test "${GCC}" = "yes"], [nut_enable_warnings="gcc-legacy"], [nut_enable_warnings="no"])], - [AC_MSG_WARN([Unsupported variant for --enable-warnings=${nut_enable_warnings}, ignored]) - nut_enable_warnings="no" - ] -) -AC_MSG_RESULT(["${nut_enable_warnings}"]) - -dnl # Nothing special for gcc - we tend to survive it with GNU standard >= 99 -dnl # and fail with strict C standard. Suggestions welcome for "gcc-hard" to -dnl # make a difference. -dnl # Note that "medium" and "hard" settings tend to trigger warnings also -dnl # from system headers, so we try to avoid them, using "-isystem path" -dnl # pre-set in our `m4/nut_compiler_family.m4` script: -dnl # https://stackoverflow.com/questions/36355232/disable-certain-warnings-for-system-headers -dnl # and "-Wno-system-headers" below. -dnl # Some of the compiler flags (including those added by pkg-config of some -dnl # third-party dependency packages) can upset older compiler releases which -dnl # did not yet support those. Flags like "-Wno-unknown-warning" for GCC or -dnl # "-Wno-unknown-warning-option" for CLANG should take care of that at least -dnl # for toolkit versions that support these - set in NUT_COMPILER_FAMILY_FLAGS -dnl # Majority of sanity checks are enabled by "-Wextra" on both GCC and CLANG -dnl # and "-Weverything" additionally on CLANG. They are impractically picky, -dnl # especially with fallout from system headers that we can not impact anyway -dnl # so the "difficulty level" pre-sets exclude certain warning classes from -dnl # that report. -dnl ### Special exclusion picks for clang-hard: -dnl # -Wno-unused-macros -- system headers define a lot of stuff we do not use, -dnl # gotta be fatal right? -dnl # -Wno-reserved-id-macro -- configure script tends to define _GNU_SOURCE_, -dnl # __EXTENSIONS__ etc. which are underscored and reserved for compilers -dnl # -Wno-padded -- NSPR and NSS headers get to issue lots of that -dnl # -Wno-c++98-compat-pedantic -Wno-c++98-compat -- our C++ code uses nullptr -dnl # as requested by newer linters, and C++98 does not. We require C++11 -dnl # or newer anyway, and skip building C++ library and test otherwise. -dnl ### Special exclusion picks for clang-medium (same as hard, plus...): -dnl # -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -dnl # -- reduce noise due to floating-point literals like "3.14" being a C -dnl # double type (a "3.14f" literal is a C float) cast implicitly into -dnl # float variables. Also variadic functions like printf() cast their -dnl # floating-point arguments into double (and small integer types into -dnl # "int") which then confuses pedantic checks of printf("%f", floatval). -dnl # -Wno-conversion -- similarly for error: implicit conversion loses -dnl # floating-point precision: 'double' to 'float' [-Werror,-Wconversion] -dnl # max_output = atof(sValue); -dnl # -Wno-cast-qual -- our code calls some library methods in ways which use -dnl # a "const char *" as a "char *" or vice-versa. Sometimes these method -dnl # signatures differ between dependency releases; sometimes they just -dnl # happened too hard to unravel cleanly and add more warnings. -dnl # This exclusion may be removed after common warnings are solved, -dnl # to allow progress on rectifying these cases next. -dnl # -Wno-incompatible-pointer-types-discards-qualifiers -- our code often -dnl # defines (char*) as the type for struct fields and method arguments, -dnl # but initializes/passes (char[]) variables or fixed strings. -dnl # This makes at least clang-3.4 quite upset and noisy (seems newer -dnl # versions care less about this situation). -dnl # -Wno-disabled-macro-expansion -- some system definitions of strncmp() -dnl # and other routines are in fact recursive macros. The -Weverything -dnl # mode of clang(-3.4) disables their handling, unless told otherwise. -AS_CASE(["${nut_enable_warnings}"], - [all], [ - CFLAGS="${CFLAGS} -Wall" - CXXFLAGS="${CXXFLAGS} -Wall" - ], - [clang-hard], [ - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -pedantic" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat" - ], - [clang-medium], [ - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -pedantic -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat" - ], - [clang-minimal], [ - CFLAGS="${CFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation" - ], - [gcc-legacy], [CFLAGS="${CFLAGS} -Wall -Wsign-compare"], - [gcc-minimal], [ - dnl Builds with C89 (and aliases) are quite noisy for C99+ syntax used - dnl in NUT. The minimal-warnings should not complain in these builds. - dnl To make matters worse, many modern OS and third-party library - dnl headers can not be used with "C90 + pedantic" mode of GCC, either. - CFLAGS="${CFLAGS} -Wall -Wsign-compare" - CXXFLAGS="${CXXFLAGS} -Wall -Wextra" - AS_CASE(["${CFLAGS}"], - [*89*|*90*|*ansi*], [], - [CFLAGS="${CFLAGS} -Wextra -pedantic"] - ) - ], - [gcc-medium|gcc-hard], [ - CFLAGS="${CFLAGS} -Wno-system-headers -Wall -Wextra -Wsign-compare" - CXXFLAGS="${CXXFLAGS} -Wno-system-headers -Wall -Wextra" - AS_CASE(["${CFLAGS}"], - [*89*|*90*|*ansi*], [], - [CFLAGS="${CFLAGS} -pedantic"] - ) - ] -) - -AC_MSG_CHECKING([whether to make warnings fatal]) -AS_CASE(["${nut_enable_Werror}"], - [yes|auto], [ - CFLAGS="${CFLAGS} -Werror" - CXXFLAGS="${CXXFLAGS} -Werror" - ], - [no], [ - CFLAGS="${CFLAGS} -Wno-error" - CXXFLAGS="${CXXFLAGS} -Wno-error" - ] -) -AC_MSG_RESULT(["${nut_enable_Werror}"]) - -dnl Some compilers (e.g. older clang-3.4) have issues with built-in methods -dnl that are implemented as macros in system headers -- but only for some -dnl sources like snmp-ups.c, nutscan-serial.c, scan_eaton_serial.c, serial.c, -dnl scan_avahi.c, scan_xml_http.c, scan_snmp.c... (Seems they all refer to -dnl -DNETSNMP_USE_INLINE among other options, and tends to happen more with -dnl OpenSSL-enabled builds). Check if we like them? -AC_CHECK_HEADER([string.h], - [AC_LANG_PUSH([C]) - CFLAGS_SAVED="${CFLAGS}" - CFLAGS_BUILTIN_STR="-fno-builtin-strchr -fno-builtin-strcmp -fno-builtin-strncmp" - CFLAGS="${CFLAGS} -Werror -Wunreachable-code ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - AC_MSG_CHECKING([whether we should disable string built-ins]) - dnl AC_DEFINE([HAVE_STRING_H], [1], [Define to 1 if you have .]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [char *s = "v1", c = '%'; -if (strcmp(s, "v1") != 0) return 1; -if (strchr(s, '1') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - ])], - [CFLAGS="${CFLAGS_SAVED}" - AC_MSG_RESULT([no, they are not a problem])], - [CFLAGS="${CFLAGS_BUILTIN_STR} ${CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [char *s = "v1", c = '%'; -if (strcmp(s, "v1") != 0) return 1; -if (strchr(s, '1') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - ])], - [CFLAGS="${CFLAGS_BUILTIN_STR} ${CFLAGS_SAVED}" - AC_MSG_RESULT([yes, this solves a problem])], - [CFLAGS="${CFLAGS_SAVED} -Werror -Wno-unreachable-code ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [char *s = "mibs", c = '%'; -/* Macro version of strcmp() has problems with strings shorter than - * 3 or 4 bytes, so to avoid nailing "-Warray-bounds" as well, - * here we just test for longer strings - existing NUT sources were - * fixed for this situation already */ -if (strcmp(s, "mibs") != 0) return 1; -if (strchr(s, 'b') == NULL) return 1; -if (strchr(s, c) != NULL) return 1 -/* no ";return 0;" here - autoconf adds one */ - ])], - [dnl CFLAGS="${CFLAGS_SAVED} -Wno-unreachable-code" - dnl NOTE: Empirically, constrain to just LIBNETSNMP_CFLAGS - CFLAGS="${CFLAGS_SAVED}" - LIBLTDL_CFLAGS="${LIBLTDL_CFLAGS} -Wno-unreachable-code" - LIBNETSNMP_CFLAGS="${LIBNETSNMP_CFLAGS} -Wno-unreachable-code" - AC_MSG_RESULT([no, but -Wno-unreachable-code solves the problem for this compiler])], - [CFLAGS="${CFLAGS_SAVED}" - AC_MSG_RESULT([no, this does not solve the problem or is not supported]) - ]) - ]) - ] - ) - AC_LANG_POP([C])] -) - -dnl Similar to above, for s_addr = htonl((ntohl(ip->start.s_addr) + 1)); -dnl which causes "shadowed local variable" as (re-)defined in nested macros. -dnl Technically also needs to `#include ` for struct in_addr -dnl but that should be pulled by inet.h anyway -AC_CHECK_HEADER([arpa/inet.h], - [AC_LANG_PUSH([C]) - CFLAGS_SAVED="${CFLAGS}" - CFLAGS_BUILTIN_NTOHL="-fno-builtin-htonl -fno-builtin-ntohl" - CFLAGS="${CFLAGS} -Werror -Wunreachable-code -Wshadow ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - AC_MSG_CHECKING([whether we should disable htonl/ntohl built-ins]) - dnl AC_DEFINE([HAVE_ARPA_INET_H], [1], [Define to 1 if you have .]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) -/* no ";return 0;" here - autoconf adds one */ - ])], - [CFLAGS="${CFLAGS_SAVED}" - AC_MSG_RESULT([no, they are not a problem])], - [CFLAGS="${CFLAGS_BUILTIN_NTOHL} ${CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) -/* no ";return 0;" here - autoconf adds one */ - ])], - [CFLAGS="${CFLAGS_BUILTIN_NTOHL} ${CFLAGS_SAVED}" - AC_MSG_RESULT([yes, this solves a problem])], - [CFLAGS="${CFLAGS_SAVED} -Werror -Wno-shadow ${LIBNETSNMP_CFLAGS} ${LIBLTDL_CFLAGS} ${LIBNEON_CFLAGS} ${LIBSSL_CFLAGS}" - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - ]], [struct in_addr sin = {0}; -sin.s_addr = htonl((ntohl(sin.s_addr) + 1)) - ])], - [CFLAGS="${CFLAGS_SAVED}" - LIBLTDL_CFLAGS="${LIBLTDL_CFLAGS} -Wno-shadow" - LIBNETSNMP_CFLAGS="${LIBNETSNMP_CFLAGS} -Wno-shadow" - AC_MSG_RESULT([no, but -Wno-shadow solves the problem for this compiler])], - [CFLAGS="${CFLAGS_SAVED}" - AC_MSG_RESULT([no, this does not solve the problem or is not supported]) - ]) - ]) - ] - ) - AC_LANG_POP([C])] -) - -dnl Finally restore warnings settings that the caller might have provided in CFLAGS etc -NUT_POP_WARNINGS - -dnl Due to possibly repetitive content, generate unique settings -dnl relative to the top_builddir (distcheck and all): -AC_MSG_CHECKING([for top build dir for this configure run]) -TOP_BUILDDIR="" -AS_IF([test -n "${ac_abs_top_builddir}" && test -d "${ac_abs_top_builddir}"], - [TOP_BUILDDIR="${ac_abs_top_builddir}"], - [AS_IF([test -n "${ac_pwd}" && test -d "${ac_pwd}"], - [TOP_BUILDDIR="${ac_pwd}"], - [TOP_BUILDDIR="`dirname "$0"`" - TOP_BUILDDIR="`cd "$TOP_BUILDDIR" && pwd`" || AC_MSG_ERROR([Can not detect TOP_BUILDDIR])] - )] -) -AC_MSG_RESULT(["${TOP_BUILDDIR}"]) - -ABS_TOP_BUILDDIR="`cd "${TOP_BUILDDIR}" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_BUILDDIR]) -ABS_TOP_SRCDIR="`cd "${abs_srcdir}" && pwd`" || AC_MSG_ERROR([Can not detect ABS_TOP_SRCDIR]) -AM_CONDITIONAL([BUILDING_IN_TREE], [test "${ABS_TOP_BUILDDIR}" = "${ABS_TOP_SRCDIR}"]) - -AC_MSG_CHECKING([whether to customize ${TOP_BUILDDIR}/scripts/systemd/nut-common.tmpfiles.in for this system]) -AS_IF([test -n "$systemdtmpfilesdir"], - [mkdir -p "${TOP_BUILDDIR}"/scripts/systemd - cat > "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -# State file (e.g. upsd to driver) and pidfile location for NUT: -d @STATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @STATEPATH@/nut -EOF - AS_IF([test "$STATEPATH" != "$PIDPATH"], - [cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @PIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @PIDPATH@/nut -EOF]) - AS_IF([test -n "$ALTPIDPATH" && test "$STATEPATH" != "$ALTPIDPATH" && test "$PIDPATH" != "$ALTPIDPATH"], - [cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @ALTPIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @ALTPIDPATH@/nut -EOF]) - AS_IF([test -n "$ALTSTATEPATH" && test "$STATEPATH" != "$ALTSTATEPATH" && test "$ALTSTATEPATH" != "$ALTPIDPATH" && test "$PIDPATH" != "$ALTSTATEPATH"], - [cat >> "${TOP_BUILDDIR}"/scripts/systemd/nut-common.tmpfiles.in << EOF -d @ALTSTATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @ALTSTATEPATH@/nut -EOF]) -]) -AC_MSG_RESULT([done]) - -AC_MSG_NOTICE([Generating "data" files from templates, see below for executable scripts]) -AC_CONFIG_FILES([ - clients/Makefile - common/Makefile - conf/Makefile - conf/upsmon.conf.sample - conf/upssched.conf.sample - data/html/header.html - data/html/Makefile - data/Makefile - data/driver.list - docs/Makefile - docs/cables/Makefile - docs/docinfo.xml - docs/man/Makefile - drivers/Makefile - include/Makefile - lib/libupsclient-config - lib/libupsclient.pc - lib/libnutclient.pc - lib/libnutclientstub.pc - lib/libnutscan.pc - lib/Makefile - scripts/Aix/nut-aix.spec - scripts/augeas/Makefile - scripts/augeas/nutnutconf.aug - scripts/augeas/nutupsdconf.aug - scripts/augeas/nutupsdusers.aug - scripts/augeas/nutupsmonconf.aug - scripts/augeas/nutupsschedconf.aug - scripts/augeas/nuthostsconf.aug - scripts/augeas/nutupssetconf.aug - scripts/avahi/nut.service - scripts/devd/Makefile - scripts/hotplug/Makefile - scripts/hotplug/libhidups - scripts/HP-UX/nut.psf - scripts/python/Makefile - scripts/python/module/PyNUT.py - scripts/upsdrvsvcctl/Makefile - scripts/systemd/Makefile - scripts/systemd/nut-common.tmpfiles - scripts/systemd/nut-driver@.service - scripts/systemd/nut-monitor.service - scripts/systemd/nut-server.service - scripts/systemd/nut-driver-enumerator.service - scripts/systemd/nut-driver-enumerator.path - scripts/Solaris/nut-driver-enumerator.xml - scripts/Solaris/nut-driver.xml - scripts/Solaris/nut-monitor.xml - scripts/Solaris/nut-server.xml - scripts/Solaris/nut.xml - scripts/Solaris/Makefile - scripts/Solaris/pkginfo - scripts/udev/Makefile - scripts/udev/nut-ipmipsu.rules - scripts/ufw/Makefile - scripts/ufw/nut.ufw.profile - scripts/Makefile - server/Makefile - tools/Makefile - tools/nut-scanner/Makefile - tests/Makefile - tests/NIT/Makefile - Makefile -]) - -AC_MSG_NOTICE([Generating templated script files that should be marked executable]) -m4_foreach_w([SCRIPTFILE], [ - scripts/Aix/nut.init - scripts/HP-UX/postinstall - scripts/python/app/NUT-Monitor-py2gtk2 - scripts/python/app/NUT-Monitor-py3qt5 - scripts/augeas/gen-nutupsconf-aug.py - scripts/python/module/test_nutclient.py - scripts/upsdrvsvcctl/nut-driver-enumerator.sh - scripts/upsdrvsvcctl/upsdrvsvcctl - scripts/systemd/nutshutdown - scripts/Solaris/svc-nut-server - scripts/Solaris/svc-nut-monitor - scripts/Solaris/precheck.py - scripts/Solaris/preinstall - scripts/Solaris/postinstall - scripts/Solaris/preremove - scripts/Solaris/postremove - scripts/Solaris/preproto.pl - scripts/Solaris/nut - tools/gitlog2changelog.py - tools/nut-snmpinfo.py -], [ - dnl Autoconf substitutes the token above specified in plain text, - dnl e.g. the brace below is empty and bracket gives verbatim varname - dnl AC_MSG_NOTICE([Script: SCRIPTFILE brace:(${SCRIPTFILE}) bracket:([SCRIPTFILE])]) - AC_CONFIG_FILES(SCRIPTFILE, chmod +x "SCRIPTFILE") -]) - -AC_MSG_NOTICE([Generating templated script files whose templates might have been generated (or not) by autogen.sh calling our helper scripts]) -m4_foreach_w([SCRIPTFILE], [ - scripts/augeas/nutupsconf.aug - scripts/udev/nut-usbups.rules - scripts/devd/nut-usb.conf -], [ - AC_MSG_CHECKING([whether to generate SCRIPTFILE]) - AS_IF([test -s SCRIPTFILE.in && ! test -f SCRIPTFILE.in.AUTOGEN_WITHOUT], - [AC_MSG_RESULT(yes) - AC_CONFIG_FILES(SCRIPTFILE)], - [AC_MSG_RESULT(no)] - ) -]) - -AC_OUTPUT - -NUT_PRINT_FEATURE_REPORT diff --git a/configure.in b/configure.in new file mode 100644 index 0000000..eda6ae6 --- /dev/null +++ b/configure.in @@ -0,0 +1,1244 @@ +dnl +------------------------------------------------------------------+ +dnl | Network UPS Tools: configure.in | +dnl +------------------------------------------------------------------+ + +dnl NUT version number is defined here, with a Git suffix in include/nut_version.h +AC_INIT(nut, 2.7.1) +AC_CONFIG_SRCDIR(server/upsd.c) +AC_CONFIG_MACRO_DIR([m4]) +echo "Network UPS Tools version ${PACKAGE_VERSION}" +AC_CANONICAL_SYSTEM +NUT_CHECK_OS +AC_CONFIG_HEADER(include/config.h) +AC_PREFIX_DEFAULT(/usr/local/ups) +AM_INIT_AUTOMAKE + +dnl we need Autoconf 2.60 or better to enable features of Posix that are extensions to C +AC_MSG_CHECKING(for autoconf macro to enable system extensions) +m4_version_prereq(2.60, [ + AC_MSG_RESULT(yes) + AC_USE_SYSTEM_EXTENSIONS +], [ + AC_MSG_RESULT(no) +]) + +dnl Use "./configure --enable-maintainer-mode" to keep Makefile.in and Makefile +dnl in sync after SVN updates. +AM_MAINTAINER_MODE + +dnl PKG_PROG_PKG_CONFIG + +dnl Various version related processing +dnl ---------------------------------- + +dnl # the following is commented out, because the UPS_VERSION macro now +dnl # resides in include/nut_version.h, which is generated by Makefile.am, +dnl # rather than in include/config.h, which is generated by configure. The +dnl # reason is that the SVN revision should be computed at compile time, +dnl # not configure time. +dnl AC_DEFINE_UNQUOTED(UPS_VERSION, "${PACKAGE_VERSION}", [NUT version]) + +dnl However, automatically define the tree version (mostly for AC_SUBST) +TREE_VERSION="`echo ${PACKAGE_VERSION} | awk '{ print substr($0,1,3) }'`" +AC_DEFINE_UNQUOTED(TREE_VERSION, "${TREE_VERSION}", [NUT tree version]) + +NUT_NETVERSION="1.2" +AC_DEFINE_UNQUOTED(NUT_NETVERSION, "${NUT_NETVERSION}", [NUT network protocol version]) + + +dnl Fix this early so we can expand with eval later +test "${prefix}" = "NONE" && prefix="${ac_default_prefix}" +test "${exec_prefix}" = "NONE" && exec_prefix='${prefix}' + +CFLAGS=${CFLAGS-"-O"} + +dnl NOTE: for definition of NUT_* autoconf macros, see m4/ directory +dnl and docs/macros.txt + +dnl +------------------------------------------------------------------+ +dnl | default values for things later on (can be overridden) | + +STATEPATH="/var/state/ups" + +cgiexecdir='${exec_prefix}/cgi-bin' +driverexecdir='${exec_prefix}/bin' +htmldir='${prefix}/html' +pkgconfigdir='${libdir}/pkgconfig' +hotplugdir='/etc/hotplug' +if test ! -d "${hotplugdir}"; then + hotplugdir='' +fi +udevdir='/lib/udev' +if test ! -d "${udevdir}"; then + udevdir='/etc/udev' + if test ! -d "${udevdir}"; then + udevdir='' + fi +fi + +RUN_AS_USER="nobody" +RUN_AS_GROUP="nobody" +PIDPATH="/var/run" + +dnl Define directory where LIBOBJS replacement functions are +AC_CONFIG_LIBOBJ_DIR([common]) + +dnl +------------------------------------------------------------------- + +AC_PROG_CC +dnl Needed for per-target flags +AM_PROG_CC_C_O +AC_PROG_CPP +AC_PROG_CXX +AC_PROG_INSTALL +AC_PROG_EGREP +AC_PATH_PROG(AR, ar) +AC_CHECK_TOOL(RANLIB, ranlib, :) +dnl Postpone call to AC_PROG_LIBTOOL to allow disabling static lib +AC_C_BIGENDIAN +AC_C_INLINE +AC_C_FLEXIBLE_ARRAY_MEMBER +AC_C_VARARRAYS +AC_CHECK_FUNCS(flock lockf fcvt fcvtl) +AC_CHECK_FUNCS(cfsetispeed tcsendbreak) +AC_CHECK_FUNCS(seteuid setsid getpassphrase) +AC_CHECK_FUNCS(on_exit strptime setlogmask) +AC_CHECK_DECLS(LOG_UPTO, [], [], [#include ]) + +dnl the following may add stuff to LIBOBJS (is this still needed?) +AC_CHECK_FUNCS(vsnprintf snprintf, [], [ + AC_LIBOBJ(snprintf) + AC_TYPE_LONG_DOUBLE + AC_TYPE_LONG_LONG_INT +]) + +AC_REPLACE_FUNCS(setenv strerror atexit) + + +dnl +dnl Tests for CppUnit availability and usability +dnl Using CppUnit implies C++ support! +dnl Theoretically, libcppunit-dev will pull up to g++, through libstdc++... +dnl AM_PATH_CPPUNIT(1.9.6) + +PKG_CHECK_MODULES(CPPUNIT, cppunit, have_cppunit=yes, have_cppunit=no) +if test "${have_cppunit}" != "yes" ; then + AC_MSG_WARN([libcppunit not found.]) +fi +AM_CONDITIONAL(HAVE_CPPUNIT, test "${have_cppunit}" = "yes") + +dnl +dnl Only use these when compiling with gcc +dnl +if ( test "${GCC}" = "yes" ) +then + CFLAGS="${CFLAGS} -Wall -Wsign-compare" +fi + +case ${target_os} in + solaris2* ) + dnl On Solaris, this allows errno to use thread local storage + CFLAGS="${CFLAGS} -D_REENTRANT" + ;; + aix* ) + dnl On AIX, this allows errno to use thread local storage + CFLAGS="${CFLAGS} -D_REENTRANT" + ;; + hpux11* ) + dnl It seems like the thread safe string functions will not be included + dnl on 64 bit HP-UX unless we define _REENTRANT + CFLAGS="${CFLAGS} -D_REENTRANT" + ;; +esac + +dnl optind handling: +dnl need to check if unistd.h is enough, else try getopt.h, else need decls +AC_CHECK_DECLS(optind, [], [ + AC_CHECK_HEADERS(getopt.h, [ + AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed]) + ], [ + AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations]) + ], [AC_INCLUDES_DEFAULT]) +], [AC_INCLUDES_DEFAULT]) + +dnl do a 2nd check to ensure inclusion of getopt.h, in case optind is known +AC_CHECK_HEADERS(getopt.h, [ + AC_DEFINE(NEED_GETOPT_H, 1, [Define if getopt.h is needed]) +], [ + AC_DEFINE(NEED_GETOPT_DECLS, 1, [Define to use explicit getopt declarations]) +], [AC_INCLUDES_DEFAULT]) + +dnl also check for getopt_long +AC_CHECK_FUNCS(getopt_long) + +dnl FreeBSD serial locking compatibility - look for uu_lock in libutil.h +AC_CHECK_DECLS(uu_lock, [ + AC_DEFINE(HAVE_UU_LOCK, 1, [Use uu_lock for locking (FreeBSD)]) + SERLIBS="-lutil" + dnl put in some better defaults for FreeBSD + RUN_AS_USER="uucp" +], [ + SERLIBS="" +], [ +#include +#include +]) + +AC_CHECK_DECLS(__func__, [], [ + AC_CHECK_DECLS(__FUNCTION__, [ + AC_DEFINE(__func__, __FUNCTION__, [Replace missing __func__ declaration]) + ], [ + AC_DEFINE(__func__, __LINE__, [Replace missing __func__ declaration]) + ], [AC_INCLUDES_DEFAULT]) +], [AC_INCLUDES_DEFAULT]) + +dnl Solaris compatibility - check for -lnsl and -lsocket +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(connect, socket) + +AC_HEADER_TIME +AC_CHECK_HEADERS(sys/modem.h stdarg.h varargs.h sys/termios.h sys/time.h, [], [], [AC_INCLUDES_DEFAULT]) + +# pthread related checks +AC_SEARCH_LIBS([pthread_create], [pthread], + [AC_DEFINE(HAVE_PTHREAD, 1, [Define to enable pthread support code])], + []) + +dnl ---------------------------------------------------------------------- +dnl Check for types and define possible replacements +NUT_TYPE_SOCKLEN_T + +dnl ---------------------------------------------------------------------- +dnl check for --with-all (or --without-all, or --with-all=auto) flag + +AC_MSG_CHECKING(for --with-all) +AC_ARG_WITH(all, + AS_HELP_STRING([--with-all], [enable serial, usb, snmp, neon, ipmi, powerman, cgi, dev, avahi]), +[ + if test -n "${withval}"; then + dnl Note: we allow "no" as a positive value, because + dnl this is what the user expects from --without-all + if test -z "${with_serial}"; then with_serial="${withval}"; fi + if test -z "${with_usb}"; then with_usb="${withval}"; fi + if test -z "${with_snmp}"; then with_snmp="${withval}"; fi + if test -z "${with_neon}"; then with_neon="${withval}"; fi + if test -z "${with_powerman}"; then with_powerman="${withval}"; fi + if test -z "${with_cgi}"; then with_cgi="${withval}"; fi + if test -z "${with_dev}"; then with_dev="${withval}"; fi + if test -z "${with_avahi}"; then with_avahi="${withval}"; fi + if test -z "${with_ipmi}"; then with_ipmi="${withval}"; fi + AC_MSG_RESULT("${withval}") + else + AC_MSG_RESULT(not given) + fi +], [ + AC_MSG_RESULT(not given) +]) + +dnl ---------------------------------------------------------------------- +dnl declare a number of --with-FEATURE options. Do this early, so that +dnl they are listed near the top by "./configure --help" + +NUT_ARG_WITH([dev], [build and install the development files], [no]) +NUT_ARG_WITH([serial], [build and install serial drivers], [yes]) +NUT_ARG_WITH([usb], [build and install USB drivers], [auto]) +NUT_ARG_WITH([doc], [build and install documentation], [no]) +NUT_ARG_WITH([avahi], [build and install Avahi support], [auto]) + +dnl ---------------------------------------------------------------------- +dnl Check for presence and compiler flags of various libraries + +dnl These checks are performed unconditionally, even if the corresponding +dnl --with-* options are not given. This is because we cannot predict +dnl what will be in the --with-drivers argument. + +NUT_CHECK_LIBNETSNMP +NUT_CHECK_LIBUSB +NUT_ARG_WITH([hal], [build and install HAL support], [no]) +NUT_CHECK_LIBHAL +NUT_CONFIG_LIBHAL +NUT_ARG_WITH([snmp], [build and install SNMP drivers], [auto]) +NUT_CHECK_LIBNETSNMP +NUT_ARG_WITH([neon], [build and install neon based XML/HTTP driver], [auto]) +NUT_CHECK_LIBNEON +NUT_ARG_WITH([powerman], [build and install Powerman PDU client driver], [auto]) +NUT_CHECK_LIBPOWERMAN +NUT_CHECK_LIBAVAHI + +dnl ---------------------------------------------------------------------- +dnl additional USB-related checks + +dnl Solaris 10/11 USB handling (need librt and libusb runtime path) +dnl HPUX, since v11, needs an explicit activation of pthreads +case ${target_os} in + solaris2.1* ) + echo Checking for Solaris 10 / 11 specific configuration for usb drivers + AC_SEARCH_LIBS(nanosleep, rt) + LIBUSB_LIBS="-R/usr/sfw/lib ${LIBUSB_LIBS}" + dnl FIXME: Sun's libusb doesn't support timeout (so blocks notification) + dnl and need to call libusb close upon reconnection + AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of the libusb.]) + SUN_LIBUSB=1 + ;; + hpux11*) + CFLAGS="${CFLAGS} -lpthread" +esac + + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-serial + +dnl ${nut_with_serial}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_serial}" != "no"; then + nut_with_serial="yes" +fi + +NUT_REPORT_FEATURE([build serial drivers], [${nut_with_serial}], [], + [WITH_SERIAL], [Define to enable serial support]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-usb + +dnl ${nut_with_usb}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_usb}" = "yes" -a "${nut_have_libusb}" != "yes"; then + AC_MSG_ERROR(["USB drivers requested, but libusb not found."]) +fi + +if test "${nut_with_usb}" != "no"; then + nut_with_usb="${nut_have_libusb}" +fi + +NUT_REPORT_FEATURE([build USB drivers], [${nut_with_usb}], [], + [WITH_USB], [Define to enable USB support]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-snmp + +dnl ${nut_with_snmp}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_snmp}" = "yes" -a "${nut_have_libnetsnmp}" != "yes"; then + AC_MSG_ERROR(["Net-SNMP libraries not found, required for SNMP drivers"]) +fi + +if test "${nut_with_snmp}" != "no"; then + nut_with_snmp="${nut_have_libnetsnmp}" +fi + +NUT_REPORT_FEATURE([build SNMP drivers], [${nut_with_snmp}], [], + [WITH_SNMP], [Define to enable SNMP support]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-neon + +dnl ${nut_with_neon}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_neon}" = "yes" -a "${nut_have_neon}" != "yes"; then + AC_MSG_ERROR(["neon libraries not found, required for neon based XML/HTTP driver"]) +fi + +if test "${nut_with_neon}" != "no"; then + nut_with_neon="${nut_have_neon}" +fi + +NUT_REPORT_FEATURE([build neon based XML driver], [${nut_with_neon}], [], + [WITH_NEON], [Define to enable Neon HTTP support]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-avahi + +dnl ${nut_with_avahi}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_avahi}" = "yes" -a "${nut_have_avahi}" != "yes"; then + AC_MSG_ERROR(["avahi libraries not found"]) +fi + +if test "${nut_with_avahi}" != "no"; then + nut_with_avahi="${nut_have_avahi}" +fi + +NUT_REPORT_FEATURE([enable Avahi support], [${nut_with_avahi}], [], + [WITH_AVAHI], [Define to enable Avahi support]) + +dnl ---------------------------------------------------------------------- + +dnl checks related to --with-powerman + +dnl ${nut_with_powerman}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_powerman}" = "yes" -a "${nut_have_libpowerman}" != "yes"; then + AC_MSG_ERROR(["Powerman client libraries not found, required for Powerman PDU client driver"]) +fi + +if test "${nut_with_powerman}" != "no"; then + nut_with_powerman="${nut_have_libpowerman}" +fi + +NUT_REPORT_FEATURE([build Powerman PDU client driver], [${nut_with_powerman}], [], + [WITH_LIBPOWERMAN], [Define to enable Powerman PDU support]) + +dnl ---------------------------------------------------------------------- +dnl Check for with-ipmi, and --with-freeipmi (or --with-openipmi) +dnl Only one can be enabled at a time, with a preference for FreeIPMI +dnl if both are available (since it is the only one supported ATM!!) + +nut_ipmi_lib="" + +NUT_ARG_WITH([ipmi], [build and install IPMI PSU driver], [auto]) +NUT_ARG_WITH([freeipmi], [enable IPMI support using FreeIPMI], [auto]) +dnl NUT_ARG_WITH([openipmi], [enable IPMI support using OpenIPMI], [auto]) + +dnl ${nut_with_ipmi}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_ipmi}" != "no"; then + dnl check if FreeIPMI (and maybe later OpenIPMI) was explicitly requested + if test "${nut_with_freeipmi}" = "yes"; then + NUT_CHECK_LIBFREEIPMI + if test "${nut_have_freeipmi}" != "yes"; then + AC_MSG_ERROR(["GNU FreeIPMI not found, required for IPMI support"]) + fi + dnl Implies --with-ipmi + nut_with_ipmi="yes" + dnl elif test "${nut_with_openipmi}" = "yes"; then + dnl AC_MSG_ERROR(["OpenIPMI is not yet supported"]) + dnl NUT_CHECK_LIBOPENIPMI + dnl if test "${nut_have_openipmi}" != "yes"; then + dnl AC_MSG_ERROR(["OpenIPMI not found, required for IPMI support"]) + dnl fi + dnl Implies --with-ipmi + dnl nut_with_ipmi="yes" + dnl AC_DEFINE(WITH_OPENIPMI, 1, [Define to enable IPMI support using OpenIPMI]) + else + dnl Prefer FreeIPMI over OpenIPMI otherwise + NUT_CHECK_LIBFREEIPMI + if test "${nut_have_freeipmi}" != "yes"; then + if test "${nut_with_ipmi}" = "yes"; then + AC_MSG_ERROR(["FreeIPMI not found, required for IPMI support"]) + fi + nut_with_ipmi="no" + dnl NUT_CHECK_OPENIPMI + dnl if test "${nut_have_openipmi}" != "yes"; then + dnl if test "${nut_with_ipmi}" = "yes"; then + dnl AC_MSG_ERROR(["GNU FreeIPMI and OpenIPMI neither found, required for IPMI support"]) + dnl fi + dnl nut_with_ipmi="no" + dnl else + dnl Implies --with-ipmi + dnl nut_with_ipmi="yes" + dnl nut_with_openipmi="yes" + dnl fi + else + dnl Implies --with-ipmi + nut_with_ipmi="yes" + nut_with_freeipmi="yes" + AC_DEFINE(WITH_FREEIPMI, 1, [Define to enable IPMI support using FreeIPMI]) + fi + fi +fi + + +NUT_REPORT_FEATURE([build IPMI driver], [${nut_with_ipmi}], [${nut_ipmi_lib}], + [WITH_IPMI], [Define to enable IPMI support]) + +dnl Note: we still have to manually enable complementary AC_DEFINEs (see above) +dnl and AM_CONDITIONALs (see below)... +AM_CONDITIONAL(WITH_FREEIPMI, test "${nut_with_freeipmi}" = "yes") +dnl AM_CONDITIONAL(WITH_OPENIPMI, test "${nut_with_openipmi}" = "yes") + + +dnl ---------------------------------------------------------------------- +dnl The Mac OS X meta-driver looks at IOKit Power Sources keys managed by +dnl the internal USB UPS driver. +dnl +dnl FIXME: be slightly more clever here: + +NUT_ARG_WITH([macosx_ups], [build and install Mac OS X Power Sources meta-driver], [auto]) +if test "${nut_with_macosx_ups}" != no; then + if test -d /System/Library/Frameworks/IOKit.framework/ ; then + nut_with_macosx_ups="yes" + else + nut_with_macosx_ups="no" + fi +fi + +NUT_REPORT_FEATURE([build Mac OS X meta-driver], + [${nut_with_macosx_ups}], [${nut_macosx_ups_lib}], + [WITH_MACOSX], [Define to enable Mac OS X meta-driver]) + +dnl ---------------------------------------------------------------------- +dnl Check for with-ssl, and --with-nss or --with-openssl +dnl Only one can be enabled at a time, with a preference for OpenSSL +dnl if both are available + +nut_ssl_lib="" + +NUT_ARG_WITH([ssl], [enable SSL support (either NSS or OpenSSL)], [auto]) +NUT_ARG_WITH([nss], [enable SSL support using Mozilla NSS], [auto]) +NUT_ARG_WITH([openssl], [enable SSL support using OpenSSL], [auto]) + +dnl ${nut_with_ssl}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_ssl}" != "no"; then + dnl check if either NSS or OpenSSL was explicitly requested + if test "${nut_with_nss}" = "yes"; then + NUT_CHECK_LIBNSS + if test "${nut_have_libnss}" != "yes"; then + AC_MSG_ERROR(["Mozilla NSS not found, required for SSL support"]) + fi + elif test "${nut_with_openssl}" = "yes"; then + NUT_CHECK_LIBOPENSSL + if test "${nut_have_openssl}" != "yes"; then + AC_MSG_ERROR(["OpenSSL not found, required for SSL support"]) + fi + else + dnl Prefer OpenSSL over NSS otherwise + NUT_CHECK_LIBOPENSSL + if test "${nut_have_openssl}" != "yes"; then + NUT_CHECK_LIBNSS + if test "${nut_have_libnss}" != "yes"; then + dnl Only abort if SSL has been explicitly requested by the user + if test "${nut_with_ssl}" = "yes"; then + AC_MSG_ERROR(["Mozilla NSS and OpenSSL neither found, but are needed for the requested SSL support"]) + else + AC_MSG_WARN(["Mozilla NSS and OpenSSL neither found, required for SSL support"]) + fi + nut_with_ssl="no" + else + nut_with_nss="${nut_have_libnss}" + fi + else + nut_with_openssl="${nut_have_openssl}" + fi + fi +fi + +AM_CONDITIONAL(WITH_NSS, test "${nut_with_nss}" = "yes") +AM_CONDITIONAL(WITH_OPENSSL, test "${nut_with_openssl}" = "yes") + +NUT_REPORT_FEATURE([enable SSL support], [${nut_with_ssl}], [${nut_ssl_lib}], + [WITH_SSL], [Define to enable SSL]) + +dnl ---------------------------------------------------------------------- +dnl Check for --with-wrap + +NUT_ARG_WITH([wrap], [enable libwrap (tcp-wrappers) support], [auto]) + +dnl ${nut_with_wrap}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_wrap}" != "no"; then + dnl check for libwrap compiler flags + NUT_CHECK_LIBWRAP +fi + +if test "${nut_with_wrap}" = "yes" -a "${nut_have_libwrap}" != "yes"; then + AC_MSG_ERROR(["libwrap not found"]) +fi + +if test "${nut_with_wrap}" != "no"; then + nut_with_wrap="${nut_have_libwrap}" +fi + +NUT_REPORT_FEATURE([enable libwrap (tcp-wrappers) support], [${nut_with_wrap}], [], + [WITH_WRAP], [Define to enable libwrap (tcp-wrappers) support]) + + +dnl ---------------------------------------------------------------------- +dnl Check for --with-libltdl + +NUT_ARG_WITH([libltdl], [enable libltdl (Libtool dlopen abstraction) support], [auto]) + +dnl ${nut_with_libltdl}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_libltdl}" != "no"; then + dnl check for libltdl compiler flags + NUT_CHECK_LIBLTDL +fi + +if test "${nut_with_libltdl}" = "yes" -a "${nut_have_libltdl}" != "yes"; then + AC_MSG_ERROR(["libltdl not found"]) +fi + +if test "${nut_with_libltdl}" != "no"; then + nut_with_libltdl="${nut_have_libltdl}" +fi + +NUT_REPORT_FEATURE([enable libltdl (Libtool dlopen abstraction) support], [${nut_with_libltdl}], [], + [WITH_LIBLTDL], [Define to enable libltdl (Libtool dlopen abstraction) support]) + +dnl Explicitely report if we are building nut-scanner or not +dnl since it requires libltdl +NUT_REPORT([build nut-scanner], [${nut_with_libltdl}]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-cgi + +NUT_ARG_WITH([cgi], [build and install the CGI programs], [no]) + +dnl ${nut_with_cgi}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_cgi}" != "no"; then + dnl check for libgd compiler flags + NUT_CHECK_LIBGD +fi + +if test "${nut_with_cgi}" = "yes" -a "${nut_have_libgd}" != "yes"; then + AC_MSG_ERROR([libgd not found, required for CGI build]) +fi + +if test "${nut_with_cgi}" != "no"; then + nut_with_cgi="${nut_have_libgd}" +fi + +NUT_REPORT_FEATURE([build CGI programs], [${nut_with_cgi}], [], + [WITH_CGI], [Define to enable CGI (HTTP) support]) + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-hal + +dnl ${nut_with_hal}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_hal}" = "yes" -a "${nut_have_libhal}" != "yes"; then + AC_MSG_ERROR(["libhal not found, required for HAL support"]) +fi + +if test "${nut_with_hal}" = "yes" -a "${nut_have_libusb}" != "yes"; then + AC_MSG_ERROR(["libusb not found, required for HAL support"]) +fi + +if test "${nut_with_hal}" != "no"; then + if test "${nut_have_libhal}" = "yes" -a "${nut_have_libusb}" = "yes"; then + nut_with_hal="yes" + else + nut_with_hal="no" + fi +fi + +AM_CONDITIONAL(WITH_HAL, test "${nut_with_hal}" = "yes") +NUT_REPORT_FEATURE([enable HAL support], [${nut_with_hal}], [], + [WITH_HAL], [Define to enable HAL support]) + +dnl ---------------------------------------------------------------------- + +dnl checks related to --with-doc + +dnl Always check for AsciiDoc prerequisites, since even if --with-doc +dnl is set to 'no', we may still want to build the website, or some +dnl doc targets manually +NUT_CHECK_ASCIIDOC + +case "${nut_with_doc}" in + yes|all|auto) + nut_doc_build_list="html-single html-chunked pdf" + ;; + no) + nut_doc_build_list="" + ;; + *) + nut_doc_build_list="`echo ${nut_with_doc} | sed 's/,/ /g'`" + ;; +esac + +for nut_doc_build_target in ${nut_doc_build_list}; do + case "${nut_doc_build_target}" in + html-single) + AC_MSG_CHECKING([if asciidoc version can build ${nut_doc_build_target}]) + AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [8.6.3], [ + AC_MSG_RESULT(yes) + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" + ], [ + AC_MSG_RESULT(no) + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" + ]) + ;; + + html-chunked) + AC_MSG_CHECKING([if a2x version can build ${nut_doc_build_target}]) + AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [8.6.3], [ + AC_MSG_RESULT(yes) + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" + ], [ + AC_MSG_RESULT(no) + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" + ]) + ;; + + pdf) + AC_MSG_CHECKING([if dblatex version can build ${nut_doc_build_target}]) + AX_COMPARE_VERSION([${DBLATEX_VERSION}], [ge], [0.2.5], [ + AC_MSG_RESULT(yes) + DOC_BUILD_LIST="${DOC_BUILD_LIST} ${nut_doc_build_target}" + ], [ + AC_MSG_RESULT(no) + DOC_NOBUILD_LIST="${DOC_NOBUILD_LIST} ${nut_doc_build_target}" + ]) + ;; + esac +done + +case "${nut_with_doc}" in +auto) + if test -n "${DOC_BUILD_LIST}"; then + nut_with_doc="yes" + else + nut_with_doc="no" + fi + ;; +no) + ;; +*) + if test -z "${DOC_NOBUILD_LIST}"; then + nut_with_doc="yes" + else + AC_MSG_ERROR(["Unable to build ${DOC_NOBUILD_LIST} documentation"]) + fi + ;; +esac + +AC_MSG_CHECKING([if asciidoc version can build website (minimum required 8.6.3)]) +AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [8.6.3], [ + AC_MSG_RESULT(yes) + nut_have_asciidoc="yes" +], [ + AC_MSG_RESULT(no) + nut_have_asciidoc="no" +]) + +AC_MSG_CHECKING([if a2x version can build website (minimum required 8.6.3)]) +AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [8.6.3], [ + AC_MSG_RESULT(yes) +], [ + AC_MSG_RESULT(no) + nut_have_asciidoc="no" +]) + +NUT_REPORT_FEATURE([build and install documentation], [${nut_with_doc}], [], + [WITH_ASCIIDOC], [Define to enable Asciidoc support]) + +dnl Notes: we also keep HAVE_ASCIIDOC for implicit targets, such as manpage +dnl building +AM_CONDITIONAL([HAVE_ASCIIDOC], [test "${nut_have_asciidoc}" = "yes"]) + +if test "${nut_with_doc}" = "yes"; then + NUT_REPORT([only build specific documentation format], [${DOC_BUILD_LIST}]) +fi + +dnl ---------------------------------------------------------------------- +dnl checks related to --with-dev + +dnl We only init libtool there to allow AC_DISABLE_STATIC +AC_PROG_LIBTOOL + +dnl ${nut_with_dev}: any value except "yes" or "no" is treated as "auto". +if test "${nut_with_dev}" != "no"; then + nut_with_dev="yes" +else + AC_DISABLE_STATIC +fi +AM_CONDITIONAL(WITH_DEV, test "${nut_with_dev}" = "yes") +NUT_REPORT_FEATURE([build and install the development files], [${nut_with_dev}], [], + [WITH_DEV], [Define to enable development files support]) + +dnl ---------------------------------------------------------------------- + + +AC_MSG_CHECKING(state path) +AC_ARG_WITH(statepath, + AS_HELP_STRING([--with-statepath=PATH], [path for ups state files (/var/state/ups)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-statepath - see docs/configure.txt) + ;; + *) + STATEPATH="${withval}" + ;; + esac +], []) +AC_DEFINE_UNQUOTED(STATEPATH, "${STATEPATH}", [Path for UPS driver state files]) +AC_MSG_RESULT(${STATEPATH}) + +dnl --------------------------------------------------------------------- +dnl The 'alt pid path' is used by the drivers (via main.c) and upsd, since +dnl ideally they do not run as root and will not be able to write to the usual +dnl /var/run path. This defaults to the STATEPATH since they should be +dnl able to write there. +dnl + +AC_MSG_CHECKING(alt pid path) +AC_ARG_WITH(altpidpath, + AS_HELP_STRING([--with-altpidpath=PATH], [path for driver/upsd .pid files ()]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-altpidpath - see docs/configure.txt) + ;; + *) + ALTPIDPATH="${withval}" + ;; + esac +], [ + ALTPIDPATH="${STATEPATH}" +]) +AC_DEFINE_UNQUOTED(ALTPIDPATH, "${ALTPIDPATH}", [Path for pid files of drivers and upsd (usually STATEPATH)]) +AC_MSG_RESULT(${ALTPIDPATH}) + +AC_MSG_CHECKING(driver path) +AC_ARG_WITH(drvpath, + AS_HELP_STRING([--with-drvpath=PATH], [where to install UPS drivers (EPREFIX/bin)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-drvpath - see docs/configure.txt) + ;; + *) + driverexecdir="${withval}" + ;; + esac +], []) +conftemp="${driverexecdir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +AC_DEFINE_UNQUOTED(DRVPATH, "${conftemp}", [Default path for UPS drivers]) +AC_MSG_RESULT(${driverexecdir}) + +AC_MSG_CHECKING(cgi path) +AC_ARG_WITH(cgipath, + AS_HELP_STRING([--with-cgipath=PATH], [where to install CGI programs (EPREFIX/cgi-bin)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-cgipath - see docs/configure.txt) + ;; + *) + cgiexecdir="${withval}" + ;; + esac +], []) +conftemp="${cgiexecdir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +AC_DEFINE_UNQUOTED(CGIPATH, "${conftemp}", [Default path for CGI programs]) +AC_MSG_RESULT(${cgiexecdir}) + +AC_MSG_CHECKING(html path) +AC_ARG_WITH(htmlpath, + AS_HELP_STRING([--with-htmlpath=PATH], [where to install HTML files (PREFIX/html)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-htmlpath - see docs/configure.txt) + ;; + *) + htmldir="${withval}" + ;; + esac +], []) +conftemp="${htmldir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +AC_DEFINE_UNQUOTED(HTMLPATH, "${conftemp}", [Default path for HTML files]) +AC_MSG_RESULT(${htmldir}) + +AC_MSG_CHECKING(pidpath) +AC_ARG_WITH(pidpath, + AS_HELP_STRING([--with-pidpath=PATH], [path for .pid files (/var/run)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-pidpath - see docs/configure.txt) + ;; + *) + PIDPATH="${withval}" + ;; + esac +], []) +AC_DEFINE_UNQUOTED(PIDPATH, "${PIDPATH}", [Path where the pid files should go]) +AC_MSG_RESULT(${PIDPATH}) + +AC_MSG_CHECKING(network port number) +AC_ARG_WITH(port, + AS_HELP_STRING([--with-port=PORT], [port for network communications (3493)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-port - see docs/configure.txt) + ;; + *) + PORT="${withval}" + ;; + esac +], [ + PORT="3493" +]) +AC_DEFINE_UNQUOTED(PORT, ${PORT}, [Port for network communications]) +AC_MSG_RESULT(${PORT}) + +AC_MSG_CHECKING(user to run as) +AC_ARG_WITH(user, + AS_HELP_STRING([--with-user=username], [user for programs started as root (nobody)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-user - see docs/configure.txt) + ;; + *) + RUN_AS_USER="${withval}" + nut_user_given=yes + ;; + esac +], [ + nut_user_given=no +]) +AC_DEFINE_UNQUOTED(RUN_AS_USER, "${RUN_AS_USER}", [User to switch to if started as root]) +AC_MSG_RESULT(${RUN_AS_USER}) + +AC_MSG_CHECKING(group membership of user to run as) +AC_ARG_WITH(group, + AS_HELP_STRING([--with-group=groupname], [group membership of user for programs started as root (nogroup)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-group - see docs/configure.txt) + ;; + *) + RUN_AS_GROUP="${withval}" + nut_group_given=yes + ;; + esac +], [ + nut_group_given=no +]) +AC_DEFINE_UNQUOTED(RUN_AS_GROUP, "${RUN_AS_GROUP}", [Group membership of user to switch to if started as root]) +AC_MSG_RESULT(${RUN_AS_GROUP}) + +dnl check that --with-user is given if --with-group is given. +if test "${nut_user_given}" = "yes" -a "${nut_group_given}" = "no"; then + AC_MSG_ERROR(["If you specify --with-user, you also must specify --with-group"]) +elif test "${nut_user_given}" = "no" -a "${nut_group_given}" = "yes"; then + AC_MSG_ERROR(["If you specify --with-group, you also must specify --with-user"]) +fi + +AC_MSG_CHECKING(facility for syslog) +AC_ARG_WITH(logfacility, + AS_HELP_STRING([--with-logfacility=FACILITY], [facility for log messages (LOG_DAEMON)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-logfacility - see docs/configure.txt) + ;; + *) + LOGFACILITY="${withval}" + ;; + esac +], [ + LOGFACILITY="LOG_DAEMON" +]) +AC_DEFINE_UNQUOTED(LOG_FACILITY, ${LOGFACILITY}, [Desired syslog facility - see syslog(3)]) +AC_MSG_RESULT(${LOGFACILITY}) + +dnl Autoconf versions before 2.62 do not allow consecutive quadrigraphs, +dnl so the help string depends on the version used +AC_MSG_CHECKING(which drivers to build) +AC_ARG_WITH(drivers, + AS_HELP_STRING([m4_version_prereq(2.62, + [@<:@--with-drivers=driver@<:@,driver@:>@@:>@], + [[[[--with-drivers=driver@<:@,driver@:>@]]]])], + [Only build specific drivers (all)]), +[ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-drivers - see docs/configure.txt) + ;; + *) + DRIVER_BUILD_LIST=`echo ${withval} | sed "s/,/ /g"` + AC_MSG_RESULT(${DRIVER_BUILD_LIST}) + ;; + esac +], [ + DRIVER_BUILD_LIST="all" + AC_MSG_RESULT(all available) +]) +AM_CONDITIONAL(SOME_DRIVERS, test "${DRIVER_BUILD_LIST}" != "all") + +if test "${DRIVER_BUILD_LIST}" != "all"; then + NUT_REPORT([only build specific drivers], [${DRIVER_BUILD_LIST}]) +fi + +AC_MSG_CHECKING(which driver man pages to install) +if test "${DRIVER_BUILD_LIST}" = "all"; then + DRIVER_MAN_LIST=all + AC_MSG_RESULT(all available) +else + DRIVER_MAN_LIST="" + for i in ${DRIVER_BUILD_LIST}; do + if test -f ${srcdir}/docs/man/$i.8; then + DRIVER_MAN_LIST="${DRIVER_MAN_LIST} $i.8" + fi + done + AC_MSG_RESULT(${DRIVER_MAN_LIST}) +fi + +AC_MSG_CHECKING(whether to strip debug symbols) +AC_ARG_ENABLE(strip, + AS_HELP_STRING([--enable-strip], [Strip debugging symbols from binaries (no)]), +[ + case "${withval}" in + no) + AC_MSG_RESULT(no) + ;; + *) + AC_MSG_RESULT(yes) + CFLAGS="${CFLAGS} -s" + ;; + esac +], [ + AC_MSG_RESULT(no) +]) + +AC_MSG_CHECKING(whether to install pkg-config *.pc files) +AC_ARG_WITH(pkgconfig-dir, + AS_HELP_STRING([--with-pkgconfig-dir=PATH], [where to install pkg-config *.pc files (EPREFIX/lib/pkgconfig)]), +[ + case "${withval}" in + yes|auto) + ;; + no) + pkgconfigdir="" + ;; + *) + pkgconfigdir="${withval}" + ;; + esac +], []) +if test -n "${pkgconfigdir}"; then + AC_MSG_RESULT(using ${pkgconfigdir}) +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(WITH_PKG_CONFIG, test -n "${pkgconfigdir}") + +PKG_PROG_PKG_CONFIG +systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` +AC_MSG_CHECKING(whether to install systemd files) +AC_ARG_WITH([systemdsystemunitdir], + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files (auto)]), +[ + case "${withval}" in + yes|auto) + ;; + no) + systemdsystemunitdir="" + ;; + *) + systemdsystemunitdir="${withval}" + ;; + esac +], []) +dnl Override installation directory, with the local installation +dnl prefix. This is needed for 'distcheck*' targets, otherwise +dnl files will try to get intalled to the actual system directories +if test -n "${systemdsystemunitdir}"; then + systemdsystemshutdowndir="${libdir}/systemd/system-shutdown" + AC_MSG_RESULT(using ${systemdsystemunitdir}) + systemdsystemunitdir="`echo ${systemdsystemunitdir} | sed 's/\/lib/\${libdir}/'`" +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") + +AC_MSG_CHECKING(whether to install hotplug rules) +AC_ARG_WITH(hotplug-dir, + AS_HELP_STRING([--with-hotplug-dir=PATH], [where to install hotplug rules (/etc/hotplug)]), +[ + case "${withval}" in + yes) + if test -z "${hotplugdir}"; then + AC_MSG_RESULT(no) + AC_MSG_ERROR(["hotplug directory requested but not found"]) + fi + ;; + auto) + ;; + no) + hotplugdir="" + ;; + *) + hotplugdir="${withval}" + ;; + esac +], []) +if test -n "${hotplugdir}"; then + AC_MSG_RESULT(using ${hotplugdir}) +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(WITH_HOTPLUG, test -n "${hotplugdir}") + +AC_MSG_CHECKING(whether to install udev rules) +AC_ARG_WITH(udev-dir, + AS_HELP_STRING([--with-udev-dir=PATH], [where to install udev rules (/lib/udev or /etc/udev)]), +[ + case "${withval}" in + yes) + if test -z "${udevdir}"; then + AC_MSG_RESULT(no) + AC_MSG_ERROR(["udev directory requested but not found"]) + fi + ;; + auto) + ;; + no) + udevdir="" + ;; + *) + udevdir="${withval}" + ;; + esac +], []) +if test -n "${udevdir}"; then + AC_MSG_RESULT(using ${udevdir}) +else + AC_MSG_RESULT(no) +fi +AM_CONDITIONAL(WITH_UDEV, test -n "${udevdir}") + +AC_PATH_PROGS([ASCIIDOC], [asciidoc], [none]) +AM_CONDITIONAL([MANUALUPDATE], [test "x$ASCIIDOC" != "xnone"]) +AC_PATH_PROGS([A2X], [a2x], [none]) + +dnl check for spell checking deps +AC_PATH_PROGS([ASPELL], [aspell], [none]) +AM_CONDITIONAL([HAVE_ASPELL], [test "x$ASPELL" != "xnone"]) + +dnl expand ${sysconfdir} and write it out +conftemp="${sysconfdir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +CONFPATH=${conftemp} +AC_DEFINE_UNQUOTED(CONFPATH, "${conftemp}", [Default path for configuration files]) + +dnl same for datadir +conftemp="${datadir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +DATADIR=${conftemp} +AC_DEFINE_UNQUOTED(DATADIR, "${conftemp}", [Default path for data files]) + +dnl same for bindir +conftemp="${bindir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +BINDIR=${conftemp} +AC_DEFINE_UNQUOTED(BINDIR, "${conftemp}", [Default path for user executables]) + +dnl same for sbindir +conftemp="${sbindir}" +eval conftemp=\"${conftemp}\" +eval conftemp=\"${conftemp}\" +SBINDIR=${conftemp} +AC_DEFINE_UNQUOTED(SBINDIR, "${conftemp}", [Default path for system executables]) + +AC_SUBST(OS_NAME) +AC_SUBST(TREE_VERSION) +AC_SUBST(NUT_NETVERSION) +AC_SUBST(LIBSSL_CFLAGS) +AC_SUBST(LIBSSL_LIBS) +AC_SUBST(LIBGD_CFLAGS) +AC_SUBST(LIBGD_LDFLAGS) +AC_SUBST(LIBNETSNMP_CFLAGS) +AC_SUBST(LIBNETSNMP_LIBS) +AC_SUBST(LIBUSB_CFLAGS) +AC_SUBST(LIBUSB_LIBS) +AC_SUBST(LIBNEON_CFLAGS) +AC_SUBST(LIBNEON_LIBS) +AC_SUBST(LIBAVAHI_CFLAGS) +AC_SUBST(LIBAVAHI_LIBS) +AC_SUBST(LIBPOWERMAN_CFLAGS) +AC_SUBST(LIBPOWERMAN_LIBS) +AC_SUBST(LIBIPMI_CFLAGS) +AC_SUBST(LIBIPMI_LIBS) +AC_SUBST(DOC_BUILD_LIST) +AC_SUBST(LIBWRAP_CFLAGS) +AC_SUBST(LIBWRAP_LIBS) +AC_SUBST(LIBLTDL_CFLAGS) +AC_SUBST(LIBLTDL_LIBS) +AC_SUBST(HAL_USER) +AC_SUBST(HAL_DEVICE_MATCH_KEY) +AC_SUBST(HAL_FDI_PATH) +AC_SUBST(HAL_CALLOUTS_PATH) +AC_SUBST(LIBHAL_CFLAGS) +AC_SUBST(LIBHAL_LIBS) +AC_SUBST(DRIVER_BUILD_LIST) +AC_SUBST(DRIVER_MAN_LIST) +AC_SUBST(DRIVER_INSTALL_TARGET) +AC_SUBST(NETLIBS) +AC_SUBST(SERLIBS) +AC_SUBST(PIDPATH) +AC_SUBST(STATEPATH) +AC_SUBST(CONFPATH) +AC_SUBST(BINDIR) +AC_SUBST(DRVPATH) +AC_SUBST(SBINDIR) +AC_SUBST(PORT) +AC_SUBST(RUN_AS_USER) +AC_SUBST(RUN_AS_GROUP) +AC_SUBST(SUN_LIBUSB) +AC_SUBST(WORDS_BIGENDIAN) +AC_SUBST(cgiexecdir) +AC_SUBST(driverexecdir) +AC_SUBST(htmldir) +AC_SUBST(pkgconfigdir) +AC_SUBST(systemdsystemunitdir) +AC_SUBST(systemdsystemshutdowndir) +AC_SUBST(hotplugdir) +AC_SUBST(udevdir) + +AC_OUTPUT([ + clients/Makefile + common/Makefile + conf/Makefile + conf/upsmon.conf.sample + conf/upssched.conf.sample + data/html/header.html + data/html/Makefile + data/Makefile + data/driver.list + docs/Makefile + docs/man/Makefile + docs/website/Makefile + drivers/Makefile + include/Makefile + lib/libupsclient-config + lib/libupsclient.pc + lib/libnutclient.pc + lib/libnutscan.pc + lib/Makefile + scripts/augeas/Makefile + scripts/augeas/nutnutconf.aug + scripts/augeas/nutupsconf.aug + scripts/augeas/nutupsdconf.aug + scripts/augeas/nutupsdusers.aug + scripts/augeas/nutupsmonconf.aug + scripts/augeas/nutupsschedconf.aug + scripts/augeas/nuthostsconf.aug + scripts/augeas/nutupssetconf.aug + scripts/avahi/nut.service + scripts/hal/Makefile + scripts/hal/ups-nut-device.fdi + scripts/hotplug/Makefile + scripts/hotplug/libhidups + scripts/HP-UX/nut.psf + scripts/HP-UX/postinstall + scripts/python/Makefile + scripts/systemd/Makefile + scripts/systemd/nut-driver.service + scripts/systemd/nut-monitor.service + scripts/systemd/nut-server.service + scripts/systemd/nutshutdown + scripts/Solaris/Makefile + scripts/Solaris/pkginfo + scripts/Solaris/postinstall + scripts/Solaris/preremove + scripts/Solaris/nut + scripts/udev/Makefile + scripts/udev/nut-ipmipsu.rules + scripts/udev/nut-usbups.rules + scripts/ufw/nut.ufw.profile + scripts/Makefile + server/Makefile + tools/Makefile + tools/nut-scanner/Makefile + tests/Makefile + Makefile +]) + +NUT_PRINT_FEATURE_REPORT diff --git a/data/Makefile.am b/data/Makefile.am index 9909818..4b67782 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -5,16 +5,3 @@ SUBDIRS = html dist_data_DATA = cmdvartab nodist_data_DATA = driver.list EXTRA_DIST = evolution500.seq epdu-managed.dev - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -cmdvartab-spellchecked: cmdvartab Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="cmdvartab" SPELLCHECK_DIR="$(srcdir)" $@ - -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/Makefile.in b/data/Makefile.in index e2ae422..208724a 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,61 +18,23 @@ # Network UPS Tools: data VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -92,24 +55,20 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = data +DIST_COMMON = $(dist_data_DATA) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/driver.list.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -118,44 +77,25 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(dist_data_DATA) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = driver.list CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -192,33 +132,12 @@ am__installdirs = "$(DESTDIR)$(datadir)" "$(DESTDIR)$(datadir)" DATA = $(dist_data_DATA) $(nodist_data_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir distdir-am -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/driver.list.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -248,11 +167,9 @@ am__relativize = \ A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -263,7 +180,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -277,7 +193,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -290,8 +205,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -301,15 +219,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -320,29 +237,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -362,9 +271,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -373,16 +279,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -396,7 +298,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -407,12 +308,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -431,21 +328,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -459,8 +353,6 @@ SUBDIRS = html dist_data_DATA = cmdvartab nodist_data_DATA = driver.list EXTRA_DIST = evolution500.seq epdu-managed.dev -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *.pdf *.html *-spellchecked all: all-recursive .SUFFIXES: @@ -476,13 +368,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu data/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -545,25 +438,22 @@ uninstall-nodist_dataDATA: dir='$(DESTDIR)$(datadir)'; $(am__uninstall_files_from_dir) # This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -578,12 +468,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -599,7 +534,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -611,11 +551,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -624,29 +568,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -731,7 +657,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -740,7 +665,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am @@ -807,35 +731,25 @@ ps-am: uninstall-am: uninstall-dist_dataDATA uninstall-nodist_dataDATA -.MAKE: $(am__recursive_targets) install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-dist_dataDATA install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-nodist_dataDATA \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-dist_dataDATA uninstall-nodist_dataDATA +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dist_dataDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-nodist_dataDATA install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-dist_dataDATA \ + uninstall-nodist_dataDATA -.PRECIOUS: Makefile - - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -cmdvartab-spellchecked: cmdvartab Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="cmdvartab" SPELLCHECK_DIR="$(srcdir)" $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/data/cmdvartab b/data/cmdvartab index 5f322c6..8bef408 100644 --- a/data/cmdvartab +++ b/data/cmdvartab @@ -20,7 +20,6 @@ VARDESC ups.firmware "UPS firmware" VARDESC ups.firmware.aux "Auxiliary device firmware" VARDESC ups.temperature "UPS temperature (degrees C)" VARDESC ups.load "Load on UPS (percent of full)" -VARDESC ups.load.energysave "Load on UPS that triggers energysave (percent)" VARDESC ups.load.high "Load when UPS switches to overload condition (percent)" VARDESC ups.id "UPS system identifier" VARDESC ups.delay.start "Interval to wait before (re)starting the load (seconds)" @@ -47,11 +46,6 @@ VARDESC input.voltage "Input voltage (V)" VARDESC input.voltage.extended "Extended input voltage range" VARDESC input.voltage.maximum "Maximum incoming voltage seen (V)" VARDESC input.voltage.minimum "Minimum incoming voltage seen (V)" -VARDESC input.voltage.status "Voltage status relative to the thresholds" -VARDESC input.voltage.low.warning "Input voltage low warning threshold (V)" -VARDESC input.voltage.low.critical "Input voltage low critical threshold (V)" -VARDESC input.voltage.high.warning "Input voltage high warning threshold (V)" -VARDESC input.voltage.high.critical "Input voltage high critical threshold (V)" VARDESC input.voltage.nominal "Nominal input voltage (V)" VARDESC input.transfer.reason "Reason for last transfer to battery" VARDESC input.transfer.low "Low voltage transfer point (V)" @@ -64,14 +58,8 @@ VARDESC input.sensitivity "Input power sensitivity" VARDESC input.quality "Input power quality" VARDESC input.current "Input current (A)" VARDESC input.current.nominal "Nominal input current (A)" -VARDESC input.current.status "Current status relative to the thresholds" -VARDESC input.current.low.warning "Input current low warning threshold (A)" -VARDESC input.current.low.critical "Input current low critical threshold (A)" -VARDESC input.current.high.warning "Input current high warning threshold (A)" -VARDESC input.current.high.critical "Input current high critical threshold (A)" VARDESC input.frequency "Input line frequency (Hz)" VARDESC input.frequency.extended "Extended input frequency range" -VARDESC input.frequency.status "Frequency status" VARDESC input.frequency.nominal "Nominal input line frequency (Hz)" VARDESC input.frequency.low "Minimum input line frequency (Hz)" VARDESC input.frequency.high "Maximum input line frequency (Hz)" @@ -79,12 +67,6 @@ VARDESC input.transfer.boost.low "Low voltage boosting transfer point (V)" VARDESC input.transfer.boost.high "High voltage boosting transfer point (V)" VARDESC input.transfer.trim.low "Low voltage trimming transfer point (V)" VARDESC input.transfer.trim.high "High voltage trimming transfer point (V)" -VARDESC input.transfer.delay "Delay before transfer to mains" -VARDESC input.load "Load on (ePDU) input (percent of full)" -VARDESC input.realpower "Current sum value of all (ePDU) phases real power (W)" -VARDESC input.power "Current sum value of all (ePDU) phases apparent power (VA)" -VARDESC input.source "The current input power source" -VARDESC input.source.preferred "The preferred input power source" VARDESC output.voltage "Output voltage (V)" VARDESC output.voltage.nominal "Nominal output voltage (V)" @@ -94,7 +76,6 @@ VARDESC output.current "Output current (A)" VARDESC output.current.nominal "Nominal output current (A)" VARDESC battery.charge "Battery charge (percent of full)" -VARDESC battery.charge.approx "Rough approximation of battery charge" VARDESC battery.charge.low "Remaining battery level when UPS switches to LB (percent)" VARDESC battery.charge.restart "Minimum battery level for restart after power off (percent)" VARDESC battery.charge.warning "Battery level when UPS switches to Warning state (percent)" @@ -113,40 +94,19 @@ VARDESC battery.packs.bad "Number of bad battery packs" VARDESC battery.type "Battery chemistry" VARDESC battery.protection "Prevent deep discharge of battery" VARDESC battery.energysave "Switch off when running on battery and no/low load" -VARDESC battery.energysave.load "Switch off UPS if on battery and load level lower (percent)" -VARDESC battery.energysave.delay "Delay before switch off UPS if on battery and load level low (min)" -VARDESC battery.energysave.realpower "Switch off UPS if on battery and load level lower (Watts)" -VARDESC battery.charger.status "Battery charger status" VARDESC ambient.temperature "Ambient temperature (degrees C)" VARDESC ambient.temperature.alarm "Ambient temperature alarm is active" -VARDESC ambient.temperature.status "Ambient temperature status relative to the configured thresholds" -VARDESC ambient.temperature.alarm.maximum "Maximum allowed ambient temperature (degrees C)" -VARDESC ambient.temperature.alarm.minimum "Minimum allowed ambient temperature (degrees C)" +VARDESC ambient.temperature.alarm.maximum "Maximum allowed ambient temperature" +VARDESC ambient.temperature.alarm.minimum "Minimum allowed ambient temperature" VARDESC ambient.temperature.alarm.enable "Enable ambient temperature alarm" -VARDESC ambient.temperature.low "Temperature threshold low (degrees C)" -VARDESC ambient.temperature.low.warning "Temperature threshold low warning (degrees C)" -VARDESC ambient.temperature.low.critical "Temperature threshold low critical (degrees C)" -VARDESC ambient.temperature.high "Temperature threshold high (degrees C)" -VARDESC ambient.temperature.high.warning "Temperature threshold high warning (degrees C)" -VARDESC ambient.temperature.high.critical "Temperature threshold high critical (degrees C)" -VARDESC ambient.humidity "Ambient humidity (percent)" +VARDESC ambient.humidity "Ambient humidity" VARDESC ambient.humidity.alarm "Ambient humidity alarm is active" -VARDESC ambient.humidity.status "Ambient humidity status relative to the configured thresholds" -VARDESC ambient.humidity.alarm.maximum "Maximum allowed ambient humidity (percent)" -VARDESC ambient.humidity.alarm.minimum "Minimum allowed ambient humidity (percent)" +VARDESC ambient.humidity.alarm.maximum "Maximum allowed ambient humidity" +VARDESC ambient.humidity.alarm.minimum "Minimum allowed ambient humidity" VARDESC ambient.humidity.alarm.enable "Enable ambient humidity alarm" -VARDESC ambient.humidity.low "Ambient humidity threshold low (percent)" -VARDESC ambient.humidity.low.warning "Ambient humidity threshold low warning (percent)" -VARDESC ambient.humidity.low.critical "Ambient humidity threshold low critical (percent)" -VARDESC ambient.humidity.high "Ambient humidity threshold high (percent)" -VARDESC ambient.humidity.high.warning "Ambient humidity threshold high warning (percent)" -VARDESC ambient.humidity.high.critical "Ambient humidity threshold high critical (percent)" -VARDESC ambient.present "Ambient sensor presence" -VARDESC ambient.contacts.1.status "State of the dry contact sensor 1" -VARDESC ambient.contacts.2.status "State of the dry contact sensor 2" -# FIXME: the outlet collection is indexed - solve with regexps? +# FIXME: the outlet collection is indexed - solve with regexs? # # VARDESC outlet.[[:digit:]]+.id "Outlet system identifier ()" @@ -178,7 +138,6 @@ VARDESC outlet.2.delay.start "Interval to wait before restarting this outlet (se VARDESC driver.name "Driver name" VARDESC driver.version "Driver version - NUT release" VARDESC driver.version.internal "Internal driver version" -VARDESC driver.version.usb "USB library version" VARDESC device.part "Device Part Number" @@ -220,10 +179,8 @@ CMDDESC beeper.mute "Temporarily mute the UPS beeper" CMDDESC beeper.toggle "Toggle the UPS beeper" CMDDESC outlet.1.load.off "Turn off the load on outlet 1 immediately" CMDDESC outlet.1.load.on "Turn on the load on outlet 1 immediately" -CMDDESC outlet.1.shutdown.return "Turn off the outlet 1 and return when power is back" CMDDESC outlet.2.load.off "Turn off the load on outlet 2 immediately" CMDDESC outlet.2.load.on "Turn on the load on outlet 2 immediately" -CMDDESC outlet.2.shutdown.return "Turn off the outlet 2 and return when power is back" # The following two commands should *only* be defined when you need # to compose a 'shutdown.return' command by sending both a switch-off diff --git a/data/driver.list.in b/data/driver.list.in index a4e876c..96bb5a3 100644 --- a/data/driver.list.in +++ b/data/driver.list.in @@ -16,9 +16,8 @@ # ======== # - device type: # "ups" for Uninterruptible Power Supply -# "pdu" for Power Distribution Unit -# "scd" for Solar Controller Device -# "ats" for Automatic Transfer Switch +# "pdu" for Power Distributions Unit +# "scd" for Solar Controlers Device # # - support level: a number from "1" to "5" (stars) meaning: # * protocol based on reverse engineering @@ -28,57 +27,39 @@ # ***** vendor provided protocol and hardware # # - driver [parameters]: mention the driver(s) (separated by "or" if there are -# several possibilities). Any mandatory parameter(s) must be referenced, as -# they will be parsed by configuration helper software. +# several possibilities. Any mandatory parameter(s) must be referenced, as +# they will be parsed by configuration helper softwares. # For example, genericups entries must mention the "upstype=nn" format. # # Duplicate text in the last field will be cooked out during the conversion # to HTML with ROWSPAN magic. They must be an exact match for this to work. +"Ablerex" "ups" "2" "MS-RT" "" "blazer_ser" "Ablerex" "ups" "2" "625L" "USB" "blazer_usb" "Ablerex" "ups" "2" "Hope Office 400/600" "" "blazer_ser" -"Ablerex" "ups" "2" "MARS MS3000RT" "" "blazer_ser" -"Ablerex" "ups" "2" "MS-RT" "" "blazer_ser" -"Ablerex" "ups" "2" "MP series" "USB" "nutdrv_qx" -"Ablerex" "ups" "2" "ARES Plus series" "USB" "nutdrv_qx" -"Ablerex" "ups" "2" "MSII series" "USB" "nutdrv_qx" -"Ablerex" "ups" "2" "MSIII series" "USB" "nutdrv_qx" -"Ablerex" "ups" "2" "GRs series" "USB" "nutdrv_qx" -"Ablerex" "ups" "2" "GRs Plus series" "USB" "nutdrv_qx" "ActivePower" "ups" "2" "400VA" "" "blazer_ser" "ActivePower" "ups" "2" "1400VA" "" "blazer_ser" "ActivePower" "ups" "2" "2000VA" "" "blazer_ser" "Advice" "ups" "2" "TopGuard 2000" "" "blazer_ser" -"Advice" "ups" "2" "Top V Pro 6-10K" "USB" "blazer_usb" # https://www.advice.co.il/en/advice-products/ups-systems/ups-online-systems/one-phase-ups-5k-10k/%D7%90%D7%9C-%D7%A4%D7%A1%D7%A7-%D7%90%D7%95%D7%9F-%D7%9C%D7%99%D7%99%D7%9F-top-v-pro-6-10k-detail https://github.com/networkupstools/nut/issues/744 -"Advice" "ups" "2" "PRS850" "USB" "blazer_usb" -"Advice" "ups" "2" "PRV700 Pro" "USB" "blazer_usb" "AEC" "ups" "1" "MiniGuard UPS 700" "Megatec M2501 cable" "genericups upstype=21" "AEG Power Solutions" "ups" "2" "PROTECT HOME" "" "blazer_ser or blazer_usb" -"AEG Power Solutions" "ups" "3" "PROTECT NAS" "" "usbhid-ups" -"AEG Power Solutions" "ups" "3" "PROTECT B" "" "usbhid-ups" -"APC" "ups" "3" "APC AP9584 Serial-to-USB kit" "USB" "usbhid-ups" # Allows USB connections to Serial-port APC devices, https://github.com/networkupstools/nut/pull/181 -"APC" "ups" "2" "Back-UPS 1200BR (Microsol)" "" "solis" -"APC" "ups" "2" "Back-UPS BZ2200BI-BR (Microsol)" "" "solis" "APC" "ups" "1" "Back-UPS Pro" "" "apcsmart" "APC" "ups" "1" "Matrix-UPS" "" "apcsmart" "APC" "ups" "1" "Smart-UPS" "" "apcsmart" "APC" "ups" "1" "Smart-UPS SMT/SMX/SURTD" "Microlink models with RJ45 socket - they *require* AP9620 SmartSlot expansion card and smart cable" "apcsmart" "APC" "ups" "2" "Back-UPS Pro USB" "USB" "usbhid-ups" -"APC" "ups" "2" "Back-UPS (USB)" "USB" "usbhid-ups" -"APC" "ups" "2" "Back-UPS CS USB" "USB" "usbhid-ups" +"APC" "ups" "2" "Back-UPS USB" "USB" "usbhid-ups" "APC" "ups" "2" "Back-UPS RS USB" "USB" "usbhid-ups" "APC" "ups" "2" "Back-UPS LS USB" "USB" "usbhid-ups" "APC" "ups" "2" "Back-UPS ES/CyberFort 350" "USB" "usbhid-ups" "APC" "ups" "2" "Back-UPS BF500" "USB" "usbhid-ups" "APC" "ups" "2" "BACK-UPS XS LCD" "USB" "usbhid-ups" -"APC" "ups" "2" "Back-UPS XS 1000M (Back-UPS Pro 1000, Model BX1000M)" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/139 -"APC" "ups" "2" "SMC2200BI-BR" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/557 -"APC" "ups" "2" "Smart-UPS (USB)" "USB" "usbhid-ups" +"APC" "ups" "2" "Smart-UPS USB" "USB" "usbhid-ups" "APC" "ups" "1" "Back-UPS" "940-0095A/C cables" "genericups upstype=1" "APC" "ups" "1" "Back-UPS" "940-0020B/C cables" "genericups upstype=2" "APC" "ups" "1" "Back-UPS" "940-0023A cable" "genericups upstype=9" @@ -87,12 +68,10 @@ "APC" "ups" "3" "Smart-UPS RT XL" "AP9618 SNMP monitoring card" "snmp-ups" "APC" "ups" "3" "(various)" "AP9618 SNMP monitoring card" "snmp-ups" "APC" "ups" "3" "(various)" "AP9630 SNMP monitoring card" "snmp-ups privProtocol=AES" -"APC" "ups" "3" "(various)" "APCUPSD-controlled devices" "apcupsd-ups" "APC" "pdu" "1" "Masterswitch" "940-0020 cable" "genericups upstype=12" "APC" "pdu" "1" "AP9210" "8 outlets" "powerman-pdu (experimental)" "APC" "pdu" "1" "AP79xx" "8 to 24 outlets" "powerman-pdu (experimental)" -"APC" "pdu" "3" "(various APxxxx)" "SNMP monitoring card" "snmp-ups" -"APC" "ats" "3" "ATS AP7724" "" "snmp-ups (experimental)" +"APC" "pdu" "3" "(various)" "SNMP monitoring card" "snmp-ups (experimental)" "Aphel" "pdu" "3" "various PDU" "" "snmp-ups (experimental)" @@ -102,8 +81,6 @@ "Appro" "pdu" "1" "SWPDU" "48 outlets" "powerman-pdu (experimental)" -"ARES" "ups" "2" "AR265i" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 did not explicitly mention the driver parameters, but other reports in the discussion did - "ARTronic" "ups" "2" "ARTon Millenium 1/2/3/6/10 kVA" "Serial" "blazer_ser" "ARTronic" "ups" "2" "ARTon Millenium 3.1 10/15/20 kVA" "Serial" "blazer_ser" "ARTronic" "ups" "2" "ARTon Titanium 6/10 kVA" "Serial" "blazer_ser" @@ -114,12 +91,6 @@ "ARTronic" "ups" "2" "ARTon Platinium Combo 3.1 10/15/20 kVA" "USB" "blazer_usb" "ARTronic" "ups" "2" "ARTon Platinium RT 1/2/3/6/10 kVA" "USB" "blazer_usb" -"Armac" "ups" "2" "R/2000I/PSW" "(USB ID 0925:1234)" "nutdrv_qx" - -"ASEM SPA" "ups" "5" "PB1300 UPS" "i2c" "asem" - -"Asium" "ups" "3" "P700" "USB" "blazer_usb" # http://www.asiumpower.com/Asium-ASIUM-P700-650VA-360W/dp/B009SMEQ10 - "ATEK" "ups" "2" "Defensor 1K Tower / Rack" "USB" "blazer_usb" "ATEK" "ups" "2" "Defensor 2K Tower / Rack" "USB" "blazer_usb" "ATEK" "ups" "2" "Defensor 3K Tower / Rack" "USB" "blazer_usb" @@ -128,15 +99,12 @@ "Atlantis Land" "ups" "2" "A03-P826" "" "blazer_ser" "Atlantis Land" "ups" "2" "A03-P551" "USB" "blazer_usb langid_fix=0x0409" # http://www.atlantisland.it/pub/prodotti.php?famiglia=1&l1=7&l2=24&articolo=QTAzLVA1NTE= -"Atlantis Land" "ups" "2" "HostPower 851 (A03-HP851)" "USB" "nutdrv_qx" "Atlantis Land" "ups" "2" "LinePower 1151 (A03-OP1151)" "Serial" "nutdrv_qx" "Atlantis Land" "ups" "2" "LinePower 1151 (A03-OP1151)" "USB" "nutdrv_qx" -"Atlantis Land" "ups" "2" "OnePower 841+ (A03-P841)" "USB" "nutdrv_qx" "Atlantis Land" "ups" "2" "(various)" "Serial" "nutdrv_qx" "Atlantis Land" "ups" "2" "(various)" "USB" "nutdrv_qx" "Aviem Systems" "ups" "2" "Aviem Power RT 1000-3000VA" "" "blazer_ser" -"Aviem Systems" "ups" "2" "Aviem Pro 2000VA" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/827 "Baytech" "pdu" "1" "RPC3" "8 outlets" "powerman-pdu (experimental)" "Baytech" "pdu" "1" "RPC3-20NC" "8 outlets" "powerman-pdu (experimental)" @@ -150,7 +118,6 @@ "Belkin" "ups" "2" "F6H375-USB" "USB (<= 2005 models, vendor id: 050d)" "usbhid-ups" "Belkin" "ups" "2" "F6H375-USB" "USB (2007 models, vendor id: 0665)" "blazer_usb" "Belkin" "ups" "2" "Office Series F6C550-AVR" "USB" "usbhid-ups" -"Belkin" "ups" "3" "Regulator PRO-USB" "USB (~2000, product id: 0f51)" "usbhid-ups" "Belkin" "ups" "2" "Regulator Pro" "F6C525-SER, F6C625-SER" "belkin" "Belkin" "ups" "1" "Resource" "" "genericups upstype=4" "Belkin" "ups" "2" "Small Enterprise F6C1500-TW-RK" "serial port" "belkin" @@ -187,8 +154,6 @@ "Borri" "ups" "2" "B500-R060-B/B500-R100-B" "" "blazer_usb" "Borri" "ups" "2" "B500EVO-100-B/B500EVO-200-B" "" "blazer_usb" -"CABAC" "ups" "2" "UPS-1700DV2" "" "blazer_usb" - "Chloride" "ups" "2" "Desk Power 650" "serial port" "blazer_ser" "Cito Power" "ups" "2" "CPG-SR1000" "" "blazer_ser" @@ -204,63 +169,43 @@ "COVER ENERGY SA" "ups" "2" "COVER PRM 1K/2K/3K/6K/10K EC" "" "blazer_usb" "COVER ENERGY SA" "ups" "2" "COVER PRM 6K/10K PR" "" "blazer_usb" -"CPC" "ups" "2" "RACK850VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 product=MEC0003 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/537 - -"Crown" "ups" "2" "CMU-SP1200IEC" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/1014 - -"Cyber Power Systems" "ups" "1" "550SL" "" "genericups upstype=7" -"Cyber Power Systems" "ups" "1" "725SL" "" "genericups upstype=7" -"Cyber Power Systems" "ups" "1" "CPS1100AVR" "" "powerpanel" -"Cyber Power Systems" "ups" "1" "CPS1200AVR" "" "powerpanel" -"Cyber Power Systems" "ups" "1" "CPS1250AVR" "" "powerpanel" -"Cyber Power Systems" "ups" "1" "CPS1500AVR" "" "powerpanel" -"Cyber Power Systems" "ups" "1" "CPS1500AVR-HO" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS320AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS500AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS650AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS700AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS800AVR" "" "powerpanel" -"Cyber Power Systems" "ups" "1" "CPS825VA" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS850AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "CPS900AVR" "" "powerpanel" # http://www.cyberpowersystems.com/products/ups-systems/other-ups/CPS900AVR.html -"Cyber Power Systems" "ups" "1" "PR2200" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "CPS1250AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "CPS1500AVR" "" "powerpanel" "Cyber Power Systems" "ups" "1" "Power99" "" "genericups upstype=7" -"Cyber Power Systems" "ups" "2" "AE550" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "BL1250U" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/product/ups/battery-backup/bl1250u/ https://github.com/networkupstools/nut/issues/1012 -"Cyber Power Systems" "ups" "2" "BR1000ELCD" "USB" "usbhid-ups" # https://www.cyberpower.com/eu/en/product/sku/BR1000ELCD https://github.com/networkupstools/nut/issues/552 -"Cyber Power Systems" "ups" "2" "CP1350AVRLCD" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "2" "CP1500AVRLCD" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "2" "CP850PFCLCD" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/605 -"Cyber Power Systems" "ups" "2" "CP1500PFCLCD" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/product/ups/cp1500pfclcd/ https://github.com/networkupstools/nut/issues/520 -"Cyber Power Systems" "ups" "2" "CP900AVR" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "1" "550SL" "" "genericups upstype=7" +"Cyber Power Systems" "ups" "1" "725SL" "" "genericups upstype=7" +"Cyber Power Systems" "ups" "1" "CPS825VA" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "CPS1100AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "CPS1200AVR" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "CPS1500AVR-HO" "" "powerpanel" +"Cyber Power Systems" "ups" "1" "PR2200" "" "powerpanel" +"Cyber Power Systems" "ups" "2" "PR3000E" "" "powerpanel" +"Cyber Power Systems" "ups" "2" "OL3000RMXL2U" "" "powerpanel" "Cyber Power Systems" "ups" "2" "CPS685AVR" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "CPS800AVR" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "2" "OL3000RMXL2U" "" "powerpanel" -"Cyber Power Systems" "ups" "2" "PR3000E" "" "powerpanel" -"Cyber Power Systems" "ups" "2" "Value 1500ELCD-RU" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "AE550" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "CP 1500C" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "OR2200LCDRM2U" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "OR700LCDRM1U" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "3" "PR6000LCDRTXL5U" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 400E" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 600E" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "2" "Value 800E" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "CP 1500C" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "CP1000PFCLCD" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "CP1500EPFCLCD" "USB" "usbhid-ups" # http://www.cyberpower-eu.com/products/ups_systems/pfc-sinewave/cp1500epfclcd.htm -"Cyber Power Systems" "ups" "3" "CP825AVR-G / LE825G" "USB" "usbhid-ups" # http://www.cyberpowersystems.com/products/ups-systems/retail-products/LE825G.html -"Cyber Power Systems" "ups" "3" "EC350G" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/products/ups/ecologic/ec350g -"Cyber Power Systems" "ups" "3" "EC750G" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/products/ups/desktop/ec750g -"Cyber Power Systems" "ups" "3" "EC850LCD" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/product/ups/ec850lcd/ https://github.com/networkupstools/nut/issues/622 -"Cyber Power Systems" "ups" "3" "OR1500ERM1U" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/1338 -"Cyber Power Systems" "ups" "3" "OR2200LCDRM2U" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "OR700LCDRM1U" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "OR500LCDRM1U" "USB" "usbhid-ups" # https://www.cyberpowersystems.com/product/ups/or500lcdrm1u/ https://github.com/networkupstools/nut/issues/578 -"Cyber Power Systems" "ups" "3" "RT650EI" "USB" "usbhid-ups" # http://www.cyberpowersystems.de/produkte/backup-usv-serien/rt-serie.html https://github.com/networkupstools/nut/issues/453 -"Cyber Power Systems" "ups" "3" "UT2200E" "USB" "usbhid-ups" # https://www.cyberpower.com/ww/en/product/sku/UT2200E https://github.com/networkupstools/nut/issues/556 -"Cyber Power Systems" "ups" "3" "PR1500RT2U" "" "usbhid-ups" # https://www.cyberpowersystems.com/product/ups/new-smart-app-sinewave/pr1500rt2u/ https://github.com/networkupstools/nut/issues/1191 -"Cyber Power Systems" "ups" "3" "PR6000LCDRTXL5U" "USB" "usbhid-ups" -"Cyber Power Systems" "ups" "3" "PR2200LCDRT2U" "" "snmp-ups" +"Cyber Power Systems" "ups" "2" "CP900AVR" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1000AVRLCD" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1350AVRLCD" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1500AVRLCD" "USB" "usbhid-ups" +"Cyber Power Systems" "ups" "2" "CP1000PFCLCD" "USB" "usbhid-ups" "Cyber Power Systems" "ups" "3" "RMCARD100" "" "snmp-ups" "Cyber Power Systems" "ups" "3" "RMCARD201" "" "snmp-ups" "Cyber Power Systems" "ups" "3" "RMCARD202" "" "snmp-ups" -"Cyber Power Systems" "ups" "3" "RMCARD205" "" "snmp-ups" "Cyber Power Systems" "ups" "3" "RMCARD301" "" "snmp-ups" "Cyclades" "pdu" "1" "PM8" "8 outlets" "powerman-pdu (experimental)" @@ -286,28 +231,17 @@ "Dell" "ups" "5" "Rack 3750W High Efficiency Online HV" "USB port" "usbhid-ups" "Dell" "ups" "5" "Rack 4200W High Efficiency Online HV" "USB port" "usbhid-ups" "Dell" "ups" "5" "Rack 5600W HV" "USB port" "usbhid-ups" -"Dell" "ups" "5" "Various (SNMP mode)" "UPS Network Management Card" "snmp-ups" -"Dell" "ups" "5" "Various (XML/HTTP mode)" "UPS Network Management Card" "netxml-ups (experimental)" +"Dell" "ups" "5" "Various (SNMP mode)" "UPS Network Management Card " "snmp-ups" +"Dell" "ups" "5" "Various (XML/HTTP mode)" "UPS Network Management Card " "netxml-ups (experimental)" "Delta" "ups" "1" "GES602N" "" "belkin" -"Delta" "ups" "4" "Delta UPS Amplon R Series" "USB port" "usbhid-ups" "Deltec" "ups" "1" "PowerRite Pro II" "" "genericups upstype=15" "Deltec" "ups" "4" "PRM 450/700/1000/1500" "" "upscode2" -"DEXP" "ups" "2" "MIX 850VA" "USB" "blazer_usb langid_fix=0x0409 runtimecal=240,100,720,50 default.battery.voltage.high=2.27 default.battery.voltage.low=1.72" # https://github.com/networkupstools/nut/issues/721 - "Digital Loggers" "pdu" "1" "LPC, EPCR2, DIN" "8 outlets" "powerman-pdu (experimental)" -"DigiTECH" "ups" "2" "Computer 650VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/674 (may need longer pollinterval) - -"Digitus" "ups" "1" "DN-170014" "USB" "richcomm_usb" # http://www.digitus.info/en/products/professional-network/security-and-surveillance/power-supply/uninterrruptable-power-supplies/ups-uninterruptible-power-systems-dn-170014/section/prof/ "Digitus" "ups" "2" "DN-170020" "" "blazer_ser" -"Digitus" "ups" "2" "DN-170040" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/1251 -"Digitus" "ups" "2" "DN-170041" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/1251 -"Digitus" "ups" "2" "DN-170040" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1251 -"Digitus" "ups" "2" "DN-170041" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1251 -"Digitus" "ups" "2" "DN-170076" "USB" "nutdrv_qx" # https://www.digitus.info/en/products/network-and-server-cabinets/power-supply/uninterruptible-power-supplies/dn-170076/ https://github.com/networkupstools/nut/issues/948 "Dynamix" "ups" "2" "UPS1700D" "" "blazer_ser" "Dynamix" "ups" "2" "UPS-650VA" "" "blazer_ser" @@ -321,7 +255,6 @@ "Eaton" "ups" "5" "Ellipse ECO 650/800/1200/1600 VA" "USB" "usbhid-ups" "Eaton" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "USB cable" "usbhid-ups" "Eaton" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "USB cable" "usbhid-ups" -"Eaton" "ups" "5" "Ellipse PRO 650 VA" "USB cable" "usbhid-ups" "Eaton" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "USB port" "usbhid-ups" "Eaton" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "USB port" "usbhid-ups" "Eaton" "ups" "5" "EX 700/1000/1500 VA" "USB port" "usbhid-ups" @@ -330,41 +263,30 @@ "Eaton" "ups" "5" "MX 5/8/10/15/20 kVA" "USB port" "usbhid-ups" "Eaton" "ups" "5" "5 PX" "USB port" "usbhid-ups" "Eaton" "ups" "5" "Nova AVR 625/1250" "USB" "usbhid-ups" -"Eaton" "ups" "5" "5E650iUSB" "USB port" "usbhid-ups" -"Eaton" "ups" "5" "5E1100iUSB" "USB port" "usbhid-ups" # http://powerquality.eaton.com/5E1100iUSB.aspx?CX&GUID=8D85FE66-3102-427C-8F33-B8D56BBDD4D3 -"Eaton" "ups" "4" "5E2200" "USB port" "nutdrv_qx" "Eaton" "ups" "5" "5S" "USB port" "usbhid-ups" "Eaton" "ups" "5" "5SC" "USB port" "usbhid-ups" "Eaton" "ups" "5" "5P" "USB port" "usbhid-ups" "Eaton" "ups" "5" "9SX" "USB port" "usbhid-ups" -"Eaton" "ups" "5" "9PX" "USB port" "usbhid-ups" -"Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "USB port" "usbhid-ups" -"Eaton" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut" -"Eaton" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut" -"Eaton" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "EX 700/1000/1500 VA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "EX 2200/3000/3000 XL VA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "EX 1000 RT2U / 1500 RT2U" "Serial port" "mge-shut" -"Eaton" "ups" "5" "MX 5/8/10/15/20 kVA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "5 PX" "Serial port" "mge-shut" -"Eaton" "ups" "5" "EX RT 1:1 7/11 kVA" "" "mge-shut" -"Eaton" "ups" "5" "EX RT 3:1 5/7/11 kVA" "" "mge-shut" -"Eaton" "ups" "5" "5SC" "Serial port" "mge-shut" -"Eaton" "ups" "5" "5P" "Serial port" "mge-shut" -"Eaton" "ups" "5" "9SX" "Serial port" "mge-shut" -"Eaton" "ups" "5" "9PX" "Serial port" "mge-shut" -"Eaton" "ups" "5" "9PX 2000 RT" "USB port" "mge-shut" # https://github.com/networkupstools/nut/issues/540 -"Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "Serial port" "mge-shut" -"Eaton" "ups" "5" "9PX" "SNMP/Web card" "netxml-ups" -"Eaton" "ups" "5" "9PX Split Phase 6/8/10 kVA" "SNMP/Web card" "netxml-ups" +"Eaton" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "EX 700/1000/1500 VA" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "EX 2200/3000/3000 XL VA" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "EX 1000 RT2U / 1500 RT2U" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "5 PX" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "EX RT 1:1 7/11 kVA" "" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "EX RT 3:1 5/7/11 kVA" "" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "5SC" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "5P" "Serial port" "mge-shut or oldmge-shut" +"Eaton" "ups" "5" "9SX" "Serial port" "mge-shut or oldmge-shut" "Eaton" "ups" "5" "EX RT (XML/HTTP)" "NMC Transverse card (ref 66074)" "netxml-ups (experimental)" "Eaton" "ups" "5" "EX RT (SNMP)" "NMC Transverse card (ref 66074)" "snmp-ups (experimental)" "Eaton" "ups" "5" "E Series NV UPS 400-2000 VA" "" "blazer_usb" -"Eaton" "ups" "5" "E Series DX UPS 1-20 kVA" "" "blazer_ser" # http://www.eaton.com/Eaton/ESeriesUPS/DXUPS/ +"Eaton" "ups" "5" "E Series DX UPS 1-20 kVA" "" "mge-utalk" "Eaton" "ups" "4" "NetUPS SE 450/700/1000/1500" "" "upscode2" "Eaton" "ups" "5" "BladeUPS (SNMP)" "ConnectUPS Web/SNMP Card" "snmp-ups (experimental)" -"Eaton" "ups" "5" "various models (SNMP mode)" "Power Xpert Gateway UPS Card" "snmp-ups (experimental)" "Eaton" "ups" "5" "various models (XML/HTTP mode)" "NMC Minislot (ref 66102)" "netxml-ups (experimental)" "Eaton" "ups" "5" "various models (SNMP mode)" "NMC Minislot (ref 66102)" "snmp-ups (experimental)" "Eaton" "ups" "5" "various models (XML/HTTP mode)" "SNMP/Web Minislot card (ref 66244)" "netxml-ups (experimental)" @@ -373,8 +295,6 @@ "Eaton" "pdu" "5" "ePDU Managed" "" "snmp-ups" "Eaton" "pdu" "5" "ePDU Switched" "" "snmp-ups" "Eaton" "pdu" "5" "ePDU Monitored" "" "snmp-ups or netxml-ups" -"Eaton" "ups" "5" "Powerware 3105" "USB" "bcmxcp_usb" # http://powerquality.eaton.com/Products-services/Backup-Power-UPS/3105-eol.aspx -"Eaton" "ups" "5" "Powerware 9125" "USB card" "bcmxcp_usb" "Eaton" "ups" "5" "Powerware 9130" "" "bcmxcp or usbhid-ups" "Eaton" "ups" "5" "Powerware 9140" "" "bcmxcp or usbhid-ups" "Eaton" "ups" "5" "Powerware 5130" "" "usbhid-ups" @@ -383,27 +303,15 @@ "Eaton" "ups" "5" "ConnectUPS X / BD / E Slot" "Serial Pass-through mode" "bcmxcp" "Eaton" "ups" "5" "ConnectUPS X / BD / E Slot" "Network port" "snmp-ups" "Eaton" "ups" "5" "Management Card Contact" "Config 3 - Cable 66033" "genericups upstype=7" -"Eaton" "ats" "5" "Eaton ATS16" "" "snmp-ups" -"Eaton" "ats" "5" "Eaton ATS30" "" "snmp-ups" "Effekta" "ups" "2" "MI/MT/MH" "2502 cable" "blazer_ser" "Effekta" "ups" "2" "RM2000MH" "" "blazer_ser" -"Electrys" "ups" "2" "UPS 2500" "" "nutdrv_qx or blazer_ser" - -"Elsist" "ups" "2" "Nemo2.0 160" "USB" "blazer_usb" # http://www.naicon.com/company/wp-content/uploads/2017/05/Manual-NEMO2.0-Ver.02-Eng.pdf https://github.com/networkupstools/nut/issues/719 - -"Emerson" "pdu" "3" "PM3000 metered & switched" "" "snmp-ups" - "Energy Sistem" "ups" "2" "(various)" "" "blazer_ser" -"Energy Technologies" "ups" "2" "DPK1/1-3" "Serial" "blazer_ser" # https://www.tensy.ru/podderzhka/dokumentatsiya/ibp-serii-dpk/ https://github.com/networkupstools/nut/issues/762 - "ETA" "ups" "1" "mini+UPS" "WinNT/Upsoft cable" "genericups upstype=7" "ETA" "ups" "1" "mini+UPS PRO" "UPS Explorer cable" "etapro" -"EUROCASE" "ups" "2" "EA200N 2000VA" "USB" "nutdrv_qx" # http://partis.cz/index.php?gid=2551 - "EVER" "ups" "1" "NET DPC series" "Serial port" "everups" "EVER" "ups" "1" "AP Pro series" "Serial port" "everups" "EVER" "ups" "1" "625/1000" "" "safenet" @@ -414,7 +322,6 @@ "EVER" "ups" "2" "DUO II Pro series" "USB port" "blazer_usb" "EVER" "ups" "2" "POWERLINE RT 1-3kVA series" "USB port" "blazer_usb" "EVER" "ups" "2" "POWERLINE RT 6-10kVA series" "USB port" "blazer_usb" -"EVER" "ups" "4" "ECO Pro AVR CDS series" "USB port" "usbhid-ups" "Exide" "ups" "1" "NetUPS SE" "" "genericups upstype=15" "Exide" "ups" "4" "NetUPS SE 450/700/1000/1500" "" "upscode2" @@ -427,19 +334,13 @@ "Fairstone" "ups" "1" "L525/L625/L750" "" "safenet" "Fideltronik" "ups" "1" "Ares 700 and larger" "" "genericups upstype=6" -"Fideltronik" "ups" "2" "LUPUS 500" "USB" "nutdrv_qx" "Fideltronik" "ups" "1" "Other Ares models" "" "genericups upstype=19" -"Fideltronik INIGO" "ups" "2" "Viper 1200" "USB" "nutdrv_qx" # http://fideltronikinigo.com/viper/viper-1200/ "Fiskars" "ups" "4" "PowerRite MAX" "" "upscode2" "Fiskars" "ups" "4" "PowerServer 10" "" "upscode2" "Fiskars" "ups" "4" "PowerServer 30" "" "upscode2" "Fiskars" "ups" "4" "9200" "UPS Information Unit" "upscode2" -"Flight Technic & International (FTUPS)" "ups" "2" "FT-1000BS" "Serial" "nutdrv_qx" -"Flight Technic & International (FTUPS)" "ups" "2" "FT-1000BS" "USB" "nutdrv_qx" -"Flight Technic & International (FTUPS)" "ups" "2" "FT-1000BS(T)" "Serial" "nutdrv_qx" -"Flight Technic & International (FTUPS)" "ups" "2" "FT-1000BS(T)" "USB" "nutdrv_qx" "Flight Technic & International (FTUPS)" "ups" "2" "Smart On Line UPS 1KVA" "Serial" "nutdrv_qx" "Flight Technic & International (FTUPS)" "ups" "2" "Smart On Line UPS 1KVA" "USB" "nutdrv_qx" "Flight Technic & International (FTUPS)" "ups" "2" "(various)" "Serial" "nutdrv_qx" @@ -464,11 +365,6 @@ "Gemini" "ups" "1" "UPS625/UPS1000" "" "safenet" -"Grafenthal" "ups" "2" "PR-3000-HS" "SNMP/Web Minislot card (ref 149G0006)" "snmp-ups" # http://grafenthal.de/produkte/usv/online/pr-hs-serie/pr-3000-hs/?L=3et8 - -"Greencell" "ups" "2" "Micropower 600" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1080 -"Greencell" "ups" "2" "Micropower 600" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/1080 - "Gtec" "ups" "2" "ZP120N-1K / ZP120N-1KS / ZP120N-2K / ZP120N-2KS / ZP120N-3K / ZP120N-3KS" "" "blazer_usb" "Gtec" "ups" "2" "ZP120N-6K / ZP120N-6KS / ZP120N-10K-11 / ZP120N-10KS-11" "" "blazer_usb" "Gtec" "ups" "2" "ZP120N-10K-31-00 / ZP120N-10K-31-07 / ZP120N-10K-31-09 / ZP120N-10K-31-99 / ZP120N-20K" "USB port" "blazer_usb" @@ -476,8 +372,6 @@ "Gtec" "ups" "2" "ZP120N-10K-31-00 / ZP120N-10K-31-07 / ZP120N-10K-31-09 / ZP120N-10K-31-99 / ZP120N-20K" "Serial port" "blazer_ser" "Gtec" "ups" "2" "AP160N-1K / AP160LCD-1K-KS / AP160N-2K / AP160LCD-2K-KS / AP160N-3K / AP160LCD-3K-KS / AP160N-6K-PDU / AP160N-10K-PDU" "Serial port" "blazer_ser" -"Guardian" "ups" "2" "LCD 1500 AP (IGA1500LCD)" "Serial" "nutdrv_qx" - "HP" "ups" "1" "PowerTrust 2997A" "HP 5061-2575 cable" "apcsmart" "HP" "ups" "3" "T750 G2" "Serial port" "bcmxcp" "HP" "ups" "3" "T1000 G3" "Serial port" "bcmxcp" @@ -486,8 +380,8 @@ "HP" "ups" "4" "R3000 XR" "" "bcmxcp" "HP" "ups" "4" "R5500 XR" "" "bcmxcp" "HP" "ups" "3" "T500 / T750" "older models, USB port" "bcmxcp_usb" -"HP" "ups" "3" "R/T3000" "Serial port" "mge-shut" -"HP" "ups" "3" "R5000 / R7000" "Serial port" "mge-shut" +"HP" "ups" "3" "R/T3000" "Serial port" "mge-shut or oldmge-shut" +"HP" "ups" "3" "R5000 / R7000" "Serial port" "mge-shut or oldmge-shut" "HP" "ups" "3" "T750 INTL" "" "usbhid-ups" "HP" "ups" "3" "T1000 INTL" "" "usbhid-ups" "HP" "ups" "3" "T1500 INTL" "" "usbhid-ups" @@ -498,18 +392,9 @@ "HP" "ups" "3" "R/T 2200 G2" "" "usbhid-ups" "HP" "ups" "3" "R/T3000" "USB port" "usbhid-ups" "HP" "ups" "3" "R5000 / R7000" "USB port" "usbhid-ups" -"HP" "ups" "4" "Various (SNMP mode)" "HP UPS Management Module" "snmp-ups" +"HP" "ups" "4" "Various (SNMP mode)" "HP UPS Management Module " "snmp-ups" "HP" "pdu" "1" "HP3488 Switch/Control Unit" "" "powerman-pdu (experimental)" -"HPE" "pdu" "5" "Various (SNMP mode)" "" "snmp-ups" - -"Huawei" "ups" "4" "UPS5000-E" "" "snmp-ups" -"Huawei" "ups" "3" "UPS2000-G and UPS2000-A series" "MODBUS (USB with Linux 5.12+, or Serial RS-232)" "huawei-ups2000" # https://github.com/networkupstools/nut/issues/1066 https://github.com/networkupstools/nut/pull/1198 https://github.com/networkupstools/nut/pull/954 https://github.com/networkupstools/nut/issues/1017 - -"Hunnox" "ups" "2" "HNX-850" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 - -"IBM" "ups" "5" "Various" "USB port" "usbhid-ups" -"IBM" "ups" "5" "Various" "Serial port" "mge-shut" "IBM" "pdu" "1" "Blade Center Management Module" "15 outlets" "powerman-pdu (experimental)" "ICS" "pdu" "1" "8064 Ethernet Relay Interface" "16 outlets" "powerman-pdu (experimental)" @@ -529,7 +414,6 @@ "Infosec" "ups" "2" "iPEL 750" "" "blazer_ser" "Infosec" "ups" "2" "iPEL 1000" "" "blazer_ser" "Infosec" "ups" "2" "500XP" "" "blazer_ser" -"Infosec" "ups" "2" "X2, X3, X4, E2, E3, E4" "USB" "blazer_usb" "Infosec" "ups" "2" "XP 500" "USB" "blazer_usb" "Infosec" "ups" "2" "XP 1000" "" "blazer_ser" @@ -537,12 +421,10 @@ "IPMI" "pdu" "1" "" "" "powerman-pdu (experimental)" -"Ippon" "ups" "2" "Back Basic 850 Euro" "USB" "blazer_usb (experimental)" # https://github.com/networkupstools/nut/issues/802 "Ippon" "ups" "2" "Back Power Pro 400/500/600/700/800" "" "blazer_ser" "Ippon" "ups" "2" "Back Power Pro 400/500/600/700/800" "USB" "blazer_usb (experimental)" "Ippon" "ups" "2" "Back Comfo Pro 600/800" "" "blazer_ser" "Ippon" "ups" "2" "Back Comfo Pro 600/800" "USB" "blazer_usb (experimental)" -"Ippon" "ups" "2" "Back Comfo Pro II 650/850/1050" "USB" "blazer_usb (experimental)" "Ippon" "ups" "2" "Smart Power Pro 1000/1400/2000" "" "blazer_ser" "Ippon" "ups" "2" "Smart Power Pro 1000/1400/2000" "USB" "blazer_usb (experimental)" "Ippon" "ups" "2" "Smart Winner 750/1000/1500/2000/3000" "" "blazer_ser" @@ -555,13 +437,7 @@ "Jageson Technology" "ups" "1" "Jasuny USPS" "" "genericups upstype=4" -"JAWAN" "ups" "2" "JW-UPSLC02" "USB" "blazer_usb" - -"Kanji" "ups" "1" "800 VA" "USB" "nutdrv_atcl_usb" - "Kebo" "ups" "2" "1200D/D Series" "" "blazer_ser" -"Kebo" "ups" "2" "UPS-1000D (UPS-1000VA)" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/981 -"Kebo" "ups" "2" "UPS-650VA" "USB" "megatec_usb" "KOLFF" "ups" "2" "BLACK NOVA 1K/2K/3K/6K/10K/20K TOWER" "" "blazer_usb" "KOLFF" "ups" "2" "BLACK NOVA 1K/2K/3K/6K/10K/20K XL TOWER" "" "blazer_usb" @@ -571,48 +447,8 @@ "Krauler" "ups" "2" "UP-D1200VA" "USB" "blazer_usb" "Krauler" "ups" "2" "UP-M500VA" "USB" "blazer_usb" -"Lacerda" "ups" "2" "New Orion 800VA" "USB" "blazer_usb" - "LDLC" "ups" "2" "UPS-1200D" "" "blazer_usb langid_fix=0x4095" -"Legrand" "ups" "2" "Daker DK" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Daker DK" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Daker DK Plus" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Daker DK Plus" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Keor Line RT" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Keor Line RT" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Keor LP" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Keor Multiplug" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Keor S" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Keor S" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Keor PDU" "USB" "usbhid-ups" -"Legrand" "ups" "2" "Keor SP" "USB" "usbhid-ups" -"Legrand" "ups" "2" "Keor SPX" "USB" "nutdrv_qx" -"Legrand" "ups" "4" "Megaline 1250" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 2500" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 3750" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 5000" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 5000 /2" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 6250 /2" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 7500 /2" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 8750 /2" "Serial" "metasys" -"Legrand" "ups" "4" "Megaline 10000 /2" "Serial" "metasys" -"Legrand" "ups" "2" "Niky" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Niky" "USB" "nutdrv_qx" -"Legrand" "ups" "2" "Niky S" "Serial" "nutdrv_qx" -"Legrand" "ups" "2" "Niky S" "USB" "nutdrv_qx" -"Legrand" "ups" "4" "WHAD 800" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD 1000" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD 1250" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD 1500" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD 2000" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD 2500" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD CAB 1250" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD CAB 2500" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD HE 800" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD HE 1000" "Serial" "metasys" -"Legrand" "ups" "4" "WHAD HE 1500" "Serial" "metasys" - "Lestar" "ups" "2" "MD-800E" "" "blazer_ser" "Lexis" "ups" "2" "X-Power Tigra 1kVA" "" "blazer_ser or bestups" @@ -622,66 +458,59 @@ "Liebert" "ups" "1" "GXT2-3000RT230" "" "liebert-esp2 (experimental)" "Liebert" "ups" "2" "PowerSure Personal XT" "USB" "usbhid-ups" "Liebert" "ups" "2" "PowerSure PSA" "USB" "usbhid-ups" -"Liebert" "ups" "2" "PowerSure PSA 500" "USB" "usbhid-ups" -"Liebert" "ups" "2" "PowerSure PSA500MT3-230U" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/601 -"Liebert" "ups" "2" "PowerSure PSI 1440" "USB" "usbhid-ups" # http://www.emersonnetworkpower.com/en-US/Products/ACPower/Pages/LiebertPowerSurePSILineInteractiveUPS10003000VA.aspx "LNXI" "pdu" "1" "Icebox" "10 outlets" "powerman-pdu (experimental)" -"Lyonn" "ups" "2" "CTB-800V" "" "nutdrv_qx" "Lyonn" "ups" "2" "CTB-1200" "" "blazer_usb" "Masterguard" "ups" "1" "(various)" "" "masterguard" "Maxxtro" "ups" "2" "UPS 600 VA" "serial port" "blazer_ser" -"Mecer" "ups" "2" "ME-1000-WTU" "USB" "nutdrv_qx" # http://www.comx-computers.co.za/download/mecer/ME-1000-WTU.pdf "Mecer" "ups" "2" "ME-2000" "" "blazer_ser" -"Meta System" "ups" "4" "HF Line" "1..4 boards" "metasys" -"Meta System" "ups" "4" "HF Line /2" "5..8 boards" "metasys" -"Meta System" "ups" "4" "HF Millennium 810" "" "metasys" -"Meta System" "ups" "4" "HF Millennium 820" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 910" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 920" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 930" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 940" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 950" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 960" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 970" "" "metasys" -"Meta System" "ups" "4" "HF TOP Line 980" "" "metasys" -"Meta System" "ups" "4" "ECO Network 750" "" "metasys" -"Meta System" "ups" "4" "ECO Network 1000" "" "metasys" -"Meta System" "ups" "4" "ECO Network 1050" "" "metasys" -"Meta System" "ups" "4" "ECO Network 1500" "" "metasys" -"Meta System" "ups" "4" "ECO Network 1800" "" "metasys" -"Meta System" "ups" "4" "ECO Network 2000" "" "metasys" -"Meta System" "ups" "4" "ECO Network 2100" "" "metasys" -"Meta System" "ups" "4" "ECO Network 2500" "" "metasys" -"Meta System" "ups" "4" "ECO Network 3000" "" "metasys" -"Meta System" "ups" "4" "ECO 305" "" "metasys" -"Meta System" "ups" "4" "ECO 308" "" "metasys" -"Meta System" "ups" "4" "ECO 311" "" "metasys" -"Meta System" "ups" "4" "ECO 511" "" "metasys" -"Meta System" "ups" "4" "ECO 516" "" "metasys" -"Meta System" "ups" "4" "ECO 519" "" "metasys" -"Meta System" "ups" "4" "ECO 522" "" "metasys" -"Meta System" "ups" "4" "ally HF 800" "" "metasys" -"Meta System" "ups" "4" "ally HF 1000" "" "metasys" -"Meta System" "ups" "4" "ally HF 1250" "" "metasys" -"Meta System" "ups" "4" "ally HF 1600" "" "metasys" -"Meta System" "ups" "4" "ally HF 2000" "" "metasys" -"Meta System" "ups" "4" "ally HF 2500" "" "metasys" -"Meta System" "ups" "4" "Megaline 1250" "" "metasys" -"Meta System" "ups" "4" "Megaline 2500" "" "metasys" -"Meta System" "ups" "4" "Megaline 3750" "" "metasys" -"Meta System" "ups" "4" "Megaline 5000" "" "metasys" -"Meta System" "ups" "4" "Megaline 6250" "" "metasys" -"Meta System" "ups" "4" "Megaline 7500" "" "metasys" -"Meta System" "ups" "4" "Megaline 8750" "" "metasys" -"Meta System" "ups" "4" "Megaline 10000" "" "metasys" -"Meta System" "ups" "4" "DHEA 1000" "Serial" "metasys" -"Meta System" "ups" "4" "DHEA 1500" "Serial" "metasys" +"Meta System" "ups" "1" "HF Line" "1..4 boards" "metasys" +"Meta System" "ups" "1" "HF Line \/2" "5..8 boards" "metasys" +"Meta System" "ups" "1" "HF Millennium 810" "" "metasys" +"Meta System" "ups" "1" "HF Millennium 820" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 910" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 920" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 930" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 940" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 950" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 960" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 970" "" "metasys" +"Meta System" "ups" "1" "HF TOP Line 980" "" "metasys" +"Meta System" "ups" "1" "ECO Network 750" "" "metasys" +"Meta System" "ups" "1" "ECO Network 1000" "" "metasys" +"Meta System" "ups" "1" "ECO Network 1050" "" "metasys" +"Meta System" "ups" "1" "ECO Network 1500" "" "metasys" +"Meta System" "ups" "1" "ECO Network 1800" "" "metasys" +"Meta System" "ups" "1" "ECO Network 2000" "" "metasys" +"Meta System" "ups" "1" "ECO Network 2100" "" "metasys" +"Meta System" "ups" "1" "ECO Network 2500" "" "metasys" +"Meta System" "ups" "1" "ECO Network 3000" "" "metasys" +"Meta System" "ups" "1" "ECO 305" "" "metasys" +"Meta System" "ups" "1" "ECO 308" "" "metasys" +"Meta System" "ups" "1" "ECO 311" "" "metasys" +"Meta System" "ups" "1" "ECO 511" "" "metasys" +"Meta System" "ups" "1" "ECO 516" "" "metasys" +"Meta System" "ups" "1" "ECO 519" "" "metasys" +"Meta System" "ups" "1" "ECO 522" "" "metasys" +"Meta System" "ups" "1" "ally HF 800" "" "metasys" +"Meta System" "ups" "1" "ally HF 1000" "" "metasys" +"Meta System" "ups" "1" "ally HF 1250" "" "metasys" +"Meta System" "ups" "1" "ally HF 1600" "" "metasys" +"Meta System" "ups" "1" "ally HF 2000" "" "metasys" +"Meta System" "ups" "1" "ally HF 2500" "" "metasys" +"Meta System" "ups" "1" "Megaline 1250" "" "metasys" +"Meta System" "ups" "1" "Megaline 2500" "" "metasys" +"Meta System" "ups" "1" "Megaline 3750" "" "metasys" +"Meta System" "ups" "1" "Megaline 5000" "" "metasys" +"Meta System" "ups" "1" "Megaline 6250" "" "metasys" +"Meta System" "ups" "1" "Megaline 7500" "" "metasys" +"Meta System" "ups" "1" "Megaline 8750" "" "metasys" +"Meta System" "ups" "1" "Megaline 10000" "" "metasys" "MGE Office Protection Systems" "ups" "5" "Protection Center 500/675 VA" "USB" "usbhid-ups" "MGE Office Protection Systems" "ups" "5" "Protection Station 500/650/800 VA" "USB" "usbhid-ups" @@ -692,15 +521,15 @@ "MGE Office Protection Systems" "ups" "5" "Pulsar 700/1000/1500 VA" "USB port" "usbhid-ups" "MGE Office Protection Systems" "ups" "5" "Pulsar M 2200/3000 VA" "USB port" "usbhid-ups" "MGE Office Protection Systems" "ups" "5" "Pulsar MX 5/8/10/15/20 kVA" "USB port" "usbhid-ups" -"MGE Office Protection Systems" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Pulsar 700/1000/1500 VA" "Serial port" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Pulsar M 2200/3000 VA" "Serial port" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Pulsar MX 5/8/10/15/20 kVA" "Serial port" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Comet EX RT 1:1 7/11 kVA" "" "mge-shut" -"MGE Office Protection Systems" "ups" "5" "Comet EX RT 3:1 5/7/11 kVA" "" "mge-shut" +"MGE Office Protection Systems" "ups" "5" "Ellipse ASR USBS 600/750/1000/1500 VA" "Serial cable" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Ellipse MAX USBS 600/850/1100/1500 VA" "Serial cable" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Evolution 650/850/1150/1550/2000 VA" "Serial port" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Evolution S 1250/1750/2500/3000 VA" "Serial port" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar 700/1000/1500 VA" "Serial port" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar M 2200/3000 VA" "Serial port" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Pulsar MX 5/8/10/15/20 kVA" "Serial port" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Comet EX RT 1:1 7/11 kVA" "" "mge-shut or oldmge-shut" +"MGE Office Protection Systems" "ups" "5" "Comet EX RT 3:1 5/7/11 kVA" "" "mge-shut or oldmge-shut" "MGE Office Protection Systems" "ups" "5" "Comet EX RT (XML/HTTP)" "NMC Transverse card (ref 66074)" "netxml-ups (experimental)" "MGE Office Protection Systems" "ups" "5" "Comet EX RT (SNMP)" "NMC Transverse card (ref 66074)" "snmp-ups (experimental)" "MGE Office Protection Systems" "ups" "5" "various models (XML/HTTP mode)" "NMC Minislot (Ref 66102)" "netxml-ups (experimental)" @@ -748,45 +577,45 @@ "MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 4000 RT" "USB" "usbhid-ups" "MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 5000 RT" "USB" "usbhid-ups" "MGE UPS SYSTEMS" "ups" "5" "Comet / Galaxy (USB)" "USB Card (ref 66067)" "usbhid-ups" -"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 600 Serial" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 1100 Serial" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse USBS" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse S" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium USBS" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium S" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 600" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 750" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1000" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1500" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 600" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 850" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1100" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1500" "Serial cable" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C / EX RT" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT 3:1" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Esprit" "" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution 650" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution 850" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution 1150" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1250" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution 1550" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1750" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution 2000" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution S 2500" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Evolution S 3000" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 2200" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000 XL" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar 700" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000 RT2U" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500 RT2U" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 4000 RT" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 5000 RT" "Serial port" "mge-shut" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar Evolution" "Serial port" "mge-shut or mge-utalk" -"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C" "" "mge-shut or mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 600 Serial" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "NOVA AVR 1100 Serial" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse USBS" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse S" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium USBS" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Ellipse Premium S" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 600" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 750" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1000" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse Office 1500" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 600" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 850" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1100" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Ellipse MAX 1500" "Serial cable" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C / EX RT" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Comet EX RT 3:1" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Esprit" "" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 650" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 850" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1150" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1250" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 1550" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 1750" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution 2000" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 2500" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Evolution S 3000" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 2200" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar M 3000 XL" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 700" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1000 RT2U" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar 1500 RT2U" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 4000 RT" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar MX 5000 RT" "Serial port" "mge-shut or oldmge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar Evolution" "Serial port" "mge-shut or oldmge-shut or mge-utalk" +"MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme C" "" "mge-shut or oldmge-shut or mge-utalk" "MGE UPS SYSTEMS" "ups" "5" "Pulsar ES+" "" "mge-utalk" "MGE UPS SYSTEMS" "ups" "5" "Pulsar ESV+" "" "mge-utalk" "MGE UPS SYSTEMS" "ups" "5" "Pulsar SV" "" "mge-utalk" @@ -798,7 +627,7 @@ "MGE UPS SYSTEMS" "ups" "5" "Pulsar EXtreme" "" "mge-utalk" "MGE UPS SYSTEMS" "ups" "5" "Comet EXtreme" "" "mge-utalk" "MGE UPS SYSTEMS" "ups" "5" "Comet / Galaxy (Serial)" "Utalk Serial Card (ref 66060)" "mge-utalk" -"MGE UPS SYSTEMS" "ups" "5" "Comet / Galaxy (Serial)" "HID COM Serial Card (ref 66066)" "mge-shut" +"MGE UPS SYSTEMS" "ups" "5" "Comet / Galaxy (Serial)" "HID COM Serial Card (ref 66066)" "mge-shut or oldmge-shut" "MGE UPS SYSTEMS" "ups" "5" "Pulsar / Comet / Galaxy (SNMP)" "SNMP/Web Transverse card (ref 66074)" "snmp-ups (experimental)" "MGE UPS SYSTEMS" "ups" "5" "various models (XML/HTTP mode)" "NMC Minislot (Ref 66102)" "netxml-ups (experimental)" "MGE UPS SYSTEMS" "ups" "5" "various models (SNMP mode)" "NMC Minislot (Ref 66102)" "snmp-ups (experimental)" @@ -812,7 +641,6 @@ "MicroDowell" "ups" "1" "B.Box BP 750" "" "powerpanel" "MicroDowell" "ups" "1" "B.Box BP 1000" "" "powerpanel" "MicroDowell" "ups" "1" "B.Box BP 1500" "" "powerpanel" -"MicroDowell" "ups" "1" "B.Box LP 500" "" "genericups upstype=7" "MicroDowell" "ups" "5" "Enterprise B8" "" "microdowell" "MicroDowell" "ups" "5" "Enterprise B10" "" "microdowell" "MicroDowell" "ups" "5" "Enterprise N8" "" "microdowell" @@ -831,8 +659,6 @@ "Microline" "ups" "2" "C-Lion Innova Tower 6K/10K" "" "blazer_usb" "Microline" "ups" "2" "C-Lion Innova Combo 10K/20K (3/1)" "" "blazer_usb" -"Micropower" "ups" "2" "LCD 1000" "USB" "blazer_usb" - "Microsol" "ups" "4" "Solis 1.0" "1000VA" "solis" "Microsol" "ups" "4" "Solis 1.5" "1500VA" "solis" "Microsol" "ups" "4" "Solis 2.0" "2000VA" "solis" @@ -848,37 +674,20 @@ "Mustek" "ups" "2" "Powermust" "600VA Plus" "blazer_ser" "Mustek" "ups" "2" "Powermust" "800VA Pro" "blazer_ser" "Mustek" "ups" "2" "Powermust" "1000VA Plus" "blazer_ser" -"Mustek" "ups" "2" "Powermust" "1000VA USB" "blazer_usb" "Mustek" "ups" "2" "Powermust" "1400VA Plus" "blazer_ser" "Mustek" "ups" "2" "Powermust" "2000VA USB" "blazer_ser" "Mustek" "ups" "2" "Powermust Office 650" "USB" "blazer_usb" "Mustek" "ups" "2" "PowerMust 424 / 636 / 848" "USB" "blazer_usb" -"Mustek" "ups" "2" "Yukai PowerMust" "1000 USB (PID: 5161)" "blazer_usb" +"Mustek" "ups" "2" "Yukai PowerMust" "1000 USB (PID: 5161)" "blazer_usb" "Mustek" "ups" "2" "Various" "" "blazer_ser" "Neus" "ups" "2" "400va / 600va" "" "blazer_ser" -"NHS Sistemas de Energia" "ups" "5" "Expert C Online 6000" "" "gamatronic" # http://www.nhs.com.br/produtos_interna/id/TWpFeQ== -"NHS Sistemas de Energia" "ups" "5" "Expert C Online 8000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Expert C Online 10000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Expert S Online 6000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Expert S Online 8000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Expert S Online 10000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Expert S Online 10000" "" "gamatronic" -"NHS Sistemas de Energia" "ups" "5" "Laser Senoidal 5000VA" "USB" "gamatronic" # http://www.nhs.com.br/produtos_interna/id/T0RrPQ== - "Nitram" "ups" "1" "Elite 500" "" "genericups upstype=8" "Nitram" "ups" "1" "Elite 2002" "" "genericups upstype=16" "Nitram" "ups" "1" "Elite 2005" "" "powerpanel" -"nJoy" "ups" "2" "Keen 600" "USB" "blazer_ser port=/dev/ttyUSB0" # https://www.njoy.ro/UPS/keen-600 -"nJoy" "ups" "2" "Keen 600" "USB" "nutdrv_qx port=/dev/ttyUSB0" # https://www.njoy.ro/UPS/keen-600 -"nJoy" "ups" "3" "Aten PRO 3000" "SNMP" "snmp-ups" # At least basic status is served; https://www.njoy.global/product/aten-pro-3000 - -"Novex" "ups" "1" "NUPS-650" "USB" "blazer_usb protocol=megatec" # http://komp.1k.by/periphery-ups/novex/Novex_NUPS_650-130052.html - -"Numeric" "ups" "2" "3000 SW" "" "blazer_ser" -"Numeric" "ups" "2" "Digital 800 plus" "USB" "nutdrv_qx or blazer_usb" +"NUMERIC" "ups" "2" "3000 SW" "" "blazer_ser" "Oneac" "ups" "1" "ON400" "advanced interface" "oneac" "Oneac" "ups" "1" "ON600" "advanced interface" "oneac" @@ -902,28 +711,18 @@ "Online" "ups" "2" "Zinto A" "" "blazer_usb" "Online" "ups" "1" "Zinto D" "" "optiups" "Online" "ups" "2" "Yunto YQ450" "" "blazer_usb" -"Online" "ups" "2" "Xanto S700" "/dev/ttyUSB0" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1279 "OnLite" "ups" "2" "AQUA" "50" "blazer_ser" "Opti-UPS" "ups" "1" "PowerES" "420E" "optiups" -"Opti-UPS" "ups" "1" "VS 575C" "type=OPTI" "powercom" -"Opti-UPS" "ups" "1" "Power Series" "PS1500E" "blazer_usb" "Orvaldi Power Protection" "ups" "2" "various" "not 400 or 600" "blazer_ser" "Orvaldi Power Protection" "ups" "2" "750 / 900SP" "" "blazer_usb" "Phasak" "ups" "2" "400VA / 600VA" "" "blazer_ser" -"Phasak" "ups" "2" "9465 or P6N" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1187 => Voltronic-QS-Hex protocol detected - -"PhoenixContact" "ups" "4" "QUINT-UPS/24DC" "2320461" "phoenixcontact_modbus" #https://www.phoenixcontact.com/online/portal/us?uri=pxc-oc-itemdetail:pid=2320461 - -"PiJuice" "ups" "5" "PiJuice HAT" "" "pijuice" # https://github.com/PiSupply/PiJuice/issues/124 -"PiJuice" "ups" "5" "PiJuice Zero pHAT" "" "pijuice" "Plexus" "ups" "2" "500VA" "USB" "blazer_usb" "Plexus" "ups" "2" "1000VA Pro" "USB" "blazer_usb" -"Plexus" "ups" "1" "800 VA" "USB" "nutdrv_atcl_usb" "Powercom" "ups" "4" "SMK" "" "blazer_ser" "Powercom" "ups" "4" "SXL" "" "blazer_ser" @@ -943,15 +742,6 @@ "Powercom" "ups" "4" "(various)" "USB (<= 2009 models, product id: 0002)" "powercom (requires 'usbserial' kernel module)" "Powercom" "ups" "5" "(various)" "USB (2009 models, product id: 00a?)" "usbhid-ups (experimental)" "Powercom" "ups" "5" "BNT-xxxAP" "USB (product id: 0004)" "usbhid-ups (experimental)" -"Powercom" "ups" "1" "BNT-xxxAP" "USB (product id: 0001)" "usbhid-ups (experimental)" -"Powercom" "ups" "3" "RPT-600AP" "USB" "usbhid-ups" # http://pcmups.com.tw/eA/html/product/show.php?num=226&root=13&kind=105&page=1&keyword= https://github.com/networkupstools/nut/issues/633 -"Powercom" "ups" "3" "Raptor 2000" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/633 - -"Powercool" "ups" "1" "350VA to 1600VA" "USB" "nutdrv_atcl_usb" -"Powercool" "ups" "2" "650VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 product=MEC0003 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/537 -"Powercool" "ups" "2" "650VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 bus=001 product=MEC0003 protocol=hunnox langid_fix=0x0409 novendor norating noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/537 -"Powercool" "ups" "2" "1500VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 product=MEC0003 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/537 - e.g. battery percentage is not being returned -"Powercool" "ups" "2" "2000VA" "USB" "nutdrv_qx port=auto vendorid=0001 productid=0000 product=MEC0003 protocol=hunnox langid_fix=0x0409 novendor noscanlangid" # https://github.com/networkupstools/nut/pull/638 caveats at https://github.com/networkupstools/nut/issues/537 "POWEREX" "ups" "2" "VI 1000 LED" "" "blazer_usb" @@ -979,18 +769,6 @@ "PowerWalker" "ups" "2" "Line-Interactive VI 850 LCD" "" "blazer_usb" "PowerWalker" "ups" "2" "Online VFI 1000RT/1500RT/2000RT/3000RT/6000RT/10000RT LCD" "" "blazer_usb" "PowerWalker" "ups" "2" "Line-Interactive VI 1000RT/1500RT/2000RT/3000RT LCD" "" "blazer_usb" -"PowerWalker" "ups" "2" "VFI 1000 CG PF1" "" "nutdrv_qx" # https://powerwalker.com/?page=product&item=10122108&lang=en -"PowerWalker" "ups" "2" "VFI 2000 TGS" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/560 and https://github.com/networkupstools/nut/pull/564 -"PowerWalker" "ups" "2" "VI 650 SH" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/483 -"PowerWalker" "ups" "2" "VI 650/850 SHL" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/646 -"PowerWalker" "ups" "2" "VI 1200 SHL" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/1270 -"PowerWalker" "ups" "2" "VI 2200 SHL" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/756 -"PowerWalker" "ups" "2" "VI 1200 SH" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/646 -"PowerWalker" "ups" "2" "VI 2200 SH" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/646 -"PowerWalker" "ups" "2" "Basic VI 1000 SB" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/818 -"PowerWalker" "ups" "2" "PR1500LCDRT2U" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/818 -"PowerWalker" "ups" "2" "VI 3000 SCL" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/971 -"PowerWalker" "ups" "2" "VI 750T/HID" "USB" "usbhid-ups" # https://powerwalker.com/?page=select&cat=VI_THID&lang=en https://github.com/networkupstools/nut/issues/774 "Powerware" "ups" "4" "3110" "" "genericups upstype=7" "Powerware" "ups" "4" "3115" "" "genericups upstype=11" @@ -1020,7 +798,6 @@ "Raritan" "pdu" "3" "Intelligent PDU - Dominion PX" "no report, but should be supported" "snmp-ups (experimental)" "Raritan" "pdu" "3" "Metered PDU - Raritan PM" "no report, but should be supported" "snmp-ups (experimental)" "Raritan" "pdu" "3" "Switched PDU - Raritan RPC" "no report, but should be supported" "snmp-ups (experimental)" -"Raritan" "pdu" "3" "Dominion PX2" "" "snmp-ups" "REDi" "ups" "2" "Blazer 400VA / 600VA / 800VA" "" "blazer_ser" @@ -1030,8 +807,8 @@ "Riello" "ups" "3" "Riello Sentinel SDL 6000-7" "Netman Plus 102 SNMP Card" "snmp-ups" "Riello" "ups" "3" "Riello Sentinel Dual SDH 1000-7" "Netman Plus 102 SNMP Card" "snmp-ups" -"Riello" "ups" "4" "IDG 400/600/800/1200/1600" "" "riello_usb" -"Riello" "ups" "4" "IPG 600/800" "" "riello_usb" +"Riello" "ups" "5" "IDG 400/600/800/1200/1600" "" "riello_usb" +"Riello" "ups" "5" "IPG 600/800" "" "riello_usb" "Riello" "ups" "5" "WPG 400/600/800" "" "riello_usb" "Riello" "ups" "5" "NPW 600/800/1000/1500/2000" "" "riello_usb" "Riello" "ups" "5" "NDG 800/1000/1500/2000" "" "riello_usb" @@ -1069,39 +846,10 @@ "Rocketfish" "ups" "2" "RF-1000VA / RF-1025VA" "" "usbhid-ups" -"Rucelf" "ups" "2" "Rucelf UPOII-3000-96-EL" "" "blazer_ser" # http://www.rucelf.ua/en/catalog/upoii-3000-96-el/ - -"Salicru" "ups" "2" "SPS ONE 700VA" "USB" "blazer_usb" -"Salicru" "ups" "2" "SPS ONE 2000VA" "USB" "nutdrv_qx" # https://www.salicru.com/en/ups/sps-one.html https://github.com/networkupstools/nut/issues/554 -"Salicru" "ups" "2" "SPS 650/850 HOME" "usb" "usbhid-ups (experimental)" -"Salicru" "ups" "2" "SLC TWIN PRO2" "usb" "usbhid-ups (experimental)" # https://github.com/networkupstools/nut/issues/450 -"Salicru" "ups" "2" "SLC-1500-TWIN PRO3" "usb" "usbhid-ups (experimental)" # https://github.com/networkupstools/nut/issues/1142 -"Salicru" "ups" "2" "SLC TWINPRO3" "usb" "usbhid-ups (experimental)" -"Salicru" "ups" "2" "SLC TWIN RT3" "usb" "usbhid-ups (experimental)" - -"Santak" "ups" "2" "Castle C*K" "Serial" "blazer_ser" # https://github.com/networkupstools/nut/issues/1039 -"Santak" "ups" "2" "MT*-PRO" "Serial" "blazer_ser" # https://github.com/networkupstools/nut/issues/1039 - -"Siemens" "ups" "4" "SITOP UPS500" "serial" "nutdrv_siemens_sitop (experimental, untested)" -"Siemens" "ups" "4" "SITOP UPS500" "USB" "nutdrv_siemens_sitop (experimental)" - "SmartLabs" "pdu" "1" "2412S Power Line Modem" "for X10/Insteon" "powerman-pdu (experimental)" "SMS (Brazil)" "ups" "2" "Manager III" "" "blazer_ser" -"SNR" "ups" "2" "SNR-UPS-LID-600" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-600-XPS" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-600-LED-C13" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-600-LED-C13-PRO" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-800" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-800-LED-С13" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-1000-XPS" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-1200" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-1500" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-2000" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-2000-XPS" "" "nutdrv_qx" -"SNR" "ups" "2" "SNR-UPS-LID-3000-XPS" "" "nutdrv_qx" - "SOLA" "ups" "1" "305" "cable INT-0025C" "genericups upstype=7" "SOLA" "ups" "1" "325" "" "blazer_ser or bestups" "SOLA" "ups" "1" "520" "" "blazer_ser or bestups" @@ -1139,17 +887,22 @@ "Sweex" "ups" "1" "500/1000" "" "genericups upstype=7" "Sweex" "ups" "1" "1000" "USB" "richcomm_usb" "Sweex" "ups" "2" "(various)" "" "blazer_ser" -"Sweex" "ups" "2" "INTELLIGENT UPS 1500VA P220" "USB" "blazer_usb (USB ID 0665:5161)" # http://www.sweex.com/en/notebook-pc-accessoires/ups/PP220/ - -"Syndome" "ups" "2" "Era 500VA" "USB" "blazer_usb" -"Syndome" "ups" "2" "Atom LCD-1000" "USB" "usbhid-ups" # https://github.com/networkupstools/nut/issues/483 "Sysgration" "ups" "2" "UPGUARDS Pro650" "" "blazer_ser" "Tecnoware" "ups" "2" "Easy Power 1200" "" "blazer_ser" -"Tecnoware" "ups" "2" "UPS ERA LCD 0.65" "USB" "blazer_usb langid_fix=0x409" -"Tecnoware" "ups" "2" "UPS ERA PLUS 1100" "USB" "blazer_usb" # https://www.tecnoware.com/Prodotti/FGCERAPL1100/ups-era-plus-1100.aspx https://github.com/networkupstools/nut/issues/747 +"Tecnoware" "ups" "2" "UPS ERA LCD 0.65" "" "blazer_usb langid_fix=0x409" +"Tripp Lite" "ups" "1" "INTERNETOFFICE700" "USB (older; product ID: 0001)" "tripplite_usb" +"Tripp Lite" "ups" "2" "OMNIVS1000" "USB (older; product ID: 0001)" "tripplite_usb" +"Tripp Lite" "ups" "1" "OMNIVS1500XL" "USB" "tripplite_usb" +"Tripp Lite" "ups" "1" "SMART700USB" "USB" "tripplite_usb" +"Tripp Lite" "ups" "1" "SMART1500RM2U" "USB (older; product ID: 0001)" "tripplite_usb" +"Tripp Lite" "ups" "1" "SMART550USB" "USB (older; product ID: 0001)" "tripplite_usb" +"Tripp Lite" "ups" "1" "OMNISMART500" "USB (older; product ID: 0001)" "tripplite_usb" +"Tripp Lite" "ups" "1" "SMART2200RMXL2U" "USB (older; product ID: 0001)" "tripplite_usb (experimental)" +"Tripp Lite" "ups" "1" "SmartUPS" "" "tripplite" +"Tripp Lite" "ups" "1" "SmartOnline" "" "tripplitesu" "Tripp Lite" "ups" "1" "(various)" "Lan 2.2 interface - black 73-0844 cable" "genericups upstype=5" "Tripp Lite" "ups" "2" "1500 LCD" "USB" "usbhid-ups" "Tripp Lite" "ups" "3" "AVR550U" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=930&txtModelID=3090 @@ -1179,39 +932,23 @@ "Tripp Lite" "ups" "3" "INTERNET750U" "USB (protocol 1007)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3142 "Tripp Lite" "ups" "3" "INTERNET900U" "USB (protocol 1007)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=930&txtModelID=3657 "Tripp Lite" "ups" "3" "INTERNETOFFICE500" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=930&txtModelID=11 -"Tripp Lite" "ups" "1" "INTERNETOFFICE700" "USB (older; product ID: 0001)" "tripplite_usb" "Tripp Lite" "ups" "3" "INTERNETOFFICE700" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=930&txtModelID=14 "Tripp Lite" "ups" "3" "OMNI650LCD" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3195 "Tripp Lite" "ups" "3" "OMNI900LCD" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=3082 "Tripp Lite" "ups" "2" "OMNI1000LCD" "USB" "usbhid-ups" "Tripp Lite" "ups" "3" "OMNISMART300PNP" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=19 -"Tripp Lite" "ups" "1" "OMNISMART500" "USB (older; product ID: 0001)" "tripplite_usb" "Tripp Lite" "ups" "3" "OMNISMART500" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=21 "Tripp Lite" "ups" "3" "OMNISMART700" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=23 -"Tripp Lite" "ups" "2" "OMNIVSINT800" "USB (older; product ID: 0001)" "tripplite_usb" -"Tripp Lite" "ups" "3" "OMNIVS800" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2729 -"Tripp Lite" "ups" "2" "OMNIVS1000" "USB (older; product ID: 0001)" "tripplite_usb" "Tripp Lite" "ups" "3" "OMNIVS1000" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2656 -"Tripp Lite" "ups" "1" "OMNIVS1500XL" "USB" "tripplite_usb" +"Tripp Lite" "ups" "3" "OMNIVS800" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2729 "Tripp Lite" "ups" "3" "POS500" "USB (protocol 2007)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3742 "Tripp Lite" "ups" "3" "SM2200RMDVTAA" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=4648 -"Tripp Lite" "ups" "1" "SmartUPS" "" "tripplite" -"Tripp Lite" "ups" "1" "SmartOnline" "" "tripplitesu" -"Tripp Lite" "ups" "1" "SMART550USB" "USB (older; product ID: 0001)" "tripplite_usb" -"Tripp Lite" "ups" "3" "SMART550USB" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2002 -"Tripp Lite" "ups" "3" "SMART550USBWD" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2591 -"Tripp Lite" "ups" "1" "SMART700USB" "USB" "tripplite_usb" -"Tripp Lite" "ups" "3" "SMART750RMXL2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3020 -"Tripp Lite" "ups" "3" "SMART750SLT" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3007 -"Tripp Lite" "ups" "3" "SMART750USB" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2679 -"Tripp Lite" "ups" "3" "SMART750XLA" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3820 "Tripp Lite" "ups" "3" "SMART1000LCD" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=3071 "Tripp Lite" "ups" "3" "SMART1000RM2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=2657 "Tripp Lite" "ups" "3" "SMART1000RMXL2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=5262 "Tripp Lite" "ups" "3" "SMART1050SLT" "USB (protocol 3012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3253 "Tripp Lite" "ups" "3" "SMART1050SLTAA" "USB (protocol 3012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=4389 "Tripp Lite" "ups" "3" "SMART1200LCD" "USB (protocol 2009)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3193 -"Tripp Lite" "ups" "1" "SMART1500RM2U" "USB (older; product ID: 0001)" "tripplite_usb" "Tripp Lite" "ups" "3" "SMART1500CRMXL" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3826 "Tripp Lite" "ups" "3" "SMART1500LCD" "USB (protocol 2009)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=3151 "Tripp Lite" "ups" "3" "SMART1500LCDXL" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=4978 @@ -1223,7 +960,6 @@ "Tripp Lite" "ups" "3" "SMART2200CRMXL" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3825 "Tripp Lite" "ups" "3" "SMART2200RM2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=4403 "Tripp Lite" "ups" "3" "SMART2200RM2UN" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=5428 -"Tripp Lite" "ups" "1" "SMART2200RMXL2U" "USB (older; product ID: 0001)" "tripplite_usb (experimental)" "Tripp Lite" "ups" "3" "SMART2200RMXL2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3264 "Tripp Lite" "ups" "3" "SMART2200RMXL2UP" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=4672 "Tripp Lite" "ups" "3" "SMART2200RMXLN" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=5427 @@ -1238,8 +974,13 @@ "Tripp Lite" "ups" "3" "SMART3000RMXL2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=4418 "Tripp Lite" "ups" "3" "SMART3000RMXLN" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=5425 "Tripp Lite" "ups" "3" "SMART3000SLT" "USB (protocol 3013)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3490 -"Tripp Lite" "ups" "2" "SMART500RT1U" "USB (older; product ID 0001, protocol 3005)" "tripplite_usb" -"Tripp Lite" "ups" "3" "SMART500RT1U" "USB (newer; protocol/product ID 3005)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=2853 +"Tripp Lite" "ups" "3" "SMART500RT1U" "USB (protocol 3005)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=2853 +"Tripp Lite" "ups" "3" "SMART550USB" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2002 +"Tripp Lite" "ups" "3" "SMART550USBWD" "USB (protocol 2010)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2591 +"Tripp Lite" "ups" "3" "SMART750RMXL2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3020 +"Tripp Lite" "ups" "3" "SMART750SLT" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3007 +"Tripp Lite" "ups" "3" "SMART750USB" "USB (protocol 2012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=932&txtModelID=2679 +"Tripp Lite" "ups" "3" "SMART750XLA" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=3820 "Tripp Lite" "ups" "3" "SMX1000LCD" "USB (protocol 2005)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3200 "Tripp Lite" "ups" "3" "SMX1000RT2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=2798 "Tripp Lite" "ups" "3" "SMX1050SLT" "USB (protocol 3012)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3249 @@ -1250,12 +991,8 @@ "Tripp Lite" "ups" "3" "SMX3000RT2UTAA" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=4396 "Tripp Lite" "ups" "3" "SMX3000XLRT2U" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=933&txtModelID=2694 "Tripp Lite" "ups" "3" "SMX3000XLRT2UA" "USB (protocol 3015)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=5658 -"Tripp Lite" "ups" "3" "SMX500RT1U" "USB (older; product ID 0001, protocol 3005)" "tripplite_usb" # https://www.tripplite.com/support/product/part-number/SMX500RT1U https://github.com/networkupstools/nut/pull/584 -"Tripp Lite" "ups" "3" "SMX500RT1U" "USB (newer; protocol/product ID 3005)" "usbhid-ups" # https://www.tripplite.com/support/product/part-number/SMX500RT1U +"Tripp Lite" "ups" "3" "SMX500RT1U" "USB (protocol 3005)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=2691 "Tripp Lite" "ups" "3" "SMX750SLT" "USB (protocol 3014)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3021 -"Tripp Lite" "ups" "3" "SU750RTXL2U" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3194 -"Tripp Lite" "ups" "3" "SU750RTXLCD2U" "USB (protocol 4004)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=5070 -"Tripp Lite" "ups" "3" "SU750XL" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3299 "Tripp Lite" "ups" "3" "SU1000RTXL2UA" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=2948 "Tripp Lite" "ups" "3" "SU1000RTXLCD2U" "USB (protocol 4004)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=745&txtModelID=4980 "Tripp Lite" "ups" "3" "SU1000XLA" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=3180 @@ -1275,6 +1012,9 @@ "Tripp Lite" "ups" "3" "SU3000RTXR3UHW" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=4976 "Tripp Lite" "ups" "3" "SU3000XL" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=3601 "Tripp Lite" "ups" "3" "SU3000XLCD" "USB (protocol 4004)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=744&txtModelID=5342 +"Tripp Lite" "ups" "3" "SU750RTXL2U" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3194 +"Tripp Lite" "ups" "3" "SU750RTXLCD2U" "USB (protocol 4004)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=5070 +"Tripp Lite" "ups" "3" "SU750XL" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3299 "Tripp Lite" "ups" "3" "SUINT1000RTXL2UA" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtModelID=3983 "Tripp Lite" "ups" "3" "SUINT1500RTXL2UA" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=2720 "Tripp Lite" "ups" "3" "SUINT2200RTXL2UA" "USB (protocol 4001)" "usbhid-ups" # http://www.tripplite.com/en/products/model.cfm?txtSeriesID=934&txtModelID=3970 @@ -1284,8 +1024,6 @@ "Trust" "ups" "2" "UPS 1200VA Management PW-4120M" "" "blazer_ser" "Trust" "ups" "2" "UPS 1300VA Management PW-4130M" "" "blazer_ser" -"TS Shara" "ups" "4" "(various)" "" "nutdrv_qx" - "UNITEK" "ups" "2" "ALPHA 500 IC" "" "blazer_ser" "UNITEK" "ups" "2" "Alpha 1000is" "" "blazer_ser" "UNITEK" "ups" "2" "Alpha 500" "" "blazer_ser" @@ -1302,8 +1040,6 @@ "UPSonic" "ups" "2" "PrOffice 650" "USB" "blazer_usb" "UPSonic" "ups" "2" "DS-800" "USB" "blazer_usb" -"V7" "ups" "2" "UPS1RM2U1500-1E" "USB" "blazer_usb" # http://www.v7world.com/uk/ups-1500va-rack-mount-2u-eu.html https://github.com/networkupstools/nut/issues/716 - "Various" "ups" "4" "(various)" "SEC protocol" "gamatronic" "Various" "ups" "1" "(various)" "Generic RUPS model" "genericups upstype=4" "Various" "ups" "1" "(various)" "Generic RUPS 2000 (Megatec M2501 cable)" "genericups upstype=21" @@ -1328,19 +1064,10 @@ "Vivaldi" "ups" "1" "EA200 LED" "USB" "richcomm_usb" -"Voltronic Power" "ups" "2" "Apex 1KVA" "Serial" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Apex 1KVA" "USB" "nutdrv_qx" "Voltronic Power" "ups" "2" "Frigate TX 1KVA" "Serial" "nutdrv_qx" "Voltronic Power" "ups" "2" "Frigate TX 1KVA" "USB" "nutdrv_qx" "Voltronic Power" "ups" "2" "Galleon 1KVA" "Serial" "nutdrv_qx" "Voltronic Power" "ups" "2" "Galleon 1KVA" "USB" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Galleon X9-RT LCD-1-3K" "USB" "blazer_usb" # https://github.com/networkupstools/nut/issues/1251 -"Voltronic Power" "ups" "2" "Galleon X9-RT LCD-1-3K" "USB" "nutdrv_qx" # https://github.com/networkupstools/nut/issues/1251 -"Voltronic Power" "ups" "2" "Imperial 1KVA" "Serial" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Imperial 1KVA" "USB" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Prosine 800" "Serial" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Prosine 800" "USB" "nutdrv_qx" -"Voltronic Power" "ups" "2" "Vesta LED 850VA" "USB" "nutdrv_qx" "Voltronic Power" "ups" "2" "(various)" "Serial" "nutdrv_qx" "Voltronic Power" "ups" "2" "(various)" "USB" "nutdrv_qx" diff --git a/data/html/Makefile.am b/data/html/Makefile.am index 4d0620a..956e66b 100644 --- a/data/html/Makefile.am +++ b/data/html/Makefile.am @@ -1,11 +1,7 @@ -# Network UPS Tools: data/html +# Network UPS Tools: data/html # install these only if configured --with-cgi if WITH_CGI dist_html_DATA = index.html bottom.html nut-banner.png nodist_html_DATA = header.html endif EXTRA_DIST = README - -MAINTAINERCLEANFILES = Makefile.in .dirstamp -# Generated by configure script: -DISTCLEANFILES = header.html diff --git a/data/html/Makefile.in b/data/html/Makefile.in index 30cdd21..09f9e78 100644 --- a/data/html/Makefile.in +++ b/data/html/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,61 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,24 +53,20 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = data/html +DIST_COMMON = README $(am__dist_html_DATA_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/header.html.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -116,34 +75,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_html_DATA_DIST) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = header.html CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -181,18 +122,13 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(htmldir)" "$(DESTDIR)$(htmldir)" DATA = $(dist_html_DATA) $(nodist_html_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/header.html.in \ - README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -203,7 +139,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -217,7 +152,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -230,8 +164,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -241,15 +178,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -260,29 +196,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -302,9 +230,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -313,16 +238,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -336,7 +257,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -347,12 +267,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -371,21 +287,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -396,14 +309,11 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -# Network UPS Tools: data/html +# Network UPS Tools: data/html # install these only if configured --with-cgi @WITH_CGI_TRUE@dist_html_DATA = index.html bottom.html nut-banner.png @WITH_CGI_TRUE@nodist_html_DATA = header.html EXTRA_DIST = README -MAINTAINERCLEANFILES = Makefile.in .dirstamp -# Generated by configure script: -DISTCLEANFILES = header.html all: all-am .SUFFIXES: @@ -419,13 +329,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu data/html/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu data/html/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -486,17 +397,14 @@ uninstall-nodist_htmlDATA: @list='$(nodist_html_DATA)'; test -n "$(htmldir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(htmldir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -559,12 +467,10 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -634,21 +540,18 @@ uninstall-am: uninstall-dist_htmlDATA uninstall-nodist_htmlDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-dist_htmlDATA install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-nodist_htmlDATA \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am uninstall-dist_htmlDATA \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_htmlDATA install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-nodist_htmlDATA install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am uninstall uninstall-am uninstall-dist_htmlDATA \ uninstall-nodist_htmlDATA -.PRECIOUS: Makefile - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/data/html/header.html.in b/data/html/header.html.in index 6e222a5..6f7f1ff 100644 --- a/data/html/header.html.in +++ b/data/html/header.html.in @@ -1,7 +1,7 @@ -Network UPS Tools +Network UPS Tools diff --git a/debian/NEWS b/debian/NEWS deleted file mode 100644 index c943bb7..0000000 --- a/debian/NEWS +++ /dev/null @@ -1,19 +0,0 @@ -nut (2.7.2-2) unstable; urgency=medium - - Since version 1.2 NUT-Monitor uses safer directory permissions when - creating ~/.nut-monitor. - - NUT-Monitor will now detect a pre-1.2 settings directory on startup - and update its permissions. - - Please note that passwords stored in NUT-Monitor prior to this change - may have been exposed, and it is recommended that they be reset. - - -- Michael Fincham Fri, 13 Feb 2015 11:57:12 +1300 - -nut (2.6.5-1) experimental; urgency=low - - mge-shut driver has been replaced by a new implementation (newmge-shut). - In case of issue with this new version, users can revert to oldmge-shut. - - -- Laurent Bigonville Mon, 13 Aug 2012 00:32:18 +0200 diff --git a/debian/changelog b/debian/changelog deleted file mode 100644 index 46485d6..0000000 --- a/debian/changelog +++ /dev/null @@ -1,1934 +0,0 @@ -nut (2.8.0-1) unstable; urgency=medium - - [ lagertonne ] - * new upstream 2.8.0 - - -- lagertonne Wed, 29 Jun 2022 13:12:45 +0000 - -nut (2.7.4-14) unstable; urgency=medium - - [ Jeremy Sowden ] - * d/patches: add patch to fix FTBFS with g++-11 (closes: #984260) - - [ Laurent Bigonville ] - * debian/control: Bump Standards-Version to 4.6.0 (no further changes) - * debian/source_nut.py: Change the shebang to python3 - - -- Laurent Bigonville Sat, 06 Nov 2021 18:41:33 +0100 - -nut (2.7.4-13) unstable; urgency=medium - - [ Arnaud Quette ] - * Retirement of Arnaud Quette from the Debian project - - [ Debian Janitor ] - * Set upstream metadata fields: Bug-Database, Bug-Submit (from ./configure), - Name (from ./configure), Repository, Repository-Browse. - - [ Sergio Durigan Junior ] - * d/libnutclient0.symbols: Update file, and fix FTBFS. (Closes: #957614) - - -- Laurent Bigonville Thu, 15 Oct 2020 12:16:34 +0200 - -nut (2.7.4-12) unstable; urgency=medium - - * Port autopkgtests to python3, taken from Ubuntu, thanks to them and - Dimitri John Ledkov (Closes: #937169) - - -- Laurent Bigonville Thu, 30 Jan 2020 01:06:14 +0100 - -nut (2.7.4-11) unstable; urgency=medium - - * Remove python(2) binding and disable nut-monitor package for now as it - depends on unmaintained pygtk (Closes: #885358, #937169) - * debian/control: Add support for the Build-Profile - * debian/patches/0013-fix-doc-build.patch: Fix the documentation build with - asciidoc >= 0.9 - * Disable python3-nut package for now as it's broken with python3 - - -- Laurent Bigonville Sun, 15 Dec 2019 21:22:13 +0100 - -nut (2.7.4-10) unstable; urgency=medium - - * debian/libnutscan1.symbols: hurd-i386 is not built with ipmi support and - thus is libnutscan is not exporting the related symbols - * debian/libnutclient0.symbols: Add new C++ template exported on arm64 and - x32 - * debian/tests: Import changes from the ubuntu package, thanks to them. - Add psmisc to the dependencies as it's not installed by default in debian - * Add the apport script coming from Ubuntu, thanks to them again - * Add higher resolution icon for nut-monitor - - -- Laurent Bigonville Mon, 19 Aug 2019 01:04:36 +0200 - -nut (2.7.4-9) unstable; urgency=medium - - [ Ondřej Nový ] - * d/changelog: Remove trailing whitespaces - * d/control: Remove XS-Testsuite field, not needed anymore - - [ Arnaud Quette ] - * debian/control, debian/rules, debian/libnutscan1.install, - debian/libnutscan-dev.install: distribute nut-scanner. (Closes: #921379 - LP: #1814314) - - [ Laurent Bigonville ] - * Switch from cdbs to debhelper sequence - * Bump debhelper compatibility version to 12 - * Add libltdl-dev to the build-dependencies and fix FTBFS when it is - installed (Closes: #831740) - * debian/control: Bump Standards-Version to 4.4.0 (no further changes) - * debian/control: Add libnss3-dev to the dependencies of libupsclient-dev - * debian/tests/control: Drop python-unit and depend against python package - instead (Closes: #908963) - * debian/control: Fix duplicate package descriptions to please lintian - * debian/*.symbols: Add Build-Depends-Package field - * debian/control, debian/watch: Use https for the Homepage and download page - * debian/libnutclient0.symbols: Adjust the symbols due to C++ changes - * debian/patches/0011-use-pkgconfig-module.patch: Use pkg-config module - names instead of listing the libraries, to please lintian - * Move pidfiles from /var/run/nut to /run/nut, there is nothing else to do - since /var/run is a symlink to /run for some times now (policy 3.9.3) - * debian/patches/0012-add-AEG-PROTECT-NAS-support.patch: Add support for - recent AEG PROTECT NAS UPS, from upstream (Closes: #919112) - * debian/nut-server.lintian-overrides: Override - package-supports-alternative-init-but-no-init.d-script - lib/systemd/system/nut-driver.service, in LSB world, the drivers are started - by nut-server initscript - * debian/nut-client.lintian-overrides: Drop unused override - * debian/nut-monitor.install: Install nut-monitor.appdata.xml in - /usr/share/metainfo/ instead of /usr/share/appdata/ - * Simplify debian/rules, install systemd files on non-linux arch as well - * Remove obsolete files and old upgrade paths for users coming from version - prior to wheezy - * debian/control: Mark -dev packages as Multi-Arch: same - * Add debian/patches/0001-reproductible-build.patch: Try to make the - documentation reproductible - * debian/patches/0003-install-dev-files-in-usr.patch: Also change the prefix - in libnutclient.pc.in for consistency - * debian/patches/0009-fix-nutshutdown-install.patch: Use patch coming from - upstream instead of our own patch - * debian/rules, debian/control: Override --with-systemdshutdowndir passed to - configure to fix FTBFS on non-linux architectures and do not build-depend - against systemd - * debian/rules: Install augeas lenses in /usr/share/augeas/lenses/ instead - of /usr/share/augeas/lenses/dist/, the later seems to be reserved for - augeas own lenses, not 3rd party ones - - -- Laurent Bigonville Sun, 04 Aug 2019 10:34:17 +0200 - -nut (2.7.4-8) unstable; urgency=medium - - * debian/libnutclient0.symbols: Use arch-bits=32 and arch-bits=64 instead of - listing the architectures explicitly (Closes: #892234) - * debian/libnutclient0.symbols: Fix FTBFS on riscv64 - * debian/control: Update the Vcs-* fields to point to the new gitlab/salsa - machine - * debian/control: Bump Standards-Version to 4.1.4 (no further changes) - * debian/control: Drop X-Python-Version field, not needed anymore because - the version is ancient - - -- Laurent Bigonville Fri, 01 Jun 2018 17:55:25 +0200 - -nut (2.7.4-7) unstable; urgency=medium - - * debian/libnutclient0.symbols: Fix symbols file, this should fix FTBFS on - most architectures. (Closes: #890981) - - -- Laurent Bigonville Wed, 21 Feb 2018 12:06:16 +0100 - -nut (2.7.4-6) unstable; urgency=medium - - * debian/control: Switch dependency from python-gobject to python-gobject-2, - the former is a transitional package (Closes: #890158) - * debian/libnutclient0.symbols: Update the symbols file to fix the FTBFS on - ppc64 and sparc64 architectures - * debian/control: Add python-notify to the recommended packages of - nut-monitor, it can displays notification in case the UPS is on battery - * debian/control: Bump debhelper build-dependency and drop dh-systemd - * debian/rules: Assign DEB_HOST_ARCH_OS with ?= instead of :? to please - lintian - * debian/libnutclient0.symbols: Fix version of symbols introduced in last - NMU - * Add python3-nut package - * debian/control: Bump Standards-Version to 4.1.3 and bump existing packages - from the extra priority to optional as the former is deprecated - * debian/nut-server.lintian-overrides: Add overrides for - udev-rule-missing-subsystem, the SUBSYSTEM check is at the top of the file - - -- Laurent Bigonville Tue, 20 Feb 2018 13:08:57 +0100 - -nut (2.7.4-5.1) unstable; urgency=medium - - * Non-maintainer upload. - - [ Laurent Bigonville ] - * debian/nut-server.postinst: The udevd process is called systemd-udevd for - quite sometimes already, properly detect whether it's running or not, this - should fix the devices permissions for USB UPS's (LP: #1540008) - * debian/rules: Mask ups-monitor, this is not a real LSB initscript but it's - a symlink to the nut-client one. The purpose of this was to offer a common - interface to shutdown the UPS in case of power loss, this is not necessary - with systemd as this functionality is handeled by the - /lib/systemd/system-shutdown/nutshutdown script now. - - [ Michael Stapelberg ] - * Update symbols file for gcc-7 (Closes: #853579) - - -- Michael Stapelberg Wed, 23 Aug 2017 22:24:57 +0200 - -nut (2.7.4-5) unstable; urgency=medium - - * debian/control: Build-depends against asciidoc-dblatex, Recommends are not - pulled automatically by the buildd (Closes: #851015) - - -- Laurent Bigonville Wed, 25 Jan 2017 09:14:10 +0100 - -nut (2.7.4-4) unstable; urgency=medium - - * debian/libnutclient0.symbols: Update the .symbols file, this should fix - the FTBFS (Closes: #835703) - * debian/nut-monitor.install: Install appdata file - - -- Laurent Bigonville Tue, 27 Sep 2016 23:00:50 +0200 - -nut (2.7.4-3) unstable; urgency=medium - - * debian/libnutclient0.symbols: Really add all the needed symbols (Closes: - #831725) - - -- Laurent Bigonville Sun, 24 Jul 2016 16:40:24 +0200 - -nut (2.7.4-2) unstable; urgency=medium - - * debian/libnutclient0.symbols: Adjust .symbols file for arch specific C++ - symbols (Thanks to pkgkde tools) - * Run wrap-and-sort - * debian/control: Add systemd to the build-dependencies, we need the - systemd.pc file to be installed during the build - - -- Laurent Bigonville Mon, 18 Jul 2016 17:48:25 +0200 - -nut (2.7.4-1) unstable; urgency=low - - [ Arnaud Quette ] - * New upstream release (Closes: #806255) - * debian/patches/series: remove 0007-killpower-path.patch - * debian/control: add new packages libnutclient0 and libnutclient-dev - * debian/rules: adapted for the new packages - * debian/libnutclient0.install, debian/libnutclient0.symbols, - debian/libnutclient-dev.install, debian/libnutclient-dev.manpages: - created for the new packages - - [ Laurent Bigonville ] - * debian/gbp.conf: Switch back the branch to the "debian" one - * Drop d/p/0009-fix-favorites-permissions.patch, merged upstream - * d/p/0002-nut-monitor-paths.patch, d/p/0006-ups-conf-maxretry.patch: - Refreshed - * debian/control: Bump Standards-Version to 3.9.8 (no further changes) - * debian/control: Add dh-python to the build-dependencies - * Bump debhelper compatibility to 9 - * d/p/0009-fix-nutshutdown-install.patch: Install the nutshutdown script in - the correct path - * debian/nut-server.install: 52-nut-usbups.rules file has been renamed to - 62-nut-usbups.rules - * debian/libnutclient0.symbols, debian/libupsclient4.symbols: Adjust the - .symbols files - * debian/control: Use https:// URL's in Vcs-* fields - * debian/nut-cgi.README.Debian: Fix typo - * debian/control: Fix the grammar in nut-ipmi long description - * Drop debian/nut-monitor.menu and debian/nut-monitor.xpm, not needed - anymore per tech-ctte decision #741573 - * debian/rules: Enable hardening=+all - - -- Laurent Bigonville Mon, 18 Jul 2016 10:58:49 +0200 - -nut (2.7.2-4) unstable; urgency=medium - - * Really fix package initial installation when PID1 is systemd (Closes: - #747863) - - -- Laurent Bigonville Fri, 20 Mar 2015 23:12:53 +0100 - -nut (2.7.2-3) unstable; urgency=medium - - * debian/NEWS: Fix NEWS file syntax - - -- Laurent Bigonville Tue, 17 Feb 2015 23:13:02 +0100 - -nut (2.7.2-2) unstable; urgency=medium - - [ Laurent Bigonville ] - * debian/gbp.conf: Switch to debian-jessie branch - * debian/rules: Revert the changes made in the previous NMU, I don't think - that dropping the .service file that late in the release cycle is a good - idea and anyway this was causing left-over files on upgrade. - * Add wrappers that check the MODE in /etc/nut/nut.conf to avoid starting - the daemons if nut is not configured (Closes: #747863). - - [ Michael Fincham ] - * Add patch that detects and corrects unsafe permissions on ~/.nut-monitor - left over from old installations during NUT-Monitor startup. - (Closes: #777706) - - -- Laurent Bigonville Tue, 17 Feb 2015 09:54:11 +0100 - -nut (2.7.2-1.1) unstable; urgency=medium - - * Non-maintainer upload. - * Port Ubuntu change to drop upstream systemd unit files to allow - sysvinit files for Jessie. (Closes: #747863) - - -- Neil Williams Sat, 17 Jan 2015 10:29:11 +0000 - -nut (2.7.2-1) unstable; urgency=low - - * New upstream release - - Fix the undefined references (Closes: #731156) - - debian/patches/0004-fix-systemd-service.patch: Refreshed - - Drop d/p/0005-Provide-retry-options-for-upsdrvctl-and-drivers.patch: - Merged upstream - - debian/nut-server.install: Upstream is now installing upsdrvctl /sbin - - Rename package libupsclient3 to libupsclient4, soname got bumped again - * debian/rules, debian/control, d/p/0004-fix-systemd-service.patch: Use a - symlink instead of an Alias= to mask the SysV initscript - * debian/control: Bump Standards-Version to 3.9.5 (no further changes) - * debian/tests/control: Add lsb-release and netcat to the dependencies - (Closes: #733189) - * debian/control, debian/rules: Call dh-autoreconf and pass LDFLAGS to - minimize runtime dependencies - * debian/patches/0008-drop-w3c-icons.patch: Remove the link to external W3C - icons to prevent privacy breach (privacy-breach-w3c-valid-html) - * debian/nut-server.install, debian/nut-server.manpages: Install new - nutdrv_atcl_usb driver - - -- Laurent Bigonville Tue, 22 Apr 2014 22:46:12 +0200 - -nut (2.7.1-1) unstable; urgency=low - - * New upstream release (Closes: #730183) - - Refresh debian/patches/0004-fix-systemd-service.patch - - Rename libupsclient1 to libupsclient3 following the soname bump, rename - libupsclient1-dev to libupsclient-dev, the package is not co-installable - anyway - * debian/rules, debian/control: Enable SSL support using libnss3 - * d/p/0005-Provide-retry-options-for-upsdrvctl-and-drivers.patch, - d/p/0006-ups-conf-maxretry.patch: By default, retry to start the drivers - up-to three times, this should mitigate races with slow devices - (Closes: #694717) - * debian/nut-server.install, debian/nut-server.manpages: Install new drivers - * Move bash-completion file to /usr/share/bash-completion/ - * debian/patches/0007-killpower-path.patch: Revert POWERDOWNFLAG back to - /etc/killpower - * debian/nut-client.lintian-overrides: Add override for - systemd-no-service-for-init-script ups-monitor - * debian/rules: Drop static ordering for the initscripts and pass - --restart-after-upgrade option to dh_installinit and dh_systemd_start to - minimize the downtime of the daemons - - -- Laurent Bigonville Sun, 24 Nov 2013 20:57:51 +0100 - -nut (2.6.5-4) unstable; urgency=low - - * debian/control: Do not build nut-ipmi on hurd-i386 as freeipmi is not - available on that platform. - - -- Laurent Bigonville Thu, 11 Jul 2013 12:29:58 +0200 - -nut (2.6.5-3) unstable; urgency=low - - [ Laurent Bigonville ] - * debian/control: - - Move libupsclient1 package to libs Section - - Add libgd-dev to the Build-Depends, keep the other alternatives to ease - the backports - - Bump Standards-Version to 3.9.4 (no further changes) - - Add autotools-dev to the build-dependencies so config.{guess,sub} are - getting updated during build - - Use canonical URL for the VCS-* fields - - Add build-dependency against dh-systemd and bump minimal cdbs version so - systemd helpers are called during build. - * Added dep-8-tests to improve QA (from Ubuntu, closes: #708130) - * debian/nut-monitor.menu, nut-monitor.xpm: Add Debian menu entry (Closes: - #708813) - * debian/rules: Drop manual creation of .service files symlink, this should - be handled by dh_systemd now - * debian/patches/0004-fix-systemd-service.patch: Also add Wants/Before for - systemd-udev-settle.service in the nut-driver.service as it got renamed - after udev merge - * debian/patches/0004-fix-systemd-service.patch: Fix path for upsdrvctl in - scripts/systemd/nutshutdown.in - - [ Ivo De Decker ] - * debian/nut-client.preinst: also revert /etc/nut/nut.conf mangling done - by postinst during upgrade from lenny to squeeze (Really closes: #677054) - Thanks to Andreas Beckmann for the review. - - -- Laurent Bigonville Thu, 11 Jul 2013 00:50:06 +0200 - -nut (2.6.5-2) experimental; urgency=low - - [ Laurent Bigonville ] - * debian/control: Move the nut-monitor Suggests from nut-server to - nut-client - * Restore proper SELinux context for runtime created /var/run/nut directory - * debian/control: Fix typo in package description - * debian/watch: Update watch file URL (Thanks to Bart Martens) - * debian/rules: Alias systemd nut-monitor service file to nut-client to - prevent it from running twice - * d/p/0004-fix-systemd-service.patch: Fix systemd service file for Debian - * Install tmpfiles conf files to create /run/nut directory during boot - - [ Sébastien Villemot ] - * debian/nut-client.preinst: revert /etc/nut/nut.conf mangling done by older - versions of the postinst (Closes: #677054) - - [ Ivo De Decker ] - * Only fix permissions of configfiles on first install. - * Only remove /etc/init.d/nut from previous versions of nut in nut-server - postinst if there are no local changes. - * Also remove /etc/init.d/nut in nut-client postinst. Thanks to - Laurent Bigonville for the hint. - - -- Laurent Bigonville Thu, 31 Jan 2013 21:51:31 +0100 - -nut (2.6.5-1) experimental; urgency=low - - [ Arnaud Quette ] - * debian/control, debian/nut-ipmi.{install,manpages}: create IPMI - support package - * debian/nut-server.install: only install USB udev rules - - [ Laurent Bigonville ] - * New upstream release - - Drop debian/patches/0001-fix-upsmon-regression.patch, applied upstream - * Follow multi-arch policy - * Install systemd .service files (Closes: #679450) - * debian/nut-server.install: Drop newmge-shut, renamed upstream to mge-shut - and install the old implementation (oldmge-shut) instead - * debian/control: Drop ancient Conflicts/Provides/Replaces - * Install all development files under /usr - - -- Laurent Bigonville Mon, 13 Aug 2012 01:59:18 +0200 - -nut (2.6.4-2) unstable; urgency=low - - * debian/rules: Stop the nut-client before nut-server on systems using static - boot ordering (Closes: #679451) - * debian/nut-server.postinst: Remove /etc/init.d/nut on upgrade - (Closes: #677822) - * Rename nut-server.lintian-overrides to nut-client.lintian-overrides and - adjust overrides now that ups-monitor is shipped in nut-client package - (Closes: #677947) - * Add debian/patches/0001-fix-upsmon-regression.patch: Fix upsmon/upssched - regression (Taken from upstream) (Closes: #679513) - * Move nut metapackage to Section: metapackages - * Also create nut user when installing nut-client package and do not delete - it on purge anymore (Closes: #682000) - * Drop /etc/default/nut → /etc/nut/nut.conf migration code, migration - happends before squeeze release and this was against policy to have a - maintainer script modifying a conffile in the first place (Closes: #684392) - * Add dependency against adduser and lsb-base on nut-client package - * Be sure that client is stopped before the server also when using - dependencies based boot - * Fix package descriptions (Closes: #678068) - * Also install /bin/upssched-cmd in nut-client package as this script is - referenced in default upssched.conf config file - * debian/watch: Update watch file - * Be sure that all maintainer scripts are returning 0 at their end - - -- Laurent Bigonville Sun, 12 Aug 2012 20:38:52 +0200 - -nut (2.6.4-1) unstable; urgency=high - - * New upstream release (Closes: #671444) - * acknowledges NMU (Closes: #613643) - * debian/nut-client.init: fix action "start" and use of log_*_*msg - LSB log functions (Closes: #675619) - * debian/nut-server.preinst: remove obsolete file(s) left in - /etc/udev/rules.d and related processing: udev files are now located - in /lib/udev/rules, and there is no reason to modify the dedicated - USB UPS rules (52-nut-usbups.rules) (Closes: #660072) - - -- Arnaud Quette Wed, 06 Jun 2012 21:03:50 +0200 - -nut (2.6.3-2) unstable; urgency=low - - * debian/nut-server.init: rewrite to match upsd / drivers startup scope - * debian/nut-client.init: created to match upsmon startup scope - (Closes: #634858) - * debian/nut.TODO.Debian, debian/Makefile.am: updated to reflect the above - * debian/rules: install nut-client.init, and update to reflect the above - * debian/control, debian/Makefile.am: updated to reflect the above - * debian/control: - - add Breaks on nut-server (<< 2.6.3-1~) - - bump Standards-Version to 3.9.3 - * debian/nut-client.links: renamed from debian/nut-server.links, since - ups-monitor is now provided by nut-client initscript - * debian/nut.README.Debian: renamed from nut-server.README.Debian, - to provide it with both client and server packages - * debian/nut-server.install: add missing drivers (clone-outlet, - liebert-esp2 and microdowell) - * debian/nut-server.manpages: add missing manual pages (apcsmart-old, - ivtscd, liebert-esp2 and microdowell) - - -- Arnaud Quette Tue, 24 Jan 2012 13:14:59 +0100 - -nut (2.6.3-1) unstable; urgency=low - - * New upstream release (Closes: #635186, #598741, #633756, #638221) - * debian/nut-server.{install,manpages}: add richcomm_usb - * debian/nut-server.install, debian/rules: install Avahi service file - * debian/rules, nut-client.install: install Augeas lenses - * debian/nut-server.README.Debian: clarify udev explanation (Closes: #529664) - * debian/patches/0001-fix_spelling_and_typo.patch, - debian/patches/0003-libupsclient-version.patch: removed since these are now - fixed upstream - * debian/patches/series: updated - - -- Arnaud Quette Tue, 24 Jan 2012 13:14:59 +0100 - -nut (2.6.2-1) unstable; urgency=low - - * New upstream release (Closes: #594989) - * debian/control: - - remove legacy Build-Depends for nut-hal-drivers on libdbus and libglib - - Build-Depends-Indep on docbook-xsl for offline document - generation (Closes: #635347) - * debian/nut-server.install: add apcsmart-old - * debian/nut-server.init: - - add udev as Required-Start/Stop (Closes: #642412) - - remove legacy support for /etc/default/nut (Closes: #638021) - * debian/patches/0003-libupsclient-version.patch: added to fix the missing - libupsclient version info bump - * debian/libupsclient1-dev.links: update link name - * debian/libupsclient1.symbols: add with upscli_tryconnect - * debian/nut.TODO.Debian: update and complete the TODO list - - -- Arnaud Quette Thu, 29 Sep 2011 18:39:16 +0200 - -nut (2.6.1-2) unstable; urgency=low - - * debian/nut.README.Debian: Adjust udev rules naming for permissions override - (Closes: #529664) - * Re-add and refresh debian/patches/0001-fix_spelling_and_typo.patch: - Some typos and spelling errors remain. - * Split nut package into nut-client and nut-server, keep nut package as - metapackage - * Generate PDF and html doc and install it in nut-doc package - * debian/rules: - - List non-installed files - - Includes python-module.mk - - Add flags to build documentation and install it - * debian/control: - - Add python-nut package and add python build-dependency - - Set nut-powerman-pdu priority to extras - - Add nut-monitor package - - Add nut-doc package and add required C/R/P - - Add libups-nut-perl package - * debian/nut-server.prerm: Remove /var/run/nut during removal - - -- Laurent Bigonville Sun, 17 Jul 2011 19:03:18 +0200 - -nut (2.6.1-1) unstable; urgency=low - - * New upstream release (Closes: #595953, #614842, #595773) - * debian/patches/*.patch: removed since these are now fixed upstream - [Laurent Bigonville] - * Drop HAL package and build-dependencies (Closes: #613197) - * debian/control: - - Bump Standards-Version to 3.9.2 (no further changes) - - Drop autotools build-dependencies (not needed anymore) - - Drop non-existing build-dependencies - * debian/rules: - - Correctly pass flags to configure - - -- Arnaud Quette Wed, 01 Jun 2011 22:34:28 +0200 - -nut (2.6.0-2) unstable; urgency=low - - * debian/nut-snmp.docs: Distribute snmp.txt doc file (Closes: #548295) - * d/p/0001-fix_spelling_and_typo.patch: Update and refresh - * debian/nut.lintian-overrides: Fix typo - * debian/patch/0002-fix_libupsclient_pc.patch: Fix libupsclient.pc (Closes: - #624255) - * debian/rules: - - Switch to cdbs - - Remove not existing configure options (Closes: #611813) - - Drop Phony rules (Closes: #613699) - * debian/control: - - Add cdbs build-dependency - - -- Laurent Bigonville Sun, 08 May 2011 21:23:46 +0200 - -nut (2.6.0-1) unstable; urgency=low - - * New upstream release (Closes: #575176, #588648, #609597, #687985) - * debian/patches/*.patch: removed since these are now fixed upstream - * debian/patches/0001-fix_spelling_and_typo.patch, - debian/patches/series: reworked to match the new upstream release - * debian/nut.install, debian/nut.manpages: remove obsolete reference to - megatec and megatec_usb, now respectively replaced by blazer_ser and - blazer_usb - * debian/nut.docs: limit distributed documentation - - -- Arnaud Quette Wed, 16 Feb 2011 22:55:26 +0100 - -nut (2.4.3-3) UNRELEASED; urgency=low - - * debian/control: - - Wrap build-dependencies - - Change nut-cgi Recommends to apache2 | httpd-cgi - * debian/nut.postinst: Only trigger USB subsystem, should Closes: #574769 - * debian/patches/0002-fix_udev_action.patch: Use SUBSYSTEM instead of BUS - - -- Laurent Bigonville Tue, 11 Jan 2011 22:24:07 +0100 - -nut (2.4.3-2) unstable; urgency=medium - - * debian/control: - - Bump Standards-Version to 3.9.1 - - Update Vcs-* fields to new GIT repository - - Add myself as Uploaders - * Switch to dpkg-source 3.0 (quilt) format (Closes: #573601) - * debian/patches/0001-low_speed_usb_ups.patch: Use patch system for changes - that were applied directly in the source - * Add debian/gbp.conf file - * debian/watch: Bump version to 3 - * Add debian/patches/0002-fix_udev_action.patch: Also set permission for - "change" udev ACTION (Closes: #557178) - * debian/nut.postrm: Do not try to remove nut user is deluser is not - installed anymore - * debian/nut.manpages: Install manpage nut.conf.5 (Closes: #528222) - * debian/copyright: Fix copyright-with-old-dh-make-debian-copyright - * Remove nut-snmp.lintian-overrides, not needed anymore - * debian/patches/0003-fix_spelling_and_typo.patch: Fix some spelling errors - * Add debian/libupsclient1.symbols file - * Add debian/nut.links: Re-add /etc/init.d/ups-monitor that was lost for - some reasons (Closes: #592351) - * debian/nut.lintian-overrides: Add override for - init.d-script-does-not-provide-itself /etc/init.d/ups-monitor - * Drop libupsclient1.post{inst,rm}: ldconfig call is added automatically by - debhelper - * debian/libupsclient1-dev.install: Do not ship /lib/libupsclient.la anymore - * debian/rules: Remove dpatch logic as we are using package source version - '3.0 (quilt)' - * debian/compat: Bump debhelper compatibility to 8 - - -- Laurent Bigonville Fri, 24 Dec 2010 11:46:22 +0100 - -nut (2.4.3-1.1) unstable; urgency=low - - * Non-maintainer upload. - * drivers/libhid.c: Apply r2407 from upstream to fix bug with some - low speed UPS devices. (Closes: #583371) - - -- Tim Retout Fri, 15 Oct 2010 19:31:39 +0100 - -nut (2.4.3-1) unstable; urgency=low - - * New upstream release (Closes: #544390, #528222, #539747, #526811, - #562064) - * debian/nut.install, debian/nut.manpages: - - remove cyberpower driver and manpage - - add bestfortress, clone and ivtscd drivers and manpages - * debian/rules: - - change udev dir to /lib/udev (Closes: #522327) - - replace deprecated calls to 'dh_clean -k' by dh_prep (Closes: #536599) - * debian/rules, debian/nut.install, debian/nut.install, - debian/nut.README.Debian: install configuration files, without the - sample suffix (Closes: #528641) - * debian/nut.links: restored (Closes: #522506) - * debian/nut.init: - - source nut.conf instead of default/nut for POWEROFF_WAIT(Closes: - #538173) - - fix status checking (Closes: #538785) - - improve detection of non configured system and beautify related - output (Closes: #563112) - - use 'invoke-rc.d' instead of calling the reboot script directly - - add $remote_fs to Required-Start and Required-Stop - * debian/nut.postrm: remove udev files and simplify cleanup (Closes: - #541629) - * debian/control: - - remove Luca Filipozzi from the Uploaders list (Closes: #568987) - - update Standards-Version to 3.8.4 - - remove the debconf dependency - - bump debhelper version to (>= 7) in Build-Depends, for dh_prep - - add Breaks on nut-hal-drivers to ensure we have correct udev version - * Remove debconf support since it was related to really old nut - version (Closes: #518056): - - remove nut-cgi.config, nut.config, nut-cgi.templates, nut.templates, - and po/ directory - - update nut-cgi.postinst - * debian/nut.dirs: remove /var/run/nut to conform to Debian Policy - * debian/nut.postint: - - create /var/run/nut if needed - - improve security checks - * debian/nut.README.Debian: add a security note for ups.conf - * debian/watch: URL update - - -- Arnaud Quette Wed, 24 Feb 2010 22:58:53 +0100 - -nut (2.4.1-3.2) unstable; urgency=low - - * Non-maintainer upload. - * nut.postinst: fix post-processing of nut.conf to avoid overriding - user settings (Closes: #531220) - - -- Stefano Zacchiroli Thu, 26 Nov 2009 09:30:45 +0100 - -nut (2.4.1-3.1) unstable; urgency=low - - * Non-maintainer upload. - * Fix length of extended descriptions of packages - in debian/control - * Fix pending l10n issues. Debconf translations: - - Galician (marce villarino). Closes: #524263 - - Spanish (Noel David Torres Taño). Closes: #525125 - - Vietnamese (Clytie Siddall). Closes: #548170 - - -- Christian Perrier Tue, 20 Oct 2009 21:45:21 +0200 - -nut (2.4.1-3) unstable; urgency=low - - * Debconf templates and debian/control reviewed by the debian-l10n- - english team as part of the Smith review project. Closes: #520591 - * [Debconf translation updates] - - Japanese. Closes: #521350, #518602 - - Czech. Closes: #521662 - - German. Closes: #518005 - - Basque. Closes: #522390 - - French. Closes: #522677 - - Finnish. Closes: #522837 - - Swedish. Closes: #522973 - - Italian. Closes: #522987 - - Russian. Closes: #523122 - - Portuguese. Closes: #523600 - - -- Christian Perrier Sat, 21 Mar 2009 08:08:59 +0100 - -nut (2.4.1-2) unstable; urgency=low - - * debian/control: - - add Build-Depends libwrap0-dev to enable TCP wrappers support, - - remove again dpatch from Build-Depends, - - move back debconf to Depends since we don't use it anymore in the preinst, - - add udev to nut-hal-drivers Depends so that it can use udevadm. - * debian/rules: - - pre merge the needed changes for Ubuntu (udev path and version), - - deactivate again dpatch rules - - move the nut-cgi HTML files off /var/www to /usr/share/nut/www - - set dh_installdocs to ignore Makefile - - remove dh_installexamples - * debian/patches/*: removed since it doesn't address the issue - * debian/nut-snmp.lintian-overrides: added to address NetSNMP overlinking - * debian/nut.install: - - add an precise list of the configuration files (Closes: #254355), - - use a wildcard to specify the udev rules installation path - * debian/nut-hal-drivers.install: use a wildcard to specify the udev rules - installation path (either /etc or /lib) - * debian/nut-cgi.install: add an precise list of the configuration files - * debian/nut.preinst: - - remove previous udev rule if unchanged, otherwise move to new filename (ie - with a dash), - - don't call adduser or addgroup *at all*, since these operations should be - handled in the postinst, - - migrate /etc/default/nut content to /etc/nut/nut.conf (part #1) - * debian/nut-cgi.preinst: removed since its content is addressed by postinst. - * debian/nut-hal-drivers.preinst: - - remove previous udev rule if unchanged, otherwise move to new filename (ie - with a dash), - * debian/nut-hal-drivers.postinst: - - reinstate since it was lost in the 2.2.2-10 merge, - - use the safe way to install udev rules (udevadm trigger --action=change). - * debian/nut.postinst: - - use the safe way to install udev rules, as for nut-hal-drivers.postinst - (udevadm trigger --action=change) - - rework the user/group creation, and a commented add to the dialout group, - - migrate /etc/default/nut content to /etc/nut/nut.conf (part #2) - * debian/nut-cgi.postinst: rework the user/group creation, and a commented add - to the dialout group. - * debian/nut.postinst: reactivate the nut user removal upon purge - * debian/nut.init: - - use nut.conf instead of /etc/default/nut to start the right component(s) - - enforce the configuration checking - - add basic support for the status option (as required per LSB) - * debian/nut.default: removed since its content has been incorporated into - nut.conf - * debian/{nut-cgi,nut}.examples: removed since the sample configuration files - are now installed. - * debian/nut.README.Debian: reworked with a lot of update and completion. - * debian/nut-cgi.README.Debian: reworked with a lot of update and completion. - - -- Arnaud Quette Fri, 20 Feb 2009 10:09:52 +0100 - -nut (2.4.1-1) unstable; urgency=low - - * New upstream release - * Acknowledge the use of debhelpers (Closes: #506583) - * debian/copyright: authors and licensing (GPL2+ and GPL3+) completion - * debian/control: - - add a Pre-Depends on debconf for nut and nut-cgi, and remove the according - Depends - - add ${misc:Depends} to all Depends - - add libpowerman0-dev to the Build-Depends - - add a new nut-powerman-pdu package - - add a Recommends on bash-completion for nut - - remove Shaul Karl from the Uploaders as per his request - * debian/nut-powerman-pdu.install, debian/nut-powerman-pdu.manpages: added for - the nut-powerman-pdu package - * debian/nut.install: - - also list the bash_completion entry - - list update due to upstream changes - * debian/nut.manpages: list update due to upstream changes - * debian/rules: - - comment the patching rules - - install the nut.bash_completion script - * debian/patches/*: removed the previous patches since fixed upstream - * debian/patches/01_snmp_ups_no_lcrypto.dpatch: add a patch to fix snmp-ups - overlinking with lcrypto (lintian possible-gpl-code-linked-with-openssl) - * debian/po/es.po: added Spanish debconf template translation (Closes: - 512494) - * debian/po/ja.po: added Japanese debconf template translation (Closes: - 512865) - * debian/watch: updated for the new 2.4 tree - * debian/nut.prerm: replace the direct call to the init script by invoke-rc.d - - -- Arnaud Quette Tue, 17 Feb 2009 14:15:24 +0100 - -nut (2.2.2-10) unstable; urgency=low - - * Merge from Ubuntu (Morten Kjeldgaard): - * debian/compat: changed to 6 - * debian/control: - - bump Build-Depends on debhelper to (>= 6.0.7~) since we are now using - dh_lintian. - - add hal to Build-Depends since configure attempts to locate /usr/lib/hal - in order to define callouts path and device information path - * debian/rules: --prefix is back to /usr, --exec-prefix=/ and --libdir=/lib - instead, which has the desired effect of moving the libraries to /lib. - The many shell commands in debian/rules, for moving files from the - install directory to the package directories have all been replaced by - dh_* calls and matching .* files. - * debian/{libupsclient1-dev.install, libupsclient1-dev.manpages, - libupsclient1.install, nut-cgi.install, nut-cgi.manpages, - nut-hal-drivers.install, nut-snmp.install, nut-snmp.manpages, - nut-xml.install, nut-xml.manpages, nut.install, nut.lintian-overrides, - nut.manpages}: added debhelper files. - * debian/nut.dirs: modified debhelper files - * debian/libupsclient1-dev.links: added to provide a link from - /usr/lib/libupsclient.so -> /lib/libupsclient.so.1.0.0 - This is a transitional measure, to salvage packages that have not yet - been updated to the new library location. Can be removed sometime in the - future. - * debian/patches/03-configure.in.dpatch: patch to configure.in adding - AC_CONFIG_MACRO_DIR([m4]) - - -- Arnaud Quette Thu, 27 Nov 2008 21:43:59 +0100 - -nut (2.2.2-9) unstable; urgency=low - - * debian/rules: also move libupsclient.so to /lib, otherwise the link is - broken (Closes: #505101) - * debian/nut-cgi.postinst: test if /etc/nut exists before chmod'ing (Closes: - #502757) - * debian/nut.TODO.Debian: some update and completion - - -- Arnaud Quette Wed, 15 Oct 2008 17:20:29 +0200 - -nut (2.2.2-8) unstable; urgency=high - - * debian/nut.links: restored since it's now handled by insserv (Closes: - #500190) - * debian/changelog: fix a typo error - * debian/rules: move libupsclient.so.1 from /usr/lib to /lib (Closes: - #491591) - * debian/nut-cgi.README.Debian: fix the permissions on /etc/nut (Closes: - #492277) - * debian/control: add Vcs-Browser and Vcs-Svn fields - - -- Arnaud Quette Tue, 30 Sep 2008 21:37:59 +0200 - -nut (2.2.2-7) unstable; urgency=high - - * debian/nut.links: removed to satisfy insserv (Closes: #492734) - * debian/po/it.po: add Italian debconf template translation (Closes: - #495781) - * debian/nut.preinst: force the nut user to be part of the extra group nut - (Closes: #493159) - - -- Arnaud Quette Mon, 15 Sep 2008 17:18:28 +0200 - -nut (2.2.2-6) unstable; urgency=low - - * tag this bug as closed by the 2.2.2 release (Closes: #490048) - * debian/nut.README.Debian: - - fix the serial udev advice (Closes: #490182) - - mention the UPS compatibility list (Closes: #447187) - * debian/po/de.po: update German debconf template translation (Closes: - #490128) - * debian/changelog: fix a typo on 2.2.2-2 release urgency - - -- Arnaud Quette Fri, 11 Jul 2008 11:30:55 +0200 - -nut (2.2.2-5) unstable; urgency=low - - * debian/po/eu.po: add Basque debconf template translation (Closes: - #489580) - * debian/control: - - add a Build-Depends on autoconfi, automake, libtool for the below patch - - bump Depends on udev to 0.124-1 to complete the fix of #489831 - * debian/rules: call autoreconf after patches application - * debian/patches/02_g_timeout_add_seconds_patch.dpatch: fix compilation - issue in the nut-hal-drivers code, when using a Glib older than 2.14 - (Closes: #489742) - * debian/nut.postint: replace the call to udevtrigger by udevadm trigger - (Closes: #489831) - - -- Arnaud Quette Mon, 07 Jul 2008 11:04:52 +0200 - -nut (2.2.2-4) unstabl e; urgency=low - - * debian/rules: fix a Lintian warning - (debian-rules-calls-debhelper-in-odd-order) - * debian/po/fi.po: add Finnish debconf template translation (Closes: - #489123) - * debian/po/ru.po: add Russian debconf template translation (Closes: - #489285) - * debian/po/vi.po: update Vietnamese debconf template translation (Closes: - #489393) - * debian/nut.templates: remove nut/change_system_user since it is not used - anymore (Closes: #486783) - - -- Arnaud Quette Sat, 05 Jul 2008 22:56:35 +0200 - -nut (2.2.2-3) unstable; urgency=low - - * debian/rules: reactivate dpatch support - * debian/control: add dpatch back to Build-Depends - * debian/patches/00list: fix the matching of the NUT HAL .fdi file (Closes: - #471828) - * debian/po/fr.po: update French debconf template translation (Closes: - #486740) - * debian.po/de.po: update the German debconf template translation (Closes: - #487187) - * debian/po/sv.po: add Swedish debconf template translation (Closes: #488217) - * debian.po/cs.po: update the Czech debconf template translation (Closes: - #488355) - * debian/po/pt.po: update the Portuguese debconf template translation (Closes: - #488403) - * debian/po/sv.po: add Galician debconf template translation (Closes: #488380) - * debian/nut.config: fix a typo in comment - - -- Arnaud Quette Fri, 27 Jun 2008 16:18:29 +0200 - -nut (2.2.2-2) unstable; urgency=low - - * debian/rules: fix HAL files installation paths (Closes: #486362) - * debian/control: - - fix conflicts (Closes: #486704, #486705) - - update Standards-Version to 3.8.0 - - -- Arnaud Quette Fri, 20 Jun 2008 21:29:31 +0200 - -nut (2.2.2-1) unstable; urgency=low - - * New upstream release (Closes: #471828, #462468, #334105, #463150) - * acknowledges NMUs (Closes: #469855) - * debian/control: - - add the new nut-xml package and its libneon dependency - - add the new libupsclient1 and libupsclient1-dev packages, with the latter - replacing nut-dev (Closes: #419684) - - remove dpatch dependency - * debian/rules: update according to upstream changes - - replace --with-lib by --with-dev - - update HAL integration - - update for the nut-xml package - - distribute the shared version of libupsclient - - comment dpatch calls - * debian/nut.postinst, debian/nut-hal-drivers.postinst: use udevtrigger to - refresh the devices permissions (Closes: #469601, #475262) - * debian/changelog: fix a typo - * debian/nut.templates: fix the short and long descriptions - * debian/libupsclient1.postinst, debian/libupsclient1.postrm: added to - handle the calls to ldconfig - * debian/nut.init: fix the call to /etc/init.d/reboot by adding the missing - "stop" parameter (Closes: 482022) - * debian/*.template: minor rework of the Debconf templates (Closes: 444151) - - -- Arnaud Quette Wed, 04 Jun 2008 13:35:41 +0200 - -nut (2.2.1-2.1) unstable; urgency=low - - * Non-maintainer upload. - * Skip udev restart logic within chroots, closes: #469855. - - -- Joe Nahmias Sun, 09 Mar 2008 13:12:12 -0400 - -nut (2.2.1-2) unstable; urgency=low - - * debian/po/de.po: update the German po-debconf translation (Closes: - #464466) - * nut-hal-drivers.preinst: created to add to HAL user to the NUT group - (Closes: #460392) - * debian/nut-hal-drivers.postinst: created to complete the above by - restarting udev after the rules file installation - * debian/changelog: Fix some Lintian reports (syntax and spelling errors) - * debian/nut.README.Debian: completed a bit more for #334105 - - -- Arnaud Quette Fri, 8 Feb 2008 13:48:23 +0100 - -nut (2.2.1-1) unstable; urgency=low - - * New upstream release (Closes: #439986) - * acknowledges NMUs (Closes: #447961, #445000) - * debian/watch: update the URL to point the 2.2 tree - * debian/rules: - - force --udev-dir to remove udev from Build-Depends while - keeping the feature (complete #447961 fix) - - limit the above fix to linux systems not to break build on - bsd and hurd these architectures (Closes: #460732) - - fix lintian debian-rules-ignores-make-clean-error and do some more - cleanup - - remove the empty directories /usr/{include,lib} from the nut package - * debian/nut.postinst: call invoke-rc.d instead of the udev init script - (Closes: #442331) - * debian/control: - - remove udev from Build-Depends - - update Standards-Version to 3.7.3 - - remove Homepage from description and add it as a tag - - add libsnmp-dev as an alternate Build-Depends to libsnmp9-dev - * debian/po/nl.po: update the Dutch po-debconf translation (Closes: #447720) - * debian/po/fr.po: update the French po-debconf translation (Closes: #442102) - * debian/patches/*: removed since these have been applied upstream - * debian/patches/00list: emptied but kept for future use - - -- Arnaud Quette Wed, 23 Jan 2008 17:13:13 +0100 - -nut (2.2.0-2.1) unstable; urgency=low - - * Non-maintainer upload with Arnaud's permission. - * debian/nut.postinst: restart udev only if it is running already - (Closes: #447961). - * debian/nut.preinst: ignore db_get errors for nut/remove_debian_conf, - thanks to Alexander Gerasiov for the patch (Closes: #445000). - * Fixed typo in the date of the 2.2.0-2 changelog entry (Augl -> Aug). - - -- Sebastian Harl Tue, 8 Jan 2008 13:50:11 +0100 - -nut (2.2.0-2) unstable; urgency=low - - * debian/control: list udev as Build-Depends to allow the udev rules - inclusion (Closes: #437811) - * debian/nut.default: fix a typo error on UPSMON options comment (Closes: - #439407) - * debian/po/: - - add Brazilian Portuguese debconf templates translation (Closes: - #439793) - - update Portuguese debconf templates translation (Closes: 440369) - - update French debconf templates translation (Closes: 440524) - * debian/Makefile.am: update with the missing files - * debian/patches/03_libupsclient-config.dpatch: patch for the missing FLAGS - (Closes: #439985) - - -- Arnaud Quette Wed, 29 Aug 2007 16:14:11 +0200 - -nut (2.2.0-1) unstable; urgency=low - - * New upstream release (Closes: #432909, #420016, #426033) - * debian/control: - - merge the nut-usb package into nut, and update the various needed - fields (Depends, Provides, Conflicts, Suggests and Description) - - requires at least libhal-dev 0.5.8 - - complete the nut-hal-drivers Description (Homepage) - - update to policy 3.7.2 - - add po-debconf to Build-Depends - * debian/rules: - - general rewrite since the upstream now use automake - - force the evaluation of DEB_HOST_ARCH_OS for dh_gencontrol - - force udev to empty on non Linux system, for dh_gencontrol - - remove the DH_COMPAT export - - update the nut-usb specifics, not needed anymore - - nut-hal-drivers also needs the udev rules - - call debconf-updatepo to clean debconf translations - * debian/compat: creation - * debian/nut-usb.*: remove these files, and put the content in the - matching nut.* files - * debian/nut.preinst: remove the old udev rule file (025_nut...) which - was manually installed, and now addressed upstream and called 52_nut. - * debian/nut.postinst: restart udev to apply the USB rules to the - already plugged devices - * debian/nut-hal-drivers.preinst: created to add the HAL user to - the nut group - * debian/po/nl.po: added Dutch po-debconf translation (Closes: #414756) - * debian/po/pt.po: added Portuguese po-debconf translation (Closes: #415189) - * debian/patches/01_udev_rules_subsystem_usb.dpatch: update the patch - * debian/patches/02_libupsclient.dpatch: patch for the missing FLAGS - * debian/nut.templates: rewrite and simplification - * debian/nut.config: rewrite and simplification - * debian/rules: call dh_installinit with the priority set to 50 to (Closes: - #385694) - * debian/nut.default, debian/nut.init: allow to specify options for upsd and - upsmon (Closes: #420020, #434503) - - -- Arnaud Quette Tue, 17 Jul 2007 09:14:11 +0200 - -nut (2.0.5-3) unstable; urgency=low - - * debian/patches/01_udev_rules_subsystem_usb.dpatch: rework that - patch to be more generic - - -- Arnaud Quette Fri, 02 Feb 2007 15:38:59 +0100 - -nut (2.0.5-2) unstable; urgency=low - - * debian/patches/*: add a patch to fix the udev rule SUBSYSTEM from - usb_device to usb (thanks to Joey Hess) (Closes: #409080) - * debian/control: - - replace the udev substvar by udev - - nut Conflicts with nut-{usb,snmps} <= 2.0.4 and nut-{usb,snmp} - Depends upon 2.0.5 (Closes: #407882) - * debian/rules: dh_gencontrol no more calls -V for udev - - -- Arnaud Quette Thu, 01 Feb 2007 14:50:49 +0100 - -nut (2.0.5-1) unstable; urgency=low - - * New upstream release (Closes: #406045, #380304, #399741) - * debian/rules: - - replaces CHANGES by ChangeLog - - replace the dummycons installation by dummy-ups - - integrate the --with-htmlpath option - * debian/nut-cgi.docs: created to install data/html/README - * debian/nut.init: LSB compliance update - * debian/control: add lsb-base (>= 3.0-6) to Depends for LSB compliance - - -- Arnaud Quette Tue, 16 Jan 2007 10:42:36 +0100 - -nut (2.0.4-3) unstable; urgency=high - - * acknowledges NMUs (Closes: #396704, #389350) - * debian/nut-usb.postinst: remove the symlinking of the udev file since it's - not useful anymore (Closes: #400215) - * native udev rules are now used (Closes: #359802, #380304) - * debian/po/de.po: add German po-debconf template translation (Closes: - #400285) - * debian/nut.config: change the medium priorities to high (Closes: #388945) - * debian/nut.init: improve drivers startup report - - -- Arnaud Quette Wed, 20 Dec 2006 11:07:30 +0100 - -nut (2.0.4-2.3) unstable; urgency=high - - * Non-maintainer upload. - * Some polish on top of the previous NMU. - * Remove the hotplug alternative; we no longer support it, so it's no - longer acceptable in place of udev. Correspondingly, rename the - substvar to ${udev}. (Closes: #396704) - * Drop debian/nut-usbups.rules and use upstream's rules instead. Modify - debian/rules correspondigly, patch from Arnaud Quette. - - -- Steinar H. Gunderson Fri, 17 Nov 2006 01:12:54 +0100 - -nut (2.0.4-2.2) unstable; urgency=high - - * Non-maintainer upload. - * In the udev script, replace the RUN actions by MODE and GROUP actions, as - per suggestion from the maintainer; should fix permission issues. - (Closes: #396704) - - -- Steinar H. Gunderson Thu, 16 Nov 2006 15:38:43 +0100 - -nut (2.0.4-2.1) unstable; urgency=low - - * NMU - * not removing nut user on purge (Closes: #389350) - - -- Florian M. Weps Thu, 12 Oct 2006 11:19:37 +0200 - -nut (2.0.4-2) unstable; urgency=low - - * debian/rules: replace $PWD by CURDIR to satisfy buildd - * debian/nut.default, debian/nut.init: make the bug 358696 workaround - optional as it might be dangerous under some circumstances (closes: - #358696) - - -- Arnaud Quette Tue, 01 Aug 2006 08:50:26 +0200 - -nut (2.0.4-1) unstable; urgency=low - - * New upstream release - - driver do not use /var anymore when called for shutdown/poweroff - (closes: #332846) - - fixes the newhidups crash upon device reconnexion (closes: #354305, - #359769) - * debian/nut.preinst: syntax enhancement to avoid issue when the nut user - already exists (closes: #378970) - * debian/nut-cgi.postinst: fix wrong permissions (closes: #378818) - * debian/po/cs.po: update Czech translation of nut debconf messages (closes: - #366738) - * debian/nut.default, debian/nut.init: "poweroff" workaround to deal with - BIOS default of "On/Off state: Last state" and system halting itself - before the UPS cuts power (closes: #358696) - * debian/nut-usbups.rules: fix the broken udev rules (closes: #359801) - - -- Arnaud Quette Thu, 27 Jul 2006 15:20:46 +0200 - -nut (2.0.3-4) unstable; urgency=low - - * debian/nut-usb.postinst: generate the /etc/udev/rules/ file - * debian/rules: - - install the right udev rule file (not the upstream one) - - install the debian/hotplug file as libhidups, as it's compatible - with hotplug and udev styles - - -- Arnaud Quette Mon, 13 Mar 2006 08:52:25 +0100 - -nut (2.0.3-3) unstable; urgency=low - - * debian/rules: - - fix a wrong symlink for the udev rule files (closes: #354262) - - add a temporary workaround to clean drivers/tripplite_usb - - -- Arnaud Quette Mon, 27 Feb 2006 15:35:32 +0100 - -nut (2.0.3-2) unstable; urgency=low - - * debian/nut.init: fix the creation of the PID directory, as /var is now volative. - This bug has been identified in Ubuntu (Launchpad #6679) - * debian/nut-cgi.postrm: suppress the deletion of the nut user as it's not - needed (closes: #319395) - * debian/nut-cgi.preinst: suppress that file as we do not need to check and create - the nut user and group for nut-cgi - * debian/nut-cgi.postinst: enhanced to ensure the /etc/nut directory and nut-cgi - configuration files are readable by others - * debian/nut-cgi.README.Debian: improve the documentation about configuration - files permissions - - -- Arnaud Quette Fri, 24 Feb 2006 10:05:25 +0100 - -nut (2.0.3-1) unstable; urgency=low - - * New upstream release - - include the improved USB driver (closes: #300115) - - fix mge-utalk regression (closes: #315431) - - fix USB device claiming and logging (closes: #322901) - * debian/nut-cgi.config: complete the typo fixes from 2.0.2-1 and remove exit - calls (closes: #308215) - * debian/nut.config: remove exit calls - * debian/hotplug: add this file to manage hotplug and udev style permissions settings - * debian/nut-usbups.rules: embed a modified version of the upstream file - * debian/control: - - make hotplug | udev Depends conditionnal, from rules - - remove libusb-0.1-4 Depends as it is already listed with shlibs:Depends - * debian/rules: - - generate debian/control Depends for hotplug | udev - - also install udev files (closes: #338738, #332939) - - call the clean rule before distclean - * debian/nut.README.Debian: - - update the Installation §2 to reflect udev changes on serial port permissions. - Users need to manually add the nut group to the dialout group (closes: #325878, - #334105) - - some other minor update - - -- Arnaud Quette Tue, 21 Feb 2006 13:57:35 +0100 - -nut (2.0.2-2) unstable; urgency=low - - * debian/nut-cgi.postinst: load confmodule - * debian/nut-hidups/*: remove this unneeded directory - * debian/control: - - Update build dependency from libsnmp5-dev to libsnmp9-dev (closes: - #326410) - - Changes nut-usb wrong dependency from libusb-dev to libusb-0.1-4 (closes: - #320315) - - add debconf (>= 0.5.00) and adduser to nut/nut-cgi Depends - * debian/copyright: update the FSF address and the Authors - * debian/po/vi.po: add the Vietnamese translation for debconf, from Clytie - Siddall ((closes: #316327) - - -- Arnaud Quette Fri, 07 Oct 2005 23:35:55 +0200 - -nut (2.0.2-1) unstable; urgency=low - - * New upstream release: - - build respect LDFLAGS (closes: #265439) - - fix etapro brokeness (closes: #305730) - - fix shutdown/restart problems with mge-shut (closes: #302190) - - fix mge-utalk support for older units (closes: #315431) - * debian/po/fr.po: update the French debconf templates, thanks to Michel - Grentzinger (closes: #306541) - * debian/rules: - - install hotplug files for the newhidups USB driver - - suppress the snmp-ups.8 manpage workaround - * debian/nut-usb.prerm: created to remove hotplug files - * debian/control: - - add hotplug Depends for nut-usb - - upgrade Debian Policy to 3.6.2 - * debian/patches/*: remove all patch and empty 00list as all has - been fixed upstream - * debian/nut-cgi.config: integrate the typo fixes that was blocking - upgrade from woody to sarge - * debian/nut-cgi.preinst: remove an unneeded blank line - * acknowledge NMU from Craig Small (closes: #302189) - - -- Arnaud Quette Mon, 27 Jun 2005 11:29:52 +0200 - -nut (2.0.1-3) unstable; urgency=low - - * debian/patches/01_cleanSourceFromlibupsclient.dpatch: removed as it - has been fixed upstream in 2.0.1 - * debian/patches/00list: re enabled for the below patch - * debian/patches/01_upsstatsCgiNoHostCrash.dpatch: added while waiting - for the upstream fix (closes: #302902) - * debian/nut-cgi.templates: added nut-cgi/major_template_changes - * debian/nut-cgi.config: use nut-cgi/major_template_changes (closes: - #301184) - * debian/nut-cgi.README.Debian: reworked, and mention upgrade and - installation. - * debian/nut.README.Debian: mention the missing UPGRADING file, and complete - the upsmon.conf lines with the mandatory POWERDOWNFLAG and SHUTDOWNCMD - (closes: #302182) - * debian/nut.templates: add nut/2_0_upstream_changes to deal with the new - changes - * debian/nut.config: use the above nut/2_0_upstream_changes (closes: - #301060) - - -- Arnaud Quette Fri, 15 Apr 2005 13:52:32 +0100 - -nut (2.0.1-2.1) unstable; urgency=low - - * Non-maintainer upload - * NUT nows powersdown Closes: #302189 - - -- Craig Small Thu, 7 Apr 2005 11:47:58 +1000 - -nut (2.0.1-2) unstable; urgency=low - - * debian/control: add missing Build-Depends for dpatch, thanks to Kurt - Roeckx (closes: #298218) - - -- Arnaud Quette Mon, 07 Mar 2005 16:29:32 +0100 - -nut (2.0.1-1) unstable; urgency=low - - * New upstream release (closes: #247671, #283539) - * debian/watch: update URL to match the current 2.0 stable tree - * debian/rules: - - change install-misc target to install-lib following the upstream rule - name change - - error reporting enhancements, thanks to Karl Shaul (inserted a set -e at - the start of every for loop ; from Debian Policy §4.5). - - workaround to include dummycons test driver and its manpage in nut-dev - while waiting for an upstream rule - - workaround to remove snmp-ups manpage from the nut package, to avoid a - file conflict with nut-snmp, while waiting for an upstream rule - - remove the workaround from 1.4.2-2 to suppress libupsclient.a and - newhidups upon make clean - - comment the "conf files workaround" as it's no more needed - * debian/control: - - add nut-dev to nut Suggests - - complete nut-dev to include dummycons testing driver - - add libusb (>= 0.1.8) nut-usb Depends to benefit of the kernel driver - unbind feature (needed for USB models other than MGE UPSs) - - suppress libgd1 from Build-Depends to fix a DebCheck warning, as it - is listed in Section oldlibs - * debian/nut.README.Debian: add a section "(3) /etc/nut/upsd.conf" - and add references to sample config files and UPGRADING information - (closes: #269485) - * debian/nut.TODO.Debian: add this file to track planned and unfinished - tasks - * debian/nut-cgi.README.Debian: improve a bit the text - * debian/nut.init: test powerdown flag (upsmon -K) and use the new - upsdrvctl exit codes (thanks to Karl Shaul) - * debian/po/cs.po: add Czech translation of debconf templates (patch from - Miroslav Kure) (closes: #283225) - * debian/patches: add basic infrastructure for dpatch - - -- Arnaud Quette Fri, 04 Mar 2005 11:40:13 +0100 - -nut (1.4.3-2) unstable; urgency=low - - * debian/control: add nut-dev package with NUT lib and headers (closes: - #263937) - * debian/rules: change install-misc for the above nut-dev. - * debian/control: invert apache and httpd in nut-cgi Recommends to solve a - lintian warning - - -- Arnaud Quette Sun, 08 Aug 2004 16:07:04 +0200 - -nut (1.4.3-1) unstable; urgency=low - - * New upstream release - * debian/control: change Homepage URL to "www" instead of "random" and - remove trailing slash / dot (closes: #254084) - * debian/control: add apache to nut-cgi Recommends to have a non-virtual - package alternative - - -- Arnaud Quette Thu, 29 Jul 2004 22:58:03 +0200 - -nut (1.4.2-3) unstable; urgency=low - - * debian/control: add libusb-dev version in Build-Depends (closes: #248952) - * debian/copyright: update upstream URL and copyright owners (closes: - #242422) - * debian/po/ca.po: add Catalan translation of debconf templates (patch from - Aleix Badia i Bosch) (closes: #248741) - * debian/nut-cgi.README.Debian: added to describe nut-cgi configuration - (thanks to Marius Gedminas) (closes: #249825) - * debian/nut.README.Debian: minor change - - -- Arnaud Quette Fri, 28 May 2004 13:10:01 +0200 - -nut (1.4.2-2) unstable; urgency=low - - * debian/control: add libusb-dev to Build-Depends (closes: #240586) - * debian/rules: workaround to clean libupsclient.a and newhidups (complete - the above) - - -- Arnaud Quette Sun, 28 Mar 2004 18:30:01 +0100 - -nut (1.4.2-1) unstable; urgency=low - - * New upstream release - * Fixes mge-shut settings and shutdown problems (closes: #232402, #234037) - * debian/nut.init: fixes powerdown rule to prevent from forced UPS shutoff - upon normal shutdown, and add a warning when POWERDOWN flags isn't - defined, thanks to Loic Le Loarer (closes: #236092) - * debian/control: update nut-usb Description to reflect the add of newhidups - and energizerups drivers. - * debian/rules: update nut-usb build and install rules to match the new ones - - -- Arnaud Quette Thu, 25 Mar 2004 16:30:01 +0100 - -nut (1.4.1-release-2) unstable; urgency=low - - * recall previously malformed closed bug (closes: #227965, #227964) - * debian/control: Build-Depends to allow libgd*-noxpm (closes: #231153) - * debian/control: update Homepage address - * debian/watch: update target address - - -- Arnaud Quette Thu, 05 Feb 2004 19:19:56 +0100 - -nut (1.4.1-release-1) unstable; urgency=low - - * New upstream release - * debian/po/*: add gettext support for debconf templates (patch from Michel - Grentzinger) (Close: #227965) - * debian/po/fr.po: add French translation of debconf templates (patch from - Michel Grentzinger) (Close: #227964) - - -- Arnaud Quette Sun, 18 Jan 2004 21:19:56 +0100 - -nut (1.4.1-pre3-5) unstable; urgency=low - - * debian/nut.postrm: fix inverted test with -z (fix a purge error) - * debian/nut.postrm: same as above - * debian/nut.postrm: suppress check_and_delete_group() as it is not useful - * debian/nut-cgi.postrm: same as above - * debian/nut.postinst: test if /etc/nut exists before chmod'ing (fix an - install error) - - -- Arnaud Quette Sat, 15 Nov 2003 22:10:23 +0100 - -nut (1.4.1-pre3-4) unstable; urgency=low - - * debian/nut.preinst: wider check for user/group creation (closes: #217980) - * debian/nut.postrm: rework purge rule for user/group deletion (2nd part of - the above fix) - * debian/nut-cgi.postrm: rework purge rule for user/group deletion (2nd part of - the above fix) - * debian/nut-cgi.preinst: wider check for user/group creation (same as - above) - * debian/rules: suppress {nut,nut-cgi}/etc/nut/*.sample that were wrongly - installed (linked to #172217) - * debian/nut.examples: created to complete above fix - * debian/nut-cgi.examples: created to complete above fix - * debian/nut.postrm: suppress /etc/nut/*.sample file (to correct above - problem) - * debian/nut-cgi.postrm: suppress /etc/nut/*.sample file (same as above) - * Maintainer upload (forgotten previously), closes: #200182, #203061 - - -- Arnaud Quette Sat, 15 Nov 2003 10:10:23 +0100 - -nut (1.4.1-pre3-3) unstable; urgency=low - - * clients/Makefile.in: install parseconf.h to fix compilation error with wmnut - * man/Makefile.in: fix a broken upstream rule (hidups manpages installed two - times) that prevent from installing nut-usb package. This will be fixed in - the next upstream - - -- Arnaud Quette Mon, 10 Nov 2003 17:10:23 +0100 - -nut (1.4.1-pre3-2) unstable; urgency=low - - * man/Makefile.in: fix a broken upstream rule (powernet and snmp-ups - manpages installed two times) that prevent from installing nut-snmp package - - -- Arnaud Quette Mon, 10 Nov 2003 12:59:23 +0100 - -nut (1.4.1-pre3-1) unstable; urgency=low - - * New upstream release - * clients/Makefile.in: suppress the one line patch to install parseconf.o - (from 1.4.1-pre2-1). This is now cleanly addressed by the upstream source - by installing libupsclient.a (closes: #216496) - * debian/rules: change dh_shlibdeps's exclude from upsfetch.o to libupsclient.a - * debian/nut.preinst: fix install rule to catch all cases of nut user and group - needed creation. Previously, post purge install case was not (closes: #217980) - * debian/rules: suppress the work-around for nut-usb package following - the upstream correction (from 1.4.1-pre1-2) - * debian/control: Final package take over ; switch Luca Filipozzi as - co maintainer, and Arnaud Quette as new maintainer. - * debian/watch: point the authoritative download server (penguin.harrison) - and stable releases ("nut/release/1.4/" directory ; it won't work for - final 1.4.1, but for 1.4.2) - * debian/nut.postrm: rework purge rule to suppress a warning - - -- Arnaud Quette Sat, 8 Nov 2003 12:15:23 +0100 - -nut (1.4.1-pre2-1) unstable; urgency=low - - * New upstream release - * debian/control: created package nut-usb for finer deps management - * debian/rules: added rules for nut-usb package, and a work-around - for install directories creation while waiting for upstream correction. - * drivers/Makefile.in: suppressed hidups from PROGS, thanks to the above - * debian/control: repeat Homepage for every sub-package - * debian/control: completed nut Suggests - * debian/control: changed Arnaud Quette address to the good Debian one - * debian/rules: suppress the work-around for nut-snmp package following - the upstream correction(from 1.4.1-pre1-1) - * debian/nut-cgi.preinst: always test if nut user exist as nut-cgi - can be installed without nut, so not having nut user created (closes: - Bug#213730) - * debian/nut-cgi.postinst: chown root:nut to address a potential security - issue (see 1.2.1-2) - * clients/Makefile.in: one line patch to install parseconf.o. This solve - a problem with wmnut package (can't build anymore due to unresolved - symbols). This point will be more cleanly address in next upstream - - -- Arnaud Quette Sat, 18 Oct 2003 09:05:01 +0200 - -nut (1.4.1-pre1-2) unstable; urgency=low - - * debian/control: rewrotte descriptions to follow Debian Policy. A - further enhancement will be to use debian/nut.substvars (thanks - to Shaul Karl) (closes: Bug#209569) - * drivers/Makefile.in: added back hidups to PROGS (closes: Bug#208248) - * debian/control: added libgd2-* to Build-Depends to allow more choices - * debian/control: added Shaul Karl as co-maintainer - * debian/control: changed Arnaud Quette address to Debian's one - - -- Arnaud Quette Sun, 14 Sep 2003 12:11:45 +0200 - -nut (1.4.1-pre1-1) unstable; urgency=low - - * New upstream release (closes: Bug#203856) - * recall ignored 1.4.0-2 changes (closes: Bug#204193, Bug#199895) - * debian/nut.preinst: already solved bug in 1.4.0-3 (closes:Bug#206229) - * debian/control: created package nut-snmp (closes: Bug#195645) - * debian/rules: added rules for nut-snmp package, and a work-around - for install directories creation while waiting for upstream correction. - * debian/control: change Build-Depends to "libgd-xpm-dev | libgd-dev" to - allow easy woody backport (thanks to Martin Maney) - * debian/nut.prerm: wait for upsd stop before calling the remove tempo - - -- Arnaud Quette Sat, 23 Aug 2003 13:55:32 +0200 - -nut (1.4.0-3) unstable; urgency=low - - * debian/nut.prerm: fix a post removal warning by adding a tempo - (1 sec) before removing /var/run/nut - * debian/nut.preinst: reworked install rule (thanks Shaul) (closes:Bug#204153) - - -- Arnaud Quette Fri, 8 Aug 2003 23:14:26 +0200 - -nut (1.4.0-2) unstable; urgency=low - - * debian/watch: update URL to point NUT 1.4 (thanks to Shaul Karl) - * debian/nut.dirs: add /var/run/nut (thanks Shaul) (closes: Bug#204193) - * debian/nut-cgi.preinst: created for allowing separate installation - (without nut) (closes: Bug#199895) - * debian/rules: remove the "--with-group=nut" call to configure as it - is obsolete (thanks Shaul) - * debian/control: add Arnaud Quette as co-maintainer - - -- Arnaud Quette Thu, 7 Aug 2003 20:14:26 +0200 - -nut (1.4.0-1) unstable; urgency=low - - * New upstream release (closes: Bug#203061) - * debian/nut.init: change Init-script ordering (start_stop_server) to - address data stale warning (closes: Bug#200182) - - -- Arnaud Quette Fri, 1 Aug 2003 18:42:22 +0200 - -nut (1.2.2-1) unstable; urgency=low - - * New upstream release - * debian/rules: gidNumber of group 'nobody' is 65534 not 65535 - (thanks Shaul) (closes: Bug#180532) - - -- Luca Filipozzi Fri, 18 Apr 2003 20:12:17 -0700 - -nut (1.2.1-2) unstable; urgency=low - - * debian/nut.README.Debian: s/smartapc/apcsmart/ (closes: Bug#177713) - * debian/nut.postinst: chown root:nut instead of chown nut:nut for files - in /etc/nut/* and for the dirs /etc/nut, /var/run/nut, /var/lib/nut; - this addresses a potential security issue as described in the comments - contained in /etc/nut/upsmon.conf (closes: Bug#180059) - * debian/nut.init: sysadmins might modify POWERDOWNFLAG in - /etc/nut/upsmon.conf without realizing that it is hard coded in the - /etc/init.d/nut init script; fix the init script to parse the - configuration file for the value of POWERDOWNFLAG (closes: Bug#179686) - * debian/nut.init: print a message prior to shutdown (closes: Bug#180242) - - -- Luca Filipozzi Sat, 8 Feb 2003 18:12:11 -0800 - -nut (1.2.1-1) unstable; urgency=low - - * New upstream release - * debian/control: nut provides/conflicts ups-monitor (closes: Bug#170655) - * debian/nut.postinst and debian/nut-cgi.postinst: - test -f file before chown/chmod (closes: Bug#170553) - * debian/nut.postinst: fix permissions on /var/lib/nut (closes: Bug#173318) - * debian/nut.preinst: change how the 'nut' user/group are detected and - created (closes: Bug#173321) - * between 1.1.11-1 incorrectly installed conffiles into /etc/nut - with the extension .sample; fortunately, this release of the package - did not migrate to testing and since 1.1.11-2 the .sample extension - has not been used (closes: Bug#172217) - * debian/nut.preinst: change the way the nut user/group are detected - before adduser is called (closes: Bug#170653) - * debian/nut.README.Debian: fixed minor doc error (Closes: Bug#173673) - - -- Luca Filipozzi Wed, 11 Dec 2002 19:39:02 -0800 - -nut (1.2.0-1) unstable; urgency=low - - * New upstream release - * debian/nut-cgi.postinst: fix permissions on /etc/nut/hosts.conf and - /etc/nut/upsset.conf so that they are world readable (Closes: Bug#167332) - * debian/nut.init: added sleep 5 to allow for an orderly restart (thanks - to Shaul Karl for pointing this out) - - -- Luca Filipozzi Tue, 19 Nov 2002 09:44:25 -0800 - -nut (1.1.12-1) unstable; urgency=high - - * New upstream release (urgency high due to SECURITY FIX) - * SECURITY FIX: a file permission problem potentially exposes - non-system usernames/passwords in /etc/nut/upsd.users that can be used - to DoS a machine running nut by contacting the nut daemon and instructing - it to power off the machine; fixed. - * debian/nut.postinst: change permissions of /etc/nut/upsd.users and - other conffiles to 640 (Closes: Bug#165445) - * debian/nut.config: use db_fset to reset the boolean question that prompts - users to accept whether to continue with the installation of this version - of nut should they answer no (Closes: Bug#165376) - * debian/control: make nut-cgi Replace nut so that conflicting files - can be installed (Closes: Bug#165049) - * drivers/Makefile.in: restored original version that doesn't build - hidups, snmp-ups or powernet; hidups doesn't build on m68k; snmp-ups - and powernet require libsnmp5-dev but libsnmp5-dev requires OpenSSL; - unfortunately, upstream's license doesn't have the OpenSSL exclusion - clause... work is proceeding on porting to gnutls - * drivers/Makefile.in + debian/rules: figured out a mechanism to build - hidups on those architectures that have /usr/include/linux/hiddev.h - * debian/control: build-depend on libgd-xpm-dev (really closes Bug#164832) - - -- Luca Filipozzi Sat, 19 Oct 2002 16:47:35 -0700 - -nut (1.1.11-2) unstable; urgency=low - - * changed build dependencies to avoid depending on a pure-virtual package - without providing a default (thanks Junichi Uekawa) (Closes: Bug#164832) - * debian/rules calls $(MAKE) install-misc so that the header and the .o file - are released with the nut package (too small for a nut-dev package?) - - -- Luca Filipozzi Tue, 15 Oct 2002 08:50:18 -0700 - -nut (1.1.11-1) unstable; urgency=low - - * New upstream release - (Closes: Bug#151047, Bug#155943, Bug#153174, Bug#160178, Bug#164024) - * the "Hey Dorothy, you aren't in Kansas anymore" release - * warning: significant changes since nut 0.45.5; specifically: - - upsd listens on a different port (was 3305; now 3493 (IANA-assigned)) - - configuration file formats have changed - - ups driver internals haved changed: 'common main.c' + upsdrvctl - - some ups drivers that were not ported to the new common model have - been dropped by the upstream author (submit a patch to rectify) - - the init script is significantly simpler - - the daemons will NOT restart on upgrade from from 0.45.5 or earlier - - there is an /etc/default/nut file that defines whether the daemons - will be started - - removed nut-doc package... far too small to merit being on its own - - -- Luca Filipozzi Mon, 14 Oct 2002 13:33:58 -0700 - -nut (0.45.5-rel-3) unstable; urgency=low - - * "unlink .sock file before starting up; this was keeping the drivers down - after a system crash where the .sock files remained" -- upstream - (Closes: Bug#149150, Bug#139859) - - -- Luca Filipozzi Fri, 7 Jun 2002 22:34:53 -0700 - -nut (0.45.5-rel-2) unstable; urgency=low - - * debian/control: nut and nut-cgi suggest rather than recommend - the documentation package, nut-doc (Closes: Bug#144763) - * debian/nut-cgi.dirs: change absolute paths to relative (Closes: Bug#144746) - * debian/rules: remove upsdrvctl.8 from package (Closes: Bug#143099) - - -- Luca Filipozzi Sun, 2 Jun 2002 21:39:14 -0700 - -nut (0.45.5-rel-1) unstable; urgency=low - - * New upstream release - * debian/rules: moved model daemons to /lib/nut to reduce chance of - namespace conflicts (Closes: Bug#141209) - * debian/rules: moved sample configuration files to - /usr/share/doc/nut/examples (Closes: Bug#140472) - # debian/postinst: change mode and ownership of files in /etc/nut/ on - configure to allow ready by nut/nut (Closes: Bug#142116) - - -- Luca Filipozzi Sun, 14 Apr 2002 13:37:13 -0700 - -nut (0.45.4-rel-3) unstable; urgency=low - - * added runtime dependency on adduser (Closes: Bug#137887) - - -- Luca Filipozzi Sat, 16 Mar 2002 21:41:53 -0800 - -nut (0.45.4-rel-2) unstable; urgency=low - - * Changed debian/rules to call install-misc which installs the development - files upsfetch.[oh]. There are too few development files to merit a - nut-dev package. - - -- Luca Filipozzi Sun, 24 Feb 2002 15:47:56 -0800 - -nut (0.45.4-rel-1) unstable; urgency=low - - * New upstream release - - -- Luca Filipozzi Sun, 24 Feb 2002 11:56:46 -0800 - -nut (0.45.4-pre5-1) unstable; urgency=low - - * New upstream release (Closes: Bug#131673) - - -- Luca Filipozzi Sun, 17 Feb 2002 17:31:32 -0800 - -nut (0.45.1-release-2) unstable; urgency=low - - * applied POWERDOWNFLAG upstream-patch (Closes: Bug#111979) - * applied apcsmart calibration user-patch (Closes: Bug#111978) - * modified models/main.c so that it does a forceshutdown *before* - attempting to chdir into /var/lib/nut (Closes: Bug#112540) - - -- Luca Filipozzi Tue, 23 Oct 2001 16:22:57 -0700 - -nut (0.45.1-release-1) unstable; urgency=low - - * New upstream release - * Fixed conffile problem with nut-cgi package (Closes: #108687) - - -- Luca Filipozzi Sat, 18 Aug 2001 11:58:57 -0700 - -nut (0.45.1-pre4-1) unstable; urgency=low - - * New upstream release (Closes: #101105) - - -- Luca Filipozzi Sun, 5 Aug 2001 13:59:12 -0700 - -nut (0.44.3-pre6-3) unstable; urgency=low - - * Init script now poweroffs the UPS' correctly. (Closes: #96790) - * Changed section of nut-doc to 'doc' (Closes: #94842) - * Not upgrading to new upstream source (0.45.0) until it is released. - * Not upgrading to upstream source (0.44.3) since (0.45.0) is coming soon. - - -- Luca Filipozzi Sun, 3 Jun 2001 16:05:01 -0700 - -nut (0.44.3-pre6-2) unstable; urgency=low - - * init script follows policy (Closes: #90346) - - -- Luca Filipozzi Mon, 19 Mar 2001 15:21:44 -0800 - -nut (0.44.3-pre6-1) unstable; urgency=low - - * New upstream release - * modified configure.in so that it doesn't produce an error when it tests - for the existance of group "nut" (Closes: #88126) - - -- Luca Filipozzi Sun, 11 Mar 2001 11:48:54 -0800 - -nut (0.44.3-pre4-1) unstable; urgency=low - - * New upstream release - * create pidfile modifications reworked to use upstream's writepid() function - * modified init script to support these changes... note that users MUST - follow the convention for the UPS directives in the sample upsd.conf; - a warning has been placed in said file - - -- Luca Filipozzi Sun, 25 Feb 2001 19:19:29 -0800 - -nut (0.44.2-6) unstable; urgency=low - - * modified prerm and postinst so that the daemon(s) is restarted only in the - postinst rather than stopped in prerm and started later in postinst thereby - stopping the daemon(s) shortest possible time (Closes: #83614) - * modified all the daemon(s)' source code so that they create pidfiles - * modified the init script so that it uses the pidfiles - - -- Luca Filipozzi Sun, 11 Feb 2001 18:23:44 -0800 - -nut (0.44.2-5) unstable; urgency=low - - * removed "function" keyword from init script (Closes: #83569) - * modified the pre and post scripts so that #DEBHELPER# is at the bottom - * modified debian/rules so that nut-doc is created (Closes: #85059) - * added support for MGE UPS (thanks to Ryan Murray) (Closes: #83743) - - -- Luca Filipozzi Sat, 10 Feb 2001 20:09:35 -0800 - -nut (0.44.2-4) unstable; urgency=low - - * control file changed such that arch=any for nut-doc (Closes: #83323) - - -- Luca Filipozzi Tue, 23 Jan 2001 17:49:25 -0800 - -nut (0.44.2-3) unstable; urgency=low - - * Added a build conflict against libgd-gif1-dev because it provides - libgd-dev but does not have PNG support. (Closes: #82607) - * Fixed a path problem in debian/rules that had manpages installing - in /share/man/man8 instead of /usr/share/man/man8. - - -- Luca Filipozzi Wed, 17 Jan 2001 19:11:56 -0800 - -nut (0.44.2-2) unstable; urgency=low - - * Modified README.Debian to address bad doc path (Closes: #82460) - * Slight improvements to README.Debian, as well. - - -- Luca Filipozzi Mon, 15 Jan 2001 21:11:39 -0800 - -nut (0.44.2-1) unstable; urgency=low - - * New upstream release - - -- Luca Filipozzi Tue, 9 Jan 2001 08:33:56 -0800 - -nut (0.44.1-4) unstable; urgency=low - - * fixed path problem with cgi files; they *are* in /usr/lib/cgi-bin/nut now - - -- Luca Filipozzi Wed, 22 Nov 2000 08:47:54 -0800 - -nut (0.44.1-3) unstable; urgency=low - - * the following changes suggested by Patrik Rak (Closes: #77144, #77195) - * added better preinst(install) checks for group membership - * modified upstream upsd.conf to use correct paths in the UPS directives - * modified upstream upsd.conf to have better ACCESS directive examples - * modified upstream upsmon.conf to have better MONITOR directive examples - * modified upstream upsmon.conf to use a different POWERDOWNFLAG location - (location must be on the root filesystem... otherwise powerdownflag is - not found!) - * modified init script to parse upsmon.conf for the POWERDOWNFLAG location - * modified init script's poweroff section so that all args are recognized - * improved the documentation, primarily README.Debian - * installation scripts modified so that the dependency on adduser >= 3.14 - can be removed; this allows for the creation of potato packages - * the nut user is no longer part of the dialout group; users will have to - manually change the permissions on the serial port devices; - a nut group is created at the same time as the nut user; users should use - the nut group for the serial port permissions: chown root.nut /dev/ttyS0 - (suggested by Shaul Karl and Patrik Rak) - * the cgi scripts are moved to /usr/lib/cgi-bin/nut/* - (suggested by Shaul Karl) - * init script changed significantly to address argument passing problems - (reported by Shaul Karl) - - -- Luca Filipozzi Thu, 16 Nov 2000 11:42:42 -0800 - -nut (0.44.1-2) unstable; urgency=low - - * removed else clause on detection of existing "nut" user (Closes: #76721) - "install" creates the user nut; "remove" doesn't remove it, "purge" does; - a re-"install" would find an existing "nut" user and exit on error; fixed - * fixed a possible bashism (Closes: #72711) - - -- Luca Filipozzi Fri, 10 Nov 2000 10:06:05 -0800 - -nut (0.44.1-1) unstable; urgency=low - - * New upstream release - * serious repurcussion to existing users of nut... the configuration files - have changed somewhat... a critical debconf warning informs the user of - this fact - * binaries are to remains in /sbin (Closes: #69525) - * init script no longer relies on /usr being mounted (Closes: #70033) - * - - -- Luca Filipozzi Fri, 10 Nov 2000 10:05:55 -0800 - -nut (0.44.0-4) unstable; urgency=low - - * Moved man pages from section 1 to section 8. (Closes: #68819) - * nut-doc suggest rather than recommends nut and nut-cgi. (Closes: #69400) - - -- Luca Filipozzi Fri, 18 Aug 2000 23:15:18 -0700 - -nut (0.44.0-3) unstable; urgency=low - - * Minor fixes to packaging scripts (Closes: #67649). - * Created new doc package: nut-doc. - - -- Luca Filipozzi Mon, 24 Jul 2000 10:18:19 -0700 - -nut (0.44.0-2) unstable; urgency=low - - * Minor fixes to init script and to list of undocumented binaries. - - -- Luca Filipozzi Sat, 22 Jul 2000 19:11:42 -0700 - -nut (0.44.0-1) unstable; urgency=low - - * New upstream release - - -- Luca Filipozzi Thu, 20 Jul 2000 09:26:04 -0700 - -nut (0.43.2-2) unstable; urgency=low - - * fixes: Bug#67316: nut: default permissions could reveal passwords - Files in /etc/nut are now 600 by default. - * fixes: Bug#67314: nut: uses old FHS directory /var/state - Now uses /var/lib as per FHS guidelines. - * fixes: Bug#66988: nut_0.43.2-1(unstable): Missing build dependencies - Added debhelper to the build dependencies. - - -- Luca Filipozzi Tue, 18 Jul 2000 14:55:03 -0700 - -nut (0.43.2-1) unstable; urgency=low - - * Initial Release. - * Modification to upstream source: configure.in, common/common.c, - and models/upscommon.c changed to support different configuration - options... --with-user and --with-group which accept a username - and a groupname (rather than a uid/gid as before). - * Modification to upstream source: /var/state/nut is used instead - of /var/state/ups in conf/upsd.conf. - - -- Luca Filipozzi Wed, 3 May 2000 20:50:30 -0700 - -Local variables: -mode: debian-changelog -End: diff --git a/debian/compat b/debian/compat deleted file mode 100644 index 48082f7..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -12 diff --git a/debian/control b/debian/control deleted file mode 100644 index 7ba656b..0000000 --- a/debian/control +++ /dev/null @@ -1,305 +0,0 @@ -Source: nut -Section: admin -Priority: optional -Maintainer: Laurent Bigonville -Build-Depends: debhelper (>= 12), - dh-python, - libfreeipmi-dev (>= 0.8.5) [!hurd-i386], - libgd-dev | libgd2-xpm-dev | libgd2-noxpm-dev, - libipmimonitoring-dev (>= 1.1.5-2) [!hurd-i386], - libltdl-dev, - libneon27-gnutls-dev | libneon27-dev, - libnss3-dev, - libpowerman0-dev (>= 2.3.3), - libsnmp-dev | libsnmp9-dev, - libusb-dev (>= 0.1.8), - libwrap0-dev (>= 7.6), - python3 -Build-Depends-Indep: asciidoc (>= 8.6.3) , - asciidoc-dblatex , - dblatex (>= 0.2.5) , - docbook-xsl , - libxml2-utils -Standards-Version: 4.6.0 -Homepage: https://networkupstools.org/ -Vcs-Browser: https://salsa.debian.org/debian/nut -Vcs-Git: https://salsa.debian.org/debian/nut.git - -Package: nut -Architecture: all -Section: metapackages -Depends: nut-client, nut-server, ${misc:Depends} -Description: network UPS tools - metapackage - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package is a metapackage that installs both nut-server and nut-client, - in most cases it is sufficient for a basic UPS monitoring system. - -Package: nut-server -Architecture: any -Depends: adduser, - lsb-base (>= 3.0-6), - nut-client (= ${binary:Version}), - udev [linux-any], - ${misc:Depends}, - ${shlibs:Depends} -Suggests: nut-cgi, nut-ipmi, nut-snmp, nut-xml -Pre-Depends: ${misc:Pre-Depends} -Description: network UPS tools - core system - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides NUT's core system, and the serial and USB UPS - drivers. - -Package: nut-client -Architecture: any -Depends: adduser, lsb-base (>= 3.0-6), ${misc:Depends}, ${shlibs:Depends} -Provides: ups-monitor -Conflicts: ups-monitor -Recommends: bash-completion -Suggests: nut-monitor -Replaces: ups-monitor -Pre-Depends: ${misc:Pre-Depends} -Description: network UPS tools - clients - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides NUT's clients that allows the user to control - and monitor the UPS. - -Package: nut-cgi -Architecture: any -Depends: adduser, ${misc:Depends}, ${shlibs:Depends} -Recommends: apache2 | httpd-cgi -Suggests: nut -Description: network UPS tools - web interface - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides an HTTP interface for Network UPS Tools which makes - it possible to monitor the core NUT system with a web browser. - -Package: nut-snmp -Architecture: any -Depends: nut (>= 1.4.1-pre1), ${misc:Depends}, ${shlibs:Depends} -Description: network UPS tools - SNMP driver - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides snmp-ups, the SNMP multi-MIB driver for UPS, which - supports various MIBs including IETF, MGE, and APC. It adds an SNMP - Manager interface to the core NUT system. - -Package: nut-ipmi -Architecture: kfreebsd-any linux-any -Depends: nut (>= 1.4.1-pre1), ${misc:Depends}, ${shlibs:Depends} -Description: network UPS tools - IPMI driver - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package currently provides nut-ipmipsu, a driver which allows the user to - monitor IPMI power supply units (PSU) found in servers of popular brands, such - as Dell, HP, IBM. It adds an IPMI interface to the core NUT system. - -Package: nut-xml -Architecture: any -Depends: nut (>= 2.2.2), ${misc:Depends}, ${shlibs:Depends} -Description: network UPS tools - XML/HTTP driver - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides netxml-ups, which supports UPS models from - Eaton or MGE that use an XML/HTTP-based Network Management Card or - Proxy. - -Package: nut-powerman-pdu -Architecture: any -Depends: nut (>= 2.4.0), - powerman (>= 2.3.3), - ${misc:Depends}, - ${shlibs:Depends} -Description: network UPS tools - PowerMan PDU driver - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides powerman-pdu, which allows NUT clients to communicate - with the PowerMan daemon to support PDUs. - -Package: nut-doc -Architecture: all -Section: doc -Depends: ${misc:Depends} -Suggests: doc-base -Build-Profiles: -Description: network UPS tools - documentation - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package contains FAQ, user, developer and packager documentation. - -Package: libupsclient4 -Section: libs -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} -Pre-Depends: ${misc:Pre-Depends} -Multi-Arch: same -Description: network UPS tools - client library - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the shared client library. - -Package: libupsclient-dev -Section: libdevel -Architecture: any -Depends: libnss3-dev, - libupsclient4 (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Multi-Arch: same -Description: network UPS tools - development files - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the development files. - -Package: libnutclient0 -Section: libs -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} -Pre-Depends: ${misc:Pre-Depends} -Multi-Arch: same -Description: network UPS tools - new client library - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the new shared client library. - -Package: libnutclient-dev -Section: libdevel -Architecture: any -Depends: libnutclient0 (= ${binary:Version}), - ${misc:Depends}, - ${shlibs:Depends} -Multi-Arch: same -Description: network UPS tools - development files for the new client library - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the development files for the new client library. - -Package: libnutscan1 -Section: libs -Architecture: any -Depends: ${misc:Depends}, ${shlibs:Depends} -Pre-Depends: ${misc:Pre-Depends} -Multi-Arch: same -Description: network UPS tools - scanner library - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the shared scanner library. - -Package: libnutscan-dev -Section: libdevel -Architecture: any -Depends: libnutscan1 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} -Breaks: libupsclient-dev (<< 2.7.4-9~) -Replaces: libupsclient-dev (<< 2.7.4-9~) -Multi-Arch: same -Description: network UPS tools - development files for the scanner library - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides the development files for the scanner library. - -#Package: python3-nut -#Section: python -#Architecture: all -#Depends: ${misc:Depends}, ${python3:Depends} -#Description: network UPS tools - Python3 bindings for NUT server -# Network UPS Tools (NUT) is a client/server monitoring system that -# allows computers to share uninterruptible power supply (UPS) and -# power distribution unit (PDU) hardware. Clients access the hardware -# through the server, and are notified whenever the power status -# changes. -# . -# This package provides Python3 bindings to connect to NUT server. - -#Package: nut-monitor -#Architecture: all -#Depends: python-glade2, -# python-gobject-2, -# python-gtk2, -# python-nut, -# ${misc:Depends}, -# ${python:Depends} -#Recommends: python-notify -#Description: network UPS tools - GUI application to monitor UPS status -# Network UPS Tools (NUT) is a client/server monitoring system that -# allows computers to share uninterruptible power supply (UPS) and -# power distribution unit (PDU) hardware. Clients access the hardware -# through the server, and are notified whenever the power status -# changes. -# . -# This package provides nut-monitor, a GUI application to monitor UPS status. - -Package: libups-nut-perl -Section: perl -Architecture: all -Depends: ${misc:Depends}, ${perl:Depends} -Description: network UPS tools - Perl bindings for NUT server - Network UPS Tools (NUT) is a client/server monitoring system that - allows computers to share uninterruptible power supply (UPS) and - power distribution unit (PDU) hardware. Clients access the hardware - through the server, and are notified whenever the power status - changes. - . - This package provides Perl bindings to connect to NUT server. diff --git a/debian/copyright b/debian/copyright deleted file mode 100644 index 01fea18..0000000 --- a/debian/copyright +++ /dev/null @@ -1,69 +0,0 @@ -This package was debianized by Luca Filipozzi on -Wed Jun 28 19:48:05 PDT 2000 - -It was downloaded from http://www.networkupstools.org/ - -Upstream Authors: - - Russell Kroll - Arnaud Quette - Arjen de Korte - Charles Lepple - Kjell Claesson - David Goncalves - and the NUT Team - -Copyright: - - Copyright (C) 2000-2008 Russell Kroll, Arnaud Quette and the NUT Team - -Licenses: - - Most files are licensed under the GNU General Public License (GPL) version 2, - or (at your option) any later version. - - The files in the scripts/python/ directory are released under GNU General - Public License (GPL) version 3, or (at your option) any later version. - - GPL-2 - ----- - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - On Debian systems, the full text of the GNU General Public License v2 - may be found in /usr/share/common-licenses/GPL-2. - - GPL-3 - ----- - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - - On Debian systems, the full text of the GNU General Public License v3 - may be found in /usr/share/common-licenses/GPL-3. - - -The Debian packaging is Copyright (C) 2008, Arnaud Quette -and is licensed under the GPL, see `/usr/share/common-licenses/GPL'. diff --git a/debian/gbp.conf b/debian/gbp.conf deleted file mode 100644 index 6837223..0000000 --- a/debian/gbp.conf +++ /dev/null @@ -1,8 +0,0 @@ -[DEFAULT] -debian-branch = debian -upstream-branch = upstream -pristine-tar = True - -[git-buildpackage] -tarball-dir = ../tarballs/ -export-dir = ../build-area/ diff --git a/debian/libnutclient-dev.install b/debian/libnutclient-dev.install deleted file mode 100644 index f1be274..0000000 --- a/debian/libnutclient-dev.install +++ /dev/null @@ -1,4 +0,0 @@ -usr/include/nutclient.h -usr/lib/*/libnutclient.a -usr/lib/*/libnutclient.so -usr/lib/*/pkgconfig/libnutclient.pc diff --git a/debian/libnutclient0.install b/debian/libnutclient0.install deleted file mode 100644 index e5a792e..0000000 --- a/debian/libnutclient0.install +++ /dev/null @@ -1 +0,0 @@ -lib/*/libnutclient.so.* diff --git a/debian/libnutclient0.symbols b/debian/libnutclient0.symbols deleted file mode 100644 index 4e7c579..0000000 --- a/debian/libnutclient0.symbols +++ /dev/null @@ -1,199 +0,0 @@ -# SymbolsHelper-Confirmed: 2.7.4-9~ amd64 arm64 armel armhf hppa i386 ia64 m68k mips mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64 x32 -libnutclient.so.0 libnutclient0 #MINVER# -* Build-Depends-Package: libnutclient-dev - (c++)"nut::Client::Client()@Base" 2.7.3 - (c++)"nut::Client::getDevice(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Client::getDeviceVariableValues(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Client::getDevices()@Base" 2.7.3 - (c++)"nut::Client::hasDevice(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Client::hasDeviceCommand(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Client::hasDeviceVariable(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Client::~Client()@Base" 2.7.3 - (c++)"nut::Command::Command(nut::Command const&)@Base" 2.7.3 - (c++)"nut::Command::Command(nut::Device*, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Command::execute()@Base" 2.7.3 - (c++)"nut::Command::getDescription[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Command::getDevice() const@Base" 2.7.3 - (c++)"nut::Command::getDevice()@Base" 2.7.3 - (c++)"nut::Command::getName[abi:cxx11]() const@Base" 2.7.3 - (c++)"nut::Command::isOk() const@Base" 2.7.3 - (c++)"nut::Command::operator bool() const@Base" 2.7.3 - (c++)"nut::Command::operator!() const@Base" 2.7.3 - (c++)"nut::Command::operator<(nut::Command const&) const@Base" 2.7.3 - (c++)"nut::Command::operator==(nut::Command const&) const@Base" 2.7.3 - (c++)"nut::Command::~Command()@Base" 2.7.3 - (c++)"nut::Device::Device(nut::Client*, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::Device(nut::Device const&)@Base" 2.7.3 - (c++)"nut::Device::executeCommand(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::forcedShutdown()@Base" 2.7.3 - (c++)"nut::Device::getClient() const@Base" 2.7.3 - (c++)"nut::Device::getClient()@Base" 2.7.3 - (c++)"nut::Device::getCommand(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::getCommandNames[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Device::getCommands()@Base" 2.7.3 - (c++)"nut::Device::getDescription[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Device::getName[abi:cxx11]() const@Base" 2.7.3 - (c++)"nut::Device::getNumLogins()@Base" 2.7.3 - (c++)"nut::Device::getRWVariableNames[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Device::getRWVariables()@Base" 2.7.3 - (c++)"nut::Device::getVariable(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::getVariableNames[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Device::getVariableValue(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::getVariableValues[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Device::getVariables()@Base" 2.7.3 - (c++)"nut::Device::isOk() const@Base" 2.7.3 - (c++)"nut::Device::login()@Base" 2.7.3 - (c++)"nut::Device::master()@Base" 2.7.3 - (c++)"nut::Device::operator bool() const@Base" 2.7.3 - (c++)"nut::Device::operator!() const@Base" 2.7.3 - (c++)"nut::Device::operator<(nut::Device const&) const@Base" 2.7.3 - (c++)"nut::Device::operator==(nut::Device const&) const@Base" 2.7.3 - (c++)"nut::Device::setVariable(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Device::setVariable(std::__cxx11::basic_string, std::allocator > const&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&)@Base" 2.7.3 - (c++)"nut::Device::~Device()@Base" 2.7.3 - (c++)"nut::IOException::~IOException()@Base" 2.7.3 - (c++)"nut::NotConnectedException::NotConnectedException()@Base" 2.7.3 - (c++)"nut::NotConnectedException::~NotConnectedException()@Base" 2.7.3 - (c++)"nut::NutException::NutException(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::NutException::str[abi:cxx11]() const@Base" 2.7.3 - (c++)"nut::NutException::what() const@Base" 2.7.3 - (c++)"nut::NutException::~NutException()@Base" 2.7.3 - (c++)"nut::SystemException::SystemException()@Base" 2.7.3 - (c++)"nut::SystemException::err[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::SystemException::~SystemException()@Base" 2.7.3 - (c++)"nut::TcpClient::TcpClient()@Base" 2.7.3 - (c++)"nut::TcpClient::TcpClient(std::__cxx11::basic_string, std::allocator > const&, int)@Base" 2.7.3 - (c++)"nut::TcpClient::authenticate(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::connect()@Base" 2.7.3 - (c++)"nut::TcpClient::connect(std::__cxx11::basic_string, std::allocator > const&, int)@Base" 2.7.3 - (c++)"nut::TcpClient::detectError(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::deviceForcedShutdown(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::deviceGetNumLogins(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::deviceLogin(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::deviceMaster(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::disconnect()@Base" 2.7.3 - (c++)"nut::TcpClient::escape(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::executeDeviceCommand(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++|arch-bits=32)"nut::TcpClient::explode(std::__cxx11::basic_string, std::allocator > const&, unsigned int)@Base" 2.7.4 - (c++|arch-bits=64)"nut::TcpClient::explode(std::__cxx11::basic_string, std::allocator > const&, unsigned long)@Base" 2.7.4 - (c++)"nut::TcpClient::get(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDevice(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceCommandDescription(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceCommandNames(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceDescription(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceNames[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceRWVariableNames(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceVariableDescription(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceVariableNames(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceVariableValue(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getDeviceVariableValues(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::getHost[abi:cxx11]() const@Base" 2.7.3 - (c++)"nut::TcpClient::getPort() const@Base" 2.7.3 - (c++)"nut::TcpClient::getTimeout() const@Base" 2.7.3 - (c++)"nut::TcpClient::isConnected() const@Base" 2.7.3 - (c++)"nut::TcpClient::list(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::logout()@Base" 2.7.3 - (c++)"nut::TcpClient::sendQuery(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::setDeviceVariable(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::setDeviceVariable(std::__cxx11::basic_string, std::allocator > const&, std::__cxx11::basic_string, std::allocator > const&, std::vector, std::allocator >, std::allocator, std::allocator > > > const&)@Base" 2.7.3 - (c++)"nut::TcpClient::setTimeout(long)@Base" 2.7.3 - (c++)"nut::TcpClient::~TcpClient()@Base" 2.7.3 - (c++)"nut::TimeoutException::TimeoutException()@Base" 2.7.3 - (c++)"nut::TimeoutException::~TimeoutException()@Base" 2.7.3 - (c++)"nut::UnknownHostException::UnknownHostException()@Base" 2.7.3 - (c++)"nut::UnknownHostException::~UnknownHostException()@Base" 2.7.3 - (c++)"nut::Variable::Variable(nut::Device*, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Variable::Variable(nut::Variable const&)@Base" 2.7.3 - (c++)"nut::Variable::getDescription[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Variable::getDevice() const@Base" 2.7.3 - (c++)"nut::Variable::getDevice()@Base" 2.7.3 - (c++)"nut::Variable::getName[abi:cxx11]() const@Base" 2.7.3 - (c++)"nut::Variable::getValue[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::Variable::isOk() const@Base" 2.7.3 - (c++)"nut::Variable::operator bool() const@Base" 2.7.3 - (c++)"nut::Variable::operator!() const@Base" 2.7.3 - (c++)"nut::Variable::operator<(nut::Variable const&) const@Base" 2.7.3 - (c++)"nut::Variable::operator==(nut::Variable const&) const@Base" 2.7.3 - (c++)"nut::Variable::setValue(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"nut::Variable::setValues(std::vector, std::allocator >, std::allocator, std::allocator > > > const&)@Base" 2.7.3 - (c++)"nut::Variable::~Variable()@Base" 2.7.3 - (c++)"nut::internal::Socket::Socket()@Base" 2.7.3 - (c++)"nut::internal::Socket::connect(std::__cxx11::basic_string, std::allocator > const&, int)@Base" 2.7.3 - (c++)"nut::internal::Socket::disconnect()@Base" 2.7.3 - (c++)"nut::internal::Socket::isConnected() const@Base" 2.7.3 - (c++|arch-bits=32)"nut::internal::Socket::read(void*, unsigned int)@Base" 2.7.4 - (c++|arch-bits=64)"nut::internal::Socket::read(void*, unsigned long)@Base" 2.7.4 - (c++)"nut::internal::Socket::read[abi:cxx11]()@Base" 2.7.3 - (c++)"nut::internal::Socket::setTimeout(long)@Base" 2.7.3 - (c++)"nut::internal::Socket::write(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++|arch-bits=32)"nut::internal::Socket::write(void const*, unsigned int)@Base" 2.7.4 - (c++|arch-bits=64)"nut::internal::Socket::write(void const*, unsigned long)@Base" 2.7.4 - nutclient_authenticate@Base 2.7.3 - nutclient_destroy@Base 2.7.3 - nutclient_device_forced_shutdown@Base 2.7.3 - nutclient_device_login@Base 2.7.3 - nutclient_device_master@Base 2.7.3 - nutclient_execute_device_command@Base 2.7.3 - nutclient_get_device_command_description@Base 2.7.3 - nutclient_get_device_commands@Base 2.7.3 - nutclient_get_device_description@Base 2.7.3 - nutclient_get_device_num_logins@Base 2.7.3 - nutclient_get_device_rw_variables@Base 2.7.3 - nutclient_get_device_variable_description@Base 2.7.3 - nutclient_get_device_variable_values@Base 2.7.3 - nutclient_get_device_variables@Base 2.7.3 - nutclient_get_devices@Base 2.7.3 - nutclient_has_device@Base 2.7.3 - nutclient_has_device_command@Base 2.7.3 - nutclient_has_device_variable@Base 2.7.3 - nutclient_logout@Base 2.7.3 - nutclient_set_device_variable_value@Base 2.7.3 - nutclient_set_device_variable_values@Base 2.7.3 - nutclient_tcp_create_client@Base 2.7.3 - nutclient_tcp_disconnect@Base 2.7.3 - nutclient_tcp_get_timeout@Base 2.7.3 - nutclient_tcp_is_connected@Base 2.7.3 - nutclient_tcp_reconnect@Base 2.7.3 - nutclient_tcp_set_timeout@Base 2.7.3 - (c++)"std::_Rb_tree, std::less, std::allocator >::_M_erase(std::_Rb_tree_node*)@Base" 2.7.3 - (c++)"std::_Rb_tree, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::_Identity, std::allocator > >, std::less, std::allocator > >, std::allocator, std::allocator > > >::_M_erase(std::_Rb_tree_node, std::allocator > >*)@Base" 2.7.3 - (c++)"std::_Rb_tree, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::_Identity, std::allocator > >, std::less, std::allocator > >, std::allocator, std::allocator > > >::find(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > >, std::_Select1st, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > > >::_M_erase(std::_Rb_tree_node, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > >*)@Base" 2.7.3 - (c++|optional=templinst)"std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > >, std::_Select1st, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > > >::_M_get_insert_hint_unique_pos(std::_Rb_tree_const_iterator, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > >, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.4 - (c++)"std::_Rb_tree, std::allocator >, std::pair, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > >, std::_Select1st, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > >, std::less, std::allocator > >, std::allocator, std::allocator > const, std::vector, std::allocator >, std::allocator, std::allocator > > > > > >::_M_get_insert_unique_pos(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"std::__cxx11::basic_string, std::allocator > std::operator+, std::allocator >(char const*, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.3 - (c++)"std::pair, bool> std::_Rb_tree, std::less, std::allocator >::_M_insert_unique(nut::Variable&&)@Base" 2.7.3 - (c++)"std::vector, std::allocator >, std::allocator, std::allocator > > >::operator=(std::vector, std::allocator >, std::allocator, std::allocator > > > const&)@Base" 2.7.3 - (c++)"std::vector, std::allocator >, std::allocator, std::allocator > > >::~vector()@Base" 2.7.3 - (c++)"std::vector, std::allocator >, std::allocator, std::allocator > > >, std::allocator, std::allocator >, std::allocator, std::allocator > > > > >::~vector()@Base" 2.7.3 - strarr_alloc@Base 2.7.3 - strarr_free@Base 2.7.3 - (c++)"typeinfo for nut::Client@Base" 2.7.3 - (c++)"typeinfo for nut::IOException@Base" 2.7.3 - (c++)"typeinfo for nut::NotConnectedException@Base" 2.7.3 - (c++)"typeinfo for nut::NutException@Base" 2.7.3 - (c++)"typeinfo for nut::SystemException@Base" 2.7.3 - (c++)"typeinfo for nut::TcpClient@Base" 2.7.3 - (c++)"typeinfo for nut::TimeoutException@Base" 2.7.3 - (c++)"typeinfo for nut::UnknownHostException@Base" 2.7.3 - (c++)"typeinfo name for nut::Client@Base" 2.7.3 - (c++)"typeinfo name for nut::IOException@Base" 2.7.3 - (c++)"typeinfo name for nut::NotConnectedException@Base" 2.7.3 - (c++)"typeinfo name for nut::NutException@Base" 2.7.3 - (c++)"typeinfo name for nut::SystemException@Base" 2.7.3 - (c++)"typeinfo name for nut::TcpClient@Base" 2.7.3 - (c++)"typeinfo name for nut::TimeoutException@Base" 2.7.3 - (c++)"typeinfo name for nut::UnknownHostException@Base" 2.7.3 - (c++|optional=templinst)"void std::vector, std::allocator >, std::allocator, std::allocator > > >::_M_realloc_insert, std::allocator > const&>(__gnu_cxx::__normal_iterator, std::allocator >*, std::vector, std::allocator >, std::allocator, std::allocator > > > >, std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.4 - (c++|optional=templinst)"void std::vector, std::allocator >, std::allocator, std::allocator > > >, std::allocator, std::allocator >, std::allocator, std::allocator > > > > >::_M_realloc_insert, std::allocator >, std::allocator, std::allocator > > > >(__gnu_cxx::__normal_iterator, std::allocator >, std::allocator, std::allocator > > >*, std::vector, std::allocator >, std::allocator, std::allocator > > >, std::allocator, std::allocator >, std::allocator, std::allocator > > > > > >, std::vector, std::allocator >, std::allocator, std::allocator > > >&&)@Base" 2.7.4 - (c++)"vtable for nut::Client@Base" 2.7.3 - (c++)"vtable for nut::IOException@Base" 2.7.3 - (c++)"vtable for nut::NotConnectedException@Base" 2.7.3 - (c++)"vtable for nut::NutException@Base" 2.7.3 - (c++)"vtable for nut::SystemException@Base" 2.7.3 - (c++)"vtable for nut::TcpClient@Base" 2.7.3 - (c++)"vtable for nut::TimeoutException@Base" 2.7.3 - (c++)"vtable for nut::UnknownHostException@Base" 2.7.3 - (c++|optional=templinst)"void std::vector, std::allocator >, std::allocator, std::allocator > > >::_M_realloc_insert, std::allocator > >(__gnu_cxx::__normal_iterator, std::allocator >*, std::vector, std::allocator >, std::allocator, std::allocator > > > >, std::__cxx11::basic_string, std::allocator >&&)@Base" 2.7.4 - (c++|optional=templinst|arch=s390x mipsel armhf)"std::pair, std::allocator > >, bool> std::_Rb_tree, std::allocator >, std::__cxx11::basic_string, std::allocator >, std::_Identity, std::allocator > >, std::less, std::allocator > >, std::allocator, std::allocator > > >::_M_insert_unique, std::allocator > const&>(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.4 - (c++|optional=templinst|arch=!s390x !mipsel !armhf)"std::set, std::allocator >, std::less, std::allocator > >, std::allocator, std::allocator > > >::insert(std::__cxx11::basic_string, std::allocator > const&)@Base" 2.7.4 diff --git a/debian/libnutscan-dev.install b/debian/libnutscan-dev.install deleted file mode 100644 index 9902dd6..0000000 --- a/debian/libnutscan-dev.install +++ /dev/null @@ -1,6 +0,0 @@ -usr/include/nut-scan.h -usr/include/nutscan-device.h -usr/include/nutscan-init.h -usr/include/nutscan-ip.h -usr/lib/*/libnutscan.so -usr/lib/*/pkgconfig/libnutscan.pc diff --git a/debian/libnutscan1.install b/debian/libnutscan1.install deleted file mode 100644 index 2616b8d..0000000 --- a/debian/libnutscan1.install +++ /dev/null @@ -1 +0,0 @@ -lib/*/libnutscan.so.* diff --git a/debian/libnutscan1.symbols b/debian/libnutscan1.symbols deleted file mode 100644 index d498469..0000000 --- a/debian/libnutscan1.symbols +++ /dev/null @@ -1,157 +0,0 @@ -libnutscan.so.1 libnutscan1 #MINVER# -* Build-Depends-Package: libnutscan-dev - AUT@Base 2.7.4-9~ - UPS_VERSION@Base 2.7.4-9~ - altpidpath@Base 2.7.4-9~ - background@Base 2.7.4-9~ - become_user@Base 2.7.4-9~ - calc_checksum@Base 2.7.4-9~ - checksum_test@Base 2.7.4-9~ - chroot_start@Base 2.7.4-9~ - comm_upsdrv_info@Base 2.7.4-9~ - command_read_sequence@Base 2.7.4-9~ - command_write_sequence@Base 2.7.4-9~ - confpath@Base 2.7.4-9~ - device_path@Base 2.7.4-9~ - device_portname@Base 2.7.4-9~ - dflt_statepath@Base 2.7.4-9~ - do_lock_port@Base 2.7.4-9~ - exit_flag@Base 2.7.4-9~ - fatal_with_errno@Base 2.7.4-9~ - fatalx@Base 2.7.4-9~ - g_usec_timeout@Base 2.7.4-9~ - get_answer@Base 2.7.4-9~ - get_libname@Base 2.7.4-9~ - get_user_pwent@Base 2.7.4-9~ - getval@Base 2.7.4-9~ - (arch=!hurd-i386)is_ipmi_device_supported@Base 2.7.4-9~ - nut_debug_level@Base 2.7.4-9~ - nut_log_level@Base 2.7.4-9~ - nut_snmp_add_null_var@Base 2.7.4-9~ - nutscan_add_device_to_device@Base 2.7.4-9~ - nutscan_add_option_to_device@Base 2.7.4-9~ - nutscan_avail_avahi@Base 2.7.4-9~ - nutscan_avail_ipmi@Base 2.7.4-9~ - nutscan_avail_nut@Base 2.7.4-9~ - nutscan_avail_snmp@Base 2.7.4-9~ - nutscan_avail_usb@Base 2.7.4-9~ - nutscan_avail_xml_http@Base 2.7.4-9~ - nutscan_cidr_to_ip@Base 2.7.4-9~ - nutscan_device_type_string@Base 2.7.4-9~ - nutscan_device_type_strings@Base 2.7.4-9~ - nutscan_display_parsable@Base 2.7.4-9~ - nutscan_display_ups_conf@Base 2.7.4-9~ - nutscan_free@Base 2.7.4-9~ - nutscan_free_device@Base 2.7.4-9~ - nutscan_get_serial_ports_list@Base 2.7.4-9~ - nutscan_init@Base 2.7.4-9~ - nutscan_ip_iter_inc@Base 2.7.4-9~ - nutscan_ip_iter_init@Base 2.7.4-9~ - (arch=!hurd-i386)nutscan_load_ipmi_library@Base 2.7.4-9~ - nutscan_load_neon_library@Base 2.7.4-9~ - nutscan_load_snmp_library@Base 2.7.4-9~ - nutscan_load_upsclient_library@Base 2.7.4-9~ - nutscan_load_usb_library@Base 2.7.4-9~ - nutscan_new_device@Base 2.7.4-9~ - nutscan_rewind_device@Base 2.7.4-9~ - nutscan_scan_avahi@Base 2.7.4-9~ - nutscan_scan_eaton_serial@Base 2.7.4-9~ - nutscan_scan_eaton_serial_q1@Base 2.7.4-9~ - nutscan_scan_eaton_serial_shut@Base 2.7.4-9~ - nutscan_scan_eaton_serial_xcp@Base 2.7.4-9~ - nutscan_scan_ipmi@Base 2.7.4-9~ - nutscan_scan_nut@Base 2.7.4-9~ - nutscan_scan_snmp@Base 2.7.4-9~ - nutscan_scan_usb@Base 2.7.4-9~ - nutscan_scan_xml_http@Base 2.7.4-9~ - open_syslog@Base 2.7.4-9~ - pw_baud_rates@Base 2.7.4-9~ - pw_comm_setup@Base 2.7.4-9~ - search_paths@Base 2.7.4-9~ - select_read@Base 2.7.4-9~ - select_write@Base 2.7.4-9~ - send_read_command@Base 2.7.4-9~ - send_write_command@Base 2.7.4-9~ - sendsignal@Base 2.7.4-9~ - sendsignalfn@Base 2.7.4-9~ - ser_close@Base 2.7.4-9~ - ser_comm_fail@Base 2.7.4-9~ - ser_comm_good@Base 2.7.4-9~ - ser_flush_in@Base 2.7.4-9~ - ser_flush_io@Base 2.7.4-9~ - ser_get_buf@Base 2.7.4-9~ - ser_get_buf_len@Base 2.7.4-9~ - ser_get_char@Base 2.7.4-9~ - ser_get_cts@Base 2.7.4-9~ - ser_get_dcd@Base 2.7.4-9~ - ser_get_dsr@Base 2.7.4-9~ - ser_get_line@Base 2.7.4-9~ - ser_get_line_alert@Base 2.7.4-9~ - ser_open@Base 2.7.4-9~ - ser_open_nf@Base 2.7.4-9~ - ser_send@Base 2.7.4-9~ - ser_send_buf@Base 2.7.4-9~ - ser_send_buf_pace@Base 2.7.4-9~ - ser_send_char@Base 2.7.4-9~ - ser_send_pace@Base 2.7.4-9~ - ser_set_dtr@Base 2.7.4-9~ - ser_set_rts@Base 2.7.4-9~ - ser_set_speed@Base 2.7.4-9~ - ser_set_speed_nf@Base 2.7.4-9~ - shut_synchronise@Base 2.7.4-9~ - snprintfcat@Base 2.7.4-9~ - str_is_double@Base 2.7.4-9~ - str_is_double_strict@Base 2.7.4-9~ - str_is_int@Base 2.7.4-9~ - str_is_int_strict@Base 2.7.4-9~ - str_is_long@Base 2.7.4-9~ - str_is_long_strict@Base 2.7.4-9~ - str_is_short@Base 2.7.4-9~ - str_is_short_strict@Base 2.7.4-9~ - str_is_uint@Base 2.7.4-9~ - str_is_uint_strict@Base 2.7.4-9~ - str_is_ulong@Base 2.7.4-9~ - str_is_ulong_strict@Base 2.7.4-9~ - str_is_ushort@Base 2.7.4-9~ - str_is_ushort_strict@Base 2.7.4-9~ - str_ltrim@Base 2.7.4-9~ - str_ltrim_m@Base 2.7.4-9~ - str_ltrim_space@Base 2.7.4-9~ - str_rtrim@Base 2.7.4-9~ - str_rtrim_m@Base 2.7.4-9~ - str_rtrim_space@Base 2.7.4-9~ - str_to_double@Base 2.7.4-9~ - str_to_double_strict@Base 2.7.4-9~ - str_to_int@Base 2.7.4-9~ - str_to_int_strict@Base 2.7.4-9~ - str_to_long@Base 2.7.4-9~ - str_to_long_strict@Base 2.7.4-9~ - str_to_short@Base 2.7.4-9~ - str_to_short_strict@Base 2.7.4-9~ - str_to_uint@Base 2.7.4-9~ - str_to_uint_strict@Base 2.7.4-9~ - str_to_ulong@Base 2.7.4-9~ - str_to_ulong_strict@Base 2.7.4-9~ - str_to_ushort@Base 2.7.4-9~ - str_to_ushort_strict@Base 2.7.4-9~ - str_trim@Base 2.7.4-9~ - str_trim_m@Base 2.7.4-9~ - str_trim_space@Base 2.7.4-9~ - syslogbit_set@Base 2.7.4-9~ - upsdebug_ascii@Base 2.7.4-9~ - upsdebug_hex@Base 2.7.4-9~ - upsdebug_with_errno@Base 2.7.4-9~ - upsdebugx@Base 2.7.4-9~ - upsdrv_cleanup@Base 2.7.4-9~ - upsdrv_comm_good@Base 2.7.4-9~ - upsdrv_initups@Base 2.7.4-9~ - upsdrv_reconnect@Base 2.7.4-9~ - upsfd@Base 2.7.4-9~ - upslog_with_errno@Base 2.7.4-9~ - upslogx@Base 2.7.4-9~ - writepid@Base 2.7.4-9~ - xbasename@Base 2.7.4-9~ - xcalloc@Base 2.7.4-9~ - xmalloc@Base 2.7.4-9~ - xrealloc@Base 2.7.4-9~ - xstrdup@Base 2.7.4-9~ diff --git a/debian/libups-nut-perl.install b/debian/libups-nut-perl.install deleted file mode 100644 index 355c6fe..0000000 --- a/debian/libups-nut-perl.install +++ /dev/null @@ -1 +0,0 @@ -scripts/perl/Nut.pm /usr/share/perl5/UPS/ diff --git a/debian/libupsclient-dev.install b/debian/libupsclient-dev.install deleted file mode 100644 index 1f7f29a..0000000 --- a/debian/libupsclient-dev.install +++ /dev/null @@ -1,5 +0,0 @@ -usr/include/parseconf.h -usr/include/upsclient.h -usr/lib/*/libupsclient.a -usr/lib/*/libupsclient.so -usr/lib/*/pkgconfig/libupsclient.pc diff --git a/debian/libupsclient4.install b/debian/libupsclient4.install deleted file mode 100644 index 132d81a..0000000 --- a/debian/libupsclient4.install +++ /dev/null @@ -1 +0,0 @@ -lib/*/libupsclient.so.* diff --git a/debian/libupsclient4.symbols b/debian/libupsclient4.symbols deleted file mode 100644 index ed89b8a..0000000 --- a/debian/libupsclient4.symbols +++ /dev/null @@ -1,114 +0,0 @@ -libupsclient.so.4 libupsclient4 #MINVER# -* Build-Depends-Package: libupsclient-dev - UPS_VERSION@Base 2.7.2 - altpidpath@Base 2.7.2 - background@Base 2.7.2 - become_user@Base 2.7.2 - chroot_start@Base 2.7.2 - confpath@Base 2.7.2 - dflt_statepath@Base 2.7.2 - fatal_with_errno@Base 2.7.2 - fatalx@Base 2.7.2 - get_user_pwent@Base 2.7.2 - nut_debug_level@Base 2.7.2 - nut_log_level@Base 2.7.2 - open_syslog@Base 2.7.2 - pconf_char@Base 2.7.2 - pconf_encode@Base 2.7.2 - pconf_file_begin@Base 2.7.2 - pconf_file_next@Base 2.7.2 - pconf_finish@Base 2.7.2 - pconf_init@Base 2.7.2 - pconf_line@Base 2.7.2 - pconf_parse_error@Base 2.7.2 - select_read@Base 2.7.2 - select_write@Base 2.7.2 - sendsignal@Base 2.7.2 - sendsignalfn@Base 2.7.2 - snprintfcat@Base 2.7.2 - state_addcmd@Base 2.7.2 - state_addenum@Base 2.7.2 - state_addrange@Base 2.7.2 - state_cmdfree@Base 2.7.2 - state_delcmd@Base 2.7.2 - state_delenum@Base 2.7.2 - state_delinfo@Base 2.7.2 - state_delrange@Base 2.7.2 - state_getaux@Base 2.7.2 - state_getenumlist@Base 2.7.2 - state_getflags@Base 2.7.2 - state_getinfo@Base 2.7.2 - state_getrangelist@Base 2.7.2 - state_infofree@Base 2.7.2 - state_setaux@Base 2.7.2 - state_setflags@Base 2.7.2 - state_setinfo@Base 2.7.2 - state_tree_find@Base 2.7.2 - str_is_double@Base 2.7.4 - str_is_double_strict@Base 2.7.4 - str_is_int@Base 2.7.4 - str_is_int_strict@Base 2.7.4 - str_is_long@Base 2.7.4 - str_is_long_strict@Base 2.7.4 - str_is_short@Base 2.7.4 - str_is_short_strict@Base 2.7.4 - str_is_uint@Base 2.7.4 - str_is_uint_strict@Base 2.7.4 - str_is_ulong@Base 2.7.4 - str_is_ulong_strict@Base 2.7.4 - str_is_ushort@Base 2.7.4 - str_is_ushort_strict@Base 2.7.4 - str_ltrim@Base 2.7.4 - str_ltrim_m@Base 2.7.4 - str_ltrim_space@Base 2.7.4 - str_rtrim@Base 2.7.4 - str_rtrim_m@Base 2.7.4 - str_rtrim_space@Base 2.7.4 - str_to_double@Base 2.7.4 - str_to_double_strict@Base 2.7.4 - str_to_int@Base 2.7.4 - str_to_int_strict@Base 2.7.4 - str_to_long@Base 2.7.4 - str_to_long_strict@Base 2.7.4 - str_to_short@Base 2.7.4 - str_to_short_strict@Base 2.7.4 - str_to_uint@Base 2.7.4 - str_to_uint_strict@Base 2.7.4 - str_to_ulong@Base 2.7.4 - str_to_ulong_strict@Base 2.7.4 - str_to_ushort@Base 2.7.4 - str_to_ushort_strict@Base 2.7.4 - str_trim@Base 2.7.4 - str_trim_m@Base 2.7.4 - str_trim_space@Base 2.7.4 - syslogbit_set@Base 2.7.2 - upscli_add_host_cert@Base 2.7.2 - upscli_cleanup@Base 2.7.2 - upscli_connect@Base 2.7.2 - upscli_disconnect@Base 2.7.2 - upscli_errlist@Base 2.7.2 - upscli_fd@Base 2.7.2 - upscli_get@Base 2.7.2 - upscli_init@Base 2.7.2 - upscli_list_next@Base 2.7.2 - upscli_list_start@Base 2.7.2 - upscli_readline@Base 2.7.2 - upscli_sendline@Base 2.7.2 - upscli_splitaddr@Base 2.7.2 - upscli_splitname@Base 2.7.2 - upscli_ssl@Base 2.7.2 - upscli_strerror@Base 2.7.2 - upscli_tryconnect@Base 2.7.2 - upscli_upserror@Base 2.7.2 - upsdebug_ascii@Base 2.7.2 - upsdebug_hex@Base 2.7.2 - upsdebug_with_errno@Base 2.7.2 - upsdebugx@Base 2.7.2 - upslog_with_errno@Base 2.7.2 - upslogx@Base 2.7.2 - writepid@Base 2.7.2 - xbasename@Base 2.7.2 - xcalloc@Base 2.7.2 - xmalloc@Base 2.7.2 - xrealloc@Base 2.7.2 - xstrdup@Base 2.7.2 diff --git a/debian/local/nut-monitor.png b/debian/local/nut-monitor.png deleted file mode 100644 index 15f472a..0000000 Binary files a/debian/local/nut-monitor.png and /dev/null differ diff --git a/debian/local/nut-monitor.svg b/debian/local/nut-monitor.svg deleted file mode 100644 index c046562..0000000 --- a/debian/local/nut-monitor.svg +++ /dev/null @@ -1,490 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Lapo Calamandrei - - - Battery - - - battery - recharge - power - acpi - apm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/debian/local/upsd b/debian/local/upsd deleted file mode 100755 index 5e4d2a4..0000000 --- a/debian/local/upsd +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# Include NUT nut.conf -[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf - -case "$MODE" in - standalone|netserver) - exec /lib/nut/upsd "$@" - ;; - none|netclient) - echo "upsd disabled, please adjust the configuration to your needs" - echo "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it" - # exit success to avoid breaking the install process! - exit 0 - ;; - *) - exit 1 - ;; -esac diff --git a/debian/local/upsmon b/debian/local/upsmon deleted file mode 100755 index a9f6d1b..0000000 --- a/debian/local/upsmon +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# Include NUT nut.conf -[ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf - -case "$MODE" in - standalone|netserver|netclient) - exec /lib/nut/upsmon "$@" - ;; - none) - echo "upsmon disabled, please adjust the configuration to your needs" - echo "Then set MODE to a suitable value in /etc/nut/nut.conf to enable it" - # exit success to avoid breaking the install process! - exit 0 - ;; - *) - exit 1 - ;; -esac diff --git a/debian/nut-cgi.README.Debian b/debian/nut-cgi.README.Debian deleted file mode 100644 index 3a8c87d..0000000 --- a/debian/nut-cgi.README.Debian +++ /dev/null @@ -1,39 +0,0 @@ -Network UPS Tools - CGI Interface - Quick Start for Debian ----------------------------------------------------------- - -(I) Installation -================= - -1) Sample configuration files are provided in /etc/nut/ -Rename without the ".sample" suffix the files hosts.conf, upsstats.html, -upsstats-single.html and optionally upsset.conf. -Then edit these to match your configuration. - -2) Ensure these configuration files are readable by others - - chmod 755 /etc/nut - chmod 644 /etc/nut/upsset.conf - chmod 644 /etc/nut/hosts.conf - chmod 644 /etc/nut/upsstats.html - chmod 644 /etc/nut/upsstats-single.html - -3) You will then be able to access NUT CGI through a Web browser. -The URL, which depends on your httpd configuration, is: - - http://localhost/cgi-bin/nut/upsstats.cgi - -4) NUT also provides a set of HTML files to wrap the CGIs. -To use it, create a new virtual host with your preferred webserver, and point the -Document Root to: /usr/share/nut/www/ - - You can also add an alias to an existing site, if it is supported: - Alias /nut/ "/usr/share/nut/www/" - - Also ensure that the files in this directory have the suitable permissions. - -For more information on nut-cgi configuration, have a look at the following -manual pages: -- upsstats.html (5) -- hosts.conf (5) -- upsset.conf (5) - diff --git a/debian/nut-cgi.docs b/debian/nut-cgi.docs deleted file mode 100644 index 80796c9..0000000 --- a/debian/nut-cgi.docs +++ /dev/null @@ -1 +0,0 @@ -data/html/README diff --git a/debian/nut-cgi.install b/debian/nut-cgi.install deleted file mode 100644 index 8bd0f7e..0000000 --- a/debian/nut-cgi.install +++ /dev/null @@ -1,6 +0,0 @@ -debian/tmp/etc/nut/hosts.conf -debian/tmp/etc/nut/upsset.conf -debian/tmp/etc/nut/upsstats-single.html -debian/tmp/etc/nut/upsstats.html -debian/tmp/usr/lib/cgi-bin/ -debian/tmp/usr/share/nut/www diff --git a/debian/nut-cgi.postinst b/debian/nut-cgi.postinst deleted file mode 100644 index bdb72a0..0000000 --- a/debian/nut-cgi.postinst +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -e - -case "$1" in - - configure) - - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # Ensure /etc/nut is readable/crossable for others - if [ -d /etc/nut/ ] ; then - chmod 755 /etc/nut - fi - - # Ensure nut-cgi configuration files are readable by others - for file in upsset.conf hosts.conf upsstats.html upsstats-single.html ; do - if [ -f /etc/nut/$file ] ; then - chmod 644 /etc/nut/$file - fi - done - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - # do nothing - ;; - - *) - echo "$0: incorrect arguments: $*" >&2 - exit 1 - ;; - -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-client.init b/debian/nut-client.init deleted file mode 100755 index 88026b5..0000000 --- a/debian/nut-client.init +++ /dev/null @@ -1,180 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: nut-client upsmon ups-monitor -# Required-Start: $local_fs $syslog $network $remote_fs -# Required-Stop: $local_fs $syslog $network $remote_fs -# Should-Start: nut-server -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Network UPS Tools monitor initscript -# Description: This script take care of starting and stopping the -# Network UPS Tools monitoring component (upsmon). -### END INIT INFO - -# Author: Arnaud Quette - -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin - -NAME=nut-client -DESC="NUT - power device monitor and shutdown controller" -CONFIG=/etc/nut/nut.conf -pid_dir=/run/nut -upsmon_pid=${pid_dir}/upsmon.pid -upsmon=/sbin/upsmon -log=">/dev/null 2>/dev/null" - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# set upsmon specific options. use "man upsmon" for more info -# this parameter is now located in nut.conf, and not in /etc/default/nut anymore -# FIXME: retrieved from 'nut' script during update -UPSMON_OPTIONS="" - -# Exit if the package is not installed -[ -x "$upsmon" ] || exit 0 - -# Include NUT nut.conf -[ -r $CONFIG ] && . $CONFIG - -# FIXME: put all common bits, between nut-client and nut-server, -# into a common nut-function - -# Explicitly require the configuration to be done in /etc/nut/nut.conf -if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then - log_action_msg "$NAME disabled, please adjust the configuration to your needs" - log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it" - # exit success to avoid breaking the install process! - exit 0 -fi - -# Check if /run/nut exists and has the correct perms -check_var_directory() { - [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ - && chown root:nut ${pid_dir} \ - && chmod 770 ${pid_dir} \ - && [ -x /sbin/restorecon ] && /sbin/restorecon ${pid_dir} -} - -# check if the right components are running -check_status() { - case "$MODE" in - standalone|netserver|netclient) - status_of_proc -p $upsmon_pid $upsmon upsmon - ;; - none|*) - ;; - esac -} - -start_stop_client () { - case "$MODE" in - standalone|netserver|netclient) - # FIXME: for standalone|netserver, ensure 'nut-server status' returns ? - case "$1" in - start) - start-stop-daemon -S -q -p $upsmon_pid -x $upsmon \ - -- $UPSMON_OPTIONS >/dev/null 2>&1 && return 0 || return 1 - ;; - stop) - start-stop-daemon -K -o -q -p $upsmon_pid -n upsmon >/dev/null 2>&1 \ - && return 0 || return 1 - ;; - esac - ;; - none|*) - return 1 - ;; - esac -} - -case "$1" in - - start) - log_daemon_msg "Starting $DESC" "$NAME" - check_var_directory - start_stop_client start - log_end_msg $? - ;; - - stop) - log_daemon_msg "Stopping $DESC" "$NAME" - start_stop_client stop - log_end_msg $? - ;; - - reload) - log_daemon_msg "Reloading $DESC" "$NAME" - $upsmon -c reload >/dev/null 2>&1 - log_end_msg $? - ;; - - restart|force-reload) - # FIXME: lack consistency, due to initscript split. - # This only addresses partial reload. - # Full reload requires to: - # - stop nut-client - # - restart (Ie stop+start) nut-server - # - start nut-client - log_daemon_msg "Restarting $DESC" "$NAME" - start_stop_client stop || true - # should then 'start_stop_server stop', Ie /etc/init.d/nut-server stop - #sleep 5 - check_var_directory - # should first 'start_stop_server start', Ie /etc/init.d/nut-server start - start_stop_client start - log_end_msg $? - ;; - - status) - #log_daemon_msg "Checking status of $DESC" - echo "Checking status of $DESC" - check_status - exit $? - ;; - - poweroff) - case "$MODE" in - standalone|netserver) - # Sanity check - flag=`sed -ne 's#^ *POWERDOWNFLAG *\(.*\)$#\1#p' /etc/nut/upsmon.conf` - if [ -z "$flag" ] ; then - log_action_msg "##########################################################" - log_action_msg "## POWERDOWNFLAG is not defined in /etc/nut/upsmon.conf ##" - log_action_msg "## ##" - log_action_msg "## Please read the Manual page upsmon.conf(5) ##" - log_action_msg "##########################################################" - exit 1 - fi - - # Defer to nut-server to actually poweroff the UPS, if needed - # (the need is tested here though!) - if $upsmon -K >/dev/null 2>&1 ; then - log_daemon_msg "UPS poweroff required..." - log_end_msg 0 - if [ -x /etc/init.d/nut-server ] ; then - exec /etc/init.d/nut-server poweroff - else - log_action_msg "Failure: /etc/init.d/nut-server script missing" - fi - else - log_action_msg "Power down flag is not set (UPS poweroff not needed)" - fi - ;; - none|netclient|*) - # nothing to do - log_action_msg "'$MODE' configuration does not require UPS poweroff" - ;; - esac - ;; - - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|reload|restart|force-reload|status|poweroff}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/debian/nut-client.install b/debian/nut-client.install deleted file mode 100644 index 7dc3e36..0000000 --- a/debian/nut-client.install +++ /dev/null @@ -1,25 +0,0 @@ -debian/tmp/bin/upsc -debian/tmp/bin/upscmd -debian/tmp/bin/upslog -debian/tmp/bin/upsrw -debian/tmp/bin/upssched-cmd -debian/tmp/etc/nut/nut.conf -debian/tmp/etc/nut/upsmon.conf -debian/tmp/etc/nut/upssched.conf -debian/tmp/lib/nut/upsmon -debian/tmp/lib/systemd/system/nut-client.service -debian/tmp/lib/systemd/system/nut-monitor.service -debian/tmp/lib/systemd/system/ups-monitor.service -debian/tmp/sbin/upsmon -debian/tmp/sbin/upssched -debian/tmp/usr/share/apport/package-hooks/source_nut-client.py -debian/tmp/usr/share/augeas/lenses/nuthostsconf.aug -debian/tmp/usr/share/augeas/lenses/nutnutconf.aug -debian/tmp/usr/share/augeas/lenses/nutupsconf.aug -debian/tmp/usr/share/augeas/lenses/nutupsdconf.aug -debian/tmp/usr/share/augeas/lenses/nutupsdusers.aug -debian/tmp/usr/share/augeas/lenses/nutupsmonconf.aug -debian/tmp/usr/share/augeas/lenses/nutupsschedconf.aug -debian/tmp/usr/share/augeas/lenses/nutupssetconf.aug -debian/tmp/usr/share/augeas/lenses/tests/test_nut.aug -debian/tmp/usr/share/bash-completion/completions/nut diff --git a/debian/nut-client.links b/debian/nut-client.links deleted file mode 100644 index c8d27c5..0000000 --- a/debian/nut-client.links +++ /dev/null @@ -1 +0,0 @@ -etc/init.d/nut-client etc/init.d/ups-monitor diff --git a/debian/nut-client.lintian-overrides b/debian/nut-client.lintian-overrides deleted file mode 100644 index 4651289..0000000 --- a/debian/nut-client.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -nut-client: script-in-etc-init.d-not-registered-via-update-rc.d diff --git a/debian/nut-client.maintscript b/debian/nut-client.maintscript deleted file mode 100644 index 692b715..0000000 --- a/debian/nut-client.maintscript +++ /dev/null @@ -1 +0,0 @@ -rm_conffile /etc/bash_completion.d/nut 2.7.1-1~ diff --git a/debian/nut-client.postinst b/debian/nut-client.postinst deleted file mode 100644 index 86afb5c..0000000 --- a/debian/nut-client.postinst +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -e - -handle_start_failure () { -# The nut client part (upsmon) must run in all cases except when MODE in -# /etc/nut/nut.conf is set to "none" or not set at all. - [ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf - if [ -d /run/systemd/system ] && [ "$MODE" = "none" -o -z "$MODE" ]; then - return 0 - else - return 1 - fi -} - -case "$1" in - - configure) - - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # make sure that conffiles are secured and have the correct ownerships - # on first install - if [ -z "$2" ] ; then - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi - for file in nut.conf upsmon.conf upssched.conf ; do - if [ -f /etc/nut/$file ] ; then - chown root:nut /etc/nut/$file - chmod 640 /etc/nut/$file - fi - done - fi - - # make sure that /run/nut exists and has the correct ownerships - if [ ! -d /run/nut ] ; then - mkdir -p /run/nut - fi - if [ -d /run/nut ] ; then - chown root:nut /run/nut - chmod 770 /run/nut - if which restorecon >/dev/null 2>&1; then - restorecon /run/nut - fi - fi - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - # do nothing - ;; - - *) - echo "$0: incorrect arguments: $*" >&2 - exit 1 - ;; - -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-client.postrm b/debian/nut-client.postrm deleted file mode 100644 index 0de3f0c..0000000 --- a/debian/nut-client.postrm +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -case "$1" in - remove) - [ -d /run/nut ] && rmdir --ignore-fail-on-non-empty /run/nut >/dev/null 2>&1 - ;; - purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-client.prerm b/debian/nut-client.prerm deleted file mode 100644 index e45a69b..0000000 --- a/debian/nut-client.prerm +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -handle_start_failure () { -# The MODE defined in /etc/nut/nut.conf shouldn't affect the exit code when the -# daemon is stopped. If it fails to stop, the maintainer script should fail -# too. - return 1 -} - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-client.tmpfile b/debian/nut-client.tmpfile deleted file mode 100644 index bf195cf..0000000 --- a/debian/nut-client.tmpfile +++ /dev/null @@ -1 +0,0 @@ -d /run/nut 0770 root nut - - diff --git a/debian/nut-doc.doc-base.nut-developer-guide b/debian/nut-doc.doc-base.nut-developer-guide deleted file mode 100644 index ed3ad0d..0000000 --- a/debian/nut-doc.doc-base.nut-developer-guide +++ /dev/null @@ -1,13 +0,0 @@ -Document: nut-developer-guide -Title: Network UPS Tools Developer Guide -Author: Russell Kroll, Arnaud Quette, Charles Lepple and Peter Selinger -Abstract: This document intend to describe how NUT is designed, - and the way to develop new device drivers and client applications. -Section: Programming - -Format: PDF -Files: /usr/share/doc/nut-doc/pdf/developer-guide.pdf - -Format: HTML -Index: /usr/share/doc/nut-doc/html/developer-guide/index.html -Files: /usr/share/doc/nut-doc/html/developer-guide/*.html diff --git a/debian/nut-doc.doc-base.nut-faq b/debian/nut-doc.doc-base.nut-faq deleted file mode 100644 index 098042f..0000000 --- a/debian/nut-doc.doc-base.nut-faq +++ /dev/null @@ -1,12 +0,0 @@ -Document: nut-faq -Title: NUT Frequently asked questions -Author: Arnaud Quette -Abstract: Frequently asked questions for Network UPS Tools (NUT) -Section: Help/FAQ - -Format: PDF -Files: /usr/share/doc/nut-doc/pdf/FAQ.pdf - -Format: HTML -Index: /usr/share/doc/nut-doc/html/FAQ.html -Files: /usr/share/doc/nut-doc/html/FAQ.html diff --git a/debian/nut-doc.doc-base.nut-packager-guide b/debian/nut-doc.doc-base.nut-packager-guide deleted file mode 100644 index 61d6b46..0000000 --- a/debian/nut-doc.doc-base.nut-packager-guide +++ /dev/null @@ -1,15 +0,0 @@ -Document: nut-packager-guide -Title: NUT Packager and Integrators Guide -Author: Arnaud Quette -Abstract: Packaging is a final aim for software. - It eases and completes the software integration into an OS, - and allows users to have an easy software installation and support out of the box. - This document describes best practice for packaging NUT. -Section: Debian - -Format: PDF -Files: /usr/share/doc/nut-doc/pdf/packager-guide.pdf - -Format: HTML -Index: /usr/share/doc/nut-doc/html/packager-guide/index.html -Files: /usr/share/doc/nut-doc/html/packager-guide/*.html diff --git a/debian/nut-doc.doc-base.nut-user-manual b/debian/nut-doc.doc-base.nut-user-manual deleted file mode 100644 index 76db720..0000000 --- a/debian/nut-doc.doc-base.nut-user-manual +++ /dev/null @@ -1,15 +0,0 @@ -Document: nut-user-manual -Title: Network UPS Tools User Manual -Author: Russell Kroll, Arnaud Quette and Arjen de Korte -Abstract: This document intend to describe how to install software support - for your Power Devices (UPS, PDU, …), and how to use the NUT project. - It is not intended to explain what are, nor distinguish the different technologies that exist. - For such information, have a look at the General Power Devices Information. -Section: System/Administration - -Format: PDF -Files: /usr/share/doc/nut-doc/pdf/user-manual.pdf - -Format: HTML -Index: /usr/share/doc/nut-doc/html/user-manual/index.html -Files: /usr/share/doc/nut-doc/html/user-manual/*.html diff --git a/debian/nut-doc.install b/debian/nut-doc.install deleted file mode 100644 index e3f78fa..0000000 --- a/debian/nut-doc.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/share/doc/nut-doc/ diff --git a/debian/nut-ipmi.install b/debian/nut-ipmi.install deleted file mode 100644 index c74216c..0000000 --- a/debian/nut-ipmi.install +++ /dev/null @@ -1,2 +0,0 @@ -debian/tmp/*/udev/rules.d/52-nut-ipmipsu.rules -debian/tmp/lib/nut/nut-ipmipsu diff --git a/debian/nut-monitor.install b/debian/nut-monitor.install deleted file mode 100644 index 785f17e..0000000 --- a/debian/nut-monitor.install +++ /dev/null @@ -1,9 +0,0 @@ -debian/local/nut-monitor.png usr/share/icons/hicolor/256x256/apps/ -debian/local/nut-monitor.svg usr/share/icons/hicolor/scalable/apps/ -scripts/python/app/NUT-Monitor usr/bin/ -scripts/python/app/gui-*.glade usr/share/nut-monitor/ -scripts/python/app/locale/ usr/share/ -scripts/python/app/nut-monitor.appdata.xml usr/share/metainfo/ -scripts/python/app/nut-monitor.desktop usr/share/applications/ -scripts/python/app/nut-monitor.png usr/share/icons/hicolor/48x48/apps/ -scripts/python/app/pixmaps usr/share/nut-monitor/ diff --git a/debian/nut-powerman-pdu.install b/debian/nut-powerman-pdu.install deleted file mode 100644 index f0acaa4..0000000 --- a/debian/nut-powerman-pdu.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/lib/nut/powerman-pdu diff --git a/debian/nut-server.dirs b/debian/nut-server.dirs deleted file mode 100644 index a805311..0000000 --- a/debian/nut-server.dirs +++ /dev/null @@ -1 +0,0 @@ -/var/lib/nut diff --git a/debian/nut-server.init b/debian/nut-server.init deleted file mode 100644 index a222747..0000000 --- a/debian/nut-server.init +++ /dev/null @@ -1,179 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: nut-server upsd -# Required-Start: $local_fs $syslog $network $remote_fs udev -# Required-Stop: $local_fs $syslog $network $remote_fs udev -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Network UPS Tools initscript -# Description: This script take care of starting and stopping the -# Network UPS Tools components. When needed, it also -# handle the UPS hardware shutdown. -### END INIT INFO - -# Author: Arnaud Quette - -PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin - -NAME=nut-server -DESC="NUT - power devices information server and drivers" -CONFIG=/etc/nut/nut.conf -pid_dir=/run/nut -upsd_pid=${pid_dir}/upsd.pid -upsd=/sbin/upsd -upsdrvctl=/sbin/upsdrvctl -log=">/dev/null 2>/dev/null" - -# Define LSB log_* functions. -# Depend on lsb-base (>= 3.0-6) to ensure that this file is present. -. /lib/lsb/init-functions - -# set upsd specific options. use "man upsd" for more info -# this parameter is now located in nut.conf, and not in /etc/default/nut anymore -# FIXME: retrieved from 'nut' script during update -UPSD_OPTIONS="" - -# Exit if the package is not installed -[ -x "$upsd" ] || exit 0 - -# Include NUT nut.conf -[ -r $CONFIG ] && . $CONFIG - -# Explicitly require the configuration to be done in /etc/nut/nut.conf -# redundant with nut-client -if [ "x$MODE" = "xnone" -o -z "$MODE" ] ; then - log_action_msg "$NAME disabled, please adjust the configuration to your needs" - log_action_msg "Then set MODE to a suitable value in $CONFIG to enable it" - # exit success to avoid breaking the install process! - exit 0 -fi - -# Check if /run/nut exists and has the correct perms -check_var_directory() { - [ ! -d ${pid_dir} ] && mkdir -p ${pid_dir} \ - && chown root:nut ${pid_dir} \ - && chmod 770 ${pid_dir} \ - && [ -x /sbin/restorecon ] && /sbin/restorecon ${pid_dir} -} - -# check if the right components are running -check_status() { - case "$MODE" in - standalone|netserver) - status_of_proc -p $upsd_pid $upsd upsd - # FIXME: need driver(s) status too! - ;; - none|netclient|*) - # defered to nut-client - #status_of_proc -p $upsmon_pid $upsmon upsmon - ;; - esac -} - -start_stop_server () { - case "$MODE" in - standalone|netserver) - case "$1" in - start) - # First, start driver(s) - ! $upsdrvctl start >/dev/null 2>&1 && \ - log_progress_msg " (driver(s) failed)." || log_progress_msg " driver(s)." - # Then, data server (upsd) - start-stop-daemon -S -p $upsd_pid -x $upsd \ - -- $UPSD_OPTIONS >/dev/null 2>&1 && - log_progress_msg "upsd" || log_progress_msg "(upsd failed)" - ;; - stop) - # FIXME: should stop nut-client first! - # Reverse order for stop - start-stop-daemon -K -o -p $upsd_pid -n upsd && #>/dev/null 2>&1 && - log_progress_msg "upsd" || log_progress_msg "(upsd failed)" - ! /sbin/upsdrvctl stop >/dev/null 2>&1 && \ - log_progress_msg "(driver(s) failed)" || log_progress_msg "driver(s)" - ;; - esac - ;; - none|netclient|*) - # now handled by nut-client - return 1 - ;; - esac -} - -case "$1" in - - start) - log_daemon_msg "Starting $DESC" - check_var_directory - start_stop_server start #&& log_progress_msg "upsd" - #start_stop_client start && log_progress_msg "upsmon" - log_end_msg 0 - ;; - - stop) - log_daemon_msg "Stopping $DESC" - start_stop_server stop #&& log_progress_msg "upsd" - #start_stop_client stop && log_progress_msg "upsmon" - log_end_msg 0 - ;; - - reload) - $upsd -c reload >/dev/null 2>&1 - #$upsmon -c reload >/dev/null 2>&1 - ;; - - restart|force-reload) - log_daemon_msg "Restarting $DESC" - #start_stop_client stop - start_stop_server stop - sleep 5 - check_var_directory - start_stop_server start #&& log_progress_msg "upsd" - #start_stop_client start && log_progress_msg "upsmon" - log_end_msg 0 - ;; - - status) - #log_daemon_msg "Checking status of $DESC" - echo "Checking status of $DESC" - check_status - exit $? - ;; - - poweroff) - wait_delay=`sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' /etc/nut/nut.conf` - # UPS poweroff action is actually done here. - # But nut-monitor (Ie nut-client) does the check and call nut-server if needed! - # This action MUST NOT be called directly, and thus is not exposed in 'Usage' - case "$MODE" in - standalone|netserver) - log_daemon_msg "Shutting down the UPS ..." - if $upsdrvctl shutdown ; then - # FIXME (needed?): sleep 5 - log_progress_msg "Waiting for UPS to cut the power" - log_end_msg 0 - else - log_progress_msg "Shutdown failed." - log_progress_msg "Waiting for UPS batteries to run down" - log_end_msg 0 - fi - if [ -n "$wait_delay" ] ; then - log_daemon_msg " (will reboot after $wait_delay) ..." - sleep "$wait_delay" - invoke-rc.d reboot stop - fi - ;; - none|netclient|*) - # nothing to do - ;; - esac - ;; - - *) - N=/etc/init.d/$NAME - echo "Usage: $N {start|stop|reload|restart|force-reload|status}" >&2 - exit 1 - ;; -esac - -exit 0 diff --git a/debian/nut-server.install b/debian/nut-server.install deleted file mode 100644 index 51591c7..0000000 --- a/debian/nut-server.install +++ /dev/null @@ -1,66 +0,0 @@ -debian/tmp/*/udev/rules.d/62-nut-usbups.rules -debian/tmp/bin/nut-scanner -debian/tmp/etc/avahi/services/nut.service -debian/tmp/etc/nut/ups.conf -debian/tmp/etc/nut/upsd.conf -debian/tmp/etc/nut/upsd.users -debian/tmp/lib/nut/al175 -debian/tmp/lib/nut/apcsmart -debian/tmp/lib/nut/apcsmart-old -debian/tmp/lib/nut/apcupsd-ups -debian/tmp/lib/nut/bcmxcp -debian/tmp/lib/nut/bcmxcp_usb -debian/tmp/lib/nut/belkin -debian/tmp/lib/nut/belkinunv -debian/tmp/lib/nut/bestfcom -debian/tmp/lib/nut/bestfortress -debian/tmp/lib/nut/bestuferrups -debian/tmp/lib/nut/bestups -debian/tmp/lib/nut/blazer_ser -debian/tmp/lib/nut/blazer_usb -debian/tmp/lib/nut/clone -debian/tmp/lib/nut/clone-outlet -debian/tmp/lib/nut/dummy-ups -debian/tmp/lib/nut/etapro -debian/tmp/lib/nut/everups -debian/tmp/lib/nut/gamatronic -debian/tmp/lib/nut/genericups -debian/tmp/lib/nut/isbmex -debian/tmp/lib/nut/ivtscd -debian/tmp/lib/nut/liebert -debian/tmp/lib/nut/liebert-esp2 -debian/tmp/lib/nut/masterguard -debian/tmp/lib/nut/metasys -debian/tmp/lib/nut/mge-shut -debian/tmp/lib/nut/mge-utalk -debian/tmp/lib/nut/microdowell -debian/tmp/lib/nut/nutdrv_atcl_usb -debian/tmp/lib/nut/nutdrv_qx -debian/tmp/lib/nut/oneac -debian/tmp/lib/nut/optiups -debian/tmp/lib/nut/powercom -debian/tmp/lib/nut/powerpanel -debian/tmp/lib/nut/rhino -debian/tmp/lib/nut/richcomm_usb -debian/tmp/lib/nut/riello_ser -debian/tmp/lib/nut/riello_usb -debian/tmp/lib/nut/safenet -debian/tmp/lib/nut/solis -debian/tmp/lib/nut/tripplite -debian/tmp/lib/nut/tripplite_usb -debian/tmp/lib/nut/tripplitesu -debian/tmp/lib/nut/upscode2 -debian/tmp/lib/nut/upsd -debian/tmp/lib/nut/usbhid-ups -debian/tmp/lib/nut/victronups -debian/tmp/lib/systemd/system-shutdown/nutshutdown -debian/tmp/lib/systemd/system/nut-driver\@.service -debian/tmp/lib/systemd/system/nut-driver.target -debian/tmp/lib/systemd/system/nut-driver-enumerator.service -debian/tmp/lib/systemd/system/nut-driver-enumerator.path -debian/tmp/lib/systemd/system/nut-server.service -debian/tmp/sbin/upsd -debian/tmp/sbin/upsdrvctl -debian/tmp/usr/share/apport/package-hooks/source_nut-server.py -debian/tmp/usr/share/nut/cmdvartab -debian/tmp/usr/share/nut/driver.list diff --git a/debian/nut-server.lintian-overrides b/debian/nut-server.lintian-overrides deleted file mode 100644 index c46715e..0000000 --- a/debian/nut-server.lintian-overrides +++ /dev/null @@ -1,4 +0,0 @@ -# SUBSYSTEM is tested at the begining of the file -nut-server: udev-rule-missing-subsystem lib/udev/rules.d/62-nut-usbups.rules:* -# In LSB world, the drivers are started by nut-server initscript -nut-server: package-supports-alternative-init-but-no-init.d-script lib/systemd/system/nut-driver.service diff --git a/debian/nut-server.postinst b/debian/nut-server.postinst deleted file mode 100644 index 41b1d08..0000000 --- a/debian/nut-server.postinst +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -e - -handle_start_failure () { -# The nut server part (upsd) must run in all cases except when MODE in -# /etc/nut/nut.conf is set to "none", not set at all or if the machine is a -# client. - [ -r /etc/nut/nut.conf ] && . /etc/nut/nut.conf - if [ -d /run/systemd/system ] \ - && [ "$MODE" = "none" -o "$MODE" = "netclient" -o -z "$MODE" ]; then - return 0 - else - return 1 - fi -} - -case "$1" in - - configure) - - # make sure the nut user exists and has correct memberships - if ! getent group nut >/dev/null; then - addgroup --quiet --system nut - fi - if ! getent passwd nut >/dev/null; then - adduser --quiet --system --ingroup nut --home /var/lib/nut --no-create-home nut - elif ! groups nut | grep -qw nut; then - adduser nut nut - fi -# for Ubuntu, while waiting for a proper debconf -# if ! groups nut | grep -qw dialout; then -# adduser nut dialout -# fi - - # make sure that conffiles are secured and have the correct ownerships - # on first install - if [ -z "$2" ] ; then - if [ -d /etc/nut/ ] ; then - chown root:nut /etc/nut/ - fi - for file in ups.conf upsd.conf upsd.users ; do - if [ -f /etc/nut/$file ] ; then - chown root:nut /etc/nut/$file - chmod 640 /etc/nut/$file - fi - done - fi - - # make sure that /run/nut exists and has the correct ownerships - if [ ! -d /run/nut ] ; then - mkdir -p /run/nut - fi - if [ -d /run/nut ] ; then - chown root:nut /run/nut - chmod 770 /run/nut - if which restorecon >/dev/null 2>&1; then - restorecon /run/nut - fi - fi - - # make sure that /var/lib/nut has the correct permissions and ownerships - if [ -d /var/lib/nut ] ; then - chown root:nut /var/lib/nut - chmod 770 /var/lib/nut - fi - - # ask udev to check for new udev rules - [ -x /etc/init.d/udev ] && pidof systemd-udevd > /dev/null \ - && udevadm trigger --subsystem-match=usb --action=change - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - # do nothing - ;; - - *) - echo "$0: incorrect arguments: $*" >&2 - exit 1 - ;; - -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-server.postrm b/debian/nut-server.postrm deleted file mode 100644 index 0de3f0c..0000000 --- a/debian/nut-server.postrm +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -case "$1" in - remove) - [ -d /run/nut ] && rmdir --ignore-fail-on-non-empty /run/nut >/dev/null 2>&1 - ;; - purge|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postrm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-server.prerm b/debian/nut-server.prerm deleted file mode 100644 index e45a69b..0000000 --- a/debian/nut-server.prerm +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -set -e - -handle_start_failure () { -# The MODE defined in /etc/nut/nut.conf shouldn't affect the exit code when the -# daemon is stopped. If it fails to stop, the maintainer script should fail -# too. - return 1 -} - -#DEBHELPER# - -exit 0 diff --git a/debian/nut-server.tmpfile b/debian/nut-server.tmpfile deleted file mode 100644 index bf195cf..0000000 --- a/debian/nut-server.tmpfile +++ /dev/null @@ -1 +0,0 @@ -d /run/nut 0770 root nut - - diff --git a/debian/nut-snmp.docs b/debian/nut-snmp.docs deleted file mode 100644 index 9611f52..0000000 --- a/debian/nut-snmp.docs +++ /dev/null @@ -1 +0,0 @@ -docs/snmp.txt diff --git a/debian/nut-snmp.install b/debian/nut-snmp.install deleted file mode 100644 index 02dee18..0000000 --- a/debian/nut-snmp.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/lib/nut/snmp-ups diff --git a/debian/nut-xml.install b/debian/nut-xml.install deleted file mode 100644 index 9c6d56d..0000000 --- a/debian/nut-xml.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/lib/nut/netxml-ups diff --git a/debian/nut.README.Debian b/debian/nut.README.Debian deleted file mode 100644 index 882e2af..0000000 --- a/debian/nut.README.Debian +++ /dev/null @@ -1,162 +0,0 @@ -Network UPS Tools - Quick Start for Debian ------------------------------------------- - -Anyway, here are the quick start instructions for using nut: - -These Quick Start instructions are useful for a UPS connected to a single -machine. For a UPS connected to multiple machines, additional steps must be -taken, as outlined at the end of this file, including the notice regarding -SECURITY CONSIDERATIONS. - -(I) Upgrading -============= - -In case of upgrading, follow instructions given in: -/usr/share/doc/nut/UPGRADING - -Note that service(s) (driver(s), upsd, upsmon) are not restarted upon -upgrade, to avoid service disruption. You have to manually do it. - -(II) Installation -================= - -Configuration files are located in /etc/nut/ -In order to tune NUT configuration according to your needs, follow the below -information, along with the one provided inside these files. - -(1) /etc/nut/nut.conf (see 'man 5 nut.conf' for more information) - Edit /etc/nut/nut.conf and modify the "MODE" variable according to your - configuration. - - You can also fine tune the daemons options through UPSD_OPTIONS and - UPSMON_OPTIONS. - -The steps 2 to 5 are only required if you use a "standalone" or "netserver" -MODE. If you are running in "netclient" MODE, jump directly to section 6. - -(2) /etc/nut/ups.conf (see 'man 5 ups.conf' for more information) - - Edit /etc/nut/ups.conf and add something like: - [myups] - driver = usbhid-ups - port = auto - Use the appropriate driver for your UPS and select the correct port. - To select the driver, take a look at the UPS compatibility list: - /usr/share/nut/driver.list - - If you have more than one UPS, add as many entries as needed. - - If you wish to test manually whether your configuration of ups.conf is - correct, you may invoke upsdrvctl by hand (as root): - /sbin/upsdrvctl start [myups] - /sbin/upsdrvctl stop [myups] - - Ensure that the permissions of ups.conf do not permit the world to - read it. It should already be thus, but the following command - accomplishes this: - chown root:nut /etc/nut/ups.conf - chmod 640 /etc/nut/ups.conf - -(3) device port permissions - The nut user need to be able to access the device port both for reading and - writing. - - For serial devices, there are two possibilities: - - a) You can add the nut user to the dialout group. - The following command accomplishes this: - addgroup nut dialout - - This is not done by default for security reason on Debian, but is applied - on Ubuntu. - - b) Another solution, for system supporting udev, is to create a file, - For example /etc/udev/rules.d/92-nut-serialups.rules. It will - be used after /lib/udev/rules.d/91-permissions.rules, and - contains something like: - - KERNEL=="ttyS1", GROUP="nut" - - where 'ttyS1' has to be replaced by the exact name of your serial port. - - For USB devices, permissions are automatically set by the - /lib/udev/rules.d/52-nut-usbups.rules udev rules file. - -(4) /etc/nut/upsd.conf (see 'man 5 upsd.conf' for more information) - the default /etc/nut/upsd.conf is fine for a "standalone" configuration. - If you are in "netserver" MODE, you will have to modify the LISTEN option - to something suitable. - - Ensure that the permissions of upsd.conf do not permit the world to - read it. It should already be thus, but the following command - accomplishes this: - chown root:nut /etc/nut/upsd.conf - chmod 640 /etc/nut/upsd.conf - -(5) /etc/nut/upsd.users (see 'man 5 upsd.users' for more information) - Edit /etc/nut/upsd.users and add something like the following, - without the comments, in order to define a user: - [monmaster] - password = blah - upsmon master - Please use *different* usernames and passwords than you use on your - system; see the note regarding SECURITY CONSIDERATIONS at the end - of this file. - - Ensure that the permissions of upsd.users do not permit the world to - read it. It should already be thus, but the following command - accomplishes this: - chown root:nut /etc/nut/upsd.users - chmod 640 /etc/nut/upsd.users - -(6) /etc/nut/upsmon.conf (see 'man 5 upsmon.conf' for more information) - Edit /etc/nut/upsmon.conf and add something like the following: - MONITOR myups@localhost 1 monmaster blah master - POWERDOWNFLAG /etc/killpower - SHUTDOWNCMD "/sbin/shutdown -h +0" - - Ensure that the permissions of upsmon.conf do not permit the world to - read it. It should already be thus, but the following commands - accomplishes this: - chown root:nut /etc/nut/upsmon.conf - chmod 640 /etc/nut/upsmon.conf - -(7) /etc/default/nut - This file is not used anymore. - nut.conf provides all the needed features to replace this file. - -(8) start the daemon - If you use a "standalone" or "netserver" MODE, invoke: - - '/etc/init.d/nut-server start' to start upsd and appropriate driver(s), - - '/etc/init.d/nut-client start' to start upsmon. - - If you are running in "netclient" MODE, invoke: - - '/etc/init.d/nut-client start' to start upsmon. - - Check /var/log/syslog to ensure that daemon(s) started up correctly. - - -Additional Notes for Sharing a UPS ----------------------------------- -If you have multiple machines connected to the same UPS, you will need to -(a) modify the access control lists in upsd.conf on the server; -(b) add additional users to upsd.users on the server; and -(c) configure upsmon.conf on the clients. - -Please note that upsmon on a client machine and upsd on a server machine need -to communicate via your network. This means that you need to ensure that all -the networking equipment (hub, switch, router, etc.) between the client and the -server is powered by the UPS. Otherwise, when the power goes down, the network -connection between the client machine will be broken and the client will not -be told to shut down. - -SECURITY CONSIDERATIONS ------------------------ -Finally, please be aware of the following SECURITY CONSIDERATIONS: the TCP -communications between the client daemon, upsmon, and the server daemon, upsd, -send the username and passwords defined in upsd.users and used in upsmon.conf -over the wire UNENCRYPTED. This means that somebody could sniff the username -and password. A version that encrypts the connection using SSL should be -available someday. - -Please see the documentation in /usr/share/doc/nut/docs for more information. diff --git a/debian/nut.TODO.Debian b/debian/nut.TODO.Debian deleted file mode 100644 index b8fe9dd..0000000 --- a/debian/nut.TODO.Debian +++ /dev/null @@ -1,9 +0,0 @@ -- how to distribute the nut-scanner and its library? Ie, a single package, - or using the nut-{xml,snmp,...} packages. - this requires libusb (0.1), Net SNMP, FreeIPMi, Avahi, libupsclient and Neon! -- consider an SSL/TLS set of packages (ie nut-ssl, ...) - or help the port to NSS -- install the device-recorder.sh script (with libupsclient-dev or a more - generic nut-dev that depends?) -- address the /var/www issue with upstream -- audit and solve the lintian reports... diff --git a/debian/nut.docs b/debian/nut.docs deleted file mode 100644 index af234cf..0000000 --- a/debian/nut.docs +++ /dev/null @@ -1,18 +0,0 @@ -AUTHORS -MAINTAINERS -README -UPGRADING -docs/FAQ.txt -docs/acknowledgements.txt -docs/config-notes.txt -docs/documentation.txt -docs/download.txt -docs/features.txt -docs/history.txt -docs/nut-names.txt -docs/outlets.txt -docs/packager-guide.txt -docs/scheduling.txt -docs/security.txt -docs/support.txt -docs/user-manual.txt diff --git a/debian/nut.install b/debian/nut.install deleted file mode 100644 index 281f143..0000000 --- a/debian/nut.install +++ /dev/null @@ -1 +0,0 @@ -debian/tmp/usr/share/apport/package-hooks/source_nut.py diff --git a/debian/patches/0001-reproductible-build.patch b/debian/patches/0001-reproductible-build.patch deleted file mode 100644 index 2d7d7d6..0000000 --- a/debian/patches/0001-reproductible-build.patch +++ /dev/null @@ -1,41 +0,0 @@ -Description: Make the documentation reproductible -Author: Laurent Bigonville -Last-Update: 2019-07-28 - ---- a/docs/Makefile.am -+++ b/docs/Makefile.am -@@ -92,8 +92,8 @@ packager-guide.html packager-guide.chunk - # $ ASCIIDOC_VERBOSE=-v make - A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) --attribute icons \ - --xsltproc-opts "--nonet" \ -- --xsltproc-opts "--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \ -- --xsltproc-opts "--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \ -+ --xsltproc-opts "--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d -d @$(SOURCE_DATE_EPOCH)`\"" \ -+ --xsltproc-opts "--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S -d @$(SOURCE_DATE_EPOCH)`\"" \ - --xsltproc-opts "--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \ - --attribute iconsdir=$(srcdir)/images \ - --attribute=badges \ ---- a/configure.ac -+++ b/configure.ac -@@ -1211,7 +1211,7 @@ LIBDIR=${conftemp} - AC_DEFINE_UNQUOTED(LIBDIR, "${conftemp}", [Default path for system libraries]) - - dnl Current date --now=`TZ=UTC date +%Y-%m-%d` -+now=`TZ=UTC date +%Y-%m-%d -d @${SOURCE_DATE_EPOCH}` - - AC_SUBST(now) - AC_SUBST(OS_NAME) ---- a/docs/man/Makefile.am -+++ b/docs/man/Makefile.am -@@ -591,8 +591,8 @@ if HAVE_ASCIIDOC - - .txt.html: - $(ASCIIDOC) --backend=xhtml11 \ -- --attribute localdate=`TZ=UTC date +%Y-%m-%d` \ -- --attribute localtime=`TZ=UTC date +%H:%M:%S` \ -+ --attribute localdate=`TZ=UTC date +%Y-%m-%d -d @$(SOURCE_DATE_EPOCH)` \ -+ --attribute localtime=`TZ=UTC date +%H:%M:%S -d @$(SOURCE_DATE_EPOCH)` \ - --attribute nutversion="@PACKAGE_VERSION@" \ - -o $@ $< - diff --git a/debian/patches/0002-nut-monitor-paths.patch b/debian/patches/0002-nut-monitor-paths.patch deleted file mode 100644 index 88294d6..0000000 --- a/debian/patches/0002-nut-monitor-paths.patch +++ /dev/null @@ -1,48 +0,0 @@ ---- a/scripts/python/app/NUT-Monitor -+++ b/scripts/python/app/NUT-Monitor -@@ -76,7 +76,7 @@ class interface : - ( cmd_opts, args ) = opt_parser.parse_args() - - -- self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "gui-1.3.glade" ) -+ self.__glade_file = '/usr/share/nut-monitor/gui-1.3.glade' - - self.__widgets["interface"] = gtk.glade.XML( self.__glade_file, "window1", APP ) - self.__widgets["main_window"] = self.__widgets["interface"].get_widget("window1") -@@ -109,11 +109,11 @@ class interface : - - # Create the tray icon and connect it to the show/hide method... - self.__widgets["status_icon"] = gtk.StatusIcon() -- self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) ) -+ self.__widgets["status_icon"].set_from_file( "/usr/share/nut-monitor/pixmaps/on_line.png" ) - self.__widgets["status_icon"].set_visible( True ) - self.__widgets["status_icon"].connect( "activate", self.tray_activated ) - -- self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "on_line.png" ) ) -+ self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut-monitor/pixmaps/on_line.png" ) - - # Define interface callbacks actions - self.__callbacks = { "on_window1_destroy" : self.quit, -@@ -271,8 +271,8 @@ class interface : - #------------------------------------------------------------------- - # Change the status icon and tray icon - def change_status_icon( self, icon="on_line", blink=False ) : -- self.__widgets["status_icon"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) ) -- self.__widgets["ups_status_image"].set_from_file( os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "%s.png" % icon ) ) -+ self.__widgets["status_icon"].set_from_file( "/usr/share/nut-monitor/pixmaps/%s.png" % icon ) -+ self.__widgets["ups_status_image"].set_from_file( "/usr/share/nut-monitor/pixmaps/%s.png" % icon ) - self.__widgets["status_icon"].set_blinking( blink ) - - #------------------------------------------------------------------- -@@ -728,9 +728,9 @@ class interface : - - for k,v in vars.iteritems() : - if ( rwvars.has_key( k ) ) : -- icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-rw.png" ) -+ icon_file = "/usr/share/nut-monitor/pixmaps/var-rw.png" - else : -- icon_file = os.path.join( os.path.dirname( sys.argv[0] ), "pixmaps", "var-ro.png" ) -+ icon_file = "/usr/share/nut-monitor/pixmaps/var-ro.png" - - icon = gtk.gdk.pixbuf_new_from_file( icon_file ) - self.__widgets["ups_vars_tree_store"].append( [ icon, k, v ] ) diff --git a/debian/patches/0003-install-dev-files-in-usr.patch b/debian/patches/0003-install-dev-files-in-usr.patch deleted file mode 100644 index c193dc8..0000000 --- a/debian/patches/0003-install-dev-files-in-usr.patch +++ /dev/null @@ -1,28 +0,0 @@ -Description: Adjust .pc paths to install development files to /usr -Author: Laurent Bigonville -Forwarded: not-needed - ---- a/lib/libnutscan.pc.in -+++ b/lib/libnutscan.pc.in -@@ -1,4 +1,4 @@ --prefix=@prefix@ -+prefix=/usr - exec_prefix=@exec_prefix@ - libdir=@libdir@ - includedir=@includedir@ ---- a/lib/libupsclient.pc.in -+++ b/lib/libupsclient.pc.in -@@ -1,4 +1,4 @@ --prefix=@prefix@ -+prefix=/usr - exec_prefix=@exec_prefix@ - libdir=@libdir@ - includedir=@includedir@ ---- a/lib/libnutclient.pc.in -+++ b/lib/libnutclient.pc.in -@@ -1,4 +1,4 @@ --prefix=@prefix@ -+prefix=/usr - exec_prefix=@exec_prefix@ - libdir=@libdir@ - includedir=@includedir@ diff --git a/debian/patches/0004-fix-systemd-service.patch b/debian/patches/0004-fix-systemd-service.patch deleted file mode 100644 index 16df1c7..0000000 --- a/debian/patches/0004-fix-systemd-service.patch +++ /dev/null @@ -1,15 +0,0 @@ -Subject: Fix systemd service file for Debian -From: Laurent Bigonville -Forwarded: not-needed - ---- a/scripts/systemd/nut-driver.service.in -+++ b/scripts/systemd/nut-driver.service.in -@@ -1,6 +1,7 @@ - [Unit] - Description=Network UPS Tools - power device driver controller --After=local-fs.target network.target -+After=local-fs.target network.target systemd-udev-settle.service -+Wants=systemd-udev-settle.service - StopWhenUnneeded=yes - - [Service] diff --git a/debian/patches/0006-ups-conf-maxretry.patch b/debian/patches/0006-ups-conf-maxretry.patch deleted file mode 100644 index 7cf8932..0000000 --- a/debian/patches/0006-ups-conf-maxretry.patch +++ /dev/null @@ -1,45 +0,0 @@ -From ad7c2ed213e002bd16678c0d8de30b5e8b186a22 Mon Sep 17 00:00:00 2001 -From: Jim Klimov -Date: Sat, 28 Jan 2017 00:52:35 +0100 -Subject: [PATCH] Document and pre-set the "maxretry" option in ups.conf.sample - ---- - conf/ups.conf.sample | 21 +++++++++++++++++++++ - 1 file changed, 21 insertions(+) - -diff --git a/conf/ups.conf.sample b/conf/ups.conf.sample -index d8faef207..3ea13548b 100644 ---- a/conf/ups.conf.sample -+++ b/conf/ups.conf.sample -@@ -40,6 +40,24 @@ - # - # Configuration directives - # ------------------------ -+# -+# These directives are used by upsdrvctl only and should be specified outside -+# of a driver definition: -+# -+# maxretry: Optional. Specify the number of attempts to start the driver(s), -+# in case of failure, before giving up. A delay of 'retrydelay' is -+# inserted between each attempt. Caution should be taken when using -+# this option, since it can impact the time taken by your system to -+# start. -+# -+# The default is 1 attempt. -+# -+# retrydelay: Optional. Specify the delay between each restart attempt of the -+# driver(s), as specified by 'maxretry'. Caution should be taken -+# when using this option, since it can impact the time taken by your -+# system to start. -+# -+# The default is 5 seconds. - # - # These directives are common to all drivers that support ups.conf: - # -@@ -117,3 +135,6 @@ - # - # To find out if your driver supports any extra settings, start it with - # the -h option and/or read the driver's documentation. -+ -+# Set maxretry to 3 by default, this should mitigate race with slow devices: -+maxretry = 3 diff --git a/debian/patches/0008-drop-w3c-icons.patch b/debian/patches/0008-drop-w3c-icons.patch deleted file mode 100644 index ac05a34..0000000 --- a/debian/patches/0008-drop-w3c-icons.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/conf/upsstats.html.sample -+++ b/conf/upsstats.html.sample -@@ -180,11 +180,4 @@ Network UPS Tools upsstats -
- --
--Valid CSS! -- --
-- - ---- a/conf/upsstats-single.html.sample -+++ b/conf/upsstats-single.html.sample -@@ -286,9 +286,6 @@ -
--Valid HTML 4.0 Transitional - - - diff --git a/debian/patches/0009-fix-nutshutdown-install.patch b/debian/patches/0009-fix-nutshutdown-install.patch deleted file mode 100644 index 2d35566..0000000 --- a/debian/patches/0009-fix-nutshutdown-install.patch +++ /dev/null @@ -1,76 +0,0 @@ -commit 491d088af70a67b6ed1d2a6a6711d83be71dd911 -Author: Michal Marek -Date: Mon Oct 30 21:43:45 2017 +0100 - - configure.ac: Fix systemd shutdown directory detection - - The configure script assumes that systemd is installed below ${libdir}, - which is not true on many biarch Linux distros with /lib64. Instead of - guessing, use pkg-config to find the path and provide a - --with-systemdshutdowndir option so that make distcheck can override it. - Also, rename the internal variable to systemdshutdowndir to rhyme with - the respective systemd.pc variable. - - Signed-off-by: Michal Marek - ---- a/Makefile.am -+++ b/Makefile.am -@@ -22,6 +22,7 @@ DISTCHECK_LIGHT_FLAGS = --with-all=auto - - DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \ - --with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \ -+ --with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \ - --with-hotplug-dir='$${prefix}/etc/hotplug' \ - --with-udev-dir='$${prefix}/etc/udev' \ - --with-devd-dir='$${prefix}/etc/devd' ---- a/configure.ac -+++ b/configure.ac -@@ -1062,16 +1062,24 @@ AC_ARG_WITH([systemdsystemunitdir], - ;; - esac - ], []) --dnl Override installation directory, with the local installation --dnl prefix. This is needed for 'distcheck*' targets, otherwise --dnl files will try to get intalled to the actual system directories - if test -n "${systemdsystemunitdir}"; then -- systemdsystemshutdowndir="${libdir}/systemd/system-shutdown" - AC_MSG_RESULT(using ${systemdsystemunitdir}) - else - AC_MSG_RESULT(no) - fi - AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "") -+dnl This option is only provided so that make distcheck can override it, -+dnl otherwise we ask pkg-config whenever --with-systemdsystemunitdir is -+dnl given -+AC_ARG_WITH([systemdshutdowndir], -+ AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]), -+ [systemdshutdowndir=${withval}]) -+if test -n "${systemdsystemunitdir}"; then -+ case "${systemdshutdowndir}" in -+ yes|auto|"") -+ systemdshutdowndir=`$PKG_CONFIG --variable=systemdshutdowndir systemd` -+ esac -+fi - - AC_MSG_CHECKING(whether to install hotplug rules) - AC_ARG_WITH(hotplug-dir, -@@ -1261,7 +1269,7 @@ AC_SUBST(driverexecdir) - AC_SUBST(htmldir) - AC_SUBST(pkgconfigdir) - AC_SUBST(systemdsystemunitdir) --AC_SUBST(systemdsystemshutdowndir) -+AC_SUBST(systemdshutdowndir) - AC_SUBST(hotplugdir) - AC_SUBST(udevdir) - ---- a/scripts/systemd/Makefile.am -+++ b/scripts/systemd/Makefile.am -@@ -7,7 +7,7 @@ systemdsystemunit_DATA = \ - nut-monitor.service \ - nut-server.service - --systemdsystemshutdown_SCRIPTS = nutshutdown -+systemdshutdown_SCRIPTS = nutshutdown - - else - EXTRA_DIST += nut-driver.service.in nut-monitor.service.in \ diff --git a/debian/patches/0010-fix-nutscanner-ftbfs.patch b/debian/patches/0010-fix-nutscanner-ftbfs.patch deleted file mode 100644 index 54b2615..0000000 --- a/debian/patches/0010-fix-nutscanner-ftbfs.patch +++ /dev/null @@ -1,33 +0,0 @@ -commit 5d98d5536699222bc93c58c1e6f6df43dc9bfcff -Author: Arnaud Quette -Date: Thu Mar 10 14:41:40 2016 +0100 - - Fix nut-scanner compilation in some environments - - Following the commits 5187dab (common: add some string-related functions) and - e767df5 (common: consolidate some string-related functions), the build rules of - nut-scanner were not updated to also use str.c. Since the libcommon.la - dependency was still there, some environments managed to build cleanly, while - other are failing. Update build dependencies to fix this situation - -diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am -index 558cb23b..db85c682 100644 ---- a/tools/nut-scanner/Makefile.am -+++ b/tools/nut-scanner/Makefile.am -@@ -14,14 +14,14 @@ libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ - scan_avahi.c scan_eaton_serial.c nutscan-serial.c \ - ../../drivers/serial.c \ - ../../drivers/bcmxcp_ser.c \ -- ../../common/common.c -+ ../../common/common.c ../../common/str.c - libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) - libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0 - libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers - - nut_scanner_SOURCES = nut-scanner.c - nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include --nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la -+nut_scanner_LDADD = libnutscan.la - - if WITH_SSL - libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS) diff --git a/debian/patches/0011-use-pkgconfig-module.patch b/debian/patches/0011-use-pkgconfig-module.patch deleted file mode 100644 index 2e6c7b1..0000000 --- a/debian/patches/0011-use-pkgconfig-module.patch +++ /dev/null @@ -1,112 +0,0 @@ -From cbf71dbf5d7b62de3709c31c343e0ce672af5f61 Mon Sep 17 00:00:00 2001 -From: Laurent Bigonville -Date: Tue, 9 Jul 2019 14:00:53 +0200 -Subject: [PATCH] Use pkg-config module names instead of listing the libraries - -Fixes: #709 ---- - configure.ac | 1 + - lib/libupsclient.pc.in | 5 +++-- - m4/nut_check_libnss.m4 | 5 +++++ - m4/nut_check_libopenssl.m4 | 5 +++++ - 4 files changed, 14 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index ca5212050..0bf69f566 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -1677,6 +1677,7 @@ AC_SUBST(TREE_VERSION) - AC_SUBST(NUT_NETVERSION) - AC_SUBST(LIBSSL_CFLAGS) - AC_SUBST(LIBSSL_LIBS) -+AC_SUBST(LIBSSL_REQUIRES) - AC_SUBST(LIBGD_CFLAGS) - AC_SUBST(LIBGD_LDFLAGS) - AC_SUBST(LIBNETSNMP_CFLAGS) -diff --git a/lib/libupsclient.pc.in b/lib/libupsclient.pc.in -index 4ad31fbde..8efce4020 100644 ---- a/lib/libupsclient.pc.in -+++ b/lib/libupsclient.pc.in -@@ -9,5 +9,6 @@ nutuser=@RUN_AS_USER@ - Name: libupsclient - Description: UPS monitoring with Network UPS Tools - Version: @PACKAGE_VERSION@ --Libs: -L${libdir} -lupsclient @LIBSSL_LIBS@ --Cflags: -I${includedir} @LIBSSL_CFLAGS@ -+Libs: -L${libdir} -lupsclient -+Cflags: -I${includedir} -+Requires: @LIBSSL_REQUIRES@ -diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4 -index 7c235318d..7fed727d3 100644 ---- a/m4/nut_check_libnss.m4 -+++ b/m4/nut_check_libnss.m4 -@@ -11,16 +11,19 @@ if test -z "${nut_have_libnss_seen}"; then - dnl save CFLAGS and LIBS - CFLAGS_ORIG="${CFLAGS}" - LIBS_ORIG="${LIBS}" -+ REQUIRES_ORIG="${REQUIRES}" - - AC_MSG_CHECKING(for Mozilla NSS version via pkg-config) - NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`" - if test "$?" = "0" -a -n "${NSS_VERSION}"; then - CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`" - LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`" -+ REQUIRES="nss" - else - NSS_VERSION="none" - CFLAGS="" - LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" -+ REQUIRES="nss" - fi - AC_MSG_RESULT(${NSS_VERSION} found) - -@@ -67,10 +70,12 @@ if test -z "${nut_have_libnss_seen}"; then - AC_DEFINE(WITH_NSS, 1, [Define to enable SSL support using Mozilla NSS]) - LIBSSL_CFLAGS="${CFLAGS}" - LIBSSL_LIBS="${LIBS}" -+ LIBSSL_REQUIRES="${REQUIRES}" - fi - - dnl restore original CFLAGS and LIBS - CFLAGS="${CFLAGS_ORIG}" - LIBS="${LIBS_ORIG}" -+ REQUIRES="${REQUIRES_ORIG}" - fi - ]) -diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 -index 7eb401cd9..d9e9e0237 100644 ---- a/m4/nut_check_libopenssl.m4 -+++ b/m4/nut_check_libopenssl.m4 -@@ -12,16 +12,19 @@ if test -z "${nut_have_libopenssl_seen}"; then - dnl save CFLAGS and LIBS - CFLAGS_ORIG="${CFLAGS}" - LIBS_ORIG="${LIBS}" -+ REQUIRES_ORIG="${REQUIRES}" - - AC_MSG_CHECKING(for OpenSSL version via pkg-config) - OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`" - if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then - CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`" - LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`" -+ REQUIRES="openssl" - else - OPENSSL_VERSION="none" - CFLAGS="" - LIBS="-lssl -lcrypto" -+ REQUIRES="openssl" - fi - AC_MSG_RESULT(${OPENSSL_VERSION} found) - -@@ -67,10 +70,12 @@ if test -z "${nut_have_libopenssl_seen}"; then - AC_DEFINE(WITH_OPENSSL, 1, [Define to enable SSL support using OpenSSL]) - LIBSSL_CFLAGS="${CFLAGS}" - LIBSSL_LIBS="${LIBS}" -+ LIBSSL_REQUIRES="${REQUIRES}" - fi - - dnl restore original CFLAGS and LIBS - CFLAGS="${CFLAGS_ORIG}" - LIBS="${LIBS_ORIG}" -+ REQUIRES="${REQUIRES_ORIG}" - fi - ]) diff --git a/debian/patches/0012-add-AEG-PROTECT-NAS-support.patch b/debian/patches/0012-add-AEG-PROTECT-NAS-support.patch deleted file mode 100644 index 0283f48..0000000 --- a/debian/patches/0012-add-AEG-PROTECT-NAS-support.patch +++ /dev/null @@ -1,42 +0,0 @@ -From a08a2292afc559d6dfb9eede014a941d8f6b511d Mon Sep 17 00:00:00 2001 -From: Arnaud Quette -Date: Tue, 17 May 2016 09:26:04 +0200 -Subject: [PATCH] mge-shut/usbhid-ups: list AEG PROTECT NAS vendor 06da - -AEG PROTECT NAS were previously using VendorID / ProductID 0x2b2d / 0xffff, and -are now using 0x06da / 0xffff. Also bump the mge-hid subdriver version to 1.40 ---- - drivers/mge-hid.c | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c -index a3f10afa8..26486c994 100644 ---- a/drivers/mge-hid.c -+++ b/drivers/mge-hid.c -@@ -37,7 +37,7 @@ - #include "usbhid-ups.h" - #include "mge-hid.h" - --#define MGE_HID_VERSION "MGE HID 1.39" -+#define MGE_HID_VERSION "MGE HID 1.40" - - /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ - /* Eaton */ -@@ -55,6 +55,9 @@ - /* AEG */ - #define AEG_VENDORID 0x2b2d - -+/* Phoenixtec Power Co., Ltd */ -+#define PHOENIXTEC 0x06da -+ - #ifndef SHUT_MODE - #include "usb-common.h" - -@@ -80,6 +83,7 @@ static usb_device_id_t mge_usb_device_table[] = { - - /* PROTECT B / NAS */ - { USB_DEVICE(AEG_VENDORID, 0xffff), NULL }, -+ { USB_DEVICE(PHOENIXTEC, 0xffff), NULL }, - - /* Terminating entry */ - { -1, -1, NULL } diff --git a/debian/patches/0013-fix-doc-build.patch b/debian/patches/0013-fix-doc-build.patch deleted file mode 100644 index 9aeba8c..0000000 --- a/debian/patches/0013-fix-doc-build.patch +++ /dev/null @@ -1,18 +0,0 @@ -Description: Fix the documentation build with asciidoc >= 0.9 -Author: Laurent Bigonville -Last-Update: 2019-12-15 - ---- a/docs/Makefile.am -+++ b/docs/Makefile.am -@@ -91,10 +91,7 @@ packager-guide.html packager-guide.chunk - # variable ASCIIDOC_VERBOSE to "-v", ie: - # $ ASCIIDOC_VERBOSE=-v make - A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) --attribute icons \ -- --xsltproc-opts "--nonet" \ -- --xsltproc-opts "--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d -d @$(SOURCE_DATE_EPOCH)`\"" \ -- --xsltproc-opts "--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S -d @$(SOURCE_DATE_EPOCH)`\"" \ -- --xsltproc-opts "--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \ -+ --xsltproc-opts "--nonet --stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d -d @$(SOURCE_DATE_EPOCH)`\" --stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S -d @$(SOURCE_DATE_EPOCH)`\" --stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \ - --attribute iconsdir=$(srcdir)/images \ - --attribute=badges \ - --attribute=external_title \ diff --git a/debian/patches/0014-Remove-dynamic-exception-specifications-from-clients.patch b/debian/patches/0014-Remove-dynamic-exception-specifications-from-clients.patch deleted file mode 100644 index 9ec6e35..0000000 --- a/debian/patches/0014-Remove-dynamic-exception-specifications-from-clients.patch +++ /dev/null @@ -1,980 +0,0 @@ -From fab323320d5b955ed034b2eea390a9bbb549e8e5 Mon Sep 17 00:00:00 2001 -From: Peter Klein -Date: Thu, 11 Jun 2020 02:32:13 +0000 -Subject: [PATCH] Remove dynamic exception specifications from - clients/nutclient.cpp - -These are invalid in c++17 and must be removed for compatibility with -modern compilers. ---- - clients/nutclient.cpp | 146 +++++++++++++++---------------- - clients/nutclient.h | 195 +++++++++++++++++++++--------------------- - 2 files changed, 167 insertions(+), 174 deletions(-) - -diff --git a/clients/nutclient.cpp b/clients/nutclient.cpp -index b597e0e1e6c1..f5f0b70ef297 100644 ---- a/clients/nutclient.cpp -+++ b/clients/nutclient.cpp -@@ -96,18 +96,18 @@ - public: - Socket(); - -- void connect(const std::string& host, int port)throw(nut::IOException); -+ void connect(const std::string& host, int port); - void disconnect(); - bool isConnected()const; - - void setTimeout(long timeout); - bool hasTimeout()const{return _tv.tv_sec>=0;} - -- size_t read(void* buf, size_t sz)throw(nut::IOException); -- size_t write(const void* buf, size_t sz)throw(nut::IOException); -+ size_t read(void* buf, size_t sz); -+ size_t write(const void* buf, size_t sz); - -- std::string read()throw(nut::IOException); -- void write(const std::string& str)throw(nut::IOException); -+ std::string read(); -+ void write(const std::string& str); - - - private: -@@ -129,7 +129,7 @@ - _tv.tv_sec = timeout; - } - --void Socket::connect(const std::string& host, int port)throw(nut::IOException) -+void Socket::connect(const std::string& host, int port) - { - int sock_fd; - struct addrinfo hints, *res, *ai; -@@ -298,7 +298,7 @@ - return _sock!=INVALID_SOCKET; - } - --size_t Socket::read(void* buf, size_t sz)throw(nut::IOException) -+size_t Socket::read(void* buf, size_t sz) - { - if(!isConnected()) - { -@@ -325,7 +325,7 @@ - return (size_t) res; - } - --size_t Socket::write(const void* buf, size_t sz)throw(nut::IOException) -+size_t Socket::write(const void* buf, size_t sz) - { - if(!isConnected()) - { -@@ -352,7 +352,7 @@ - return (size_t) res; - } - --std::string Socket::read()throw(nut::IOException) -+std::string Socket::read() - { - std::string res; - char buff[256]; -@@ -383,7 +383,7 @@ - } - } - --void Socket::write(const std::string& str)throw(nut::IOException) -+void Socket::write(const std::string& str) - { - // write(str.c_str(), str.size()); - // write("\n", 1); -@@ -408,13 +408,13 @@ - { - } - --bool Client::hasDevice(const std::string& dev)throw(NutException) -+bool Client::hasDevice(const std::string& dev) - { - std::set devs = getDeviceNames(); - return devs.find(dev) != devs.end(); - } - --Device Client::getDevice(const std::string& name)throw(NutException) -+Device Client::getDevice(const std::string& name) - { - if(hasDevice(name)) - return Device(this, name); -@@ -422,7 +422,7 @@ - return Device(NULL, ""); - } - --std::set Client::getDevices()throw(NutException) -+std::set Client::getDevices() - { - std::set res; - -@@ -435,13 +435,13 @@ - return res; - } - --bool Client::hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException) -+bool Client::hasDeviceVariable(const std::string& dev, const std::string& name) - { - std::set names = getDeviceVariableNames(dev); - return names.find(name) != names.end(); - } - --std::map > Client::getDeviceVariableValues(const std::string& dev)throw(NutException) -+std::map > Client::getDeviceVariableValues(const std::string& dev) - { - std::map > res; - -@@ -455,7 +455,7 @@ - return res; - } - --bool Client::hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException) -+bool Client::hasDeviceCommand(const std::string& dev, const std::string& name) - { - std::set names = getDeviceCommandNames(dev); - return names.find(name) != names.end(); -@@ -477,7 +477,7 @@ - // Do not connect now - } - --TcpClient::TcpClient(const std::string& host, int port)throw(IOException): -+TcpClient::TcpClient(const std::string& host, int port): - Client(), - _socket(new internal::Socket) - { -@@ -489,14 +489,14 @@ - delete _socket; - } - --void TcpClient::connect(const std::string& host, int port)throw(IOException) -+void TcpClient::connect(const std::string& host, int port) - { - _host = host; - _port = port; - connect(); - } - --void TcpClient::connect()throw(nut::IOException) -+void TcpClient::connect() - { - _socket->connect(_host, _port); - } -@@ -532,19 +532,18 @@ - } - - void TcpClient::authenticate(const std::string& user, const std::string& passwd) -- throw(NutException) - { - detectError(sendQuery("USERNAME " + user)); - detectError(sendQuery("PASSWORD " + passwd)); - } - --void TcpClient::logout()throw(NutException) -+void TcpClient::logout() - { - detectError(sendQuery("LOGOUT")); - _socket->disconnect(); - } - --Device TcpClient::getDevice(const std::string& name)throw(NutException) -+Device TcpClient::getDevice(const std::string& name) - { - try - { -@@ -560,7 +559,7 @@ - return Device(this, name); - } - --std::set TcpClient::getDeviceNames()throw(NutException) -+std::set TcpClient::getDeviceNames() - { - std::set res; - -@@ -576,12 +575,12 @@ - return res; - } - --std::string TcpClient::getDeviceDescription(const std::string& name)throw(NutException) -+std::string TcpClient::getDeviceDescription(const std::string& name) - { - return get("UPSDESC", name)[0]; - } - --std::set TcpClient::getDeviceVariableNames(const std::string& dev)throw(NutException) -+std::set TcpClient::getDeviceVariableNames(const std::string& dev) - { - std::set set; - -@@ -594,7 +593,7 @@ - return set; - } - --std::set TcpClient::getDeviceRWVariableNames(const std::string& dev)throw(NutException) -+std::set TcpClient::getDeviceRWVariableNames(const std::string& dev) - { - std::set set; - -@@ -607,17 +606,17 @@ - return set; - } - --std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException) -+std::string TcpClient::getDeviceVariableDescription(const std::string& dev, const std::string& name) - { - return get("DESC", dev + " " + name)[0]; - } - --std::vector TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException) -+std::vector TcpClient::getDeviceVariableValue(const std::string& dev, const std::string& name) - { - return get("VAR", dev + " " + name); - } - --std::map > TcpClient::getDeviceVariableValues(const std::string& dev)throw(NutException) -+std::map > TcpClient::getDeviceVariableValues(const std::string& dev) - { - - std::map > map; -@@ -634,13 +633,13 @@ - return map; - } - --void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException) -+void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value) - { - std::string query = "SET VAR " + dev + " " + name + " " + escape(value); - detectError(sendQuery(query)); - } - --void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException) -+void TcpClient::setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values) - { - std::string query = "SET VAR " + dev + " " + name; - for(size_t n=0; n TcpClient::getDeviceCommandNames(const std::string& dev)throw(NutException) -+std::set TcpClient::getDeviceCommandNames(const std::string& dev) - { - std::set cmds; - -@@ -663,32 +662,32 @@ - return cmds; - } - --std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException) -+std::string TcpClient::getDeviceCommandDescription(const std::string& dev, const std::string& name) - { - return get("CMDDESC", dev + " " + name)[0]; - } - --void TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException) -+void TcpClient::executeDeviceCommand(const std::string& dev, const std::string& name) - { - detectError(sendQuery("INSTCMD " + dev + " " + name)); - } - --void TcpClient::deviceLogin(const std::string& dev)throw(NutException) -+void TcpClient::deviceLogin(const std::string& dev) - { - detectError(sendQuery("LOGIN " + dev)); - } - --void TcpClient::deviceMaster(const std::string& dev)throw(NutException) -+void TcpClient::deviceMaster(const std::string& dev) - { - detectError(sendQuery("MASTER " + dev)); - } - --void TcpClient::deviceForcedShutdown(const std::string& dev)throw(NutException) -+void TcpClient::deviceForcedShutdown(const std::string& dev) - { - detectError(sendQuery("FSD " + dev)); - } - --int TcpClient::deviceGetNumLogins(const std::string& dev)throw(NutException) -+int TcpClient::deviceGetNumLogins(const std::string& dev) - { - std::string num = get("NUMLOGINS", dev)[0]; - return atoi(num.c_str()); -@@ -696,7 +695,7 @@ - - - std::vector TcpClient::get -- (const std::string& subcmd, const std::string& params) throw(NutException) -+ (const std::string& subcmd, const std::string& params) - { - std::string req = subcmd; - if(!params.empty()) -@@ -714,7 +713,7 @@ - } - - std::vector > TcpClient::list -- (const std::string& subcmd, const std::string& params) throw(NutException) -+ (const std::string& subcmd, const std::string& params) - { - std::string req = subcmd; - if(!params.empty()) -@@ -748,13 +747,13 @@ - } - } - --std::string TcpClient::sendQuery(const std::string& req)throw(IOException) -+std::string TcpClient::sendQuery(const std::string& req) - { - _socket->write(req); - return _socket->read(); - } - --void TcpClient::detectError(const std::string& req)throw(NutException) -+void TcpClient::detectError(const std::string& req) - { - if(req.substr(0,3)=="ERR") - { -@@ -954,47 +953,44 @@ - return getName()getDeviceDescription(getName()); - } - - std::vector Device::getVariableValue(const std::string& name) -- throw(NutException) - { - return getClient()->getDeviceVariableValue(getName(), name); - } - - std::map > Device::getVariableValues() -- throw(NutException) - { - return getClient()->getDeviceVariableValues(getName()); - } - --std::set Device::getVariableNames()throw(NutException) -+std::set Device::getVariableNames() - { - return getClient()->getDeviceVariableNames(getName()); - } - --std::set Device::getRWVariableNames()throw(NutException) -+std::set Device::getRWVariableNames() - { - return getClient()->getDeviceRWVariableNames(getName()); - } - --void Device::setVariable(const std::string& name, const std::string& value)throw(NutException) -+void Device::setVariable(const std::string& name, const std::string& value) - { - getClient()->setDeviceVariable(getName(), name, value); - } - - void Device::setVariable(const std::string& name, const std::vector& values) -- throw(NutException) - { - getClient()->setDeviceVariable(getName(), name, values); - } - - - --Variable Device::getVariable(const std::string& name)throw(NutException) -+Variable Device::getVariable(const std::string& name) - { - if(getClient()->hasDeviceVariable(getName(), name)) - return Variable(this, name); -@@ -1002,7 +998,7 @@ - return Variable(NULL, ""); - } - --std::set Device::getVariables()throw(NutException) -+std::set Device::getVariables() - { - std::set set; - -@@ -1015,7 +1011,7 @@ - return set; - } - --std::set Device::getRWVariables()throw(NutException) -+std::set Device::getRWVariables() - { - std::set set; - -@@ -1028,12 +1024,12 @@ - return set; - } - --std::set Device::getCommandNames()throw(NutException) -+std::set Device::getCommandNames() - { - return getClient()->getDeviceCommandNames(getName()); - } - --std::set Device::getCommands()throw(NutException) -+std::set Device::getCommands() - { - std::set cmds; - -@@ -1046,7 +1042,7 @@ - return cmds; - } - --Command Device::getCommand(const std::string& name)throw(NutException) -+Command Device::getCommand(const std::string& name) - { - if(getClient()->hasDeviceCommand(getName(), name)) - return Command(this, name); -@@ -1054,26 +1050,26 @@ - return Command(NULL, ""); - } - --void Device::executeCommand(const std::string& name)throw(NutException) -+void Device::executeCommand(const std::string& name) - { - getClient()->executeDeviceCommand(getName(), name); - } - --void Device::login()throw(NutException) -+void Device::login() - { - getClient()->deviceLogin(getName()); - } - --void Device::master()throw(NutException) -+void Device::master() - { - getClient()->deviceMaster(getName()); - } - --void Device::forcedShutdown()throw(NutException) -+void Device::forcedShutdown() - { - } - --int Device::getNumLogins()throw(NutException) -+int Device::getNumLogins() - { - return getClient()->deviceGetNumLogins(getName()); - } -@@ -1141,22 +1137,22 @@ - return getName() Variable::getValue()throw(NutException) -+std::vector Variable::getValue() - { - return getDevice()->getClient()->getDeviceVariableValue(getDevice()->getName(), getName()); - } - --std::string Variable::getDescription()throw(NutException) -+std::string Variable::getDescription() - { - return getDevice()->getClient()->getDeviceVariableDescription(getDevice()->getName(), getName()); - } - --void Variable::setValue(const std::string& value)throw(NutException) -+void Variable::setValue(const std::string& value) - { - getDevice()->setVariable(getName(), value); - } - --void Variable::setValues(const std::vector& values)throw(NutException) -+void Variable::setValues(const std::vector& values) - { - getDevice()->setVariable(getName(), values); - } -@@ -1225,12 +1221,12 @@ - return getName()getClient()->getDeviceCommandDescription(getDevice()->getName(), getName()); - } - --void Command::execute()throw(NutException) -+void Command::execute() - { - getDevice()->executeCommand(getName()); - } ---- a/clients/nutclient.h -+++ b/clients/nutclient.h -@@ -51,9 +51,9 @@ - { - public: - NutException(const std::string& msg):_msg(msg){} -- virtual ~NutException() throw() {} -- virtual const char * what() const throw() {return this->_msg.c_str();} -- virtual std::string str() const throw() {return this->_msg;} -+ virtual ~NutException() {} -+ virtual const char * what() const noexcept {return this->_msg.c_str();} -+ virtual std::string str() const noexcept {return this->_msg;} - private: - std::string _msg; - }; -@@ -65,7 +65,7 @@ - { - public: - SystemException(); -- virtual ~SystemException() throw() {} -+ virtual ~SystemException() {} - private: - static std::string err(); - }; -@@ -78,7 +78,7 @@ - { - public: - IOException(const std::string& msg):NutException(msg){} -- virtual ~IOException() throw() {} -+ virtual ~IOException() {} - }; - - /** -@@ -88,7 +88,7 @@ - { - public: - UnknownHostException():IOException("Unknown host"){} -- virtual ~UnknownHostException() throw() {} -+ virtual ~UnknownHostException() {} - }; - - /** -@@ -98,7 +98,7 @@ - { - public: - NotConnectedException():IOException("Not connected"){} -- virtual ~NotConnectedException() throw() {} -+ virtual ~NotConnectedException() {} - }; - - /** -@@ -108,7 +108,7 @@ - { - public: - TimeoutException():IOException("Timeout"){} -- virtual ~TimeoutException() throw() {} -+ virtual ~TimeoutException() {} - }; - - /** -@@ -132,13 +132,13 @@ - * \todo Is his method is global to all connection protocol or is it specific to TCP ? - * \note Actually, authentication fails only if already set, not if bad values are sent. - */ -- virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException)=0; -+ virtual void authenticate(const std::string& user, const std::string& passwd)=0; - - /** - * Disconnect from the NUTD server. - * \todo Is his method is global to all connection protocol or is it specific to TCP ? - */ -- virtual void logout()throw(NutException)=0; -+ virtual void logout()=0; - - /** - * Device manipulations. -@@ -151,29 +151,29 @@ - * \param name Name of the device. - * \return The device. - */ -- virtual Device getDevice(const std::string& name)throw(NutException); -+ virtual Device getDevice(const std::string& name); - /** - * Retrieve the list of all devices supported by UPSD server. - * \return The set of supported devices. - */ -- virtual std::set getDevices()throw(NutException); -+ virtual std::set getDevices(); - /** - * Test if a device is supported by the NUTD server. - * \param dev Device name. - * \return true if supported, false otherwise. - */ -- virtual bool hasDevice(const std::string& dev)throw(NutException); -+ virtual bool hasDevice(const std::string& dev); - /** - * Retrieve names of devices supported by NUTD server. - * \return The set of names of supported devices. - */ -- virtual std::set getDeviceNames()throw(NutException)=0; -+ virtual std::set getDeviceNames()=0; - /** - * Retrieve the description of a device. - * \param name Device name. - * \return Device description. - */ -- virtual std::string getDeviceDescription(const std::string& name)throw(NutException)=0; -+ virtual std::string getDeviceDescription(const std::string& name)=0; - /** \} */ - - /** -@@ -186,54 +186,54 @@ - * \param dev Device name - * \return Variable names - */ -- virtual std::set getDeviceVariableNames(const std::string& dev)throw(NutException)=0; -+ virtual std::set getDeviceVariableNames(const std::string& dev)=0; - /** - * Retrieve names of read/write variables supported by a device. - * \param dev Device name - * \return RW variable names - */ -- virtual std::set getDeviceRWVariableNames(const std::string& dev)throw(NutException)=0; -+ virtual std::set getDeviceRWVariableNames(const std::string& dev)=0; - /** - * Test if a variable is supported by a device. - * \param dev Device name - * \param name Variable name - * \return true if the variable is supported. - */ -- virtual bool hasDeviceVariable(const std::string& dev, const std::string& name)throw(NutException); -+ virtual bool hasDeviceVariable(const std::string& dev, const std::string& name); - /** - * Retrieve the description of a variable. - * \param dev Device name - * \param name Variable name - * \return Variable description if provided. - */ -- virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException)=0; -+ virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)=0; - /** - * Retrieve values of a variable. - * \param dev Device name - * \param name Variable name - * \return Variable values (usually one) if available. - */ -- virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException)=0; -+ virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name)=0; - /** - * Retrieve values of all variables of a device. - * \param dev Device name - * \return Variable values indexed by variable names. - */ -- virtual std::map > getDeviceVariableValues(const std::string& dev)throw(NutException); -+ virtual std::map > getDeviceVariableValues(const std::string& dev); - /** - * Intend to set the value of a variable. - * \param dev Device name - * \param name Variable name - * \param value Variable value - */ -- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException)=0; -+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)=0; - /** - * Intend to set the value of a variable. - * \param dev Device name - * \param name Variable name - * \param value Variable value - */ -- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException)=0; -+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)=0; - /** \} */ - - /** -@@ -246,27 +246,27 @@ - * \param dev Device name - * \return Command names - */ -- virtual std::set getDeviceCommandNames(const std::string& dev)throw(NutException)=0; -+ virtual std::set getDeviceCommandNames(const std::string& dev)=0; - /** - * Test if a command is supported by a device. - * \param dev Device name - * \param name Command name - * \return true if the command is supported. - */ -- virtual bool hasDeviceCommand(const std::string& dev, const std::string& name)throw(NutException); -+ virtual bool hasDeviceCommand(const std::string& dev, const std::string& name); - /** - * Retrieve the description of a command. - * \param dev Device name - * \param name Command name - * \return Command description if provided. - */ -- virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException)=0; -+ virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)=0; - /** - * Intend to execute a command. - * \param dev Device name - * \param name Command name - */ -- virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException)=0; -+ virtual void executeDeviceCommand(const std::string& dev, const std::string& name)=0; - /** \} */ - - /** -@@ -277,15 +277,15 @@ - * Log the current user (if authenticated) for a device. - * \param dev Device name. - */ -- virtual void deviceLogin(const std::string& dev)throw(NutException)=0; -+ virtual void deviceLogin(const std::string& dev)=0; - /** - * Retrieve the number of user longged in the specified device. - * \param dev Device name. - * \return Number of logged-in users. - */ -- virtual int deviceGetNumLogins(const std::string& dev)throw(NutException)=0; -- virtual void deviceMaster(const std::string& dev)throw(NutException)=0; -- virtual void deviceForcedShutdown(const std::string& dev)throw(NutException)=0; -+ virtual int deviceGetNumLogins(const std::string& dev)=0; -+ virtual void deviceMaster(const std::string& dev)=0; -+ virtual void deviceForcedShutdown(const std::string& dev)=0; - - protected: - Client(); -@@ -309,7 +309,7 @@ - * \param host Server host name. - * \param port Server port. - */ -- TcpClient(const std::string& host, int port = 3493)throw(nut::IOException); -+ TcpClient(const std::string& host, int port = 3493); - ~TcpClient(); - - /** -@@ -317,13 +317,13 @@ - * \param host Server host name. - * \param port Server port. - */ -- void connect(const std::string& host, int port = 3493)throw(nut::IOException); -+ void connect(const std::string& host, int port = 3493); - - /** - * Connect to the server. - * Host name and ports must have already set (usefull for reconnection). - */ -- void connect()throw(nut::IOException); -+ void connect(); - - /** - * Test if the connection is active. -@@ -358,39 +358,37 @@ - */ - int getPort()const; - -- virtual void authenticate(const std::string& user, const std::string& passwd)throw(NutException); -- virtual void logout()throw(NutException); -+ virtual void authenticate(const std::string& user, const std::string& passwd); -+ virtual void logout(); - -- virtual Device getDevice(const std::string& name)throw(NutException); -- virtual std::set getDeviceNames()throw(NutException); -- virtual std::string getDeviceDescription(const std::string& name)throw(NutException); -- -- virtual std::set getDeviceVariableNames(const std::string& dev)throw(NutException); -- virtual std::set getDeviceRWVariableNames(const std::string& dev)throw(NutException); -- virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name)throw(NutException); -- virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name)throw(NutException); -- virtual std::map > getDeviceVariableValues(const std::string& dev)throw(NutException); -- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value)throw(NutException); -- virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values)throw(NutException); -- -- virtual std::set getDeviceCommandNames(const std::string& dev)throw(NutException); -- virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name)throw(NutException); -- virtual void executeDeviceCommand(const std::string& dev, const std::string& name)throw(NutException); -- -- virtual void deviceLogin(const std::string& dev)throw(NutException); -- virtual void deviceMaster(const std::string& dev)throw(NutException); -- virtual void deviceForcedShutdown(const std::string& dev)throw(NutException); -- virtual int deviceGetNumLogins(const std::string& dev)throw(NutException); -+ virtual Device getDevice(const std::string& name); -+ virtual std::set getDeviceNames(); -+ virtual std::string getDeviceDescription(const std::string& name); -+ -+ virtual std::set getDeviceVariableNames(const std::string& dev); -+ virtual std::set getDeviceRWVariableNames(const std::string& dev); -+ virtual std::string getDeviceVariableDescription(const std::string& dev, const std::string& name); -+ virtual std::vector getDeviceVariableValue(const std::string& dev, const std::string& name); -+ virtual std::map > getDeviceVariableValues(const std::string& dev); -+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::string& value); -+ virtual void setDeviceVariable(const std::string& dev, const std::string& name, const std::vector& values); -+ -+ virtual std::set getDeviceCommandNames(const std::string& dev); -+ virtual std::string getDeviceCommandDescription(const std::string& dev, const std::string& name); -+ virtual void executeDeviceCommand(const std::string& dev, const std::string& name); -+ -+ virtual void deviceLogin(const std::string& dev); -+ virtual void deviceMaster(const std::string& dev); -+ virtual void deviceForcedShutdown(const std::string& dev); -+ virtual int deviceGetNumLogins(const std::string& dev); - - protected: -- std::string sendQuery(const std::string& req)throw(nut::IOException); -- static void detectError(const std::string& req)throw(nut::NutException); -+ std::string sendQuery(const std::string& req); -+ static void detectError(const std::string& req); - -- std::vector get(const std::string& subcmd, const std::string& params = "") -- throw(nut::NutException); -+ std::vector get(const std::string& subcmd, const std::string& params = ""); - -- std::vector > list(const std::string& subcmd, const std::string& params = "") -- throw(nut::NutException); -+ std::vector > list(const std::string& subcmd, const std::string& params = ""); - - static std::vector explode(const std::string& str, size_t begin=0); - static std::string escape(const std::string& str); -@@ -455,92 +453,92 @@ - /** - * Retrieve the description of the devce if specified. - */ -- std::string getDescription()throw(NutException); -+ std::string getDescription(); - - /** - * Intend to retrieve the value of a variable of the device. - * \param name Name of the variable to get. - * \return Value of the variable, if available. - */ -- std::vector getVariableValue(const std::string& name)throw(NutException); -+ std::vector getVariableValue(const std::string& name); - /** - * Intend to retrieve values of all variables of the devices. - * \return Map of all variables values indexed by their names. - */ -- std::map > getVariableValues()throw(NutException); -+ std::map > getVariableValues(); - /** - * Retrieve all variables names supported by the device. - * \return Set of available variable names. - */ -- std::set getVariableNames()throw(NutException); -+ std::set getVariableNames(); - /** - * Retrieve all Read/Write variables names supported by the device. - * \return Set of available Read/Write variable names. - */ -- std::set getRWVariableNames()throw(NutException); -+ std::set getRWVariableNames(); - /** - * Intend to set the value of a variable of the device. - * \param name Variable name. - * \param value New variable value. - */ -- void setVariable(const std::string& name, const std::string& value)throw(NutException); -+ void setVariable(const std::string& name, const std::string& value); - /** - * Intend to set values of a variable of the device. - * \param name Variable name. - * \param value New variable values. - */ -- void setVariable(const std::string& name, const std::vector& values)throw(NutException); -+ void setVariable(const std::string& name, const std::vector& values); - - /** - * Retrieve a Variable object representing the specified variable. - * \param name Variable name. - * \return Variable object. - */ -- Variable getVariable(const std::string& name)throw(NutException); -+ Variable getVariable(const std::string& name); - /** - * Retrieve Variable objects representing all variables available for the device. - * \return Set of Variable objects. - */ -- std::set getVariables()throw(NutException); -+ std::set getVariables(); - /** - * Retrieve Variable objects representing all Read/Write variables available for the device. - * \return Set of Variable objects. - */ -- std::set getRWVariables()throw(NutException); -+ std::set getRWVariables(); - - /** - * Retrieve names of all commands supported by the device. - * \return Set of available command names. - */ -- std::set getCommandNames()throw(NutException); -+ std::set getCommandNames(); - /** - * Retrieve objects for all commands supported by the device. - * \return Set of available Command objects. - */ -- std::set getCommands()throw(NutException); -+ std::set getCommands(); - /** - * Retrieve an object representing a command of the device. - * \param name Command name. - * \return Command object. - */ -- Command getCommand(const std::string& name)throw(NutException); -+ Command getCommand(const std::string& name); - /** - * Intend to execute a command on the device. - * \param name Command name. - */ -- void executeCommand(const std::string& name)throw(NutException); -+ void executeCommand(const std::string& name); - - /** - * Login current client's user for the device. - */ -- void login()throw(NutException); -- void master()throw(NutException); -- void forcedShutdown()throw(NutException); -+ void login(); -+ void master(); -+ void forcedShutdown(); - /** - * Retrieve the number of logged user for the device. - * \return Number of users. - */ -- int getNumLogins()throw(NutException); -+ int getNumLogins(); - - protected: - Device(Client* client, const std::string& name); -@@ -603,23 +601,23 @@ - * Intend to retrieve variable value. - * \return Value of the variable. - */ -- std::vector getValue()throw(NutException); -+ std::vector getValue(); - /** - * Intend to retireve variable description. - * \return Variable description if provided. - */ -- std::string getDescription()throw(NutException); -+ std::string getDescription(); - - /** - * Intend to set a value to the variable. - * \param value New variable value. - */ -- void setValue(const std::string& value)throw(NutException); -+ void setValue(const std::string& value); - /** - * Intend to set (multiple) values to the variable. - * \param value New variable values. - */ -- void setValues(const std::vector& values)throw(NutException); -+ void setValues(const std::vector& values); - - protected: - Variable(Device* dev, const std::string& name); -@@ -683,13 +681,13 @@ - * Intend to retireve command description. - * \return Command description if provided. - */ -- std::string getDescription()throw(NutException); -+ std::string getDescription(); - - /** - * Intend to retrieve command description. - * \return Command description if provided. - */ -- void execute()throw(NutException); -+ void execute(); - - protected: - Command(Device* dev, const std::string& name); --- -2.33.0 - diff --git a/debian/patches/series b/debian/patches/series deleted file mode 100644 index 677ad2c..0000000 --- a/debian/patches/series +++ /dev/null @@ -1,14 +0,0 @@ -0001-reproductible-build.patch -0003-install-dev-files-in-usr.patch -0002-nut-monitor-paths.patch -0004-fix-systemd-service.patch -0008-drop-w3c-icons.patch - -# Upstream patches -0006-ups-conf-maxretry.patch -0009-fix-nutshutdown-install.patch -0010-fix-nutscanner-ftbfs.patch -0011-use-pkgconfig-module.patch -0012-add-AEG-PROTECT-NAS-support.patch -0013-fix-doc-build.patch -0014-Remove-dynamic-exception-specifications-from-clients.patch diff --git a/debian/python3-nut.install b/debian/python3-nut.install deleted file mode 100644 index 4ed84d2..0000000 --- a/debian/python3-nut.install +++ /dev/null @@ -1 +0,0 @@ -scripts/python/module/PyNUT.py usr/lib/python3/dist-packages diff --git a/debian/rules b/debian/rules deleted file mode 100755 index 9a3f689..0000000 --- a/debian/rules +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/make -f - -DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS 2>/dev/null) - -DEB_BUILD_MAINT_OPTIONS=hardening=+all -DEB_LDFLAGS_MAINT_APPEND=-Wl,-z,defs -Wl,-O1 -Wl,--as-needed -include /usr/share/dpkg/buildflags.mk - -DEB_CONFIGURE_EXTRA_FLAGS := --prefix= \ - --sysconfdir=/etc/nut \ - --includedir=/usr/include \ - --mandir=/usr/share/man \ - --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) \ - --with-ssl --with-nss \ - --with-cgi \ - --with-dev \ - --enable-static \ - --with-statepath=/run/nut \ - --with-altpidpath=/run/nut \ - --with-drvpath=/lib/nut \ - --with-cgipath=/usr/lib/cgi-bin/nut \ - --with-htmlpath=/usr/share/nut/www \ - --with-pidpath=/run/nut \ - --datadir=/usr/share/nut \ - --with-pkgconfig-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig \ - --with-user=nut --with-group=nut \ - --with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system \ - --with-systemdshutdowndir=/lib/systemd/system-shutdown - -# only build documentation if asciidoc is installed -ifneq ($(shell which asciidoc),) - DEB_CONFIGURE_EXTRA_FLAGS+=--with-doc=html-chunked,pdf -endif - -%: - dh $@ --no-parallel --with python3 - -override_dh_auto_configure: - dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) - -override_dh_autoreconf: - dh_autoreconf --as-needed - -override_dh_auto_install-arch: - dh_auto_install - - # install the bash completion script - mkdir -p $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/ - cp $(CURDIR)/scripts/misc/nut.bash_completion \ - $(CURDIR)/debian/tmp/usr/share/bash-completion/completions/nut - - # install the avahi service file - mkdir -p $(CURDIR)/debian/tmp/etc/avahi/services - cp $(CURDIR)/scripts/avahi/nut.service \ - $(CURDIR)/debian/tmp/etc/avahi/services - - # install Augeas lenses - mkdir -p $(CURDIR)/debian/tmp/usr/share/augeas/lenses/tests - cp $(CURDIR)/scripts/augeas/*.aug \ - $(CURDIR)/debian/tmp/usr/share/augeas/lenses/ - cp $(CURDIR)/scripts/augeas/tests/test_nut.aug \ - $(CURDIR)/debian/tmp/usr/share/augeas/lenses/tests/ - - # install the default configuration - for f in $(CURDIR)/debian/tmp/etc/nut/*; do \ - nf=`basename $${f} | sed 's/\(.*\).sample/\1/'`; \ - mv $${f} $(CURDIR)/debian/tmp/etc/nut/$${nf}; \ - done - - # Move -dev file to /usr - mv $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.a \ - $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.a - rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libupsclient.so.4 \ - $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libupsclient.so - mv $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.a \ - $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.a - rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutclient.so.0 \ - $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutclient.so - - rm -f $(CURDIR)/debian/tmp/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so - ln -s /lib/$(DEB_HOST_MULTIARCH)/libnutscan.so.1 \ - $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libnutscan.so - - # Move daemons and install wrappers - mv $(CURDIR)/debian/tmp/sbin/upsmon $(CURDIR)/debian/tmp/lib/nut/upsmon - mv $(CURDIR)/debian/tmp/sbin/upsd $(CURDIR)/debian/tmp/lib/nut/upsd - install -m 0755 debian/local/upsmon $(CURDIR)/debian/tmp/sbin/upsmon - install -m 0755 debian/local/upsd $(CURDIR)/debian/tmp/sbin/upsd - - # Add a symlink to mask the LSB initscript - ln -s nut-monitor.service $(CURDIR)/debian/tmp/lib/systemd/system/nut-client.service - ln -s /dev/null $(CURDIR)/debian/tmp/lib/systemd/system/ups-monitor.service - - # install apport hooks - install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut-server.py - install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut-client.py - -override_dh_auto_install-indep: -ifeq ($(filter nodoc,$(DEB_BUILD_PROFILES)),) - #install documentation - mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf - mkdir -p $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html - cp $(CURDIR)/docs/*.pdf $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/pdf - cp $(CURDIR)/docs/FAQ.txt $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html - - for f in $(CURDIR)/docs/*.chunked/; do \ - nf=`basename $${f} | sed 's/\(.*\)\.chunked/\1/'`; \ - cp -a $${f} $(CURDIR)/debian/tmp/usr/share/doc/nut-doc/html/$${nf}/; \ - done -endif - - # install apport hooks - install -D -m 644 debian/source_nut.py $(CURDIR)/debian/tmp/usr/share/apport/package-hooks/source_nut.py - -override_dh_installinit: - dh_installinit --error-handler=handle_start_failure - -override_dh_compress: - dh_compress -X.pdf - -override_dh_installdocs: - dh_installdocs -A ./README ./NEWS ./TODO ./AUTHORS - -override_dh_installchangelogs: -# dh_installchangelogs automagically rename history.txt to changelog, let's try -# to avoid that - dh_installchangelogs -pnut -Xhistory.txt - dh_installchangelogs --remaining-packages diff --git a/debian/source/format b/debian/source/format deleted file mode 100644 index 163aaf8..0000000 --- a/debian/source/format +++ /dev/null @@ -1 +0,0 @@ -3.0 (quilt) diff --git a/debian/source/include-binaries b/debian/source/include-binaries deleted file mode 100644 index 8976bba..0000000 --- a/debian/source/include-binaries +++ /dev/null @@ -1 +0,0 @@ -debian/local/nut-monitor.png diff --git a/debian/source_nut.py b/debian/source_nut.py deleted file mode 100644 index b5088f1..0000000 --- a/debian/source_nut.py +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/python3 - -'''nut Apport interface - -Copyright (C) 2010 Canonical Ltd. -Author: Chuck Short - -This program is free software; you can redistribute it and/or modify it -under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2 of the License, or (at your -option) any later version. See http://www.gnu.org/copyleft/gpl.html for -the full text of the license. -''' -from apport.hookutils import * - - -def add_info(report,ui): - - response = ui.yesno("The contents of your nut configuration files may help developers diagnose your bug more quickly, however, it may contain sensitive information. Do you want to include it in your bug report?") - - if response == None: #use cancelled - raise StropIteration - - elif response == True: - attach_file(report, '/etc/nut/ups.conf', 'UpsConf') - - elif response == False: - ui.information("The contents of your nut configuration files will NOT be included in the bug report") - - report['USBDevices'] = command_output(['lsusb']) - packages = ['nut', 'nut-client','nut-server', 'nut-cgi', 'nut-snmp', 'nut-hal-drivers', 'nut-xml', 'libupsclient1', - 'libupsclient1-dev', 'python-nut', 'nut-monitor'] - versions = '' - for package in packages: - try: - version = packaging.get_version(package) - except ValueError: - version = 'N/A' - if version is None: - version = 'N/A' - versions += '%s %s\n' %(package, version) - report['NutInstalledVersions'] = versions - report['KernelVersion'] = command_output(['uname', '-a']) diff --git a/debian/tests/control b/debian/tests/control deleted file mode 100644 index 0f68e27..0000000 --- a/debian/tests/control +++ /dev/null @@ -1,3 +0,0 @@ -Tests: nut -Depends: lsb-release, netcat, nut-client, nut-server, psmisc, python3 -Restrictions: needs-root diff --git a/debian/tests/nut b/debian/tests/nut deleted file mode 100644 index b367bba..0000000 --- a/debian/tests/nut +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -#------------ -# Testing nut -#------------ -set -e -python3 `dirname $0`/test-nut.py 2>&1 diff --git a/debian/tests/test-nut.py b/debian/tests/test-nut.py deleted file mode 100644 index ffbec80..0000000 --- a/debian/tests/test-nut.py +++ /dev/null @@ -1,423 +0,0 @@ -#!/usr/bin/python -# -# test-nut.py quality assurance test script -# Copyright (C) 2008-2011 Arnaud Quette -# Copyright (C) 2012 Jamie Strandboge -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3, -# as published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -# - -''' - *** IMPORTANT *** - DO NOT RUN ON A PRODUCTION SERVER. - *** IMPORTANT *** - - How to run (xenial+): - $ sudo apt-get -y install nut-server nut-client python - $ sudo ./test-nut.py -v - - - NOTE: - - NUT architecture (helps understanding): - http://www.networkupstools.org/docs/developer-guide.chunked/ar01s02.html#_the_layering - - - These tests only validate the NUT software framework itself (communication - between the drivers, server and client layers ; events propagation and - detection). The critical part of NUT, Ie the driver layer which - communicate with actual devices, can only be tested with real hardware! - - - These tests use the NUT simulation driver (dummy-ups) to emulate real - hardware behavior, and generate events (power failure, low battery, ...). - - TODO: - - improve test duration, by reworking NutTestCommon._setUp() and the way - daemons are started (ie, always) - - more events testing (upsmon / upssched) - - test syslog and wall output - - test UPS redundancy - - test Powerchain (once available!) - - test AppArmor (once available!) - - add hardware testing as Private tests? - - load a .dev file, and test a full output - - QA INFORMATION: - - NUT provides "make check" and "make distcheck" in its source distribution - - NUT provides Quality Assurance information, to track all efforts: - http://www.networkupstools.org/nut-qa.html -''' - -# QRT-Packages: netcat-openbsd psmisc python -# QRT-Alternates: nut-server nut -# QRT-Alternates: nut-client nut -# nut-dev is needed for the dummy driver on hardy -# QRT-Alternates: nut-dev -# QRT-Privilege: root -# QRT-Depends: - - -import unittest, subprocess, sys, os, time -import tempfile -import testlib - -use_private = True -try: - from private.qrt.nut import PrivateNutTest -except ImportError: - class PrivateNutTest(object): - '''Empty class''' - print("Skipping private tests") - - -class NutTestCommon(testlib.TestlibCase): - '''Common functions''' - - # FIXME: initscript will be splitted into nut-server and nut-client - # (Debian bug #634858) - initscript = "/etc/init.d/nut-server" - hosts_file = "/etc/hosts" - powerdownflag = "/etc/killpower" - shutdowncmd = "/tmp/shutdowncmd" - notifyscript = "/tmp/nutifyme" - notifylog = "/tmp/notify.log" - - def _setUp(self): - '''Set up prior to each test_* function''' - '''We generate a NUT config using the dummmy-ups driver - and standard settings for local monitoring - ''' - self.tmpdir = "" - self.rundir = "/run/nut" - testlib.cmd(['/bin/rm -f' + self.powerdownflag]) - - testlib.config_replace('/etc/nut/ups.conf', ''' -[dummy-dev1] - driver = dummy-ups - port = dummy.dev - desc = "simulation device" - ''') - - if self.lsb_release['Release'] <= 8.04: - testlib.config_replace('/etc/nut/upsd.conf', ''' -ACL dummy-net 127.0.0.1/8 -ACL dummy-net2 ::1/64 -ACL all 0.0.0.0/0 -ACCEPT dummy-net dummy-net2 -REJECT all - ''') - else: - testlib.config_replace('/etc/nut/upsd.conf', '''# just to touch the file''') - - extra_cfgs = '' - if self.lsb_release['Release'] <= 8.04: - extra_cfgs = ''' allowfrom = dummy-net dummy-net2 -''' - testlib.config_replace('/etc/nut/upsd.users', ''' -[admin] - password = dummypass - actions = SET - instcmds = ALL -%s -[monuser] - password = dummypass - upsmon master -%s ''' %(extra_cfgs, extra_cfgs)) - - testlib.config_replace('/etc/nut/upsmon.conf', ''' -MONITOR dummy-dev1@localhost 1 monuser dummy-pass master -MINSUPPLIES 1 -SHUTDOWNCMD "/usr/bin/touch ''' + self.shutdowncmd + '"\n' -'''POWERDOWNFLAG ''' + self.powerdownflag + '\n' -''' -NOTIFYCMD ''' + self.notifyscript + '\n' -''' -NOTIFYFLAG ONLINE SYSLOG+EXEC -NOTIFYFLAG ONBATT SYSLOG+EXEC -NOTIFYFLAG LOWBATT SYSLOG+EXEC -NOTIFYFLAG FSD SYSLOG+EXEC -# NOTIFYFLAG COMMOK SYSLOG+EXEC -# NOTIFYFLAG COMMBAD SYSLOG+EXEC -NOTIFYFLAG SHUTDOWN SYSLOG+EXEC -# NOTIFYFLAG REPLBATT SYSLOG+EXEC -# NOTIFYFLAG NOCOMM SYSLOG+EXEC -# NOTIFYFLAG NOPARENT SYSLOG+EXEC - -# Shorten test duration by: -# Speeding up polling frequency -POLLFREQ 2 -# And final wait delay -FINALDELAY 0 -''' -) - - testlib.create_fill(self.notifyscript, ''' -#! /bin/bash -echo "$*" > ''' + self.notifylog + '\n', mode=0o755) - - # dummy-ups absolutely needs a data file, even if empty - testlib.config_replace('/etc/nut/dummy.dev', ''' -ups.mfr: Dummy Manufacturer -ups.model: Dummy UPS -ups.status: OL -# Set a big enough timer to avoid value reset, due to reading loop -TIMER 600 - ''') - - testlib.config_replace('/etc/nut/nut.conf', '''MODE=standalone''') - - # Add known friendly IP names for localhost v4 and v6 - # FIXME: find a way to determine if v4 / v6 are enabled, and a way to - # get v4 / v6 names - testlib.config_replace(self.hosts_file, '''# -127.0.0.1 localv4 -::1 localv6 -''', append=True) - - if self.lsb_release['Release'] <= 8.04: - testlib.config_replace('/etc/default/nut', '''# -START_UPSD=yes -UPSD_OPTIONS="" -START_UPSMON=yes -UPSMON_OPTIONS="" -''', append=False) - - # Start the framework - self._restart() - - def _tearDown(self): - '''Clean up after each test_* function''' - self._stop() - time.sleep(2) - os.unlink('/etc/nut/ups.conf') - os.unlink('/etc/nut/upsd.conf') - os.unlink('/etc/nut/upsd.users') - os.unlink('/etc/nut/upsmon.conf') - os.unlink('/etc/nut/dummy.dev') - os.unlink('/etc/nut/nut.conf') - testlib.config_restore('/etc/nut/ups.conf') - testlib.config_restore('/etc/nut/upsd.conf') - testlib.config_restore('/etc/nut/upsd.users') - testlib.config_restore('/etc/nut/upsmon.conf') - testlib.config_restore('/etc/nut/dummy.dev') - testlib.config_restore('/etc/nut/nut.conf') - if os.path.exists(self.notifyscript): - os.unlink(self.notifyscript) - if os.path.exists(self.shutdowncmd): - os.unlink(self.shutdowncmd) - testlib.config_restore(self.hosts_file) - if self.lsb_release['Release'] <= 8.04: - testlib.config_restore('/etc/default/nut') - - if os.path.exists(self.tmpdir): - testlib.recursive_rm(self.tmpdir) - - # this is needed because of the potentially hung upsd process in the - # CVE-2012-2944 test - testlib.cmd(['killall', 'upsd']) - testlib.cmd(['killall', '-9', 'upsd']) - - def _start(self): - '''Start NUT''' - rc, report = testlib.cmd([self.initscript, 'start']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEqual(expected, rc, result + report) - time.sleep(2) - - def _stop(self): - '''Stop NUT''' - rc, report = testlib.cmd([self.initscript, 'stop']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEqual(expected, rc, result + report) - - def _reload(self): - '''Reload NUT''' - rc, report = testlib.cmd([self.initscript, 'force-reload']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEqual(expected, rc, result + report) - - def _restart(self): - '''Restart NUT''' - self._stop() - time.sleep(2) - self._start() - - def _status(self): - '''NUT Status''' - rc, report = testlib.cmd([self.initscript, 'status']) - expected = 0 - if self.lsb_release['Release'] <= 8.04: - self._skipped("init script does not support status command") - expected = 1 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEqual(expected, rc, result + report) - - def _testDaemons(self, daemons): - '''Daemons running''' - for d in daemons: - # A note on the driver pid file: its name is - # -.pid - # ex: dummy-dev1-dummy-ups.pid - if d == 'dummy-ups' : - pidfile = os.path.join(self.rundir, 'dummy-ups-dummy-dev1.pid') - else : - pidfile = os.path.join(self.rundir, d + '.pid') - warning = "Could not find pidfile '" + pidfile + "'" - self.assertTrue(os.path.exists(pidfile), warning) - self.assertTrue(testlib.check_pidfile(d, pidfile), d + ' is not running') - - def _nut_setvar(self, var, value): - '''Test upsrw''' - rc, report = testlib.cmd(['/bin/upsrw', '-s', var + '=' + value, - '-u', 'admin' , '-p', 'dummypass', 'dummy-dev1@localhost']) - self.assertTrue(rc == 0, 'upsrw: ' + report) - return rc,report - - -class BasicTest(NutTestCommon, PrivateNutTest): - '''Test basic NUT functionalities''' - - def setUp(self): - '''Setup mechanisms''' - NutTestCommon._setUp(self) - - def tearDown(self): - '''Shutdown methods''' - NutTestCommon._tearDown(self) - - def test_daemons_service(self): - '''Test daemons using "service status"''' - self._status() - - def test_daemons_pid(self): - '''Test daemons using PID files''' - # upsmon does not work because ups-client is still missing - daemons = [ 'dummy-ups', 'upsd'] - self._testDaemons(daemons) - - def test_upsd_IPv4(self): - '''Test upsd IPv4 reachability''' - rc, report = testlib.cmd(['/bin/upsc', '-l', 'localv4']) - self.assertTrue('dummy-dev1' in report, 'dummy-dev1 should be present in device(s) listing: ' + report) - - def test_upsd_IPv6(self): - '''Test upsd IPv6 reachability''' - rc, report = testlib.cmd(['/bin/upsc', '-l', 'localv6']) - self.assertTrue('dummy-dev1' in report, 'dummy-dev1 should be present in device(s) listing: ' + report) - - def test_upsc_device_list(self): - '''Test NUT client interface (upsc): device(s) listing''' - rc, report = testlib.cmd(['/bin/upsc', '-L']) - self.assertTrue('dummy-dev1: simulation device' in report, 'dummy-dev1 should be present in device(s) listing: ' + report) - - def _test_upsc_status(self): - '''Test NUT client interface (upsc): data access''' - rc, report = testlib.cmd(['/bin/upsc', 'dummy-dev1', 'ups.status']) - self.assertTrue('OL' in report, 'UPS Status: ' + report + 'should be OL') - - #def test_upsc_powerchain(self): - # '''Test NUT client interface (upsc): Powerchain(s) listing''' - # rc, report = testlib.cmd(['/bin/upsc', '-p']) - # Result == Main ; dummy-dev1 ; $hostname - # self.assertTrue('dummy-dev1' in report, 'dummy-dev1 should be present in device(s) listing: ' + report) - - def test_upsrw(self): - '''Test upsrw''' - # Set ups.status to OB (On Battery)... - self._nut_setvar('ups.model', 'Test') - time.sleep(2) - # and check the result on the client side - rc, report = testlib.cmd(['/bin/upsc', 'dummy-dev1@localhost', 'ups.model']) - self.assertTrue('Test' in report, 'UPS Model: ' + report + 'should be Test') - - # FIXME: need a simulation counterpart, not yet implemented - #def test_upscmd(self): - # '''Test upscmd''' - - def test_upsmon_notif(self): - '''Test upsmon notifications''' - # Set ups.status to OB (On Battery)... - self._nut_setvar('ups.status', 'OB') - time.sleep(1) - # and check the result on the client side - rc, report = testlib.cmd(['/bin/upsc', 'dummy-dev1@localhost', 'ups.status']) - self.assertTrue('OB' in report, 'UPS Status: ' + report + 'should be OB') - - #def test_upsmon_shutdown(self): - # '''Test upsmon basic shutdown (single UPS, low battery status)''' - # self._nut_setvar('ups.status', 'OB LB') - # time.sleep(2) - # # and check the result on the client side - # rc, report = testlib.cmd(['/bin/upsc', 'dummy-dev1@localhost', 'ups.status']) - # self.assertTrue('OB LB' in report, 'UPS Status: ' + report + 'should be OB LB') - # # FIXME: improve with a 2 sec loop * 5 tries - # time.sleep(3) - # # Check for powerdownflag and shutdowncmd (needed for halt!) - # # FIXME: replace by a call to 'upsmon -K' - # self.assertTrue(os.path.exists(self.powerdownflag), 'POWERDOWNFLAG has not been set!') - # self.assertTrue(os.path.exists(self.shutdowncmd), 'SHUTDOWNCMD has not been executed!') - - def test_CVE_2012_2944(self): - '''Test CVE-2012-2944''' - self.tmpdir = tempfile.mkdtemp(dir='/tmp', prefix="testlib-") - # First send bad input. We need to do this in a script because python - # functions don't like our embedded NULs - script = os.path.join(self.tmpdir, 'script.sh') - contents = '''#!/bin/sh -printf '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\n' | nc -q 1 127.0.0.1 3493 -sleep 1 -dd if=/dev/urandom count=64 | nc -q 1 127.0.0.1 3493 -''' - testlib.create_fill(script, contents, mode=0o755) - rc, report = testlib.cmd([script]) - - # It should not have crashed. Let's see if it did - self._testDaemons(['upsd']) - self.assertTrue('ERR UNKNOWN-COMMAND' in report, "Could not find 'ERR UNKNOWN-COMMAND' in:\n%s" % report) - - # This CVE may also result in a hung upsd. Try to kill it, if it is - # still around, it is hung - testlib.cmd(['killall', 'upsd']) - pidfile = os.path.join(self.rundir, 'upsd.pid') - timeout = 50 - while timeout > 0 and os.path.exists(pidfile): - time.sleep(0.1) - timeout -= 1 - self.assertFalse(os.path.exists(pidfile), "Found %s" % pidfile) - self.assertFalse(testlib.check_pidfile('upsd', pidfile), 'upsd is hung') - #subprocess.call(['bash']) - -# FIXME -#class AdvancedTest(NutTestCommon, PrivateNutTest): -# '''Test advanced NUT functionalities''' - -if __name__ == '__main__': - - suite = unittest.TestSuite() - # more configurable - if (len(sys.argv) == 1 or sys.argv[1] == '-v'): - suite.addTest(unittest.TestLoader().loadTestsFromTestCase(BasicTest)) - - # Pull in private tests - #if use_private: - # suite.addTest(unittest.TestLoader().loadTestsFromTestCase(MyPrivateTest)) - - else: - print('''Usage: - test-nut.py [-v] basic tests -''') - sys.exit(1) - rc = unittest.TextTestRunner(verbosity=2).run(suite) - if not rc.wasSuccessful(): - sys.exit(1) diff --git a/debian/tests/testlib.py b/debian/tests/testlib.py deleted file mode 100644 index bc72b07..0000000 --- a/debian/tests/testlib.py +++ /dev/null @@ -1,1144 +0,0 @@ -# -# testlib.py quality assurance test script -# Copyright (C) 2008-2011 Canonical Ltd. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public -# License along with this program. If not, see -# . -# - -'''Common classes and functions for package tests.''' - -import string, random, crypt, subprocess, pwd, grp, signal, time, unittest, tempfile, shutil, os, os.path, re, glob -import sys, socket, gzip -from stat import * - -import warnings -warnings.filterwarnings('ignore', message=r'.*apt_pkg\.TagFile.*', category=DeprecationWarning) -try: - import apt_pkg - apt_pkg.InitSystem(); -except: - # On non-Debian system, fall back to simple comparison without debianisms - class apt_pkg(object): - def VersionCompare(one, two): - list_one = one.split('.') - list_two = two.split('.') - while len(list_one)>0 and len(list_two)>0: - if list_one[0] > list_two[0]: - return 1 - if list_one[0] < list_two[0]: - return -1 - list_one.pop(0) - list_two.pop(0) - return 0 - -bogus_nxdomain = "208.69.32.132" - -# http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2009-07-02-python-sigpipe.html -# This is needed so that the subprocesses that produce endless output -# actually quit when the reader goes away. -import signal -def subprocess_setup(): - # Python installs a SIGPIPE handler by default. This is usually not what - # non-Python subprocesses expect. - signal.signal(signal.SIGPIPE, signal.SIG_DFL) - -class TimedOutException(Exception): - def __init__(self, value = "Timed Out"): - self.value = value - def __str__(self): - return repr(self.value) - -def _restore_backup(path): - pathbackup = path + '.autotest' - if os.path.exists(pathbackup): - shutil.move(pathbackup, path) - -def _save_backup(path): - pathbackup = path + '.autotest' - if os.path.exists(path) and not os.path.exists(pathbackup): - shutil.copy2(path, pathbackup) - # copy2 does not copy ownership, so do it here. - # Reference: http://docs.python.org/library/shutil.html - a = os.stat(path) - os.chown(pathbackup, a[4], a[5]) - -def config_copydir(path): - if os.path.exists(path) and not os.path.isdir(path): - raise OSError("'%s' is not a directory" % (path)) - _restore_backup(path) - - pathbackup = path + '.autotest' - if os.path.exists(path): - shutil.copytree(path, pathbackup, symlinks=True) - -def config_replace(path,contents,append=False): - '''Replace (or append) to a config file''' - _restore_backup(path) - if os.path.exists(path): - _save_backup(path) - if append: - contents = open(path).read() + contents - open(path, 'w').write(contents) - -def config_comment(path, field): - _save_backup(path) - contents = "" - for line in open(path).readlines(): - if re.search("^\s*%s\s*=" % (field), line): - line = "#" + line - contents += line - - open(path+'.new', 'w').write(contents) - os.rename(path+'.new', path) - -def config_set(path, field, value, spaces=True): - _save_backup(path) - contents = "" - if spaces==True: - setting = '%s = %s\n' % (field, value) - else: - setting = '%s=%s\n' % (field, value) - found = False - for line in open(path).readlines(): - if re.search("^\s*%s\s*=" % (field), line): - found = True - line = setting - contents += line - if not found: - contents += setting - - open(path+'.new', 'w').write(contents) - os.rename(path+'.new', path) - -def config_patch(path, patch, depth=1): - '''Patch a config file''' - _restore_backup(path) - _save_backup(path) - - handle, name = mkstemp_fill(patch) - rc = subprocess.call(['/usr/bin/patch', '-p%s' %(depth), path], stdin=handle, stdout=subprocess.PIPE) - os.unlink(name) - if rc != 0: - raise Exception("Patch failed") - -def config_restore(path): - '''Rename a replaced config file back to its initial state''' - _restore_backup(path) - -def timeout(secs, f, *args): - def handler(signum, frame): - raise TimedOutException() - - old = signal.signal(signal.SIGALRM, handler) - result = None - signal.alarm(secs) - try: - result = f(*args) - finally: - signal.alarm(0) - signal.signal(signal.SIGALRM, old) - - return result - -def require_nonroot(): - if os.geteuid() == 0: - print("This series of tests should be run as a regular user with sudo access, not as root.", file=sys.stderr) - sys.exit(1) - -def require_root(): - if os.geteuid() != 0: - print("This series of tests should be run with root privileges (e.g. via sudo).", file=sys.stderr) - sys.exit(1) - -def require_sudo(): - if os.geteuid() != 0 or os.environ.get('SUDO_USER', None) == None: - print("This series of tests must be run under sudo.", file=sys.stderr) - sys.exit(1) - if os.environ['SUDO_USER'] == 'root': - print('Please run this test using sudo from a regular user. (You ran sudo from root.)', file=sys.stderr) - sys.exit(1) - -def random_string(length,lower=False): - '''Return a random string, consisting of ASCII letters, with given - length.''' - - s = '' - selection = string.letters - if lower: - selection = string.lowercase - maxind = len(selection)-1 - for l in range(length): - s += selection[random.randint(0, maxind)] - return s - -def mkstemp_fill(contents,suffix='',prefix='testlib-',dir=None): - '''As tempfile.mkstemp does, return a (file, name) pair, but with - prefilled contents.''' - - handle, name = tempfile.mkstemp(suffix=suffix,prefix=prefix,dir=dir) - os.close(handle) - handle = open(name,"w+") - handle.write(contents) - handle.flush() - handle.seek(0) - - return handle, name - -def create_fill(path, contents, mode=0o644): - '''Safely create a page''' - # make the temp file in the same dir as the destination file so we - # don't get invalid cross-device link errors when we rename - handle, name = mkstemp_fill(contents, dir=os.path.dirname(path)) - handle.close() - os.rename(name, path) - os.chmod(path, mode) - -def login_exists(login): - '''Checks whether the given login exists on the system.''' - - try: - pwd.getpwnam(login) - return True - except KeyError: - return False - -def group_exists(group): - '''Checks whether the given login exists on the system.''' - - try: - grp.getgrnam(group) - return True - except KeyError: - return False - -def recursive_rm(dirPath, contents_only=False): - '''recursively remove directory''' - names = os.listdir(dirPath) - for name in names: - path = os.path.join(dirPath, name) - if os.path.islink(path) or not os.path.isdir(path): - os.unlink(path) - else: - recursive_rm(path) - if contents_only == False: - os.rmdir(dirPath) - -def check_pidfile(exe, pidfile): - '''Checks if pid in pidfile is running''' - if not os.path.exists(pidfile): - return False - - # get the pid - try: - fd = open(pidfile, 'r') - pid = fd.readline().rstrip('\n') - fd.close() - except: - return False - - return check_pid(exe, pid) - -def check_pid(exe, pid): - '''Checks if pid is running''' - cmdline = "/proc/%s/cmdline" % (str(pid)) - if not os.path.exists(cmdline): - return False - - # get the command line - try: - fd = open(cmdline, 'r') - tmp = fd.readline().split('\0') - fd.close() - except: - return False - - # this allows us to match absolute paths or just the executable name - if re.match('^' + exe + '$', tmp[0]) or \ - re.match('.*/' + exe + '$', tmp[0]) or \ - re.match('^' + exe + ': ', tmp[0]) or \ - re.match('^\(' + exe + '\)', tmp[0]): - return True - - return False - -def check_port(port, proto, ver=4): - '''Check if something is listening on the specified port. - WARNING: for some reason this does not work with a bind mounted /proc - ''' - assert (port >= 1) - assert (port <= 65535) - assert (proto.lower() == "tcp" or proto.lower() == "udp") - assert (ver == 4 or ver == 6) - - fn = "/proc/net/%s" % (proto) - if ver == 6: - fn += str(ver) - - rc, report = cmd(['cat', fn]) - assert (rc == 0) - - hport = "%0.4x" % port - - if re.search(': [0-9a-f]{8}:%s [0-9a-f]' % str(hport).lower(), report.lower()): - return True - return False - -def get_arch(): - '''Get the current architecture''' - rc, report = cmd(['uname', '-m']) - assert (rc == 0) - return report.strip() - -def get_memory(): - '''Gets total ram and swap''' - meminfo = "/proc/meminfo" - memtotal = 0 - swaptotal = 0 - if not os.path.exists(meminfo): - return (False, False) - - try: - fd = open(meminfo, 'r') - for line in fd.readlines(): - splitline = line.split() - if splitline[0] == 'MemTotal:': - memtotal = int(splitline[1]) - elif splitline[0] == 'SwapTotal:': - swaptotal = int(splitline[1]) - fd.close() - except: - return (False, False) - - return (memtotal,swaptotal) - -def is_running_in_vm(): - '''Check if running under a VM''' - # add other virtualization environments here - for search in ['QEMU Virtual CPU']: - rc, report = cmd_pipe(['dmesg'], ['grep', search]) - if rc == 0: - return True - return False - -def ubuntu_release(): - '''Get the Ubuntu release''' - f = "/etc/lsb-release" - try: - size = os.stat(f)[ST_SIZE] - except: - return "UNKNOWN" - - if size > 1024*1024: - raise IOError('Could not open "%s" (too big)' % f) - - try: - fh = open("/etc/lsb-release", 'r') - except: - raise - - lines = fh.readlines() - fh.close() - - pat = re.compile(r'DISTRIB_CODENAME') - for line in lines: - if pat.search(line): - return line.split('=')[1].rstrip('\n').rstrip('\r') - - return "UNKNOWN" - -def cmd(command, input = None, stderr = subprocess.STDOUT, stdout = subprocess.PIPE, stdin = None, timeout = None): - '''Try to execute given command (array) and return its stdout, or return - a textual error if it failed.''' - - try: - sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr, close_fds=True, preexec_fn=subprocess_setup, universal_newlines=True) - except OSError as e: - return [127, str(e)] - - out, outerr = sp.communicate(input) - # Handle redirection of stdout - if out == None: - out = '' - # Handle redirection of stderr - if outerr == None: - outerr = '' - return [sp.returncode,out+outerr] - -def cmd_pipe(command1, command2, input = None, stderr = subprocess.STDOUT, stdin = None): - '''Try to pipe command1 into command2.''' - try: - sp1 = subprocess.Popen(command1, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) - sp2 = subprocess.Popen(command2, stdin=sp1.stdout, stdout=subprocess.PIPE, stderr=stderr, close_fds=True) - except OSError as e: - return [127, str(e)] - - out = sp2.communicate(input)[0] - return [sp2.returncode,out] - -def cwd_has_enough_space(cdir, total_bytes): - '''Determine if the partition of the current working directory has 'bytes' - free.''' - rc, df_output = cmd(['df']) - result = 'Got exit code %d, expected %d\n' % (rc, 0) - if rc != 0: - return False - - kb = total_bytes / 1024 - - mounts = dict() - for line in df_output.splitlines(): - if '/' not in line: - continue - tmp = line.split() - mounts[tmp[5]] = int(tmp[3]) - - cdir = os.getcwd() - while cdir != '/': - if cdir not in mounts: - cdir = os.path.dirname(cdir) - continue - if kb < mounts[cdir]: - return True - else: - return False - - if kb < mounts['/']: - return True - - return False - -def get_md5(filename): - '''Gets the md5sum of the file specified''' - - (rc, report) = cmd(["/usr/bin/md5sum", "-b", filename]) - expected = 0 - assert (expected == rc) - - return report.split(' ')[0] - -def dpkg_compare_installed_version(pkg, check, version): - '''Gets the version for the installed package, and compares it to the - specified version. - ''' - (rc, report) = cmd(["/usr/bin/dpkg", "-s", pkg]) - assert (rc == 0) - assert ("Status: install ok installed" in report) - installed_version = "" - for line in report.splitlines(): - if line.startswith("Version: "): - installed_version = line.split()[1] - - assert (installed_version != "") - - (rc, report) = cmd(["/usr/bin/dpkg", "--compare-versions", installed_version, check, version]) - assert (rc == 0 or rc == 1) - if rc == 0: - return True - return False - -def prepare_source(source, builder, cached_src, build_src, patch_system): - '''Download and unpack source package, installing necessary build depends, - adjusting the permissions for the 'builder' user, and returning the - directory of the unpacked source. Patch system can be one of: - - cdbs - - dpatch - - quilt - - quiltv3 - - None (not the string) - - This is normally used like this: - - def setUp(self): - ... - self.topdir = os.getcwd() - self.cached_src = os.path.join(os.getcwd(), "source") - self.tmpdir = tempfile.mkdtemp(prefix='testlib', dir='/tmp') - self.builder = testlib.TestUser() - testlib.cmd(['chgrp', self.builder.login, self.tmpdir]) - os.chmod(self.tmpdir, 0775) - - def tearDown(self): - ... - self.builder = None - self.topdir = os.getcwd() - if os.path.exists(self.tmpdir): - testlib.recursive_rm(self.tmpdir) - - def test_suite_build(self): - ... - build_dir = testlib.prepare_source('foo', \ - self.builder, \ - self.cached_src, \ - os.path.join(self.tmpdir, \ - os.path.basename(self.cached_src)), - "quilt") - os.chdir(build_dir) - - # Example for typical build, adjust as necessary - print "" - print " make clean" - rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'clean']) - - print " configure" - rc, report = testlib.cmd(['sudo', '-u', self.builder.login, './configure', '--prefix=%s' % self.tmpdir, '--enable-debug']) - - print " make (will take a while)" - rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make']) - - print " make check (will take a while)", - rc, report = testlib.cmd(['sudo', '-u', self.builder.login, 'make', 'check']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEquals(expected, rc, result + report) - - def test_suite_cleanup(self): - ... - if os.path.exists(self.cached_src): - testlib.recursive_rm(self.cached_src) - - It is up to the caller to clean up cached_src and build_src (as in the - above example, often the build_src is in a tmpdir that is cleaned in - tearDown() and the cached_src is cleaned in a one time clean-up - operation (eg 'test_suite_cleanup()) which must be run after the build - suite test (obviously). - ''' - - # Make sure we have a clean slate - assert (os.path.exists(os.path.dirname(build_src))) - assert (not os.path.exists(build_src)) - - cdir = os.getcwd() - if os.path.exists(cached_src): - shutil.copytree(cached_src, build_src) - os.chdir(build_src) - else: - # Only install the build dependencies on the initial setup - rc, report = cmd(['apt-get','-y','--force-yes','build-dep',source]) - assert (rc == 0) - - os.makedirs(build_src) - os.chdir(build_src) - - # These are always needed - pkgs = ['build-essential', 'dpkg-dev', 'fakeroot'] - rc, report = cmd(['apt-get','-y','--force-yes','install'] + pkgs) - assert (rc == 0) - - rc, report = cmd(['apt-get','source',source]) - assert (rc == 0) - shutil.copytree(build_src, cached_src) - - unpacked_dir = os.path.join(build_src, glob.glob('%s-*' % source)[0]) - - # Now apply the patches. Do it here so that we don't mess up our cached - # sources. - os.chdir(unpacked_dir) - assert (patch_system in ['cdbs', 'dpatch', 'quilt', 'quiltv3', None]) - if patch_system != None and patch_system != "quiltv3": - if patch_system == "quilt": - os.environ.setdefault('QUILT_PATCHES','debian/patches') - rc, report = cmd(['quilt', 'push', '-a']) - assert (rc == 0) - elif patch_system == "cdbs": - rc, report = cmd(['./debian/rules', 'apply-patches']) - assert (rc == 0) - elif patch_system == "dpatch": - rc, report = cmd(['dpatch', 'apply-all']) - assert (rc == 0) - - cmd(['chown', '-R', '%s:%s' % (builder.uid, builder.gid), build_src]) - os.chdir(cdir) - - return unpacked_dir - -def _aa_status(): - '''Get aa-status output''' - exe = "/usr/sbin/aa-status" - assert (os.path.exists(exe)) - if os.geteuid() == 0: - return cmd([exe]) - return cmd(['sudo', exe]) - -def is_apparmor_loaded(path): - '''Check if profile is loaded''' - rc, report = _aa_status() - if rc != 0: - return False - - for line in report.splitlines(): - if line.endswith(path): - return True - return False - -def is_apparmor_confined(path): - '''Check if application is confined''' - rc, report = _aa_status() - if rc != 0: - return False - - for line in report.splitlines(): - if re.search('%s \(' % path, line): - return True - return False - -def check_apparmor(path, first_ubuntu_release, is_running=True): - '''Check if path is loaded and confined for everything higher than the - first Ubuntu release specified. - - Usage: - rc, report = testlib.check_apparmor('/usr/sbin/foo', 8.04, is_running=True) - if rc < 0: - return self._skipped(report) - - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEquals(expected, rc, result + report) - ''' - global manager - rc = -1 - - if manager.lsb_release["Release"] < first_ubuntu_release: - return (rc, "Skipped apparmor check") - - if not os.path.exists('/sbin/apparmor_parser'): - return (rc, "Skipped (couldn't find apparmor_parser)") - - rc = 0 - msg = "" - if not is_apparmor_loaded(path): - rc = 1 - msg = "Profile not loaded for '%s'" % path - - # this check only makes sense it the 'path' is currently executing - if is_running and rc == 0 and not is_apparmor_confined(path): - rc = 1 - msg = "'%s' is not running in enforce mode" % path - - return (rc, msg) - -def get_gcc_version(gcc, full=True): - gcc_version = 'none' - if not gcc.startswith('/'): - gcc = '/usr/bin/%s' % (gcc) - if os.path.exists(gcc): - gcc_version = 'unknown' - lines = cmd([gcc,'-v'])[1].strip().splitlines() - version_lines = [x for x in lines if x.startswith('gcc version')] - if len(version_lines) == 1: - gcc_version = " ".join(version_lines[0].split()[2:]) - if not full: - return gcc_version.split()[0] - return gcc_version - -def is_kdeinit_running(): - '''Test if kdeinit is running''' - # applications that use kdeinit will spawn it if it isn't running in the - # test. This is a problem because it does not exit. This is a helper to - # check for it. - rc, report = cmd(['ps', 'x']) - if 'kdeinit4 Running' not in report: - print(("kdeinit not running (you may start/stop any KDE application then run this script again)"), file=sys.stderr) - return False - return True - -def get_pkgconfig_flags(libs=[]): - '''Find pkg-config flags for libraries''' - assert (len(libs) > 0) - rc, pkg_config = cmd(['pkg-config', '--cflags', '--libs'] + libs) - expected = 0 - if rc != expected: - print('Got exit code %d, expected %d\n' % (rc, expected), file=sys.stderr) - assert(rc == expected) - return pkg_config.split() - -class TestDaemon: - '''Helper class to manage daemons consistently''' - def __init__(self, init): - '''Setup daemon attributes''' - self.initscript = init - - def start(self): - '''Start daemon''' - rc, report = cmd([self.initscript, 'start']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - time.sleep(2) - if expected != rc: - return (False, result + report) - - if "fail" in report: - return (False, "Found 'fail' in report\n" + report) - - return (True, "") - - def stop(self): - '''Stop daemon''' - rc, report = cmd([self.initscript, 'stop']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - if expected != rc: - return (False, result + report) - - if "fail" in report: - return (False, "Found 'fail' in report\n" + report) - - return (True, "") - - def reload(self): - '''Reload daemon''' - rc, report = cmd([self.initscript, 'force-reload']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - if expected != rc: - return (False, result + report) - - if "fail" in report: - return (False, "Found 'fail' in report\n" + report) - - return (True, "") - - def restart(self): - '''Restart daemon''' - (res, str) = self.stop() - if not res: - return (res, str) - - (res, str) = self.start() - if not res: - return (res, str) - - return (True, "") - - def status(self): - '''Check daemon status''' - rc, report = cmd([self.initscript, 'status']) - expected = 0 - result = 'Got exit code %d, expected %d\n' % (rc, expected) - if expected != rc: - return (False, result + report) - - if "fail" in report: - return (False, "Found 'fail' in report\n" + report) - - return (True, "") - -class TestlibManager(object): - '''Singleton class used to set up per-test-run information''' - def __init__(self): - # Set glibc aborts to dump to stderr instead of the tty so test output - # is more sane. - os.environ.setdefault('LIBC_FATAL_STDERR_','1') - - # check verbosity - self.verbosity = False - if (len(sys.argv) > 1 and '-v' in sys.argv[1:]): - self.verbosity = True - - # Load LSB release file - self.lsb_release = dict() - if not os.path.exists('/usr/bin/lsb_release') and not os.path.exists('/bin/lsb_release'): - raise OSError("Please install 'lsb-release'") - for line in subprocess.Popen(['lsb_release','-a'],stdout=subprocess.PIPE,stderr=subprocess.PIPE, universal_newlines=True).communicate()[0].splitlines(): - field, value = line.split(':',1) - value=value.strip() - field=field.strip() - # Convert numerics - try: - value = float(value) - except: - pass - self.lsb_release.setdefault(field,value) - - # FIXME: hack OEM releases into known-Ubuntu versions - if self.lsb_release['Distributor ID'] == "HP MIE (Mobile Internet Experience)": - if self.lsb_release['Release'] == 1.0: - self.lsb_release['Distributor ID'] = "Ubuntu" - self.lsb_release['Release'] = 8.04 - else: - raise OSError("Unknown version of HP MIE") - - # FIXME: hack to assume a most-recent release if we're not - # running under Ubuntu. - if self.lsb_release['Distributor ID'] not in ["Ubuntu","Linaro"]: - self.lsb_release['Release'] = 10000 - # Adjust Linaro release to pretend to be Ubuntu - if self.lsb_release['Distributor ID'] in ["Linaro"]: - self.lsb_release['Distributor ID'] = "Ubuntu" - self.lsb_release['Release'] -= 0.01 - - # Load arch - if not os.path.exists('/usr/bin/dpkg'): - machine = cmd(['uname','-m'])[1].strip() - if machine.endswith('86'): - self.dpkg_arch = 'i386' - elif machine.endswith('_64'): - self.dpkg_arch = 'amd64' - elif machine.startswith('arm'): - self.dpkg_arch = 'armel' - else: - raise ValueError("Unknown machine type '%s'" % (machine)) - else: - self.dpkg_arch = cmd(['dpkg','--print-architecture'])[1].strip() - - # Find kernel version - self.kernel_is_ubuntu = False - self.kernel_version_signature = None - self.kernel_version = cmd(["uname","-r"])[1].strip() - versig = '/proc/version_signature' - if os.path.exists(versig): - self.kernel_is_ubuntu = True - with open(versig) as f: - self.kernel_version_signature = f.read().strip() - self.kernel_version_ubuntu = self.kernel_version - elif os.path.exists('/usr/bin/dpkg'): - # this can easily be inaccurate but is only an issue for Dapper - rc, out = cmd(['dpkg','-l','linux-image-%s' % (self.kernel_version)]) - if rc == 0: - self.kernel_version_signature = out.strip().split('\n').pop().split()[2] - self.kernel_version_ubuntu = self.kernel_version_signature - if self.kernel_version_signature == None: - # Attempt to fall back to something for non-Debian-based - self.kernel_version_signature = self.kernel_version - self.kernel_version_ubuntu = self.kernel_version - # Build ubuntu version without hardware suffix - try: - self.kernel_version_ubuntu = "-".join([x for x in self.kernel_version_signature.split(' ')[1].split('-') if re.search('^[0-9]', x)]) - except: - pass - - # Find gcc version - self.gcc_version = get_gcc_version('gcc') - - # Find libc - self.path_libc = [x.split()[2] for x in cmd(['ldd','/bin/ls'])[1].splitlines() if x.startswith('\tlibc.so.')][0] - - # Report self - if self.verbosity: - kernel = self.kernel_version_ubuntu - if kernel != self.kernel_version_signature: - kernel += " (%s)" % (self.kernel_version_signature) - print("Running test: '%s' distro: '%s %.2f' kernel: '%s' arch: '%s' uid: %d/%d SUDO_USER: '%s')" % ( \ - sys.argv[0], - self.lsb_release['Distributor ID'], - self.lsb_release['Release'], - kernel, - self.dpkg_arch, - os.geteuid(), os.getuid(), - os.environ.get('SUDO_USER', '')), file=sys.stdout) - sys.stdout.flush() - - # Additional heuristics - #if os.environ.get('SUDO_USER', os.environ.get('USER', '')) in ['mdeslaur']: - # sys.stdout.write("Replying to Marc Deslauriers in http://launchpad.net/bugs/%d: " % random.randint(600000, 980000)) - # sys.stdout.flush() - # time.sleep(0.5) - # sys.stdout.write("destroyed\n") - # time.sleep(0.5) - - def hello(self, msg): - print("Hello from %s" % (msg), file=sys.stderr) -# The central instance -manager = TestlibManager() - -class TestlibCase(unittest.TestCase): - def __init__(self, *args): - '''This is called for each TestCase test instance, which isn't much better - than SetUp.''' - - unittest.TestCase.__init__(self, *args) - - # Attach to and duplicate dicts from manager singleton - self.manager = manager - #self.manager.hello(repr(self) + repr(*args)) - self.my_verbosity = self.manager.verbosity - self.lsb_release = self.manager.lsb_release - self.dpkg_arch = self.manager.dpkg_arch - self.kernel_version = self.manager.kernel_version - self.kernel_version_signature = self.manager.kernel_version_signature - self.kernel_version_ubuntu = self.manager.kernel_version_ubuntu - self.kernel_is_ubuntu = self.manager.kernel_is_ubuntu - self.gcc_version = self.manager.gcc_version - self.path_libc = self.manager.path_libc - - def version_compare(self, one, two): - return apt_pkg.VersionCompare(one,two) - - def assertFileType(self, filename, filetype): - '''Checks the file type of the file specified''' - - (rc, report, out) = self._testlib_shell_cmd(["/usr/bin/file", "-b", filename]) - out = out.strip() - expected = 0 - # Absolutely no idea why this happens on Hardy - if self.lsb_release['Release'] == 8.04 and rc == 255 and len(out) > 0: - rc = 0 - result = 'Got exit code %d, expected %d:\n%s\n' % (rc, expected, report) - self.assertEqual(expected, rc, result) - - filetype = '^%s$' % (filetype) - result = 'File type reported by file: [%s], expected regex: [%s]\n' % (out, filetype) - self.assertNotEqual(None, re.search(filetype, out), result) - - def yank_commonname_from_cert(self, certfile): - '''Extract the commonName from a given PEM''' - rc, out = cmd(['openssl','asn1parse','-in',certfile]) - if rc == 0: - ready = False - for line in out.splitlines(): - if ready: - return line.split(':')[-1] - if ':commonName' in line: - ready = True - return socket.getfqdn() - - def announce(self, text): - if self.my_verbosity: - print("(%s) " % (text), end=' ', file=sys.stdout) - sys.stdout.flush() - - def make_clean(self): - rc, output = self.shell_cmd(['make','clean']) - self.assertEqual(rc, 0, output) - - def get_makefile_compiler(self): - # Find potential compiler name - compiler = 'gcc' - if os.path.exists('Makefile'): - for line in open('Makefile'): - if line.startswith('CC') and '=' in line: - items = [x.strip() for x in line.split('=')] - if items[0] == 'CC': - compiler = items[1] - break - return compiler - - def make_target(self, target, expected=0): - '''Compile a target and report output''' - - compiler = self.get_makefile_compiler() - rc, output = self.shell_cmd(['make',target]) - self.assertEqual(rc, expected, 'rc(%d)!=%d:\n' % (rc, expected) + output) - self.assertTrue('%s ' % (compiler) in output, 'Expected "%s":' % (compiler) + output) - return output - - # call as return testlib.skipped() - def _skipped(self, reason=""): - '''Provide a visible way to indicate that a test was skipped''' - if reason != "": - reason = ': %s' % (reason) - self.announce("skipped%s" % (reason)) - return False - - def _testlib_shell_cmd(self,args,stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT): - argstr = "'" + "', '".join(args).strip() + "'" - rc, out = cmd(args,stdin=stdin,stdout=stdout,stderr=stderr) - report = 'Command: ' + argstr + '\nOutput:\n' + out - return rc, report, out - - def shell_cmd(self, args, stdin=None): - return cmd(args,stdin=stdin) - - def assertShellExitEquals(self, expected, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): - '''Test a shell command matches a specific exit code''' - rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) - result = 'Got exit code %d, expected %d\n' % (rc, expected) - self.assertEqual(expected, rc, msg + result + report) - - def assertShellExitNotEquals(self, unwanted, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg=""): - '''Test a shell command doesn't match a specific exit code''' - rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) - result = 'Got (unwanted) exit code %d\n' % rc - self.assertNotEqual(unwanted, rc, msg + result + report) - - def assertShellOutputContains(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False): - '''Test a shell command contains a specific output''' - rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) - result = 'Got exit code %d. Looking for text "%s"\n' % (rc, text) - if not invert: - self.assertTrue(text in out, msg + result + report) - else: - self.assertFalse(text in out, msg + result + report) - - def assertShellOutputEquals(self, text, args, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, msg="", invert=False, expected=None): - '''Test a shell command matches a specific output''' - rc, report, out = self._testlib_shell_cmd(args, stdin=stdin, stdout=stdout, stderr=stderr) - result = 'Got exit code %d. Looking for exact text "%s" (%s)\n' % (rc, text, " ".join(args)) - if not invert: - self.assertEqual(text, out, msg + result + report) - else: - self.assertNotEqual(text, out, msg + result + report) - if expected != None: - result = 'Got exit code %d. Expected %d (%s)\n' % (rc, expected, " ".join(args)) - self.assertEqual(rc, expected, msg + result + report) - - def _word_find(self, report, content, invert=False): - '''Check for a specific string''' - if invert: - warning = 'Found "%s"\n' % content - self.assertTrue(content not in report, warning + report) - else: - warning = 'Could not find "%s"\n' % content - self.assertTrue(content in report, warning + report) - - def _test_sysctl_value(self, path, expected, msg=None, exists=True): - sysctl = '/proc/sys/%s' % (path) - self.assertEqual(exists, os.path.exists(sysctl), sysctl) - value = None - if exists: - value = int(open(sysctl).read()) - report = "%s is not %d: %d" % (sysctl, expected, value) - if msg: - report += " (%s)" % (msg) - self.assertEqual(value, expected, report) - return value - - def set_sysctl_value(self, path, desired): - sysctl = '/proc/sys/%s' % (path) - self.assertTrue(os.path.exists(sysctl),"%s does not exist" % (sysctl)) - open(sysctl,'w').write(str(desired)) - self._test_sysctl_value(path, desired) - - def kernel_at_least(self, introduced): - return self.version_compare(self.kernel_version_ubuntu, - introduced) >= 0 - - def kernel_claims_cve_fixed(self, cve): - changelog = "/usr/share/doc/linux-image-%s/changelog.Debian.gz" % (self.kernel_version) - if os.path.exists(changelog): - for line in gzip.open(changelog): - if cve in line and not "revert" in line and not "Revert" in line: - return True - return False - -class TestGroup: - '''Create a temporary test group and remove it again in the dtor.''' - - def __init__(self, group=None, lower=False): - '''Create a new group''' - - self.group = None - if group: - if group_exists(group): - raise ValueError('group name already exists') - else: - while(True): - group = random_string(7,lower=lower) - if not group_exists(group): - break - - assert subprocess.call(['groupadd',group]) == 0 - self.group = group - g = grp.getgrnam(self.group) - self.gid = g[2] - - def __del__(self): - '''Remove the created group.''' - - if self.group: - rc, report = cmd(['groupdel', self.group]) - assert rc == 0 - -class TestUser: - '''Create a temporary test user and remove it again in the dtor.''' - - def __init__(self, login=None, home=True, group=None, uidmin=None, lower=False, shell=None): - '''Create a new user account with a random password. - - By default, the login name is random, too, but can be explicitly - specified with 'login'. By default, a home directory is created, this - can be suppressed with 'home=False'.''' - - self.login = None - - if os.geteuid() != 0: - raise ValueError("You must be root to run this test") - - if login: - if login_exists(login): - raise ValueError('login name already exists') - else: - while(True): - login = 't' + random_string(7,lower=lower) - if not login_exists(login): - break - - self.salt = random_string(2) - self.password = random_string(8,lower=lower) - self.crypted = crypt.crypt(self.password, self.salt) - - creation = ['useradd', '-p', self.crypted] - if home: - creation += ['-m'] - if group: - creation += ['-G',group] - if uidmin: - creation += ['-K','UID_MIN=%d'%uidmin] - if shell: - creation += ['-s',shell] - creation += [login] - assert subprocess.call(creation) == 0 - # Set GECOS - assert subprocess.call(['usermod','-c','Buddy %s' % (login),login]) == 0 - - self.login = login - p = pwd.getpwnam(self.login) - self.uid = p[2] - self.gid = p[3] - self.gecos = p[4] - self.home = p[5] - self.shell = p[6] - - def __del__(self): - '''Remove the created user account.''' - - if self.login: - # sanity check the login name so we don't accidentally wipe too much - if len(self.login)>3 and not '/' in self.login: - subprocess.call(['rm','-rf', '/home/'+self.login, '/var/mail/'+self.login]) - rc, report = cmd(['userdel', '-f', self.login]) - assert rc == 0 - - def add_to_group(self, group): - '''Add user to the specified group name''' - rc, report = cmd(['usermod', '-G', group, self.login]) - if rc != 0: - print(report) - assert rc == 0 - -# Timeout handler using alarm() from John P. Speno's Pythonic Avocado -class TimeoutFunctionException(Exception): - """Exception to raise on a timeout""" - pass -class TimeoutFunction: - def __init__(self, function, timeout): - self.timeout = timeout - self.function = function - - def handle_timeout(self, signum, frame): - raise TimeoutFunctionException() - - def __call__(self, *args, **kwargs): - old = signal.signal(signal.SIGALRM, self.handle_timeout) - signal.alarm(self.timeout) - try: - result = self.function(*args, **kwargs) - finally: - signal.signal(signal.SIGALRM, old) - signal.alarm(0) - return result - -def main(): - print("hi") - unittest.main() diff --git a/debian/upstream/metadata b/debian/upstream/metadata deleted file mode 100644 index 6e031b2..0000000 --- a/debian/upstream/metadata +++ /dev/null @@ -1,6 +0,0 @@ ---- -Name: nut -Bug-Database: https://github.com/networkupstools/nut/issues -Bug-Submit: https://github.com/networkupstools/nut/issues -Repository: https://github.com/networkupstools/nut.git -Repository-Browse: https://github.com/networkupstools/nut diff --git a/debian/watch b/debian/watch deleted file mode 100644 index e228e43..0000000 --- a/debian/watch +++ /dev/null @@ -1,2 +0,0 @@ -version=3 -https://networkupstools.org/download.html .*/nut-(.*)\.tar\.(?:gz|bz2|xz) diff --git a/depcomp b/depcomp index 6b39162..25a39e6 100755 --- a/depcomp +++ b/depcomp @@ -1,9 +1,10 @@ #! /bin/sh # depcomp - compile a program generating dependencies as side-effects -scriptversion=2018-03-07.03; # UTC +scriptversion=2012-03-27.16; # UTC -# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010, +# 2011, 2012 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -16,7 +17,7 @@ scriptversion=2018-03-07.03; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,9 +28,9 @@ scriptversion=2018-03-07.03; # UTC case $1 in '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] @@ -56,65 +57,11 @@ EOF ;; esac -# Get the directory component of the given path, and save it in the -# global variables '$dir'. Note that this directory component will -# be either empty or ending with a '/' character. This is deliberate. -set_dir_from () -{ - case $1 in - */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; - *) dir=;; - esac -} - -# Get the suffix-stripped basename of the given path, and save it the -# global variable '$base'. -set_base_from () -{ - base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` -} - -# If no dependency file was actually created by the compiler invocation, -# we still have to create a dummy depfile, to avoid errors with the -# Makefile "include basename.Plo" scheme. -make_dummy_depfile () -{ - echo "#dummy" > "$depfile" -} - -# Factor out some common post-processing of the generated depfile. -# Requires the auxiliary global variable '$tmpdepfile' to be set. -aix_post_process_depfile () -{ - # If the compiler actually managed to produce a dependency file, - # post-process it. - if test -f "$tmpdepfile"; then - # Each line is of the form 'foo.o: dependency.h'. - # Do two passes, one to just change these to - # $object: dependency.h - # and one to simply output - # dependency.h: - # which is needed to avoid the deleted-header problem. - { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" - sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" - } > "$depfile" - rm -f "$tmpdepfile" - else - make_dummy_depfile - fi -} - # A tabulation character. tab=' ' # A newline character. nl=' ' -# Character ranges might be problematic outside the C locale. -# These definitions help. -upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ -lower=abcdefghijklmnopqrstuvwxyz -digits=0123456789 -alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 @@ -128,9 +75,6 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" -# Avoid interferences from the environment. -gccflag= dashmflag= - # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case @@ -142,32 +86,32 @@ if test "$depmode" = hp; then fi if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then - # This is just like msvisualcpp but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvisualcpp + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then - # This is just like msvc7 but w/o cygpath translation. - # Just convert the backslash-escaped backslashes to single forward - # slashes to satisfy depend.m4 - cygpath_u='sed s,\\\\,/,g' - depmode=msvc7 + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 fi if test "$depmode" = xlc; then - # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. - gccflag=-qmakedep=gcc,-MF - depmode=gcc + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations. + gccflag=-qmakedep=gcc,-MF + depmode=gcc fi case "$depmode" in @@ -190,7 +134,8 @@ gcc3) done "$@" stat=$? - if test $stat -ne 0; then + if test $stat -eq 0; then : + else rm -f "$tmpdepfile" exit $stat fi @@ -198,17 +143,13 @@ gcc3) ;; gcc) -## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. -## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. -## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). Also, it might not be -## supported by the other compilers which use the 'gcc' depmode. +## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then @@ -216,14 +157,15 @@ gcc) fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? - if test $stat -ne 0; then + if test $stat -eq 0; then : + else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" - # The second -e expression handles DOS-style file names with drive - # letters. + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. @@ -232,15 +174,15 @@ gcc) ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. + tr ' ' "$nl" < "$tmpdepfile" | ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" + sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -258,7 +200,8 @@ sgi) "$@" -MDupdate "$tmpdepfile" fi stat=$? - if test $stat -ne 0; then + if test $stat -eq 0; then : + else rm -f "$tmpdepfile" exit $stat fi @@ -266,6 +209,7 @@ sgi) if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in @@ -273,15 +217,19 @@ sgi) # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ - | tr "$nl" ' ' >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr "$nl" ' ' >> "$depfile" echo >> "$depfile" + # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> "$depfile" + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" else - make_dummy_depfile + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; @@ -299,8 +247,9 @@ aix) # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. - set_dir_from "$object" - set_base_from "$object" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u @@ -313,7 +262,9 @@ aix) "$@" -M fi stat=$? - if test $stat -ne 0; then + + if test $stat -eq 0; then : + else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi @@ -322,113 +273,65 @@ aix) do test -f "$tmpdepfile" && break done - aix_post_process_depfile - ;; - -tcc) - # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 - # FIXME: That version still under development at the moment of writing. - # Make that this statement remains true also for stable, released - # versions. - # It will wrap lines (doesn't matter whether long or short) with a - # trailing '\', as in: - # - # foo.o : \ - # foo.c \ - # foo.h \ - # - # It will put a trailing '\' even on the last line, and will use leading - # spaces rather than leading tabs (at least since its commit 0394caf7 - # "Emit spaces for -MD"). - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile" - exit $stat + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependent.h'. + # Do two passes, one to just change these to + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" fi - rm -f "$depfile" - # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. - # We have to change lines of the first kind to '$object: \'. - sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" - # And for each line of the second kind, we have to emit a 'dep.h:' - # dummy dependency, to avoid the deleted-header problem. - sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; -## The order of this option in the case statement is important, since the -## shell code in configure will try each of these formats in the order -## listed in this file. A plain '-MD' option would be understood by many -## compilers, so we must ensure this comes after the gcc and icc options. -pgcc) - # Portland's C compiler understands '-MD'. - # Will always output deps to 'file.d' where file is the root name of the - # source file under compilation, even if file resides in a subdirectory. - # The object file name does not affect the name of the '.d' file. - # pgcc 10.2 will output +icc) + # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'. + # However on + # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using '\' : + # and will wrap long lines using '\': # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... - set_dir_from "$object" - # Use the source, not the object, to determine the base name, since - # that's sadly what pgcc will do too. - set_base_from "$source" - tmpdepfile=$base.d - - # For projects that build the same source file twice into different object - # files, the pgcc approach of using the *source* file root name can cause - # problems in parallel builds. Use a locking strategy to avoid stomping on - # the same $tmpdepfile. - lockdir=$base.d-lock - trap " - echo '$0: caught signal, cleaning up...' >&2 - rmdir '$lockdir' - exit 1 - " 1 2 13 15 - numtries=100 - i=$numtries - while test $i -gt 0; do - # mkdir is a portable test-and-set. - if mkdir "$lockdir" 2>/dev/null; then - # This process acquired the lock. - "$@" -MD - stat=$? - # Release the lock. - rmdir "$lockdir" - break - else - # If the lock is being held by a different process, wait - # until the winning process is done or we timeout. - while test -d "$lockdir" && test $i -gt 0; do - sleep 1 - i=`expr $i - 1` - done - fi - i=`expr $i - 1` - done - trap - 1 2 13 15 - if test $i -le 0; then - echo "$0: failed to acquire lock after $numtries attempts" >&2 - echo "$0: check lockdir '$lockdir'" >&2 - exit 1 - fi - - if test $stat -ne 0; then + # tcc 0.9.26 (FIXME still under development at the moment of writing) + # will emit a similar output, but also prepend the continuation lines + # with horizontal tabulation characters. + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Each line is of the form 'foo.o: dependent.h', + # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'. # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ - | sed -e 's/$/ :/' >> "$depfile" + # '$object: dependent.h' and one to simply 'dependent.h:'. + sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \ + < "$tmpdepfile" > "$depfile" + sed ' + s/[ '"$tab"'][ '"$tab"']*/ /g + s/^ *// + s/ *\\*$// + s/^[^:]*: *// + /^$/d + /:$/d + s/$/ :/ + ' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; @@ -439,8 +342,9 @@ hp2) # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. - set_dir_from "$object" - set_base_from "$object" + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d @@ -451,7 +355,8 @@ hp2) "$@" +Maked fi stat=$? - if test $stat -ne 0; then + if test $stat -eq 0; then : + else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi @@ -461,61 +366,76 @@ hp2) test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ - s/^ *// - s/ \\*$// - s/$/:/ - p - }' "$tmpdepfile" >> "$depfile" + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" else - make_dummy_depfile + echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in 'foo.d' instead, so we check for that too. - # Subdirectories are respected. - set_dir_from "$object" - set_base_from "$object" + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - if test "$libtool" = yes; then - # Libtool generates 2 separate objects for the 2 libraries. These - # two compilations output dependencies in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir$base.o.d # libtool 1.5 - tmpdepfile2=$dir.libs/$base.o.d # Likewise. - tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - "$@" -MD - fi + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi - stat=$? - if test $stat -ne 0; then - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - exit $stat - fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" - do - test -f "$tmpdepfile" && break - done - # Same post-processing that is required for AIX mode. - aix_post_process_depfile - ;; + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; msvc7) if test "$libtool" = yes; then @@ -526,7 +446,8 @@ msvc7) "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" - if test $stat -ne 0; then + if test "$stat" = 0; then : + else rm -f "$tmpdepfile" exit $stat fi @@ -552,7 +473,6 @@ $ { G p }' >> "$depfile" - echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; @@ -604,14 +524,13 @@ dashmstdout) # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | - sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this sed invocation - # correctly. Breaking it into two sed invocations is a workaround. - tr ' ' "$nl" < "$tmpdepfile" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" + tr ' ' "$nl" < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; @@ -664,12 +583,10 @@ makedepend) # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process the last invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed '1,2d' "$tmpdepfile" \ - | tr ' ' "$nl" \ - | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ - | sed -e 's/$/ :/' >> "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; @@ -705,10 +622,10 @@ cpp) esac done - "$@" -E \ - | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - | sed '$ s: \\$::' > "$tmpdepfile" + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" @@ -740,15 +657,15 @@ msvisualcpp) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; + set fnord "$@" + shift + shift + ;; *) - set fnord "$@" "$arg" - shift - shift - ;; + set fnord "$@" "$arg" + shift + shift + ;; esac done "$@" -E 2>/dev/null | @@ -783,9 +700,9 @@ exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" +# time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: diff --git a/docs/FAQ.txt b/docs/FAQ.txt index 9c59f10..df20987 100644 --- a/docs/FAQ.txt +++ b/docs/FAQ.txt @@ -4,12 +4,21 @@ NUT Frequently Asked Questions endif::external_title[] == I just upgraded, and ... -You have read link:UPGRADING[UPGRADING] in the base directory of the -distribution, right? +You have read link:UPGRADING[UPGRADING] in the base directory of the distribution, +right? If not, go read it now, then come back to this file if your question wasn't answered in there. +== upsstats says 'Error: can't open template file (upsstats.html)'. +Go into your configuration path (/usr/local/ups/etc by default) and +copy the sample template files over to their real names. The sample +template files are installed with 'make install' and can +also be found inside the source distribution in the conf directory. + +== upsmon fails the login and says 'username required' now. +Go read the link:UPGRADING[UPGRADING] file again. + == My UPS driver now says it's 'broken', and won't start. What now? Or a variation like... @@ -38,7 +47,7 @@ already been done in the old version. The drivers drop root privileges long before the serial port is opened. You'll need to change the permissions on that port so that -their new user id can access it. Normally this is "nobody", but it +their new user id can access it. Normally this is "nobody", but it may be changed at compile-time by using configure --with-user. Read the error message. If you have a permissions mismatch, then @@ -47,12 +56,12 @@ you'll see something like this: Network UPS Tools - APC Smart protocol driver 0.60 (1.1.7) This program is currently running as youruid (UID 1234) /dev/ttyS2 is owned by user root (UID 0), mode 0600 - Change the port name, or fix the permissions or ownership + Change the port name, or fix the permissions or ownership of /dev/ttyS2 and try again. Unable to open /dev/ttyS2: Permission denied Now is a good time to point out that using "nobody" is a bad idea, -since it's a hack for NFS access. You should create a new role +since it's a hack for NFS access. You should create a new role account (perhaps called "ups" or "nut"), and use that instead. Also, scroll down to the "security domains" question to see an @@ -88,37 +97,24 @@ Refer to the upsd(8) and upsd.conf(5) manpages for more information. == I get a 'not listening on...' error from upsd. -Verify your LISTEN directive. It should be one of the valid IP addresses -for the computer running `upsd` (or `0.0.0.0`, which is `INADDR_ANY`), not -an address for a client. +Verify your LISTEN directive. It should be one of the valid IP addresses for +the computer running upsd (or 0.0.0.0, which is INADDR_ANY), not an address for +a client. -The LISTEN directive lets you pick which interface `upsd` listens on. -If you are trying to limit the clients which can connect to `upsd`, -you either need to use tcp-wrappers or kernel firewall rules. +The LISTEN directive lets you pick which interface upsd listens on. If you are +trying to limit the clients which can connect to upsd, you either need to use +tcp-wrappers or kernel firewall rules. -This isn't a NUT-specific limitation -- it applies equally to your web server -or mailer daemon. +This isn't a NUT-specific limitation - it applies equally to your web server or +mailer daemon. -== Which UPS should I buy? - -One with a no-questions-asked money-back guarantee. Seriously. The NUT -developers cannot take responsibility for recommending an UPS (see the LICENSE -file for more details on the explicit lack of warranty), only to find out that -the manufacturer has changed the internals of the UPS without changing the -model name. - -That said, from time to time, certain vendors have helped out by providing -hardware for testing, results of their testing efforts, or protocol -specifications. We try to publish this information on the NUT website, so you -can take this into consideration when selecting an UPS brand. - -== I have an APC Smart-UPS connected with a grey APC serial cable and it won't work. +== I have an APC Smart-UPS connected with a grey APC serial cable and it won't work. The Back-UPS type in the genericups driver works but then I don't get to use all the nifty features in there. Why doesn't the right driver work? The problem lies in your choice of cable. APC's grey cables -generally only do "dumb" signalling -- very basic yes/no info about +generally only do "dumb" signalling - very basic yes/no info about the battery and line status. While that is sufficient to detect a low battery condition while on battery, you miss out on all the goodies that you paid for. @@ -138,10 +134,9 @@ If your grey cable isn't the 940-0095B, the solution is to dump that cable and find one that supports APC's "smart" signalling. Typically these come with the UPS and are black. If your smart cable has wandered off, one can be built rather easily with some connectors and -cable -- there's no fancy wiring or resistors. +cable - there's no fancy wiring or resistors. -See this URL for a handy diagram: -http://www.networkupstools.org/cables/940-0024C.jpg +See this URL for a handy diagram: http://www.networkupstools.org/cables/940-0024C.jpg There is also a text version of that diagram in the docs/cables directory of the NUT source distribution. Either one should allow @@ -163,7 +158,7 @@ hardware properly. *Answer 1* -We try to follow the "tool for the job" philosophy. It may mean +I try to follow the "tool for the job" philosophy. It may mean more programs running, but the flexibility you get is usually worth it. @@ -177,8 +172,7 @@ Besides, if upsmon were rolled into upsd, upsd would get even bigger than it is now. You'd have one less process, but the RAM consumption would be pretty close to now. -See the "Data Room" section in link:docs/config-notes.txt[] for -more configuration ideas and explanations. +See data-room.txt for more configuration ideas and explanations. *Answer 2* @@ -186,12 +180,12 @@ If this really bothers you, roll up your sleeves and use the sockdebug code to write a "upsmon" type program that sits on top of the state sockets. It won't work over the network, but it means you don't need upsd. It also means only one host can monitor the -UPS. +UPS. This is also a good option to consider if you can't use networked monitoring code for security or safety reasons. -See the TODO file for more on this and other related topics. +See ideas.txt for more on this and other related topics. == Why isn't upssched part of upsmon? @@ -207,7 +201,7 @@ It is also coherent with the answer to the previous question. *Answer 1* New versions of the init man page taken from the sysvinit package -are saying that usage of SIGPWR is discouraged, since /dev/initctl +are saying that usage of SIGPWR is discouraged, since /dev/initctl control channel is the preferred way of communication. *Answer 2* @@ -225,13 +219,12 @@ a shell script and make upsmon call it. Everyone wins. There are at least two different protocols being used for hardware with very similar names. The bestups driver tends to support the -units built around the newer "PhoenixTec" protocol, and the bestfortress -driver supports the older Best hardware. +units built around the newer "PhoenixTec" protocol. -There is a similar problem with the tripplite_usb driver: it only supports the -older, proprietary protocol. Newer standards-compliant Tripp Lite UPS models -are supported by usbhid-ups. We name drivers based on the information -available at the time the driver was first written, which often is incomplete. +Previous releases of this software included a driver called +bestfortress which supported the older Best hardware. See the +earlier entries about updating old drivers which have been removed +from the tree. == What's this about 'data stale'? @@ -243,9 +236,9 @@ If this happens to you, make sure your driver is still running. Also look at the syslog. Sometimes the driver loses the connection to the UPS, and that will also make the data go stale. -This might also happen on certain virtualization platforms. If you cannot -reproduce the problem on a physical machine, please report the bug to the -virtualization software vendor. +Note: some very slow machines have trouble keeping up with the +serial ports during periods of extreme load. My old 486 used to +flip between "stale" and "OK" while running backups. If this happens a lot, you might consider cranking up DEADTIME in the upsmon.conf to suppress some of the warnings for shorter @@ -254,42 +247,25 @@ directly affects how long you run on battery without knowing what's going on with the UPS. Note: some drivers occasionally need more time to update than the -default value of MAXAGE (in upsd.conf) allows. As a result, they +default value of MAXAGE (in upsd.conf) allows. As a result, they are temporarily marked stale even though everything is fine. This -can happen with MGE Ellipse equipment -- see the mge-shut or usbhid-ups man -pages. In such cases, you can raise the value of MAXAGE to avoid these +can happen with MGE Ellipse equipment - see the mge-shut man page. +In such cases, you can raise the value of MAXAGE to avoid these warnings; try a value like 25 or 30. == Why do the client programs say 'Driver not connected' when I try to run them? This means that upsd can't connect to the driver for some reason. -Your ups.conf entry might be wrong, or the driver might not be +Your ups.conf entry might be wrong, or the driver might not be running. Maybe your state path is not configured properly. Check your syslog. upsd will complain regularly if it can't connect to a driver, and it should say why it can't connect. -Note: if you jumped in with both feet and didn't follow the INSTALL.nut +Note: if you jumped in with both feet and didn't follow the INSTALL document, you probably started upsd by itself. You have to run 'upsdrvctl start' to start the drivers after configuring ups.conf. -On operating systems with a supported service management framework, -you might wrap your NUT drivers into individual services instances -with 'upsdrvsvcctl resync' and then manage those with commands like -'upsdrvsvcctl stop' and 'upsdrvsvcctl start' (note that on other -systems this tool may be not pre-installed via packaging). - -== Why don't the pathnames in your documentation match the package I installed? - -Each distribution has conventions for where specific file types should be -stored. The NUT project cannot possibly track all of these conventions, so the -documentation assumes the default installation directory prefix of -`/usr/local/ups` when describing file locations. The distributions tend not to -change the base name of the files, so you can search for drivers and -configuration files in the package database of installed files. For instance, -on Debian or Ubuntu derivatives, you can use `dpkg --search usbhid-ups` to see -where the drivers are stored. - == Everything works perfectly during the shutdown, and the UPS comes back on, but my system stays off. What's happening? Assuming you don't have the problem in the next question, then you @@ -305,14 +281,11 @@ that point. You *want* the system to die without reaching the part where the kernel tells it to shut down. A possible script might look like this: ------- # other shutdown stuff here (mount -o remount,ro ...) - # `upsmon -K` if available on still mounted filesystems - # at this point is more portable than the `test` below if (test -f /etc/killpower) then - /sbin/upsdrvctl shutdown + /usr/local/ups/bin/upsdrvctl shutdown sleep 600 # this should never return @@ -321,7 +294,6 @@ might look like this: fi halt -p ------- The other solution is to change your BIOS setting to "always power on" instead of "last state", assuming that's possible. @@ -334,8 +306,8 @@ things depending on what's supported: - Set a jumper on the motherboard that means "return after outage" - Set something in the BIOS that says "power up after power failure" -- Try using something (like a capacitor) across the power button - to "push" it for you -- this might not work if it needs a delay +- Try using something (like a capacitor) across the power button + to "push" it for you - this might not work if it needs a delay - Hack the cable between the power supply and the motherboard to fool it into powering up whenever line power is present - Teach a monkey to watch the machine and press the power button @@ -353,15 +325,14 @@ cat some magic characters at /dev/adb to enable "server mode". This would instruct the system to reboot while unattended. From Usenet post <6boftzxz51.fsf@ecc-office.sp.cs.cmu.edu>: ------- + # Send packet over the ADB bus to the PowerMac CUDA chip # telling it to reboot automatically when power is restored # after a power failure. cat /etc/local/autoboot.adb > /dev/adb - # autoboot.adb contains these three bytes (in hex): 01 13 01 ------- + autoboot.adb contains these three bytes (in hex): 01 13 01 Later PowerPC Macs with a PMU and the appropriate kernel driver can achieve the same effect with the following command: @@ -371,15 +342,15 @@ same effect with the following command: The following pages have some slightly more kludgy answers which involve the use of `setpci`, and are highly model-specific: - - https://www.mythic-beasts.com/support/servers/colo/macminicolo_howto + - http://mythic-beasts.com/support/macminicolo_howto.html - http://superuser.com/questions/212434/reboot-after-power-failure-for-mac-running-ubuntu - http://ubuntuforums.org/showthread.php?t=1209576 -Note: this question has been in the FAQ for several years now, and +Note: this question has been in the FAQ for several years now, and there's still no clean answer. Let me guess: everyone who runs a server on Mac hardware has a team of trained monkeys, and feeds them by growing bananas in the tropical environment formed by waste heat -from the equipment. +from the equipment. The rest of us are still waiting for the answer. Booting into the Mac OS to frob the "file server" panel is not an acceptable @@ -388,7 +359,7 @@ solution. == My Mac won't power back up by itself into Mac OS X after the UPS shuts down. What can I do about this? This is relatively simple to fix. If you have console or VNC access, log in as -an administrator, go to System Preferences, click on Energy Saver, click on the +an administrator, go to System Preferences, click on energy saver, click on the options tab, check "Restart automatically after a power failure". Alternatively, you can connect via SSH and run "sudo pmset autorestart 1" to @@ -416,7 +387,7 @@ For my development system this yields the following /dev entries: - Switch to root, then start the drivers: - # upsdrvctl -u nutdev start + # /usr/local/ups/bin/upsdrvctl -u nutdev start - The listing for /var/state/ups then looks like this: @@ -440,14 +411,14 @@ make the files owned by root.nut, with mode 0640. Once the config files are ready, start upsd: - # upsd -u nutsrv + # /usr/local/ups/sbin/upsd -u nutsrv Check your syslog to be sure everything's happy, then be sure to update your startup scripts so it uses this procedure on your next boot. If you like this, you'll probably also find the chroot process to -be useful and interesting. See link:security.txt[] for more details. +be useful and interesting. See security.txt for more details. == What's the point of that 'security domains' concept above? @@ -457,12 +428,12 @@ to that one user account. Direct access to the serial device is not possible, since that is owned by another user. There is also the possibility of running the drivers and upsd in a -chroot jail. See the chroot option in link:security.txt[], `upsd` -and driver documentation. +chroot jail. See the chroot.txt provided in the source +distribution for an example implementation. Why give would-be vandals any sort of help? -Put it this way -- I *wrote* good chunks of this stuff, and I still +Put it this way - I *wrote* good chunks of this stuff, and I still run the programs this way locally. You should definitely consider using this technique. @@ -470,8 +441,8 @@ using this technique. You probably don't want to do this, since it doesn't maximize your runtime on battery. Assuming you have a good reason for it (see -the next entry), then look at link:scheduling.txt[] or the -linkman:upssched[8] man page for some ideas. +the next entry), then look at scheduling.txt or the upssched(8) man +page for some ideas. ///////////////////////////////////////////////////////////////// TODO: figure out how to link to the upssched man page above. @@ -499,17 +470,17 @@ with no visible interruption in service. If you purposely shut down early, you guarantee an interruption in service by bringing down the box. -See link:upssched.txt[] for information on how you can shutdown early if +See upssched.txt for information on how you can shutdown early if this is what you really want to do. -== The CGI programs report 'access to that host is not authorized' -- what's going on? +== The CGI programs report 'access to that host is not authorized' - what's going on? Those programs need to see a host in your hosts.conf before they will attempt communications. This keeps people from feeding it random "host=" settings, which would annoy others with outgoing connection attempts from your system. -If your hosts.conf turns out to be configured correctly with +If your hosts.conf turns out to be configured correctly with MONITOR entries and all that, check the permissions. Your web server may be running the CGI programs as a user that can't read the file. @@ -517,16 +488,15 @@ the file. If you run your web server in a chroot jail, make sure the programs can still read hosts.conf. You may have to copy it into the jail for this to work. If you do that, make sure it's not writable by -any of the user accounts which run inside the jail. +any of the user accounts which run inside the jail. == upsd is running, so why can't I connect to it? -Assuming you haven't changed the TCP port number on the command line or at -compile-time, then you may have some sort of firewall blocking the connection. +Assuming you haven't changed the TCP port number on the command line +or at compile-time, then you probably have some sort of firewall +blocking the connection. -upsd listens on TCP port 3493 by default. If you do not specify a LISTEN -directive in upsd.conf, upsd only listens on the loopback interface. See the -upsd.conf man page for details. +upsd listens on TCP port 3493 by default. == How do you make upsmon reload the config file? @@ -538,7 +508,7 @@ Either find the pid of the background process and send it a SIGHUP, or just start it again with '-c reload'. If you send the signals yourself instead of using -c, be sure you -hit the right process. There are usually two upsmon processes, and you +hit the right process. There are usually two upsmons, and you should only send signals to one of them. To be safe, read the pid file. @@ -546,165 +516,45 @@ file. There are several driver to support USB models. -- usbhid-ups supports various manufacturers complying to the HID Power Device Class (PDC) standard, -- tripplite_usb supports various older Tripp-Lite units (with USB ProductID 0001) +- usbhid-ups supports various manufacturers complying to the HID standard, +- tripplite_usb supports various Tripp-Lite units, - bcmxcp_usb supports various Powerware units, - blazer_usb supports various manufacturers that use the Megatec / Q1 protocol. -- nutdrv_qx supports various manufacturers that use the Megatec / Q* protocol - family. This is the driver slated to receive all further development in this - area, it was specially designed to support many more sub-drivers and has - added a lot over time, so please do try it first nowadays. -Refer to the 'driver-name' (8) man page for more information. +Refer to the 'driver-name' (8) manpage for more information. -You can also consult the Hardware Compatibility List (HCL) and filter on USB: -http://www.networkupstools.org/stable-hcl.html?connection=USB +== What is this usbhid-ups (formerly newhidups) about? -== My USB UPS has a bogus Vendor ID 0x0001 and Product ID 0x0000, what driver supports it? +The basic USB UPS support was done until NUT 2.2 using hidups. To allow +a wider support accross platforms for USB/HID compliant devices, +usbhid-ups driver uses libusb (which is available for a wide range of +operating systems) and libhid (currently, a modified internal version +of it). -Unfortunately, many devices are made without registering as a Vendor with -the corresponding standards body, and use generic USB chips for interfacing -with a computer (roughly similar to using a network interface card with a -random MAC address and PCI ID, and thus poorly identifiable device specifics -needed to automatically load some certain driver). Often they also lack a -unique serial number field, so monitoring several devices is problematic. +As of NUT 2.2, usbhid-ups completely replaces the legacy hidups driver, +and provides support for various manufacturers. At that time, newhidups was +renamed to usbhid-ups. -One frequent case is with devices identifying as "Fry's Electronics" and/or -"MEC0003", if those data are served at all, or plain "0001/0000" in ID field. -In some cases they are accompanied by "UPSmart" software with a "MEGA(USB)" -connection option that works for Windows users. - -Your best bet is to search for community discussions of issues on NUT GitHub -at https://github.com/networkupstools/nut/issues?q=is%3Aissue and try options -there. Devices with these chips were known to connect with drivers for such -unrelated protocols as Megatec Q* (different sub-drivers, often `fabula` or -`hunnox`), ATCL, or USB-HID. +usbhid-ups is built automatically if possible (libusb development files +need to be installed) and installed by the "make install" command. == My USB UPS is supported but doesn't work! -On Linux, udev rules are provided to set the correct permissions on device -file. This allows the NUT driver to communicate with the UPS, through this -device file. +On Linux, udev rules are provided to set the correct permissions on device file. +This allows the NUT driver to communicate with the UPS, through this device file. -However, the driver may still fail to start and support the device, with a +However, the driver may still failed to start and support the device, with a message like: failed to claim USB device: could not claim interface 0: Operation not permitted -*Operation not permitted* is a message pointing to a privilege issue. +*Operation not permitted* is a message pointing a privilege issue. The most frequent issue is that udev has not actually applied the rule: - if NUT has been freshly installed, -- and if the device USB cord was already plugged when installing NUT. +- and if the device USB cord was already plugged when installing nut. -In this case, just unplug and plug back the USB cord, then restart NUT. -Instead of unplugging, you might also be able to run `udevadm trigger ---subsystem-match=usb --action=change` to fix permissions. - -There was a mistake in the naming of the NUT udev rules file which resulted in -the rules being overridden by another udev configuration file. While this has -been fixed in the Git master branch, your distribution may still be affected. -Details are available in the following GitHub issue: -https://github.com/networkupstools/nut/issues/140 - -== Why do you not use the Linux kernel HID driver when communicating with USB UPSes? - -When the `usbhid-ups` was first written, it replaced an older driver `hidups` -which used the Linux kernel USB HID API. At the time, the kernel HID API could -not distinguish between identical Usage IDs that were nested in different -parent IDs, so many common measurements were not available from `hidups`. For -this reason, the libusb approach was chosen, which has the added side effect -of being more portable than the Linux HID API. The Linux hiddev device nodes -have very similar permissions problems as the `/dev/bus/usb` nodes that the -libusb approach uses. - -Due to difficulties in running libusb on OS X and Windows, those platforms -might benefit more from a native HID approach. - -== I get a message from the kernel that the driver "did not claim interface 0 before use" - -On Linux, if two copies of a driver are competing for the UPS, these messages -will appear in dmesg: - - usbfs: process 29641 (usbhid-ups) did not claim interface 0 before use - -This can be a symptom of a source install conflicting with a package install. -There is a rudimentary locking mechanism in NUT, but there is a chance that the -packages might not use the same directory as the NUT default, and the conflict -will be reported by the kernel. - -== Why does my (Eaton 5E) USB UPS on Linux connect but quickly disconnects soon? - -This issue was extensively investigated by NUT community members in -https://github.com/networkupstools/nut/issues/630 and resulted in a -chain of distribution bugs logged such as -https://bugzilla.redhat.com/show_bug.cgi?id=1715504 - -The gist of it is that some versions of Linux kernel used an "USB HID quirk" -for certain devices, see Linux kernel source `drivers/hid/hid-quirks.c` file, -including MGE/Eaton vendor ID (0x0463) based on an older device a contributor -had issues with. Firmware in newer devices no longer had the bug which needed -the "quirk" and misbehaved when it was enabled. While newer (and much older) -Linux kernels should not have the problem, with the quirk removed according -to https://lkml.org/lkml/2018/11/26/580 having the issue in the field really -depends on the combination of Linux kernel and device firmware that meet. - -Either way, it seems that problematic combinations preclude Linux from seeing -the device as a `hid-generic` first, to hand it over to a NUT driver. - -This quirk can be tuned with a kernel boot parameter (via GRUB etc.): - - usbhid.quirks=0x0463:0xffff:0x08 - -to re-enable the NOGET quirk. - -For context, according to https://bugzilla.redhat.com/show_bug.cgi?id=1875532 -the symptoms for the problem look like this: - - # Plug in the UPS and observe the dmesg logs, - # the following continuously appears: - [ 93.568082] usb 1-6: new full-speed USB device number 9 using xhci_hcd - [ 94.311469] usb 1-6: New USB device found, idVendor=0463, idProduct=ffff, bcdDevice= 0.01 - [ 94.311475] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0 - [ 94.311483] usb 1-6: Product: 5E - [ 94.311486] usb 1-6: Manufacturer: EATON - [ 96.269989] hid-generic 0003:0463:FFFF.000A: hiddev96,hidraw2: USB HID v1.10 Device [EATON 5E] on usb-0000:00:14.0-6/input0 - [ 107.369425] hid-generic 0003:0463:FFFF.000A: usb_submit_urb(ctrl) failed: -1 - [ 107.369469] hid-generic 0003:0463:FFFF.000A: timeout initializing reports - [ 112.828826] usb 1-6: USB disconnect, device number 9 - [ 113.284452] usb 1-6: new full-speed USB device number 10 using xhci_hcd - [ 114.027693] usb 1-6: New USB device found, idVendor=0463, idProduct=ffff, bcdDevice= 0.01 - [ 114.027698] usb 1-6: New USB device strings: Mfr=1, Product=2, SerialNumber=0 - [ 114.027701] usb 1-6: Product: 5E - [ 114.027704] usb 1-6: Manufacturer: EATON - [ 115.984222] hid-generic 0003:0463:FFFF.000B: hiddev96,hidraw2: USB HID v1.10 Device [EATON 5E] on usb-0000:00:14.0-6/input0 - [ 126.825756] hid-generic 0003:0463:FFFF.000B: usb_submit_urb(ctrl) failed: -1 - [ 126.825775] hid-generic 0003:0463:FFFF.000B: timeout initializing reports - [ 132.527809] usb 1-6: USB disconnect, device number 10 - -A similar report on the driver side may look like: - - usbhid-ups[4554]: libusb_get_report: Input/output error - upsd[4591]: Data for UPS [eaton] is stale - check driver - usbhid-ups[4554]: Can't claim USB device [0463:ffff]: No such file or directory - upsd[4591]: Can't connect to UPS [eaton] (usbhid-ups-eaton): No such file or directory - upsmon[5148]: Poll UPS [eaton@localhost] failed - Driver not connected - upsmon[5148]: Communications with UPS eaton@localhost lost - -Other similar looking issues may include improper setup of udev, upower -and similar frameworks to hand over the device from the OS to a driver -daemon; competition with other software probing USB devices (ModemManager -was mentioned in this context), including running several copies of the -NUT drivers trying to use same port (e.g. one started by services and -another manually as you tried to debug the problems). - -Software quirks aside, please do test with a different USB cable and/or port -on the computer. These were known to cause grief beyond what can be fixed -with a few key words ;) - -Finally, sometimes the issue is on the OS side (and/or USB chipset), to -the point that the USB driver can not be unloaded and re-attached until -you power cycle the system. +In this case, just unplug and plug back the USB cord, then restart nut. == Why doesn't my package work? @@ -720,79 +570,6 @@ This means all packages have been built by a third party. If you have an issue that's related to packaging, you will need to seek help with whoever built it for you. -== My UPS is directly connected to an appliance with a limited version of NUT, how can I monitor the UPS from arbitrary clients? - -You can set up a separate general-purpose system as the NUT server for -your "arbitrary clients", using `dummy-ups` in "relay mode" as the driver. -This instance of `dummy-ups` would in turn be the NUT client allowed to -interact with the appliance and that way with the UPS connected there. - -NOTE: The original question related to a NAS with NUT provided in its -firmware OS, that only allowed one or few clients and not a whole -rack's worth of client IP addresses. - -== My networked UPS can't handle being monitored by dozens of NUT clients - -Network management cards on many UPSes are rather puny appliances, often -known to either limit the amount of clients who may connect, for security -or performance reasons, or otherwise to crash or respond very slowly when -overwhelmed. - -You may be better off reducing the amount of servers connected to the UPS -with the `snmp-ups`, `netxml-ups` or similar type of driver, and set up -other systems as clients of these NUT servers. - -Developers who are working on NUT, its drivers, or further projects and -appliances based on NUT, and who need to monitor their UPS from multiple -systems using the complete NUT stack on each system (e.g. during testing), -can benefit from dedicating a separate general-purpose system as the NUT -server using the real (networked) driver for the UPS, while using the -`dummy-ups` in "relay mode" as the driver connected to this dedicated -server on each tested system. - -== How can I setup NUT as a proxy (setup a server to forward/relay client data)? - -This can easily be achieved by using the `dummy-ups` driver. -The `port` field acts as the reference to the "other" UPS served -by another NUT server. - -Example with `dummy-ups` driver: - - [proxy] - driver = dummy-ups - port = upsname@ip-or-hostname[:port] - desc = "UPS proxy for UPS upsname on server ip-or-hostname" - -Also note that there is a `clone` driver with similar purpose, -which allows users to group clients to a particular outlet of -a device with a "real" driver running locally, and deal with -this output as if it was a normal UPS. - -Here the `port` field references the driver socket name that -the "real" UPS driver is using. See its manual page for more -details and caveats. - -Example with `clone` driver: - - [realups] - driver = usbhid-ups - port = auto - - [clone-outlet-1] - driver = clone - port = usbhid-ups-realups - load.on = outlet.1.load.on - load.off = outlet.1.load.off - load.status = outlet.1.status - [...] - -This allows to group load attached to a separately manageable -outlet (or group of outlets) on larger UPS and ePDUs, in order -to power those devices on/off together. This may be also useful -to delegate management of feeds to devices for purposes like -hosting or supporting hardware for smaller teams sharing a rack -in a larger company. - == Why are there two copies of upsmon running? It's not really two complete copies if your OS forks efficiently. @@ -808,58 +585,28 @@ root, start upsmon with -p and it will go back to being one big process. This is not recommended, so don't blame us if something bad happens in this mode. -== I get the following error while building: `make[4]: don't know how to make HP-UX/nut-drvctl.sh. Stop` - -NUT still has some hidden dependencies on GNU Make which show up while running -`make distcheck`. If you are running `make distcheck` or its variants, you -will need to install GNU Make (`devel/gmake` in the ports tree), which is -incidentally what the official FreeBSD port of NUT does for all builds. - == I have 'some problem' with 'some old version' ... Get the latest stable release, and see if it still happens. If it -goes away, it means someone else reported it and got it fixed a +goes away, it means someone else reported it and got it fixed a long time ago. -You may want to search the mailing lists to see if someone else has -experienced the same problem. If so, there is a good chance that someone else -has worked through the process necessary to shoehorn the latest NUT version -into your distribution (potentially with unofficial packages). +If that doesn't work, try the latest development version. -Some OS distributions contain old versions of NUT. If your hardware is newer -than the NUT release, there is a good chance that support has not been added -yet. Please do not tell us you have the "latest version for Distro XYZ" -- even -if the developers are familiar with that distribution, it helps others if you -quote the exact package version. +If your problem is STILL there, then contact the mailing lists. NOTE: check the release date on the version you have. If it's more -than about 6-12 months old, there's probably a newer stable tree -version out there. As development happens actively, be sure to also -check if a custom build from Git (usually using the `master` branch -of NUT https://github.com/networkupstools/nut/ repository) has your -issue fixed by some kind soul already. - -== I built NUT from Git, and it complains about lots of missing files. What happened? - -If you are not actively developing a driver, can you use a snapshot instead? -The NUT instance of Buildbot generates tar files of the latest NUT source -after each successful build, and these snapshots include a pre-built version -of the `./configure` script. - -Otherwise, you will need recent versions of autoconf, automake, libtool, -asciidoc, a2x and its dependencies for DocBook/dblatex. Rather than publish a -list of the exact versions needed (which will quickly become out of date), we -recommend you consult your distribution's dependency list for building a NUT -package, and use that as a starting point. +than about 6 months old, there's probably a newer stable tree +version out there. == Do I have to use a serial connection to monitor the UPS? What about direct network connections (SNMP or otherwise)? -NUT currently supports USB communication through several drivers, +No. NUT currently support USB communication through several drivers, and also SNMP and XML/HTTP (Eaton and MGE) communications. Since NUT is very extensible, support for a new communication bus can be added easily. - + Any time there is a gap in features, it's usually because the group of people who own that hardware and the group of people who write code don't overlap. The fix is to make them overlap - @@ -867,23 +614,23 @@ turn an owner into a developer or vice-versa. == What happened to the patch I sent? -We try to prioritize emails with patches, but you should understand that a -simple fix for your bug might be complicated to integrate with the rest of -NUT. Changing the way a fundamental component works, such as USB support, -means a lot of testing to ensure that your fix does not break other drivers. +If a release goes by and your patch hasn't been included, it was +probably dropped. There can be a lot of patches waiting for +inclusion at some points, and occasionally some have to be +rejected. + +Design issues or severe coding style problems can be the reason +for this. I try to point out what the problems are, but there are +limits. See developers.txt for some pointers on submitting +patches. Sometimes patches are put on hold due to a feature freeze. If it -doesn't show up once the new version opens up, please send it again. - -It may also be much more productive to submit changes as pull requests via -https://github.com/networkupstools/nut/pulls so they are automatically -processed by the NUT CI farm across numerous target platforms, and -various inconsistencies can be diagnosed and fixed early. +doesn't show up once the new version opens up, send it again. == I'm not much of a programmer. How can I help? There's always work to be done outside of the realm of code bashing. -Documentation can always be improved. A user's perspective +Documentation might not always be so clear. A user's perspective is sometimes needed to appreciate this. Bug reports on a project's documentation are just as valuable as those for the actual source. @@ -896,7 +643,7 @@ has already handled it successfully. == I replaced the battery in my APC Smart-UPS and now it thinks the battery is low all the time. How do you fix this? Or a variation like... - + == My APC UPS keeps reporting 'OL LB', even after it's been charging for many hours. What can I do about this? This happened to me, and some other people too. The combination of @@ -914,7 +661,7 @@ disconnect it from the computer so this software won't shut it down. The easiest way to do this is to first unplug your computer(s) from -it, and plug in a token load like a lamp. Also, move the UPS to a +it, and plug in a token load like a lamp. Also, move the UPS to a power strip that doesn't switch the ground line or an outlet that you can switch off at your panel. @@ -937,15 +684,10 @@ upsstats.html and change it from TEMPC to TEMPF. == Why is the mailing list ignoring me? -You probably asked a question that's answered in this FAQ, or -somewhere else in the documentation, and nobody wants to quote it +You probably asked a question that's answered in this FAQ or +somewhere else in the documentation and nobody wants to quote it for you. -There is a small chance that the mailing list spam filter ate your message. -Check the list archives to see if your message appears there. -Also double-check that you have subscribed to the lists and completed -all the confirmation rituals of its engine. - Convincing the other subscribers that you've actually read down this far might be useful. You might mention "queequeg" for better results. @@ -953,36 +695,12 @@ This URL may also be helpful: http://www.catb.org/~esr/faqs/smart-questions.html -== Why are you so insistent about sending emails to public mailing lists instead of to individuals? - -By and large, NUT is a volunteer effort. By emailing one person, you are -asking them to take care of your question. If you email the list instead, you -give others the opportunity to answer. - -In addition, the mailing lists are publicly archived, and therefore easily -searchable. Chances are, you aren't the only person who will ever have that -question. - -There are similar benefits to using the discussions on issue tracker at -https://github.com/networkupstools/nut/issues and if suitable, in the -currently open pull requests. - -== If you want mailing list replies to go to the list, why don't you add a Reply-To: header? - -We are not going to rehash all of the arguments for and against this in a -simple FAQ entry. If you intend for your reply to go to more than just the -last person who posted, it is not too much trouble to hit "reply all". - == I found some information about another kind of UPS protocol you don't support yet, but I don't know what to do with it. Can you help? If you're not a programmer, you can still help others by making that protocol available. You might host the document somewhere and send the URL to one of the mailing lists. -Posting an issue with attachments on -https://github.com/networkupstools/nut/issues -can also be helpful. - == How can you answer questions to situations that nobody's encountered yet? Isn't this a frequently asked questions file? *Answer 1* @@ -994,12 +712,9 @@ It's a kind of Magic. It's both that and a frequently *anticipated* questions file, too. The idea is to write it up in here so that nobody asks the mailing -list when it finally does get released. +list when it finally does get released. == My UPS powers up immediately after a power failure instead of waiting for the batteries to recharge! -Or a variation like... - -== My UPS (an APC as it happens) lacks the field "battery.charge.restart" -- so how will it know when to restart? You can rig up a little hack to handle this issue in software. @@ -1016,8 +731,8 @@ where there's not enough battery capacity left for upsmon to do its thing. Exactly how long to wait is a function of your UPS hardware, and will require careful testing. -If this is too evil for you, buy another kind of UPS that will either wait for -a minimum amount of charge, a minimum amount of time, or both. +If this is too evil for you, buy another kind of UPS that will either wait for a +minimum amount of charge, a minimum amount of time, or both. == I'm facing a power race Or a variation like... @@ -1042,17 +757,12 @@ they won't be stuck in the halted state with the UPS running on line power. Implement this by modifying your shutdown script like this: ------- - # `upsmon -K` if available on still mounted filesystems - # at this point is more portable than the `test` below - if (test -f /etc/killpower) then - /sbin/upsdrvctl shutdown + /usr/local/ups/bin/upsdrvctl shutdown sleep 120 # uh oh, we never got shut down! (power race?) reboot fi ------- diff --git a/docs/Makefile.am b/docs/Makefile.am index a593070..0149f52 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,10 +1,3 @@ -MAINTAINERCLEANFILES = Makefile.in .dirstamp -EXTRA_DIST = - -# Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) -EGREP = egrep -#EGREP = grep -E - IMAGE_FILES = images/asciidoc.png \ images/hostedby.png \ images/nut_layering.png \ @@ -19,12 +12,12 @@ IMAGE_FILES = images/asciidoc.png \ images/old-cgi.png # Only track here the local deps -SHARED_DEPS = nut-names.txt daisychain.txt asciidoc.conf asciidoc.txt +SHARED_DEPS = nut-names.txt asciidoc.conf USER_MANUAL_DEPS = acknowledgements.txt cables.txt config-notes.txt \ - config-prereqs.txt ci-farm-lxc-setup.txt \ configure.txt download.txt documentation.txt features.txt history.txt \ - outlets.txt scheduling.txt security.txt support.txt user-manual.txt + outlets.txt scheduling.txt security.txt support.txt user-manual.txt \ + stable-hcl.txt DEVELOPER_GUIDE_DEPS = contact-closure.txt design.txt developers.txt \ developer-guide.txt hid-subdrivers.txt macros.txt new-clients.txt \ @@ -40,115 +33,64 @@ CABLES_IMAGES = images/cables/73-0724.png images/cables/940-0024C.jpg \ images/cables/belkin-f6cx-rkm-xu-cable.jpg images/cables/Lansafecable.jpg \ images/cables/mac-940-0024C.png images/cables/mge-66049.png \ images/cables/mge-db9-rj12.jpg images/cables/mge-db9-rj45.jpg \ - images/cables/mge-usb-rj45.jpg \ images/cables/SOLA-330.png -ALL_TXT_SRC = nut-names.txt daisychain.txt \ - $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ - $(CABLES_DEPS) FAQ.txt nut-qa.txt packager-guide.txt snmp.txt \ - solaris-usb.txt +ALL_TXT_SRC = nut-names.txt $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ + $(CABLES_DEPS) FAQ.txt nut-hal.txt nut-qa.txt packager-guide.txt snmp.txt NUT_SPELL_DICT = nut.dict -EXTRA_DIST += $(ALL_TXT_SRC) $(SHARED_DEPS) $(IMAGE_FILES) \ - $(CABLES_IMAGES) $(NUT_SPELL_DICT) \ - common.xsl xhtml.xsl chunked.xsl asciidoc.txt +EXTRA_DIST = $(ALL_TXT_SRC) $(SHARED_DEPS) $(IMAGE_FILES) \ + $(CABLES_IMAGES) docinfo.xml $(NUT_SPELL_DICT) ASCIIDOC_HTML_SINGLE = user-manual.html \ developer-guide.html \ packager-guide.html \ - solaris-usb.html \ - cables.html \ FAQ.html ASCIIDOC_HTML_CHUNKED = user-manual.chunked \ developer-guide.chunked \ packager-guide.chunked \ - solaris-usb.chunked \ - cables.chunked \ - FAQ.chunked + FAQ.html ASCIIDOC_PDF = user-manual.pdf \ developer-guide.pdf \ packager-guide.pdf \ - solaris-usb.pdf \ - cables.pdf \ FAQ.pdf -SUBDIRS = man cables -SUFFIXES = .txt .html .pdf -spellchecked +# Force build in ./ and man/ before website +SUBDIRS = . man website +SUFFIXES = .txt .html .pdf all: doc -# This list is defined by configure script choices and options: -check-local: @DOC_CHECK_LIST@ - -# This list is defined by configure script choices and options: doc: @DOC_BUILD_LIST@ -# This target can be called by developers to go around the configure -# script choices at their risk (e.g. missing tools are possible): -docs: pdf html-single html-chunked man-man html-man - -all-docs: docs - -check-docs: check-pdf check-html-single check-html-chunked check-man - pdf: $(ASCIIDOC_PDF) # also build the HTML manpages with these targets html-single: $(ASCIIDOC_HTML_SINGLE) html-chunked: $(ASCIIDOC_HTML_CHUNKED) -# the "for" loops might better use $^ but it might be not portable -check-pdf: $(ASCIIDOC_PDF) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(ASCIIDOC_PDF) ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i 'PDF document' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED PDF sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED PDF sanity check"; exit 0 +if HAVE_ASCIIDOC +website: html-chunked pdf +else !HAVE_ASCIIDOC +website: + @echo "Not building website documentation since 'asciidoc' was not found." +endif !HAVE_ASCIIDOC -check-html-single: $(ASCIIDOC_HTML_SINGLE) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(ASCIIDOC_HTML_SINGLE) ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-single sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-single sanity check"; exit 0 - -check-html-chunked: $(ASCIIDOC_HTML_CHUNKED) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for D in $(ASCIIDOC_HTML_CHUNKED); do \ - for F in "$$D"/*.html ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; \ - for F in "$$D"/*.css ; do \ - test -s "$$F" && { $(EGREP) -i 'CSS stylesheet' "$$F" > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-chunked sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-chunked sanity check"; exit 0 - -# Note: usually the results from man-page check will be reported twice: -# once as a SUBDIRS child makefile, and once via DOC_CHECK_LIST expansion -# Note: default `make all` in the man directory caters to drivers etc. -# chosen during configure script execution. The "all-man" and "all-html" -# rules build everything documented. -check-man all-man man-man all-html html-man: - cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile $@ - -man: - cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile all - -CLEANFILES = *.xml *.html *.pdf *-spellchecked docbook-xsl.css - -# Dirs to clean clean-local: - rm -rf *.chunked *.bak tmp + rm -rf *.pdf *.html *.chunked docbook-xsl.css *.bak + +# Static HCL is generated automatically +# This is more of a harness, since this file should have already been +# generated, due to the top level Makefile SUBDIRS ordering (tools before docs) +ups-html.txt: ../data/driver.list.in + cd ../data && $(MAKE) $(AM_MAKEFLAGS) driver.list + cd ../tools && $(MAKE) $(AM_MAKEFLAGS) website ### TODO: automatic dependency generation # Add other directory deps (not for local EXTRA_DIST) and generated contents FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ - ../INSTALL.nut ../UPGRADING ../TODO ../scripts/ufw/README + ../INSTALL ../UPGRADING ../TODO ../scripts/ufw/README FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ ../scripts/augeas/README ../TODO ../lib/README \ ../tools/nut-scanner/README @@ -156,258 +98,50 @@ FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ user-manual.html user-manual.chunked user-manual.pdf: $(FULL_USER_MANUAL_DEPS) developer-guide.html developer-guide.chunked developer-guide.pdf: $(FULL_DEVELOPER_GUIDE_DEPS) packager-guide.html packager-guide.chunked packager-guide.pdf: packager-guide.txt asciidoc.conf -solaris-usb.html solaris-usb.chunked solaris-usb.pdf: solaris-usb.txt asciidoc.conf # Note: without the "-v", asciidoc (circa 8.6.2) sometimes hangs when # generating the chunked HTML. In this case, export the environment # variable ASCIIDOC_VERBOSE to "-v", ie: # $ ASCIIDOC_VERBOSE=-v make -A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) \ - --attribute=icons \ - --xsltproc-opts="--nonet" \ - --xsltproc-opts="--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \ - --xsltproc-opts="--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \ - --xsltproc-opts="--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \ - --attribute=iconsdir="$(srcdir)/images" \ +A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) --attribute icons \ + --attribute localdate=`TZ=UTC date +%Y-%m-%d` \ + --attribute localtime=`TZ=UTC date +%H:%M:%S` \ + --attribute iconsdir=$(srcdir)/images \ --attribute=badges \ --attribute=external_title \ - --attribute=tree_version="@TREE_VERSION@" \ - -a toc -a numbered --destination-dir=$${A2X_OUTDIR} -# NOTE: a2x newer than 8.6.8 says "--destination-dir" is only valid for HTML. -# As of version 8.6.9 it lies, and the argument is required for our distcheck -# (and does affect PDF builds, as found during work on collision-avoidance - -# true with at least asciidoc/a2x versions 9.0.0rc2). -# For more details see issues https://github.com/asciidoc/asciidoc/issues/44 -# and https://github.com/networkupstools/nut/pull/281 (in short, attempts -# to "fix" this warning broke NUT build). If this is to be retried later, see -# https://github.com/networkupstools/nut/pull/281/commits/fe17861c4ea12679b3ebfefa8a6d692d79d99f2d -# and do not forget to fix up docs/man/Makefile.am too ;) + --attribute tree_version=@TREE_VERSION@ \ + -a toc -a numbered --destination-dir=. -# NOTE: a2x tends to copy some files into its working area, preserving original -# permissions. If those files are read-only in origin (e.g. packaged stylesheet -# or our resources coming from EXTRA_DIST) the next a2x can not overwrite it. -# Also note that such hoarding of files has potential to break parallel builds -# (or cause them to produce undefined results if some bad timing happens). -# As a brutal workaround for the former problem, we chmod. For second one we -# might try magic with .SEQUENTIAL recipe hints, but that is gmake-dependent. - -# Note that empirically it treats "destination-dir" as the source root for -# PDF generation (even though it claims the argument is ignored for non-HTML -# targets) so we have to provide the "images/" in this case. ONLY for PDF! - -# Note we only remove the original target (if present), if it is a directory - -# e.g. created by "html-chunked" targets. -DOCBUILD_BEGIN = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - rm -rf "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ - mkdir -p "./$${A2X_OUTDIR}" || exit ; \ - case "$${A2X_OUTDIR}" in \ - tmp/pdf.*) ln -s ../../images "./$${A2X_OUTDIR}" ;; \ - esac; \ - else A2X_OUTDIR='.' ; fi; \ - if test -s "${builddir}/docbook-xsl.css" \ - && test -r "${builddir}/docbook-xsl.css" \ - && ! test -w "${builddir}/docbook-xsl.css" \ - ; then chmod u+w "${builddir}/docbook-xsl.css" ; fi ; \ - chmod -R u+w "./$${A2X_OUTDIR}" || true; \ -} - -# When moving "*" hope a2x did not make any "hidden" files -# like ".*" that would be required for resulting documents. -# Leave the "images/" dir there, though. -# Otherwise, we would have to `find` them all. -DOCBUILD_END = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - chmod -R u+w "./$${A2X_OUTDIR}" || true; \ - test -d "$@" && rm -rf "$@" || true ; \ - mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \ - mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \ - rm -rf "./$${A2X_OUTDIR}" ; \ - fi ; \ -} - -# PORTABILITY NOTE: POSIX Make forbids the suffix rule definitions with -# prerequisites like done below, and GNU Make of some versions complains; -# https://www.gnu.org/software/make/manual/html_node/Error-Messages.html -# says the prerequisites were ignored while a suffix rule was created; -# eventually the POSIX stance would be taken to define a rule for a weird -# verbatim target file name with prerequisites: -# ../docs/Makefile:936: warning: ignoring prerequisites on suffix rule definition -# Changes from ".txt.pdf: docinfo.xml" to "*.pdf: docinfo.xml" = ".txt.pdf:" -# as done below may be pointless in the end (with regard to a portable way -# to trigger builds by a changed dependency), but at least predictable and -# not toxic. -*.html: common.xsl xhtml.xsl .txt.html: - @A2X_OUTDIR="tmp/html-single.$(@F).$$$$" ; \ - echo " DOC-HTML Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml --xsl-file=$(srcdir)/xhtml.xsl $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml $< -*.chunked: common.xsl chunked.xsl .txt.chunked: - @A2X_OUTDIR="tmp/html-chunked.$(@F).$$$$" ; \ - echo " DOC-HTML-CHUNKED Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked --xsl-file=$(srcdir)/chunked.xsl $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked $< -# Note: non-HTML a2x modes may ignore the destination directory -*.pdf: docinfo.xml -.txt.pdf: - @A2X_OUTDIR="tmp/pdf.$(@F).$$$$" ; \ - echo " DOC-PDF Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES +.txt.pdf: docinfo.xml + $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< if HAVE_ASPELL +# FIXME: also check ../{NEWS,README,UPGRADING}+other dirs # Non-interactively spell check all documentation source files. # This is useful for Buildbot and automated QA processing # FIXME: how to present output (std{out,err}, single file or per target)? -# NOTE: ../ChangeLog is nowadays generated from commit messages, so -# its spelling (or errors in that) are not fixable and thus irrelevant. -# Similarly for the ../INSTALL file that is prepared by autoconf and not -# tracked as a source file by NUT Git repository. -SPELLCHECK_SRC = $(ALL_TXT_SRC) ../README ../INSTALL.nut ../UPGRADING ../NEWS \ - ../TODO ../scripts/ufw/README ../scripts/augeas/README ../lib/README \ - ../tools/nut-scanner/README \ - ../AUTHORS ../COPYING ../LICENSE-GPL2 ../LICENSE-GPL3 - -# Directory SPELLCHECK_SRC files are relative to. Overriden by other Makefiles. -SPELLCHECK_DIR = $(srcdir) - -# Note: de-facto our documentation is beyond ASCII (at least in names of -# international committers). The grep tests below look if the aspell output -# contained something other than the OK lines (tagged with asterisk) and -# aspell's version (tagged with @) and if it did - those lines must be the -# spellcheck complaints. Empty OUT is ok. -# We also must indent the input, because certain piped-in characters are -# interpreted as commands, and seems this feature can not be turned off. -# See also http://aspell.net/man-html/Through-A-Pipe.html -# TODO: Is "grep -a" or "grep -b" (treat input as ascii/bin) portable enough? -# Set SPELLCHECK_ERROR_FATAL=no if there are some unavoidable issues -# due to spellchecking, to temporarily not fail builds due to this. -# For Travis CI in particular, see ci_build.sh in NUT codebase root. -SPELLCHECK_ERROR_FATAL = yes -SPELLCHECK_ENV_DEBUG = no -ASPELL_NUT_COMMON_ARGS = -p $(abs_srcdir)/$(NUT_SPELL_DICT) -ASPELL_NUT_COMMON_ARGS += -d en --lang=en --ignore-accents -ASPELL_NUT_COMMON_ARGS += --encoding=utf-8 -ASPELL_ENV_LANG = en.UTF-8 -ASPELL_OUT_NOTERRORS = (^[ \t]*[\*\@]|^$$) - -# WARNING: The percent wildcard is a GNU extension; otherwise we need -# a ".txt.txt-spellchecked" type of rule and files like "README" all -# renamed to *.txt, or lots of rules for files without the extensions -# Other Makefiles have a relatively simple life, dealing with just a -# few texts and name/extension patterns in their directories. -#?#.txt.txt-spellchecked: Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -#%-spellchecked: % Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -#*-spellchecked */*-spellchecked: $(@:-spellchecked=) $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# NOTE: This portable rule RELIES on just one SPELLCHECK_SRC defined -# at a time, with an outer Makefile caller ensuring the looping: -$(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE) $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - @LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - rm -f "$@" || true ; \ - echo " ASPELL Spell checking on $(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)"; \ - OUT="`(sed 's,^\(.*\)$$, \1,' | $(ASPELL) -a -t $(ASPELL_NUT_COMMON_ARGS) 2>&1) < "$(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)"`" \ - && { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \ - test -z "$$OUT" ; } \ - || { RES=$$? ; \ - echo "FAILED : Aspell reported errors here:" >&2 \ - && echo "----- vvv" >&2 \ - && echo "$$OUT" >&2 \ - && echo "----- ^^^" >&2 ; \ - exit $$RES; } ; \ - touch "$@" - spellcheck: - @if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \ - echo "ASPELL DEBUG : information about the setup follows:"; \ - LANG=$(ASPELL_ENV_LANG); LC_ALL=$(ASPELL_ENV_LANG); export LANG; export LC_ALL; \ - $(ASPELL) --help || true; \ - dpkg -l |grep -i aspell || true ; \ - echo "ASPELL automatic execution line is : ( sed 's,^\(.*\)$$, \1,' < docfile.txt | $(ASPELL) -a -t $(ASPELL_NUT_COMMON_ARGS) | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' )" ; \ - echo "ASPELL proceeding to spellchecking job..."; \ - else true; fi - @FAILED="" ; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for docsrc in $(SPELLCHECK_SRC); do \ - if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \ - echo "ASPELL MAKEFILE DEBUG: Will see from `pwd` if '$(SPELLCHECK_DIR)/$${docsrc}-spellchecked' is up to date" >&2; \ - else true ; fi ; \ - $(MAKE) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_DIR="$(SPELLCHECK_DIR)" "$(SPELLCHECK_DIR)/$${docsrc}-spellchecked" \ - || FAILED="$$FAILED $(SPELLCHECK_DIR)/$$docsrc"; \ - done ; \ - if test -n "$$FAILED" ; then \ - echo "=====================================================================" ; \ - echo "FAILED automatic spellcheck for the following sources (relative to `pwd`): $$FAILED" ; \ - echo "=====================================================================" ; \ - echo "Please 'cd $(abs_top_builddir) && make spellcheck-interactive'"; \ - echo "to either fix document sources or update the dictionary of accepted"; \ - echo "words and spellings listed in the '$(NUT_SPELL_DICT)' file there."; \ - echo "Either way, please follow up by posting a pull request or a patch"; \ - echo "to integrate your fixes into the common NUT codebase."; \ - echo "=====================================================================" ; \ - test x"$(SPELLCHECK_ERROR_FATAL)" = xno || exit 1; \ - echo "NOTE: SPELLCHECK_ERROR_FATAL == no so this make does not break the build!"; \ - echo "=====================================================================" ; \ - fi >&2 ; exit 0 - -# Interactively spell check all documentation source files below (so a human -# can edit the documentation errors and/or add words to custom dictionary). -# Note that here we do not restrain reported issues, so this might catch more -# than the automated test above. -spellcheck-sortdict: $(abs_builddir)/$(NUT_SPELL_DICT).sorted - -# Note that the source file may be not overwritable (distcheck, cdrom, ...), -# so we'd ignore that failure. But the practical use-case is a developer's -# in-tree workspace, so we want the working copy of the dictionary fixed up -# for easy `git diff`ing if possible. -# Note also that "$( "$@" - @cp -f "$@" "$(abs_builddir)/$(NUT_SPELL_DICT)" - @if [ "$(abs_builddir)" != "$(abs_srcdir)" ] ; then \ - cp -f "$@" "$<" || true ; \ - cp -f "$(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting" "$(abs_srcdir)/" || true ; \ - fi - -DISTCLEANFILES = $(NUT_SPELL_DICT).bak-pre-sorting .$(NUT_SPELL_DICT).sorted $(NUT_SPELL_DICT).sorted - + @for docsrc in $(ALL_TXT_SRC); do \ + echo "Spell checking on $$docsrc"; \ + LANG=C $(ASPELL) -a -t -p $(NUT_SPELL_DICT) < $$docsrc | grep [^*]; \ + done +# Interactively spell check all documentation source files spellcheck-interactive: - @FAILED="" ; for docsrc in $(SPELLCHECK_SRC); do \ - echo "Spell checking on $(SPELLCHECK_DIR)/$$docsrc"; \ - LANG=$(ASPELL_ENV_LANG) LC_ALL=$(ASPELL_ENV_LANG) $(ASPELL) check $(ASPELL_NUT_COMMON_ARGS) $(SPELLCHECK_DIR)/$$docsrc || \ - FAILED="$$FAILED $(SPELLCHECK_DIR)/$$docsrc"; \ - done ; \ - if test -n "$$FAILED" ; then \ - echo "FAILED interactive spellcheck for the following sources (relative to `pwd`): $$FAILED" >&2 ; \ - exit 1; \ - fi ; exit 0 - $(MAKE) spellcheck-sortdict - @echo "------------------------------------------------------------------------"; \ - echo "Custom dictionary file $(NUT_SPELL_DICT) may have been updated now."; \ - echo "Use 'git add -p docs/$(NUT_SPELL_DICT) && git checkout -- docs/$(NUT_SPELL_DICT) && make spellcheck-sortdict && git add -p docs/$(NUT_SPELL_DICT)'"; \ - echo "to review changes (please DO NOT REMOVE LINES that aspell chose to drop,"; \ - echo "because other systems might not know these words in their system dictionaries)"; \ - echo "------------------------------------------------------------------------" + @for docsrc in $(ALL_TXT_SRC); do\ + echo "Spell checking on $$docsrc"; \ + LANG=C $(ASPELL) check -p $(NUT_SPELL_DICT) $$docsrc; \ + done else !HAVE_ASPELL -# This rule woulf probably just fail; normally with no ASPELL there are no callers for it -*/*-spellchecked *-spellchecked: Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) - @echo " SKIP-ASPELL $@ : Documentation spell check not available since 'aspell' was not found." >&2 spellcheck: @echo "Documentation spell check not available since 'aspell' was not found." spellcheck-interactive: @echo "Documentation spell check not available since 'aspell' was not found." endif !HAVE_ASPELL -.PHONY: html html-chunked html-single pdf man +.PHONY: html html-single pdf website diff --git a/docs/Makefile.in b/docs/Makefile.in index 8b1a929..b2a6741 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,61 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -89,24 +52,19 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = docs +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -115,43 +73,25 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = docinfo.xml +CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -159,33 +99,12 @@ am__can_run_installinfo = \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir distdir-am -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/docinfo.xml.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -215,11 +134,9 @@ am__relativize = \ A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -230,7 +147,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -244,7 +160,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -254,13 +169,14 @@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ - -# Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) -EGREP = egrep +EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -270,15 +186,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -289,29 +204,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -331,9 +238,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -342,16 +246,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -365,7 +265,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -376,12 +275,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -400,21 +295,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -424,11 +316,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -MAINTAINERCLEANFILES = Makefile.in .dirstamp -EXTRA_DIST = $(ALL_TXT_SRC) $(SHARED_DEPS) $(IMAGE_FILES) \ - $(CABLES_IMAGES) $(NUT_SPELL_DICT) common.xsl xhtml.xsl \ - chunked.xsl asciidoc.txt -#EGREP = grep -E IMAGE_FILES = images/asciidoc.png \ images/hostedby.png \ images/nut_layering.png \ @@ -444,11 +331,11 @@ IMAGE_FILES = images/asciidoc.png \ # Only track here the local deps -SHARED_DEPS = nut-names.txt daisychain.txt asciidoc.conf asciidoc.txt +SHARED_DEPS = nut-names.txt asciidoc.conf USER_MANUAL_DEPS = acknowledgements.txt cables.txt config-notes.txt \ - config-prereqs.txt ci-farm-lxc-setup.txt \ configure.txt download.txt documentation.txt features.txt history.txt \ - outlets.txt scheduling.txt security.txt support.txt user-manual.txt + outlets.txt scheduling.txt security.txt support.txt user-manual.txt \ + stable-hcl.txt DEVELOPER_GUIDE_DEPS = contact-closure.txt design.txt developers.txt \ developer-guide.txt hid-subdrivers.txt macros.txt new-clients.txt \ @@ -464,44 +351,39 @@ CABLES_IMAGES = images/cables/73-0724.png images/cables/940-0024C.jpg \ images/cables/belkin-f6cx-rkm-xu-cable.jpg images/cables/Lansafecable.jpg \ images/cables/mac-940-0024C.png images/cables/mge-66049.png \ images/cables/mge-db9-rj12.jpg images/cables/mge-db9-rj45.jpg \ - images/cables/mge-usb-rj45.jpg \ images/cables/SOLA-330.png -ALL_TXT_SRC = nut-names.txt daisychain.txt \ - $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ - $(CABLES_DEPS) FAQ.txt nut-qa.txt packager-guide.txt snmp.txt \ - solaris-usb.txt +ALL_TXT_SRC = nut-names.txt $(USER_MANUAL_DEPS) $(DEVELOPER_GUIDE_DEPS) \ + $(CABLES_DEPS) FAQ.txt nut-hal.txt nut-qa.txt packager-guide.txt snmp.txt NUT_SPELL_DICT = nut.dict +EXTRA_DIST = $(ALL_TXT_SRC) $(SHARED_DEPS) $(IMAGE_FILES) \ + $(CABLES_IMAGES) docinfo.xml $(NUT_SPELL_DICT) + ASCIIDOC_HTML_SINGLE = user-manual.html \ developer-guide.html \ packager-guide.html \ - solaris-usb.html \ - cables.html \ FAQ.html ASCIIDOC_HTML_CHUNKED = user-manual.chunked \ developer-guide.chunked \ packager-guide.chunked \ - solaris-usb.chunked \ - cables.chunked \ - FAQ.chunked + FAQ.html ASCIIDOC_PDF = user-manual.pdf \ developer-guide.pdf \ packager-guide.pdf \ - solaris-usb.pdf \ - cables.pdf \ FAQ.pdf -SUBDIRS = man cables -SUFFIXES = .txt .html .pdf -spellchecked -CLEANFILES = *.xml *.html *.pdf *-spellchecked docbook-xsl.css + +# Force build in ./ and man/ before website +SUBDIRS = . man website +SUFFIXES = .txt .html .pdf ### TODO: automatic dependency generation # Add other directory deps (not for local EXTRA_DIST) and generated contents FULL_USER_MANUAL_DEPS = $(USER_MANUAL_DEPS) $(SHARED_DEPS) ../README \ - ../INSTALL.nut ../UPGRADING ../TODO ../scripts/ufw/README + ../INSTALL ../UPGRADING ../TODO ../scripts/ufw/README FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ ../scripts/augeas/README ../TODO ../lib/README \ @@ -512,114 +394,19 @@ FULL_DEVELOPER_GUIDE_DEPS = $(DEVELOPER_GUIDE_DEPS) $(SHARED_DEPS) \ # generating the chunked HTML. In this case, export the environment # variable ASCIIDOC_VERBOSE to "-v", ie: # $ ASCIIDOC_VERBOSE=-v make -A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) \ - --attribute=icons \ - --xsltproc-opts="--nonet" \ - --xsltproc-opts="--stringparam nut.localdate \"`TZ=UTC date +%Y-%m-%d`\"" \ - --xsltproc-opts="--stringparam nut.localtime \"`TZ=UTC date +%H:%M:%S`\"" \ - --xsltproc-opts="--stringparam nut.nutversion \"@PACKAGE_VERSION@\"" \ - --attribute=iconsdir="$(srcdir)/images" \ +A2X_COMMON_OPTS = $(ASCIIDOC_VERBOSE) --attribute icons \ + --attribute localdate=`TZ=UTC date +%Y-%m-%d` \ + --attribute localtime=`TZ=UTC date +%H:%M:%S` \ + --attribute iconsdir=$(srcdir)/images \ --attribute=badges \ --attribute=external_title \ - --attribute=tree_version="@TREE_VERSION@" \ - -a toc -a numbered --destination-dir=$${A2X_OUTDIR} + --attribute tree_version=@TREE_VERSION@ \ + -a toc -a numbered --destination-dir=. -# NOTE: a2x newer than 8.6.8 says "--destination-dir" is only valid for HTML. -# As of version 8.6.9 it lies, and the argument is required for our distcheck -# (and does affect PDF builds, as found during work on collision-avoidance - -# true with at least asciidoc/a2x versions 9.0.0rc2). -# For more details see issues https://github.com/asciidoc/asciidoc/issues/44 -# and https://github.com/networkupstools/nut/pull/281 (in short, attempts -# to "fix" this warning broke NUT build). If this is to be retried later, see -# https://github.com/networkupstools/nut/pull/281/commits/fe17861c4ea12679b3ebfefa8a6d692d79d99f2d -# and do not forget to fix up docs/man/Makefile.am too ;) - -# NOTE: a2x tends to copy some files into its working area, preserving original -# permissions. If those files are read-only in origin (e.g. packaged stylesheet -# or our resources coming from EXTRA_DIST) the next a2x can not overwrite it. -# Also note that such hoarding of files has potential to break parallel builds -# (or cause them to produce undefined results if some bad timing happens). -# As a brutal workaround for the former problem, we chmod. For second one we -# might try magic with .SEQUENTIAL recipe hints, but that is gmake-dependent. - -# Note that empirically it treats "destination-dir" as the source root for -# PDF generation (even though it claims the argument is ignored for non-HTML -# targets) so we have to provide the "images/" in this case. ONLY for PDF! - -# Note we only remove the original target (if present), if it is a directory - -# e.g. created by "html-chunked" targets. -DOCBUILD_BEGIN = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - rm -rf "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ - mkdir -p "./$${A2X_OUTDIR}" || exit ; \ - case "$${A2X_OUTDIR}" in \ - tmp/pdf.*) ln -s ../../images "./$${A2X_OUTDIR}" ;; \ - esac; \ - else A2X_OUTDIR='.' ; fi; \ - if test -s "${builddir}/docbook-xsl.css" \ - && test -r "${builddir}/docbook-xsl.css" \ - && ! test -w "${builddir}/docbook-xsl.css" \ - ; then chmod u+w "${builddir}/docbook-xsl.css" ; fi ; \ - chmod -R u+w "./$${A2X_OUTDIR}" || true; \ -} - - -# When moving "*" hope a2x did not make any "hidden" files -# like ".*" that would be required for resulting documents. -# Leave the "images/" dir there, though. -# Otherwise, we would have to `find` them all. -DOCBUILD_END = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - chmod -R u+w "./$${A2X_OUTDIR}" || true; \ - test -d "$@" && rm -rf "$@" || true ; \ - mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \ - mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \ - rm -rf "./$${A2X_OUTDIR}" ; \ - fi ; \ -} - - -# Non-interactively spell check all documentation source files. -# This is useful for Buildbot and automated QA processing -# FIXME: how to present output (std{out,err}, single file or per target)? -# NOTE: ../ChangeLog is nowadays generated from commit messages, so -# its spelling (or errors in that) are not fixable and thus irrelevant. -# Similarly for the ../INSTALL file that is prepared by autoconf and not -# tracked as a source file by NUT Git repository. -@HAVE_ASPELL_TRUE@SPELLCHECK_SRC = $(ALL_TXT_SRC) ../README ../INSTALL.nut ../UPGRADING ../NEWS \ -@HAVE_ASPELL_TRUE@ ../TODO ../scripts/ufw/README ../scripts/augeas/README ../lib/README \ -@HAVE_ASPELL_TRUE@ ../tools/nut-scanner/README \ -@HAVE_ASPELL_TRUE@ ../AUTHORS ../COPYING ../LICENSE-GPL2 ../LICENSE-GPL3 - - -# Directory SPELLCHECK_SRC files are relative to. Overriden by other Makefiles. -@HAVE_ASPELL_TRUE@SPELLCHECK_DIR = $(srcdir) - -# Note: de-facto our documentation is beyond ASCII (at least in names of -# international committers). The grep tests below look if the aspell output -# contained something other than the OK lines (tagged with asterisk) and -# aspell's version (tagged with @) and if it did - those lines must be the -# spellcheck complaints. Empty OUT is ok. -# We also must indent the input, because certain piped-in characters are -# interpreted as commands, and seems this feature can not be turned off. -# See also http://aspell.net/man-html/Through-A-Pipe.html -# TODO: Is "grep -a" or "grep -b" (treat input as ascii/bin) portable enough? -# Set SPELLCHECK_ERROR_FATAL=no if there are some unavoidable issues -# due to spellchecking, to temporarily not fail builds due to this. -# For Travis CI in particular, see ci_build.sh in NUT codebase root. -@HAVE_ASPELL_TRUE@SPELLCHECK_ERROR_FATAL = yes -@HAVE_ASPELL_TRUE@SPELLCHECK_ENV_DEBUG = no -@HAVE_ASPELL_TRUE@ASPELL_NUT_COMMON_ARGS = -p \ -@HAVE_ASPELL_TRUE@ $(abs_srcdir)/$(NUT_SPELL_DICT) -d en \ -@HAVE_ASPELL_TRUE@ --lang=en --ignore-accents --encoding=utf-8 -@HAVE_ASPELL_TRUE@ASPELL_ENV_LANG = en.UTF-8 -@HAVE_ASPELL_TRUE@ASPELL_OUT_NOTERRORS = (^[ \t]*[\*\@]|^$$) -@HAVE_ASPELL_TRUE@DISTCLEANFILES = $(NUT_SPELL_DICT).bak-pre-sorting .$(NUT_SPELL_DICT).sorted $(NUT_SPELL_DICT).sorted all: all-recursive .SUFFIXES: -.SUFFIXES: .txt .html .pdf -spellchecked .chunked +.SUFFIXES: .txt .html .pdf .chunked $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -632,13 +419,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -649,8 +437,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -docinfo.xml: $(top_builddir)/config.status $(srcdir)/docinfo.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo @@ -659,25 +445,22 @@ clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -692,12 +475,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -713,7 +541,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -725,11 +558,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -738,29 +575,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -816,7 +635,6 @@ distdir-am: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local check: check-recursive all-am: Makefile installdirs: installdirs-recursive @@ -843,17 +661,14 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool clean-local mostlyclean-am @@ -918,240 +733,81 @@ ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) check-am install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am check-local clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags ctags-am distclean \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs installdirs-am \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + clean-local ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am all: doc -# This list is defined by configure script choices and options: -check-local: @DOC_CHECK_LIST@ - -# This list is defined by configure script choices and options: doc: @DOC_BUILD_LIST@ -# This target can be called by developers to go around the configure -# script choices at their risk (e.g. missing tools are possible): -docs: pdf html-single html-chunked man-man html-man - -all-docs: docs - -check-docs: check-pdf check-html-single check-html-chunked check-man - pdf: $(ASCIIDOC_PDF) # also build the HTML manpages with these targets html-single: $(ASCIIDOC_HTML_SINGLE) html-chunked: $(ASCIIDOC_HTML_CHUNKED) -# the "for" loops might better use $^ but it might be not portable -check-pdf: $(ASCIIDOC_PDF) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(ASCIIDOC_PDF) ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i 'PDF document' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED PDF sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED PDF sanity check"; exit 0 +@HAVE_ASCIIDOC_TRUE@website: html-chunked pdf +@HAVE_ASCIIDOC_FALSE@website: +@HAVE_ASCIIDOC_FALSE@ @echo "Not building website documentation since 'asciidoc' was not found." -check-html-single: $(ASCIIDOC_HTML_SINGLE) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(ASCIIDOC_HTML_SINGLE) ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-single sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-single sanity check"; exit 0 - -check-html-chunked: $(ASCIIDOC_HTML_CHUNKED) - @FAILED=""; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for D in $(ASCIIDOC_HTML_CHUNKED); do \ - for F in "$$D"/*.html ; do \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; \ - for F in "$$D"/*.css ; do \ - test -s "$$F" && { $(EGREP) -i 'CSS stylesheet' "$$F" > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-chunked sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-chunked sanity check"; exit 0 - -# Note: usually the results from man-page check will be reported twice: -# once as a SUBDIRS child makefile, and once via DOC_CHECK_LIST expansion -# Note: default `make all` in the man directory caters to drivers etc. -# chosen during configure script execution. The "all-man" and "all-html" -# rules build everything documented. -check-man all-man man-man all-html html-man: - cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile $@ - -man: - cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile all - -# Dirs to clean clean-local: - rm -rf *.chunked *.bak tmp + rm -rf *.pdf *.html *.chunked docbook-xsl.css *.bak + +# Static HCL is generated automatically +# This is more of a harness, since this file should have already been +# generated, due to the top level Makefile SUBDIRS ordering (tools before docs) +ups-html.txt: ../data/driver.list.in + cd ../data && $(MAKE) $(AM_MAKEFLAGS) driver.list + cd ../tools && $(MAKE) $(AM_MAKEFLAGS) website user-manual.html user-manual.chunked user-manual.pdf: $(FULL_USER_MANUAL_DEPS) developer-guide.html developer-guide.chunked developer-guide.pdf: $(FULL_DEVELOPER_GUIDE_DEPS) packager-guide.html packager-guide.chunked packager-guide.pdf: packager-guide.txt asciidoc.conf -solaris-usb.html solaris-usb.chunked solaris-usb.pdf: solaris-usb.txt asciidoc.conf -# PORTABILITY NOTE: POSIX Make forbids the suffix rule definitions with -# prerequisites like done below, and GNU Make of some versions complains; -# https://www.gnu.org/software/make/manual/html_node/Error-Messages.html -# says the prerequisites were ignored while a suffix rule was created; -# eventually the POSIX stance would be taken to define a rule for a weird -# verbatim target file name with prerequisites: -# ../docs/Makefile:936: warning: ignoring prerequisites on suffix rule definition -# Changes from ".txt.pdf: docinfo.xml" to "*.pdf: docinfo.xml" = ".txt.pdf:" -# as done below may be pointless in the end (with regard to a portable way -# to trigger builds by a changed dependency), but at least predictable and -# not toxic. -*.html: common.xsl xhtml.xsl .txt.html: - @A2X_OUTDIR="tmp/html-single.$(@F).$$$$" ; \ - echo " DOC-HTML Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml --xsl-file=$(srcdir)/xhtml.xsl $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_COMMON_OPTS) --attribute=xhtml11_format --format=xhtml $< -*.chunked: common.xsl chunked.xsl .txt.chunked: - @A2X_OUTDIR="tmp/html-chunked.$(@F).$$$$" ; \ - echo " DOC-HTML-CHUNKED Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked --xsl-file=$(srcdir)/chunked.xsl $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_COMMON_OPTS) --attribute=chunked_format --format=chunked $< -# Note: non-HTML a2x modes may ignore the destination directory -*.pdf: docinfo.xml -.txt.pdf: - @A2X_OUTDIR="tmp/pdf.$(@F).$$$$" ; \ - echo " DOC-PDF Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES - -# WARNING: The percent wildcard is a GNU extension; otherwise we need -# a ".txt.txt-spellchecked" type of rule and files like "README" all -# renamed to *.txt, or lots of rules for files without the extensions -# Other Makefiles have a relatively simple life, dealing with just a -# few texts and name/extension patterns in their directories. -#?#.txt.txt-spellchecked: Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -#%-spellchecked: % Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -#*-spellchecked */*-spellchecked: $(@:-spellchecked=) $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# NOTE: This portable rule RELIES on just one SPELLCHECK_SRC defined -# at a time, with an outer Makefile caller ensuring the looping: -@HAVE_ASPELL_TRUE@$(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)-spellchecked: $(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE) $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -@HAVE_ASPELL_TRUE@ @LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ -@HAVE_ASPELL_TRUE@ rm -f "$@" || true ; \ -@HAVE_ASPELL_TRUE@ echo " ASPELL Spell checking on $(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)"; \ -@HAVE_ASPELL_TRUE@ OUT="`(sed 's,^\(.*\)$$, \1,' | $(ASPELL) -a -t $(ASPELL_NUT_COMMON_ARGS) 2>&1) < "$(SPELLCHECK_DIR)/$(SPELLCHECK_SRC_ONE)"`" \ -@HAVE_ASPELL_TRUE@ && { if test -n "$$OUT" ; then OUT="`echo "$$OUT" | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' `" ; fi; \ -@HAVE_ASPELL_TRUE@ test -z "$$OUT" ; } \ -@HAVE_ASPELL_TRUE@ || { RES=$$? ; \ -@HAVE_ASPELL_TRUE@ echo "FAILED : Aspell reported errors here:" >&2 \ -@HAVE_ASPELL_TRUE@ && echo "----- vvv" >&2 \ -@HAVE_ASPELL_TRUE@ && echo "$$OUT" >&2 \ -@HAVE_ASPELL_TRUE@ && echo "----- ^^^" >&2 ; \ -@HAVE_ASPELL_TRUE@ exit $$RES; } ; \ -@HAVE_ASPELL_TRUE@ touch "$@" +.txt.pdf: docinfo.xml + $(A2X) $(A2X_COMMON_OPTS) --attribute=pdf_format --format=pdf -a docinfo1 $< +# FIXME: also check ../{NEWS,README,UPGRADING}+other dirs +# Non-interactively spell check all documentation source files. +# This is useful for Buildbot and automated QA processing +# FIXME: how to present output (std{out,err}, single file or per target)? @HAVE_ASPELL_TRUE@spellcheck: -@HAVE_ASPELL_TRUE@ @if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \ -@HAVE_ASPELL_TRUE@ echo "ASPELL DEBUG : information about the setup follows:"; \ -@HAVE_ASPELL_TRUE@ LANG=$(ASPELL_ENV_LANG); LC_ALL=$(ASPELL_ENV_LANG); export LANG; export LC_ALL; \ -@HAVE_ASPELL_TRUE@ $(ASPELL) --help || true; \ -@HAVE_ASPELL_TRUE@ dpkg -l |grep -i aspell || true ; \ -@HAVE_ASPELL_TRUE@ echo "ASPELL automatic execution line is : ( sed 's,^\(.*\)$$, \1,' < docfile.txt | $(ASPELL) -a -t $(ASPELL_NUT_COMMON_ARGS) | $(EGREP) -b -v '$(ASPELL_OUT_NOTERRORS)' )" ; \ -@HAVE_ASPELL_TRUE@ echo "ASPELL proceeding to spellchecking job..."; \ -@HAVE_ASPELL_TRUE@ else true; fi -@HAVE_ASPELL_TRUE@ @FAILED="" ; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ -@HAVE_ASPELL_TRUE@ for docsrc in $(SPELLCHECK_SRC); do \ -@HAVE_ASPELL_TRUE@ if test "$(SPELLCHECK_ENV_DEBUG)" != no ; then \ -@HAVE_ASPELL_TRUE@ echo "ASPELL MAKEFILE DEBUG: Will see from `pwd` if '$(SPELLCHECK_DIR)/$${docsrc}-spellchecked' is up to date" >&2; \ -@HAVE_ASPELL_TRUE@ else true ; fi ; \ -@HAVE_ASPELL_TRUE@ $(MAKE) -s -f "$(abs_top_builddir)/docs/Makefile" SPELLCHECK_SRC_ONE="$${docsrc}" SPELLCHECK_DIR="$(SPELLCHECK_DIR)" "$(SPELLCHECK_DIR)/$${docsrc}-spellchecked" \ -@HAVE_ASPELL_TRUE@ || FAILED="$$FAILED $(SPELLCHECK_DIR)/$$docsrc"; \ -@HAVE_ASPELL_TRUE@ done ; \ -@HAVE_ASPELL_TRUE@ if test -n "$$FAILED" ; then \ -@HAVE_ASPELL_TRUE@ echo "=====================================================================" ; \ -@HAVE_ASPELL_TRUE@ echo "FAILED automatic spellcheck for the following sources (relative to `pwd`): $$FAILED" ; \ -@HAVE_ASPELL_TRUE@ echo "=====================================================================" ; \ -@HAVE_ASPELL_TRUE@ echo "Please 'cd $(abs_top_builddir) && make spellcheck-interactive'"; \ -@HAVE_ASPELL_TRUE@ echo "to either fix document sources or update the dictionary of accepted"; \ -@HAVE_ASPELL_TRUE@ echo "words and spellings listed in the '$(NUT_SPELL_DICT)' file there."; \ -@HAVE_ASPELL_TRUE@ echo "Either way, please follow up by posting a pull request or a patch"; \ -@HAVE_ASPELL_TRUE@ echo "to integrate your fixes into the common NUT codebase."; \ -@HAVE_ASPELL_TRUE@ echo "=====================================================================" ; \ -@HAVE_ASPELL_TRUE@ test x"$(SPELLCHECK_ERROR_FATAL)" = xno || exit 1; \ -@HAVE_ASPELL_TRUE@ echo "NOTE: SPELLCHECK_ERROR_FATAL == no so this make does not break the build!"; \ -@HAVE_ASPELL_TRUE@ echo "=====================================================================" ; \ -@HAVE_ASPELL_TRUE@ fi >&2 ; exit 0 - -# Interactively spell check all documentation source files below (so a human -# can edit the documentation errors and/or add words to custom dictionary). -# Note that here we do not restrain reported issues, so this might catch more -# than the automated test above. -@HAVE_ASPELL_TRUE@spellcheck-sortdict: $(abs_builddir)/$(NUT_SPELL_DICT).sorted - -# Note that the source file may be not overwritable (distcheck, cdrom, ...), -# so we'd ignore that failure. But the practical use-case is a developer's -# in-tree workspace, so we want the working copy of the dictionary fixed up -# for easy `git diff`ing if possible. -# Note also that "$( "$@" -@HAVE_ASPELL_TRUE@ @cp -f "$@" "$(abs_builddir)/$(NUT_SPELL_DICT)" -@HAVE_ASPELL_TRUE@ @if [ "$(abs_builddir)" != "$(abs_srcdir)" ] ; then \ -@HAVE_ASPELL_TRUE@ cp -f "$@" "$<" || true ; \ -@HAVE_ASPELL_TRUE@ cp -f "$(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting" "$(abs_srcdir)/" || true ; \ -@HAVE_ASPELL_TRUE@ fi - +@HAVE_ASPELL_TRUE@ @for docsrc in $(ALL_TXT_SRC); do \ +@HAVE_ASPELL_TRUE@ echo "Spell checking on $$docsrc"; \ +@HAVE_ASPELL_TRUE@ LANG=C $(ASPELL) -a -t -p $(NUT_SPELL_DICT) < $$docsrc | grep [^*]; \ +@HAVE_ASPELL_TRUE@ done +# Interactively spell check all documentation source files @HAVE_ASPELL_TRUE@spellcheck-interactive: -@HAVE_ASPELL_TRUE@ @FAILED="" ; for docsrc in $(SPELLCHECK_SRC); do \ -@HAVE_ASPELL_TRUE@ echo "Spell checking on $(SPELLCHECK_DIR)/$$docsrc"; \ -@HAVE_ASPELL_TRUE@ LANG=$(ASPELL_ENV_LANG) LC_ALL=$(ASPELL_ENV_LANG) $(ASPELL) check $(ASPELL_NUT_COMMON_ARGS) $(SPELLCHECK_DIR)/$$docsrc || \ -@HAVE_ASPELL_TRUE@ FAILED="$$FAILED $(SPELLCHECK_DIR)/$$docsrc"; \ -@HAVE_ASPELL_TRUE@ done ; \ -@HAVE_ASPELL_TRUE@ if test -n "$$FAILED" ; then \ -@HAVE_ASPELL_TRUE@ echo "FAILED interactive spellcheck for the following sources (relative to `pwd`): $$FAILED" >&2 ; \ -@HAVE_ASPELL_TRUE@ exit 1; \ -@HAVE_ASPELL_TRUE@ fi ; exit 0 -@HAVE_ASPELL_TRUE@ $(MAKE) spellcheck-sortdict -@HAVE_ASPELL_TRUE@ @echo "------------------------------------------------------------------------"; \ -@HAVE_ASPELL_TRUE@ echo "Custom dictionary file $(NUT_SPELL_DICT) may have been updated now."; \ -@HAVE_ASPELL_TRUE@ echo "Use 'git add -p docs/$(NUT_SPELL_DICT) && git checkout -- docs/$(NUT_SPELL_DICT) && make spellcheck-sortdict && git add -p docs/$(NUT_SPELL_DICT)'"; \ -@HAVE_ASPELL_TRUE@ echo "to review changes (please DO NOT REMOVE LINES that aspell chose to drop,"; \ -@HAVE_ASPELL_TRUE@ echo "because other systems might not know these words in their system dictionaries)"; \ -@HAVE_ASPELL_TRUE@ echo "------------------------------------------------------------------------" -# This rule woulf probably just fail; normally with no ASPELL there are no callers for it -@HAVE_ASPELL_FALSE@*/*-spellchecked *-spellchecked: Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -@HAVE_ASPELL_FALSE@ @echo " SKIP-ASPELL $@ : Documentation spell check not available since 'aspell' was not found." >&2 +@HAVE_ASPELL_TRUE@ @for docsrc in $(ALL_TXT_SRC); do\ +@HAVE_ASPELL_TRUE@ echo "Spell checking on $$docsrc"; \ +@HAVE_ASPELL_TRUE@ LANG=C $(ASPELL) check -p $(NUT_SPELL_DICT) $$docsrc; \ +@HAVE_ASPELL_TRUE@ done @HAVE_ASPELL_FALSE@spellcheck: @HAVE_ASPELL_FALSE@ @echo "Documentation spell check not available since 'aspell' was not found." @HAVE_ASPELL_FALSE@spellcheck-interactive: @HAVE_ASPELL_FALSE@ @echo "Documentation spell check not available since 'aspell' was not found." -.PHONY: html html-chunked html-single pdf man +.PHONY: html html-single pdf website # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/docs/acknowledgements.txt b/docs/acknowledgements.txt index 7597bb2..bda575d 100644 --- a/docs/acknowledgements.txt +++ b/docs/acknowledgements.txt @@ -19,24 +19,24 @@ The NUT Team Active members ~~~~~~~~~~~~~~ -- Jim Klimov: project leader (since 2020), OpenIndiana and OmniOS packager, CI ops and infra -- Arnaud Quette: ex-project leader (from 2005 to 2020), Debian packager and jack of all trades +- Arnaud Quette: project leader (since 2005), Debian packager and jack of all trades - Charles Lepple: senior lieutenant -- Daniele Pezzini: senior developer +- Frederic Bohe: senior developer +- Emilien Kia: senior developer +- Václav Krpec: junior developer - Kjell Claesson: senior developer - Alexander Gordeev: junior developer - Michal Soltys: junior developer - David Goncalves: Python developer - Jean Perriault: web consultant - Eric S. Raymond: Documentation consultant -- Roger Price: Documentation specialist - Oden Eriksson: Mandriva packager -- Stanislav Brabec: Novell / SUSE packager +- Stanislav Brabec: Novell / Suse packager - Michal Hlavinka: Redhat packager - Antoine Colombier: trainee For an up to date list of NUT developers, refer to -link:https://github.com/networkupstools/nut/graphs/contributors[GitHub]. +link:https://alioth.debian.org/project/memberlist.php?group_id=30602[Alioth]. Retired members ~~~~~~~~~~~~~~~ @@ -45,21 +45,37 @@ Retired members - Arjen de Korte: senior lieutenant - Peter Selinger: senior lieutenant - Carlos Rodrigues: author of the "megatec" drivers, removing the numerous - drivers for Megatec / Q1 protocol. These drivers have now been replaced - by blazer_ser and blazer_usb +drivers for Megatec / Q1 protocol. These drivers have now been replaced by +blazer_ser and blazer_usb - Niels Baggesen: ported and heavily extended upscode2 to NUT 2.0 driver model - Niklas Edmundsson: has worked on 3-phase support, and upscode2 updates - Martin Loyer: has worked a bit on mge-utalk - Jonathan Dion: MGE internship (summer 2006), who has worked on configuration - Doug Reynolds: has worked on CyberPower support (powerpanel driver) -- Jon Gough: has worked on porting the megatec driver to USB (megatec_usb) +- Jon Gough: has worked on porting the megatec driver to USB (megatec_usb) - Dominique Lallement: Consultant (chairman of the USB/HID PDC Forum) - Julius Malkiewicz: junior developer - Tomas Smetana: former Redhat packager (2007-2008) -- Frederic Bohe: senior developer, Eaton contractor (2009-2013) -- Emilien Kia: senior developer -- Václav Krpec: junior developer +[[Eaton]] +Our main supporter: Eaton +------------------------- + +Through the acquisition of MGE Office Protection Systems (a carve out of +the MGE UPS SYSTEMS small systems, up to 10 KVA), Eaton has been supporting +NUT, and more generally the Free/Libre Opensource Software Community +since around 2002. + +This support includes the following actions: + +- providing extensive technical documents (Eaton protocols library), +- providing units to developers of NUT and related projects, +- hosting the networkupstools.org webserver (from 2005 to August 2012), +- providing artwork, +- promoting NUT in general. + +For more detailed information on Eaton's Opensource commitment, please refer to +link:http://opensource.eaton.com[Eaton Opensource website]. Supporting manufacturers ------------------------ @@ -67,66 +83,33 @@ Supporting manufacturers UPS manufacturers ~~~~~~~~~~~~~~~~~ -[[Eaton]] -* link:http://powerquality.eaton.com[Eaton], has been the main NUT supporter in -the past, between 2007 and 2011, continuing MGE UPS SYSTEMS efforts. -As such, Eaton has been: - - providing extensive technical documents (Eaton protocols library), - - providing units to developers of NUT and related projects, - - hosting the networkupstools.org webserver (from 2007 to August 2012), - - providing artwork, - - promoting NUT in general, - - supporting its customers using NUT. -+ -[WARNING] -================================================================================ -*The situation has evolved, and since 2011 Eaton does not support NUT anymore.* +- link:http://powerquality.eaton.com[Eaton], our main supporter, as presented in +the <>. -*This may still evolve in the future.* - -*But for now, please do not consider anymore that buying Eaton products will -provide you with official support from Eaton, or a better level of device -support in NUT.* -================================================================================ - -* link:https://www.ametek.com/products/businessunits/powersystemsandinstruments/powervar[AMETEK -Powervar], through Andrew McCartney, has added support for all AMETEK Powervar -UPM models as usb-hid UPS. - -* link:http://www.gamatronic.com[Gamatronic], through Nadav Moskovitch, has +- link:http://www.gamatronic.com[Gamatronic], through Nadav Moskovitch, has revived the 'sec' driver (as gamatronic), and expanded a bit genericups for its UPSs with alarm interface. -* link:https://ever.eu/[EVER Power Systems] added a USB HID subdriver for -EVER UPSes (Sinline RT Series, Sinline RT XL Series, ECO PRO AVR CDS Series). - -* link:http://www.microdowell.com[Microdowell], through Elio Corbolante, has -created the 'microdowell' driver to support the Enterprise Nxx/Bxx serial -devices. The company also proposes NUT as an alternative to its software for +- link:http://www.microdowell.com[Microdowell], through Elio Corbolante, has +created the 'microdowell' driver to support the Enterprise Nxx/Bxx serial devices. +They also proposes NUT as an alternative to its software for link:http://www.microdowell.com/fra/download.html[Linux / Unix]. -* link:http://pcmups.com.tw[Powercom], through Alexey Morozov, has provided +- link:http://pcmups.com.tw[Powercom], through Alexey Morozov, has provided link:ups-protocols.html[extensive information] on its USB/HID devices, along with development units. -* link:http://www.riello-ups.com[Riello UPS], through Massimo Zampieri, has +- link:http://www.riello-ups.com[Riello UPS], through Massimo Zampieri, has provided link:ups-protocols.html[all protocols information]. Elio Parisi has also created riello_ser and riello_usb to support these protocols. -* link:http://www.tripplite.com[Tripp Lite], through Eric Cobb, has provided +- link:http://www.tripplite.com[Tripp Lite], through Eric Cobb, has provided test results from connecting their HID-compliant UPS hardware to NUT. Some of this information has been incorporated into the NUT hardware compatibility list, and the rest of the information is available via the link:http://article.gmane.org/gmane.comp.monitoring.nut.user/8173[list archives]. -* link:https://nag.company/en[NAG], through Alexey Kazancev and Igor Ryabov, -has added support for SNR-UPS-LID-XXXX models as usb-hid UPS. - -* link:http://www.ablerex.com.tw/[Ablere Electronics Co., Ltd.] contributed -the ablerex subdriver for blazer_usb, handling Ablerex MP, ARES Plus, MSII -MSIII, GRs and GRs Plus models. - Appliances manufacturers ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -150,30 +133,28 @@ safenet driver. Older entries (before 2005) --------------------------- -- MGE UPS SYSTEMS was the previous NUT sponsor, from 2002 until its partial -acquisition by Eaton. They provided protocols information, many units for -development of NUT-related projects. +- MGE UPS SYSTEMS was the previous NUT sponsor. They provided protocols +information, many units for development of NUT-related projects. Several drivers such as mge-utalk, mge-shut, snmp-ups, hidups, and usbhid-ups are the result of this collaboration, in addition to the WMNut, MGE HID Parser -the libhid projects, ... through Arnaud Quette (who was also an MGE employee). -All the MGE supporters have gone with Eaton (through MGE Office Protection -Systems), which was temporarily the new NUT sponsor. +the libhid projects, ... through Arnaud. +All the MGE supporters have now gone with Eaton (through MGE Office +Protection Systems), which is the new NUT sponsor. -- Fenton Technologies contributed a PowerPal 660 to the project. Their open -stance and quick responses to technical inquiries were appreciated for +- Fenton Technologies contributed a PowerPal 660 to the project. Their open +stance and quick responses to technical inquiries were appreciated for making the development of the fentonups driver possible. -Fenton has since been acquired by link:http://www.metapo.com[Metapo]. +Fenton has since been acquired by link:http://www.metapo.com[Metapo]. -- Bo Kersey of link:http://www.vircio.com[VirCIO] provided a Best Power -Fortress 750 to facilitate the bestups driver. +- Bo Kersey of link:http://www.vircio.com[VirCIO] provided a Best Power Fortress +750 to facilitate the bestups driver. - Invensys Energy Systems provided the SOLA/Best "Phoenixtec" protocol document. SOLA has since been acquired by Eaton. - PowerKinetics technical support provided documentation on their MiniCOL protocol, which is archived in the NUT protocol library. -PowerKinetics was acquired by the link:http://www.jst.cc[JST Group] -in June 2003. +PowerKinetics was acquired by the link:http://www.jst.cc[JST Group] in June 2003. - link:http://www.cyberpowersystems.com[Cyber Power Systems] contributed a 700AVR model for testing and development of the cyberpower driver. @@ -183,12 +164,7 @@ and a UPStation GXT2 with the Web/SNMP card for development of the liebert driver and expansion of the existing snmp-ups driver. Liebert has since been acquired by link:http://www.emerson.com[Emerson]. -NOTE: If a company or individual isn't listed here, then we probably don't -have enough information about the situation. Developers are kindly requested -to report vendor contributions to the NUT team so this list may reflect their -help, as well as convey a sense of official support (at least, that drivers -were proposed according to the know-how coming from specs and knowledge about -hardware and firmware capabilities, and not acquired via reverse engineering -with a certain degree of unreliability and incompleteness). If we have left -you out, please send us some mail or post a pull request to update this -document in GitHub. +NOTE: If a company or individual isn't listed here, then we probably don't have +enough information about the situation. Developers are requested to report vendor +contributions to the NUT team so this list may reflect their help. +If we have left you out, send us some mail. diff --git a/docs/asciidoc.txt b/docs/asciidoc.txt deleted file mode 100644 index 1f7b391..0000000 --- a/docs/asciidoc.txt +++ /dev/null @@ -1,19 +0,0 @@ -Using AsciiDoc in NUT -===================== -Charles Lepple -:Author Initials: CFL - -Intro ------ - -See the https://asciidoc-py.github.io/userguide.html[AsciiDoc User Guide] -for more information. - -Works in Progress ------------------ - -- link:website/index.html[The NUT Website] -- link:user-manual.html[The NUT User Manual] -- link:developer-guide.html[The NUT Developer Guide] -- link:packager-guide.html[The NUT Packager Guide] -- link:man/index.html[Man pages] diff --git a/docs/cables.txt b/docs/cables.txt index df4ca78..fde660a 100644 --- a/docs/cables.txt +++ b/docs/cables.txt @@ -37,25 +37,25 @@ OmniGuard F6C***-RKM *From "Daniel"* -A straight-through RS-232 cable (with pins 2-7 connected through) should -work with the following models: +A straight-through RS-232 cable (with pins 2-7 connected through) should work +with the following models: - F6C110-RKM-2U - F6C150-RKM-2U - F6C230-RKM-2U -- F6C320-RKM-3U +- F6C320-RKM-3U image::images/cables/belkin-f6cx-rkm-xu-cable.jpg[Belkin OmniGuard F6C***-RKM cable] Eaton ----- -Documents in this section are provided courtesy of Eaton. +Documents in this section are provided courtesy of Eaton. MGE Office Protection Systems ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -The three first cables also applies to MGE UPS SYSTEMS and Eaton. +The two first cables also applies to MGE UPS SYSTEMS. DB9-DB9 cable (ref 66049) ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -67,36 +67,11 @@ image::images/cables/mge-66049.png[DB9-DB9 cable] DB9-RJ45 cable ^^^^^^^^^^^^^^ -This cable is used on the more recent models, including Ellipse MAX, -Protection Station, ... +This cable is used on the more recent models, including Ellipse MAX, Protection +Station, ... image::images/cables/mge-db9-rj45.jpg[DB9-RJ45 cable] -NMC DB9-RJ45 cable -^^^^^^^^^^^^^^^^^^ - -The following applies to the MGE 66102 NMC (Network Management Card), and -possibly other models. The NMC connection is an 8P8C RJ45-style jack. - -|==== -|Signal | PC | NMC -| | 1,4,6 | -|TxD | 2 | 3 -|RxD | 3 | 6 -|GND | 5 | 4 -| | 7,8 | -| | shield | shield -|==== - - -USB-RJ45 cable -^^^^^^^^^^^^^^ - -This cable is used also on the more recent models, including Ellipse MAX, -Protection Station, ... - -image::images/cables/mge-usb-rj45.jpg[USB-RJ45 cable] - DB9-RJ12 cable ^^^^^^^^^^^^^^ @@ -127,46 +102,26 @@ This cable can be used with the following models: T700, T1000, T1500, T1500j, T700h, T1000h, T1500h, R1500, R1500j, R1500h, T2000, T2000j, T2400h, T2400h-NA, R3000 / R3000j, R3000h, -R3000h-International, R3000h-NA, R6000h-NA, R6000i, R6000j. +R3000h-International, R3000h-NA, R6000h-NA, R6000i, R6000j. - UPS PC 9 pin connector +UPS PC 9 pin connector - 1 --------- 3 - 2 --------- 2 - 4 -\ - 4 --------- 5 | - 6 -/ - 6 --------- 7 + 1 --------- 3 + 2 --------- 2 + 4 -\ + 4 --------- 5 | + 6 -/ + 6 --------- 7 Contributed by Kjell Claesson and Arnaud Quette. -Phoenixtec (Best Power) ------------------------ - -Many Best Power units (including the Patriot Pro II) have a female DB-9 -socket with a non-standard pinout. - -|==== -|Signal | PC | UPS -| | 1,4,6 | NC -|TxD | 2 | 2 -|RxD | 3 | 1 -|GND | 5 | 4 -| | 7,8 | NC -|==== - -Sources: - -* http://pinoutsguide.com/UPS/best_power_pinout.shtml -* http://lit.powerware.com/ll_download.asp?file=m_patriotproii_jan99.pdf -* Stan Gammons Tripp-Lite ---------- *From Tripp-Lite, via Bryan Kolodziej* -This cable (black 73-0844 cable) is used on various models, using the -"Lan 2.2 interface" and the genericups driver (upstype=5). +This cable (black 73-0844 cable) is used on various models, using the "Lan 2.2 interface" +and the genericups driver (upstype=5). image::images/cables/73-0724.png[73-0724 cable] diff --git a/docs/cables/Makefile.am b/docs/cables/Makefile.am deleted file mode 100644 index 8cdb1d3..0000000 --- a/docs/cables/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -CLEANFILES = *-spellchecked -MAINTAINERCLEANFILES = Makefile.in .dirstamp diff --git a/docs/cables/apc-rs500-serial.txt b/docs/cables/apc-rs500-serial.txt index 9a35a2a..ef89ed6 100644 --- a/docs/cables/apc-rs500-serial.txt +++ b/docs/cables/apc-rs500-serial.txt @@ -1,7 +1,7 @@ Desc: APC UPS cable - for Back-UPS RS 500 File: apc-rs500-serial.txt Date: 14 July 2004 -Auth: Russell Kroll , Martin Edlman +Auth: Russell Kroll , Martin Edlman This document was constructed from a mail from Martin. He figured out the pinouts to make the Back-UPS RS 500 work with a normal serial port. diff --git a/docs/cables/ge-imv-victron.txt b/docs/cables/ge-imv-victron.txt index 6a84417..bffed19 100644 --- a/docs/cables/ge-imv-victron.txt +++ b/docs/cables/ge-imv-victron.txt @@ -25,7 +25,7 @@ Data cable 2 for UPS: Driver: victronups (newvictronups) - + UPS PC 9 pin connector 2 --------- 3 3 --------- 2 @@ -39,13 +39,13 @@ UPS PC 9 pin connector Crack cable: for UPS Victron Lite (no IMV Victron Match Lite) - + Driver: genericsups UPS PC 9 pin connector 1 ---------- 4 DTR -7 ---------- 1 DCD ----------+ +7 ---------- 1 DCD ----------+ 9 ---------- 8 CTS -----+ | 5 ---------- 5 GND | | | | diff --git a/docs/cables/powerware.txt b/docs/cables/powerware.txt index 1db1a77..3aa127b 100644 --- a/docs/cables/powerware.txt +++ b/docs/cables/powerware.txt @@ -1,8 +1,8 @@ Desc: Powerware 3115 factory cable File: powerware.txt -Date: 22 July 2005 +Date: 22 July 2005 Auth: various - + 1) Powerware 3115 factory cable From Peter Åstrand diff --git a/docs/cables/repotec.txt b/docs/cables/repotec.txt index 3d26a70..6df107a 100644 --- a/docs/cables/repotec.txt +++ b/docs/cables/repotec.txt @@ -2,7 +2,7 @@ Desc: Repotec 800A (800VA) & 162A (1600VA) cable File: repotec.txt Date: 11 April 2001 Auth: Theodor Milkov - + PC UPS @@ -11,9 +11,9 @@ PC UPS R 5.6k | 7 (RTS) >----+ - + 3 (Tx) >--------------- 6 - + 4 (DTR) <----+---------- 5 | R 5.6k diff --git a/docs/cables/sms.txt b/docs/cables/sms.txt index 54f3b81..6d7ab73 100644 --- a/docs/cables/sms.txt +++ b/docs/cables/sms.txt @@ -1,4 +1,4 @@ -Desc: SMS UPS cables, for Upsilon compatible SMS UPS +Desc: SMS UPS cables, for Upsilon compatible SMS UPS File: sms.txt Date: 9 October 2001 Auth: Marcio Gomes @@ -11,6 +11,6 @@ FEMEA DB9 MACHO DB9 4/8 ---------- 5 5 ---------- 8 -- This cable is working with Manager III 1300 VA and 650 VA, SMS UPS's -- Jump in computer side pins 4/8 and connect to pin 1 in UPS side +- This cable is working with Manager III 1300 VA and 650 VA, SMS Ups's +- Jump in computer side pins 4/8 and conect to pin 1 in UPS side - Use NUT blazer_ser driver diff --git a/docs/chunked.xsl b/docs/chunked.xsl deleted file mode 100644 index 7f09a80..0000000 --- a/docs/chunked.xsl +++ /dev/null @@ -1,17 +0,0 @@ - - - - - images/icons/ - images/icons/ - - diff --git a/docs/ci-farm-lxc-setup.txt b/docs/ci-farm-lxc-setup.txt deleted file mode 100644 index 0e7fa7f..0000000 --- a/docs/ci-farm-lxc-setup.txt +++ /dev/null @@ -1,693 +0,0 @@ -Setting up the multi-arch Linux LXC container farm for NUT CI -------------------------------------------------------------- - -Due to some historical reasons including earlier personal experience, -the Linux container setup implemented as described below was done with -persistent LXC containers wrapped by LIBVIRT for management. There was -no particular use-case for systems like Docker (and no firepower for a -Kubernetes cluster) in that the build environment intended for testing -non-regression against a certain release does not need to be regularly -updated -- its purpose is to be stale and represent what users still -running that system for whatever reason (e.g. embedded, IoT, corporate) -have in their environments. - -Common preparations -~~~~~~~~~~~~~~~~~~~ - -* Prepare LXC and LIBVIRT-LXC integration, including an "independent" - (aka "masqueraded) bridge for NAT, following https://wiki.debian.org/LXC - and https://wiki.debian.org/LXC/SimpleBridge -** For dnsmasq integration on the independent bridge (`lxcbr0` following - the documentation examples), be sure to mention: -*** `LXC_DHCP_CONFILE="/etc/lxc/dnsmasq.conf"` in `/etc/default/lxc-net` -*** `dhcp-hostsfile=/etc/lxc/dnsmasq-hosts.conf` in/as the content of - `/etc/lxc/dnsmasq.conf` -*** `touch /etc/lxc/dnsmasq-hosts.conf` which would list simple `name,IP` - pairs, one per line (so one per container) -*** `systemctl restart lxc-net` to apply config (is this needed after - setup of containers too, to apply new items before booting them?) - -* Install qemu with its `/usr/bin/qemu-*-static` and registration in - `/var/lib/binfmt` - -* Prepare an LVM partition (or preferably some other tech like ZFS) - as `/srv/libvirt` and create a `/srv/libvirt/rootfs` to hold the containers - -* Prepare `/home/abuild` on the host system (preferably in ZFS with - lightweight compression like lz4 -- and optionally, only if the amount - of available system RAM permits, with deduplication; otherwise avoid it); - account user and group ID numbers are `399` as on the rest of the CI farm - (historically, inherited from OBS workers) - -** It may help to generate an ssh key without a passphrase for `abuild` - that it would trust, to sub-login from CI agent sessions into the - container. Then again, it may be not required if CI logs into the - host by SSH using `authorized_keys` and an SSH Agent, and the inner - ssh client would forward that auth channel to the original agent. -+ ------- -abuild$ ssh-keygen -# accept defaults - -abuild$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys -abuild$ chmod 640 ~/.ssh/authorized_keys ------- - -* Edit the root (or whoever manages libvirt) `~/.profile` to default the - virsh provider with: -+ ------- -LIBVIRT_DEFAULT_URI=lxc:///system -export LIBVIRT_DEFAULT_URI ------- - -* If host root filesystem is small, relocate the LXC download cache to the - (larger) `/srv/libvirt` partition: -+ ------- -:; mkdir -p /srv/libvirt/cache-lxc -:; rm -rf /var/cache/lxc -:; ln -sfr /srv/libvirt/cache-lxc /var/cache/lxc ------- -** Maybe similarly relocate shared `/home/abuild` to reduce strain on rootfs? - - -Setup a container -~~~~~~~~~~~~~~~~~ - -Note that completeness of qemu CPU emulation varies, so not all distros -can be installed, e.g. "s390x" failed for both debian10 and debian11 to -set up the `openssh-server` package, or once even to run `/bin/true` (seems -to have installed an older release though, to match the outdated emulation?) - -While the `lxc-create` tool does not really specify the error cause and -deletes the directories after failure, it shows the pathname where it -writes the log (also deleted). Before re-trying the container creation, this -file can be watched with e.g. `tail -F /var/cache/lxc/.../debootstrap.log` - -[NOTE] -====== -You can find the list of LXC "template" definitions on your system -by looking at the contents of the `/usr/share/lxc/templates/` directory, -e.g. a script named `lxc-debian` for the "debian" template. You can see -further options for each "template" by invoking its help action, e.g.: ------- -:; lxc-create -t debian -h ------- -====== - -* Install containers like this: -+ ------- -:; lxc-create -P /srv/libvirt/rootfs \ - -n jenkins-debian11-mips64el -t debian -- \ - -r bullseye -a mips64el ------- -** to specify a particular mirror (not everyone hosts everything -- - so if you get something like - `"E: Invalid Release file, no entry for main/binary-mips/Packages"` - then see https://www.debian.org/mirror/list for details, and double-check - the chosen site to verify if the distro version of choice is hosted with - your arch of choice): -+ ------- -:; MIRROR="http://ftp.br.debian.org/debian/" \ - lxc-create -P /srv/libvirt/rootfs \ - -n jenkins-debian10-mips -t debian -- \ - -r buster -a mips ------- -** ...or for EOLed distros, use the archive, e.g.: -+ ------- -:; MIRROR="http://archive.debian.org/debian-archive/debian/" \ - lxc-create -P /srv/libvirt/rootfs \ - -n jenkins-debian8-s390x -t debian -- \ - -r jessie -a s390x ------- -** ...Alternatively, other distributions can be used (as supported by your - LXC scripts, typically in `/usr/share/debootstrap/scripts`), e.g. Ubuntu: -+ ------- -:; lxc-create -P /srv/libvirt/rootfs \ - -n jenkins-ubuntu1804-s390x -t ubuntu -- \ - -r bionic -a s390x ------- -** For distributions with a different packaging mechanism from that on the - LXC host system, you may need to install corresponding tools (e.g. `yum4`, - `rpm` and `dnf` on Debian hosts for installing CentOS and related guests). - You may also need to pepper with symlinks to taste (e.g. `yum => yum4`), - or find a `pacman` build to install Arch Linux or derivative, etc. - Otherwise, you risk seeing something like this: -+ ------- -root@debian:~# lxc-create -P /srv/libvirt/rootfs \ - -n jenkins-centos7-x86-64 -t centos -- \ - -R 7 -a x86_64 - -Host CPE ID from /etc/os-release: -'yum' command is missing -lxc-create: jenkins-centos7-x86-64: lxccontainer.c: - create_run_template: 1616 Failed to create container from template -lxc-create: jenkins-centos7-x86-64: tools/lxc_create.c: - main: 319 Failed to create container jenkins-centos7-x86-64 ------- -+ -Note also that with such "third-party" distributions you may face other - issues; for example, the CentOS helper did not generate some fields in - the `config` file that were needed for conversion into libvirt "domxml" - (as found by trial and error, and comparison to other `config` files): -+ ------- -lxc.uts.name = jenkins-centos7-x86-64 -lxc.arch = x86_64 ------- -+ -Also note the container/system naming without underscore in "x86_64" -- - the deployed system discards the character when assigning its hostname. - Using "amd64" is another reasonable choice here. - -* Add the "name,IP" line for this container to `/etc/lxc/dnsmasq-hosts.conf` - on the host, e.g.: -+ ------- -jenkins-debian11-mips,10.0.3.245 ------- -+ -NOTE: Don't forget to eventually `systemctl restart lxc-net` to apply the -new host reservation! - -* Convert a pure LXC container to be managed by LIBVIRT-LXC (and edit config - markup on the fly -- e.g. fix the LXC `dir:/` URL schema): -+ ------- -:; virsh -c lxc:///system domxml-from-native lxc-tools \ - /srv/libvirt/rootfs/jenkins-debian11-armhf/config \ - | sed -e 's,dir:/srv,/srv,' \ - > /tmp/x && virsh define /tmp/x ------- -+ -NOTE: You may want to tune the default generic 64MB RAM allocation, - so your launched QEMU containers are not OOM-killed as they exceeded - their memory `cgroup` limit. In practice they do not eat *that much* - resident memory, just want to have it addressable by VMM, I guess - (swap is not very used either), at least not until active builds - start (and then it depends on compiler appetite and `make` program - parallelism level you allow, e.g. by pre-exporting `MAXPARMAKES` - environment variable for `ci_build.sh`, and on the number of Jenkins - "executors" assigned to the build agent). -+ -** It may be needed to revert the generated "os/arch" to `x86_64` (and let - QEMU handle the rest) in the `/tmp/x` file, and re-try the definition: -+ ------- -:; virsh define /tmp/x ------- - -* Then execute `virsh edit jenkins-debian11-armhf` (and same for other - containers) to bind-mount the common `/home/abuild` location, adding - this tag to their "devices": -+ ------- - - - - ------- -** Note that generated XML might not conform to current LXC schema, so it - fails validation during save; this can be bypassed with `i` when it asks. - One such case was however with indeed invalid contents, the "dir:" schema - removed by example above. - - -Shepherd the herd -~~~~~~~~~~~~~~~~~ - -* Monitor deployed container rootfs'es with: -+ ------- -:; du -ks /srv/libvirt/rootfs/* ------- -+ -(should have non-trivial size for deployments without fatal infant errors) - -* Mass-edit/review libvirt configurations with: -+ ------- -:; virsh list --all | awk '{print $2}' \ - | grep jenkins | while read X ; do \ - virsh edit --skip-validate $X ; done ------- -** ...or avoid `--skip-validate` when markup is initially good :) - -* Mass-define network interfaces: -+ ------- -:; virsh list --all | awk '{print $2}' \ - | grep jenkins | while read X ; do \ - virsh dumpxml "$X" | grep "bridge='lxcbr0'" \ - || virsh attach-interface --domain "$X" --config \ - --type bridge --source lxcbr0 ; \ - done ------- - -* Verify that unique MAC addresses were defined (e.g. `00:16:3e:00:00:01` - tends to pop up often, while `52:54:00:xx:xx:xx` are assigned to other - containers); edit the domain definitions to randomize, if needed: -+ ------- -:; grep 'mac add' /etc/libvirt/lxc/*.xml | awk '{print $NF" "$1}' | sort ------- - -* Make sure at least one console device exists (end of file, under the - network interface definition tags), e.g.: -+ ------- - - - ------- - -* Populate with `abuild` account, as well as with the `bash` shell and - `sudo` ability, reporting of assigned IP addresses on the console, - and SSH server access complete with envvar passing from CI clients - by virtue of `ssh -o SendEnv='*' container-name`: -+ ------- -:; for ALTROOT in /srv/libvirt/rootfs/*/rootfs/ ; do \ - echo "=== $ALTROOT :" >&2; \ - grep eth0 "$ALTROOT/etc/issue" || ( printf '%s %s\n' \ - '\S{NAME} \S{VERSION_ID} \n \l@\b ;' \ - 'Current IP(s): \4{eth0} \4{eth1} \4{eth2} \4{eth3}' \ - >> "$ALTROOT/etc/issue" ) ; \ - grep eth0 "$ALTROOT/etc/issue.net" || ( printf '%s %s\n' \ - '\S{NAME} \S{VERSION_ID} \n \l@\b ;' \ - 'Current IP(s): \4{eth0} \4{eth1} \4{eth2} \4{eth3}' \ - >> "$ALTROOT/etc/issue.net" ) ; \ - groupadd -R "$ALTROOT" -g 399 abuild ; \ - useradd -R "$ALTROOT" -u 399 -g abuild -M -N -s /bin/bash abuild \ - || useradd -R "$ALTROOT" -u 399 -g 399 -M -N -s /bin/bash abuild \ - || { if ! grep -w abuild "$ALTROOT/etc/passwd" ; then \ - echo 'abuild:x:399:399::/home/abuild:/bin/bash' \ - >> "$ALTROOT/etc/passwd" ; \ - echo "USERADDed manually: passwd" >&2 ; \ - fi ; \ - if ! grep -w abuild "$ALTROOT/etc/shadow" ; then \ - echo 'abuild:!:18889:0:99999:7:::' >> "$ALTROOT/etc/shadow" ; \ - echo "USERADDed manually: shadow" >&2 ; \ - fi ; \ - } ; \ - if [ -s "$ALTROOT/etc/ssh/sshd_config" ]; then \ - grep 'AcceptEnv \*' "$ALTROOT/etc/ssh/sshd_config" || ( \ - ( echo "" ; \ - echo "# For CI: Allow passing any envvars:"; \ - echo 'AcceptEnv *' ) \ - >> "$ALTROOT/etc/ssh/sshd_config" \ - ) ; \ - fi ; \ - done ------- -+ -Note that for some reason, in some of those other-arch distros `useradd` -fails to find the group anyway; then we have to "manually" add them. - -* Let the host know and resolve the names/IPs of containers you assigned: -+ ------- -:; grep -v '#' /etc/lxc/dnsmasq-hosts.conf \ - | while IFS=, read N I ; do \ - getent hosts "$N" >&2 || echo "$I $N" ; \ - done >> /etc/hosts ------- - -Further setup of the containers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -See NUT `docs/config-prereqs.txt` about dependency package installation -for Debian-based Linux systems. - -It may be wise to not install e.g. documentation generation tools (or at -least not the full set for HTML/PDF generation) in each environment, in -order to conserve space and run-time stress. - -Still, if there are significant version outliers (such as using an older -distribution due to vCPU requirements), it can be installed fully just -to ensure non-regression -- e.g. that when adapting `Makefile` rule -definitions or compiler arguments to modern toolkits, we do not lose -the ability to build with older ones. - -For this, `chroot` from the host system can be used, e.g. to improve the -interactive usability for a population of Debian(-compatible) containers -(and to use its networking, while the operating environment in containers -may be not yet configured or still struggling to access the Internet): ------- -:; for ALTROOT in /srv/libvirt/rootfs/*/rootfs/ ; do \ - echo "=== $ALTROOT :" ; \ - chroot "$ALTROOT" apt-get install \ - sudo bash vim mc p7zip p7zip-full pigz pbzip2 git \ - ; done ------- - -Similarly for `yum`-managed systems (CentOS and relatives), though specific -package names can differ, and additional package repositories may need to -be enabled first (see link:config-prereqs.txt[config-prereqs.txt] for more -details such as recommended package names). - -Note that technically `(sudo) chroot ...` can also be used from the CI worker -account on the host system to build in the prepared filesystems without the -overhead of running containers as complete operating environments with any -standard services and several copies of Jenkins `agent.jar` in them. - -Also note that externally-driven set-up of some packages, including the -`ca-certificates` and the JDK/JRE, require that the `/proc` filesystem -is usable in the chroot environment. This can be achieved with e.g.: ------- -:; for ALTROOT in /srv/libvirt/rootfs/*/rootfs/ ; do \ - for D in proc ; do \ - echo "=== $ALTROOT/$D :" ; \ - mkdir -p "$ALTROOT/$D" ; \ - mount -o bind,rw "/$D" "$ALTROOT/$D" ; \ - done ; \ - done ------- - -TODO: Test and document a working NAT and firewall setup for this, to allow -SSH access to the containers via dedicated TCP ports exposed on the host. - - -Troubleshooting -~~~~~~~~~~~~~~~ - -* Q: Container won't start, its `virsh console` says something like: -+ ------- -Failed to create symlink /sys/fs/cgroup/net_cls: Operation not permitted ------- -A: According to https://bugzilla.redhat.com/show_bug.cgi?id=1770763 - (skip to the end for summary) this can happen when a newer Linux - host system with `cgroupsv2` capabilities runs an older guest distro - which only knows about `cgroupsv1`, such as when hosting a CentOS 7 - container on a Debian 11 server. -** One workaround is to ensure that the guest `systemd` does not try to - "join" host facilities, by setting an explicit empty list for that: -+ ------- -:; echo 'JoinControllers=' >> "$ALTROOT/etc/systemd/system.conf" ------- -** Another approach is to upgrade `systemd` related packages in the guest - container. This may require additional "backport" repositories or - similar means, possibly maintained not by distribution itself but by - other community members, and arguably would logically compromise the - idea of non-regression builds in the old environment "as is". - -* Q: Server was set up with ZFS as recommended, and lots of I/O hit the - disk even when application writes are negligible -+ -A: This was seen on some servers and generally derives from data layout - and how ZFS maintains the tree structure of blocks. A small application - write (such as a new log line) means a new empty data block allocation, - an old block release, and bubble up through the whole metadata tree to - complete the transaction (grouped as TXG to flush to disk). -+ -** One solution is to use discardable build workspaces in RAM-backed - storage like `/dev/shm` (`tmpfs`) on Linux, or `/tmp` (`swap`) on - illumos hosting systems, and only use persistent storage for the home - directory with `.ccache` and `.gitcache-dynamatrix` directories. -** Another solution is to reduce the frequency of TXG sync from modern - default of 5 sec to conservative 30-60 sec. Check how to set the - `zfs_txg_timeout` on your platform. - - -Connecting Jenkins to the containers ------------------------------------- - -To properly cooperate with the -https://github.com/networkupstools/jenkins-dynamatrix[jenkins-dynamatrix] -project driving regular NUT CI builds, each build environment should be -exposed as an individual agent with labels describing its capabilities. - -Agent Labels -~~~~~~~~~~~~ - -With the `jenkins-dynamatrix`, agent labels are used to calculate a large -"slow build" matrix to cover numerous scenarios for what can be tested -with the current population of the CI farm, across operating systems, -`make`, shell and compiler implementations and versions, and C/C++ language -revisions, to name a few common "axes" involved. - -Labels for QEMU -^^^^^^^^^^^^^^^ - -Emulated-CPU container builds are CPU-intensive, so for them we define as -few capabilities as possible: here CI is more interested in checking how -binaries behave on those CPUs, *not* in checking the quality of recipes -(distcheck, Make implementations, etc.), shell scripts or documentation, -which is more efficient to test on native platforms. - -Still, we are interested in results from different compiler suites, so -specify at least one version of each. - -NOTE: Currently the NUT `Jenkinsfile-dynamatrix` only looks at various -`COMPILER` variants for `qemu-nut-builder` use-cases, disregarding the -versions and just using one that the environment defaults to. - -The reduced set of labels for QEMU workers looks like: - ------- -qemu-nut-builder qemu-nut-builder:alldrv -NUT_BUILD_CAPS=drivers:all NUT_BUILD_CAPS=cppunit -OS_FAMILY=linux OS_DISTRO=debian11 GCCVER=10 CLANGVER=11 -COMPILER=GCC COMPILER=CLANG -ARCH64=ppc64le ARCH_BITS=64 ------- - -Labels for native builds -^^^^^^^^^^^^^^^^^^^^^^^^ - -For contrast, a "real" build agent's set of labels, depending on -presence or known lack of some capabilities, looks something like this: ------- -doc-builder nut-builder nut-builder:alldrv -NUT_BUILD_CAPS=docs:man NUT_BUILD_CAPS=docs:all -NUT_BUILD_CAPS=drivers:all NUT_BUILD_CAPS=cppunit=no -OS_FAMILY=bsd OS_DISTRO=freebsd12 GCCVER=10 CLANGVER=10 -COMPILER=GCC COMPILER=CLANG -ARCH64=amd64 ARCH_BITS=64 -SHELL_PROGS=sh SHELL_PROGS=dash SHELL_PROGS=zsh SHELL_PROGS=bash -SHELL_PROGS=csh SHELL_PROGS=tcsh SHELL_PROGS=busybox -MAKE=make MAKE=gmake -PYTHON=python2.7 PYTHON=python3.8 ------- - -Generic agent attributes -~~~~~~~~~~~~~~~~~~~~~~~~ - -* Name: e.g. `ci-debian-altroot--jenkins-debian10-arm64` (note the - pattern for "Conflicts With" detailed below) - -* Remote root directory: preferably unique per agent, to avoid surprises; - e.g.: `/home/abuild/jenkins-nut-altroots/jenkins-debian10-armel` -** Note it may help that the system home directory itself is shared between - co-located containers, so that the `.ccache` or `.gitcache-dynamatrix` - are available to all builders with identical contents -** If RAM permits, the Jenkins Agent working directory may be placed in - a temporary filesystem not backed by disk (e.g. `/dev/shm` on modern - Linux distributions); roughly estimate 300Mb per executor for NUT builds. - -* Usage: "Only build jobs with label expressions matching this node" - -* Node properties / Environment variables: - -** `PATH+LOCAL` => `/usr/lib/ccache` - -Where to run agent.jar -~~~~~~~~~~~~~~~~~~~~~~ - -Depending on circumstances of the container, there are several options -available to the NUT CI farm: - -* Java can run in the container, efficiently (native CPU, different distro) - => the container may be exposed as a standalone host for direct SSH access - (usually by NAT, exposing SSH on a dedicated port of the host; or by first - connecting the Jenkins controller with the host as an SSH Build Agent, and - then calling SSH to the container as a prefix for running the agent; or - by using Jenkins Swarm agents), so ultimately the build `agent.jar` JVM - would run in the container. - Filesystem for the `abuild` account may be or not be shared with the host. - -* Java can not run in the container (crashes on emulated CPU, or is too old - in the agent container's distro -- currently Jenkins requires JRE 8+, but - eventually will require 11+) => the agent would run on the host, and then - the host would `ssh` or `chroot` (networking not required, but bind-mount - of `/home/abuild` and maybe other paths from host would be needed) called - for executing `sh` steps in the container environment. Either way, home - directory of the `abuild` account is maintained on the host and shared with - the guest environment, user and group IDs should match. - -* Java is inefficient in the container (operations like un-stashing the source - succeed but take minutes instead of seconds) => either of the above - -Using Jenkins SSH Build Agents -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This is a typical use-case for tightly integrated build farms under common -management, where the Jenkins controller can log by SSH into systems which -act as its build agents. It injects and launches the `agent.jar` to execute -child processes for the builds, and maintains a tunnel to communicate. - -Methods below involving SSH assume that you have configured a password-less -key authentication from the host machine to the `abuild` account in each -guest build environment container. -This can be an `ssh-keygen` result posted into `authorized_keys`, or a -trusted key passed by a chain of ssh agents from a Jenkins Credential -for connection to the container-hoster into the container. -The private SSH key involved may be secured by a pass-phrase, as long as -your Jenkins Credential storage knows it too. -Note that for the approaches explored below, the containers are not -directly exposed for log-in from any external network. - -* For passing the agent through an SSH connection from host to container, - so that the `agent.jar` runs inside the container environment, configure: - -** Launch method: "Agents via SSH" - -** Host, Credentials, Port: as suitable for accessing the container-hoster -+ -NOTE: The container-hoster should have accessed the guest container from - the account used for intermediate access, e.g. `abuild`, so that its - `.ssh/known_hosts` file would trust the SSH server on the container. - -** Prefix Start Agent Command: content depends on the container name, - but generally looks like the example below to report some info about - the final target platform (and make sure `java` is usable) in the - agent's log. Note that it ends with un-closed quote and a space char: -+ ------- -ssh jenkins-debian10-amd64 '( java -version & uname -a ; getconf LONG_BIT; getconf WORD_BIT; wait ) && ------- - -** Suffix Start Agent Command: a single quote to close the text opened above: ------- -' ------- - - -* The other option is to run the `agent.jar` on the host, for all the - network and filesystem magic the agent does, and only execute shell - steps in the container. The solution relies on overridden `sh` step - implementation in the `jenkins-dynamatrix` shared library that uses a - magic `CI_WRAP_SH` environment variable to execute a pipe into the - container. Such pipes can be `ssh` or `chroot` with appropriate host - setup described above. -+ -NOTE: In case of ssh piping, remember that the container's - `/etc/ssh/sshd_config` should `AcceptEnv *` and the SSH - server should be restarted after such configuration change. - -** Launch method: "Agents via SSH" - -** Host, Credentials, Port: as suitable for accessing the container-hoster - -** Prefix Start Agent Command: content depends on the container name, - but generally looks like the example below to report some info about - the final target platform (and make sure it is accessible) in the - agent's log. Note that it ends with a space char, and that the command - here should not normally print anything into stderr/stdout (this tends - to confuse the Jenkins Remoting protocol): -+ ------- -echo PING > /dev/tcp/jenkins-debian11-ppc64el/22 && ------- - -** Suffix Start Agent Command: empty - -* Node properties / Environment variables: - -** `CI_WRAP_SH` => -+ ------- -ssh -o SendEnv='*' "jenkins-debian11-ppc64el" /bin/sh -xe ------- - -Using Jenkins Swarm Agents -^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This approach allows remote systems to participate in the NUT CI farm by -dialing in and so defining an agent. A single contributing system may be -running a number of containers or virtual machines set up following the -instructions above, and each of those would be a separate build agent. - -Such systems should be "dedicated" to contribution in the sense that -they should be up and connected for days, and sometimes tasks would land. - -Configuration files maintained on the Swarm Agent system dictate which -labels or how many executors it would expose, etc. Credentials to access -the NUT CI farm Jenkins controller to register as an agent should be -arranged with the farm maintainers, and currently involve a GitHub account -with Jenkins role assignment for such access, and a token for authentication. - -The https://github.com/networkupstools/jenkins-swarm-nutci[jenkins-swarm-nutci] -repository contains example code from such setup with a back-up server -experiment for the NUT CI farm, including auto-start method scripts for -Linux systemd and upstart, illumos SMF, and OpenBSD rcctl. - -Sequentializing the stress -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Running one agent at a time -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -Another aspect of farm management is that emulation is a slow and intensive -operation, so we can not run all agents and execute builds at the same time. - -The current solution relies on -https://github.com/jimklimov/conflict-aware-ondemand-retention-strategy-plugin -to allow co-located build agents to "conflict" with each other -- when one -picks up a job from the queue, it blocks neighbors from starting; when it -is done, another may start. - -Containers can be configured with "Availability => On demand", with shorter -cycle to switch over faster (the core code sleeps a minute between attempts): - -* In demand delay: `0`; - -* Idle delay: `0` (Jenkins may change it to `1`); - -* Conflicts with: `^ci-debian-altroot--.*$` assuming that is the pattern - for agent definitions in Jenkins -- not necessarily linked to hostnames. - -Also, the "executors" count should be reduced to the amount of compilers -in that system (usually 2) and so avoid extra stress of scheduling too many -emulated-CPU builds at once. - -Sequentializing the git cache access -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -As part of the `jenkins-dynamatrix` optional optimizations, the NUT CI -recipe invoked via `Jenkinsfile-dynamatrix` maintains persistent git -reference repositories that can be used to cache NUT codebase (including -the tested commits) and so considerably speed up workspace preparation -when running numerous build scenarios on the same agent. - -Such `.gitcache-dynamatrix` cache directories are located in the build -workspace location (unique for each agent), but on a system with numerous -containers these names can be symlinks pointing to a shared location. - -To avoid collisions with several executors updating the same cache with -new commits, critical access windows are sequentialized with the use of -https://github.com/jenkinsci/lockable-resources-plugin[Lockable Resources -plugin]. On the `jenkins-dynamatrix` side this is facilitated by labels: ------- -DYNAMATRIX_UNSTASH_PREFERENCE=scm-ws:nut-ci-src -DYNAMATRIX_REFREPO_WORKSPACE_LOCKNAME=gitcache-dynamatrix:SHARED_HYPERVISOR_NAME ------- - -* The `DYNAMATRIX_UNSTASH_PREFERENCE` tells the `jenkins-dynamatrix` library - code which checkout/unstash strategy to use on a particular build agent - (following values defined in the library; `scm-ws` means SCM caching - under the agent workspace location, `nut-ci-src` names the cache for - this project); -* The `DYNAMATRIX_REFREPO_WORKSPACE_LOCKNAME` specifies a semi-unique - string: it should be same for all co-located agents which use the same - shared cache location, e.g. guests on the same hypervisor; and it should - be different for unrelated cache locations, e.g. different hypervisors - and stand-alone machines. diff --git a/docs/common.xsl b/docs/common.xsl deleted file mode 100644 index eed9099..0000000 --- a/docs/common.xsl +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - 1 - 0 - - - - - - -images/icons/ -0 - - - - 0 - #E0E0E0 - - - -images/icons/ - - - margin-left: 0; margin-right: 10%; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -article toc,title -book toc,title,figure,table,example,equation - - -chapter toc,title -part toc,title -preface toc,title -qandadiv toc -qandaset toc -reference toc,title -sect1 toc -sect2 toc -sect3 toc -sect4 toc -sect5 toc -section toc -set toc,title - - - -article nop -book nop - - - - - - - - - - - - - - - - - - - - diff --git a/docs/config-notes.txt b/docs/config-notes.txt index a87ae50..31a12fd 100644 --- a/docs/config-notes.txt +++ b/docs/config-notes.txt @@ -13,8 +13,8 @@ NOTE: NUT does not currently provide proper graphical configuration tools. However, there is now support for linkdoc:developer-guide[Augeas,augeas_user], which will enable the easier creation of configuration tools. Moreover, linkman:nut-scanner[8] is available to discover supported devices -(USB, SNMP, Eaton XML/HTTP and IPMI) and NUT servers (using Avahi or the -classic connection method). +(USB, SNMP, Eaton XML/HTTP and IPMI) and NUT servers (using Avahi or the classic +connection method). Details about the configuration files ------------------------------------- @@ -30,7 +30,7 @@ configuration directive. This may be something like MONITOR, NOTIFYCMD, or ACCESS. The case does matter here. "monitor" won't be recognized. Next, the parser does not care about whitespace between words. If you -like to indent things with tabs or spaces, feel free to do it here. +like to indent things with tabs or spaces, feel free to do it here. If you need to set a value to something containing spaces, it has to be contained within "quotes" to keep the parser from splitting up the line. @@ -45,46 +45,46 @@ configuration directive for some reason. You can do that too. NOTIFYCMD "/bin/notifyme -foo -bar \"hi there\" -baz" -In other words, `\` can be used to escape the `"`. +In other words, *\* can be used to escape the *"*. -Finally, for the situation where you need to put the `\` character into your +Finally, for the situation where you need to put the *\* character into your string, you just escape it. NOTIFYCMD "/bin/notifyme c:\\dos\\style\\path" -The `\` can actually be used to escape any character, but you only really -need it for `\`, `"`, and `#` as they have special meanings to the parser. +The *\* can actually be used to escape any character, but you only really +need it for *\*, *"*, and *#* as they have special meanings to the parser. When using file names with space characters, you may end up having tricky -things since you need to write them inside `""` which must be escaped: +things since you need to write them inside *""* which must be escaped: NOTIFYCMD "\"c:\\path with space\\notifyme\" \"c:\\path with space\\name\"" -`#` is the comment character. Anything after an unescaped `#` is ignored. +*#* is the comment character. Anything after an unescaped *#* is ignored. Something like this... identity = my#1ups -will actually turn into `identity = my`, since the `#` stops the -parsing. If you really need to have a `#` in your configuration, then +... will actually turn into "identity = my", since the *#* stops the +parsing. If you really need to have a *#* in your configuration, then escape it. identity = my\#1ups Much better. -The `=` character should be used with care too. There should be only one -"simple" `=` character in a line: between the parameter name and its value. -All other `=` characters should be either escaped or within "quotes". +The *=* character should be used with care too. There should be only one +"simple" *=* character in a line: between the parameter name and its value. +All other *=* characters should be either escaped or whithin "quotes". password = 123=123 -is incorrect. You should use: + ... is incorrect. You should use: password = 123\=123 -or: + ... or : password = "123=123" @@ -95,7 +95,7 @@ You can put a backslash at the end of the line to join it to the next one. This creates one virtual line that is composed of more than one physical line. -Also, if you leave the `""` quote container open before a newline, it will +Also, if you leave the *""* quote container open before a newline, it will keep scanning until it reaches another one. If you see bizarre behavior in your configuration files, check for an unintentional instance of quotes spanning multiple lines. @@ -104,7 +104,7 @@ quotes spanning multiple lines. Basic configuration ------------------- -This chapter describes the base configuration to establish communication with +This chapter describe the base configuration to establish communication with the device. This will be sufficient for PDU. But for UPS and SCD, you will also need to @@ -112,35 +112,21 @@ configure <>. image:images/simple.png[] -On operating systems with service management frameworks (such as Linux -systemd and Solaris/illumos SMF), the life-cycle of driver, data server -and monitoring client daemons is managed respectively by `nut-driver` -(multi-instance service), `nut-server` and `nut-monitor` services. -These are in turn wrapped by an "umbrella" service (or systemd "target") -conveniently called `nut` which allows to easily start or stop all those -of the bundled services, which are enabled on a particular deployment. - [[Driver_configuration]] Driver configuration ~~~~~~~~~~~~~~~~~~~~ -Create one section per UPS in 'ups.conf' +Create one section per UPS in /usr/local/ups/etc/ups.conf -NOTE: The default path for a source installation is `/usr/local/ups/etc`, -while packaged installation will vary. -For example, `/etc/nut` is used on Debian and derivatives, -while `/etc/ups` or `/etc/upsd` is used on RedHat and derivatives. - -To find out which driver to use, check the -<>, -or `data/driver.list(.in)` source file. +To find out which driver to use, check the <>, +or data/driver.list. Once you have picked a driver, create a section for your UPS in -'ups.conf'. You must supply values at least for "driver" and "port". +ups.conf. You must supply values for "driver" and "port". Some drivers may require other flags or settings. The "desc" value is optional, but is recommended to provide a better description of -what useful load your UPS is feeding. +what your UPS is supporting. A typical device without any extra settings looks like this: @@ -149,29 +135,19 @@ A typical device without any extra settings looks like this: port = /dev/ttyS1 desc = "Workstation" -[NOTE] -====== -USB drivers (such as `usbhid-ups` for non-SHUT mode, `nutdrv_qx` for -non-serial mode, `bcmxcp_usb`, `tripplite_usb`, `blazer_usb`, `riello_usb` -and `richcomm_usb`) are special cases and ignore the 'port' value. - +NOTE: USB drivers (usbhid-ups, bcmxcp_usb, tripplite_usb, blazer_usb and +richcomm_usb) are special cases and ignore the 'port' value. You must still set this value, but it does not matter what you set -it to; a common and good practice is to set 'port' to *auto*, but you -can put whatever you like. - -If you only own one USB UPS, the driver will find it automatically. - -If you own more than one, refer to the driver's manual page for more -information on matching a specific device. -====== +it to; a common and good practice is to set 'port' to *auto*, but you can +put whatever you like. If you only own one UBS UPS, the driver will +find it automatically. If you own more than one, refer to the driver's +manual page for more information on matching a specific device. References: linkman:ups.conf[5], linkman:nutupsdrv[8], linkman:bcmxcp_usb[8], linkman:blazer[8], -linkman:nutdrv_qx[8], linkman:richcomm_usb[8], -linkman:riello_usb[8], linkman:tripplite_usb[8], linkman:usbhid-ups[8] @@ -180,17 +156,16 @@ linkman:usbhid-ups[8] Starting the driver(s) ~~~~~~~~~~~~~~~~~~~~~~ -Generally, you can just start the driver(s) for your hardware (all sections -defined in 'ups.conf') using the following command: +Start the driver(s) for your hardware: - upsdrvctl start + /usr/local/ups/bin/upsdrvctl start Make sure the driver doesn't report any errors. It should show a few details about the hardware and then enter the background. You should get back to the command prompt a few seconds later. For reference, a successful start of the `usbhid-ups` driver looks like this: - # upsdrvctl start + # /usr/local/ups/bin/upsdrvctl start Network UPS Tools - Generic HID driver 0.34 (2.4.1) USB communication driver 0.31 Using subdriver: MGE HID 1.12 @@ -198,96 +173,29 @@ reference, a successful start of the `usbhid-ups` driver looks like this: If the driver doesn't start cleanly, make sure you have picked the right one for your hardware. You might need to try other drivers -by changing the "driver=" value in 'ups.conf'. +by changing the "driver=" value in ups.conf. Be sure to check the driver's man page to see if it needs any extra -settings in 'ups.conf' to detect your hardware. +settings in ups.conf to detect your hardware. -If it says `can't bind /var/state/ups/...` or similar, then your +If it says "can't bind /var/state/ups/..." or similar, then your state path probably isn't writable by the driver. Check the -<> vs. the -user account your driver starts as. +<>. -After making changes, try the <> -step again. +After making changes, try the <> step again. -Driver(s) as a service -~~~~~~~~~~~~~~~~~~~~~~ - -On operating systems with init-scripts managing life-cycle of the operating -environment, the `upsdrvctl` program is also commonly used in those scripts. -It has a few downsides, such as that if the device was not accessible during -OS startup and the driver connection timed out, it would remain not-started -until an administrator (or some other script) "kicks" the driver to retry -startup. Also, startup of the `upsd` data server daemon and its clients -like `upsmon` is delayed until all the NUT drivers complete their startup -(or time out trying). - -This can be a big issue on systems which monitor multiple devices, such as -big servers with multiple power sources, or administrative workstations -which monitor a datacenter full of UPSes. - -For this reason, NUT starting with version 2.8.0 supports startup of its -drivers as independent instances of a `nut-driver` service under the Linux -systemd and Solaris/illumos SMF service-management frameworks (corresponding -files and scripts may be not pre-installed in packaging for other systems). - -Such service instances have their own and independent life-cycle, including -parallel driver start and stop processing, and retries of startup in case of -failure as implemented by the service framework in the OS. The Linux systemd -solution also includes a `nut-driver.target` as a checkpoint that all defined -drivers have indeed started up (as well as being a singular way to enable or -disable startup of drivers). - -In both cases, a service named `nut-driver-enumerator` is registered, and -when it is (re-)started it scans the currently defined device sections in -'ups.conf' and the currently defined instances of `nut-driver` service, -and brings them in sync (adding or removing service instances), and if -there were changes -- it restarts the corresponding drivers (via service -instances) as well as the data server which only reads the list of sections -at its startup. This helper service should be triggered whenever your system -(re-)starts the `nut-server` service, so that it runs against an up-to-date -list of NUT driver processes. - -A service-oriented solution also allows to consider that different drivers -have different dependencies -- such as that networked drivers should begin -startup after IP addresses have been assigned, while directly-connected -devices might need nothing beside a mounted filesystem (or an activated -USB stack service or device rule, in case of Linux). Likewise, systems -administrators can define further local dependencies between services and -their instances as needed on particular deployments. - -This solution also adds the `upsdrvsvcctl` script to manage NUT drivers as -system service instances, whose CLI mimics that of `upsdrvctl` program. -One addition is the `resync` argument to trigger `nut-driver-enumerator`, -another is a `list` argument to display current mappings of service -instances to NUT driver sections. Also, original tool's arguments such -as the `-u` (user to run the driver as) or `-D` (debug of the driver) -do not make sense in the service context -- the accounts to use and -other arguments to the driver process are part of service setup (and -an administrator can manage it there). - -Note that while this solution tries to register service instances with same -names as NUT configuration sections for the devices, this can not always be -possible due to constraints such as syntax supported by a particular service -management framework. In this case, the enumerator falls back to MD5 hashes -of such section names, and the `upsdrvsvcctl` script supports this to map -the user-friendly NUT configuration section names to actual service names -that it would manage. - -References: man pages: linkman:nutupsdrv[8], linkman:upsdrvctl[8], -linkman:upsdrvsvcctl[8] +References: man pages: linkman:nutupsdrv[8], linkman:upsdrvctl[8] Data server configuration (upsd) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Configure `upsd`, which serves data from the drivers to the clients. +Configure upsd, which serves data from the drivers to the clients. -First, edit 'upsd.conf' to allow access to your client systems. By -default, `upsd` will only listen to `localhost` port 3493/tcp. If you want +First, edit upsd.conf to allow access to your client systems. By +default, upsd will only listen to localhost port 3493/tcp. If you want to connect to it from other machines, you must specify each interface you -want `upsd` to listen on for connections, optionally with a port number. +want upsd to listen on for connections, optionally with a port number. LISTEN 127.0.0.1 3493 LISTEN ::1 3493 @@ -295,15 +203,15 @@ want `upsd` to listen on for connections, optionally with a port number. NOTE: Refer to the NUT user manual <> for information on how to access and secure upsd clients connections. -Next, create 'upsd.users'. For now, this can be an empty file. -You can come back and add more to it later when it's time to -configure `upsmon` or run one of the management tools. +Next, create upsd.users. For now, this can be an empty file. +You can come back and add more to it later when it's time to +configure upsmon or run one of the management tools. Do not make either file world-readable, since they both hold access control data and passwords. They just need to be readable by the user you created in the preparation process. -The suggested configuration is to `chown` it to `root`, `chgrp` it to the +The suggested configuration is to chown it to root, chgrp it to the group you created, then make it readable by the group. chown root:nut upsd.conf upsd.users @@ -319,36 +227,26 @@ Starting the data server Start the network data server: - upsd + /usr/local/ups/sbin/upsd Make sure it is able to connect to the driver(s) on your system. A successful run looks like this: - # upsd + # /usr/local/ups/sbin/upsd Network UPS Tools upsd 2.4.1 listening on 127.0.0.1 port 3493 listening on ::1 port 3493 Connected to UPS [eaton]: usbhid-ups-eaton -`upsd` prints dots while it waits for the driver to respond. Your +upsd prints dots while it waits for the driver to respond. Your system may print more or less depending on how many drivers you have and how fast they are. -NOTE: If `upsd` says that it can't connect to a UPS or that the data -is stale, then your 'ups.conf' is not configured correctly, or you +NOTE: if upsd says that it can't connect to a UPS or that the data +is stale, then your ups.conf is not configured correctly, or you have a driver that isn't working properly. You must fix this before going on to the next step. -NOTE: Normally `upsd` requires that at least one driver section is -defined in the 'ups.conf' file, and refuses to start otherwise. -If you intentionally do not have any driver sections defined (yet) -but still want the data server to run, respond and report zero devices -(e.g. on an automatically managed monitoring deployment), you can enable -the `ALLOW_NO_DEVICE true` option in the 'upsd.conf' file. - -On operating systems with service management frameworks, the data server -life-cycle is managed by `nut-server` service. - Reference: man page: linkman:upsd[8] Check the UPS data @@ -358,18 +256,17 @@ Status data ^^^^^^^^^^^ Make sure that the UPS is providing good status data. -You can use the `upsc` command-line client for this: - upsc myupsname@localhost ups.status + /usr/local/ups/bin/upsc myupsname@localhost ups.status You should see just one line in response: OL -`OL` means your system is running on line power. If it says something -else (like `OB` -- on battery, or `LB` -- low battery), your driver was +OL means your system is running on line power. If it says something +else (like OB - on battery, or LB - low battery), your driver was probably misconfigured during the <> -step. If you reconfigure the driver, use `upsdrvctl stop` to stop it, then +step. If you reconfigure the driver, use 'upsdrvctl stop' to stop it, then start it again as shown in the <> step. Reference: man page: linkman:upsc[8] @@ -380,11 +277,11 @@ All data Look at all of the status data which is being monitored. - upsc myupsname@localhost + /usr/local/ups/bin/upsc myupsname@localhost What happens now depends on the kind of device and driver you have. -In the list, you should see `ups.status` with the same value you got -above. A sample run on an UPS (Eaton Ellipse MAX 1100) looks like this: +In the list, you should see ups.status with the same value you got +above. A sample run on a UPS (Eaton Ellipse MAX 1100) looks like this: battery.charge: 100 battery.charge.low: 20 @@ -438,17 +335,10 @@ Reference: man page: linkman:upsc[8], Startup scripts ~~~~~~~~~~~~~~~ -NOTE: This step is not necessary if you installed from packages. - -Edit your startup scripts, and make sure `upsdrvctl` and `upsd` are run -every time your system starts. In newer versions of NUT, you may have a -'nut.conf' file which sets the `MODE` variable for bundled init-scripts, -to facilitate enabling of certain features in the specific end-user -deployments. - -If you installed from source, check the `scripts` directory for reference -init-scripts, as well as systemd or SMF service methods and manifests. +NOTE: This step is not need if you installed from packages. +Edit your startup scripts, and make sure upsdrvctl and upsd are run every time +your system starts. [[UPS_shutdown]] Configuring automatic shutdowns for low battery events @@ -457,7 +347,7 @@ Configuring automatic shutdowns for low battery events The whole point of UPS software is to bring down the OS cleanly when you run out of battery power. Everything else is roughly eye candy. -To make sure your system shuts down properly, you will need to perform some +To make sure your system shuts down properly, you will need to perform some additional configuration and run upsmon. Here are the basics. [[Shutdown_design]] @@ -466,95 +356,59 @@ Shutdown design When your UPS batteries get low, the operating system needs to be brought down cleanly. Also, the UPS load should be turned off so that all devices -that are attached to it are forcibly rebooted, and subsequently start in -the predictable order and state suitable for your data center. +that are attached to it are forcibly rebooted. -Here are the steps that occur when a critical power event happens, -for the simpler case of one UPS device feeding one or several systems: +Here are the steps that occur when a critical power event happens: 1. The UPS goes on battery -2. The UPS reaches low battery (a "critical" UPS), that is to say, - `upsc` displays: +2. The UPS reaches low battery (a "critical" UPS), that is to say + upsc displays: + ups.status: OB LB + -The exact behavior depends on the specific device, and is related to -such settings and readings as: +The exact behavior depends on the specific device, and is related to: - - `battery.charge` and `battery.charge.low` - - `battery.runtime` and `battery.runtime.low` + - battery.charge and battery.charge.low + - battery.runtime and battery.runtime.low -3. The `upsmon` primary notices the "critical UPS" situation and sets - "FSD" -- the "forced shutdown" flag to tell all secondary systems - that it will soon power down the load. +3. The upsmon master notices and sets "FSD" - the "forced shutdown" + flag to tell all slave systems that it will soon power down the load. + -[WARNING] -========= -By design, since we require power-cycling the load and don't -want some systems to be powered off while others remain running -if the "wall power" returns at the wrong moment as usual, the "FSD" -flag can not be removed from the data server unless its daemon is -restarted. If we do take the first step in critical mode, then we -intend to go all the way -- shut down all the servers gracefully, -and power down the UPS. +(If you have no slaves, skip to step 6) -Keep in mind that some UPS devices and corresponding drivers would -latch the "FSD" again even if "wall power" is available, but the -remaining battery charge is below a threshold configured as "safe" -in the device (usually if you manually power on the UPS after a long -power outage). This is by design of respective UPS vendors, since -in such situation they can not guarantee that if a new power outage -happens, their UPS would safely shut down your systems again. -So it is deemed better and safer to stay dark until batteries -become sufficiently charged. -========= -+ -(If you have no secondary systems, skip to step 6) +4. upsmon slave systems see "FSD" and: -4. `upsmon` secondary systems see "FSD" and: + - generate a NOTIFY_SHUTDOWN event + - wait FINALDELAY seconds - typically 5 + - call their SHUTDOWNCMD + - disconnect from upsd - - generate a `NOTIFY_SHUTDOWN` event - - wait `FINALDELAY` seconds -- typically `5` - - call their `SHUTDOWNCMD` - - disconnect from `upsd` +5. The upsmon master system waits up to HOSTSYNC seconds (typically 15) + for the slaves to disconnect from upsd. If any are connected after + this time, upsmon stops waiting and proceeds with the shutdown + process. -5. The `upsmon` primary system waits up to `HOSTSYNC` seconds (typically `15`) - for the secondary systems to disconnect from `upsd`. If any are still - connected after this time, `upsmon` primary stops waiting and proceeds - with the shutdown process. +6. The upsmon master: -6. The `upsmon` primary: + - generates a NOTIFY_SHUTDOWN event + - waits FINALDELAY seconds - typically 5 + - creates the POWERDOWNFLAG file - usually /etc/killpower + - calls the SHUTDOWNCMD - - generates a `NOTIFY_SHUTDOWN` event - - waits `FINALDELAY` seconds -- typically `5` - - creates the `POWERDOWNFLAG` file in its local filesystem -- - usually `/etc/killpower` - - calls the `SHUTDOWNCMD` - -7. On most systems, `init` takes over, kills your processes, syncs and +7. On most systems, init takes over, kills your processes, syncs and unmounts some filesystems, and remounts some read-only. -8. `init` then runs your shutdown script. This checks for the - `POWERDOWNFLAG`, finds it, and tells the UPS driver(s) to power off - the load by sending commands to the connected UPS device(s) they manage. +8. init then runs your shutdown script. This checks for the + POWERDOWNFLAG, finds it, and tells the UPS driver(s) to power off + the load. -9. All the systems lose power. +9. The system loses power. 10. Time passes. The power returns, and the UPS switches back on. 11. All systems reboot and go back to work. -/////////////////////////////////// -https://github.com/networkupstools/nut/issues/1370 - -TODO: Check other docs and code to spell out expected behavior with -multiple UPS devices (when not all of them go critical or even on battery) -and servers with multiple inputs. - -Does the `upsmon` primary system power-cycle a "critical" UPS if that -is not the only one feeding it, so it is not shutting down now? -/////////////////////////////////// How you set it up ~~~~~~~~~~~~~~~~~ @@ -563,48 +417,42 @@ How you set it up NUT user creation ^^^^^^^^^^^^^^^^^ -Create a `upsd` user for `upsmon` to use while monitoring this UPS. +Create a upsd user for upsmon to use while monitoring this UPS. -Edit 'upsd.users' and create a new section. The `upsmon` will connect -to `upsd` and use these user name (in brackets) and password to -authenticate (as specified in its configuration via `MONITOR` line). - -This example is for defining a user called "monuser": +Edit upsd.users and create a new section. upsmon will connect +to upsd and use this user name (in brackets) and password to +authenticate. This example is for a user called "monuser": [monuser] password = mypass - upsmon primary - # or upsmon secondary + upsmon master + # or upsmon slave References: linkman:upsd[8], linkman:upsd.users[5] Reloading the data server ^^^^^^^^^^^^^^^^^^^^^^^^^ -Reload `upsd`. Depending on your configuration, you may be able to -do this without stopping the `upsd` daemon process: +Reload upsd. Depending on your configuration, you may be able to +do this without stopping upsd: - upsd -c reload + /usr/local/ups/sbin/upsd -c reload If that doesn't work (check the syslog), just restart it: - upsd -c stop - upsd + /usr/local/ups/sbin/upsd -c stop + /usr/local/ups/sbin/upsd -For systems with integrated service management (Linux systemd, -illumos/Solaris SMF) their corresponding `reload` or `refresh` -service actions should handle this as well. - -NOTE: If you want to make reloading work later, see the entry in the -link:FAQ.html[FAQ] about starting `upsd` as a different user. +NOTE: if you want to make reloading work later, see the entry in the +link:FAQ.html[FAQ] about starting upsd as a different user. Power Off flag file ^^^^^^^^^^^^^^^^^^^ -Set the `POWERDOWNFLAG` location for `upsmon`. +Set the POWERDOWNFLAG location for upsmon. -In 'upsmon.conf', add a `POWERDOWNFLAG` directive with a filename. -The `upsmon` will create this file when the UPS needs to be powered off +In upsmon.conf, add a POWERDOWNFLAG directive with a filename. +upsmon will create this file when the UPS needs to be powered off during a power failure when low battery is reached. We will test for the presence of this file in a later step. @@ -617,79 +465,68 @@ linkman:upsmon.conf[5] Securing upsmon.conf ^^^^^^^^^^^^^^^^^^^^ -The recommended setting is to have it owned by `root:nut`, then make it -readable by the group and not by the world. This file contains passwords -that could be used by an attacker to start a shutdown, so keep it secure. +The recommended setting is to have it owned by root:nut, then make it readable +by the group and not world. This file contains passwords that could be used by +an attacker to start a shutdown, so keep it secure. chown root:nut upsmon.conf chmod 0640 upsmon.conf -This step has been placed early in the process so you secure this file -before adding sensitive data in the next step. +This step has been placed early in the process so you secure this file before +adding sensitive data in the next step. Create a MONITOR directive for upsmon ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Edit 'upsmon.conf' and create a `MONITOR` line with the UPS definition -(@), username and password from the -<> step, and the -"primary" or "secondary" setting. +Edit upsmon.conf and create a MONITOR line with the UPS definition +(@), username and password from the <> +step, and the master or slave setting. -If this system is the UPS manager (i.e. it's connected to this UPS directly -and can manage it using a suitable NUT driver), its `upsmon` is the primary: +If it's the master (i.e., it's connected to this UPS directly): - MONITOR myupsname@mybox 1 monuser mypass primary + MONITOR myupsname@mybox 1 monuser mypass master -If it's just monitoring this UPS over the network, and some other -system is the primary, then this one is a secondary: +If it's just monitoring this UPS over the network, and some other system is the +master: - MONITOR myupsname@mybox 1 monuser mypass secondary + MONITOR myupsname@mybox 1 monuser mypass slave -The number `1` here is the "power value". This should always be set -to 1, unless you have a very special (read: expensive) system with -redundant power supplies. In such cases, refer to the User Manual: +The number "1" here is the power value. This should always be set to 1 unless +you have a very special (read: expensive) system with redundant power supplies. +In such cases, refer to the User Manual: - <>, - <>. -Note that the "power value" may also be 0 for a monitoring (administrative) -system which only observes the remote UPS status but is not impacted by its -power events, and so does not shut down when the UPS does. - References: linkman:upsmon[8], linkman:upsmon.conf[5] Define a SHUTDOWNCMD for upsmon ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Still in 'upsmon.conf', add a directive that tells `upsmon` how to -shut down your system. This example seems to work on most systems: +Still in upsmon.conf, add a directive that tells upsmon how to shut down your +system. This example seems to work on most systems: SHUTDOWNCMD "/sbin/shutdown -h +0" Notice the presence of "quotes" here to keep it together. -If your system has special needs (e.g. system-provided shutdown handler -is ungracefully time constrained), you may want to set this to a script -which does customized local shutdown tasks before calling `init` or -`shutdown` programs to handle the system side of this operation. +If your system has special needs, you may want to set this to a script which +does local shutdown tasks before calling init. Start upsmon ^^^^^^^^^^^^ - upsmon + /usr/local/ups/sbin/upsmon If it complains about something, then check your configuration. -On operating systems with service management frameworks, the monitoring client -life-cycle is managed by `nut-monitor` service. - Checking upsmon ^^^^^^^^^^^^^^^ -Look for messages in the `syslog` to indicate success. -It should look something like this: +Look for messages in the syslog to indicate success. It should look something +like this: May 29 01:11:27 mybox upsmon[102]: Startup successful May 29 01:11:28 mybox upsd[100]: Client monuser@192.168.50.1 @@ -706,12 +543,10 @@ NOTE: This step is not need if you installed from packages. Edit your startup scripts, and add a call to `upsmon`. -Make sure `upsmon` starts when your system comes up. -On systems with `upsmon` primary (also running the data server), -do it after `upsdrvctl` and `upsd`, or it will complain about not -being able to contact the server. +Make sure `upsmon` starts when your system comes up. Do it after `upsdrvctl` +and `upsd`, or it will complain about not being able to contact the server. -You may delete the `POWERDOWNFLAG` in the startup scripts, but it is not +You may delete the POWERDOWNFLAG in the startup scripts, but it is not necessary. `upsmon` will clear that file for you when it starts. NOTE: Init script examples are provide in the 'scripts' directory of @@ -725,17 +560,16 @@ NOTE: This step is not need if you installed from packages. Edit your shutdown scripts, and add `upsdrvctl shutdown`. -You should configure your system to power down the UPS after the -filesystems are remounted read-only. Have it look for the presence -of the `POWERDOWNFLAG` (from linkman:upsmon.conf[5]), using this -as an example: +You should configure your system to power down the UPS after the filesystems are +remounted read-only. Have it look for the presence of the POWERDOWNFLAG (from +linkman:upsmon.conf[5]), using this as an example: ------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- - if (/sbin/upsmon -K) + if (test -f /etc/killpower) then echo "Killing the power, bye!" - /sbin/upsdrvctl shutdown + /usr/local/ups/bin/upsdrvctl shutdown sleep 120 @@ -744,25 +578,18 @@ as an example: # *** see also the section on power races in the FAQ! *** fi ------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- [WARNING] -============================================================================== -- Be careful that `upsdrvctl shutdown` command will probably power off -your machine and others fed by the UPS(es) which it manages. +================================================================================ +- Be careful that upsdrvctl command will probably power off your machine. Don't use it unless your system is ready to be halted by force. If you run RAID, read the <<_raid_warning,RAID warning>> below! -- Make sure the filesystem(s) containing `upsdrvctl`, `upsmon`, -the `POWERDOWNFLAG` file, 'ups.conf' and your UPS driver(s) are -mounted (possibly in read-only mode) when the system gets to -this point. Otherwise it won't be able to figure out what to do. - -- If for some reason you can not ensure `upsmon` program is executable -at this point, your script can `(test -f /etc/killpower)` in a somewhat -non-portable manner, instead of asking `upsmon -K` for the verdict -according to its current configuration. -============================================================================== +- Make sure the filesystem(s) containing upsdrvctl, ups.conf and your UPS +driver(s) are mounted (possibly in read-only mode) when the system gets to this +point. Otherwise it won't be able to figure out what to do. +================================================================================ [[Testing_shutdowns]] @@ -775,17 +602,17 @@ on your systems before leaving them unattended. A successful sequence is one where the OS halts before the battery runs out, and the system restarts when power returns. -The first step is to see how `upsdrvctl` will behave without actually -turning off the power. To do so, use the `-t` argument: +The first step is to see how upsdrvctl will behave without actually turning off +power. To do so, use the '-t' argument: - upsdrvctl -t shutdown + /usr/local/ups/bin/upsdrvctl -t shutdown It will display the sequence without actually calling the drivers. You can finally test a forced shutdown sequence (FSD) using: - upsmon -c fsd + /usr/local/ups/sbin/upsmon -c fsd This will execute a full shutdown sequence, as presented in <>, starting from the 3rd step. @@ -816,38 +643,35 @@ is turned off and waits for the power to return. Once the power is back, the system reboots, pulls the snapshot back in, and keeps going from there. If the user happened to be away when it happened, they may return and have no idea that their system actually -shut down completely in the middle (although network connections will drop). +shut down completely in the middle. -In order for this to work, you need to shutdown NUT (UPS driver, `upsd` -server and `upsmon` client) in the `suspend` script and start them again in -the `resume` script. Don't try to keep them running. The `upsd` server -will latch the FSD state (so it won't be usable after resuming) and so -will the `upsmon` client. Some drivers may work after resuming, but many -don't and some UPS devices will require re-initialization, so it's best not -to keep them running either. +In order for this to work, you need to shutdown NUT (UPS driver, upsd +server and upsmon client) in the suspend script and start them again in +the resume script. Don't try to keep them running. The upsd server +will latch the FSD state (so it won't be useable after resuming) and so +will the upsmon client. Some drivers may work after resuming, but many +don't and some UPS'es will require re-initialization, so it's best not +to keep this running either. -After stopping NUT driver, server and client you'll have to send the UPS -the command to shutdown only if the `POWERDOWNFLAG` is present. Note -that most likely you'll have to allow for a grace period after calling -`upsdrvctl shutdown` since the system will still have to take a -snapshot of itself after that. Not all drivers and devices support this, -so before going down this road, make sure that the one you're using does. - -- see if you can query or configure settings named like `load.off.delay`, - `ups.delay.shutdown`, `offdelay` and/or `shutdown_delay` +After stopping driver, server and client you'll have to send the UPS +the command to shutdown only if the POWERDOWNFLAG is present. Note +that most likely you'll have to allow for a grace period after sending +'upsdrvctl shutdown' since the system will still have to take a +snapshot of itself after that. Not all drivers support this, so before +going down this road, make sure that the one you're using does. RAID warning ~~~~~~~~~~~~ -If you run any sort of RAID equipment, make sure your arrays are -either halted (if possible) or switched to "read-only" mode. -Otherwise you may suffer a long resync once the system comes back up. +If you run any sort of RAID equipment, make sure your arrays are either halted +(if possible) or switched to "read-only" mode. Otherwise you may suffer a long +resync once the system comes back up. -The kernel may not ever run its final shutdown procedure, so you must take -care of all array shutdowns in userspace before `upsdrvctl shutdown` runs. +The kernel may not ever run its final shutdown procedure, so you must take care +of all array shutdowns in userspace before upsdrvctl runs. -If you use software RAID (md) on Linux, get `mdadm` and try using -`mdadm --readonly` to put your arrays in a safe state. This has to +If you use software RAID (md) on Linux, get mdadm and try using +'mdadm --readonly' to put your arrays in a safe state. This has to happen after your shutdown scripts have remounted the filesystems. On hardware RAID or other kernels, you have to do some detective work. It may @@ -869,8 +693,8 @@ be configured using some general descriptions. There are two main elements: -1. There's a UPS attached to a communication (serial, USB or network) port - on this system. +1. There's a UPS attached to a communication (serial, USB or network) port on +this system. 2. This system depends on a UPS for power. You can play "mix and match" with those two to arrive at these descriptions @@ -880,37 +704,36 @@ for individual hosts: - B: 2 but not 1 - C: 1 and 2 -A small to medium sized data room usually has one 'C' and a bunch of 'Bs'. -This means that there's a system (type 'C') hooked to the UPS which depends -on it for power. There are also some other systems in there (type 'B') +A small to medium sized data room usually has one C and a bunch of Bs. +This means that there's a system (type C) hooked to the UPS which depends +on it for power. There are also some other systems in there (type B) which depend on that same UPS for power, but aren't directly connected to -it communications-wise. +it. Larger data rooms or those with multiple UPSes may have several "clusters" -of the "single 'C', many 'Bs'" depending on how it's all wired. +of the "single C, many Bs" depending on how it's all wired. -Finally, there's a special case. Type 'A' systems are connected to -an UPS's communication port, but don't depend on it for power. -This usually happens when an UPS is physically close to a box and can -reach the serial port, but the power wiring is such that it doesn't -actually feed that box. +Finally, there's a special case. Type A systems are connected to a UPS's +serial port, but don't depend on it for power. This usually happens when +a UPS is physically close to a box and can reach the serial port, but +the wiring is such that it doesn't actually feed it. Once you identify a system's type, use this list to decide which of the programs need to be run for monitoring: -- A: driver and `upsd` -- B: `upsmon` (in secondary mode) -- C: driver, `upsd`, and `upsmon` (in primary mode, as the UPS manager) - -image:images/advanced.png[] +- A: driver and upsd +- B: upsmon (as slave) +- C: driver, upsd, and upsmon (as master) To further complicate things, you can have a system that is hooked to multiple UPSes, but only depends on one for power. This particular -situation makes it an `A` relative to one UPS, and a `C` relative to the -other. The software can handle this -- you just have to tell it what to do. +situation makes it an "A" relative to one UPS, and a "C" relative to the +other. The software can handle this - you just have to tell it what to do. NOTE: NUT can also serve as a data proxy to increase the number of clients, -or share the communication load between several `upsd` instances. +or share the communication load between several upsd instances. + +image:images/advanced.png[] If you are running large server-class systems that have more than one power feed, see the next section for information on how to handle it @@ -920,8 +743,8 @@ properly. Typical setups for big servers with UPS redundancy -------------------------------------------------- -By using multiple `MONITOR` statements in 'upsmon.conf', you can configure -an environment where a large machine with redundant power monitors multiple +By using multiple MONITOR statements in upsmon.conf, you can configure an +environment where a large machine with redundant power monitors multiple separate UPSes. image:images/bigbox.png[] @@ -929,39 +752,35 @@ image:images/bigbox.png[] Example configuration ~~~~~~~~~~~~~~~~~~~~~ -For the examples in this section, we will use a server with four power -supplies installed and locally running the full NUT stack, including -`upsmon` in primary mode -- as the UPS manager. +For the examples in this section, we will use a server with four power supplies +installed. -Two UPSes, 'Alpha' and 'Beta', are each driving two of the power supplies -(by adding up, we know about the four power supplies of the current system). +Two UPS, 'Alpha' and 'Beta', are each driving two of the power supplies. This means that either 'Alpha' *or* 'Beta' can totally shut down and the server will be able to keep running. -The 'upsmon.conf' configuration which reflects this is the following: +The upsmon.conf configuration that reflect this is the following: - MONITOR ups-alpha@myhost 2 monuser mypass primary - MONITOR ups-beta@myhost 2 monuser mypass primary + MONITOR ups-alpha@myhost 2 monuser mypass master + MONITOR ups-beta@myhost 2 monuser mypass master MINSUPPLIES 2 -With such configuration, `upsmon` on this system will only shut down when -both UPS devices reach a critical (on battery + low battery) condition, -since 'Alpha' and 'Beta' each provide the same power value. +With that configuration, upsmon will only shut down when both UPS reaches +a critical (on battery + low battery) condition, since 'Alpha' and 'Beta' +provide the same power value. As an added bonus, this means you can move a running server from one UPS -to another (for maintenance purpose for example) without bringing it down -since the minimum sufficient power will be provided at all times. +to another (for maintenance purpose for example) without bringing it down since +the minimum power will be provided at all times. -The `MINSUPPLIES` line tells `upsmon` that we need at least 2 power supplies +The MINSUPPLIES line tells upsmon that we need at least 2 power supplies to be receiving power from a good UPS (on line or on battery, just not -on battery *and* low battery). +on battery and low battery). -NOTE: We could have used a 'Power Value' of `1` for both UPS, and have -`MINSUPPLIES` set to `1` too. These values are purely arbitrary, so -you are free to use your own rules. Here, we have linked these values -to the number of power supplies that each UPS is feeding (2) since this -maps better to physical topology and allows to throw a third or fourth -UPS into the mix without much configuration headache. +NOTE: we could have used a 'Power Value' of 1 for both UPS, and MINSUPPLIES +set to 1 too. These values are purely arbitrary, so you are free to use your +own rules. Here, we have linked these values to the number of power supplies +that each UPS is feeding (2). Multiple UPS shutdowns ordering @@ -969,11 +788,11 @@ Multiple UPS shutdowns ordering If you have multiple UPSes connected to your system, chances are that you need to shut them down in a specific order. The goal is to shut down -everything but the one keeping `upsmon` alive at first, then you do that -one last. +everything but the one keeping upsmon alive at first, then you do that one +last. To set the order in which your UPSes receive the shutdown commands, define -the `sdorder` value in your 'ups.conf' device sections. +the 'sdorder' value in your ups.conf. [bigone] driver = usbhid-ups @@ -991,11 +810,11 @@ the `sdorder` value in your 'ups.conf' device sections. sdorder = 0 The order runs from 0 to the highest number available. So, for this -configuration, the order of shutdowns would be 'misc', 'littleguy', -and then 'bigone'. +configuration, the order of shutdowns would be 'misc', 'littleguy', and then +'bigone'. -NOTE: If you have a UPS that shouldn't be powered off when running -`upsdrvctl shutdown`, set its `sdorder` to `-1`. +NOTE: If you have a UPS that shouldn't be shutdown when running 'upsdrvctl +shutdown', set the *sdorder* to *-1*. Other redundancy configurations diff --git a/docs/config-prereqs.txt b/docs/config-prereqs.txt deleted file mode 100644 index 45b1058..0000000 --- a/docs/config-prereqs.txt +++ /dev/null @@ -1,848 +0,0 @@ -ifdef::website[] -Prerequisites for building NUT on different OSes -================================================ -endif::website[] - -This chapter aims to list packages with the tools needed on a freshly minimally -deployed worker to build as many targets of NUT recipes as possible, mainly -the diverse driver and documentation types. - -NUT codebase generally should not depend on particular operating system or -kernel technology and version, and with the operating systems listed below -one can benefit from use of containers (jails, zones) to build and test -against numerous OS distributions on one physical or virtual machine, -e.g. to cover non-regression with older tool kits while taking advantage -of new releases. - -* For Linux systems, we have notes on link:ci-farm-lxc-setup.txt[Setting - up the multi-arch Linux LXC container farm for NUT CI] - -Some of the below are alternatives, e.g. compiler toolkits (gcc vs. clang) -or SSL implementations (OpenSSL vs Mozilla NSS) -- no problem installing -both, at a disk space cost. - -NOTE: Some NUT branches may need additional or different software versions -that are not yet included into `master` branch dependencies, e.g. the DMF -(Dynamic Mapping Files) sub-project needs LUA 5.1. - -More packages and/or system setup may be needed to actually run NUT with -all features enabled; chapters below concern just with building it. - -General call to Test the ability to configure and build -------------------------------------------------------- - -Check out from git, generate files and configure to tailor to your build -environment, and build some tests: - ------- -:; mkdir -p nut && cd nut && \ - git clone https://github.com/networkupstools/nut/ -b master . -:; ./autogen.sh && \ - ./configure --with-doc=all --with-all --with-cgi && \ - make all && make check && make spellcheck ------- - -You can toggle some `configure` options to check different dependency -variants, e.g. `--with-ssl=nss` vs. `--with-ssl=openssl` - -For reproducible runs of various pre-sets of configuration during -development, take a look at `ci_build.sh` script and different `BUILD_TYPE` -(and other) environment variable settings that it supports. A minimal run -with it is just to call the script, e.g.: - ------- -:; mkdir -p nut && cd nut && \ - git clone https://github.com/networkupstools/nut/ -b fightwarn . -:; ./ci_build.sh ------- - -[NOTE] -====== -To build older releases, such as "vanilla" NUT 2.7.4 and older, -you may need to address some nuances: - -* Ensure that `python` in `PATH` points to a python-2.x implementation - (`master` branch is fixed to work with python 2 and 3) - -* Ensure that `bash` is your user and maybe system shell (or ensure the - generated `configure` script gets interpreted by it) - -* Generally you may have better results with GNU Make newer than 3.81 - than with other make implementations; however, builds are regularly - tested by CI with Sun dmake and BSD make as well, so recipes should - not expect GNU-only syntax and constructs to work - -* Parallel builds should be okay in current development version and - since NUT 2.8.0 (is a bug to log and fix, if not), but they may be - failure-prone in 2.7.4 and earlier releases -====== - -For intensive rebuilds, `ccache` is recommended. - - -Build prerequisites to make NUT from scratch on various Operating Systems -------------------------------------------------------------------------- - -Debian 10/11 -~~~~~~~~~~~~ - -Being a popular baseline among Linux distributions, Debian is an -important build target. Related common operating systems include -Ubuntu and customized distros for Raspberry Pi, Proxmox, as well -as many others. - -The package list below should largely apply to those as well, -however note that some well-known package names tend to differ. -A few of those are noted below. - -[NOTE] -====== -While Debian distros I've seen (8 to 11) provide a "libusb-dev" -for libusb-0.1 headers, the binary library package name is specifically -versioned package by default of the current release (e.g. "libusb-0.1-4"), -while names of both the library and development packages for libusb-1.0 -must be determined with: ------- -:; apt-cache search 'libusb.*1\.0.* ------- -yielding e.g. "libusb-1.0-0-dev" (string name was seen with different -actual package source versions on both Debian 8 "Jessie" and -Debian 11 "Buster"). -====== - -Debian-like package installations commonly start with an update of -metadata about recently published package revisions: - ------- -:; apt-get update - -# NOTE: Older Debian-like distributions may lack a "libtool-bin" -:; apt-get install \ - ccache time \ - git python perl curl \ - make autoconf automake libltdl-dev libtool-bin libtool \ - valgrind \ - cppcheck \ - pkg-config \ - gcc g++ clang - -# NOTE: For python, you may eventually have to specify a variant like this -# (numbers depending on default or additional packages of your distro): -# :; apt-get install python2 python2.7 python-is-python2 -# and/or: -# :; apt-get install python3 python3.9 -# You can find a list of what is (pre-)installed with: -# :; dpkg -l | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; apt-get install \ - aspell aspell-en - -# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11): -:; apt-get install \ - asciidoc source-highlight python3-pygments dblatex - -# For CGI graph generation - massive packages (X11): -:; apt-get install \ - libgd-dev - -# NOTE: Some older Debian-like distributions, could ship "libcrypto-dev" -# and/or "openssl-dev" instead of "libssl-dev" by its modern name -:; apt-get install \ - libcppunit-dev \ - libssl-dev libnss3-dev \ - augeas-tools libaugeas-dev augeas-lenses \ - libusb-dev libusb-1.0-0-dev \ - libi2c-dev \ - libmodbus-dev \ - libsnmp-dev \ - libpowerman0-dev \ - libfreeipmi-dev libipmimonitoring-dev \ - libavahi-common-dev libavahi-core-dev libavahi-client-dev -# For libneon, see below - -:; apt-get install \ - lua5.1-dev - -:; apt-get install \ - bash dash ksh busybox ------- - -Alternatives that can depend on your system's other packaging choices: ------- -:; apt-get install libneon27-dev -# ... or -:; apt-get install libneon27-gnutls-dev ------- - -Over time, Debian and Ubuntu had different packages and libraries providing -the actual methods for I2C; if your system lacks the `libi2c` (and so fails -to `./configure --with-all`), try adding the following packages: ------- -:; apt-get install build-essential git-core libi2c-dev i2c-tools lm-sensors ------- - -For cross-builds (note that not everything supports multilib approach, -limiting standard package installations to one or another implementation; -in that case local containers each with one ARCH may be a better choice, -with `qemu-user-static` playing a role to "natively" run the other-ARCH -complete environments): ------- -:; apt-get install \ - gcc-multilib g++-multilib \ - crossbuild-essential \ - gcc-10:armhf gcc-10-base:armhf \ - qemu-user-static ------- - -NOTE: For Jenkins agents, also need to `apt-get install openjdk-11-jdk-headless` -(technically, needs at least JRE 8+). You may have to ensure `/proc` is mounted -in the target chroot (or do this from the running container). - -CentOS 7 -~~~~~~~~ - -CentOS is another popular baseline among Linux distributions, being a free -derivative of the RedHat Linux, upon which many other distros are based as -well. These systems typically use the RPM package manager, using directly -`rpm` command, or `yum` or `dnf` front-ends depending on their generation. - -For CentOS 7 it seems that not all repositories are equally good; some of -the software below is only served by EPEL (Extra Packages for Enterprise -Linux), as detailed at: - -* https://docs.fedoraproject.org/en-US/epel/ -* https://www.redhat.com/en/blog/whats-epel-and-how-do-i-use-it -* https://pkgs.org/download/epel-release - -You may have to specify a mirror as the `baseurl` in a `/etc/yum.repos.d/...` -file (as the aged distributions become less served by mirrors), such as: - -* https://www.mirrorservice.org/sites/dl.fedoraproject.org/pub/epel/7/x86_64/ -+ ------- -# e.g. for CentOS7 currently: -:; yum install https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-14.noarch.rpm - -# And edit /etc/yum.repos.d/epel.repo to uncomment and set the baseurl=... -# lines, and comment away the mirrorlist= lines (if yum hiccups otherwise) ------- - -General developer system helpers mentioned in link:ci-farm-lxc-setup.txt[]: ------- -:; yum update - -:; yum install \ - sudo vim mc p7zip pigz pbzip2 ------- - -NOTE: Below we request to install generic `python` per system defaults. -You may request specifically `python2` or `python3` (or both): current -NUT should be compatible with both (2.7+ at least). - -NOTE: On CentOS, `libusb` means 0.1.x and `libusbx` means 1.x.x API version. - -NOTE: On CentOS, it seems that development against libi2c/smbus is not -supported. Neither the suitable devel packages were found, nor i2c-based -drivers in distro packaging of NUT. Resolution and doc PRs are welcome. - ------- -:; yum install \ - ccache time \ - file systemd-devel \ - git python perl curl \ - make autoconf automake libtool-ltdl-devel libtool \ - valgrind \ - cppcheck \ - pkgconfig \ - gcc gcc-c++ clang - -# NOTE: For python, you may eventually have to specify a variant like this -# (numbers depending on default or additional packages of your distro): -# :; yum install python-2.7.5 -# and/or: -# :; yum install python3 python3-3.6.8 -# You can find a list of what is (pre-)installed with: -# :; rpm -qa | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; yum install \ - aspell aspell-en - -# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11): -:; yum install \ - asciidoc source-highlight python-pygments dblatex - -# For CGI graph generation - massive packages (X11): -:; yum install \ - gd-devel - -# NOTE: "libusbx" is the CentOS way of naming "libusb-1.0" -# vs. the older "libusb" as the package with "libusb-0.1" -:; yum install \ - cppunit-devel \ - openssl-devel nss-devel \ - augeas augeas-devel \ - libusb-devel libusbx-devel \ - i2c-tools \ - libmodbus-devel \ - net-snmp-devel \ - powerman-devel \ - freeipmi-devel \ - avahi-devel \ - neon-devel -#?# is python-augeas needed? exists at least... -#?# no (lib)i2c-devel ... -#?# no (lib)ipmimonitoring-devel ... would "freeipmi-ipmidetectd" cut it at least for run-time? - -# Some NUT code related to lua may be currently limited to lua-5.1 -# or possibly 5.2; the former is default in CentOS 7 releases... -:; yum install \ - lua-devel - -:; yum install \ - bash dash ksh ------- - -NOTE: `busybox` is not packaged for CentOS 7 release; a static binary can -be downloaded if needed. For more details, see -https://unix.stackexchange.com/questions/475584/cannot-install-busybox-on-centos - -CentOS packaging for 64-bit systems delivers the directory for dispatching -compiler symlinks as `/usr/lib64/ccache`. You can set it up same way as for -other described environments by adding a symlink `/usr/lib/ccache`: ------- -:; ln -s ../lib64/ccache/ "$ALTROOT"/usr/lib/ ------- - -NOTE: For Jenkins agents, also need to `yum install java-11-openjdk-headless` -(technically, needs at least JRE 8+). - -FreeBSD 12.2 -~~~~~~~~~~~~ - -Note that `PATH` for builds on BSD should include `/usr/local/...`: - ------- -:; PATH=/usr/local/libexec/ccache:/usr/local/bin:/usr/bin:$PATH -:; export PATH ------- - -NOTE: You may want to reference `ccache` even before all that, as detailed -below. - ------- -:; pkg install \ - git python perl5 curl \ - gmake autoconf automake autotools libltdl libtool \ - valgrind \ - cppcheck \ - pkgconf \ - gcc clang - -# NOTE: For python, you may eventually have to specify a variant like this -# (numbers depending on default or additional packages of your distro): -# :; pkg install python2 python27 -# and/or: -# :; pkg install python3 python37 -# You can find a list of what is (pre-)installed with: -# :; pkg info | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; pkg install \ - aspell en-aspell - -# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11): -:; pkg install \ - asciidoc source-highlight textproc/py-pygments dblatex - -# For CGI graph generation - massive packages (X11): -:; pkg install \ - libgd - -:; pkg install \ - cppunit \ - openssl nss \ - augeas \ - libmodbus \ - neon \ - net-snmp \ - powerman \ - freeipmi \ - avahi - -:; pkg install \ - lua51 - -:; pkg install \ - bash dash busybox ksh93 ------- - -Recommended: ------- -:; pkg install ccache -:; ccache-update-links ------- - -For compatibility with common setups on other operating systems, can symlink -`/usr/local/libexec/ccache` as `/usr/lib/ccache` and possibly add dash-number -suffixed symlinks to compiler tools (e.g. `gcc-10` beside `gcc10` installed -by package). - -NOTE: For Jenkins agents, also need to `pkg install openjdk8` (or 11+) -- -and do note its further OS configuration suggestions for special filesystem -mounts. - -Due to BSD specific paths *when not using* an implementation of `pkg-config` -or `pkgconf` (so guessing of flags is left to administrator -- TBD in NUT -`m4` scripts), better use this routine to test the config/build: ----- -:; ./configure --with-doc=all --with-all --with-cgi \ - --without-avahi --without-powerman --without-modbus \ - ### CPPFLAGS="-I/usr/local/include -I/usr/include" \ - ### LDFLAGS="-L/usr/local/lib -L/usr/lib" ----- - -Note the lack of `pkg-config` also precludes `libcppunit` tests, although -they also tend to mis-compile/mis-link with GCC (while CLANG seems okay). - -OpenBSD 6.4 -~~~~~~~~~~~ - -Note that `PATH` for builds on BSD should include `/usr/local/...`: - ------- -:; PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH -:; export PATH ------- - -NOTE: You may want to reference `ccache` even before all that, as detailed -below. - -OpenBSD delivers many versions of numerous packages, you should specify -your pick interactively or as part of package name (e.g. `autoconf-2.69p2`). - -During builds, you may have to tell system dispatcher scripts which version -to use (which feels inconvenient, but on the up-side for CI -- this system -allows to test many versions of auto-tools in the same agent), e.g.: ------- -:; export AUTOCONF_VERSION=2.69 AUTOMAKE_VERSION=1.10 ------- - -To use the `ci_build.sh` don't forget `bash` which is not part of OpenBSD -base installation. It is not required for "legacy" builds arranged by just -`autogen.sh` and `configure` scripts. - -NOTE: The OpenBSD 6.4 `install64.iso` installation includes a set of packages -that seems to exceed whatever is available on network mirrors; for example, -the CD image included `clang` program while it is not available to `pkg_add`, -at least not via http://ftp.netbsd.hu/mirrors/openbsd/6.4/packages/amd64/ -mirror. The `gcc` version on CD image differed notably from that in the -networked repository (4.2.x vs 4.9.x) - ------- -:; pkg_add \ - git python curl \ - gmake autoconf automake libltdl libtool \ - valgrind \ - cppcheck \ - pkgconf \ - gcc clang - -# NOTE: For python, you may eventually have to specify a variant like this -# (numbers depending on default or additional packages of your distro): -# :; yum install python-2.7.15p0 -# and/or: -# :; yum install python-3.6.6p1 -# although you might succeed specifying shorter names and the packager -# will offer a list of matching variants. -# NOTE: "perl" is not currently a package, but seemingly part of base OS. -# You can find a list of what is (pre-)installed with: -# :; pkg_info | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; pkg_add \ - aspell - -# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11): -:; pkg_add \ - asciidoc source-highlight py-pygments dblatex \ - docbook2x docbook-to-man - -# For CGI graph generation - massive packages (X11): -:; pkg_add \ - gd - -:; pkg_add \ - cppunit \ - openssl nss \ - augeas \ - libusb1 \ - neon \ - net-snmp \ - avahi - -# Select a LUA-5.1 (or possibly 5.2?) version -:; pkg_add \ - lua - -:; pkg_add \ - bash dash busybox ksh93 ------- - -[NOTE] -====== -With OpenBSD 6.4, building against freeipmi failed: its libtool -recipes referenced `-largp` which did not get installed in the system. -Maybe some more packages are needed explicitly? - ------- -:; pkg_add \ - freeipmi ------- -====== - -Recommended: ------- -:; pkg_add ccache -:; ( mkdir -p /usr/lib/ccache && cd /usr/lib/ccache && \ - for TOOL in cpp gcc g++ clang clang++ clang-cpp ; do \ - ln -s ../../local/bin/ccache "$TOOL" ; \ - done ; \ - ) ------- - -For compatibility with common setups on other operating systems, can add -dash-number suffixed symlinks to compiler tools (e.g. `gcc-4.2.1` beside -`gcc` installed by package) into `/usr/lib/ccache`. - -NOTE: For Jenkins agents, also need to `pkg_add jre` or `pkg_add jdk` -(pick version 1.8 or 8, or 11+). - -Due to BSD specific paths *when not using* an implementation of `pkg-config` -or `pkgconf` (so guessing of flags is left to administrator -- TBD in NUT -`m4` scripts), better use this routine to test the config/build: ------- -:; ./configure --with-doc=all --with-all --with-cgi \ - --without-avahi --without-powerman --without-modbus \ - ### CPPFLAGS="-I/usr/local/include -I/usr/include" - ### LDFLAGS="-L/usr/local/lib -L/usr/lib" ------- - -Note the lack of `pkg-config` also precludes `libcppunit` tests, although -they also tend to mis-compile/mis-link with GCC (while CLANG seems okay). - -NetBSD 9.2 -~~~~~~~~~~ - -Instructions below assume that `pkgin` tool (pkg-src component to -"install binary packages") is present on the system. Text below -was prepared with a VM where "everything" was installed from the -ISO image, including compilers and X11. It is possible that some -packages provided this way differ from those served by `pkgin`, -or on the contrary, that the list of suggested tool installation -below would not include something a bare-minimum system would -require to build NUT. - -Note that `PATH` for builds on NetBSD should include `local` and -`pkg`; the default after installation of the test system was: - ------- -:; PATH="/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin:/usr/X11R7/bin:/usr/local/sbin:/usr/local/bin" -:; export PATH ------- - -NOTE: You may want to reference `ccache` even before all that, -as detailed below: - ------- -:; PATH="/usr/lib/ccache:$PATH" -:; export PATH ------- - -To use the `ci_build.sh` don't forget `bash` which is not part of OpenBSD -base installation. It is not required for "legacy" builds arranged by just -`autogen.sh` and `configure` scripts. - ------- -:; pkgin install \ - git python27 python39 perl curl \ - make gmake autoconf automake libltdl libtool \ - cppcheck \ - pkgconf \ - gcc7 clang - -;; ( cd /usr/pkg/bin && ( ln -fs python2.7 python2 ; ln -fs python3.9 python3 ) ) -# You can find a list of what is (pre-)installed with: -# :; pkgin list | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; pkgin install \ - aspell aspell-en - -# For man-page doc types, footprint on this platform is moderate: -:; pkgin install \ - asciidoc - -# For other doc types (PDF, HTML) generation - massive packages (TEX, X11): -:; pkgin install \ - source-highlight py39-pygments dblatex - -# For CGI graph generation - massive packages (X11): -:; pkgin install \ - gd openmp - -:; pkgin install \ - cppunit \ - openssl nss \ - augeas \ - libusb libusb1 \ - neon \ - net-snmp \ - avahi - -# Select a LUA-5.1 (or possibly 5.2?) version -:; pkgin install \ - lua51 - -:; pkgin install \ - bash dash ast-ksh oksh ------- - -[NOTE] -====== -(TBD) On NetBSD 9.2 this package complains that it requires -OS ABI 9.0, or that `CHECK_OSABI=no` is set in `pkg_install.conf`. -Such file was not found in the test system... - ------- -:; pkgin install \ - openipmi ------- -====== - -Recommended: For compatibility with common setups on other operating -systems, can add dash-number suffixed symlinks to compiler tools (e.g. -`gcc-7` beside the `gcc` installed by package) near the original -binaries and into `/usr/lib/ccache`: ------- -:; ( cd /usr/bin && for TOOL in cpp gcc g++ ; do \ - ln -s "$TOOL" "$TOOL-7" ; \ - done ) - -# Note that the one delivered binary is `clang-13` and many (unnumbered) -# symlinks to it. For NUT CI style of support for builds with many -# compilers, complete the known numbers: -:; ( cd /usr/pkg/bin && for TOOL in clang-cpp clang++ ; do \ - ln -s clang-13 "$TOOL-13" ; \ - done ) - -:; pkgin install ccache -:; ( mkdir -p /usr/lib/ccache && cd /usr/lib/ccache && \ - for TOOL in cpp gcc g++ clang ; do \ - for VER in "" "-7" ; do \ - ln -s ../../pkg/bin/ccache "$TOOL$VER" ; \ - done ; \ - done ; \ - for TOOL in clang clang++ clang-cpp ; do \ - for VER in "" "-13" ; do \ - ln -s ../../pkg/bin/ccache "$TOOL$VER" ; \ - done ; \ - done ; \ - ) ------- - -NOTE: For Jenkins agents, also need to `pkgin install openjdk11` (will be -in `JAVA_HOME=/usr/pkg/java/openjdk11`). - -OpenIndiana 2021.10 -~~~~~~~~~~~~~~~~~~~ - -Note that due to IPS and `pkg(5)`, a version of python is part of baseline -illumos-based OS; this may not be the case on some other illumos distributions -which do not use IPS however. Currently they use python 3.7 or newer. - -To build older NUT releases (2.7.4 and before), you may need to explicitly -`pkg install python-27`. - -Typical tooling would include: - ------- -:; pkg install \ - git curl wget \ - gnu-make autoconf automake libltdl libtool \ - valgrind \ - pkg-config \ - gnu-binutils developer/linker - -# NOTE: For python, some suitable version should be available since `pkg(5)` -# tool is written in it. Similarly, many system tools are written in perl -# so some version should be installed. You may specify additional variants -# like this (numbers depending on default or additional packages of your -# distro; recommended to group `pkg` calls with many packages at once to -# save processing time for calculating a build strategy): -# :; pkg install runtime/python-27 -# and/or: -# :; pkg install runtime/python-37 runtime/python-35 runtime/python-39 -# Similarly for perl variants, e.g.: -# :; pkg install runtime/perl-522 runtime/perl-524 runtime/perl-534 -# You can find a list of what is available in remote repositories with: -# :; pkg info -r | grep -Ei 'perl|python' - -# For spell-checking, highly recommended if you would propose pull requests: -:; pkg install \ - aspell text/aspell/en - -# For other doc types (man-page, PDF, HTML) generation - massive packages (TEX, X11): -:; pkg install \ - asciidoc libxslt \ - docbook/dtds docbook/dsssl docbook/xsl docbook docbook/sgml-common pygments-39 \ - graphviz expect graphviz-tcl - -# For CGI graph generation - massive packages (X11): -:; pkg install \ - gd - -:; pkg install \ - openssl library/mozilla-nss \ - library/augeas python/augeas \ - libusb-1 libusbugen system/library/usb/libusb system/header/header-usb driver/usb/ugen \ - libmodbus \ - neon \ - net-snmp \ - powerman \ - freeipmi \ - avahi - -:; pkg install \ - lua - -:; pkg install \ - dash bash shell/ksh93 - -### Maybe -:; pkg install \ - gnu-coreutils - -### Maybe - after it gets fixed for GCC builds/linkage -:; pkg install \ - cppunit ------- - -For extra compiler coverage, we can install a large selection of versions, -although to meet NUT CI farm expectations we also need to expose "numbered" -filenames, as automated below: ------- -:; pkg install \ - gcc-48 gcc-49 gcc-5 gcc-6 gcc-7 gcc-9 gcc-10 gcc-11 \ - clang-80 clang-90 \ - ccache - -# As of this writing, clang-13 refused to link (claiming issues with -# --fuse-ld which was never specified) on OI; maybe later it will: -:; pkg install \ - developer/clang-13 runtime/clang-13 - -# Get clang-cpp-X visible in standard PATH (for CI to reference the right one), -# and make sure other frontends are exposed with versions (not all OI distro -# releases have such symlinks packaged right), e.g.: -:; (cd /usr/bin && for X in 8 9 13 ; do for T in "" "++" "-cpp"; do \ - ln -fs "../clang/$X.0/bin/clang$T" "clang${T}-${X}" ; \ - done; done) - -# If /usr/lib/ccache/ symlinks to compilers do not appear after package -# installation, or if you had to add links like above, call the service: -:; svcadm restart ccache-update-symlinks ------- - -We can even include a `gcc-4.4.4-il` version (used to build the illumos OS -ecosystems, at least until recently, which is a viable example of an old -GCC baseline); but note that so far it conflicts with `libgd` builds at -`./configure --with-cgi` stage (its binaries require newer ecosystem): - ------- -:; pkg install \ - illumos-gcc@4.4.4 - -# Make it visible in standard PATH -:; (cd /usr/bin && for T in gcc g++ cpp ; do \ - ln -s ../../opt/gcc/4.4.4/bin/$T $T-4.4.4 ; \ - done) - -# If /usr/lib/ccache/ symlinks to these do not appear, call the service: -:; svcadm restart ccache-update-symlinks ------- - -OI currently also does not build `cppunit`-based tests well, at least -not with GCC (they segfault at run-time with `ostream` issues); a CLANG -build works for that however. - -It also lacks out-of-the-box Tex suite and `dblatex` in particular, which -`asciidoc` needs to build PDF documents. It may be possible to add these -from third-party repositories (e.g. SFE) and/or build from sources. - -No pre-packaged `cppcheck` was found, either. - -NOTE: For Jenkins agents, also need to `pkg install developer/java/openjdk8` -(or `pkg install runtime/java/openjdk11` for JRE 11 -- currently the OS does -not offer in-distro JDK version 11+). - -OmniOS CE (as of release 151036) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Being a minimal-footprint system, OmniOS CE provides very few packages out -of the box. There are additional repositories supported by the project, as -well as third-party repositories such as SFE. For some dependencies, it may -happen that you would need to roll and install your own builds in accordance -with that project's design goals. - -Note you may need not just the "Core" IPS package publisher, but also the -"Extra" one. See OmniOS CE web site for setup details. - ------- -:; pkg install \ - developer/build/autoconf developer/build/automake developer/build/libtool \ - build-essential ccache git developer/pkg-config \ - runtime/perl \ - asciidoc \ - libgd - -:; pkg install \ - net-snmp - -# NOTE: For python, some suitable version should be available since `pkg(5)` -# tool is written in it. You may specify an additional variant like this -# (numbers depending on default or additional packages of your distro): -# :; pkg install runtime/python-37 -# You can find a list of what is available in remote repositories with: -# :; pkg info -r | grep -Ei 'perl|python' ------- - -OmniOS lacks a pre-packaged libusb, however the binary build from contemporary -OpenIndiana can be used (copy the header files and the library+symlinks for -all architectures you would need). - -You may need to set up `ccache` with the same `/usr/lib/ccache` dir used -in other OS recipes. Assuming your Build Essentials pulled GCC 9 version, -and ccache is under `/opt/ooce` namespace, that would be like: ------- -:; mkdir -p /usr/lib/ccache -:; cd /usr/lib/ccache -:; ln -fs ../../../opt/ooce/bin/ccache gcc -:; ln -fs ../../../opt/ooce/bin/ccache g++ -:; ln -fs ../../../opt/ooce/bin/ccache gcpp -:; ln -fs ../../../opt/ooce/bin/ccache gcc-9 -:; ln -fs ../../../opt/ooce/bin/ccache g++-9 -:; ln -fs ../../../opt/ooce/bin/ccache gcpp-9 ------- - -Given that many of the dependencies can get installed into that namespace, -you may have to specify where `pkg-config` will look for them (note that -library and binary paths can be architecture bitness-dependent): ------- -:; ./configure PKG_CONFIG_PATH="/opt/ooce/lib/amd64/pkgconfig" --with-cgi ------- - -Note also that the minimal footprint nature of OmniOS CE precludes building -any large scope easily, so avoid docs and "all drivers" unless you provide -whatever they need to happen. diff --git a/docs/configure.txt b/docs/configure.txt index c681f74..a28aca6 100644 --- a/docs/configure.txt +++ b/docs/configure.txt @@ -3,112 +3,46 @@ Configure options ================= endif::website[] -There are a few options reviewed below that can be given to `configure` -script to tweak your compilations. See also `./configure --help` for a -current and complete listing for the current version of the codebase. +There are a few options that can be given to configure to tweak compiles. +See also "./configure --help" for a current and complete listing. Driver selection ---------------- -Serial drivers -~~~~~~~~~~~~~~ - --with-serial -USB drivers -~~~~~~~~~~~ - Build and install the serial drivers (default: yes) --with-usb Build and install the USB drivers (default: auto-detect) - -Note that you need to install the libusb development package or files, -and that both libusb 0.1 and 1.0 are supported. In case both are -available, libusb 1.0 takes precedence, and will be used by default. -It is however possible to override this default choice by explicitly -calling `--with-usb=libusb-0.1` or `--with-usb=libusb-1.0`. -If you do specify the version to use (or `yes` for auto-detection), -this option would fail if requested (or any) libusb version was not -found. The default `auto` value would not fail in such case. - -SNMP drivers -~~~~~~~~~~~~ +Note that you need to install the libusb development package or files. --with-snmp Build and install the SNMP drivers (default: auto-detect) - Note that you need to install libsnmp development package or files. - --with-net-snmp-config - -In addition to the `--with-snmp` option above, this one allows to provide -a custom program name (in `PATH`) or complete pathname to `net-snmp-config` -(may have copies named per architecture, e.g. `net-snmp-config-32` and -`net-snmp-config-64`). - -This may be needed on build systems which support multiple architectures, -or in cases where your distribution names this program differently. -With a default value of `yes` it would mean preference of this program, -compared to information from `pkg-config`, if both are available. - -XML drivers and features -~~~~~~~~~~~~~~~~~~~~~~~~ - --with-neon Build and install the XML drivers (default: auto-detect) - Note that you need to install neon development package or files. -LLNC CHAOS Powerman driver -~~~~~~~~~~~~~~~~~~~~~~~~~~ - --with-powerman Build and install Powerman PDU client driver (default: auto-detect) - This allows to interact with the Powerman daemon, and the numerous -Power Distribution Units (PDU) supported by the -https://github.com/chaos/powerman[powerman] project. - +Power Distribution Units (PDU) supported by the project. Note that you need to install powerman development package or files. -IPMI drivers -~~~~~~~~~~~~ - --with-ipmi --with-freeipmi Build and install IPMI PSU driver (default: auto-detect) - -This allows to monitor numerous Power Supply Units (PSU) found on servers. - -Note that you need to install freeipmi (0.8.5 or higher, for nut-scanner; -and 1.0.1 or higher, for nut-ipmipsu) development package or files. - -I2C bus drivers -~~~~~~~~~~~~~~~ - - --with-linux_i2c - -Build and install i2c drivers (default: auto-detect) - -Note that you need to install libi2c development package or files. - -Modbus drivers -~~~~~~~~~~~~~~ - - --with-modbus - -Build and install modbus (Serial, TCP) drivers (default: auto-detect) - -Note that you need to install libmodbus development package or files. - -Manual selection of drivers -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This allows to monitor numerous Power Supply Units (PSU) found +on servers. +Note that you need to install freeipmi (0.8.5 or higher) development package or +files. --with-drivers=,,... @@ -116,116 +50,44 @@ Specify exactly which driver or drivers to build and install (this works for serial, usb, and snmp drivers, and overrides the preceding three options). -As of the time of original writing (2010), there are 46 UPS drivers +As of the time of this writing (2010), there are 46 UPS drivers available. Most users will only need one, a few will need two or three, and very few people will need all of them. To save time during the compile and disk space later on, you can use this option to just build and install a subset of the drivers. -For example, to select `mge-shut` and `usbhid-ups`, you'd do this: +To select mge-shut and usbhid-ups, you'd do this: --with-drivers=apcsmart,usbhid-ups If you need to build more drivers later on, you will need to rerun -`configure` with a different list. To make it build all of the -drivers from scratch again, run `make clean` before starting. +configure with a different list. To make it build all of the +drivers from scratch again, run 'make clean' before starting. Optional features ----------------- -CGI client interface -~~~~~~~~~~~~~~~~~~~~ - --with-cgi (default: no) Build and install the optional CGI programs, HTML files, and sample CGI configuration files. This is not enabled by default, as they -are only useful on web servers. See link:data/html/README[] for additional +are only useful on web servers. See data/html/README for additional information on how to set up CGI programs. -Pretty documentation and man pages -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --with-doc= (default: no) Build and install NUT documentation file(s). +The possible values are "html-single" for single page HTML, "html-chunked" +for multi pages HTML, "pdf" for a PDF file or "auto" to build all the +possible previous documentation formats. +Verbose output can be enabled using: ASCIIDOC_VERBOSE=-v make -This feature requires AsciiDoc 8.6.3 or newer (see https://asciidoc.org). +This feature requires AsciiDoc 8.6.3 (http://www.methods.co.nz/asciidoc). -The possible documentation type values are: + --with-lib (default: no) -* `html-single` for single page HTML, -* `html-chunked` for multi-paged HTML, -* `pdf` for a PDF file, and -* `man` for the usual manpages. - -Other values understood for this option are listed below: - -* If the `--with-doc` argument is passed without a list, or specifies - just `=yes` or `=all`, it enables all supported formats with a `=yes` - to require them. - -* An (explicit!) `--with-doc=auto` argument tries to enable all supported - formats with an `=auto` but should not fail the build if something - can not be generated. - -* A `--with-doc=no` quietly skips generation of all types of documentation, - including manpages. - -* `--with-doc=skip` is used to configure some of the `make distcheck*` - scenarios to re-use man page files built and distributed by the main - build and not waste time on re-generation of those. - -Multiple documentation format values can be specified, separated with comma. -Each such value can be suffixed with `=yes` to require building of this one -documentation format (abort configuration if tools are missing), `=auto` to -detect and enable if we can build it on this system (and not abort if we -can not), and `=no` (or `=skip`) to explicitly skip generation of this -document format even if we do have the tools to build it. - -If a document format is mentioned in the list without a suffix, then it is -treated as a `=yes` requirement. - -Verbose output can be enabled using: `ASCIIDOC_VERBOSE=-v make` - -Example valid formats of this flag: - -* `--with-doc` without an argument, effectively same as `--with-doc=yes` -* `--with-doc=` is a valid empty list, effectively same as `--with-doc=no` -* `--with-doc=auto` -* `--with-doc=pdf,html-chunked` -* `--with-doc=man=no,pdf=auto,html-single` - -Development files -~~~~~~~~~~~~~~~~~ - - --with-dev (default: no) - -Build and install the upsclient and nutclient library and header files, to -build further projects against NUT (such as wmNUT client and many others). - -Options for developers -~~~~~~~~~~~~~~~~~~~~~~ - - --enable-check-NIT (default: no) - -Add `make check-NIT` to default activity of `make check` to run the -NUT Integration Testing suite. This is potentially dangerous (e.g. due -to port conflicts when running many such tests in same environment), -so not active by default. - - --enable-maintainer-mode (default: no) - -Use maintainer mode to keep `Makefile.in` and `Makefile` in sync with -ever-changing `Makefile.am` content after Git updates or editing. - - --enable-cppcheck (default: no) - -Activate recipes for static analysis with `cppcheck` tools (if available). - -I want it all! -~~~~~~~~~~~~~~ +Build and install the upsclient library and header files. --with-all (no default) @@ -233,120 +95,91 @@ Build and install all of the above (the serial, USB, SNMP, XML/HTTP and PowerMan drivers, the CGI programs and HTML files, and the upsclient library). -Networking transport security -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - --with-ssl (default: auto-detect) --with-nss (default: auto-detect) --with-openssl (default: auto-detect) Enable SSL support, using either Mozilla NSS or OpenSSL. - If both are present, and nothing was specified, OpenSSL support will -be preferred. - -Read link:docs/security.txt[] for instructions on SSL support. - -NOTE: Currently the two implementations differ in supported features. - -Networking access security -~~~~~~~~~~~~~~~~~~~~~~~~~~ +be prefered. Read docs/security.txt for instructions on SSL support. --with-wrap (default: auto-detect) -Enable libwrap (tcp-wrappers) support. - -Refer to linkman:upsd[8] man page for more information. - -Networking IPv6 -~~~~~~~~~~~~~~~ +Enable libwrap (tcp-wrappers) support. Refer to upsd man page for +more information. --with-ipv6 (default: auto-detect) Enable IPv6 support. -AVAHI/mDNS -~~~~~~~~~~ + --with-hal (default: no) + +Build and install Hardware Abstraction Layer support. +If you own a USB unit, only protect your local system and run the +Gnome or KDE desktop, this will enable a full Plug & Play usage. +See docs/nut-hal.txt for additional information on how to set up +and use HAL support. --with-avahi (default: auto-detect) Build and install Avahi support, to publish NUT server availability -using mDNS protocol. This requires Avahi development files for the -Core and Client parts. - -LibLTDL -~~~~~~~ +using mDNS protocol. --with-libltdl (default: auto-detect) Enable libltdl (Libtool dlopen abstraction) support. - -This is required to build `nut-scanner` which loads third-party libraries -dynamically, based on requested scanning options. This allows to build and -package the tool without requiring all possible dependencies to be installed -in each run-time environment. +This is required to build nut-scanner. Other configuration options --------------------------- -NUT data server port -~~~~~~~~~~~~~~~~~~~~ - --with-port=PORT -Change the TCP port used by the network code. Default is 3493 -as registered with IANA. +Change the TCP port used by the network code. Default is 3493. -Ancient versions of `upsd` used port 3305. NUT 2.0 and up use a -substantially different network protocol and are not able to +Ancient versions of upsd used port 3305. NUT 2.0 and up use a +substantially different network protocol and are not able to communicate with anything older than the 1.4 series. If you have to monitor a mixed environment, use the last 1.4 version, as it contains compatibility code for both the old "REQ" and the new "GET" versions of the protocol. -Daemon user accounts -~~~~~~~~~~~~~~~~~~~~ - --with-user= --with-group= -Programs started as `root` will `setuid()` to `` for somewhat -safer operation. You can override this with `-u ` in several -programs, including `upsdrvctl` (and all drivers by extension), `upsd`, -and `upsmon`. The "user" directive in `ups.conf` overrides this at run +Programs started as root will setuid() to for somewhat +safer operation. You can override this with -u in several +programs, including upsdrvctl (and all drivers by extension), upsd, +and upsmon. The "user" directive in ups.conf overrides this at run time for the drivers. -NOTE: `upsmon` does not totally drop `root` because it may need to +NOTE: upsmon does not totally drop root because it may need to initiate a shutdown. There is always at least a stub process -remaining with `root` powers. The network code runs in another +remaining with root powers. The network code runs in another (separate) process as the new user. -The `` is used for the permissions of some files, +The is used for the permissions of some files, particularly the hotplugging rules for USB. The idea is that the device files for any UPS devices should be readable and writable by members of that group. -The default value for both the username and groupname is `nobody` -(or `nogroup` on systems that have it when `configure` script runs). +The default value for both the username and groupname is "nobody". This was done since it's slightly better than staying around as -`root`. Running things as `nobody` is not a good idea, since it's a +root. Running things as nobody is not a good idea, since it's a hack for NFS access. You should create at least one separate user for this software. -If you use one of the `--with-user` and `--with-group` options, then -you have to use the other one too. +If you use one of the --with-user and --with-group options, then +you have to use the other one too. -See the link:INSTALL.nut[] document and the FAQ for more on this topic. - -Syslog facility -~~~~~~~~~~~~~~~ +See the INSTALL document and the FAQ for more on this topic. --with-logfacility=FACILITY Change the facility used when writing to the log file. Read the man -page for `openlog` to get some idea of what's available on your system. -Default is `LOG_DAEMON`. +page for openlog to get some idea of what's available on your system. +Default is LOG_DAEMON. Installation directories @@ -356,165 +189,111 @@ Installation directories This is a fairly standard option with GNU autoconf, and it sets the base path for most of the other install directories. The default -is `/usr/local/ups`, which puts everything but the state sockets in one -easy place, and does not conflict with usual distribution packaging. +is /usr/local/ups, which puts everything but the state sockets in one +easy place. If you like having things to be at more of a "system" level, setting -the prefix to `/usr/local` or even `/usr` might be better. +the prefix to /usr/local or even /usr might be better. --exec_prefix=PATH This sets the base path for architecture dependent files. By -default, it is the same as ``. +default, it is the same as . --sysconfdir=PATH Changes the location where NUT's configuration files are stored. -By default this path is `/etc`. Setting this to `/etc/nut` or -`/etc/ups` might be useful. +By default this path is /etc. Setting this to /etc or +/etc/ups might be useful. -The `NUT_CONFPATH` environment variable overrides this at run time. +The NUT_CONFPATH environment variable overrides this at run time. - --sbindir=PATH --bindir=PATH + --sbindir=PATH Where executable files will be installed. Files that are normally -executed by root (`upsd`, `upsmon`, `upssched`) go to ``, -all others to ``. The defaults are `/sbin` and -`/bin` respectively. - -See also `--with-drvpath` below. - - --with-drvpath=PATH - -The UPS drivers will be installed to this path. By default they -install to `/bin`, i.e. `/usr/local/ups/bin`. - -You would want a location that remains mounted when most of the system -is prepared to turn off, so some distributions package NUT drivers into -`/lib/nut` or similar. See link:config-notes.txt[] detailing how to -set up system shutdown. - -The `driverpath` global directive in the `ups.conf` file overrides this -at run time. +executed by root (upsd, upsmon, upssched) go to sbindir, all others +to bindir. The defaults are /bin and /sbin. --datadir=PATH Change the data directory, i.e., where architecture independent -read-only data is installed. By default this is `/share`, -i.e. `/usr/local/ups/share`. At the moment, this directory only -holds two files -- the optional `cmdvartab` and `driver.list`. +read-only data is installed. By default this is /share, +i.e., /usr/local/ups/share. At the moment, this directory only +holds two files - the optional cmdvartab and driver.list. --mandir=PATH Sets the base directories for the man pages. The default is -`/man`, i.e. `/usr/local/ups/man`. +/man, i.e., /usr/local/ups/man. --includedir=PATH -Sets the path for include files to be installed when `--with-dev` is -selected. For example, `upsclient.h` is installed here. The default -is `/include`. +Sets the path for include files to be installed when --with-lib is +selected. For example, upsclient.h is installed here. The default +is /include. --libdir=PATH -Sets the installation path for libraries. Depending on the build -configuration, this can include the `libupsclient`, `libnutclient`, -`libnutclientsub`, `libnutscan` and their pkg-config metadata (see -`--with-pkgconfig-dir` option). The default is `/lib`. +Sets the installation path for libraries. This is just the +upsclient library for now. The default is /lib. - --with-pkgconfig-dir=PATH + --with-drvpath=PATH -Where to install pkg-config `*.pc` files. This option only has an -effect if `--with-dev` is selected, and causes a pkg-config file to -be installed in the named location. The default is -`/pkgconfig`. +The UPS drivers will be installed to this path. By default they +install to "/bin", i.e., /usr/local/ups/bin. -Use `--without-pkgconfig-dir` to disable this feature altogether. +The "driverpath" global directive in the ups.conf file overrides this +at run time. --with-cgipath=PATH The CGI programs will be installed to this path. By default, they -install to `/cgi-bin`, which is usually -`/usr/local/ups/cgi-bin`. +install to "/cgi-bin", which is usually /usr/local/ups/cgi-bin. -NOTE: If you set the prefix to something like `/usr`, you should set the -`cgipath` to something else, because `/usr/cgi-bin` is pretty ugly and +If you set the prefix to something like /usr, you should set the +cgipath to something else, because /usr/cgi-bin is pretty ugly and non-standard. The CGI programs are not built or installed by default. Use -`./configure --with-cgi` to request that they are built and +"./configure --with-cgi" to request that they are built and installed. --with-htmlpath=PATH HTML files will be installed to this path. By default, this is -`/html`. Note that HTML files are only installed if -`--with-cgi` is selected. +"/html". Note that HTML files are only installed if +--with-cgi is selected. + + --with-pkgconfig-dir=PATH + +Where to install pkg-config *.pc files. This option only has an +effect if --with-lib is selected, and causes a pkg-config file to +be installed in the named location. The default is +/pkgconfig. + +Use --without-pkgconfig-dir to disable this feature altogether. --with-hotplug-dir=PATH -Where to install Linux 2.4 hotplugging rules. The default is to use -`/etc/hotplug`, if that directory exists, and to not install it +Where to install Linux 2.4 hotplugging rules. The default is +/etc/hotplug, if that directory exists, and not to install it otherwise. Note that this installation directory is not a -subdirectory of `` by default. When installing NUT as a +subdirectory of by default. When installing NUT as a non-root user, you may have to override this option. -Use `--without-hotplug-dir` to disable this feature altogether. +Use --without-hotplug-dir to disable this feature altogether. --with-udev-dir=PATH Where to install Linux 2.6 hotplugging rules, for kernels that have -the "udev" mechanism. The default is to use `/etc/udev`, if that -directory exists, and to not install it otherwise. Note that this -installation directory is not a subdirectory of `` by +the "udev" mechanism. The default is /etc/udev, if that directory +exists, and not to install it otherwise. Note that this +installation directory is not a subdirectory of by default. When installing NUT as a non-root user, you may have to override this option. -Use `--without-udev-dir` to disable this feature altogether. - - --with-systemdsystemunitdir=PATH - -Where to install Linux systemd unit definitions. Useless and harmless -on other OSes, including Linux distributions without systemd, just adding -a little noise to configure script output. - -Use `--with-systemdsystemunitdir=auto` (default) to detect the settings -using pkg-config if possible. - -Use `--with-systemdsystemunitdir(=yes)` to require detection of these -settings with pkg-config, or fail configuration if not possible. - -Use `--with-systemdsystemunitdir=no` to disable this feature altogether. - - --with-systemdshutdowndir=PATH - -Where to install Linux systemd unit definitions for shutdown handling. -Useless and harmless on other OSes, including Linux distributions -without systemd, just adding a little noise to configure script output. - -Use `--with-systemdshutdowndir` to detect the settings using pkg-config. - -Use `--with-systemdshutdowndir=no` to disable this feature altogether. - - --with-systemdtmpfilesdir=PATH - -Where to install Linux systemd configuration for tmpfiles handling (the -automatically created locations for PID, state and similar run-time files). -Useless and harmless on other OSes, including Linux distributions -without systemd, just adding a little noise to configure script output. - -Use `--with-systemdtmpfilesdir` to detect the settings using pkg-config. - -Use `--with-systemdtmpfilesdir=no` to disable this feature altogether. - - --with-augeas-lenses-dir=PATH - -Where to install Augeas configuration-management lenses. - -Only useful and valid if you use Augeas to parse and modify configuration -files. The default is to use `/usr/share/augeas/lenses`, if that directory -exists, and to not install it otherwise. +Use --without-udev-dir to disable this feature altogether. Directories used by NUT at run-time @@ -523,87 +302,68 @@ Directories used by NUT at run-time --with-pidpath=PATH Changes the directory where pid files are stored. By default this is -`/var/run`. Certain programs like `upsmon` will leave files here. +/var/run. Certain programs like upsmon will leave files here. --with-altpidpath=PATH -Programs that normally don't have `root` powers, like the drivers and -`upsd`, write their pid files here. By default this is whatever the -statepath (below) is, as those programs should be able to write there. - -The `NUT_ALTPIDPATH` environment variable overrides this at run time. +Programs that normally don't have root powers, like the drivers and +upsd, write their pid files here. By default this is whatever the +statepath is, as those programs should be able to write there. --with-statepath=PATH -Change the default location of the state sockets created by the drivers -to interact with the data server `upsd`. Default is `/var/state/ups`. +Change the default location of the state sockets created by the +drivers. -The `NUT_STATEPATH` environment variable overrides this at run time. +The NUT_STATEPATH environment variable overrides this at run time. + +Default is /var/state/ups. Things the compiler might need to find -------------------------------------- -LibGD -~~~~~ - - --with-pkg-config - -This option allows to provide a custom program name (in `PATH`) or a -complete pathname to `pkg-config` which describes `CFLAGS`, `LIBS` and -possibly other build-time options in `*.pc` files, to use third-party -libraries. On build systems which support multiple architectures you -may also want to set `PKG_CONFIG_PATH` to match your current build. - --with-gd-includes="-I/foo/bar" -If you installed `libgd` in some place where your C preprocessor can't -find the header files, use this switch to add additional `-I` flags. +If you installed gd in some place where your C preprocessor can't +find the header files, use this switch to add additional -I flags. --with-gd-libs="-L/foo/bar -labcd -lxyz" -If your copy of `libgd` isn't linking properly, use this to give the -proper `-L` and `-l` flags to make it work. See `LIBS=` in gd's `Makefile`. +If your copy of gd isn't linking properly, use this to give the +proper -L and -l flags to make it work. See LIBS= in gd's Makefile. -NOTE: the `--with-gd` switches are not necessary if you have gd 2.0.8 -or higher installed properly. The `gdlib-config` script or pkg-config -manifest will be detected and used by default in that situation. - - --with-gdlib-config - -This option allows to provide a custom program name (in `PATH`) or -a complete pathname to `gdlib-config`. This may be needed on build -systems which support multiple architectures, or in cases where your -distribution names this program differently. - -LibUSB -~~~~~~ - - --with-libusb-config - -This option allows to provide a custom program name (in `PATH`) or -a complete pathname to `libusb-config` (usually delivered only for -libusb-0.1 version, but not for libusb-1.0). This may be needed on -build systems which support multiple architectures or provide several -versions of libusb, or in cases where your distribution names this -program differently. - -Various -~~~~~~~ +NOTE: the --with-gd switches are not necessary if you have gd 2.0.8 +or higher installed properly. The gdlib-config script will be +detected and used by default in that situation. --with-ssl-includes, --with-usb-includes, --with-snmp-includes, --with-neon-includes, --with-libltdl-includes, --with-powerman-includes="-I/foo/bar" If your system doesn't have pkg-config and support for any of the above -libraries isn't found (but you know it is installed), you must specify -the compiler flags that are needed. +libraries isn't found (but you know it is installed), you must specify the +compiler flags that are needed. --with-ssl-libs, --with-usb-libs, --with-snmp-libs, --with-neon-libs, --with-libltdl-libs --with-powerman-libs="-L/foo/bar -labcd -lxyz" -If system doesn't have pkg-config or it fails to provides hints for -some of the settings that are needed to set it up properly and the -build in defaults are not right, you can specify the correct values -for your system here. +If your system doesn't have pkg-config and support for any of the above +libraries isn't found (but you know it is installed), you must specify the +linker flags that are needed. + +HAL addons (deprecated) +----------------------- + + --with-hal-includes="-DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal \ + -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" + --with-hal-libs="-lhal -ldbus-1 -lpthread" + --with-hal-user="haldaemon" + --with-hal-device-match-key="info.bus" + --with-hal-callouts-path="${libdir}/hal" + --with-hal-fdi-path="${datarootdir}/hal/fdi/information/20thirdparty" + +If system doesn't have pkg-config or it fails to provides hints for some of the +settings that are needed to set it up properly and the build in defaults are +not right, you can specify the right variables here. diff --git a/docs/contact-closure.txt b/docs/contact-closure.txt index 044039e..deba8b9 100644 --- a/docs/contact-closure.txt +++ b/docs/contact-closure.txt @@ -74,19 +74,15 @@ When editing the genericups.h, the values have the following meanings: Outgoing lines: -- line_norm = what to set to make the line "normal" -- i.e. cable power +- line_norm = what to set to make the line "normal" - i.e. cable power - line_sd = what to set to make the UPS shut down the load Incoming lines: -- line_ol = flag that appears for on line / on battery -- val_ol = value of that flag when the UPS is on battery -- line_bl = flag that appears for low battery / battery OK -- val_bl = value of that flag when the battery is low -- line_rb = flag that appears for battery health -- val_rb = value of that flag when the battery needs a replacement -- line_bypass = flag that appears for battery bypass / battery protection active -- val_bypass = value of that flag when the battery is bypassed / missing +- line_ol = flag that appears for on line / on battery +- val_ol = value of that flag when the UPS is on battery +- line_bl = flag that appears for low battery / battery OK +- val_bl = value of that flag when the battery is low This may seem a bit confusing to have two variables per value that we want to read, but here's how it works. If you set line_ol to @@ -95,7 +91,7 @@ with the value of the serial port whenever a poll occurs. If that flag exists, then the result of the and will be 0x80. If it does not exist, the result will be 0. -So, if line_ol = foo, then val_ol can only be foo or 0. +So, if line_ol = foo, then val_ol can only be foo or 0. As a general case, if 'line_ol == val_ol', then the value you're reading is active high. Otherwise, it's active low. Check out the guts of diff --git a/docs/daisychain.txt b/docs/daisychain.txt deleted file mode 100644 index c67d287..0000000 --- a/docs/daisychain.txt +++ /dev/null @@ -1,220 +0,0 @@ -ifndef::external_title[] -[[daisychain]] -NUT daisychain support notes -============================ -endif::external_title[] - -NUT supports daisychained devices for any kind of device that proposes -it. This chapter introduces: - -* for developers: how to implement such mechanism, -* for users: how to manage and use daisychained devices in NUT in general, - and how to take advantage of the provided features. - -Introduction ------------- - -It's not unusual to see some daisy-chained PDUs or UPSs, connected together -in master-slave mode, to only consume 1 IP address for their communication -interface (generally, network card exposing SNMP data) and expose only one -point of communication to manage several devices, through the daisy-chain -master. - -This breaks the historical consideration of NUT that one driver provides -data for one unique device. However, there is an actual need, and a smart -approach was considered to fulfill this, while not breaking the standard -scope (for base compatibility). - - -Implementation notes --------------------- - -General specification -~~~~~~~~~~~~~~~~~~~~~ - -The daisychain support uses the device collection to extend the historical -NUT scope (1 driver -- 1 device), and provides data from the additional -devices accessible through a single management interface. - -A new variable was introduced to provide the number of devices exposed: the -`device.count`, which: - -* defaults to 1 -* if higher than 1, enables daisychain support and access to data of each -individual device through `device.X.{...}` - -To ensure backward compatibility in NUT, the data of the various devices -are exposed the following way: - -* `device.0` is a special case, for the whole set of devices (the whole -daisychain). It is equivalent to `device` (without `.X` index) and root -collections. The idea is to be able to get visibility and control over the -whole daisychain from a single point. -* daisy-chained devices are available from `device.1` (master) to `device.N` -(slaves). - -That way, client applications that are unaware of the daisychain support, -will only see the whole daisychain, as it would normally seem, and not -nothing at all. - -Moreover, this solution is generic, and not specific to the ePDU use case -currently considered. It thus support both the current NUT scope, along with -other use cases (parallel / serial UPS setups), and potential evolution and -technology change (hybrid chain with UPS and PDU for example). - - -Devices status handling -^^^^^^^^^^^^^^^^^^^^^^^ - -To be clarified... - - -Devices alarms handling -^^^^^^^^^^^^^^^^^^^^^^^ - -Devices (master and slaves) alarms are published in `device.X.ups.alarm`, -which may evolve into `device.X.alarm`. If any of the devices has an alarm, -the main `ups.status` will publish an `ALARM` flag. This flag is be cleared -once all devices have no alarms anymore. - -NOTE: ups.alarm behavior is not yet defined (all devices alarms vs. list of -device(s) that have alarms vs. nothing?) - -Example -^^^^^^^ - -Here is an example excerpt of three PDUs, connected in daisychain mode, with -one master and two slaves: - - device.count: 3 - device.mfr: EATON - device.model: EATON daisychain PDU - device.1.mfr: EATON - device.1.model: EPDU MI 38U-A IN: L6-30P 24A 1P OUT: 36XC13:6XC19 - device.2.mfr: EATON - device.2.model: EPDU MI 38U-A IN: L6-30P 24A 1P OUT: 36XC13:6XC19 - device.3.mfr: EATON - device.3.model: EPDU MI 38U-A IN: L6-30P 24A 1P OUT: 36XC13:6XC19 - ... - device.3.ups.alarm: high current critical! - device.3.ups.status: ALARM - ... - input.voltage: ??? (proposal: range or list or average?) - device.1.input.voltage: 237.75 - device.2.input.voltage: 237.75 - device.3.input.voltage: 237.75 - ... - outlet.1.status: ?? (proposal: "on, off, off) - device.1.outlet.1.status: on - device.2.outlet.1.status: off - device.3.outlet.1.status: off - ... - ups.status: ALARM - - -Information for developers -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -NOTE: these details are dedicated to the `snmp-ups` driver! - -In order to enable daisychain support for a range of devices, developers -have to do two things: - -* Add a `device.count` entry in a mapping file (see `*-mib.c`) -* Modify mapping entries to include a format string for the daisychain index - -Optionally, if there is support for outlets and / or outlet-groups, there -is already a template formatting string. So you have to tag such templates -with multiple definitions, to point if the daisychain index is the first -or second formatting string. - -Base support -^^^^^^^^^^^^ - -In order to enable daisychain support on a mapping structure, the following -steps have to be done: - -* Add a "device.count" entry in the mapping file: snmp-ups will determine -if the daisychain support has to be enabled (if more than 1 device). -To achieve this, use one of the following type of declarations: -+ -a) point at an OID which provides the number of devices: - - { "device.count", 0, 1, ".1.3.6.1.4.1.13742.6.3.1.0", "1", - SU_FLAG_STATIC, NULL }, -+ -b) point at a template OID to guesstimate the number of devices, by walking -through this template, until it fails: -+ - { "device.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", "1", - SU_FLAG_STATIC, NULL, NULL }, - -* Modify all entries so that OIDs include the formatting string for the -daisychain index. For example, if you have the following entry: -+ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0", ... }, -+ -And if the last "0" of the the 4th field represents the index of the device -in the daisychain, then you would have to adapt it the following way: -+ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", ... }, - - -Templates with multiple definitions -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If there already exist templates in the mapping structure, such as for -single outlets and outlet-groups, you also need to specify the position -of the daisychain device index in the OID strings for all entries in the -mapping table, to indicate where the daisychain insertion point is exactly. - -For example, using the following entry: - - { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.0.%i", - NULL, SU_OUTLET, NULL, NULL }, - -You would have to translate it to: - - { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL, NULL }, - -`SU_TYPE_DAISY_1` flag indicates that the daisychain index is the first -`%i` specifier in the OID template string. If it is the second one, use -`SU_TYPE_DAISY_2`. - - -Devices alarms handling -^^^^^^^^^^^^^^^^^^^^^^^ - -Two functions are available to handle alarms on daisychain devices in your -driver: - -* `device_alarm_init()`: clear the current alarm buffer -* `device_alarm_commit(const int device_number)`: commit the current alarm -buffer to "device..ups.alarm", and increase the count of -alarms. If the current alarms buffer is empty, the count of alarm is -decreased, and the variable "device..ups.alarm" is removed -from publication. Once the alarm count reaches "0", the main (device.0) -ups.status will also remove the "ALARM" flag. - -[NOTE] -====== -When implementing a new driver, the following functions have to be -called: - -* `alarm_init()` at the beginning of the main update loop, for the whole -daisychain. This will set the alarm count to "0", and reinitialize all -alarms, -* `device_alarm_init()` at the beginning of the per-device update loop. -This will only clear the alarms for the current device, -* `device_alarm_commit()` at the end of the per-device update loop. -This will flush the current alarms for the current device, -* also `device_alarm_init()` at the end of the per-device update loop. -This will clear the current alarms, and ensure that this buffer will not -be considered by other subsequent devices, -* `alarm_commit()` at the end of the main update loop, for the whole -daisychain. This will take care of publishing or not the "ALARM" flag -in the main ups.status (`device.0`, root collection). -====== diff --git a/docs/design.txt b/docs/design.txt index 9655f01..4e39eca 100644 --- a/docs/design.txt +++ b/docs/design.txt @@ -1,7 +1,7 @@ NUT design document =================== -This software is designed around a layered scheme with drivers, a +This software is designed around a layered scheme with drivers, a server and clients. These layers communicate with text-based protocols for easier maintenance and diagnostics. @@ -26,7 +26,7 @@ From the driver ~~~~~~~~~~~~~~~ The core of all DRIVERS maintains internal storage for every variable -that is known along with the auxiliary data for those variables. It +that is known along with the auxiliary data for those variables. It sends updates to this data to any process which connects to the Unix domain socket. @@ -39,7 +39,7 @@ The SERVER will connect to the socket of each DRIVER and will request a dump at that time. It retains this data in local storage for later use. It continues to listen on the socket for additional updates. -This protocol is documented in link:sock-protocol.txt[]. +This protocol is documented in sock-protocol.txt. From the server ~~~~~~~~~~~~~~~ @@ -50,31 +50,28 @@ immediately. When a request for data arrives from a CLIENT, the SERVER looks through the internal storage for that UPS and returns the requested data if it is available. -The format for requests from the CLIENT is documented in link:protocol.txt[]. +The format for requests from the CLIENT is documented in protocol.txt. Instant commands ---------------- -"Instant commands" is the term given to a set of actions that result in +Instant commands is the term given to a set of actions that result in something happening to the UPS. Some of the common ones are -`test.battery.start` to initiate a battery test and `test.panel.start` to +test.battery.start to initiate a battery test and test.panel.start to test the front panel of the UPS. They are passed to the SERVER from a CLIENT using an authenticated network connection. The SERVER first checks to make sure that the instant -command is valid for the DRIVER. If it's supported, a message is sent +command is valid for the DRIVER. If it's supported, a message is sent via a socket to the DRIVER containing the command and any auxiliary information. At this point, there is no confirmation to the SERVER of the command's execution. This is (still) planned for a future release. This has been delayed since returning a response involves some potentially interesting -timing issues. Remember that `upsd` services clients in a round-robin +timing issues. Remember that upsd services clients in a round-robin fashion, so all queries must be lightweight and speedy. -NOTE: FIXME: Wasn't "TRACKING" mechanism for "INSTCMD/SET VAR" introduced -to address just this? See https://github.com/networkupstools/nut/pull/659 - Setting variables ----------------- @@ -91,9 +88,6 @@ Like the instant commands, there is currently no acknowledgement of the command's completion from the DRIVER. This, too, is planned for a future release. -NOTE: FIXME: Wasn't "TRACKING" mechanism for "INSTCMD/SET VAR" introduced -to address just this? See https://github.com/networkupstools/nut/pull/659 - Example data path ----------------- @@ -103,24 +97,24 @@ delivering the alpha message to the admin. 1. EQUIPMENT reports on battery by setting flag in status register -2. DRIVER notices this flag and stores it in the `ups.status` variable as +2. DRIVER notices this flag and stores it in the ups.status variable as OB. This update gets pushed out to any listeners via the sockets. -3. SERVER `upsd` sees activity on the socket, reads it, parses it, and - commits the new data to its local version of the status variable. +3. SERVER upsd sees activity on the socket, reads it, parses it, and + commits the new data to its local version of the status variable. -4. CLIENT `upsmon` does a routine poll of SERVER for `ups.status` and - gets `OB`. +4. CLIENT upsmon does a routine poll of SERVER for "ups.status" and + gets "OB". -5. CLIENT `upsmon` then invokes its `NOTIFYCMD` which is `upssched`. +5. CLIENT upsmon then invokes its NOTIFYCMD which is upssched. -6. `upssched` starts up a daemon to handle a timer which will expire about +6. upssched starts up a daemon to handle a timer which will expire about 30 seconds into the future. 7. 30 seconds later, the timer expires since the UPS is still on battery, - and so `upssched` calls the `CMDSCRIPT` which is `upssched-cmd`. + and upssched calls the CMDSCRIPT upssched-cmd. -8. `upssched-cmd` parses the args and calls `sendmail`. +8. upssched-cmd parses the args and calls sendmail. 9. Avian carriers, smoke signals, SMTP, and some magic result in the message getting from the pager company's gateway to a transmitter @@ -128,66 +122,66 @@ delivering the alpha message to the admin. This scenario requires some configuration, obviously: -1. There's an UPS driver running. +1. There's a UPS driver running. (Whatever applies for the hardware) -2. `upsd` has a valid UPS entry in 'ups.conf' for this UPS. +2. upsd has a valid UPS entry in ups.conf for this UPS. [myups] driver = nutupsdrv port = /dev/ttySx -3. `upsd` has a valid user for `upsmon` in 'upsd.users' file. +3. upsd has a valid user for upsmon in upsd.users. [monuser] password = somepass - upsmon primary + upsmon master -4. `upsmon` is set to monitor this UPS with this user in 'upsmon.conf' file. +4. upsmon is set to monitor this UPS in upsmon.conf. + + MONITOR myups@localhost 1 monuser somepass master - MONITOR myups@localhost 1 monuser somepass primary - -5. `upsmon` is set to `EXEC` the `NOTIFYCMD` for the `ONBATT` condition in - 'upsmon.conf' file. +5. upsmon is set to EXEC the NOTIFYCMD for the ONBATT condition in + upsmon.conf. NOTIFYFLAG ONBATT EXEC -6. `upsmon` calls `upssched` as the `NOTIFYCMD` in 'upsmon.conf' file. +6. upsmon calls upssched as the NOTIFYCMD in upsmon.conf. NOTIFYCMD /path/to/upssched -7. `upssched` has a 30 second timer for `ONBATT` in 'upssched.conf' file. +7. upssched has a 30 second timer for ONBATT in upssched.conf. AT ONBATT * START-TIMER upsonbatt 30 -8. `upssched` calls `upssched-cmd` as the `CMDSCRIPT` in 'upssched.conf'. +8. upssched calls upssched-cmd as the CMDSCRIPT in upssched.conf. CMDSCRIPT /path/to/upssched-cmd -9. `upssched-cmd` knows what to do with `upsonbatt` keyword as its first - argument (a quick `case..esac` construct, see the examples) +9. upssched-cmd knows what to do with "upsonbatt" as its first argument + (A quick case..esac construct, see the examples) History ------- The oldest versions of this software (1998) had no separation between -the driver and the network server, and only supported the latest APC +the driver and the network server and only supported the latest APC Smart-UPS hardware as a result. The network protocol used brittle binary structs. This had numerous bad implications for compatibility and portability. After the driver and server were separated, data was shared through the state file concept. Status was written into a static array (the "info -array") by drivers, and that array was stored on disk. The `upsd` would +array") by drivers, and that array was stored on disk. upsd would periodically read that file into a local copy of that array. Shared memory mode was added a bit later, and that removed some of the lag from the status updates. Unfortunately, it didn't have any locking originally, and the possibility for corruption due to races existed. -`mmap()` support was added at some point after that, and became the -default. The drivers and `upsd` would `mmap()` the file into memory and +mmap() support was added at some point after that, and became the +default. The drivers and upsd would mmap() the file into memory and read or write from it. Locking was done using the state file as the token, so contention problems were avoided. This method was relatively quick, but it involved at least 3 copies of the data (driver, disk/mmap, @@ -200,13 +194,12 @@ connections and push updates asynchronously to any listeners. They also recognize a few commands. Drivers also dampen updates, and only push them out when something actually changes. -As a result, `upsd` no longer has to poll any files on the disk, and can -just `select()` all of its file descriptors (fds) and wait for activity. -When one of them is active, it reads the fd and parses the results. -Updates from the hardware now get to `upsd` about as fast as they possibly -can. +As a result, upsd no longer has to poll any files on the disk, and can +just select() all of its fds and wait for activity. When one of them is +active, it reads the fd and parses the results. Updates from the +hardware now get to upsd about as fast as they possibly can. -Drivers used to call `setinfo()` to change the local array, and then would -call `writeinfo()` to push the array onto the disk, or into the +Drivers used to call setinfo() to change the local array, and then would +call writeinfo() to push the array onto the disk, or into the mmap/shared memory space. This introduced a lag since many drivers poll quite a few variables during an update. diff --git a/docs/developer-guide.txt b/docs/developer-guide.txt index 5cd8f2c..7b0a823 100644 --- a/docs/developer-guide.txt +++ b/docs/developer-guide.txt @@ -73,19 +73,18 @@ This mode allows to simulate any kind of devices, even non existing ones. Using this method, you can either replay a real life sequence, <>, or directly interact -through `upsrw` or by editing the device file, to modify the variables' -values. +through upsrw or by editing the device file, to modify the variables values. Here is an example to setup a device simulation: - install NUT as usual, if not already done -- get a simulation file (`.dev`) or sequence (`.seq`), or generate one using - the <>. Sample files are provided in the - `data` directory of the NUT source. You can also download these from - the development repository, such as the - link:https://github.com/networkupstools/nut/raw/master/data/evolution500.seq[evolution500.seq]. -- copy the simulation file to your sysconfig directory, like `/etc/nut` - or `/etc/ups` +- get a simulation file (.dev) or sequence (.seq), or generate one using the +<>. Sample files are provided in the 'data' +directory of the NUT source. You can also download these from the development +repository, such as the +link:http://anonscm.debian.org/viewvc/nut/trunk/data/evolution500.seq?revision=2778&view=co[evolution500.seq]. +- copy the simulation file to your sysconfig directory, like /etc/nut or +/etc/ups - configure NUT for simulation (linkman:ups.conf[5]): + [dummy] @@ -93,7 +92,7 @@ Here is an example to setup a device simulation: port = evolution500.dev desc = "dummy-ups in dummy mode" + -- now start NUT, at least `dummy-ups` and `upsd`: +- now start NUT, at least dummy-ups and upsd: + $ upsdrvctl start dummy $ upsd @@ -103,15 +102,15 @@ Here is an example to setup a device simulation: $ upsc dummy ... + -- you can also use `upsrw` to modify the data in memory: +- you can also use upsrw to modify the data: + $ upsrw -s ups.status="OB LB" -u user -p password dummy + -- or directly edit your copy of `/etc/nut/evolution500.seq`. - In this case, modification will only apply according to the `TIMER` - events and the current position in the sequence. +- or directly edit /etc/nut/evolution500.seq. In this case, modification will +only apply according to the TIMER events and the current position in the +sequence. -For more information, refer to linkman:dummy-ups[8] manual page. +For more information, refer to linkman:dummy-ups[8] manual page. [[dev-recording]] @@ -119,11 +118,11 @@ For more information, refer to linkman:dummy-ups[8] manual page. Device recording ---------------- -To complete `dummy-ups`, NUT provides a device recorder script called -`nut-recorder.sh` and located in the 'tools/' directory of the +To complete dummy-ups, NUT provides a device recorder script called +'nut-recorder.sh' and located in the 'tools/' directory of the NUT source tree. -This script uses `upsc` to record device information, and stores +This script uses 'upsc' to record device information, and stores these in a differential fashion every 5 seconds (by default). Its usage is the following: @@ -135,8 +134,8 @@ For example, to record information from the device 'myups' every 10 seconds: nut-recorder.sh myups@localhost myups.seq 10 During the recording, you will want to generate power events, such as power -failure and restoration. These will be tracked in the simulation files, and -be eventually be replayed by the <> driver. +failure and restoration. These will be tracked in the simulation files, and be +eventually be replayed by the <> driver. NUT core development and maintenance @@ -160,14 +159,8 @@ Appendix A: NUT command and variable naming scheme include::nut-names.txt[] -[[daisychain]] -Appendix B: NUT daisychain support notes -======================================== - -include::daisychain.txt[] - [[lib-info]] -Appendix C: NUT libraries complementary information +Appendix B: NUT libraries complementary information =================================================== include::../lib/README[] diff --git a/docs/developers.txt b/docs/developers.txt index 11f8daa..bc555b4 100644 --- a/docs/developers.txt +++ b/docs/developers.txt @@ -4,71 +4,70 @@ Information for developers This document is intended to explain some of the more useful things within the tree, and provide a standard for working on the code. -General stuff -- common subdirectory ------------------------------------- +General stuff - common subdirectory +----------------------------------- String handling ~~~~~~~~~~~~~~~ -Use `snprintf()`. It's even provided with a compatibility module if the +Use snprintf(). It's even provided with a compatibility module if the target system doesn't have it natively. -If you use `snprintf()` to load some value into a buffer, make sure you +If you use snprintf() to load some value into a buffer, make sure you provide the format string. Don't use user-provided format strings, since that's an easy way to open yourself up to an exploit. -Don't use `strcat()`. We have a neat wrapper for `snprintf()` called -`snprintfcat()` that allows you to append to `char *` with a format -string and all the usual string length checking of `snprintf()` routine. +Don't use strcat(). We have a neat wrapper for snprintf() called snprintfcat() +that allows you to append to char * with a format string and all the usual +string length checking of snprintf(). Error reporting ~~~~~~~~~~~~~~~ -Don't call `syslog()` directly. Use `upslog_with_errno()` and `upslogx()`. +Don't call syslog() directly. Use upslog_with_errno() and upslogx(). They may write to the syslog, stderr, or both as appropriate. This means you don't have to worry about whether you're running in the background or not. -The `upslog_with_errno()` routine prints your message plus the string -expansion of `errno`. The `upslogx()` just prints the message. +upslog_with_errno prints your message plus the string expansion of +errno. upslogx just prints the message. -`fatal_with_errno()` and `fatalx()` work the same way, but they -also `exit(EXIT_FAILURE)` afterwards. Don't call `exit()` directly. +fatal_with_errno and fatalx work the same way, but they +exit(EXIT_FAILURE) afterwards. Don't call exit() directly. Debugging information ~~~~~~~~~~~~~~~~~~~~~ -The `upsdebug_with_errno()`, `upsdebugx()`, `upsdebug_hex()` and -`upsdebug_ascii()` routines use the global `nut_debug_level`, so you -don't have to mess around with `printf()`'s and `if`'s yourself. -Use them. +upsdebug_with_errno(), upsdebugx(), upsdebug_hex() and upsdebug_ascii() +use the global `nut_debug_level` so you don't have to mess around with +printf()s yourself. Use them. Memory allocation ~~~~~~~~~~~~~~~~~ -`xmalloc()`, `xcalloc()`, `xrealloc()` and `xstrdup()` all check the -results of the base calls before continuing, so you don't have to. -Don't use the raw calls directly. +xmalloc, xcalloc, xrealloc and xstrdup all check the results of the base +calls before continuing, so you don't have to. Don't use the raw calls +directly. Config file parsing ~~~~~~~~~~~~~~~~~~~ -The configuration parser, called `parseconf`, is now up to its fourth +The configuration parser, called parseconf, is now up to its fourth major version. It has multiple entry points, and can handle many different jobs. It's usually used for parsing files, but it can also take input a line at a time or even a character at a time. -You must initialize a context buffer with `pconf_init()` before using any -other `parseconf` function. `pconf_encode()` is the only exception, since -it operates on a buffer you supply and is an auxiliary function. +You must initialize a context buffer with pconf_init before using any +other parseconf function. pconf_encode is the only exception, since it +operates on a buffer you supply and is an auxiliary function. Escaping special characters and quoting multiple-word elements is all handled by the state machine. Using the same code for all config files avoids code duplication. NOTE: this does not apply to drivers. Driver authors should use the -`upsdrv_makevartable()` scheme to pick up values from 'ups.conf' file. -Drivers should not have their own config files. +upsdrv_makevartable() scheme to pick up values from ups.conf. Drivers +should not have their own config files. Drivers may have their own data files, such as lists of hardware, mapping tables, or similar. The difference between a data file and a @@ -79,13 +78,15 @@ hardware support to a driver without recompiling. vs. ~~~~~~~~~~~~~~~~~~~~~~~~~ -This is already handled by autoconf, so just `#include "timehead.h"` and -you will get the right headers on every system. +This is already handled by autoconf, so just include "timehead.h" and you +will get the right headers on every system. -Device drivers -- main.c ------------------------- +Device drivers - main.c +----------------------- -The device drivers use `main.c` as their core. +The device drivers use main.c as their core. The only exceptions are the +HAL-based drivers, which use the same dstate function calls while integrating +with the DBUS event loop. To write a new driver, you create a file with a series of support functions that will be called by main. These all have names that start @@ -93,7 +94,7 @@ with `upsdrv_`, and they will be called at different times by main depending on what needs to happen. See the <> for information on writing -drivers, and also refer to the skeletal driver in `skel.c`. +drivers, and also refer to the skeletal driver in skel.c. Portability ----------- @@ -109,9 +110,9 @@ There are still older systems out there that don't do C++ style comments. -------------------------------------- Newer versions of gcc allow you to declare a variable inside a function -after code, somewhat like the way C++ operates, like this: +somewhat like the way C++ operates, like this: -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- function do_stuff(void) { check_something(); @@ -120,322 +121,18 @@ function do_stuff(void) a = do_something_else(); } -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- While this will compile and run on these newer versions, it will fail miserably for anyone on an older system. That means you must not use -it. `gcc` only warns about this with `-pedantic` flag. - -Another feature that does not work on some compilers (e.g. conforming -to "ANSI C"/C89/C90 standard) is initial variable declaration inside a -'for loop' block, like this: --------------------------------------------------------------------------------- -function do_stuff(void) -{ - /* This should declare "int i;" first, then use it in "for" loop: */ - for (int i = 0; i < INT_MAX; ++i) { ... } - - /* Additional loops cause also an error about re-declaring a variable: */ - for (int i = 10; i < 15; ++i) { ... } -} --------------------------------------------------------------------------------- - -TIP: At this point NUT is expected to work correctly when built with a -C99 (or rather GNU99 on many systems) or newer standard. - -The NUT codebase may build in a mode without warnings made fatal on C89 -(GNU89), but the emitted warnings indicate that those binaries may crash. -By the end of 2021, NUT codebase has been revised to pass GNU and strict-C -mode builds with C89 standard with the GCC toolkit (and on systems that do -have the newer features in libraries, just hide them in standard headers); -however CLANG toolkit is more restrictive about the C99+ syntax used. -If somebody in the community requires to build and run NUT on systems -that old, pull requests to fix the offending coding issues are welcome. - -Note also that the NUT codebase currently relies on certain features, -such as the printf format modifiers for `(s)size_t`, use of `long long`, -some nuances about structure/array initializers, variadic macros for -debugging, etc. that a pedantic C90 mode compilation warns is not part -of the standard but a GNU extension (and part of C99 and newer standard -revisions). Many of the "offences" against the older standard actually -come from system and third-party header files. - -That said, the NUT CI farm does run non-regression builds with GNU C89 -and strict C89 standard revisions and minimal passing warnings level, -to ensure that codebase is and remains at least basically compliant. - -Continuous Integration and Automated Builds -------------------------------------------- - -To ease and automate the build scenarios which were deemed important for -quality assurance and non-regression checks of NUT, several solutions -were introduced over time. - -ci_build.sh -^^^^^^^^^^^ - -This script was originally introduced (following ZeroMQ/ZProject example) -to automate CI builds, by automating certain scenarios driven by exported -environment variables to set particular `configure` options and `make` -some targets (chosen by the `BUILD_TYPE` envvar). It can also be used -locally to avoid much typing to re-run those scenarios during development. - -Developers can directly use the scripts involved in CI builds to fix -existing code on their workstations or to ensure support for new -compilers and C standard revisions, e.g. save a local file like this -to call the common script with pre-sets: - - $ cat _fightwarn-gcc10-gnu17.sh - #!/bin/sh - - BUILD_TYPE=default-all-errors \ - CFLAGS="-Wall -Wextra -Werror -pedantic -std=gnu17" \ - CXXFLAGS="-Wall -Wextra -Werror -std=gnu++17" \ - CC=gcc-10 CXX=g++-10 \ - ./ci_build.sh - -...and then execute it to prepare a workspace, after which you can go -fixing bugs file-by-file running a `make` after each save to confirm -your solutions and uncover the next issue to address :-) - -Helpfully, the NUT CI farm build logs report the configuration used for -each executed stage, so if some build combination fails -- you can just -scroll to the end of that section and copy-paste the way to reproduce -an issue locally (on an OS similar to that build case). - -Note that while spelling out sets of warnings can help in a quest to -fix certain bugs during development (if only by removing noise from -classes of warnings not relevant to the issue one is working on), there -is a reasonable set of warnings which NUT codebase actively tries to -be clean about (and checks in CI), detailed in the next section. - -For the `ci_build.sh` usage like above, one can instead pass the setting -via `BUILD_WARNOPT=...`, and require that all emitted warnings are fatal -for their build, e.g.: - - $ cat _fightwarn-clang9-gnu11.sh - #!/bin/sh - - BUILD_TYPE=default-all-errors \ - BUILD_WARNOPT=hard BUILD_WARNFATAL=yes \ - CFLAGS="-std=gnu11" \ - CXXFLAGS="-std=gnu++11" \ - CC=clang-9 CXX=clang++-9 CPP=clang-cpp \ - ./ci_build.sh - -Finally, for refactoring effort geared particularly for fighting the -warnings which exist in current codebase, the script contains some -presets (which would evolve along with codebase quality improvements) -as `BUILD_TYPE=fightwarn-gcc`, `BUILD_TYPE=fightwarn-clang` or plain -`BUILD_TYPE=fightwarn`: - - BUILD_TYPE=fightwarn-clang ./ci_build.sh - -As a rule of thumb, new contributions must not emit any warnings when -built in GNU99 mode with a `minimal` "difficulty" level of warnings. -Technically they must survive the part of test matrix across the several -platforms tested by NUT CI and marked in project settings as required -to pass, to be accepted for a pull request merge. - -Developers aiming to post successful pull requests to improve NUT can -pass the `--enable-warnings` option to the `configure` script in local -builds to see how that behaves and ensure that at least in some set-up -their contribution is viable. Note that different compiler versions and -vendors (gcc/clang/...), building against different OS and third-party -dependencies, with different CPU architectures and different language -specification revisions, might all complain about different issues -- -and catching this in as diverse range of set-ups as possible is why we -have CI tests. - -It can be beneficial for serial developers to set up a local BuildBot, -Travis or a Jenkins instance with a matrix test job, to test their local -git repository branches with whatever systems they have available. - -* https://github.com/networkupstools/nut/issues/823 - -While `autoconf` tries its best to provide portable shell code, sometimes -there are builds of system shell that just fail under stress. If you are -seeing random failures of `./configure` script in different spots with -the same inputs, try telling `./ci_build.sh` to loop configuring until -success (instead of quickly failing), and/or tell `./configure` to use -another shell at least for the system call-outs, with options like these: - - SHELL=/bin/bash CONFIG_SHELL=/bin/bash CI_SHELL_IS_FLAKY=true \ - ./ci_build.sh - -Jenkins CI -^^^^^^^^^^ - -Since mid-2021, the NUT CI farm is implemented by several virtual servers -courteously provided by http://fosshost.org - -These run various operating systems as build agents, and a Jenkins instance -to orchestrate the builds of NUT branches and pull requests on those agents. - -This is driven by `Jenkinsfile-dynamatrix` and a Jenkins Shared Library called -link:https://github.com/networkupstools/jenkins-dynamatrix[jenkins-dynamatrix] -which prepares a matrix of builds across as many operating systems, -bitnesses/architectures, compilers, make programs and C/C++ revisions -as it can -- based on the population of currently available build agents -and capabilities which they expose as agent labels. - -This hopefully means that people interested in NUT can contribute to the -build farm (and ensure NUT is and remains compatible with their platform) -by running a Jenkins Swarm agent with certain labels, which would dial -into https://ci.networkupstools.org/ controller. Please contact the NUT -maintainer if you want to participate in this manner. - -The `Jenkinsfile-dynamatrix` recipe allows NUT CI farm to run different sets -of build scenarios based on various conditions, such as the name of branch -being built (or PR'ed against), changed files (e.g. C/C++ sources vs. just -docs), and some build combinations may be not required to succeed. - -For example, the main development branch and pull requests against it must -cleanly pass all specified builds and tests on various platforms with the -default level of warnings specified in the `configure` script. These are -balanced to not run too many build scenarios overall, but just a quick and -sufficiently representative set. - -As another example, there is special handling for "fightwarn" pattern in -the branch names to run many more builds with varying warning levels and -more variants of intermediate language revisions, and so expose concerns -deliberately missed by default warnings levels in "master" branch builds -(the bar moves over time, as some classes of warnings become extinct from -our codebase). - -Further special handling for branches named like `fightwarn.*89.*` regex -enables more intensive warning levels for a GNU89 build specifically (which -are otherwise disabled as noisy yet not useful for supported C99+ builds), -and is intended to help develop fixes for support of this older language -revision, if anyone would dare. - -Many of those unsuccessful build stages are precisely the focus of the -"fightwarn" effort, and are currently marked as "may fail", so they end -up as "UNSTABLE" (seen as orange bubbles in the Jenkins BlueOcean UI, or -orange cells in the tabular list of stages in the legacy UI), rather than -as "FAILURE" (red bubbles) for build scenarios that were not expected to -fail and usually represent higher-priority problems that would block a PR. - -Developers whose PR builds (or attempts to fix warnings) did not succeed in -some cell of such build matrix, can look at the individual logs of that cell. -Beside indication from the compiler about the failure, the end of log text -includes the command which was executed by CI worker and can be reproduced -locally by the developer, e.g.: ----- -22:26:01 FINISHED with exit-code 2 cmd: ( -22:26:01 [ -x ./ci_build.sh ] || exit -22:26:01 -22:26:01 eval BUILD_TYPE="default-alldrv" BUILD_WARNOPT="hard" \ - BUILD_WARNFATAL="yes" MAKE="make" CC=gcc-10 CXX=g++-10 \ - CPP=cpp-10 CFLAGS='-std=gnu99 -m64' CXXFLAGS='-std=gnu++11 -m64' \ - LDFLAGS='-m64' ./ci_build.sh -22:26:01 ) ----- -or for autotools-driven scenarios (which prep, configure, build and test -in separate stages -- so for reproducing a failed build you should also -look at its configuration step separately): ----- -22:28:18 FINISHED with exit-code 0 cmd: ( [ -x configure ] || exit; \ - eval CC=clang-9 CXX=clang++-9 CPP=clang-cpp-9 CFLAGS='-std=c11 -m64' \ - CXXFLAGS='-std=c++11 -m64' LDFLAGS='-m64' time ./configure ) ----- - -To re-run such scenario locally, you can copy the line from `eval` (but -without the `eval` keyword itself) up to and including the executed script -or tool, into your shell. Depending on locally available compilers, you -may have to tweak the `CC`, `CXX` and `CPP` arguments; note that a `CPP` -may be specified as `/path/to/CC -E` for GCC and CLANG based toolkits -at least, if they lack a standalone preprocessor program (e.g. IntelCC). - -NOTE: While NUT recipes do not currently recognize a separate `CXXCPP`, -it would follow similar semantics. - -Some further details about the NUT CI farm workers are available in -link:config-prereqs.txt[config-prereqs.txt] and -link:ci-farm-lxc-setup.txt[ci-farm-lxc-setup.txt] documents. - -Travis CI -^^^^^^^^^ - -See the `.travis.yml` file in project sources for a detailed list of third -party dependencies and a large matrix of `CFLAGS` and compiler versions -last known to work or to not (yet) work on operating systems available -to that CI solution. - -[NOTE] -====== -The cloud Travis CI offering became effectively defunct for -open-source projects in mid-2021, so the `.travis.yml` file in NUT -codebase is not actively maintained. - -Local private deployments of Travis CI are possible, so if anybody does -use it and has updated markup to share, they are welcome to post PRs. -====== - -The NUT project on GitHub has integration with Travis CI to test a large -set of compiler and option combinations, covering different versions of -gcc and clang, C standards, and requiring to pass builds at least in a -mode without warnings (and checking the other cases where any warnings -are made fatal). - -Pre-set warning options -~~~~~~~~~~~~~~~~~~~~~~~ - -The options chosen into pre-sets that can be selected by `configure` -script options are ones we use for different layers of CI tests. - -Values to note include: - -* `--enable-Werror(=yes/no)` -- make warnings fatal; - -* `--enable-warnings(=.../no)` -- enable certain warning presets: - -** `gcc-hard`, `clang-hard`, `gcc-medium`, `clang-medium`, `gcc-minimal`, - `clang-minimal`, `all` -- actual definitions that are compiler-dependent - (the latter just adds `-Wall` which may be relatively portable); - -** `hard`, `medium` or `minimal` -- if current compiler is detected as - CLANG or GCC, apply corresponding setting from above (or `all` otherwise); - -** `gcc` or `clang` -- apply the set of options (regardless of detected - compiler) with default "difficulty" hard-coded in `configure` script, - to tweak as our codebase becomes cleaner; - -** `yes`/`auto` (also takes effect if `--enable-warnings` is requested - without an `=ARG` part) -- if current compiler is detected as CLANG - or GCC, apply corresponding setting with default "difficulty" from - above (or `all` otherwise). - -Note that for backwards-compatibility reasons and to help filter out -introduction of blatant errors, builds with compilers that claim GCC -compatibility can enable a few easy warning presets by default. This -can be avoided with an explicit argument to `--disable-warnings` (or -`--enable-warnings=no`). - -All levels of warnings pre-sets for GCC in particular do not enforce -the `-pedantic` mode for builds with C89/C90/ANSI standard revision -(as guesstimated by `CFLAGS` content), because nowadays it complains -more about the system and third-party library headers, than about NUT -codebase quality (and "our offenses" are mostly something not worth -fixing in this era, such as the use of `__func__` in debug commands). -If there still are practical use-cases that require builds of NUT on -pre-C99 compiler toolkits, pull requests are of course welcome -- but -the maintainer team does not intend to spend much time on that. - -Hopefully this warnings pre-set mechanism is extensible enough if we -would need to add more compilers and/or "difficulty levels" in the -future. - -Finally, note that such pre-set warnings can be mixed with options -passed through `CFLAGS` or `CXXFLAGS` values to your local `configure` -run, but it is up to your compiler how it interprets the resulting mix. +it. gcc only warns about this with -pedantic. Coding style ------------ This is how we do things: -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- int open_subspace(char *ship, int privacy) { if (!privacy) @@ -446,22 +143,22 @@ int open_subspace(char *ship, int privacy) return secure_channel(ship); } -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- The basic idea is that we try to group things into functions, and then find ways to drop out of them when we can't go any further. There's another way to program this involving a big else chunk and a bunch of braces, and it can be hard to follow. You can read this from top to bottom and have a pretty good idea of what's going on without having to -track too much `{ }` nesting and indenting. +track too much { } nesting and indenting. -We don't really care for `pretentiousVariableNamingSchemes`, but you can +We don't really care for pretentiousVariableNamingSchemes, but you can probably get away with it in your own driver that we will never have to touch. If your function or variable names start pushing important code off the right margin of the screen, expect them to meet the byte chainsaw sooner or later. -All types defined with typedef should end in `_t`, because this is +All types defined with typedef should end in "_t", because this is easier to read, and it enables tools (such as indent and emacs) to display the source code correctly. @@ -479,41 +176,16 @@ non-tab character has appeared on the line must be done by spaces in order for it to remain at the same alignment when someone views tabs at a different widths. -One common example for this is multi-line if condition: - --------------------------------------------------------------------------------- - if (something && - something_else) { --------------------------------------------------------------------------------- - -which may be written without mixing tabs and spaces to indent, as: - --------------------------------------------------------------------------------- - if (something - && something_else - ) { --------------------------------------------------------------------------------- - -Another example is tables of definitions that are better aligned with -(non-leading) spaces at least between names and values not too many -characters wide; it still helps to align the columns with spaces at -offsets divisible by 4 or 8 (consistently for the whole table): - --------------------------------------------------------------------------------- -#define SHORT_MACRO 1 /* flag comment */ -#define SOMETHING_WITH_A_VERY_LONG_NAME 255 /* flag comment */ --------------------------------------------------------------------------------- - -If you write something that uses leading spaces, you may get away with -it in a driver that's relatively secluded. However, if we have to work -on that code, expect it to get reformatted according to the above. +If you write something that uses spaces, you may get away with it in a +driver that's relatively secluded. However, if we have to work on that +code, expect it to get reformatted according to the above. Patches to existing code that don't conform to the coding style being used in that file will probably be dropped. If it's something we really need, it will be grudgingly reformatted before being included. When in doubt, have a look at Linus's take on this topic in the Linux -kernel -- Documentation/CodingStyle. He's done a far better job of +kernel - Documentation/CodingStyle. He's done a far better job of explaining this. Line breaks @@ -521,52 +193,26 @@ Line breaks It is better to have lines that are longer than 80 characters than to wrap lines in random places. This makes it easier to work with tools -such as `grep`, and it also lets each developer choose their own +such as "grep", and it also lets each developer choose their own window size and tab setting without being stuck to one particular choice. Of course, this does not mean that lines should be made unnecessarily long when there is a better alternative (see the note on -`pretentiousVariableNamingSchemes` above). Certainly there should not +pretentiousVariableNamingSchemes above). Certainly there should not be more than one statement per line. Please do not use -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- if (condition) break; -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- but use the following: -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- if (condition) { break; } -------------------------------------------------------------------------------- - -Un-used variables and function arguments -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Whenever a function needs to satisfy a particular API, it can end up -taking arguments that are not used in practice (think a too-trivial -signal handler). While some compilers offer the facility of decorations -like `__attribute__(unused)`, this proved not to be a portable solution. -Also the abilities of newer C++ standard revisions are of no help to -the vast range of existing systems that run NUT today and expect to be -able to do so tomorrow (hence the required C99+ support noted above). - -In NUT codebase we prefer to mark un-used variables explicitly in the -body of the function (or an `#ifdef` branch of its code) using the -`NUT_UNUSED_VARIABLE(varname)` as a routine call inside a function -body, referring to the macro defined in `common.h`. - -To display in a rough example: - -------------------------------------------------------------------------------- - static void signal_X_handler(int signal_X) { - NUT_UNUSED_VARIABLE(signal_X); - /* We have explicitly got nothing to do if we catch signal X */ - return; - } -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- Miscellaneous coding style tools -------------------------------- @@ -586,10 +232,10 @@ possible to set a tab stop to be 3 spaces, rather than the usual 8. (Note that in the saved file, one indentation level will still correspond to one tab stop; the difference is only how the file is rendered on screen). It is even possible to set this on a -per-directory basis, by putting something like this into your `.emacs` +per-directory basis, by putting something like this into your .emacs file: -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- ;; NUT style (defun nut-c-mode () @@ -604,64 +250,29 @@ file: (setq auto-mode-alist (cons '(".*/nut/.*\\.[ch]$". nut-c-mode) auto-mode-alist)) -------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- Finishing touches ~~~~~~~~~~~~~~~~~ -We like code that uses `const` and `static` liberally. If you don't need -to expose a function or global variable to the outside world, `static` is +We like code that uses const and static liberally. If you don't need to +expose a function or global variable to the outside world, static is your friend. If nobody should edit the contents of some buffer that's -behind a pointer, `const` keeps them honest. +behind a pointer, const keeps them honest. -We always compile with `-Wall`, so things like `const` and `static` help you +We always compile with -Wall, so things like const and static help you find implementation flaws. Functions that attempt to modify a constant or access something outside their scope will throw a warning or even fail to compile in some cases. This is what we want. -Switch case fall-through -~~~~~~~~~~~~~~~~~~~~~~~~ - -While C standards allow to write `switch` statements to "fall through" -from handling one case into another, modern compilers frown upon that -practice and spew warnings which complicate detecting real bugs in the -code (and also looking back at some of the cases written decades ago, -it is not trivial to state whether the fall-through was intentional or -really is a bug). - -Compilers which detect such problem usually offer ways to decorate the -code with comments or attributes to keep it quiet it in cases where the -jump is intentional; also C++17 introduces special keywords for that in -the standard. NUT aiming to be portable and independent of compilers as -much as possible, prefers the arguably clearer and standards-based way -of using `goto` into the next intended operation, even though it is a -couple of lines away, e.g.: - - int uppercase = 0; - switch (char_opt) { - case 'U': - uppercase = 1; - goto fallthrough_case_u_option; - case 'u': - fallthrough_case_u_option: - process_u_option(uppercase); - break; - } - -In trivial cases, like falling through to `default` which just returns, -it may be clearer and more maintainable (adding other option cases in -the future) to just `return same_result` in the code block that would -fall through otherwise and avoid `goto` statements altogether. - Spaghetti ~~~~~~~~~ -If you use a `goto` that jumps over long distances (see "Switch case -fall-through" section above), expect us to drop it when our head stops -spinning. It gives us flashbacks to the very old code we wrote. +If you use a goto, expect us to drop it when our head stops spinning. +It gives us flashbacks to the very old code we wrote. We've tried to clean up our act, and you should make the effort -as well. +as well. We're not making a blanket statement about gotos, since everything probably has at least one good use. There are a few cases where a goto @@ -676,18 +287,18 @@ There are parts of the source tree that do not yet conform to these specs. Part of this is due to the fact that the coding style has been evolving slightly over the course of the project. Some of the code you see in these directories is 5 years old, and things have gotten cleaner -since then. Don't worry -- it'll get cleaned up the next time something +since then. Don't worry - it'll get cleaned up the next time something in the vicinity gets a visit. Memory leak checking ~~~~~~~~~~~~~~~~~~~~ We can't say enough good things about valgrind. If you do anything with -dynamic memory in your code, you need to use this. Just compile with -`gcc -g` and start the program inside `valgrind`. Run it through the -suspected area and then exit cleanly. valgrind will tell you if you've -done anything dodgy like freeing regions twice, reading uninitialized -memory, or if you've leaked memory anywhere. +dynamic memory in your code, you need to use this. Just compile with -g +and start the program inside valgrind. Run it through the suspected +area and then exit cleanly. valgrind will tell you if you've done +anything dodgy like freeing regions twice, reading uninitialized memory, +or if you've leaked memory anywhere. For more information, refer to the link:http://valgrind.kde.org[Valgrind] project. @@ -701,24 +312,19 @@ and many people have put a lot of time and energy to improve it. Submitting patches ------------------ -Current preference for suggesting changes is to open a pull request on -GitHub for the https://github.com/networkupstools/nut/ project. +Small patches that arrive in unified format (diff -u) as plain text attachments +with no HTML and a brief summary at the top are the easiest to handle. -For some cases, small patches that arrive by mailing list in unified -format (`diff -u`) as plain text attachments with no HTML and a brief -summary at the top are easy to handle, but sadly also easy to overlook. - -If a patch is sent to the nut-upsdev mailing list, it stands a better -chance of being seen immediately. However, it is likely to be dropped -if any issues cannot be resolved quickly. If your code might not work -for others, or if it is a large change, your best bet is to submit a -pull request or create an +If a patch is sent to the nut-upsdev mailing list, it stands a better chance of +being seen immediately. However, it is likely to be dropped if any issues +cannot be resolved quickly. If your code might not work for others, or if it is +a large change, your best bet is to submit a pull request or create an link:https://github.com/networkupstools/nut/issues[issue on GitHub]. -The issue tracker allows us to track the patches over a longer period -of time, and it is less likely that a patch will fall through the cracks. -Posting a reminder to the developers (via the nut-upsdev list) about a -patch on GitHub is fair game. +The issue tracker allows us to track the patches over a longer period of time, +and it is less likely that a patch will fall through the cracks. Posting a +reminder to the developers (via the nut-upsdev list) about a patch on GitHub is +fair game. Patch cohesion -------------- @@ -734,7 +340,7 @@ evaluated separately, assuming the core developers care enough to do that instead of just dropping it. If you have to make big changes in lots of places, send multiple -patches -- one per item. +patches - one per item. The finishing touches: manual pages and device entry in HCL ----------------------------------------------------------- @@ -749,57 +355,33 @@ skeletal man page that will probably miss many of the finer points of the driver and hardware. The same remark goes for device entries: if you add support for new models, -please remember to also complete the hardware compatibility list, present -in link:data/driver.list.in[]. This will be used to generate both textual, -static HTML and dynamic searchable HTML for the website. - -Finally, don't forget about fame and glory: if you added or substantially -updated a driver, your copyright belongs in the heading comment (along -with existing ones). For vendor backed (or sponsored) contributions we -welcome an entry in the link:docs/acknowledgements.txt[] file as well, -to track and know the industry players who help make NUT better and more -useful. - -It is nice to update the link:NEWS[] file for significant development -to be seen as part of next release, as well as to update the -link:UPGRADING[] file for potentially breaking changes and similar -heads-up notes for third-party teams (distribution packagers, clients -and bindings, etc.) +remember to also complete the hardware compatibility list, present +in data/driver.list.in. This will be used to generate both textual, static +HTML and dynamic searchable HTML for the website. Source code management ---------------------- -We currently use a Git repository hosted at GitHub to track changes to -the NUT source code. This allows you to clone the repository (or fork, -in GitHub parlance), make changes, and post them online for peer review -prior to integration. +We currently use a Git repository hosted at GitHub (with a mirror at Alioth) to track +changes to the NUT source code. This allows you to clone the repository (or +fork, in GitHub parlance), make changes, and post them online for review prior +to integration. -To obtain permission to commit directly to the common upstream NUT repository, -you must be prepared to spend a fair amount of time contributing to the -NUT codebase. Most developers will be well served by committing to their -own forked Git repository (preferably in a uniquely named branch for each -new contribution), and having the NUT team merge their changes using pull -requests. +To obtain permission to commit directly to the master NUT repository, you must +be prepared to spend a fair amount of time contributing to the NUT codebase. +Most developers will be well served by committing to their own Git repository, +and having the NUT team merge their changes. -Git offers a little more flexibility than the +svn update+ command. -You may fetch other developers' changes into your repository, but hold -off on actually combining them with your branch until you have compared -the two branches (for instance, with `gitk --all`). Git also allows you -to accumulate more than one commit worth of changes before pushing to -another repository. This allows development to continue without a constant -network connection. +Git offers a little more flexibility than the +svn update+ command. You may +fetch other developers' changes from SVN into your repository, but hold off on +actually combining them with your branch until you have compared the two +branches (for instance, with `gitk --all`). Git also allows you to accumulate +more than one commit worth of changes before pushing to another repository. -For a quick change to a file in the Git working copy, you can use -`git diff` to generate a patch to send to the nut-upsdev mailing list. -If you have more extensive changes, you can use `git format-patch` on -a complete commit or branch, and send the resulting series of patches -to the list. - -If you use GitHub's web-based editor to make changes, it tends to create -lots of small commits, one per change per file. Unless there is reason to -keep the intermediate history, we will probably collapse (or "squash" in -Git parlance) the entire branch into one commit with a `git rebase -i` -before merging. +For a quick change to a file in the Git working copy, you can use `git diff` to +generate a patch to send to the nut-upsdev mailing list. If you have more +extensive changes, you can use `git format-patch` on a complete commit or +branch, and send the resulting series of patches to the list. The link:https://git.wiki.kernel.org/index.php/GitSvnCrashCourse[GitSvnCrashCourse] wiki page has some useful information for long-time users of Subversion. @@ -815,38 +397,46 @@ or git clone https://github.com/networkupstools/nut.git -if it is necessary to get around a pesky firewall that blocks the native -Git protocol. +if it is necessary to get around a pesky firewall that blocks the native Git +protocol. For a quicker checkout (when you don't need the entire repository history), you can limit the depth of the clone: git clone --depth 1 git://github.com/networkupstools/nut.git +In case the GitHub repository is temporarily unavailable for any reason, we +also plan to push to Alioth's +link:https://alioth.debian.org/scm/?group_id=30602[Git server] as well. You can +add a remote reference to your local repository: + + cd path/to/nut + git remote add -f alioth git://anonscm.debian.org/nut/nut.git + Mercurial (hg) access ~~~~~~~~~~~~~~~~~~~~~ -There are those who prefer the simplicity and self-consistency of the -Mercurial SCM client over the hodgepodge of unique commands which make -up Git. Rather than debate the merits of each system, we will gently -guide you towards the link:http://hg-git.github.com/[hg-git project] -which would theoretically be a transparent bridge between the central -Git repository, and your local Mercurial working copy. +There are those who prefer the simplicity and self-consistency of the Mercurial +SCM client over the hodgepodge of unique commands which make up Git. Rather +than debate the merits of each system, we will gently guide you towards the +link:http://hg-git.github.com/[hg-git project] which would theoretically be a +transparent bridge between the central Git repository, and your local Mercurial +working copy. -Other tools for hg/git interoperability are sure to exist. We would -welcome any feedback about this process on the nut-upsdev mailing list. +Other tools for hg/git interoperability are sure to exist. We would welcome any +feedback about this process on the nut-upsdev mailing list. Subversion (SVN) access ~~~~~~~~~~~~~~~~~~~~~~~ If you prefer to check out the NUT source code using an SVN client, GitHub has a link:https://github.com/blog/966-improved-subversion-client-support[SVN -interface to Git repositories] hosted on their servers. You can fork a copy -of the NUT repository and commit to your fork with SVN. +interface to Git repositories] hosted on their servers. You can fork a copy of +the NUT repository and commit to your fork with SVN. -Be aware that the examples in the GitHub blog post might result in a -checkout that includes all of the current branches, as well as the trunk. -You are most likely interested in a command line similar to the following: +Be aware that the examples in the GitHub blog post might result in a checkout +that includes all of the current branches, as well as the trunk. You are most +likely interested in a command line similar to the following: svn co https://github.com/networkupstools/nut/trunk nut-trunk-svn @@ -857,13 +447,12 @@ The NUT repository generally only holds files which are not generated from other files. This prevents spurious differences from being recorded in the repository history. -If you add a driver, it is recommended that you add the driver executable -name to the `.gitignore` file in that directory. Similarly, files generated -from `*.in` and `*.am` source templates should be ignored as well. -We try to include a number of generated files in the tarball releases with -`make dist` hooks in order to minimize the number of dependencies for end -users, but the assumption is that a developer can install the packages -needed to regenerate those files. +If you add a driver, it is recommended that you add the driver executable name +to the .gitignore file in that directory. Similarly, files generated from *.in +and *.am sources should be ignored as well. We try to include a number of +generated files in the tarball releases with `make dist` hooks in order to +minimize the number of dependencies for end users, but the assumption is that +a developer can install the packages needed to regenerate those files. Commit message formatting ------------------------- @@ -871,11 +460,11 @@ Commit message formatting From the `git commit` man page: [quote] -Though not required, it's a good idea to begin the commit message with a -single short (less than 50 character) line summarizing the change, followed -by a blank line and then a more thorough description. The text up to the -first blank line in a commit message is treated as the commit title, and -that title is used throughout git. +Though not required, it’s a good idea to begin the commit message with a single +short (less than 50 character) line summarizing the change, followed by a blank +line and then a more thorough description. The text up to the first blank line +in a commit message is treated as the commit title, and that title is used +throughout git. If your commit is just a change to one component, such as the HCL, upsd or a specific driver, prefix your commit message in a way that matches similar @@ -892,38 +481,49 @@ best to add some context such as the commit title or a date. You may notice that some older commits have `[[SVN:####]]` tags and Fossil-ID footers. These were lifted from the old SVN commit messages using reposurgeon, -and should *not* be used as a guide for future commits. +and should not be used as a guide for future commits. Repository etiquette and quality assurance ------------------------------------------ -For developers who have commit access to the common upstream NUT repository: -Please keep the Git "master" branch in working condition at all times. -The "master" branch may be used to generate daily tarballs, it provides the -baseline for new contributions, and occasionally is tagged for a new release. -It should not contain broken code. If you need to commit incremental changes -that leave the system in a broken state, please do so in a separate branch -and merge the changes back into "master" once they are complete. - -To help keep the codebase ever-green, we run a number of CI tests and builds -in various conditions, including older compilers, different C/C++ standard -revisions, and an assortment of operating systems; a section below elaborates -on this in more detail. +Please keep the Git master branch in working condition at all times. The +master branch may be used to generate daily tarballs, and should not contain +broken code. If you need to commit incremental changes that leave the system +in a broken state, please do so in a separate branch and merge the changes +back into master once they are complete. You are encouraged to use `git rebase -i` on your private Git branches to separate your changes into <<_patch_cohesion,logical changes>>. -From there, you can generate patches for the issue tracker, or the nut-upsdev -mailing list. +From there, you can generate patches for the issue tracker, or the nut-upsdev list. Note that once you rebase a branch, anyone else who has a copy of this branch will need to rebase on top of your rebased branch. Obviously, this hinders collaboration. In this case, we recommend that you rebase only in your private repository, and push when things are ready for discussion. Merging instead of rebasing will help with collaboration, but please do not turn the repository -history into a pile of spaghetti by merging unnecessarily. (Test merges can be -done on integration branches, which can be discarded if the merge is trivial.) -Be sure that your commit messages are descriptive when merging. +history into a pile of spaghetti by merging unnecessarily. Be sure that your +commit messages are descriptive when merging. + +Before pushing your commits upstream, please remember to run +make +distcheck-light+. This checks that the Makefiles are not broken, that all the +relevant files are distributed, and that there are no compilation or +installation errors. + +Running +make distcheck-light+ is especially important if you have added or +removed files, or updated configure.in or some Makefile.am. Remember: simply +adding a file to Git does not mean it will be distributed. To distribute a +file, you must update the corresponding Makefile.am. + +There is also +make distcheck+, which runs an even stricter set of +tests than +make distcheck-light+, but will not work unless you have all the +optional libraries and features installed. + +You may create as many branches as you like in your local Git repository. When +using Git, our preferred way to combine small changes with the upstream +upstream repository is to use `git rebase` on your local branch. This is +equivalent to treating your branch as a series of patches, and re-applying your +patches on top of the upstream changes. If you haven't created a commit out of your local changes yet, and you want to fetch the latest code, you can also use +git stash+ before pulling, then +git @@ -931,7 +531,7 @@ stash pop+ to apply your saved changes. Here is an example workflow: ------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- git clone -o central git://github.com/networkupstools/nut.git cd nut @@ -958,75 +558,9 @@ Here is an example workflow: # Publish your branch to your GitHub repository: git push username my-new-feature ------------------------------------------------------------------------------- +-------------------------------------------------------------------------------- If you are new to Git, but are familiar with SVN, the link:http://git-scm.com/course/svn.html[following link] may be of use. -[[building]] -Building the Code ------------------ -For a developer, the NUT build process starts with `./autogen.sh`. - -This script generates the `./configure` script that end users typically -invoke to build NUT. If you are making a number of changes to the NUT -source tree, configuring with the `--enable-maintainer-mode` flag will -ensure that after you change a `Makefile.am`, nearby `Makefile.in` and -`Makefile` get regenerated. At a minimum, you will need at least: - -* autoconf -* automake -* libtool -* Python -* Perl - -[NOTE] -====== -See the link:config-prereqs.txt[] for better detailed package lists for -different operating systems. - -See `ci_build.sh` for automating many practical scenarios, for easier -iterations. -====== - -Even if you do not use your distribution's packages of NUT, installing the -distribution's list of build dependencies for NUT can reduce the amount of -trial-and-error when installing dependencies. For instance, in Debian, you -can run `apt-get build-dep nut` to install all of the auto* tools as well -as any development libraries and headers. - -After running `./autogen.sh`, you can pass your local configuration -options to `./configure` and run `make` from the top-level directory. -To avoid the need for root privileges when testing new NUT code, you -may wish to use `--prefix=$HOME/local/nut --with-statepath=/tmp`. -You can also keep compilation times down by only building the driver -which you are currently working on: `--with-drivers=driver1,dummy-ups`. - -Before pushing your commits upstream, please run `make distcheck-light`. -This checks that the Makefiles are not broken, that all the relevant files -are distributed, and that there are no compilation or installation errors. -Note that unless you specifically pass `--with-doc=skip` to `configure`, -this requires all of the dependencies necessary to build the documentation -to be locally installed on your system, including `asciidoc`, `a2x`, -`xsltproc`, `dblatex` and any additional XSL stylesheets. - -Running `make distcheck-light` is especially important if you have added or -removed files, or updated `configure.ac` or some `Makefile.am` file. -Remember: simply adding a file to Git does not mean it will be distributed. -To distribute a file, you must update the corresponding `Makefile.am` with -`EXTRA_DIST` entry and possibly other recipe handling. - -There is also `make distcheck`, which runs an even stricter set of -tests than `make distcheck-light`, but will not work unless you have all -of the optional third-party libraries and features installed. - -Finally note, that since 2017 the GitHub upstream project is monitored -by Travis CI (in addition to earlier multi-platform buildbots which -occasionally do not work), replaced since 2021 by a dedicated NUT CI farm. -This means that if your posted improvements are based on current NUT -"master" branch, the resulting pull request should get tested for a number of -scenarios automatically. If your code adds a substantial feature, consider -extending the `Jenkinsfile-dynamatrix` and/or `ci_build.sh` scripts in the -workspace root to add another `BUILD_TYPE` to the matrix of tests run in -parallel. diff --git a/docs/docinfo.xml b/docs/docinfo.xml new file mode 100644 index 0000000..a8650ec --- /dev/null +++ b/docs/docinfo.xml @@ -0,0 +1,10 @@ + + + 2.6.0 + 2011-01-14 + + + First release of AsciiDoc documentation for Network UPS Tools (NUT). + + + diff --git a/docs/docinfo.xml.in b/docs/docinfo.xml.in deleted file mode 100644 index ed3faaf..0000000 --- a/docs/docinfo.xml.in +++ /dev/null @@ -1,23 +0,0 @@ - - - - - @PACKAGE_VERSION@ - @now@ - - - Current release of Network UPS Tools (NUT). - - - - - - 2.6.0 - 2011-01-14 - - - First release of AsciiDoc documentation for Network UPS Tools (NUT). - - - - diff --git a/docs/documentation.txt b/docs/documentation.txt index c588e12..280f945 100644 --- a/docs/documentation.txt +++ b/docs/documentation.txt @@ -3,25 +3,20 @@ Documentation ============= endif::website[] - User Documentation ------------------ ifdef::website[] - FAQ - Frequently Asked Questions (link:docs/FAQ.html[online]) (link:docs/FAQ.pdf[PDF]) - NUT User Manual (link:docs/user-manual.chunked/index.html[online]) (link:docs/user-manual.pdf[PDF]) -- Cables information (link:cables.html[online]) (link:docs/cables.pdf[PDF]) +- Cables information (link:cables.html[online]) (link:cables.pdf[PDF]) - link:docs/man/index.html#User_man[User manual pages] -- link:ddl/index.html#_supported_devices[Devices Dumps Library (DDL)]: Provides information on how devices are supported -- link:docs/solaris-usb.html[Notes on NUT monitoring of USB devices in Solaris and related operating systems] endif::website[] ifndef::website[] - link:../FAQ.html[FAQ - Frequently Asked Questions] - linkdoc:user-manual[NUT user manual] - <> - link:../man/index.html#User_man[User manual pages] -- link:http://www.networkupstools.org/ddl/index.html#_supported_devices[Devices Dumps Library (DDL)]: Provides information on how devices are supported -- link:../solaris-usb.html[Notes on NUT monitoring of USB devices in Solaris and related operating systems] endif::website[] Developer Documentation @@ -33,7 +28,6 @@ ifdef::website[] - link:ups-protocols.html[UPS protocols library] - link:docs/man/index.html#Developer_man[Developer manual pages] - link:nut-qa.html[NUT Quality Assurance] -- link:ddl/index.html[Devices Dumps Library (DDL)]: Provides simulation data to the linkman:dummy-ups[8] driver endif::website[] ifndef::website[] - linkdoc:developer-guide[NUT Developer Guide] @@ -41,60 +35,26 @@ ifndef::website[] - link:ups-protocols.html[UPS protocols library] - link:../man/index.html#Developer_man[Developer manual pages] - link:nut-qa.html[NUT Quality Assurance] -- link:http://www.networkupstools.org/ddl/index.html[Devices Dumps Library (DDL)]: Provides simulation data to the linkman:dummy-ups[8] driver endif::website[] -Data dumps for the DDL ----------------------- - -Note: both developers contributing a driver and users using an existing driver -for device not previously documented as supported by it, are welcome to report -new data for the Devices Dumps Library (DDL) mentioned above. Best of all such -"data dump" reports can be prepared by the -ifdef::website[] -link:https://raw.githubusercontent.com/networkupstools/nut/master/tools/nut-ddl-dump.sh[`tools/nut-ddl-dump.sh`] -endif::website[] -ifndef::website[] -`./tools/nut-ddl-dump.sh` -endif::website[] -script from the main NUT codebase, and reported on the NUT mailing list or -via link:https://github.com/networkupstools/nut/issues[NUT issues on GitHub] -or as a pull request against the -link:https://github.com/networkupstools/nut-ddl[NUT Devices Dumps Library] -following the naming and other rules described in the DDL documentation page. - -Data dumps collected by the tools above, or by `upsc` client, or by drivers -in exploratory data-dumping mode (with `-d 1` argument), can be compared by -ifdef::website[] -link:https://raw.githubusercontent.com/networkupstools/nut/master/tools/nut-dumpdiff.sh[`tools/nut-dumpdiff.sh`] -endif::website[] -ifndef::website[] -`./tools/nut-dumpdiff.sh` -endif::website[] -script from the main NUT codebase, which strips away lines with only numeric -values (aiming to minimize the risk of losing meaningful changes like counters). - Offsite Links ------------- [[general_powerdev_info]] -These are general information about UPS, PDU, ATS, PSU and SCD: +These are general information about UPS and PDU. - link:http://tldp.org/HOWTO/UPS-HOWTO/[UPS HOWTO] (The Linux Documentation Project) - link:http://en.wikipedia.org/wiki/Uninterruptible_power_supply[UPS on Wikipedia] - link:http://en.wikipedia.org/wiki/Power_distribution_unit[PDU on Wikipedia] -- link:https://en.wikipedia.org/wiki/Transfer_switch[Automatic Transfer Switch] -- link:https://en.wikipedia.org/wiki/Power_supply_unit_%28computer%29[Power Supply Units] - link:http://en.wikipedia.org/wiki/Solar_controller[Solar controller on Wikipedia] - link:http://www.pcguide.com/ref/power/ext/ups/over.htm[UPS on The PC Guide] These are writeups by users of the software. -- link:http://rogerprice.org/NUT.html[NUT Setup with openSUSE] '(Roger Price)' -- link:http://www.dimat.unina2.it/LCS/MonitoraggioUpsNutUbuntu10-eng.htm[Deploying NUT on an Ubuntu 10.04 cluster] '(Stefano Angelone)' +- link:http://www.dimat.unina2.it/LCS/MonitoraggioUpsNutUbuntu10-eng.htm[Deploying NUT on an Ubuntu 10.04 cluster] '(Stefano Angelone)' - link:http://blog.shadypixel.com/monitoring-a-ups-with-nut-on-debian-or-ubuntu-linux[Monitoring a UPS with nut on Debian or Ubuntu Linux] '(Avery Fay)' - link:http://linux.developpez.com/cours/upsusb/[Installation et gestion d'un UPS USB en réseau sous linux] '(Olivier Van Hoof, french)' -- link:https://github.com/networkupstools/nut/wiki/NUT-on-Mac-OS-X[Network UPS Tools (NUT) on Mac OS X (10.4.10)] '(Andy Poush)' +- link:http://trac.networkupstools.org/projects/nut/wiki/NutOnMacOSX[Network UPS Tools (NUT) on Mac OS X (10.4.10)] '(Andy Poush)' - link:http://www.llondel.org/ups.shtml[Interfacing a Contact-Closure UPS to Mac OS X and Linux] '(David Hough)' - link:http://fedoranews.org/contributors/kazutoshi_morioka/nut/[How to use UPS with nut on RedHat / Fedora Core] '(Kazutoshi Morioka)' - link:http://people.freebsd.org/~thierry/nut_FreeBSD_HowTo.txt[FreeBSD installation procedure] '(Thierry Thomas, from FreeBSD)' @@ -103,14 +63,9 @@ These are writeups by users of the software. - link:http://deschis.blogspot.com/2006/07/cum-se-configureaz-un-ups-apollo-seria.html[Cum se configurează un UPS Apollo seria 1000F pe Linux] '(deschis, Romanian)' - link:http://buffalo.nas-central.org/wiki/Install_a_UPS_%28nut%29[Install a UPS (nut) on a Buffalo NAS] '(various authors)' - link:http://blog.pointbre.com/2903/nutnetwork-ups-tool-korean-guidebook.html[NUT Korean GuideBook] '(PointBre)' -- link:https://www.jamesridgway.co.uk/monitoring-eaton-5sc-ups-scripts-and-integration-network-tools-home-assistant/amp/[USB UPS, notifications, and Home Assistant] '(James Ridgway)' - -Video articles are also available: - -- link:https://www.youtube.com/watch?v=vyBP7wpN72c[Network UPS Tools (NUT Server) Ultimate Guide] '(Techno Tim)' News articles and Press releases -------------------------------- -- link:http://www.crn.com/news/channel-programs/199000818/linux-ups-without-tears.htm[Linux UPS Without Tears] '(A. Lizard)' -- link:http://www.enterprisenetworkingplanet.com/netsysm/article.php/3295841/Graceful-UPS-Shutdowns-on-Linux.htm[Graceful UPS shutdowns on Linux] '(Carla Schroder)' +- link:http://www.crn.com/white-box/199000818?pgno=1[Linux UPS Without Tears] '(A. Lizard)' +- link:http://networking.earthweb.com/netsysm/article.php/10954_3295841_1[Graceful UPS shutdowns on Linux] '(Carla Schroder)' diff --git a/docs/download.txt b/docs/download.txt index c6d2a63..8436094 100644 --- a/docs/download.txt +++ b/docs/download.txt @@ -10,12 +10,12 @@ Source code ================================================================================ You should always use PGP/GPG to verify the signatures before using any source code. -You can use the +You can use the ifdef::website[] link:docs/user-manual.chunked/ar01s09.html#verifySourceSig[following procedure] endif::website[] ifndef::website[] -<>. +- Else, you can read the <>. endif::website[] to do so. ================================================================================ @@ -51,7 +51,7 @@ following script in the directory you just checked out: $ ./autogen.sh -Then refer to the +Then refer to the ifdef::website[] link:docs/user-manual.chunked/index.html[NUT user manual] endif::website[] @@ -59,7 +59,7 @@ ifndef::website[] linkdoc:user-manual[NUT user manual] endif::website[] for more information. - + ////////////////////////// NOTE: Users that need the latest developments to support new devices *must* use Git or <>. @@ -68,10 +68,12 @@ use Git or <>. Browse code ^^^^^^^^^^^ -You can browse the "vanilla NUT" code at the -link:https://github.com/networkupstools/nut/[Main GitHub repository for NUT sources], -and some possibly modified copies as part of packaging recipe -sources of operating system distributions, as listed below. +You can also browse the code at +link:https://github.com/networkupstools/nut[GitHub], or at the +link:http://alioth.debian.org/scm/?group_id=30602[Alioth mirror]. The code was +originally kept in Subversion, and the old +link:http://trac.networkupstools.org/projects/nut[Trac site] will be kept +around for a bit so as not to break the URLs in the mailing list archives. [[Snapshots]] Snapshots @@ -79,23 +81,13 @@ Snapshots GitHub has several download links for repository snapshots (for particular tags or branches), but you will need a number of tools such as autoconf, automake -and libtool to use these snapshots to generate the `configure` script and some -other files. - -After you `configure` the source workspace, a `make dist-hash` recipe would -create the snapshot tarballs which do not require the auto* tools, and their -checksum files, such as those available on the NUT website and attached to -link:https://github.com/networkupstools/nut/releases[GitHub Releases page]. - -///////// -TODO: #1400 to replace this with a NUT CI farm service to publish the tarballs +and libtool to use these snapshots. If our Buildbot instance is behaving, you can download a snapshot which does not require auto* tools from this link:http://buildbot.networkupstools.org/snapshots[builder]. Look for the latest *[tarball]* link towards the top of the page, and be sure to check the 'Build ##' link to verify the branch name. -///////// Older versions ~~~~~~~~~~~~~~ @@ -108,70 +100,42 @@ Binary packages NOTE: The only official releases from this project are source code. -NUT is already available in the following operating systems (and -link:https://github.com/networkupstools/nut/wiki/Links-to-distribution-packaging-recipes-and-repository-sections[likely more]): +NUT is already available in the following systems: -- link:https://repology.org/project/nut/versions[Repology report on NUT] - lists 745 entries about NUT, as of this writing - -- Linux: - - * link:https://github.com/42ity/nut/tree/FTY/obs[42ITy.org packaging recipes for Debian-based releases] - * link:https://salsa.debian.org/debian/nut/[Debian Salsa recipes] - and link:http://packages.debian.org/nut[Debian packages] - * link:http://packages.ubuntu.com/nut[Ubuntu packages] - * link:https://src.fedoraproject.org/rpms/nut/tree/rawhide[Fedora Rawhide recipes] - and link:https://src.fedoraproject.org/rpms/nut[Red Hat / Fedora packages] - * link:https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=network-ups-tools-git[Arch Linux recipe] - and link:https://aur.archlinux.org/packages/network-ups-tools-git[Arch Linux package info] - * link:https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-power/nut[Gentoo Linux recipe] - and link:http://packages.gentoo.org/package/sys-power/nut[Gentoo Linux package info] - * link:https://build.opensuse.org/package/show/openSUSE%3AFactory/nut[Novell SUSE / openSUSE official package base recipe] - and link:https://build.opensuse.org/package/show/hardware/nut[Novell SUSE / openSUSE official package development recipe], - and link:http://software.opensuse.org/package/nut[Novell SUSE / openSUSE official package overview] - * link:https://build.opensuse.org/search?search_text=nut[Numerous other recipes on Open Build System (not only by SUSE)] - * link:https://github.com/openwrt/packages/tree/master/net/nut[OpenWRT recipes] - * link:http://sotirov-bg.net/slackpack/search.cgi?q=nut[Slackware package overview] - * link:https://github.com/void-linux/void-packages/tree/master/srcpkgs/network-ups-tools[Void Linux recipes] +- Linux: +link:http://aur.archlinux.org/packages.php?ID=5379[Arch Linux], +link:http://packages.debian.org/nut[Debian], +link:http://packages.gentoo.org/package/sys-power/nut[Gentoo Linux], +Mandriva, +link:https://admin.fedoraproject.org/pkgdb/acls/name/nut[Red Hat / Fedora], +link:http://software.opensuse.org/package/nut[Novell Suse / openSUSE], +link:https://forum.openwrt.org/viewtopic.php?id=26269[OpenWrt], +link:http://packages.ubuntu.com/nut[Ubuntu]. - BSD systems: - - * link:https://cgit.freebsd.org/ports/tree/sysutils/nut-devel[FreeBSD package recipe (devel)], - link:https://cgit.freebsd.org/ports/tree/sysutils/nut[FreeBSD package recipe] - and link:http://www.FreeBSD.org/cgi/ports.cgi?query=^nut-&stype=name[FreeBSD package overview] - * link:cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/sysutils/ups-nut/[NetBSD recipe] and link:http://pkgsrc.se/sysutils/ups-nut[NetBSD package overview] - * link:http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/nut/[OpenBSD recipe] - * link:https://github.com/freenas/iocage-ports/tree/master/sysutils/nut[FreeNAS iocage-ports recipe], - link:http://doc.freenas.org/9.3/freenas_services.html#ups[FreeNAS 9.3 docs on UPS integration] - and link:https://www.ixsystems.com/documentation/freenas/11.3-U5/services.html#ups[FreeNAS 11.3-U5 docs on UPS integration] +link:http://www.FreeBSD.org/cgi/ports.cgi?query=^nut-&stype=name[FreeBSD], +link:ftp://ftp.netbsd.org/pub/NetBSD/packages/pkgsrc/sysutils/ups-nut/README.html[NetBSD], +link:http://www.openbsd.org/cgi-bin/cvsweb/ports/sysutils/nut/[OpenBSD], +link:http://doc.freenas.org/index.php/UPS[FreeNAS]. - Mac OS X: - - * link:https://github.com/fink/fink-distributions/blob/master/10.9-libcxx/stable/main/finkinfo/net/nut.info[Fink recipe] - and link:http://pdb.finkproject.org/pdb/package.php/nut[Fink package overview] - * link:http://trac.macports.org/browser/trunk/dports/sysutils/nut/Portfile[MacPorts recipe] - -- illumos/Solaris: - - * link:https://github.com/OpenIndiana/oi-userland/tree/oi/hipster/components/sysutils/nut[OpenIndiana oi-userland recipe] - and link:https://pkg.openindiana.org/hipster/en/search.shtml?token=nut&action=Search[OpenIndiana latest rolling builds] +link:http://pdb.finkproject.org/pdb/package.php/nut[Fink], +link:http://trac.macports.org/browser/trunk/dports/sysutils/nut/Portfile[MacPorts] - Windows (complete port, Beta): - - * link:http://www.networkupstools.org/package/windows/NUT-Installer-2.6.5-6.msi[Windows MSI installer 2.6.5-6] +link:http://www.networkupstools.org/package/windows/NUT-Installer-2.6.5-3.msi[Windows MSI installer 2.6.5-3] Java packages ------------- -- The jNut package has been split into its own - link:https://github.com/networkupstools/jNut[GitHub repository]. +The jNut package has been split into its own link:https://github.com/networkupstools/jNut[GitHub repository]. - NUT Java support (client side, Beta) - link:http://www.networkupstools.org/package/java/jNut-0.2-SNAPSHOT.tar.gz[jNUT 0.2-SNAPSHOT] +link:http://www.networkupstools.org/package/java/jNut-0.2-SNAPSHOT.tar.gz[jNUT 0.2-SNAPSHOT] - NUT Java Web support (client side using REST, Beta) - link:http://www.networkupstools.org/package/java/jNutWebAPI-0.2-SNAPSHOT-src.tar.gz[jNutWebAPI 0.2-SNAPSHOT (sources)] +link:http://www.networkupstools.org/package/java/jNutWebAPI-0.2-SNAPSHOT-src.tar.gz[jNutWebAPI 0.2-SNAPSHOT (sources)] Virtualization packages ----------------------- @@ -179,7 +143,7 @@ Virtualization packages VMware ~~~~~~ -- NUT client 2.7.4 for ESXi 5.0, 5.1, 5.5 and 6.0 (offsite, René Garcia) +- NUT client for ESXi 5.0 (offsite, René Garcia) * link:http://rene.margar.fr/2012/05/client-nut-pour-esxi-5-0/[blog entry (French)] - * link:http://rene.margar.fr/downloads/NutClient-ESXi500-1.4.0.tar.gz[VIB package (v1.4.0)] + * link:http://rene.margar.fr/downloads/NutClient-ESXi500-1.2.0.tar.gz[VIB package (v1.2.0)] diff --git a/docs/features.txt b/docs/features.txt index 631bdbc..d114ea1 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -18,12 +18,10 @@ More and more appliances manufacturers are bundling NUT... Multiple manufacturer and device support ---------------------------------------- -- Monitors many UPS, PDU, ATS, PSU and SCD models from more than 140 -manufacturers with a unified interface -(link:stable-hcl.html[Hardware Compatibility List]). +- Monitors many UPS, PDU and SCD models from more than 100 manufacturers with a +unified interface (link:stable-hcl.html[Hardware Compatibility List]). -- Various communication types and many protocols are supported with the same -common interface: +- Various communication types are supported with the same common interface: * serial, * USB, * network (SNMP, Eaton / MGE XML/HTTP). @@ -31,12 +29,11 @@ common interface: Multiple architecture support ----------------------------- -- Cross-platform -- different flavors of Unix can be managed together with a +- Cross-platform - different flavors of Unix can be managed together with a common set of tools, even crossing architectures. -- This software has been reported to run on Linux distributions, the BSDs, -Apple's OS X, commercial Solaris and open-source illumos distros, IRIX, -HP/UX, Tru64 Unix, and AIX. +- This software has been reported to run on Linux distributions, the BSDs, Apple's +OS X, Solaris, IRIX, HP/UX, Tru64 Unix, and AIX. - Windows users may be able to build it directly with Cygwin. There is also a port of the client-side monitoring to Windows called WinNUT. @@ -61,8 +58,21 @@ WARNING: Be sure to plug your network's physical hardware (switches, hubs, routers, bridges, ...) into the UPS! -Redundancy support -- Hot swap/high availability power supplies ---------------------------------------------------------------- +//////////////////////////////////////////////////////////////////////////////// +*FIXME* to be removed? + +- This has also allowed us to create easily the Power Management integration. + +=== Power Management integration === + +- Thanks to its modular design, NUT can feed data to the FreeDesktop Hardware Abstraction Layer (HAL).[[BR]] + This allow a seemless integration of USB UPSs, at a small cost (around 200 Kb), reusing the standard Power Management GUIs and providing to users a full Plug & Play system. + +- The added bonus is that this is the best Power Management existing, surpassing the one that exist on Windows and Mac OS, both in terms of devices supported and of features. +//////////////////////////////////////////////////////////////////////////////// + +Redundancy support - Hot swap/high availability power supplies +-------------------------------------------------------------- - upsmon can handle high-end servers which receive power from multiple UPSes simultaneously. @@ -71,18 +81,14 @@ simultaneously. source UPSes becomes critical (on battery and low battery). - You can lose a UPS completely as long as you still have at least the minimum -number of sources available. The minimum value is configurable. +number of sources available. The minimum value is configurable. Security and access control --------------------------- - Manager functions are granted with per-user granularity. The admin can have -full powers, while the admin's helper can only do specific non-destructive -tasks such as a battery test (beware that with a worn-out battery whose -replacement is a few years overdue, a "capacity/remaining runtime" test can -still be destructive by powering off the load abruptly -- and also such a -test can cause hosts to hide into graceful shutdowns when the battery state -does get critical as part of the test). +full powers, while the admin's helper can only do specific non-destructive tasks +such as a battery test. - The drivers, server, and monitoring client (upsmon) can all run as separate user IDs if this is desired for privilege separation. @@ -96,8 +102,8 @@ shutdown command. In any other case, the privileged process exits. This was inspired by the auth mechanism in Solar Designer's excellent popa3d. - The drivers and network server may be run in a chroot jail for further -security benefits. This is supported directly since version 1.4 and beyond -with the 'chroot=' configuration directive. +security benefits. This is supported directly since version 1.4 and beyond with +the 'chroot=' configuration directive. - IP-based access control relies on the local firewall and link:http://en.wikipedia.org/wiki/TCP_Wrapper[TCP Wrapper]. @@ -111,9 +117,9 @@ Web-based monitoring - Comes stock with CGI-based web interface tools for UPS monitoring and management, including graphical status displays. -- Custom status web pages may be generated with the CGI programs, since they -use templates to create the pages. This allows you to have status pages which -fit the look and feel of the rest of your site. +- Custom status web pages may be generated with the CGI programs, since they use +templates to create the pages. This allows you to have status pages which fit +the look and feel of the rest of your site. Free software ------------- @@ -121,48 +127,39 @@ Free software - That's free beer and free speech. Licensed under the GNU General Public License version 2 or later. -- Know your systems -- all source code is available for inspection, so there are -no mysteries or secrets in your critical monitoring tools. +- Know your systems - all source code is available for inspection, so there are +no mysteries or secrets in your critical monitoring tools. UPS management and control -------------------------- -- Writable variables may be edited on higher end equipment for local -customization +- Writable variables may be edited on higher end equipment for local customizations -- Status monitoring can generate notifications (email/pager/SMS/...) on alert -conditions +- Status monitoring can generate notifications (email/pager/SMS/...) on alert conditions -- Alert notices may be dampened to only trigger after a condition persists. -This avoids the usual pager meltdown when something happens and no delay -is used. +- Alert notices may be dampened to only trigger after a condition persists. This +avoids the usual pager meltdown when something happens and no delay is used. - Maintenance actions such as battery runtime calibration are available where supported by the UPS hardware. -- Power statistics can be logged in custom formats for later retrieval and -analysis +- Power statistics can be logged in custom formats for later retrieval and analysis -- All drivers are started and stopped with one common program. Starting one -is as easy as starting ten: `upsdrvctl start`. - -- For operating systems with a supported service management framework, you can -manage the NUT drivers wrapped into independent service instances using the -'upsdrvsvcctl' instead, and gain the benefits of automated restart as well as -possibility to define further dependencies between your OS components. +- All drivers are started and stopped with one common program. Starting one is +as easy as starting ten: 'upsdrvctl start'. - Shutdowns and other procedures may be tested without stressing actual UPS -hardware by simulating status values with the dummy-ups pseudo-driver. -Anything that can happen in a driver can be replicated with dummy-ups. +hardware by simulating status values with the dummy-ups pseudo-driver. Anything +which can happen in a driver can be replicated with dummy-ups. Monitoring diagrams ------------------- -These are the most common situations for monitoring UPS hardware. Other ways -are possible, but they are mostly variations of these four. +These are the most common situations for monitoring UPS hardware. Other ways are +possible, but they are mostly variants on these four. -NOTE: these examples show serial communications for simplicity, but USB or -SNMP or any other monitoring is also possible. +NOTE: these examples show serial communications for simplicity, but USB or SNMP +or any other monitoring is also possible. "Simple" configuration ~~~~~~~~~~~~~~~~~~~~~~ @@ -171,8 +168,8 @@ image:images/simple.png[] One UPS, one computer. This is also known as "Standalone" configuration. -This is the configuration that most users will use. You need at least a -driver, `upsd`, and `upsmon` running. +This is the configuration that most users will use. You need at least a driver, +upsd, and upsmon running. "Advanced" configuration ~~~~~~~~~~~~~~~~~~~~~~~~ @@ -180,77 +177,60 @@ driver, `upsd`, and `upsmon` running. image:images/advanced.png[] One UPS, multiple computers. Only one of them can actually talk to the UPS -directly. That's where the network comes in: +directly. That's where the network comes in. The Master system runs the driver, +upsd, and upsmon in master mode. The Slave systems only run upsmon in slave mode. -- The Primary system runs the relevant driver, `upsd`, and `upsmon` in -"primary" mode. +This is useful when you have a very large UPS that's capable of running multiple +systems simultaneously. There is no longer the need to buy a bunch of individual +UPSes or "sharing" hardware, since this software will handle the sharing for you. -- The Secondary systems only run `upsmon` in "secondary" mode which all -connect to `upsd` on Primary. - -This is useful when you have a very large UPS that's capable of running -multiple systems simultaneously. There is no longer the need to buy a bunch -of individual UPSes or "sharing" hardware, since this software will handle -the sharing for you. - -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// *FIXME* remainder === One UPS, many clients === -- Multiple systems may monitor a single UPS using only their network -connections -- no special "UPS sharing" hardware is required. +- Multiple systems may monitor a single UPS using only their network connections - no special "UPS sharing" hardware is required. -- "Secondaries and a primary" monitoring design synchronizes shutdowns so that -secondary systems can bring down their operating systems cleanly before -the primary tells the UPS to switch off the power. +- "Slave and master" monitoring design synchronizes shutdowns so that slaves can bring down their operating systems cleanly before the master switches off the power. === Many UPSes, many clients === -- Each `upsd` process can serve status data for multiple UPSes to many clients. -Multiple NUT drivers need to be configured and running locally on the system -with `upsd` then, and have appropriate media connections to the power devices. +- Each upsd process can serve status data for multiple UPSes to many clients. -- Each `upsmon` process can monitor multiple UPSes, possibly from multiple -`upsd` hosts, for status data. +- Each upsmon process can monitor multiple UPSes for status data. -////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////// "Big Box" configuration ~~~~~~~~~~~~~~~~~~~~~~~ image:images/bigbox.png[] -Some systems have multiple power supplies and cords. You typically find -this on high-end servers that allow hot-swap and other fun features. -In this case, you run multiple drivers (one per UPS), a single `upsd`, -and a single `upsmon` (as a primary for both UPS 1 and UPS 2) +Some systems have multiple power supplies and cords. You typically find this on +high-end servers that allow hot-swap and other fun features. In this case, you +run multiple drivers (one per UPS), a single upsd, and a single upsmon (as +master for both UPS 1 and UPS 2) -This software understands that some of these servers can also run with -some of the supplies gone. For this reason, every UPS is assigned a -"power value" -- the quantity of power supplies that it feeds on this -system. - -The total available "power value" is compared to the minimum that is -required for that hardware. For example, if you have 3 power supplies -and 3 UPSes, but only 2 supplies must be running at any given moment, -the minimum would be 2. - -This means that you can safely lose any one UPS and the software will -handle it properly by remaining online and not causing a shut down. +This software understands that some of these servers can also run with some of +the supplies gone. For this reason, every UPS is assigned a "power value" - the +quantity of power supplies that it feeds on a system. +The total available "power value" is compared to the minimum that is required +for that hardware. For example, if you have 3 power supplies and 3 UPSes, but +only 2 supplies must be running at any given moment, the minimum would be 2. +This means that you can safely lose any one UPS and the software will handle it +properly by remaining online. "Bizarre" configuration ~~~~~~~~~~~~~~~~~~~~~~~ image:images/bizarre.png[] -You can even have a UPS that has the serial port connected to a system that -it's not feeding. Sometimes a PC will be close to a UPS that needs to be -monitored, so it's drafted to supply a serial port for the purpose. -This PC may in fact be getting its own power from some other UPS. This is -not a problem for the set-up. +You can even have a UPS that has the serial port connected to a system that it's +not feeding. Sometimes a PC will be close to a UPS that needs to be monitored, +so it's drafted to supply a serial port for the purpose. This PC may in fact be +getting power from some other UPS. This is not a problem. -The first system ("mixed") is a Primary for UPS 1, but is only monitoring -UPS 2. The other systems are Secondaries of UPS 2. +The first system ("mixed") is a Master for UPS 1, but is only monitoring UPS 2. +The other systems are Slaves of UPS 2. Image credits ------------- diff --git a/docs/hid-subdrivers.txt b/docs/hid-subdrivers.txt index edf2b84..42a7cab 100644 --- a/docs/hid-subdrivers.txt +++ b/docs/hid-subdrivers.txt @@ -9,9 +9,9 @@ different classes (audio, imaging, mass storage etc). Almost all UPS devices belong to the "HID" class, which means "Human Interface Device", and also includes things like keyboards and mice. What HID devices have in common is a particular (and very flexible) interface -for reading and writing information (such as X/Y coordinates and -button states, in the case of a mouse, or voltages and status information, -in the case of a UPS). +for reading and writing information (such as x/y coordinates and +button states, in case of a mouse, or voltages and status information, +in case of a UPS). The NUT "usbhid-ups" driver is a meta-driver that handles all HID UPS devices. It consists of a core driver that handles most of the work of @@ -20,14 +20,13 @@ specific UPS manufacturers (MGE, APC, and Belkin are currently supported). Adding support for a new HID UPS device is easy, because it requires only the creation of a new sub-driver. -There are a few USB UPS devices that are not true HID devices. These +There are a few USB UPS devices that are not HID devices. These devices typically implement some version of the manufacturer's serial protocol over USB (which is a really dumb idea, by the way). An -example is the original Tripplite USB interface (USB idProduct = 0001). Its HID -descriptor is only 52 bytes long (compared to several hundred bytes for a true -PDC HID UPS). Such devices are *not* supported by the usbhid-ups driver, and -are not covered in this document. If you need to add support for such a device, -read new-drivers.txt and see the "tripplite_usb" driver for inspiration. +example is the Tripplite USB. Such devices are *not* supported by the +usbhid-ups driver, and are not covered in this document. If you need to +add support for such a device, read new-drivers.txt and see the +tripplite_usb driver for inspiration. HID Usage Tree ~~~~~~~~~~~~~~ @@ -116,7 +115,7 @@ example Belkin defines `00860040` = ConfigVoltage (which is incidentally a violation of the USB PDC specification, as `00860040` is reserved for future use). -Thus, subdrivers generally need to provide: +Thus, subdrivers generally need to provide: - manufacturer-specific usage definitions, - a mapping of HID variables to NUT variables. @@ -127,58 +126,26 @@ shutdown.restart), and conversions of manufacturer specific data formats. -Usage macros in drivers/hidtypes.h -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The `drivers/hidtypes.h` header provides a number of macro names -for entries in the standard usage tables for Power Device -`USAGE_POW_` and Battery System `USAGE_BAT_` -data pages. - -If NUT codebase would ever need to refresh those macros, here is -some background information (based on NUT issue #1189 and PR #1290): - -These data were parsed from (a very slightly updated version of) -https://github.com/abend0c1/hidrdd/blob/master/rd.conf file, which -incorporates the complete USB-IF usage definitions for Power Device -and Battery System pages (among many others), so we didn't have to -extract the names and values from the USB-IF standards documents -(did check it all by eye though). - -The file was processed with the following chain of commands: - ------- -:; grep -e '^0084' -e '^0085' rd.conf \ - | sed 's/,.*$//;s/ *$//' \ - | sed 's/ /_/g;s/_/ /' \ - | tr '[:lower:]' '[:upper:]' \ - | sed 's/\(0085.... \)/\1USAGE_BAT_/;s/\(0084.... \)/\1USAGE_POW_/;s/\([A-Z_]*\)_PAGE/PAGE_\1/' \ - | awk '{print "#define "$2" 0x"$1}' ------- - - Writing a subdriver ~~~~~~~~~~~~~~~~~~~ In preparation for writing a subdriver for a device that is currently unsupported, run usbhid-ups with the following command line: - drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX -x port=auto -s ups + drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX auto -(substitute your device's 4-digit VendorID instead of "XXXX"). -This will produce a bunch of debugging information, including a number -of lines starting with "Path:" that describe the device's usage tree. -This information forms the initial basis for a new subdriver. +(substitute your device's 4-digit VendorID instead of "XXXX"). +This will produce a bunch of debugging information, including a number +of lines starting with "Path:" that describe the device's usage tree. +This information forms the initial basis for a new subdriver. -You should save this information to a file, e.g.: - - drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX \ - -x port=auto -s ups 2>&1 | tee /tmp/info +You should save this information to a file, e.g. + drivers/usbhid-ups -DD -u root -x explore -x vendorid=XXXX auto >& /tmp/info You can create an initial "stub" subdriver for your device by using script scripts/subdriver/gen-usbhid-subdriver.sh. Note: this only creates -a "stub" and needs to be further customized to be useful (see -"Customization" below). +a "stub" and needs to be futher customized to be useful (see +CUSTOMIZATION below). Use the script as follows: @@ -193,18 +160,14 @@ and digits, and use natural capitalization such as "Belkin" (not information. You should put the generated files into the drivers/ subdirectory, and -update `usbhid-ups.c` by adding the appropriate `#include` line and by -updating the definition of `subdriver_list` in `usbhid-ups.c`. You must -also add the subdriver to USBHID_UPS_SUBDRIVERS in `drivers/Makefile.am` -and call `autoreconf` and/or `./configure` from the top-level NUT directory. -You can then recompile `usbhid-ups`, and start experimenting with the new +update usbhid-ups.c by adding the appropriate #include line and by +updating the definition of subdriver_list in usbhid-ups.c. You must +also add the subdriver to USBHID_UPS_SUBDRIVERS in drivers/Makefile.am +and call "autoreconf" and/or "./configure" from the top level NUT directory. +You can then recompile usbhid-ups, and start experimenting with the new subdriver. - -Customization -~~~~~~~~~~~~~ - -The initially generated subdriver code is only a stub, +CUSTOMIZATION: The initially generated subdriver code is only a stub, and will not implement any useful functionality (in particular, it will be unable to shut down the UPS). In the beginning, it simply attempts to monitor some UPS variables. To make this driver useful, @@ -212,7 +175,7 @@ you must examine the NUT variables of the form "unmapped.*" in the hid_info_t data structure, and map them to actual NUT variables and instant commands. There are currently no step-by-step instructions for how to do this. Please look at the files to see how the currently implemented -subdrivers are written: +subdrivers are written.: - apc-hid.c/h - belkin-hid.c/h @@ -225,29 +188,10 @@ subdrivers are written: - tripplite-hid.c/h -Fixing report descriptors -~~~~~~~~~~~~~~~~~~~~~~~~~ - -It is a fact of life that fellow developers make mistakes, and firmware -authors do too. In some cases there are inconsistencies about bytes seen -on the wire vs. their logical values, such value range and signedness if -interpreting them according to standard. - -NUT drivers now include a way to detect and fix up known issues in such -flawed USB report descriptors, side-stepping the standard similarly where -deemed needed. A pointer to such hook method is part of the `subdriver_t` -structure detailing each `usbhid-ups` subdriver nuances, defaulting to -a `fix_report_desc()` trivial implementation. - -For some practical examples, see e.g. `apc_fix_report_desc()` method in the -`drivers/apc-hid.c` file, and `cps_fix_report_desc()` in `drivers/cps-hid.c` -file. - - Shutting down the UPS ~~~~~~~~~~~~~~~~~~~~~ -It is desirable to support shutting down the UPS. Usually (for +It is desireable to support shutting down the UPS. Usually (for devices that follow the HID Power Device Class specification), this requires sending the UPS two commands. One for shutting down the UPS (with an 'offdelay') and one for restarting it (with an 'ondelay'), diff --git a/docs/history.txt b/docs/history.txt index 4db0a35..da66cec 100644 --- a/docs/history.txt +++ b/docs/history.txt @@ -8,7 +8,7 @@ This page is an attempt to document how everything came together. The Network UPS Tools team would like to warmly thank Russell Kroll. Russell initially started this project, maintaining and improving it for -over 8 years (1996 -- mid 2005). +over 8 years (1996 - mid 2005). Prototypes and experiments -------------------------- @@ -144,75 +144,49 @@ September 1999: new name, new URL Several visitors to the web page and subscribers to the mailing lists provided suggestions to rename the project. The old name no longer accurately described -it, and it was perilously close to APC's "Smart-UPS" trademark. Rather than -risk problems in the future, the name was changed. Kern Sibbald provided the -winner: Network UPS Tools, which captures the essence of the project and makes -for great short tarball filenames: nut-x.y.z.tar.gz. +it, and it was perilously close to APC's "Smart-UPS" trademark. Rather than risk +problems in the future, the name was changed. Kern Sibbald provided the winner: +Network UPS Tools, which captures the essence of the project and makes for great +short tarball filenames: nut-x.y.z.tar.gz. -The new name was first applied to 0.42.0, released October 31, 1999. -This is also when the web pages moved from the old -`http://www.exploits.org/~rkroll/smartupstools/` URL to the replacement -at `http://www.exploits.org/nut/` to coincide with the name change. +The new name was first applied to 0.42.0, released October 31, 1999. This is +also when the web pages moved from the old `http://www.exploits.org/~rkroll/smartupstools/` +URL to the replacement at `http://www.exploits.org/nut/` to coincide with the +name change. More drivers were written and the hardware support continued to grow. upsmon -picked up the concepts of what is now known as "primary" and "secondary", -and could now handle environments where multiple systems get power from a -single UPS. - -Manager mode was added to allow changing the value of read/write variables -in certain UPS models. +picked up the concepts of "master" and "slave", and could now handle +environments where multiple systems get power from a single UPS. Manager mode +was added to allow changing the value of read/write variables in certain UPS +models. June 2001: common driver core ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Up to this point, all of the drivers compiled into freestanding programs, each providing their own implementation of main(). This meant they all had to check -the incoming arguments and act uniformly. Unfortunately, not all of the -programs behaved the same way, and it was hard to document and use consistently. -It also meant that startup scripts had to be edited depending on what kind of -hardware was attached. +the incoming arguments and act uniformly. Unfortunately, not all of the programs +behaved the same way, and it was hard to document and use consistently. It also +meant that startup scripts had to be edited depending on what kind of hardware +was attached. -Starting in 0.45.0, released June 11, 2001, there was a new common core for -all drivers called `main.c`. It provided the main function and called back to -the `upsdrv_*` functions provided by the hardware-specific part of the drivers. -This allowed driver authors to focus on the UPS hardware without worrying about -the housekeeping stuff that needs to happen. +Starting in 0.45.0, released June 11, 2001, there was a new common core for all drivers called main.c. It provided the main function and called back to the upsdrv_* functions provided by the hardware-specific part of the drivers. This allowed driver authors to focus on the UPS hardware without worrying about the housekeeping stuff that needs to happen. -This new design provided an obvious way to configure drivers from one file, and -so `ups.conf` was born. This eventually spawned upsdrvctl, and now all drivers -based on this common core could be started or stopped with one command. Startup -scripts now could contain "upsdrvctl start", and it didn't matter what kind of -hardware or how many UPSes you had on one system. +This new design provided an obvious way to configure drivers from one file, and ups.conf was born. This eventually spawned upsdrvctl, and now all drivers based on this common core could be started or stopped with one command. Startup scripts now could contain "upsdrvctl start", and it didn't matter what kind of hardware or how many UPSes you had on one system. -Interestingly, at the end of this month, Arnaud Quette entered the UPS world, -as a subcontractor of the now defunct MGE UPS SYSTEMS. This marked the start of -a future successful collaboration. +Interestingly, at the end of this month, Arnaud Quette entered the UPS world, as a subcontractor of the now defunct MGE UPS SYSTEMS. +This marks the start of a future successful collaboration. May 2002: casting off old drivers, IANA port, towards 1.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -During the 0.45.x series, both the old standalone drivers and the ones which -had been converted to the common core were released together. Before the -release of 0.50.0 on May 24, 2002, all of the old drivers were removed. -While this shrank the list of supported hardware, it set the precedent for -removing code which isn't receiving regular maintenance. The assumption is -that the code will be brought back up to date by someone if they actually -need it. Otherwise, it's just dead weight in the tree. +During the 0.45.x series, both the old standalone drivers and the ones which had been converted to the common core were released together. Before the release of 0.50.0 on May 24, 2002, all of the old drivers were removed. While this shrank the list of supported hardware, it set the precedent for removing code which isn't receiving regular maintenance. The assumption is that the code will be brought back up to date by someone if they actually need it. Otherwise, it's just dead weight in the tree. -This change meant that all remaining drivers could be controlled with the -`upsdrvctl` and `ups.conf`, allowing the documentation to be greatly -simplified. There was no longer any reason to say "do this, unless you -have this driver, then do this". +This change meant that all drivers could be controlled with upsdrvctl and ups.conf, allowing the documentation to be greatly simplified. There was no longer any reason to say "do this, unless you have this driver, then do this". -IANA granted an official port number to the project, and the network code -switched to port 3493. It had previously been on 3305 which is assigned to -`odette-ftp`. 3305 was probably picked in 1997 because it was the fifth -project to spawn from some common UDP server code. +IANA granted an official port number to the project, and the network code switched to port 3493. It had previously been on 3305 which is assigned to odette-ftp. 3305 was probably picked in 1997 because it was the fifth project to spawn from some common UDP server code. -After 0.50.1, the 0.99 tree was created to provide a tree which would receive -nothing but bug fixes in preparation for the release of 1.0. As it turned out, -very few things required fixing, and there were only three releases in this -tree. +After 0.50.1, the 0.99 tree was created to provide a tree which would receive nothing but bug fixes in preparation for the release of 1.0. As it turned out, very few things required fixing, and there were only three releases in this tree. Leaving 0.x territory --------------------- @@ -220,119 +194,51 @@ Leaving 0.x territory August 2002: first stable tree: NUT 1.0.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -After nearly 5 years of having a 0.x version number, 1.0.0 was released on -August 19, 2002. This milestone meant that all of the base features that -you would expect to find were intact: good hardware support, a network -server with security controls, and system shutdowns that worked. +After nearly 5 years of having a 0.x version number, 1.0.0 was released on August 19, 2002. This milestone meant that all of the base features that you would expect to find were intact: good hardware support, a network server with security controls, and system shutdowns that worked. -The design was showing signs of wear from the rapid expansion, but this was -intentionally ignored for the moment. The focus was on getting a good version -out that would provide a reasonable base while the design issues could be -addressed in the future, and I'm confident that we succeeded. +The design was showing signs of wear from the rapid expansion, but this was intentionally ignored for the moment. The focus was on getting a good version out that would provide a reasonable base while the design issues could be addressed in the future, and I'm confident that we succeeded. November 2002: second stable tree: NUT 1.2.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -One day after the release of 1.0.0, 1.1.0 started the new development tree. -During that development cycle, the CGI programs were rewritten to use template -files instead of hard-coded HTML, thus bringing back the flexibility of the -original unreleased prototype from 5 years before. The `multimon` was removed -from the tree, as the new `upsstats` could do both jobs by loading different -templates. +One day after the release of 1.0.0, 1.1.0 started the new development tree. During that development cycle, the CGI programs were rewritten to use templates instead of hard-coded HTML, thus bringing back the flexibility of the original unreleased prototype from 5 years before. multimon was removed from the tree, as the new upsstats could do both jobs by loading different templates. -A new client library called upsclient was created, and it replaced upsfetch. -This new library only supported TCP connections, and used an opaque context -struct to keep state for each connection. As a result, client programs could -now do things that used multiple connections without any conflicts. This was -done primarily to allow OpenSSL support, but there were other benefits from -the redesign. +A new client library called upsclient was created, and it replaced upsfetch. This new library only supported TCP connections, and used an opaque context struct to keep state for each connection. As a result, client programs could now do things that used multiple connections without any conflicts. This was done primarily to allow OpenSSL support, but there were other benefits from the redesign. -upsd and the clients could now use OpenSSL for basic authentication and -encryption, but this was not included by default. This was provided as -a bonus feature for those users who cared to read about it and enable -the option, as the initial setup was complex. +upsd and the clients could now use OpenSSL for basic authentication and encryption, but this was not included by default. This was provided as a bonus feature for those users who cared to read about it and enable the option, as the initial setup was complex. -After the 1.1 tree was frozen and deemed complete, it became the second -stable tree with the release of 1.2.0 on November 5, 2002. +After the 1.1 tree was frozen and deemed complete, it became the second stable tree with the release of 1.2.0 on November 5, 2002. April 2003: new naming scheme, better driver glue, and an overhauled protocol ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Following an extended period with no development tree, 1.3.0 got things -moving again on April 13, 2003. The focus of this tree was to rewrite -the driver-server communication layer and replace the static naming -scheme for variables and commands. +Following an extended period with no development tree, 1.3.0 got things moving again on April 13, 2003. The focus of this tree was to rewrite the driver-server communication layer and replace the static naming scheme for variables and commands. -Up to this point, all variables had names like STATUS, UTILITY, and OUTVOLT. -They had been created as drivers were added to the tree, and there was little -consistency. For example, it probably should have been INVOLT and OUTVOLT, -but there was no OUTVOLT originally, so UTILITY was all we had. This same -pattern repeated with ACFREQ -- is it incoming or outgoing? -- and many more. +Up to this point, all variables had names like STATUS, UTILITY, and OUTVOLT. They had been created as drivers were added to the tree, and there was little consistency. For example, it probably should have been INVOLT and OUTVOLT, but there was no OUTVOLT originally, so UTILITY was all we had. This same pattern repeated with ACFREQ - is it incoming or outgoing? - and many more. -To solve this problem, all variables and commands were renamed to a -hierarchical scheme that had obvious grouping. STATUS became ups.status. -UTILITY turned into input.voltage, and OUTVOLT is output.voltage. -ACFREQ is input.frequency, and the new output.frequency is also now -supported. Every other variable or command was renamed in this fashion. +To solve this problem, all variables and commands were renamed to a hierarchical scheme that had obvious grouping. STATUS became ups.status. UTILITY turned into input.voltage, and OUTVOLT is output.voltage. ACFREQ is input.frequency, and the new output.frequency is also now supported. Every other variable or command was renamed in this fashion. -These variables had been shared between the drivers and upsd as values. -That is, for each name like STATUS, there was a #define somewhere in the -tree with an INFO_ prefix that gave it a number. INFO_STATUS was 0x0006, -INFO_UTILITY was 0x0004, and so on, with each name having a matching number. -This number was stored in an int within a structure which was part of the -array that was either written to disk or shared memory. +These variables had been shared between the drivers and upsd as values. That is, for each name like STATUS, there was a #define somewhere in the tree with an INFO_ prefix that gave it a number. INFO_STATUS was 0x0006, INFO_UTILITY was 0x0004, and so on, with each name having a matching number. This number was stored in an int within a structure which was part of the array that was either written to disk or shared memory. -That structure had several restrictions on expansion and was dropped as the -data sharing method between the drivers and the server. It was replaced by -a new system of text-based messages over Unix domain sockets. Drivers now -accepted a short list of commands from upsd, and would push out updates -asynchronously. upsd no longer had to poll the state files or shared memory. -It could just select all of the driver and client fds and act on events. +That structure had several restrictions on expansion and was dropped as the data sharing method between the drivers and the server. It was replaced by a new system of text-based messages over Unix domain sockets. Drivers now accepted a short list of commands from upsd, and would push out updates asynchronously. upsd no longer had to poll the state files or shared memory. It could just select all of the driver and client fds and act on events. -At the same time, the network protocol on port 3493 was overhauled to take -advantage of the new naming scheme. The existing "REQ STATUS@su700", -"ANS STATUS@su700 OL" scheme was showing signs of age, and it really -only supported the UPS name (@su700) as an afterthought. The new protocol -would now use commands like GET and LIST, leading to exchanges like -"GET VAR su700 ups.status" and "VAR su700 ups.status OL". These responses -contain enough data to stand alone, so clients can now handle them -asynchronously. +At the same time, the network protocol on port 3493 was overhauled to take advantage of the new naming scheme. The existing "REQ STATUS@su700", "ANS STATUS@su700 OL" scheme was showing signs of age, and it really only supported the UPS name (@su700) as an afterthought. The new protocol would now use commands like GET and LIST, leading to exchanges like "GET VAR su700 ups.status" and "VAR su700 ups.status OL". The responses contain enough data to stand alone, so clients can now handle them asynchronously. July 2003: third stable tree: NUT 1.4.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -On July 25, 2003, 1.4.0 was released. It contained support for both the -old "REQ" style protocol (with names like STATUS), and the new "GET" style -protocol (with names like ups.status). This tree is provided to bridge the -gap between all of the old releases and the upcoming 2.0. +On July 25, 2003, 1.4.0 was released. It contained support for both the old "REQ" style protocol (with names like STATUS), and the new "GET" style protocol (with names like ups.status). This tree is provided to bridge the gap between all of the old releases and the upcoming 2.0. -2.0 will be released without support for the old REQ/STATUS protocol. -The hope is that client authors and those who have implemented their own -monitoring software will use the 1.4 cycle to change to the new protocol. -The 1.4 releases contain a lot of compatibility code to make sure both -work at the same time. +2.0 will be released without support for the old REQ/STATUS protocol. The hope is that client authors and those who have implemented their own monitoring software will use the 1.4 cycle to change to the new protocol. The 1.4 releases contain a lot of compatibility code to make sure both work at the same time. July 2003: pushing towards 2.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -1.5.0 forked from 1.4.0 and was released on July 29, 2003. The first changes -were to throw out anything which was providing compatibility with the older -versions of the software. This means that 1.5 and the eventual 2.0 will not -talk to anything older than 1.4. +1.5.0 forked from 1.4.0 and was released on July 29, 2003. The first changes were to throw out anything which was providing compatibilty with the older versions of the software. This means that 1.5 and the eventual 2.0 will not talk to anything older than 1.4. -This tree continues to evolve with new serial routines for the drivers which -are intended to replace the aging upscommon code which dates back to the early -0.x releases. The original routines would call alarm and read in a tight loop -while fetching characters. The new functions are much cleaner, and wait for -data with select. This makes for much cleaner code and easier strace/ktrace -logs, since the number of syscalls has been greatly reduced. +This tree continues to evolve with new serial routines for the drivers which are intended to replace the aging upscommon code which dates back to the early 0.x releases. The original routines would call alarm and read in a tight loop while fetching characters. The new functions are much cleaner, and wait for data with select. This makes for much cleaner code and easier strace/ktrace logs, since the number of syscalls has been greatly reduced. -There has also been a push to make sure the data from the UPS is well-formed -and is actually usable before sending updates out to upsd. This started -during 1.3 as drivers were adapted to use the dstate functions and the -new variable/command names. Some drivers which were not converted to the -new naming scheme or didn't do sanity checks on the incoming UPS data from -the serial port were dropped from the tree. +There has also been a push to make sure the data from the UPS is well-formed and is actually usable before sending updates out to upsd. This started during 1.3 as drivers were adapted to use the dstate functions and the new variable/command names. Some drivers which were not converted to the new naming scheme or didn't do sanity checks on the incoming UPS data from the serial port were dropped from the tree. This tree was released as 2.0.0. @@ -342,23 +248,11 @@ networkupstools.org November 2003: a new URL ~~~~~~~~~~~~~~~~~~~~~~~~ -The bandwidth demands of a project like this have slowly been forcing me to -offload certain parts to other servers. The download links have pointed -offsite for many months, and other large things like certain UPS protocols -have followed. As the traffic grows, it's clear that having the project -attached to exploits.org is not going to work. +The bandwidth demands of a project like this have slowly been forcing me to offload certain parts to other servers. The download links have pointed offsite for many months, and other large things like certain UPS protocols have followed. As the traffic grows, it's clear that having the project attached to exploits.org is not going to work. -The solution was to register a new domain and set up mirrors. There are two -initial web servers, with more on the way. The main project URL has changed -from `http://www.exploits.org/nut/` to http://www.networkupstools.org. -The actual content is hosted on various mirrors which are updated regularly -with rsync, so the days of dribbling bits through my DSL should be over. +The solution was to register a new domain and set up mirrors. There are two initial web servers, with more on the way. The main project URL has changed from `http://www.exploits.org/nut/` to http://www.networkupstools.org. The actual content is hosted on various mirrors which are updated regularly with rsync, so the days of dribbling bits through my DSL should be over. -This is also when all of the web pages were redesigned to have a simpler -look with fewer links on the left side. The old web pages used to have 30 -or more links on the top page, and most of them vanished when you dropped -down one level. The links are now constant on the entire site, and the old -links now live in their own groups in separate directories. +This is also when all of the web pages were redesigned to have a simpler look with fewer links on the left side. The old web pages used to have 30 or more links on the top page, and most of them vanished when you dropped down one level. The links are now constant on the entire site, and the old links now live in their own groups in separate directories. Second major version -------------------- @@ -385,7 +279,7 @@ At that time, the development process was still centralized. There was no revision control system (like the current Subversion repository), nor trackers to interact with NUT development. Russell was receiving all the patches and requests, and doing all the work on -his own, including releases. +his own, including releases. Russell was more and more thinking about giving the project leadership to Arnaud Quette, which finally happened with the 2.0.1 release in February 2005. @@ -393,11 +287,10 @@ Arnaud Quette, which finally happened with the 2.0.1 release in February 2005. This marked a new era for NUT... First, Arnaud aimed at opening up the development by creating a project on the -http://www.debian.org/[Debian] -http://alioth.debian.org/projects/nut/[Alioth Forge]. +http://www.debian.org/[Debian] http://alioth.debian.org/projects/nut/[Alioth Forge]. This allowed to build the team of hackers that Russell dreamed about. It also allows to ensure NUT's continuation, whatever happens to -the leader. And that would most of all boost the projects contributions. +the leader. And that would most of all boost the projects contributions. //////////////////////////////////////////////////////////////////////// diff --git a/docs/images/advanced.png b/docs/images/advanced.png index a8291af..8f1df80 100644 Binary files a/docs/images/advanced.png and b/docs/images/advanced.png differ diff --git a/docs/images/bizarre.png b/docs/images/bizarre.png index 47e45e2..0c56884 100644 Binary files a/docs/images/bizarre.png and b/docs/images/bizarre.png differ diff --git a/docs/images/cables/mge-usb-rj45.jpg b/docs/images/cables/mge-usb-rj45.jpg deleted file mode 100644 index e9104a5..0000000 Binary files a/docs/images/cables/mge-usb-rj45.jpg and /dev/null differ diff --git a/docs/images/nut_layering.png b/docs/images/nut_layering.png index 41f650c..ff451b4 100644 Binary files a/docs/images/nut_layering.png and b/docs/images/nut_layering.png differ diff --git a/docs/macros.txt b/docs/macros.txt index b32da5b..7bda240 100644 --- a/docs/macros.txt +++ b/docs/macros.txt @@ -12,6 +12,7 @@ directory. #define a replacement if necessary. - NUT_CHECK_LIBGD +- NUT_CHECK_LIBHAL - NUT_CHECK_LIBNEON - NUT_CHECK_LIBNETSNMP - NUT_CHECK_LIBPOWERMAN @@ -44,11 +45,11 @@ directory. - NUT_CHECK_OS Check for the exact system name and type. - This was only used in the past to determine the packaging rule to be - used through the OS_NAME variable, but may be useful for other purposes - in the future. + This was only used in the past to determine the packaging rule to be used + through the OS_NAME variable, but may be useful for other purposes in the + future. -- NUT_REPORT_FEATURE(FEATURE, VALUE, VARIABLE, DESCRIPTION) +- NUT_REPORT_FEATURE(FEATURE, VALUE, VARIABLE, DESCRIPTION) Schedule a line for the end-of-configuration feature summary. The FEATURE is a descriptive string such that the sentence "Checking @@ -62,7 +63,7 @@ directory. - NUT_REPORT(FEATURE, VALUE) Schedule a line for the end-of-configuration feature summary, without - printing anything to the terminal immediately. + printing anything to the terminal immediately. - NUT_PRINT_FEATURE_REPORT diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 0d693a3..0306370 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -4,21 +4,13 @@ # Notes: # - sources (.txt) and groff formats are both distributed, # - only sources are versioned ; groff files are generated at worst -# during 'make dist' (while preparing a release tarball) +# during 'make dist' # - HTML files are built upon request, if AsciiDoc is available, # - groff update will only happen if AsciiDoc is available too, # - all this can probably (and hopefully) be improved, but I've not # found a way to do pattern replacement on the fly for target deps! # FIXME: investigate an autogen.sh hook # - Ref: http://www.gnu.org/software/hello/manual/automake/Man-pages.html -# - WITH_MANS can be enabled if either we are building man-pages, or if -# the --with-doc=man=auto detected an inability to build the man-pages -# but enabled the DOC_INSTALL_DISTED_MANS toggle so we deliver disted -# files from source tree - -# Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) -EGREP = egrep -#EGREP = grep -E # Base configuration and client manpages, always installed SRC_CONF_PAGES = \ @@ -29,7 +21,6 @@ SRC_CONF_PAGES = \ upsmon.conf.txt \ upssched.conf.txt -if WITH_MANS MAN_CONF_PAGES = \ nut.conf.5 \ ups.conf.5 \ @@ -37,7 +28,6 @@ MAN_CONF_PAGES = \ upsd.users.5 \ upsmon.conf.5 \ upssched.conf.5 -endif man5_MANS = $(MAN_CONF_PAGES) @@ -49,50 +39,36 @@ HTML_CONF_MANS = \ upsmon.conf.html \ upssched.conf.html -# NOTE: Currently SRC_DRIVERTOOL_PAGES are a separate list to generate -# a linkman-drivertool-names.txt file, but historically remain part of -# MAN/HTML_CLIENT_PAGES in the bigger picture. -SRC_DRIVERTOOL_PAGES = \ - nut-driver-enumerator.txt \ - upsdrvctl.txt \ - upsdrvsvcctl.txt - SRC_CLIENT_PAGES = \ - $(SRC_DRIVERTOOL_PAGES) \ nutupsdrv.txt \ upsc.txt \ upscmd.txt \ upsd.txt \ + upsdrvctl.txt \ upslog.txt \ upsmon.txt \ upsrw.txt \ upssched.txt -if WITH_MANS MAN_CLIENT_PAGES = \ nutupsdrv.8 \ - nut-driver-enumerator.8 \ upsc.8 \ upscmd.8 \ upsd.8 \ upsdrvctl.8 \ - upsdrvsvcctl.8 \ upslog.8 \ upsmon.8 \ upsrw.8 \ upssched.8 -endif man8_MANS = $(MAN_CLIENT_PAGES) HTML_CLIENT_MANS = \ nutupsdrv.html \ - nut-driver-enumerator.html \ upsc.html \ upscmd.html \ upsd.html \ upsdrvctl.html \ - upsdrvsvcctl.html \ upslog.html \ upsmon.html \ upsrw.html \ @@ -100,9 +76,7 @@ HTML_CLIENT_MANS = \ SRC_TOOL_PAGES = nut-scanner.txt nut-recorder.txt -if WITH_MANS MAN_TOOL_PAGES = nut-scanner.8 nut-recorder.8 -endif man8_MANS += $(MAN_TOOL_PAGES) @@ -117,7 +91,6 @@ SRC_CGI_PAGES = \ upsstats.cgi.txt \ upsimage.cgi.txt -if WITH_MANS MAN5_CGI_PAGES = \ hosts.conf.5 \ upsset.conf.5 \ @@ -127,11 +100,11 @@ MAN8_CGI_PAGES = \ upsset.cgi.8 \ upsstats.cgi.8 \ upsimage.cgi.8 -endif if WITH_CGI -man5_MANS += $(MAN5_CGI_PAGES) -man8_MANS += $(MAN8_CGI_PAGES) + man5_MANS += $(MAN5_CGI_PAGES) + + man8_MANS += $(MAN8_CGI_PAGES) endif HTML_CGI_MANS = \ @@ -172,7 +145,7 @@ SRC_DEV_PAGES = \ nutscan.txt \ nutscan_scan_snmp.txt \ nutscan_scan_usb.txt \ - nutscan_scan_xml_http_range.txt \ + nutscan_scan_xml_http.txt \ nutscan_scan_nut.txt \ nutscan_scan_avahi.txt \ nutscan_scan_ipmi.txt \ @@ -189,66 +162,7 @@ SRC_DEV_PAGES = \ libupsclient-config.txt \ skel.txt -if WITH_MANS # NOTE: nutclient_*.3 has no source counterpart (libnutclient_*.txt) - -LIBNUTCLIENT_MISC_DEPS= \ - nutclient_authenticate.3 \ - nutclient_logout.3 \ - nutclient_device_login.3 \ - nutclient_get_device_num_logins.3 \ - nutclient_device_master.3 \ - nutclient_device_forced_shutdown.3 - -$(LIBNUTCLIENT_MISC_DEPS): libnutclient_misc.3 - touch $@ - -LIBNUTCLIENT_TCP_DEPS= \ - nutclient_tcp_create_client.3 \ - nutclient_tcp_disconnect.3 \ - nutclient_tcp_get_timeout.3 \ - nutclient_tcp_is_connected.3 \ - nutclient_tcp_reconnect.3 \ - nutclient_tcp_set_timeout.3 - -$(LIBNUTCLIENT_TCP_DEPS): libnutclient_tcp.3 - touch $@ - -LIBNUTCLIENT_GENERAL_DEPS= \ - nutclient_destroy.3 - -$(LIBNUTCLIENT_GENERAL_DEPS): libnutclient_general.3 - touch $@ - -LIBNUTCLIENT_VARIABLES_DEPS= \ - nutclient_get_device_rw_variables.3 \ - nutclient_get_device_variable_description.3 \ - nutclient_get_device_variables.3 \ - nutclient_get_device_variable_values.3 \ - nutclient_has_device_variable.3 \ - nutclient_set_device_variable_value.3 \ - nutclient_set_device_variable_values.3 - -$(LIBNUTCLIENT_VARIABLES_DEPS): libnutclient_variables.3 - touch $@ - -LIBNUTCLIENT_COMMANDS_DEPS= \ - nutclient_execute_device_command.3 \ - nutclient_get_device_command_description.3 \ - nutclient_get_device_commands.3 \ - nutclient_has_device_command.3 - -$(LIBNUTCLIENT_COMMANDS_DEPS): libnutclient_commands.3 - touch $@ - -LIBNUTCLIENT_DEVICES_DEPS= \ - nutclient_get_device_description.3 \ - nutclient_get_devices.3 \ - nutclient_has_device.3 - -$(LIBNUTCLIENT_DEVICES_DEPS): libnutclient_devices.3 - touch $@ - MAN3_DEV_PAGES = \ upsclient.3 \ upscli_add_host_cert.3 \ @@ -261,9 +175,7 @@ MAN3_DEV_PAGES = \ upscli_list_next.3 \ upscli_list_start.3 \ upscli_readline.3 \ - upscli_readline_timeout.3 \ upscli_sendline.3 \ - upscli_sendline_timeout.3 \ upscli_splitaddr.3 \ upscli_splitname.3 \ upscli_ssl.3 \ @@ -271,21 +183,42 @@ MAN3_DEV_PAGES = \ upscli_upserror.3 \ libnutclient.3 \ libnutclient_commands.3 \ - $(LIBNUTCLIENT_COMMANDS_DEPS) \ libnutclient_devices.3 \ - $(LIBNUTCLIENT_DEVICES_DEPS) \ libnutclient_general.3 \ - $(LIBNUTCLIENT_GENERAL_DEPS) \ libnutclient_misc.3 \ - $(LIBNUTCLIENT_MISC_DEPS) \ libnutclient_tcp.3 \ - $(LIBNUTCLIENT_TCP_DEPS) \ libnutclient_variables.3 \ - $(LIBNUTCLIENT_VARIABLES_DEPS) \ + nutclient_authenticate.3 \ + nutclient_destroy.3 \ + nutclient_device_forced_shutdown.3 \ + nutclient_device_login.3 \ + nutclient_device_master.3 \ + nutclient_execute_device_command.3 \ + nutclient_get_device_command_description.3 \ + nutclient_get_device_commands.3 \ + nutclient_get_device_description.3 \ + nutclient_get_device_num_logins.3 \ + nutclient_get_device_rw_variables.3 \ + nutclient_get_devices.3 \ + nutclient_get_device_variable_description.3 \ + nutclient_get_device_variables.3 \ + nutclient_get_device_variable_values.3 \ + nutclient_has_device.3 \ + nutclient_has_device_command.3 \ + nutclient_has_device_variable.3 \ + nutclient_logout.3 \ + nutclient_set_device_variable_value.3 \ + nutclient_set_device_variable_values.3 \ + nutclient_tcp_create_client.3 \ + nutclient_tcp_disconnect.3 \ + nutclient_tcp_get_timeout.3 \ + nutclient_tcp_is_connected.3 \ + nutclient_tcp_reconnect.3 \ + nutclient_tcp_set_timeout.3 \ nutscan.3 \ nutscan_scan_snmp.3 \ nutscan_scan_usb.3 \ - nutscan_scan_xml_http_range.3 \ + nutscan_scan_xml_http.3 \ nutscan_scan_nut.3 \ nutscan_scan_avahi.3 \ nutscan_scan_ipmi.3 \ @@ -300,21 +233,14 @@ MAN3_DEV_PAGES = \ nutscan_get_serial_ports_list.3 \ nutscan_init.3 -upscli_readline_timeout.3: upscli_readline.3 - touch $@ - -upscli_sendline_timeout.3: upscli_sendline.3 - touch $@ - MAN1_DEV_PAGES = \ libupsclient-config.1 -endif if WITH_DEV -man3_MANS = $(MAN3_DEV_PAGES) + man3_MANS = $(MAN3_DEV_PAGES) if !WITH_PKG_CONFIG -man1_MANS = $(MAN1_DEV_PAGES) + man1_MANS = $(MAN1_DEV_PAGES) endif # WITH_DEV endif @@ -347,7 +273,7 @@ HTML_DEV_MANS = \ nutscan.html \ nutscan_scan_snmp.html \ nutscan_scan_usb.html \ - nutscan_scan_xml_http_range.html \ + nutscan_scan_xml_http.html \ nutscan_scan_nut.html \ nutscan_scan_avahi.html \ nutscan_scan_ipmi.html \ @@ -369,7 +295,7 @@ HTML_DEV_MANS = \ # (--with-drivers=...) if SOME_DRIVERS -man8_MANS += $(DRIVER_MAN_LIST) + man8_MANS += $(DRIVER_MAN_LIST) else @@ -403,8 +329,7 @@ SRC_SERIAL_PAGES = \ mge-utalk.txt \ oneac.txt \ microdowell.txt \ - microsol-apc.txt \ - nutdrv_siemens_sitop.txt \ + nutdrv_qx.txt \ optiups.txt \ powercom.txt \ powerpanel.txt \ @@ -418,7 +343,6 @@ SRC_SERIAL_PAGES = \ victronups.txt \ apcupsd-ups.txt -if WITH_MANS MAN_SERIAL_PAGES = \ al175.8 \ apcsmart.8 \ @@ -445,10 +369,9 @@ MAN_SERIAL_PAGES = \ metasys.8 \ mge-shut.8 \ mge-utalk.8 \ + nutdrv_qx.8 \ oneac.8 \ microdowell.8 \ - microsol-apc.8 \ - nutdrv_siemens_sitop.8 \ optiups.8 \ powercom.8 \ powerpanel.8 \ @@ -461,10 +384,9 @@ MAN_SERIAL_PAGES = \ upscode2.8 \ victronups.8 \ apcupsd-ups.8 -endif if WITH_SERIAL -man8_MANS += $(MAN_SERIAL_PAGES) + man8_MANS += $(MAN_SERIAL_PAGES) endif HTML_SERIAL_MANS = \ @@ -493,10 +415,9 @@ HTML_SERIAL_MANS = \ metasys.html \ mge-shut.html \ mge-utalk.html \ + nutdrv_qx.html \ oneac.html \ microdowell.html \ - microsol-apc.html \ - nutdrv_siemens_sitop.html \ optiups.html \ powercom.html \ powerpanel.html \ @@ -512,12 +433,10 @@ HTML_SERIAL_MANS = \ # (--with-snmp) SRC_SNMP_PAGES = snmp-ups.txt -if WITH_MANS MAN_SNMP_PAGES = snmp-ups.8 -endif if WITH_SNMP -man8_MANS += $(MAN_SNMP_PAGES) + man8_MANS += $(MAN_SNMP_PAGES) endif HTML_SNMP_MANS = snmp-ups.html @@ -527,143 +446,77 @@ SRC_USB_LIBUSB_PAGES = \ bcmxcp_usb.txt \ blazer-common.txt \ blazer_usb.txt \ - nutdrv_atcl_usb.txt \ + nutdrv_qx.txt \ richcomm_usb.txt \ riello_usb.txt \ tripplite_usb.txt \ usbhid-ups.txt -if WITH_MANS MAN_USB_LIBUSB_PAGES = \ bcmxcp_usb.8 \ blazer_usb.8 \ - nutdrv_atcl_usb.8 \ + nutdrv_qx.8 \ richcomm_usb.8 \ riello_usb.8 \ tripplite_usb.8 \ usbhid-ups.8 -endif if WITH_USB -man8_MANS += $(MAN_USB_LIBUSB_PAGES) + man8_MANS += $(MAN_USB_LIBUSB_PAGES) endif HTML_USB_LIBUSB_MANS = \ bcmxcp_usb.html \ blazer_usb.html \ - nutdrv_atcl_usb.html \ + nutdrv_qx.html \ richcomm_usb.html \ riello_usb.html \ tripplite_usb.html \ usbhid-ups.html -# (--with-serial / --with-usb) -SRC_SERIAL_USB_PAGES = \ - nutdrv_qx.txt - -if WITH_MANS -MAN_SERIAL_USB_PAGES = \ - nutdrv_qx.8 -endif - -if WITH_SERIAL -man8_MANS += $(MAN_SERIAL_USB_PAGES) -else -if WITH_USB -man8_MANS += $(MAN_SERIAL_USB_PAGES) -endif -endif - -HTML_SERIAL_USB_MANS = \ - nutdrv_qx.html - # (--with-neon) SRC_NETXML_PAGES = netxml-ups.txt -if WITH_MANS MAN_NETXML_PAGES = netxml-ups.8 -endif if WITH_NEON -man8_MANS += $(MAN_NETXML_PAGES) + man8_MANS += $(MAN_NETXML_PAGES) endif HTML_NETXML_MANS = netxml-ups.html # (--with-powerman) SRC_POWERMAN_PAGES = powerman-pdu.txt -if WITH_MANS MAN_POWERMAN_PAGES = powerman-pdu.8 -endif if WITH_LIBPOWERMAN -man8_MANS += $(MAN_POWERMAN_PAGES) + man8_MANS += $(MAN_POWERMAN_PAGES) endif HTML_POWERMAN_MANS = powerman-pdu.html # (--with-ipmi) SRC_IPMIPSU_PAGES = nut-ipmipsu.txt -if WITH_MANS MAN_IPMIPSU_PAGES = nut-ipmipsu.8 -endif if WITH_IPMI -man8_MANS += $(MAN_IPMIPSU_PAGES) + man8_MANS += $(MAN_IPMIPSU_PAGES) endif HTML_IPMIPSU_MANS = nut-ipmipsu.html SRC_MACOSX_PAGES = macosx-ups.txt -if WITH_MANS MAN_MACOSX_PAGES = macosx-ups.8 -endif if WITH_MACOSX -man8_MANS += $(MAN_MACOSX_PAGES) + man8_MANS += $(MAN_MACOSX_PAGES) endif HTML_MACOSX_MANS = macosx-ups.html -SRC_MODBUS_PAGES = phoenixcontact_modbus.txt \ - generic_modbus.txt \ - huawei-ups2000.txt \ - socomec_jbus.txt \ - adelsystem_cbi.txt -if WITH_MANS -MAN_MODBUS_PAGES = phoenixcontact_modbus.8 \ - generic_modbus.8 \ - huawei-ups2000.8 \ - socomec_jbus.8 \ - adelsystem_cbi.8 -endif - -if WITH_MODBUS -man8_MANS += $(MAN_MODBUS_PAGES) -endif - -HTML_MODBUS_MANS = phoenixcontact_modbus.html \ - generic_modbus.html \ - huawei-ups2000.html \ - socomec_jbus.html \ - adelsystem_cbi.html - -SRC_LINUX_I2C_PAGES = asem.txt pijuice.txt -if WITH_MANS -MAN_LINUX_I2C_PAGES = asem.8 pijuice.8 -endif - -if WITH_LINUX_I2C -man8_MANS += $(MAN_LINUX_I2C_PAGES) -endif - -HTML_LINUX_I2C_MANS = asem.html pijuice.html - # SOME_DRIVERS endif -MAN_MANS = -if WITH_MANS -MAN_MANS += \ +MAN_MANS = \ $(MAN_CONF_PAGES) \ $(MAN_CLIENT_PAGES) \ $(MAN_TOOL_PAGES) \ @@ -674,60 +527,29 @@ MAN_MANS += \ $(MAN_SERIAL_PAGES) \ $(MAN_SNMP_PAGES) \ $(MAN_USB_LIBUSB_PAGES) \ - $(MAN_SERIAL_USB_PAGES) \ $(MAN_NETXML_PAGES) \ $(MAN_POWERMAN_PAGES) \ $(MAN_IPMIPSU_PAGES) \ - $(MAN_MACOSX_PAGES) \ - $(MAN_MODBUS_PAGES) \ - $(MAN_LINUX_I2C_PAGES) -endif - -SRC_DRIVERS_PAGES = \ - $(SRC_SERIAL_PAGES) \ - $(SRC_SNMP_PAGES) \ - $(SRC_USB_LIBUSB_PAGES) \ - $(SRC_SERIAL_USB_PAGES) \ - $(SRC_NETXML_PAGES) \ - $(SRC_POWERMAN_PAGES) \ - $(SRC_IPMIPSU_PAGES) \ - $(SRC_MACOSX_PAGES) \ - $(SRC_MODBUS_PAGES) \ - $(SRC_LINUX_I2C_PAGES) + $(MAN_MACOSX_PAGES) # distribute everything, even those not installed by default # Note that 'dist' target requires AsciiDoc! -SRC_ALL_PAGES = \ +EXTRA_DIST = \ $(SRC_CONF_PAGES) \ $(SRC_CLIENT_PAGES) \ $(SRC_TOOL_PAGES) \ $(SRC_CGI_PAGES) \ $(SRC_DEV_PAGES) \ - $(SRC_DRIVERS_PAGES) - -EXTRA_DIST = \ - $(SRC_ALL_PAGES) \ + $(SRC_SERIAL_PAGES) \ + $(SRC_SNMP_PAGES) \ + $(SRC_USB_LIBUSB_PAGES) \ + $(SRC_NETXML_PAGES) \ + $(SRC_POWERMAN_PAGES) \ + $(SRC_IPMIPSU_PAGES) \ + $(SRC_MACOSX_PAGES) \ $(MAN_MANS) \ asciidoc.conf -if ! WITH_MANS -if ! SKIP_MANS -# Cause "make dist" to fail, unless caller (like the stack of distcheck-dmf) -# runs ./configure --with-doc=skip (or --with-doc=man=skip specifically) -EXTRA_DIST += dist -dist: - @echo "ERROR: Manpage building was disabled by configure script, and these pages are required for our proper 'make dist'" >&2 ; false -endif -endif - -# For builds done from dist'ed sources, there may be a conflict of timestamps -# between original *.txt files and pre-built manpages etc. leading to skipping -# of manpage re-generation even if that activity is possible and requested. -# Possibly a cleaner, but less portable, solution would be to touch the -# generated files to long ago. Current solution assumes good valid clocks :) -dist-hook: - @echo "Fix up manpage source timestamps" && cd $(distdir) && touch $(SRC_ALL_PAGES) - HTML_MANS = \ $(HTML_CONF_MANS) \ $(HTML_CLIENT_MANS) \ @@ -737,303 +559,64 @@ HTML_MANS = \ $(HTML_SERIAL_MANS) \ $(HTML_SNMP_MANS) \ $(HTML_USB_LIBUSB_MANS) \ - $(HTML_SERIAL_USB_MANS) \ $(HTML_NETXML_MANS) \ $(HTML_POWERMAN_MANS) \ $(HTML_IPMIPSU_MANS) \ - $(HTML_MACOSX_MANS) \ - $(HTML_MODBUS_MANS) \ - $(HTML_LINUX_I2C_MANS) - -# Note: target documents, except nutupsdrv.txt itself, start the -# list of drivers with `- linkman:nutupsdrv[8]` entry -# To regenerate these files, do `make distclean` first -LINKMAN_INCLUDE_GENERATED = linkman-driver-names.txt linkman-drivertool-names.txt -LINKMAN_INCLUDE_CONSUMERS = index.txt upsd.txt nutupsdrv.txt - -linkman-driver-names.txt: - @if test x"$(srcdir)" != x"$(builddir)" ; then \ - if ! test -s "$(builddir)/$@" && test -s "$(srcdir)/$(@F)" ; then \ - ln -fs "$(srcdir)/$(@F)" "$(builddir)/" ; \ - fi ; \ - fi - @if test -s "$@" ; then exit 0 ; fi ; \ - (LC_ALL=C; LANG=C; export LC_ALL LANG; \ - for F in $(SRC_DRIVERS_PAGES) ; do echo "$$F" ; done \ - | grep -vE '^nutupsdrv\.txt$$' \ - | sort -n | uniq \ - | sed 's,^\(.*\)\.txt$$,- linkman:\1[8],' ; \ - ) > "$@" - -linkman-drivertool-names.txt: - @if test x"$(srcdir)" != x"$(builddir)" ; then \ - if ! test -s "$(builddir)/$@" && test -s "$(srcdir)/$(@F)" ; then \ - ln -fs "$(srcdir)/$(@F)" "$(builddir)/" ; \ - fi ; \ - fi - @if test -s "$@" ; then exit 0 ; fi ; \ - (LC_ALL=C; LANG=C; export LC_ALL LANG; \ - for F in $(SRC_DRIVERTOOL_PAGES) ; do echo "$$F" ; done \ - | sort -n | uniq \ - | sed 's,^\(.*\)\.txt$$,- linkman:\1[8],' ; \ - ) > "$@" - -# Dependencies are about particular filenames, since over time -# we might have several use-cases for LINKMAN_INCLUDE_GENERATED: -$(LINKMAN_INCLUDE_CONSUMERS): linkman-driver-names.txt linkman-drivertool-names.txt - -# These files are generated when we build from git source so not tracked in -# git, and not part of tarball (to be in builddir) - so not in EXTRA_DIST. -DISTCLEANFILES = $(LINKMAN_INCLUDE_GENERATED) + $(HTML_MACOSX_MANS) all: -all-html html-man: $(HTML_MANS) index.html +man-index.html: index.html + cp -f $< $@ -# Have a way to build all man pages, not just those that fit currently -# configured drivers, daemons, developer aspect, etc. -all-man man-man: $(MAN_MANS) +html-man: $(HTML_MANS) man-index.html -if WITH_MANS -if ! SKIP_MANS -check-local: check-man -else -check-local: check-man-txt check-man-pages - @echo "Man-page generation was SKIPPED per user request, so pregenerated pages were sanity-checked (if any)" >&2 -endif -else -check-local: check-man-txt check-man-pages - @echo "Man-page generation was not done, so pregenerated pages were sanity-checked (if any)" >&2 -endif - -check-man: check-man-txt check-man-pages check-html-man - -# the "for" loops might better use $^ but it might be not portable -check-man-html: check-html-man - -check-html-man: $(HTML_MANS) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(HTML_MANS) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-man sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-man sanity check (checked $$CHECKED files)"; exit 0 - -# Note: many man-pages here have code samples and are mis-identified as C code -check-man-page: check-man-pages - -# Man-pages may be pre-generated (srcdir), or re-built (builddir) -check-man-pages: $(MAN_MANS) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(MAN_MANS) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - ( test -s "$(abs_srcdir)/$$F" && { file "$(abs_srcdir)/$$F" | $(EGREP) -i '(roff.* input|C source|ASCII text)' > /dev/null ; } ) || \ - ( test -s "$(abs_builddir)/$$F" && { file "$(abs_builddir)/$$F" | $(EGREP) -i '(roff.* input|C source|ASCII text)' > /dev/null ; } ) || \ - FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED man-page sanity check for:$$FAILED" >&2 ; \ - ( echo "SRCDIR:"; cd "$(abs_srcdir)/" && file $$FAILED ; \ - echo "BUILDDIR:"; cd "$(abs_builddir)/" && file $$FAILED ; \ - ) >&2 ; exit 1; \ - fi; echo "PASSED man-page sanity check (checked $$CHECKED files)"; exit 0 - -check-man-source: check-man-txt - -# Note: (GNU) make can helpfully add VPATH to the short source filenames -# which we had listed above, so the "case" below handles two possibilities -check-man-txt: $(SRC_ALL_PAGES) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - ( cd $(abs_srcdir) ) || exit; \ - for F in $(SRC_ALL_PAGES) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - case "$$F" in \ - */*) ;; \ - *) F="$(abs_srcdir)/$$F" ;; \ - esac ; \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(ASCII|UTF-8|Unicode|ISO-8859|English).* text' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED man-source sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED man-source sanity check (checked $$CHECKED files)"; exit 0 - -CLEANFILES = *-spellchecked +CLEANFILES = *.xml *.html SUFFIXES = .txt .html .1 .3 .5 .8 -# For builds with allowed installation of prebuild man pages, check that -# they exist in sources (make would pull them automatically as a fallback -# from failed lookup in build products). For builds that require rebuild -# of man pages, abort with error if build product is missing. -if DOC_INSTALL_DISTED_MANS -SRC_PREBUILT_CLAUSE=|| [ -r "$(srcdir)/`basename $@`" ] -else -SRC_PREBUILT_CLAUSE= -endif - if HAVE_ASCIIDOC -CLEANFILES += *.1 *.3 *.5 *.8 *.xml *.html *.pdf - -# Working around a2x not friendly to parallelized runs. -# See more details in the main NUT docs/Makefile.am -DOCBUILD_BEGIN = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - rm -rf "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ - mkdir -p "./$${A2X_OUTDIR}" || exit ; \ - for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ - if [ -s "./$$F" ] ; then ln -f -s "../../$$F" "./$${A2X_OUTDIR}/" ; else \ - if [ -s "$(abs_srcdir)/$$F" ] ; then ln -f -s "$(abs_srcdir)/$$F" "./$${A2X_OUTDIR}/" ; fi ; fi ; \ - done ; \ - else A2X_OUTDIR='.' ; fi; \ - if test -s "${builddir}/docbook-xsl.css" \ - && test -r "${builddir}/docbook-xsl.css" \ - && ! test -w "${builddir}/docbook-xsl.css" \ - ; then chmod u+w "${builddir}/docbook-xsl.css" ; fi ; \ - chmod -R u+w "./$${A2X_OUTDIR}" || true ; \ - if test x"$(srcdir)" != x"$(builddir)" ; then \ - if ! test -s "$(builddir)/$<" && test -s "$(srcdir)/`basename $<`" ; then \ - ln -fs "$(srcdir)/`basename $<`" "$(builddir)/" ; \ - fi ; \ - fi ; \ - A2X_VERBOSE="$(ASCIIDOC_VERBOSE)"; if [ "$(V)" = 1 ]; then A2X_VERBOSE="--verbose"; fi; \ -} - -# Note that documents with sub-pages (see LIBNUTCLIENT_*_DEPS above) -# may generate multiple files in one go... so we move "*" and hope -# for no required hidden files (or would have to `find` them all). -DOCBUILD_END = { \ - if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ - chmod -R u+w "./$${A2X_OUTDIR}" || true ; \ - test -d "$@" && rm -rf "$@" || true ; \ - for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ - rm -f "./$${A2X_OUTDIR}/$$F" || true ; \ - done ; \ - mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \ - mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \ - rm -rf "./$${A2X_OUTDIR}" ; \ - fi ; \ -} - -### Regarding absolute paths in attributes below: by default asciidoc -### resolves include paths relative to the main document, so while we -### see the relative builddir as "." in the makefile, for included -### data it would mean the source directory where the .txt resides. .txt.html: - @A2X_OUTDIR="tmp/man-html.$(@F).$$$$" ; \ - echo " DOC-MAN-HTML Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(ASCIIDOC) --backend=xhtml11 $${A2X_VERBOSE} \ - --attribute localdate="`TZ=UTC date +%Y-%m-%d`" \ - --attribute localtime="`TZ=UTC date +%H:%M:%S`" \ - --attribute nutversion="@PACKAGE_VERSION@" \ - --attribute srcdir="$(abs_srcdir)" \ - --attribute builddir="$(abs_builddir)" \ - -o "$${A2X_OUTDIR}/$(@F)" $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(ASCIIDOC) --backend=xhtml11 \ + --attribute localdate=`TZ=UTC date +%Y-%m-%d` \ + --attribute localtime=`TZ=UTC date +%H:%M:%S` \ + -o $@ $< ### Prior to Asciidoc ~8.6.8, the --destination-dir flag didn't seem to affect the location of the intermediate .xml file. -### This parameter is currently required; see docs/Makefile.am for more detail. -A2X_MANPAGE_OPTS = --doctype manpage --format manpage $${A2X_VERBOSE} \ - --xsltproc-opts="--nonet" \ +A2X_MANPAGE_OPTS = --doctype manpage --format manpage \ --attribute mansource="Network UPS Tools" \ --attribute manversion="@PACKAGE_VERSION@" \ --attribute manmanual="NUT Manual" \ - --attribute srcdir="$(abs_srcdir)" \ - --attribute builddir="$(abs_builddir)" \ - --destination-dir="$${A2X_OUTDIR}" + --destination-dir=. .txt.1: - @A2X_OUTDIR="tmp/man1.$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_MANPAGE_OPTS) $< .txt.3: - @A2X_OUTDIR="tmp/man3.$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_MANPAGE_OPTS) $< .txt.5: - @A2X_OUTDIR="tmp/man5.$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_MANPAGE_OPTS) $< .txt.8: - @A2X_OUTDIR="tmp/man8.$(@F).$$$$" ; \ - echo " DOC-MAN Generating $@"; \ - $(DOCBUILD_BEGIN) ; RES=0; \ - $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ - $(DOCBUILD_END) ; exit $$RES + $(A2X) $(A2X_MANPAGE_OPTS) $< else !HAVE_ASCIIDOC .txt.html: - @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ - echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ - else \ - echo "Could not find prebuilt $@ manual page." ; \ - echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ - exit 1; \ - fi + @echo "Not (re)building $@ manual page, since 'asciidoc' was not found." .txt.1: - @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ - echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ - else \ - echo "Could not find prebuilt $@ manual page." ; \ - echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ - exit 1; \ - fi + @echo "Using existing $@ manual page, since 'asciidoc' was not found." .txt.3: - @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ - echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ - else \ - echo "Could not find prebuilt $@ manual page." ; \ - echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ - exit 1; \ - fi + @echo "Using existing $@ manual page, since 'asciidoc' was not found." .txt.5: - @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ - echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ - else \ - echo "Could not find prebuilt $@ manual page." ; \ - echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ - exit 1; \ - fi + @echo "Using existing $@ manual page, since 'asciidoc' was not found." .txt.8: - @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ - echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ - else \ - echo "Could not find prebuilt $@ manual page." ; \ - echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ - exit 1; \ - fi + @echo "Using existing $@ manual page, since 'asciidoc' was not found." endif !HAVE_ASCIIDOC - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here -# by a wildcard target in case the make implementation can put the two together. -*.txt-spellchecked: Makefile.am $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -.txt.txt-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SRC_ALL_PAGES)" SPELLCHECK_DIR="$(srcdir)" $@ - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -clean-local: - rm -rf tmp diff --git a/docs/man/Makefile.in b/docs/man/Makefile.in index b0610d3..94f03a1 100644 --- a/docs/man/Makefile.in +++ b/docs/man/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -20,73 +21,31 @@ # Notes: # - sources (.txt) and groff formats are both distributed, # - only sources are versioned ; groff files are generated at worst -# during 'make dist' (while preparing a release tarball) +# during 'make dist' # - HTML files are built upon request, if AsciiDoc is available, # - groff update will only happen if AsciiDoc is available too, # - all this can probably (and hopefully) be improved, but I've not # found a way to do pattern replacement on the fly for target deps! # FIXME: investigate an autogen.sh hook # - Ref: http://www.gnu.org/software/hello/manual/automake/Man-pages.html -# - WITH_MANS can be enabled if either we are building man-pages, or if -# the --with-doc=man=auto detected an inability to build the man-pages -# but enabled the DOC_INSTALL_DISTED_MANS toggle so we deliver disted -# files from source tree VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -116,57 +75,24 @@ target_triplet = @target@ @SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__append_4 = $(MAN_SERIAL_PAGES) @SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__append_5 = $(MAN_SNMP_PAGES) @SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__append_6 = $(MAN_USB_LIBUSB_PAGES) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__append_7 = $(MAN_SERIAL_USB_PAGES) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_FALSE@@WITH_USB_TRUE@am__append_8 = $(MAN_SERIAL_USB_PAGES) -@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__append_9 = $(MAN_NETXML_PAGES) -@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_10 = $(MAN_POWERMAN_PAGES) -@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__append_11 = $(MAN_IPMIPSU_PAGES) -@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__append_12 = $(MAN_MACOSX_PAGES) -@SOME_DRIVERS_FALSE@@WITH_MODBUS_TRUE@am__append_13 = $(MAN_MODBUS_PAGES) -@SOME_DRIVERS_FALSE@@WITH_LINUX_I2C_TRUE@am__append_14 = $(MAN_LINUX_I2C_PAGES) -@WITH_MANS_TRUE@am__append_15 = \ -@WITH_MANS_TRUE@ $(MAN_CONF_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_CLIENT_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_TOOL_PAGES) \ -@WITH_MANS_TRUE@ $(MAN5_CGI_PAGES) \ -@WITH_MANS_TRUE@ $(MAN8_CGI_PAGES) \ -@WITH_MANS_TRUE@ $(MAN1_DEV_PAGES) \ -@WITH_MANS_TRUE@ $(MAN3_DEV_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_SERIAL_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_SNMP_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_USB_LIBUSB_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_SERIAL_USB_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_NETXML_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_POWERMAN_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_IPMIPSU_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_MACOSX_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_MODBUS_PAGES) \ -@WITH_MANS_TRUE@ $(MAN_LINUX_I2C_PAGES) - - -# Cause "make dist" to fail, unless caller (like the stack of distcheck-dmf) -# runs ./configure --with-doc=skip (or --with-doc=man=skip specifically) -@SKIP_MANS_FALSE@@WITH_MANS_FALSE@am__append_16 = dist -@HAVE_ASCIIDOC_TRUE@am__append_17 = *.1 *.3 *.5 *.8 *.xml *.html *.pdf +@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__append_7 = $(MAN_NETXML_PAGES) +@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_8 = $(MAN_POWERMAN_PAGES) +@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__append_9 = $(MAN_IPMIPSU_PAGES) +@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__append_10 = $(MAN_MACOSX_PAGES) subdir = docs/man +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -175,33 +101,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -244,17 +153,13 @@ man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 NROFF = nroff MANS = $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -265,7 +170,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -279,7 +183,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -289,13 +192,14 @@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ - -# Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) -EGREP = egrep +EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -305,15 +209,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -324,29 +227,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -366,9 +261,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -377,16 +269,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -400,7 +288,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -411,12 +298,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -435,21 +318,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -459,7 +339,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -#EGREP = grep -E # Base configuration and client manpages, always installed SRC_CONF_PAGES = \ @@ -470,13 +349,13 @@ SRC_CONF_PAGES = \ upsmon.conf.txt \ upssched.conf.txt -@WITH_MANS_TRUE@MAN_CONF_PAGES = \ -@WITH_MANS_TRUE@ nut.conf.5 \ -@WITH_MANS_TRUE@ ups.conf.5 \ -@WITH_MANS_TRUE@ upsd.conf.5 \ -@WITH_MANS_TRUE@ upsd.users.5 \ -@WITH_MANS_TRUE@ upsmon.conf.5 \ -@WITH_MANS_TRUE@ upssched.conf.5 +MAN_CONF_PAGES = \ + nut.conf.5 \ + ups.conf.5 \ + upsd.conf.5 \ + upsd.users.5 \ + upsmon.conf.5 \ + upssched.conf.5 man5_MANS = $(MAN_CONF_PAGES) $(am__append_1) HTML_CONF_MANS = \ @@ -487,59 +366,45 @@ HTML_CONF_MANS = \ upsmon.conf.html \ upssched.conf.html - -# NOTE: Currently SRC_DRIVERTOOL_PAGES are a separate list to generate -# a linkman-drivertool-names.txt file, but historically remain part of -# MAN/HTML_CLIENT_PAGES in the bigger picture. -SRC_DRIVERTOOL_PAGES = \ - nut-driver-enumerator.txt \ - upsdrvctl.txt \ - upsdrvsvcctl.txt - SRC_CLIENT_PAGES = \ - $(SRC_DRIVERTOOL_PAGES) \ nutupsdrv.txt \ upsc.txt \ upscmd.txt \ upsd.txt \ + upsdrvctl.txt \ upslog.txt \ upsmon.txt \ upsrw.txt \ upssched.txt -@WITH_MANS_TRUE@MAN_CLIENT_PAGES = \ -@WITH_MANS_TRUE@ nutupsdrv.8 \ -@WITH_MANS_TRUE@ nut-driver-enumerator.8 \ -@WITH_MANS_TRUE@ upsc.8 \ -@WITH_MANS_TRUE@ upscmd.8 \ -@WITH_MANS_TRUE@ upsd.8 \ -@WITH_MANS_TRUE@ upsdrvctl.8 \ -@WITH_MANS_TRUE@ upsdrvsvcctl.8 \ -@WITH_MANS_TRUE@ upslog.8 \ -@WITH_MANS_TRUE@ upsmon.8 \ -@WITH_MANS_TRUE@ upsrw.8 \ -@WITH_MANS_TRUE@ upssched.8 +MAN_CLIENT_PAGES = \ + nutupsdrv.8 \ + upsc.8 \ + upscmd.8 \ + upsd.8 \ + upsdrvctl.8 \ + upslog.8 \ + upsmon.8 \ + upsrw.8 \ + upssched.8 man8_MANS = $(MAN_CLIENT_PAGES) $(MAN_TOOL_PAGES) $(am__append_2) \ $(am__append_3) $(am__append_4) $(am__append_5) \ $(am__append_6) $(am__append_7) $(am__append_8) \ - $(am__append_9) $(am__append_10) $(am__append_11) \ - $(am__append_12) $(am__append_13) $(am__append_14) + $(am__append_9) $(am__append_10) HTML_CLIENT_MANS = \ nutupsdrv.html \ - nut-driver-enumerator.html \ upsc.html \ upscmd.html \ upsd.html \ upsdrvctl.html \ - upsdrvsvcctl.html \ upslog.html \ upsmon.html \ upsrw.html \ upssched.html SRC_TOOL_PAGES = nut-scanner.txt nut-recorder.txt -@WITH_MANS_TRUE@MAN_TOOL_PAGES = nut-scanner.8 nut-recorder.8 +MAN_TOOL_PAGES = nut-scanner.8 nut-recorder.8 HTML_TOOL_MANS = nut-scanner.html nut-recorder.html # CGI (--with-cgi) related manpages @@ -551,15 +416,15 @@ SRC_CGI_PAGES = \ upsstats.cgi.txt \ upsimage.cgi.txt -@WITH_MANS_TRUE@MAN5_CGI_PAGES = \ -@WITH_MANS_TRUE@ hosts.conf.5 \ -@WITH_MANS_TRUE@ upsset.conf.5 \ -@WITH_MANS_TRUE@ upsstats.html.5 +MAN5_CGI_PAGES = \ + hosts.conf.5 \ + upsset.conf.5 \ + upsstats.html.5 -@WITH_MANS_TRUE@MAN8_CGI_PAGES = \ -@WITH_MANS_TRUE@ upsset.cgi.8 \ -@WITH_MANS_TRUE@ upsstats.cgi.8 \ -@WITH_MANS_TRUE@ upsimage.cgi.8 +MAN8_CGI_PAGES = \ + upsset.cgi.8 \ + upsstats.cgi.8 \ + upsimage.cgi.8 HTML_CGI_MANS = \ hosts.conf.html \ @@ -599,7 +464,7 @@ SRC_DEV_PAGES = \ nutscan.txt \ nutscan_scan_snmp.txt \ nutscan_scan_usb.txt \ - nutscan_scan_xml_http_range.txt \ + nutscan_scan_xml_http.txt \ nutscan_scan_nut.txt \ nutscan_scan_avahi.txt \ nutscan_scan_ipmi.txt \ @@ -618,98 +483,78 @@ SRC_DEV_PAGES = \ # NOTE: nutclient_*.3 has no source counterpart (libnutclient_*.txt) -@WITH_MANS_TRUE@LIBNUTCLIENT_MISC_DEPS = \ -@WITH_MANS_TRUE@ nutclient_authenticate.3 \ -@WITH_MANS_TRUE@ nutclient_logout.3 \ -@WITH_MANS_TRUE@ nutclient_device_login.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_num_logins.3 \ -@WITH_MANS_TRUE@ nutclient_device_master.3 \ -@WITH_MANS_TRUE@ nutclient_device_forced_shutdown.3 +MAN3_DEV_PAGES = \ + upsclient.3 \ + upscli_add_host_cert.3 \ + upscli_cleanup.3 \ + upscli_connect.3 \ + upscli_disconnect.3 \ + upscli_fd.3 \ + upscli_get.3 \ + upscli_init.3 \ + upscli_list_next.3 \ + upscli_list_start.3 \ + upscli_readline.3 \ + upscli_sendline.3 \ + upscli_splitaddr.3 \ + upscli_splitname.3 \ + upscli_ssl.3 \ + upscli_strerror.3 \ + upscli_upserror.3 \ + libnutclient.3 \ + libnutclient_commands.3 \ + libnutclient_devices.3 \ + libnutclient_general.3 \ + libnutclient_misc.3 \ + libnutclient_tcp.3 \ + libnutclient_variables.3 \ + nutclient_authenticate.3 \ + nutclient_destroy.3 \ + nutclient_device_forced_shutdown.3 \ + nutclient_device_login.3 \ + nutclient_device_master.3 \ + nutclient_execute_device_command.3 \ + nutclient_get_device_command_description.3 \ + nutclient_get_device_commands.3 \ + nutclient_get_device_description.3 \ + nutclient_get_device_num_logins.3 \ + nutclient_get_device_rw_variables.3 \ + nutclient_get_devices.3 \ + nutclient_get_device_variable_description.3 \ + nutclient_get_device_variables.3 \ + nutclient_get_device_variable_values.3 \ + nutclient_has_device.3 \ + nutclient_has_device_command.3 \ + nutclient_has_device_variable.3 \ + nutclient_logout.3 \ + nutclient_set_device_variable_value.3 \ + nutclient_set_device_variable_values.3 \ + nutclient_tcp_create_client.3 \ + nutclient_tcp_disconnect.3 \ + nutclient_tcp_get_timeout.3 \ + nutclient_tcp_is_connected.3 \ + nutclient_tcp_reconnect.3 \ + nutclient_tcp_set_timeout.3 \ + nutscan.3 \ + nutscan_scan_snmp.3 \ + nutscan_scan_usb.3 \ + nutscan_scan_xml_http.3 \ + nutscan_scan_nut.3 \ + nutscan_scan_avahi.3 \ + nutscan_scan_ipmi.3 \ + nutscan_scan_eaton_serial.3 \ + nutscan_display_ups_conf.3 \ + nutscan_display_parsable.3 \ + nutscan_cidr_to_ip.3 \ + nutscan_new_device.3 \ + nutscan_free_device.3 \ + nutscan_add_option_to_device.3 \ + nutscan_add_device_to_device.3 \ + nutscan_get_serial_ports_list.3 \ + nutscan_init.3 -@WITH_MANS_TRUE@LIBNUTCLIENT_TCP_DEPS = \ -@WITH_MANS_TRUE@ nutclient_tcp_create_client.3 \ -@WITH_MANS_TRUE@ nutclient_tcp_disconnect.3 \ -@WITH_MANS_TRUE@ nutclient_tcp_get_timeout.3 \ -@WITH_MANS_TRUE@ nutclient_tcp_is_connected.3 \ -@WITH_MANS_TRUE@ nutclient_tcp_reconnect.3 \ -@WITH_MANS_TRUE@ nutclient_tcp_set_timeout.3 - -@WITH_MANS_TRUE@LIBNUTCLIENT_GENERAL_DEPS = \ -@WITH_MANS_TRUE@ nutclient_destroy.3 - -@WITH_MANS_TRUE@LIBNUTCLIENT_VARIABLES_DEPS = \ -@WITH_MANS_TRUE@ nutclient_get_device_rw_variables.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_variable_description.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_variables.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_variable_values.3 \ -@WITH_MANS_TRUE@ nutclient_has_device_variable.3 \ -@WITH_MANS_TRUE@ nutclient_set_device_variable_value.3 \ -@WITH_MANS_TRUE@ nutclient_set_device_variable_values.3 - -@WITH_MANS_TRUE@LIBNUTCLIENT_COMMANDS_DEPS = \ -@WITH_MANS_TRUE@ nutclient_execute_device_command.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_command_description.3 \ -@WITH_MANS_TRUE@ nutclient_get_device_commands.3 \ -@WITH_MANS_TRUE@ nutclient_has_device_command.3 - -@WITH_MANS_TRUE@LIBNUTCLIENT_DEVICES_DEPS = \ -@WITH_MANS_TRUE@ nutclient_get_device_description.3 \ -@WITH_MANS_TRUE@ nutclient_get_devices.3 \ -@WITH_MANS_TRUE@ nutclient_has_device.3 - -@WITH_MANS_TRUE@MAN3_DEV_PAGES = \ -@WITH_MANS_TRUE@ upsclient.3 \ -@WITH_MANS_TRUE@ upscli_add_host_cert.3 \ -@WITH_MANS_TRUE@ upscli_cleanup.3 \ -@WITH_MANS_TRUE@ upscli_connect.3 \ -@WITH_MANS_TRUE@ upscli_disconnect.3 \ -@WITH_MANS_TRUE@ upscli_fd.3 \ -@WITH_MANS_TRUE@ upscli_get.3 \ -@WITH_MANS_TRUE@ upscli_init.3 \ -@WITH_MANS_TRUE@ upscli_list_next.3 \ -@WITH_MANS_TRUE@ upscli_list_start.3 \ -@WITH_MANS_TRUE@ upscli_readline.3 \ -@WITH_MANS_TRUE@ upscli_readline_timeout.3 \ -@WITH_MANS_TRUE@ upscli_sendline.3 \ -@WITH_MANS_TRUE@ upscli_sendline_timeout.3 \ -@WITH_MANS_TRUE@ upscli_splitaddr.3 \ -@WITH_MANS_TRUE@ upscli_splitname.3 \ -@WITH_MANS_TRUE@ upscli_ssl.3 \ -@WITH_MANS_TRUE@ upscli_strerror.3 \ -@WITH_MANS_TRUE@ upscli_upserror.3 \ -@WITH_MANS_TRUE@ libnutclient.3 \ -@WITH_MANS_TRUE@ libnutclient_commands.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_COMMANDS_DEPS) \ -@WITH_MANS_TRUE@ libnutclient_devices.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_DEVICES_DEPS) \ -@WITH_MANS_TRUE@ libnutclient_general.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_GENERAL_DEPS) \ -@WITH_MANS_TRUE@ libnutclient_misc.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_MISC_DEPS) \ -@WITH_MANS_TRUE@ libnutclient_tcp.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_TCP_DEPS) \ -@WITH_MANS_TRUE@ libnutclient_variables.3 \ -@WITH_MANS_TRUE@ $(LIBNUTCLIENT_VARIABLES_DEPS) \ -@WITH_MANS_TRUE@ nutscan.3 \ -@WITH_MANS_TRUE@ nutscan_scan_snmp.3 \ -@WITH_MANS_TRUE@ nutscan_scan_usb.3 \ -@WITH_MANS_TRUE@ nutscan_scan_xml_http_range.3 \ -@WITH_MANS_TRUE@ nutscan_scan_nut.3 \ -@WITH_MANS_TRUE@ nutscan_scan_avahi.3 \ -@WITH_MANS_TRUE@ nutscan_scan_ipmi.3 \ -@WITH_MANS_TRUE@ nutscan_scan_eaton_serial.3 \ -@WITH_MANS_TRUE@ nutscan_display_ups_conf.3 \ -@WITH_MANS_TRUE@ nutscan_display_parsable.3 \ -@WITH_MANS_TRUE@ nutscan_cidr_to_ip.3 \ -@WITH_MANS_TRUE@ nutscan_new_device.3 \ -@WITH_MANS_TRUE@ nutscan_free_device.3 \ -@WITH_MANS_TRUE@ nutscan_add_option_to_device.3 \ -@WITH_MANS_TRUE@ nutscan_add_device_to_device.3 \ -@WITH_MANS_TRUE@ nutscan_get_serial_ports_list.3 \ -@WITH_MANS_TRUE@ nutscan_init.3 - -@WITH_MANS_TRUE@MAN1_DEV_PAGES = \ -@WITH_MANS_TRUE@ libupsclient-config.1 +MAN1_DEV_PAGES = \ + libupsclient-config.1 @WITH_DEV_TRUE@man3_MANS = $(MAN3_DEV_PAGES) @WITH_DEV_TRUE@@WITH_PKG_CONFIG_FALSE@man1_MANS = $(MAN1_DEV_PAGES) @@ -742,7 +587,7 @@ HTML_DEV_MANS = \ nutscan.html \ nutscan_scan_snmp.html \ nutscan_scan_usb.html \ - nutscan_scan_xml_http_range.html \ + nutscan_scan_xml_http.html \ nutscan_scan_nut.html \ nutscan_scan_avahi.html \ nutscan_scan_ipmi.html \ @@ -790,8 +635,7 @@ HTML_DEV_MANS = \ @SOME_DRIVERS_FALSE@ mge-utalk.txt \ @SOME_DRIVERS_FALSE@ oneac.txt \ @SOME_DRIVERS_FALSE@ microdowell.txt \ -@SOME_DRIVERS_FALSE@ microsol-apc.txt \ -@SOME_DRIVERS_FALSE@ nutdrv_siemens_sitop.txt \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.txt \ @SOME_DRIVERS_FALSE@ optiups.txt \ @SOME_DRIVERS_FALSE@ powercom.txt \ @SOME_DRIVERS_FALSE@ powerpanel.txt \ @@ -805,48 +649,47 @@ HTML_DEV_MANS = \ @SOME_DRIVERS_FALSE@ victronups.txt \ @SOME_DRIVERS_FALSE@ apcupsd-ups.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_SERIAL_PAGES = \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ al175.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ apcsmart.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ apcsmart-old.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bcmxcp.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ belkin.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ belkinunv.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bestfortress.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bestuferrups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bestups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bestfcom.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ blazer_ser.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ clone.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ dummy-ups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ etapro.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ everups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ gamatronic.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ genericups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ isbmex.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ ivtscd.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ liebert.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ liebert-esp2.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ masterguard.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ metasys.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ mge-shut.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ mge-utalk.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ oneac.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ microdowell.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ microsol-apc.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ nutdrv_siemens_sitop.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ optiups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ powercom.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ powerpanel.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ rhino.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ riello_ser.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ safenet.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ solis.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ tripplite.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ tripplitesu.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ upscode2.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ victronups.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ apcupsd-ups.8 +@SOME_DRIVERS_FALSE@MAN_SERIAL_PAGES = \ +@SOME_DRIVERS_FALSE@ al175.8 \ +@SOME_DRIVERS_FALSE@ apcsmart.8 \ +@SOME_DRIVERS_FALSE@ apcsmart-old.8 \ +@SOME_DRIVERS_FALSE@ bcmxcp.8 \ +@SOME_DRIVERS_FALSE@ belkin.8 \ +@SOME_DRIVERS_FALSE@ belkinunv.8 \ +@SOME_DRIVERS_FALSE@ bestfortress.8 \ +@SOME_DRIVERS_FALSE@ bestuferrups.8 \ +@SOME_DRIVERS_FALSE@ bestups.8 \ +@SOME_DRIVERS_FALSE@ bestfcom.8 \ +@SOME_DRIVERS_FALSE@ blazer_ser.8 \ +@SOME_DRIVERS_FALSE@ clone.8 \ +@SOME_DRIVERS_FALSE@ dummy-ups.8 \ +@SOME_DRIVERS_FALSE@ etapro.8 \ +@SOME_DRIVERS_FALSE@ everups.8 \ +@SOME_DRIVERS_FALSE@ gamatronic.8 \ +@SOME_DRIVERS_FALSE@ genericups.8 \ +@SOME_DRIVERS_FALSE@ isbmex.8 \ +@SOME_DRIVERS_FALSE@ ivtscd.8 \ +@SOME_DRIVERS_FALSE@ liebert.8 \ +@SOME_DRIVERS_FALSE@ liebert-esp2.8 \ +@SOME_DRIVERS_FALSE@ masterguard.8 \ +@SOME_DRIVERS_FALSE@ metasys.8 \ +@SOME_DRIVERS_FALSE@ mge-shut.8 \ +@SOME_DRIVERS_FALSE@ mge-utalk.8 \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.8 \ +@SOME_DRIVERS_FALSE@ oneac.8 \ +@SOME_DRIVERS_FALSE@ microdowell.8 \ +@SOME_DRIVERS_FALSE@ optiups.8 \ +@SOME_DRIVERS_FALSE@ powercom.8 \ +@SOME_DRIVERS_FALSE@ powerpanel.8 \ +@SOME_DRIVERS_FALSE@ rhino.8 \ +@SOME_DRIVERS_FALSE@ riello_ser.8 \ +@SOME_DRIVERS_FALSE@ safenet.8 \ +@SOME_DRIVERS_FALSE@ solis.8 \ +@SOME_DRIVERS_FALSE@ tripplite.8 \ +@SOME_DRIVERS_FALSE@ tripplitesu.8 \ +@SOME_DRIVERS_FALSE@ upscode2.8 \ +@SOME_DRIVERS_FALSE@ victronups.8 \ +@SOME_DRIVERS_FALSE@ apcupsd-ups.8 @SOME_DRIVERS_FALSE@HTML_SERIAL_MANS = \ @SOME_DRIVERS_FALSE@ al175.html \ @@ -874,10 +717,9 @@ HTML_DEV_MANS = \ @SOME_DRIVERS_FALSE@ metasys.html \ @SOME_DRIVERS_FALSE@ mge-shut.html \ @SOME_DRIVERS_FALSE@ mge-utalk.html \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.html \ @SOME_DRIVERS_FALSE@ oneac.html \ @SOME_DRIVERS_FALSE@ microdowell.html \ -@SOME_DRIVERS_FALSE@ microsol-apc.html \ -@SOME_DRIVERS_FALSE@ nutdrv_siemens_sitop.html \ @SOME_DRIVERS_FALSE@ optiups.html \ @SOME_DRIVERS_FALSE@ powercom.html \ @SOME_DRIVERS_FALSE@ powerpanel.html \ @@ -894,7 +736,7 @@ HTML_DEV_MANS = \ # (--with-snmp) @SOME_DRIVERS_FALSE@SRC_SNMP_PAGES = snmp-ups.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_SNMP_PAGES = snmp-ups.8 +@SOME_DRIVERS_FALSE@MAN_SNMP_PAGES = snmp-ups.8 @SOME_DRIVERS_FALSE@HTML_SNMP_MANS = snmp-ups.html # (--with-usb) @@ -902,108 +744,85 @@ HTML_DEV_MANS = \ @SOME_DRIVERS_FALSE@ bcmxcp_usb.txt \ @SOME_DRIVERS_FALSE@ blazer-common.txt \ @SOME_DRIVERS_FALSE@ blazer_usb.txt \ -@SOME_DRIVERS_FALSE@ nutdrv_atcl_usb.txt \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.txt \ @SOME_DRIVERS_FALSE@ richcomm_usb.txt \ @SOME_DRIVERS_FALSE@ riello_usb.txt \ @SOME_DRIVERS_FALSE@ tripplite_usb.txt \ @SOME_DRIVERS_FALSE@ usbhid-ups.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_USB_LIBUSB_PAGES = \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ bcmxcp_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ blazer_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ nutdrv_atcl_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ richcomm_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ riello_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ tripplite_usb.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ usbhid-ups.8 +@SOME_DRIVERS_FALSE@MAN_USB_LIBUSB_PAGES = \ +@SOME_DRIVERS_FALSE@ bcmxcp_usb.8 \ +@SOME_DRIVERS_FALSE@ blazer_usb.8 \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.8 \ +@SOME_DRIVERS_FALSE@ richcomm_usb.8 \ +@SOME_DRIVERS_FALSE@ riello_usb.8 \ +@SOME_DRIVERS_FALSE@ tripplite_usb.8 \ +@SOME_DRIVERS_FALSE@ usbhid-ups.8 @SOME_DRIVERS_FALSE@HTML_USB_LIBUSB_MANS = \ @SOME_DRIVERS_FALSE@ bcmxcp_usb.html \ @SOME_DRIVERS_FALSE@ blazer_usb.html \ -@SOME_DRIVERS_FALSE@ nutdrv_atcl_usb.html \ +@SOME_DRIVERS_FALSE@ nutdrv_qx.html \ @SOME_DRIVERS_FALSE@ richcomm_usb.html \ @SOME_DRIVERS_FALSE@ riello_usb.html \ @SOME_DRIVERS_FALSE@ tripplite_usb.html \ @SOME_DRIVERS_FALSE@ usbhid-ups.html -# (--with-serial / --with-usb) -@SOME_DRIVERS_FALSE@SRC_SERIAL_USB_PAGES = \ -@SOME_DRIVERS_FALSE@ nutdrv_qx.txt - -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_SERIAL_USB_PAGES = \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ nutdrv_qx.8 - -@SOME_DRIVERS_FALSE@HTML_SERIAL_USB_MANS = \ -@SOME_DRIVERS_FALSE@ nutdrv_qx.html - - # (--with-neon) @SOME_DRIVERS_FALSE@SRC_NETXML_PAGES = netxml-ups.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_NETXML_PAGES = netxml-ups.8 +@SOME_DRIVERS_FALSE@MAN_NETXML_PAGES = netxml-ups.8 @SOME_DRIVERS_FALSE@HTML_NETXML_MANS = netxml-ups.html # (--with-powerman) @SOME_DRIVERS_FALSE@SRC_POWERMAN_PAGES = powerman-pdu.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_POWERMAN_PAGES = powerman-pdu.8 +@SOME_DRIVERS_FALSE@MAN_POWERMAN_PAGES = powerman-pdu.8 @SOME_DRIVERS_FALSE@HTML_POWERMAN_MANS = powerman-pdu.html # (--with-ipmi) @SOME_DRIVERS_FALSE@SRC_IPMIPSU_PAGES = nut-ipmipsu.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_IPMIPSU_PAGES = nut-ipmipsu.8 +@SOME_DRIVERS_FALSE@MAN_IPMIPSU_PAGES = nut-ipmipsu.8 @SOME_DRIVERS_FALSE@HTML_IPMIPSU_MANS = nut-ipmipsu.html @SOME_DRIVERS_FALSE@SRC_MACOSX_PAGES = macosx-ups.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_MACOSX_PAGES = macosx-ups.8 +@SOME_DRIVERS_FALSE@MAN_MACOSX_PAGES = macosx-ups.8 @SOME_DRIVERS_FALSE@HTML_MACOSX_MANS = macosx-ups.html -@SOME_DRIVERS_FALSE@SRC_MODBUS_PAGES = phoenixcontact_modbus.txt \ -@SOME_DRIVERS_FALSE@ generic_modbus.txt \ -@SOME_DRIVERS_FALSE@ huawei-ups2000.txt \ -@SOME_DRIVERS_FALSE@ socomec_jbus.txt \ -@SOME_DRIVERS_FALSE@ adelsystem_cbi.txt - -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_MODBUS_PAGES = phoenixcontact_modbus.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ generic_modbus.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ huawei-ups2000.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ socomec_jbus.8 \ -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@ adelsystem_cbi.8 - -@SOME_DRIVERS_FALSE@HTML_MODBUS_MANS = phoenixcontact_modbus.html \ -@SOME_DRIVERS_FALSE@ generic_modbus.html \ -@SOME_DRIVERS_FALSE@ huawei-ups2000.html \ -@SOME_DRIVERS_FALSE@ socomec_jbus.html \ -@SOME_DRIVERS_FALSE@ adelsystem_cbi.html - -@SOME_DRIVERS_FALSE@SRC_LINUX_I2C_PAGES = asem.txt pijuice.txt -@SOME_DRIVERS_FALSE@@WITH_MANS_TRUE@MAN_LINUX_I2C_PAGES = asem.8 pijuice.8 -@SOME_DRIVERS_FALSE@HTML_LINUX_I2C_MANS = asem.html pijuice.html # SOME_DRIVERS -MAN_MANS = $(am__append_15) -SRC_DRIVERS_PAGES = \ - $(SRC_SERIAL_PAGES) \ - $(SRC_SNMP_PAGES) \ - $(SRC_USB_LIBUSB_PAGES) \ - $(SRC_SERIAL_USB_PAGES) \ - $(SRC_NETXML_PAGES) \ - $(SRC_POWERMAN_PAGES) \ - $(SRC_IPMIPSU_PAGES) \ - $(SRC_MACOSX_PAGES) \ - $(SRC_MODBUS_PAGES) \ - $(SRC_LINUX_I2C_PAGES) +MAN_MANS = \ + $(MAN_CONF_PAGES) \ + $(MAN_CLIENT_PAGES) \ + $(MAN_TOOL_PAGES) \ + $(MAN5_CGI_PAGES) \ + $(MAN8_CGI_PAGES) \ + $(MAN1_DEV_PAGES) \ + $(MAN3_DEV_PAGES) \ + $(MAN_SERIAL_PAGES) \ + $(MAN_SNMP_PAGES) \ + $(MAN_USB_LIBUSB_PAGES) \ + $(MAN_NETXML_PAGES) \ + $(MAN_POWERMAN_PAGES) \ + $(MAN_IPMIPSU_PAGES) \ + $(MAN_MACOSX_PAGES) # distribute everything, even those not installed by default # Note that 'dist' target requires AsciiDoc! -SRC_ALL_PAGES = \ +EXTRA_DIST = \ $(SRC_CONF_PAGES) \ $(SRC_CLIENT_PAGES) \ $(SRC_TOOL_PAGES) \ $(SRC_CGI_PAGES) \ $(SRC_DEV_PAGES) \ - $(SRC_DRIVERS_PAGES) + $(SRC_SERIAL_PAGES) \ + $(SRC_SNMP_PAGES) \ + $(SRC_USB_LIBUSB_PAGES) \ + $(SRC_NETXML_PAGES) \ + $(SRC_POWERMAN_PAGES) \ + $(SRC_IPMIPSU_PAGES) \ + $(SRC_MACOSX_PAGES) \ + $(MAN_MANS) \ + asciidoc.conf -EXTRA_DIST = $(SRC_ALL_PAGES) $(MAN_MANS) asciidoc.conf \ - $(am__append_16) HTML_MANS = \ $(HTML_CONF_MANS) \ $(HTML_CLIENT_MANS) \ @@ -1013,93 +832,25 @@ HTML_MANS = \ $(HTML_SERIAL_MANS) \ $(HTML_SNMP_MANS) \ $(HTML_USB_LIBUSB_MANS) \ - $(HTML_SERIAL_USB_MANS) \ $(HTML_NETXML_MANS) \ $(HTML_POWERMAN_MANS) \ $(HTML_IPMIPSU_MANS) \ - $(HTML_MACOSX_MANS) \ - $(HTML_MODBUS_MANS) \ - $(HTML_LINUX_I2C_MANS) + $(HTML_MACOSX_MANS) - -# Note: target documents, except nutupsdrv.txt itself, start the -# list of drivers with `- linkman:nutupsdrv[8]` entry -# To regenerate these files, do `make distclean` first -LINKMAN_INCLUDE_GENERATED = linkman-driver-names.txt linkman-drivertool-names.txt -LINKMAN_INCLUDE_CONSUMERS = index.txt upsd.txt nutupsdrv.txt - -# These files are generated when we build from git source so not tracked in -# git, and not part of tarball (to be in builddir) - so not in EXTRA_DIST. -DISTCLEANFILES = $(LINKMAN_INCLUDE_GENERATED) -CLEANFILES = *-spellchecked $(am__append_17) +CLEANFILES = *.xml *.html SUFFIXES = .txt .html .1 .3 .5 .8 -@DOC_INSTALL_DISTED_MANS_FALSE@SRC_PREBUILT_CLAUSE = - -# For builds with allowed installation of prebuild man pages, check that -# they exist in sources (make would pull them automatically as a fallback -# from failed lookup in build products). For builds that require rebuild -# of man pages, abort with error if build product is missing. -@DOC_INSTALL_DISTED_MANS_TRUE@SRC_PREBUILT_CLAUSE = || [ -r "$(srcdir)/`basename $@`" ] - -# Working around a2x not friendly to parallelized runs. -# See more details in the main NUT docs/Makefile.am -@HAVE_ASCIIDOC_TRUE@DOCBUILD_BEGIN = { \ -@HAVE_ASCIIDOC_TRUE@ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ -@HAVE_ASCIIDOC_TRUE@ rm -rf "./$${A2X_OUTDIR}" || true ; \ -@HAVE_ASCIIDOC_TRUE@ test -d "$@" && rm -rf "$@" || true ; \ -@HAVE_ASCIIDOC_TRUE@ mkdir -p "./$${A2X_OUTDIR}" || exit ; \ -@HAVE_ASCIIDOC_TRUE@ for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ -@HAVE_ASCIIDOC_TRUE@ if [ -s "./$$F" ] ; then ln -f -s "../../$$F" "./$${A2X_OUTDIR}/" ; else \ -@HAVE_ASCIIDOC_TRUE@ if [ -s "$(abs_srcdir)/$$F" ] ; then ln -f -s "$(abs_srcdir)/$$F" "./$${A2X_OUTDIR}/" ; fi ; fi ; \ -@HAVE_ASCIIDOC_TRUE@ done ; \ -@HAVE_ASCIIDOC_TRUE@ else A2X_OUTDIR='.' ; fi; \ -@HAVE_ASCIIDOC_TRUE@ if test -s "${builddir}/docbook-xsl.css" \ -@HAVE_ASCIIDOC_TRUE@ && test -r "${builddir}/docbook-xsl.css" \ -@HAVE_ASCIIDOC_TRUE@ && ! test -w "${builddir}/docbook-xsl.css" \ -@HAVE_ASCIIDOC_TRUE@ ; then chmod u+w "${builddir}/docbook-xsl.css" ; fi ; \ -@HAVE_ASCIIDOC_TRUE@ chmod -R u+w "./$${A2X_OUTDIR}" || true ; \ -@HAVE_ASCIIDOC_TRUE@ if test x"$(srcdir)" != x"$(builddir)" ; then \ -@HAVE_ASCIIDOC_TRUE@ if ! test -s "$(builddir)/$<" && test -s "$(srcdir)/`basename $<`" ; then \ -@HAVE_ASCIIDOC_TRUE@ ln -fs "$(srcdir)/`basename $<`" "$(builddir)/" ; \ -@HAVE_ASCIIDOC_TRUE@ fi ; \ -@HAVE_ASCIIDOC_TRUE@ fi ; \ -@HAVE_ASCIIDOC_TRUE@ A2X_VERBOSE="$(ASCIIDOC_VERBOSE)"; if [ "$(V)" = 1 ]; then A2X_VERBOSE="--verbose"; fi; \ -@HAVE_ASCIIDOC_TRUE@} - - -# Note that documents with sub-pages (see LIBNUTCLIENT_*_DEPS above) -# may generate multiple files in one go... so we move "*" and hope -# for no required hidden files (or would have to `find` them all). -@HAVE_ASCIIDOC_TRUE@DOCBUILD_END = { \ -@HAVE_ASCIIDOC_TRUE@ if test -n "$${A2X_OUTDIR}" && test "$${A2X_OUTDIR}" != '.' ; then \ -@HAVE_ASCIIDOC_TRUE@ chmod -R u+w "./$${A2X_OUTDIR}" || true ; \ -@HAVE_ASCIIDOC_TRUE@ test -d "$@" && rm -rf "$@" || true ; \ -@HAVE_ASCIIDOC_TRUE@ for F in $(LINKMAN_INCLUDE_GENERATED) ; do \ -@HAVE_ASCIIDOC_TRUE@ rm -f "./$${A2X_OUTDIR}/$$F" || true ; \ -@HAVE_ASCIIDOC_TRUE@ done ; \ -@HAVE_ASCIIDOC_TRUE@ mv -f "./$${A2X_OUTDIR}/$(@F)" ./ || exit ; \ -@HAVE_ASCIIDOC_TRUE@ mv -f "./$${A2X_OUTDIR}/"*.* ./ 2>/dev/null || true ; \ -@HAVE_ASCIIDOC_TRUE@ rm -rf "./$${A2X_OUTDIR}" ; \ -@HAVE_ASCIIDOC_TRUE@ fi ; \ -@HAVE_ASCIIDOC_TRUE@} - ### Prior to Asciidoc ~8.6.8, the --destination-dir flag didn't seem to affect the location of the intermediate .xml file. -### This parameter is currently required; see docs/Makefile.am for more detail. -@HAVE_ASCIIDOC_TRUE@A2X_MANPAGE_OPTS = --doctype manpage --format manpage $${A2X_VERBOSE} \ -@HAVE_ASCIIDOC_TRUE@ --xsltproc-opts="--nonet" \ +@HAVE_ASCIIDOC_TRUE@A2X_MANPAGE_OPTS = --doctype manpage --format manpage \ @HAVE_ASCIIDOC_TRUE@ --attribute mansource="Network UPS Tools" \ @HAVE_ASCIIDOC_TRUE@ --attribute manversion="@PACKAGE_VERSION@" \ @HAVE_ASCIIDOC_TRUE@ --attribute manmanual="NUT Manual" \ -@HAVE_ASCIIDOC_TRUE@ --attribute srcdir="$(abs_srcdir)" \ -@HAVE_ASCIIDOC_TRUE@ --attribute builddir="$(abs_builddir)" \ -@HAVE_ASCIIDOC_TRUE@ --destination-dir="$${A2X_OUTDIR}" +@HAVE_ASCIIDOC_TRUE@ --destination-dir=. -MAINTAINERCLEANFILES = Makefile.in .dirstamp all: all-am .SUFFIXES: -.SUFFIXES: .txt .html .1 .3 .5 .8 .txt-spellchecked +.SUFFIXES: .txt .html .1 .3 .5 .8 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -1112,13 +863,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/man/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu docs/man/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -1299,17 +1051,27 @@ uninstall-man8: } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1339,11 +1101,7 @@ distdir-am: $(DISTFILES) || exit 1; \ fi; \ done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile $(MANS) installdirs: @@ -1377,15 +1135,13 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-generic clean-libtool clean-local mostlyclean-am +clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -1452,10 +1208,9 @@ uninstall-am: uninstall-man uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5 \ uninstall-man8 -.MAKE: check-am install-am install-strip +.MAKE: install-am install-strip -.PHONY: all all-am check check-am check-local clean clean-generic \ - clean-libtool clean-local cscopelist-am ctags-am dist-hook \ +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ distclean distclean-generic distclean-libtool distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ @@ -1465,247 +1220,50 @@ uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5 \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-man uninstall-man1 uninstall-man3 \ - uninstall-man5 uninstall-man8 + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-man uninstall-man1 uninstall-man3 uninstall-man5 \ + uninstall-man8 -.PRECIOUS: Makefile - - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_MISC_DEPS): libnutclient_misc.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_TCP_DEPS): libnutclient_tcp.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_GENERAL_DEPS): libnutclient_general.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_VARIABLES_DEPS): libnutclient_variables.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_COMMANDS_DEPS): libnutclient_commands.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@$(LIBNUTCLIENT_DEVICES_DEPS): libnutclient_devices.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@upscli_readline_timeout.3: upscli_readline.3 -@WITH_MANS_TRUE@ touch $@ - -@WITH_MANS_TRUE@upscli_sendline_timeout.3: upscli_sendline.3 -@WITH_MANS_TRUE@ touch $@ -@SKIP_MANS_FALSE@@WITH_MANS_FALSE@dist: -@SKIP_MANS_FALSE@@WITH_MANS_FALSE@ @echo "ERROR: Manpage building was disabled by configure script, and these pages are required for our proper 'make dist'" >&2 ; false - -# For builds done from dist'ed sources, there may be a conflict of timestamps -# between original *.txt files and pre-built manpages etc. leading to skipping -# of manpage re-generation even if that activity is possible and requested. -# Possibly a cleaner, but less portable, solution would be to touch the -# generated files to long ago. Current solution assumes good valid clocks :) -dist-hook: - @echo "Fix up manpage source timestamps" && cd $(distdir) && touch $(SRC_ALL_PAGES) - -linkman-driver-names.txt: - @if test x"$(srcdir)" != x"$(builddir)" ; then \ - if ! test -s "$(builddir)/$@" && test -s "$(srcdir)/$(@F)" ; then \ - ln -fs "$(srcdir)/$(@F)" "$(builddir)/" ; \ - fi ; \ - fi - @if test -s "$@" ; then exit 0 ; fi ; \ - (LC_ALL=C; LANG=C; export LC_ALL LANG; \ - for F in $(SRC_DRIVERS_PAGES) ; do echo "$$F" ; done \ - | grep -vE '^nutupsdrv\.txt$$' \ - | sort -n | uniq \ - | sed 's,^\(.*\)\.txt$$,- linkman:\1[8],' ; \ - ) > "$@" - -linkman-drivertool-names.txt: - @if test x"$(srcdir)" != x"$(builddir)" ; then \ - if ! test -s "$(builddir)/$@" && test -s "$(srcdir)/$(@F)" ; then \ - ln -fs "$(srcdir)/$(@F)" "$(builddir)/" ; \ - fi ; \ - fi - @if test -s "$@" ; then exit 0 ; fi ; \ - (LC_ALL=C; LANG=C; export LC_ALL LANG; \ - for F in $(SRC_DRIVERTOOL_PAGES) ; do echo "$$F" ; done \ - | sort -n | uniq \ - | sed 's,^\(.*\)\.txt$$,- linkman:\1[8],' ; \ - ) > "$@" - -# Dependencies are about particular filenames, since over time -# we might have several use-cases for LINKMAN_INCLUDE_GENERATED: -$(LINKMAN_INCLUDE_CONSUMERS): linkman-driver-names.txt linkman-drivertool-names.txt all: -all-html html-man: $(HTML_MANS) index.html +man-index.html: index.html + cp -f $< $@ -# Have a way to build all man pages, not just those that fit currently -# configured drivers, daemons, developer aspect, etc. -all-man man-man: $(MAN_MANS) +html-man: $(HTML_MANS) man-index.html -@SKIP_MANS_FALSE@@WITH_MANS_TRUE@check-local: check-man -@SKIP_MANS_TRUE@@WITH_MANS_TRUE@check-local: check-man-txt check-man-pages -@SKIP_MANS_TRUE@@WITH_MANS_TRUE@ @echo "Man-page generation was SKIPPED per user request, so pregenerated pages were sanity-checked (if any)" >&2 -@WITH_MANS_FALSE@check-local: check-man-txt check-man-pages -@WITH_MANS_FALSE@ @echo "Man-page generation was not done, so pregenerated pages were sanity-checked (if any)" >&2 - -check-man: check-man-txt check-man-pages check-html-man - -# the "for" loops might better use $^ but it might be not portable -check-man-html: check-html-man - -check-html-man: $(HTML_MANS) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(HTML_MANS) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(XML|HTML.*document)' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED HTML-man sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED HTML-man sanity check (checked $$CHECKED files)"; exit 0 - -# Note: many man-pages here have code samples and are mis-identified as C code -check-man-page: check-man-pages - -# Man-pages may be pre-generated (srcdir), or re-built (builddir) -check-man-pages: $(MAN_MANS) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - for F in $(MAN_MANS) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - ( test -s "$(abs_srcdir)/$$F" && { file "$(abs_srcdir)/$$F" | $(EGREP) -i '(roff.* input|C source|ASCII text)' > /dev/null ; } ) || \ - ( test -s "$(abs_builddir)/$$F" && { file "$(abs_builddir)/$$F" | $(EGREP) -i '(roff.* input|C source|ASCII text)' > /dev/null ; } ) || \ - FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED man-page sanity check for:$$FAILED" >&2 ; \ - ( echo "SRCDIR:"; cd "$(abs_srcdir)/" && file $$FAILED ; \ - echo "BUILDDIR:"; cd "$(abs_builddir)/" && file $$FAILED ; \ - ) >&2 ; exit 1; \ - fi; echo "PASSED man-page sanity check (checked $$CHECKED files)"; exit 0 - -check-man-source: check-man-txt - -# Note: (GNU) make can helpfully add VPATH to the short source filenames -# which we had listed above, so the "case" below handles two possibilities -check-man-txt: $(SRC_ALL_PAGES) - @FAILED=""; CHECKED=0; LANG=C; LC_ALL=C; export LANG; export LC_ALL; \ - ( cd $(abs_srcdir) ) || exit; \ - for F in $(SRC_ALL_PAGES) ; do \ - CHECKED="`expr $$CHECKED + 1`"; \ - case "$$F" in \ - */*) ;; \ - *) F="$(abs_srcdir)/$$F" ;; \ - esac ; \ - test -s "$$F" && { file "$$F" | $(EGREP) -i '(ASCII|UTF-8|Unicode|ISO-8859|English).* text' > /dev/null ; } || FAILED="$$FAILED $$F" ; \ - done; if test -n "$$FAILED" ; then \ - echo "FAILED man-source sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ - fi; echo "PASSED man-source sanity check (checked $$CHECKED files)"; exit 0 - -### Regarding absolute paths in attributes below: by default asciidoc -### resolves include paths relative to the main document, so while we -### see the relative builddir as "." in the makefile, for included -### data it would mean the source directory where the .txt resides. @HAVE_ASCIIDOC_TRUE@.txt.html: -@HAVE_ASCIIDOC_TRUE@ @A2X_OUTDIR="tmp/man-html.$(@F).$$$$" ; \ -@HAVE_ASCIIDOC_TRUE@ echo " DOC-MAN-HTML Generating $@"; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_BEGIN) ; RES=0; \ -@HAVE_ASCIIDOC_TRUE@ $(ASCIIDOC) --backend=xhtml11 $${A2X_VERBOSE} \ -@HAVE_ASCIIDOC_TRUE@ --attribute localdate="`TZ=UTC date +%Y-%m-%d`" \ -@HAVE_ASCIIDOC_TRUE@ --attribute localtime="`TZ=UTC date +%H:%M:%S`" \ -@HAVE_ASCIIDOC_TRUE@ --attribute nutversion="@PACKAGE_VERSION@" \ -@HAVE_ASCIIDOC_TRUE@ --attribute srcdir="$(abs_srcdir)" \ -@HAVE_ASCIIDOC_TRUE@ --attribute builddir="$(abs_builddir)" \ -@HAVE_ASCIIDOC_TRUE@ -o "$${A2X_OUTDIR}/$(@F)" $< || RES=$$? ; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_END) ; exit $$RES +@HAVE_ASCIIDOC_TRUE@ $(ASCIIDOC) --backend=xhtml11 \ +@HAVE_ASCIIDOC_TRUE@ --attribute localdate=`TZ=UTC date +%Y-%m-%d` \ +@HAVE_ASCIIDOC_TRUE@ --attribute localtime=`TZ=UTC date +%H:%M:%S` \ +@HAVE_ASCIIDOC_TRUE@ -o $@ $< @HAVE_ASCIIDOC_TRUE@.txt.1: -@HAVE_ASCIIDOC_TRUE@ @A2X_OUTDIR="tmp/man1.$(@F).$$$$" ; \ -@HAVE_ASCIIDOC_TRUE@ echo " DOC-MAN Generating $@"; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_BEGIN) ; RES=0; \ -@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_END) ; exit $$RES +@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< @HAVE_ASCIIDOC_TRUE@.txt.3: -@HAVE_ASCIIDOC_TRUE@ @A2X_OUTDIR="tmp/man3.$(@F).$$$$" ; \ -@HAVE_ASCIIDOC_TRUE@ echo " DOC-MAN Generating $@"; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_BEGIN) ; RES=0; \ -@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_END) ; exit $$RES +@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< @HAVE_ASCIIDOC_TRUE@.txt.5: -@HAVE_ASCIIDOC_TRUE@ @A2X_OUTDIR="tmp/man5.$(@F).$$$$" ; \ -@HAVE_ASCIIDOC_TRUE@ echo " DOC-MAN Generating $@"; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_BEGIN) ; RES=0; \ -@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_END) ; exit $$RES +@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< @HAVE_ASCIIDOC_TRUE@.txt.8: -@HAVE_ASCIIDOC_TRUE@ @A2X_OUTDIR="tmp/man8.$(@F).$$$$" ; \ -@HAVE_ASCIIDOC_TRUE@ echo " DOC-MAN Generating $@"; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_BEGIN) ; RES=0; \ -@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< || RES=$$? ; \ -@HAVE_ASCIIDOC_TRUE@ $(DOCBUILD_END) ; exit $$RES +@HAVE_ASCIIDOC_TRUE@ $(A2X) $(A2X_MANPAGE_OPTS) $< @HAVE_ASCIIDOC_FALSE@.txt.html: -@HAVE_ASCIIDOC_FALSE@ @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ -@HAVE_ASCIIDOC_FALSE@ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ -@HAVE_ASCIIDOC_FALSE@ else \ -@HAVE_ASCIIDOC_FALSE@ echo "Could not find prebuilt $@ manual page." ; \ -@HAVE_ASCIIDOC_FALSE@ echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ -@HAVE_ASCIIDOC_FALSE@ exit 1; \ -@HAVE_ASCIIDOC_FALSE@ fi +@HAVE_ASCIIDOC_FALSE@ @echo "Not (re)building $@ manual page, since 'asciidoc' was not found." @HAVE_ASCIIDOC_FALSE@.txt.1: -@HAVE_ASCIIDOC_FALSE@ @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ -@HAVE_ASCIIDOC_FALSE@ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ -@HAVE_ASCIIDOC_FALSE@ else \ -@HAVE_ASCIIDOC_FALSE@ echo "Could not find prebuilt $@ manual page." ; \ -@HAVE_ASCIIDOC_FALSE@ echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ -@HAVE_ASCIIDOC_FALSE@ exit 1; \ -@HAVE_ASCIIDOC_FALSE@ fi +@HAVE_ASCIIDOC_FALSE@ @echo "Using existing $@ manual page, since 'asciidoc' was not found." @HAVE_ASCIIDOC_FALSE@.txt.3: -@HAVE_ASCIIDOC_FALSE@ @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ -@HAVE_ASCIIDOC_FALSE@ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ -@HAVE_ASCIIDOC_FALSE@ else \ -@HAVE_ASCIIDOC_FALSE@ echo "Could not find prebuilt $@ manual page." ; \ -@HAVE_ASCIIDOC_FALSE@ echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ -@HAVE_ASCIIDOC_FALSE@ exit 1; \ -@HAVE_ASCIIDOC_FALSE@ fi +@HAVE_ASCIIDOC_FALSE@ @echo "Using existing $@ manual page, since 'asciidoc' was not found." @HAVE_ASCIIDOC_FALSE@.txt.5: -@HAVE_ASCIIDOC_FALSE@ @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ -@HAVE_ASCIIDOC_FALSE@ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ -@HAVE_ASCIIDOC_FALSE@ else \ -@HAVE_ASCIIDOC_FALSE@ echo "Could not find prebuilt $@ manual page." ; \ -@HAVE_ASCIIDOC_FALSE@ echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ -@HAVE_ASCIIDOC_FALSE@ exit 1; \ -@HAVE_ASCIIDOC_FALSE@ fi +@HAVE_ASCIIDOC_FALSE@ @echo "Using existing $@ manual page, since 'asciidoc' was not found." @HAVE_ASCIIDOC_FALSE@.txt.8: -@HAVE_ASCIIDOC_FALSE@ @if [ -r "$@" ] $(SRC_PREBUILT_CLAUSE); then \ -@HAVE_ASCIIDOC_FALSE@ echo "Not (re)building $@ manual page, since 'asciidoc', 'xmllint' or 'xsltproc' were not found." ; \ -@HAVE_ASCIIDOC_FALSE@ else \ -@HAVE_ASCIIDOC_FALSE@ echo "Could not find prebuilt $@ manual page." ; \ -@HAVE_ASCIIDOC_FALSE@ echo "If you are building from Git, do you have all of the asciidoc/a2x tools installed?"; \ -@HAVE_ASCIIDOC_FALSE@ exit 1; \ -@HAVE_ASCIIDOC_FALSE@ fi - -# NOTE: Due to portability, we do not use a GNU percent-wildcard extension: -#%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -# $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -# NOTE: Portable suffix rules do not allow prerequisites, so we shim them here -# by a wildcard target in case the make implementation can put the two together. -*.txt-spellchecked: Makefile.am $(abs_top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) -.txt.txt-spellchecked: - $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ - -spellcheck spellcheck-interactive spellcheck-sortdict: - $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SRC_ALL_PAGES)" SPELLCHECK_DIR="$(srcdir)" $@ - -clean-local: - rm -rf tmp +@HAVE_ASCIIDOC_FALSE@ @echo "Using existing $@ manual page, since 'asciidoc' was not found." # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/docs/man/adelsystem_cbi.8 b/docs/man/adelsystem_cbi.8 deleted file mode 100644 index 38c08dc..0000000 --- a/docs/man/adelsystem_cbi.8 +++ /dev/null @@ -1,160 +0,0 @@ -'\" t -.\" Title: adelsystem_cbi -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "ADELSYSTEM_CBI" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -adelsystem_cbi \- Driver for the ADELSYSTEM CB/CBI DC\-UPS -.SH "SYNOPSIS" -.sp -\fBadelsystem_cbi\fR \-h -.sp -\fBadelsystem_cbi\fR \-a \fIDEVICE_NAME\fR [\fIOPTIONS\fR] -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This man page only documents the specific features of the \fBadelsystem_cbi\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -This is the driver for the adelsystem cb/cbi dc\-ups devices\&. -.sp -The driver has been tested against CBI2801224A, all in one 12/24Vdc DC\-UPS\&. -.PP -More information about this UPS can be found here: -.RS 4 -https://www\&.adelsystem\&.com/en/products/dc\-ups\-/ -.RE -.SH "EXTRA ARGUMENTS" -.sp -This driver supports the following optional settings in the \fBups.conf\fR(5) file: -.SS "Serial:" -.PP -\fBser_baud_rate\fR=\fIvalue\fR -.RS 4 -A integer specifying the serial port baud rate (default 9600)\&. -.RE -.PP -\fBser_data_bit\fR=\fIvalue\fR -.RS 4 -A integer specifying the serial port data bit (default 8)\&. -.RE -.PP -\fBser_parity\fR=\fIvalue\fR -.RS 4 -A character specifying the serial port parity (default N)\&. -.RE -.PP -\fBser_stop_bit\fR=\fIvalue\fR -.RS 4 -An integer specifying the serial port stop bit (default 1)\&. -.RE -.SS "Modbus:" -.PP -\fBdev_slave_id\fR=\fIvalue\fR -.RS 4 -An integer specifying the device modbus slave ID (default 1)\&. -.RE -.SH "CONFIGURATION" -.sp -Here is an example of adelsystem_cbi driver configuration in \fBups\&.conf\fR file: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[adelsystem_cbi] - driver = adelsystem_cbi - port = /dev/ttyUSB0 - desc = "adelsystem cb/cbi ups driver" - # serial settings - ser_baud_rate = 9600 - ser_parity = N - ser_data_bit = 8 - ser_stop_bit = 1 - # modbus slave id - dev_slave_id = 5 -.fi -.if n \{\ -.RE -.\} -.SH "INSTANT COMMANDS" -.sp -This driver support the following instant commands: -.PP -load\&.off -.RS 4 -executes "instant poweroff" -.RE -.SH "INSTALLATION" -.sp -This driver is not built by default\&. You can build it by installing libmodbus and running configure \-\-with\-modbus=yes\&. -.sp -You also need to give proper permissions on the local serial device file (/dev/ttyUSB0 for example) to allow the run\-time NUT driver user account to access it\&. -.SH "AUTHOR" -.sp -Dimitris Economou -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8), \fBups.conf\fR(5) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -libmodbus home page: -http://libmodbus\&.org -.RE diff --git a/docs/man/adelsystem_cbi.txt b/docs/man/adelsystem_cbi.txt deleted file mode 100644 index e8d1bd9..0000000 --- a/docs/man/adelsystem_cbi.txt +++ /dev/null @@ -1,111 +0,0 @@ -ADELSYSTEM_CBI(8) -================= - -NAME ----- - -adelsystem_cbi - Driver for the ADELSYSTEM CB/CBI DC-UPS - -SYNOPSIS --------- - -*adelsystem_cbi* -h - -*adelsystem_cbi* -a 'DEVICE_NAME' ['OPTIONS'] - -NOTE: This man page only documents the specific features of the *adelsystem_cbi* -driver. For information about the core driver, see linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This is the driver for the adelsystem cb/cbi dc-ups devices. - -The driver has been tested against CBI2801224A, all in one 12/24Vdc DC-UPS. - -More information about this UPS can be found here: :: -https://www.adelsystem.com/en/products/dc-ups-/ - - -EXTRA ARGUMENTS ---------------- - -This driver supports the following optional settings in the -linkman:ups.conf[5] file: - -Serial: -~~~~~~ - -*ser_baud_rate*='value':: -A integer specifying the serial port baud rate (default 9600). - -*ser_data_bit*='value':: -A integer specifying the serial port data bit (default 8). - -*ser_parity*='value':: -A character specifying the serial port parity (default N). - -*ser_stop_bit*='value':: -An integer specifying the serial port stop bit (default 1). - -Modbus: -~~~~~~ - -*dev_slave_id*='value':: -An integer specifying the device modbus slave ID (default 1). - - -CONFIGURATION -------------- - -Here is an example of adelsystem_cbi driver configuration in *ups.conf* file: ----- -[adelsystem_cbi] - driver = adelsystem_cbi - port = /dev/ttyUSB0 - desc = "adelsystem cb/cbi ups driver" - # serial settings - ser_baud_rate = 9600 - ser_parity = N - ser_data_bit = 8 - ser_stop_bit = 1 - # modbus slave id - dev_slave_id = 5 ----- - -INSTANT COMMANDS ----------------- - -This driver support the following instant commands: - -load.off:: -executes "instant poweroff" - -INSTALLATION ------------- - -This driver is not built by default. You can build it by installing -libmodbus and running `configure --with-modbus=yes`. - -You also need to give proper permissions on the local serial device -file (/dev/ttyUSB0 for example) to allow the run-time NUT driver user -account to access it. - -AUTHOR ------- - -Dimitris Economou - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8], linkman:ups.conf[5] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* libmodbus home page: http://libmodbus.org diff --git a/docs/man/al175.8 b/docs/man/al175.8 index 40cdc34..3adb0c5 100644 --- a/docs/man/al175.8 +++ b/docs/man/al175.8 @@ -1,13 +1,13 @@ '\" t .\" Title: al175 .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/20/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1 .\" Language: English .\" -.TH "AL175" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "AL175" "8" "11/20/2013" "Network UPS Tools 2\&.7\&.1" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -46,7 +46,7 @@ Eltek MPSU4000 with AL175 alarm module .RE .\} .sp -It may also work with other UPSes equipped with AL175 alarm module, but they have not been tested\&. +It may also work with other UPSes equiped with AL175 alarm module, but they have not been tested\&. .sp AL175 have to be configured to operate in COMLI mode\&. See documentation supplied with your hardware on how to do it\&. .SH "EXTRA ARGUMENTS" @@ -77,6 +77,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBups\&.test\&.result\fR .RE .sp @@ -88,6 +89,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBoutput\&.voltage\&.nominal\fR .RE .sp @@ -99,6 +101,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBoutput\&.current\fR .RE .sp @@ -110,6 +113,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBbattery\&.voltage\&.nominal\fR .RE .sp @@ -121,6 +125,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBbattery\&.current\fR .RE .sp @@ -132,6 +137,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBbattery\&.temperature\fR .RE .sp @@ -143,6 +149,7 @@ Besides status, this driver reads UPS state into following variables: .sp -1 .IP \(bu 2.3 .\} + \fBinput\&.transfer\&.boost\&.low\fR .RE .SH "KNOWN ISSUES AND BUGS" diff --git a/docs/man/al175.txt b/docs/man/al175.txt index 7ba616b..fc4f202 100644 --- a/docs/man/al175.txt +++ b/docs/man/al175.txt @@ -3,24 +3,21 @@ AL175(8) NAME ---- - al175 - Driver for Eltek UPS models with AL175 alarm module NOTE ---- - This man page only documents the hardware-specific features of the *al175* driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - The *al175* driver is known to work with the following UPSes: Eltek MPSU4000 with AL175 alarm module -It may also work with other UPSes equipped with AL175 alarm module, +It may also work with other UPSes equiped with AL175 alarm module, but they have not been tested. @@ -29,13 +26,11 @@ See documentation supplied with your hardware on how to do it. EXTRA ARGUMENTS --------------- - This driver does not support any extra settings in the linkman:ups.conf[5]. INSTANT COMMANDS ---------------- - This driver supports some extra commands (see linkman:upscmd[8]): *test.battery.start*:: @@ -46,7 +41,6 @@ Stop a battery test. VARIABLES --------- - Besides status, this driver reads UPS state into following variables: - *ups.test.result* @@ -59,14 +53,12 @@ Besides status, this driver reads UPS state into following variables: KNOWN ISSUES AND BUGS --------------------- - * Shutdown is not supported. FIXME * The driver was reworked to meet the project code quality criteria, without testing on real hardware. Some bugs may have crept in. AUTHOR ------ - Kirill Smelkov SEE ALSO @@ -74,10 +66,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/apcsmart-old.8 b/docs/man/apcsmart-old.8 index 829d0be..6395221 100644 --- a/docs/man/apcsmart-old.8 +++ b/docs/man/apcsmart-old.8 @@ -1,13 +1,13 @@ '\" t .\" Title: apcsmart-old -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "APCSMART\-OLD" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "APCSMART\-OLD" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -112,13 +112,9 @@ Mode 4 exploits an oddity in the CS 350 models since they only seem to support t Some older APC UPS models return bogus data in the status register during a front panel test\&. This is usually detected and discarded, but some other unexpected values have occasionally slipped through\&. .sp APC UPS models with both USB and serial ports require a power cycle when switching from USB communication to serial, and perhaps vice versa\&. -.SH "AUTHORS AND HISTORY" +.SH "AUTHOR" .sp -Nigel Metheringham (drawing heavily on the original apcsmart driver by Russell Kroll)\&. -.sp -This driver was called newapc for a time and was renamed in the 1\&.5 series\&. -.sp -In 2\&.6\&.2 the driver was renamed to apcsmart\-old, being superseded by updated version with new features\&. +Nigel Metheringham (drawing heavily on the original apcsmart driver by Russell Kroll)\&. This driver was called newapc for a time and was renamed in the 1\&.5 series\&. In 2\&.6\&.2 the driver was renamed to apcsmart\-old, being superseded by updated version with new features\&. .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/apcsmart-old.txt b/docs/man/apcsmart-old.txt index 6ca4cff..43ed048 100644 --- a/docs/man/apcsmart-old.txt +++ b/docs/man/apcsmart-old.txt @@ -1,7 +1,7 @@ APCSMART-OLD(8) =============== -NAME +NAME ---- apcsmart-old - Driver for American Power Conversion Smart Protocol UPS equipment @@ -83,27 +83,21 @@ other unexpected values have occasionally slipped through. APC UPS models with both USB and serial ports require a power cycle when switching from USB communication to serial, and perhaps vice versa. -AUTHORS AND HISTORY -------------------- - +AUTHOR +------ Nigel Metheringham (drawing -heavily on the original `apcsmart` driver by Russell Kroll). - -This driver was called `newapc` for a time and was renamed in -the 1.5 series. - -In 2.6.2 the driver was renamed to `apcsmart-old`, being superseded -by updated version with new features. +heavily on the original apcsmart driver by Russell Kroll). This driver +was called newapc for a time and was renamed in the 1.5 series. In 2.6.2 +the driver was renamed to apcsmart-old, being superseded by updated version +with new features. SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/apcsmart.8 b/docs/man/apcsmart.8 index 24000cf..a78856e 100644 --- a/docs/man/apcsmart.8 +++ b/docs/man/apcsmart.8 @@ -1,13 +1,13 @@ '\" t .\" Title: apcsmart -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 10/30/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "APCSMART" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "APCSMART" "8" "10/30/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ apcsmart \- Driver for American Power Conversion Smart Protocol UPS equipment .sp \fBapcsmart\fR \-h .sp -\fBapcsmart\fR \-a \fIUPS_NAME\fR [\-x option=value \&...] +\fBapcsmart\fR \-a \*(AqUPS_NAME\*(Aq [\-x option=value \&...] .if n \{\ .sp .\} @@ -52,15 +52,15 @@ This man page only documents the hardware\-specific features of the apcsmart dri .RE .SH "SUPPORTED HARDWARE" .sp -The apcsmart driver should recognize (or at the very least, work with) the majority of Smart\-UPS models \- which includes Smart\-UPS, Matrix\-UPS and Back\-UPS lineups, among few other ones\&. +The apcsmart driver should recognize (or at the very least work with) majority of Smart\-UPS models \- which includes Smart\-UPS, Matrix\-UPS and Back\-UPS lineups, among few other ones\&. .sp -Currently, we can roughly divide APC hardware into four groups (note that the division isn\(cqt strict by any means, and the borders between those are pretty fuzzy): +Currently we can roughly divide APC hardware into 3 groups (note that the division isn\*(Aqt strict by any means, and the borders between those are pretty fuzzy): .PP [very] "old" models .RS 4 These models usually have old APC logo, white color and \fIno\fR -programmable EEPROM; you won\(cqt find them listed anywhere on APC\(cqs site either\&. The support for those will be usually based on driver\(cqs compatibility tables, or if the model (firmware) is not listed in those \- the driver will try to follow the very basic subset of features, while still trying to remain useful\&. Despite "smart" tagname, they often tend to behave in pretty dumb way (see the section below about shutdown behaviour)\&. +programmable eeprom; You won\*(Aqt find them listed anywhere on APC\(cqs site either\&. The support for those will be usually based on driver\*(Aqs compatibility tables, or if the model (firmware) is not listed in those \- the driver will try to follow the very basic subset of features, while still trying to remain useful\&. Despite "smart" tagname, they often tend to behave in pretty dumb way (see the section below about shutdown behaviour)\&. .PP \fBExample models:\fR .sp @@ -89,60 +89,22 @@ Smart\-UPS 900I .PP "new" models .RS 4 -These models usually come from late 1990s / pre\-2009 times\&. They are often referred as "3rd\&. gen"\&. For the most part, they have programmable EEPROM, report supported commands and capabilities, and should work just fine with the apcsmart driver\&. +These models usually come from late 1990s / pre\-2009 times\&. They are often referred as "3rd\&. gen"\&. For the most part, they have programmable eeprom, report supported commands and capabilites, and should work just fine with the apcsmart driver\&. .RE .PP "microlink" models .RS 4 WARNING: these are not \fInatively\fR -supported by -\fBapcsmart\fR -(or -\fBapcupsd\fR, for that matter, if you\(cqre wondering)\&. Around 2007, APC (now APC Schneider) decided to go back to its proprietary roots, and all the new models (SMT, SMX, SURTD) use completely different protocol and cables\&. If you purchased a new APC UPS \- that uses cable with RJ45 on the one end, and DB\-9 on the other \- then you have such model\&. Your only option to support it through +supported by apcsmart (or apcupsd for that matter, if you\(cqre wondering)\&. Around 2007 APC (now APC Schneider) decided to go back to its proprietry roots and all the new models (SMT, SMX, SURTD) use completely different protocol and cables\&. If you purchased a new APC UPS, that uses cable with rj45 on the one end, and db\-9 on the other \- then you have such model\&. Your only option to support it through \fBNUT\fR -is to purchase a "legacy communications card" \- part #AP9620 (google -\fIAP9620\fR -for more details)\&. Or if that\(cqs not an option, rely on official software\&. -.RE -.PP -Microsol models -.RS 4 -Several Microsol serial models sold in Brazil have been rebranded as APC Back\-UPS, and the model numbers tend to start with "BZ"\&. If you have one of these "Nobreaks", they will not work with the -\fBapcsmart\fR -driver \- please see the -\fBsolis\fR(8) -driver instead\&. -.PP -\fBExample models:\fR -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Back\-UPS BZ1200\-BR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Back\-UPS BZ2200BI\-BR -.RE +is to purchase "legacy communications card" \- part #AP9620 (google \*(AqAP9620\*(Aq for more details)\&. Or if that\*(Aqs not an option, rely on official software\&. .RE .sp Another thing to remember is that Smart protocol is not USB protocol\&. If you have UPS with both USB and serial ports, then depending on how you connect it, you will need either apcsmart or usbhid\-ups driver\&. .SH "CABLING" .sp -This driver expects to see a 940\-0024C cable or a clone by default\&. You can switch to the 940\-0095B dual\-mode cable support with the \fIcable=\fR definition described below\&. +This driver expects to see a 940\-0024C cable or a clone by default\&. You can switch to the 940\-0095B dual\-mode cable support with the \*(Aqcable=\*(Aq definition described below\&. .sp If your 940\-xx24X cable is broken or missing, use this diagram to build a clone: .sp @@ -173,7 +135,7 @@ Alternatively, you can also provide it on the command line using: \-x \fBcable\fR=940\-0095B .SH "TTY MODES" .sp -By default the driver works in canonical mode, but it proved to be a problem in Windows systems\&. Furthermore there\(cqs a possibility of some obscure serial cards or serial\-USB converters that could cause problems as well\&. You can use \fIttymode=\fR option to force non\-canonical discipline in \fBups.conf\fR(5): +By default the driver works in canonical mode, but it showed to be a problem in windows systems\&. Furthermore there\(cqs a possibility of some obscure serial cards or serial\-usb convertes that could cause problems as well\&. You can use \*(Aqttymode=\*(Aq option to force non\-canonical discipline in \fBups.conf\fR(5): .sp \fBttymode\fR=raw .sp @@ -203,55 +165,49 @@ APC hardware supports a lot of shutdown methods, that themselves can differ in b \fBS\fR (soft hibernate) .RS 4 This is most basic command present in probably all APC models\&. It will hibernate the UPS, and subsequently wake it up when the mains supply returns\&. -\fBThe command doesn\(cqt work if the UPS is running on mains\&.\fR +\fBThe command doesn\*(Aqt work if UPS is running on mains\&.\fR .PP -"old" models: +"old" models .RS 4 The behaviour here is unfortunately pretty primitive \- when the power returns, the UPS just wakes up\&. No grace periods, no min\&. battery charge condition, etc\&. This is probably not what you want\&. .RE .PP -"new" models: +"new" models .RS 4 -The behaviour here is as expected \- the power is cut off after the EEPROM defined grace period\&. The UPS will wake up when the power returns, after the EEPROM defined delay AND if the EEPROM defined min\&. battery charge level is met\&. The delay is counted from the power\(cqs return\&. +The behaviour here is as expected \- the power is cut off after the eeprom defined grace period\&. The UPS will wake up when the power returns, after the eeprom defined delay AND if the eeprom defined min\&. battery charge level is met\&. The delay is counted from the power\*(Aqs return\&. .RE .RE .PP \fBCS\fR (aka "force OB hack") .RS 4 -This is a trick to make UPS power down even if it\(cqs running on mains\&. Immediately before issuing +This is a trick to make UPS power down even if it\*(Aqs running on mains\&. Immediately before issuing \fBS\fR, "simulate power failure" is issued\&. The remaining behaviour is as in \fBS\fR case\&. .sp -There\(cqs a delay between "simulate power failure" and -\fBS\fR -\- by default set to 3\&.5s\&. You can control it through -\fBcshdelay\fR -option (allowed values are from 0 to 9\&.9)\&. -.sp The name came from APC CS models, where such trick was used to power down UPSes in consistent fashion using only -\fBS\fR\&. It\(cqs better to use +\fBS\fR\&. It\*(Aqs better to use \fB@nnn\fR command if your UPS supports it (and is not too old, see below)\&. .RE .PP \fB@nnn\fR (hard hibernate) .RS 4 -This is basic command used to hibernate UPS regardless if it\(cqs running on batteries or on mains\&. The option takes 3 digits argument which can be used to specify additional wake\-up delay (in 6 minute units)\&. +This is basic command used to hibernate UPS regardless if it\*(Aqs running on batteries or on mains\&. The option takes 3 digits argument which can be used to specify additional wakeup delay (in 6 minute units)\&. .PP -"old" models: +"old" models .RS 4 -The behaviour is \- unfortunately \- similarly primitive to +The behaviour is \- unfortunately \- similary primitive to \fBS\fR\&. The UPS unconditionally wakes up after nnn*6 minutes \- -\fBit doesn\(cqt care if the power returned !\fR -If nnn = 000, then UPS will do precisely nothing\&. On those models you\(cqre better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment\&. Another thing to consider with "old" models \- you might lose the connection with the UPS, until it wakes up (with +\fBit doesn\*(Aqt care if the power returned !\fR +If nnn = 000, then UPS will do precisely nothing\&. On those models you\*(Aqre better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment\&. Another thing to consider with "old" models \- you might lose the connection with the UPS, until it wakes up (with \fBS\fR, the serial connection is kept alive)\&. .RE .PP -"new" models: +"new" models .RS 4 -All the usual variables defined in EEPROM are respected (see -\fBS\fR)\&. Additionally, if nnn > 0, the nnn*6 minutes are added to EEPROM defined delay\&. UPS will not power up if it\(cqs running on batteries, contrary to what "old" models used to do \- the combined delay is counted from the moment of power return\&. +All the usual variables defined in eeprom are respected (see +\fBS\fR)\&. Additionally, if nnn > 0, the nnn*6 minutes are added to eeprom defined delay\&. UPS will not power up if it\*(Aqs running on batteries, contrary to what "old" models used to do \- the combined delay is counted from the moment of power return\&. .RE .sp Supposedly there exist models that take 2 digits instead of 3\&. Just in case, NUT also supports such variation\&. You have to provide exactly 2 digits to trigger it (\fBawd\fR @@ -260,7 +216,7 @@ option, or argument to one of the supported instant commands)\&. .PP \fBK\fR (delayed poweroff) .RS 4 -This is permanent poweroff \- the UPS will not wake up automatically\&. On newer units, it will respect applicable EEPROM variables\&. +This is permanent poweroff \- the UPS will not wake up automatically\&. On newer units, it will respect applicable eeprom variables\&. .RE .PP \fBZ\fR (instant poweroff) @@ -278,18 +234,18 @@ This option takes a single digit (0\-5) as an argument\&. See below for details\ .PP \fBadvorder\fR=no|[0\-4]+ .RS 4 -This option takes string of digits as an argument\&. Methods listed are tried in turn until one of them succeeds\&. Note that the meaning of digits is different from +This option takes string of digits as an argument\&. Methods listed are tried in turn until one of them succeedes\&. Note that the meaning of digits is different from \fBsdtype\fR\&. See below for details\&. .RE .PP \fBawd\fR=[0\-9]{1,3} .RS 4 -This option lets you specify additional wake\-up delay used by +This option lets you specify additional wakeup delay used by \fB@\fR\&. If you provide exactly 2 digits, the driver will try 2 digits variation (see previous section for more info)\&. Otherwise standard 3 digits variation is used\&. \fBNote: the time unit is 6 minutes !\fR .RE .sp -Keep in mind that \fBsdtype\fR and \fBadvorder\fR are mutually exclusive\&. If \fBadvorder\fR is provided, \fBsdtype\fR is ignored\&. If \fBadvorder\fR is set to \fIno\fR, \fBsdtype\fR is used instead\&. +Keep in mind that \fBsdtype\fR and \fBadvorder\fR are mutually exclusive\&. If \fBadvorder\fR is provided, \fBsdtype\fR is ignored\&. If \fBadvorder\fR is set to \*(Aqno\*(Aq, \fBsdtype\fR is used instead\&. .sp If nothing is provided, \fBNUT\fR will assume \fBsdtype\fR=0 \- which is generally fine for anything not too ancient or not too quirky\&. .SS "SDTYPE" @@ -338,14 +294,14 @@ issue hard hibernate (\fB@\fR) .ps -1 .br .sp -Hard hibernate\(cqs additional wake\-up delay can be provided by \fBawd\fR\&. +Hard hibernate\*(Aqs additional wakeup delay can be provided by \fBawd\fR\&. .sp .5v .RE .SS "ADVORDER" .sp -The argument is either a word \fIno\fR, or a string of 1 \- 5 digits in [0 \- 4] range\&. Each digit maps to the one of shutdown methods supported by APC UPSes\&. Methods listed in this way are tried in order, until one of them succeeds\&. +The argument is either a word \*(Aqno\*(Aq, or a string of 1 \- 5 digits in [0 \- 4] range\&. Each digit maps to the one of shutdown methods supported by APC UPSes\&. Methods listed in this way are tried in order, until one of them succedes\&. .sp -If \fBadvorder\fR is undefined or set to \fIno\fR, \fBsdtype\fR is used instead\&. +If \fBadvorder\fR is undefined or set to \*(Aqno\*(Aq, \fBsdtype\fR is used instead\&. .sp The mapping is as follows: .TS @@ -405,12 +361,12 @@ T} .ps -1 .br .sp -Hard hibernate\(cqs additional wake\-up delay can be provided by \fBawd\fR\&. +Hard hibernate\*(Aqs additional wakeup delay can be provided by \fBawd\fR\&. .sp .5v .RE .SH "IGNORING LB STATE" .sp -APC units \- even if they report LB mode \- will not go into shutdown automatically\&. This gives us even more control with reference to "when to actually shutdown PSU"\&. Since version 2\&.6\&.2, NUT supports \fBignorelb\fR option in driver\(cqs section of \fBups.conf\fR(5)\&. When such option is in effect, the core driver will ignore LB state as reported by specific driver and start shutdown basing the decision \fIonly\fR on two conditions: +APC units \- even if they report LB mode \- will not go into shutdown automatically\&. This gives us even more control with reference to "when to actually shutdown psu"\&. Since version 2\&.6\&.2, NUT supports \fBignorelb\fR option in driver\*(Aqs section of \fBups.conf\fR(5)\&. When such option is in effect, the core driver will ignore LB state as reported by specific driver and start shutdown basing the decision \fIonly\fR on two conditions: .sp battery\&.charge < battery\&.charge\&.low .sp @@ -420,7 +376,7 @@ battery\&.runtime < battery\&.runtime\&.low .sp Of course \- if any of the variables are not available, the appropriate condition is not checked\&. If you want to explicitly disable one of the conditions, simply override the right hand variable causing the condition to always evaluate to false (you can even provide negative numbers)\&. .sp -APC UPSes don\(cqt have battery\&.charge\&.low \- you will have to define it if you want to use such condition (prefix the variable with override\&. or default\&.)\&. +APC UPSes don\*(Aqt have battery\&.charge\&.low \- you will have to define it if you want to use such condition (prefix the variable with override\&. or default\&.)\&. .sp "New" units have battery\&.runtime\&.low, but depending on battery quality, firmware version, calibration and UPS load \- this variable can be underestimated quite a bit \- especially right after going into OB state\&. This in turn can cause LB to be asserted, which under normal conditions will cause \fBNUT\fR to initiate the shutdown\&. You might want to disable this condition entirely, when relying on \fBignorelb\fR option (this was actually the main motivation behind introduction of such feature)\&. .sp @@ -443,7 +399,7 @@ This would cause apcsmart to go into shutdown \fIonly\fR if detected battery cha .sp You could ask \- why bother ? Well, the reason is already hinted above\&. APC units can be very picky about the batteries, and their firmware can underestimate the remaining runtime (especially right after going into OB state)\&. \fBignorelb\fR option and \fBoverride\&.*\fR let you remain in control of the UPS, not UPS in control of you\&. .sp -Furthermore, this allows to specify conditions similarly to how it\(cqs done in apcupsd daemon, so it should be welcome by people used to that software\&. +Furthermore, this allows to specify conditions similary to how it\(cqs done in apcupsd daemon, so it should be welcome by people used to that software\&. .SH "SUPPORTED INSTANT COMMANDS" .sp The apcsmart driver exposes following instant commands: @@ -460,7 +416,7 @@ executes "force OB hack" .PP shutdown\&.return at: .RS 4 -executes "hard hibernate" with *6 minutes additional wake\-up delay ( format is the same as of +executes "hard hibernate" with *6 minutes additional wakeup delay ( format is the same as of \fBawd\fR option) .RE @@ -475,7 +431,7 @@ load\&.off executes "instant poweroff" .RE .sp -All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call)\&. Those commands are mostly useful for manual testing, when your machine is not powered by the UPS you\(cqre testing\&. +All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call)\&. Those commands are mostly useful for manual testing, when your machine is not powered by the UPS you\*(Aqre testing\&. .sp Other supported commands: .sp @@ -579,22 +535,18 @@ calibrate\&.stop .RE .SH "PREVIOUS DRIVER VERSION" .sp -Previous driver is still available as \fBapcsmart\-old\fR, should there be any need to use earlier version (bugs, incompatibilities with new functionality, etc\&.)\&. In due time, \fBapcsmart\-old\fR will be phased out completely, but this won\(cqt happen until the new version gets solid exposure with no pending issues\&. +Previous driver is still available as apcsmart\-old \- should there be any need to use earlier version (bugs, incompatiblities with new functionality, etc\&.)\&. In due time apcsmart\-old will be phased out completely, but this won\(cqt happen until the new version gets solid exposure with no pending issues\&. .SH "BUGS" .sp Some older APC UPS models return bogus data in the status register during a front panel test\&. This is usually detected and discarded, but some other unexpected values have occasionally slipped through\&. .sp APC UPS models with both USB and serial ports require a power cycle when switching from USB communication to serial, and perhaps vice versa\&. -.SH "AUTHORS AND HISTORY" +.SH "AUTHOR" .sp -Nigel Metheringham (drawing heavily on the original apcsmart driver by Russell Kroll)\&. -.sp -This driver was called newapc for a time and was renamed in the 1\&.5 series\&. -.sp -In 2\&.6\&.2 it was renamed to apcsmart\-old, being superseded by updated version with new features, which is maintained by Michal Soltys +Nigel Metheringham (drawing heavily on the original apcsmart driver by Russell Kroll)\&. This driver was called newapc for a time and was renamed in the 1\&.5 series\&. In 2\&.6\&.2 it was renamed to apcsmart\-old, being superseded by updated version with new features, which is maintained by Michal Soltys .SH "SEE ALSO" .sp -\fBnutupsdrv\fR(8), \fBups.conf\fR(5), \fBusbhid-ups\fR(8), \fBsolis\fR(8) +\fBnutupsdrv\fR(8), \fBups.conf\fR(5) .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/apcsmart.txt b/docs/man/apcsmart.txt index 503ff57..2ec0a34 100644 --- a/docs/man/apcsmart.txt +++ b/docs/man/apcsmart.txt @@ -1,7 +1,7 @@ APCSMART(8) =========== -NAME +NAME ---- apcsmart - Driver for American Power Conversion Smart Protocol UPS equipment @@ -11,7 +11,7 @@ SYNOPSIS *apcsmart* -h -*apcsmart* -a 'UPS_NAME' [-x option=value ...] +*apcsmart* -a \'UPS_NAME' [-x option=value ...] NOTE: This man page only documents the hardware-specific features of the apcsmart driver. For information about the core driver, see @@ -21,17 +21,17 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ -The apcsmart driver should recognize (or at the very least, work with) the -majority of Smart-UPS models - which includes Smart-UPS, Matrix-UPS and Back-UPS -lineups, among few other ones. +The apcsmart driver should recognize (or at the very least work with) majority +of Smart-UPS models - which includes Smart-UPS, Matrix-UPS and Back-UPS lineups, +among few other ones. -Currently, we can roughly divide APC hardware into four groups (note that the -division isn't strict by any means, and the borders between those are pretty fuzzy): +Currently we can roughly divide APC hardware into 3 groups (note that the +division isn\'t strict by any means, and the borders between those are pretty fuzzy): [very] "old" models:: These models usually have old APC logo, white color and _no_ programmable - EEPROM; you won't find them listed anywhere on APC's site either. The support - for those will be usually based on driver's compatibility tables, or if the + eeprom; You won\'t find them listed anywhere on APC's site either. The support + for those will be usually based on driver\'s compatibility tables, or if the model (firmware) is not listed in those - the driver will try to follow the very basic subset of features, while still trying to remain useful. Despite "smart" tagname, they often tend to behave in pretty dumb way (see the @@ -45,32 +45,19 @@ division isn't strict by any means, and the borders between those are pretty fuz "new" models:: These models usually come from late 1990s / pre-2009 times. They are often - referred as "3rd. gen". For the most part, they have programmable EEPROM, - report supported commands and capabilities, and should work just fine with the + referred as "3rd. gen". For the most part, they have programmable eeprom, + report supported commands and capabilites, and should work just fine with the apcsmart driver. "microlink" models:: - WARNING: these are not _natively_ supported by *apcsmart* (or *apcupsd*, - for that matter, if you're wondering). Around 2007, APC (now APC Schneider) - decided to go back to its proprietary roots, and all the new models (SMT, - SMX, SURTD) use completely different protocol and cables. If you purchased - a new APC UPS - that uses cable with RJ45 on the one end, and DB-9 on the - other - then you have such model. Your only option to support it through - *NUT* is to purchase a "legacy communications card" - part #AP9620 (google - 'AP9620' for more details). Or if that's not an option, rely on official - software. - -Microsol models:: - Several Microsol serial models sold in Brazil have been rebranded as APC - Back-UPS, and the model numbers tend to start with "BZ". If you have one - of these "Nobreaks", they will not work with the *apcsmart* driver - please - see the linkman:solis[8] driver instead. -+ --- -.Example models: - * Back-UPS BZ1200-BR - * Back-UPS BZ2200BI-BR --- + WARNING: these are not _natively_ supported by apcsmart (or apcupsd for that + matter, if you\'re wondering). Around 2007 APC (now APC Schneider) decided to + go back to its proprietry roots and all the new models (SMT, SMX, SURTD) use + completely different protocol and cables. If you purchased a new APC UPS, + that uses cable with rj45 on the one end, and db-9 on the other - then you + have such model. Your only option to support it through *NUT* is to + purchase "legacy communications card" - part #AP9620 (google \'AP9620' for + more details). Or if that\'s not an option, rely on official software. Another thing to remember is that Smart protocol is not USB protocol. If you have UPS with both USB and serial ports, then depending on how you connect it, @@ -80,7 +67,7 @@ CABLING ------- This driver expects to see a 940-0024C cable or a clone by default. You -can switch to the 940-0095B dual-mode cable support with the 'cable=' +can switch to the 940-0095B dual-mode cable support with the \'cable=' definition described below. If your 940-xx24X cable is broken or missing, use this diagram to build @@ -105,10 +92,10 @@ Alternatively, you can also provide it on the command line using: TTY MODES --------- -By default the driver works in canonical mode, but it proved to be a problem in -Windows systems. Furthermore there's a possibility of some obscure serial cards -or serial-USB converters that could cause problems as well. You can use -'ttymode=' option to force non-canonical discipline in linkman:ups.conf[5]: +By default the driver works in canonical mode, but it showed to be a problem in +windows systems. Furthermore there's a possibility of some obscure serial cards +or serial-usb convertes that could cause problems as well. You can use +\'ttymode=' option to force non-canonical discipline in linkman:ups.conf[5]: *ttymode*=raw @@ -127,55 +114,49 @@ behaviour quite a bit, depending on the model. *S* (soft hibernate):: This is most basic command present in probably all APC models. It will hibernate the UPS, and subsequently wake it up when the mains supply - returns. *The command doesn't work if the UPS is running on mains.* -+ --- - "old" models: :: + returns. *The command doesn\'t work if UPS is running on mains.* + + "old" models::: The behaviour here is unfortunately pretty primitive - when the power returns, the UPS just wakes up. No grace periods, no min. battery charge condition, etc. This is probably not what you want. - "new" models: :: + "new" models::: The behaviour here is as expected - the power is cut off after the - EEPROM defined grace period. The UPS will wake up when the power - returns, after the EEPROM defined delay AND if the EEPROM defined min. - battery charge level is met. The delay is counted from the power's + eeprom defined grace period. The UPS will wake up when the power + returns, after the eeprom defined delay AND if the eeprom defined min. + battery charge level is met. The delay is counted from the power\'s return. --- -+ + *CS* (aka "force OB hack"):: - This is a trick to make UPS power down even if it's running on mains. + This is a trick to make UPS power down even if it\'s running on mains. Immediately before issuing *S*, "simulate power failure" is issued. The remaining behaviour is as in *S* case. + -There's a delay between "simulate power failure" and *S* - by default set to -3.5s. You can control it through *cshdelay* option (allowed values are from 0 -to 9.9). -+ The name came from APC CS models, where such trick was used to power down -UPSes in consistent fashion using only *S*. It's better to use *@nnn* +UPSes in consistent fashion using only *S*. It\'s better to use *@nnn* command if your UPS supports it (and is not too old, see below). *@nnn* (hard hibernate):: - This is basic command used to hibernate UPS regardless if it's + This is basic command used to hibernate UPS regardless if it\'s running on batteries or on mains. The option takes 3 digits argument which - can be used to specify additional wake-up delay (in 6 minute units). + can be used to specify additional wakeup delay (in 6 minute units). + -- - "old" models: :: - The behaviour is - unfortunately - similarly primitive to *S*. The UPS - unconditionally wakes up after $$nnn*6$$ minutes - *it doesn't care if the + "old" models::: + The behaviour is - unfortunately - similary primitive to *S*. The UPS + unconditionally wakes up after $$nnn*6$$ minutes - *it doesn\'t care if the power returned !* If nnn = 000, then UPS will do precisely nothing. On - those models you're better specifying nnn > 0, if you can estimate + those models you\'re better specifying nnn > 0, if you can estimate the kind of power problems that might be happening in your environment. Another thing to consider with "old" models - you might lose the connection with the UPS, until it wakes up (with *S*, the serial connection is kept alive). - "new" models: :: - All the usual variables defined in EEPROM are respected (see *S*). - Additionally, if nnn > 0, the $$nnn*6$$ minutes are added to EEPROM - defined delay. UPS will not power up if it's running on batteries, + "new" models::: + All the usual variables defined in eeprom are respected (see *S*). + Additionally, if nnn > 0, the $$nnn*6$$ minutes are added to eeprom + defined delay. UPS will not power up if it\'s running on batteries, contrary to what "old" models used to do - the combined delay is counted from the moment of power return. -- @@ -186,7 +167,7 @@ trigger it (*awd* option, or argument to one of the supported instant commands). *K* (delayed poweroff):: This is permanent poweroff - the UPS will not wake up automatically. On - newer units, it will respect applicable EEPROM variables. + newer units, it will respect applicable eeprom variables. *Z* (instant poweroff):: This is also permanent poweroff - the UPS will not wake up automatically. @@ -203,17 +184,17 @@ There are three options used to control the shutdown behaviour. *advorder*=no|[0-4]+:: This option takes string of digits as an argument. Methods listed are tried - in turn until one of them succeeds. Note that the meaning of digits is + in turn until one of them succeedes. Note that the meaning of digits is different from *sdtype*. See below for details. *awd*=[0-9]{1,3}:: - This option lets you specify additional wake-up delay used by *@*. If you + This option lets you specify additional wakeup delay used by *@*. If you provide exactly 2 digits, the driver will try 2 digits variation (see previous section for more info). Otherwise standard 3 digits variation is used. *Note: the time unit is 6 minutes !* Keep in mind that *sdtype* and *advorder* are mutually exclusive. If *advorder* -is provided, *sdtype* is ignored. If *advorder* is set to 'no', *sdtype* is +is provided, *sdtype* is ignored. If *advorder* is set to \'no', *sdtype* is used instead. If nothing is provided, *NUT* will assume *sdtype*=0 - which is generally fine @@ -240,16 +221,16 @@ issue "force OB hack" (*CS*) 5:: issue hard hibernate (*@*) -NOTE: Hard hibernate's additional wake-up delay can be provided by *awd*. +NOTE: Hard hibernate\'s additional wakeup delay can be provided by *awd*. ADVORDER ~~~~~~~~ -The argument is either a word 'no', or a string of 1 - 5 digits in [0 - 4] +The argument is either a word \'no', or a string of 1 - 5 digits in [0 - 4] range. Each digit maps to the one of shutdown methods supported by APC UPSes. -Methods listed in this way are tried in order, until one of them succeeds. +Methods listed in this way are tried in order, until one of them succedes. -If *advorder* is undefined or set to 'no', *sdtype* is used instead. +If *advorder* is undefined or set to \'no', *sdtype* is used instead. The mapping is as follows: @@ -260,16 +241,16 @@ The mapping is as follows: 3:: instant poweroff (*Z*) 4:: "force OB hack" (*CS*) -NOTE: Hard hibernate's additional wake-up delay can be provided by *awd*. +NOTE: Hard hibernate\'s additional wakeup delay can be provided by *awd*. IGNORING LB STATE ----------------- APC units - even if they report LB mode - will not go into shutdown automatically. This gives us even more control with reference to "when to -actually shutdown PSU". Since version 2.6.2, NUT supports *ignorelb* option in -driver's section of linkman:ups.conf[5]. When such option is in effect, -the core driver will ignore LB state as reported by specific driver and +actually shutdown psu". Since version 2.6.2, NUT supports *ignorelb* option in +driver\'s section of linkman:ups.conf[5]. When such option is in effect, +the core driver will ignore LB state as reported by specific driver and start shutdown basing the decision _only_ on two conditions: battery.charge < battery.charge.low @@ -283,8 +264,8 @@ is not checked. If you want to explicitly disable one of the conditions, simply override the right hand variable causing the condition to always evaluate to false (you can even provide negative numbers). -APC UPSes don't have battery.charge.low - you will have to define it if you want -to use such condition (prefix the variable with `override.` or `default.`). +APC UPSes don\'t have battery.charge.low - you will have to define it if you want +to use such condition (prefix the variable with override. or default.). "New" units have battery.runtime.low, but depending on battery quality, firmware version, calibration and UPS load - this variable can be underestimated quite a bit - @@ -295,6 +276,8 @@ shutdown. You might want to disable this condition entirely, when relying on such feature). Simple example: + +[source,conf] ---- [apc] ignorelb @@ -311,7 +294,7 @@ remaining runtime (especially right after going into OB state). *ignorelb* option and *$$override.*$$* let you remain in control of the UPS, not UPS in control of you. -Furthermore, this allows to specify conditions similarly to how it's done in +Furthermore, this allows to specify conditions similary to how it's done in apcupsd daemon, so it should be welcome by people used to that software. @@ -325,7 +308,7 @@ executes soft hibernate shutdown.return cs:: executes "force OB hack" shutdown.return at::: -executes "hard hibernate" with $$*6$$ minutes additional wake-up delay ( format +executes "hard hibernate" with $$*6$$ minutes additional wakeup delay ( format is the same as of *awd* option) shutdown.stayoff:: executes "delayed poweroff" @@ -335,7 +318,7 @@ executes "instant poweroff" All the above commands must be issued 2nd time to have any effect (no less than 3 seconds, and no more than 15 seconds after the initial call). Those commands are mostly useful for manual testing, when your machine is not powered by the UPS -you're testing. +you\'re testing. Other supported commands: @@ -352,9 +335,9 @@ Other supported commands: PREVIOUS DRIVER VERSION ----------------------- -Previous driver is still available as *apcsmart-old*, should there be any need to -use earlier version (bugs, incompatibilities with new functionality, etc.). In -due time, *apcsmart-old* will be phased out completely, but this won't happen until +Previous driver is still available as apcsmart-old - should there be any need to +use earlier version (bugs, incompatiblities with new functionality, etc.). In +due time apcsmart-old will be phased out completely, but this won't happen until the new version gets solid exposure with no pending issues. BUGS @@ -367,28 +350,22 @@ other unexpected values have occasionally slipped through. APC UPS models with both USB and serial ports require a power cycle when switching from USB communication to serial, and perhaps vice versa. -AUTHORS AND HISTORY -------------------- +AUTHOR +------ Nigel Metheringham (drawing -heavily on the original `apcsmart` driver by Russell Kroll). - -This driver was called `newapc` for a time and was renamed in -the 1.5 series. - -In 2.6.2 it was renamed to `apcsmart-old`, being superseded by -updated version with new features, which is maintained by Michal -Soltys +heavily on the original apcsmart driver by Russell Kroll). This driver +was called newapc for a time and was renamed in the 1.5 series. In 2.6.2 +it was renamed to apcsmart-old, being superseded by updated version with +new features, which is maintained by Michal Soltys SEE ALSO -------- -linkman:nutupsdrv[8], linkman:ups.conf[5], linkman:usbhid-ups[8], -linkman:solis[8] +linkman:nutupsdrv[8], linkman:ups.conf[5] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ // vim: tw=80 ai si ts=8 sts=4 sw=4 et : diff --git a/docs/man/apcupsd-ups.8 b/docs/man/apcupsd-ups.8 index c8e4657..7944bed 100644 --- a/docs/man/apcupsd-ups.8 +++ b/docs/man/apcupsd-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: apcupsd-ups .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "APCUPSD\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "APCUPSD\-UPS" "8" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ apcupsd-ups \- Driver for apcupsd client access This man page only documents the specific features of the \fBapcupsd\-ups\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "DESCRIPTION" .sp -This driver is a client to \fBapcupsd\fR (another UPS monitoring project)\&. +This driver is a client to \fBapcupsd\fR\&. .sp \fBapcupsd\-ups\fR acts as an \fBapcupsd\fR client, simply forwarding data\&. This can be useful in cases where both protocols are required in a network, or in case apcupsd has a required UPS access mode missing from NUT\&. .SH "EXTRA ARGUMENTS" @@ -62,7 +62,7 @@ For instance: .\} .SH "BACKGROUND" .sp -This driver was originally written in one evening to allow interoperating with \fBapcupsd\fR\&. +This driver was originally written in one evening to allow interworking with \fBapcupsd\fR\&. .SH "SUPPORTED VARIABLES" .sp The following variables are translated from \fBapcupsd\fR to NUT\&. All times should be converted to seconds (please file a bug if you notice a mismatch in units)\&. @@ -352,26 +352,6 @@ Andreas Steinmetz \fBups.conf\fR(5), \fBnutupsdrv\fR(8) .SS "Internet Resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The apcupsd home page: -http://www\&.apcupsd\&.org/ -.RE +The apcupsd home page: http://www\&.apcupsd\&.org/ diff --git a/docs/man/apcupsd-ups.txt b/docs/man/apcupsd-ups.txt index 1017bd2..6c56aee 100644 --- a/docs/man/apcupsd-ups.txt +++ b/docs/man/apcupsd-ups.txt @@ -3,20 +3,17 @@ APCUPSD-UPS(8) NAME ---- - apcupsd-ups - Driver for apcupsd client access NOTE ---- - This man page only documents the specific features of the *apcupsd-ups* driver. For information about the core driver, see linkman:nutupsdrv[8]. DESCRIPTION ----------- - -This driver is a client to *apcupsd* (another UPS monitoring project). +This driver is a client to *apcupsd*. *apcupsd-ups* acts as an *apcupsd* client, simply forwarding data. This can be useful in cases where both protocols are required in a network, @@ -40,15 +37,13 @@ For instance: BACKGROUND ---------- -This driver was originally written in one evening to allow interoperating -with *apcupsd*. +This driver was originally written in one evening to allow interworking with *apcupsd*. SUPPORTED VARIABLES ------------------- -The following variables are translated from *apcupsd* to NUT. -All times should be converted to seconds (please file a bug -if you notice a mismatch in units). +The following variables are translated from *apcupsd* to NUT. All times should be +converted to seconds (please file a bug if you notice a mismatch in units). [width="50%",cols="m,m",options="header"] |=============================== @@ -90,7 +85,6 @@ if you notice a mismatch in units). LIMITATIONS ----------- - Access to *apcupsd* is strictly read only: no commands can be issued. This stems from the design of *apcupsd*, where the settings are changed in *apctest*. In order to run *apctest*, *apcupsd* must be stopped (and *apcupsd* @@ -98,7 +92,6 @@ exposes the UPS to the network). AUTHOR ------ - Andreas Steinmetz SEE ALSO @@ -109,6 +102,6 @@ linkman:nutupsdrv[8] Internet Resources: ~~~~~~~~~~~~~~~~~~~ +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The apcupsd home page: http://www.apcupsd.org/ +The apcupsd home page: http://www.apcupsd.org/ diff --git a/docs/man/asciidoc.conf b/docs/man/asciidoc.conf index 9b4533d..08d5f10 100644 --- a/docs/man/asciidoc.conf +++ b/docs/man/asciidoc.conf @@ -22,12 +22,4 @@ endif::backend-docbook[] ifdef::backend-xhtml11[] [linkman-inlinemacro] {target}{0?({0})} - -# Override HTML footer, to include NUT version -[footer-text] -Last updated {docdate} {doctime} -- Network UPS Tools {nutversion} - -# Format-detection to prevent smartphones from being too smart -[+docinfo] - endif::backend-xhtml11[] diff --git a/docs/man/asem.8 b/docs/man/asem.8 deleted file mode 100644 index 7903235..0000000 --- a/docs/man/asem.8 +++ /dev/null @@ -1,117 +0,0 @@ -'\" t -.\" Title: asem -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "ASEM" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -asem \- driver for UPS in ASEM PB1300 -.SH "NOTE" -.sp -This man page only documents the hardware\-specific features of the \fBasem\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "SUPPORTED HARDWARE" -.sp -The \fBasem\fR driver supports the UPS in ASEM PB1300 embedded PCs\&. Likely other I2C devices from the same manufacturer will work too, since this is a "custom" charger\&. -.sp -Seems that there are two versions of the charger\&. Older one is based on Max1667, newer one is a custom solution\&. Both are on I2C address 0x09\&. To be compatible with both versions, the driver just reads bit 15 of address 0x13 which yields online/on battery status\&. Battery monitor is a BQ2060 at address 0x0B\&. -.SH "EXTRA ARGUMENTS" -.sp -The required parameter for this driver is the I2C bus name: -.PP -\fBport\fR=\fIdev\-node\fR -.RS 4 -On the Asem PB1300, this should be -/dev/i2c\-7 -for the i801 SMBUS adapter\&. -.RE -.sp -This driver also supports the following optional settings: -.PP -\fBlb\fR=\fInum\fR -.RS 4 -Set the low battery threshold to -\fInum\fR -volts\&. -.RE -.PP -\fBhb\fR=\fInum\fR -.RS 4 -Set the high battery threshold to -\fInum\fR -volts\&. -.RE -.SH "INSTALLATION" -.sp -This driver is specific to the Linux I2C API, and requires the lm_sensors libi2c\-dev or its equivalent to compile\&. -.sp -Beware that the SystemIO memory used by the I2C controller is reserved by ACPI\&. If only a native I2C driver (e\&.g\&. i2c_i801, as of 3\&.5\&.X Linux kernels) is available, then you\(cqll need to relax the ACPI resources check\&. For example, you can boot with the acpi_enforce_resources=lax option\&. -.SH "KNOWN ISSUES AND BUGS" -.sp -The driver shutdown function is not implemented, so other arrangements must be made to turn off the UPS\&. -.SH "AUTHOR" -.sp -Giuseppe Corbelli -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PB1300 specifications: -http://www\&.asem\&.it/en/products/industrial\-automation/box\-pcs/performance/pb1300/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -BQ2060 datasheet: -http://www\&.ti\&.com/lit/ds/symlink/bq2060\&.pdf -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE diff --git a/docs/man/asem.txt b/docs/man/asem.txt deleted file mode 100644 index b45cf11..0000000 --- a/docs/man/asem.txt +++ /dev/null @@ -1,90 +0,0 @@ -ASEM(8) -======= - -NAME ----- - -asem - driver for UPS in ASEM PB1300 - -NOTE ----- - -This man page only documents the hardware-specific features of the -*asem* driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -The *asem* driver supports the UPS in ASEM PB1300 embedded PCs. Likely other -I2C devices from the same manufacturer will work too, since this is a "custom" -charger. - -Seems that there are two versions of the charger. Older one is based on -Max1667, newer one is a custom solution. Both are on I2C address 0x09. -To be compatible with both versions, the driver just reads bit 15 of address -0x13 which yields online/on battery status. -Battery monitor is a BQ2060 at address 0x0B. - -EXTRA ARGUMENTS ---------------- - -The required parameter for this driver is the I2C bus name: - -*port*='dev-node':: -On the Asem PB1300, this should be `/dev/i2c-7` for the i801 SMBUS adapter. - -This driver also supports the following optional settings: - -*lb*='num':: -Set the low battery threshold to 'num' volts. - -*hb*='num':: -Set the high battery threshold to 'num' volts. - -INSTALLATION ------------- - -This driver is specific to the Linux I2C API, and requires the lm_sensors -libi2c-dev or its equivalent to compile. - -Beware that the SystemIO memory used by the I2C controller is reserved by ACPI. -If only a native I2C driver (e.g. i2c_i801, as of 3.5.X Linux kernels) is -available, then you'll need to relax the ACPI resources check. For example, you -can boot with the `acpi_enforce_resources=lax` option. - -////////////////////////////////////////// -Optional: use DIAGNOSTICS to describe troubleshooting techniques that are -longer than what can be conveniently described in the driver error messages. - -DIAGNOSTICS ------------ - -////////////////////////////////////////// - -KNOWN ISSUES AND BUGS ---------------------- - -The driver shutdown function is not implemented, so other arrangements must be -made to turn off the UPS. - -AUTHOR ------- - -Giuseppe Corbelli - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* PB1300 specifications: - http://www.asem.it/en/products/industrial-automation/box-pcs/performance/pb1300/ -* BQ2060 datasheet: http://www.ti.com/lit/ds/symlink/bq2060.pdf -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/bcmxcp.8 b/docs/man/bcmxcp.8 index 428f128..f419069 100644 --- a/docs/man/bcmxcp.8 +++ b/docs/man/bcmxcp.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bcmxcp .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BCMXCP" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BCMXCP" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -58,6 +58,7 @@ Communication speed for the UPS\&. If this is set to 9600, it tries to connect t .sp -1 .IP \(bu 2.3 .\} + \fBshutdown_delay =\fR \fI120\fR .RE @@ -70,6 +71,7 @@ Communication speed for the UPS\&. If this is set to 9600, it tries to connect t .sp -1 .IP \(bu 2.3 .\} + \fBbaud_rate =\fR \fInone\fR .RE diff --git a/docs/man/bcmxcp.txt b/docs/man/bcmxcp.txt index 037e1b0..3037a9c 100644 --- a/docs/man/bcmxcp.txt +++ b/docs/man/bcmxcp.txt @@ -8,14 +8,12 @@ bcmxcp - Driver for UPSes supporting the serial BCM/XCP protocol NOTE ---- - This man page only documents the hardware-specific features of the bcmxcp driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver should recognize all serial BCM/XCP-compatible UPSes. It has been developed and tested on Powerware PW5115 and PW9120 hardware. If your UPS has a USB connection, you may also consult the linkman:bcmxcp_usb[8] driver @@ -23,12 +21,11 @@ documentation. EXTRA ARGUMENTS --------------- - -This driver supports the following optional settings in the +This driver supports the following optional settings in the linkman:ups.conf[5]. *shutdown_delay=*'delay':: -The number of seconds that the UPS should wait between receiving the +The number of seconds that the UPS should wait between receiving the shutdown command (`upsdrvctl shutdown`) and actually shutting off. *baud_rate=*'rate':: @@ -36,20 +33,18 @@ Communication speed for the UPS. If this is set to 9600, it tries to connect to the UPS at 9600bps. If it fails to communicate, it will go into baud-hunting. It starts at 1200 and goes up to 19200. If it succeeds, it tell you the speed it connected with. If not included in the config, it defaults to baud-hunting. - + DEFAULT VALUES FOR THE EXTRA ARGUMENTS -------------------------------------- - - *shutdown_delay =* '120' - *baud_rate =* 'none' INSTANT COMMANDS ---------------- - This driver supports the following Instant Commands: *shutdown.return*:: -Turn off the load and return when power is back. +Turn off the load and return when power is back. *shutdown.stayoff*:: Turn off the load and remain off. @@ -59,7 +54,7 @@ Start a battery test. *outlet.n.shutdown.return*:: Turn off the load on outlet 'n' and return when power is back. -('n' is the outlet number reported by the upsc command) +('n' is the outlet number reported by the upsc command) TODO LIST --------- @@ -72,28 +67,22 @@ Access the config register to change settings. BUGS ---- - None known. AUTHOR ------ - Tore Ørpetveit SEE ALSO -------- - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] The USB BCM/XCP driver: ~~~~~~~~~~~~~~~~~~~~~~~ - linkman:bcmxcp_usb[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/bcmxcp_usb.8 b/docs/man/bcmxcp_usb.8 index 60e2adf..08b99a5 100644 --- a/docs/man/bcmxcp_usb.8 +++ b/docs/man/bcmxcp_usb.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bcmxcp_usb -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BCMXCP_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BCMXCP_USB" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -71,7 +71,7 @@ Start a battery test\&. BCM/XCP supports reporting a wide range of UPS alarm conditions\&. .RE .PP -\fBReport UPS statistics information\fR +\fBReport UPS statistics informations\fR .RS 4 BCM/XCP supports reporting of UPS statistics data\&. .RE @@ -102,29 +102,9 @@ bcmxcp_usb only supports 1 UPS at this time\&. You can put the "auto" value for .SS ""Got EPERM: Operation not permitted upon driver startup"" .sp You have forgotten to install the hotplug files, as explained in the INSTALLATION section above\&. Don\(cqt forget to restart hotplug so that it applies these changes\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Tore Ørpetveit -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Wolfgang Ocker -.RE +Tore Ørpetveit , Wolfgang Ocker .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/bcmxcp_usb.txt b/docs/man/bcmxcp_usb.txt index 2eae9f5..a69d631 100644 --- a/docs/man/bcmxcp_usb.txt +++ b/docs/man/bcmxcp_usb.txt @@ -3,12 +3,10 @@ BCMXCP_USB(8) NAME ---- - bcmxcp_usb - Experimental driver for UPSes supporting the BCM/XCP protocol over USB NOTE ---- - This man page only documents the hardware-specific features of the bcmxcp_usb driver. For information about the core driver, see linkman:nutupsdrv[8]. @@ -16,7 +14,6 @@ This driver is a variant of the serial driver bcmxcp and uses the same core code SUPPORTED HARDWARE ------------------ - This driver should recognize all BCM/XCP-compatible UPSes that are connected via USB. It has been developed and tested on Powerware PW3501 hardware. It also has been tested on PW5110 hardware. @@ -24,25 +21,23 @@ been tested on PW5110 hardware. EXTRA ARGUMENTS --------------- -This driver supports the following optional settings in the +This driver supports the following optional settings in the linkman:ups.conf[5]. *shutdown_delay=*'delay':: -The number of seconds that the UPS should wait between receiving the +The number of seconds that the UPS should wait between receiving the shutdown command and actually shutting off. DEFAULT VALUES FOR THE EXTRA ARGUMENTS -------------------------------------- - *shutdown_delay =*'120' INSTANT COMMANDS ---------------- - This driver supports the following Instant Commands: *shutdown.return*:: -Turn off the load and return when power is back. +Turn off the load and return when power is back. *shutdown.stayoff*:: Turn off the load and remain off. @@ -56,12 +51,11 @@ TODO LIST *Report UPS alarm status*:: BCM/XCP supports reporting a wide range of UPS alarm conditions. -*Report UPS statistics information*:: +*Report UPS statistics informations*:: BCM/XCP supports reporting of UPS statistics data. EXPERIMENTAL DRIVER ------------------- - This driver has been tagged experimental, even if it has been reported to be stable. Thus it is not suitable for production systems and it is not built by default. This is mainly due to the fact that it is a @@ -69,7 +63,6 @@ new driver. INSTALLATION ------------ - This driver is not built by default. You can build it by using "configure --with-usb=yes". Note that it will also install other USB drivers. @@ -81,7 +74,6 @@ must have execution flag set (ie using chmod +x ...). IMPLEMENTATION -------------- - bcmxcp_usb only supports 1 UPS at this time. You can put the "auto" value for port in `ups.conf`, i.e.: @@ -91,7 +83,6 @@ bcmxcp_usb only supports 1 UPS at this time. You can put the KNOWN ISSUES AND BUGS --------------------- - "Got EPERM: Operation not permitted upon driver startup" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -99,21 +90,18 @@ You have forgotten to install the hotplug files, as explained in the INSTALLATION section above. Don't forget to restart hotplug so that it applies these changes. -AUTHORS -------- - -* Tore Ørpetveit -* Wolfgang Ocker +AUTHOR +------ +Tore Ørpetveit , +Wolfgang Ocker SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/belkin.8 b/docs/man/belkin.8 index 4798967..23ed5f8 100644 --- a/docs/man/belkin.8 +++ b/docs/man/belkin.8 @@ -1,13 +1,13 @@ '\" t .\" Title: belkin -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BELKIN" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BELKIN" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,8 +37,6 @@ This man page only documents the hardware\-specific features of the belkin drive The \fBbelkin\fR driver is known to support the Regulator Pro 525 (F6C525\-SER)\&. Other similar models such as the 425 and 625 should also work\&. .sp The Trust UPS and older Belkin units are not supported\&. -.sp -This driver only supports serial connections\&. If your UPS has a USB port, please consult the Hardware Compatibility List (HCL) to see which of the USB drivers you should use\&. .SH "EXTRA ARGUMENTS" .sp This driver does not support any extra settings in the \fBups.conf\fR(5)\&. @@ -65,9 +63,6 @@ the driver doesn\(cqt go anywhere near these character sequences, so it won\(cqt .SS "The core driver:" .sp \fBnutupsdrv\fR(8) -.SS "Other Belkin drivers:" -.sp -\fBbelkinunv\fR(8), \fBblazer_ser\fR(8), \fBblazer_usb\fR(8), \fBusbhid-ups\fR(8) .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/belkin.txt b/docs/man/belkin.txt index 57e0320..495201e 100644 --- a/docs/man/belkin.txt +++ b/docs/man/belkin.txt @@ -3,32 +3,27 @@ BELKIN(8) NAME ---- - + belkin - Driver for Belkin serial UPS equipment NOTE ---- This man page only documents the hardware-specific features of the -belkin driver. For information about the core driver, see +belkin driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - The *belkin* driver is known to support the Regulator Pro 525 (F6C525-SER). Other similar models such as the 425 and 625 should also work. The Trust UPS and older Belkin units are not supported. -This driver only supports serial connections. If your UPS has a USB port, -please consult the Hardware Compatibility List (HCL) to see which of the USB -drivers you should use. - EXTRA ARGUMENTS --------------- -This driver does not support any extra settings in the +This driver does not support any extra settings in the linkman:ups.conf[5]. BUGS @@ -47,18 +42,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] -Other Belkin drivers: -~~~~~~~~~~~~~~~~~~~~~ - -linkman:belkinunv[8], -linkman:blazer_ser[8], -linkman:blazer_usb[8], -linkman:usbhid-ups[8] - Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/belkinunv.8 b/docs/man/belkinunv.8 index 0e18d03..45ff16b 100644 --- a/docs/man/belkinunv.8 +++ b/docs/man/belkinunv.8 @@ -1,13 +1,13 @@ '\" t .\" Title: belkinunv .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BELKINUNV" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BELKINUNV" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,8 +32,6 @@ belkinunv \- Driver for Belkin "Universal UPS" and compatible .SH "NOTE" .sp This man page only documents the hardware\-specific features of the belkin driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp -This driver only supports serial connections\&. If your UPS has a USB port, please consult the Hardware Compatibility List (HCL) to see which of the USB drivers you should use\&. .SH "SUPPORTED HARDWARE" .sp The belkinunv driver is known to work with the Belkin Universal UPS models F6C800\-UNV and F6C120\-UNV, and is expected to work with other Belkin Universal UPS models\&. The driver only supports serial communication, not USB\&. @@ -320,16 +318,10 @@ When used with the \fB\-x wait\fR option, the exit status is normally \fB0\fR\&. .SH "EXTRA ARGUMENTS" .sp This driver does not support any extra settings in \fBups.conf\fR(5)\&. -.SH "AUTHOR" -.sp -Peter Selinger .SH "SEE ALSO" .SS "The core driver:" .sp \fBnutupsdrv\fR(8) -.SS "Other Belkin drivers:" -.sp -\fBbelkinunv\fR(8), \fBblazer_ser\fR(8), \fBblazer_usb\fR(8), \fBusbhid-ups\fR(8) .SS "Internet resources:" .sp .RS 4 @@ -354,5 +346,7 @@ http://www\&.networkupstools\&.org/ .\} The documentation for the protocol used by this UPS: belkin\-universal\-ups\&.html -(replica on NUT site) .RE +.SH "AUTHOR" +.sp +Peter Selinger diff --git a/docs/man/belkinunv.txt b/docs/man/belkinunv.txt index 4d8d8c2..cc8bb99 100644 --- a/docs/man/belkinunv.txt +++ b/docs/man/belkinunv.txt @@ -8,18 +8,12 @@ belkinunv - Driver for Belkin "Universal UPS" and compatible NOTE ---- - This man page only documents the hardware-specific features of the -belkin driver. For information about the core driver, see +belkin driver. For information about the core driver, see linkman:nutupsdrv[8]. -This driver only supports serial connections. If your UPS has a USB port, -please consult the Hardware Compatibility List (HCL) to see which of the USB -drivers you should use. - SUPPORTED HARDWARE ------------------ - The belkinunv driver is known to work with the Belkin Universal UPS models F6C800-UNV and F6C120-UNV, and is expected to work with other Belkin Universal UPS models. The driver only supports serial @@ -34,7 +28,6 @@ are supported using the linkman:genericups[8] driver with SOFT SHUTDOWN WORKAROUND ------------------------ - One problem with the Belkin Universal UPS is that it cannot enter a soft shutdown (shut down the load until AC power returns) unless the batteries are completely depleted. Thus, one cannot just shut off the @@ -58,7 +51,7 @@ system reboots in this case. If AC power does not come back on, the UPS will eventually run out of batteries, kill the computer's power supply, and go into soft shutdown mode, which means everything will reboot properly when the power returns. In either case, a deadlock is -avoided. +avoided. In addition, if an optional integer argument is given to the *-x wait* option, this causes *belkinunv* to wait not only for AC power to be present, @@ -76,7 +69,6 @@ startup scripts. OPTIONS ------- - See also linkman:nutupsdrv[8] for generic options. Never use the *-k* option with this driver; it does not work properly. @@ -100,7 +92,7 @@ used in a startup script, to ensure the computer remains bootable even if the UPS has been disconnected during the power failure (for instance, you attached your computer to a generator, carried it to a neighbor's house, or -whatever). +whatever). *-x flash*:: This option only has an effect when used in conjunction with the *-x wait* @@ -130,7 +122,6 @@ line. VARIABLES --------- - *battery.charge*:: *battery.runtime*:: @@ -254,7 +245,7 @@ load is online *ACFAIL*:: AC failure. Note that this refers to the AC input, and thus it is not the same as "OB". An AC failure can occur at any time, for instance, -during a battery test, or when the UPS load is off. +during a battery test, or when the UPS load is off. *OVER*:: overload @@ -273,7 +264,7 @@ charging *DEPLETED*:: the battery is depleted. When the UPS raises this flag, it -simultaneously switches off the load. +simultaneously switches off the load. *RB*:: replace battery @@ -332,32 +323,20 @@ EXTRA ARGUMENTS This driver does not support any extra settings in linkman:ups.conf[5]. -AUTHOR ------- - -Peter Selinger - SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] -Other Belkin drivers: -~~~~~~~~~~~~~~~~~~~~~ - -linkman:belkinunv[8], -linkman:blazer_ser[8], -linkman:blazer_usb[8], -linkman:usbhid-ups[8] - Internet resources: ~~~~~~~~~~~~~~~~~~~ + - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ + - The documentation for the protocol used by this UPS: +link:http://www.mscs.dal.ca/~selinger/ups/belkin-universal-ups.html[belkin-universal-ups.html] -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The documentation for the protocol used by this UPS: - link:http://www.mscs.dal.ca/~selinger/ups/belkin-universal-ups.html[belkin-universal-ups.html] - (link:https://networkupstools.org/protocols/belkin-universal.html[replica - on NUT site]) +AUTHOR +------ + +Peter Selinger diff --git a/docs/man/bestfcom.8 b/docs/man/bestfcom.8 index f83b2cb..9b7e4e5 100644 --- a/docs/man/bestfcom.8 +++ b/docs/man/bestfcom.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bestfcom .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BESTFCOM" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BESTFCOM" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,49 +40,13 @@ Best Power Fortress/Ferrups implementing the Fortress UPS Protocol (f\-command s This driver does not support any extra settings in the \fBups.conf\fR(5)\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Kent Polk (bestfcom) -.RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Andreas Wrede, John Stone (bestuferrups) -.RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Grant Taylor (bestfort) -.RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Russell Kroll (bestups) -.RE .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/bestfcom.txt b/docs/man/bestfcom.txt index 6700185..d742e8a 100644 --- a/docs/man/bestfcom.txt +++ b/docs/man/bestfcom.txt @@ -8,40 +8,38 @@ bestfcom - Driver for Best Power Fortress/Ferrups NOTE ---- - This man page only documents the hardware-specific features of the bestfcom driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - Best Power Fortress/Ferrups implementing the Fortress UPS Protocol (f-command set). EXTRA ARGUMENTS --------------- -This driver does not support any extra settings in the +This driver does not support any extra settings in the linkman:ups.conf[5]. AUTHORS ------- +Kent Polk (bestfcom) -* Kent Polk (bestfcom) -* Andreas Wrede, John Stone (bestuferrups) -* Grant Taylor (bestfort) -* Russell Kroll (bestups) +Andreas Wrede, John Stone (bestuferrups) + +Grant Taylor (bestfort) + +Russell Kroll (bestups) SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/bestfortress.8 b/docs/man/bestfortress.8 index d96dee0..f1fb8e7 100644 --- a/docs/man/bestfortress.8 +++ b/docs/man/bestfortress.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bestfortress -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BESTFORTRESS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BESTFORTRESS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -50,29 +50,9 @@ Set the full\-scale value of the \fBups\&.load\fR variable\&. .RE -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Holger Dietze -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Stuart D\&. Gathman -.RE +Holger Dietze , Stuart D\&. Gathman .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/bestfortress.txt b/docs/man/bestfortress.txt index aac0b8b..8bc969a 100644 --- a/docs/man/bestfortress.txt +++ b/docs/man/bestfortress.txt @@ -15,12 +15,10 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports old Best Fortress UPS equipment using a serial connection. EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in the linkman:ups.conf[5]: @@ -30,26 +28,22 @@ Set the speed of the serial connection - 1200, 2400, 4800 or 9600. *max_load*='VA':: Set the full-scale value of the *ups.load* variable. -AUTHORS -------- - -* Holger Dietze -* Stuart D. Gathman +AUTHOR +------ +Holger Dietze , +Stuart D. Gathman SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] The newer Best Power drivers: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - linkman:bestups[8], linkman:bestuferrups[8], linkman:bestfcom[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/bestuferrups.8 b/docs/man/bestuferrups.8 index 1fc7857..59b1d4e 100644 --- a/docs/man/bestuferrups.8 +++ b/docs/man/bestuferrups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bestuferrups .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BESTUFERRUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BESTUFERRUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,38 +40,11 @@ Best Power Micro\-Ferrups ME3100, probably other similar models too\&. This driver does not support any extra settings in the \fBups.conf\fR(5)\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Andreas Wrede, John Stone (bestuferrups) -.RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Grant Taylor (bestfort) -.RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} Russell Kroll (bestups) -.RE .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/bestuferrups.txt b/docs/man/bestuferrups.txt index cfe857d..49f4645 100644 --- a/docs/man/bestuferrups.txt +++ b/docs/man/bestuferrups.txt @@ -8,38 +8,35 @@ bestuferrups - Driver for Best Power Micro-Ferrups NOTE ---- - This man page only documents the hardware-specific features of the bestuferrups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - Best Power Micro-Ferrups ME3100, probably other similar models too. EXTRA ARGUMENTS --------------- -This driver does not support any extra settings in the +This driver does not support any extra settings in the linkman:ups.conf[5]. AUTHORS ------- +Andreas Wrede, John Stone (bestuferrups) -* Andreas Wrede, John Stone (bestuferrups) -* Grant Taylor (bestfort) -* Russell Kroll (bestups) +Grant Taylor (bestfort) + +Russell Kroll (bestups) SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/bestups.8 b/docs/man/bestups.8 index 009477a..70e1313 100644 --- a/docs/man/bestups.8 +++ b/docs/man/bestups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: bestups -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "BESTUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BESTUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,11 +32,6 @@ bestups \- Driver for Best Power / SOLA (Phoenixtec protocol) UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the bestups driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "NOTE" -.sp -Please note that this driver is deprecated and will not receive new development\&. If it works for managing your devices \(em fine, but if you are running it to try setting up a new device, please consider the newer \fBnutdrv_qx\fR(8) instead, which should handle all \fIQ*\fR protocol variants for NUT\&. -.sp -Please do also report if your device works with this driver, but \fBnutdrv_qx\fR(8) would not actually support it with any subdriver! .SH "SUPPORTED HARDWARE" .sp \fBbestups\fR was designed to monitor Best Power UPS hardware like the Fortress, Fortress Telecom, Axxium Rackmount and Patriot Pro\&. It also recognizes and supports SOLA units such as the 325, 520 and 620\&. In addition, the Best 610 is supported using the \(oqID\(cq option\&. @@ -95,32 +90,12 @@ Example: a Best 610 1\&.5KVA unit would use the string "610,1500,120,120,10\&.0, .sp The battery charge percentage value (in battery\&.charge) is derived from the voltage data that the UPS returns, since the UPS doesn\(cqt return that value directly\&. On some hardware, the charge will remain at 100% for a long time and then drops quickly shortly before the battery runs out\&. You can confirm from the battery\&.voltage readings that this is a problem with the UPS and not this driver\&. .sp -Similarly, the float from the charger in some models forces the battery charge percentage back up to 100% immediately after the UPS goes back on\-line, so you can\(cqt tell when it is really recharged\&. +Similarly, the float from the charger in some models forces the battery charge percentage back up to 100% immedately after the UPS goes back on\-line, so you can\(cqt tell when it is really recharged\&. .sp Finally, some models give one value for the battery\(cqs nominal voltage and yet actually have a nominal voltage slightly below that\&. This leads to things such as the perpetual 98\&.7% charge on the author\(cqs Fortress 750, even when it\(cqs been charging for weeks\&. You can use nombattvolt= in \fBups.conf\fR(8) to fix this\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Russell Kroll -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Jason White -.RE +Russell Kroll, Jason White .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/bestups.txt b/docs/man/bestups.txt index f2904bf..61704f6 100644 --- a/docs/man/bestups.txt +++ b/docs/man/bestups.txt @@ -10,28 +10,14 @@ NOTE ---- This man page only documents the hardware-specific features of the -bestups driver. For information about the core driver, see +bestups driver. For information about the core driver, see linkman:nutupsdrv[8]. -NOTE ----- - -Please note that this driver is deprecated and will not receive -new development. If it works for managing your devices -- fine, -but if you are running it to try setting up a new device, please -consider the newer linkman:nutdrv_qx[8] instead, which should -handle all 'Q*' protocol variants for NUT. - -Please do also report if your device works with this driver, -but linkman:nutdrv_qx[8] would not actually support it with any -subdriver! - SUPPORTED HARDWARE ------------------ - *bestups* was designed to monitor Best Power UPS hardware like the Fortress, Fortress Telecom, Axxium Rackmount and Patriot Pro. It also recognizes -and supports SOLA units such as the 325, 520 and 620. In addition, the +and supports SOLA units such as the 325, 520 and 620. In addition, the Best 610 is supported using the `ID' option. Other UPS hardware using the Phoenixtec protocol should also work, but @@ -68,31 +54,31 @@ case you can set `battvoltmult = 12` in linkman:ups.conf[8] to fix this. *ID=*'string':: Set the Identification response string. This should only be used -with hardware that supports the Phoenixtec protocol status inquiry -commands, but not the "ID" command, such as the Best/SOLA 610. Format +with hardware that supports the Phoenixtec protocol status inquiry +commands, but not the "ID" command, such as the Best/SOLA 610. Format of the ID string is: AAA,BBBB,CCC,DDD,EE.E,FF.F + AAA is the three-character identification for the UPS model. + -BBBB is the output power in VA (volt amperes). B is an integer number +BBBB is the output power in VA (volt amperes). B is an integer number ranging from 0 to 9. + -CCC is the Nominal Input Voltage. C is an integer number ranging from 0 +CCC is the Nominal Input Voltage. C is an integer number ranging from 0 to 9. The unit is Volts AC. + -DDD is the Nominal Output Voltage. D is an integer number ranging from 0 +DDD is the Nominal Output Voltage. D is an integer number ranging from 0 to 9. The unit is Volts AC. + -EE.E is the Battery Voltage that will cause the UPS to shut itself off. -E is an integer number ranging from 0 to 9. Then unit is Volts DC and a +EE.E is the Battery Voltage that will cause the UPS to shut itself off. +E is an integer number ranging from 0 to 9. Then unit is Volts DC and a decimal point is present. + -FF.F or FFF.F is the Battery Voltage at full charge. F is an integer -number ranging from 0 to 9. Then unit is Volts DC. Typically, for 700VA, -1KVA and 1.5KVA units, the format is FF.F. For 2KVA and 3KVA units, the +FF.F or FFF.F is the Battery Voltage at full charge. F is an integer +number ranging from 0 to 9. Then unit is Volts DC. Typically, for 700VA, +1KVA and 1.5KVA units, the format is FF.F. For 2KVA and 3KVA units, the format is FFF.F. + -Example: a Best 610 1.5KVA unit would use the string +Example: a Best 610 1.5KVA unit would use the string "610,1500,120,120,10.0,48.0". BUGS @@ -103,33 +89,29 @@ the voltage data that the UPS returns, since the UPS doesn't return that value directly. On some hardware, the charge will remain at 100% for a long time and then drops quickly shortly before the battery runs out. You can confirm from the `battery.voltage` readings that this is a problem -with the UPS and not this driver. +with the UPS and not this driver. Similarly, the float from the charger in some models forces the battery -charge percentage back up to 100% immediately after the UPS goes back +charge percentage back up to 100% immedately after the UPS goes back on-line, so you can't tell when it is really recharged. Finally, some models give one value for the battery's nominal voltage and yet actually have a nominal voltage slightly below that. This leads to things such as the perpetual 98.7% charge on the author's Fortress 750, -even when it's been charging for weeks. You can use `nombattvolt=` in +even when it's been charging for weeks. You can use `nombattvolt=` in linkman:ups.conf[8] to fix this. -AUTHORS -------- - -* Russell Kroll -* Jason White +AUTHOR +------ +Russell Kroll, Jason White SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/blazer-common.txt b/docs/man/blazer-common.txt index dc53dc8..7449624 100644 --- a/docs/man/blazer-common.txt +++ b/docs/man/blazer-common.txt @@ -1,22 +1,9 @@ NOTE ---- - This man page only documents the hardware-specific features of the blazer driver. For information about the core driver, see linkman:nutupsdrv[8]. -NOTE ----- - -Please note that this driver is deprecated and will not receive -new development. If it works for managing your devices -- fine, -but if you are running it to try setting up a new device, please -consider the newer linkman:nutdrv_qx[8] instead, which should -handle all 'Q*' protocol variants for NUT. - -Please do also report if your device works with this driver, -but linkman:nutdrv_qx[8] would not actually support it with any -subdriver! SUPPORTED HARDWARE ------------------ @@ -157,18 +144,10 @@ Examples: *bus =* 'regex':: -Select a UPS on a specific USB bus or group of buses. The argument is +Select a UPS on a specific USB bus or group of busses. The argument is a regular expression that must match the bus name where the UPS is connected (e.g. bus="002", bus="00[2-3]"). -*device =* 'regex':: - -Select a UPS on a specific USB device or group of devices. The argument is -a regular expression that must match the device name where the UPS is -connected (e.g. device="001", device="00[1-2]"). -Note that device numbers are not guaranteed by the OS to be stable across -re-boots or device re-plugging. - *subdriver =* 'string':: Select a serial-over-USB subdriver to use. You have a choice between *phoenix*, @@ -317,8 +296,8 @@ The temperature and load value is known to be bogus in some models. AUTHORS ------- -* Arjen de Korte -* Alexander Gordeev +Arjen de Korte , +Alexander Gordeev SEE ALSO @@ -336,5 +315,7 @@ linkman:nutupsdrv[8], linkman:upsc[8], linkman:upscmd[8], linkman:upsrw[8] Internet Resources: ~~~~~~~~~~~~~~~~~~~ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT HCL: http://www.networkupstools.org/stable-hcl.html +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ + +The NUT HCL: http://www.networkupstools.org/stable-hcl.html + diff --git a/docs/man/blazer_ser.8 b/docs/man/blazer_ser.8 index dafaaa4..c867e7d 100644 --- a/docs/man/blazer_ser.8 +++ b/docs/man/blazer_ser.8 @@ -1,13 +1,13 @@ '\" t .\" Title: blazer_ser .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/17/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "BLAZER_SER" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BLAZER_SER" "8" "11/17/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,11 +32,6 @@ blazer_ser \- Driver for Megatec/Q1 protocol serial based UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the blazer driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "NOTE" -.sp -Please note that this driver is deprecated and will not receive new development\&. If it works for managing your devices \(em fine, but if you are running it to try setting up a new device, please consider the newer \fBnutdrv_qx\fR(8) instead, which should handle all \fIQ*\fR protocol variants for NUT\&. -.sp -Please do also report if your device works with this driver, but \fBnutdrv_qx\fR(8) would not actually support it with any subdriver! .SH "SUPPORTED HARDWARE" .sp The blazer driver is known to work with various UPSes from Blazer, Energy Sistem, Fenton Technologies, General Electric, Mustek and many others\&. The NUT compatibility table lists all the known supported models\&. Keep in mind, however, that other models not listed there may also be supported, but haven\(cqt been tested\&. @@ -265,52 +260,12 @@ Some models report a bogus value for the beeper status (will always be \fIenable The temperature and load value is known to be bogus in some models\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arjen de Korte -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Alexander Gordeev -.RE +Arjen de Korte , Alexander Gordeev .SH "SEE ALSO" .sp \fBblazer_usb\fR(8), \fBnutupsdrv\fR(8), \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8) .SS "Internet Resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT HCL: -http://www\&.networkupstools\&.org/stable\-hcl\&.html -.RE +The NUT HCL: http://www\&.networkupstools\&.org/stable\-hcl\&.html diff --git a/docs/man/blazer_usb.8 b/docs/man/blazer_usb.8 index 262eb78..b44a4ec 100644 --- a/docs/man/blazer_usb.8 +++ b/docs/man/blazer_usb.8 @@ -1,13 +1,13 @@ '\" t .\" Title: blazer_usb .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "BLAZER_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "BLAZER_USB" "8" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,11 +32,6 @@ blazer_usb \- Driver for Megatec/Q1 protocol USB based UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the blazer driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "NOTE" -.sp -Please note that this driver is deprecated and will not receive new development\&. If it works for managing your devices \(em fine, but if you are running it to try setting up a new device, please consider the newer \fBnutdrv_qx\fR(8) instead, which should handle all \fIQ*\fR protocol variants for NUT\&. -.sp -Please do also report if your device works with this driver, but \fBnutdrv_qx\fR(8) would not actually support it with any subdriver! .SH "SUPPORTED HARDWARE" .sp The blazer driver is known to work with various UPSes from Blazer, Energy Sistem, Fenton Technologies, General Electric, Mustek and many others\&. The NUT compatibility table lists all the known supported models\&. Keep in mind, however, that other models not listed there may also be supported, but haven\(cqt been tested\&. @@ -159,6 +154,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendor="Foo\&.Corporation\&.*" .RE .sp @@ -170,6 +166,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendorid=051d* (APC) .RE @@ -182,18 +179,14 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x product="\&.*(Smart|Back)\-?UPS\&.*" .RE .RE .PP \fBbus =\fR \fIregex\fR .RS 4 -Select a UPS on a specific USB bus or group of buses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. bus="002", bus="00[2\-3]")\&. -.RE -.PP -\fBdevice =\fR \fIregex\fR -.RS 4 -Select a UPS on a specific USB device or group of devices\&. The argument is a regular expression that must match the device name where the UPS is connected (e\&.g\&. device="001", device="00[1\-2]")\&. Note that device numbers are not guaranteed by the OS to be stable across re\-boots or device re\-plugging\&. +Select a UPS on a specific USB bus or group of busses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. bus="002", bus="00[2\-3]")\&. .RE .PP \fBsubdriver =\fR \fIstring\fR @@ -333,52 +326,12 @@ Some models report a bogus value for the beeper status (will always be \fIenable The temperature and load value is known to be bogus in some models\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arjen de Korte -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Alexander Gordeev -.RE +Arjen de Korte , Alexander Gordeev .SH "SEE ALSO" .sp \fBblazer_ser\fR(8), \fBnutupsdrv\fR(8), \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8) .SS "Internet Resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT HCL: -http://www\&.networkupstools\&.org/stable\-hcl\&.html -.RE +The NUT HCL: http://www\&.networkupstools\&.org/stable\-hcl\&.html diff --git a/docs/man/clone.8 b/docs/man/clone.8 index 0519d89..8f3889f 100644 --- a/docs/man/clone.8 +++ b/docs/man/clone.8 @@ -1,13 +1,13 @@ '\" t .\" Title: clone .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "CLONE" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "CLONE" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -71,7 +71,7 @@ Set the timer (in seconds) before the outlet is turned off after the shutdown co .PP \fBondelay\fR=\fInum\fR .RS 4 -Set the timer (in seconds) for the outlet to switch on in case the power returns after the outlet has been switched off\&. Defaults to 30 seconds\&. +Set the timer (in seconds) for the outlet to switch on in case the power returns after the oulet has been switched off\&. Defaults to 30 seconds\&. .RE .PP \fBmincharge\fR=\fIvalue\fR @@ -91,44 +91,45 @@ The port specification in the \fBups.conf\fR(5) reference the driver socket that .RS 4 .\} .nf - [realups] - driver = usbhid\-ups - port = auto - - [clone\-outlet\-1] - driver = clone - port = usbhid\-ups\-realups - load\&.on = outlet\&.1\&.load\&.on - load\&.off = outlet\&.1\&.load\&.off - load\&.status = outlet\&.1\&.status - [\&.\&.\&.] +[realups] + driver = usbhid\-ups + port = auto +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +[clone\-outlet\-1] + driver = clone + port = usbhid\-ups\-realups + load\&.on = outlet\&.1\&.load\&.on + load\&.off = outlet\&.1\&.load\&.off + load\&.status = outlet\&.1\&.status + [\&.\&.\&.] .fi .if n \{\ .RE .\} .SH "IMPORTANT" .sp -Unlike a real UPS, you should \fBnot\fR configure a upsmon primary mode for this driver\&. When a upsmon primary sees the OB LB flags and tells the upsd server it is OK to initiate the shutdown sequence, the server will latch the FSD status and it will not be possible to restart the systems connected without restarting the upsd server\&. +Unlike a real UPS, you should \fBnot\fR configure a upsmon master for this driver\&. When a upsmon master sees the OB LB flags and tells the upsd server it is OK to initiate the shutdown sequence, the server will latch the FSD status and it will not be possible to restart the systems connected without restarting the upsd server\&. .sp -This will be a problem if the power returns after the clone UPS initiated the shutdown sequence on it\(cqs outlet, but returns before the real UPS begins shutting down\&. The solution is in the clone driver, that will insert the FSD flag if needed without the help of a upsmon primary\&. +This will be a problem if the power returns after the clone UPS initiated the shutdown sequence on it\(cqs outlet, but returns before the real UPS begins shutting down\&. The solution is in the clone driver, that will insert the FSD flag if needed without the help of a upsmon master\&. .SH "CAVEATS" .sp The clone UPS will follow the status on the real UPS driver\&. You can only make the clone UPS shutdown earlier than the real UPS driver, not later\&. If the real UPS driver initiates a shutdown, the clone UPS driver will immediately follow\&. .sp Be aware that the commands to shutdown/restart an outlet on the real UPS drivers are not affected, so if you tell the real UPS driver to shutdown the outlet of the clone UPS driver, your clients will lose power without warning\&. -.sp -If you use service management frameworks like systemd or SMF to manage the dependencies between driver instances and other units, then you may have to set up special dependencies (e\&.g\&. with systemd "drop\-in" snippet files) to queue your clone drivers to start after the "real" device drivers\&. .SH "AUTHOR" .sp Arjen de Korte .SH "SEE ALSO" .sp \fBupscmd\fR(1), \fBupsrw\fR(1), \fBups.conf\fR(5), \fBnutupsdrv\fR(8) -.SS "Dummy driver:" -.sp -The "repeater" mode of \fIdummy\-ups\fR driver is in some ways similar to the \fIclone\fR driver, by relaying information from a locally or remotely running "real" device driver (and NUT data server)\&. -.sp -\fBdummy-ups\fR(8) .SS "Internet Resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/clone.txt b/docs/man/clone.txt index 555e5c7..6a844ac 100644 --- a/docs/man/clone.txt +++ b/docs/man/clone.txt @@ -3,26 +3,22 @@ CLONE(8) NAME ---- - clone - UPS driver clone NOTE ---- - This man page only documents the specific features of the clone driver. For information about the core driver, see linkman:nutupsdrv[8]. DESCRIPTION ----------- - This driver, which sits on top of another driver socket, allows users to group clients to a particular outlet of a device and deal with this output as if it was a normal UPS. EXTRA ARGUMENTS --------------- - This driver supports the following settings: *load.off*='command':: @@ -50,7 +46,7 @@ was issued. Defaults to 120 seconds. *ondelay*='num':: Set the timer (in seconds) for the outlet to switch on in case the power -returns after the outlet has been switched off. Defaults to 30 seconds. +returns after the oulet has been switched off. Defaults to 30 seconds. *mincharge*='value':: Set the remaining battery level when the clone UPS switches to LB @@ -62,11 +58,9 @@ Set the remaining battery runtime when the clone UPS switches to LB IMPLEMENTATION -------------- - The port specification in the linkman:ups.conf[5] reference the driver socket that the "real" UPS driver is using. For example: ------- [realups] driver = usbhid-ups port = auto @@ -78,13 +72,11 @@ socket that the "real" UPS driver is using. For example: load.off = outlet.1.load.off load.status = outlet.1.status [...] ------- IMPORTANT --------- - -Unlike a real UPS, you should *not* configure a upsmon primary mode for this -driver. When a upsmon primary sees the OB LB flags and tells the upsd server +Unlike a real UPS, you should *not* configure a upsmon master for this +driver. When a upsmon master sees the OB LB flags and tells the upsd server it is OK to initiate the shutdown sequence, the server will latch the FSD status and it will not be possible to restart the systems connected without restarting the upsd server. @@ -92,11 +84,10 @@ restarting the upsd server. This will be a problem if the power returns after the clone UPS initiated the shutdown sequence on it's outlet, but returns before the real UPS begins shutting down. The solution is in the clone driver, that will insert the -FSD flag if needed without the help of a upsmon primary. +FSD flag if needed without the help of a upsmon master. CAVEATS ------- - The clone UPS will follow the status on the real UPS driver. You can only make the clone UPS shutdown earlier than the real UPS driver, not later. If the real UPS driver initiates a shutdown, the clone UPS driver will @@ -107,19 +98,8 @@ drivers are not affected, so if you tell the real UPS driver to shutdown the outlet of the clone UPS driver, your clients will lose power without warning. -If you use service management frameworks like systemd or SMF to manage the -dependencies between driver instances and other units, then you may have -to set up special dependencies (e.g. with systemd "drop-in" snippet files) -to queue your `clone` drivers to start after the "real" device drivers. - -////////////////////////////////////// -TODO later: declare the driver as "optional", see -https://github.com/networkupstools/nut/issues/1389 -////////////////////////////////////// - AUTHOR ------ - Arjen de Korte SEE ALSO @@ -130,16 +110,6 @@ linkman:upsrw[1], linkman:ups.conf[5], linkman:nutupsdrv[8] -Dummy driver: -~~~~~~~~~~~~~ - -The "repeater" mode of 'dummy-ups' driver is in some ways similar to the -'clone' driver, by relaying information from a locally or remotely running -"real" device driver (and NUT data server). - -linkman:dummy-ups[8] - Internet Resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/dummy-ups.8 b/docs/man/dummy-ups.8 index 3a39b67..6af7deb 100644 --- a/docs/man/dummy-ups.8 +++ b/docs/man/dummy-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: dummy-ups .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "DUMMY\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "DUMMY\-UPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,110 +31,22 @@ dummy-ups \- Driver for multi\-purpose UPS emulation .SH "NOTE" .sp -This man page only documents the specific features of the \fBdummy\-ups\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. +This man page only documents the specific features of the dummy\-ups driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "DESCRIPTION" .sp -This program is a multi\-purpose UPS emulation tool\&. Its general behavior depends on the running mode: "dummy" ("dummy\-once" or "dummy\-loop"), or "repeater"\&. +This program is a multi\-purpose UPS emulation tool\&. Its behavior depends on the running mode: .SS "Dummy Mode" .sp -In this mode, \fBdummy\-ups\fR looks like a standard NUT device driver to \fBupsd\fR(8) and allows one to change any value for testing purposes\&. It is both interactive, controllable through the \fBupsrw\fR(1) and \fBupscmd\fR(1) commands (or equivalent graphical tool), and batchable through script files\&. It can be configured, launched and used as any other "real" NUT driver\&. This mode is mostly useful for development and testing purposes\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -See below about the differences of dummy\-once vs\&. dummy\-loop modes \(em the former may be more suitable for "interactive" uses and tests\&. -.sp .5v -.RE +\fBdummy\-ups\fR looks like a standard device driver to \fBupsd\fR(8) and allows one to change any value for testing purposes\&. It is both interactive, controllable through the \fBupsrw\fR(1) and \fBupscmd\fR(1) commands (or equivalent graphical tool), and batchable through script files\&. It can be configured, launched and used as any other real driver\&. This mode is mostly useful for development and testing purposes\&. .SS "Repeater Mode" .sp -In this mode, \fBdummy\-ups\fR acts as a NUT client, simply forwarding data\&. This can be useful for supervision purposes\&. This mode can also allow some load sharing between several upsd instances communicating with ultimate NUT clients, with a "central" one using a point\-to\-point communication with the UPS\&. This arrangement can also help with networked UPSes, whose network management cards can be overwhelmed with a farm of servers directly polling SNMP or other protocols every few seconds\&. +\fBdummy\-ups\fR acts as a NUT client, simply forwarding data\&. This can be useful for supervision purposes\&. This can also allow some load sharing between several UPS instances, using a point\-to\-point communication with the UPS\&. .SH "IMPLEMENTATION" .sp -The port specification in ups\&.conf depends on the running mode, and allows the driver to select the right mode of operation\&. -.sp -Since NUT v2\&.8\&.0, the mode specification in ups\&.conf allows users to override the mode of operation which would be otherwise guessed by the driver\&. +The port specification depends on the running mode, and allows the driver to select the right mode\&. .SS "Dummy Mode" .sp -In this context, port in the ups\&.conf block defines a file name for the \fBdummy\-ups\fR to read data from\&. This can either be an absolute or a relative path name\&. In the latter case the NUT sysconfig directory (i\&.e\&. /etc/nut, /usr/local/ups/etc, \&...) is prepended\&. -.sp -Since NUT v2\&.8\&.0 two aspects of this mode are differentiated: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -dummy\-once -reads the specified file once to the end (interrupting for -TIMER -lines, etc\&.) and does not re\-process it until the filesystem timestamp of the data file is changed; this reduces run\-time stress if you test with a lot of dummy devices, and allows use/test cases to -upsrw -variables into the driver instance \(em and they remain in memory until the driver is restarted (or the file is touched or modified); -.sp -Since NUT v2\&.8\&.0 -dummy\-once -is assigned by default to files with a -*\&.dev -naming pattern\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -dummy\-loop -reads the specified file again and again, with a short sleep between the processing cycles; for sequence files using a -TIMER -keyword (see below), or for use/test cases which modify file contents with external means, this allows an impression of a device whose state changes over time\&. -.sp -Before NUT v2\&.8\&.0 this was the only aspect, so a simple -dummy -mode value maps to this behavior for backwards compatibility\&. -.sp -Since NUT v2\&.8\&.0 -dummy\-loop -is assigned by default to files with a -*\&.seq -naming pattern, and -dummy -is assigned by default to files with other naming patterns that the driver could not classify\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Said defaulting based on filename pattern can break third\-party test scripts which earlier expected *\&.dev files to work as a looping sequence with a TIMER keywords to change values slowly\&. Now such files should get processed to the end once\&. -.sp -Specify mode=dummy\-loop driver option or rename the data file used in the port option for legacy behavior\&. -.sp -Use/Test\-cases which modified such files content externally should not be impacted\&. -.sp .5v -.RE +Port is a definition file name for \fBdummy\-ups\fR\&. This can either be an absolute or a relative path name\&. In the latter case the NUT sysconfig directory (ie /etc/nut, /usr/local/ups/etc, \&...) is prepended\&. .sp For instance: .sp @@ -142,55 +54,22 @@ For instance: .RS 4 .\} .nf -[dummy1] +[dummy] driver = dummy\-ups - port = evolution500\&.seq - desc = "dummy\-ups in dummy\-loop mode" + port = evolution500\&.dev + desc = "dummy\-ups in dummy mode" .fi .if n \{\ .RE .\} .sp -.if n \{\ -.RS 4 -.\} -.nf -[dummy2] - driver = dummy\-ups - port = epdu\-managed\&.dev - desc = "dummy\-ups in dummy\-once mode" -.fi -.if n \{\ -.RE -.\} +This file is generally named "something\&.dev"\&. It contains a list of all valid data and associated values, and has the same format as an \fBupsc\fR(8) dump (: )\&. So you can easily create definition files from an existing UPS using "upsc > file\&.dev"\&. It can also be empty, in which case only a basic set of data is available: device\&.\fB, driver\&.\fR, ups\&.mfr, ups\&.model, ups\&.status .sp -This file is generally named something\&.dev or something\&.seq\&. It contains a list of all valid variables and associated values (you can later use upsrw only to modify values of these variables), and has the same format as an \fBupsc\fR(8) dump (: )\&. So you can easily create definition files from an existing UPS using upsc > file\&.dev\&. +Samples definition files are available in the "data" directory of the nut source tree, and generally in the sysconfig directory of your system distribution\&. .sp -Note that the Network UPS project provides an extensive DDL (Devices Dumps Library) with files which can be used for modelling real devices\&. Entries for the DDL library are best prepared with the tools/nut\-ddl\-dump\&.sh script from NUT sources instead of plain upsc, to provide some additional data points from other NUT clients as well\&. +Since \fBdummy\-ups\fR will loop on reading this file, you can dynamically modify it to interact with the driver\&. This will avoid message spam into your system log files, if you are using NUT default configuration\&. .sp -The file can also be empty, in which case only a basic set of data is available: device\&.*, driver\&.*, ups\&.mfr, ups\&.model, ups\&.status as filled by the driver itself\&. -.sp -Some sample definition files are available in the data directory of the NUT source tree, and generally in the sysconfig or share directory of your system distribution\&. -.sp -Since \fBdummy\-ups\fR will usually loop on reading this file, you can dynamically modify it with some external process to "interact" with the driver\&. This will avoid message spam into your system log files, if you are using NUT default configuration\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -By default since NUT v2\&.8\&.0, it will not loop on files in dummy\-once mode, e\&.g\&. those with a \&.dev extension, unless their timestamp changes\&. -.sp .5v -.RE -.sp -You can also use the TIMER instruction to create scheduled event sequences (such files are traditionally named with the \&.seq extension)\&. For example, the following sequence will loop on switching ups\&.status between "OL", "OB" and "OB LB" every minute: +You can also use the "TIMER " instruction to create scheduled events sequences\&. For example, the following sequence will loop on switching ups\&.status between "OL", "OB" and "OB LB" every minute: .sp .if n \{\ .RS 4 @@ -200,25 +79,23 @@ ups\&.status: OL TIMER 60 ups\&.status: OB TIMER 60 -ups\&.status: OB LB +ups\&.status: LB TIMER 60 .fi .if n \{\ .RE .\} .sp -It is wise to end the script for dummy\-loop mode with a TIMER keyword\&. Otherwise dummy\-ups will directly go back to the beginning of the file and, in particular, forget any values you could have just set with upsrw\&. -.sp -Note that to avoid CPU overload with an infinite loop, the driver "sleeps" a bit between file\-reading cycles (currently this delay is hardcoded to one second), independently of (and/or in addition to) any TIMER keywords\&. +It is wise to end the script with a TIMER\&. Otherwise dummy\-ups will directly go back to the beginning of the file\&. .SS "Repeater Mode" .sp -In this context, port in the ups\&.conf block is the name of a remote UPS, using the NUT format, i\&.e\&.: +Port is the name of a remote UPS, using the NUT form, ie: .sp .if n \{\ .RS 4 .\} .nf -@[:] +[@[:]] .fi .if n \{\ .RE @@ -231,52 +108,38 @@ For instance: .\} .nf [repeater] - driver = dummy\-ups - port = ups1@remotehost - desc = "dummy\-ups in repeater mode" + driver = dummy\-ups + port = ups@hostname + desc = "dummy\-ups in repeater mode" .fi .if n \{\ .RE .\} -.sp -Unlike UPS specifications in the rest of NUT, the @hostname portion is not optional \- it is the @ character which enables Repeater Mode\&. To refer to an UPS on the same host as \fBdummy\-ups\fR, use port = upsname@localhost\&. -.sp -Note that to avoid CPU overload with an infinite loop, the driver "sleeps" a bit between data\-requesting cycles (currently this delay is hardcoded to one second), so propagation of data updates available to a remote upsd may lag by this much\&. .SH "INTERACTION" .sp Once the driver is loaded in dummy mode, you can change any variables, except those of the driver\&.* and server\&.* collections\&. You can do this by either editing the definition file, or use the \fBupsrw\fR(1) and \fBupscmd\fR(1) commands\&. .sp -Note that in simulation mode, new variables can be added on the fly, but only by adding these to the definition file (and waiting for it to be re\-read)\&. That is, the driver should not allow to define a new variable via upsrw\&. +Note that in simulation mode, new variables can be added on the fly, by adding these to the definition file\&. Conversely, if you need to remove variable (such as transient ones, like ups\&.alarm), simply update these by setting an empty value\&. As a result, they will get removed from the data\&. .sp -Conversely, if you need to remove a variable (such as transient ones, like ups\&.alarm), simply update these by setting an empty value\&. As a result, they will get removed from the data\&. -.sp -In repeater mode, the driver acts according to the capabilities of the UPS, and so supports the same instant commands and settable values\&. +In repeater mode, the driver acts according to the capabilities of the UPS, and so support the same instant commands and settable values\&. .SH "BACKGROUND" .sp -Dummy Mode was originally written in one evening to replace the previous \fIdummycons\fR testing driver, which was too limited, and required a terminal for interaction\&. +This driver was written in one evening to replace the previous dummycons testing driver\&. It was too limited and required to work from a terminal to interact\&. .sp -\fBdummy\-ups\fR is useful for NUT client development, and other testing purposes\&. +\fBdummy\-ups\fR is useful for NUT client development, and other testing purpose\&. .sp It also helps the NUT Quality Assurance effort, by automating some tests on the NUT framework\&. .sp -It now offers a repeater mode\&. This will help in building the Meta UPS approach, which allows one to build a virtual device, composed of several other devices (either UPS, PDUs), or perhaps represent the same device which supports several communication protocols and different media (Serial, USB, SNMP\&...) +It now offers a repeater mode\&. This will help in building the Meta UPS approach, which allows one to build a virtual device, composed of several other devices (either UPS, PDUs)\&. .SH "BUGS" .sp Instant commands are not yet supported in Dummy Mode, and data need name/value checking enforcement, as well as boundaries or enumeration definition\&. -.SH "CAVEATS" -.sp -If you use service management frameworks like systemd or SMF to manage the dependencies between driver instances and the data server, and some of these drivers are dummy\-ups in repeater mode representing data from another driver running on the same system, then you may have to set up special dependencies (e\&.g\&. with systemd "drop\-in" snippet files) to allow your nut\-server to start after the "real" device drivers and before such repeater drivers (without a responding server, they would fail to start anyway)\&. This may also need special care in upsd\&.conf and/or ups\&.conf files to not block the system start\-up for too long while the repeater driver has not started\&. .SH "AUTHOR" .sp Arnaud Quette .SH "SEE ALSO" .sp \fBupscmd\fR(1), \fBupsrw\fR(1), \fBups.conf\fR(5), \fBnutupsdrv\fR(8) -.SS "Clone driver:" -.sp -The "repeater" mode of \fIdummy\-ups\fR driver is in some ways similar to the \fIclone\fR driver, which sits on top of another driver socket, and allows users to group clients to a particular outlet of a device and deal with this output as if it were a normal UPS\&. -.sp -\fBclone\fR(8) .SS "Internet Resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/dummy-ups.txt b/docs/man/dummy-ups.txt index e3ed2f6..766d17e 100644 --- a/docs/man/dummy-ups.txt +++ b/docs/man/dummy-ups.txt @@ -3,262 +3,137 @@ DUMMY-UPS(8) NAME ---- - dummy-ups - Driver for multi-purpose UPS emulation NOTE ---- - This man page only documents the specific features of the -*dummy-ups* driver. For information about the core driver, see +dummy-ups driver. For information about the core driver, see linkman:nutupsdrv[8]. DESCRIPTION ----------- - This program is a multi-purpose UPS emulation tool. -Its general behavior depends on the running mode: "dummy" ("dummy-once" -or "dummy-loop"), or "repeater". -//////////////////////////////////////// -...or "meta" eventually. -//////////////////////////////////////// +Its behavior depends on the running mode: Dummy Mode ~~~~~~~~~~ -In this mode, *dummy-ups* looks like a standard NUT device driver to -linkman:upsd[8] and allows one to change any value for testing purposes. -It is both interactive, controllable through the linkman:upsrw[1] and -linkman:upscmd[1] commands (or equivalent graphical tool), and batchable -through script files. It can be configured, launched and used as any other -"real" NUT driver. This mode is mostly useful for development and testing -purposes. - -NOTE: See below about the differences of `dummy-once` vs. `dummy-loop` -modes -- the former may be more suitable for "interactive" uses and tests. +*dummy-ups* looks like a standard device driver to linkman:upsd[8] and +allows one to change any value for testing purposes. It is both interactive, +controllable through the linkman:upsrw[1] and linkman:upscmd[1] commands (or +equivalent graphical tool), and batchable through script files. It can be +configured, launched and used as any other real driver. This mode is mostly +useful for development and testing purposes. Repeater Mode ~~~~~~~~~~~~~ -In this mode, *dummy-ups* acts as a NUT client, simply forwarding data. -This can be useful for supervision purposes. This mode can also allow some -load sharing between several `upsd` instances communicating with ultimate -NUT clients, with a "central" one using a point-to-point communication with -the UPS. This arrangement can also help with networked UPSes, whose network -management cards can be overwhelmed with a farm of servers directly polling -SNMP or other protocols every few seconds. - -//////////////////////////////////////// -Future intention: Meta mode to aggregate several drivers as one device -e.g. to represent same UPS with Serial + USB + SNMP links, and/or cover -an SNMP UPS that supports different data in different MIBs. -//////////////////////////////////////// +*dummy-ups* acts as a NUT client, simply forwarding data. This can be useful +for supervision purposes. This can also allow some load sharing between several +UPS instances, using a point-to-point communication with the UPS. IMPLEMENTATION -------------- -The `port` specification in `ups.conf` depends on the running mode, and allows -the driver to select the right mode of operation. - -Since NUT v2.8.0, the `mode` specification in `ups.conf` allows users to -override the mode of operation which would be otherwise guessed by the driver. +The port specification depends on the running mode, and allows the driver to +select the right mode. Dummy Mode ~~~~~~~~~~ -In this context, `port` in the `ups.conf` block defines a file name for the -*dummy-ups* to read data from. This can either be an absolute or a relative -path name. In the latter case the NUT sysconfig directory (i.e. `/etc/nut`, -`/usr/local/ups/etc`, ...) is prepended. - -Since NUT v2.8.0 two aspects of this mode are differentiated: - -* `dummy-once` reads the specified file once to the end (interrupting for - `TIMER` lines, etc.) and does not re-process it until the filesystem - timestamp of the data file is changed; this reduces run-time stress if - you test with a lot of dummy devices, and allows use/test cases to - `upsrw` variables into the driver instance -- and they remain in memory - until the driver is restarted (or the file is touched or modified); -+ -Since NUT v2.8.0 `dummy-once` is assigned by default to files with a `*.dev` - naming pattern. - -* `dummy-loop` reads the specified file again and again, with a short sleep - between the processing cycles; for sequence files using a `TIMER` keyword - (see below), or for use/test cases which modify file contents with external - means, this allows an impression of a device whose state changes over time. -+ -Before NUT v2.8.0 this was the only aspect, so a simple `dummy` mode value - maps to this behavior for backwards compatibility. -+ -Since NUT v2.8.0 `dummy-loop` is assigned by default to files with a `*.seq` - naming pattern, and `dummy` is assigned by default to files with other - naming patterns that the driver could not classify. - -[NOTE] -====== -Said defaulting based on filename pattern can break third-party -test scripts which earlier expected `*.dev` files to work as a -looping sequence with a `TIMER` keywords to change values slowly. -Now such files should get processed to the end once. - -Specify `mode=dummy-loop` driver option or rename the data file -used in the `port` option for legacy behavior. - -Use/Test-cases which modified such files content externally should -not be impacted. -====== +Port is a definition file name for *dummy-ups*. This can either +be an absolute or a relative path name. In the latter case the NUT +sysconfig directory (ie /etc/nut, /usr/local/ups/etc, ...) is prepended. For instance: - [dummy1] + [dummy] driver = dummy-ups - port = evolution500.seq - desc = "dummy-ups in dummy-loop mode" + port = evolution500.dev + desc = "dummy-ups in dummy mode" - [dummy2] - driver = dummy-ups - port = epdu-managed.dev - desc = "dummy-ups in dummy-once mode" +This file is generally named "something.dev". It contains a list of all +valid data and associated values, and has the same format as an linkman:upsc[8] +dump (: ). So you can easily create definition +files from an existing UPS using "upsc > file.dev". +It can also be empty, in which case only a basic set of data is available: +device.*, driver.*, ups.mfr, ups.model, ups.status -This file is generally named `something.dev` or `something.seq`. It contains -a list of all valid variables and associated values (you can later use `upsrw` -only to modify values of these variables), and has the same format as an -linkman:upsc[8] dump (`: `). So you can easily create -definition files from an existing UPS using `upsc > file.dev`. +Samples definition files are available in the "data" directory of the nut source +tree, and generally in the sysconfig directory of your system distribution. -Note that the Network UPS project provides an extensive -link:https://networkupstools.org/ddl/index.html[DDL (Devices Dumps Library)] -with files which can be used for modelling real devices. -Entries for the DDL library are best prepared with the -link:https://raw.githubusercontent.com/networkupstools/nut/master/tools/nut-ddl-dump.sh[`tools/nut-ddl-dump.sh`] -script from NUT sources instead of plain `upsc`, to provide some additional -data points from other NUT clients as well. +Since *dummy-ups* will loop on reading this file, you can dynamically modify +it to interact with the driver. This will avoid message spam into your +system log files, if you are using NUT default configuration. -The file can also be empty, in which case only a basic set of data is -available: `device.*`, `driver.*`, `ups.mfr`, `ups.model`, `ups.status` -as filled by the driver itself. - -Some sample definition files are available in the `data` directory of the -NUT source tree, and generally in the sysconfig or share directory of your -system distribution. - -Since *dummy-ups* will usually loop on reading this file, you can dynamically -modify it with some external process to "interact" with the driver. -This will avoid message spam into your system log files, if you are -using NUT default configuration. - -NOTE: By default since NUT v2.8.0, it will not loop on files in `dummy-once` -mode, e.g. those with a `.dev` extension, unless their timestamp changes. - -You can also use the `TIMER ` instruction to create scheduled event -sequences (such files are traditionally named with the `.seq` extension). -For example, the following sequence will loop on switching `ups.status` +You can also use the "TIMER " instruction to create scheduled events +sequences. For example, the following sequence will loop on switching ups.status between "OL", "OB" and "OB LB" every minute: ups.status: OL TIMER 60 ups.status: OB TIMER 60 - ups.status: OB LB + ups.status: LB TIMER 60 -It is wise to end the script for `dummy-loop` mode with a `TIMER` keyword. -Otherwise `dummy-ups` will directly go back to the beginning of the file -and, in particular, forget any values you could have just set with `upsrw`. - -Note that to avoid CPU overload with an infinite loop, the driver "sleeps" -a bit between file-reading cycles (currently this delay is hardcoded to one -second), independently of (and/or in addition to) any `TIMER` keywords. +It is wise to end the script with a TIMER. Otherwise dummy-ups will directly +go back to the beginning of the file. Repeater Mode ~~~~~~~~~~~~~ -In this context, `port` in the `ups.conf` block is the name of a remote UPS, -using the NUT format, i.e.: +Port is the name of a remote UPS, using the NUT form, ie: - @[:] + [@[:]] For instance: - [repeater] + [repeater] driver = dummy-ups - port = ups1@remotehost + port = ups@hostname desc = "dummy-ups in repeater mode" -Unlike UPS specifications in the rest of NUT, the `@hostname` portion is not -optional - it is the `@` character which enables Repeater Mode. To refer to an -UPS on the same host as *dummy-ups*, use `port = upsname@localhost`. - -Note that to avoid CPU overload with an infinite loop, the driver "sleeps" a -bit between data-requesting cycles (currently this delay is hardcoded to one -second), so propagation of data updates available to a remote `upsd` may lag -by this much. - INTERACTION ----------- Once the driver is loaded in dummy mode, you can change any variables, except -those of the `driver.*` and `server.*` collections. +those of the driver.* and server.* collections. You can do this by either editing the definition file, or use the linkman:upsrw[1] and linkman:upscmd[1] commands. -Note that in simulation mode, new variables can be added on the fly, but only -by adding these to the definition file (and waiting for it to be re-read). -That is, the driver should not allow to define a new variable via `upsrw`. +Note that in simulation mode, new variables can be added on the fly, by +adding these to the definition file. Conversely, if you need to remove +variable (such as transient ones, like ups.alarm), simply update these +by setting an empty value. As a result, they will get removed from the data. -Conversely, if you need to remove a variable (such as transient ones, like -`ups.alarm`), simply update these by setting an empty value. As a result, -they will get removed from the data. - -In repeater mode, the driver acts according to the capabilities of the UPS, -and so supports the same instant commands and settable values. +In repeater mode, the driver acts according to the capabilities of the UPS, and +so support the same instant commands and settable values. BACKGROUND ---------- -Dummy Mode was originally written in one evening to replace the previous -'dummycons' testing driver, which was too limited, and required a terminal -for interaction. +This driver was written in one evening to replace the previous dummycons +testing driver. It was too limited and required to work from a terminal to +interact. -*dummy-ups* is useful for NUT client development, and other testing purposes. +*dummy-ups* is useful for NUT client development, and other testing purpose. -It also helps the NUT Quality Assurance effort, by automating some tests on -the NUT framework. +It also helps the NUT Quality Assurance effort, by automating some tests on the +NUT framework. It now offers a repeater mode. This will help in building the Meta UPS approach, which allows one to build a virtual device, composed of several other devices -(either UPS, PDUs), or perhaps represent the same device which supports -several communication protocols and different media (Serial, USB, SNMP...) +(either UPS, PDUs). BUGS ---- - Instant commands are not yet supported in Dummy Mode, and data need name/value checking enforcement, as well as boundaries or enumeration definition. -CAVEATS -------- - -If you use service management frameworks like systemd or SMF to manage -the dependencies between driver instances and the data server, and some -of these drivers are `dummy-ups` in repeater mode representing data -from another driver running on the same system, then you may have to -set up special dependencies (e.g. with systemd "drop-in" snippet files) -to allow your `nut-server` to start after the "real" device drivers and -before such repeater drivers (without a responding server, they would fail -to start anyway). This may also need special care in `upsd.conf` and/or -`ups.conf` files to not block the system start-up for too long while the -repeater driver has not started. - -////////////////////////////////////// -TODO later: declare the driver as "optional", see -https://github.com/networkupstools/nut/issues/1389 -////////////////////////////////////// - AUTHOR ------ - Arnaud Quette SEE ALSO @@ -269,17 +144,6 @@ linkman:upsrw[1], linkman:ups.conf[5], linkman:nutupsdrv[8] -Clone driver: -~~~~~~~~~~~~~ - -The "repeater" mode of 'dummy-ups' driver is in some ways similar to the -'clone' driver, which sits on top of another driver socket, and allows -users to group clients to a particular outlet of a device and deal with -this output as if it were a normal UPS. - -linkman:clone[8] - Internet Resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/etapro.8 b/docs/man/etapro.8 index e9c3c95..1cb6ca6 100644 --- a/docs/man/etapro.8 +++ b/docs/man/etapro.8 @@ -1,13 +1,13 @@ '\" t .\" Title: etapro .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "ETAPRO" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "ETAPRO" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/etapro.txt b/docs/man/etapro.txt index 86d9212..3b827e2 100644 --- a/docs/man/etapro.txt +++ b/docs/man/etapro.txt @@ -3,41 +3,33 @@ ETAPRO(8) NAME ---- - etapro - Driver for ETA UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the etapro driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports ETA UPS equipment with the "PRO" option for smart mode. EXTRA ARGUMENTS --------------- - This driver does not support any extra settings in the linkman:ups.conf[5]. AUTHOR ------ - Marek Michalkiewicz SEE ALSO -------- - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/everups.8 b/docs/man/everups.8 index 66df659..c95d57c 100644 --- a/docs/man/everups.8 +++ b/docs/man/everups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: everups .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "EVERUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "EVERUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/everups.txt b/docs/man/everups.txt index 7700982..cf01bc0 100644 --- a/docs/man/everups.txt +++ b/docs/man/everups.txt @@ -3,25 +3,22 @@ EVERUPS(8) NAME ---- - everups - Driver for Ever UPS models NOTE ---- - This man page only documents the hardware-specific features of the everups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver should recognize the NET *-DPC and AP *-PRO models. EXTRA ARGUMENTS --------------- -This driver does not support any extra settings in the +This driver does not support any extra settings in the linkman:ups.conf[5]. BUGS @@ -33,7 +30,6 @@ don't sleep and force a reboot. AUTHOR ------ - Bartek Szady SEE ALSO @@ -41,10 +37,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/gamatronic.8 b/docs/man/gamatronic.8 index 2fdb3a9..43a975a 100644 --- a/docs/man/gamatronic.8 +++ b/docs/man/gamatronic.8 @@ -1,13 +1,13 @@ '\" t .\" Title: gamatronic .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "GAMATRONIC" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "GAMATRONIC" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/gamatronic.txt b/docs/man/gamatronic.txt index 9512295..ac9db3f 100644 --- a/docs/man/gamatronic.txt +++ b/docs/man/gamatronic.txt @@ -3,19 +3,16 @@ GAMATRONIC(8) NAME ---- - gamatronic - Driver for Gamatronic UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the gamatronic driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - Various - Rebuilt to work with Gamatronic UPS Units, but should recognize any UPS that speaks the SEC protocol at 1200-19200 bps. @@ -27,7 +24,6 @@ linkman:ups.conf[5]. AUTHOR ------ - Nadav Moskovitch SEE ALSO @@ -35,10 +31,8 @@ SEE ALSO The core driver ~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/generic_modbus.8 b/docs/man/generic_modbus.8 deleted file mode 100644 index cc2fd34..0000000 --- a/docs/man/generic_modbus.8 +++ /dev/null @@ -1,355 +0,0 @@ -'\" t -.\" Title: generic_modbus -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "GENERIC_MODBUS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -generic_modbus \- Driver for contact (direct) signal UPS devices connected via modbus remote I/O gateways -.SH "SYNOPSIS" -.sp -\fBgeneric_modbus\fR \-h -.sp -\fBgeneric_modbus\fR \-a \fIDEVICE_NAME\fR [\fIOPTIONS\fR] -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This man page only documents the specific features of the \fBgeneric_modbus\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -This is a generic modbus driver expected to work with contact (direct) signal UPS devices, connected via modbus RIO (remote I/O) either serial or TCP/IP\&. -.sp -The driver has been tested against PULS UPS (model UB40\&.241) via MOXA ioLogikR1212 (RS485) and ioLogikE1212 (TCP/IP)\&. -.PP -More information about this UPS can be found here: -.RS 4 -https://products\&.pulspower\&.com/ca/ubc10\-241\-n1\&.html -.RE -.PP -More information about Moxa ioLogik R1212, E1212 can be found here: -.RS 4 -https://www\&.moxa\&.com/en/products/industrial\-edge\-connectivity/controllers\-and\-ios -.RE -.sp -The PULS UPS UB40\&.241 supports the following signals: -.sp -.if n \{\ -.RS 4 -.\} -.nf -Ready contact (DO) <\-\-> HB -Buffering contact (DO) <\-\-> OL | OB -Battery\-low (DO) <\-\-> LB -Replace Battery (DO) <\-\-> RB -Inhibit (DI) <\-\-> FSD -.fi -.if n \{\ -.RE -.\} -.sp -Digital port direction (DI/DO) assumes the device perspective -.sp -The driver\(cqs concept is to map the UPS states (as defined in NUT) onto UPS contacts\*(Aq states\&. The driver has an extended configuration interface implemented using variables defined in ups\&.conf\&. -.SH "HARDWARE INTERCONNECTION" -.sp -The commission of modbus remote I/O server as well as UPS device is carried out following the corresponding instruction manuals\&. The following figure depicts the anticipated communication path and hardware interconnection: -.sp -.if n \{\ -.RS 4 -.\} -.nf -+\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-+ -| UPSD | <\-\-\-> | GENERIC_MODBUS | <\-\-\-> | MODBUS RIO | <\-\-\-> | UPS DEVICE | -+\-\-\-\-\-\-+ (1) +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ (2) +\-\-\-\-\-\-\-\-\-\-\-\-+ (3) +\-\-\-\-\-\-\-\-\-\-\-\-+ - | | - +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ - HOST CONTROLLER - -(1) Unix IPC -(2) RS232 | TCP/IP -(3) contacts -.fi -.if n \{\ -.RE -.\} -.SH "EXTRA ARGUMENTS" -.sp -This driver supports the following optional settings in the \fBups.conf\fR(5) file: -.SS "Generic:" -.PP -\fBdevice_mfr\fR=\fIvalue\fR -.RS 4 -A string specifying the manufacturer of the UPS device (default UNKNOWN)\&. -.RE -.PP -\fBdevice_model\fR=\fIvalue\fR -.RS 4 -A string specifying the model of the UPS device (default UNKNOWN)\&. -.RE -.SS "Serial:" -.PP -\fBser_baud_rate\fR=\fIvalue\fR -.RS 4 -A integer specifying the serial port baud rate (default 9600)\&. -.RE -.PP -\fBser_data_bit\fR=\fIvalue\fR -.RS 4 -A integer specifying the serial port data bit (default 8)\&. -.RE -.PP -\fBser_parity\fR=\fIvalue\fR -.RS 4 -A character specifying the serial port parity (default N)\&. -.RE -.PP -\fBser_stop_bit\fR=\fIvalue\fR -.RS 4 -An integer specifying the serial port stop bit (default 1)\&. -.RE -.SS "Modbus:" -.PP -\fBrio_slave_id\fR=\fIvalue\fR -.RS 4 -An integer specifying the RIO modbus slave ID (default 1)\&. -.RE -.SS "States (X = OL, OB, LB, HB, RB, CHRG, DISCHRG, FSD)" -.PP -\fB_addr\fR=\fIvalue\fR -.RS 4 -A number specifying the modbus address for the X state\&. -.RE -.PP -\fB_regtype\fR=\fIvalue\fR -.RS 4 -A number specifying the modbus register type for the X state -.RE -.PP -Default values: -.RS 4 -.sp -.if n \{\ -.RS 4 -.\} -.nf -1 for X = OL, OB, LB ,HB, RB, CHRG, DISCHRG -0 for X = FSD -.fi -.if n \{\ -.RE -.\} -.RE -.PP -Valid values: -.RS 4 -.sp -.if n \{\ -.RS 4 -.\} -.nf -0:COIL, 1:INPUT_B, 2:INPUT_R, 3:HOLDING -.fi -.if n \{\ -.RE -.\} -.RE -.PP -\fB_noro\fR=\fIvalue\fR -.RS 4 -A number specifying the contact configuration for the X state (default 1)\&. -.RE -.PP -Valid values: -.RS 4 -.sp -.if n \{\ -.RS 4 -.\} -.nf -0:NC, 1:NO -.fi -.if n \{\ -.RE -.\} -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -NO stands for normally open and NC for normally closed contact -.sp .5v -.RE -.RE -.SS "Shutdown" -.PP -\fBFSD_pulse_duration\fR=\fIvalue\fR -.RS 4 -A number specifying the duration in ms for the inhibit pulse\&. If it\(cqs not defined, signal has only one transition depending on FSD_noro configuration\&. -.sp -Examples for FSD signal configuration: -.RE -.sp -.if n \{\ -.RS 4 -.\} -.nf -FSD_noro = 1 -FSD_pulse_duration = 150 - - +\-\-\-\-\-+ - | | -inhibit pulse >\-\-\-\-\-+ +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> - <\-\-\-> - 150ms - - -FSD_noro = 0 - -inhibit pulse >\-\-\-\-\-+ - | - +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> -.fi -.if n \{\ -.RE -.\} -.SH "CONFIGURATION" -.sp -Here is an example of generic_modbus driver configuration in \fBups\&.conf\fR file: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[generic_modbus] - driver = generic_modbus - port = /dev/ttyUSB0 - desc = "generic ups driver" - # device info - device_mfr = "PULS" - device_model = "UB40\&.241" - # serial settings - ser_baud_rate = 9600 - ser_parity = N - ser_data_bit = 8 - ser_stop_bit = 1 - # modbus slave id - rio_slave_id = 5 - # UPS signal state attributes - OB_addr = 0x0 - OB_regtype = 1 - OB_noro = 0 - LB_addr = 0x1 - LB_regtype = 1 - HB_addr = 0x2 - HB_regtype = 1 - RB_addr = 0x3 - RB_regtype = 1 - FSD_addr = 0x0 - FSD_regtype = 0 - FSD_pulse_duration = 150 -.fi -.if n \{\ -.RE -.\} -.SH "INSTANT COMMANDS" -.sp -This driver support the following instant commands: -.PP -load\&.off -.RS 4 -executes "instant poweroff" -.RE -.SH "INSTALLATION" -.sp -This driver is not built by default\&. You can build it by installing libmodbus and running configure \-\-with\-modbus=yes\&. -.sp -You also need to give proper permissions on the local serial device file (/dev/ttyUSB0 for example) to allow the run\-time NUT driver user account to access it\&. -.SH "OTHER NOTES" -.sp -The generic_modbus driver intends to support generic UPS devices with contact signals through modbus TCP/RTU gateways (also known as RIO \(em remote I/Os)\&. The data and signal path looks like this: -.sp -.if n \{\ -.RS 4 -.\} -.nf -[UPSD] <\-\-\- IPC \-\-\-> [GENERIC_UPS] <\-\-\- modbus TCP/RTU \-\-\-> MODBUS\-RIO <\-\-\- contacts \-\-\-> [UPS DEVICE] -.fi -.if n \{\ -.RE -.\} -.sp -On the other hand, you can setup any kind of modbus server, and configure the generic_modbus driver to connect and read or write specific registers\&. Your application / modbus server could then drive NUT statuses (e\&.g\&. OL, OB, HB etc) by writing over those registers\&. -.SH "AUTHOR" -.sp -Dimitris Economou -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8), \fBups.conf\fR(5) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -libmodbus home page: -http://libmodbus\&.org -.RE diff --git a/docs/man/generic_modbus.txt b/docs/man/generic_modbus.txt deleted file mode 100644 index 37f9de6..0000000 --- a/docs/man/generic_modbus.txt +++ /dev/null @@ -1,247 +0,0 @@ -GENERIC_MODBUS(8) -================= - -NAME ----- - -generic_modbus - Driver for contact (direct) signal UPS devices connected via modbus remote I/O gateways - -SYNOPSIS --------- - -*generic_modbus* -h - -*generic_modbus* -a 'DEVICE_NAME' ['OPTIONS'] - -NOTE: This man page only documents the specific features of the *generic_modbus* -driver. For information about the core driver, see linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This is a generic modbus driver expected to work with contact (direct) signal -UPS devices, connected via modbus RIO (remote I/O) either serial or TCP/IP. - -The driver has been tested against PULS UPS (model UB40.241) -via MOXA ioLogikR1212 (RS485) and ioLogikE1212 (TCP/IP). - -More information about this UPS can be found here: :: -https://products.pulspower.com/ca/ubc10-241-n1.html - -More information about Moxa ioLogik R1212, E1212 can be found here: :: -https://www.moxa.com/en/products/industrial-edge-connectivity/controllers-and-ios - -The PULS UPS UB40.241 supports the following signals: ----- -Ready contact (DO) <--> HB -Buffering contact (DO) <--> OL | OB -Battery-low (DO) <--> LB -Replace Battery (DO) <--> RB -Inhibit (DI) <--> FSD ----- - -Digital port direction (DI/DO) assumes the device perspective - -The driver's concept is to map the UPS states (as defined in NUT) onto -UPS contacts' states. The driver has an extended configuration interface -implemented using variables defined in ups.conf. - -HARDWARE INTERCONNECTION ------------------------- - -The commission of modbus remote I/O server as well as UPS device is carried -out following the corresponding instruction manuals. The following figure -depicts the anticipated communication path and hardware interconnection: ----- -+------+ +----------------+ +------------+ +------------+ -| UPSD | <---> | GENERIC_MODBUS | <---> | MODBUS RIO | <---> | UPS DEVICE | -+------+ (1) +----------------+ (2) +------------+ (3) +------------+ - | | - +-------------------+ - HOST CONTROLLER - -(1) Unix IPC -(2) RS232 | TCP/IP -(3) contacts ----- - -EXTRA ARGUMENTS ---------------- - -This driver supports the following optional settings in the -linkman:ups.conf[5] file: - -Generic: -~~~~~~~ - -*device_mfr*='value':: -A string specifying the manufacturer of the UPS device (default UNKNOWN). - -*device_model*='value':: -A string specifying the model of the UPS device (default UNKNOWN). - -Serial: -~~~~~~ - -*ser_baud_rate*='value':: -A integer specifying the serial port baud rate (default 9600). - -*ser_data_bit*='value':: -A integer specifying the serial port data bit (default 8). - -*ser_parity*='value':: -A character specifying the serial port parity (default N). - -*ser_stop_bit*='value':: -An integer specifying the serial port stop bit (default 1). - -Modbus: -~~~~~~ - -*rio_slave_id*='value':: -An integer specifying the RIO modbus slave ID (default 1). - -States (X = OL, OB, LB, HB, RB, CHRG, DISCHRG, FSD) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*_addr*='value':: -A number specifying the modbus address for the X state. - -*_regtype*='value':: -A number specifying the modbus register type for the X state -Default values: :: -+ ----- -1 for X = OL, OB, LB ,HB, RB, CHRG, DISCHRG -0 for X = FSD ----- -Valid values: :: -+ ----- -0:COIL, 1:INPUT_B, 2:INPUT_R, 3:HOLDING ----- - -*_noro*='value':: -A number specifying the contact configuration for the X state (default 1). -Valid values: :: -+ ----- -0:NC, 1:NO ----- -+ -NOTE: NO stands for normally open and NC for normally closed contact - -Shutdown -~~~~~~~~ - -*FSD_pulse_duration*='value':: -A number specifying the duration in ms for the inhibit pulse. -If it's not defined, signal has only one transition depending -on FSD_noro configuration. -+ -Examples for FSD signal configuration: ----- -FSD_noro = 1 -FSD_pulse_duration = 150 - - +-----+ - | | -inhibit pulse >-----+ +------------------> - <---> - 150ms - - -FSD_noro = 0 - -inhibit pulse >-----+ - | - +------------------------> - ----- - -CONFIGURATION -------------- - -Here is an example of generic_modbus driver configuration in *ups.conf* file: ----- -[generic_modbus] - driver = generic_modbus - port = /dev/ttyUSB0 - desc = "generic ups driver" - # device info - device_mfr = "PULS" - device_model = "UB40.241" - # serial settings - ser_baud_rate = 9600 - ser_parity = N - ser_data_bit = 8 - ser_stop_bit = 1 - # modbus slave id - rio_slave_id = 5 - # UPS signal state attributes - OB_addr = 0x0 - OB_regtype = 1 - OB_noro = 0 - LB_addr = 0x1 - LB_regtype = 1 - HB_addr = 0x2 - HB_regtype = 1 - RB_addr = 0x3 - RB_regtype = 1 - FSD_addr = 0x0 - FSD_regtype = 0 - FSD_pulse_duration = 150 ----- - -INSTANT COMMANDS ----------------- - -This driver support the following instant commands: - -load.off:: -executes "instant poweroff" - -INSTALLATION ------------- - -This driver is not built by default. You can build it by installing -libmodbus and running `configure --with-modbus=yes`. - -You also need to give proper permissions on the local serial device -file (/dev/ttyUSB0 for example) to allow the run-time NUT driver user -account to access it. - -OTHER NOTES ------------ - -The `generic_modbus` driver intends to support generic UPS devices with -contact signals through modbus TCP/RTU gateways (also known as RIO -- -remote I/Os). The data and signal path looks like this: - ----- -[UPSD] <--- IPC ---> [GENERIC_UPS] <--- modbus TCP/RTU ---> MODBUS-RIO <--- contacts ---> [UPS DEVICE] ----- - -On the other hand, you can setup any kind of modbus server, and configure -the `generic_modbus` driver to connect and read or write specific registers. -Your application / modbus server could then drive NUT statuses (e.g. OL, OB, -HB etc) by writing over those registers. - -AUTHOR ------- - -Dimitris Economou - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8], linkman:ups.conf[5] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* libmodbus home page: http://libmodbus.org diff --git a/docs/man/genericups.8 b/docs/man/genericups.8 index 77b8ff1..f2a02bf 100644 --- a/docs/man/genericups.8 +++ b/docs/man/genericups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: genericups -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "GENERICUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "GENERICUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ This man page only documents the specific features of the genericups driver\&. F .sp This driver supports hardware from many different manufacturers as it only uses the very simplest of signaling schemes\&. Contact closure refers to a kind of interface where basic high/low signals are provided to indicate status\&. This kind of UPS can only report line power and battery status\&. .sp -This means that you will only get the essentials in ups\&.status: OL, OB, and LB (some UPSes may also support RB and BYPASS)\&. Anything else requires a smarter UPS\&. +This means that you will only get the essentials in ups\&.status: OL, OB, and LB\&. Anything else requires a smarter UPS\&. .SH "CABLING" .sp Cabling is different for every kind of UPS\&. See the table below for information on what is known to work with a given UPS type\&. @@ -137,16 +137,6 @@ LB Low battery .RE .PP -RB -.RS 4 -Replace battery -.RE -.PP -BYPASS -.RS 4 -Battery bypass active or no battery installed -.RE -.PP SD .RS 4 Shutdown load @@ -182,27 +172,10 @@ DTR Data Terminal Ready\&. Sent by the PC\&. .RE .PP -DSR -.RS 4 -Data Set Ready\&. Received from the UPS\&. -.RE -.PP ST .RS 4 Send a BREAK on the transmit data line .RE -.PP -NULL -.RS 4 -Disable this signal\&. Disabled signal will always be low except for OL which will always be high\&. -.RE -.PP -none -.RS 4 -Alias to -NULL -which matches some other documentation\&. -.RE .sp A "\-" in front of a signal name (like \-RNG) means that the indicated condition is signaled with an active low signal\&. For example, [LB=\-RNG] means the battery is low when the ring indicate line goes low, and that the battery is OK when that line is held high\&. .SH "UPS TYPES" @@ -502,18 +475,6 @@ Check docs/cables/powerware\&.txt .if n \{\ .RE .\} -.sp -23 = Generic FTTx (Fiber to the x) battery backup with 4\-wire telemetry interface -.sp -.if n \{\ -.RS 4 -.\} -.nf -[CP=RTS] [OL=CTS] [LB=\-DCD] [RB=\-RNG] [BYPASS=\-DSR] [SD=none] -.fi -.if n \{\ -.RE -.\} .SH "SIMILAR MODELS" .sp Many different UPS companies make models with similar interfaces\&. The RUPS cable seems to be especially popular in the "power strip" variety of UPS found in office supply stores\&. If your UPS works with an entry in the table above, but the model or manufacturer information don\(cqt match, don\(cqt despair\&. You can fix that easily by using the mfr and model variables documented above in your \fBups.conf\fR(5)\&. @@ -620,13 +581,13 @@ Types 7 and 10 should both work with the PhoenixTec A1000\&. .sp There is no way to reliably detect a contact\-closure UPS\&. This means the driver will start up happily even if no UPS is detected\&. It also means that if the connection between the UPS and computer is interrupted, you may not be able to sense this in software\&. .sp -Most contact\-closure UPSes will not power down the load if the line power is present\&. This can create a race when using secondary \fBupsmon\fR(8) systems\&. See the \fBupsmon\fR(8) man page for more information\&. +Most contact\-closure UPSes will not power down the load if the line power is present\&. This can create a race when using slave \fBupsmon\fR(8) systems\&. See the \fBupsmon\fR(8) man page for more information\&. .sp The solution to both of these problems is to upgrade to a smart protocol UPS of some kind that allows detection and proper load cycling on command\&. .SH "SEE ALSO" .SS "The core driver" .sp \fBnutupsdrv\fR(8) -.SS "Internet resources:" +.SS "Internet resources" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/genericups.txt b/docs/man/genericups.txt index 54c4a6b..c54a10d 100644 --- a/docs/man/genericups.txt +++ b/docs/man/genericups.txt @@ -3,36 +3,30 @@ GENERICUPS(8) NAME ---- - genericups - Driver for contact-closure UPS equipment NOTE ---- - -This man page only documents the specific features of the genericups +This man page only documents the specific features of the genericups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - -This driver supports hardware from many different manufacturers as it only -uses the very simplest of signaling schemes. Contact closure refers to a -kind of interface where basic high/low signals are provided to indicate +This driver supports hardware from many different manufacturers as it only +uses the very simplest of signaling schemes. Contact closure refers to a +kind of interface where basic high/low signals are provided to indicate status. This kind of UPS can only report line power and battery status. This means that you will only get the essentials in ups.status: OL, OB, -and LB (some UPSes may also support RB and BYPASS). Anything else requires -a smarter UPS. +and LB. Anything else requires a smarter UPS. CABLING ------- - -Cabling is different for every kind of UPS. See the table below for +Cabling is different for every kind of UPS. See the table below for information on what is known to work with a given UPS type. EXTRA ARGUMENTS --------------- - This driver supports the following settings in the linkman:ups.conf[5]: upstype='type':: @@ -43,25 +37,25 @@ are available. mfr='string':: -Optional. The very nature of a generic UPS driver sometimes means that -the stock manufacturer data has no relation to the actual hardware that is -attached. With the `mfr` setting, you can change the value that is seen by +Optional. The very nature of a generic UPS driver sometimes means that +the stock manufacturer data has no relation to the actual hardware that is +attached. With the `mfr` setting, you can change the value that is seen by clients that monitor this UPS. model='string':: -Optional. This is like `mfr` above, but it overrides the model string +Optional. This is like `mfr` above, but it overrides the model string instead. serial='string':: Optional. This is like `mfr` above and intended to record the identification -string of the UPS. It is titled "serial" because usually this string is +string of the UPS. It is titled "serial" because usually this string is referred to as the serial number. sdtime='value':: -Optional. The driver will sleep for this many seconds after setting the +Optional. The driver will sleep for this many seconds after setting the shutdown signal. This is necessary for some hardware which requires a sustained level to activate the shutdown sequence. + @@ -94,18 +88,13 @@ recognizes a low battery condition when DCD is not held high. TYPE INFORMATION ---------------- - -The essence of a UPS definition in this driver is how it uses the serial +The essence of a UPS definition in this driver is how it uses the serial lines that are available. These are the abbreviations you will see below: OL:: On line (no power failure) (opposite of OB - on battery) LB:: Low battery -RB:: Replace battery - -BYPASS:: Battery bypass active or no battery installed - SD:: Shutdown load CP:: Cable power (must be present for cable to have valid reading) @@ -120,85 +109,78 @@ RNG:: Ring indicate. Received from the UPS. DTR:: Data Terminal Ready. Sent by the PC. -DSR:: Data Set Ready. Received from the UPS. - ST:: Send a BREAK on the transmit data line -NULL:: Disable this signal. Disabled signal will always be low except for OL - which will always be high. - -none:: Alias to `NULL` which matches some other documentation. - -A "-" in front of a signal name (like -RNG) means that the indicated -condition is signaled with an active low signal. For example, [LB=-RNG] -means the battery is low when the ring indicate line goes low, and that +A "-" in front of a signal name (like -RNG) means that the indicated +condition is signaled with an active low signal. For example, [LB=-RNG] +means the battery is low when the ring indicate line goes low, and that the battery is OK when that line is held high. UPS TYPES --------- -0 = UPSonic LAN Saver 600 +0 = UPSonic LAN Saver 600 [CP=DTR+RTS] [OL=-CTS] [LB=DCD] [SD=DTR] -1 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0095A/C cable +1 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0095A/C cable [CP=DTR] [OL=-RNG] [LB=DCD] [SD=RTS] -2 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0020B cable +2 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0020B cable [CP=RTS] [OL=-CTS] [LB=DCD] [SD=DTR+RTS] Type 2 has also been reported to work with the 940-0020C cable. -3 = PowerTech Comp1000 with DTR cable power +3 = PowerTech Comp1000 with DTR cable power [CP=DTR] [OL=CTS] [LB=DCD] [SD=DTR+RTS] -4 = Generic RUPS Model +4 = Generic RUPS Model [CP=RTS] [OL=CTS] [LB=-DCD] [SD=-RTS] -5 = Tripp Lite UPS with Lan2.2 interface (black 73-0844 cable) +5 = Tripp Lite UPS with Lan2.2 interface (black 73-0844 cable) [CP=DTR] [OL=CTS] [LB=-DCD] [SD=DTR+RTS] -6 = Best Patriot with INT51 cable +6 = Best Patriot with INT51 cable [CP=DTR] [OL=CTS] [LB=-DCD] [SD=RTS] -7 = CyberPower Power99 +7 = CyberPower Power99 Also Upsonic Power Guardian PG-500, Belkin Belkin Home Office, F6H350-SER, F6H500-SER, F6H650-SER, Eaton Management Card Contact - Config3 with cable 66033 (shutdown does not work) [CP=RTS] [OL=CTS] [LB=-DCD] [SD=DTR] -8 = Nitram Elite 500 +8 = Nitram Elite 500 [CP=DTR] [OL=CTS] [LB=-DCD] [SD=???] -9 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0023A cable +9 = APC Back-UPS/Back-UPS Pro/Smart-UPS with 940-0023A cable [CP=none] [OL=-DCD] [LB=CTS] [SD=RTS] -10 = Victron Lite with crack cable +10 = Victron Lite with crack cable [CP=RTS] [OL=CTS] [LB=-DCD] [SD=DTR] -11 = Powerware 3115 +11 = Powerware 3115 [CP=DTR] [OL=-CTS] [LB=-DCD] [SD=ST] -12 = APC Back-UPS Office with 940-0119A cable +12 = APC Back-UPS Office with 940-0119A cable [CP=RTS] [OL=-CTS] [LB=DCD] [SD=DTR] -13 = RPT Repoteck RPT-800A/RPT-162A +13 = RPT Repoteck RPT-800A/RPT-162A [CP=DTR+RTS] [OL=DCD] [LB=-CTS] [SD=ST] -14 = Online P-series +14 = Online P-series [CP=DTR] [OL=DCD] [LB=-CTS] [SD=RTS] @@ -237,26 +219,21 @@ UPS TYPES [CP=RTS] [OL=CTS] [LB=-DCD] [SD=DTR] -23 = Generic FTTx (Fiber to the x) battery backup - with 4-wire telemetry interface - - [CP=RTS] [OL=CTS] [LB=-DCD] [RB=-RNG] [BYPASS=-DSR] [SD=none] - SIMILAR MODELS -------------- -Many different UPS companies make models with similar interfaces. The -RUPS cable seems to be especially popular in the "power strip" variety of +Many different UPS companies make models with similar interfaces. The +RUPS cable seems to be especially popular in the "power strip" variety of UPS found in office supply stores. If your UPS works with an entry in the table above, but the model or manufacturer information don't match, -don't despair. You can fix that easily by using the mfr and model +don't despair. You can fix that easily by using the mfr and model variables documented above in your linkman:ups.conf[5]. TESTING COMPATIBILITY --------------------- -If your UPS isn't listed above, you can try going through the list until -you find one that works. There is a lot of cable and interface reuse in +If your UPS isn't listed above, you can try going through the list until +you find one that works. There is a lot of cable and interface reuse in the UPS world, and you may find a match. To do this, first make sure nothing important is plugged into the @@ -267,7 +244,7 @@ supplied to the outlets. Now, you can either attempt to make an educated guess based on the documentation your manufacturer has provided (if any), or just start -going down the list. +going down the list. Step 1 ~~~~~~ @@ -342,20 +319,20 @@ Change the port and upstype values to match your system. NEW SUPPORT ----------- -If the above testing sequence fails, you will probably need to create a -new entry to support your hardware. All UPS types are determined from the +If the above testing sequence fails, you will probably need to create a +new entry to support your hardware. All UPS types are determined from the table in the genericups.h file in the source tree. -On a standard 9 pin serial port, there are 6 lines that are used as the -standard "high/low" signal levels. 4 of them are incoming (to the PC, -from the UPS), and the other 2 are outgoing (to the UPS, from the PC). +On a standard 9 pin serial port, there are 6 lines that are used as the +standard "high/low" signal levels. 4 of them are incoming (to the PC, +from the UPS), and the other 2 are outgoing (to the UPS, from the PC). The other 3 are the receive/transmit lines and the ground. -Be aware that many manufacturers remap pins within the cable. If you have -any doubts, a quick check with a multimeter should confirm whether the -cable is straight-through or not. Another thing to keep in mind is that -some cables have electronics in them to do special things. Some have -resistors and transistors on board to change behavior depending on what's +Be aware that many manufacturers remap pins within the cable. If you have +any doubts, a quick check with a multimeter should confirm whether the +cable is straight-through or not. Another thing to keep in mind is that +some cables have electronics in them to do special things. Some have +resistors and transistors on board to change behavior depending on what's being supplied by the PC. SPECIFIC MODEL NOTES @@ -363,17 +340,17 @@ SPECIFIC MODEL NOTES These have been contributed by users of this driver. -The Centralion CL series may power down the load if the driver starts up -with the UPS running on battery as the default line settings contain the +The Centralion CL series may power down the load if the driver starts up +with the UPS running on battery as the default line settings contain the shutdown sequence. - Neil Muller -The Tripp-Lite Internet Office 700 must be used with the black 73-0844 -cable instead of the gray 73-0743 cable. This entry should work with any -of their models with the Lan 2.2 interface - see the sticker by the DB9 +The Tripp-Lite Internet Office 700 must be used with the black 73-0844 +cable instead of the gray 73-0743 cable. This entry should work with any +of their models with the Lan 2.2 interface - see the sticker by the DB9 connector on the UPS. - Stephen Brown -Type 5 should work with the Tripp-Lite Lan 2.1 interface and the 73-0724 -cable. This was tested with the OmniSmart 675 PNP on Red Hat 7.2. - Q +Type 5 should work with the Tripp-Lite Lan 2.1 interface and the 73-0724 +cable. This was tested with the OmniSmart 675 PNP on Red Hat 7.2. - Q Giese Types 7 and 10 should both work with the PhoenixTec A1000. @@ -381,16 +358,16 @@ Types 7 and 10 should both work with the PhoenixTec A1000. BUGS ---- -There is no way to reliably detect a contact-closure UPS. This means the -driver will start up happily even if no UPS is detected. It also means -that if the connection between the UPS and computer is interrupted, you +There is no way to reliably detect a contact-closure UPS. This means the +driver will start up happily even if no UPS is detected. It also means +that if the connection between the UPS and computer is interrupted, you may not be able to sense this in software. -Most contact-closure UPSes will not power down the load if the line power -is present. This can create a race when using secondary linkman:upsmon[8] +Most contact-closure UPSes will not power down the load if the line power +is present. This can create a race when using slave linkman:upsmon[8] systems. See the linkman:upsmon[8] man page for more information. -The solution to both of these problems is to upgrade to a smart protocol +The solution to both of these problems is to upgrade to a smart protocol UPS of some kind that allows detection and proper load cycling on command. SEE ALSO @@ -398,10 +375,8 @@ SEE ALSO The core driver ~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +Internet resources +~~~~~~~~~~~~~~~~~~ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/hosts.conf.5 b/docs/man/hosts.conf.5 index 298105f..89538df 100644 --- a/docs/man/hosts.conf.5 +++ b/docs/man/hosts.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: hosts.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "HOSTS\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "HOSTS\&.CONF" "5" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/hosts.conf.txt b/docs/man/hosts.conf.txt index 8d86ea8..273ae98 100644 --- a/docs/man/hosts.conf.txt +++ b/docs/man/hosts.conf.txt @@ -36,5 +36,4 @@ linkman:upsset.cgi[8], linkman:upsstats.cgi[8], linkman:upsimage.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/huawei-ups2000.8 b/docs/man/huawei-ups2000.8 deleted file mode 100644 index 40ada33..0000000 --- a/docs/man/huawei-ups2000.8 +++ /dev/null @@ -1,489 +0,0 @@ -'\" t -.\" Title: huawei_ups2000 -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "HUAWEI_UPS2000" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -huawei-ups2000 \- Driver for Huawei UPS2000 (1kVA\-3kVA) UPS with USB or RS\-232 serial Modbus connection\&. -.SH "SYNOPSIS" -.sp -\fBhuawei\-ups2000\fR \-h -.sp -\fBhuawei\-ups2000\fR \-a \fIDEVICE_NAME\fR [\fIOPTIONS\fR] -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This man page only documents the hardware\-specific features of the huawei\-ups2000 driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -This driver supports Huawei UPS2000 series, online (double conversion) UPS with the following characteristics\&. -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -Output power: 1 kVA to 3 kVA (higher power models are unsupported)\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -Connection: USB or RS\-232 (USB is only supported on Linux 5\&.12 and newer kernels, read the section -\fBCabling\fR -carefully)\&. -.RE -.sp -The UPS2000 series has two variants: UPS2000\-A with a tower chassis, and UPS2000\-G with a rack\-mount chassis\&. Both should be equally supported, but more testers are needed\&. -.sp -Currently, it has been tested on the following models\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -UPS2000\-A\-1KTTS (firmware: V2R1C1SPC40, P1\&.0\-D1\&.0) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -UPS2000\-A\-2KTTS (firmware: V2R1C1SPC50, P1\&.0\-D1\&.0) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -UPS2000\-G\-3KRTS (firmware: V2R1C1SPC40, P1\&.0\-D1\&.0) -.RE -.sp -If your model is not in the list, we encourage you to report successful or unsuccessful results to the bug tracker or the mailing list\&. Make sure to include the full model number of your UPS manually in your report, because the firmware only reports "UPS2000\-A" for all models, including the G series\&. -.sp -huawei\-ups2000 uses the libmodbus project, for Modbus implementation\&. -.SH "CABLING" -.sp -The UPS has a USB port and a RS\-232 port\&. Both are supported, but USB is only usable on Linux 5\&.12 and later, via the \fBxr_serial\fR kernel module (see subsection \fBUSB\fR for details)\&. RS\-232 is supported on all operating systems\&. -.sp -Only one port can be used at a time\&. When USB is used, RS\-232 should be unplugged from the UPS, and vice versa\&. Further, optional adapter cards, such as RS\-485 or SNMP, are not supported\&. They should be removed from the UPS\&. -.sp -Because the UPS port can be unresponsive under certain circumstances, it\(cqs recommended to power cycle your UPS after making a cabling change, especially after changing the port type\&. That is, turn off the UPS power output via the front panel, then unplug the UPS from line power input\&. Wait for the LCD screen to go black\&. Finally reconnect line power and restart your UPS\&. -.SS "USB" -.sp -The USB port on the UPS2000 is powered by a MaxLinear/Exar RX21V1410 USB\-to\-serial converter chip, it\(cqs only supported by Linux 5\&.12 or newer, via the \fBxr_serial\fR kernel module\&. -.sp -When the UPS2000 is connected via USB to a supported Linux system, you should see the following logs in \fBdmesg\fR\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -xr_serial 1\-1\&.2:1\&.1: xr_serial converter detected -usb 1\-1\&.2: xr_serial converter now attached to ttyUSB0 -.fi -.if n \{\ -.RE -.\} -.sp -The driver must be \fBxr_serial\fR\&. If your system doesn\(cqt have the necessary device driver, you will get this message instead: -.sp -.if n \{\ -.RS 4 -.\} -.nf -cdc_acm 1\-1\&.2:1\&.0: ttyACM0: USB ACM device -.fi -.if n \{\ -.RE -.\} -.sp -The generic driver \fBcdc_acm\fR is incompatible and cannot be used\&. You should upgrade your Linux kernel to Linux 5\&.12 or newer\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBWarning\fR -.ps -1 -.br -.sp -On an unsupported system, the USB device can still be recognized as a USB ACM device, but communication is impossible, please don\(cqt waste your time on \fBcdc_acm\fR\&. -.sp .5v -.RE -.sp -If you\(cqre already running on Linux 5\&.12 or newer kernels, but still cannot see the \fBxr_serial\fR driver, it means the driver is not enabled in your kernel build\&. If you\(cqre a regular user, you should file a bug report to your Linux distro maintainers and ask them to enable \fBxr_serial\fR (kernel option CONFIG_USB_SERIAL_XR)\&. -.sp -When upgrading the Linux kernel isn\(cqt an option, or when you are using another operating system (e\&.g\&. FreeBSD), RS\-232 must be used\&. -.SS "RS\-232" -.sp -RS\-232 is supported on all operating systems, either via a built\-in serial port on your computer, or by using an external USB\-to\-RS\-232 converter\&. If you plan to use an USB\-to\-RS\-232 converter, make sure it\(cqs supported by your operating system\&. -.SH "INSTALLATION" -.sp -This driver is not built by default\&. You can build it by installing libmodbus (with development packages) and running -.sp -.if n \{\ -.RS 4 -.\} -.nf -configure \-\-with\-serial=yes \-\-with\-modbus=yes -.fi -.if n \{\ -.RE -.\} -.sp -You also need to give proper (R/W) permissions on the local serial device file to allow the NUT driver run\-time user to access it\&. This may need additional setup for start\-up scripting, udev or upower rules, to apply the rights on every boot \(em especially if your device nodes are tracked by a virtual filesystem\&. -.sp -For example, a USB\-to\-serial converter can be identified as /dev/ttyACM0 or /dev/ttyUSB0 on Linux, or /dev/ttyU0 on FreeBSD (note the capital "U")\&. A built\-in serial port can be identified as /dev/ttyS0 on Linux or one of /dev/cua* names on FreeBSD\&. -.SH "EXTRA ARGUMENTS" -.sp -This driver supports the following optional settings in the \fBups.conf\fR(5) file: -.PP -\fBoffdelay=\fR\fIvalue\fR -.RS 4 -Time to wait before shutting down the UPS (seconds), acceptable range is 6 seconds (0\&.1 minutes) to 5940 seconds (99 minutes)\&. Defaults to 60 seconds\&. Must be a multiple of 6 seconds\&. To ensure your system has adequate time to shut down after a power failure, it\(cqs highly recommended to adjust -\fBoffdelay\fR\&. -.RE -.PP -\fBrebootdelay=\fR\fIvalue\fR -.RS 4 -Time to wait before rebooting the UPS (seconds), acceptable range is 6 seconds (0\&.1 minutes) to 5940 seconds (99 minutes)\&. Defaults to 60 seconds\&. Must be a multiple of 6 seconds\&. This is used by the -\fBshutdown\&.reboot\&.graceful\fR -instant command\&. If you\(cqve adjusted -\fBoffdelay\fR, you should also adjust -\fBrebootdelay\fR\&. -.RE -.PP -\fBondelay=\fR\fIvalue\fR -.RS 4 -Time to wait before switching on the UPS (seconds), acceptable range is 60 seconds (1 minutes) to 5940 seconds (99 minutes)\&. Defaults to 60 seconds\&. Must be a multiple of 60 seconds (not 6 seconds)\&. You don\(cqt need to adjust this delay unless you have special requirements\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Due to hardware limitation, in this driver, \fBondelay\fR is respected only when line power is available\&. If a power failure has occurred, the UPS and the load is always immediately switched on, as soon (or as late) as line power is restored\&. -.sp .5v -.RE -.SH "INSTANT COMMANDS" -.sp -This driver supports some instant commands (see \fBupscmd\fR(8)): -.PP -\fBshutdown\&.stayoff\fR -.RS 4 -After an -\fBoffdelay\fR, turn off the load\&. When line power is back, remain off\&. -.RE -.PP -\fBshutdown\&.return\fR -.RS 4 -After an -\fBoffdelay\fR, turn off the load\&. When line power is back, turn on the load, possibly after an -\fBondelay\fR\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -Normally, the load is turned on as soon as line power is back\&. But if line power is never lost, or has came back unexpectedly in the middle of an ongoing shutdown (an undesirable "power race" condition that many entry\-level products on the market fail to recover from), the load is turned on after an \fBondelay\fR\&. Thus, UPS2000 is unaffected by a power race, the load is guaranteed to always restart\&. -.sp .5v -.RE -.PP -\fBshutdown\&.reboot\fR -.RS 4 -Like -\fBshutdown\&.return\fR, except that the load is turned off immediately (6 seconds in this implementation)\&. -.RE -.PP -\fBshutdown\&.reboot\&.graceful\fR -.RS 4 -Like -\fBshutdown\&.return\fR, except that the load is turned off after a -\fBrebootdelay\fR, not an -\fBoffdelay\fR\&. -.RE -.PP -\fBbeeper\&.enable\fR -.RS 4 -Enable the UPS beeper\&. -.RE -.PP -\fBbeeper\&.disable\fR -.RS 4 -Disable the UPS beeper\&. -.RE -.PP -\fBbeeper\&.toggle\fR -.RS 4 -Toggle the UPS beeper\&. -.RE -.PP -\fBbypass\&.start\fR -.RS 4 -Put the UPS in bypass mode\&. Use with caution\&. It exposes your equipment to unregulated line power and provides no protection from power failures\&. Also, the UPS may shut down whenever the bypass input voltage is out of the nominal range\&. As a warning, the UPS beeps once every 10 seconds in bypass mode\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The driver has a basic foolproof mechanism\&. If the bypass input is already abnormal due to a power failure, the driver refuses to enter bypass mode by aborting the command and logging an error\&. However, it offers no protection after the UPS has entered (or in the middle of entering) bypass mode\&. Thus, again, use with caution\&. -.sp .5v -.RE -.PP -\fBbypass\&.stop\fR -.RS 4 -Put the UPS out of bypass mode\&. -.RE -.PP -\fBload\&.on\fR -.RS 4 -Turn on the load immediately\&. -.RE -.PP -\fBload\&.off\fR -.RS 4 -Turn off the load immediately\&. Use with caution, everything on the UPS will lost power\&. -.RE -.PP -\fBtest\&.battery\&.start\&.quick\fR -.RS 4 -Perform a short battery test\&. -.RE -.PP -\fBtest\&.battery\&.start\&.deep\fR -.RS 4 -Perform a long battery test\&. -.RE -.PP -\fBtest\&.battery\&.stop\fR -.RS 4 -Stop a running battery test\&. -.RE -.SH "VARIABLES" -.sp -This driver supports some writable runtime variables (see \fBupsrw\fR(8)): -.PP -\fBups\&.beeper\&.status\fR -.RS 4 -Enable or disable the UPS beeper, -\fBdisabled\fR -or -\fBenabled\fR\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The beeper can only be disabled completely, it cannot be temporally muted until the next alarm, but the option \fBmuted\fR is also accepted for convenience, \fBmuted\fR is treated as an alias of \fBdisabled\fR\&. -.sp .5v -.RE -.PP -\fBups\&.delay\&.shutdown\fR -.RS 4 -Seconds to wait after shutdown with delay command\&. It\(cqs the runtime equivalent of -\fBoffdelay\fR\&. See description of -\fBoffdelay\fR\&. -.RE -.PP -\fBups\&.delay\&.reboot\fR -.RS 4 -Seconds to wait before rebooting the UPS, it\(cqs the runtime equivalent of -\fBrebootdelay\fR\&. See description of -\fBrebootdelay\fR\&. -.RE -.PP -\fBups\&.delay\&.start\fR -.RS 4 -Seconds to wait before restarting the load, it\(cqs the runtime equivalent of -\fBondelay\fR\&. See description of -\fBondelay\fR\&. -.RE -.SH "KNOWN ISSUES AND BUGS" -.SS "Battery status has a non\-fatal read failure" -.sp -It\(cqs usually harmless and can be safely ignored\&. It\(cqs only logged for informative purposes (\fBLOG_INFO\fR), not as a warning or error\&. -.SS "Data stale" -.sp -Under certain circumstances, some registers can return invalid values and trigger a "data stale" error\&. Once a data stale error has occurred, you should see error messages similar to the example below in the system log\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -huawei\-ups2000: register 2002 has invalid value a000, -upsd: Data for UPS [huawei] is stale \- check driver -upsd: UPS [huawei] data is no longer stale -.fi -.if n \{\ -.RE -.\} -.sp -So far all known problems have been fixed by the author, but an unknown one cannot be ruled out\&. If you have encountered "data stale" problems during normal uses, please file a bug report with full logs attached\&. -.sp -Before troubleshooting or reporting a problem, it\(cqs important to check your \fBdmesg\fR log for USB connect and disconnect events to avoid wasting time on the NUT driver when the actual problem is USB\&. For example, if someone yanks the cable out of the USB port, or if a new USB device is plugged into a USB host/hub that is struggling to power its ports (common on single\-board computers like Raspberry Pi), or if you have flaky cabling or EMI noise, the serial converter can get disconnected from USB, at least briefly\&. This creates a permanent data stale, the driver must be restarted (plugging the USB back won\(cqt fix it, since the driver is still using the nonexistent serial device)\&. These USB problems usually have nothing to do with NUT\&. If it\(cqs the case, you should solve the underlying USB problem \- check the cable, check the converter, try a powered USB hub, try a full\-speed USB isolator, etc\&. -.SS "Serial port becomes unresponsive" -.sp -Some malformed commands are known to lock up the serial port (including USB, which is a USB\-to\-serial device)\&. Upon receiving them, UPS2000 stops all serial communications\&. The result is a completely unresponsive UPS, regardless of what you do \- restarting NUT, rebooting the computer \- cannot restore connectivity, as if someone has unplugged the RS\-232 cable\&. To recover, simply power cycle the UPS: Turn off the UPS output via the front panel, then unplug the UPS from line power\&. Wait for the LCD front screen to go black\&. Finally reconnect line power and restart your UPS\&. -.sp -That being said, a serial port lockup is unlikely to happen\&. To our best knowledge, this driver never sends malformed commands to the UPS (it was only a problem during early development)\&. Furthermore, due to a CRC checksum, they\(cqre unlikely to be accidentally generated\&. -.sp -Still, we recommend to power cycle your UPS after making a cabling change, especially after changing from RS\-485/USB to RS\-232, just to ensure the UPS selects the correct communication interface\&. Also, if you have discovered a reproducible serial port lockup problem, it can be an previously unknown bug, make sure to file a bug report\&. -.SS "USB is unsupported" -.sp -As previously stated, only RS\-232 is supported on all systems\&. USB requires a device\-specific driver, which is only available on Linux 5\&.12 and newer kernels\&. -.sp -On an unsupported system, the USB device can still be recognized as a USB ACM device, but in reality, communication is impossible\&. It can only be fixed by implementing a driver for your system, nothing can be done within NUT\&. -.sp -Finally, in the unlike scenario that you are using NUT on Microsoft Windows, you should be able to install the USB device driver following the steps in the Huawei UPS2000 (1 kVA\-3 kVA) Modbus Protocol Development Guide\&. -.SH "AUTHOR" -.sp -Yifeng Li -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Huawei UPS2000\-A (1 kVA\-3 kVA) User Manual: -https://support\&.huawei\&.com/enterprise/en/doc/EDOC1000084260 -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Huawei UPS2000 (1 kVA\-3 kVA) Modbus Protocol Development Guide: -https://support\&.huawei\&.com/enterprise/en/doc/EDOC1000110696 -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -libmodbus home page: -http://libmodbus\&.org -.RE diff --git a/docs/man/huawei-ups2000.txt b/docs/man/huawei-ups2000.txt deleted file mode 100644 index af38350..0000000 --- a/docs/man/huawei-ups2000.txt +++ /dev/null @@ -1,364 +0,0 @@ -HUAWEI_UPS2000(8) -================== - -NAME ----- - -huawei-ups2000 - Driver for Huawei UPS2000 (1kVA-3kVA) UPS with USB or -RS-232 serial Modbus connection. - -SYNOPSIS --------- - -*huawei-ups2000* -h - -*huawei-ups2000* -a 'DEVICE_NAME' ['OPTIONS'] - -NOTE: This man page only documents the hardware-specific features of the -huawei-ups2000 driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This driver supports Huawei UPS2000 series, online (double conversion) -UPS with the following characteristics. - -1. Output power: 1 kVA to 3 kVA (higher power models are unsupported). - -2. Connection: USB or RS-232 (USB is only supported on Linux 5.12 and -newer kernels, read the section *Cabling* carefully). - -The UPS2000 series has two variants: UPS2000-A with a tower chassis, -and UPS2000-G with a rack-mount chassis. Both should be equally supported, -but more testers are needed. - -Currently, it has been tested on the following models. - -* UPS2000-A-1KTTS (firmware: V2R1C1SPC40, P1.0-D1.0) -* UPS2000-A-2KTTS (firmware: V2R1C1SPC50, P1.0-D1.0) -* UPS2000-G-3KRTS (firmware: V2R1C1SPC40, P1.0-D1.0) - -If your model is not in the list, we encourage you to report successful -or unsuccessful results to the bug tracker or the mailing list. -Make sure to include the full model number of your UPS manually -in your report, because the firmware only reports "UPS2000-A" -for all models, including the G series. - -huawei-ups2000 uses the libmodbus project, for Modbus implementation. - -CABLING -------- - -The UPS has a USB port and a RS-232 port. Both are supported, but USB is -only usable on Linux 5.12 and later, via the *xr_serial* kernel module (see -subsection *USB* for details). RS-232 is supported on all operating systems. - -Only one port can be used at a time. When USB is used, RS-232 should be -unplugged from the UPS, and vice versa. Further, optional adapter cards, -such as RS-485 or SNMP, are not supported. They should be removed from -the UPS. - -Because the UPS port can be unresponsive under certain circumstances, it's -recommended to power cycle your UPS after making a cabling change, especially -after changing the port type. That is, turn off the UPS power output via the -front panel, then unplug the UPS from line power input. Wait for the LCD -screen to go black. Finally reconnect line power and restart your UPS. - -USB -~~~~ - -The USB port on the UPS2000 is powered by a MaxLinear/Exar RX21V1410 -USB-to-serial converter chip, it's only supported by Linux 5.12 or -newer, via the *xr_serial* kernel module. - -When the UPS2000 is connected via USB to a supported Linux system, -you should see the following logs in *dmesg*. - - xr_serial 1-1.2:1.1: xr_serial converter detected - usb 1-1.2: xr_serial converter now attached to ttyUSB0 - -The driver must be *xr_serial*. If your system doesn't have the -necessary device driver, you will get this message instead: - - cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device - -The generic driver *cdc_acm* is incompatible and cannot be used. -You should upgrade your Linux kernel to Linux 5.12 or newer. - -WARNING: On an unsupported system, the USB device can still be -recognized as a USB ACM device, but communication is impossible, -please don't waste your time on *cdc_acm*. - -If you're already running on Linux 5.12 or newer kernels, but still -cannot see the *xr_serial* driver, it means the driver is not enabled -in your kernel build. If you're a regular user, you should file a bug -report to your Linux distro maintainers and ask them to enable -*xr_serial* (kernel option `CONFIG_USB_SERIAL_XR`). - -When upgrading the Linux kernel isn't an option, or when you are using -another operating system (e.g. FreeBSD), RS-232 must be used. - -RS-232 -~~~~~~ - -RS-232 is supported on all operating systems, either via a built-in serial -port on your computer, or by using an external USB-to-RS-232 converter. If -you plan to use an USB-to-RS-232 converter, make sure it's supported by your -operating system. - - -INSTALLATION ------------- - -This driver is not built by default. You can build it by installing libmodbus -(with development packages) and running - - configure --with-serial=yes --with-modbus=yes - -You also need to give proper (R/W) permissions on the local serial device file -to allow the NUT driver run-time user to access it. This may need additional -setup for start-up scripting, udev or upower rules, to apply the rights on every -boot -- especially if your device nodes are tracked by a virtual filesystem. - -For example, a USB-to-serial converter can be identified as `/dev/ttyACM0` -or `/dev/ttyUSB0` on Linux, or `/dev/ttyU0` on FreeBSD (note the capital "U"). -A built-in serial port can be identified as `/dev/ttyS0` on Linux or one of -`/dev/cua*` names on FreeBSD. - -EXTRA ARGUMENTS ---------------- -This driver supports the following optional settings in the -linkman:ups.conf[5] file: - -*offdelay=*'value':: -Time to wait before shutting down the UPS (seconds), acceptable range is -6 seconds (0.1 minutes) to 5940 seconds (99 minutes). Defaults to 60 seconds. -Must be a multiple of 6 seconds. To ensure your system has adequate time -to shut down after a power failure, it's highly recommended to adjust -*offdelay*. - -*rebootdelay=*'value':: -Time to wait before rebooting the UPS (seconds), acceptable range is -6 seconds (0.1 minutes) to 5940 seconds (99 minutes). Defaults to 60 seconds. -Must be a multiple of 6 seconds. This is used by the *shutdown.reboot.graceful* -instant command. If you've adjusted *offdelay*, you should also adjust -*rebootdelay*. - -*ondelay=*'value':: -Time to wait before switching on the UPS (seconds), acceptable range is -60 seconds (1 minutes) to 5940 seconds (99 minutes). Defaults to 60 seconds. -Must be a multiple of 60 seconds (not 6 seconds). You don't need to adjust -this delay unless you have special requirements. - -NOTE: Due to hardware limitation, in this driver, *ondelay* is respected -only when line power is available. If a power failure has occurred, the -UPS and the load is always immediately switched on, as soon (or as late) -as line power is restored. - -INSTANT COMMANDS ----------------- - -This driver supports some instant commands (see linkman:upscmd[8]): - -*shutdown.stayoff*:: -After an *offdelay*, turn off the load. When line power is back, -remain off. - -*shutdown.return*:: -After an *offdelay*, turn off the load. When line power is back, -turn on the load, possibly after an *ondelay*. - -NOTE: Normally, the load is turned on as soon as line power is back. -But if line power is never lost, or has came back unexpectedly -in the middle of an ongoing shutdown (an undesirable "power race" -condition that many entry-level products on the market fail to -recover from), the load is turned on after an *ondelay*. Thus, -UPS2000 is unaffected by a power race, the load is guaranteed to -always restart. - -*shutdown.reboot*:: -Like *shutdown.return*, except that the load is turned off immediately -(6 seconds in this implementation). - -*shutdown.reboot.graceful*:: -Like *shutdown.return*, except that the load is turned off after a -*rebootdelay*, not an *offdelay*. - -*beeper.enable*:: - -Enable the UPS beeper. - -*beeper.disable*:: - -Disable the UPS beeper. - -*beeper.toggle*:: - -Toggle the UPS beeper. - -*bypass.start*:: - -Put the UPS in bypass mode. Use with caution. It exposes your equipment -to unregulated line power and provides no protection from power failures. -Also, the UPS may shut down whenever the bypass input voltage is out -of the nominal range. As a warning, the UPS beeps once every 10 seconds -in bypass mode. - -NOTE: The driver has a basic foolproof mechanism. If the bypass input -is already abnormal due to a power failure, the driver refuses to enter -bypass mode by aborting the command and logging an error. However, it -offers no protection after the UPS has entered (or in the middle of -entering) bypass mode. Thus, again, use with caution. - -*bypass.stop*:: - -Put the UPS out of bypass mode. - -*load.on*:: - -Turn on the load immediately. - -*load.off*:: - -Turn off the load immediately. Use with caution, everything on the UPS -will lost power. - -*test.battery.start.quick*:: - -Perform a short battery test. - -*test.battery.start.deep*:: - -Perform a long battery test. - -*test.battery.stop*:: - -Stop a running battery test. - -VARIABLES ---------- - -This driver supports some writable runtime variables (see linkman:upsrw[8]): - -**ups.beeper.status**:: -Enable or disable the UPS beeper, *disabled* or *enabled*. - -NOTE: The beeper can only be disabled completely, it cannot be -temporally muted until the next alarm, but the option *muted* is -also accepted for convenience, *muted* is treated as an alias of -*disabled*. - -**ups.delay.shutdown**:: -Seconds to wait after shutdown with delay command. It's the runtime -equivalent of *offdelay*. See description of *offdelay*. - -**ups.delay.reboot**:: -Seconds to wait before rebooting the UPS, it's the runtime -equivalent of *rebootdelay*. See description of *rebootdelay*. - -**ups.delay.start**:: -Seconds to wait before restarting the load, it's the runtime -equivalent of *ondelay*. See description of *ondelay*. - -KNOWN ISSUES AND BUGS ---------------------- - -Battery status has a non-fatal read failure -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -It's usually harmless and can be safely ignored. It's only logged for -informative purposes (*LOG_INFO*), not as a warning or error. - -Data stale -~~~~~~~~~~~ - -Under certain circumstances, some registers can return invalid values -and trigger a "data stale" error. Once a data stale error has occurred, -you should see error messages similar to the example below in the system -log. - - huawei-ups2000: register 2002 has invalid value a000, - upsd: Data for UPS [huawei] is stale - check driver - upsd: UPS [huawei] data is no longer stale - -So far all known problems have been fixed by the author, but an unknown one -cannot be ruled out. If you have encountered "data stale" problems during -normal uses, please file a bug report with full logs attached. - -Before troubleshooting or reporting a problem, it's important to check -your *dmesg* log for USB connect and disconnect events to avoid wasting -time on the NUT driver when the actual problem is USB. For example, if -someone yanks the cable out of the USB port, or if a new USB device is -plugged into a USB host/hub that is struggling to power its ports -(common on single-board computers like Raspberry Pi), or if you have -flaky cabling or EMI noise, the serial converter can get disconnected -from USB, at least briefly. This creates a permanent data stale, the driver -must be restarted (plugging the USB back won't fix it, since the driver -is still using the nonexistent serial device). These USB problems usually -have nothing to do with NUT. If it's the case, you should solve the -underlying USB problem - check the cable, check the converter, try a -powered USB hub, try a full-speed USB isolator, etc. - -Serial port becomes unresponsive -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Some malformed commands are known to lock up the serial port (including -USB, which is a USB-to-serial device). Upon receiving them, UPS2000 stops -all serial communications. The result is a completely unresponsive UPS, -regardless of what you do - restarting NUT, rebooting the computer - -cannot restore connectivity, as if someone has unplugged the RS-232 cable. -To recover, simply power cycle the UPS: Turn off the UPS output via the -front panel, then unplug the UPS from line power. Wait for the LCD front -screen to go black. Finally reconnect line power and restart your UPS. - -That being said, a serial port lockup is unlikely to happen. To our best -knowledge, this driver never sends malformed commands to the UPS (it was -only a problem during early development). Furthermore, due to a CRC checksum, -they're unlikely to be accidentally generated. - -Still, we recommend to power cycle your UPS after making a cabling change, -especially after changing from RS-485/USB to RS-232, just to ensure the -UPS selects the correct communication interface. Also, if you have -discovered a reproducible serial port lockup problem, it can be an -previously unknown bug, make sure to file a bug report. - -USB is unsupported -~~~~~~~~~~~~~~~~~~~ - -As previously stated, only RS-232 is supported on all systems. USB -requires a device-specific driver, which is only available on Linux -5.12 and newer kernels. - -On an unsupported system, the USB device can still be recognized as a -USB ACM device, but in reality, communication is impossible. It can -only be fixed by implementing a driver for your system, nothing can -be done within NUT. - -Finally, in the unlike scenario that you are using NUT on Microsoft -Windows, you should be able to install the USB device driver following -the steps in the Huawei UPS2000 (1 kVA-3 kVA) Modbus Protocol Development -Guide. - -AUTHOR ------- - -Yifeng Li - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* Huawei UPS2000-A (1 kVA-3 kVA) User Manual: - https://support.huawei.com/enterprise/en/doc/EDOC1000084260 -* Huawei UPS2000 (1 kVA-3 kVA) Modbus Protocol Development Guide: - https://support.huawei.com/enterprise/en/doc/EDOC1000110696 -* libmodbus home page: http://libmodbus.org diff --git a/docs/man/isbmex.8 b/docs/man/isbmex.8 index 6083184..a2286bc 100644 --- a/docs/man/isbmex.8 +++ b/docs/man/isbmex.8 @@ -1,13 +1,13 @@ '\" t .\" Title: isbmex .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "ISBMEX" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "ISBMEX" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/isbmex.txt b/docs/man/isbmex.txt index 985f0ff..9b97d16 100644 --- a/docs/man/isbmex.txt +++ b/docs/man/isbmex.txt @@ -15,7 +15,6 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports SOLA/BASIC Mexico ISBMEX protocol UPS equipment. EXTRA ARGUMENTS @@ -26,7 +25,6 @@ linkman:ups.conf[5]. AUTHOR ------ - Edscott Wilson Garcia SEE ALSO @@ -34,10 +32,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/ivtscd.8 b/docs/man/ivtscd.8 index 6bdbb80..6b07ba7 100644 --- a/docs/man/ivtscd.8 +++ b/docs/man/ivtscd.8 @@ -1,13 +1,13 @@ '\" t .\" Title: ivtscd .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "IVTSCD" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "IVTSCD" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/ivtscd.txt b/docs/man/ivtscd.txt index 0696c87..6a2c7c4 100644 --- a/docs/man/ivtscd.txt +++ b/docs/man/ivtscd.txt @@ -3,40 +3,32 @@ IVTSCD(8) NAME ---- - ivtscd - driver for the IVT Solar Controller Device NOTE ---- - This man page only documents the hardware-specific features of the *ivtscd* driver. For information about the core driver, see linkman:nutupsdrv[8]. DESCRIPTION ----------- - This driver allows to access the IVT SCD-series devices. EXTRA ARGUMENTS --------------- - This driver does not support any extra argument. AUTHOR ------ - Arjen de Korte SEE ALSO -------- - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/libnutclient.3 b/docs/man/libnutclient.3 index f41cd09..6da4460 100644 --- a/docs/man/libnutclient.3 +++ b/docs/man/libnutclient.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "LIBNUTCLIENT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT" "3" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/libnutclient.txt b/docs/man/libnutclient.txt index 668eb83..d23b705 100644 --- a/docs/man/libnutclient.txt +++ b/docs/man/libnutclient.txt @@ -39,12 +39,10 @@ See the `nutclient.h` header for more information. ERROR HANDLING -------------- - There is currently no specific mechanism around error handling. SEE ALSO -------- - linkman:libnutclient_devices[3] linkman:libnutclient_commands[3] linkman:libnutclient_general[3] diff --git a/docs/man/libnutclient_commands.3 b/docs/man/libnutclient_commands.3 index e202009..06c9268 100644 --- a/docs/man/libnutclient_commands.3 +++ b/docs/man/libnutclient_commands.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_commands -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBNUTCLIENT_COMMAND" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_COMMAND" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,121 +40,26 @@ typedef void* NUTCLIENT_t; .fi .sp .nf -typedef char** strarr; -.fi -.sp -.nf -strarr nutclient_get_device_commands( - NUTCLIENT_t client, - const char* dev); -.fi -.sp -.nf -int nutclient_has_device_command( - NUTCLIENT_t client, - const char* dev, const char* cmd); -.fi -.sp -.nf -char* nutclient_get_device_command_description( - NUTCLIENT_t client, - const char* dev, const char* cmd); -.fi -.sp -.nf -void nutclient_execute_device_command( - NUTCLIENT_t client, - const char* dev, const char* cmd, - const char* param=""); +strarr nutclient_get_device_commands(NUTCLIENT_t client, const char* dev); +int nutclient_has_device_command(NUTCLIENT_t client, const char* dev, const char* cmd); +char* nutclient_get_device_command_description(NUTCLIENT_t client, const char* dev, const char* cmd); +void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd); .fi .SH "DESCRIPTION" .sp These functions allow to manage instant commands of devices\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_get_device_commands()\fR -function retrieves the list of command names for a device\&. +The \fBnutclient_get_device_commands()\fR function retrieve the list of command names for a device\&. The returned strarr must be freed by \fIstrarr_free\fR\&. .sp -The returned strarr must be freed by -\fIstrarr_free\fR\&. -.RE +The \fBnutclient_has_device_command\fR function test if the specified command is supported by the device\&. Return 1 is supported and 0 if not\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_has_device_command\fR -function tests if the specified command is supported by the device\&. +The \fBnutclient_get_device_command_description\fR function retrieve the command description, if any\&. The resturned string must be freed\&. .sp -Return 1 is supported and 0 if not\&. -.RE +The \fBnutclient_execute_device_command\fR intend to execute the instant command\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_get_device_command_description\fR -function retrieves the command description, if any\&. +\fIdev\fR is the device name\&. .sp -The returned string must be freed\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_execute_device_command\fR -intends to execute the instant command, with an optional parameter\&. -.RE -.sp -Common arguments: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIdev\fR -is the device name\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIcmd\fR -is the instant command name\&. -.RE +\fIcmd\fR is the instant command name\&. .SH "SEE ALSO" .sp \fBlibnutclient\fR(3) \fBlibnutclient_devices\fR(3) \fBlibnutclient_general\fR(3) diff --git a/docs/man/libnutclient_commands.txt b/docs/man/libnutclient_commands.txt index 33a90ca..339fd2c 100644 --- a/docs/man/libnutclient_commands.txt +++ b/docs/man/libnutclient_commands.txt @@ -4,11 +4,9 @@ LIBNUTCLIENT_COMMANDS(3) NAME ---- -libnutclient_commands, nutclient_get_device_commands, -nutclient_has_device_command, nutclient_get_device_command_description, -nutclient_execute_device_command - -Instant command related functions in Network UPS Tools high-level client -access library +libnutclient_commands, nutclient_get_device_commands, nutclient_has_device_command, +nutclient_get_device_command_description, nutclient_execute_device_command - +Instant command related functions in Network UPS Tools high-level client access library SYNOPSIS -------- @@ -17,57 +15,33 @@ SYNOPSIS typedef void* NUTCLIENT_t; - typedef char** strarr; - - strarr nutclient_get_device_commands( - NUTCLIENT_t client, - const char* dev); - - int nutclient_has_device_command( - NUTCLIENT_t client, - const char* dev, const char* cmd); - - char* nutclient_get_device_command_description( - NUTCLIENT_t client, - const char* dev, const char* cmd); - - void nutclient_execute_device_command( - NUTCLIENT_t client, - const char* dev, const char* cmd, - const char* param=""); + strarr nutclient_get_device_commands(NUTCLIENT_t client, const char* dev); + int nutclient_has_device_command(NUTCLIENT_t client, const char* dev, const char* cmd); + char* nutclient_get_device_command_description(NUTCLIENT_t client, const char* dev, const char* cmd); + void nutclient_execute_device_command(NUTCLIENT_t client, const char* dev, const char* cmd); DESCRIPTION ----------- These functions allow to manage instant commands of devices. -* The *nutclient_get_device_commands()* function retrieves - the list of command names for a device. -+ +The *nutclient_get_device_commands()* function retrieve the list of command names for a device. The returned strarr must be freed by 'strarr_free'. -* The *nutclient_has_device_command* function tests if the - specified command is supported by the device. -+ +The *nutclient_has_device_command* function test if the specified command is supported by the device. Return 1 is supported and 0 if not. -* The *nutclient_get_device_command_description* function - retrieves the command description, if any. -+ -The returned string must be freed. +The *nutclient_get_device_command_description* function retrieve the command description, if any. +The resturned string must be freed. -* The *nutclient_execute_device_command* intends to execute - the instant command, with an optional parameter. +The *nutclient_execute_device_command* intend to execute the instant command. -Common arguments: +'dev' is the device name. -* 'dev' is the device name. - -* 'cmd' is the instant command name. +'cmd' is the instant command name. SEE ALSO -------- - linkman:libnutclient[3] linkman:libnutclient_devices[3] linkman:libnutclient_general[3] diff --git a/docs/man/libnutclient_devices.3 b/docs/man/libnutclient_devices.3 index 9e9385e..8fa5be7 100644 --- a/docs/man/libnutclient_devices.3 +++ b/docs/man/libnutclient_devices.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_devices -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBNUTCLIENT_DEVICES" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_DEVICES" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,81 +40,21 @@ typedef void* NUTCLIENT_t; .fi .sp .nf -typedef char** strarr; -.fi -.sp -.nf strarr nutclient_get_devices(NUTCLIENT_t client); -.fi -.sp -.nf int nutclient_has_device(NUTCLIENT_t client, const char* dev); -.fi -.sp -.nf char* nutclient_get_device_description(NUTCLIENT_t client, const char* dev); .fi .SH "DESCRIPTION" .sp These functions allow to manage devices\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_get_devices()\fR -function retrieves the list of devices monitored by a client\&. +The \fBnutclient_get_devices()\fR function retrieve the list of devices monitored by a client\&. The returned strarr must be freed by \fIstrarr_free\fR\&. .sp -The returned strarr must be freed by -\fIstrarr_free\fR\&. -.RE +The \fBnutclient_has_device()\fR function test if a device is monitored by a client\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_has_device()\fR -function tests if a device is monitored by a client\&. -.RE +The \fBnutclient_get_device_description()\fR function retrieve the device description\&. The returned description string must be freed\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The -\fBnutclient_get_device_description()\fR -function retrieves the device description\&. -.sp -The returned description string must be freed\&. -.RE -.sp -Common arguments: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIdev\fR -is the device name\&. -.RE +\fIdev\fR is the device name\&. .SH "SEE ALSO" .sp \fBlibnutclient\fR(3) \fBlibnutclient_commands\fR(3) \fBlibnutclient_devices\fR(3) \fBlibnutclient_general\fR(3) \fBlibnutclient_variables\fR(3) diff --git a/docs/man/libnutclient_devices.txt b/docs/man/libnutclient_devices.txt index 700673f..dd69101 100644 --- a/docs/man/libnutclient_devices.txt +++ b/docs/man/libnutclient_devices.txt @@ -4,10 +4,8 @@ LIBNUTCLIENT_DEVICES(3) NAME ---- -libnutclient_devices, nutclient_get_devices, nutclient_has_device, -nutclient_get_device_description - -Device related functions in Network UPS Tools high-level client access -library +libnutclient_devices, nutclient_get_devices, nutclient_has_device, nutclient_get_device_description - +Device related functions in Network UPS Tools high-level client access library SYNOPSIS -------- @@ -16,12 +14,8 @@ SYNOPSIS typedef void* NUTCLIENT_t; - typedef char** strarr; - strarr nutclient_get_devices(NUTCLIENT_t client); - int nutclient_has_device(NUTCLIENT_t client, const char* dev); - char* nutclient_get_device_description(NUTCLIENT_t client, const char* dev); DESCRIPTION @@ -29,28 +23,21 @@ DESCRIPTION These functions allow to manage devices. -* The *nutclient_get_devices()* function retrieves the list of devices - monitored by a client. -+ +The *nutclient_get_devices()* function retrieve the list of devices monitored by a client. The returned strarr must be freed by 'strarr_free'. -* The *nutclient_has_device()* function tests if a device is monitored - by a client. +The *nutclient_has_device()* function test if a device is monitored by a client. -* The *nutclient_get_device_description()* function retrieves the device - description. -+ +The *nutclient_get_device_description()* function retrieve the device description. The returned description string must be freed. -Common arguments: - -* 'dev' is the device name. +'dev' is the device name. SEE ALSO -------- - linkman:libnutclient[3] linkman:libnutclient_commands[3] linkman:libnutclient_devices[3] linkman:libnutclient_general[3] linkman:libnutclient_variables[3] + diff --git a/docs/man/libnutclient_general.3 b/docs/man/libnutclient_general.3 index 7487cad..132412a 100644 --- a/docs/man/libnutclient_general.3 +++ b/docs/man/libnutclient_general.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_general -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "LIBNUTCLIENT_GENERAL" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_GENERAL" "3" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -49,9 +49,6 @@ typedef char** strarr; .sp .nf strarr strarr_alloc(unsigned short count); -.fi -.sp -.nf void strarr_free(strarr arr); .fi .SH "DESCRIPTION" diff --git a/docs/man/libnutclient_general.txt b/docs/man/libnutclient_general.txt index 7d41acf..909549a 100644 --- a/docs/man/libnutclient_general.txt +++ b/docs/man/libnutclient_general.txt @@ -5,8 +5,7 @@ NAME ---- libnutclient_general, nutclient_destroy, strarr_alloc, strarr_free - -General and utility functions in Network UPS Tools high-level client -access library +General and utility functions in Network UPS Tools high-level client access library SYNOPSIS -------- @@ -20,7 +19,6 @@ SYNOPSIS typedef char** strarr; strarr strarr_alloc(unsigned short count); - void strarr_free(strarr arr); DESCRIPTION @@ -44,5 +42,4 @@ It also frees all pointed strings. SEE ALSO -------- - linkman:libnutclient[3] diff --git a/docs/man/libnutclient_misc.3 b/docs/man/libnutclient_misc.3 index 0485cba..1468970 100644 --- a/docs/man/libnutclient_misc.3 +++ b/docs/man/libnutclient_misc.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_misc -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBNUTCLIENT_MISC" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_MISC" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,7 +28,7 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -libnutclient_misc, nutclient_authenticate, nutclient_logout, nutclient_device_login, nutclient_get_device_num_logins, nutclient_device_master, nutclient_device_forced_shutdown \- Miscellaneous functions in Network UPS Tools high\-level client access library +libnutclient_misc, nutclient_authenticate, nutclient_logout, nutclient_device_login, nutclient_get_device_num_logins, nutclient_device_master, nutclient_device_forced_shutdown \- Miscelaneous functions in Network UPS Tools high\-level client access library .SH "SYNOPSIS" .sp .nf @@ -40,67 +40,28 @@ typedef void* NUTCLIENT_t; .fi .sp .nf -void nutclient_authenticate( - NUTCLIENT_t client, - const char* login, const char* passwd); -.fi -.sp -.nf +void nutclient_authenticate(NUTCLIENT_t client, const char* login, const char* passwd); void nutclient_logout(NUTCLIENT_t client); -.fi -.sp -.nf void nutclient_device_login(NUTCLIENT_t client, const char* dev); -.fi -.sp -.nf int nutclient_get_device_num_logins(NUTCLIENT_t client, const char* dev); -.fi -.sp -.nf -void nutclient_device_primary(NUTCLIENT_t client, const char* dev); -/* OBSOLETED name: */ void nutclient_device_master(NUTCLIENT_t client, const char* dev); -.fi -.sp -.nf void nutclient_device_forced_shutdown(NUTCLIENT_t client, const char* dev); .fi .SH "DESCRIPTION" .sp -The \fBnutclient_authenticate()\fR function authenticates the user\&. +The \fBnutclient_authenticate()\fR function authenticate the user\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIlogin\fR -is the user name\&. -.RE +\fIlogin\fR is the user name\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIpasswd\fR -is the user password\&. -.RE +\fIpasswd\fR is the user password\&. .sp -The \fBnutclient_logout()\fR function disconnects gracefully from the server\&. +The \fBnutclient_logout()\fR function disconnect gracefully from the server\&. .sp -The \fBnutclient_device_login()\fR function logs the fact that a system is drawing power from this UPS\&. +The \fBnutclient_device_login()\fR function log the fact that a system is drawing power from this UPS\&. .sp -The \fBnutclient_get_device_num_logins()\fR function retrieves the number of clients which have been logged for this device\&. +The \fBnutclient_get_device_num_logins()\fR function retrieve the number of clients which have been logged for this device\&. .sp -The \fBnutclient_device_master()\fR and \fBnutclient_device_primary()\fR (note: the former is obsoleted since NUT v2\&.8\&.0 in favor of the latter) functions make sure that primary\-mode functions like FSD are available if necessary\&. +The \fBnutclient_device_master()\fR function make sure that master\-level functions like FSD are available if necessary\&. .sp The \fBnutclient_device_forced_shutdown()\fR function sets the "forced shutdown" flag on the device\&. .sp diff --git a/docs/man/libnutclient_misc.txt b/docs/man/libnutclient_misc.txt index 2635db4..d8b2fef 100644 --- a/docs/man/libnutclient_misc.txt +++ b/docs/man/libnutclient_misc.txt @@ -4,10 +4,10 @@ LIBNUTCLIENT_MISC(3) NAME ---- -libnutclient_misc, nutclient_authenticate, nutclient_logout, -nutclient_device_login, nutclient_get_device_num_logins, +libnutclient_misc, nutclient_authenticate, nutclient_logout, +nutclient_device_login, nutclient_get_device_num_logins, nutclient_device_master, nutclient_device_forced_shutdown - -Miscellaneous functions in Network UPS Tools high-level client access library +Miscelaneous functions in Network UPS Tools high-level client access library SYNOPSIS -------- @@ -16,49 +16,37 @@ SYNOPSIS typedef void* NUTCLIENT_t; - void nutclient_authenticate( - NUTCLIENT_t client, - const char* login, const char* passwd); - + void nutclient_authenticate(NUTCLIENT_t client, const char* login, const char* passwd); void nutclient_logout(NUTCLIENT_t client); - void nutclient_device_login(NUTCLIENT_t client, const char* dev); - int nutclient_get_device_num_logins(NUTCLIENT_t client, const char* dev); - - void nutclient_device_primary(NUTCLIENT_t client, const char* dev); - /* OBSOLETED name: */ void nutclient_device_master(NUTCLIENT_t client, const char* dev); - void nutclient_device_forced_shutdown(NUTCLIENT_t client, const char* dev); DESCRIPTION ----------- -The *nutclient_authenticate()* function authenticates the user. +The *nutclient_authenticate()* function authenticate the user. -* 'login' is the user name. +'login' is the user name. -* 'passwd' is the user password. +'passwd' is the user password. -The *nutclient_logout()* function disconnects gracefully from the server. +The *nutclient_logout()* function disconnect gracefully from the server. -The *nutclient_device_login()* function logs the fact that a system +The *nutclient_device_login()* function log the fact that a system is drawing power from this UPS. -The *nutclient_get_device_num_logins()* function retrieves the number of -clients which have been logged for this device. +The *nutclient_get_device_num_logins()* function retrieve the number of clients +which have been logged for this device. -The *nutclient_device_master()* and *nutclient_device_primary()* (note: -the former is obsoleted since NUT v2.8.0 in favor of the latter) functions -make sure that primary-mode functions like FSD are available if necessary. +The *nutclient_device_master()* function make sure that master-level +functions like FSD are available if necessary. -The *nutclient_device_forced_shutdown()* function sets the "forced shutdown" -flag on the device. +The *nutclient_device_forced_shutdown()* function sets the "forced shutdown" flag on the device. 'dev' is the device name. SEE ALSO -------- - linkman:libnutclient[3] diff --git a/docs/man/libnutclient_tcp.3 b/docs/man/libnutclient_tcp.3 index c341fd1..2c8bc30 100644 --- a/docs/man/libnutclient_tcp.3 +++ b/docs/man/libnutclient_tcp.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_tcp -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBNUTCLIENT_TCP" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_TCP" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,8 +33,6 @@ libnutclient_tcp, nutclient_tcp_create_client, nutclient_tcp_is_connected, nutcl .sp .nf #include -#include /* uint16_t */ -#include /* time_t */ .fi .sp .nf @@ -42,28 +40,12 @@ typedef NUTCLIENT_t NUTCLIENT_TCP_t; .fi .sp .nf -NUTCLIENT_TCP_t nutclient_tcp_create_client( - const char* host, uint16_t port); -.fi -.sp -.nf +NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, unsigned short port); int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client); -.fi -.sp -.nf void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client); -.fi -.sp -.nf int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client); -.fi -.sp -.nf -void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout); -.fi -.sp -.nf -time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); +void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, long timeout); +long nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); .fi .SH "DESCRIPTION" .sp @@ -71,29 +53,9 @@ These functions allow to manage connections to \fBupsd\fR(8) using NUT TCP proto .sp The \fBnutclient_tcp_create_client()\fR function create the \fINUTCLIENT_TCP_t\fR context and intend to connect to upsd at \fIhost\fR and \fIport\fR\&. The context must be freed by \fInutclient_destroy()\fR .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIhost\fR -can be a sever name or a valid IPv4 or IPv6 address like "localhost", "127\&.0\&.0\&.1" or "::1"\&. -.RE +\fIhost\fR can be a sever name or a valid IPv4 or IPv6 adress like "localhost", "127\&.0\&.0\&.1" or "::1"\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIport\fR -is a valid TCP port, generally 3493\&. -.RE +\fIport\fR is a valid TCP port, genrally 3493\&. .sp The \fBnutclient_tcp_is_connected()\fR function test if the connection is valid\&. .sp diff --git a/docs/man/libnutclient_tcp.txt b/docs/man/libnutclient_tcp.txt index 299fce2..4c17300 100644 --- a/docs/man/libnutclient_tcp.txt +++ b/docs/man/libnutclient_tcp.txt @@ -7,64 +7,48 @@ NAME libnutclient_tcp, nutclient_tcp_create_client, nutclient_tcp_is_connected, nutclient_tcp_disconnect, nutclient_tcp_reconnect, nutclient_tcp_set_timeout, nutclient_tcp_get_timeout - -TCP protocol related function for Network UPS Tools high-level client -access library +TCP protocol related function for Network UPS Tools high-level client access library SYNOPSIS -------- #include - #include /* uint16_t */ - #include /* time_t */ typedef NUTCLIENT_t NUTCLIENT_TCP_t; - NUTCLIENT_TCP_t nutclient_tcp_create_client( - const char* host, uint16_t port); - + NUTCLIENT_TCP_t nutclient_tcp_create_client(const char* host, unsigned short port); int nutclient_tcp_is_connected(NUTCLIENT_TCP_t client); - void nutclient_tcp_disconnect(NUTCLIENT_TCP_t client); - int nutclient_tcp_reconnect(NUTCLIENT_TCP_t client); - - void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, time_t timeout); - - time_t nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); + void nutclient_tcp_set_timeout(NUTCLIENT_TCP_t client, long timeout); + long nutclient_tcp_get_timeout(NUTCLIENT_TCP_t client); DESCRIPTION ----------- -These functions allow to manage connections to linkman:upsd[8] -using NUT TCP protocol. +These functions allow to manage connections to linkman:upsd[8] using NUT TCP protocol. -The *nutclient_tcp_create_client()* function create the 'NUTCLIENT_TCP_t' -context and intend to connect to upsd at 'host' and 'port'. -The context must be freed by 'nutclient_destroy()' +The *nutclient_tcp_create_client()* function create the 'NUTCLIENT_TCP_t' context and +intend to connect to upsd at 'host' and 'port'. The context must be freed by 'nutclient_destroy()' -* 'host' can be a sever name or a valid IPv4 or IPv6 address like -"localhost", "127.0.0.1" or "::1". +'host' can be a sever name or a valid IPv4 or IPv6 adress like "localhost", "127.0.0.1" or "::1". -* 'port' is a valid TCP port, generally 3493. +'port' is a valid TCP port, genrally 3493. The *nutclient_tcp_is_connected()* function test if the connection is valid. -The *nutclient_tcp_disconnect()* function force to disconnect the specified -connection. +The *nutclient_tcp_disconnect()* function force to disconnect the specified connection. The *nutclient_tcp_reconnect()* function force to reconnect a connection, disconnecting it if needed. -The *nutclient_tcp_set_timeout()* function set the timeout duration -for I/O operations. +The *nutclient_tcp_set_timeout()* function set the timeout duration for I/O operations. -The *nutclient_tcp_get_timeout()* function retrieve the timeout duration -for I/O operations. +The *nutclient_tcp_get_timeout()* function retrieve the timeout duration for I/O operations. 'timeout' values are specified in seconds, negatives values for blocking. SEE ALSO -------- - linkman:libnutclient[3] linkman:libnutclient_general[3] diff --git a/docs/man/libnutclient_variables.3 b/docs/man/libnutclient_variables.3 index ba2039e..b86b921 100644 --- a/docs/man/libnutclient_variables.3 +++ b/docs/man/libnutclient_variables.3 @@ -1,13 +1,13 @@ '\" t .\" Title: libnutclient_variables -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBNUTCLIENT_VARIABL" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBNUTCLIENT_VARIABL" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,110 +40,39 @@ typedef void* NUTCLIENT_t; .fi .sp .nf -typedef char** strarr; -.fi -.sp -.nf -strarr nutclient_get_device_variables(NUTCLIENT_t client, - const char* dev); -.fi -.sp -.nf -strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, - const char* dev); -.fi -.sp -.nf -int nutclient_has_device_variable(NUTCLIENT_t client, - const char* dev, const char* var); -.fi -.sp -.nf -char* nutclient_get_device_variable_description(NUTCLIENT_t client, - const char* dev, const char* var); -.fi -.sp -.nf -strarr nutclient_get_device_variable_values(NUTCLIENT_t client, - const char* dev, const char* var); -.fi -.sp -.nf -void nutclient_set_device_variable_value(NUTCLIENT_t client, - const char* dev, const char* var, const char* value); -.fi -.sp -.nf -void nutclient_set_device_variable_values(NUTCLIENT_t client, - const char* dev, const char* var, const strarr values); +strarr nutclient_get_device_variables(NUTCLIENT_t client, const char* dev); +strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, const char* dev); +int nutclient_has_device_variable(NUTCLIENT_t client, const char* dev, const char* var); +char* nutclient_get_device_variable_description(NUTCLIENT_t client, const char* dev, const char* var); +strarr nutclient_get_device_variable_values(NUTCLIENT_t client, const char* dev, const char* var); +void nutclient_set_device_variable_value(NUTCLIENT_t client, const char* dev, const char* var, const char* value); +void nutclient_set_device_variable_values(NUTCLIENT_t client, const char* dev, const char* var, const strarr values); .fi .SH "DESCRIPTION" .sp These functions allow to manage variables of devices\&. .sp -The \fBnutclient_get_device_variables()\fR function retrieves the list of variables names for a device\&. The returned strarr must be freed by \fIstrarr_free\fR\&. +The \fBnutclient_get_device_variables()\fR function retrieve the list of variables names for a device\&. The returned strarr must be freed by \fIstrarr_free\fR\&. .sp -The \fBnutclient_get_device_rw_variables\fR function retrieves the list of read\-write variables names for a device\&. The returned strarr must be freed by \fIstrarr_free\fR\&. +The \fBnutclient_get_device_rw_variables\fR function retrieve the list of read\-write variables names for a device\&. The returned strarr must be freed by \fIstrarr_free\fR\&. .sp -The \fBnutclient_has_device_variable\fR function tests if the specified variable is supported by the device\&. Return 1 is supported and 0 if not\&. +The \fBnutclient_has_device_variable\fR function test if the specified variable is supported by the device\&. Return 1 is supported and 0 if not\&. .sp -The \fBnutclient_get_device_variable_description\fR function retrieves the variable description, if any\&. The returned string must be freed\&. +The \fBnutclient_get_device_variable_description\fR function retrieve the variable description, if any\&. The resturned string must be freed\&. .sp The \fBnutclient_get_device_variable_values\fR returns variable values (generally only one)\&. The returned strarr must be freed by \fIstrarr_free\fR\&. .sp -The \fBnutclient_set_device_variable_value\fR intends to set the value of the specified variable\&. +The \fBnutclient_set_device_variable_value\fR intend to set the value of the specified variable\&. .sp -The \fBnutclient_set_device_variable_values\fR intends to set multiple values of the specified variable\&. +The \fBnutclient_set_device_variable_values\fR intend to set multiple values of the specified variable\&. .sp -Common arguments: +\fIdev\fR is the device name\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIdev\fR -is the device name\&. -.RE +\fIvar\fR is the variable name\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIvar\fR -is the variable name\&. -.RE +\fIvalue\fR is the variable value\&. .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIvalue\fR -is the variable value\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fIvalues\fR -is the variable array of values\&. -.RE +\fIvalues\fR is the variable array of values\&. .SH "SEE ALSO" .sp \fBlibnutclient\fR(3) \fBlibnutclient_devices\fR(3) \fBlibnutclient_general\fR(3) diff --git a/docs/man/libnutclient_variables.txt b/docs/man/libnutclient_variables.txt index fbeeb3d..2e84c79 100644 --- a/docs/man/libnutclient_variables.txt +++ b/docs/man/libnutclient_variables.txt @@ -6,11 +6,9 @@ NAME libnutclient_variables, nutclient_get_device_variables, nutclient_get_device_rw_variables, nutclient_has_device_variable, -nutclient_get_device_variable_description, -nutclient_get_device_variable_values, +nutclient_get_device_variable_description, nutclient_get_device_variable_values, nutclient_set_device_variable_value, nutclient_set_device_variable_values - -Variable related functions in Network UPS Tools high-level client access -library +Variable related functions in Network UPS Tools high-level client access library SYNOPSIS -------- @@ -19,73 +17,48 @@ SYNOPSIS typedef void* NUTCLIENT_t; - typedef char** strarr; - - strarr nutclient_get_device_variables(NUTCLIENT_t client, - const char* dev); - - strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, - const char* dev); - - int nutclient_has_device_variable(NUTCLIENT_t client, - const char* dev, const char* var); - - char* nutclient_get_device_variable_description(NUTCLIENT_t client, - const char* dev, const char* var); - - strarr nutclient_get_device_variable_values(NUTCLIENT_t client, - const char* dev, const char* var); - - void nutclient_set_device_variable_value(NUTCLIENT_t client, - const char* dev, const char* var, const char* value); - - void nutclient_set_device_variable_values(NUTCLIENT_t client, - const char* dev, const char* var, const strarr values); + strarr nutclient_get_device_variables(NUTCLIENT_t client, const char* dev); + strarr nutclient_get_device_rw_variables(NUTCLIENT_t client, const char* dev); + int nutclient_has_device_variable(NUTCLIENT_t client, const char* dev, const char* var); + char* nutclient_get_device_variable_description(NUTCLIENT_t client, const char* dev, const char* var); + strarr nutclient_get_device_variable_values(NUTCLIENT_t client, const char* dev, const char* var); + void nutclient_set_device_variable_value(NUTCLIENT_t client, const char* dev, const char* var, const char* value); + void nutclient_set_device_variable_values(NUTCLIENT_t client, const char* dev, const char* var, const strarr values); DESCRIPTION ----------- These functions allow to manage variables of devices. -The *nutclient_get_device_variables()* function retrieves the list -of variables names for a device. +The *nutclient_get_device_variables()* function retrieve the list of variables names for a device. The returned strarr must be freed by 'strarr_free'. -The *nutclient_get_device_rw_variables* function retrieves the list -of read-write variables names for a device. +The *nutclient_get_device_rw_variables* function retrieve the list of read-write variables names for a device. The returned strarr must be freed by 'strarr_free'. -The *nutclient_has_device_variable* function tests if the specified -variable is supported by the device. +The *nutclient_has_device_variable* function test if the specified variable is supported by the device. Return 1 is supported and 0 if not. -The *nutclient_get_device_variable_description* function retrieves -the variable description, if any. -The returned string must be freed. +The *nutclient_get_device_variable_description* function retrieve the variable description, if any. +The resturned string must be freed. -The *nutclient_get_device_variable_values* returns variable values -(generally only one). +The *nutclient_get_device_variable_values* returns variable values (generally only one). The returned strarr must be freed by 'strarr_free'. -The *nutclient_set_device_variable_value* intends to set the value -of the specified variable. +The *nutclient_set_device_variable_value* intend to set the value of the specified variable. -The *nutclient_set_device_variable_values* intends to set multiple -values of the specified variable. +The *nutclient_set_device_variable_values* intend to set multiple values of the specified variable. -Common arguments: +'dev' is the device name. -* 'dev' is the device name. +'var' is the variable name. -* 'var' is the variable name. +'value' is the variable value. -* 'value' is the variable value. - -* 'values' is the variable array of values. +'values' is the variable array of values. SEE ALSO -------- - linkman:libnutclient[3] linkman:libnutclient_devices[3] linkman:libnutclient_general[3] diff --git a/docs/man/libupsclient-config.1 b/docs/man/libupsclient-config.1 index bf0bf06..f081c77 100644 --- a/docs/man/libupsclient-config.1 +++ b/docs/man/libupsclient-config.1 @@ -1,13 +1,13 @@ '\" t .\" Title: libupsclient-config .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "LIBUPSCLIENT\-CONFIG" "1" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIBUPSCLIENT\-CONFIG" "1" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/libupsclient-config.txt b/docs/man/libupsclient-config.txt index 526276c..730a5b2 100644 --- a/docs/man/libupsclient-config.txt +++ b/docs/man/libupsclient-config.txt @@ -4,12 +4,10 @@ LIBUPSCLIENT-CONFIG(1) NAME ---- -libupsclient-config - script to get information about the installed -version of libupsclient +libupsclient-config - script to get information about the installed version of libupsclient SYNOPSIS -------- - *libupsclient-config* [--version] [--libs] [--cflags] DESCRIPTION @@ -17,7 +15,7 @@ DESCRIPTION *libupsclient-config* is a tool that is used to determine the compiler and linker flags that should be used to compile and link programs that use -*libupsclient* from the Network UPS Tools project. +*libupsclient* from the Network UPS Tools project. OPTIONS ------- @@ -35,7 +33,6 @@ Print the compiler flags that are necessary to compile a *libupsclient* program. AUTHORS ------- - This manual page was written by Arnaud Quette . SEE ALSO @@ -45,5 +42,5 @@ linkman:upsclient[3] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ + diff --git a/docs/man/liebert-esp2.8 b/docs/man/liebert-esp2.8 index 829d00a..f052acf 100644 --- a/docs/man/liebert-esp2.8 +++ b/docs/man/liebert-esp2.8 @@ -1,13 +1,13 @@ '\" t .\" Title: liebert-esp2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "LIEBERT\-ESP2" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIEBERT\-ESP2" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,27 +32,9 @@ liebert-esp2 \- Driver for Liebert UPS, using the ESP\-II serial protocol .SH "NOTE" .sp This man page only documents the hardware\-specific features of the liebert\-esp2 driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "SPECIAL CABLING NOTE" -.sp -Be aware that an RS\-232 cable with ONLY the RX, TX and ground pin must be used when interfacing with GXT2 series UPS units (and possibly others), since the handshaking lines are used for purposes other than RS\-232 flow control\&. Use of a standard RS\-232 cable with full handshaking may result in undesired operation and/or shutdown\&. It is therefore advisable to confirm the proper cable/wiring with the diagram provided in the manual with your UPS\&. .SH "SUPPORTED HARDWARE" .sp -Tested to work on the following units: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Liebert GXT2\-6000RT208 -.RE -.sp This is an experimental driver\&. You have been warned\&. -.sp -This driver currently does not support modification of configuration parameters, such as the low battery warning time and automatic restart policy\&. .SH "EXTRA ARGUMENTS" .sp This driver supports the following optional settings in \fBups.conf\fR(5): @@ -61,40 +43,9 @@ This driver supports the following optional settings in \fBups.conf\fR(5): .RS 4 Set the speed of the serial connection \- 1200, 2400 (default), 4800, 9600 or 19200\&. .RE -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Richard Gregory -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arjen de Korte -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Nash Kaminski -.RE +Richard Gregory , Arjen de Korte .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/liebert-esp2.txt b/docs/man/liebert-esp2.txt index e71fb72..e34fb06 100644 --- a/docs/man/liebert-esp2.txt +++ b/docs/man/liebert-esp2.txt @@ -1,40 +1,21 @@ LIEBERT-ESP2(8) ============== -NAME +NAME ---- liebert-esp2 - Driver for Liebert UPS, using the ESP-II serial protocol NOTE ---- - This man page only documents the hardware-specific features of the -liebert-esp2 driver. For information about the core driver, see +liebert-esp2 driver. For information about the core driver, see linkman:nutupsdrv[8]. -SPECIAL CABLING NOTE --------------------- - -Be aware that an RS-232 cable with ONLY the RX, TX and ground pin -must be used when interfacing with GXT2 series UPS units (and possibly others), -since the handshaking lines are used for purposes other than RS-232 flow control. -Use of a standard RS-232 cable with full handshaking may result in -undesired operation and/or shutdown. It is therefore advisable to confirm -the proper cable/wiring with the diagram provided in the manual with your UPS. - SUPPORTED HARDWARE ------------------ - -Tested to work on the following units: - -* Liebert GXT2-6000RT208 - This is an experimental driver. You have been warned. -This driver currently does not support modification of configuration parameters, -such as the low battery warning time and automatic restart policy. - EXTRA ARGUMENTS --------------- @@ -43,22 +24,17 @@ This driver supports the following optional settings in linkman:ups.conf[5]: *baudrate=*'num':: Set the speed of the serial connection - 1200, 2400 (default), 4800, 9600 or 19200. -AUTHORS -------- - -* Richard Gregory -* Arjen de Korte -* Nash Kaminski +AUTHOR +------ +Richard Gregory , Arjen de Korte SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/liebert.8 b/docs/man/liebert.8 index d4fc4b6..4a3b7ca 100644 --- a/docs/man/liebert.8 +++ b/docs/man/liebert.8 @@ -1,13 +1,13 @@ '\" t .\" Title: liebert -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "LIEBERT" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "LIEBERT" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/liebert.txt b/docs/man/liebert.txt index b913659..dfaa795 100644 --- a/docs/man/liebert.txt +++ b/docs/man/liebert.txt @@ -8,14 +8,12 @@ liebert - Driver for Liebert contact-closure UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the liebert driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports some Liebert UPS equipment with a contact-closure interface. This includes the UPStation GXT2 with their contact-closure cable. The smart mode ("Multilink") cable is not supported by this @@ -44,10 +42,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/macosx-ups.8 b/docs/man/macosx-ups.8 index b726d06..d8e933a 100644 --- a/docs/man/macosx-ups.8 +++ b/docs/man/macosx-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: macosx-ups -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHORS" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "MACOSX\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "MACOSX\-UPS" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,12 +39,14 @@ This man page only documents the hardware\-specific features of the \fBmacosx\-u If the UPS is visible in the Energy Saver preferences pane of System Preferences, this driver should be able to monitor it\&. .SH "EXTRA ARGUMENTS" .PP -\fBport\fR=auto +\fBport\fR=\fIregex\fR .RS 4 -Due to changes in the way that Mac OS X lists power sources, the +The \fBport\fR -parameter no longer has any effect\&. The rest of NUT still requires a value here, and our traditional "don\(cqt care" value is -auto\&. +parameter in the configuration file can be a case\-insensitive extended regular expression (see +\fBregex\fR(3) for details) to match against specific UPS and battery names\&. +.sp +The traditional NUT auto\-detection value of "auto" will be changed to "/UPS"\&. To test this driver against the internal battery of a laptop, a value such as "battery" can be used\&. .RE .PP \fBmodel\fR=\fIregex\fR @@ -63,7 +65,7 @@ This driver is a monitoring\-only driver, and cannot shut down an UPS on its own The default distribution of \fBapcupsd\fR installs a kernel extension which prevents Mac OS X from attaching to the UPS\&. In order to use this driver after installing apcupsd, you must first run the apcupsd\-uninstall script and reboot\&. .sp Note that other UPS monitoring solutions may show more detail than what is provided by the built\-in Mac OS X driver\&. In particular, voltages other than the battery voltage, as well as current and frequency, are typically not shown\&. It may be possible to monitor these values with \fBapcupsd\fR (for APC hardware only) or \fBusbhid-ups\fR(8)\&. -.SH "AUTHOR" +.SH "AUTHORS" .sp Charles Lepple .SH "SEE ALSO" @@ -74,26 +76,6 @@ Charles Lepple \fBnutupsdrv\fR(8) .SS "Internet resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The apcupsd home page: -http://www\&.apcupsd\&.org/ -.RE +The apcupsd home page: http://www\&.apcupsd\&.org/ diff --git a/docs/man/macosx-ups.txt b/docs/man/macosx-ups.txt index 2338be2..9202f5b 100644 --- a/docs/man/macosx-ups.txt +++ b/docs/man/macosx-ups.txt @@ -3,19 +3,16 @@ MACOSX-UPS(8) NAME ---- - macosx-ups - monitor for Mac OS X built-in UPS and battery driver NOTE ---- - This man page only documents the hardware-specific features of the *macosx-ups* driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - *macosx-ups* supports any USB HID Power Device Class (PDC) UPS which is matched by the Mac OS X built-in drivers. It also can monitor a laptop internal battery as though it were an UPS. @@ -26,17 +23,40 @@ Preferences, this driver should be able to monitor it. EXTRA ARGUMENTS ---------------- - -*port*=auto:: -Due to changes in the way that Mac OS X lists power sources, the *port* -parameter no longer has any effect. The rest of NUT still requires a value here, -and our traditional "don't care" value is `auto`. +*port*='regex':: +The *port* parameter in the configuration file can be a case-insensitive +extended regular expression (see *regex*(3) for details) to match against +specific UPS and battery names. ++ +The traditional NUT auto-detection value of "auto" will be changed to "/UPS". +To test this driver against the internal battery of a laptop, a value such as +"battery" can be used. *model*='regex':: Likewise, if you have more than one UPS, it may be necessary to specify a *model* name to match against. This parameter is also a case-insensitive extended regular expression. +////////////////////////////////////////// +This driver also supports the following optional settings: + +*option1*='num':: +Set the value of ... to 'num'. Contrast with *option2*. + +*option2*='string':: +Some other option. +////////////////////////////////////////// + +////////////////////////////////////////// +Optional: list supported instant commands here: + +INSTANT COMMANDS +---------------- + +*instcmd1*:: +Command 1. +////////////////////////////////////////// + DIAGNOSTICS ----------- @@ -64,9 +84,8 @@ the battery voltage, as well as current and frequency, are typically not shown. It may be possible to monitor these values with *apcupsd* (for APC hardware only) or linkman:usbhid-ups[8]. -AUTHOR ------- - +AUTHORS +------- Charles Lepple SEE ALSO @@ -76,11 +95,10 @@ linkman:usbhid-ups[8], *pmset*(8), *regex*(3) The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The apcupsd home page: http://www.apcupsd.org/ +The apcupsd home page: http://www.apcupsd.org/ diff --git a/docs/man/masterguard.8 b/docs/man/masterguard.8 index 072a1cb..fe49c79 100644 --- a/docs/man/masterguard.8 +++ b/docs/man/masterguard.8 @@ -1,13 +1,13 @@ '\" t .\" Title: masterguard .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "MASTERGUARD" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "MASTERGUARD" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,14 +32,9 @@ masterguard \- Driver for Masterguard UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the masterguard driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "NOTE" -.sp -Please note that this driver is deprecated and will not receive new development\&. If it works for managing your devices \(em fine, but if you are running it to try setting up a new device, please consider the newer \fBnutdrv_qx\fR(8) instead, which should handle all \fIQ*\fR protocol variants for NUT\&. -.sp -Please do also report if your device works with this driver, but \fBnutdrv_qx\fR(8) would not actually support it with any subdriver! .SH "SUPPORTED HARDWARE" .sp -This driver supports Masterguard UPS equipment (serial connection only)\&. +This driver supports Masterguard UPS equipment\&. .SH "EXTRA ARGUMENTS" .PP \fBCS\fR @@ -50,9 +45,6 @@ Cancel the shutdown procedure\&. .sp Michael Spanier .SH "SEE ALSO" -.SS "Newer driver:" -.sp -\fBnutdrv_qx\fR(8) .SS "The core driver:" .sp \fBnutupsdrv\fR(8) diff --git a/docs/man/masterguard.txt b/docs/man/masterguard.txt index 373fc2f..0820025 100644 --- a/docs/man/masterguard.txt +++ b/docs/man/masterguard.txt @@ -3,33 +3,17 @@ MASTERGUARD(8) NAME ---- - masterguard - Driver for Masterguard UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the masterguard driver. For information about the core driver, see linkman:nutupsdrv[8]. -NOTE ----- - -Please note that this driver is deprecated and will not receive -new development. If it works for managing your devices -- fine, -but if you are running it to try setting up a new device, please -consider the newer linkman:nutdrv_qx[8] instead, which should -handle all 'Q*' protocol variants for NUT. - -Please do also report if your device works with this driver, -but linkman:nutdrv_qx[8] would not actually support it with any -subdriver! - SUPPORTED HARDWARE ------------------ - -This driver supports Masterguard UPS equipment (serial connection only). +This driver supports Masterguard UPS equipment. EXTRA ARGUMENTS --------------- @@ -39,23 +23,15 @@ Cancel the shutdown procedure. AUTHOR ------ - Michael Spanier SEE ALSO -------- -Newer driver: -~~~~~~~~~~~~~ - -linkman:nutdrv_qx[8] - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/metasys.8 b/docs/man/metasys.8 index 3e4ae30..073648f 100644 --- a/docs/man/metasys.8 +++ b/docs/man/metasys.8 @@ -1,13 +1,13 @@ '\" t .\" Title: metasys .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "METASYS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "METASYS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/metasys.txt b/docs/man/metasys.txt index d134fe5..4a6fc2e 100644 --- a/docs/man/metasys.txt +++ b/docs/man/metasys.txt @@ -1,7 +1,7 @@ METASYS(8) ========== -NAME +NAME ---- metasys - Driver for Meta System UPS equipment @@ -10,7 +10,7 @@ NOTE ---- This man page only documents the hardware-specific features of the -metasys driver. For information about the core driver, see +metasys driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE @@ -32,19 +32,16 @@ The driver should support all the common features of the ups models: CABLING ------- - The needed cable is a standard pin-to-pin serial cable with at least pins 2, 3, and 5 (on DB9 connector) connected. EXTRA ARGUMENTS --------------- - This driver supports no extra arguments from linkman:ups.conf[5]. BUGS ---- - -This driver has been tested on Meta System HF Millennium 820 and +This driver has been tested on Meta System HF Millennium 820 and ally HF 1000 only. Any information about the use of the driver with the other listed @@ -52,7 +49,6 @@ UPS are really welcome. AUTHOR ------ - Fabio Di Niro SEE ALSO @@ -60,10 +56,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/mge-shut.8 b/docs/man/mge-shut.8 index 4e7d572..5899482 100644 --- a/docs/man/mge-shut.8 +++ b/docs/man/mge-shut.8 @@ -1,13 +1,13 @@ '\" t .\" Title: mge-shut .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "MGE\-SHUT" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "MGE\-SHUT" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -89,7 +89,7 @@ The default value is 30 (in seconds)\&. Usually this \fBmust be greater\fR than offdelay, but the driver will \fBnot\fR -warn you upon startup if it isn\(cqt\&. Some UPSes will restart no matter what, even if the power is (still) out at the moment this timer elapses\&. In that case, you could try if setting +warn you upon startup if it isn\(cqt\&. Some UPS\(cqes will restart no matter what, even if the power is (still) out at the moment this timer elapses\&. In that case, you could try if setting \fIondelay = \-1\fR in \fBups\&.conf\fR diff --git a/docs/man/mge-shut.txt b/docs/man/mge-shut.txt index 91d96b7..d8e19c3 100644 --- a/docs/man/mge-shut.txt +++ b/docs/man/mge-shut.txt @@ -1,4 +1,4 @@ -MGE-SHUT(8) +MGE-SHUT(8) =========== NAME @@ -44,7 +44,7 @@ sent (via the *-k* switch). + The default value is 20 (in seconds). Usually this *must be lower* than 'ondelay', but the driver will *not* warn you upon startup if it isn't. - + *ondelay*='num':: Set the timer for the UPS to switch on in case the power returns after the kill power command had been sent but before the actual switch off. This @@ -53,7 +53,7 @@ a power failure. + The default value is 30 (in seconds). Usually this *must be greater* than offdelay, but the driver will *not* warn you upon startup if it -isn't. Some UPSes will restart no matter what, even if the power is +isn't. Some UPS'es will restart no matter what, even if the power is (still) out at the moment this timer elapses. In that case, you could try if setting 'ondelay = -1' in *ups.conf* helps. + @@ -90,10 +90,8 @@ SEE ALSO The core driver ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/mge-utalk.8 b/docs/man/mge-utalk.8 index e84fc4f..1b0a80a 100644 --- a/docs/man/mge-utalk.8 +++ b/docs/man/mge-utalk.8 @@ -1,13 +1,13 @@ '\" t .\" Title: mge-utalk -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "MGE\-UTALK" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "MGE\-UTALK" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -54,93 +54,22 @@ This man page only documents the hardware\-specific features of the mge\-utalk d .sp mge\-utalk supports the following legacy units, using the MGE UTalk protocol: .sp +.if n \{\ .RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c .\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Pulsar ESV+ +.nf +Pulsar ESV+, +Pulsar ES+, +Pulsar EL, +Pulsar EX, +Pulsar EXtreme, +Comet EXtreme, +Comet (Utalk Serial Card, ref 66060), +Galaxy (Utalk Serial Card, ref 66060)\&. +.fi +.if n \{\ .RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c .\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Pulsar ES+ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Pulsar EL -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Pulsar EX -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Pulsar EXtreme -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Comet EXtreme -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Comet (Utalk Serial Card, ref 66060) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Galaxy (Utalk Serial Card, ref 66060) -.RE .sp This driver also support some newer models with backward UTalk compatibility, such as Pulsar Evolution and Pulsar EXtreme C\&. As these models also support the SHUT protocol, prefer mge\-shut for serial communication, or use the USB port, if available, with the usbhid\-ups driver\&. .SH "EXTRA ARGUMENTS" @@ -179,84 +108,9 @@ Set this flag if you are running Linux on an Oldworld Macintosh box (all beige A .SS "Repetitive timeout and staleness" .sp Older models, such as ES/ESV ones, might report repetitive "data stale" errors\&. This is due to the fact that these models don\(cqt support too much polling\&. To solve this problem, add "pollinterval=20" in ups\&.conf, and change the value of MAXAGE to 25 in upsd\&.conf, and DEADTIME to 25 in upsmon\&.conf\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Hans Ekkehard Plesser -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arnaud Quette -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Martin Loyer -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Patrick Agrain -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Nicholas Reilly -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Dave Abbott -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Marek Kralewski -.RE +Hans Ekkehard Plesser, Arnaud Quette, Martin Loyer, Patrick Agrain, Nicholas Reilly, Dave Abbott, Marek Kralewski .SH "SEE ALSO" .SS "The core driver" .sp diff --git a/docs/man/mge-utalk.txt b/docs/man/mge-utalk.txt index 4dd0384..ef11baa 100644 --- a/docs/man/mge-utalk.txt +++ b/docs/man/mge-utalk.txt @@ -1,4 +1,4 @@ -MGE-UTALK(8) +MGE-UTALK(8) ============ NAME @@ -14,7 +14,7 @@ SYNOPSIS *mge-utalk* -a 'UPS_NAME' ['OPTIONS'] NOTE: This man page only documents the hardware-specific features of the -mge-utalk driver. For information about the core driver, see +mge-utalk driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE @@ -22,14 +22,14 @@ SUPPORTED HARDWARE mge-utalk supports the following legacy units, using the MGE UTalk protocol: -* Pulsar ESV+ -* Pulsar ES+ -* Pulsar EL -* Pulsar EX -* Pulsar EXtreme -* Comet EXtreme -* Comet (Utalk Serial Card, ref 66060) -* Galaxy (Utalk Serial Card, ref 66060) + Pulsar ESV+, + Pulsar ES+, + Pulsar EL, + Pulsar EX, + Pulsar EXtreme, + Comet EXtreme, + Comet (Utalk Serial Card, ref 66060), + Galaxy (Utalk Serial Card, ref 66060). This driver also support some newer models with backward UTalk compatibility, such as Pulsar Evolution and Pulsar EXtreme C. As these models also support @@ -75,26 +75,24 @@ This is due to the fact that these models don't support too much polling. To solve this problem, add "pollinterval=20" in ups.conf, and change the value of MAXAGE to 25 in upsd.conf, and DEADTIME to 25 in upsmon.conf. -AUTHORS -------- +AUTHOR +------ -* Hans Ekkehard Plesser -* Arnaud Quette -* Martin Loyer -* Patrick Agrain -* Nicholas Reilly -* Dave Abbott -* Marek Kralewski +Hans Ekkehard Plesser, +Arnaud Quette, +Martin Loyer, +Patrick Agrain, +Nicholas Reilly, +Dave Abbott, +Marek Kralewski SEE ALSO -------- The core driver ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/microdowell.8 b/docs/man/microdowell.8 index 8cfe267..9724e8e 100644 --- a/docs/man/microdowell.8 +++ b/docs/man/microdowell.8 @@ -1,13 +1,13 @@ '\" t .\" Title: microdowell .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "MICRODOWELL" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "MICRODOWELL" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/microdowell.txt b/docs/man/microdowell.txt index a23ead2..9277379 100644 --- a/docs/man/microdowell.txt +++ b/docs/man/microdowell.txt @@ -15,9 +15,8 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - -This driver was developed for the Enterprise Nxx and Bxx models. -Other Microdowell models may work, too. +This driver was developed for the Enterprise Nxx and Bxx models. Other +Microdowell models may work, too. EXTRA ARGUMENTS --------------- @@ -27,7 +26,6 @@ linkman:ups.conf[5]. AUTHOR ------ - Elio Corbolante SEE ALSO @@ -35,10 +33,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/microsol-apc.8 b/docs/man/microsol-apc.8 deleted file mode 100644 index 4d06ad0..0000000 --- a/docs/man/microsol-apc.8 +++ /dev/null @@ -1,146 +0,0 @@ -'\" t -.\" Title: microsol-apc -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "MICROSOL\-APC" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -microsol-apc \- Driver for APC Back\-UPS BR UPS equipment -.SH "NOTE" -.sp -This man page only documents the hardware\-specific features of the microsol\-apc driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "SUPPORTED HARDWARE" -.sp -This driver supports the following UPS models: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -APC Back\-UPS BZ1500\-BR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -APC Back\-UPS BZ2200I\-BR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -APC Back\-UPS BZ2200BI\-BR -.RE -.sp -In 2009, Schneider Electric acquired Microsol Technologies, and by 2012, the entire Microsol line was being sold under the APC brand\&. This driver supports these newer, APC\-branded models\&. Older equipment should use \fBsolis\fR(8)\&. -.SH "EXTRA ARGUMENTS" -.sp -This driver support the following extra optional settings in the \fBups.conf\fR(5)\&. -.sp -\fBbattext = n\fR \- (default = 0, no extra battery, where n = Ampere*hour ) -.sp -\fBprgshut = 1\fR \- (default = 0, no programmable shutdown ) -.SH "COMMANDS" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -shutdown\&.return \- Shut down in \&.3 minutes and restart in \&.3 minutes -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -shutdown\&.stayoff \- Shut down in \&.3 minutes and do not return -.RE -.SH "ISSUES" -.sp -For other APC\-Microsol models, the reported voltages, currents and power will be incorrect, as the communication protocol reports unprocessed data instead of real values, needing model\-specific post\-processing by the driver\&. Monitoring of UPS state (on\-battery/on\-line, critical battery) should work for other models, but is untested\&. -.SH "AUTHORS" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Ygor A\&. S\&. Regados -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Roberto P\&. Velloso -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Silvino B\&. Magalhães -.RE -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/microsol-apc.txt b/docs/man/microsol-apc.txt deleted file mode 100644 index 74e3225..0000000 --- a/docs/man/microsol-apc.txt +++ /dev/null @@ -1,73 +0,0 @@ -MICROSOL-APC(8) -=============== - -NAME ----- - -microsol-apc - Driver for APC Back-UPS BR UPS equipment - -NOTE ----- - -This man page only documents the hardware-specific features of the -microsol-apc driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This driver supports the following UPS models: - - * APC Back-UPS BZ1500-BR - * APC Back-UPS BZ2200I-BR - * APC Back-UPS BZ2200BI-BR - -In 2009, Schneider Electric acquired Microsol Technologies, and by 2012, the -entire Microsol line was being sold under the APC brand. This driver supports -these newer, APC-branded models. Older equipment should use linkman:solis[8]. - -EXTRA ARGUMENTS ---------------- - -This driver support the following extra optional settings in the -linkman:ups.conf[5]. - -*battext = n* - (default = 0, no extra battery, where n = Ampere*hour ) - -*prgshut = 1* - (default = 0, no programmable shutdown ) - -COMMANDS --------- - - * shutdown.return - Shut down in .3 minutes and restart in .3 minutes - - * shutdown.stayoff - Shut down in .3 minutes and do not return - -ISSUES ------- - -For other APC-Microsol models, the reported voltages, currents and power will -be incorrect, as the communication protocol reports unprocessed data instead of -real values, needing model-specific post-processing by the driver. Monitoring -of UPS state (on-battery/on-line, critical battery) should work for other -models, but is untested. - -AUTHORS -------- - -* Ygor A. S. Regados -* Roberto P. Velloso -* Silvino B. Magalhães - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/netxml-ups.8 b/docs/man/netxml-ups.8 index ebb1a93..88e4d22 100644 --- a/docs/man/netxml-ups.8 +++ b/docs/man/netxml-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: netxml-ups .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 10/30/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NETXML\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NETXML\-UPS" "8" "10/30/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ netxml-ups \- Driver for Eaton / MGE Network Management Card / Proxy (XML/HTTP P This man page only documents the hardware\-specific features of the netxml\-ups driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -netxml\-ups supports all recent Eaton / MGE models which use a Network Management Card or Proxy (MGE XML/HTTP protocol based)\&. This applies to both Eaton (previously MGE Office Protection Systems) and to MGE UPS SYSTEMS\&. Supported card and proxy models are: +netxml\-ups support all recent Eaton / MGE models which use a Network Management Card or Proxy (MGE XML/HTTP protocol based)\&. This applies to both Eaton (previously MGE Office Protection Systems) and to MGE UPS SYSTEMS\&. Supported card and proxy models are: .sp .RS 4 .ie n \{\ @@ -142,11 +142,6 @@ Set the shutdown timer, in seconds\&. After \fIvalue\fR seconds running on battery, the local system will receive a notification to shutdown\&. Defaults to "none" (disabled)\&. .RE -.PP -\fBdo_convert_deci\fR -.RS 4 -If this flag value is present, the driver assumes you have a very old MGE networked UPS (or rather an old network management card firmware) which serves certain measurements spelled 10x too big in the XML markup\&. Originally such measurements were decimated by the driver \(em but this is wrong for newer, more sane, devices \(em so this behavior was deprecated and is now disabled by default\&. Enabling this flag in configuration of a particular driver instance restores the old behavior for those measurements\&. -.RE .SH "IMPLEMENTATION" .sp The hostname of the UPS is specified with the "port" value in \fBups\&.conf\fR, i\&.e\&.: diff --git a/docs/man/netxml-ups.txt b/docs/man/netxml-ups.txt index acc672e..86c86dc 100644 --- a/docs/man/netxml-ups.txt +++ b/docs/man/netxml-ups.txt @@ -1,23 +1,20 @@ netxml-ups(8) ============= -NAME +NAME ---- - netxml-ups - Driver for Eaton / MGE Network Management Card / Proxy (XML/HTTP Protocol) equipment NOTE ---- - This man page only documents the hardware-specific features of the -netxml-ups driver. For information about the core driver, see +netxml-ups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - -netxml-ups supports all recent Eaton / MGE models which use a Network +netxml-ups support all recent Eaton / MGE models which use a Network Management Card or Proxy (MGE XML/HTTP protocol based). This applies to both Eaton (previously MGE Office Protection Systems) and to MGE UPS SYSTEMS. Supported card and proxy models are: @@ -27,7 +24,7 @@ Supported card and proxy models are: * NMC Transverse (Ref 66074), * NMC & Modbus/JBus (Ref 66103), * Network Management Proxy, - * ePDU Monitored (newer version). + * ePDU Monitored (newer version). Older models, such as SNMP card (Ref 66062 and Ref 66045), use the SNMP protocol and should use the linkman:snmp-ups[8] driver with the "mibs=mge" @@ -35,8 +32,7 @@ parameter. EXTRA ARGUMENTS --------------- - -This driver supports the following optional settings in the +This driver supports the following optional settings in the linkman:ups.conf[5]: *timeout*='value':: @@ -70,18 +66,8 @@ Set the shutdown timer, in seconds. After 'value' seconds running on battery, the local system will receive a notification to shutdown. Defaults to "none" (disabled). -*do_convert_deci*:: -If this flag value is present, the driver assumes you have a very old -MGE networked UPS (or rather an old network management card firmware) -which serves certain measurements spelled 10x too big in the XML markup. -Originally such measurements were decimated by the driver -- but this is -wrong for newer, more sane, devices -- so this behavior was deprecated -and is now disabled by default. Enabling this flag in configuration of a -particular driver instance restores the old behavior for those measurements. - IMPLEMENTATION -------------- - The hostname of the UPS is specified with the "port" value in *ups.conf*, i.e.: @@ -99,7 +85,6 @@ linkman:ups.conf[5]) to at least 5 seconds. KNOWN ISSUES ------------ - Don't connect to the UPS through a proxy. Although it would be trivial to add support for proxies, this is not recommended and don't ask for it. Not only because it will prevent the driver to make a persistent connection to the UPS, @@ -108,7 +93,6 @@ whatever reason), the driver will no longer be able to reach the UPS. AUTHORS ------- - Arjen de Korte SEE ALSO @@ -116,10 +100,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nut-driver-enumerator.8 b/docs/man/nut-driver-enumerator.8 deleted file mode 100644 index 49576a9..0000000 --- a/docs/man/nut-driver-enumerator.8 +++ /dev/null @@ -1,158 +0,0 @@ -'\" t -.\" Title: nut-driver-enumerator -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "NUT\-DRIVER\-ENUMERA" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -nut-driver-enumerator \- tool to map NUT device entries to service instances -.SH "SYNOPSIS" -.sp -\fBnut\-driver\-enumerator\&.sh\fR \-h -.sp -\fBnut\-driver\-enumerator\&.sh\fR (no args) -.sp -\fBnut\-driver\-enumerator\&.sh\fR [\-\-COMMAND] -.SH "DESCRIPTION" -.sp -\fBnut\-driver\-enumerator\&.sh\fR implements the set\-up and querying of the mapping between NUT driver configuration sections for each individual monitored device, and the operating system service management framework service instances into which such drivers are wrapped for independent execution and management (on platforms where NUT currently supports this integration \(em currently this covers Linux distributions with systemd and systems derived from Solaris 10 codebase, including proprietary Sun/Oracle Solaris and numerous open\-source illumos distributions with SMF)\&. It may be not installed in packaging for other operating systems\&. -.sp -This script provides a uniform interface for further NUT tools such as \fBupsdrvsvcctl\fR(8) to implement their logic as platform\-independently as was possible and practical\&. It is not currently intended for end\-user consumption (and so is located in the \fIlibexec\fR directory), with \fBupsdrvsvcctl\fR exposing the most useful data and actions with its \fIlist\fR and \fIresync\fR arguments\&. -.sp -One part of the platform complexity that \fBnut\-driver\-enumerator\&.sh\fR hides is the difference of rules for valid service instance names in various frameworks, as well as system tools and naming patterns involved\&. -.SH "COMMANDS" -.PP -\fBnut\-driver\-enumerator\&.sh (no args)\fR -.RS 4 -Update wrapping of devices into services -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-daemon(=freq)\fR -.RS 4 -Update wrapping of devices into services in an infinite loop; Default freq is 60 sec\&. -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-reconfigure\fR -.RS 4 -Stop and un\-register all service instances and recreate them (e\&.g\&. if new dependency template was defined in a new version of the script or package) -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-get\-service\-framework\fR -.RS 4 -Print the detected service management framework in this OS -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-list\-devices\fR -.RS 4 -Print list of devices in NUT config -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-list\-services\fR -.RS 4 -Print list of service instances which wrap registered NUT devices (full name of service unit) -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-list\-instances\fR -.RS 4 -Print list of service instances which wrap registered NUT devices (just instance suffix) -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-get\-service\-for\-device DEV\fR -.RS 4 -Print the full name of service unit which wraps a NUT device named -DEV -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-get\-device\-for\-service SVC\fR -.RS 4 -Print the NUT device name for full or instance\-suffix name of a service unit -SVC -which wraps it -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-list\-services\-for\-devices\fR -.RS 4 -Print a TAB\-separated list of service units and corresponding NUT device names which each such unit wraps -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-show\-all\-configs\fR -.RS 4 -Show the complete normalized list of device configuration blocks (same as used later by the parser in the script to make decisions) -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-show\-device\-config DEV\fR -.RS 4 -Show configuration block of the specified NUT device -.RE -.PP -\fBnut\-driver\-enumerator\&.sh \-\-show\-device\-config\-value DEV KEY\fR -.RS 4 -Show single configuration key of the specified NUT device -.RE -.SH "ENVIRONMENT VARIABLES" -.sp -By default \fBnut\-driver\-enumerator\&.sh\fR executed without arguments would automatically start any newly registered service instances wrapping the NUT devices, and would also restart the nut\-server service if the configuration was changed\&. Environment variable AUTO_START=no disables this default part of the action\&. -.sp -Also see below for environment variable REPORT_RESTART_42=no value\&. -.SH "DIAGNOSTICS" -.sp -\fBnut\-driver\-enumerator\&.sh\fR will return a zero exit code if it had nothing to do (all currently defined drivers match all of the currently defined service instances, one\-to\-one) and if it had no errors in its operation\&. -.sp -Other codes can be returned as a result of re\-synchronization of mappings: -.PP -\fB42\fR -.RS 4 -NUT device sections and system service instances differed before, but now match up \(em so now the caller should likely restart some services\&. Note that the drivers\*(Aq service instances may have been started or stopped as required (by -AUTO_START=yes) \(em but maybe the upsmon or upssched services should restart\&. If you pass environment variable -REPORT_RESTART_42=no -then this codepath would return 0 (as a non\-error exit code)\&. In default mode, such non\-null reconfiguration should cause the nut\-driver\-enumerator service to restart and this would propagate to other NUT services that depend on it\&. -.RE -.PP -\fB13\fR -.RS 4 -Sections and services differed, and still do not match up -.RE -.PP -\fB1\fR -.RS 4 -Bad inputs, e\&.g\&. unrecognized service management framework -.RE -.PP -\fB2\fR -.RS 4 -Absent or unreadable -ups\&.conf -file -.RE -.SH "AUTHOR" -.sp -Jim Klimov -.SH "SEE ALSO" -.sp -\fBupsdrvsvcctl\fR(8), \fBups.conf\fR(5) -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nut-driver-enumerator.txt b/docs/man/nut-driver-enumerator.txt deleted file mode 100644 index 6fe92db..0000000 --- a/docs/man/nut-driver-enumerator.txt +++ /dev/null @@ -1,150 +0,0 @@ -NUT-DRIVER-ENUMERATOR(8) -======================== - -NAME ----- - -nut-driver-enumerator - tool to map NUT device entries to service instances - -SYNOPSIS --------- - -*nut-driver-enumerator.sh* -h - -*nut-driver-enumerator.sh* (no args) - -*nut-driver-enumerator.sh* [--COMMAND] - - -DESCRIPTION ------------ - -*nut-driver-enumerator.sh* implements the set-up and querying of the -mapping between NUT driver configuration sections for each individual -monitored device, and the operating system service management framework -service instances into which such drivers are wrapped for independent -execution and management (on platforms where NUT currently supports -this integration -- currently this covers Linux distributions with -systemd and systems derived from Solaris 10 codebase, including -proprietary Sun/Oracle Solaris and numerous open-source illumos -distributions with SMF). It may be not installed in packaging for -other operating systems. - -This script provides a uniform interface for further NUT tools -such as linkman:upsdrvsvcctl[8] to implement their logic as -platform-independently as was possible and practical. It is not -currently intended for end-user consumption (and so is located in -the 'libexec' directory), with *upsdrvsvcctl* exposing the most -useful data and actions with its 'list' and 'resync' arguments. - -One part of the platform complexity that *nut-driver-enumerator.sh* -hides is the difference of rules for valid service instance names -in various frameworks, as well as system tools and naming patterns -involved. - -COMMANDS --------- - -*nut-driver-enumerator.sh (no args)*:: -Update wrapping of devices into services - -*nut-driver-enumerator.sh --daemon(=freq)*:: -Update wrapping of devices into services in an infinite loop; -Default freq is 60 sec. - -*nut-driver-enumerator.sh --reconfigure*:: -Stop and un-register all service instances and recreate them -(e.g. if new dependency template was defined in a new -version of the script or package) - -*nut-driver-enumerator.sh --get-service-framework*:: -Print the detected service management framework in this OS - -*nut-driver-enumerator.sh --list-devices*:: -Print list of devices in NUT config - -*nut-driver-enumerator.sh --list-services*:: -Print list of service instances which wrap registered -NUT devices (full name of service unit) - -*nut-driver-enumerator.sh --list-instances*:: -Print list of service instances which wrap registered -NUT devices (just instance suffix) - -*nut-driver-enumerator.sh --get-service-for-device DEV*:: -Print the full name of service unit which wraps a NUT -device named `DEV` - -*nut-driver-enumerator.sh --get-device-for-service SVC*:: -Print the NUT device name for full or instance-suffix name of -a service unit `SVC` which wraps it - -*nut-driver-enumerator.sh --list-services-for-devices*:: -Print a TAB-separated list of service units and corresponding -NUT device names which each such unit wraps - -*nut-driver-enumerator.sh --show-all-configs*:: -Show the complete normalized list of device configuration blocks -(same as used later by the parser in the script to make decisions) - -*nut-driver-enumerator.sh --show-device-config DEV*:: -Show configuration block of the specified NUT device - -*nut-driver-enumerator.sh --show-device-config-value DEV KEY*:: -Show single configuration key of the specified NUT device - -ENVIRONMENT VARIABLES ---------------------- - -By default *nut-driver-enumerator.sh* executed without arguments would -automatically start any newly registered service instances wrapping the -NUT devices, and would also restart the `nut-server` service if the -configuration was changed. Environment variable `AUTO_START=no` disables -this default part of the action. - -Also see below for environment variable `REPORT_RESTART_42=no` value. - -DIAGNOSTICS ------------ - -*nut-driver-enumerator.sh* will return a zero exit code if it had nothing -to do (all currently defined drivers match all of the currently defined -service instances, one-to-one) and if it had no errors in its operation. - -Other codes can be returned as a result of re-synchronization of mappings: - -*42*:: -NUT device sections and system service instances differed before, but -now match up -- so now the caller should likely restart some services. -Note that the drivers' service instances may have been started or stopped -as required (by `AUTO_START=yes`) -- but maybe the upsmon or upssched -services should restart. -If you pass environment variable `REPORT_RESTART_42=no` then -this codepath would return 0 (as a non-error exit code). -In default mode, such non-null reconfiguration should cause -the nut-driver-enumerator service to restart and this would -propagate to other NUT services that depend on it. - -*13*:: -Sections and services differed, and still do not match up - -*1*:: -Bad inputs, e.g. unrecognized service management framework - -*2*:: -Absent or unreadable `ups.conf` file - -AUTHOR ------- - -Jim Klimov - -SEE ALSO --------- - -linkman:upsdrvsvcctl[8], linkman:ups.conf[5] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nut-ipmipsu.8 b/docs/man/nut-ipmipsu.8 index 021d322..8190e2e 100644 --- a/docs/man/nut-ipmipsu.8 +++ b/docs/man/nut-ipmipsu.8 @@ -1,13 +1,13 @@ '\" t .\" Title: nut-ipmipsu .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUT\-IPMIPSU" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUT\-IPMIPSU" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -153,6 +153,7 @@ status of the PSU: .sp -1 .IP \(bu 2.3 .\} + \fIOL\fR means that the PSU is present and providing power, .RE @@ -165,6 +166,7 @@ means that the PSU is present and providing power, .sp -1 .IP \(bu 2.3 .\} + \fIOFF\fR means that the PSU is present but not providing power (power cable removed), .RE @@ -177,6 +179,7 @@ means that the PSU is present but not providing power (power cable removed), .sp -1 .IP \(bu 2.3 .\} + \fIstale\fR (no data) means that the PSU is not present (ie physically removed)\&. .RE @@ -223,26 +226,6 @@ Arnaud Quette \fBnutupsdrv\fR(8) .SS "Internet resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -GNU FreeIPMI home page: -http://www\&.gnu\&.org/software/freeipmi/ -.RE +GNU FreeIPMI home page: http://www\&.gnu\&.org/software/freeipmi/ diff --git a/docs/man/nut-ipmipsu.txt b/docs/man/nut-ipmipsu.txt index 5191ea2..11c4f5c 100644 --- a/docs/man/nut-ipmipsu.txt +++ b/docs/man/nut-ipmipsu.txt @@ -1,4 +1,4 @@ -NUT-IPMIPSU(8) +NUT-IPMIPSU(8) ============== NAME @@ -100,19 +100,16 @@ Here is an example output for a Dell r610 server: AUTHOR ------ - Arnaud Quette SEE ALSO -------- - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* GNU FreeIPMI home page: http://www.gnu.org/software/freeipmi/ +GNU FreeIPMI home page: http://www.gnu.org/software/freeipmi/ diff --git a/docs/man/nut-recorder.8 b/docs/man/nut-recorder.8 index 856902d..917ed44 100644 --- a/docs/man/nut-recorder.8 +++ b/docs/man/nut-recorder.8 @@ -1,13 +1,13 @@ '\" t .\" Title: nut-recorder .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "NUT\-RECORDER" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUT\-RECORDER" "8" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -96,9 +96,8 @@ You can then define a dummy device in \fBups.conf\fR(5): .sp Arnaud Quette .SH "SEE ALSO" -.SS "The dummy\-ups driver:" .sp \fBdummy-ups\fR(8) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nut-recorder.txt b/docs/man/nut-recorder.txt index edde4ae..e202239 100644 --- a/docs/man/nut-recorder.txt +++ b/docs/man/nut-recorder.txt @@ -1,19 +1,17 @@ NUT-RECORDER(8) =============== + NAME ---- - nut-recorder - utility to record device status and values changes SYNOPSIS -------- - *nut-recorder* 'device-name' [output-file] [interval] DESCRIPTION ----------- - *nut-recorder* is an utility to record sequences from running devices (such as power failures, or any other value changes) from upsd, and dump it in a .seq format. @@ -23,7 +21,6 @@ to replay the sequence. OPTIONS ------- - 'device-name':: Record the changes of this device. The format for this option is @@ -63,18 +60,14 @@ You can then define a dummy device in linkman:ups.conf[5]: AUTHOR ------ - Arnaud Quette SEE ALSO -------- -The dummy-ups driver: -~~~~~~~~~~~~~~~~~~~~~ - linkman:dummy-ups[8] -Internet resources: -~~~~~~~~~~~~~~~~~~~ +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nut-scanner.8 b/docs/man/nut-scanner.8 index e1eaeb9..4998de9 100644 --- a/docs/man/nut-scanner.8 +++ b/docs/man/nut-scanner.8 @@ -1,13 +1,13 @@ '\" t .\" Title: nut-scanner -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "NUT\-SCANNER" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUT\-SCANNER" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -103,7 +103,7 @@ Scan NUT compatible power supplies available via IPMI on the current host, or ov .PP \fB\-E\fR | \fB\-\-eaton_serial\fR \fIserial ports\fR .RS 4 -Scan Eaton devices (XCP and SHUT) available via serial bus on the current host\&. This option must be requested explicitly, even for a complete scan\&. +Scan Eaton devices (XCP and SHUT) available via serial bus on the current host\&. This option must be requested explicitely, even for a complete scan\&. \fIserial ports\fR can be expressed in various forms: .sp @@ -115,6 +115,7 @@ can be expressed in various forms: .sp -1 .IP \(bu 2.3 .\} + \fIauto\fR to scan all serial ports\&. .RE @@ -127,7 +128,7 @@ to scan all serial ports\&. .sp -1 .IP \(bu 2.3 .\} -a single character indicating a port number (\fI0\fR +a single charcater indicating a port number (\fI0\fR (zero) for /dev/ttyS0 and /dev/ttyUSB0 on Linux, \fI1\fR for COM1 on Windows, @@ -144,7 +145,7 @@ for /dev/ttya on Solaris\&...) .IP \(bu 2.3 .\} a range of N characters, hyphen separated, describing the range of ports using -\fIX\-Y\fR, where X and Y are characters referring to the port number\&. +\fIX\-Y\fR, where X and Y are characters refering to the port number\&. .RE .sp .RS 4 @@ -229,9 +230,7 @@ used for authenticated SNMPv3 messages\&. This parameter is mandatory if you set .RS 4 Set the \fIauthentication protocol\fR -used for authenticated SNMPv3 messages\&. Allowed values are MD5, SHA, SHA256, SHA384 or SHA512 (depending on Net\-SNMP library capabilities; check help of the -nut\-scanner -binary program for the run\-time supported list)\&. Default value is MD5\&. +used for authenticated SNMPv3 messages\&. Allowed values are MD5 or SHA\&. Default value is MD5\&. .RE .PP \fB\-W\fR | \fB\-\-authPassword\fR \fIauthentication pass phrase\fR @@ -247,9 +246,7 @@ to authNoPriv or authPriv\&. .RS 4 Set the \fIprivacy protocol\fR -used for encrypted SNMPv3 messages\&. Allowed values are DES, AES, AES192 or AES256 (depending on Net\-SNMP library capabilities; check help of the -nut\-scanner -binary program for the run\-time supported list)\&. Default value is DES\&. +used for encrypted SNMPv3 messages\&. Allowed values are DES or AES\&. Default value is DES\&. .RE .PP \fB\-X\fR | \fB\-\-privPassword\fR \fIprivacy pass phrase\fR @@ -269,7 +266,7 @@ Set the username used for authenticating IPMI over LAN connections (mandatory fo .PP \fB\-B\fR | \fB\-\-password\fR \fIpassword\fR .RS 4 -Specify the password to use when authenticating with the remote host (mandatory for IPMI over LAN\&. No default)\&. +Specify the password to use when authenticationg with the remote host (mandatory for IPMI over LAN\&. No default)\&. .RE .PP \fB\-d\fR | \fB\-\-authType\fR \fIauthentication type\fR @@ -279,7 +276,7 @@ Specify the IPMI 1\&.5 authentication type to use (NONE, STRAIGHT_PASSWORD_KEY, IPMI interface , thus in IPMI 1\&.5 mode\&. .RE .PP -\fB\-L\fR | \fB\-\-cipher_suite_id\fR \fIcipher suite identifier\fR +\fB\-D\fR | \fB\-\-cipher_suite_id\fR \fIcipher suite identifier\fR .RS 4 Specify the IPMI 2\&.0 cipher suite ID to use\&. The Cipher Suite ID identifies a set of authentication, integrity, and confidentiality algorithms to use for IPMI 2\&.0 communication\&. The authentication algorithm identifies the algorithm to use for session setup, the integrity algorithm identifies the algorithm to use for session packet signatures, and the confidentiality algorithm identifies the algorithm to use for payload encryption (default=3)\&. .sp @@ -293,6 +290,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB0\fR: None; None; None .RE .sp @@ -304,6 +302,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB1\fR: HMAC\-SHA1; None; None .RE .sp @@ -315,6 +314,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB2\fR: HMAC\-SHA1; HMAC\-SHA1\-96; None .RE .sp @@ -326,6 +326,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB3\fR: HMAC\-SHA1; HMAC\-SHA1\-96; AES\-CBC\-128 .RE .sp @@ -337,6 +338,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB6\fR: HMAC\-MD5; None; None .RE .sp @@ -348,6 +350,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB7\fR: HMAC\-MD5; HMAC\-MD5\-128; None .RE .sp @@ -359,6 +362,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB8\fR: HMAC\-MD5; HMAC\-MD5\-128; AES\-CBC\-128 .RE .sp @@ -370,6 +374,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB11\fR: HMAC\-MD5; MD5\-128; None .RE .sp @@ -381,6 +386,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB12\fR: HMAC\-MD5; MD5\-128; AES\-CBC\-128 .RE .sp @@ -392,6 +398,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB15\fR: HMAC\-SHA256; None; None .RE .sp @@ -403,6 +410,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB16\fR: HMAC\-SHA256; HMAC_SHA256_128; None .RE .sp @@ -414,6 +422,7 @@ The following cipher suite ids are currently supported (Authentication; Integrit .sp -1 .IP \(bu 2.3 .\} + \fB17\fR: HMAC\-SHA256; HMAC_SHA256_128; AES\-CBC\-128 .RE .RE @@ -433,11 +442,6 @@ Display available bus that can be scanned , depending on how the binary has been .RS 4 Display only scan result\&. No information on currently scanned bus is displayed\&. .RE -.PP -\fB\-D\fR | \fB\-\-nut_debug_level\fR -.RS 4 -Raise the debugging level\&. Use this multiple times to see more details\&. -.RE .SH "EXAMPLES" .sp To scan USB devices only: @@ -452,7 +456,7 @@ The same using CIDR notation: .sp \fBnut\-scanner \-S \-m 192\&.168\&.0\&.0/24\fR .sp -To scan NUT servers with a timeout of 10 seconds on IP range 192\&.168\&.0\&.0 to 192\&.168\&.0\&.127 using CIDR notation: +To scan NUT servers with a timeout of 10 seconds on IP range 192\&.168\&.0\&.0 to 192\&.168\&.0\&.128 using CIDR notation: .sp \fBnut\-scanner \-O \-t 10 \-m 192\&.168\&.0\&.0/25\fR .sp @@ -470,6 +474,6 @@ To scan for Eaton serial devices on ports 1 and 2 (COM1 and COM2 on Windows): .SH "SEE ALSO" .sp \fBups.conf\fR(5) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nut-scanner.txt b/docs/man/nut-scanner.txt index 9560360..359806f 100644 --- a/docs/man/nut-scanner.txt +++ b/docs/man/nut-scanner.txt @@ -1,14 +1,13 @@ NUT-SCANNER(8) ============== + NAME ---- - nut-scanner - scan communication buses for NUT devices SYNOPSIS -------- - *nut-scanner* -h *nut-scanner* ['OPTIONS'] @@ -30,7 +29,6 @@ both during compilation and runtime, then SNMP discovery will be available. OPTIONS ------- - *-h*:: Display the help text. @@ -56,7 +54,7 @@ List all NUT-compatible USB devices currently plugged in. Scan SNMP devices. Requires at least a 'start IP', and optionally, an 'end IP'. See specific SNMP OPTIONS for community and security settings. *-M* | *--xml_scan*:: -Scan XML/HTTP devices. Broadcast a network message on the current network interfaces to retrieve XML/HTTP capable devices. No IP required. +Scan XML/HTTP devices. Broadcast a network message on the current network interfaces to retrieve XML/HTTP capable devices. No IP required. *-O* | *--oldnut_scan*:: Scan NUT devices (i.e. upsd daemon) on IP ranging from 'start IP' to 'end IP'. @@ -69,14 +67,14 @@ Scan NUT compatible power supplies available via IPMI on the current host, or ov *-E* | *--eaton_serial* 'serial ports':: Scan Eaton devices (XCP and SHUT) available via serial bus on the current host. -This option must be requested explicitly, even for a complete scan. +This option must be requested explicitely, even for a complete scan. 'serial ports' can be expressed in various forms: - 'auto' to scan all serial ports. -- a single character indicating a port number ('0' (zero) for /dev/ttyS0 and +- a single charcater indicating a port number ('0' (zero) for /dev/ttyS0 and /dev/ttyUSB0 on Linux, '1' for COM1 on Windows, 'a' for /dev/ttya on Solaris...) - a range of N characters, hyphen separated, describing the range of -ports using 'X-Y', where X and Y are characters referring to the port number. +ports using 'X-Y', where X and Y are characters refering to the port number. - a single port name. - a list of ports name, coma separated, like '/dev/ttyS1,/dev/ttyS4'. @@ -118,13 +116,13 @@ Set the 'security level' used for SNMPv3 messages. Allowed values are: noAuthNoP Set the 'security name' used for authenticated SNMPv3 messages. This parameter is mandatory if you set 'security level'. *-w* | *--authProtocol* 'authentication protocol':: -Set the 'authentication protocol' used for authenticated SNMPv3 messages. Allowed values are MD5, SHA, SHA256, SHA384 or SHA512 (depending on Net-SNMP library capabilities; check help of the `nut-scanner` binary program for the run-time supported list). Default value is MD5. +Set the 'authentication protocol' used for authenticated SNMPv3 messages. Allowed values are MD5 or SHA. Default value is MD5. *-W* | *--authPassword* 'authentication pass phrase':: Set the 'authentication pass phrase' used for authenticated SNMPv3 messages. This parameter is mandatory if you set 'security level' to authNoPriv or authPriv. *-x* | *--privProtocol* 'privacy protocol':: -Set the 'privacy protocol' used for encrypted SNMPv3 messages. Allowed values are DES, AES, AES192 or AES256 (depending on Net-SNMP library capabilities; check help of the `nut-scanner` binary program for the run-time supported list). Default value is DES. +Set the 'privacy protocol' used for encrypted SNMPv3 messages. Allowed values are DES or AES. Default value is DES. *-X* | *--privPassword* 'privacy pass phrase':: Set the 'privacy pass phrase' used for encrypted SNMPv3 messages. This parameter is mandatory if you set 'security level' to authPriv. @@ -136,13 +134,13 @@ IPMI OPTIONS Set the username used for authenticating IPMI over LAN connections (mandatory for IPMI over LAN. No default). *-B* | *--password* 'password':: -Specify the password to use when authenticating with the remote host (mandatory for IPMI over LAN. No default). +Specify the password to use when authenticationg with the remote host (mandatory for IPMI over LAN. No default). *-d* | *--authType* 'authentication type':: Specify the IPMI 1.5 authentication type to use (NONE, STRAIGHT_PASSWORD_KEY, MD2, and MD5) with the remote host (default=MD5). This forces connection through the 'lan' IPMI interface , thus in IPMI 1.5 mode. -*-L* | *--cipher_suite_id* 'cipher suite identifier':: +*-D* | *--cipher_suite_id* 'cipher suite identifier':: Specify the IPMI 2.0 cipher suite ID to use. The Cipher Suite ID identifies a set of authentication, integrity, and confidentiality algorithms to use for IPMI 2.0 communication. The authentication algorithm identifies the algorithm to use for session setup, the integrity algorithm identifies the algorithm to use for session packet signatures, and the @@ -175,9 +173,6 @@ Display available bus that can be scanned , depending on how the binary has been *-q* | *--quiet*:: Display only scan result. No information on currently scanned bus is displayed. -*-D* | *--nut_debug_level*:: -Raise the debugging level. Use this multiple times to see more details. - EXAMPLES -------- @@ -193,7 +188,7 @@ The same using CIDR notation: *nut-scanner -S -m 192.168.0.0/24* -To scan NUT servers with a timeout of 10 seconds on IP range 192.168.0.0 to 192.168.0.127 using CIDR notation: +To scan NUT servers with a timeout of 10 seconds on IP range 192.168.0.0 to 192.168.0.128 using CIDR notation: *nut-scanner -O -t 10 -m 192.168.0.0/25* @@ -215,7 +210,7 @@ SEE ALSO linkman:ups.conf[5] -Internet resources: -~~~~~~~~~~~~~~~~~~~ +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nut.conf.5 b/docs/man/nut.conf.5 index cf06517..bd27a97 100644 --- a/docs/man/nut.conf.5 +++ b/docs/man/nut.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: nut.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "NUT\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUT\&.CONF" "5" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -94,7 +94,7 @@ above indicates that no upsmon should be running\&. .PP \fBPOWEROFF_WAIT\fR .RS 4 -Optional\&. At the end of an emergency system halt, the upsmon primary will signal the UPS to switch off\&. This may fail for a number of reasons\&. Most notably is the case that mains power returns during the shutdown process\&. See the section "Power races" in /usr/share/doc/nut/FAQ\&.txt\&.gz\&. The system will wait this long for the UPS to cut power, and then reboot\&. It should be long enough to exhaust the batteries, in case line power continues to be unavailable\&. On the other hand, it should not be so long that the system remains offline for an unreasonable amount of time if line power has returned\&. See sleep(1) for compatible time syntax\&. If you specify the time in seconds, use the "s" suffix\&. +Optional\&. At the end of an emergency system halt, the upsmon master will signal the UPS to switch off\&. This may fail for a number of reasons\&. Most notably is the case that mains power returns during the shutdown process\&. See the section "Power races" in /usr/share/doc/nut/docs/shutdown\&.txt\&.gz\&. The system will wait this long for the UPS to cut power, and then reboot\&. It should be long enough to exhaust the batteries, in case line power continues to be unavailable\&. On the other hand, it should not be so long that the system remains offline for an unreasonable amount of time if line power has returned\&. See sleep(1) for compatible time syntax\&. If you specify the time in seconds, use the "s" suffix\&. .RE .if n \{\ .sp @@ -118,25 +118,57 @@ this workaround might be dangerous under some circumstances\&. Please read http: .RS 4 .\} .nf - # /etc/nut/nut\&.conf\&. See nut\&.conf(5) - - MODE=none - - UPSD_OPTIONS="" - - UPSMON_OPTIONS="" - - # POWEROFF_WAIT=15m +# /etc/nut/nut\&.conf\&. See nut\&.conf(5) +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +MODE=none +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +UPSD_OPTIONS="" +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +UPSMON_OPTIONS="" +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +# POWEROFF_WAIT=15m .fi .if n \{\ .RE .\} .SH "INTEGRATION" .sp -An init script, such as /etc/init\&.d/nut, is expected to source this file in order to determine which components have to be started\&. +An init script, such as /etc/init\&.d/nut, is expected to source this file in order to determine which component(s) has to be started\&. .SH "SEE ALSO" .sp \fBups.conf\fR(5), \fBupsd.conf\fR(5), \fBupsd.users\fR(5), \fBupsmon.conf\fR(5) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nut.conf.txt b/docs/man/nut.conf.txt index 90f7106..074ff95 100644 --- a/docs/man/nut.conf.txt +++ b/docs/man/nut.conf.txt @@ -3,7 +3,6 @@ NUT.CONF(5) NAME ---- - nut.conf - UPS definitions for Network UPS Tools DESCRIPTION @@ -65,11 +64,11 @@ more details. It is ignored when 'MODE' above indicates that no upsmon should be running. *POWEROFF_WAIT*:: -Optional. At the end of an emergency system halt, the upsmon primary +Optional. At the end of an emergency system halt, the upsmon master will signal the UPS to switch off. This may fail for a number of reasons. Most notably is the case that mains power returns during the shutdown process. See the section "Power races" in -/usr/share/doc/nut/FAQ.txt.gz. The system will wait this +/usr/share/doc/nut/docs/shutdown.txt.gz. The system will wait this long for the UPS to cut power, and then reboot. It should be long enough to exhaust the batteries, in case line power continues to be unavailable. On the other hand, it should not be so long that the @@ -83,7 +82,6 @@ Please read http://bugs.debian.org/358696 for more details. EXAMPLE ------- ------- # /etc/nut/nut.conf. See nut.conf(5) MODE=none @@ -93,13 +91,12 @@ EXAMPLE UPSMON_OPTIONS="" # POWEROFF_WAIT=15m ------- INTEGRATION ----------- An init script, such as /etc/init.d/nut, is expected to source this -file in order to determine which components have to be started. +file in order to determine which component(s) has to be started. SEE ALSO -------- @@ -107,7 +104,6 @@ SEE ALSO linkman:ups.conf[5], linkman:upsd.conf[5], linkman:upsd.users[5], linkman:upsmon.conf[5] -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nutclient_authenticate.3 b/docs/man/nutclient_authenticate.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_authenticate.3 +++ b/docs/man/nutclient_authenticate.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_destroy.3 b/docs/man/nutclient_destroy.3 index 8269028..b2f546d 100644 --- a/docs/man/nutclient_destroy.3 +++ b/docs/man/nutclient_destroy.3 @@ -1 +1 @@ -.so man3/libnutclient_general.3 +.so libnutclient_general.3 diff --git a/docs/man/nutclient_device_forced_shutdown.3 b/docs/man/nutclient_device_forced_shutdown.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_device_forced_shutdown.3 +++ b/docs/man/nutclient_device_forced_shutdown.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_device_login.3 b/docs/man/nutclient_device_login.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_device_login.3 +++ b/docs/man/nutclient_device_login.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_device_master.3 b/docs/man/nutclient_device_master.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_device_master.3 +++ b/docs/man/nutclient_device_master.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_execute_device_command.3 b/docs/man/nutclient_execute_device_command.3 index ae0e4eb..36dc188 100644 --- a/docs/man/nutclient_execute_device_command.3 +++ b/docs/man/nutclient_execute_device_command.3 @@ -1 +1 @@ -.so man3/libnutclient_commands.3 +.so libnutclient_commands.3 diff --git a/docs/man/nutclient_get_device_command_description.3 b/docs/man/nutclient_get_device_command_description.3 index ae0e4eb..36dc188 100644 --- a/docs/man/nutclient_get_device_command_description.3 +++ b/docs/man/nutclient_get_device_command_description.3 @@ -1 +1 @@ -.so man3/libnutclient_commands.3 +.so libnutclient_commands.3 diff --git a/docs/man/nutclient_get_device_commands.3 b/docs/man/nutclient_get_device_commands.3 index ae0e4eb..36dc188 100644 --- a/docs/man/nutclient_get_device_commands.3 +++ b/docs/man/nutclient_get_device_commands.3 @@ -1 +1 @@ -.so man3/libnutclient_commands.3 +.so libnutclient_commands.3 diff --git a/docs/man/nutclient_get_device_description.3 b/docs/man/nutclient_get_device_description.3 index 6499d7b..95bc2dc 100644 --- a/docs/man/nutclient_get_device_description.3 +++ b/docs/man/nutclient_get_device_description.3 @@ -1 +1 @@ -.so man3/libnutclient_devices.3 +.so libnutclient_devices.3 diff --git a/docs/man/nutclient_get_device_num_logins.3 b/docs/man/nutclient_get_device_num_logins.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_get_device_num_logins.3 +++ b/docs/man/nutclient_get_device_num_logins.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_get_device_rw_variables.3 b/docs/man/nutclient_get_device_rw_variables.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_get_device_rw_variables.3 +++ b/docs/man/nutclient_get_device_rw_variables.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_get_device_variable_description.3 b/docs/man/nutclient_get_device_variable_description.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_get_device_variable_description.3 +++ b/docs/man/nutclient_get_device_variable_description.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_get_device_variable_values.3 b/docs/man/nutclient_get_device_variable_values.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_get_device_variable_values.3 +++ b/docs/man/nutclient_get_device_variable_values.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_get_device_variables.3 b/docs/man/nutclient_get_device_variables.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_get_device_variables.3 +++ b/docs/man/nutclient_get_device_variables.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_get_devices.3 b/docs/man/nutclient_get_devices.3 index 6499d7b..95bc2dc 100644 --- a/docs/man/nutclient_get_devices.3 +++ b/docs/man/nutclient_get_devices.3 @@ -1 +1 @@ -.so man3/libnutclient_devices.3 +.so libnutclient_devices.3 diff --git a/docs/man/nutclient_has_device.3 b/docs/man/nutclient_has_device.3 index 6499d7b..95bc2dc 100644 --- a/docs/man/nutclient_has_device.3 +++ b/docs/man/nutclient_has_device.3 @@ -1 +1 @@ -.so man3/libnutclient_devices.3 +.so libnutclient_devices.3 diff --git a/docs/man/nutclient_has_device_command.3 b/docs/man/nutclient_has_device_command.3 index ae0e4eb..36dc188 100644 --- a/docs/man/nutclient_has_device_command.3 +++ b/docs/man/nutclient_has_device_command.3 @@ -1 +1 @@ -.so man3/libnutclient_commands.3 +.so libnutclient_commands.3 diff --git a/docs/man/nutclient_has_device_variable.3 b/docs/man/nutclient_has_device_variable.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_has_device_variable.3 +++ b/docs/man/nutclient_has_device_variable.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_logout.3 b/docs/man/nutclient_logout.3 index d2c6e59..b7346a9 100644 --- a/docs/man/nutclient_logout.3 +++ b/docs/man/nutclient_logout.3 @@ -1 +1 @@ -.so man3/libnutclient_misc.3 +.so libnutclient_misc.3 diff --git a/docs/man/nutclient_set_device_variable_value.3 b/docs/man/nutclient_set_device_variable_value.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_set_device_variable_value.3 +++ b/docs/man/nutclient_set_device_variable_value.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_set_device_variable_values.3 b/docs/man/nutclient_set_device_variable_values.3 index cfb1867..087bc31 100644 --- a/docs/man/nutclient_set_device_variable_values.3 +++ b/docs/man/nutclient_set_device_variable_values.3 @@ -1 +1 @@ -.so man3/libnutclient_variables.3 +.so libnutclient_variables.3 diff --git a/docs/man/nutclient_tcp_create_client.3 b/docs/man/nutclient_tcp_create_client.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_create_client.3 +++ b/docs/man/nutclient_tcp_create_client.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutclient_tcp_disconnect.3 b/docs/man/nutclient_tcp_disconnect.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_disconnect.3 +++ b/docs/man/nutclient_tcp_disconnect.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutclient_tcp_get_timeout.3 b/docs/man/nutclient_tcp_get_timeout.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_get_timeout.3 +++ b/docs/man/nutclient_tcp_get_timeout.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutclient_tcp_is_connected.3 b/docs/man/nutclient_tcp_is_connected.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_is_connected.3 +++ b/docs/man/nutclient_tcp_is_connected.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutclient_tcp_reconnect.3 b/docs/man/nutclient_tcp_reconnect.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_reconnect.3 +++ b/docs/man/nutclient_tcp_reconnect.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutclient_tcp_set_timeout.3 b/docs/man/nutclient_tcp_set_timeout.3 index 350e176..7df5982 100644 --- a/docs/man/nutclient_tcp_set_timeout.3 +++ b/docs/man/nutclient_tcp_set_timeout.3 @@ -1 +1 @@ -.so man3/libnutclient_tcp.3 +.so libnutclient_tcp.3 diff --git a/docs/man/nutdrv_atcl_usb.8 b/docs/man/nutdrv_atcl_usb.8 deleted file mode 100644 index 31554a4..0000000 --- a/docs/man/nutdrv_atcl_usb.8 +++ /dev/null @@ -1,76 +0,0 @@ -'\" t -.\" Title: nutdrv_atcl_usb -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "NUTDRV_ATCL_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -nutdrv_atcl_usb \- Driver for \*(AqATCL FOR UPS\*(Aq equipment -.SH "NOTE" -.sp -This man page only documents the specific features of the nutdrv_atcl_usb driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "SUPPORTED HARDWARE" -.sp -This driver is for UPS hardware which identifies itself as USB idVendor 0001 and idProduct 0000, and iManufacturer ATCL FOR UPS\&. Known manufacturers include Kanji and Plexus\&. -.sp -The UPS interface seems to be a generic USB\-to\-serial chip, and for hardware manufactured by Kanji and Plexus, the microcontroller appears to emulate a traditional contact\-closure interface\&. This translates into only three states in ups\&.status: \fBOL\fR, \fBOB\fR and \fBOB LB\fR (similar to \fBgenericups\fR(8)), with no other dynamic status values reported\&. -.sp -Note that these USB identifiers (including the iManufacturer string) have also been seen on devices that are supported by the fuji subdriver of \fBnutdrv_qx\fR(8)\&. -.SH "EXTRA ARGUMENTS" -.sp -This driver supports the following optional setting: -.PP -\fBvendor\fR=\fIname\fR -.RS 4 -In case your iManufacturer (Vendor) string does not exactly match -ATCL FOR UPS, you may provide an alternate string here\&. Note that a more likely case is that your device is handled by another driver for -0001:0000 -devices, such as -\fBnutdrv_qx\fR(8)\&. -.RE -.SH "BUGS" -.sp -The UPS returns the same code for "load power is off" as for "on line power"\&. This condition will not be observed if the NUT upsmon in primary mode runs on the box powered by the UPS, but may be an issue if the UPS is monitored by a remote (secondary) system\&. -.sp -The time between the shutdown command and removal of power seems to be fixed at 30 seconds\&. Ensure that the NUT shutdown script is invoked as late as possible in the shutdown procedure (in case some services take longer than others to clean up)\&. -.sp -Most contact\-closure UPSes will not power down the load if the line power is present\&. This can create a race when using secondary \fBupsmon\fR(8) systems\&. See the \fBupsmon\fR(8) man page for more information\&. The solution to this problem is to upgrade to a smart protocol UPS of some kind that allows detection and proper load cycling on command\&. -.SH "AUTHOR" -.sp -Charles Lepple -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "The generic serial driver:" -.sp -\fBgenericups\fR(8) -.SS "The Qx driver:" -.sp -\fBnutdrv_qx\fR(8) (fuji subdriver) -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nutdrv_atcl_usb.txt b/docs/man/nutdrv_atcl_usb.txt deleted file mode 100644 index e955a01..0000000 --- a/docs/man/nutdrv_atcl_usb.txt +++ /dev/null @@ -1,88 +0,0 @@ -NUTDRV_ATCL_USB(8) -================== - -NAME ----- - -nutdrv_atcl_usb - Driver for 'ATCL FOR UPS' equipment - -NOTE ----- - -This man page only documents the specific features of the nutdrv_atcl_usb -driver. For information about the core driver, see linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This driver is for UPS hardware which identifies itself as USB idVendor 0001 -and idProduct 0000, and iManufacturer +ATCL FOR UPS+. Known manufacturers -include Kanji and Plexus. - -The UPS interface seems to be a generic USB-to-serial chip, and for -hardware manufactured by Kanji and Plexus, the microcontroller -appears to emulate a traditional contact-closure interface. This translates -into only three states in ups.status: *OL*, *OB* and *OB LB* (similar to -linkman:genericups[8]), with no other dynamic status values reported. - -Note that these USB identifiers (including the iManufacturer string) -have also been seen on devices that are supported by the `fuji` -subdriver of linkman:nutdrv_qx[8]. - -EXTRA ARGUMENTS ---------------- - -This driver supports the following optional setting: - -*vendor*='name':: -In case your iManufacturer (Vendor) string does not exactly match -+ATCL FOR UPS+, you may provide an alternate string here. Note that a more -likely case is that your device is handled by another driver for +0001:0000+ -devices, such as linkman:nutdrv_qx[8]. - -BUGS ----- - -The UPS returns the same code for "load power is off" as for "on line power". -This condition will not be observed if the NUT `upsmon` in primary mode runs -on the box powered by the UPS, but may be an issue if the UPS is monitored -by a remote (secondary) system. - -The time between the shutdown command and removal of power seems to be fixed at -30 seconds. Ensure that the NUT shutdown script is invoked as late as possible -in the shutdown procedure (in case some services take longer than others to -clean up). - -Most contact-closure UPSes will not power down the load if the line power is -present. This can create a race when using secondary linkman:upsmon[8] -systems. See the linkman:upsmon[8] man page for more information. -The solution to this problem is to upgrade to a smart protocol UPS of some -kind that allows detection and proper load cycling on command. - -AUTHOR ------- - -Charles Lepple - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -The generic serial driver: -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -linkman:genericups[8] - -The Qx driver: -~~~~~~~~~~~~~~ - -linkman:nutdrv_qx[8] (`fuji` subdriver) - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nutdrv_qx.8 b/docs/man/nutdrv_qx.8 index 1336d83..463aaab 100644 --- a/docs/man/nutdrv_qx.8 +++ b/docs/man/nutdrv_qx.8 @@ -1,13 +1,13 @@ '\" t .\" Title: nutdrv_qx .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "NUTDRV_QX" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTDRV_QX" "8" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,11 +34,9 @@ nutdrv_qx \- Driver for Q* protocol serial and USB based UPS equipment This man page only documents the hardware\-specific features of the \fBnutdrv_qx\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -The \fBnutdrv_qx\fR driver is known to work with various UPSes from \fIArmac\fR, \fIBlazer\fR, \fIEnergy Sistem\fR, \fIFenton Technologies\fR, \fIGeneral Electric\fR, \fIHunnox\fR, \fIMasterguard\fR, \fIMustek\fR, \fIPowercool\fR, \fIVoltronic Power\fR (rebranded by many, many \- have I said many? \- others\&... +The \fBnutdrv_qx\fR driver is known to work with various UPSes from \fIBlazer\fR, \fIEnergy Sistem\fR, \fIFenton Technologies\fR, \fIGeneral Electric\fR, \fIMustek\fR, \fIVoltronic Power\fR (rebranded by many, many \- have I said many? \- others\&.\&. Long story short: if your UPS came with a software called \fIViewpower\fR, chances are high that it works with this driver with the \fIvoltronic\fR protocol) and many others\&. .sp -Long story short: if your UPS came with a software called \fIViewpower\fR, chances are high that it works with this driver with one of the \fIvoltronic*\fR protocols or with the \fImecer\fR one), and many others\&. -.sp -The NUT compatibility table lists all the known supported models\&. Keep in mind, however, that other models not listed there may also be supported, but haven\(cqt been tested or reported back\&. +The NUT compatibility table lists all the known supported models\&. Keep in mind, however, that other models not listed there may also be supported, but haven\(cqt been tested\&. .sp All devices with a serial interface and many with a USB interface are supported\&. .SH "EXTRA ARGUMENTS" @@ -49,11 +47,9 @@ The following are the ones that most likely will need changing (see \fBups.conf\ .PP \fBondelay =\fR \fIvalue\fR .RS 4 -Time to wait before switching on the UPS (seconds)\&. This value is truncated to units of 60 seconds\&. -.sp -Note that a value below 3 minutes, may cause earlier firmware versions to not switch on automatically, so it defaults to 3 minutes (i\&.e\&. 180 seconds)\&. -.sp -This option provides a default value for +Time to wait before switching on the UPS (seconds)\&. This value is truncated to units of 60 seconds\&. The acceptable range is +0\&.\&.599940 +seconds\&. Note that a value below 3 minutes, may cause earlier firmware versions to not switch on automatically, so it defaults to 3 minutes (i\&.e\&. 180 seconds)\&. This option provides a default value for \fBups\&.delay\&.start\fR that will then be used by the driver in the automatic shutdown sequence (i\&.e\&. calling the driver with the \fB\-k\fR @@ -73,9 +69,7 @@ with .PP \fBoffdelay =\fR \fIvalue\fR .RS 4 -Time to wait before shutting down the UPS (seconds)\&. This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds)\&. Defaults to 30 seconds\&. -.sp -This option provides a default value for +Time to wait before shutting down the UPS (seconds)\&. This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds)\&. Defaults to 30 seconds\&. This option provides a default value for \fBups\&.delay\&.shutdown\fR that will then be used by the driver in the automatic shutdown sequence (i\&.e\&. calling the driver with the \fB\-k\fR @@ -101,8 +95,7 @@ when FSD arises the UPS will call a \fBshutdown\&.stayoff\fR shutting down after \fBups\&.delay\&.shutdown\fR -seconds and won\(cqt return (see -KNOWN PROBLEMS), otherwise (standard behaviour) the UPS will call +seconds and won\(cqt return, otherwise (standard behaviour) the UPS will call \fBshutdown\&.return\fR shutting down after \fBups\&.delay\&.shutdown\fR @@ -113,43 +106,19 @@ seconds (if mains meanwhile returned)\&. .PP \fBprotocol =\fR \fIstring\fR .RS 4 -Skip autodetection of the protocol to use and only use the one specified\&. Supported values: -\fIbestups\fR, -\fIhunnox\fR, -\fImasterguard\fR, +Skip autodetection of the protocol to use and only use the one specified\&. Supported values \fImecer\fR, \fImegatec\fR, \fImegatec/old\fR, \fImustek\fR, -\fIq1\fR, -\fIvoltronic\fR, -\fIvoltronic\-qs\fR, -\fIvoltronic\-qs\-hex\fR +\fIvoltronic\fR and \fIzinto\fR\&. -.sp -Note that if you end up using the -\fIq1\fR -protocol, you may want to give a try to the -\fImecer\fR, -\fImegatec\fR -and -\fIzinto\fR -ones setting the -\fBnovendor\fR/\fBnorating\fR flags -(only one, or both)\&. .RE .PP -\fBpollfreq =\fR \fInum\fR +\fBpollfreq =\fR \fIvalue\fR .RS 4 -Set polling interval for full updates, in seconds, to reduce the message traffic\&. Between two polling requests, the driver will do -\fIquick polls\fR -dealing just with -\fBups\&.status\fR -at an interval specified by the -\fBpollinterval\fR -driver option (details in -\fBups.conf\fR(5))\&. The default value is 30 (in seconds)\&. +Set polling frequency, in seconds, to reduce the data flow\&. Between two polling requests the driver will do \(oqquick polls\(cq dealing just with ups\&.status\&. The default value is 30 (in seconds)\&. .RE .sp If your UPS doesn\(cqt report either \fBbattery\&.charge\fR or \fBbattery\&.runtime\fR you may want to add the following ones in order to have guesstimated values: @@ -214,22 +183,8 @@ Minimum battery load used by the driver to estimate the runtime\&. If not specif \fBruntimecal\fR is also specified\&. .RE -.SS "BESTUPS, MECER, MEGATAEC, MEGATEC/OLD, MUSTEK, Q1, VOLTRONIC\-QS, VOLTRONIC\-QS\-HEX, ZINTO PROTOCOLS" -.PP -\fBignoresab\fR -.RS 4 -Some UPSes incorrectly report the \(oqShutdown Active\(cq bit as always on, consequently making the driver believe the UPS is nearing a shutdown (and, as a result, ups\&.status always contains -FSD\&... and you know what this means)\&. Setting this flag will make the driver ignore the \(oqShutdown Active\(cq bit\&. -.RE .SS "MECER, MEGATAEC, MEGATEC/OLD, MUSTEK, ZINTO PROTOCOLS" .PP -\fBondelay\fR -.RS 4 -The acceptable range is -0\&.\&.599940 -seconds\&. -.RE -.PP \fBoffdelay\fR .RS 4 The acceptable range is @@ -246,85 +201,10 @@ Some UPSes will lock up if you attempt to read rating information from them\&. S .RS 4 Some UPSes will lock up if you attempt to read vendor information from them\&. Setting this flag will make the driver skip this step\&. .RE -.SS "BESTUPS PROTOCOL" -.PP -\fBondelay\fR -.RS 4 -The acceptable range is -60\&.\&.599940 -seconds\&. -.RE -.PP -\fBoffdelay\fR -.RS 4 -The acceptable range is -12\&.\&.5940 -seconds\&. -.RE -.PP -\fBpins_shutdown_mode =\fR \fIvalue\fR -.RS 4 -Set -shutdown mode functionality of Pin 1 and Pin 7 -on the UPS DB9 communication port (Per Best Power\(cqs EPS\-0059) to -\fIvalue\fR -[0\&.\&.6]\&. -.RE -.SS "MASTERGUARD PROTOCOL" -.PP -\fBslave_addr =\fR \fIvalue\fR -.RS 4 -Make the claim function verify it\(cqs talking to the specified -\fIslave address\fR -(\fBups\&.id\fR)\&. Safeguard against talking to the wrong one of several identical UPSes on the same USB bus\&. Note that when changing -\fBups\&.id\fR -(through -\fBupsrw\fR(8)) the driver will continue to talk to the UPS with the new -\fIslave address\fR, but won\(cqt claim it again on restart until the -\fBslave_addr\fR -parameter is adjusted\&. -.RE -.SS "Q1 PROTOCOL" -.PP -\fBondelay\fR -.RS 4 -The acceptable range is -0\&.\&.599940 -seconds\&. -.RE -.PP -\fBoffdelay\fR -.RS 4 -The acceptable range is -12\&.\&.600 -seconds\&. -.RE -.SS "VOLTRONIC\-QS, VOLTRONIC\-QS\-HEX PROTOCOLS" -.PP -\fBondelay\fR -.RS 4 -The acceptable range is -60\&.\&.599940 -seconds\&. -.RE -.PP -\fBoffdelay\fR -.RS 4 -The acceptable range is -12\&.\&.540 -seconds\&. -.RE .SS "VOLTRONIC PROTOCOL" .sp The following options are supported only by the \fIvoltronic\fR protocol\&. Not all of them are available on all the UPSes supported by this protocol\&. .PP -\fBondelay\fR -.RS 4 -The acceptable range is -0\&.\&.599940 -seconds\&. -.RE -.PP \fBoffdelay\fR .RS 4 The acceptable range is @@ -372,7 +252,7 @@ and \fBinput\&.frequency\&.low\fR\&. .RE .sp -These UPSes can be fine\-tuned to suit your needs enabling or disabling the following options (the driver should tell you which one the UPS is capable of on startup: the settable ones will be reported either are \fIenabled\fR or \fIdisabled\fR in the logs): +These UPSes can be fine\-tuned to suit your needs enabling or disabling the following options (the driver should tell you which one the UPS is capable of on startup: the settable ones will be reported either ar \fIenabled\fR or \fIdisabled\fR in the logs): .PP \fBalarm_control =\fR \fIstring\fR .RS 4 @@ -432,7 +312,7 @@ Enable or disable Battery Open Status Check [enabled/disabled]\&. If enabled, wh Enable or disable site fault detection [enabled/disabled]\&. If enabled, the UPS will beep when the input neutral and hot wires are reversed\&. .RE .PP -\fBconstant_phase_angle =\fR \fIstring\fR +\fBcostant_phase_angle =\fR \fIstring\fR .RS 4 Enable or disable Constant Phase Angle Function (output and input phase angles are not equal) [enabled/disabled]\&. .RE @@ -502,7 +382,7 @@ Device grid working range for P31 UPSes [Appliance/UPS]\&. \fBTESTING\fR .RS 4 .sp -This protocol comes with a couple of functions that are not enabled by default because of the lack of knowledge of some part of the communication protocol used by these UPSes by your friendly neighborhood developer\&. Since these functions are supposed to be queries to the UPS for some kind of information, they \fIshould\fR not make your UPS go boom\&. So if you are brave enough to risk your UPS and attached devices\*(Aq life to help the developers, this will be very appreciated\&.\&. \fBDo it at your own risk\fR\&. +This protocol comes with a couple of functions that are not enabled by default because of the lack of knowledge of some part of the communication protocol used by these UPSes by your friendly neighborhood developer\&. Since these functions are supposed to be queries to the UPS for some kind of informations, they \fIshould\fR not make your UPS go boom\&. So if you are brave enough to risk your UPS and attached devices\*(Aq life to help the developers, this will be very appreciated\&.\&. \fBDo it at your own risk\fR\&. .PP \fBtesting\fR .RS 4 @@ -542,6 +422,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendor="Foo\&.Corporation\&.*" .RE .sp @@ -553,6 +434,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendorid=051d* (APC) .RE @@ -565,40 +447,25 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x product="\&.*(Smart|Back)\-?UPS\&.*" .RE .RE .PP \fBbus =\fR \fIregex\fR .RS 4 -Select a UPS on a specific USB bus or group of buses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. +Select a UPS on a specific USB bus or group of busses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. bus="002", bus="00[2\-3]")\&. .RE .PP -\fBdevice =\fR \fIregex\fR -.RS 4 -Select a UPS on a specific USB device or group of devices\&. The argument is a regular expression that must match the device name where the UPS is connected (e\&.g\&. -device="001", -device="00[1\-2]")\&. Note that device numbers are not guaranteed by the OS to be stable across re\-boots or device re\-plugging\&. -.RE -.PP \fBsubdriver =\fR \fIstring\fR .RS 4 Select a serial\-over\-USB subdriver to use\&. You have a choice between -\fBcypress\fR, -\fBfabula\fR, -\fBfuji\fR, -\fBhunnox\fR, -\fBippon\fR, -\fBkrauler\fR, \fBphoenix\fR, -\fBphoenixtec\fR, -\fBsgs\fR, -\fBsnr\fR, -\fBarmac\fR -and -\fBablerex\fR\&. When using this option, it is mandatory to also specify the +\fBippon\fR, +\fBcypress\fR, and +\fBkrauler\fR\&. When using this option, it is mandatory to also specify the \fBvendorid\fR and \fBproductid\fR\&. @@ -614,92 +481,6 @@ subdriver\&. This is mandatory for some devices to work (LDLC, Dynamix and other or 0x4095), according to your device entry in NUT hardware compatibility list (HCL)\&. .RE -.PP -\fBnoscanlangid\fR -.RS 4 -If this flag is set, don\(cqt autoscan valid range for langid\&. -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBIMPLEMENTATION NOTES\fR -.RS 4 -.PP -\fB\fIarmac\fR\fR\fB subdriver\fR -.RS 4 -The Armac communication subdriver reproduces a communication protocol used by an old release of "PowerManagerII" software, which doesn\(cqt seem to be Armac specific: its banner is "2004 Richcomm Technologies, Inc\&. Dec 27 2005 ver 1\&.1\&." Maybe other Richcomm UPSes would work with this \(em maybe better than with the older standalone -richcomm_usb -driver\&. -.RE -.PP -\fB\fIfabula\fR\fR\fB subdriver\fR -.RS 4 -This subdriver, meant to be used with the -\fImegatec\fR -protocol, does -\fBnot\fR -support the various -\fBtest\&.battery\fR -commands\&. Plus, the -\fBshutdown\&.return\fR -command ignores the values set in -\fIups\&.delay\&.start\fR/\fBondelay\fR -and makes the UPS turn on the load as soon as power is back\&. -.RE -.PP -\fB\fIhunnox\fR\fR\fB subdriver\fR -.RS 4 -This protocol subdriver is closely related to -\fIfabula\fR -one, with a few tweaks for devices not directly supported by that driver\&. -.RE -.PP -\fB\fIfuji\fR\fR\fB subdriver\fR -.RS 4 -This subdriver, meant to be used with the -\fImegatec\fR -protocol, does -\fBnot\fR -support the -\fBshutdown\&.stayoff\fR -and -\fBload\&.off\fR -commands\&. Plus, the -\fBshutdown\&.return\fR -command ignores the values set in -\fIups\&.delay\&.start\fR/\fBondelay\fR -and makes the UPS turn on the load as soon as power is back\&. -.RE -.PP -\fB\fIkrauler\fR\fR\fB subdriver\fR -.RS 4 -This subdriver, meant to be used with the -\fImegatec\fR -protocol, does -\fBnot\fR -support the shutdown commands, i\&.e\&.: -\fBshutdown\&.return\fR, -\fBshutdown\&.stayoff\fR -and -\fBload\&.off\fR\&. -.RE -.PP -\fB\fIsnr\fR\fR\fB subdriver\fR -.RS 4 -This subdriver, meant to be used with the -\fImegatec\fR -protocol, does -\fBnot\fR -support the shutdown commands, i\&.e\&.: -\fBshutdown\&.return\fR, -\fBshutdown\&.stayoff\fR -and -\fBload\&.off\fR\&. -.RE -.RE .SH "UPS COMMANDS" .sp This driver supports some instant commands (see \fBupscmd\fR(8)): @@ -711,7 +492,7 @@ Toggle the UPS beeper\&. (Not available on some hardware) .PP \fBload\&.on\fR .RS 4 -Turn on the load immediately\&. (Not available on some hardware) +Turn on the load immediately\&. .RE .PP \fBload\&.off\fR @@ -754,7 +535,7 @@ Perform a quick (10 second) battery test\&. .RS 4 Stop a running battery test\&. (Not available on some hardware) .RE -.SS "BESTUPS, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, ZINTO PROTOCOLS" +.SS "MECER, MEGATEC, MEGATEC/OLD, MUSTEK, ZINTO PROTOCOLS" .PP \fBtest\&.battery\&.start\fR \fIvalue\fR .RS 4 @@ -762,50 +543,6 @@ Perform a battery test for the duration of \fIvalue\fR seconds (truncated to 60 seconds) [60\&.\&.5940]\&. .RE -.SS "MASTERGUARD PROTOCOL" -.PP -\fBbeeper\&.enable\fR -.RS 4 -Enable the UPS beeper\&. -.RE -.PP -\fBbeeper\&.disable\fR -.RS 4 -Disable the UPS beeper\&. -.RE -.PP -\fBtest\&.battery\&.start\fR \fIvalue\fR -.RS 4 -Perform a battery test for the duration of -\fIvalue\fR -seconds (truncated to 60 seconds) [0\&.\&.5940]\&. This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds)\&. -.RE -.PP -\fBbypass\&.start\fR -.RS 4 -Put the UPS in bypass mode -.RE -.PP -\fBbypass\&.stop\fR -.RS 4 -Take the UPS in normal mode -.RE -.sp -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBVOLTRONIC POWER P98 UNITS (WITH MECER PROTOCOL)\fR -.RS 4 -.PP -\fBtest\&.battery\&.start\fR \fIvalue\fR -.RS 4 -Perform a battery test for the duration of -\fIvalue\fR -seconds (truncated to 60 seconds) [12\&.\&.5940]\&. This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds)\&. -.RE -.RE .SS "VOLTRONIC PROTOCOL" .sp The following instant commands are available for the \fIvoltronic\fR protocol\&. Not all of them are available on all the UPSes supported by this protocol\&. @@ -948,22 +685,6 @@ driver wants a \fIvalue\fR in seconds\&. .RE -.SH "NOTES FOR THE PREVIOUS USER OF BESTUPS DRIVER" -.sp -The \fBnutdrv_qx\fR driver having replaced the bestups one, some configuration changes may be required by users switching to \fBnutdrv_qx\fR\&. -.sp -Part of this, the following bestups options, in \fBups.conf\fR(5), are no longer supported by this driver: -.PP -\fBnombattvolt\fR, \fBbattvoltmult\fR -.RS 4 -See -BATTERY CHARGE\&. -.RE -.PP -\fBID\fR -.RS 4 -Discarded\&. -.RE .SH "NOTES FOR THE PREVIOUS USER OF VOLTRONIC DRIVERS" .sp The \fBnutdrv_qx\fR driver having replaced the voltronic ones, some configuration changes may be required by users switching to \fBnutdrv_qx\fR\&. @@ -1157,62 +878,6 @@ Both the \fBload\&.off\fR and \fBshutdown\&.stayoff\fR instant commands are mean Some models report a bogus value for the beeper status (will always be \fIenabled\fR or \fIdisabled\fR)\&. So, the \fBbeeper\&.toggle\fR command may appear to have no effect in the status reported by the driver when, in fact, it is working fine\&. .sp The temperature and load value is known to be bogus in some models\&. -.SS "MASTERGUARD UNITS" -.sp -The driver is supposed to support both "new" A series (A700/1000/2000/3000 and their \-19 cousins) and E series (E60/100/200) but was tested only on A due to lack of E hardware\&. -.SS "VOLTRONIC\-QS UNITS" -.sp -Both \fBload\&.off\fR and \fBshutdown\&.stayoff\fR instant commands are known to work as expected (i\&.e\&. turn the load off indefinitely) only if mains is present, otherwise, as soon as mains returns the load will be powered\&. -.sp -After issuing a \fBshutdown\&.return\fR instant command, the UPS won\(cqt wait \fBondelay\fR before powering on the load, provided the following conditions are met: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -if the load has been previously (no matter how long before) powered off through -\fBload\&.off\fR/\fBshutdown\&.stayoff\fR -\fIand\fR -powered on through -\fBload\&.on\fR/\fBshutdown\&.stop\fR -\fIand\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -if AC wasn\(cqt cut after issuing the -\fBload\&.off\fR/\fBshutdown\&.stayoff\fR -(i\&.e\&. the UPS didn\(cqt turn itself off) -\fIand\fR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -if there\(cqs a power outage after issuing the -\fBshutdown\&.return\fR -command -.RE -.sp -In this case, as soon as mains returns the load will be powered\&. -.SS "VOLTRONIC\-QS\-HEX UNITS" -.sp -\fBshutdown\&.return\fR, \fBload\&.off\fR, and \fBshutdown\&.stayoff\fR instant commands are known to work as expected only if mains is present, otherwise, as soon as mains returns the load will be powered\&. .SH "UPS WARNINGS (VOLTRONIC PROTOCOL)" .sp The UPSes supported by \fIvoltronic\fR protocol report warnings through a 64bit flag (bit1bit2\&...bit63bit64) where 1 means that a warning arose, while 0 means no warning\&. Since more than one warning at a time can be signaled, and because of the limited space in the ups\&.alarm variable, if the length of the warnings exceeds that of ups\&.alarms variable, they will be reported as bits\&. If you want to know the explanation of that bit you can either watch the log or see the next table (unlisted bits equal to unknown warnings)\&. @@ -1707,107 +1372,12 @@ T} .sp 1 .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Daniele Pezzini -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arnaud Quette -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -John Stamp -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Peter Selinger -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arjen de Korte -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Alexander Gordeev -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Edgar Fuß -.RE +Daniele Pezzini , Arnaud Quette , John Stamp , Peter Selinger , Arjen de Korte , Alexander Gordeev .SH "SEE ALSO" .sp \fBblazer_ser\fR(8), \fBblazer_usb\fR(8), \fBnutupsdrv\fR(8), \fBups.conf\fR(5), \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsdrvctl\fR(8), \fBupsmon\fR(8), \fBupsrw\fR(8) .SS "Internet Resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT HCL: -http://www\&.networkupstools\&.org/stable\-hcl\&.html -.RE +The NUT HCL: http://www\&.networkupstools\&.org/stable\-hcl\&.html diff --git a/docs/man/nutdrv_qx.txt b/docs/man/nutdrv_qx.txt index 905b561..f448282 100644 --- a/docs/man/nutdrv_qx.txt +++ b/docs/man/nutdrv_qx.txt @@ -17,22 +17,12 @@ For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ -The *nutdrv_qx* driver is known to work with various UPSes from -'Armac', 'Blazer', 'Energy Sistem', 'Fenton Technologies', 'General Electric', -'Hunnox', 'Masterguard', 'Mustek', 'Powercool', 'Voltronic Power' -(rebranded by many, many - have I said many? - others... +The *nutdrv_qx* driver is known to work with various UPSes from 'Blazer', 'Energy Sistem', 'Fenton Technologies', 'General Electric', 'Mustek', 'Voltronic Power' (rebranded by many, many - have I said many? - others.. Long story short: if your UPS came with a software called 'Viewpower', chances are high that it works with this driver with the 'voltronic' <<_extra_arguments,protocol>>) and many others. -Long story short: if your UPS came with a software called 'Viewpower', -chances are high that it works with this driver with one of the -<<_extra_arguments,'voltronic*' protocols or with the 'mecer' one>>), -and many others. +The <<_internet_resources,NUT compatibility table>> lists all the known supported models. +Keep in mind, however, that other models not listed there may also be supported, but haven't been tested. -The <<_internet_resources,NUT compatibility table>> lists all the known -supported models. Keep in mind, however, that other models not listed -there may also be supported, but haven't been tested or reported back. - -All devices with a serial interface and many with a USB interface are -supported. +All devices with a serial interface and many with a USB interface are supported. EXTRA ARGUMENTS @@ -45,32 +35,26 @@ The following are the ones that most likely will need changing (see linkman:ups. *ondelay =* 'value':: Time to wait before switching on the UPS (seconds). This value is truncated to units of 60 seconds. -+ +The acceptable range is +0..599940+ seconds. Note that a value below 3 minutes, may cause earlier firmware versions to not switch on automatically, so it defaults to 3 minutes (i.e. 180 seconds). -+ This option provides a default value for *ups.delay.start* that will then be used by the driver in the automatic shutdown sequence (i.e. calling the driver with the *-k* option, calling linkman:upsdrvctl[8] with the *shutdown* option or when the +FSD+ flag is set and linkman:upsmon[8] enters its shutdown sequence): however you can change this value `on the fly' for the actual session, only for the use with instant commands, setting *ups.delay.start* with linkman:upsrw[8]. *offdelay =* 'value':: Time to wait before shutting down the UPS (seconds). This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds). Defaults to 30 seconds. -+ This option provides a default value for *ups.delay.shutdown* that will then be used by the driver in the automatic shutdown sequence (i.e. calling the driver with the *-k* option, calling linkman:upsdrvctl[8] with the *shutdown* option or when the +FSD+ flag is set and linkman:upsmon[8] enters its shutdown sequence): however you can change this value `on the fly' for the actual session, only for the use with instant commands, setting *ups.delay.shutdown* with linkman:upsrw[8]. *stayoff*:: -If you set stayoff in linkman:ups.conf[5] when FSD arises the UPS will call a *shutdown.stayoff* shutting down after *ups.delay.shutdown* seconds and won't return (see <<_known_problems,KNOWN PROBLEMS>>), otherwise (standard behaviour) the UPS will call *shutdown.return* shutting down after *ups.delay.shutdown* seconds and then turn on after *ups.delay.start* seconds (if mains meanwhile returned). +If you set stayoff in linkman:ups.conf[5] when FSD arises the UPS will call a *shutdown.stayoff* shutting down after *ups.delay.shutdown* seconds and won't return, otherwise (standard behaviour) the UPS will call *shutdown.return* shutting down after *ups.delay.shutdown* seconds and then turn on after *ups.delay.start* seconds (if mains meanwhile returned). *protocol =* 'string':: Skip autodetection of the protocol to use and only use the one specified. -Supported values: 'bestups', 'hunnox', 'masterguard', 'mecer', 'megatec', 'megatec/old', 'mustek', 'q1', 'voltronic', 'voltronic-qs', 'voltronic-qs-hex' and 'zinto'. -+ -Note that if you end up using the 'q1' protocol, you may want to give a try to the 'mecer', 'megatec' and 'zinto' ones setting the <> (only one, or both). +Supported values 'mecer', 'megatec', 'megatec/old', 'mustek', 'voltronic' and 'zinto'. -*pollfreq =* 'num':: -Set polling interval for full updates, in seconds, to reduce the message traffic. -Between two polling requests, the driver will do 'quick polls' dealing just -with *ups.status* at an interval specified by the *pollinterval* driver option -(details in linkman:ups.conf[5]). +*pollfreq =* 'value':: +Set polling frequency, in seconds, to reduce the data flow. +Between two polling requests the driver will do `quick polls' dealing just with ups.status. The default value is 30 (in seconds). If your UPS doesn't report either *battery.charge* or *battery.runtime* you may want to add the following ones in order to have guesstimated values: @@ -115,21 +99,9 @@ If not specified, the driver defaults to 10%. Only used if *runtimecal* is also specified. -BESTUPS, MECER, MEGATAEC, MEGATEC/OLD, MUSTEK, Q1, VOLTRONIC-QS, VOLTRONIC-QS-HEX, ZINTO PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*ignoresab*:: -Some UPSes incorrectly report the `Shutdown Active' bit as always on, consequently making the driver believe the UPS is nearing a shutdown (and, as a result, ups.status always contains +FSD+... and you know what this means). -Setting this flag will make the driver ignore the `Shutdown Active' bit. - - -[[old-blazer-protocols-options]] MECER, MEGATAEC, MEGATEC/OLD, MUSTEK, ZINTO PROTOCOLS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*ondelay*:: -The acceptable range is +0..599940+ seconds. - *offdelay*:: The acceptable range is +12..600+ seconds. @@ -142,57 +114,12 @@ Some UPSes will lock up if you attempt to read vendor information from them. Setting this flag will make the driver skip this step. -BESTUPS PROTOCOL -~~~~~~~~~~~~~~~~ - -*ondelay*:: -The acceptable range is +60..599940+ seconds. - -*offdelay*:: -The acceptable range is +12..5940+ seconds. - -*pins_shutdown_mode =* 'value':: -Set http://www.networkupstools.org/protocols/sola.html#_shutdown_set_command[shutdown mode functionality of Pin 1 and Pin 7] on the UPS DB9 communication port (Per Best Power's EPS-0059) to 'value' [+0..6+]. - - -MASTERGUARD PROTOCOL -~~~~~~~~~~~~~~~~~~~~ - -*slave_addr =* 'value':: -Make the claim function verify it's talking to the specified 'slave address' (*ups.id*). -Safeguard against talking to the wrong one of several identical UPSes on the same USB bus. -Note that when changing *ups.id* (through linkman:upsrw[8]) the driver will continue to talk to the UPS with the new 'slave address', but won't claim it again on restart until the *slave_addr* parameter is adjusted. - - -Q1 PROTOCOL -~~~~~~~~~~~ - -*ondelay*:: -The acceptable range is +0..599940+ seconds. - -*offdelay*:: -The acceptable range is +12..600+ seconds. - - -VOLTRONIC-QS, VOLTRONIC-QS-HEX PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -*ondelay*:: -The acceptable range is +60..599940+ seconds. - -*offdelay*:: -The acceptable range is +12..540+ seconds. - - VOLTRONIC PROTOCOL ~~~~~~~~~~~~~~~~~~ The following options are supported only by the 'voltronic' protocol. Not all of them are available on all the UPSes supported by this protocol. -*ondelay*:: -The acceptable range is +0..599940+ seconds. - *offdelay*:: The acceptable range is +12..5940+ seconds. @@ -213,7 +140,7 @@ Reset capability options and their voltage and frequency limits to safe default + Note that setting this option will reset also *ups.start.auto*, *battery.protection*, *battery.energysave*, *ups.start.battery*, *outlet.0.switchable*, *input.transfer.high*, *input.transfer.low*, *input.frequency.high* and *input.frequency.low*. -These UPSes can be fine-tuned to suit your needs enabling or disabling the following options (the driver should tell you which one the UPS is capable of on startup: the settable ones will be reported either are 'enabled' or 'disabled' in the logs): +These UPSes can be fine-tuned to suit your needs enabling or disabling the following options (the driver should tell you which one the UPS is capable of on startup: the settable ones will be reported either ar 'enabled' or 'disabled' in the logs): *alarm_control =* 'string':: Enable or disable alarm (BEEP!) [+enabled+/+disabled+]. @@ -257,7 +184,7 @@ If enabled, when the UPS is turned on, it will check if the battery is connected Enable or disable site fault detection [+enabled+/+disabled+]. If enabled, the UPS will beep when the input neutral and hot wires are reversed. -*constant_phase_angle =* 'string':: +*costant_phase_angle =* 'string':: Enable or disable Constant Phase Angle Function (output and input phase angles are not equal) [+enabled+/+disabled+]. *limited_runtime_on_battery =* 'string':: @@ -300,7 +227,7 @@ TESTING ^^^^^^^ This protocol comes with a couple of functions that are not enabled by default because of the lack of knowledge of some part of the communication protocol used by these UPSes by your friendly neighborhood developer. -Since these functions are supposed to be queries to the UPS for some kind of information, they _should_ not make your UPS go boom. +Since these functions are supposed to be queries to the UPS for some kind of informations, they _should_ not make your UPS go boom. So if you are brave enough to risk your UPS and attached devices' life to help the developers, this will be very appreciated.. *Do it at your own risk*. @@ -338,17 +265,12 @@ Examples: - `-x product=".*(Smart|Back)-?UPS.*"` *bus =* 'regex':: -Select a UPS on a specific USB bus or group of buses. +Select a UPS on a specific USB bus or group of busses. The argument is a regular expression that must match the bus name where the UPS is connected (e.g. +bus="002"+, +bus="00[2-3]"+). -*device =* 'regex':: -Select a UPS on a specific USB device or group of devices. -The argument is a regular expression that must match the device name where the UPS is connected (e.g. +device="001"+, +device="00[1-2]"+). -Note that device numbers are not guaranteed by the OS to be stable across re-boots or device re-plugging. - *subdriver =* 'string':: Select a serial-over-USB subdriver to use. -You have a choice between *cypress*, *fabula*, *fuji*, *hunnox*, *ippon*, *krauler*, *phoenix*, *phoenixtec*, *sgs*, *snr*, *armac* and *ablerex*. +You have a choice between *phoenix*, *ippon*, *cypress*, and *krauler*. When using this option, it is mandatory to also specify the *vendorid* and *productid*. *langid_fix =* 'value':: @@ -356,37 +278,6 @@ Apply the language ID workaround to the *krauler* subdriver. This is mandatory for some devices to work (LDLC, Dynamix and others). You must provide *value* (+0x409+ or +0x4095+), according to your device entry in NUT hardware compatibility list (HCL). -*noscanlangid*:: -If this flag is set, don't autoscan valid range for langid. - - -IMPLEMENTATION NOTES -^^^^^^^^^^^^^^^^^^^^ - -*'armac' subdriver*:: -The Armac communication subdriver reproduces a communication protocol used by -an old release of "PowerManagerII" software, which doesn't seem to be Armac -specific: its banner is "2004 Richcomm Technologies, Inc. Dec 27 2005 ver 1.1." -Maybe other Richcomm UPSes would work with this -- maybe better than with -the older standalone `richcomm_usb` driver. - -*'fabula' subdriver*:: -This subdriver, meant to be used with the 'megatec' protocol, does *not* support the various *test.battery* commands. -Plus, the *shutdown.return* command ignores the values set in 'ups.delay.start'/*ondelay* and makes the UPS turn on the load as soon as power is back. - -*'hunnox' subdriver*:: -This protocol subdriver is closely related to 'fabula' one, with a few tweaks for devices not directly supported by that driver. - -*'fuji' subdriver*:: -This subdriver, meant to be used with the 'megatec' protocol, does *not* support the *shutdown.stayoff* and *load.off* commands. -Plus, the *shutdown.return* command ignores the values set in 'ups.delay.start'/*ondelay* and makes the UPS turn on the load as soon as power is back. - -*'krauler' subdriver*:: -This subdriver, meant to be used with the 'megatec' protocol, does *not* support the shutdown commands, i.e.: *shutdown.return*, *shutdown.stayoff* and *load.off*. - -*'snr' subdriver*:: -This subdriver, meant to be used with the 'megatec' protocol, does *not* support the shutdown commands, i.e.: *shutdown.return*, *shutdown.stayoff* and *load.off*. - UPS COMMANDS ------------ @@ -399,7 +290,6 @@ Toggle the UPS beeper. *load.on*:: Turn on the load immediately. -(Not available on some hardware) *load.off*:: Turn off the load immediately (see <<_known_problems,KNOWN PROBLEMS>>). @@ -427,41 +317,13 @@ Stop a running battery test. (Not available on some hardware) -BESTUPS, MECER, MEGATEC, MEGATEC/OLD, MUSTEK, Q1, ZINTO PROTOCOLS -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +MECER, MEGATEC, MEGATEC/OLD, MUSTEK, ZINTO PROTOCOLS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *test.battery.start* 'value':: Perform a battery test for the duration of 'value' seconds (truncated to 60 seconds) [+60..5940+]. -MASTERGUARD PROTOCOL -~~~~~~~~~~~~~~~~~~~~ - -*beeper.enable*:: -Enable the UPS beeper. - -*beeper.disable*:: -Disable the UPS beeper. - -*test.battery.start* 'value':: -Perform a battery test for the duration of 'value' seconds (truncated to 60 seconds) [+0..5940+]. -This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds). - -*bypass.start*:: -Put the UPS in bypass mode - -*bypass.stop*:: -Take the UPS in normal mode - - -VOLTRONIC POWER P98 UNITS (WITH MECER PROTOCOL) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -*test.battery.start* 'value':: -Perform a battery test for the duration of 'value' seconds (truncated to 60 seconds) [+12..5940+]. -This value is truncated to units of 6 seconds (less than 60 seconds) or 60 seconds (more than 60 seconds). - - VOLTRONIC PROTOCOL ~~~~~~~~~~~~~~~~~~ @@ -569,21 +431,6 @@ The following instant command has also been changed: While the old blazer drivers expected a 'value' in minutes, the *nutdrv_qx* driver wants a 'value' in seconds. -NOTES FOR THE PREVIOUS USER OF BESTUPS DRIVER ---------------------------------------------- - -The *nutdrv_qx* driver having replaced the bestups one, some configuration changes may be required by users switching to *nutdrv_qx*. - -Part of this, the following bestups options, in linkman:ups.conf[5], are no longer supported by this driver: - -*nombattvolt*:: -*battvoltmult*:: -See <<_battery_charge,BATTERY CHARGE>>. - -*ID*:: -Discarded. - - NOTES FOR THE PREVIOUS USER OF VOLTRONIC DRIVERS ------------------------------------------------ @@ -639,22 +486,22 @@ If disabled, the UPS will provide continuous power to programmable outlets until *max_eco_volt*:: -> *input.transfer.high* + Maximum voltage for ECO Mode (V). -If AC voltage is within acceptable range, ECO mode will be used (If the UPS is capable of and it's enabled). +If AC voltage is within acceptable range, ECO mode will be used (If the UPS is capable of and it’s enabled). *min_eco_volt*:: -> *input.transfer.low* + Minimum voltage for ECO Mode (V). -If AC voltage is within acceptable range, ECO mode will be used (If the UPS is capable of and it's enabled). +If AC voltage is within acceptable range, ECO mode will be used (If the UPS is capable of and it’s enabled). *max_eco_freq*:: -> *input.frequency.high* + Maximum frequency for ECO Mode (Hz). -If AC frequency is within acceptable range, ECO mode will be used (If the UPS is capable of and it's enabled). +If AC frequency is within acceptable range, ECO mode will be used (If the UPS is capable of and it’s enabled). *min_eco_freq*:: -> *input.frequency.low* + Minimum frequency for ECO Mode (Hz). -If AC frequency is within acceptable range, ECO mode will be used (If the UPS is capable of and it's enabled). +If AC frequency is within acceptable range, ECO mode will be used (If the UPS is capable of and it’s enabled). *outlet1_delay*:: -> *outlet.1.delay.shutdown* + @@ -693,32 +540,6 @@ So, the *beeper.toggle* command may appear to have no effect in the status repor The temperature and load value is known to be bogus in some models. -MASTERGUARD UNITS -~~~~~~~~~~~~~~~~~ - -The driver is supposed to support both "new" A series (A700/1000/2000/3000 and their -19 cousins) and E series (E60/100/200) but was tested only on A due to lack of E hardware. - - -VOLTRONIC-QS UNITS -~~~~~~~~~~~~~~~~~~ - -Both *load.off* and *shutdown.stayoff* instant commands are known to work as expected (i.e. turn the load off indefinitely) only if mains is present, otherwise, as soon as mains returns the load will be powered. - -After issuing a *shutdown.return* instant command, the UPS won't wait *ondelay* before powering on the load, provided the following conditions are met: - -- if the load has been previously (no matter how long before) powered off through *load.off*/*shutdown.stayoff* _and_ powered on through *load.on*/*shutdown.stop* _and_ -- if AC wasn't cut after issuing the *load.off*/*shutdown.stayoff* (i.e. the UPS didn't turn itself off) _and_ -- if there's a power outage after issuing the *shutdown.return* command - -In this case, as soon as mains returns the load will be powered. - - -VOLTRONIC-QS-HEX UNITS -~~~~~~~~~~~~~~~~~~~~~~ - -*shutdown.return*, *load.off*, and *shutdown.stayoff* instant commands are known to work as expected only if mains is present, otherwise, as soon as mains returns the load will be powered. - - UPS WARNINGS (VOLTRONIC PROTOCOL) --------------------------------- @@ -727,81 +548,80 @@ Since more than one warning at a time can be signaled, and because of the limite If you want to know the explanation of that bit you can either watch the log or see the next table (unlisted bits equal to unknown warnings). .UPS Warnings for 'voltronic' UPSes -[cols="5>,95",options="autowidth,header",frame="topbot",grid="rows",align="center",caption=""] +[cols="5>,95",options="autowidth,header",frame="topbot",align="center",caption=""] |==== -|# |Corresponding Warning -|1 |Battery disconnected -|2 |Neutral not connected -|3 |Site fault -|4 |Phase sequence incorrect -|5 |Phase sequence incorrect in bypass -|6 |Input frequency unstable in bypass -|7 |Battery overcharged -|8 |Low battery -|9 |Overload alarm -|10 |Fan alarm -|11 |EPO enabled -|12 |Unable to turn on UPS -|13 |Over temperature alarm -|14 |Charger alarm -|15 |Remote auto shutdown -|16 |L1 input fuse not working -|17 |L2 input fuse not working -|18 |L3 input fuse not working -|19 |Positive PFC abnormal in L1 -|20 |Negative PFC abnormal in L1 -|21 |Positive PFC abnormal in L2 -|22 |Negative PFC abnormal in L2 -|23 |Positive PFC abnormal in L3 -|24 |Negative PFC abnormal in L3 -|25 |Abnormal in CAN-bus communication -|26 |Abnormal in synchronous signal circuit -|27 |Abnormal in synchronous pulse signal circuit -|28 |Abnormal in host signal circuit -|29 |Male connector of parallel cable not connected well -|30 |Female connector of parallel cable not connected well -|31 |Parallel cable not connected well -|32 |Battery connection not consistent in parallel systems -|33 |AC connection not consistent in parallel systems -|34 |Bypass connection not consistent in parallel systems -|35 |UPS model types not consistent in parallel systems -|36 |Capacity of UPSs not consistent in parallel systems -|37 |Auto restart setting not consistent in parallel systems -|38 |Battery cell over charge -|39 |Battery protection setting not consistent in parallel systems -|40 |Battery detection setting not consistent in parallel systems -|41 |Bypass not allowed setting not consistent in parallel systems -|42 |Converter setting not consistent in parallel systems -|43 |High loss point for frequency in bypass mode not consistent in parallel systems -|44 |Low loss point for frequency in bypass mode not consistent in parallel systems -|45 |High loss point for voltage in bypass mode not consistent in parallel systems -|46 |Low loss point for voltage in bypass mode not consistent in parallel systems -|47 |High loss point for frequency in AC mode not consistent in parallel systems -|48 |Low loss point for frequency in AC mode not consistent in parallel systems -|49 |High loss point for voltage in AC mode not consistent in parallel systems -|50 |Low loss point for voltage in AC mode not consistent in parallel systems -|51 |Warning for locking in bypass mode after 3 consecutive overloads within 30 min -|52 |Warning for three-phase AC input current unbalance -|53 |Warning for a three-phase input current unbalance detected in battery mode -|54 |Warning for Inverter inter-current unbalance -|55 |Programmable outlets cut off pre-alarm -|56 |Warning for Battery replace -|57 |Abnormal warning on input phase angle -|58 |Warning!! Cover of maintain switch is open -|62 |EEPROM operation error +|# |Corresponding Warning +|1 |Battery disconnected +|2 |Neutral not connected +|3 |Site fault +|4 |Phase sequence incorrect +|5 |Phase sequence incorrect in bypass +|6 |Input frequency unstable in bypass +|7 |Battery overcharged +|8 |Low battery +|9 |Overload alarm +|10 |Fan alarm +|11 |EPO enabled +|12 |Unable to turn on UPS +|13 |Over temperature alarm +|14 |Charger alarm +|15 |Remote auto shutdown +|16 |L1 input fuse not working +|17 |L2 input fuse not working +|18 |L3 input fuse not working +|19 |Positive PFC abnormal in L1 +|20 |Negative PFC abnormal in L1 +|21 |Positive PFC abnormal in L2 +|22 |Negative PFC abnormal in L2 +|23 |Positive PFC abnormal in L3 +|24 |Negative PFC abnormal in L3 +|25 |Abnormal in CAN-bus communication +|26 |Abnormal in synchronous signal circuit +|27 |Abnormal in synchronous pulse signal circuit +|28 |Abnormal in host signal circuit +|29 |Male connector of parallel cable not connected well +|30 |Female connector of parallel cable not connected well +|31 |Parallel cable not connected well +|32 |Battery connection not consistent in parallel systems +|33 |AC connection not consistent in parallel systems +|34 |Bypass connection not consistent in parallel systems +|35 |UPS model types not consistent in parallel systems +|36 |Capacity of UPSs not consistent in parallel systems +|37 |Auto restart setting not consistent in parallel systems +|38 |Battery cell over charge +|39 |Battery protection setting not consistent in parallel systems +|40 |Battery detection setting not consistent in parallel systems +|41 |Bypass not allowed setting not consistent in parallel systems +|42 |Converter setting not consistent in parallel systems +|43 |High loss point for frequency in bypass mode not consistent in parallel systems +|44 |Low loss point for frequency in bypass mode not consistent in parallel systems +|45 |High loss point for voltage in bypass mode not consistent in parallel systems +|46 |Low loss point for voltage in bypass mode not consistent in parallel systems +|47 |High loss point for frequency in AC mode not consistent in parallel systems +|48 |Low loss point for frequency in AC mode not consistent in parallel systems +|49 |High loss point for voltage in AC mode not consistent in parallel systems +|50 |Low loss point for voltage in AC mode not consistent in parallel systems +|51 |Warning for locking in bypass mode after 3 consecutive overloads within 30 min +|52 |Warning for three-phase AC input current unbalance +|53 |Warning for a three-phase input current unbalance detected in battery mode +|54 |Warning for Inverter inter-current unbalance +|55 |Programmable outlets cut off pre-alarm +|56 |Warning for Battery replace +|57 |Abnormal warning on input phase angle +|58 |Warning!! Cover of maintain switch is open +|62 |EEPROM operation error |==== AUTHORS ------- -* Daniele Pezzini -* Arnaud Quette -* John Stamp -* Peter Selinger -* Arjen de Korte -* Alexander Gordeev -* Edgar Fuß +Daniele Pezzini , +Arnaud Quette , +John Stamp , +Peter Selinger , +Arjen de Korte , +Alexander Gordeev SEE ALSO @@ -817,9 +637,10 @@ linkman:upsdrvctl[8], linkman:upsmon[8], linkman:upsrw[8] - Internet Resources: ~~~~~~~~~~~~~~~~~~~ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT HCL: http://www.networkupstools.org/stable-hcl.html +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ + +The NUT HCL: http://www.networkupstools.org/stable-hcl.html + diff --git a/docs/man/nutdrv_siemens_sitop.8 b/docs/man/nutdrv_siemens_sitop.8 deleted file mode 100644 index b2f5f74..0000000 --- a/docs/man/nutdrv_siemens_sitop.8 +++ /dev/null @@ -1,269 +0,0 @@ -'\" t -.\" Title: nutdrv_siemens_sitop -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "NUTDRV_SIEMENS_SITOP" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -nutdrv_siemens_sitop \- driver for the Siemens SITOP UPS500 series UPS -.SH "NOTE" -.sp -This man page only documents the hardware\-specific features of the \fBnutdrv_siemens_sitop\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.SH "SUPPORTED HARDWARE" -.sp -\fBnutdrv_siemens_sitop\fR supports Siemens UPS models from the SITOP UPS500 series\&. Some models have a serial port, others have a USB port\&. The models with USB port actually contain a serial\-over\-USB chip, so as far as this driver is concerned, all models are serial models\&. This driver should work with all models in the SITOP UPS500 series, as long as your kernel has support for the serial port device (see section \fBUSB driver\fR below)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This driver has only been tested with the SITOP UPS500S\-2\&.5 with USB port (Siemens product number 6EP1933\-2EC41)\&. -.sp .5v -.RE -.SH "DEVICE SETTINGS" -.sp -The UPS is configured via DIP\-switches\&. For correct functioning in combination with NUT, set the DIP\-switches to the following: -.PP -\fBswitch 1\-4\fR -.RS 4 -Choose whatever suits your situation\&. Any combination will work with NUT\&. -.RE -.PP -\fBswitch 5\fR (⇒ / t) -.RS 4 -Set to OFF (t)\&. This ensures that the UPS will not cut power unless NUT tells it to do so (or unless the batteries are exhausted)\&. -.RE -.PP -\fBswitch 6\-10\fR (delay) -.RS 4 -Set to OFF (minimum delay)\&. Setting a higher delay will actually also work, but any command from NUT will be delayed as well before being executed by the UPS\&. With the minimum setting, it will already take 5 seconds before a command from NUT is executed\&. -.RE -.PP -\fBswitch 11\fR (INTERR\&.) -.RS 4 -Set to ON (interrupt the output after the timer expires)\&. This ensures that the UPS briefly interrupts the output power in response to the shutdown\&.return command\&. See the section -\fBInstant Commands\fR -below\&. -.RE -.PP -\fBswitch 12\fR (ON/OFF) -.RS 4 -set to ON (enable the UPS functionality)\&. Without this, the UPS will never supply power from its batteries\&. -.RE -.SH "USB DRIVER" -.sp -The USB\-versions of the UPS contain an FTDI USB\-to\-serial converter chip\&. It is programmed with a non\-standard product ID (for example \fI0403:e0e3\fR), but can still be used with the normal ftdi_sio driver\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -The following hints may be specific to GNU/Linux\&. -.sp .5v -.RE -.sp -Use \fBlsusb\fR to figure out which product ID is used in your model, and replace all occurrences of \fIe0e3\fR in the following examples with the actual Product ID\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -modprobe ftdi_sio -echo 0403 e0e3 > /sys/bus/usb\-serial/drivers/ftdi_sio/new_id -.fi -.if n \{\ -.RE -.\} -.sp -If your system uses \fBudev\fR, this can be automated via a udev rule: -.sp -.if n \{\ -.RS 4 -.\} -.nf -ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3", \e - RUN+="/sbin/modprobe ftdi_sio", \e - RUN+="/bin/sh \-c \*(Aqecho 0403 e0e3 > /sys/bus/usb\-serial/drivers/ftdi_sio/new_id\*(Aq" -.fi -.if n \{\ -.RE -.\} -.sp -You can use the following udev rule to obtain a predictable device name, for example \fI/dev/ttyUPS\fR: -.sp -.if n \{\ -.RS 4 -.\} -.nf -SUBSYSTEM=="tty" ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3" SYMLINK+="ttyUPS" -.fi -.if n \{\ -.RE -.\} -.SH "POLLING" -.sp -The UPS does not have a special \fIget status\fR command\&. Instead, it continuously sends out status update messages (tens of messages per second)\&. Every \fBpollinterval\fR, these messages are read from the serial port buffer\&. In order to react quickly on status changes from the UPS, and to prevent the serial buffer from overflowing, \fBpollinterval\fR should be set to a relatively low value\&. The recommended value is 1 (second)\&. -.SH "EXTRA ARGUMENTS" -.sp -This driver supports the following optional settings: -.PP -\fBmax_polls_without_data\fR=\fInum\fR -.RS 4 -The serial port is polled periodically for new data (see -\fBPolling\fR)\&. If there is no valid new data after -\fInum\fR -polls, it is assumed that communication with the UPS is lost\&. The default value is 2\&. Lower values may cause spurious -\fIData stale\fR -messages, especially at startup\&. -.RE -.SH "INSTANT COMMANDS" -.PP -\fBshutdown\&.return\fR -.RS 4 -The behavior of this command depends on the line state: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBon line\fR: after 5 seconds (or longer, if DIP switches 6\-10 are not OFF), the UPS will shut off its output\&. After another 5 seconds, the output is activated again\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBon battery\fR: after 5 seconds (or longer, if DIP switches 6\-10 are not OFF), the UPS will shut off its output\&. The output will stay off, until the line voltage has returned\&. -.RE -.RE -.PP -\fBshutdown\&.stayoff\fR -.RS 4 -The behavior of this command depends on the line state: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBon line\fR: after 5 seconds (or longer, if DIP switches 6\-10 are not OFF), the UPS will shut off its output\&. The output stays off, until the line voltage has been removed for at least 1 second, and has been re\-applied\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBon battery\fR: this command behaves the same as -\fBshutdown\&.return\fR\&. -.RE -.RE -.SH "INSTALLATION" -.sp -Make sure that your operating system has created a serial device for the UPS\&. See the section \fBUSB driver\fR for more information\&. -.sp -Next, make sure that NUT has access rights to this device file\&. For example, by creating a udev rule that grants permission to the NUT user, or by adding the NUT user to a user group that can access serial devices (e\&.g\&. the \fBdialout\fR group on Debian\-based systems)\&. -.SH "DIAGNOSTICS" -.sp -You can verify the correct functioning of the hardware, by monitoring the serial port with a terminal program, for example picocom: -.sp -.if n \{\ -.RS 4 -.\} -.nf -picocom \-b 9600 \-d 8 \-p n /dev/ttyUPS -.fi -.if n \{\ -.RE -.\} -.sp -NUT must not be running when you do this\&. You should now see a continuous stream of 5\-character texts coming in, for example: -.sp -.if n \{\ -.RS 4 -.\} -.nf -BUFRD -BA>85 -DC_OK -.fi -.if n \{\ -.RE -.\} -.sp -To exit picocom, use Ctrl\-A Ctrl\-X\&. -.SH "KNOWN ISSUES AND BUGS" -.PP -\fBUntested models\fR -.RS 4 -As mentioned under -\fBSupported hardware\fR, this driver has not been tested with all models in the SITOP UPS500 series\&. -.RE -.PP -\fBData stale messages\fR -.RS 4 -The firmware in these UPSes is quite buggy\&. After sending data to the UPS, it sometimes stops sending status updates\&. This driver tries to prevent this (e\&.g\&. by sending commands twice, and by sending additional LF characters after each command)\&. Once the UPS is in this state, communication can only be restored by rebooting the UPS, or by unplugging and reconnecting the USB cable\&. During normal operation, no commands are sent to the UPS at all (only at shutdown), so this issue is expected to have little impact on usability\&. It is not sure if the serial models are affected by this issue as well\&. -.RE -.SH "AUTHOR" -.sp -Matthijs H\&. ten Berge -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nutdrv_siemens_sitop.txt b/docs/man/nutdrv_siemens_sitop.txt deleted file mode 100644 index 193f99d..0000000 --- a/docs/man/nutdrv_siemens_sitop.txt +++ /dev/null @@ -1,201 +0,0 @@ -NUTDRV_SIEMENS_SITOP(8) -======================= - -NAME ----- - -nutdrv_siemens_sitop - driver for the Siemens SITOP UPS500 series UPS - -NOTE ----- - -This man page only documents the hardware-specific features of the -*nutdrv_siemens_sitop* driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -*nutdrv_siemens_sitop* supports Siemens UPS models from the SITOP UPS500 series. -Some models have a serial port, others have a USB port. -The models with USB port actually contain a serial-over-USB chip, -so as far as this driver is concerned, all models are serial models. -This driver should work with all models in the SITOP UPS500 series, -as long as your kernel has support for the serial port device -(see section *USB driver* below). - -NOTE: This driver has only been tested with the SITOP UPS500S-2.5 -with USB port (Siemens product number 6EP1933-2EC41). - -DEVICE SETTINGS ---------------- - -The UPS is configured via DIP-switches. -For correct functioning in combination with NUT, set the DIP-switches -to the following: - -*switch 1-4*:: -Choose whatever suits your situation. Any combination will work with NUT. - -*switch 5* (=> / t):: -Set to OFF (t). This ensures that the UPS will not cut power unless NUT -tells it to do so (or unless the batteries are exhausted). - -*switch 6-10* (delay):: -Set to OFF (minimum delay). Setting a higher delay will actually also work, -but any command from NUT will be delayed as well before being executed -by the UPS. With the minimum setting, it will already take 5 seconds -before a command from NUT is executed. - -*switch 11* (INTERR.):: -Set to ON (interrupt the output after the timer expires). This ensures that -the UPS briefly interrupts the output power in response to the shutdown.return -command. See the section *Instant Commands* below. - -*switch 12* (ON/OFF):: -set to ON (enable the UPS functionality). Without this, the UPS will never -supply power from its batteries. - -USB driver ----------- - -The USB-versions of the UPS contain an FTDI USB-to-serial converter chip. -It is programmed with a non-standard product ID (for example _0403:e0e3_), -but can still be used with the normal ftdi_sio driver. - -NOTE: The following hints may be specific to GNU/Linux. - -Use *lsusb* to figure out which product ID is used in your model, and -replace all occurrences of _e0e3_ in the following examples with the actual -Product ID. - -.... -modprobe ftdi_sio -echo 0403 e0e3 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id -.... - -If your system uses *udev*, this can be automated via a udev rule: - ----- -ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3", \ - RUN+="/sbin/modprobe ftdi_sio", \ - RUN+="/bin/sh -c 'echo 0403 e0e3 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'" ----- - -You can use the following udev rule to obtain a predictable device name, -for example _/dev/ttyUPS_: ----- -SUBSYSTEM=="tty" ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3" SYMLINK+="ttyUPS" ----- - -POLLING -------- - -The UPS does not have a special 'get status' command. Instead, it continuously -sends out status update messages (tens of messages per second). -Every *pollinterval*, these messages are read from the serial port buffer. -In order to react quickly on status changes from the UPS, and to prevent the serial buffer -from overflowing, *pollinterval* should be set to a relatively low value. The recommended -value is 1 (second). - -EXTRA ARGUMENTS ---------------- - -This driver supports the following optional settings: - -*max_polls_without_data*='num':: -The serial port is polled periodically for new data (see *Polling*). -If there is no valid new data after 'num' polls, it is assumed that communication -with the UPS is lost. -The default value is 2. Lower values may cause spurious 'Data stale' messages, -especially at startup. - -INSTANT COMMANDS ----------------- - -*shutdown.return*:: -The behavior of this command depends on the line state: - -* *on line*: after 5 seconds (or longer, if DIP switches 6-10 are not OFF), -the UPS will shut off its output. After another 5 seconds, the output is -activated again. -* *on battery*: after 5 seconds (or longer, if DIP switches 6-10 are not OFF), -the UPS will shut off its output. The output will stay off, until the -line voltage has returned. - -*shutdown.stayoff*:: -The behavior of this command depends on the line state: - -* *on line*: after 5 seconds (or longer, if DIP switches 6-10 are not OFF), -the UPS will shut off its output. The output stays off, until the line voltage -has been removed for at least 1 second, and has been re-applied. -* *on battery*: this command behaves the same as *shutdown.return*. - -INSTALLATION ------------- - -Make sure that your operating system has created a serial device for the UPS. -See the section *USB driver* for more information. - -Next, make sure that NUT has access rights to this device file. -For example, by creating a udev rule that grants permission to the NUT user, -or by adding the NUT user to a user group that can access serial devices -(e.g. the *dialout* group on Debian-based systems). - -DIAGNOSTICS ------------ - -You can verify the correct functioning of the hardware, by monitoring the -serial port with a terminal program, for example picocom: - -.... -picocom -b 9600 -d 8 -p n /dev/ttyUPS -.... - -NUT must not be running when you do this. -You should now see a continuous stream of 5-character texts coming in, -for example: - -.... -BUFRD -BA>85 -DC_OK -.... -To exit picocom, use Ctrl-A Ctrl-X. - -KNOWN ISSUES AND BUGS ---------------------- - -*Untested models*:: -As mentioned under *Supported hardware*, this driver has not been tested -with all models in the SITOP UPS500 series. - -*Data stale messages*:: -The firmware in these UPSes is quite buggy. After sending data to the UPS, -it sometimes stops sending status updates. This driver tries to prevent this -(e.g. by sending commands twice, and by sending additional LF characters after -each command). -Once the UPS is in this state, communication can only be restored by rebooting -the UPS, or by unplugging and reconnecting the USB cable. -During normal operation, no commands are sent to the UPS at all -(only at shutdown), so this issue is expected to have little impact on -usability. -It is not sure if the serial models are affected by this issue as well. - -AUTHOR ------- - -Matthijs H. ten Berge - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/nutscan.3 b/docs/man/nutscan.3 index 22c4df4..6451be4 100644 --- a/docs/man/nutscan.3 +++ b/docs/man/nutscan.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,7 +33,7 @@ nutscan \- Network UPS Tools (NUT) device discovery library .sp The Network UPS Tools (NUT) \fBnutscan\fR library provides the same discovery related features that are also offered by \fBnut-scanner\fR(8)\&. .sp -It enables the discovery of supported NUT devices (USB, SNMP, Eaton XML/HTTP and IPMI) and NUT servers (either using Avahi, or the classic connection method)\&. +It enables the discovery of supported NUT devices (USB, SNMP, Eaton XML/HTTP and IPMI) and NUT servers (using Avahi, or the classic connection method)\&. .SH "DISCOVERY FUNCTIONS" .sp First, include the required header file: @@ -58,6 +58,7 @@ Then, to discover new devices, use the appropriate function: .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_scan_usb\fR(3) for supported USB devices, .RE @@ -70,6 +71,7 @@ for supported USB devices, .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_scan_snmp\fR(3) for supported SNMP agents, .RE @@ -82,7 +84,8 @@ for supported SNMP agents, .sp -1 .IP \(bu 2.3 .\} -\fBnutscan_scan_xml_http_range\fR(3) + +\fBnutscan_scan_xml_http\fR(3) for Eaton Network Management Card, .RE .sp @@ -94,8 +97,9 @@ for Eaton Network Management Card, .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_scan_nut\fR(3) -for NUT servers (upsd), using the classic method (search for port), +for NUT servers (upsd), using the classic method, .RE .sp .RS 4 @@ -106,6 +110,7 @@ for NUT servers (upsd), using the classic method (search for port), .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_scan_avahi\fR(3) for NUT servers (upsd), using the mDNS (Avahi) method, .RE @@ -118,6 +123,7 @@ for NUT servers (upsd), using the mDNS (Avahi) method, .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_scan_ipmi\fR(3) for supported IPMI PSU\&. .RE @@ -134,6 +140,7 @@ Helper functions are also provided to output data using standard formats: .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_display_parsable\fR(3) for parsable output, .RE @@ -146,6 +153,7 @@ for parsable output, .sp -1 .IP \(bu 2.3 .\} + \fBnutscan_display_ups_conf\fR(3) for ups\&.conf style\&. .RE @@ -154,7 +162,4 @@ for ups\&.conf style\&. There is currently no specific mechanism for error handling\&. .SH "SEE ALSO" .sp -\fBnut-scanner\fR(8), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3) -.SS "Internet resources:" -.sp -http://avahi\&.org/ +\fBnut-scanner\fR(8), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3), http://avahi\&.org/ diff --git a/docs/man/nutscan.txt b/docs/man/nutscan.txt index 99cb247..90ac366 100644 --- a/docs/man/nutscan.txt +++ b/docs/man/nutscan.txt @@ -13,8 +13,7 @@ The Network UPS Tools (NUT) *nutscan* library provides the same discovery related features that are also offered by linkman:nut-scanner[8]. It enables the discovery of supported NUT devices (USB, SNMP, Eaton XML/HTTP -and IPMI) and NUT servers (either using Avahi, or the classic connection -method). +and IPMI) and NUT servers (using Avahi, or the classic connection method). DISCOVERY FUNCTIONS @@ -28,17 +27,14 @@ Then, to discover new devices, use the appropriate function: - linkman:nutscan_scan_usb[3] for supported USB devices, - linkman:nutscan_scan_snmp[3] for supported SNMP agents, -- linkman:nutscan_scan_xml_http_range[3] for Eaton Network Management Card, -- linkman:nutscan_scan_nut[3] for NUT servers (upsd), using the classic - method (search for port), -- linkman:nutscan_scan_avahi[3] for NUT servers (upsd), using the mDNS - (Avahi) method, +- linkman:nutscan_scan_xml_http[3] for Eaton Network Management Card, +- linkman:nutscan_scan_nut[3] for NUT servers (upsd), using the classic method, +- linkman:nutscan_scan_avahi[3] for NUT servers (upsd), using the mDNS (Avahi) method, - linkman:nutscan_scan_ipmi[3] for supported IPMI PSU. -All of these functions return a list of devices found, using the -`nutscan_device_t` structure. This structure is described in -linkman:nutscan_add_device_to_device[3]. +All of these functions return a list of devices found, using the nutscan_device_t +structure. This structure is described in linkman:nutscan_add_device_to_device[3]. Helper functions are also provided to output data using standard formats: @@ -48,24 +44,17 @@ Helper functions are also provided to output data using standard formats: ERROR HANDLING -------------- - There is currently no specific mechanism for error handling. SEE ALSO -------- - linkman:nut-scanner[8], linkman:nutscan_scan_usb[3], linkman:nutscan_scan_snmp[3], -linkman:nutscan_scan_xml_http_range[3], linkman:nutscan_scan_nut[3], +linkman:nutscan_scan_xml_http[3], linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_parsable[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], -linkman:nutscan_add_device_to_device[3], -linkman:nutscan_add_option_to_device[3], -linkman:nutscan_cidr_to_ip[3] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +linkman:nutscan_add_device_to_device[3], linkman:nutscan_add_option_to_device[3], +linkman:nutscan_cidr_to_ip[3], http://avahi.org/ diff --git a/docs/man/nutscan_add_device_to_device.3 b/docs/man/nutscan_add_device_to_device.3 index d571750..89fc442 100644 --- a/docs/man/nutscan_add_device_to_device.3 +++ b/docs/man/nutscan_add_device_to_device.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_add_device_to_device -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_ADD_DEVICE_T" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_ADD_DEVICE_T" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,9 +36,7 @@ nutscan_add_device_to_device \- Concatenate two devices structure\&. .fi .sp .nf -nutscan_device_t * nutscan_add_device_to_device( - nutscan_device_t * first, - nutscan_device_t * second); +nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutscan_device_t * second); .fi .SH "DESCRIPTION" .sp @@ -61,13 +59,10 @@ struct nutscan_device * next; .sp This is a double linked list of device\&. Each device is described by its type, its driver name, its port and any number of optional data\&. .sp -The \fBnutscan_add_device_to_device()\fR concatenates \fIfirst\fR and \fIsecond\fR devices to a unique device\&. No new device is created, the two linked lists are simply linked to each other\&. So \fIfirst\fR and \fIsecond\fR devices are likely to be modified by this function\&. +The \fBnutscan_add_device_to_device()\fR concatenates \fIfirst\fR and \fIsecond\fR devices to a unique device\&. No new device is created, the two linked list are simply linked to each other\&. So \fIfirst\fR and \fIsecond\fR devices are likely to be modified by this function\&. .SH "RETURN VALUE" .sp -The \fBnutscan_add_device_to_device()\fR functions returns a pointer to a device containing both passed devices\&. Note that it\(cqs not a new device, so it is either \fIfirst\fR or \fIsecond\fR which is returned\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-device\&.h\fR file\&. +The \fBnutscan_add_device_to_device()\fR functions returns a pointer to a device containg both passed devices\&. Note that it\(cqs not a new device, so it is either \fIfirst\fR or \fIsecond\fR which is returned\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3) diff --git a/docs/man/nutscan_add_device_to_device.txt b/docs/man/nutscan_add_device_to_device.txt index 6f5aed6..7ccc3c8 100644 --- a/docs/man/nutscan_add_device_to_device.txt +++ b/docs/man/nutscan_add_device_to_device.txt @@ -11,9 +11,7 @@ SYNOPSIS #include - nutscan_device_t * nutscan_add_device_to_device( - nutscan_device_t * first, - nutscan_device_t * second); + nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutscan_device_t * second); DESCRIPTION @@ -22,37 +20,25 @@ DESCRIPTION The `nutscan_device_t` contains the following variables: nutscan_device_type_t type; - char * driver; - char * port; - nutscan_options_t opt; - struct nutscan_device * prev; - struct nutscan_device * next; + char * driver; + char * port; + nutscan_options_t opt; + struct nutscan_device * prev; + struct nutscan_device * next; -This is a double linked list of device. Each device is described by its -`type`, its `driver` name, its `port` and any number of optional data. +This is a double linked list of device. Each device is described by its `type`, its `driver` name, its `port` and any number of optional data. -The *nutscan_add_device_to_device()* concatenates 'first' and 'second' -devices to a unique device. No new device is created, the two linked -lists are simply linked to each other. So 'first' and 'second' devices -are likely to be modified by this function. +The *nutscan_add_device_to_device()* concatenates 'first' and 'second' devices to a unique device. No new device is created, the two linked list are simply linked to each other. So 'first' and 'second' devices are likely to be modified by this function. RETURN VALUE ------------ -The *nutscan_add_device_to_device()* functions returns a pointer to a -device containing both passed devices. Note that it's not a new device, -so it is either 'first' or 'second' which is returned. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-device.h' file. +The *nutscan_add_device_to_device()* functions returns a pointer to a device containg both passed devices. Note that it's not a new device, so it is either 'first' or 'second' which is returned. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], diff --git a/docs/man/nutscan_add_option_to_device.3 b/docs/man/nutscan_add_option_to_device.3 index 8599526..f0947f3 100644 --- a/docs/man/nutscan_add_option_to_device.3 +++ b/docs/man/nutscan_add_option_to_device.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_add_option_to_device -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_ADD_OPTION_T" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_ADD_OPTION_T" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,10 +36,7 @@ nutscan_add_option_to_device \- Add option data to the specified device\&. .fi .sp .nf -void nutscan_add_option_to_device( - nutscan_device_t * device, - char * option_name, - char * value); +void nutscan_add_option_to_device(nutscan_device_t * device,char * option_name, char * value); .fi .SH "DESCRIPTION" .sp @@ -62,10 +59,7 @@ struct nutscan_device * next; .sp This is a double linked list of device\&. Each device is described by its type, its driver name, its port and any number of optional data\&. .sp -The \fBnutscan_add_option_to_device()\fR adds an optional data in the given device\&. Optional data are made of an \fIoption_name\fR and an associated \fIvalue\fR\&. Copies of \fIoption_name\fR and \fIvalue\fR are stored in the device, so the caller can safely free both of the original strings used as arguments\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-device\&.h\fR file\&. +The \fBnutscan_add_option_to_device()\fR adds an optional data in the given devcie\&. Optional data are made of an \fIoption_name\fR and an associated \fIvalue\fR\&. Copies of \fIoption_name\fR and \fIvalue\fR are stored in the device, so the caller can safely free both of them\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_device_to_device\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_device_to_device\fR(3) diff --git a/docs/man/nutscan_add_option_to_device.txt b/docs/man/nutscan_add_option_to_device.txt index 2dbf669..636f056 100644 --- a/docs/man/nutscan_add_option_to_device.txt +++ b/docs/man/nutscan_add_option_to_device.txt @@ -11,10 +11,7 @@ SYNOPSIS #include - void nutscan_add_option_to_device( - nutscan_device_t * device, - char * option_name, - char * value); + void nutscan_add_option_to_device(nutscan_device_t * device,char * option_name, char * value); DESCRIPTION @@ -23,31 +20,20 @@ DESCRIPTION The `nutscan_device_t` contains the following variables: nutscan_device_type_t type; - char * driver; - char * port; - nutscan_options_t opt; - struct nutscan_device * prev; - struct nutscan_device * next; + char * driver; + char * port; + nutscan_options_t opt; + struct nutscan_device * prev; + struct nutscan_device * next; -This is a double linked list of device. Each device is described by -its `type`, its `driver` name, its `port` and any number of optional data. +This is a double linked list of device. Each device is described by its `type`, its `driver` name, its `port` and any number of optional data. -The *nutscan_add_option_to_device()* adds an optional data in the -given device. Optional data are made of an 'option_name' and an -associated 'value'. Copies of 'option_name' and 'value' are stored -in the device, so the caller can safely free both of the original -strings used as arguments. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-device.h' file. +The *nutscan_add_option_to_device()* adds an optional data in the given devcie. Optional data are made of an 'option_name' and an associated 'value'. Copies of 'option_name' and 'value' are stored in the device, so the caller can safely free both of them. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], diff --git a/docs/man/nutscan_cidr_to_ip.3 b/docs/man/nutscan_cidr_to_ip.3 index c572999..e8fe9e8 100644 --- a/docs/man/nutscan_cidr_to_ip.3 +++ b/docs/man/nutscan_cidr_to_ip.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_cidr_to_ip -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_CIDR_TO_IP" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_CIDR_TO_IP" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,15 +40,10 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_cidr_to_ip()\fR function converts a range of IP address in the CIDR format given as a string in \fIcidr\fR, to two IPs in strings pointed by \fIstart_ip\fR and \fIstop_ip\fR which can be used as input parameters in the scanning functions of the libnutscan API\&. -.sp -It is the caller\(cqs responsibility to free \fIstart_ip\fR and \fIstop_ip\fR strings\&. +The \fBnutscan_cidr_to_ip()\fR function converts a range of IP address in the CIDR format given as a string in \fIcidr\fR, to two IPs in strings pointed by \fIstart_ip\fR and \fIstop_ip\fR which can be used as input paramters in the scanning functions of the libnutscan API\&. It is the caller\(cqs responsability to free \fIstart_ip\fR and \fIstop_ip\fR strings\&. .SH "RETURN VALUE" .sp -The \fBnutscan_cidr_to_ip()\fR function returns 0 if an error occurred (invalid \fIcidr\fR address) or 1 if successful\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-ip\&.h\fR file\&. +The \fBnutscan_cidr_to_ip()\fR function returns 0 if an error occured (invalid \fIcidr\fR address) or 1 if successful\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3) diff --git a/docs/man/nutscan_cidr_to_ip.txt b/docs/man/nutscan_cidr_to_ip.txt index 5f18213..6ebe237 100644 --- a/docs/man/nutscan_cidr_to_ip.txt +++ b/docs/man/nutscan_cidr_to_ip.txt @@ -16,28 +16,16 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_cidr_to_ip()* function converts a range of IP address in -the CIDR format given as a string in 'cidr', to two IPs in strings -pointed by 'start_ip' and 'stop_ip' which can be used as input -parameters in the scanning functions of the libnutscan API. - -It is the caller's responsibility to free 'start_ip' and 'stop_ip' strings. +The *nutscan_cidr_to_ip()* function converts a range of IP address in the CIDR format given as a string in 'cidr', to two IPs in strings pointed by 'start_ip' and 'stop_ip' which can be used as input paramters in the scanning functions of the libnutscan API. It is the caller's responsability to free 'start_ip' and 'stop_ip' strings. RETURN VALUE ------------ -The *nutscan_cidr_to_ip()* function returns 0 if an error occurred -(invalid 'cidr' address) or 1 if successful. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-ip.h' file. +The *nutscan_cidr_to_ip()* function returns 0 if an error occured (invalid 'cidr' address) or 1 if successful. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_parsable[3], linkman:nutscan_display_ups_conf[3] diff --git a/docs/man/nutscan_display_parsable.3 b/docs/man/nutscan_display_parsable.3 index 3df0739..bd020f6 100644 --- a/docs/man/nutscan_display_parsable.3 +++ b/docs/man/nutscan_display_parsable.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_display_parsable -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_DISPLAY_PARS" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_DISPLAY_PARS" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,48 +42,9 @@ void nutscan_display_parsable(nutscan_device_t * device); .sp The \fBnutscan_display_parsable()\fR function displays all NUT devices in \fIdevice\fR to stdout\&. It displays them in a way that can be easily parsed which is: .sp -.if n \{\ -.RS 4 -.\} -.nf -:driver="",port=""[,="",="",\&.\&.\&.] -.fi -.if n \{\ -.RE -.\} +:driver="",port=""[,="",="",\&...] .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - may be one of USB, SNMP, XML, NUT, IPMI or AVAHI\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - is the name of the driver\(cqs binary corresponding to this device\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} - and depend on , see the corresponding driver\(cqs man page\&. -.RE + may be one of USB, SNMP, XML, NUT, IPMI or AVAHI\&. is the name of the driver\(cqs binary corresponding to this device\&. and depend on , see the corresponding driver\(cqs man page\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3) diff --git a/docs/man/nutscan_display_parsable.txt b/docs/man/nutscan_display_parsable.txt index 9e27515..7379d65 100644 --- a/docs/man/nutscan_display_parsable.txt +++ b/docs/man/nutscan_display_parsable.txt @@ -4,8 +4,7 @@ NUTSCAN_DISPLAY_PARSABLE(3) NAME ---- -nutscan_display_parsable - Display the specified `nutscan_device_t` -structure on stdout. +nutscan_display_parsable - Display the specified `nutscan_device_t` structure on stdout. SYNOPSIS -------- @@ -17,24 +16,19 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_display_parsable()* function displays all NUT devices in -'device' to stdout. It displays them in a way that can be easily parsed -which is: +The *nutscan_display_parsable()* function displays all NUT devices in 'device' to stdout. It displays them in a way that can be easily parsed which is: - :driver="",port=""[,="",="",...] +:driver="",port=""[,="",="",...] -* may be one of USB, SNMP, XML, NUT, IPMI or AVAHI. -* is the name of the driver's binary corresponding - to this device. -* and depend on , - see the corresponding driver's man page. + may be one of USB, SNMP, XML, NUT, IPMI or AVAHI. + is the name of the driver's binary corresponding to this device. + and depend on , see the corresponding driver's man page. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_cidr_to_ip[3] diff --git a/docs/man/nutscan_display_ups_conf.3 b/docs/man/nutscan_display_ups_conf.3 index 955d042..f568e3f 100644 --- a/docs/man/nutscan_display_ups_conf.3 +++ b/docs/man/nutscan_display_ups_conf.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_display_ups_conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_DISPLAY_UPS_" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_DISPLAY_UPS_" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,7 +40,7 @@ void nutscan_display_ups_conf(nutscan_device_t * device); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_display_ups_conf()\fR function displays all NUT devices in \fIdevice\fR to stdout\&. It displays them in a way that it can be directly copied into the \fIups\&.conf\fR file\&. +The \fBnutscan_display_ups_conf()\fR function displays all NUT devices in \fIdevice\fR to stdout\&. It displays them in a way that it can be directly copied into the ups\&.conf file\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3) diff --git a/docs/man/nutscan_display_ups_conf.txt b/docs/man/nutscan_display_ups_conf.txt index b79c90f..8d95e07 100644 --- a/docs/man/nutscan_display_ups_conf.txt +++ b/docs/man/nutscan_display_ups_conf.txt @@ -4,8 +4,7 @@ NUTSCAN_DISPLAY_UPS_CONF(3) NAME ---- -nutscan_display_ups_conf - Display the specified `nutscan_device_t` -structure on stdout. +nutscan_display_ups_conf - Display the specified `nutscan_device_t` structure on stdout. SYNOPSIS -------- @@ -17,16 +16,13 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_display_ups_conf()* function displays all NUT devices in -'device' to stdout. It displays them in a way that it can be directly -copied into the 'ups.conf' file. +The *nutscan_display_ups_conf()* function displays all NUT devices in 'device' to stdout. It displays them in a way that it can be directly copied into the ups.conf file. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_cidr_to_ip[3] diff --git a/docs/man/nutscan_free_device.3 b/docs/man/nutscan_free_device.3 index 6c13797..7ba5008 100644 --- a/docs/man/nutscan_free_device.3 +++ b/docs/man/nutscan_free_device.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_free_device -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_FREE_DEVICE" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_FREE_DEVICE" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,7 +28,7 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -nutscan_free_device \- Free a `nutscan_device_t` structure created by `nutscan_new_device`\&. +nutscan_free_device \- Free a nutscan_device_t structure created by nutscan_new_device\&. .SH "SYNOPSIS" .sp .nf @@ -40,10 +40,7 @@ void nutscan_free_device(nutscan_device_t * device); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_free_device()\fR function can free a nutscan_device_type_t structure\&. Doing so, it frees the whole linked list, not only the given device\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-device\&.h\fR file\&. +The \fBnutscan_free_device()\fR function free a nutscan_device_type_t structure\&. Doing so, it free the whole linked list, not only the given device\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3) diff --git a/docs/man/nutscan_free_device.txt b/docs/man/nutscan_free_device.txt index 4420f36..062bb4b 100644 --- a/docs/man/nutscan_free_device.txt +++ b/docs/man/nutscan_free_device.txt @@ -4,8 +4,7 @@ NUTSCAN_FREE_DEVICE(3) NAME ---- -nutscan_free_device - Free a `nutscan_device_t` structure created by -`nutscan_new_device`. +nutscan_free_device - Free a nutscan_device_t structure created by nutscan_new_device. SYNOPSIS -------- @@ -17,20 +16,12 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_free_device()* function can free a `nutscan_device_type_t` -structure. Doing so, it frees the whole linked list, not only the given -device. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-device.h' file. +The *nutscan_free_device()* function free a `nutscan_device_type_t` structure. Doing so, it free the whole linked list, not only the given device. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_add_option_to_device[3], diff --git a/docs/man/nutscan_get_serial_ports_list.3 b/docs/man/nutscan_get_serial_ports_list.3 index 9758534..f40111c 100644 --- a/docs/man/nutscan_get_serial_ports_list.3 +++ b/docs/man/nutscan_get_serial_ports_list.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_get_serial_ports_list -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_GET_SERIAL_P" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_GET_SERIAL_P" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,7 +40,7 @@ char ** nutscan_get_serial_ports_list(const char *ports_range); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_get_serial_ports_list()\fR function returns a null terminated array of strings generated from a port range\&. \fIports_range\fR may be one of: +The \fBnutscan_get_serial_ports_list()\fR function returns a null terminated array of string generated from a port range\&. \fIports_range\fR may be one of: .sp .RS 4 .ie n \{\ @@ -50,7 +50,7 @@ The \fBnutscan_get_serial_ports_list()\fR function returns a null terminated arr .sp -1 .IP \(bu 2.3 .\} -a single character from 0 to 9 or a to z representing a serial communication port depending on the operating system\&. For instance "0" is converted to /dev/ttyS0 and /dev/ttyUSB0 on Linux; "1" is converted to COM1 on Windows; "c" is converted to /dev/ttyc on Solaris\&... +a single character from 0 to 9 or a to z representing a serial communication port depending on the operating system\&. For instance "0" is converted to /dev/ttyS0 and /dev/ttyUSB0 on Linux; "1" is converted to COM1 on Windows; "c" is converted to /dev/ttyc on solaris\&... .RE .sp .RS 4 @@ -83,16 +83,13 @@ a single port name (/dev/ttyS5, COM4\&...)\&. .sp -1 .IP \(bu 2.3 .\} -a list of port names separated with commas: "/dev/ttyS0,/dev/ttyS2,/dev/ttyS4" or "COM1,COM3"\&... +a list of port names separated with comas : "/dev/ttyS0,/dev/ttyS2,/dev/ttyS4" or "COM1,COM3"\&... .RE .sp The returned array can be used in a call to \fBnutscan_scan_eaton_serial\fR to get the serial device on a system\&. .SH "RETURN VALUE" .sp -The \fBnutscan_get_serial_ports_list()\fR function returns NULL if an error occurred (invalid port range) or a pointer to a null terminated array of strings on success\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-serial\&.h\fR file\&. +The \fBnutscan_get_serial_ports_list()\fR function returns NULL if an error occured (invalid port range) or a pointer to a nll terminated array of string on success\&. .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_display_ups_conf\fR(3) diff --git a/docs/man/nutscan_get_serial_ports_list.txt b/docs/man/nutscan_get_serial_ports_list.txt index 8b38bed..dfe0d65 100644 --- a/docs/man/nutscan_get_serial_ports_list.txt +++ b/docs/man/nutscan_get_serial_ports_list.txt @@ -16,44 +16,25 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_get_serial_ports_list()* function returns a null -terminated array of strings generated from a port range. +The *nutscan_get_serial_ports_list()* function returns a null terminated array of string generated from a port range. 'ports_range' may be one of: - - a single character from 0 to 9 or a to z representing a serial - communication port depending on the operating system. For instance - "0" is converted to /dev/ttyS0 and /dev/ttyUSB0 on Linux; - "1" is converted to COM1 on Windows; - "c" is converted to /dev/ttyc on Solaris... - - a range of character in the form "X-Y". For instance - "0-1" will be converted to /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0 - and /dev/ttyUSB1 on Linux; - "1-3" will be converted to COM1, COM2 and COM3 on Windows; - "a-c" will be converted to /dev/ttya, /dev/ttyb and /dev/ttyc on Solaris. + - a single character from 0 to 9 or a to z representing a serial communication port depending on the operating system. For instance "0" is converted to /dev/ttyS0 and /dev/ttyUSB0 on Linux; "1" is converted to COM1 on Windows; "c" is converted to /dev/ttyc on solaris... + - a range of character in the form "X-Y". For instance "0-1" will be converted to /dev/ttyS0, /dev/ttyS1, /dev/ttyUSB0 and /dev/ttyUSB1 on Linux; "1-3" will be converted to COM1, COM2 and COM3 on Windows; "a-c" will be converted to /dev/ttya, /dev/ttyb and /dev/ttyc on Solaris. - a single port name (/dev/ttyS5, COM4...). - - a list of port names separated with commas: - "/dev/ttyS0,/dev/ttyS2,/dev/ttyS4" or "COM1,COM3"... + - a list of port names separated with comas : "/dev/ttyS0,/dev/ttyS2,/dev/ttyS4" or "COM1,COM3"... -The returned array can be used in a call to *nutscan_scan_eaton_serial* -to get the serial device on a system. +The returned array can be used in a call to *nutscan_scan_eaton_serial* to get the serial device on a system. RETURN VALUE ------------ -The *nutscan_get_serial_ports_list()* function returns NULL if an error -occurred (invalid port range) or a pointer to a null terminated array -of strings on success. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-serial.h' file. +The *nutscan_get_serial_ports_list()* function returns NULL if an error occured (invalid port range) or a pointer to a nll terminated array of string on success. SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_eaton_serial[3], linkman:nutscan_display_parsable[3], linkman:nutscan_display_ups_conf[3] diff --git a/docs/man/nutscan_init.3 b/docs/man/nutscan_init.3 index 8afbfd1..8dbcb48 100644 --- a/docs/man/nutscan_init.3 +++ b/docs/man/nutscan_init.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_init -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_INIT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_INIT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,15 +36,13 @@ nutscan_init \- Initialize the nutscan library\&. .fi .sp .nf -void nutscan_init(void); +void nutscan_init(); .fi .SH "DESCRIPTION" .sp The \fBnutscan_init()\fR function must be called at least once before using any other function of the nutscan library\&. .sp -It updates the following global variables which can be used by nutscan library user to know which scan methods are available at run\-time\&. -.sp -This depends on the libraries installed on the system: +It updates the following global variables which can be used by nutscan library user to know which scan methods are available at run\-time\&. This depends on the libraries installed on the system: .sp .if n \{\ .RS 4 @@ -62,9 +60,6 @@ nutscan_avail_xml_http = 1 : XML HTTP method is available .\} .sp Note that if a method is reported as unavailable by those variables, the call to the corresponding nutscan_scan_* function will always return NULL\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-init\&.h\fR file\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3) diff --git a/docs/man/nutscan_init.txt b/docs/man/nutscan_init.txt index 17e6ddf..203eb63 100644 --- a/docs/man/nutscan_init.txt +++ b/docs/man/nutscan_init.txt @@ -11,18 +11,14 @@ SYNOPSIS #include - void nutscan_init(void); + void nutscan_init(); DESCRIPTION ----------- -The *nutscan_init()* function must be called at least once before using -any other function of the nutscan library. +The *nutscan_init()* function must be called at least once before using any other function of the nutscan library. -It updates the following global variables which can be used by nutscan -library user to know which scan methods are available at run-time. - -This depends on the libraries installed on the system: +It updates the following global variables which can be used by nutscan library user to know which scan methods are available at run-time. This depends on the libraries installed on the system: nutscan_avail_avahi = 1 : AVAHI scan is available nutscan_avail_ipmi = 1 : IPMI scan is available @@ -31,21 +27,14 @@ This depends on the libraries installed on the system: nutscan_avail_usb = 1 : USB method is available nutscan_avail_xml_http = 1 : XML HTTP method is available -Note that if a method is reported as unavailable by those variables, the -call to the corresponding `nutscan_scan_*` function will always return NULL. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-init.h' file. +Note that if a method is reported as unavailable by those variables, the call to the corresponding nutscan_scan_* function will always return NULL. SEE ALSO -------- - linkman:nutscan_init[3], linkman:nutscan_scan_usb[3], -linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3] diff --git a/docs/man/nutscan_new_device.3 b/docs/man/nutscan_new_device.3 index 8ae2ecf..ccce712 100644 --- a/docs/man/nutscan_new_device.3 +++ b/docs/man/nutscan_new_device.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_new_device -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_NEW_DEVICE" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_NEW_DEVICE" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,17 +36,14 @@ nutscan_new_device \- Create a new nutscan_device_t structure\&. .fi .sp .nf -nutscan_device_t * nutscan_new_device(void); +nutscan_device_t * nutscan_new_device(); .fi .SH "DESCRIPTION" .sp The \fBnutscan_new_device()\fR function allocates a new nutscan_device_type_t structure\&. .SH "RETURN VALUE" .sp -The \fBnutscan_new_device()\fR function returns the newly allocated nutscan_device_type_t structure\&. -.SH "NOTES" -.sp -Technically, the function is currently defined in \fInutscan\-device\&.h\fR file\&. +The \fBnutscan_new_device()\fR function returns the newly allocated nutscan_device_type_t structure .SH "SEE ALSO" .sp -\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3) \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3) \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3) \fBnutscan_add_device_to_device\fR(3) +\fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_scan_snmp\fR(3) \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3) \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3) \fBnutscan_add_device_to_device\fR(3) diff --git a/docs/man/nutscan_new_device.txt b/docs/man/nutscan_new_device.txt index 81cf26d..1b887cc 100644 --- a/docs/man/nutscan_new_device.txt +++ b/docs/man/nutscan_new_device.txt @@ -11,30 +11,22 @@ SYNOPSIS #include - nutscan_device_t * nutscan_new_device(void); + nutscan_device_t * nutscan_new_device(); DESCRIPTION ----------- -The *nutscan_new_device()* function allocates a new `nutscan_device_type_t` -structure. +The *nutscan_new_device()* function allocates a new `nutscan_device_type_t` structure. RETURN VALUE ------------ -The *nutscan_new_device()* function returns the newly allocated -`nutscan_device_type_t` structure. - -NOTES ------ - -Technically, the function is currently defined in 'nutscan-device.h' file. +The *nutscan_new_device()* function returns the newly allocated `nutscan_device_type_t` structure SEE ALSO -------- - -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], linkman:nutscan_scan_ipmi[3], linkman:nutscan_scan_snmp[3] linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3] linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3] diff --git a/docs/man/nutscan_scan_avahi.3 b/docs/man/nutscan_scan_avahi.3 index c7c52a9..acadc07 100644 --- a/docs/man/nutscan_scan_avahi.3 +++ b/docs/man/nutscan_scan_avahi.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_avahi -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_AVAHI" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_AVAHI" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,11 +33,10 @@ nutscan_scan_avahi \- Scan network for NUT services via mDNS .sp .nf #include -#include /* useconds_t */ .fi .sp .nf -nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout); +nutscan_device_t * nutscan_scan_avahi(long usec_timeout); .fi .SH "DESCRIPTION" .sp @@ -45,15 +44,10 @@ The \fBnutscan_scan_avahi()\fR function tries to detect the NUT service via mDNS .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. .sp -This function can query perspective IP addresses using NUT protocol, and in this case it waits up to \fIusec_timeout\fR microseconds before considering an IP address to be unresponsive\&. +This function waits up to \fIusec_timeout\fR microseconds before considering an IP address to be unresponsive\&. .SH "RETURN VALUE" .sp -The \fBnutscan_scan_avahi()\fR function returns a pointer to a nutscan_device_t structure containing all found devices\&. -.sp -It returns NULL if an error occurs, or if no device is found\&. +The \fBnutscan_scan_avahi()\fR function returns a pointer to a nutscan_device_t structure containing all found devices\&. It returns NULL if an error occurs, or if no device is found\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3), \fBnutscan_scan_eaton_serial\fR(3) -.SS "Internet resources:" -.sp -http://avahi\&.org/ +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_cidr_to_ip\fR(3), \fBnutscan_scan_eaton_serial\fR(3), http://avahi\&.org/ diff --git a/docs/man/nutscan_scan_avahi.txt b/docs/man/nutscan_scan_avahi.txt index 01f02e9..fe82e12 100644 --- a/docs/man/nutscan_scan_avahi.txt +++ b/docs/man/nutscan_scan_avahi.txt @@ -10,43 +10,35 @@ SYNOPSIS -------- #include - #include /* useconds_t */ - nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout); + nutscan_device_t * nutscan_scan_avahi(long usec_timeout); DESCRIPTION ----------- -The *nutscan_scan_avahi()* function tries to detect the NUT service via -mDNS, and its associated devices. It uses the Avahi library to do so. +The *nutscan_scan_avahi()* function tries to detect the NUT service via mDNS, +and its associated devices. It uses the Avahi library to do so. You MUST call linkman:nutscan_init[3] before using this function. -This function can query perspective IP addresses using NUT protocol, and -in this case it waits up to 'usec_timeout' microseconds before considering -an IP address to be unresponsive. +This function waits up to 'usec_timeout' microseconds before considering an IP +address to be unresponsive. RETURN VALUE ------------ -The *nutscan_scan_avahi()* function returns a pointer to a -`nutscan_device_t` structure containing all found devices. - -It returns NULL if an error occurs, or if no device is found. +The *nutscan_scan_avahi()* function returns a pointer to a `nutscan_device_t` +structure containing all found devices. It returns NULL if an error occurs, or +if no device is found. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_snmp[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_cidr_to_ip[3], -linkman:nutscan_scan_eaton_serial[3] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +linkman:nutscan_scan_eaton_serial[3], http://avahi.org/ diff --git a/docs/man/nutscan_scan_eaton_serial.3 b/docs/man/nutscan_scan_eaton_serial.3 index c468577..8b41840 100644 --- a/docs/man/nutscan_scan_eaton_serial.3 +++ b/docs/man/nutscan_scan_eaton_serial.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_eaton_serial -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_EATON_S" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_EATON_S" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,9 +40,7 @@ nutscan_device_t * nutscan_scan_eaton_serial(const char* ports_list); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_scan_eaton_serial()\fR function tries to detect NUT devices which are compatible with Eaton\(cqs serial device protocols (SHUT, XCP and Q1 (aka blazer))\&. -.sp -\fIports_list\fR is a NULL terminated array of pointers to strings containing serial device name (/dev/ttyS0, COM1, /dev/ttya\&...) +The \fBnutscan_scan_eaton_serial()\fR function tries to detect NUT devices which are compatible with Eaton\(cqs serial device protocols (SHUT, XCP and Q1 (aka blazer))\&. \fIports_list\fR is a NULL terminated array of pointers to strings containing serial device name (/dev/ttyS0, COM1, /dev/ttya\&...) .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. .SH "RETURN VALUE" @@ -50,4 +48,4 @@ You MUST call \fBnutscan_init\fR(3) before using this function\&. The \fBnutscan_scan_eaton_serial()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_get_serial_ports_list\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_get_serial_ports_list\fR(3) diff --git a/docs/man/nutscan_scan_eaton_serial.txt b/docs/man/nutscan_scan_eaton_serial.txt index 068db12..7a38172 100644 --- a/docs/man/nutscan_scan_eaton_serial.txt +++ b/docs/man/nutscan_scan_eaton_serial.txt @@ -4,8 +4,7 @@ NUTSCAN_SCAN_EATON_SERIAL(3) NAME ---- -nutscan_scan_eaton_serial - Scan serial ports for Eaton devices (XCP, SHUT -and Q1). +nutscan_scan_eaton_serial - Scan serial ports for Eaton devices (XCP, SHUT and Q1). SYNOPSIS -------- @@ -17,10 +16,8 @@ SYNOPSIS DESCRIPTION ----------- -The *nutscan_scan_eaton_serial()* function tries to detect NUT devices -which are compatible with Eaton's serial device protocols (SHUT, XCP -and Q1 (aka blazer)). - +The *nutscan_scan_eaton_serial()* function tries to detect NUT devices which are +compatible with Eaton's serial device protocols (SHUT, XCP and Q1 (aka blazer)). 'ports_list' is a NULL terminated array of pointers to strings containing serial device name (/dev/ttyS0, COM1, /dev/ttya...) @@ -29,17 +26,14 @@ You MUST call linkman:nutscan_init[3] before using this function. RETURN VALUE ------------ -The *nutscan_scan_eaton_serial()* function returns a pointer to -a `nutscan_device_t` structure containing all found devices or -NULL if an error occurs or no device is found. +The *nutscan_scan_eaton_serial()* function returns a pointer to a `nutscan_device_t` structure containing all found devices or NULL if an error occurs or no device is found. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], diff --git a/docs/man/nutscan_scan_ipmi.3 b/docs/man/nutscan_scan_ipmi.3 index 4d2d55d..6cbca6b 100644 --- a/docs/man/nutscan_scan_ipmi.3 +++ b/docs/man/nutscan_scan_ipmi.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_ipmi -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_IPMI" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_IPMI" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,26 +36,16 @@ nutscan_scan_ipmi \- Scan local IPMI devices\&. .fi .sp .nf -nutscan_device_t * nutscan_scan_ipmi( - const char * startIP, - const char * stopIP, - nutscan_ipmi_t * sec); +nutscan_device_t * nutscan_scan_ipmi(void); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_scan_ipmi()\fR function tries to detect IPMI manageable devices\&. -.sp -If \fIstart_ip\fR is NULL, the function searches for a local PSU\&. -.sp -Otherwise, it searches for remote hosts that would serve IPMI protocols, and would try to authenticate using the data in \fIsec\fR structure\&. It issues a NUT request on every IP ranging from \fIstartIP\fR to \fIstopIP\fR, where \fIstopIP\fR is optional\&. Those IP arguments may be either IPv4 or IPv6 addresses or host names\&. +The \fBnutscan_scan_ipmi()\fR function is not implemented yet\&. .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. -.SH "BUGS" -.sp -Design or implementation of this function may be incomplete: until recently, this man page stated that it was not implemented yet\&. Source code is present, although some blocks are commented away or hidden with #if 0\&. .SH "RETURN VALUE" .sp The \fBnutscan_scan_ipmi()\fR function is not implemented yet\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) diff --git a/docs/man/nutscan_scan_ipmi.txt b/docs/man/nutscan_scan_ipmi.txt index 9d463f4..a5ee61c 100644 --- a/docs/man/nutscan_scan_ipmi.txt +++ b/docs/man/nutscan_scan_ipmi.txt @@ -11,34 +11,15 @@ SYNOPSIS #include - nutscan_device_t * nutscan_scan_ipmi( - const char * startIP, - const char * stopIP, - nutscan_ipmi_t * sec); + nutscan_device_t * nutscan_scan_ipmi(void); DESCRIPTION ----------- -The *nutscan_scan_ipmi()* function tries to detect IPMI manageable devices. - -If 'start_ip' is NULL, the function searches for a local PSU. - -Otherwise, it searches for remote hosts that would serve IPMI protocols, -and would try to authenticate using the data in 'sec' structure. -It issues a NUT request on every IP ranging from 'startIP' to 'stopIP', -where 'stopIP' is optional. Those IP arguments may be either IPv4 or IPv6 -addresses or host names. +The *nutscan_scan_ipmi()* function is not implemented yet. You MUST call linkman:nutscan_init[3] before using this function. -BUGS ----- - -Design or implementation of this function may be incomplete: until -recently, this man page stated that it was not implemented yet. -Source code is present, although some blocks are commented away -or hidden with `#if 0`. - RETURN VALUE ------------ @@ -46,11 +27,10 @@ The *nutscan_scan_ipmi()* function is not implemented yet. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_snmp[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3], diff --git a/docs/man/nutscan_scan_nut.3 b/docs/man/nutscan_scan_nut.3 index 6dc3a4b..cae5851 100644 --- a/docs/man/nutscan_scan_nut.3 +++ b/docs/man/nutscan_scan_nut.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_nut -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_NUT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_NUT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,19 +33,14 @@ nutscan_scan_nut \- Scan network for available NUT services\&. .sp .nf #include -#include /* useconds_t */ .fi .sp .nf -nutscan_device_t * nutscan_scan_nut( - const char * startIP, - const char * stopIP, - const char * port, - useconds_t usec_timeout); +nutscan_device_t * nutscan_scan_nut(const char * startIP, const char * stopIP, const char * port, long usec_timeout); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_scan_nut()\fR function try to detect available NUT services and their associated devices\&. It issues a NUT request on every IP ranging from \fIstartIP\fR to \fIstopIP\fR\&. \fIstartIP\fR is mandatory, \fIstopIP\fR is optional\&. Those IP arguments may be either IPv4 or IPv6 addresses or host names\&. +The \fBnutscan_scan_nut()\fR function try to detect available NUT services and their associated devices\&. It issues a NUT request on every IP ranging from \fIstartIP\fR to \fIstopIP\fR\&. \fIstartIP\fR is mandatory, \fIstopIP\fR is optional\&. Those IP may be either IPv4 or IPv6 addresses or host names\&. .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. .sp @@ -57,4 +52,4 @@ This function waits up to \fIusec_timeout\fR microseconds before considering an The \fBnutscan_scan_nut()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) diff --git a/docs/man/nutscan_scan_nut.txt b/docs/man/nutscan_scan_nut.txt index 7d0b543..367a819 100644 --- a/docs/man/nutscan_scan_nut.txt +++ b/docs/man/nutscan_scan_nut.txt @@ -10,43 +10,31 @@ SYNOPSIS -------- #include - #include /* useconds_t */ - nutscan_device_t * nutscan_scan_nut( - const char * startIP, - const char * stopIP, - const char * port, - useconds_t usec_timeout); + nutscan_device_t * nutscan_scan_nut(const char * startIP, const char * stopIP, const char * port, long usec_timeout); DESCRIPTION ----------- -The *nutscan_scan_nut()* function try to detect available NUT services -and their associated devices. It issues a NUT request on every IP ranging -from 'startIP' to 'stopIP'. 'startIP' is mandatory, 'stopIP' is optional. -Those IP arguments may be either IPv4 or IPv6 addresses or host names. +The *nutscan_scan_nut()* function try to detect available NUT services and their associated devices. It issues a NUT request on every IP ranging from 'startIP' to 'stopIP'. 'startIP' is mandatory, 'stopIP' is optional. Those IP may be either IPv4 or IPv6 addresses or host names. You MUST call linkman:nutscan_init[3] before using this function. A specific 'port' number may be passed, or NULL to use the default NUT port. -This function waits up to 'usec_timeout' microseconds before considering -an IP address does not respond to NUT queries. +This function waits up to 'usec_timeout' microseconds before considering an IP address does not respond to NUT queries. RETURN VALUE ------------ -The *nutscan_scan_nut()* function returns a pointer to a `nutscan_device_t` -structure containing all found devices or NULL if an error occurs or no -device is found. +The *nutscan_scan_nut()* function returns a pointer to a `nutscan_device_t` structure containing all found devices or NULL if an error occurs or no device is found. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3], diff --git a/docs/man/nutscan_scan_snmp.3 b/docs/man/nutscan_scan_snmp.3 index 5b75a62..99326c7 100644 --- a/docs/man/nutscan_scan_snmp.3 +++ b/docs/man/nutscan_scan_snmp.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_snmp -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_SNMP" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_SNMP" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,19 +33,14 @@ nutscan_scan_snmp \- Scan network for SNMP devices\&. .sp .nf #include -#include /* useconds_t */ .fi .sp .nf -nutscan_device_t * nutscan_scan_snmp( - const char * start_ip, - const char * stop_ip, - useconds_t timeout, - nutscan_snmp_t * sec); +nutscan_device_t * nutscan_scan_snmp(const char * start_ip,const char * stop_ip,long timeout, nutscan_snmp_t * sec); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_scan_snmp()\fR function try to detect NUT compatible SNMP devices\&. It tries SNMP queries on every IP ranging from \fIstart_ip\fR to \fIstop_ip\fR\&. Those IP arguments may be either IPv4 or IPv6 addresses or host names\&. +The \fBnutscan_scan_snmp()\fR function try to detect NUT compatible SNMP devices\&. It tries SNMP queries on every IP ranging from \fIstart_ip\fR to \fIstop_ip\fR\&. Those IP may be either IPv4 or IPv6 addresses or host names\&. .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. .sp @@ -91,4 +86,4 @@ If \fIprivProtocol\fR is NULL, DES protocol is used\&. Else you can set \fIprivP The \fBnutscan_scan_snmp()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3), \fBnutscan_cidr_to_ip\fR(3) diff --git a/docs/man/nutscan_scan_snmp.txt b/docs/man/nutscan_scan_snmp.txt index ecc893f..4dbec4b 100644 --- a/docs/man/nutscan_scan_snmp.txt +++ b/docs/man/nutscan_scan_snmp.txt @@ -10,31 +10,21 @@ SYNOPSIS -------- #include - #include /* useconds_t */ - nutscan_device_t * nutscan_scan_snmp( - const char * start_ip, - const char * stop_ip, - useconds_t timeout, - nutscan_snmp_t * sec); + nutscan_device_t * nutscan_scan_snmp(const char * start_ip,const char * stop_ip,long timeout, nutscan_snmp_t * sec); DESCRIPTION ----------- -The *nutscan_scan_snmp()* function try to detect NUT compatible SNMP -devices. It tries SNMP queries on every IP ranging from 'start_ip' to -'stop_ip'. Those IP arguments may be either IPv4 or IPv6 addresses or -host names. +The *nutscan_scan_snmp()* function try to detect NUT compatible SNMP devices. It tries SNMP queries on every IP ranging from 'start_ip' to 'stop_ip'. Those IP may be either IPv4 or IPv6 addresses or host names. You MUST call linkman:nutscan_init[3] before using this function. -This function waits up to 'timeout' microseconds before considering -an IP address does not respond to SNMP queries. +This function waits up to 'timeout' microseconds before considering an IP address does not respond to SNMP queries. A valid `nutscan_snmp_t` structure must be passed to this function. -The `nutscan_snmp_t` structure contains the following members which -must be filled as described below: +The `nutscan_snmp_t` structure contains the following members which must be filled as described below: char * 'community'; char * 'secLevel'; @@ -46,43 +36,31 @@ must be filled as described below: If 'community' is not NULL, SNMP v1 request are sent using this 'community'. -If 'community' is NULL and 'secLevel' is NULL, SNMP v1 is selected -and 'community' is set to "public". +If 'community' is NULL and 'secLevel' is NULL, SNMP v1 is selected and 'community' is set to "public". -In the other cases, SNMP v3 is used. 'secLevel' may be one -of `SNMP_SEC_LEVEL_NOAUTH`, `SNMP_SEC_LEVEL_AUTHNOPRIV` -or `SNMP_SEC_LEVEL_AUTHPRIV`. -'secName' is the security name and must be non NULL. +In the other cases, SNMP v3 is used. 'secLevel' may be one of `SNMP_SEC_LEVEL_NOAUTH`, `SNMP_SEC_LEVEL_AUTHNOPRIV` or `SNMP_SEC_LEVEL_AUTHPRIV`. 'secName' is the security name and must be non NULL. -If 'secLevel' is set to `SNMP_SEC_LEVEL_AUTHNOPRIV`, 'authPassword' -must be non NULL. +If 'secLevel' is set to `SNMP_SEC_LEVEL_AUTHNOPRIV`, 'authPassword' must be non NULL. -If 'secLevel' is set to `SNMP_SEC_LEVEL_AUTHPRIV`, 'authPassword' -and 'privPassword' must be non NULL. +If 'secLevel' is set to `SNMP_SEC_LEVEL_AUTHPRIV`, 'authPassword' and 'privPassword' must be non NULL. -If 'authProtocol' is NULL, MD5 protocol is used. -Else you can set 'authProtocol' to either "MD5" or "SHA". +If 'authProtocol' is NULL, MD5 protocol is used. Else you can set 'authProtocol' to either "MD5" or "SHA". -If 'privProtocol' is NULL, DES protocol is used. -Else you can set 'privProtocol' to either "AES" or "DES". +If 'privProtocol' is NULL, DES protocol is used. Else you can set 'privProtocol' to either "AES" or "DES". -'peername' and 'handle' are used internally and do not need any -initialization. +'peername' and 'handle' are used internally and do not need any initialization. RETURN VALUE ------------ -The *nutscan_scan_snmp()* function returns a pointer to a -`nutscan_device_t` structure containing all found devices -or NULL if an error occurs or no device is found. +The *nutscan_scan_snmp()* function returns a pointer to a `nutscan_device_t` structure containing all found devices or NULL if an error occurs or no device is found. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3], diff --git a/docs/man/nutscan_scan_usb.3 b/docs/man/nutscan_scan_usb.3 index e5fa2ce..965e7d1 100644 --- a/docs/man/nutscan_scan_usb.3 +++ b/docs/man/nutscan_scan_usb.3 @@ -1,13 +1,13 @@ '\" t .\" Title: nutscan_scan_usb -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_USB" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_USB" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ nutscan_scan_usb \- Scan NUT compatible USB devices\&. .fi .sp .nf -nutscan_device_t * nutscan_scan_usb(void); +nutscan_device_t * nutscan_scan_usb(); .fi .SH "DESCRIPTION" .sp @@ -48,4 +48,4 @@ You MUST call \fBnutscan_init\fR(3) before using this function\&. The \fBnutscan_scan_usb()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. .SH "SEE ALSO" .sp -\fBnutscan_init\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http_range\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3) +\fBnutscan_init\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_xml_http\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3) diff --git a/docs/man/nutscan_scan_usb.txt b/docs/man/nutscan_scan_usb.txt index 878c712..a48009c 100644 --- a/docs/man/nutscan_scan_usb.txt +++ b/docs/man/nutscan_scan_usb.txt @@ -11,7 +11,7 @@ SYNOPSIS #include - nutscan_device_t * nutscan_scan_usb(void); + nutscan_device_t * nutscan_scan_usb(); DESCRIPTION ----------- @@ -23,17 +23,14 @@ You MUST call linkman:nutscan_init[3] before using this function. RETURN VALUE ------------ -The *nutscan_scan_usb()* function returns a pointer to a `nutscan_device_t` -structure containing all found devices or NULL if an error occurs or no -device is found. +The *nutscan_scan_usb()* function returns a pointer to a `nutscan_device_t` structure containing all found devices or NULL if an error occurs or no device is found. SEE ALSO -------- - linkman:nutscan_init[3], -linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_xml_http_range[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_scan_snmp[3], linkman:nutscan_scan_xml_http[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3] diff --git a/docs/man/nutscan_scan_xml_http_range.3 b/docs/man/nutscan_scan_xml_http.3 similarity index 54% rename from docs/man/nutscan_scan_xml_http_range.3 rename to docs/man/nutscan_scan_xml_http.3 index 74ba7a3..fa4ee22 100644 --- a/docs/man/nutscan_scan_xml_http_range.3 +++ b/docs/man/nutscan_scan_xml_http.3 @@ -1,13 +1,13 @@ '\" t -.\" Title: nutscan_scan_xml_http_range -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Title: nutscan_scan_xml_http +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "NUTSCAN_SCAN_XML_HTT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTSCAN_SCAN_XML_HTT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,35 +28,24 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -nutscan_scan_xml_http_range \- Scan network for XML/HTTP devices\&. +nutscan_scan_xml_http \- Scan network for XML/HTTP devices\&. .SH "SYNOPSIS" .sp .nf #include -#include /* useconds_t */ .fi .sp .nf -nutscan_device_t * nutscan_scan_xml_http_range( - const char * start_ip, - const char * end_ip, - useconds_t usec_timeout, - nutscan_xml_t * sec) +nutscan_device_t * nutscan_scan_xml_http(long usec_timeout); .fi .SH "DESCRIPTION" .sp -The \fBnutscan_scan_xml_http_range()\fR function tries to detect NUT compatible XML/HTTP devices\&. -.sp -If \fIstart_ip\fR is NULL, the function does this by issuing a broadcast message on currently configured network interfaces\&. -.sp -Otherwise, it queries every IP ranging from \fIstart_ip\fR to \fIstop_ip\fR\&. Those IP arguments may be either IPv4 or IPv6 addresses or host names\&. -.sp -It waits up to \fIusec_timeout\fR microseconds for a response from potential devices\&. +The \fBnutscan_scan_xml_http()\fR function try to detect NUT compatible XML/HTTP devices\&. It does this by issuing a broadcast message on currently configured network interfaces\&. It waits up to \fIusec_timeout\fR microseconds for a response from potential devices\&. .sp You MUST call \fBnutscan_init\fR(3) before using this function\&. .SH "RETURN VALUE" .sp -The \fBnutscan_scan_xml_http_range()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. +The \fBnutscan_scan_xml_http()\fR function returns a pointer to a nutscan_device_t structure containing all found devices or NULL if an error occurs or no device is found\&. .SH "SEE ALSO" .sp \fBnutscan_init\fR(3), \fBnutscan_scan_usb\fR(3), \fBnutscan_scan_snmp\fR(3), \fBnutscan_scan_nut\fR(3), \fBnutscan_scan_avahi\fR(3), \fBnutscan_scan_ipmi\fR(3), \fBnutscan_display_ups_conf\fR(3), \fBnutscan_display_parsable\fR(3), \fBnutscan_new_device\fR(3), \fBnutscan_free_device\fR(3), \fBnutscan_add_option_to_device\fR(3), \fBnutscan_add_device_to_device\fR(3), \fBnutscan_scan_eaton_serial\fR(3) diff --git a/docs/man/nutscan_scan_xml_http.txt b/docs/man/nutscan_scan_xml_http.txt new file mode 100644 index 0000000..42bfe84 --- /dev/null +++ b/docs/man/nutscan_scan_xml_http.txt @@ -0,0 +1,36 @@ +NUTSCAN_SCAN_XML_HTTP(3) +======================== + +NAME +---- + +nutscan_scan_xml_http - Scan network for XML/HTTP devices. + +SYNOPSIS +-------- + + #include + + nutscan_device_t * nutscan_scan_xml_http(long usec_timeout); + +DESCRIPTION +----------- + +The *nutscan_scan_xml_http()* function try to detect NUT compatible XML/HTTP devices. It does this by issuing a broadcast message on currently configured network interfaces. It waits up to 'usec_timeout' microseconds for a response from potential devices. + +You MUST call linkman:nutscan_init[3] before using this function. + +RETURN VALUE +------------ + +The *nutscan_scan_xml_http()* function returns a pointer to a `nutscan_device_t` structure containing all found devices or NULL if an error occurs or no device is found. + +SEE ALSO +-------- +linkman:nutscan_init[3], +linkman:nutscan_scan_usb[3], linkman:nutscan_scan_snmp[3], +linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], +linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], +linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], +linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], +linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3] diff --git a/docs/man/nutscan_scan_xml_http_range.txt b/docs/man/nutscan_scan_xml_http_range.txt deleted file mode 100644 index 15cb2af..0000000 --- a/docs/man/nutscan_scan_xml_http_range.txt +++ /dev/null @@ -1,54 +0,0 @@ -NUTSCAN_SCAN_XML_HTTP_RANGE(3) -============================== - -NAME ----- - -nutscan_scan_xml_http_range - Scan network for XML/HTTP devices. - -SYNOPSIS --------- - - #include - #include /* useconds_t */ - - nutscan_device_t * nutscan_scan_xml_http_range( - const char * start_ip, - const char * end_ip, - useconds_t usec_timeout, - nutscan_xml_t * sec) - -DESCRIPTION ------------ - -The *nutscan_scan_xml_http_range()* function tries to detect NUT compatible -XML/HTTP devices. - -If 'start_ip' is NULL, the function does this by issuing a broadcast message -on currently configured network interfaces. - -Otherwise, it queries every IP ranging from 'start_ip' to 'stop_ip'. -Those IP arguments may be either IPv4 or IPv6 addresses or host names. - -It waits up to 'usec_timeout' microseconds for a response from potential -devices. - -You MUST call linkman:nutscan_init[3] before using this function. - -RETURN VALUE ------------- - -The *nutscan_scan_xml_http_range()* function returns a pointer to -a `nutscan_device_t` structure containing all found devices -or NULL if an error occurs or no device is found. - -SEE ALSO --------- - -linkman:nutscan_init[3], -linkman:nutscan_scan_usb[3], linkman:nutscan_scan_snmp[3], -linkman:nutscan_scan_nut[3], linkman:nutscan_scan_avahi[3], -linkman:nutscan_scan_ipmi[3], linkman:nutscan_display_ups_conf[3], -linkman:nutscan_display_parsable[3], linkman:nutscan_new_device[3], -linkman:nutscan_free_device[3], linkman:nutscan_add_option_to_device[3], -linkman:nutscan_add_device_to_device[3], linkman:nutscan_scan_eaton_serial[3] diff --git a/docs/man/nutupsdrv.8 b/docs/man/nutupsdrv.8 index c331441..650e088 100644 --- a/docs/man/nutupsdrv.8 +++ b/docs/man/nutupsdrv.8 @@ -1,13 +1,13 @@ '\" t .\" Title: nutupsdrv -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/20/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1 .\" Language: English .\" -.TH "NUTUPSDRV" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "NUTUPSDRV" "8" "11/20/2013" "Network UPS Tools 2\&.7\&.1" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -42,11 +42,9 @@ For information on the specific drivers, see their individual man pages\&. .sp UPS drivers provide a communication channel between the physical UPS hardware and the \fBupsd\fR(8) server\&. The driver is responsible for translating the native protocol of the UPS to the common format used by the rest of this package\&. .sp -The core has three modes of operation which are determined by the command line switches\&. In the normal mode, the driver will periodically poll the UPS for its state and parameters, as per the \fBpollinterval\fR parameter in \fBups.conf\fR(5)\&. The results of this command are presented to upsd\&. The driver will also handle setting variables and instant commands if available\&. +The core has two modes of operation which are determined by the command line switches\&. In the normal mode, the driver will periodically poll the UPS for its state and parameters\&. The results of this command is presented to upsd\&. The driver will also handle setting variables and instant commands if available\&. .sp -In the second mode, using \fB\-k\fR, the driver can instruct the UPS to shut down the load, possibly after some delay\&. This mode of operation is intended for cases when it is known that the UPS is running out of battery power and the systems attached must be turned off to ensure a proper reboot when power returns\&. -.sp -In the third mode, using \fB\-d\fR, the driver will exit after some update loops, dumping the data tree (in upsc\-like format) to stdout\&. This can be useful to complement the nut\-scanner to discover devices, along with in\-depth data\&. +The driver can also instruct the UPS to shut down the load, possibly after some delay\&. This mode of operation is intended for cases when it is known that the UPS is running out of battery power and the systems attached must be turned off to ensure a proper reboot when power returns\&. .if n \{\ .sp .\} @@ -81,31 +79,13 @@ section of \fBThis argument is mandatory when calling the driver directly\&.\fR .RE .PP -\fB\-s\fR \fIid\fR -.RS 4 -Configure this driver only with command line arguments instead of reading -\fBups.conf\fR(5)\&. To be used instead of -\fB\-a\fR -option when need to run a driver not present in driver configuration file\&. Instead, driver configuration have to be set with -\fB\-x\fR -options directly in the command line\&. As the driver instance cannot be controlled by -\fBupsdrvctl\fR(8), this option should be used for specific needs only\&. -.RE -.PP \fB\-D\fR .RS 4 -Raise the debugging level\&. Use this multiple times to see more details\&. Running a driver in debug mode will (by default) prevent it from backgrounding after startup\&. It will keep on logging information to the console until it receives a SIGINT (usually Ctrl\-C) or SIGTERM signal\&. +Raise the debugging level\&. Use this multiple times to see more details\&. Running a driver in debug mode will prevent it from backgrounding after startup\&. It will keep on logging information to the console until it receives a SIGINT (usually Ctrl\-C) or SIGTERM signal\&. .sp The level of debugging needed depends both on the driver and the problem you\(cqre trying to diagnose\&. Therefore, first explain the problem you have with a driver to a developer/maintainer, before sending them debugging output\&. More often than not, if you just pick a level, the output may be either too limited or too verbose to be of any use\&. .RE .PP -\fB\-d\fR \fIupdate_count\fR -.RS 4 -Dump the data tree (in upsc\-like format) to stdout after running the driver update loop for -\fIupdate_count\fR -times and exit\&. By default this prevents the driver process from backgrounding after startup\&. Note that the driver banner will be printed too, so when using this option in scripts, don\(cqt forget to trim the first line\&. -.RE -.PP \fB\-q\fR .RS 4 Raise log level threshold\&. Use this multiple times to log more details\&. @@ -113,19 +93,9 @@ Raise log level threshold\&. Use this multiple times to log more details\&. The debugging comment above also applies here\&. .RE .PP -\fB\-F\fR -.RS 4 -Enforce running the driver as a foreground process, regardless of debugging or data\-dumping settings\&. -.RE -.PP -\fB\-B\fR -.RS 4 -Enforce running the driver as a background process, regardless of debugging or data\-dumping settings\&. -.RE -.PP \fB\-i\fR \fIinterval\fR .RS 4 -Set the poll interval for the device\&. The default value is 2 (in seconds)\&. +Set the poll interval for the device\&. .RE .PP \fB\-V\fR @@ -135,7 +105,7 @@ Print only version information, then exit\&. .PP \fB\-L\fR .RS 4 -Print a parsable list of driver variables\&. Mostly useful for configuration wizard programs\&. +Print a parseable list of driver variables\&. Mostly useful for configuration wizard programs\&. .RE .PP \fB\-k\fR @@ -160,27 +130,11 @@ for this to work\&. The serial ports are opened before the chroot call, so you d .PP \fB\-u\fR \fIusername\fR .RS 4 -Override the unprivileged username that the driver may use after startup\&. If started as root, after opening configuration files (and optionally calling chroot(2), as described in the previous option), the driver will look up -\fIusername\fR -in the -passwd -database, then change to the user and group identities associated with -\fIusername\fR\&. (If started with a nonzero UID or effective UID, the driver will silently ignore this option\&.) +If started as root, the driver will setuid(2) to the user id associated with +\fIusername\fR\&. .sp -When compiling NUT from source, the default username is typically -nobody, and this may cause permission errors when the driver opens the UPS device node\&. You can use this option to temporarily override the defaults\&. For testing purposes, you can set this option to -root -to bypass permission errors, especially with USB\-based drivers\&. However, you will want to remove this option later in order to avoid permission conflicts between the driver and the unprivileged copy of -\fBupsd\fR(8)\&. -.RE -.PP -\fB\-g\fR \fIgroupname\fR -.RS 4 -Override the unprivileged group name that the driver may use after startup to set permissions for the filesystem socket so -upsd -may still access it if the run\-time -user -of the driver normally would deny that access\&. +If you do not specify this value and start it as root, the driver will switch to the default value that was compiled into the code\&. This is typically +\fInobody\fR, and is far from ideal\&. .RE .PP \fB\-x\fR \fIvar\fR=\fIval\fR @@ -210,836 +164,19 @@ ups\&.conf .RS 4 Required configuration file\&. This contains all details on which drivers to start and where the hardware is attached\&. .RE -.SH "ENVIRONMENT VARIABLES" -.sp -\fBNUT_CONFPATH\fR is the path name of the directory that contains upsd\&.conf and other configuration files\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /usr/local/ups/etc\&. -.sp -\fBNUT_STATEPATH\fR is the path name of the directory in which \fBupsd\fR keeps state information\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /var/state/ups\&. The \fBSTATEPATH\fR directive in \fBupsd.conf\fR(5) overrides this variable\&. -.sp -\fBNUT_ALTPIDPATH\fR is the path name of the directory in which \fBupsd\fR and drivers store \&.pid files\&. If this variable is not set, \fBupsd\fR and drivers use either \fBNUT_STATEPATH\fR if set, or ALTPIDPATH if set, or otherwise the built\-in default \fBSTATEPATH\fR\&. .SH "BUGS" .sp Some of the drivers may have bugs\&. See their manuals for more information\&. .SH "SEE ALSO" -.SS "Server:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsd\fR(8) -.RE -.SS "Clients:" +Server: \fBupsd\fR(8) .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsc\fR(8) -.RE +Clients: \fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8), \fBupslog\fR(8), \fBupsmon\fR(8) .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupscmd\fR(8) -.RE +CGI programs: \fBupsset.cgi\fR(8), \fBupsstats.cgi\fR(8), \fBupsimage.cgi\fR(8) .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsrw\fR(8) -.RE +Driver control: \fBupsdrvctl\fR(8) .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupslog\fR(8) -.RE +Drivers: \fBal175\fR(8) \fBapcsmart\fR(8), \fBbcmxcp\fR(8), \fBbcmxcp_usb\fR(8), \fBbelkin\fR(8), \fBbelkinunv\fR(8), \fBbestfcom\fR(8), \fBbestuferrups\fR(8), \fBbestups\fR(8), \fBblazer_ser\fR(8), \fBblazer_usb\fR(8), \fBcyberpower\fR(8), \fBdummy-ups\fR(8), \fBetapro\fR(8), \fBeverups\fR(8), \fBgamatronic\fR(8), \fBgenericups\fR(8), \fBisbmex\fR(8), \fBliebert\fR(8), \fBmasterguard\fR(8), \fBmetasys\fR(8), \fBmge-shut\fR(8), \fBmge-utalk\fR(8), \fBmge-xml\fR(8), \fBnewmge-shut\fR(8), \fBnitram\fR(8), \fBnutdrv_qx\fR(8), \fBoneac\fR(8), \fBoptiups\fR(8), \fBpowercom\fR(8), \fBpowerman-pdu\fR(8), \fBpowerpanel\fR(8), \fBrhino\fR(8), \fBrichcomm_usb\fR(8), \fBsafenet\fR(8), \fBsnmp-ups\fR(8), \fBsolis\fR(8), \fBtripplite\fR(8), \fBtripplitesu\fR(8), \fBtripplite_usb\fR(8), \fBusbhid-ups\fR(8), \fBupscode2\fR(8), \fBvictronups\fR(8) .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsmon\fR(8) -.RE -.SS "CGI programs:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsset.cgi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsstats.cgi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsimage.cgi\fR(8) -.RE -.SS "Driver control:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnut-driver-enumerator\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsdrvctl\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsdrvsvcctl\fR(8) -.RE -.SS "Drivers:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBadelsystem_cbi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBal175\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcsmart-old\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcsmart\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcupsd-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBasem\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbcmxcp\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbcmxcp_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbelkin\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbelkinunv\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestfcom\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestfortress\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestuferrups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer-common\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer_ser\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBclone\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBdummy-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBetapro\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBeverups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgamatronic\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgeneric_modbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgenericups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBhuawei-ups2000\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBisbmex\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBivtscd\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBliebert-esp2\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBliebert\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmacosx-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmasterguard\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmetasys\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmge-shut\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmge-utalk\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmicrodowell\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmicrosol-apc\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnetxml-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnut-ipmipsu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_atcl_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_qx\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_siemens_sitop\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBoneac\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBoptiups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBphoenixcontact_modbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpijuice\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowercom\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowerman-pdu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowerpanel\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBrhino\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBrichcomm_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBriello_ser\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBriello_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsafenet\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsnmp-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsocomec_jbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsolis\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplite\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplite_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplitesu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupscode2\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBusbhid-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBvictronups\fR(8) -.RE -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ +Internet resources: The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/nutupsdrv.txt b/docs/man/nutupsdrv.txt index 01ddbf5..88878cd 100644 --- a/docs/man/nutupsdrv.txt +++ b/docs/man/nutupsdrv.txt @@ -1,7 +1,7 @@ NUTUPSDRV(8) ============ -NAME +NAME ---- nutupsdrv - generic manual for unified NUT drivers @@ -27,21 +27,16 @@ hardware and the linkman:upsd[8] server. The driver is responsible for translating the native protocol of the UPS to the common format used by the rest of this package. -The core has three modes of operation which are determined by the +The core has two modes of operation which are determined by the command line switches. In the normal mode, the driver will periodically -poll the UPS for its state and parameters, as per the *pollinterval* parameter -in linkman:ups.conf[5]. The results of this command are presented to upsd. -The driver will also handle setting variables and instant commands if available. +poll the UPS for its state and parameters. The results of this command +is presented to upsd. The driver will also handle setting variables and +instant commands if available. -In the second mode, using *-k*, the driver can instruct the UPS to shut down -the load, possibly after some delay. This mode of operation is intended for -cases when it is known that the UPS is running out of battery power and the -systems attached must be turned off to ensure a proper reboot when power -returns. - -In the third mode, using *-d*, the driver will exit after some update loops, -dumping the data tree (in upsc-like format) to stdout. This can be useful to -complement the nut-scanner to discover devices, along with in-depth data. +The driver can also instruct the UPS to shut down the load, possibly +after some delay. This mode of operation is intended for cases when it is +known that the UPS is running out of battery power and the systems +attached must be turned off to ensure a proper reboot when power returns. NOTE: You probably don't want to use any of these options directly. You should use linkman:upsdrvctl[8] to control your drivers, and @@ -50,7 +45,6 @@ options and parameters that generally are not needed by normal users. OPTIONS ------- - *-h*:: Display a help message without doing anything else. This will also list possible values for '-x' in that driver, and other help text that the @@ -60,18 +54,10 @@ driver's author may have provided. Autoconfigure this driver using the 'id' section of linkman:ups.conf[5]. *This argument is mandatory when calling the driver directly.* -*-s* 'id':: -Configure this driver only with command line arguments instead of reading -linkman:ups.conf[5]. To be used instead of *-a* option when need to run -a driver not present in driver configuration file. Instead, driver -configuration have to be set with *-x* options directly in the command line. -As the driver instance cannot be controlled by linkman:upsdrvctl[8], -this option should be used for specific needs only. - *-D*:: Raise the debugging level. Use this multiple times to see more details. -Running a driver in debug mode will (by default) prevent it from backgrounding -after startup. It will keep on logging information to the console until it +Running a driver in debug mode will prevent it from backgrounding after +startup. It will keep on logging information to the console until it receives a SIGINT (usually Ctrl-C) or SIGTERM signal. + The level of debugging needed depends both on the driver and the @@ -80,34 +66,19 @@ have with a driver to a developer/maintainer, before sending them debugging output. More often than not, if you just pick a level, the output may be either too limited or too verbose to be of any use. -*-d* 'update_count':: -Dump the data tree (in upsc-like format) to stdout after running the driver -update loop for 'update_count' times and exit. -By default this prevents the driver process from backgrounding after startup. -Note that the driver banner will be printed too, so when using this option in -scripts, don't forget to trim the first line. - *-q*:: Raise log level threshold. Use this multiple times to log more details. + The debugging comment above also applies here. - -*-F*:: -Enforce running the driver as a foreground process, regardless of debugging -or data-dumping settings. - -*-B*:: -Enforce running the driver as a background process, regardless of debugging -or data-dumping settings. - + *-i* 'interval':: -Set the poll interval for the device. The default value is 2 (in seconds). +Set the poll interval for the device. *-V*:: Print only version information, then exit. *-L*:: -Print a parsable list of driver variables. Mostly useful for configuration +Print a parseable list of driver variables. Mostly useful for configuration wizard programs. *-k*:: @@ -127,30 +98,17 @@ opened before the chroot call, so you do not need to create them inside the jail. In fact, it is somewhat safer if you do not. *-u* 'username':: -Override the unprivileged username that the driver may use after startup. If -started as root, after opening configuration files (and optionally calling -chroot(2), as described in the previous option), the driver will look up -'username' in the `passwd` database, then change to the user and group -identities associated with 'username'. (If started with a nonzero UID or -effective UID, the driver will silently ignore this option.) +If started as root, the driver will setuid(2) to the user id +associated with 'username'. + -When compiling NUT from source, the default username is typically `nobody`, and -this may cause permission errors when the driver opens the UPS device node. You -can use this option to temporarily override the defaults. For testing purposes, -you can set this option to `root` to bypass permission errors, especially with -USB-based drivers. However, you will want to remove this option later in order -to avoid permission conflicts between the driver and the unprivileged copy of -linkman:upsd[8]. - -*-g* 'groupname':: -Override the unprivileged group name that the driver may use after startup -to set permissions for the filesystem socket so `upsd` may still access it -if the run-time `user` of the driver normally would deny that access. +If you do not specify this value and start it as root, the driver will +switch to the default value that was compiled into the code. This is +typically 'nobody', and is far from ideal. *-x* 'var'='val':: Define a variable called 'var' with the value of 'var' in the driver. This varies from driver to driver - see the specific man pages -for more information. +for more information. + This is like setting 'var'='val' in linkman:ups.conf[5], but *-x* overrides any settings from that file. @@ -172,28 +130,10 @@ production use. FILES ----- - ups.conf:: Required configuration file. This contains all details on which drivers to start and where the hardware is attached. -ENVIRONMENT VARIABLES ---------------------- - -*NUT_CONFPATH* is the path name of the directory that contains -`upsd.conf` and other configuration files. If this variable is not set, -*upsd* uses a built-in default, which is often `/usr/local/ups/etc`. - -*NUT_STATEPATH* is the path name of the directory in which -*upsd* keeps state information. If this variable is not set, -*upsd* uses a built-in default, which is often `/var/state/ups`. -The *STATEPATH* directive in linkman:upsd.conf[5] overrides this variable. - -*NUT_ALTPIDPATH* is the path name of the directory in which -*upsd* and drivers store .pid files. If this variable is not set, -*upsd* and drivers use either *NUT_STATEPATH* if set, or ALTPIDPATH if set, -or otherwise the built-in default *STATEPATH*. - BUGS ---- @@ -204,37 +144,62 @@ SEE ALSO -------- Server: -~~~~~~~ - -- linkman:upsd[8] +linkman:upsd[8] Clients: -~~~~~~~~ - -- linkman:upsc[8] -- linkman:upscmd[8] -- linkman:upsrw[8] -- linkman:upslog[8] -- linkman:upsmon[8] +linkman:upsc[8], linkman:upscmd[8], +linkman:upsrw[8], linkman:upslog[8], linkman:upsmon[8] CGI programs: -~~~~~~~~~~~~~ - -- linkman:upsset.cgi[8] -- linkman:upsstats.cgi[8] -- linkman:upsimage.cgi[8] +linkman:upsset.cgi[8], linkman:upsstats.cgi[8], linkman:upsimage.cgi[8] Driver control: -~~~~~~~~~~~~~~~ - -include::{builddir}/linkman-drivertool-names.txt[] +linkman:upsdrvctl[8] Drivers: -~~~~~~~~ - -include::{builddir}/linkman-driver-names.txt[] +linkman:al175[8] +linkman:apcsmart[8], +linkman:bcmxcp[8], +linkman:bcmxcp_usb[8], +linkman:belkin[8], +linkman:belkinunv[8], +linkman:bestfcom[8], +linkman:bestuferrups[8], +linkman:bestups[8], +linkman:blazer_ser[8], +linkman:blazer_usb[8], +linkman:cyberpower[8], +linkman:dummy-ups[8], +linkman:etapro[8], +linkman:everups[8], +linkman:gamatronic[8], +linkman:genericups[8], +linkman:isbmex[8], +linkman:liebert[8], +linkman:masterguard[8], +linkman:metasys[8], +linkman:mge-shut[8], +linkman:mge-utalk[8], +linkman:mge-xml[8], +linkman:newmge-shut[8], +linkman:nitram[8], +linkman:nutdrv_qx[8], +linkman:oneac[8], +linkman:optiups[8], +linkman:powercom[8], +linkman:powerman-pdu[8], +linkman:powerpanel[8], +linkman:rhino[8], +linkman:richcomm_usb[8], +linkman:safenet[8], +linkman:snmp-ups[8], +linkman:solis[8], +linkman:tripplite[8], +linkman:tripplitesu[8], +linkman:tripplite_usb[8], +linkman:usbhid-ups[8], +linkman:upscode2[8], +linkman:victronups[8] Internet resources: -~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/oneac.8 b/docs/man/oneac.8 index 8db799b..e9e3ac3 100644 --- a/docs/man/oneac.8 +++ b/docs/man/oneac.8 @@ -1,13 +1,13 @@ '\" t .\" Title: oneac -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "ONEAC" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "ONEAC" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -204,29 +204,9 @@ If your UPS supports writing battery\&.runtime\&.low, the new set value is to be If your UPS supports input\&.transfer\&.low and input\&.transfer\&.high, those values are used to create an allowable output range\&. The UPS will do what it can to keep the output voltage value within the defined range (for example: tap change or switch to inverter)\&. .sp .5v .RE -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Bill Elliot -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Eric Lawson -.RE +Bill Elliot , Eric Lawson .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/oneac.txt b/docs/man/oneac.txt index beb257e..fe6c779 100644 --- a/docs/man/oneac.txt +++ b/docs/man/oneac.txt @@ -28,7 +28,6 @@ linkman:genericups[8] driver. EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in the linkman:ups.conf[5] file: @@ -40,7 +39,6 @@ Change shutdown delay time from 0 second default. INSTANT COMMANDS ---------------- - This driver supports the following Instant Commands. (See linkman:upscmd[8]) @@ -99,7 +97,6 @@ Mutes the UPS beeper/buzzer for the current alarm condition(s). Writable Variables ------------------ - See linkman:upsrw[8] to see what variables are writable for the UPS. NOTE: If your UPS supports writing battery.runtime.low, the new set value @@ -107,25 +104,22 @@ is to be entered in minutes (up to 99) but the reported value is reported in seconds (set value * 60). NOTE: If your UPS supports input.transfer.low and input.transfer.high, -those values are used to create an allowable output range. The UPS -will do what it can to keep the output voltage value within the +those values are used to create an allowable output range. The UPS +will do what it can to keep the output voltage value within the defined range (for example: tap change or switch to inverter). -AUTHORS -------- - -* Bill Elliot -* Eric Lawson +AUTHOR +------ +Bill Elliot , +Eric Lawson SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/optiups.8 b/docs/man/optiups.8 index 46e090d..9d9d2b0 100644 --- a/docs/man/optiups.8 +++ b/docs/man/optiups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: optiups -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "OPTIUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "OPTIUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -86,40 +86,9 @@ Zinto D from ONLINE\-USV cannot be identified when switched to standby\&. Set th .SH "BUGS" .sp On the 420E, ups\&.serial and ups\&.temperature are unsupported features\&. This is not a bug in NUT or the NUT driver, just the way things are with this UPS\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Russell Kroll -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Scott Heavner -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Matthias Goebl -.RE +Russell Kroll, Scott Heavner, Matthias Goebl .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/optiups.txt b/docs/man/optiups.txt index 1e1d904..25f7342 100644 --- a/docs/man/optiups.txt +++ b/docs/man/optiups.txt @@ -1,7 +1,7 @@ OPTIUPS(8) ========== -NAME +NAME ---- optiups - Driver for Opti-UPS (Viewsonic) UPS and Zinto D (ONLINE-USV) equipment @@ -10,7 +10,7 @@ NOTE ---- This man page only documents the hardware-specific features of the -optiups driver. For information about the core driver, see +optiups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE @@ -56,14 +56,13 @@ sent to your system logs each time NUT polls the UPS. If you specify *fake_lowbatt*:: -This forces the low battery flag true. Without it, if you want to test -your UPS, you will have to unplug it and wait until the battery drops -to a low/critical voltage level before NUT will respond and power down -your system. With the flag, NUT should power down the system soon after -you pull the plug. When you are done testing, you should remove this flag. +This forces the low battery flag true. Without it, if you want to test your +UPS, you will have to unplug it and wait until the battery drops to a low/critical +voltage level before NUT will respond and power down your system. With the flag, +NUT should power down the system soon after you pull the plug. When you are done +testing, you should remove this flag. + -For basic shutdown configuration testing, the command 'upsmon -c fsd' is -preferred. +For basic shutdown configuration testing, the command 'upsmon -c fsd' is preferred. *powerup*:: @@ -74,26 +73,20 @@ This will also power-up your equipment connected to the UPS! BUGS ---- -On the 420E, `ups.serial` and `ups.temperature` are unsupported features. -This is not a bug in NUT or the NUT driver, just the way things are with -this UPS. +On the 420E, `ups.serial` and `ups.temperature` are unsupported features. This +is not a bug in NUT or the NUT driver, just the way things are with this UPS. -AUTHORS -------- - -* Russell Kroll -* Scott Heavner -* Matthias Goebl +AUTHOR +------ +Russell Kroll, Scott Heavner, Matthias Goebl SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/phoenixcontact_modbus.8 b/docs/man/phoenixcontact_modbus.8 deleted file mode 100644 index c085453..0000000 --- a/docs/man/phoenixcontact_modbus.8 +++ /dev/null @@ -1,254 +0,0 @@ -'\" t -.\" Title: phoenixcontact_modbus -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "PHOENIXCONTACT_MODBU" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -phoenixcontact_modbus \- Driver for Phoenix Contact -.SH "SYNOPSIS" -.sp -\fBphoenixcontact_modbus\fR \-h -.sp -\fBphoenixcontact_modbus\fR \-a \fIDEVICE_NAME\fR [\fIOPTIONS\fR] -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This man page only documents the hardware\-specific features of the phoenixcontact_modbus driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -This driver should support the PhoenixContact QUINT\-UPS industrial DC UPS, model 2320461 and all compatible models\&. More information about this UPS can be found here: https://www\&.phoenixcontact\&.com/online/portal/us?uri=pxc\-oc\-itemdetail:pid=2320461 -.sp -phoenixcontact_modbus uses the libmodbus project, for Modbus implementation\&. -.SH "HOW TO CONFIGURE THE UPS" -.sp -Note: this UPS and its manual refers to Low\-Batt as "Shutdown Event"\&. -.sp -You need the "IFS\-RS232\-DATACABLE" to communicate with the UPS in Linux as the IFS\-USB cable doesn\(cqt seem to be supported\&. FYI communication parameters are: 115200,E,8,1\&. -.sp -You also need the UPS\-CONF Windows software (free; download from their site), to configure the UPS signals and timers\&. -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -Run the UPS\-CONF -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -Go to Settings→Time Setting -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 3.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 3." 4.2 -.\} -Choose "state of charge shutdown delay" -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 4.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 4." 4.2 -.\} -Choose Remote starts PC\-Shutdown in Mains and Battery mode -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 5.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 5." 4.2 -.\} -On the PC\-Shutdown enter the maximum value (5 minutes) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 6.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 6." 4.2 -.\} -On the PC\-Restart delay enter the time you want the UPS to leave the output power off before restarting (e\&.g\&. 60 seconds), after mains power is restored\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 7.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 7." 4.2 -.\} -On the UPS, turn the screw to the "PC\-MODE" position -.RE -.sp -Configuring the above way ensures that: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When power is lost, UPS constantly calculates remaining battery time -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When remaining battery time is less than 5 minutes (PC\-Shutdown setting), it will raise the "Shutdown" event (seen as LOW\-BATT in NUT) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -From that moment even if input power is restored, the UPS will cut the output power to its load after 5 minutes -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -When the input power is restored, the UPS will restore output power after 60 seconds (PC\-RESTART delay setting)\&. -.RE -.sp -Meaning of settings: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PC\-Shutdown: How long before output cutoff the UPS will raise the "shutdown event" signal\&. Max value for this is 5 minutes\&. So PC should be able to shutdown within 5 minutes\&. -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -PC\-Restart: How long to delay output power after power is restored\&. Max is 60 seconds\&. -.RE -.SH "EXTRA ARGUMENTS" -.sp -This driver doesn\(cqt support any optional settings\&. -.SH "INSTALLATION" -.sp -This driver is not built by default\&. You can build it by installing libmodbus and running configure \-\-with\-modbus=yes\&. -.sp -You also need to give proper permissions on the local serial device file (/dev/ttyS0 for example) to allow the NUT user to access it\&. -.SH "INSTANT COMMANDS" -.sp -This driver doesn\(cqt support any instant commands\&. -.SH "AUTHOR" -.sp -Spiros Ioannou -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -libmodbus home page: -http://libmodbus\&.org -.RE diff --git a/docs/man/phoenixcontact_modbus.txt b/docs/man/phoenixcontact_modbus.txt deleted file mode 100644 index e173089..0000000 --- a/docs/man/phoenixcontact_modbus.txt +++ /dev/null @@ -1,107 +0,0 @@ -PHOENIXCONTACT_MODBUS(8) -======================== - -NAME ----- - -phoenixcontact_modbus - Driver for Phoenix Contact - -SYNOPSIS --------- - -*phoenixcontact_modbus* -h - -*phoenixcontact_modbus* -a 'DEVICE_NAME' ['OPTIONS'] - -NOTE: This man page only documents the hardware-specific features of the -phoenixcontact_modbus driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This driver should support the PhoenixContact QUINT-UPS industrial DC UPS, -model 2320461 and all compatible models. More information about this UPS -can be found here: -https://www.phoenixcontact.com/online/portal/us?uri=pxc-oc-itemdetail:pid=2320461 - -phoenixcontact_modbus uses the libmodbus project, for Modbus implementation. - -How to configure the UPS ------------------------- - -Note: this UPS and its manual refers to Low-Batt as "Shutdown Event". - -You need the "IFS-RS232-DATACABLE" to communicate with the UPS in Linux -as the IFS-USB cable doesn't seem to be supported. FYI communication -parameters are: 115200,E,8,1. - -You also need the UPS-CONF Windows software (free; download from their -site), to configure the UPS signals and timers. - -1. Run the UPS-CONF -2. Go to Settings->Time Setting -3. Choose "state of charge shutdown delay" -4. Choose Remote starts PC-Shutdown in Mains and Battery mode -5. On the PC-Shutdown enter the maximum value (5 minutes) -6. On the PC-Restart delay enter the time you want the UPS to leave - the output power off before restarting (e.g. 60 seconds), after - mains power is restored. -7. On the UPS, turn the screw to the "PC-MODE" position - -Configuring the above way ensures that: - - * When power is lost, UPS constantly calculates remaining battery time - * When remaining battery time is less than 5 minutes (PC-Shutdown setting), - it will raise the "Shutdown" event (seen as LOW-BATT in NUT) - * From that moment even if input power is restored, the UPS will cut the - output power to its load after 5 minutes - * When the input power is restored, the UPS will restore output power - after 60 seconds (PC-RESTART delay setting). - -Meaning of settings: - - * PC-Shutdown: How long before output cutoff the UPS will raise - the "shutdown event" signal. Max value for this is 5 minutes. - So PC should be able to shutdown within 5 minutes. - * PC-Restart: How long to delay output power after power is restored. - Max is 60 seconds. - - -EXTRA ARGUMENTS ---------------- - -This driver doesn't support any optional settings. - -INSTALLATION ------------- - -This driver is not built by default. You can build it by installing -libmodbus and running `configure --with-modbus=yes`. - -You also need to give proper permissions on the local serial device file -(/dev/ttyS0 for example) to allow the NUT user to access it. - -INSTANT COMMANDS ----------------- - -This driver doesn't support any instant commands. - -AUTHOR ------- - -Spiros Ioannou - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* libmodbus home page: http://libmodbus.org diff --git a/docs/man/pijuice.8 b/docs/man/pijuice.8 deleted file mode 100644 index 15af10a..0000000 --- a/docs/man/pijuice.8 +++ /dev/null @@ -1,167 +0,0 @@ -'\" t -.\" Title: pijuice -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "PIJUICE" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -pijuice \- driver for UPS in PiJuice HAT -.SH "NOTE" -.sp -This man page only documents the hardware\-specific features of the \fBpijuice\fR driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This manual page was hastily adapted from related asem driver manpage based on information from the original pull request, and so may not fully apply to PiJuice HAT, patches from experts are welcome\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -The \fBpijuice\fR driver supports the portable PiJuice HAT UPS for Raspberry Pi embedded PCs\&. -.SH "EXTRA ARGUMENTS" -.sp -The required parameter for this driver is the I2C bus name: -.PP -\fBport\fR=\fIdev\-node\fR -.RS 4 -On the PiJuice HAT, this should be -/dev/i2c\-1\&. -.RE -.SH "INSTALLATION" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This section was copied from asem driver manpage and may not fully apply to PiJuice HAT, patches are welcome\&. -.sp .5v -.RE -.sp -This driver is specific to the Linux I2C API, and requires the lm_sensors libi2c\-dev or its equivalent to compile\&. -.sp -Beware that the SystemIO memory used by the I2C controller is reserved by ACPI\&. If only a native I2C driver (e\&.g\&. i2c_i801, as of 3\&.5\&.X Linux kernels) is available, then you\(cqll need to relax the ACPI resources check\&. For example, you can boot with the acpi_enforce_resources=lax option\&. -.SH "KNOWN ISSUES AND BUGS" -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This section was copied from asem driver manpage and may not fully apply to PiJuice HAT, patches are welcome\&. -.sp .5v -.RE -.sp -The driver shutdown function is not implemented, so other arrangements must be made to turn off the UPS\&. -.SH "AUTHORS" -.sp -Andrew Anderson -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Initial pull requests adding this driver: -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -https://github\&.com/networkupstools/nut/pull/730 -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -https://github\&.com/PiSupply/PiJuice/issues/124 -.RE -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Product home page: -https://uk\&.pi\-supply\&.com/products/pijuice\-standard -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE diff --git a/docs/man/pijuice.txt b/docs/man/pijuice.txt deleted file mode 100644 index 801646a..0000000 --- a/docs/man/pijuice.txt +++ /dev/null @@ -1,88 +0,0 @@ -PIJUICE(8) -========== - -NAME ----- - -pijuice - driver for UPS in PiJuice HAT - -NOTE ----- - -This man page only documents the hardware-specific features of the -*pijuice* driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -NOTE: This manual page was hastily adapted from related `asem` driver -manpage based on information from the original pull request, and so -may not fully apply to PiJuice HAT, patches from experts are welcome. - -SUPPORTED HARDWARE ------------------- - -The *pijuice* driver supports the portable PiJuice HAT UPS for Raspberry Pi -embedded PCs. - -EXTRA ARGUMENTS ---------------- - -The required parameter for this driver is the I2C bus name: - -*port*='dev-node':: -On the PiJuice HAT, this should be `/dev/i2c-1`. - -INSTALLATION ------------- - -NOTE: This section was copied from `asem` driver manpage and may not fully -apply to PiJuice HAT, patches are welcome. - -This driver is specific to the Linux I2C API, and requires the lm_sensors -libi2c-dev or its equivalent to compile. - -Beware that the SystemIO memory used by the I2C controller is reserved by ACPI. -If only a native I2C driver (e.g. i2c_i801, as of 3.5.X Linux kernels) is -available, then you'll need to relax the ACPI resources check. For example, you -can boot with the `acpi_enforce_resources=lax` option. - -////////////////////////////////////////// -Optional: use DIAGNOSTICS to describe troubleshooting techniques that are -longer than what can be conveniently described in the driver error messages. - -DIAGNOSTICS ------------ - -////////////////////////////////////////// - -KNOWN ISSUES AND BUGS ---------------------- - -NOTE: This section was copied from `asem` driver manpage and may not fully -apply to PiJuice HAT, patches are welcome. - -The driver shutdown function is not implemented, so other arrangements must be -made to turn off the UPS. - -AUTHORS -------- - -Andrew Anderson - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* Initial pull requests adding this driver: -** https://github.com/networkupstools/nut/pull/730 -** https://github.com/PiSupply/PiJuice/issues/124 - -* Product home page: https://uk.pi-supply.com/products/pijuice-standard - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/powercom.8 b/docs/man/powercom.8 index 9c5c801..205f6b7 100644 --- a/docs/man/powercom.8 +++ b/docs/man/powercom.8 @@ -1,13 +1,13 @@ '\" t .\" Title: powercom -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "POWERCOM" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "POWERCOM" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -73,10 +73,8 @@ The exact type of the communication protocol within the powercom family, that wi \fIKP625AP\fR, \fIIMP\fR, \fIKIN\fR, -\fIBNT\fR, -\fIBNT\-other\fR -and -\fIOPTI\fR\&. The default is +\fIBNT\fR, and +\fIBNT\-other\fR\&. The default is \fITrust\fR\&. .sp \fIBNT\-other\fR @@ -129,11 +127,6 @@ or .RS 4 (Only for types KP625AP, Trust, Egys\&.) A quad that is used convert the raw voltage data to a human\-readable voltage reading using the function A*x+B\&. If the raw value x IS HALF the Voltage, then set A=2, B=0\&. The default is type\-dependent and is given below\&. Do note that the braces and commas are mandatory, as well as the lack of whitespace characters\&. .RE -.PP -\fBnobt\fR -.RS 4 -If this flag is present, the battery check on startup is skipped\&. This is useful for systems that tend to overload the UPS when testing the battery on system startup \(em just when the power consumption tends to be high\&. -.RE .SH "DEFAULT VALUES FOR THE EXTRA ARGUMENTS" .sp .if n \{\ @@ -265,65 +258,9 @@ voltage = {2\&.0000,0\&.0000,2\&.0000,0\&.0000} .if n \{\ .RE .\} -.SS "OPTI" +.SH "AUTHOR" .sp -.if n \{\ -.RS 4 -.\} -.nf -numOfBytesFromUPS = 16 -methodOfFlowControl = no_flow_control -validationSequence = {{5,0xFF},{7,0},{8,0}} -shutdownArguments = {{1,30},y} -.fi -.if n \{\ -.RE -.\} -.SH "AUTHORS" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Peter Bieringer -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Alexey Sidorov -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Keven L\&. Ates -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Rouben Tchakhmakhtchian -.RE +Peter Bieringer , Alexey Sidorov , Keven L\&. Ates .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/powercom.txt b/docs/man/powercom.txt index db7e936..b7516ff 100644 --- a/docs/man/powercom.txt +++ b/docs/man/powercom.txt @@ -1,21 +1,19 @@ POWERCOM(8) =========== -NAME +NAME ---- powercom - UPS driver for serial Powercom/Trust/Advice UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the powercom driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports many similar kinds of serial UPS hardware (as well as a few USB UPS models with USB-to-serial adapters). The most common ones are the Trust 425/625, Powercom, and Advice Partner/King PR750. Others using the same @@ -26,12 +24,11 @@ see the NUT Hardware Compatibility List (HCL). EXTRA ARGUMENTS --------------- - -This driver supports the following optional settings in the +This driver supports the following optional settings in the linkman:ups.conf[5] file: *linevoltage*='value':: -An integer specifying the line voltage. It can't be auto detected. Acceptable +An integer specifying the line voltage. It can't be auto detected. Acceptable values are in the range of 110-120 or 220-240. The default is '230'. *manufacturer*='name':: @@ -39,7 +36,7 @@ Specify the manufacturer name, which also can't be auto detected. This is a user defined string, so any name is acceptable. The default is 'PowerCom'. *modelname*='name':: -Specify the model name, which also can't be auto detected. This is a user +Specify the model name, which also can't be auto detected. This is a user defined string, so any name is acceptable. The default is 'Unknown'. *serialnumber*='value':: @@ -49,17 +46,17 @@ Like modelname above, but for the serial number. The default is 'Unknown'. The exact type of the communication protocol within the powercom family, that will be used to communicate with the UPS. The type is named after the first modelname that was coded with that protocol. The acceptable names are -'Trust', 'Egys', 'KP625AP', 'IMP', 'KIN', 'BNT', 'BNT-other' and 'OPTI'. +'Trust', 'Egys', 'KP625AP', 'IMP', 'KIN', 'BNT', and 'BNT-other'. The default is 'Trust'. + -'BNT-other' is a special type for other BNT models (such as the 1500A at 120V +'BNT-other' is a special type for other BNT models (such as the 1500A at 120V and can be used to override ALL models using ALL of the following values. *shutdownArguments*={{'minutes','seconds'},'whether_minutes_should_be_used'}:: -The minutes and seconds that the UPS should wait between receiving the +The minutes and seconds that the UPS should wait between receiving the shutdown command and actually shutting off. The other argument should be set -to the character 'n' only when the minutes value should be skipped and not -sent to the UPS. The default is type-dependent and is given below. The braces +to the character 'n' only when the minutes value should be skipped and not +sent to the UPS. The default is type-dependent and is given below. The braces and commas are mandatory. Note that there should be no whitespace characters. *numOfBytesFromUPS*='value':: @@ -68,13 +65,13 @@ is type-dependent and is given below. *methodOfFlowControl*='name':: The method of serial communication flow control that is engaged by the UPS. -The default is type-dependent and is given below. Acceptable names are +The default is type-dependent and is given below. Acceptable names are 'dtr0rts1', 'dtr1' or 'no_flow_control'. *validationSequence*={{'index1','value1'},{'index2','value2'},{'index3','value3'}}:: (Only for types KP625AP, Trust, Egys.) 3 pairs to be used for validating the UPS by comparing bytes of the raw data -with constant values. The index selects the byte from the UPS (see +with constant values. The index selects the byte from the UPS (see numOfBytesFromUPS) and the value is for matching to the byte. The default is type-dependent and is given below. The braces and commas are mandatory, as the lack of white space characters. @@ -83,7 +80,7 @@ the lack of white space characters. (Only for types KP625AP, Trust, Egys.) A pair to convert the raw frequency data to a human-readable frequency reading using the function 1/(A*x+B). If the raw value x IS the frequency, -then set A=1/(x^2) and B=0. The default is type-dependent and is given below. +then set A=1/(x^2) and B=0. The default is type-dependent and is given below. Do note that the braces and commas are mandatory as well, as the lack of whitespace characters. @@ -97,11 +94,11 @@ characters. *batteryPercentage*={'Battery1','Battery2','Battery3','Line4','Line5'}:: (Only for KP625AP, Trust, Egys.) -A 5 tuple to convert the raw battery and line data to a human-readable +A 5 tuple to convert the raw battery and line data to a human-readable battery and line percentage reading using the functions (Battery) A*x+B*y+C and (Line) D*x+E. If the raw value x IS the Battery Percent, then -set A=1, B=0, C=0, D=1, E=0. The default is type-dependent and is given below. -Do note that the braces and commas are mandatory, as the lack of white space +set A=1, B=0, C=0, D=1, E=0. The default is type-dependent and is given below. +Do note that the braces and commas are mandatory, as the lack of white space characters. *voltage*={'240A','240B','120A','120B'}:: @@ -112,14 +109,8 @@ then set A=2, B=0. The default is type-dependent and is given below. Do note that the braces and commas are mandatory, as well as the lack of whitespace characters. -*nobt*:: -If this flag is present, the battery check on startup is skipped. This is -useful for systems that tend to overload the UPS when testing the battery on -system startup -- just when the power consumption tends to be high. - DEFAULT VALUES FOR THE EXTRA ARGUMENTS -------------------------------------- - linevoltage = 230 manufacturer = PowerCom modelname = Unknown @@ -132,7 +123,6 @@ values for ALL models. Trust ~~~~~ - numOfBytesFromUPS = 11 methodOfFlowControl = dtr0rts1 validationSequence = {{5,0},{7,0},{8,0}} @@ -144,7 +134,6 @@ Trust KP625AP ~~~~~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = dtr0rts1 validationSequence = {{5,0x80},{7,0},{8,0}} @@ -156,7 +145,6 @@ KP625AP Egys ~~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = no_flow_control validationSequence = {{5,0x80},{7,0},{8,0}} @@ -168,7 +156,6 @@ Egys IMP ~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = no_flow_control validationSequence = {{5,0xFF},{7,0},{8,0}} @@ -176,7 +163,6 @@ IMP KIN ~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = no_flow_control validationSequence = {{11,0x4b},{8,0},{8,0}} @@ -184,7 +170,6 @@ KIN BNT ~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = no_flow_control validationSequence = {{11,0x42},{8,0},{8,0}} @@ -192,7 +177,6 @@ BNT BNT-other ~~~~~~~~~ - numOfBytesFromUPS = 16 methodOfFlowControl = no_flow_control validationSequence = {{8,0},{8,0},{8,0}} @@ -202,31 +186,19 @@ BNT-other batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000} voltage = {2.0000,0.0000,2.0000,0.0000} -OPTI -~~~~ - - numOfBytesFromUPS = 16 - methodOfFlowControl = no_flow_control - validationSequence = {{5,0xFF},{7,0},{8,0}} - shutdownArguments = {{1,30},y} - -AUTHORS -------- - -* Peter Bieringer -* Alexey Sidorov -* Keven L. Ates -* Rouben Tchakhmakhtchian +AUTHOR +------ +Peter Bieringer , +Alexey Sidorov , +Keven L. Ates SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/powerman-pdu.8 b/docs/man/powerman-pdu.8 index e0d59d5..c8c9808 100644 --- a/docs/man/powerman-pdu.8 +++ b/docs/man/powerman-pdu.8 @@ -1,13 +1,13 @@ '\" t .\" Title: powerman-pdu .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "POWERMAN\-PDU" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "POWERMAN\-PDU" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -108,26 +108,6 @@ Arnaud Quette \fBnutupsdrv\fR(8) .SS "Internet resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The PowerMan home page: -https://github\&.com/chaos/powerman -.RE +The PowerMan home page: http://powerman\&.sourceforge\&.net/ diff --git a/docs/man/powerman-pdu.txt b/docs/man/powerman-pdu.txt index 0332ea6..a7b914d 100644 --- a/docs/man/powerman-pdu.txt +++ b/docs/man/powerman-pdu.txt @@ -1,4 +1,4 @@ -POWERMAN-PDU(8) +POWERMAN-PDU(8) =============== NAME @@ -38,7 +38,6 @@ This driver is not built by default. You can build it by using UPS COMMANDS ------------ - The following instant commands (see linkman:upscmd[8]) are available for each outlet of the PDU, with *X* standing for the outlet number: @@ -56,7 +55,6 @@ Cycle the outlet (power off then power on, possibly with a delay). IMPLEMENTATION -------------- - The hostname of the Powerman server is specified using the "port" value in *ups.conf*, i.e.: @@ -68,26 +66,22 @@ The port used to reach 'powermand' is optional if the default port is used. KNOWN ISSUES ------------ - In the current NUT version (2.4.1), ups.status is still exposed, with the value "WAIT". Some other values from the ups collection are also exposed. AUTHOR ------ - Arnaud Quette SEE ALSO -------- - The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The PowerMan home page: https://github.com/chaos/powerman +The PowerMan home page: http://powerman.sourceforge.net/ diff --git a/docs/man/powerpanel.8 b/docs/man/powerpanel.8 index b10dffa..b7aa6ac 100644 --- a/docs/man/powerpanel.8 +++ b/docs/man/powerpanel.8 @@ -1,13 +1,13 @@ '\" t .\" Title: powerpanel .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "POWERPANEL" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "POWERPANEL" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,15 +28,13 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -powerpanel \- Driver for serial PowerPanel Plus compatible UPS equipment +powerpanel \- Driver for PowerPanel Plus compatible UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the powerpanel driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp This driver supports CyberPower BC1200, PR2200 and many other similar devices, both for the text and binary protocols\&. The driver will autodetect which protocol is used\&. -.sp -If your Cyber Power Systems UPS has a USB port, you may wish to use the \fBusbhid-ups\fR(8) driver\&. The \fBsnmp-ups\fR(8) driver supports several network cards via SNMP\&. .SH "EXTRA ARGUMENTS" .sp This driver supports the following optional settings in \fBups.conf\fR(5): @@ -169,9 +167,6 @@ Arjen de Korte , Doug Reynolds .SS "The core driver:" .sp \fBnutupsdrv\fR(8) -.SS "Other drivers:" -.sp -\fBusbhid-ups\fR(8), \fBsnmp-ups\fR(8) .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/powerpanel.txt b/docs/man/powerpanel.txt index 4e8450d..6ba2b6e 100644 --- a/docs/man/powerpanel.txt +++ b/docs/man/powerpanel.txt @@ -4,29 +4,22 @@ POWERPANEL(8) NAME ---- -powerpanel - Driver for serial PowerPanel Plus compatible UPS equipment +powerpanel - Driver for PowerPanel Plus compatible UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the powerpanel driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports CyberPower BC1200, PR2200 and many other similar devices, both for the text and binary protocols. The driver will autodetect which protocol is used. -If your Cyber Power Systems UPS has a USB port, you may wish to use the -linkman:usbhid-ups[8] driver. The linkman:snmp-ups[8] driver supports several -network cards via SNMP. - EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in linkman:ups.conf[5]: *protocol=*['text,binary']:: @@ -54,7 +47,6 @@ seconds will be truncated to 6 seconds intervals, values above 60 seconds to VARIABLES --------- - Depending on the type of your UPS unit, some of the following variables may be changed with linkman:upsrw[8]. If the driver can't read a variable from the UPS, it will not be made available. @@ -76,7 +68,6 @@ writable: allow cold start from battery COMMANDS -------- - Depending on the type of your UPS unit, some of the following commands may be available. @@ -93,7 +84,6 @@ must verify that these work as expected (see <<_shutdown_issues,Shutdown Issues> SUPPORT STATUS -------------- - Vendor support is absent for this driver, so if you need some features that are currently not available, provide ample documentation on what the driver should sent to the UPS in order to make this work. If more information @@ -104,7 +94,6 @@ isn't willing to share this with us. SHUTDOWN ISSUES --------------- - If the *shutdown.return* command on your UPS doesn't seem to work, chances are that your UPS is an older model. Try a couple of different settings for 'offdelay'. If no value in the range 6..600 works, your @@ -121,7 +110,6 @@ supported through the text protocol are affected by this. KNOWN PROBLEMS -------------- - The CyberPower OP series don't offer direct voltage, charge, frequency and temperature readings. Instead, they will return a binary value that needs conversion to the actual value. @@ -136,7 +124,6 @@ instrument. AUTHORS ------- - Arjen de Korte , Doug Reynolds SEE ALSO @@ -144,16 +131,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] -Other drivers: -~~~~~~~~~~~~~~ - -linkman:usbhid-ups[8], -linkman:snmp-ups[8] - Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/rhino.8 b/docs/man/rhino.8 index fd9eeba..54a37f4 100644 --- a/docs/man/rhino.8 +++ b/docs/man/rhino.8 @@ -1,13 +1,13 @@ '\" t .\" Title: rhino .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "RHINO" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "RHINO" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ rhino \- Driver for Brazilian Microsol RHINO UPS equipment This man page only documents the hardware\-specific features of the rhino driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -This driver has been tested with: +This driver has been tested with : .sp .RS 4 .ie n \{\ diff --git a/docs/man/rhino.txt b/docs/man/rhino.txt index bdb30f8..e4638e2 100644 --- a/docs/man/rhino.txt +++ b/docs/man/rhino.txt @@ -3,21 +3,18 @@ RHINO(8) NAME ---- - rhino - Driver for Brazilian Microsol RHINO UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the rhino driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - -This driver has been tested with: - +This driver has been tested with : + * Rhino 6000 VA * Rhino 7500 VA * Rhino 10000 VA @@ -48,7 +45,6 @@ COMMANDS AUTHOR ------ - Silvino B. Magalhães SEE ALSO @@ -56,10 +52,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/richcomm_usb.8 b/docs/man/richcomm_usb.8 index 5605e1b..391e88a 100644 --- a/docs/man/richcomm_usb.8 +++ b/docs/man/richcomm_usb.8 @@ -1,13 +1,13 @@ '\" t .\" Title: richcomm_usb .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "RICHCOMM_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "RICHCOMM_USB" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -37,32 +37,12 @@ This man page only documents the specific features of the richcomm_usb driver\&. The Richcomm dry\-contact to USB solution is a generic interface that is used to upgrade an existing (RS\-232) contact closure UPS interface to USB\&. As such, all the limitations of the underlying contact closure interface apply\&. This means that you will only get the essentials in ups\&.status: OL, OB, and LB\&. See also \fBgenericups\fR(8)\&. .SH "BUGS" .sp -Most contact\-closure UPSes will not power down the load if the line power is present\&. This can create a race when using secondary \fBupsmon\fR(8) systems\&. See the \fBupsmon\fR(8) man page for more information\&. +Most contact\-closure UPSes will not power down the load if the line power is present\&. This can create a race when using slave \fBupsmon\fR(8) systems\&. See the \fBupsmon\fR(8) man page for more information\&. .sp The solution to both of these problems is to upgrade to a smart protocol UPS of some kind that allows detection and proper load cycling on command\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Peter van Valderen -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Dirk Teurlings -.RE +Peter van Valderen , Dirk Teurlings .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/richcomm_usb.txt b/docs/man/richcomm_usb.txt index fe53b14..3f52861 100644 --- a/docs/man/richcomm_usb.txt +++ b/docs/man/richcomm_usb.txt @@ -3,19 +3,16 @@ RICHCOMM_USB(8) NAME ---- - richcomm_usb - Driver UPS equipment using Richcomm dry-contact to USB solution NOTE ---- - -This man page only documents the specific features of the richcomm_usb +This man page only documents the specific features of the richcomm_usb driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - The Richcomm dry-contact to USB solution is a generic interface that is used to upgrade an existing (RS-232) contact closure UPS interface to USB. As such, all the limitations of the underlying contact closure interface @@ -24,34 +21,30 @@ OB, and LB. See also linkman:genericups[8]. BUGS ---- - -Most contact-closure UPSes will not power down the load if the line power -is present. This can create a race when using secondary linkman:upsmon[8] +Most contact-closure UPSes will not power down the load if the line power +is present. This can create a race when using slave linkman:upsmon[8] systems. See the linkman:upsmon[8] man page for more information. -The solution to both of these problems is to upgrade to a smart protocol +The solution to both of these problems is to upgrade to a smart protocol UPS of some kind that allows detection and proper load cycling on command. AUTHORS ------- -* Peter van Valderen -* Dirk Teurlings +Peter van Valderen , +Dirk Teurlings SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] The generic serial driver: ~~~~~~~~~~~~~~~~~~~~~~~~~~ - linkman:genericups[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/riello_ser.8 b/docs/man/riello_ser.8 index d82d2bf..58dcb8e 100644 --- a/docs/man/riello_ser.8 +++ b/docs/man/riello_ser.8 @@ -1,13 +1,13 @@ '\" t .\" Title: riello_ser .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "RIELLO_SER" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "RIELLO_SER" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/riello_ser.txt b/docs/man/riello_ser.txt index cbc326b..fddd5a5 100644 --- a/docs/man/riello_ser.txt +++ b/docs/man/riello_ser.txt @@ -1,5 +1,5 @@ -RIELLO_SER(8) -============= +RIELLO_SER(8) +=========== NAME ---- @@ -36,10 +36,8 @@ SEE ALSO The core driver ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/riello_usb.8 b/docs/man/riello_usb.8 index 4cbf52e..94460d4 100644 --- a/docs/man/riello_usb.8 +++ b/docs/man/riello_usb.8 @@ -1,13 +1,13 @@ '\" t .\" Title: riello_usb .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "RIELLO_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "RIELLO_USB" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/riello_usb.txt b/docs/man/riello_usb.txt index 1c4ffd6..ced417a 100644 --- a/docs/man/riello_usb.txt +++ b/docs/man/riello_usb.txt @@ -1,5 +1,5 @@ -RIELLO_USB(8) -============= +RIELLO_USB(8) +=========== NAME ---- @@ -35,10 +35,8 @@ SEE ALSO The core driver ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/safenet.8 b/docs/man/safenet.8 index da11c78..62b2ac9 100644 --- a/docs/man/safenet.8 +++ b/docs/man/safenet.8 @@ -1,13 +1,13 @@ '\" t .\" Title: safenet .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "SAFENET" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "SAFENET" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -66,7 +66,7 @@ Time to wait before switching on the UPS (minutes)\&. Defaults to 1 minute\&. .RS 4 Time to wait before shutting down the UPS (seconds)\&. Defaults to 30 seconds\&. .RE -.SH "INSTANT COMMANDS" +.SH "UPSCMD" .sp This driver supports some instant commands (see \fBupscmd\fR(8)): .PP diff --git a/docs/man/safenet.txt b/docs/man/safenet.txt index 00aa02f..f6f5a5a 100644 --- a/docs/man/safenet.txt +++ b/docs/man/safenet.txt @@ -3,25 +3,21 @@ SAFENET(8) NAME ---- - safenet - Driver for SafeNet compatible UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the safenet driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports UPS equipment which can be controlled via SafeNet v1.0 for Windows (serial interface only). EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in the linkman:ups.conf[5] file: @@ -42,9 +38,8 @@ Time to wait before switching on the UPS (minutes). Defaults to 1 minute. *offdelay=*'value':: Time to wait before shutting down the UPS (seconds). Defaults to 30 seconds. -INSTANT COMMANDS ----------------- - +UPSCMD +------ This driver supports some instant commands (see linkman:upscmd[8]): *test.battery.start*:: @@ -78,7 +73,6 @@ and *ondelay*. KNOWN PROBLEMS -------------- - If you run the *shutdown.return* command with mains present, the output may stay on or switch off and not back on again. The *shutdown.reboot* command will unconditionally switch on the load again (with or without mains @@ -93,7 +87,6 @@ return when the power comes back. AUTHOR ------ - Arjen de Korte SEE ALSO @@ -101,10 +94,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/skel.txt b/docs/man/skel.txt index 8e31094..8bf885f 100644 --- a/docs/man/skel.txt +++ b/docs/man/skel.txt @@ -3,12 +3,10 @@ SKEL(8) NAME ---- - skel - skeleton driver man page NOTE ---- - This man page only documents the hardware-specific features of the *skel* driver. For information about the core driver, see linkman:nutupsdrv[8]. @@ -17,7 +15,7 @@ linkman:nutupsdrv[8]. The following lines are comments. When copying this man page for your new driver, be sure to replace all -occurrences of "skel" and "SKEL" by your actual driver name. +occurrances of "skel" and "SKEL" by your actual driver name. If you have AsciiDoc installed, you can test the formatting of your man page by running: @@ -33,7 +31,6 @@ apropos(8) database is properly rebuilt. SUPPORTED HARDWARE ------------------ - *skel* supports ... ////////////////////////////////////////// @@ -47,12 +44,11 @@ CABLING EXTRA ARGUMENTS --------------- - This driver also supports the following optional settings: *option1*='num':: Set the value of ... to 'num'. Contrast with *option2*. - + *option2*='string':: Some other option. @@ -90,7 +86,6 @@ encountered when implementing the protocol for your UPS. KNOWN ISSUES AND BUGS --------------------- - *Got "EPERM: Operation not permitted" upon driver startup*:: You have forgotten to install the udev files, as explained @@ -105,7 +100,6 @@ some form of contact information so that users can report bugs. AUTHORS ------- - J Random User ////////////////////////////////////////// @@ -120,10 +114,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/snmp-ups.8 b/docs/man/snmp-ups.8 index b102ee4..2ec4c26 100644 --- a/docs/man/snmp-ups.8 +++ b/docs/man/snmp-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: snmp-ups .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "SNMP\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "SNMP\-UPS" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,12 +34,7 @@ snmp-ups \- Multi\-MIB Driver for SNMP UPS equipment This man page only documents the hardware\-specific features of the snmp\-ups driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -The snmp\-ups driver automatically detects and supports a wide range of devices by loading various MIBS, such as: -.PP -\fBietf\fR -.RS 4 -UPS that is RFC 1628 (UPS MIB) compliant, e\&.g\&. MGE UPS SYSTEMS, Liebert, perhaps others (default) -.RE +The snmp\-ups driver automatically detects and supports a wide range of devices by loading various MIBS: \fBietf\fR:: UPS that is RFC 1628 (UPS MIB) compliant, e\&.g\&. MGE UPS SYSTEMS, Liebert, perhaps others (default) .PP \fBmge\fR .RS 4 @@ -61,11 +56,6 @@ Socomec Sicon UPS with Netvision Web/SNMP management card/external box Powerware devices with ConnectUPS SNMP cards .RE .PP -\fBpxgx_ups\fR -.RS 4 -Eaton devices with Power Xpert Gateway UPS Card -.RE -.PP \fBaphel_genesisII\fR .RS 4 Eaton Powerware ePDU Monitored @@ -78,12 +68,7 @@ Eaton Powerware ePDU Managed .PP \fBraritan\fR .RS 4 -Various Raritan PDUs (Dominion PX, PM, RPC) -.RE -.PP -\fBraritan\-px2\fR -.RS 4 -Various Raritan PDUs (Dominion PX2) +Various Raritan PDUs .RE .PP \fBbaytech\fR @@ -100,56 +85,20 @@ HP/Compaq AF401A management card, perhaps others .RS 4 Cyberpower RMCARD201\&. Should also support RMCARD100 (net version), RMCARD202 and RMCARD301 .RE -.PP -\fBhuawei\fR -.RS 4 -Huawei UPS5000\-E, perhaps others -.RE -.PP -\fBtripplite\fR -.RS 4 -TrippLite UPSes; at this time this is the IETF MIB mapping with just the Tripplite entry point OID to verify the device vendor, and a real hardware\-specific configuration will be added in the future development\&. -.RE -.sp -For a complete and up\-to\-date listing, you can query the driver by passing the \fBmibs=\-\-list\fR argument (see below)\&. .SH "EXTRA ARGUMENTS" .sp This driver supports the following optional settings in the \fBups.conf\fR(5): .PP -\fBport\fR=\fIhostname[:port]\fR -.RS 4 -Set SNMP hostname, or IP address, and port number of the peer SNMP agent\&. There is no default for the hostname, but the default port is 161\&. -.RE -.PP -\fBmibs\fR=\fI\-\-list\fR -.RS 4 -A special option which allows to list the currently known MIB\-to\-NUT mappings and exit the driver binary, intended for command\-line usage like this: -.RE -.sp -.if n \{\ -.RS 4 -.\} -.nf -$ snmp\-ups \-a snmp\-test \-x mibs=\-\-list -.fi -.if n \{\ -.RE -.\} -.PP \fBmibs\fR=\fIname\fR .RS 4 -Set MIB compliance (default=auto, allowed entries: refer to SUPPORTED HARDWARE above)\&. -.sp -With "auto", the driver will try a select set of SNMP objects until it finds one that the device responds to\&. -.sp -Note that since NUT 2\&.6\&.2, snmp\-ups has a new method that uses sysObjectID (which is a pointer to the preferred MIB of the device) to detect supported devices\&. This renders void the -\fBrequirement\fR -to use the "mibs" option\&. +Set MIB compliance (default=auto, allowed entries: refer to the above SUPPORTED HARDWARE)\&. With "auto", the driver will try a select set of SNMP objects until it finds one that the device responds to\&. Note that, since NUT 2\&.6\&.2, snmp\-ups has a new method that uses sysObjectID, which is a pointer to the prefered MIB of the device, to detect supported devices\&. This renders void the use of +\fImib\fR +option\&. .RE .PP \fBcommunity\fR=\fIname\fR .RS 4 -Set community name (default = public)\&. Note that a RW community name is required to change UPS settings and send commands (as for a powerdown)\&. +Set community name (default = public)\&. Note that you require a RW community name to change UPS settings (as for a powerdown)\&. .RE .PP \fBsnmp_version\fR=\fIversion\fR @@ -157,25 +106,9 @@ Set community name (default = public)\&. Note that a RW community name is requir Set SNMP version (default = v1, allowed: v2c, v3) .RE .PP -\fBsnmp_retries\fR=\fIretries\fR +\fBpollfreq\fR=\fIvalue\fR .RS 4 -Specifies the number of Net\-SNMP retries to be used in the requests (default=5) -.RE -.PP -\fBsnmp_timeout\fR=\fItimeout\fR -.RS 4 -Specifies the Net\-SNMP timeout in seconds between retries (default=1) -.RE -.PP -\fBsymmetrathreephase\fR -.RS 4 -Enable APCC three phase Symmetra quirks (use on APCC three phase Symmetras): Convert from three phase line\-to\-line voltage to line\-to\-neutral voltage (default: not enabled) -.RE -.PP -\fBpollfreq\fR=\fInum\fR -.RS 4 -Set polling interval for full updates, in seconds, to reduce SNMP network traffic relative to the quick updates performed every "pollinterval" (the latter option is described in -\fBups.conf\fR(5))\&. The default value is 30 (in seconds)\&. +Set polling frequency in seconds, to reduce network flow (default=30) .RE .PP \fBnotransferoids\fR @@ -205,99 +138,72 @@ Set the privacy pass phrase used for encrypted SNMPv3 messages (no default) .PP \fBauthProtocol\fR=\fIvalue\fR .RS 4 -Set the authentication protocol (MD5, SHA, SHA256, SHA384 or SHA512) used for authenticated SNMPv3 messages (default=MD5)\&. Note that the exact protocol list depends on Net\-SNMP library capabilities; check help of the -snmp\-ups -binary program for the run\-time supported list\&. +Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages (default=MD5) .RE .PP \fBprivProtocol\fR=\fIvalue\fR .RS 4 -Set the privacy protocol (DES, AES, AES192 or AES256) used for encrypted SNMPv3 messages (default=DES)\&. Note that the exact protocol list depends on Net\-SNMP library capabilities; check help of the -snmp\-ups -binary program for the run\-time supported list\&. +Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages (default=DES) .RE .SH "REQUIREMENTS" .sp You will need to install the Net\-SNMP package from http://www\&.net\-snmp\&.org/ before building this driver\&. .sp SNMP v3 also requires OpenSSL support from http://www\&.openssl\&.org\&. -.SH "LIMITATIONS" +.SH "LIMITATION" .SS "Shutdown" .sp -The shutdown sequence should be tested before relying on NUT to send a shutdown command to the UPS\&. The problem is that the host network stack may have been torn down by the time the driver is invoked to send the shutdown command\&. The driver attempts to send shutdown\&.return, shutdown\&.reboot, and load\&.off\&.delay commands to the UPS in sequence, stopping after the first supported command\&. +This driver does not provide a proper upsdrv_shutdown() function\&. There probably never will be one, since at the time this script should run (near the end of the system halt script), there will be no network capabilities anymore\&. Probably the only way to shutdown an SNMP UPS is by sending it a shutdown with delay command through \fBupscmd\fR(8) and hope for the best that the system will have finished shutting down before the power is cut\&. .SH "INSTALLATION" .sp -This driver is only built if the Net\-SNMP development files are present at configuration time\&. You can also force it to be built by using configure \-\-with\-snmp=yes before calling make\&. -.SH "EXAMPLES" +This driver is only built if the Net\-SNMP development files are present on the system\&. You can also force it to be built by using "configure \-\-with\-snmp=yes" before calling make\&. +.SH "IMPLEMENTATION" .sp -The hostname of the UPS is specified with the "port" value in ups\&.conf, and may include a non\-standard (161) remote peer port: +The hostname of the UPS is specified with the "port" value in ups\&.conf, i\&.e\&.: .sp .if n \{\ .RS 4 .\} .nf - [snmpv1] - driver = snmp\-ups - port = snmp\-ups\&.example\&.com - community = public - snmp_version = v1 - pollfreq = 15 - desc = "Example SNMP v1 device" - - [snmpv3] - driver = snmp\-ups - port = 166\&.99\&.224\&.132:170 - snmp_version = v3 - secLevel = authPriv - secName = mysecurityname - authPassword = myauthenticationpassphrase - privPassword = myprivatepassphrase - desc = "Example SNMP v3 device, with the highest security level" +[snmpv1] + driver = snmp\-ups + port = snmp\-ups\&.example\&.com + community = public + snmp_version = v1 + pollfreq = 15 + desc = "Example SNMP v1 device" +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +[snmpv3] + driver = snmp\-ups + port = 166\&.99\&.224\&.132 + snmp_version = v3 + secLevel = authPriv + secName = mysecurityname + authPassword = myauthenticationpassphrase + privPassword = myprivatepassphrase + desc = "Example SNMP v3 device, with the highest security level" .fi .if n \{\ .RE .\} .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arnaud Quette -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Dmitry Frolov -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Jim Klimov -.RE +Arnaud Quette, Dmitry Frolov .SH "SEE ALSO" .SS "The core driver:" .sp \fBnutupsdrv\fR(8) .SS "NUT SNMP Protocols Library" .sp -Available at: http://www\&.networkupstools\&.org/ups\-protocols\&.html#_snmp +Available at: http://www\&.networkupstools\&.org/protocols/snmp/ .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/snmp-ups.txt b/docs/man/snmp-ups.txt index f45462b..9584d20 100644 --- a/docs/man/snmp-ups.txt +++ b/docs/man/snmp-ups.txt @@ -8,7 +8,6 @@ snmp-ups - Multi-MIB Driver for SNMP UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the snmp-ups driver. For information about the core driver, see linkman:nutupsdrv[8]. @@ -16,20 +15,15 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ -The snmp-ups driver automatically detects and supports a wide range of -devices by loading various MIBS, such as: - +The snmp-ups driver automatically detects and supports a wide range of devices by loading various MIBS: *ietf*:: -UPS that is RFC 1628 (UPS MIB) compliant, e.g. MGE UPS SYSTEMS, Liebert, -perhaps others (default) +UPS that is RFC 1628 (UPS MIB) compliant, e.g. MGE UPS SYSTEMS, Liebert, perhaps others (default) *mge*:: -MGE UPS SYSTEMS and MGE Office Protection Systems devices with SNMP cards -(ref 66062, 66045, 66074 and 66244) +MGE UPS SYSTEMS and MGE Office Protection Systems devices with SNMP cards (ref 66062, 66045, 66074 and 66244) *apcc*:: -APC AP9605, AP9606, AP9617, and AP9618 APC network management cards, -as well as any others supporting the APC POWERNET MIB +APC AP9605, AP9606, AP9617, and AP9618 APC network management cards, as well as any others supporting the APC POWERNET MIB *netvision*:: Socomec Sicon UPS with Netvision Web/SNMP management card/external box @@ -37,9 +31,6 @@ Socomec Sicon UPS with Netvision Web/SNMP management card/external box *pw*:: Powerware devices with ConnectUPS SNMP cards -*pxgx_ups*:: -Eaton devices with Power Xpert Gateway UPS Card - *aphel_genesisII*:: Eaton Powerware ePDU Monitored @@ -47,10 +38,7 @@ Eaton Powerware ePDU Monitored Eaton Powerware ePDU Managed *raritan*:: -Various Raritan PDUs (Dominion PX, PM, RPC) - -*raritan-px2*:: -Various Raritan PDUs (Dominion PX2) +Various Raritan PDUs *baytech*:: Various BayTech PDUs @@ -59,19 +47,7 @@ Various BayTech PDUs HP/Compaq AF401A management card, perhaps others *cyberpower*:: -Cyberpower RMCARD201. Should also support RMCARD100 (net version), -RMCARD202 and RMCARD301 - -*huawei*:: -Huawei UPS5000-E, perhaps others - -*tripplite*:: -TrippLite UPSes; at this time this is the IETF MIB mapping with just -the Tripplite entry point OID to verify the device vendor, and a real -hardware-specific configuration will be added in the future development. - -For a complete and up-to-date listing, you can query the driver by passing -the *mibs=--list* argument (see below). +Cyberpower RMCARD201. Should also support RMCARD100 (net version), RMCARD202 and RMCARD301 EXTRA ARGUMENTS --------------- @@ -79,52 +55,22 @@ EXTRA ARGUMENTS This driver supports the following optional settings in the linkman:ups.conf[5]: -*port*='hostname[:port]':: -Set SNMP hostname, or IP address, and port number of the peer SNMP agent. -There is no default for the hostname, but the default port is 161. - -*mibs*='--list':: -A special option which allows to list the currently known MIB-to-NUT mappings -and exit the driver binary, intended for command-line usage like this: ----- -$ snmp-ups -a snmp-test -x mibs=--list ----- - *mibs*='name':: -Set MIB compliance (default=auto, allowed entries: refer to SUPPORTED -HARDWARE above). -+ +Set MIB compliance (default=auto, allowed entries: refer to the above SUPPORTED HARDWARE). With "auto", the driver will try a select set of SNMP objects until it finds -one that the device responds to. -+ -Note that since NUT 2.6.2, snmp-ups has a new method that uses sysObjectID -(which is a pointer to the preferred MIB of the device) to detect supported -devices. This renders void the *requirement* to use the "mibs" option. - +one that the device responds to. Note that, since NUT 2.6.2, snmp-ups has a new +method that uses sysObjectID, which is a pointer to the prefered MIB of the +device, to detect supported devices. This renders void the use of 'mib' option. + *community*='name':: Set community name (default = public). -Note that a RW community name is required to change UPS settings and -send commands (as for a powerdown). +Note that you require a RW community name to change UPS settings (as for a powerdown). *snmp_version*='version':: Set SNMP version (default = v1, allowed: v2c, v3) -*snmp_retries*='retries':: -Specifies the number of Net-SNMP retries to be used in the requests (default=5) - -*snmp_timeout*='timeout':: -Specifies the Net-SNMP timeout in seconds between retries (default=1) - -*symmetrathreephase*:: -Enable APCC three phase Symmetra quirks (use on APCC three phase Symmetras): -Convert from three phase line-to-line voltage to line-to-neutral voltage -(default: not enabled) - -*pollfreq*='num':: -Set polling interval for full updates, in seconds, to reduce SNMP network -traffic relative to the quick updates performed every "pollinterval" (the -latter option is described in linkman:ups.conf[5]). -The default value is 30 (in seconds). +*pollfreq*='value':: +Set polling frequency in seconds, to reduce network flow (default=30) *notransferoids*:: Disable the monitoring of the low and high voltage transfer OIDs in @@ -147,52 +93,42 @@ Set the authentication pass phrase used for authenticated SNMPv3 messages Set the privacy pass phrase used for encrypted SNMPv3 messages (no default) *authProtocol*='value':: -Set the authentication protocol (MD5, SHA, SHA256, SHA384 or SHA512) used for -authenticated SNMPv3 messages (default=MD5). Note that the exact protocol list -depends on Net-SNMP library capabilities; check help of the `snmp-ups` binary -program for the run-time supported list. +Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 +messages (default=MD5) *privProtocol*='value':: -Set the privacy protocol (DES, AES, AES192 or AES256) used for encrypted SNMPv3 -messages (default=DES). Note that the exact protocol list depends on Net-SNMP -library capabilities; check help of the `snmp-ups` binary program for the -run-time supported list. +Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages +(default=DES) REQUIREMENTS ------------ - You will need to install the Net-SNMP package from http://www.net-snmp.org/ before building this driver. SNMP v3 also requires OpenSSL support from http://www.openssl.org. -LIMITATIONS ------------ - +LIMITATION +---------- Shutdown ~~~~~~~~ -The shutdown sequence should be tested before relying on NUT to send a -shutdown command to the UPS. The problem is that the host network stack may -have been torn down by the time the driver is invoked to send the shutdown -command. The driver attempts to send +shutdown.return+, +shutdown.reboot+, -and +load.off.delay+ commands to the UPS in sequence, stopping after the first -supported command. +This driver does not provide a proper upsdrv_shutdown() function. There probably +never will be one, since at the time this script should run (near the end of +the system halt script), there will be no network capabilities anymore. +Probably the only way to shutdown an SNMP UPS is by sending it a shutdown +with delay command through linkman:upscmd[8] and hope for the best that the +system will have finished shutting down before the power is cut. INSTALLATION ------------ +This driver is only built if the Net-SNMP development files are present on the system. +You can also force it to be built by using "configure --with-snmp=yes" before calling make. -This driver is only built if the Net-SNMP development files are present at -configuration time. You can also force it to be built by using -+configure --with-snmp=yes+ before calling make. - -EXAMPLES --------- - +IMPLEMENTATION +-------------- The hostname of the UPS is specified with the "port" value in -`ups.conf`, and may include a non-standard (161) remote peer port: +`ups.conf`, i.e.: ------- [snmpv1] driver = snmp-ups port = snmp-ups.example.com @@ -203,36 +139,30 @@ The hostname of the UPS is specified with the "port" value in [snmpv3] driver = snmp-ups - port = 166.99.224.132:170 + port = 166.99.224.132 snmp_version = v3 secLevel = authPriv secName = mysecurityname authPassword = myauthenticationpassphrase privPassword = myprivatepassphrase desc = "Example SNMP v3 device, with the highest security level" ------- AUTHORS ------- +Arnaud Quette, Dmitry Frolov -* Arnaud Quette -* Dmitry Frolov -* Jim Klimov SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] NUT SNMP Protocols Library ~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Available at: http://www.networkupstools.org/ups-protocols.html#_snmp +Available at: http://www.networkupstools.org/protocols/snmp/ Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/socomec_jbus.8 b/docs/man/socomec_jbus.8 deleted file mode 100644 index 624d94f..0000000 --- a/docs/man/socomec_jbus.8 +++ /dev/null @@ -1,196 +0,0 @@ -'\" t -.\" Title: socomec_jbus -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "SOCOMEC_JBUS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -socomec_jbus \- Driver for Socomec JBUS UPS with RS\-232 serial Modbus connection\&. -.SH "SYNOPSIS" -.sp -\fBsocomec_jbus\fR \-h -.sp -\fBsocomec_jbus\fR \-a \fIDEVICE_NAME\fR [\fIOPTIONS\fR] -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -This man page only documents the hardware\-specific features of the socomec_jbus driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. -.sp .5v -.RE -.SH "SUPPORTED HARDWARE" -.sp -This driver supports Socomec JBUS series, online (double conversion) UPS with the following characteristics\&. -.sp -.RS 4 -.ie n \{\ -\h'-04' 1.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 1." 4.2 -.\} -Single phase and 3\-phase UPS -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04' 2.\h'+01'\c -.\} -.el \{\ -.sp -1 -.IP " 2." 4.2 -.\} -Connection: RS\-232 -.RE -.sp -These are typically provided with a Netvision WEB/SNMP management card / external box that would be better served by the \fBsnmp-ups\fR(8) driver\&. In case netvision isn\(cqt available, you can hook up the UPS directly via the serial port and use this driver\&. -.sp -Currently, it has only been tested on the following model\&. -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -DIGYS 3/3 15kVA -.RE -.sp -In theory, any Socomec JBUS model should work\&. It should be discovered as \(lqUnknown Socomec JBUS\(rq with a numeric id that I\(cqll need to add it to the list of supported UPSs\&. -.sp -Sadly, Socomec document only mentions DELPHYS MX and DELPHYS MX elite and I have the id of my own DIGYS, so chances are, your model will not be recognized but will probably mostly work\&. Please report successful or unsuccessful results to the bug tracker or the mailing list\&. Make sure to include the full model number of your UPS manually in your report\&. -.sp -socomec_jbus uses the libmodbus project, for Modbus implementation\&. -.SH "CABLING" -.sp -The UPS has an RS\-232 port which should be connected with a NULL\-modem cable to a PC serial port\&. The UPS tested has a female DB9 connector, so if you construct the cable yourself, make note of the connector type to avoid using gender changers\&. -.sp -RS\-232 is supported on all operating systems, either via a built\-in serial port on your computer, or by using an external USB\-to\-RS\-232 converter\&. If you plan to use an USB\-to\-RS\-232 converter, make sure it\(cqs supported by your operating system\&. -.SH "INSTALLATION" -.sp -This driver should be built by default if libmodbus and development headers are available\&. You can force the configure script to build it with the following arguments: -.sp -.if n \{\ -.RS 4 -.\} -.nf -configure \-\-with\-serial=yes \-\-with\-modbus=yes -.fi -.if n \{\ -.RE -.\} -.sp -You also need to give proper (R/W) permissions on the local serial device file to allow the NUT driver run\-time user to access it\&. This may need additional setup for start\-up scripting, udev or upower rules, to apply the rights on every boot \(em especially if your device nodes are tracked by a virtual filesystem\&. -.sp -For example, a USB\-to\-serial converter can be identified as /dev/ttyACM0 or /dev/ttyUSB0 on Linux, or /dev/ttyU0 on FreeBSD (note the capital "U")\&. A built\-in serial port can be identified as /dev/ttyS0 on Linux or one of /dev/cua* names on FreeBSD\&. -.SH "INSTANT COMMANDS" -.sp -This driver does not (yet?) support sending commands to the UPS\&. -.SH "VARIABLES" -.sp -This driver does not support writable runtime variables (see \fBupsrw\fR(8)): for the same reasons\&. Both should be trivial to implement, but since I\(cqve already found one or two inconsistencies in the documentation, I\(cqm withholding from trying them\&. -.SH "KNOWN ISSUES AND BUGS" -.sp -Well, it is an alpha release at best, but so far appears to report the UPS status reliably\&. Mostly based on the work of Yifeng Li on the huawei\-ups2000 in that very same source tree\&. -.SS "Read failure on some JBUS addresses" -.sp -The driver polls all documented JBUS addresses and it is quite possible that your UPS model does not support one of them (e\&.g\&. the Digys does not support address 0x1020 which should provide the current UPS status)\&. This should be logged with LOG_ERR from modbus_read_input_registers() along with the address that produced the error\&. -.SS "Data stale" -.sp -Under certain circumstances, some registers can return invalid values and trigger a "data stale" error\&. Once a data stale error has occurred, you should see error messages similar to the example below in the system log\&. -.sp -.if n \{\ -.RS 4 -.\} -.nf -socomec_jbus: modbus_read_input_registers(addr:XXXX, count:Z): - Illegal data address -upsd: Data for UPS [socomec] is stale \- check driver -upsd: UPS [socomec] data is no longer stale -.fi -.if n \{\ -.RE -.\} -.sp -So far all known problems have been fixed by the author, but an unknown one cannot be ruled out\&. If you have encountered "data stale" problems during normal uses, please file a bug report with full logs attached\&. -.sp -Before troubleshooting or reporting a problem, it\(cqs important to check your \fBdmesg\fR log for USB connect and disconnect events to avoid wasting time on the NUT driver when the actual problem is USB\&. For example, if someone yanks the cable out of the USB port, or if a new USB device is plugged into a USB host/hub that is struggling to power its ports (common on single\-board computers like Raspberry Pi), or if you have flaky cabling or EMI noise, the serial converter can get disconnected from USB, at least briefly\&. This creates a permanent data stale, the driver must be restarted (plugging the USB back won\(cqt fix it, since the driver is still using the nonexistent serial device)\&. These USB problems usually have nothing to do with NUT\&. If it\(cqs the case, you should solve the underlying USB problem \- check the cable, check the converter, try a powered USB hub, try a full\-speed USB isolator, etc\&. -.SH "AUTHOR" -.sp -Thanos Chatziathanassiou -.SH "SEE ALSO" -.SS "The core driver:" -.sp -\fBnutupsdrv\fR(8) -.SS "Internet resources:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Socomec JBUS/Modbus Reference Guide: -https://www\&.socomec\&.com/files/live/sites/systemsite/files/GB\-JBUS\-MODBUS\-for\-Delphys\-MP\-and\-Delphys\-MX\-operating\-manual\&.pdf -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -libmodbus home page: -http://libmodbus\&.org -.RE diff --git a/docs/man/socomec_jbus.txt b/docs/man/socomec_jbus.txt deleted file mode 100644 index bc192d6..0000000 --- a/docs/man/socomec_jbus.txt +++ /dev/null @@ -1,166 +0,0 @@ -SOCOMEC_JBUS(8) -=============== - -NAME ----- - -socomec_jbus - Driver for Socomec JBUS UPS with -RS-232 serial Modbus connection. - -SYNOPSIS --------- - -*socomec_jbus* -h - -*socomec_jbus* -a 'DEVICE_NAME' ['OPTIONS'] - -NOTE: This man page only documents the hardware-specific features of the -socomec_jbus driver. For information about the core driver, see -linkman:nutupsdrv[8]. - -SUPPORTED HARDWARE ------------------- - -This driver supports Socomec JBUS series, online (double conversion) -UPS with the following characteristics. - -1. Single phase and 3-phase UPS - -2. Connection: RS-232 - -These are typically provided with a Netvision WEB/SNMP management -card / external box that would be better served by the linkman:snmp-ups[8] -driver. In case netvision isn't available, you can hook up the UPS directly -via the serial port and use this driver. - -Currently, it has only been tested on the following model. - -* DIGYS 3/3 15kVA - -In theory, any Socomec JBUS model should work. It should be discovered -as ``Unknown Socomec JBUS'' with a numeric id that I'll need to add it -to the list of supported UPSs. - -Sadly, Socomec document only mentions DELPHYS MX and DELPHYS MX elite and -I have the id of my own DIGYS, so chances are, your model will not be -recognized but will probably mostly work. Please report successful -or unsuccessful results to the bug tracker or the mailing list. -Make sure to include the full model number of your UPS manually -in your report. - -socomec_jbus uses the libmodbus project, for Modbus implementation. - -CABLING -------- - -The UPS has an RS-232 port which should be connected with a NULL-modem -cable to a PC serial port. The UPS tested has a female DB9 connector, -so if you construct the cable yourself, make note of the connector type to -avoid using gender changers. - -RS-232 is supported on all operating systems, either via a built-in serial -port on your computer, or by using an external USB-to-RS-232 converter. If -you plan to use an USB-to-RS-232 converter, make sure it's supported by your -operating system. - - -INSTALLATION ------------- - -This driver should be built by default if libmodbus and development headers -are available. You can force the `configure` script to build it with the -following arguments: - - configure --with-serial=yes --with-modbus=yes - -You also need to give proper (R/W) permissions on the local serial device -file to allow the NUT driver run-time user to access it. This may need -additional setup for start-up scripting, udev or upower rules, to apply -the rights on every boot -- especially if your device nodes are tracked -by a virtual filesystem. - -For example, a USB-to-serial converter can be identified as `/dev/ttyACM0` -or `/dev/ttyUSB0` on Linux, or `/dev/ttyU0` on FreeBSD (note the capital "U"). -A built-in serial port can be identified as `/dev/ttyS0` on Linux or one of -`/dev/cua*` names on FreeBSD. - -INSTANT COMMANDS ----------------- - -This driver does not (yet?) support sending commands to the UPS. - -VARIABLES ---------- - -This driver does not support writable runtime variables (see linkman:upsrw[8]): -for the same reasons. -Both should be trivial to implement, but since I've already found one or two -inconsistencies in the documentation, I'm withholding from trying them. - -KNOWN ISSUES AND BUGS ---------------------- - -Well, it is an alpha release at best, but so far appears to report the UPS -status reliably. Mostly based on the work of Yifeng Li on -the huawei-ups2000 in that very same source tree. - -Read failure on some JBUS addresses -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The driver polls all documented JBUS addresses and it is quite possible -that your UPS model does not support one of them (e.g. the Digys does not -support address 0x1020 which should provide the current UPS status). -This should be logged with LOG_ERR from modbus_read_input_registers() -along with the address that produced the error. - -Data stale -~~~~~~~~~~~ - -Under certain circumstances, some registers can return invalid values -and trigger a "data stale" error. Once a data stale error has occurred, -you should see error messages similar to the example below in the system -log. - - socomec_jbus: modbus_read_input_registers(addr:XXXX, count:Z): - Illegal data address - upsd: Data for UPS [socomec] is stale - check driver - upsd: UPS [socomec] data is no longer stale - -So far all known problems have been fixed by the author, but an unknown one -cannot be ruled out. If you have encountered "data stale" problems during -normal uses, please file a bug report with full logs attached. - -Before troubleshooting or reporting a problem, it's important to check -your *dmesg* log for USB connect and disconnect events to avoid wasting -time on the NUT driver when the actual problem is USB. For example, if -someone yanks the cable out of the USB port, or if a new USB device is -plugged into a USB host/hub that is struggling to power its ports -(common on single-board computers like Raspberry Pi), or if you have -flaky cabling or EMI noise, the serial converter can get disconnected -from USB, at least briefly. This creates a permanent data stale, the driver -must be restarted (plugging the USB back won't fix it, since the driver -is still using the nonexistent serial device). These USB problems usually -have nothing to do with NUT. If it's the case, you should solve the -underlying USB problem - check the cable, check the converter, try a -powered USB hub, try a full-speed USB isolator, etc. - -AUTHOR ------- - -Thanos Chatziathanassiou - -SEE ALSO --------- - -The core driver: -~~~~~~~~~~~~~~~~ - -linkman:nutupsdrv[8] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* Socomec JBUS/Modbus Reference Guide: - https://www.socomec.com/files/live/sites/systemsite/files/GB-JBUS-MODBUS-for-Delphys-MP-and-Delphys-MX-operating-manual.pdf -* libmodbus home page: http://libmodbus.org diff --git a/docs/man/solis.8 b/docs/man/solis.8 index 887f55c..15d273f 100644 --- a/docs/man/solis.8 +++ b/docs/man/solis.8 @@ -1,13 +1,13 @@ '\" t .\" Title: solis .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "SOLIS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "SOLIS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -34,7 +34,7 @@ solis \- Driver for Brazilian Microsol SOLIS UPS equipment This man page only documents the hardware\-specific features of the solis driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. .SH "SUPPORTED HARDWARE" .sp -This driver has been tested with: +This driver has been tested with : .sp .RS 4 .ie n \{\ @@ -80,38 +80,14 @@ Solis 2000 VA Solis 3000 VA .RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Back\-UPS BZ1200\-BR -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Back\-UPS BZ2200BI\-BR -.RE -.sp -All Solis models are sinusoidal on\-line\&. -.sp -In 2009, Schneider Electric acquired Microsol Technologies, and by 2012, the entire Microsol line of equipment was being sold under the APC brand\&. +All Solis models are sinusoidal on\-line .SH "EXTRA ARGUMENTS" .sp This driver support the following extra optional settings in the \fBups.conf\fR(5)\&. .sp \fBbattext = n\fR \- (default = 0, no extra battery, where n = Ampere*hour ) .sp -\fBprgshut = 1\fR \- (default = 0, no programmable shutdown ) +\fBprgshut = 1\fR \- (default = 0, no programable shutdown ) .SH "COMMANDS" .sp .RS 4 @@ -135,9 +111,6 @@ shutdown\&.return \- Shut down in \&.3 minutes and restart in \&.3 minutes .\} shutdown\&.stayoff \- Shut down in \&.3 minutes and do not return .RE -.SH "ISSUES" -.sp -The APC version of the Microsol protocol is slightly incompatible with the \fBsolis\fR driver\&. As of version 0\&.62 of the \fBsolis\fR driver, the driver will connect to the UPS, but some values are read incorrectly\&. .SH "AUTHOR" .sp Silvino B\&. Magalhães diff --git a/docs/man/solis.txt b/docs/man/solis.txt index 532112b..37bc48d 100644 --- a/docs/man/solis.txt +++ b/docs/man/solis.txt @@ -15,20 +15,14 @@ linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - -This driver has been tested with: - +This driver has been tested with : + * Solis 1000 VA * Solis 1500 VA * Solis 2000 VA * Solis 3000 VA - * Back-UPS BZ1200-BR - * Back-UPS BZ2200BI-BR -All Solis models are sinusoidal on-line. - -In 2009, Schneider Electric acquired Microsol Technologies, and by 2012, the -entire Microsol line of equipment was being sold under the APC brand. +All Solis models are sinusoidal on-line EXTRA ARGUMENTS --------------- @@ -38,7 +32,7 @@ linkman:ups.conf[5]. *battext = n* - (default = 0, no extra battery, where n = Ampere*hour ) -*prgshut = 1* - (default = 0, no programmable shutdown ) +*prgshut = 1* - (default = 0, no programable shutdown ) COMMANDS -------- @@ -47,16 +41,8 @@ COMMANDS * shutdown.stayoff - Shut down in .3 minutes and do not return -ISSUES ------- - -The APC version of the Microsol protocol is slightly incompatible with the -*solis* driver. As of version 0.62 of the *solis* driver, the driver will -connect to the UPS, but some values are read incorrectly. - AUTHOR ------ - Silvino B. Magalhães SEE ALSO @@ -64,10 +50,8 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/tripplite.8 b/docs/man/tripplite.8 index 4a802dd..8732e58 100644 --- a/docs/man/tripplite.8 +++ b/docs/man/tripplite.8 @@ -1,13 +1,13 @@ '\" t .\" Title: tripplite .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "TRIPPLITE" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "TRIPPLITE" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -58,27 +58,7 @@ Set the time that the UPS waits before it turns itself back on after a reboot co Battery charge information may not be correct for all UPSes\&. It is tuned to be correct for a SMART700SER\&. Other models may not provide correct information\&. Information from the manufacturer would be helpful\&. .SH "AUTHORS" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Rickard E\&. (Rik) Faith -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Nicholas Kain -.RE +Rickard E\&. (Rik) Faith, Nicholas Kain .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/tripplite.txt b/docs/man/tripplite.txt index 9ec37f2..dc6f1c8 100644 --- a/docs/man/tripplite.txt +++ b/docs/man/tripplite.txt @@ -3,27 +3,23 @@ TRIPPLITE(8) NAME ---- - tripplite - Driver for Tripp-Lite SmartPro UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the tripplite driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver should work on the SmartPro line, including the SMART700 and SMART700SER. It only supports SmartPro models that communicate using the serial port. EXTRA ARGUMENTS --------------- - -This driver supports the following optional settings in the +This driver supports the following optional settings in the linkman:ups.conf[5]: *offdelay*='num':: @@ -40,31 +36,25 @@ reboot command. The default value is 60 (in seconds). KNOWN ISSUES AND BUGS --------------------- - Battery charge information may not be correct for all UPSes. It is tuned to be correct for a SMART700SER. Other models may not provide correct information. Information from the manufacturer would be helpful. AUTHORS ------- - -* Rickard E. (Rik) Faith -* Nicholas Kain +Rickard E. (Rik) Faith, Nicholas Kain SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Other drivers for Tripp-Lite hardware: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - linkman:tripplitesu[8], linkman:tripplite_usb[8], linkman:usbhid-ups[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/tripplite_usb.8 b/docs/man/tripplite_usb.8 index 68efb1d..f6a8def 100644 --- a/docs/man/tripplite_usb.8 +++ b/docs/man/tripplite_usb.8 @@ -1,13 +1,13 @@ '\" t .\" Title: tripplite_usb -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "TRIPPLITE_USB" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "TRIPPLITE_USB" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,11 +36,7 @@ tripplite_usb \- Driver for older Tripp Lite USB UPSes (not PDC HID) \fBtripplite_usb\fR \-a \fIUPS_NAME\fR [\fIOPTIONS\fR] .SH "SUPPORTED HARDWARE" .sp -This driver should work with older Tripp Lite UPSes which are detected as USB HID\-class devices, but are not true HID Power\-Device Class devices\&. So far, the devices supported by tripplite_usb have product ID 0001, and the newer units (such as those with "LCD" in the model name) with product ID 2001 require the \fBusbhid-ups\fR(8) driver instead\&. -.sp -Please report success or failure to the nut\-upsuser mailing list\&. A key piece of information is the protocol number, returned in ups\&.firmware\&.aux\&. Also, be sure to turn on debugging (\fI\-DDD\fR) for more informative log messages\&. -.sp -If your Tripp Lite UPS uses a serial port, you may wish to investigate the \fBtripplite\fR(8) or \fBtripplitesu\fR(8) drivers\&. +This driver should work with older Tripp Lite UPSes which are detected as USB HID\-class devices, but are not true HID Power\-Device Class devices\&. So far, the devices supported by tripplite_usb have product ID 0001, and the newer units (such as those with "LCD" in the model name) with product ID 2001 require the \fBusbhid-ups\fR(8) driver instead\&. Please report success or failure to the nut\-upsuser mailing list\&. A key piece of information is the protocol number, returned in ups\&.debug\&.0\&. Also, be sure to turn on debugging (\fI\-DDD\fR) for more informative log messages\&. If your Tripp Lite UPS uses a serial port, you may wish to investigate the \fBtripplite\fR(8) or \fBtripplite_su\fR(8) driver\&. .sp This driver has been tested with the following models: .sp @@ -167,17 +163,6 @@ Protocol 2001 Protocol 3003 .RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Protocol 3005 -.RE -.sp On the other hand, if the web page for your UPS on the Tripp\-Lite website says "HID\-compliant USB port also enables direct integration with built\-in power management and auto\-shutdown features of Windows and MAC OS X", then you should use the \fBusbhid-ups\fR(8) driver instead\&. .SH "EXTRA ARGUMENTS" .sp @@ -188,12 +173,6 @@ This driver supports the following optional settings in the \fBups.conf\fR(5) fi This setting controls the delay between receiving the "kill" command (\fI\-k\fR) and actually cutting power to the computer\&. .RE .PP -\fBbattery_min\fR, \fBbattery_max\fR -.RS 4 -These floating\-point values correspond to the "empty" (10%) and "full" (100%) voltages of the battery\&. They are used for an approximation of the battery state\-of\-charge\&. The calculated battery\&.charge value will be clamped to the range of 10% through 100%, so the resting voltage of the charged battery can be used for -\fBbattery_max\fR, and the higher float charge voltage should not cause problems\&. -.RE -.PP \fBbus\fR .RS 4 This regular expression is used to match the USB bus (as seen in @@ -201,13 +180,6 @@ This regular expression is used to match the USB bus (as seen in or lsusb(8); including leading zeroes)\&. .RE .PP -\fBdevice\fR -.RS 4 -This regular expression is used to match the USB device (as seen in -/proc/bus/usb/devices -or lsusb(8); including leading zeroes)\&. Note that device numbers are not guaranteed by the OS to be stable across re\-boots or device re\-plugging\&. -.RE -.PP \fBproduct\fR .RS 4 A regular expression to match the product string for the UPS\&. This would be useful if you have two different Tripp Lite UPS models connected to the system, and you want to be sure that you shut them down in the correct order\&. @@ -275,16 +247,14 @@ in the variable name\&. Be sure to test this first \- there is no other way to b .sp The driver was not developed with any official documentation from Tripp Lite, so certain events may confuse the driver\&. If you observe any strange behavior, please re\-run the driver with \-DDD to increase the verbosity\&. .sp -So far, the Tripp Lite UPSes do not seem to have a serial number or other globally unique identifier accessible through USB\&. Thus, when monitoring several Tripp Lite USB UPSes, you should use either the \fIbus\fR, \fIdevice\fR or \fIproduct\fR configuration options to uniquely specify which UPS a given driver instance should control\&. +So far, the Tripp Lite UPSes do not seem to have a serial number or other globally unique identifier accessible through USB\&. Thus, when monitoring several Tripp Lite USB UPSes, you should use either the \fIbus\fR or \fIproduct\fR configuration options to uniquely specify which UPS a given driver instance should control\&. .sp -For instance, you can easily monitor an OMNIVS1000 and a SMART1500RM2U at the same time, since they have different USB Product ID strings\&. If you have two SMART1500RM2U units, you would have to find which USB bus and device number each unit is on (via lsusb(8))\&. +For instance, you can easily monitor an OMNIVS1000 and a SMART1500RM2U at the same time, since they have different USB Product ID strings\&. If you have two SMART1500RM2U units, you would have to find which USB bus number each unit is on (via lsusb(8)), which may result in ambiguities if the available USB ports are on the same bus\&. .sp Some of the SMART*2U models have an ID number, but because this ID is not exposed as a USB string descriptor, there is no easy way to use this ID to distinguish between multiple UPS units on a single machine\&. The UPS would need to be claimed by the driver in order to read this ID\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -Written by Charles Lepple, based on the \fBtripplite\fR(8) driver by Rickard E\&. (Rik) Faith and Nicholas Kain\&. -.sp -Please do not email the authors directly \- use the nut\-upsdev mailing list\&. +Written by Charles Lepple, based on the \fBtripplite\fR(8) driver by Rickard E\&. (Rik) Faith and Nicholas Kain\&. Please do not email the authors directly \- use the nut\-upsdev mailing list\&. .sp A Tripp Lite OMNIVS1000 was graciously donated to the NUT project by Bradley Feldman (http://www\&.bradleyloritheo\&.com) .SH "SEE ALSO" @@ -297,6 +267,6 @@ A Tripp Lite OMNIVS1000 was graciously donated to the NUT project by Bradley Fel .SS "Other tools:" .sp regex(7), lsusb(8) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/tripplite_usb.txt b/docs/man/tripplite_usb.txt index cad5a80..9e4e59e 100644 --- a/docs/man/tripplite_usb.txt +++ b/docs/man/tripplite_usb.txt @@ -1,34 +1,29 @@ TRIPPLITE_USB(8) ================ + NAME ---- - tripplite_usb - Driver for older Tripp Lite USB UPSes (not PDC HID) SYNOPSIS -------- - *tripplite_usb* -h *tripplite_usb* -a 'UPS_NAME' ['OPTIONS'] SUPPORTED HARDWARE ------------------ - -This driver should work with older Tripp Lite UPSes which are detected -as USB HID-class devices, but are not true HID Power-Device Class devices. -So far, the devices supported by `tripplite_usb` have product ID 0001, -and the newer units (such as those with "LCD" in the model name) with -product ID 2001 require the linkman:usbhid-ups[8] driver instead. - -Please report success or failure to the nut-upsuser mailing list. -A key piece of information is the protocol number, returned in -`ups.firmware.aux`. Also, be sure to turn on debugging ('-DDD') -for more informative log messages. - -If your Tripp Lite UPS uses a serial port, you may wish to investigate -the linkman:tripplite[8] or linkman:tripplitesu[8] drivers. +This driver should work with older Tripp Lite UPSes which are detected as USB +HID-class devices, but are not true HID Power-Device Class devices. So far, +the devices supported by tripplite_usb have product ID 0001, and the newer +units (such as those with "LCD" in the model name) with product ID 2001 require +the linkman:usbhid-ups[8] driver instead. Please report success or failure to +the nut-upsuser mailing list. A key piece of information is the protocol +number, returned in `ups.debug.0`. Also, be sure to turn on debugging ('-DDD') +for more informative log messages. If your Tripp Lite UPS uses a serial port, +you may wish to investigate the linkman:tripplite[8] or linkman:tripplite_su[8] +driver. This driver has been tested with the following models: @@ -48,7 +43,6 @@ following protocols: * Protocol 1001 * Protocol 2001 * Protocol 3003 - * Protocol 3005 On the other hand, if the web page for your UPS on the Tripp-Lite website says "HID-compliant USB port also enables direct integration with built-in power @@ -66,27 +60,11 @@ file (or with '-x' on the command line): This setting controls the delay between receiving the "kill" command ('-k') and actually cutting power to the computer. -*battery_min*, *battery_max*:: - -These floating-point values correspond to the "empty" (10%) and "full" (100%) -voltages of the battery. They are used for an approximation of the battery -state-of-charge. The calculated battery.charge value will be clamped to the -range of 10% through 100%, so the resting voltage of the charged battery can be -used for *battery_max*, and the higher float charge voltage should not cause -problems. - *bus*:: This regular expression is used to match the USB bus (as seen in `/proc/bus/usb/devices` or lsusb(8); including leading zeroes). -*device*:: - -This regular expression is used to match the USB device (as seen in -`/proc/bus/usb/devices` or lsusb(8); including leading zeroes). -Note that device numbers are not guaranteed by the OS to be stable across -re-boots or device re-plugging. - *product*:: A regular expression to match the product string for the UPS. This would be @@ -143,27 +121,26 @@ please re-run the driver with `-DDD` to increase the verbosity. So far, the Tripp Lite UPSes do not seem to have a serial number or other globally unique identifier accessible through USB. Thus, when monitoring -several Tripp Lite USB UPSes, you should use either the 'bus', 'device' or -'product' configuration options to uniquely specify which UPS a given driver -instance should control. +several Tripp Lite USB UPSes, you should use either the 'bus' or 'product' +configuration options to uniquely specify which UPS a given driver instance +should control. For instance, you can easily monitor an OMNIVS1000 and a SMART1500RM2U at the same time, since they have different USB Product ID strings. If you have two -SMART1500RM2U units, you would have to find which USB bus and device number -each unit is on (via lsusb(8)). +SMART1500RM2U units, you would have to find which USB bus number each unit is +on (via lsusb(8)), which may result in ambiguities if the available USB ports +are on the same bus. Some of the SMART*2U models have an ID number, but because this ID is not exposed as a USB string descriptor, there is no easy way to use this ID to distinguish between multiple UPS units on a single machine. The UPS would need to be claimed by the driver in order to read this ID. -AUTHORS -------- - -Written by Charles Lepple, based on the linkman:tripplite[8] driver -by Rickard E. (Rik) Faith and Nicholas Kain. - -Please do not email the authors directly - use the nut-upsdev mailing list. +AUTHOR +------ +Written by Charles Lepple, based on the linkman:tripplite[8] driver by Rickard E. (Rik) +Faith and Nicholas Kain. Please do not email the authors directly - use the +nut-upsdev mailing list. A Tripp Lite OMNIVS1000 was graciously donated to the NUT project by Bradley Feldman (http://www.bradleyloritheo.com) @@ -173,20 +150,19 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Other drivers for Tripp-Lite hardware: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - linkman:tripplite[8], linkman:tripplitesu[8], linkman:usbhid-ups[8] Other tools: ~~~~~~~~~~~~ - regex(7), lsusb(8) -Internet resources: -~~~~~~~~~~~~~~~~~~~ + +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ + diff --git a/docs/man/tripplitesu.8 b/docs/man/tripplitesu.8 index 7e93983..584691c 100644 --- a/docs/man/tripplitesu.8 +++ b/docs/man/tripplitesu.8 @@ -1,13 +1,13 @@ '\" t .\" Title: tripplitesu .\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "TRIPPLITESU" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "TRIPPLITESU" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/tripplitesu.txt b/docs/man/tripplitesu.txt index 9194a12..6416699 100644 --- a/docs/man/tripplitesu.txt +++ b/docs/man/tripplitesu.txt @@ -3,24 +3,20 @@ TRIPPLITESU(8) NAME ---- - tripplitesu - Driver for Tripp-Lite SmartOnline (SU) UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the tripplitesu driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports the Tripp Lite SmartOnline family (via the serial port). EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in the linkman:ups.conf[5]: @@ -31,7 +27,6 @@ until there are only a few seconds left. Common values are around 25--30. AUTHOR ------ - Allan N. Hessenflow SEE ALSO @@ -39,15 +34,12 @@ SEE ALSO The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Other drivers for Tripp-Lite hardware: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - linkman:tripplite[8], linkman:tripplite_usb[8], linkman:usbhid-ups[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/ups.conf.5 b/docs/man/ups.conf.5 index e75338b..5f5f3bc 100644 --- a/docs/man/ups.conf.5 +++ b/docs/man/ups.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: ups.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "UPS\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPS\&.CONF" "5" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -85,93 +85,15 @@ Optional\&. Path name of the directory in which the UPS driver executables resid Optional\&. Same as the UPS field of the same name, but this is the default for UPSes that don\(cqt have the field\&. .RE .PP -\fBmaxretry\fR -.RS 4 -Optional\&. Specify the number of attempts to start the driver(s), in case of failure, before giving up\&. A delay of -\fIretrydelay\fR -is inserted between each attempt\&. Caution should be taken when using this option, since it can impact the time taken by your system to start\&. -.sp -The default is 1 attempt\&. -.RE -.PP -\fBnowait\fR -.RS 4 -Optional\&. Specify to upsdrvctl to not wait at all for the driver(s) to execute the request command\&. -.sp -The default (omission) is to wait\&. -.RE -.PP -\fBretrydelay\fR -.RS 4 -Optional\&. Specify the delay between each restart attempt of the driver(s), as specified by -\fImaxretry\fR\&. Caution should be taken when using this option, since it can impact the time taken by your system to start\&. -.sp -The default is 5 seconds\&. -.RE -.PP \fBpollinterval\fR .RS 4 Optional\&. The status of the UPS will be refreshed after a maximum delay which is controlled by this setting\&. This is normally 2 seconds\&. This may be useful if the driver is creating too much of a load on your system or network\&. -.sp -Note that some drivers (such as -\fBusbhid-ups\fR(8), -\fBsnmp-ups\fR(8) -and -\fBnutdrv_qx\fR(8)) also have an option called -\fBpollfreq\fR -which controls how frequently some of the less critical parameters are polled\&. Details are provided in the respective driver man pages\&. -.RE -.PP -\fBsynchronous\fR -.RS 4 -Optional\&. The drivers work by default in asynchronous mode initially but can fall back to synchronous mode if writes to server socket failed (i\&.e -\fBsynchronous=auto\fR)\&. This means that all data are pushed by the driver on the communication socket to upsd (Unix socket on Unix, Named pipe on Windows) without waiting for these data to be actually consumed\&. With some HW, such as ePDUs, that can produce a lot of data, asynchronous mode may cause some congestion, resulting in the socket to be full, and the driver to appear as not connected\&. In such case, the driver will provide the following debug message: -.sp -.if n \{\ -.RS 4 -.\} -.nf -write XX bytes to socket Y failed -.fi -.if n \{\ -.RE -.\} -.sp -By enabling the -\fIsynchronous\fR -flag (value = -\fIyes\fR), the driver will wait for data to be consumed by upsd, prior to publishing more\&. This can be enabled either globally or per driver\&. -.sp -The default of -\fIauto\fR -acts like -\fIno\fR -(i\&.e\&. asynchronous mode) for backward compatibility of the driver behavior, until communications fail with a "Resource temporarily unavailable" condition, which happens when the driver has many data points to send in a burst, and the server can not handle that quickly enough so the buffer fills up\&. .RE .PP \fBuser\fR .RS 4 -Optional\&. Overrides the compiled\-in default unprivileged username for all NUT device drivers\&. See the discussion of the -\-u -option in -\fBnutupsdrv\fR(8) -for details\&. -.RE -.PP -\fBgroup\fR -.RS 4 -Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged group name for all NUT device drivers, used for the socket file access\&. See the discussion of the -\-g -option in -\fBnutupsdrv\fR(8) -for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&. -.RE -.PP -\fBdebug_min\fR \fIINTEGER\fR -.RS 4 -Optional\&. Specify a minimum debug level for all driver daemons, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. Command\-line option -\-D -can only increase this verbosity level\&. +Optional\&. If started as root, the driver will setuid(2) to the user id associated with +\fIusername\fR\&. .RE .SH "UPS FIELDS" .PP @@ -189,24 +111,6 @@ Required\&. This is the serial port where the UPS is connected\&. On a Linux sys \fI/dev/cuaa0\fR\&. .RE .PP -\fBuser\fR -.RS 4 -Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged username for a particular NUT device driver\&. See the discussion of the -\-u -option in -\fBnutupsdrv\fR(8) -for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&. -.RE -.PP -\fBgroup\fR -.RS 4 -Optional\&. Overrides the compiled\-in (and/or global\-section) default unprivileged group name for a particular NUT device driver, used for the socket file access\&. See the discussion of the -\-g -option in -\fBnutupsdrv\fR(8) -for details\&. This may be specifically useful for ensuring access to dynamic device filesystem nodes, such as USB (or serial\-over\-USB) hot\-plug support, or with device filesystems re\-generated by an OS for every reboot\&. -.RE -.PP \fBsdorder\fR .RS 4 Optional\&. When you have multiple UPSes on your system, you usually need to turn them off in a certain order\&. upsdrvctl shuts down all the 0s, then the 1s, 2s, and so on\&. To exclude a UPS from the shutdown sequence, set this to \-1\&. @@ -230,7 +134,7 @@ This may be needed on Mac OS X systems\&. .PP \fBignorelb\fR .RS 4 -Optional\&. When you specify this, the driver ignores a low battery condition flag that is reported by the UPS (some devices will switch off almost immediately after setting this flag, or will report this as soon as the mains fails)\&. Instead it will use either of the following conditions to determine when the battery is low: +Optional\&. When you specify this, the driver ignores a low battery condition flag that is reported by the UPS (some devices will switch off almost immediately after setting this flag, or will report this as soons as the mains fails)\&. Instead it will use either of the following conditions to determine when the battery is low: .sp .if n \{\ .RS 4 @@ -268,21 +172,6 @@ Optional\&. This can be set as a global variable above your first UPS definition The default is 45 seconds\&. .RE .PP -\fBsynchronous\fR -.RS 4 -Optional\&. Same as the global directive of the same name, but this is for a specific device\&. -.RE -.PP -\fBusb_set_altinterface\fR[=\fIaltinterface\fR] -.RS 4 -Optional\&. Force the USB code to call -usb_set_altinterface(0), as was done in NUT 2\&.7\&.2 and earlier\&. This should not be necessary, since the default for -bAlternateSetting -(as shown in lsusb) is zero on all USB devices seen to date\&. However, this redundant call to -usb_set_altinterface() -prevents certain UPSes from working on Mac OS X\&. If your UPS requires explicitly setting the alternate interface, include this flag, and email the nut\-upsdev list with details about your UPS and operating system\&. -.RE -.PP \fBdefault\&.\fR .RS 4 Optional\&. Set a default value for which is used in case the UPS doesn\(cqt provide a value, but will be overwritten if a value is available from the UPS: @@ -318,15 +207,6 @@ Use with caution! This will only change the appearance of the variable to the ou .RE .sp All other fields are passed through to the hardware\-specific part of the driver\&. See those manuals for the list of what is allowed\&. -.PP -\fBdebug_min\fR \fIINTEGER\fR -.RS 4 -Optional\&. Specify a minimum debug level for this driver daemon, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. If the global -debug_min -is also set, this driver\-level setting overrides it\&. Command\-line option -\-D -can only increase this verbosity level\&. -.RE .SH "INTEGRATION" .sp \fBupsdrvctl\fR(8) uses this file to start and stop the drivers\&. @@ -336,7 +216,7 @@ The drivers themselves also obtain configuration data from this file\&. Each dri \fBupsd\fR(8) learns about which UPSes are installed on this system by reading this file\&. If this system is called "doghouse" and you have defined a UPS in your \fBups\&.conf\fR called "snoopy", then you can monitor it from \fBupsc\fR(8) or similar as "snoopy@doghouse"\&. .SH "SEE ALSO" .sp -\fBupsd\fR(8), \fBnutupsdrv\fR(8), \fBupsdrvctl\fR(8), \fBupsdrvsvcctl\fR(8) +\fBupsd\fR(8), \fBnutupsdrv\fR(8), \fBupsdrvctl\fR(8) .SS "Internet resources" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/ups.conf.txt b/docs/man/ups.conf.txt index 10c0607..8a72a83 100644 --- a/docs/man/ups.conf.txt +++ b/docs/man/ups.conf.txt @@ -3,7 +3,6 @@ UPS.CONF(5) NAME ---- - ups.conf - UPS definitions for Network UPS Tools DESCRIPTION @@ -59,89 +58,20 @@ directory, which is often /usr/local/ups/bin. Optional. Same as the UPS field of the same name, but this is the default for UPSes that don't have the field. -*maxretry*:: -Optional. Specify the number of attempts to start the driver(s), in case of -failure, before giving up. A delay of 'retrydelay' is inserted between each -attempt. Caution should be taken when using this option, since it can -impact the time taken by your system to start. -+ -The default is 1 attempt. - -*nowait*:: -Optional. Specify to upsdrvctl to not wait at all for the driver(s) to -execute the request command. -+ -The default (omission) is to wait. - -*retrydelay*:: -Optional. Specify the delay between each restart attempt of the driver(s), -as specified by 'maxretry'. Caution should be taken when using this option, -since it can impact the time taken by your system to start. -+ -The default is 5 seconds. - *pollinterval*:: Optional. The status of the UPS will be refreshed after a maximum delay which is controlled by this setting. This is normally 2 seconds. This may be useful if the driver is creating too much of a load on your system or network. -+ -Note that some drivers (such as linkman:usbhid-ups[8], linkman:snmp-ups[8] and -linkman:nutdrv_qx[8]) also have an option called *pollfreq* which controls how -frequently some of the less critical parameters are polled. Details are -provided in the respective driver man pages. - -*synchronous*:: - -Optional. The drivers work by default in asynchronous mode initially -but can fall back to synchronous mode if writes to server socket failed -(i.e *synchronous=auto*). This means that all data are pushed by the driver -on the communication socket to upsd (Unix socket on Unix, Named pipe -on Windows) without waiting for these data to be actually consumed. -With some HW, such as ePDUs, that can produce a lot of data, -asynchronous mode may cause some congestion, resulting in the socket to -be full, and the driver to appear as not connected. In such case, the -driver will provide the following debug message: -+ - write XX bytes to socket Y failed -+ -By enabling the 'synchronous' flag (value = 'yes'), the driver will wait -for data to be consumed by upsd, prior to publishing more. This can be -enabled either globally or per driver. -+ -The default of 'auto' acts like 'no' (i.e. asynchronous mode) for backward -compatibility of the driver behavior, until communications fail with a -"Resource temporarily unavailable" condition, which happens when the -driver has many data points to send in a burst, and the server can not -handle that quickly enough so the buffer fills up. *user*:: -Optional. Overrides the compiled-in default unprivileged username for -all NUT device drivers. See the discussion of the `-u` option in -linkman:nutupsdrv[8] for details. - -*group*:: - -Optional. Overrides the compiled-in (and/or global-section) default -unprivileged group name for all NUT device drivers, used for the -socket file access. See the discussion of the `-g` option in -linkman:nutupsdrv[8] for details. -This may be specifically useful for ensuring access to dynamic device -filesystem nodes, such as USB (or serial-over-USB) hot-plug support, -or with device filesystems re-generated by an OS for every reboot. - -*debug_min* 'INTEGER':: - -Optional. Specify a minimum debug level for all driver daemons, e.g. for -troubleshooting a deployment, without impacting foreground or background -running mode directly. Command-line option `-D` can only increase this -verbosity level. +Optional. If started as root, the driver will setuid(2) to the user id +associated with 'username'. UPS FIELDS ---------- - *driver*:: Required. This specifies which program will be monitoring this UPS. You @@ -155,25 +85,6 @@ Required. This is the serial port where the UPS is connected. On a Linux system, the first serial port usually is '/dev/ttyS0'. On FreeBSD and similar systems, it probably will be '/dev/cuaa0'. -*user*:: - -Optional. Overrides the compiled-in (and/or global-section) default -unprivileged username for a particular NUT device driver. See the -discussion of the `-u` option in linkman:nutupsdrv[8] for details. -This may be specifically useful for ensuring access to dynamic device -filesystem nodes, such as USB (or serial-over-USB) hot-plug support, -or with device filesystems re-generated by an OS for every reboot. - -*group*:: - -Optional. Overrides the compiled-in (and/or global-section) default -unprivileged group name for a particular NUT device driver, used for -the socket file access. See the discussion of the `-g` option in -linkman:nutupsdrv[8] for details. -This may be specifically useful for ensuring access to dynamic device -filesystem nodes, such as USB (or serial-over-USB) hot-plug support, -or with device filesystems re-generated by an OS for every reboot. - *sdorder*:: Optional. When you have multiple UPSes on your system, you usually need to @@ -193,16 +104,16 @@ to clients that ask for a list of connected equipment. Optional. When you specify this, the driver skips the port locking routines every time it starts. This may allow other processes to seize the port if you start more than one accidentally. -+ ++ You should only use this if your system won't work without it. -+ ++ This may be needed on Mac OS X systems. *ignorelb*:: Optional. When you specify this, the driver ignores a low battery condition flag that is reported by the UPS (some devices will switch off almost -immediately after setting this flag, or will report this as soon as the +immediately after setting this flag, or will report this as soons as the mains fails). Instead it will use either of the following conditions to determine when the battery is low: @@ -228,21 +139,6 @@ system from getting stuck due to a broken driver or UPS. + The default is 45 seconds. -*synchronous*:: - -Optional. Same as the global directive of the same name, but this is -for a specific device. - -*usb_set_altinterface*[='altinterface']:: - -Optional. Force the USB code to call `usb_set_altinterface(0)`, as was done in -NUT 2.7.2 and earlier. This should not be necessary, since the default for -`bAlternateSetting` (as shown in lsusb) is zero on all USB devices seen to -date. However, this redundant call to `usb_set_altinterface()` prevents -certain UPSes from working on Mac OS X. If your UPS requires explicitly setting -the alternate interface, include this flag, and email the nut-upsdev list with -details about your UPS and operating system. - *default.*:: Optional. Set a default value for which is used in case the UPS @@ -268,14 +164,6 @@ the outside world, internally in the UPS the original value is used. All other fields are passed through to the hardware-specific part of the driver. See those manuals for the list of what is allowed. -*debug_min* 'INTEGER':: - -Optional. Specify a minimum debug level for this driver daemon, e.g. for -troubleshooting a deployment, without impacting foreground or background -running mode directly. If the global `debug_min` is also set, this -driver-level setting overrides it. Command-line option `-D` can only -increase this verbosity level. - INTEGRATION ----------- @@ -291,11 +179,8 @@ from linkman:upsc[8] or similar as "snoopy@doghouse". SEE ALSO -------- - -linkman:upsd[8], linkman:nutupsdrv[8], linkman:upsdrvctl[8], -linkman:upsdrvsvcctl[8] +linkman:upsd[8], linkman:nutupsdrv[8], linkman:upsdrvctl[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsc.8 b/docs/man/upsc.8 index 521794b..7fcb4a8 100644 --- a/docs/man/upsc.8 +++ b/docs/man/upsc.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsc -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/31/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSC" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSC" "8" "07/31/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -141,6 +141,6 @@ Earlier versions of this program used the \fIupsfetch\fR library and UDP sockets .SH "SEE ALSO" .sp \fBupsd\fR(8) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsc.txt b/docs/man/upsc.txt index 2e89c50..1162886 100644 --- a/docs/man/upsc.txt +++ b/docs/man/upsc.txt @@ -1,14 +1,13 @@ UPSC(8) ======= + NAME ---- - upsc - example lightweight UPS client SYNOPSIS -------- - *upsc* -l | -L ['host'] *upsc* 'ups' ['variable'] @@ -24,7 +23,6 @@ want to include the full interface. OPTIONS ------- - *-l* 'host':: List all UPS names configured at 'host', one name per line. The hostname @@ -115,7 +113,7 @@ SEE ALSO linkman:upsd[8] -Internet resources: -~~~~~~~~~~~~~~~~~~~ +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upscli_add_host_cert.3 b/docs/man/upscli_add_host_cert.3 index b3d08b2..c8dbdbc 100644 --- a/docs/man/upscli_add_host_cert.3 +++ b/docs/man/upscli_add_host_cert.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_add_host_cert -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_ADD_HOST_CERT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_ADD_HOST_CERT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -44,8 +44,6 @@ void upscli_add_host_cert(const char* hostname, const char* certname, The \fBupscli_add_host_cert()\fR function register a security rule associated to the \fIhostname\fR\&. All connections to this host use this rule\&. .sp The rule is composed of the certificate name \fIcertname \*(Aqexpected for the host, \*(Aqcertverify\fR if the certificate must be validated for the host and \fIforcessl\fR if a secured connection must be used to connect to the host\&. -.sp -Note: This call only functions if upsclient has been compiled with NSS support\&. If instead it was compiled with OpenSSL support, this function contains an empty definition and will take no action when called\&. .SH "RETURN VALUE" .sp \fBupscli_add_host_cert()\fR returns no value\&. diff --git a/docs/man/upscli_add_host_cert.txt b/docs/man/upscli_add_host_cert.txt index 6d9050d..96070e8 100644 --- a/docs/man/upscli_add_host_cert.txt +++ b/docs/man/upscli_add_host_cert.txt @@ -16,17 +16,13 @@ SYNOPSIS DESCRIPTION ----------- - -The *upscli_add_host_cert()* function register a security rule associated +The *upscli_add_host_cert()* function register a security rule associated to the 'hostname'. All connections to this host use this rule. The rule is composed of the certificate name 'certname 'expected for the host, 'certverify' if the certificate must be validated for the host and 'forcessl' if a secured connection must be used to connect to the host. -Note: This call only functions if upsclient has been compiled with NSS -support. If instead it was compiled with OpenSSL support, this function -contains an empty definition and will take no action when called. RETURN VALUE ------------ @@ -35,6 +31,5 @@ RETURN VALUE SEE ALSO -------- - -linkman:upscli_init[3], linkman:upscli_connect[3], linkman:upscli_ssl[3], +linkman:upscli_init[3], linkman:upscli_connect[3], linkman:upscli_ssl[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_cleanup.3 b/docs/man/upscli_cleanup.3 index 5edde88..3c362d4 100644 --- a/docs/man/upscli_cleanup.3 +++ b/docs/man/upscli_cleanup.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_cleanup -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_CLEANUP" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_CLEANUP" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ upscli_cleanup \- Clean\-up upsclient module after usage\&. .fi .sp .nf -int upscli_cleanup(void); +int upscli_cleanup(); .fi .SH "DESCRIPTION" .sp diff --git a/docs/man/upscli_cleanup.txt b/docs/man/upscli_cleanup.txt index 60431ec..cd88a51 100644 --- a/docs/man/upscli_cleanup.txt +++ b/docs/man/upscli_cleanup.txt @@ -11,22 +11,19 @@ SYNOPSIS #include - int upscli_cleanup(void); + int upscli_cleanup(); DESCRIPTION ----------- - The *upscli_cleanup()* function flushes SSL caches and frees memory used internally in upsclient module. RETURN VALUE ------------ -The *upscli_cleanup()* function returns 1 on success, or -1 if an error -occurs. +The *upscli_cleanup()* function returns 1 on success, or -1 if an error occurs. SEE ALSO -------- - linkman:upscli_init[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_connect.3 b/docs/man/upscli_connect.3 index ed94a7e..794ec69 100644 --- a/docs/man/upscli_connect.3 +++ b/docs/man/upscli_connect.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_connect -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_CONNECT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_CONNECT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ upscli_connect \- Open a connection to a NUT upsd .fi .sp .nf -int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags); +int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags); .fi .SH "DESCRIPTION" .sp @@ -44,8 +44,6 @@ The \fBupscli_connect()\fR function takes the pointer \fIups\fR to a UPSCONN_t s .sp \fIflags\fR may be either UPSCLI_CONN_TRYSSL to try a SSL connection, or UPSCLI_CONN_REQSSL to require a SSL connection\&. .sp -Introduced in version 2\&.7, an additional flag UPSCLI_CONN_CERTVERIF now exists to verify the signature offered during the SSL handshake\&. This flag should be used in conjunction with \fBupscli_init\fR(3) and/or \fBupscli_add_host_cert\fR(3) calls before connecting in order to define a CA certificate with which to verify\&. -.sp If SSL mode is required, this function will only return successfully if it is able to establish a SSL connection with the server\&. Possible reasons for failure include no SSL support on the server, and if \fBupsclient\fR itself hasn\(cqt been compiled with SSL support\&. .sp You must call \fBupscli_disconnect\fR(3) when finished with a connection, or your program will slowly leak memory and file descriptors\&. diff --git a/docs/man/upscli_connect.txt b/docs/man/upscli_connect.txt index c2e3dde..d493dd0 100644 --- a/docs/man/upscli_connect.txt +++ b/docs/man/upscli_connect.txt @@ -11,23 +11,16 @@ SYNOPSIS #include - int upscli_connect(UPSCONN_t *ups, const char *host, uint16_t port, int flags); + int upscli_connect(UPSCONN_t *ups, const char *host, int port, int flags); DESCRIPTION ----------- - The *upscli_connect()* function takes the pointer 'ups' to a `UPSCONN_t` state structure and opens a TCP connection to the 'host' on the given 'port'. 'flags' may be either `UPSCLI_CONN_TRYSSL` to try a SSL -connection, or `UPSCLI_CONN_REQSSL` to require a SSL connection. - -Introduced in version 2.7, an additional flag `UPSCLI_CONN_CERTVERIF` -now exists to verify the signature offered during the SSL handshake. -This flag should be used in conjunction with linkman:upscli_init[3] -and/or linkman:upscli_add_host_cert[3] calls before connecting in -order to define a CA certificate with which to verify. +connection, or `UPSCLI_CONN_REQSSL` to require a SSL connection. If SSL mode is required, this function will only return successfully if it is able to establish a SSL connection with the server. Possible @@ -46,8 +39,7 @@ returns 0 on success, or -1 if an error occurs. SEE ALSO -------- - -linkman:upscli_disconnect[3], linkman:upscli_fd[3], -linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], -linkman:upscli_ssl[3], linkman:upscli_strerror[3], +linkman:upscli_disconnect[3], linkman:upscli_fd[3], +linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], +linkman:upscli_ssl[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_disconnect.3 b/docs/man/upscli_disconnect.3 index 5857fa4..8a26aaf 100644 --- a/docs/man/upscli_disconnect.3 +++ b/docs/man/upscli_disconnect.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_disconnect -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_DISCONNECT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_DISCONNECT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -40,9 +40,7 @@ int upscli_disconnect(UPSCONN_t *ups); .fi .SH "DESCRIPTION" .sp -The \fBupscli_disconnect()\fR function takes the pointer \fIups\fR to a UPSCONN_t state structure, shuts down the connection to the server, and frees dynamic memory used by the state structure\&. -.sp -The UPSCONN_t structure is no longer valid after this function is called\&. +The \fBupscli_disconnect()\fR function takes the pointer \fIups\fR to a UPSCONN_t state structure, shuts down the connection to the server, and frees dynamic memory used by the state structure\&. The UPSCONN_t structure is no longer valid after this function is called\&. .sp This function must be called, or your program will leak memory and file descriptors\&. .SH "RETURN VALUE" diff --git a/docs/man/upscli_disconnect.txt b/docs/man/upscli_disconnect.txt index 76a8e61..8c7d5ca 100644 --- a/docs/man/upscli_disconnect.txt +++ b/docs/man/upscli_disconnect.txt @@ -15,12 +15,10 @@ SYNOPSIS DESCRIPTION ----------- - The *upscli_disconnect()* function takes the pointer 'ups' to a -`UPSCONN_t` state structure, shuts down the connection to the server, -and frees dynamic memory used by the state structure. - -The `UPSCONN_t` structure is no longer valid after this function is called. +`UPSCONN_t` state structure, shuts down the connection to the server, and +frees dynamic memory used by the state structure. The `UPSCONN_t` structure +is no longer valid after this function is called. This function must be called, or your program will leak memory and file descriptors. @@ -33,6 +31,5 @@ error occurs. SEE ALSO -------- - -linkman:upscli_connect[3], linkman:upscli_fd[3], +linkman:upscli_connect[3], linkman:upscli_fd[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_fd.3 b/docs/man/upscli_fd.3 index 5bd0063..1aca6a0 100644 --- a/docs/man/upscli_fd.3 +++ b/docs/man/upscli_fd.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_fd -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_FD" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_FD" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -45,9 +45,7 @@ The \fBupscli_fd()\fR function takes the pointer \fIups\fR to a UPSCONN_t state This may be useful for determining if the connection to \fBupsd\fR(8) has been lost\&. .SH "RETURN VALUE" .sp -The \fBupscli_fd()\fR function returns the file descriptor, which may be any non\-negative number\&. -.sp -It returns \-1 if an error occurs\&. +The \fBupscli_fd()\fR function returns the file descriptor, which may be any non\-negative number\&. It returns \-1 if an error occurs\&. .SH "SEE ALSO" .sp \fBupscli_connect\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3) diff --git a/docs/man/upscli_fd.txt b/docs/man/upscli_fd.txt index 1fd2971..c42b098 100644 --- a/docs/man/upscli_fd.txt +++ b/docs/man/upscli_fd.txt @@ -16,9 +16,9 @@ SYNOPSIS DESCRIPTION ----------- -The *upscli_fd()* function takes the pointer 'ups' to a `UPSCONN_t` -state structure and returns the value of the file descriptor for -that connection, if any. +The *upscli_fd()* function takes the pointer 'ups' to a +`UPSCONN_t` state structure and returns the value of the file descriptor +for that connection, if any. This may be useful for determining if the connection to linkman:upsd[8] has been lost. @@ -27,9 +27,7 @@ RETURN VALUE ------------ The *upscli_fd()* function returns the file descriptor, which -may be any non-negative number. - -It returns -1 if an error occurs. +may be any non-negative number. It returns -1 if an error occurs. SEE ALSO -------- diff --git a/docs/man/upscli_get.3 b/docs/man/upscli_get.3 index c020a09..fd825a0 100644 --- a/docs/man/upscli_get.3 +++ b/docs/man/upscli_get.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_get -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_GET" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_GET" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,7 +28,7 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -upscli_get \- retrieve data from an UPS +upscli_get \- retrieve data from a UPS .SH "SYNOPSIS" .sp .nf @@ -36,8 +36,8 @@ upscli_get \- retrieve data from an UPS .fi .sp .nf -int upscli_get(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) +int upscli_get(UPSCONN_t *ups, int numq, const char **query, + int *numa, char ***answer) .fi .SH "DESCRIPTION" .sp @@ -46,9 +46,7 @@ The \fBupscli_get()\fR function takes the pointer \fIups\fR to a UPSCONN_t state Upon success, the response will be split into separate components\&. A pointer to those components will be returned in \fIanswer\fR\&. The number of usable answer components will be returned in \fInuma\fR\&. .SH "USES" .sp -This function implements the "GET" command in the protocol\&. As a result, you can use it to request many different things from the server\&. -.sp -Some examples are: +This function implements the "GET" command in the protocol\&. As a result, you can use it to request many different things from the server\&. Some examples are: .sp .RS 4 .ie n \{\ @@ -123,12 +121,20 @@ To generate a request for GET NUMLOGINS su700, you would populate query and numq .RS 4 .\} .nf - size_t numq; - const char *query[2]; - - query[0] = "NUMLOGINS"; - query[1] = "su700"; - numq = 2; +int numq; +const char *query[2]; +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +query[0] = "NUMLOGINS"; +query[1] = "su700"; +numq = 2; .fi .if n \{\ .RE @@ -137,20 +143,16 @@ To generate a request for GET NUMLOGINS su700, you would populate query and numq All escaping of special characters and quoting of elements with spaces is handled for you inside this function\&. .SH "ANSWER FORMATTING" .sp -The raw response from upsd to the above query would be NUMLOGINS su700 1\&. -.sp -Since this is split up for you, the values work out like this: +The raw response from upsd to the above query would be NUMLOGINS su700 1\&. Since this is split up for you, the values work out like this: .sp .if n \{\ .RS 4 .\} .nf - size_t numa; - - numa = 3; - answer[0] = "NUMLOGINS" - answer[1] = "su700" - answer[2] = "1" +numa = 3; +answer[0] = "NUMLOGINS" +answer[1] = "su700" +answer[2] = "1" .fi .if n \{\ .RE @@ -172,23 +174,6 @@ The array will be deleted after calling \fBupscli_disconnect\fR(3)\&. Any access .SH "RETURN VALUE" .sp The \fBupscli_get()\fR function returns 0 on success, or \-1 if an error occurs\&. -.sp -If \fBupsd\fR disconnects, you may need to handle or ignore SIGPIPE in order to prevent your program from terminating the next time that the library writes to the disconnected socket\&. -.sp -The following code in your initialization function will allow the \fBupscli_get()\fR call to return an error in that case: -.sp -.if n \{\ -.RS 4 -.\} -.nf -#include -\&.\&.\&. -signal (SIGPIPE, SIG_IGN); -\&.\&.\&. -.fi -.if n \{\ -.RE -.\} .SH "SEE ALSO" .sp \fBupscli_list_start\fR(3), \fBupscli_list_next\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3) diff --git a/docs/man/upscli_get.txt b/docs/man/upscli_get.txt index 0d524fe..00aea76 100644 --- a/docs/man/upscli_get.txt +++ b/docs/man/upscli_get.txt @@ -3,36 +3,32 @@ UPSCLI_GET(3) NAME ---- - -upscli_get - retrieve data from an UPS +upscli_get - retrieve data from a UPS SYNOPSIS -------- #include - int upscli_get(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) + int upscli_get(UPSCONN_t *ups, int numq, const char **query, + int *numa, char ***answer) DESCRIPTION ----------- - The *upscli_get()* function takes the pointer 'ups' to a `UPSCONN_t` state structure, and the pointer 'query' to an array of 'numq' query elements. It builds a properly-formatted request from those elements and transmits it to linkman:upsd[8]. -Upon success, the response will be split into separate components. -A pointer to those components will be returned in 'answer'. -The number of usable answer components will be returned in 'numa'. +Upon success, the response will be split into separate components. A +pointer to those components will be returned in 'answer'. The +number of usable answer components will be returned in 'numa'. USES ---- -This function implements the "GET" command in the protocol. -As a result, you can use it to request many different things -from the server. - +This function implements the "GET" command in the protocol. As a +result, you can use it to request many different things from the server. Some examples are: * GET NUMLOGINS @@ -44,46 +40,36 @@ Some examples are: QUERY FORMATTING ---------------- - To generate a request for `GET NUMLOGINS su700`, you would populate query and numq as follows: ------- - size_t numq; + int numq; const char *query[2]; query[0] = "NUMLOGINS"; query[1] = "su700"; numq = 2; ------- All escaping of special characters and quoting of elements with spaces is handled for you inside this function. ANSWER FORMATTING ----------------- - -The raw response from `upsd` to the above query would be `NUMLOGINS su700 1`. - +The raw response from upsd to the above query would be `NUMLOGINS su700 1`. Since this is split up for you, the values work out like this: ------- - size_t numa; - numa = 3; answer[0] = "NUMLOGINS" answer[1] = "su700" answer[2] = "1" ------- -Notice that the value which you seek typically starts at `answer[numq]`. +Notice that the value which you seek typically starts at answer[numq]. ERROR CHECKING -------------- - This function will check your query against the response from -linkman:upsd[8]. For example, if you send "VAR" "su700" "ups.status", -it will expect to see those at the beginning of the response. +linkman:upsd[8]. For example, if you send "VAR" "su700" "ups.status", it +will expect to see those at the beginning of the response. If the results from *upsd* do not pass this case-insensitive test against your request, this function will return an error. When this @@ -91,7 +77,6 @@ happens, linkman:upscli_upserror[3] will return 'UPSCLI_ERR_PROTOCOL'. ANSWER ARRAY LIFETIME --------------------- - The pointers contained within the 'answer' array are only valid until the next call to a 'upsclient' function which references them. If you need to use data from multiple calls, you must copy it somewhere @@ -103,29 +88,15 @@ which were returned by the most recent call. You also must not attempt to use more than 'numa' elements in 'answer'. Such behavior is undefined, and may yield bogus data or a crash. -The array will be deleted after calling linkman:upscli_disconnect[3]. -Any access after that point is also undefined. +The array will be deleted after calling linkman:upscli_disconnect[3]. Any +access after that point is also undefined. RETURN VALUE ------------ - The *upscli_get()* function returns 0 on success, or -1 if an error occurs. -If *upsd* disconnects, you may need to handle or ignore `SIGPIPE` -in order to prevent your program from terminating the next time that -the library writes to the disconnected socket. - -The following code in your initialization function will allow the -*upscli_get()* call to return an error in that case: - - #include - ... - signal (SIGPIPE, SIG_IGN); - ... - SEE ALSO -------- - linkman:upscli_list_start[3], linkman:upscli_list_next[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_init.3 b/docs/man/upscli_init.3 index 04fd0ce..488df32 100644 --- a/docs/man/upscli_init.3 +++ b/docs/man/upscli_init.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_init -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_INIT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_INIT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -43,21 +43,7 @@ int upscli_init(int certverify, const char *certpath, .sp The \fBupscli_init()\fR function initialize upsclient module and set many SSL\-related properties: \fIcertverify\fR to 1 makes certificate verification required for all SSL connections and \fIcertpath\fR is the location of certificate database\&. .sp -If compiled with OpenSSL, certpath refers to directory containing certificates where the certificates must be named according to their hash values ending in a "\&.0" extension\&. If two certificates result in the same hash value (thus file name), the "\&.0" can be incremented to "\&.1" and so on, as needed\&. The bash command for creating links in this manner would be: -.sp -.if n \{\ -.RS 4 -.\} -.nf -ln \-s ca\&.pem \&./$(openssl x509 \-hash \-noout \-in ca\&.pem)\&.0 -.fi -.if n \{\ -.RE -.\} -.sp -Alternatively, the c_rehash utility (provided by openssl\-perl) can take a directory and iterate it to link all certificates found in that directory, in the manner described above\&. -.sp -If compiled with NSS, certpath refers to a directory containing database files\&. +If compiled with OpenSSL, certpath refers to a \&.pem file containing certificates and if compiled with NSS, certpath refers to a directory containing database files\&. .sp If compiled with NSS and using SSL, you can specify \fIcertname\fR the name of the certificate to send to upsd and \fIcertpasswd\fR the password used to decrypt certificate private key\&. .sp diff --git a/docs/man/upscli_init.txt b/docs/man/upscli_init.txt index 16cd0e9..d07c7e7 100644 --- a/docs/man/upscli_init.txt +++ b/docs/man/upscli_init.txt @@ -16,27 +16,14 @@ SYNOPSIS DESCRIPTION ----------- - The *upscli_init()* function initialize upsclient module and set many SSL-related properties: 'certverify' to 1 makes certificate verification required for all SSL connections and 'certpath' is the location of certificate database. -If compiled with OpenSSL, certpath refers to directory containing -certificates where the certificates must be named according to their -hash values ending in a ".0" extension. If two certificates result in -the same hash value (thus file name), the ".0" can be incremented to ".1" -and so on, as needed. The bash command for creating links in this manner -would be: - - ln -s ca.pem ./$(openssl x509 -hash -noout -in ca.pem).0 - -Alternatively, the c_rehash utility (provided by openssl-perl) can take a -directory and iterate it to link all certificates found in that directory, -in the manner described above. - -If compiled with NSS, certpath refers to a directory containing database -files. +If compiled with OpenSSL, certpath refers to a .pem file containing +certificates and if compiled with NSS, certpath refers to a directory +containing database files. If compiled with NSS and using SSL, you can specify 'certname' the name of the certificate to send to upsd and 'certpasswd' the password used @@ -54,9 +41,8 @@ The *upscli_init()* function returns 1 on success, or -1 if an error occurs. SEE ALSO -------- - linkman:upscli_add_host_cert[3], linkman:upscli_cleanup[3], -linkman:upscli_disconnect[3], linkman:upscli_fd[3], -linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], -linkman:upscli_ssl[3], linkman:upscli_strerror[3], +linkman:upscli_disconnect[3], linkman:upscli_fd[3], +linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], +linkman:upscli_ssl[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_list_next.3 b/docs/man/upscli_list_next.3 index f3a1ec4..f7a0180 100644 --- a/docs/man/upscli_list_next.3 +++ b/docs/man/upscli_list_next.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_list_next -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_LIST_NEXT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_LIST_NEXT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,8 +36,8 @@ upscli_list_next \- retrieve list items from a UPS .fi .sp .nf -int upscli_list_next(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) +int upscli_list_next(UPSCONN_t *ups, int numq, const char **query, + int *numa, char ***answer) .fi .SH "DESCRIPTION" .sp diff --git a/docs/man/upscli_list_next.txt b/docs/man/upscli_list_next.txt index 9612136..30fc7b3 100644 --- a/docs/man/upscli_list_next.txt +++ b/docs/man/upscli_list_next.txt @@ -11,8 +11,8 @@ SYNOPSIS #include - int upscli_list_next(UPSCONN_t *ups, size_t numq, const char **query, - size_t *numa, char ***answer) + int upscli_list_next(UPSCONN_t *ups, int numq, const char **query, + int *numa, char ***answer) DESCRIPTION ----------- @@ -42,8 +42,8 @@ ANSWER FORMATTING ----------------- The contents of 'numa' and 'answer' work just like a call to -linkman:upscli_get[3]. The values returned by linkman:upsd[8] are -identical to a single item request, so this is not surprising. +linkman:upscli_get[3]. The values returned by linkman:upsd[8] are identical to +a single item request, so this is not surprising. ERROR CHECKING -------------- @@ -66,6 +66,5 @@ its first call in that case. SEE ALSO -------- - linkman:upscli_list_start[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscli_list_start.3 b/docs/man/upscli_list_start.3 index da7a80d..87fe4c6 100644 --- a/docs/man/upscli_list_start.3 +++ b/docs/man/upscli_list_start.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_list_start -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_LIST_START" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_LIST_START" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,10 +33,7 @@ upscli_list_start \- begin multi\-item retrieval from a UPS .sp .nf #include -.fi -.sp -.nf -int upscli_list_start(UPSCONN_t *ups, size_t numq, const char **query) +int upscli_list_start(UPSCONN_t *ups, int numq, const char **query) .fi .SH "DESCRIPTION" .sp @@ -120,12 +117,20 @@ To see the list of variables on a UPS called \fIsu700\fR, the protocol command w .RS 4 .\} .nf - size_t numq; - const char *query[2]; - - query[0] = "VAR"; - query[1] = "su700"; - numq = 2; +int numq; +const char *query[2]; +.fi +.if n \{\ +.RE +.\} +.sp +.if n \{\ +.RS 4 +.\} +.nf +query[0] = "VAR"; +query[1] = "su700"; +numq = 2; .fi .if n \{\ .RE diff --git a/docs/man/upscli_list_start.txt b/docs/man/upscli_list_start.txt index c564c36..e041934 100644 --- a/docs/man/upscli_list_start.txt +++ b/docs/man/upscli_list_start.txt @@ -10,8 +10,7 @@ SYNOPSIS -------- #include - - int upscli_list_start(UPSCONN_t *ups, size_t numq, const char **query) + int upscli_list_start(UPSCONN_t *ups, int numq, const char **query) DESCRIPTION ----------- @@ -47,14 +46,12 @@ To see the list of variables on a UPS called 'su700', the protocol command would be `LIST VAR su700`. To start that list with this function, you would populate query and numq as follows: ------- - size_t numq; + int numq; const char *query[2]; query[0] = "VAR"; query[1] = "su700"; numq = 2; ------- All escaping of special characters and quoting of elements with spaces are handled for you inside this function. @@ -71,7 +68,6 @@ When this happens, linkman:upscli_upserror[3] will return RETURN VALUE ------------ - The *upscli_list_start()* function returns 0 on success, or -1 if an error occurs. @@ -82,3 +78,4 @@ linkman:upscli_fd[3], linkman:upscli_get[3], linkman:upscli_readline[3], linkman:upscli_sendline[3], linkman:upscli_ssl[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] + diff --git a/docs/man/upscli_readline.3 b/docs/man/upscli_readline.3 index 6d2962a..6b8a698 100644 --- a/docs/man/upscli_readline.3 +++ b/docs/man/upscli_readline.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_readline -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_READLINE" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_READLINE" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,32 +28,24 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -upscli_readline, upscli_readline_timeout \- read a single response from a UPS +upscli_readline \- read a single response from a UPS .SH "SYNOPSIS" .sp .nf #include -#include /* or on some platforms */ .fi .sp .nf int upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen); .fi -.sp -.nf -int upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, - const time_t timeout); -.fi .SH "DESCRIPTION" .sp -The \fBupscli_readline()\fR and \fBupscli_readline_timeout()\fR functions take the pointer \fIups\fR to a UPSCONN_t state structure, receive a single line from the server, and copy up to \fIbuflen\fR bytes of the response into the buffer \fIbuf\fR\&. +The \fBupscli_readline()\fR function takes the pointer \fIups\fR to a UPSCONN_t state structure, receives a single line from the server, and copies up to \fIbuflen\fR bytes of the response into the buffer \fIbuf\fR\&. .sp Some parsing of the string occurs during reception\&. In particular, ERR messages from \fBupsd\fR(8) are detected and will cause this function to return \-1\&. -.sp -The difference between the two functions is that \fBupscli_readline_timeout()\fR lets the caller decide the amount of time (\fItimeout\fR seconds) after which it should give up and return, whereas \fBupscli_readline()\fR does not offer this freedom, and uses NUT default network timeout (5 seconds)\&. .SH "RETURN VALUE" .sp -The \fBupscli_readline()\fR and \fBupscli_readline_timeout()\fR functions return 0 on success, or \-1 if an error occurs\&. +The \fBupscli_readline()\fR function returns 0 on success, or \-1 if an error occurs\&. .SH "SEE ALSO" .sp \fBupscli_fd\fR(3), \fBupscli_get\fR(3), \fBupscli_readline\fR(3), \fBupscli_sendline\fR(3), \fBupscli_ssl\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3) diff --git a/docs/man/upscli_readline.txt b/docs/man/upscli_readline.txt index 120ad21..52106ad 100644 --- a/docs/man/upscli_readline.txt +++ b/docs/man/upscli_readline.txt @@ -4,41 +4,31 @@ UPSCLI_READLINE(3) NAME ---- -upscli_readline, upscli_readline_timeout - read a single response from a UPS +upscli_readline - read a single response from a UPS SYNOPSIS -------- #include - #include /* or on some platforms */ int upscli_readline(UPSCONN_t *ups, char *buf, size_t buflen); - int upscli_readline_timeout(UPSCONN_t *ups, char *buf, size_t buflen, - const time_t timeout); - DESCRIPTION ----------- - -The *upscli_readline()* and *upscli_readline_timeout()* functions take -the pointer 'ups' to a `UPSCONN_t` state structure, receive a single -line from the server, and copy up to 'buflen' bytes of the response -into the buffer 'buf'. +The *upscli_readline()* function takes the pointer 'ups' to a +`UPSCONN_t` state structure, receives a single line from the server, and +copies up to 'buflen' bytes of the response into the buffer +'buf'. Some parsing of the string occurs during reception. In particular, ERR messages from linkman:upsd[8] are detected and will cause this function to return -1. -The difference between the two functions is that *upscli_readline_timeout()* -lets the caller decide the amount of time ('timeout' seconds) after which it -should give up and return, whereas *upscli_readline()* does not offer this -freedom, and uses NUT default network timeout (5 seconds). - RETURN VALUE ------------ -The *upscli_readline()* and *upscli_readline_timeout()* functions -return 0 on success, or -1 if an error occurs. +The *upscli_readline()* function returns 0 on success, or -1 if an +error occurs. SEE ALSO -------- diff --git a/docs/man/upscli_readline_timeout.3 b/docs/man/upscli_readline_timeout.3 deleted file mode 100644 index 0e696de..0000000 --- a/docs/man/upscli_readline_timeout.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/upscli_readline.3 diff --git a/docs/man/upscli_sendline.3 b/docs/man/upscli_sendline.3 index b94d952..8aab0a3 100644 --- a/docs/man/upscli_sendline.3 +++ b/docs/man/upscli_sendline.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_sendline -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_SENDLINE" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_SENDLINE" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -28,32 +28,24 @@ .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" -upscli_sendline, upscli_sendline_timeout \- send a single command to a UPS +upscli_sendline \- send a single command to a UPS .SH "SYNOPSIS" .sp .nf #include -#include /* or on some platforms */ .fi .sp .nf int upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen); .fi -.sp -.nf -int upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, - const time_t timeout); -.fi .SH "DESCRIPTION" .sp -The \fBupscli_sendline()\fR and \fBupscli_sendline_timeout()\fR functions take the pointer \fIups\fR to a UPSCONN_t state structure and transmit a buffer \fIbuf\fR of size \fIbuflen\fR to the server\&. +The \fBupscli_sendline()\fR function takes the pointer \fIups\fR to a UPSCONN_t state structure and transmits a buffer \fIbuf\fR of size \fIbuflen\fR to the server\&. .sp The data in \fIbuf\fR must be a fully formatted protocol command as no parsing of the buffer occurs within this function\&. -.sp -The difference between the two functions is that \fBupscli_sendline_timeout()\fR lets the caller decide the amount of time (\fItimeout\fR seconds) after which it should give up and return, whereas \fBupscli_sendline()\fR does not offer this freedom, and uses an immediate timeout (0 second)\&. .SH "RETURN VALUE" .sp -The \fBupscli_sendline()\fR and \fBupscli_sendline_timeout()\fR functions return 0 on success, or \-1 if an error occurs\&. +The \fBupscli_sendline()\fR function returns 0 on success, or \-1 if an error occurs\&. .SH "SEE ALSO" .sp \fBupscli_fd\fR(3), \fBupscli_get\fR(3), \fBupscli_readline\fR(3), \fBupscli_sendline\fR(3), \fBupscli_ssl\fR(3), \fBupscli_strerror\fR(3), \fBupscli_upserror\fR(3) diff --git a/docs/man/upscli_sendline.txt b/docs/man/upscli_sendline.txt index 895f0ba..c449c6d 100644 --- a/docs/man/upscli_sendline.txt +++ b/docs/man/upscli_sendline.txt @@ -4,39 +4,31 @@ UPSCLI_SENDLINE(3) NAME ---- -upscli_sendline, upscli_sendline_timeout - send a single command to a UPS +upscli_sendline - send a single command to a UPS SYNOPSIS -------- + #include - #include /* or on some platforms */ int upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen); - int upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen, - const time_t timeout); - DESCRIPTION ----------- -The *upscli_sendline()* and *upscli_sendline_timeout()* functions take the -pointer 'ups' to a `UPSCONN_t` state structure and transmit a buffer 'buf' -of size 'buflen' to the server. +The *upscli_sendline()* function takes the pointer 'ups' to a +`UPSCONN_t` state structure and transmits a buffer 'buf' of size +'buflen' to the server. The data in 'buf' must be a fully formatted protocol command as no parsing of the buffer occurs within this function. -The difference between the two functions is that *upscli_sendline_timeout()* -lets the caller decide the amount of time ('timeout' seconds) after which it -should give up and return, whereas *upscli_sendline()* does not offer this -freedom, and uses an immediate timeout (0 second). - RETURN VALUE ------------ -The *upscli_sendline()* and *upscli_sendline_timeout()* functions -return 0 on success, or -1 if an error occurs. +The *upscli_sendline()* function returns 0 on success, or -1 if an +error occurs. SEE ALSO -------- diff --git a/docs/man/upscli_sendline_timeout.3 b/docs/man/upscli_sendline_timeout.3 deleted file mode 100644 index ebd0d6c..0000000 --- a/docs/man/upscli_sendline_timeout.3 +++ /dev/null @@ -1 +0,0 @@ -.so man3/upscli_sendline.3 diff --git a/docs/man/upscli_splitaddr.3 b/docs/man/upscli_splitaddr.3 index 4fdc1c7..c8cd9c6 100644 --- a/docs/man/upscli_splitaddr.3 +++ b/docs/man/upscli_splitaddr.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_splitaddr -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_SPLITADDR" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_SPLITADDR" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_splitaddr.txt b/docs/man/upscli_splitaddr.txt index b705493..4633762 100644 --- a/docs/man/upscli_splitaddr.txt +++ b/docs/man/upscli_splitaddr.txt @@ -9,6 +9,7 @@ upscli_splitaddr - split a listening address into its components SYNOPSIS -------- + #include int upscli_splitaddr(const char *buf, char **hostname, @@ -17,7 +18,7 @@ SYNOPSIS DESCRIPTION ----------- -The *upscli_splitaddr()* function takes a pointer to the raw UPS +The *upscli_splitaddr()* function takes a pointer to the raw UPS definition 'buf' and returns pointers to dynamically allocated memory in 'upsname' and 'hostname'. It also copies the port number into 'port'. diff --git a/docs/man/upscli_splitname.3 b/docs/man/upscli_splitname.3 index cfa4e6b..56ac4ed 100644 --- a/docs/man/upscli_splitname.3 +++ b/docs/man/upscli_splitname.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_splitname -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_SPLITNAME" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_SPLITNAME" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_splitname.txt b/docs/man/upscli_splitname.txt index d40e642..1b714c6 100644 --- a/docs/man/upscli_splitname.txt +++ b/docs/man/upscli_splitname.txt @@ -11,13 +11,13 @@ SYNOPSIS #include - int upscli_splitname(const char *buf, char **upsname, + int upscli_splitname(const char *buf, char **upsname, char **hostname, int *port) DESCRIPTION ----------- -The *upscli_splitname()* function takes a pointer to the raw UPS +The *upscli_splitname()* function takes a pointer to the raw UPS definition 'buf' and returns pointers to dynamically allocated memory in 'upsname' and 'hostname'. It also copies the port number into 'port'. @@ -37,7 +37,6 @@ Definitions without an explicit port value receive the default value of MEMORY USAGE ------------ - You must *free*(3) the pointers to 'upsname' and 'hostname' when you are done with them to avoid memory leaks. diff --git a/docs/man/upscli_ssl.3 b/docs/man/upscli_ssl.3 index 6a7d151..37a3565 100644 --- a/docs/man/upscli_ssl.3 +++ b/docs/man/upscli_ssl.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_ssl -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_SSL" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_SSL" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_strerror.3 b/docs/man/upscli_strerror.3 index 9fb0805..cf0dd9f 100644 --- a/docs/man/upscli_strerror.3 +++ b/docs/man/upscli_strerror.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_strerror -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_STRERROR" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_STRERROR" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -36,7 +36,7 @@ upscli_strerror \- return string describing error condition .fi .sp .nf -const char *upscli_strerror(UPSCONN_t *ups); +char *upscli_strerror(UPSCONN_t *ups); .fi .SH "DESCRIPTION" .sp diff --git a/docs/man/upscli_strerror.txt b/docs/man/upscli_strerror.txt index b9b8462..fa6da66 100644 --- a/docs/man/upscli_strerror.txt +++ b/docs/man/upscli_strerror.txt @@ -11,7 +11,7 @@ SYNOPSIS #include - const char *upscli_strerror(UPSCONN_t *ups); + char *upscli_strerror(UPSCONN_t *ups); DESCRIPTION ----------- diff --git a/docs/man/upscli_upserror.3 b/docs/man/upscli_upserror.3 index 33f45b4..e2d0577 100644 --- a/docs/man/upscli_upserror.3 +++ b/docs/man/upscli_upserror.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upscli_upserror -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLI_UPSERROR" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLI_UPSERROR" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upscli_upserror.txt b/docs/man/upscli_upserror.txt index c4b5ac3..b8ac616 100644 --- a/docs/man/upscli_upserror.txt +++ b/docs/man/upscli_upserror.txt @@ -18,7 +18,7 @@ DESCRIPTION The *upscli_upserror*() function takes the pointer 'ups' to a `UPSCONN_t` state structure and returns the value of the internal error -number, if any. +number, if any. This is typically used to check for certain error values like `UPSCLI_ERR_UNKCOMMAND`. That specific error can be used for detecting diff --git a/docs/man/upsclient.3 b/docs/man/upsclient.3 index 600a2e7..87471fa 100644 --- a/docs/man/upsclient.3 +++ b/docs/man/upsclient.3 @@ -1,13 +1,13 @@ '\" t .\" Title: upsclient -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSCLIENT" "3" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCLIENT" "3" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsclient.txt b/docs/man/upsclient.txt index 0c2ac15..5bfda67 100644 --- a/docs/man/upsclient.txt +++ b/docs/man/upsclient.txt @@ -27,7 +27,7 @@ Before creating any connection, and in general using any upscli function, you must call linkman:upscli_init[3] with proper parameters to initialize upscli module. -To register specific host security policy, you must call +To register specific host security policy, you must call linkman:upscli_add_host_cert[3] before initialize connection to it. In the same way, just before exiting, and after all upscli usage, you must @@ -60,7 +60,6 @@ in memory and file descriptor leaks in your program. ERROR HANDLING -------------- - In the event of an error, linkman:upscli_strerror[3] will provide human-readable details on what happened. linkman:upscli_upserror[3] may also be used to retrieve the error number. These numbers are defined in @@ -68,13 +67,12 @@ also be used to retrieve the error number. These numbers are defined in SEE ALSO -------- - linkman:libupsclient-config[1], linkman:upscli_init[3], linkman:upscli_cleanup[3], linkman:upscli_add_host_cert[3], linkman:upscli_connect[3], linkman:upscli_disconnect[3], linkman:upscli_fd[3], -linkman:upscli_getvar[3], linkman:upscli_list_next[3], -linkman:upscli_list_start[3], linkman:upscli_readline[3], -linkman:upscli_sendline[3], -linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], -linkman:upscli_ssl[3], linkman:upscli_strerror[3], +linkman:upscli_getvar[3], linkman:upscli_list_next[3], +linkman:upscli_list_start[3], linkman:upscli_readline[3], +linkman:upscli_sendline[3], +linkman:upscli_splitaddr[3], linkman:upscli_splitname[3], +linkman:upscli_ssl[3], linkman:upscli_strerror[3], linkman:upscli_upserror[3] diff --git a/docs/man/upscmd.8 b/docs/man/upscmd.8 index a1122b3..c1e64b8 100644 --- a/docs/man/upscmd.8 +++ b/docs/man/upscmd.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upscmd -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/31/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSCMD" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCMD" "8" "07/31/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -35,7 +35,7 @@ upscmd \- UPS administration program for instant commands .sp \fBupscmd\fR \-l \fIups\fR .sp -\fBupscmd\fR [\-u \fIusername\fR] [\-p \fIpassword\fR] [\-w] [\-t ] \fIups\fR \fIcommand\fR +\fBupscmd\fR [\-u \fIusername\fR] [\-p \fIpassword\fR] \fIups\fR \fIcommand\fR .SH "DESCRIPTION" .sp \fBupscmd\fR allows you to invoke "instant commands" in your UPS hardware\&. Not all hardware supports this, so check the list with \-l to see if anything will work on your equipment\&. @@ -63,18 +63,6 @@ Set the username for the connection to the server\&. This is optional, and you w Set the password to authenticate to the server\&. This is also optional like \-u, and you will be prompted for it if necessary\&. .RE .PP -\fB\-w\fR -.RS 4 -Wait for the completion of command execution by the driver and return its actual result from the device\&. Note that this feature requires that both upsd and the driver support TRACKING (NUT version 2\&.8\&.0 or higher) or it will otherwise fail\&. The command will also block until an actual result is provided from the driver, or the timeout is reached (see -\fB\-t\fR)\&. -.RE -.PP -\fB\-t\fR \fIseconds\fR -.RS 4 -Set a timeout when using -\fB\-w\fR\&. Defaults to 10 seconds\&. -.RE -.PP \fIups\fR .RS 4 Connect to this UPS\&. The format is @@ -97,12 +85,12 @@ This paranoia is entirely defined within the driver\&. upsd and upscmd have no c upscmd won\(cqt work unless you provide a valid username and password\&. If you get "access denied" errors, make sure that your \fBupsd.users\fR(5) has an entry for you, and that the username you are using has permissions to SET variables\&. .SH "BUGS" .sp -There is currently no way to tell the user when the driver requires confirmation to invoke a command such as load\&.off\&. +There is currently no way to tell the user when the driver requires confirmation to invoke a command such as load\&.off\&. Similarly, there is not yet a way to tell the user if a command succeeds or fails\&. .sp This is on the list of things to fix in the future, so don\(cqt despair\&. It involves magic cookies\&. .SH "SEE ALSO" .sp \fBupsd\fR(8), \fBupsrw\fR(8) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upscmd.txt b/docs/man/upscmd.txt index b8c80d8..8083fec 100644 --- a/docs/man/upscmd.txt +++ b/docs/man/upscmd.txt @@ -3,17 +3,15 @@ UPSCMD(8) NAME ---- - upscmd - UPS administration program for instant commands SYNOPSIS -------- - *upscmd* -h *upscmd* -l 'ups' -*upscmd* [-u 'username'] [-p 'password'] [-w] [-t ] 'ups' 'command' +*upscmd* [-u 'username'] [-p 'password'] 'ups' 'command' DESCRIPTION ----------- @@ -41,20 +39,9 @@ Set the username for the connection to the server. This is optional, and you will be prompted for this when invoking a command if -u is not used. *-p* 'password':: -Set the password to authenticate to the server. This is also optional +Set the password to authenticate to the server. This is also optional like -u, and you will be prompted for it if necessary. -*-w*:: -Wait for the completion of command execution by the driver and return its -actual result from the device. Note that this feature requires that both upsd -and the driver support TRACKING (NUT version 2.8.0 or higher) or it will -otherwise fail. -The command will also block until an actual result is provided from the driver, -or the timeout is reached (see *-t*). - -*-t* 'seconds':: -Set a timeout when using *-w*. Defaults to 10 seconds. - 'ups':: Connect to this UPS. The format is `upsname[@hostname[:port]]`. The default hostname is "localhost". @@ -97,17 +84,16 @@ BUGS ---- There is currently no way to tell the user when the driver requires -confirmation to invoke a command such as `load.off`. +confirmation to invoke a command such as `load.off`. Similarly, there is +not yet a way to tell the user if a command succeeds or fails. This is on the list of things to fix in the future, so don't despair. It involves magic cookies. SEE ALSO -------- - linkman:upsd[8], linkman:upsrw[8] -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upscode2.8 b/docs/man/upscode2.8 index 43836a9..4ab981f 100644 --- a/docs/man/upscode2.8 +++ b/docs/man/upscode2.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upscode2 -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSCODE2" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSCODE2" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -76,7 +76,7 @@ Flag to set if commands towards to UPS need to be introduced with an LF\&. A Com .RE .SH "COMMANDS" .sp -The driver supports the following commands for those UPSes that support them\&. The available commands are autodetected during initialization, so you should check availability with \fIupscmd \-l\fR\&. +The driver supports the following commands for those UPSen that support them\&. The available commands are autodetected during initialization, so you should check availability with \fIupscmd \-l\fR\&. .sp .RS 4 .ie n \{\ @@ -168,29 +168,9 @@ shutdown\&.reboot\&.graceful \- Shut down in 20 seconds and reboot after 1 minut .SH "NOTES" .sp The Powerware UPS models that this driver has been tested against until now have not returned a value for \fIbattery\&.charge\fR\&. Therefore, the driver will guestimate a value based on the nominal battery min/max and the current battery voltage\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Håvard Lygre -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Niels Baggesen -.RE +Håvard Lygre , Niels Baggesen .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/upscode2.txt b/docs/man/upscode2.txt index 21c7b02..5e9cfda 100644 --- a/docs/man/upscode2.txt +++ b/docs/man/upscode2.txt @@ -3,26 +3,22 @@ UPSCODE2(8) NAME ---- - upscode2 - Driver for UPScode II compatible UPS equipment NOTE ---- - This man page only documents the hardware-specific features of the upscode2 driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - This driver supports UPS equipment which can be controlled via the UPScode II protocol. This is mainly Fiskars, Powerware equipment, but also some (probably OEM'ed) products from Compaq. EXTRA ARGUMENTS --------------- - This driver supports the following optional settings in the linkman:ups.conf[5]: @@ -58,7 +54,7 @@ A Compaq T1500h is known to need this. COMMANDS -------- -The driver supports the following commands for those UPSes that support them. +The driver supports the following commands for those UPSen that support them. The available commands are autodetected during initialization, so you should check availability with 'upscmd -l'. @@ -86,21 +82,18 @@ have not returned a value for 'battery.charge'. Therefore, the driver will guestimate a value based on the nominal battery min/max and the current battery voltage. -AUTHORS -------- - -* Håvard Lygre -* Niels Baggesen +AUTHOR +------ +Håvard Lygre , +Niels Baggesen SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsd.8 b/docs/man/upsd.8 index 3044797..37273cf 100644 --- a/docs/man/upsd.8 +++ b/docs/man/upsd.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsd -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSD" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSD" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -64,30 +64,9 @@ stop process and exit .RE .RE .PP -\fB\-P\fR \fIpid\fR -.RS 4 -Send the command signal above using specified PID number, rather than consulting the PID file\&. This can help define service units which start -upsd -as a foreground process so it does not create a PID file\&. See also -\-FF -option as an alternative\&. -.RE -.PP \fB\-D\fR .RS 4 -Raise the debugging level\&. upsd will run in the foreground by default, and will print information on stdout about the monitoring process\&. Use this option multiple times for more details\&. -.RE -.PP -\fB\-F\fR -.RS 4 -upsd will run in the foreground, regardless of debugging settings\&. Specify twice (\-FF -or -\-F \-F) to save the PID file even in this mode\&. -.RE -.PP -\fB\-B\fR -.RS 4 -upsd will run in the background, regardless of debugging settings\&. +Raise the debug level\&. Use this multiple times for additional details\&. .RE .PP \fB\-h\fR @@ -125,9 +104,9 @@ Display the version of the program\&. .sp upsd can reload its configuration files without shutting down the process if you send it a SIGHUP or start it again with \-c reload\&. This only works if the background process is able to read those files\&. .sp -If you think that upsd can\(cqt reload, check your syslog for error messages\&. If it\(cqs complaining about not being able to read the files, then you need to adjust your system to make it possible\&. Either change the permissions on the files, or run upsd as another user that will be able to read them\&. +If you think that upsd can\(cqt reload, check your syslogs for error messages\&. If it\(cqs complaining about not being able to read the files, then you need to adjust your system to make it possible\&. Either change the permissions on the files, or run upsd as another user that will be able to read them\&. .sp -DO NOT make your upsd\&.conf or upsd\&.users world\-readable, as those files hold important authentication information\&. In the wrong hands, it could be used by some evil person to spoof your primary\-mode upsmon and command your systems to shut down\&. +DO NOT make your upsd\&.conf or upsd\&.users world\-readable, as those files hold important authentication information\&. In the wrong hands, it could be used by some evil person to spoof your master upsmon and command your systems to shut down\&. .SH "DIAGNOSTICS" .sp upsd expects the drivers to either update their status regularly or at least answer periodic queries, called pings\&. If a driver doesn\(cqt answer, upsd will declare it "stale" and no more information will be provided to the clients\&. @@ -146,827 +125,16 @@ The general upsd configuration file is \fBupsd.conf\fR(5)\&. The administrative \fBNUT_CONFPATH\fR is the path name of the directory that contains upsd\&.conf and other configuration files\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /usr/local/ups/etc\&. .sp \fBNUT_STATEPATH\fR is the path name of the directory in which \fBupsd\fR keeps state information\&. If this variable is not set, \fBupsd\fR uses a built\-in default, which is often /var/state/ups\&. The \fBSTATEPATH\fR directive in \fBupsd.conf\fR(5) overrides this variable\&. -.sp -\fBNUT_ALTPIDPATH\fR is the path name of the directory in which \fBupsd\fR and drivers store \&.pid files\&. If this variable is not set, \fBupsd\fR and drivers use either \fBNUT_STATEPATH\fR if set, or ALTPIDPATH if set, or otherwise the built\-in default \fBSTATEPATH\fR\&. .SH "SEE ALSO" .SS "Clients:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsc\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupscmd\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsrw\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupslog\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsmon\fR(8) -.RE +\fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8), \fBupslog\fR(8), \fBupsmon\fR(8) .SS "CGI programs:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsset.cgi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsstats.cgi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsimage.cgi\fR(8) -.RE -.SS "Driver control:" -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnut-driver-enumerator\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsdrvctl\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupsdrvsvcctl\fR(8) -.RE +\fBupsset.cgi\fR(8), \fBupsstats.cgi\fR(8), \fBupsimage.cgi\fR(8) .SS "Drivers:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutupsdrv\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBadelsystem_cbi\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBal175\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcsmart-old\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcsmart\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBapcupsd-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBasem\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbcmxcp\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbcmxcp_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbelkin\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbelkinunv\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestfcom\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestfortress\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestuferrups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBbestups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer-common\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer_ser\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBblazer_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBclone\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBdummy-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBetapro\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBeverups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgamatronic\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgeneric_modbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBgenericups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBhuawei-ups2000\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBisbmex\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBivtscd\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBliebert-esp2\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBliebert\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmacosx-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmasterguard\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmetasys\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmge-shut\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmge-utalk\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmicrodowell\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBmicrosol-apc\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnetxml-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnut-ipmipsu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_atcl_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_qx\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBnutdrv_siemens_sitop\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBoneac\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBoptiups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBphoenixcontact_modbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpijuice\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowercom\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowerman-pdu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBpowerpanel\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBrhino\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBrichcomm_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBriello_ser\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBriello_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsafenet\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsnmp-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsocomec_jbus\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBsolis\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplite\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplite_usb\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBtripplitesu\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBupscode2\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBusbhid-ups\fR(8) -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -\fBvictronups\fR(8) -.RE +\fBnutupsdrv\fR(8), \fBapcsmart\fR(8), \fBbelkin\fR(8), \fBbelkinunv\fR(8), \fBbestuferrups\fR(8), \fBbestups\fR(8), \fBcyberpower\fR(8), \fBenergizerups\fR(8), \fBetapro\fR(8), \fBeverups\fR(8), \fBgenericups\fR(8), \fBisbmex\fR(8), \fBliebert\fR(8), \fBmasterguard\fR(8), \fBmge-shut\fR(8), \fBmge-utalk\fR(8), \fBoneac\fR(8), \fBpowercom\fR(8), \fBsafenet\fR(8), \fBsnmp-ups\fR(8), \fBtripplite\fR(8), \fBtripplitesu\fR(8), \fBvictronups\fR(8), .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsd.conf.5 b/docs/man/upsd.conf.5 index e5ef1ac..039b09a 100644 --- a/docs/man/upsd.conf.5 +++ b/docs/man/upsd.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upsd.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSD\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSD\&.CONF" "5" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -41,34 +41,6 @@ upsd usually allows a driver to stop responding for up to 15 seconds before decl Most users should leave this at the default value\&. .RE .PP -"TRACKINGDELAY \fIseconds\fR" -.RS 4 -When instant commands and variables setting status tracking is enabled, status execution information are kept during this amount of time, and then cleaned up\&. This defaults to 3600 (1 hour)\&. -.RE -.PP -"ALLOW_NO_DEVICE \fIBoolean\fR" -.RS 4 -Normally upsd requires that at least one device section is defined in ups\&.conf when the daemon starts, to serve its data\&. For automatically managed services it may be preferred to have upsd always running, and reload the configuration when power devices become defined\&. -.sp -Boolean values -\fItrue\fR, -\fIyes\fR, -\fIon\fR -and -\fI1\fR -mean that the server would not refuse to start with zero device sections found in ups\&.conf\&. -.sp -Boolean values -\fIfalse\fR, -\fIno\fR, -\fIoff\fR -and -\fI0\fR -mean that the server should refuse to start if zero device sections were found in ups\&.conf\&. This is the default, unless the calling environment sets a same\-named variable to enforce a value for the current run\&. One way this can happen is somebody un\-commenting it in the -\fInut\&.conf\fR -file used by init\-scripts and service unit method scripts\&. -.RE -.PP "STATEPATH \fIpath\fR" .RS 4 Tell upsd to look for the driver state sockets in @@ -78,28 +50,21 @@ rather than the default that was compiled into the program\&. .PP "LISTEN \fIinterface\fR \fIport\fR" .RS 4 -Bind a listening port to the interface specified by its Internet address or name\&. This may be useful on hosts with multiple interfaces\&. You should not rely exclusively on this for security, as it can be subverted on many systems\&. +Bind a listening port to the interface specified by its Internet address\&. This may be useful on hosts with multiple interfaces\&. You should not rely exclusively on this for security, as it can be subverted on many systems\&. .sp -Optionally listen on TCP port +Listen on TCP port \fIport\fR instead of the default value which was compiled into the code\&. This overrides any value you may have set with \fIconfigure \-\-with\-port\fR\&. If you don\(cqt change it with configure or this value, upsd will listen on port 3493 for this interface\&. .sp Multiple LISTEN addresses may be specified\&. The default is to bind to 127\&.0\&.0\&.1 if no LISTEN addresses are specified (and ::1 if IPv6 support is compiled in)\&. .sp -To listen on all available interfaces, you may also use -\fI0\&.0\&.0\&.0\fR -for IPv4 and and -\fI::\fR -for IPv6\&. -.sp .if n \{\ .RS 4 .\} .nf LISTEN 127\&.0\&.0\&.1 LISTEN 192\&.168\&.50\&.1 -LISTEN myhostname\&.mydomain LISTEN ::1 LISTEN 2001:0db8:1234:08d3:1319:8a2e:0370:7344 .fi @@ -124,7 +89,7 @@ or the Security chapter of NUT user manual for more information on the SSL suppo .PP "CERTPATH \fIcertificate database\fR" .RS 4 -When compiled with SSL support with NSS backend, you can enter the certificate path here\&. Certificates are stored in a dedicated database (data split in 3 files)\&. Specify the path of the database directory\&. +When compiled with SSL support with NSS backend, you can enter the certificate path here\&. Certificates are stored in a dedicated database (splitted in 3 files)\&. Specify the path of the database directory\&. .RE .PP "CERTIDENT \fIcertificate name\fR \fIdatabase password\fR" @@ -145,6 +110,7 @@ When compiled with SSL support with NSS backend and client certificate validatio .sp -1 .IP \(bu 2.3 .\} + \fI0\fR to not request to clients to provide any certificate .RE @@ -157,6 +123,7 @@ to not request to clients to provide any certificate .sp -1 .IP \(bu 2.3 .\} + \fI1\fR to require to all clients a certificate .RE @@ -169,52 +136,14 @@ to require to all clients a certificate .sp -1 .IP \(bu 2.3 .\} + \fI2\fR to require to all clients a valid certificate .RE .RE -.PP -"DISABLE_WEAK_SSL \fIBOOLEAN\fR" -.RS 4 -Tell upsd to disable older/weak SSL/TLS protocols and ciphers\&. With relatively recent versions of OpenSSL or NSS it will be restricted to TLSv1\&.2 or better\&. Unless you have really ancient clients, you probably want to enable this\&. Currently disabled by default to ensure compatibility with existing setups\&. -.RE -.PP -"DEBUG_MIN \fIINTEGER\fR" -.RS 4 -Optionally specify a minimum debug level for -upsd -data daemon, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. Command\-line option -\-D -can only increase this verbosity level\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -if the running daemon receives a -reload -command, presence of the -DEBUG_MIN NUMBER -value in the configuration file can be used to tune debugging verbosity in the running service daemon (it is recommended to comment it away or set the minimum to explicit zero when done, to avoid huge journals and I/O system abuse)\&. Keep in mind that for this run\-time tuning, the -DEBUG_MIN -value -\fBpresent\fR -in -\fBreloaded\fR -configuration files is applied instantly and overrides any previously set value, from file or CLI options, regardless of older logging level being higher or lower than the newly found number; a missing (or commented away) value however does not change the previously active logging verbosity\&. -.sp .5v -.RE -.RE .SH "SEE ALSO" .sp \fBupsd\fR(8), \fBnutupsdrv\fR(8), \fBupsd.users\fR(5) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsd.conf.txt b/docs/man/upsd.conf.txt index 410910e..b1d5d24 100644 --- a/docs/man/upsd.conf.txt +++ b/docs/man/upsd.conf.txt @@ -26,28 +26,6 @@ to make upsd wait longer. + Most users should leave this at the default value. -"TRACKINGDELAY 'seconds'":: - -When instant commands and variables setting status tracking is enabled, status -execution information are kept during this amount of time, and then cleaned up. -This defaults to 3600 (1 hour). - -"ALLOW_NO_DEVICE 'Boolean'":: - -Normally upsd requires that at least one device section is defined in ups.conf -when the daemon starts, to serve its data. For automatically managed services -it may be preferred to have upsd always running, and reload the configuration -when power devices become defined. -+ -Boolean values 'true', 'yes', 'on' and '1' mean that the server would not -refuse to start with zero device sections found in ups.conf. -+ -Boolean values 'false', 'no', 'off' and '0' mean that the server should refuse -to start if zero device sections were found in ups.conf. This is the default, -unless the calling environment sets a same-named variable to enforce a value -for the current run. One way this can happen is somebody un-commenting it in -the 'nut.conf' file used by init-scripts and service unit method scripts. - "STATEPATH 'path'":: Tell upsd to look for the driver state sockets in 'path' rather @@ -55,26 +33,22 @@ than the default that was compiled into the program. "LISTEN 'interface' 'port'":: -Bind a listening port to the interface specified by its Internet address or -name. This may be useful on hosts with multiple interfaces. -You should not rely exclusively on this for security, as it can be subverted -on many systems. +Bind a listening port to the interface specified by its Internet +address. This may be useful on hosts with multiple interfaces. +You should not rely exclusively on this for security, as it can be +subverted on many systems. + -Optionally listen on TCP port 'port' instead of the default value which was -compiled into the code. This overrides any value you may have set with -'configure --with-port'. If you don't change it with configure or this value, -upsd will listen on port 3493 for this interface. +Listen on TCP port 'port' instead of the default value which was +compiled into the code. This overrides any value you may have set +with 'configure --with-port'. If you don't change it with configure +or this value, upsd will listen on port 3493 for this interface. + Multiple LISTEN addresses may be specified. The default is to bind to 127.0.0.1 if no LISTEN addresses are specified (and ::1 if IPv6 support is compiled in). -+ -To listen on all available interfaces, you may also use '0.0.0.0' for IPv4 and -and '::' for IPv6. LISTEN 127.0.0.1 LISTEN 192.168.50.1 - LISTEN myhostname.mydomain LISTEN ::1 LISTEN 2001:0db8:1234:08d3:1319:8a2e:0370:7344 + @@ -102,9 +76,9 @@ NUT user manual for more information on the SSL support in NUT. When compiled with SSL support with NSS backend, you can enter the certificate path here. -Certificates are stored in a dedicated database (data split in 3 files). +Certificates are stored in a dedicated database (splitted in 3 files). Specify the path of the database directory. - + "CERTIDENT 'certificate name' 'database password'":: When compiled with SSL support with NSS backend, you can specify the @@ -121,38 +95,11 @@ Possible values are : - '1' to require to all clients a certificate - '2' to require to all clients a valid certificate -"DISABLE_WEAK_SSL 'BOOLEAN'":: - -Tell upsd to disable older/weak SSL/TLS protocols and ciphers. -With relatively recent versions of OpenSSL or NSS it will be restricted -to TLSv1.2 or better. -Unless you have really ancient clients, you probably want to enable this. -Currently disabled by default to ensure compatibility with existing setups. - -"DEBUG_MIN 'INTEGER'":: - -Optionally specify a minimum debug level for `upsd` data daemon, e.g. for -troubleshooting a deployment, without impacting foreground or background -running mode directly. Command-line option `-D` can only increase this -verbosity level. -+ -NOTE: if the running daemon receives a `reload` command, presence of the -`DEBUG_MIN NUMBER` value in the configuration file can be used to tune -debugging verbosity in the running service daemon (it is recommended to -comment it away or set the minimum to explicit zero when done, to avoid -huge journals and I/O system abuse). Keep in mind that for this run-time -tuning, the `DEBUG_MIN` value *present* in *reloaded* configuration files -is applied instantly and overrides any previously set value, from file -or CLI options, regardless of older logging level being higher or lower -than the newly found number; a missing (or commented away) value however -does not change the previously active logging verbosity. - SEE ALSO -------- linkman:upsd[8], linkman:nutupsdrv[8], linkman:upsd.users[5] -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsd.txt b/docs/man/upsd.txt index 25d92ca..64cff41 100644 --- a/docs/man/upsd.txt +++ b/docs/man/upsd.txt @@ -8,10 +8,9 @@ upsd - UPS information server SYNOPSIS -------- - *upsd* -h -*upsd* ['OPTIONS'] +*upsd* ['OPTIONS'] DESCRIPTION ----------- @@ -44,23 +43,8 @@ are: *reload*;; reread configuration files *stop*;; stop process and exit -*-P* 'pid':: -Send the command signal above using specified PID number, rather than -consulting the PID file. This can help define service units which -start `upsd` as a foreground process so it does not create a PID file. -See also `-FF` option as an alternative. - *-D*:: -Raise the debugging level. upsd will run in the foreground by default, -and will print information on stdout about the monitoring process. -Use this option multiple times for more details. - -*-F*:: -upsd will run in the foreground, regardless of debugging settings. -Specify twice (`-FF` or `-F -F`) to save the PID file even in this mode. - -*-B*:: -upsd will run in the background, regardless of debugging settings. +Raise the debug level. Use this multiple times for additional details. *-h*:: Display the help text. @@ -89,15 +73,15 @@ upsd can reload its configuration files without shutting down the process if you send it a SIGHUP or start it again with `-c reload`. This only works if the background process is able to read those files. -If you think that upsd can't reload, check your syslog for error messages. +If you think that upsd can't reload, check your syslogs for error messages. If it's complaining about not being able to read the files, then you need to adjust your system to make it possible. Either change the permissions on the files, or run upsd as another user that will be able to read them. DO NOT make your upsd.conf or upsd.users world-readable, as those files hold important authentication information. In the wrong hands, it could -be used by some evil person to spoof your primary-mode upsmon and command -your systems to shut down. +be used by some evil person to spoof your master upsmon and command your +systems to shut down. DIAGNOSTICS ----------- @@ -142,47 +126,35 @@ ENVIRONMENT VARIABLES `upsd.conf` and other configuration files. If this variable is not set, *upsd* uses a built-in default, which is often `/usr/local/ups/etc`. -*NUT_STATEPATH* is the path name of the directory in which +*NUT_STATEPATH* is the path name of the directory in which *upsd* keeps state information. If this variable is not set, *upsd* uses a built-in default, which is often `/var/state/ups`. The *STATEPATH* directive in linkman:upsd.conf[5] overrides this variable. -*NUT_ALTPIDPATH* is the path name of the directory in which -*upsd* and drivers store .pid files. If this variable is not set, -*upsd* and drivers use either *NUT_STATEPATH* if set, or ALTPIDPATH if set, -or otherwise the built-in default *STATEPATH*. - SEE ALSO -------- Clients: ~~~~~~~~ - -- linkman:upsc[8] -- linkman:upscmd[8] -- linkman:upsrw[8] -- linkman:upslog[8] -- linkman:upsmon[8] +linkman:upsc[8], linkman:upscmd[8], +linkman:upsrw[8], linkman:upslog[8], linkman:upsmon[8] CGI programs: ~~~~~~~~~~~~~ - -- linkman:upsset.cgi[8] -- linkman:upsstats.cgi[8] -- linkman:upsimage.cgi[8] - -Driver control: -~~~~~~~~~~~~~~~ - -include::{builddir}/linkman-drivertool-names.txt[] +linkman:upsset.cgi[8], linkman:upsstats.cgi[8], linkman:upsimage.cgi[8] Drivers: ~~~~~~~~ - -- linkman:nutupsdrv[8] -include::{builddir}/linkman-driver-names.txt[] +linkman:nutupsdrv[8], +linkman:apcsmart[8], linkman:belkin[8], linkman:belkinunv[8], +linkman:bestuferrups[8], linkman:bestups[8], +linkman:cyberpower[8], linkman:energizerups[8], linkman:etapro[8], +linkman:everups[8], linkman:genericups[8], +linkman:isbmex[8], linkman:liebert[8], linkman:masterguard[8], +linkman:mge-shut[8], linkman:mge-utalk[8], linkman:oneac[8], +linkman:powercom[8], linkman:safenet[8], linkman:snmp-ups[8], +linkman:tripplite[8], linkman:tripplitesu[8], linkman:victronups[8], Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsd.users.5 b/docs/man/upsd.users.5 index 606a700..7ef3211 100644 --- a/docs/man/upsd.users.5 +++ b/docs/man/upsd.users.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upsd.users -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSD\&.USERS" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSD\&.USERS" "5" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -68,9 +68,9 @@ Here are some examples to get you started: .RS 4 .\} .nf -[upswired] +[monmaster] password = blah - upsmon primary + upsmon master .fi .if n \{\ .RE @@ -80,9 +80,9 @@ Here are some examples to get you started: .RS 4 .\} .nf -[observer] +[monslave] password = abcd - upsmon secondary + upsmon slave .fi .if n \{\ .RE @@ -126,13 +126,13 @@ file supplied with the distribution contains a list of most of the known command .PP \fBupsmon\fR .RS 4 -Add the necessary actions for a upsmon process to work\&. This is either set to "primary" or "secondary"\&. +Add the necessary actions for a upsmon process to work\&. This is either set to "master" or "slave"\&. .sp Do not attempt to assign actions to upsmon by hand, as you may miss something important\&. This method of designating a "upsmon user" was created so internal capabilities could be changed later on without breaking existing installations\&. .RE .SH "SEE ALSO" .sp \fBupsd\fR(8), \fBupsd.conf\fR(5) -.SS "Internet resources:" +.SH "INTERNET RESOURCES" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsd.users.txt b/docs/man/upsd.users.txt index 6b287d0..4f73ceb 100644 --- a/docs/man/upsd.users.txt +++ b/docs/man/upsd.users.txt @@ -3,7 +3,6 @@ UPSD.USERS(5) NAME ---- - upsd.users - Administrative user definitions for NUT upsd DESCRIPTION @@ -13,7 +12,7 @@ Administrative commands such as setting variables and the instant commands are powerful, and access to them needs to be restricted. This file defines who may access them, and what is available. -Each user gets its own section. The fields in that section set the +Each user gets its own section. The fields in that section set the parameters associated with that user's privileges. The section begins with the name of the user in brackets, and continues until the next user name in brackets or EOF. These users are independent of /etc/passwd. @@ -31,13 +30,13 @@ Here are some examples to get you started: instcmds = test.panel.start instcmds = test.panel.stop - [upswired] + [monmaster] password = blah - upsmon primary + upsmon master - [observer] + [monslave] password = abcd - upsmon secondary + upsmon slave FIELDS ------ @@ -54,7 +53,7 @@ actions are: SET;; change the value of certain variables in the UPS - FSD;; set the forced shutdown flag in the UPS. This is + FSD;; set the forced shutdown flag in the UPS. This is equivalent to an "on battery + low battery" situation for the purposes of monitoring. @@ -73,7 +72,7 @@ of most of the known command names. *upsmon*:: Add the necessary actions for a upsmon process to work. This is either -set to "primary" or "secondary". +set to "master" or "slave". + Do not attempt to assign actions to upsmon by hand, as you may miss something important. This method of designating a "upsmon user" was @@ -85,8 +84,7 @@ SEE ALSO linkman:upsd[8], linkman:upsd.conf[5] -Internet resources: -~~~~~~~~~~~~~~~~~~~ - +INTERNET RESOURCES +------------------ The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsdrvctl.8 b/docs/man/upsdrvctl.8 index a3a2ccc..5d85226 100644 --- a/docs/man/upsdrvctl.8 +++ b/docs/man/upsdrvctl.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsdrvctl -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "UPSDRVCTL" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSDRVCTL" "8" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -39,8 +39,6 @@ upsdrvctl \- UPS driver controller \fBupsdrvctl\fR provides a uniform interface for controlling your UPS drivers\&. You should use upsdrvctl instead of direct calls to the drivers whenever possible\&. .sp When used properly, upsdrvctl lets you maintain identical startup scripts across multiple systems with different UPS configurations\&. -.sp -Note: For operating systems with service management frameworks, such as Solaris SMF or Linux systemd, the \fBupsdrvsvcctl\fR may be a better choice\&. .SH "OPTIONS" .PP \fB\-h\fR @@ -80,25 +78,13 @@ This may be set in ups\&.conf with "user" in the global section\&. .RS 4 Raise the debug level\&. Use this multiple times for additional details\&. .RE -.PP -\fB\-d\fR -.RS 4 -Pass the selected debug level from -upsdrvctl -to launched drivers\&. -.RE .SH "COMMANDS" .sp upsdrvctl supports three commands \- start, stop and shutdown\&. They take an optional argument which is a UPS name from \fBups.conf\fR(5)\&. Without that argument, they operate on every UPS that is currently configured\&. .PP \fBstart\fR .RS 4 -Start the UPS driver(s)\&. In case of failure, further attempts may be executed by using the -\fImaxretry\fR -and -\fIretrydelay\fR -options \- see -\fBups.conf\fR(5)\&. +Start the UPS driver(s)\&. .RE .PP \fBstop\fR @@ -127,22 +113,6 @@ Command the UPS driver(s) to run their shutdown sequence\&. Drivers are stopped this will probably power off your computers, so don\(cqt play around with this option\&. Only use it when your systems are prepared to lose power\&. .sp .5v .RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -refer to \fBups.conf\fR(5) for using the \fBnowait\fR parameter\&. -.sp .5v -.RE .SH "ENVIRONMENT VARIABLES" .sp \fBNUT_CONFPATH\fR is the path name of the directory that contains upsd\&.conf and other configuration files\&. If this variable is not set, \fBupsdrvctl\fR the driver use a built\-in default, which is often /usr/local/ups/etc\&. @@ -151,7 +121,7 @@ refer to \fBups.conf\fR(5) for using the \fBnowait\fR parameter\&. upsdrvctl will return a nonzero exit code if it encounters an error while performing the desired operation\&. This will also happen if a driver takes longer than the \fImaxstartdelay\fR period to enter the background\&. .SH "SEE ALSO" .sp -\fBupsdrvsvcctl\fR(8), \fBnutupsdrv\fR(8), \fBupsd\fR(8), \fBups.conf\fR(5) +\fBnutupsdrv\fR(8), \fBupsd\fR(8), \fBups.conf\fR(5) .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsdrvctl.txt b/docs/man/upsdrvctl.txt index 46ec658..f19fd77 100644 --- a/docs/man/upsdrvctl.txt +++ b/docs/man/upsdrvctl.txt @@ -1,4 +1,4 @@ -UPSDRVCTL(8) +UPSDRVCTL(8) ============ NAME @@ -8,7 +8,6 @@ upsdrvctl - UPS driver controller SYNOPSIS -------- - *upsdrvctl* -h *upsdrvctl* ['OPTIONS'] {start | stop | shutdown} ['ups'] @@ -23,9 +22,6 @@ whenever possible. When used properly, upsdrvctl lets you maintain identical startup scripts across multiple systems with different UPS configurations. -Note: For operating systems with service management frameworks, such as -Solaris SMF or Linux systemd, the *upsdrvsvcctl* may be a better choice. - OPTIONS ------- @@ -58,9 +54,6 @@ This may be set in ups.conf with "user" in the global section. *-D*:: Raise the debug level. Use this multiple times for additional details. -*-d*:: -Pass the selected debug level from `upsdrvctl` to launched drivers. - COMMANDS -------- @@ -70,8 +63,7 @@ Without that argument, they operate on every UPS that is currently configured. *start*:: -Start the UPS driver(s). In case of failure, further attempts may be executed -by using the 'maxretry' and 'retrydelay' options - see linkman:ups.conf[5]. +Start the UPS driver(s). *stop*:: Stop the UPS driver(s). @@ -84,8 +76,6 @@ WARNING: this will probably power off your computers, so don't play around with this option. Only use it when your systems are prepared to lose power. -NOTE: refer to linkman:ups.conf[5] for using the *nowait* parameter. - ENVIRONMENT VARIABLES --------------------- @@ -104,10 +94,8 @@ background. SEE ALSO -------- - -linkman:upsdrvsvcctl[8], linkman:nutupsdrv[8], linkman:upsd[8], linkman:ups.conf[5] +linkman:nutupsdrv[8], linkman:upsd[8], linkman:ups.conf[5] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsdrvsvcctl.8 b/docs/man/upsdrvsvcctl.8 deleted file mode 100644 index c436e6c..0000000 --- a/docs/man/upsdrvsvcctl.8 +++ /dev/null @@ -1,206 +0,0 @@ -'\" t -.\" Title: upsdrvsvcctl -.\" Author: [see the "AUTHOR" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 -.\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 -.\" Language: English -.\" -.TH "UPSDRVSVCCTL" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" -.\" ----------------------------------------------------------------- -.\" * Define some portability stuff -.\" ----------------------------------------------------------------- -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.\" http://bugs.debian.org/507673 -.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html -.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -.ie \n(.g .ds Aq \(aq -.el .ds Aq ' -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.\" ----------------------------------------------------------------- -.\" * MAIN CONTENT STARTS HERE * -.\" ----------------------------------------------------------------- -.SH "NAME" -upsdrvsvcctl \- UPS driver service instance controller -.SH "SYNOPSIS" -.sp -\fBupsdrvsvcctl\fR \-h -.sp -\fBupsdrvsvcctl\fR [\fIOPTIONS\fR] {start | stop } [\fIups\fR] -.SH "DESCRIPTION" -.sp -\fBupsdrvsvcctl\fR provides a uniform interface for controlling your UPS drivers wrapped into service instances on platforms which support that (currently this covers Linux distributions with systemd and systems derived from Solaris 10 codebase, including proprietary Sun/Oracle Solaris and numerous open\-source illumos distributions with SMF)\&. It may be not installed in packaging for other operating systems\&. -.sp -When used properly, upsdrvsvcctl lets you maintain identical startup scripts across multiple systems with different UPS configurations\&. -.sp -The goal of this solution is to allow the services of \fBupsd\fR data server to start up even if some of the power devices are currently not accessible, and for NUT drivers to be automatically restarted by the system in case of problems (driver bug, startup failure)\&. It also allows for faster startup of systems which monitor several devices, by letting each driver to start in parallel with others, and not with a sequential loop like was done previously\&. -.sp -Independent service instances for each NUT driver also allow one to configure further dependencies, such as that networking must be available for SNMP and similar drivers (but is not needed for local\-medium drivers such as serial or USB)\&. -.sp -The old monolithic "all or nothing" solution requiring that all drivers must be running, which sufficed for deployments with a few UPSes, did not really work well for monitoring larger deployments\&. It was also not easy to strike a pre\-packaged balance between early UPS protection for USB/serial home setups vs\&. waiting for network on larger ones\&. -.sp -\fBupsdrvsvcctl\fR is a script which mimics the operation of \fBupsdrvctl\fR program (where possible) to provide similar end\-user experience when manipulating drivers wrapped into service instances rather than as directly executed daemons\&. It relies on \fBnut\-driver\-enumerator\&.sh\fR for a large part of actual operations\&. -.sp -You should use upsdrvsvcctl instead of direct calls to the drivers and daemon\-based management with \fBupsdrvctl\fR whenever possible (that is, for "production" use on compatible OSes)\&. Otherwise (testing, other OSes) the \fBupsdrvctl\fR is a recommended option\&. -.SH "OPTIONS" -.PP -\fB\-h\fR -.RS 4 -Display the help text\&. -.RE -.PP -\fB\-t\fR -.RS 4 -Enable testing mode\&. Testing mode makes upsdrvsvcctl display the actions it would execute without actually doing them\&. -.RE -.SH "OPTIONS OF UPSDRVCTL NOT (CURRENTLY) APPLICABLE TO UPSDRVSVCCTL" -.sp -Options like \fI\-r\fR, \fI\-u\fR or \fI\-D\fR could be handled by properties of the service instances themselves, with this script helping to configure them (assuming proper privileges of the user who called it)\&. This is not a "production" use case, though, to change such options on a configured system \(em so for experiments and troubleshooting, it may be better to stop the service instance and play with \fBupsdrvctl\fR directly\&. -.PP -\fB\-r\fR \fIdirectory\fR -.RS 4 -If starting a driver, this value will direct it to -\fBchroot\fR(2) into -\fIdirectory\fR\&. This can be useful when securing systems\&. -.RE -.sp -This may be set in the ups\&.conf with "chroot" in the global section\&. -.PP -\fB\-u\fR \fIusername\fR -.RS 4 -If starting a driver, this value will direct it to -\fBsetuid\fR(2) to the user id associated with -\fIusername\fR\&. -.RE -.sp -If the driver is started as root without specifying this value, it will use the username that was compiled into the binary\&. This defaults to "nobody", and is far from ideal\&. -.sp -This may be set in ups\&.conf with "user" in the global section\&. -.PP -\fB\-D\fR -.RS 4 -Raise the driver debug level\&. Use this multiple times for additional details\&. -.RE -.SH "COMMANDS" -.sp -\fBupsdrvsvcctl\fR supports three of the commands processed by \fBupsdrvctl\fR \(em start, stop and shutdown\&. They take an optional argument which is a UPS name from \fBups.conf\fR(5)\&. Without that argument, they operate on every UPS that is currently configured\&. -.sp -Note: shutdown is currently supported by stopping the driver service instances to release the potentially held ports etc\&., calling the \fBupsdrvctl\fR directly for issuing the shutdown command, and restarting the driver service instances to reconnect when the device comes back online\&. -.PP -\fBstart\fR -.RS 4 -Start the UPS driver(s)\&. In case of failure, further attempts may be executed by using the -\fImaxretry\fR -and -\fIretrydelay\fR -options \- see -\fBups.conf\fR(5)\&. -.RE -.PP -\fBstop\fR -.RS 4 -Stop the UPS driver(s)\&. -.RE -.sp -\fBupsdrvsvcctl\fR also supports further operations for troubleshooting the mapping of NUT driver section names to the service instance names (which may differ due to limitations of various systems)\&. -.PP -\fBlist\fR -.RS 4 -list the currently active mapping of service instances to device sections -.RE -.PP -\fBresync\fR -.RS 4 -update the mapping of service instances for NUT drivers to device section names used in -\fIups\&.conf\fR -(register new instances, tear down obsoleted ones)\&. -.RE -.SH "COMMANDS OF UPSDRVCTL NOT (CURRENTLY) APPLICABLE TO UPSDRVSVCCTL" -.PP -\fBshutdown\fR -.RS 4 -Command the UPS driver(s) to run their shutdown sequence\&. Drivers are stopped according to their sdorder value \- see -\fBups.conf\fR(5)\&. -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBWarning\fR -.ps -1 -.br -.sp -this will probably power off your computers, so don\(cqt play around with this option\&. Only use it when your systems are prepared to lose power\&. -.sp .5v -.RE -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -.sp -refer to \fBups.conf\fR(5) for using the \fBnowait\fR parameter\&. -.sp .5v -.RE -.SH "ENVIRONMENT VARIABLES" -.sp -\fBNUT_CONFPATH\fR is the path name of the directory that contains upsd\&.conf and other configuration files\&. If this variable is not set, \fBupsdrvsvcctl\fR (or rather \fBnut\-driver\-enumerator\&.sh\fR) would use a built\-in default, which is often /usr/local/ups/etc\&. -.SH "DIAGNOSTICS" -.sp -upsdrvsvcctl will return a nonzero exit code if it encounters an error while performing the desired operation\&. This will also happen if a driver takes longer than the \fImaxstartdelay\fR period to enter the background\&. -.sp -Any messages issued by the \fBupsdrvctl\fR program used to start the NUT drivers as part of the service instances\*(Aq implementations, or by the drivers themselves, will be logged by the service management framework facilities and will not appear in your interactive terminal used to manage the driver\&. -.sp -Use upsdrvsvcctl list or upsdrvsvcctl list NUT\-device to find out the service instance name for the NUT driver (section name) you are interested in\&. Then look up the service logs (where the outputs of the service implementation program as well as the framework messages about this service are stored), as suggested below: -.PP -\fBLinux systemd\fR -.RS 4 -Messages will normally be kept in the service journal, so: -.sp -.if n \{\ -.RS 4 -.\} -.nf -journalctl \-lu nut\-driver@instance\-name -.fi -.if n \{\ -.RE -.\} -.RE -.sp -Note that your local system configuration may be impacted by such nuances as passing the journal data to a standard syslog server, and/or by having a small cache for locally stored journal messages (so older entries would disappear)\&. There may also be or not be a copy of the journals stored in the filesystem\&. -.PP -\fBSolaris SMF\fR -.RS 4 -Look for -/var/svc/log/system\-power\-nut\-driver:instance\-name\&.log -file\&. -.RE -.SH "AUTHOR" -.sp -Jim Klimov -.SH "SEE ALSO" -.sp -\fBupsdrvctl\fR(8), \fBnutupsdrv\fR(8), \fBupsd\fR(8), \fBnut-driver-enumerator\fR(8), \fBups.conf\fR(5) -.SS "Internet resources:" -.sp -The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsdrvsvcctl.txt b/docs/man/upsdrvsvcctl.txt deleted file mode 100644 index fdace1f..0000000 --- a/docs/man/upsdrvsvcctl.txt +++ /dev/null @@ -1,205 +0,0 @@ -UPSDRVSVCCTL(8) -=============== - -NAME ----- - -upsdrvsvcctl - UPS driver service instance controller - -SYNOPSIS --------- - -*upsdrvsvcctl* -h - -*upsdrvsvcctl* ['OPTIONS'] {start | stop } ['ups'] - -DESCRIPTION ------------ - -*upsdrvsvcctl* provides a uniform interface for controlling your UPS -drivers wrapped into service instances on platforms which support that -(currently this covers Linux distributions with systemd and systems -derived from Solaris 10 codebase, including proprietary Sun/Oracle -Solaris and numerous open-source illumos distributions with SMF). -It may be not installed in packaging for other operating systems. - -When used properly, upsdrvsvcctl lets you maintain identical startup -scripts across multiple systems with different UPS configurations. - -The goal of this solution is to allow the services of *upsd* data -server to start up even if some of the power devices are currently -not accessible, and for NUT drivers to be automatically restarted -by the system in case of problems (driver bug, startup failure). -It also allows for faster startup of systems which monitor several -devices, by letting each driver to start in parallel with others, -and not with a sequential loop like was done previously. - -Independent service instances for each NUT driver also allow one -to configure further dependencies, such as that networking must be -available for SNMP and similar drivers (but is not needed for -local-medium drivers such as serial or USB). - -The old monolithic "all or nothing" solution requiring that all -drivers must be running, which sufficed for deployments with a few -UPSes, did not really work well for monitoring larger deployments. -It was also not easy to strike a pre-packaged balance between early -UPS protection for USB/serial home setups vs. waiting for network -on larger ones. - -*upsdrvsvcctl* is a script which mimics the operation of *upsdrvctl* -program (where possible) to provide similar end-user experience when -manipulating drivers wrapped into service instances rather than as -directly executed daemons. It relies on *nut-driver-enumerator.sh* -for a large part of actual operations. - -You should use upsdrvsvcctl instead of direct calls to the drivers -and daemon-based management with *upsdrvctl* whenever possible (that -is, for "production" use on compatible OSes). Otherwise (testing, -other OSes) the *upsdrvctl* is a recommended option. - -OPTIONS -------- - -*-h*:: -Display the help text. - -*-t*:: -Enable testing mode. Testing mode makes upsdrvsvcctl display the actions -it would execute without actually doing them. - - - -OPTIONS OF UPSDRVCTL NOT (CURRENTLY) APPLICABLE TO UPSDRVSVCCTL ---------------------------------------------------------------- - -Options like '-r', '-u' or '-D' could be handled by properties of the -service instances themselves, with this script helping to configure -them (assuming proper privileges of the user who called it). This is -not a "production" use case, though, to change such options on a -configured system -- so for experiments and troubleshooting, it may -be better to stop the service instance and play with *upsdrvctl* -directly. - -*-r* 'directory':: -If starting a driver, this value will direct it to *chroot*(2) into -'directory'. This can be useful when securing systems. - -This may be set in the ups.conf with "chroot" in the global section. - -*-u* 'username':: -If starting a driver, this value will direct it to *setuid*(2) to -the user id associated with 'username'. - -If the driver is started as root without specifying this value, it will -use the username that was compiled into the binary. This defaults to -"nobody", and is far from ideal. - -This may be set in ups.conf with "user" in the global section. - -*-D*:: -Raise the driver debug level. Use this multiple times for additional -details. - -COMMANDS --------- - -*upsdrvsvcctl* supports three of the commands processed by *upsdrvctl* -- -start, stop and shutdown. They take an optional argument which is a UPS -name from linkman:ups.conf[5]. Without that argument, they operate on -every UPS that is currently configured. - -Note: shutdown is currently supported by stopping the driver service -instances to release the potentially held ports etc., calling the -*upsdrvctl* directly for issuing the shutdown command, and restarting -the driver service instances to reconnect when the device comes back -online. - -*start*:: -Start the UPS driver(s). In case of failure, further attempts may be executed -by using the 'maxretry' and 'retrydelay' options - see linkman:ups.conf[5]. - -*stop*:: -Stop the UPS driver(s). - -*upsdrvsvcctl* also supports further operations for troubleshooting the -mapping of NUT driver section names to the service instance names (which -may differ due to limitations of various systems). - -*list*:: -list the currently active mapping of service instances to device sections - -*resync*:: -update the mapping of service instances for NUT drivers to device section -names used in 'ups.conf' (register new instances, tear down obsoleted ones). - - -COMMANDS OF UPSDRVCTL NOT (CURRENTLY) APPLICABLE TO UPSDRVSVCCTL ----------------------------------------------------------------- - -*shutdown*:: -Command the UPS driver(s) to run their shutdown sequence. Drivers are -stopped according to their sdorder value - see linkman:ups.conf[5]. - -WARNING: this will probably power off your computers, so don't -play around with this option. Only use it when your systems are prepared -to lose power. - -NOTE: refer to linkman:ups.conf[5] for using the *nowait* parameter. - -ENVIRONMENT VARIABLES ---------------------- - -*NUT_CONFPATH* is the path name of the directory that contains -`upsd.conf` and other configuration files. If this variable is not set, -*upsdrvsvcctl* (or rather *nut-driver-enumerator.sh*) would use a built-in -default, which is often `/usr/local/ups/etc`. - -DIAGNOSTICS ------------ - -upsdrvsvcctl will return a nonzero exit code if it encounters an error -while performing the desired operation. This will also happen if a -driver takes longer than the 'maxstartdelay' period to enter the -background. - -Any messages issued by the *upsdrvctl* program used to start the NUT -drivers as part of the service instances' implementations, or by the -drivers themselves, will be logged by the service management framework -facilities and will not appear in your interactive terminal used to -manage the driver. - -Use `upsdrvsvcctl list` or `upsdrvsvcctl list NUT-device` to find out -the service instance name for the NUT driver (section name) you are -interested in. Then look up the service logs (where the outputs of the -service implementation program as well as the framework messages about -this service are stored), as suggested below: - -*Linux systemd*:: -Messages will normally be kept in the service journal, so: - - journalctl -lu nut-driver@instance-name - -Note that your local system configuration may be impacted by such -nuances as passing the journal data to a standard syslog server, -and/or by having a small cache for locally stored journal messages -(so older entries would disappear). There may also be or not be a -copy of the journals stored in the filesystem. - -*Solaris SMF*:: -Look for `/var/svc/log/system-power-nut-driver:instance-name.log` file. - -AUTHOR ------- - -Jim Klimov - -SEE ALSO --------- - -linkman:upsdrvctl[8], linkman:nutupsdrv[8], linkman:upsd[8], -linkman:nut-driver-enumerator[8], linkman:ups.conf[5] - -Internet resources: -~~~~~~~~~~~~~~~~~~~ - -The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsimage.cgi.8 b/docs/man/upsimage.cgi.8 index 629f573..cae7201 100644 --- a/docs/man/upsimage.cgi.8 +++ b/docs/man/upsimage.cgi.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsimage.cgi -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSIMAGE\&.CGI" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSIMAGE\&.CGI" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -64,26 +64,6 @@ upsstats will only talk to \fBupsd\fR(8) servers that have been defined in your \fBupsd\fR(8), \fBupsstats.cgi\fR(8) .SS "Internet resources:" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The NUT (Network UPS Tools) home page: -http://www\&.networkupstools\&.org/ -.RE +The gd home page: http://www\&.boutell\&.com/gd/ .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -The gd home page: -http://libgd\&.bitbucket\&.org -.RE +The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upsimage.cgi.txt b/docs/man/upsimage.cgi.txt index bdf23b8..1118bd2 100644 --- a/docs/man/upsimage.cgi.txt +++ b/docs/man/upsimage.cgi.txt @@ -45,5 +45,6 @@ linkman:upsd[8], linkman:upsstats.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ -* The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ -* The gd home page: http://libgd.bitbucket.org +The gd home page: http://www.boutell.com/gd/ + +The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upslog.8 b/docs/man/upslog.8 index 976741f..10d260e 100644 --- a/docs/man/upslog.8 +++ b/docs/man/upslog.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upslog -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSLOG" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSLOG" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -115,17 +115,7 @@ library\&. .RS 4 Store the results in this file\&. .sp -You can use "\-" for stdout, but upslog will remain in the foreground by default\&. -.RE -.PP -\fB\-F\fR -.RS 4 -upslog will run in the foreground, regardless of logging target\&. -.RE -.PP -\fB\-B\fR -.RS 4 -upslog will run in the background, regardless of logging target\&. +You can use "\-" for stdout, but upslog will remain in the foreground\&. .RE .PP \fB\-s\fR \fIups\fR @@ -136,7 +126,7 @@ upsname[@hostname[:port]]\&. The default hostname is "localhost"\&. .PP \fB\-u\fR \fIusername\fR .RS 4 -If started as root, upslog will +If started as root, upsmon will \fBsetuid\fR(2) to the user id associated with \fIusername\fR for security\&. @@ -148,9 +138,6 @@ is not defined, it will use the value that was compiled into the program\&. This .SH "SERVICE DELAYS" .sp The interval value is merely the number given to \fBsleep\fR(3) after running through the format string\&. Therefore, a query will actually take slightly longer than the interval, depending on the speed of your system\&. -.SH "ON\-DEMAND LOGGING" -.sp -Sending a USR1 signal to a running \fBupslog\fR process makes it wake from the current sleep and log immediately\&. This is useful when triggered from a \fBupssched\fR event trigger (e\&.g\&. AT ONBATT or AT ONLINE) to ensure that an entry always exists, even if the power goes away for a period of time shorter than that specified by the \-i argument\&. .SH "LOG ROTATION" .sp \fBupslog\fR writes its PID to upslog\&.pid, and will reopen the log file if you send it a SIGHUP\&. This allows it to keep running when the log is rotated by an external program\&. @@ -160,7 +147,7 @@ Sending a USR1 signal to a running \fBupslog\fR process makes it wake from the c \fBupsd\fR(8) .SS "Clients:" .sp -\fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8), \fBupsmon\fR(8), \fBupssched\fR(8) +\fBupsc\fR(8), \fBupscmd\fR(8), \fBupsrw\fR(8), \fBupsmon\fR(8) .SS "Internet resources:" .sp The NUT (Network UPS Tools) home page: http://www\&.networkupstools\&.org/ diff --git a/docs/man/upslog.txt b/docs/man/upslog.txt index f405104..b3603d8 100644 --- a/docs/man/upslog.txt +++ b/docs/man/upslog.txt @@ -37,7 +37,7 @@ within this string are: %TIME format%;; Insert the time with strftime formatting -%ETIME%;; Insert the number of seconds, ala time_t. This is now a +%ETIME%;; Insert the number of seconds, ala time_t. This is now a 10 digit number. %HOST%;; insert the local hostname @@ -50,8 +50,8 @@ within this string are: The default format string is: - %TIME @Y@m@d @H@M@S% %VAR battery.charge% %VAR input.voltage% - %VAR ups.load% [%VAR ups.status%] %VAR ups.temperature% + %TIME @Y@m@d @H@M@S% %VAR battery.charge% %VAR input.voltage% + %VAR ups.load% [%VAR ups.status%] %VAR ups.temperature% %VAR input.frequency% *-i* 'interval':: @@ -65,23 +65,16 @@ the linkman:upsclient[3] library. Store the results in this file. + -You can use "-" for stdout, but upslog will remain in the foreground -by default. - -*-F*:: -upslog will run in the foreground, regardless of logging target. - -*-B*:: -upslog will run in the background, regardless of logging target. +You can use "-" for stdout, but upslog will remain in the foreground. *-s* 'ups':: -Monitor this UPS. The format for this option is +Monitor this UPS. The format for this option is +upsname[@hostname[:port]]+. The default hostname is "localhost". *-u* 'username':: -If started as root, upslog will *setuid*(2) to the user id -associated with 'username' for security. +If started as root, upsmon will *setuid*(2) to the user id +associated with 'username' for security. + If 'username' is not defined, it will use the value that was compiled into the program. This defaults to "nobody", which is less than ideal. @@ -93,16 +86,6 @@ The interval value is merely the number given to *sleep*(3) after running through the format string. Therefore, a query will actually take slightly longer than the interval, depending on the speed of your system. -ON-DEMAND LOGGING ------------------ - -Sending a USR1 signal to a running *upslog* process makes it wake from the -current sleep and log immediately. This is useful when triggered from a -*upssched* event trigger (e.g. `AT ONBATT` or `AT ONLINE`) to ensure that an -entry always exists, even if the power goes away for a period of time shorter -than that specified by the `-i` argument. - - LOG ROTATION ------------ @@ -115,16 +98,13 @@ SEE ALSO Server: ~~~~~~~ - linkman:upsd[8] Clients: ~~~~~~~~ - linkman:upsc[8], linkman:upscmd[8], -linkman:upsrw[8], linkman:upsmon[8], linkman:upssched[8] +linkman:upsrw[8], linkman:upsmon[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsmon.8 b/docs/man/upsmon.8 index aa222bb..2466689 100644 --- a/docs/man/upsmon.8 +++ b/docs/man/upsmon.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsmon -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSMON" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSMON" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -33,14 +33,14 @@ upsmon \- UPS monitor and shutdown controller .sp \fBupsmon\fR \-h .sp -\fBupsmon\fR \-c \fIcommand\fR [\-P \fIpid\fR] +\fBupsmon\fR \-c \fIcommand\fR .sp -\fBupsmon\fR [\-D] [\-F | \-B] [\-K] [\-p] [\-u \fIuser\fR] +\fBupsmon\fR [\-D] [\-K] [\-p] [\-u \fIuser\fR] .SH "DESCRIPTION" .sp \fBupsmon\fR is the client process that is responsible for the most important part of UPS monitoring\(emshutting down the system when the power goes out\&. It can call out to other helper programs for notification purposes during power events\&. .sp -upsmon can monitor multiple systems using a single process\&. Every UPS that is defined in the \fBupsmon.conf\fR(5) configuration file is assigned a power value and a type (\fBprimary\fR or \fBsecondary\fR)\&. +upsmon can monitor multiple systems using a single process\&. Every UPS that is defined in the \fBupsmon.conf\fR(5) configuration file is assigned a power value and a type (\fBslave\fR or \fBmaster\fR)\&. .SH "OPTIONS" .PP \fB\-h\fR @@ -56,7 +56,7 @@ to the existing upsmon process\&. Valid commands are: .PP \fBfsd\fR .RS 4 -shutdown all primary\-mode UPSes (use with caution) +shutdown all master UPSes (use with caution) .RE .PP \fBstop\fR @@ -72,26 +72,9 @@ configuration file\&. See "reloading nuances" below if this doesn\(cqt work\&. .RE .RE .PP -\fB\-P\fR \fIpid\fR -.RS 4 -Send the command signal above using specified PID number, rather than consulting the PID file\&. This can help define service units which start main -upsmon -as a foreground process so it does not have to rely on a PID file\&. -.RE -.PP \fB\-D\fR .RS 4 -Raise the debugging level\&. upsmon will run in the foreground by default, and will print information on stdout about the monitoring process\&. Use this option multiple times for more details\&. -.RE -.PP -\fB\-F\fR -.RS 4 -upsmon will run in the foreground, regardless of debugging settings\&. -.RE -.PP -\fB\-B\fR -.RS 4 -upsmon will run in the background, regardless of debugging settings\&. +Raise the debugging level\&. upsmon will run in the foreground and prints information on stdout about the monitoring process\&. Use this multiple times for more details\&. .RE .PP \fB\-K\fR @@ -172,7 +155,7 @@ The \fIpowervalue\fR refers to how many power supplies on this system are being .sp The \fIusername\fR is a section in your \fBupsd.users\fR(5) file\&. Whatever password you set in that section must match the \fIpassword\fR set in this file\&. .sp -The type set in that section must also match the \fItype\fR here \(em \fBprimary\fR or \fBsecondary\fR\&. In general, a primary process is one running on the system with the UPS actually plugged into a serial port, and a secondary is drawing power from the UPS but can\(cqt talk to it directly\&. See the section on UPS types for more\&. +The type set in that section must also match the \fItype\fR here\-\- \fBmaster\fR or \fBslave\fR\&. In general, a master process is one running on the system with the UPS actually plugged into a serial port, and a slave is drawing power from the UPS but can\(cqt talk to it directly\&. See the section on UPS types for more\&. .SH "NOTIFY EVENTS" .sp \fBupsmon\fR senses several events as it monitors each UPS\&. They are called notify events as they can be used to tell the users and admins about the change in status\&. See the additional NOTIFY\-related sections below for information on customizing the delivery of these messages\&. @@ -231,9 +214,9 @@ NOTIFYCMD "/usr/local/bin/notifyme" .sp Remember to wrap the path in "quotes" if it contains any spaces\&. .sp -The program you run as your NOTIFYCMD can use the environment variables NOTIFYTYPE and UPSNAME to know what has happened and on which UPS\&. It also receives the notification message (see below) as the first (and only) argument, so you can deliver a pre\-formatted message too\&. +The program you run as your NOTIFYCMD can use the environment variables NOTIFYTYPE and UPSNAME to know what has happened and on which UPS\&. It also receives the notification message (see below) as the first (and only) argument, so you can deliver a preformatted message too\&. .sp -Note that the NOTIFYCMD will only be called for a given event when you set the EXEC flag by using the notify flags, as detailed below\&. +Note that the NOTIFYCMD will only be called for a given event when you set the EXEC flag by using the notify flags, below: .SH "NOTIFY FLAGS" .sp By default, all notify events (see above) generate a global message (wall) to all users, plus they are logged via the syslog\&. You can change this with the NOTIFYFLAG directive in the configuration file: @@ -250,6 +233,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + NOTIFYFLAG ONLINE SYSLOG .RE .sp @@ -261,6 +245,7 @@ NOTIFYFLAG ONLINE SYSLOG .sp -1 .IP \(bu 2.3 .\} + NOTIFYFLAG ONBATT SYSLOG+WALL .RE .sp @@ -272,6 +257,7 @@ NOTIFYFLAG ONBATT SYSLOG+WALL .sp -1 .IP \(bu 2.3 .\} + NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC .RE .sp @@ -315,6 +301,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + NOTIFYMSG ONLINE "UPS %s is getting line power" .RE .sp @@ -340,17 +327,17 @@ MONITOR \fIupsname\fR \fIpowervalue\fR \fIusername\fR \fIpassword\fR \fItype\fR .sp Normally, you only have one power supply, so it will be set to 1\&. .sp -MONITOR myups@myhost 1 username mypassword primary +MONITOR myups@myhost 1 username mypassword master .sp On a large server with redundant power supplies, the power value for a UPS may be greater than 1\&. You may also have more than one of them defined\&. .sp -MONITOR ups\-alpha@myhost 2 username mypassword primary +MONITOR ups\-alpha@myhost 2 username mypassword master .sp -MONITOR ups\-beta@myhost 2 username mypassword primary +MONITOR ups\-beta@myhost 2 username mypassword master .sp -You can also set the power value for a UPS to 0 if it does not supply any power to that system\&. This is generally used when you want to use the upsmon notification features for a UPS even though it\(cqs not actually running the system that hosts upsmon\&. Don\(cqt set this to "primary" unless you really want to power this UPS off when this instance of upsmon needs to shut down for its own reasons\&. +You can also set the power value for a UPS to 0 if it does not supply any power to that system\&. This is generally used when you want to use the upsmon notification features for a UPS even though it\(cqs not actually running the system that hosts upsmon\&. Don\(cqt set this to "master" unless you really want to power this UPS off when this instance of upsmon needs to shut down for its own reasons\&. .sp -MONITOR faraway@anotherbox 0 username mypassword secondary +MONITOR faraway@anotherbox 0 username mypassword slave .sp The "minimum power value" is the number of power supplies that must be receiving power in order to keep the computer running\&. .sp @@ -367,13 +354,13 @@ MINSUPPLIES 3 When the current overall power value drops below the minimum power value, upsmon starts the shutdown sequence\&. This design allows you to lose some of your power supplies in a redundant power environment without bringing down the entire system while still working properly for smaller systems\&. .SH "UPS TYPES" .sp -\fBupsmon\fR and \fBupsd\fR(8) don\(cqt always run on the same system\&. When they do, any UPSes that are directly attached to the upsmon host should be monitored in "primary" mode\&. This makes upsmon take charge of that equipment, and it will wait for the "secondary" systems to disconnect before shutting down the local system\&. This allows the distant systems (monitoring over the network) to shut down cleanly before upsdrvctl shutdown runs and turns them all off\&. +\fBupsmon\fR and \fBupsd\fR(8) don\(cqt always run on the same system\&. When they do, any UPSes that are directly attached to the upsmon host should be monitored in "master" mode\&. This makes upsmon take charge of that equipment, and it will wait for slaves to disconnect before shutting down the local system\&. This allows the distant systems (monitoring over the network) to shut down cleanly before upsdrvctl shutdown runs and turns them all off\&. .sp -When upsmon runs as a secondary, it is relying on the distant system to tell it about the state of the UPS\&. When that UPS goes critical (on battery and low battery), it immediately invokes the local shutdown command\&. This needs to happen quickly\&. Once all secondaries disconnect from the distant \fBupsd\fR(8) server, its primary\-mode upsmon will start its own shutdown process\&. Your secondary systems must all quiesce and shut down before the primary turns off the shared power source, or filesystem damage may result\&. +When upsmon runs as a slave, it is relying on the distant system to tell it about the state of the UPS\&. When that UPS goes critical (on battery and low battery), it immediately invokes the local shutdown command\&. This needs to happen quickly\&. Once it disconnects from the distant \fBupsd\fR(8) server, the master upsmon will start its own shutdown process\&. Your slaves must all shut down before the master turns off the power or filesystem damage may result\&. .sp -upsmon deals with secondaries that get wedged, hang, or otherwise fail to disconnect from \fBupsd\fR(8) in a timely manner with the HOSTSYNC timer\&. During a shutdown situation, the primary upsmon will give up after this interval and it will shut down anyway\&. This keeps the primary from sitting there forever (which would endanger that host) if a secondary should break somehow\&. This defaults to 15 seconds\&. +upsmon deals with slaves that get wedged, hang, or otherwise fail to disconnect from \fBupsd\fR(8) in a timely manner with the HOSTSYNC timer\&. During a shutdown situation, the master upsmon will give up after this interval and it will shut down anyway\&. This keeps the master from sitting there forever (which would endanger that host) if a slave should break somehow\&. This defaults to 15 seconds\&. .sp -If your primary system is shutting down too quickly, set the FINALDELAY interval to something greater than the default 15 seconds\&. Don\(cqt set this too high, or your UPS battery may run out of power before the primary upsmon process shuts down that system\&. +If your master system is shutting down too quickly, set the FINALDELAY interval to something greater than the default 15 seconds\&. Don\(cqt set this too high, or your UPS battery may run out of power before the master upsmon process shuts down that system\&. .SH "TIMED SHUTDOWNS" .sp For those rare situations where the shutdown process can\(cqt be completed between the time that low battery is signalled and the UPS actually powers off the load, use the \fBupssched\fR(8) helper program\&. You can use it along with upsmon to schedule a shutdown based on the "on battery" event\&. upssched can then come back to upsmon to initiate the shutdown once it has run on battery too long\&. @@ -392,14 +379,14 @@ When alpha goes on battery, your current overall power value will stay at 3, as However, if beta goes critical, subtracting its contribution will take the current overall value from 3 to 2\&. This is just high enough to satisfy the minimum, so the system will continue running as before\&. If beta returns later, it will be re\-added and the current value will go back to 3\&. This allows you to swap out UPSes, change a power configuration, or whatever, as long as you maintain the minimum power value at all times\&. .SH "MIXED OPERATIONS" .sp -Besides being able to monitor multiple UPSes, upsmon can also monitor them as different roles\&. If you have a system with multiple power supplies serviced by separate UPS batteries, it\(cqs possible to be a primary on one UPS and a secondary on the other\&. This usually happens when you run out of serial or USB ports and need to do the monitoring through another system nearby\&. +Besides being able to monitor multiple UPSes, upsmon can also monitor them as different roles\&. If you have a system with multiple power supplies serviced by separate UPS batteries, it\(cqs possible to be a master on one and a slave on the other\&. This usually happens when you run out of serial ports and need to do the monitoring through another system nearby\&. .sp This is also complicated, especially when it comes time to power down a UPS that has gone critical but doesn\(cqt supply the local system\&. You can do this with some scripting magic in your notify command script, but it\(cqs beyond the scope of this manual\&. .SH "FORCED SHUTDOWNS" .sp -When upsmon is forced to bring down the local system, it sets the "FSD" (forced shutdown) flag on any UPSes that it is running in primary mode\&. This is used to synchronize secondary systems in the event that a primary which is otherwise OK needs to be brought down due to some pressing event on the UPS manager system\&. +When upsmon is forced to bring down the local system, it sets the "FSD" (forced shutdown) flag on any UPSes that it is running in master mode\&. This is used to synchronize slaves in the event that a master UPS that is otherwise OK needs to be brought down due to some pressing event on the master\&. .sp -You can manually invoke this mode on the system with primary\-mode upsmon by starting another copy of the program with \-c fsd command line argument\&. This is useful when you want to initiate a shutdown before the critical stage through some external means, such as \fBupssched\fR(8)\&. +You can manually invoke this mode on the master upsmon by starting another copy with \-c fsd\&. This is useful when you want to initiate a shutdown before the critical stage through some external means, such as \fBupssched\fR(8)\&. .SH "DEAD UPSES" .sp In the event that upsmon can\(cqt reach \fBupsd\fR(8), it declares that UPS "dead" after some interval controlled by DEADTIME in the \fBupsmon.conf\fR(5)\&. If this happens while that UPS was last known to be on battery, it is assumed to have gone critical and no longer contributes to the overall power value\&. @@ -420,9 +407,7 @@ To test a synchronized shutdown without pulling the plug on your UPS(es), you ne .sp upsmon \-c fsd .sp -After that, the primary and the secondary will do their usual shutdown sequence as if the battery had gone critical, while you can time how long it takes for them\&. This is much easier on your UPS equipment, and it beats crawling under a desk to find the plug\&. -.sp -Note you can also use a dummy SHUTDOWNCMD setting to just report that the systems would shut down at this point, without actually disrupting their work\&. +After that, the master and the slaves will do their usual shutdown sequence as if the battery had gone critical\&. This is much easier on your UPS equipment, and it beats crawling under a desk to find the plug\&. .SH "FILES" .sp \fBupsmon.conf\fR(5) diff --git a/docs/man/upsmon.conf.5 b/docs/man/upsmon.conf.5 index 7691751..7686f4f 100644 --- a/docs/man/upsmon.conf.5 +++ b/docs/man/upsmon.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upsmon.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 11/18/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre2 .\" Language: English .\" -.TH "UPSMON\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSMON\&.CONF" "5" "11/18/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -49,7 +49,7 @@ Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT\&. Otherwise, .PP \fBFINALDELAY\fR \fIseconds\fR .RS 4 -When running in primary mode, upsmon waits this long after sending the NOTIFY_SHUTDOWN to warn the users\&. After the timer elapses, it then runs your SHUTDOWNCMD\&. By default this is set to 5 seconds\&. +When running in master mode, upsmon waits this long after sending the NOTIFY_SHUTDOWN to warn the users\&. After the timer elapses, it then runs your SHUTDOWNCMD\&. By default this is set to 5 seconds\&. .sp If you need to let your users do something in between those events, increase this number\&. Remember, at this point your UPS battery is almost depleted, so don\(cqt make this too big\&. .sp @@ -66,20 +66,20 @@ Alternatively, you can set this very low so you don\(cqt wait around when it\(cq \fBNote\fR .ps -1 .br -If FINALDELAY on the secondary is greater than HOSTSYNC on the primary, the primary will give up waiting for that secondary upsmon to disconnect\&. +If FINALDELAY on the slave is greater than HOSTSYNC on the master, the master will give up waiting for the slave to disconnect\&. .sp .5v .RE .RE .PP \fBHOSTSYNC\fR \fIseconds\fR .RS 4 -upsmon will wait up to this many seconds in primary mode for the secondaries to disconnect during a shutdown situation\&. By default, this is 15 seconds\&. +upsmon will wait up to this many seconds in master mode for the slaves to disconnect during a shutdown situation\&. By default, this is 15 seconds\&. .sp -When a UPS goes critical (on battery + low battery, or "FSD": forced shutdown), the secondary systems are supposed to disconnect and shut down right away\&. The HOSTSYNC timer keeps the primary upsmon from sitting there forever if one of the secondaries gets stuck\&. +When a UPS goes critical (on battery + low battery, or "FSD": forced shutdown), the slaves are supposed to disconnect and shut down right away\&. The HOSTSYNC timer keeps the master upsmon from sitting there forever if one of the slaves gets stuck\&. .sp -This value is also used to keep secondary systems from getting stuck if the primary fails to respond in time\&. After a UPS becomes critical, the secondary will wait up to HOSTSYNC seconds for the primary to set the FSD flag\&. If that timer expires, the secondary upsmon will assume that the primary (or communications path to it) is broken and will shut down anyway\&. +This value is also used to keep slave systems from getting stuck if the master fails to respond in time\&. After a UPS becomes critical, the slave will wait up to HOSTSYNC seconds for the master to set the FSD flag\&. If that timer expires, the slave will assume that the master is broken and will shut down anyway\&. .sp -This keeps the secondaries from shutting down during a short\-lived status change to "OB LB" and back that the secondaries see but the primary misses\&. +This keeps the slaves from shutting down during a short\-lived status change to "OB LB" that the slaves see but the master misses\&. .RE .PP \fBMINSUPPLIES\fR \fInum\fR @@ -135,11 +135,9 @@ on port "5678"\&. .sp You can set the \fIpowervalue\fR to 0 if you want to monitor a UPS that doesn\(cqt actually supply power to this system\&. This is useful when you want to have upsmon do notifications about status changes on a UPS without shutting down when it goes critical\&. .sp -The \fIusername\fR and \fIpassword\fR on this line must match an entry in the upsd server system\(cqs \fBupsd.users\fR(5) file\&. +The \fIusername\fR and \fIpassword\fR on this line must match an entry in that system\(cqs \fBupsd.users\fR(5)\&. If your username is "monmaster" and your password is "blah", the MONITOR line might look like this: .sp -If your username is "observer" and your password is "abcd", the MONITOR line might look like this (likely on a remote secondary system): -.sp -MONITOR myups@bigserver 1 observer abcd secondary +MONITOR myups@bigserver 1 monmaster blah master .sp Meanwhile, the upsd\&.users on bigserver would look like this: .sp @@ -147,31 +145,15 @@ Meanwhile, the upsd\&.users on bigserver would look like this: .RS 4 .\} .nf -[observer] - password = abcd - upsmon secondary +[monmaster] + password = blah + upsmon master # (or slave) .fi .if n \{\ .RE .\} .sp -.if n \{\ -.RS 4 -.\} -.nf -[upswired] - password = blah - upsmon primary -.fi -.if n \{\ -.RE -.\} -.sp -And the copy of upsmon on that bigserver would run with the primary configuration: -.sp -MONITOR myups@bigserver 1 upswired blah primary -.sp -The \fItype\fR refers to the relationship with \fBupsd\fR(8)\&. It can be either "primary" or "secondary"\&. See \fBupsmon\fR(8) for more information on the meaning of these modes\&. The mode you pick here also goes in the upsd\&.users file, as seen in the example above\&. +The \fItype\fR refers to the relationship with \fBupsd\fR(8)\&. It can be either "master" or "slave"\&. See \fBupsmon\fR(8) for more information on the meaning of these modes\&. The mode you pick here also goes in the upsd\&.users file, as seen in the example above\&. .PP \fBNOCOMMWARNTIME\fR \fIseconds\fR .RS 4 @@ -258,7 +240,7 @@ UPS is on battery and has a low battery (is critical) .PP FSD .RS 4 -UPS is being shutdown by the primary (FSD = "Forced Shutdown") +UPS is being shutdown by the master (FSD = "Forced Shutdown") .RE .PP COMMOK @@ -287,7 +269,7 @@ A UPS is unavailable (can\(cqt be contacted for monitoring) .RE .RE .PP -\fBNOTIFYFLAG\fR \fItype\fR \fIflag\fR[+\fIflag\fR]\&... +\fBNOTIFYFLAG\fR \fItype\fR \fIflag\fR[+\fIflag\fR][+\fIflag\fR]\&... .RS 4 By default, upsmon sends walls global messages to all logged in users) via /bin/wall and writes to the syslog when things happen\&. You can change this\&. .sp @@ -351,15 +333,13 @@ The warnings from the POLLFREQ entry about too\-high and too\-low values also ap .PP \fBPOWERDOWNFLAG\fR \fIfilename\fR .RS 4 -upsmon creates this file when running in primary mode when the UPS needs to be powered off\&. You should check for this file in your shutdown scripts and call +upsmon creates this file when running in master mode when the UPS needs to be powered off\&. You should check for this file in your shutdown scripts and call upsdrvctl shutdown if it exists\&. .sp -This is done to forcibly reset the secondary systems, so they don\(cqt get stuck at the "halted" stage even if the power returns during the shutdown process\&. This usually does not work well on contact\-closure UPSes that use the genericups driver\&. +This is done to forcibly reset the slaves, so they don\(cqt get stuck at the "halted" stage even if the power returns during the shutdown process\&. This usually does not work well on contact\-closure UPSes that use the genericups driver\&. .sp -See the config\-notes\&.txt file in the docs subdirectory for more information\&. Refer to the section: - -"Configuring automatic shutdowns for low battery events", or refer to the online version\&. +See the shutdown\&.txt file in the docs subdirectory for more information\&. .RE .PP \fBRBWARNTIME\fR \fIseconds\fR @@ -386,9 +366,9 @@ This file should not be writable by the upsmon user, as it would be possible to .PP \fBSHUTDOWNCMD\fR \fIcommand\fR .RS 4 -upsmon runs this command when the system needs to be brought down\&. If it is a secondary, it will do that immediately whenever the current overall power value drops below the MINSUPPLIES value above\&. +upsmon runs this command when the system needs to be brought down\&. If it is a slave, it will do that immediately whenever the current overall power value drops below the MINSUPPLIES value above\&. .sp -When upsmon is a primary, it will allow any secondaries to log out before starting the local shutdown procedure\&. +When upsmon is a master, it will allow any slaves to log out before starting the local shutdown procedure\&. .sp Note that the command needs to be one element in the config file\&. If your shutdown command includes spaces, then put it in quotes to keep it together, i\&.e\&.: .sp @@ -409,7 +389,7 @@ When compiled with SSL support, you can enter the certificate path here\&. .PP With NSS: .RS 4 -Certificates are stored in a dedicated database (data split in 3 files)\&. Specify the path of the database directory\&. +Certificates are stored in a dedicated database (splitted in 3 files)\&. Specify the path of the database directory\&. .RE .PP With OpenSSL: @@ -436,7 +416,7 @@ When compiled with SSL support, make upsmon verify all connections with certific .sp Without this, there is no guarantee that the upsd is the right host\&. Enabling this greatly reduces the risk of man\-in\-the\-middle attacks\&. This effectively forces the use of SSL, so don\(cqt use this unless all of your upsd hosts are ready for SSL and have their certificates in order\&. .sp -When compiled with NSS support of SSL, can be overridden for host specified with a CERTHOST directive\&. +When compiled with NSS support of SSL, can be overriden for host specified with a CERTHOST directive\&. .RE .PP \fBFORCESSL\fR \fI0 | 1\fR @@ -446,41 +426,7 @@ When compiled with SSL, specify that a secured connection must be used to commun If you don\(cqt use \fICERTVERIFY 1\fR, then this will at least make sure that nobody can sniff your sessions without a large effort\&. Setting this will make upsmon drop connections if the remote upsd doesn\(cqt support SSL, so don\(cqt use it unless all of them have it running\&. .sp -When compiled with NSS support of SSL, can be overridden for host specified with a CERTHOST directive\&. -.RE -.PP -\fBDEBUG_MIN\fR \fIINTEGER\fR -.RS 4 -Optionally specify a minimum debug level for -upsmon -daemon, e\&.g\&. for troubleshooting a deployment, without impacting foreground or background running mode directly\&. Command\-line option -\-D -can only increase this verbosity level\&. -.if n \{\ -.sp -.\} -.RS 4 -.it 1 an-trap -.nr an-no-space-flag 1 -.nr an-break-flag 1 -.br -.ps +1 -\fBNote\fR -.ps -1 -.br -if the running daemon receives a -reload -command, presence of the -DEBUG_MIN NUMBER -value in the configuration file can be used to tune debugging verbosity in the running service daemon (it is recommended to comment it away or set the minimum to explicit zero when done, to avoid huge journals and I/O system abuse)\&. Keep in mind that for this run\-time tuning, the -DEBUG_MIN -value -\fBpresent\fR -in -\fBreloaded\fR -configuration files is applied instantly and overrides any previously set value, from file or CLI options, regardless of older logging level being higher or lower than the newly found number; a missing (or commented away) value however does not change the previously active logging verbosity\&. -.sp .5v -.RE +When compiled with NSS support of SSL, can be overriden for host specified with a CERTHOST directive\&. .RE .SH "SEE ALSO" .sp diff --git a/docs/man/upsmon.conf.txt b/docs/man/upsmon.conf.txt index 1bd18ab..4ae285b 100644 --- a/docs/man/upsmon.conf.txt +++ b/docs/man/upsmon.conf.txt @@ -25,25 +25,25 @@ CONFIGURATION DIRECTIVES upsmon allows a UPS to go missing for this many seconds before declaring it "dead". The default is 15 seconds. + -upsmon requires a UPS to provide status information every few seconds +upsmon requires a UPS to provide status information every few seconds (see POLLFREQ and POLLFREQALERT) to keep things updated. If the status -fetch fails, the UPS is marked stale. If it stays stale for more than +fetch fails, the UPS is marked stale. If it stays stale for more than DEADTIME seconds, the UPS is marked dead. + A dead UPS that was last known to be on battery is assumed to have -changed to a low battery condition. This may force a shutdown if it is +changed to a low battery condition. This may force a shutdown if it is providing a critical amount of power to your system. This seems disruptive, but the alternative is barreling ahead into oblivion and crashing when you run out of power. + -Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT. +Note: DEADTIME should be a multiple of POLLFREQ and POLLFREQALERT. Otherwise, you'll have "dead" UPSes simply because upsmon isn't polling them quickly enough. Rule of thumb: take the larger of the two POLLFREQ values, and multiply by 3. *FINALDELAY* 'seconds':: -When running in primary mode, upsmon waits this long after sending the +When running in master mode, upsmon waits this long after sending the NOTIFY_SHUTDOWN to warn the users. After the timer elapses, it then runs your SHUTDOWNCMD. By default this is set to 5 seconds. + @@ -51,33 +51,32 @@ If you need to let your users do something in between those events, increase this number. Remember, at this point your UPS battery is almost depleted, so don't make this too big. + -Alternatively, you can set this very low so you don't wait around when -it's time to shut down. Some UPSes don't give much warning for low +Alternatively, you can set this very low so you don't wait around when +it's time to shut down. Some UPSes don't give much warning for low battery and will require a value of 0 here for a safe shutdown. + -NOTE: If FINALDELAY on the secondary is greater than HOSTSYNC on the -primary, the primary will give up waiting for that secondary upsmon -to disconnect. +NOTE: If FINALDELAY on the slave is greater than HOSTSYNC on the master, +the master will give up waiting for the slave to disconnect. *HOSTSYNC* 'seconds':: -upsmon will wait up to this many seconds in primary mode for the secondaries +upsmon will wait up to this many seconds in master mode for the slaves to disconnect during a shutdown situation. By default, this is 15 seconds. + When a UPS goes critical (on battery + low battery, or "FSD": forced -shutdown), the secondary systems are supposed to disconnect and shut -down right away. The HOSTSYNC timer keeps the primary upsmon from sitting -there forever if one of the secondaries gets stuck. +shutdown), the slaves are supposed to disconnect and shut down right +away. The HOSTSYNC timer keeps the master upsmon from sitting there +forever if one of the slaves gets stuck. + -This value is also used to keep secondary systems from getting stuck if -the primary fails to respond in time. After a UPS becomes critical, the -secondary will wait up to HOSTSYNC seconds for the primary to set the -FSD flag. If that timer expires, the secondary upsmon will assume that the -primary (or communications path to it) is broken and will shut down anyway. +This value is also used to keep slave systems from getting stuck if +the master fails to respond in time. After a UPS becomes critical, +the slave will wait up to HOSTSYNC seconds for the master to set the +FSD flag. If that timer expires, the slave will assume that the master +is broken and will shut down anyway. + -This keeps the secondaries from shutting down during a short-lived status -change to "OB LB" and back that the secondaries see but the primary misses. +This keeps the slaves from shutting down during a short-lived status +change to "OB LB" that the slaves see but the master misses. *MINSUPPLIES* 'num':: @@ -127,34 +126,22 @@ doesn't actually supply power to this system. This is useful when you want to have upsmon do notifications about status changes on a UPS without shutting down when it goes critical. -The 'username' and 'password' on this line must match an entry in -the `upsd` server system's linkman:upsd.users[5] file. +The 'username' and 'password' on this line must match an entry +in that system's linkman:upsd.users[5]. If your username is "monmaster" +and your password is "blah", the MONITOR line might look like this: -If your username is "observer" and your password is "abcd", the MONITOR -line might look like this (likely on a remote secondary system): - -+MONITOR myups@bigserver 1 observer abcd secondary+ ++MONITOR myups@bigserver 1 monmaster blah master+ Meanwhile, the `upsd.users` on `bigserver` would look like this: - [observer] - password = abcd - upsmon secondary - - [upswired] - password = blah - upsmon primary - -And the copy of upsmon on that bigserver would run with the primary -configuration: - -+MONITOR myups@bigserver 1 upswired blah primary+ - + [monmaster] + password = blah + upsmon master # (or slave) The 'type' refers to the relationship with linkman:upsd[8]. It can -be either "primary" or "secondary". See linkman:upsmon[8] for more -information on the meaning of these modes. The mode you pick here -also goes in the `upsd.users` file, as seen in the example above. +be either "master" or "slave". See linkman:upsmon[8] for more information +on the meaning of these modes. The mode you pick here also goes in +the `upsd.users` file, as seen in the example above. *NOCOMMWARNTIME* 'seconds':: @@ -167,7 +154,7 @@ seconds. upsmon calls this to send messages when things happen. + -This command is called with the full text of the message as one +This command is called with the full text of the message as one argument. The environment string NOTIFYTYPE will contain the type string of whatever caused this event to happen. + @@ -214,7 +201,7 @@ ONBATT;; UPS is on battery LOWBATT;; UPS is on battery and has a low battery (is critical) -FSD;; UPS is being shutdown by the primary (FSD = "Forced Shutdown") +FSD;; UPS is being shutdown by the master (FSD = "Forced Shutdown") COMMOK;; Communications established with the UPS @@ -224,13 +211,13 @@ SHUTDOWN;; The system is being shutdown REPLBATT;; The UPS battery is bad and needs to be replaced -NOCOMM;; A UPS is unavailable (can't be contacted for monitoring) +NOCOMM;; A UPS is unavailable (can't be contacted for monitoring) -*NOTIFYFLAG* 'type' 'flag'[+'flag']...:: +*NOTIFYFLAG* 'type' 'flag'[\+'flag'][+'flag']...:: By default, upsmon sends walls global messages to all logged in users) via /bin/wall and writes to the syslog when things happen. You can -change this. +change this. + Examples: + @@ -279,19 +266,16 @@ also apply here. *POWERDOWNFLAG* 'filename':: -upsmon creates this file when running in primary mode when the UPS needs +upsmon creates this file when running in master mode when the UPS needs to be powered off. You should check for this file in your shutdown scripts and call `upsdrvctl shutdown` if it exists. + -This is done to forcibly reset the secondary systems, so they don't get -stuck at the "halted" stage even if the power returns during the shutdown +This is done to forcibly reset the slaves, so they don't get stuck at +the "halted" stage even if the power returns during the shutdown process. This usually does not work well on contact-closure UPSes that use the genericups driver. + -See the config-notes.txt file in the docs subdirectory for more information. -Refer to the section: -[[UPS_shutdown]] "Configuring automatic shutdowns for low battery events", -or refer to the online version. +See the shutdown.txt file in the docs subdirectory for more information. *RBWARNTIME* 'seconds':: @@ -319,17 +303,17 @@ privileges and an impossible password. Then, tell upsmon to run as that user, and make `upsmon.conf` readable by it. Your reloads will work, and your config file will stay secure. + -This file should not be writable by the upsmon user, as it would be +This file should not be writable by the upsmon user, as it would be possible to exploit a hole, change the SHUTDOWNCMD to something malicious, then wait for upsmon to be restarted. *SHUTDOWNCMD* 'command':: upsmon runs this command when the system needs to be brought down. If -it is a secondary, it will do that immediately whenever the current -overall power value drops below the MINSUPPLIES value above. +it is a slave, it will do that immediately whenever the current overall +power value drops below the MINSUPPLIES value above. + -When upsmon is a primary, it will allow any secondaries to log out before +When upsmon is a master, it will allow any slaves to log out before starting the local shutdown procedure. + Note that the command needs to be one element in the config file. If @@ -343,7 +327,7 @@ together, i.e.: When compiled with SSL support, you can enter the certificate path here. + With NSS:;; - Certificates are stored in a dedicated database (data split in 3 files). + Certificates are stored in a dedicated database (splitted in 3 files). Specify the path of the database directory. With OpenSSL:;; Directory containing CA certificates in PEM format, used to verify @@ -368,7 +352,7 @@ must be secure. *CERTVERIFY* '0 | 1':: -When compiled with SSL support, make upsmon verify all connections with +When compiled with SSL support, make upsmon verify all connections with certificates. + Without this, there is no guarantee that the upsd is the right host. @@ -377,7 +361,7 @@ This effectively forces the use of SSL, so don't use this unless all of your upsd hosts are ready for SSL and have their certificates in order. + -When compiled with NSS support of SSL, can be overridden for host +When compiled with NSS support of SSL, can be overriden for host specified with a CERTHOST directive. *FORCESSL* '0 | 1':: @@ -390,33 +374,13 @@ that nobody can sniff your sessions without a large effort. Setting this will make upsmon drop connections if the remote upsd doesn't support SSL, so don't use it unless all of them have it running. + -When compiled with NSS support of SSL, can be overridden for host +When compiled with NSS support of SSL, can be overriden for host specified with a CERTHOST directive. -*DEBUG_MIN* 'INTEGER':: - -Optionally specify a minimum debug level for `upsmon` daemon, e.g. for -troubleshooting a deployment, without impacting foreground or background -running mode directly. Command-line option `-D` can only increase this -verbosity level. -+ -NOTE: if the running daemon receives a `reload` command, presence of the -`DEBUG_MIN NUMBER` value in the configuration file can be used to tune -debugging verbosity in the running service daemon (it is recommended to -comment it away or set the minimum to explicit zero when done, to avoid -huge journals and I/O system abuse). Keep in mind that for this run-time -tuning, the `DEBUG_MIN` value *present* in *reloaded* configuration files -is applied instantly and overrides any previously set value, from file -or CLI options, regardless of older logging level being higher or lower -than the newly found number; a missing (or commented away) value however -does not change the previously active logging verbosity. - SEE ALSO -------- - linkman:upsmon[8], linkman:upsd[8], linkman:nutupsdrv[8]. Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsmon.txt b/docs/man/upsmon.txt index cb202fc..077144d 100644 --- a/docs/man/upsmon.txt +++ b/docs/man/upsmon.txt @@ -11,9 +11,9 @@ SYNOPSIS *upsmon* -h -*upsmon* -c 'command' [-P 'pid'] +*upsmon* -c 'command' -*upsmon* [-D] [-F | -B] [-K] [-p] [-u 'user'] +*upsmon* [-D] [-K] [-p] [-u 'user'] DESCRIPTION ----------- @@ -25,7 +25,7 @@ power events. upsmon can monitor multiple systems using a single process. Every UPS that is defined in the linkman:upsmon.conf[5] configuration file is assigned -a power value and a type (*primary* or *secondary*). +a power value and a type (*slave* or *master*). OPTIONS ------- @@ -37,34 +37,22 @@ Display the help message. Send the command 'command' to the existing upsmon process. Valid commands are: -*fsd*;; shutdown all primary-mode UPSes (use with caution) +*fsd*;; shutdown all master UPSes (use with caution) *stop*;; stop monitoring and exit *reload*;; reread linkman:upsmon.conf[5] configuration file. See "reloading nuances" below if this doesn't work. -*-P* 'pid':: -Send the command signal above using specified PID number, rather than -consulting the PID file. This can help define service units which -start main `upsmon` as a foreground process so it does not have to -rely on a PID file. - *-D*:: -Raise the debugging level. upsmon will run in the foreground by default, -and will print information on stdout about the monitoring process. -Use this option multiple times for more details. - -*-F*:: -upsmon will run in the foreground, regardless of debugging settings. - -*-B*:: -upsmon will run in the background, regardless of debugging settings. +Raise the debugging level. upsmon will run in the foreground and prints +information on stdout about the monitoring process. Use this multiple +times for more details. *-K*:: Test for the shutdown flag. If it exists and contains the magic string from upsmon, then upsmon will exit with `EXIT_SUCCESS`. Any other condition -will make upsmon exit with `EXIT_FAILURE`. +will make upsmon exit with `EXIT_FAILURE`. + You can test for a successful exit from `upsmon -K` in your shutdown scripts to know when to call linkman:upsdrvctl[8] to shut down the UPS. @@ -105,7 +93,7 @@ examples follow: - "su700@mybox" means a UPS called "su700" on a system called "mybox". This is the normal form. - - "fenton@bigbox:5678" is a UPS called "fenton" on a system called + - "fenton@bigbox:5678" is a UPS called "fenton" on a system called "bigbox" which runs linkman:upsd[8] on port "5678". The 'powervalue' refers to how many power supplies on this system are @@ -114,13 +102,13 @@ on power values below. The 'username' is a section in your linkman:upsd.users[5] file. Whatever password you set in that section must match the 'password' -set in this file. +set in this file. -The type set in that section must also match the 'type' here -- -*primary* or *secondary*. In general, a primary process is one +The type set in that section must also match the 'type' here-- +*master* or *slave*. In general, a master process is one running on the system with the UPS actually plugged into a serial -port, and a secondary is drawing power from the UPS but can't -talk to it directly. See the section on UPS types for more. +port, and a slave is drawing power from the UPS but can't talk to it +directly. See the section on UPS types for more. NOTIFY EVENTS ------------- @@ -161,7 +149,7 @@ NOTIFY COMMAND -------------- In linkman:upsmon.conf[5], you can configure a program called the NOTIFYCMD -that will handle events that occur. +that will handle events that occur. +NOTIFYCMD+ "'path to program'" @@ -172,10 +160,10 @@ Remember to wrap the path in "quotes" if it contains any spaces. The program you run as your NOTIFYCMD can use the environment variables NOTIFYTYPE and UPSNAME to know what has happened and on which UPS. It also receives the notification message (see below) as the first (and -only) argument, so you can deliver a pre-formatted message too. +only) argument, so you can deliver a preformatted message too. Note that the NOTIFYCMD will only be called for a given event when you set -the EXEC flag by using the notify flags, as detailed below. +the EXEC flag by using the notify flags, below: NOTIFY FLAGS ------------ @@ -239,36 +227,36 @@ number. If a UPS is critical (on battery and low battery) or has been put into "forced shutdown" mode, it no longer contributes. A "power value" on a MONITOR line in the config file is the number of -power supplies that the UPS runs on the current system. +power supplies that the UPS runs on the current system. +MONITOR+ 'upsname' 'powervalue' 'username' 'password' 'type' -Normally, you only have one power supply, so it will be set to 1. +Normally, you only have one power supply, so it will be set to 1. -+MONITOR myups@myhost 1 username mypassword primary+ ++MONITOR myups@myhost 1 username mypassword master+ On a large server with redundant power supplies, the power value for a UPS may be greater than 1. You may also have more than one of them defined. -+MONITOR ups-alpha@myhost 2 username mypassword primary+ ++MONITOR ups-alpha@myhost 2 username mypassword master+ -+MONITOR ups-beta@myhost 2 username mypassword primary+ ++MONITOR ups-beta@myhost 2 username mypassword master+ You can also set the power value for a UPS to 0 if it does not supply any power to that system. This is generally used when you want to use the upsmon notification features for a UPS even though it's not actually -running the system that hosts upsmon. Don't set this to "primary" unless +running the system that hosts upsmon. Don't set this to "master" unless you really want to power this UPS off when this instance of upsmon needs to shut down for its own reasons. -+MONITOR faraway@anotherbox 0 username mypassword secondary+ ++MONITOR faraway@anotherbox 0 username mypassword slave+ The "minimum power value" is the number of power supplies that must be -receiving power in order to keep the computer running. +receiving power in order to keep the computer running. +MINSUPPLIES+ 'value' -Typical PCs only have 1, so most users will leave this at the default. +Typical PCs only have 1, so most users will leave this at the default. +MINSUPPLIES 1+ @@ -288,31 +276,31 @@ UPS TYPES *upsmon* and linkman:upsd[8] don't always run on the same system. When they do, any UPSes that are directly attached to the upsmon host should be -monitored in "primary" mode. This makes upsmon take charge of that equipment, -and it will wait for the "secondary" systems to disconnect before shutting +monitored in "master" mode. This makes upsmon take charge of that +equipment, and it will wait for slaves to disconnect before shutting down the local system. This allows the distant systems (monitoring over the network) to shut down cleanly before `upsdrvctl shutdown` runs and turns them all off. -When upsmon runs as a secondary, it is relying on the distant system to tell +When upsmon runs as a slave, it is relying on the distant system to tell it about the state of the UPS. When that UPS goes critical (on battery and low battery), it immediately invokes the local shutdown command. This -needs to happen quickly. Once all secondaries disconnect from the distant -linkman:upsd[8] server, its primary-mode upsmon will start its own shutdown -process. Your secondary systems must all quiesce and shut down before the -primary turns off the shared power source, or filesystem damage may result. +needs to happen quickly. Once it disconnects from the distant +linkman:upsd[8] server, the master upsmon will start its own shutdown +process. Your slaves must all shut down before the master turns off the +power or filesystem damage may result. -upsmon deals with secondaries that get wedged, hang, or otherwise fail to +upsmon deals with slaves that get wedged, hang, or otherwise fail to disconnect from linkman:upsd[8] in a timely manner with the HOSTSYNC -timer. During a shutdown situation, the primary upsmon will give up after -this interval and it will shut down anyway. This keeps the primary from -sitting there forever (which would endanger that host) if a secondary -should break somehow. This defaults to 15 seconds. +timer. During a shutdown situation, the master upsmon will give up after +this interval and it will shut down anyway. This keeps the master from +sitting there forever (which would endanger that host) if a slave should +break somehow. This defaults to 15 seconds. -If your primary system is shutting down too quickly, set the FINALDELAY +If your master system is shutting down too quickly, set the FINALDELAY interval to something greater than the default 15 seconds. Don't set this too high, or your UPS battery may run out of power before the -primary upsmon process shuts down that system. +master upsmon process shuts down that system. TIMED SHUTDOWNS --------------- @@ -365,10 +353,9 @@ MIXED OPERATIONS Besides being able to monitor multiple UPSes, upsmon can also monitor them as different roles. If you have a system with multiple power supplies -serviced by separate UPS batteries, it's possible to be a primary on one -UPS and a secondary on the other. This usually happens when you run -out of serial or USB ports and need to do the monitoring through another -system nearby. +serviced by separate UPS batteries, it's possible to be a master on one +and a slave on the other. This usually happens when you run out of serial +ports and need to do the monitoring through another system nearby. This is also complicated, especially when it comes time to power down a UPS that has gone critical but doesn't supply the local system. You can @@ -379,15 +366,15 @@ FORCED SHUTDOWNS ---------------- When upsmon is forced to bring down the local system, it sets the -"FSD" (forced shutdown) flag on any UPSes that it is running in primary -mode. This is used to synchronize secondary systems in the event that -a primary which is otherwise OK needs to be brought down due to some -pressing event on the UPS manager system. +"FSD" (forced shutdown) flag on any UPSes that it is running in master +mode. This is used to synchronize slaves in the event that a master UPS +that is otherwise OK needs to be brought down due to some pressing event +on the master. -You can manually invoke this mode on the system with primary-mode upsmon -by starting another copy of the program with `-c fsd` command line argument. -This is useful when you want to initiate a shutdown before the critical -stage through some external means, such as linkman:upssched[8]. +You can manually invoke this mode on the master upsmon by starting another +copy with `-c fsd`. This is useful when you want to initiate a shutdown +before the critical stage through some external means, such as +linkman:upssched[8]. DEAD UPSES ---------- @@ -432,13 +419,9 @@ by calling upsmon again to set the flag, i.e.: +upsmon -c fsd+ -After that, the primary and the secondary will do their usual shutdown -sequence as if the battery had gone critical, while you can time how long -it takes for them. This is much easier on your UPS equipment, and it beats -crawling under a desk to find the plug. - -Note you can also use a dummy SHUTDOWNCMD setting to just report that the -systems would shut down at this point, without actually disrupting their work. +After that, the master and the slaves will do their usual shutdown sequence +as if the battery had gone critical. This is much easier on your UPS +equipment, and it beats crawling under a desk to find the plug. FILES ----- @@ -450,21 +433,17 @@ SEE ALSO Server: ~~~~~~~ - linkman:upsd[8] Clients: ~~~~~~~~ - linkman:upsc[8], linkman:upscmd[8], linkman:upsrw[8], linkman:upsmon[8] CGI programs: ~~~~~~~~~~~~~ - linkman:upsset.cgi[8], linkman:upsstats.cgi[8], linkman:upsimage.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsrw.8 b/docs/man/upsrw.8 index 15fdc8d..d616695 100644 --- a/docs/man/upsrw.8 +++ b/docs/man/upsrw.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsrw -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/31/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSRW" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSRW" "8" "07/31/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -31,11 +31,11 @@ upsrw \- UPS variable administration tool .SH "SYNOPSIS" .sp -\fBupsrw\fR [\-l] \fIups\fR +\fBupsrw\fR \fIups\fR .sp \fBupsrw\fR \-h .sp -\fBupsrw\fR \-s \fIvariable\fR [\-u \fIusername\fR] [\-p \fIpassword\fR] [\-w] [\-t ] \fIups\fR +\fBupsrw\fR \-s \fIvariable\fR [\-u \fIusername\fR] [\-p \fIpassword\fR] \fIups\fR .SH "DESCRIPTION" .sp \fBupsrw\fR allows you to view and change the read/write variables inside your UPS\&. It sends commands via the server \fBupsd\fR(8) to your driver, which configures the hardware for you\&. @@ -67,15 +67,6 @@ Without this argument, upsrw will just display the list of the variables and the Some variables are strings, and can be set to any value within the length limit\&. Others are enumerated types and can only be set to one of those values\&. Others may be within an allowed range of values\&. Refer to the list to know what\(cqs available in your hardware\&. .RE .PP -\fB\-l\fR -.RS 4 -Just display the list of the variables and their possible values\&. -.sp -Same as default activity without -\fI\-s\fR -argument, provided for CLI similarity with other tools\&. -.RE -.PP \fB\-u\fR \fIusername\fR .RS 4 Set the NUT username for the connection to the server\&. This is optional, and you will be prompted for this when using the \-s option if you don\(cqt specify \-u on the command line\&. NUT usernames are defined in @@ -87,18 +78,6 @@ Set the NUT username for the connection to the server\&. This is optional, and y Set the password to authenticate to the server\&. This is also optional like \-u, and you will be prompted for it if necessary\&. .RE .PP -\fB\-w\fR -.RS 4 -Wait for the completion of setting execution by the driver and return its actual result from the device\&. Note that this feature requires that both upsd and the driver support TRACKING (NUT version 2\&.8\&.0 or higher) or it will otherwise fail\&. The command will also block until an actual result is provided from the driver, or the timeout is reached (see -\fB\-t\fR)\&. -.RE -.PP -\fB\-t\fR \fIseconds\fR -.RS 4 -Set a timeout when using -\fB\-w\fR\&. Defaults to 10 seconds\&. -.RE -.PP \fIups\fR .RS 4 View or change the settings on this UPS\&. The format for this option is @@ -114,9 +93,6 @@ Moreover, if you run this program inside a shell script or similar, you should o .SH "DIAGNOSTICS" .sp \fBupsrw\fR can\(cqt set variables on your UPS unless you provide a valid username and password\&. If you get "access denied" errors, make sure that your \fBupsd.users\fR(5) has an entry for you, and that the username you are using has permissions to SET variables\&. -.SH "VALUE FORMAT" -.sp -When using \fBupsrw\fR to modify a numeric float value, that values must be given using decimal (base 10) english\-based representation, so using a dot, in non\-scientific notation\&. So hexadecimal, exponents, and comma for thousands separator are forbidden\&. For example: "1200\&.20" is valid, while "1,200\&.20" and "1200,20" are invalid\&. .SH "HISTORY" .sp This program used to be called upsct2, which was ambiguous and confusing\&. diff --git a/docs/man/upsrw.txt b/docs/man/upsrw.txt index ebcd205..de09067 100644 --- a/docs/man/upsrw.txt +++ b/docs/man/upsrw.txt @@ -9,11 +9,11 @@ upsrw - UPS variable administration tool SYNOPSIS -------- -*upsrw* [-l] 'ups' +*upsrw* 'ups' *upsrw* -h -*upsrw* -s 'variable' [-u 'username'] [-p 'password'] [-w] [-t ] 'ups' +*upsrw* -s 'variable' [-u 'username'] [-p 'password'] 'ups' DESCRIPTION ----------- @@ -48,12 +48,6 @@ length limit. Others are enumerated types and can only be set to one of those values. Others may be within an allowed range of values. Refer to the list to know what's available in your hardware. -*-l*:: -Just display the list of the variables and their possible values. -+ -Same as default activity without '-s' argument, provided for CLI similarity -with other tools. - *-u* 'username':: Set the NUT username for the connection to the server. This is optional, and you will be prompted for this when using the -s option if you don't @@ -62,18 +56,7 @@ linkman:upsd.users[5], and are not linked to system usernames. *-p* 'password':: Set the password to authenticate to the server. This is also optional -like -u, and you will be prompted for it if necessary. - -*-w*:: -Wait for the completion of setting execution by the driver and return its -actual result from the device. Note that this feature requires that both upsd -and the driver support TRACKING (NUT version 2.8.0 or higher) or it will -otherwise fail. -The command will also block until an actual result is provided from the driver, -or the timeout is reached (see *-t*). - -*-t* 'seconds':: -Set a timeout when using *-w*. Defaults to 10 seconds. +like -u, and you will be prompted for it if necessary. 'ups':: View or change the settings on this UPS. The format for this option is @@ -101,15 +84,6 @@ username and password. If you get "access denied" errors, make sure that your linkman:upsd.users[5] has an entry for you, and that the username you are using has permissions to SET variables. -VALUE FORMAT ------------- - -When using *upsrw* to modify a numeric float value, that values must be given -using decimal (base 10) english-based representation, so using a dot, in -non-scientific notation. So hexadecimal, exponents, and comma for thousands -separator are forbidden. -For example: "1200.20" is valid, while "1,200.20" and "1200,20" are invalid. - HISTORY ------- @@ -118,10 +92,8 @@ confusing. SEE ALSO -------- - linkman:upsd[8], linkman:upscmd[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upssched.8 b/docs/man/upssched.8 index 0adceff..809fed3 100644 --- a/docs/man/upssched.8 +++ b/docs/man/upssched.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upssched -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSSCHED" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSCHED" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upssched.conf.5 b/docs/man/upssched.conf.5 index 102902e..e37dfe2 100644 --- a/docs/man/upssched.conf.5 +++ b/docs/man/upssched.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upssched.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "UPSSCHED\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSCHED\&.CONF" "5" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -116,7 +116,7 @@ as an argument to your CMDSCRIPT\&. .sp Example: .sp -Start a timer that will execute when any UPS (*) has been gone for 10 seconds +Start a timer that\(cqll execute when any UPS (*) has been gone for 10 seconds .sp .if n \{\ .RS 4 diff --git a/docs/man/upssched.conf.txt b/docs/man/upssched.conf.txt index 52a028c..96aea56 100644 --- a/docs/man/upssched.conf.txt +++ b/docs/man/upssched.conf.txt @@ -67,7 +67,7 @@ CMDSCRIPT. + Example: + -Start a timer that will execute when any UPS (*) has been +Start a timer that'll execute when any UPS (*) has been gone for 10 seconds AT COMMBAD * START-TIMER upsgone 10 @@ -107,5 +107,4 @@ linkman:upssched[8], linkman:upsmon[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upssched.txt b/docs/man/upssched.txt index 0fb033b..2e377be 100644 --- a/docs/man/upssched.txt +++ b/docs/man/upssched.txt @@ -8,7 +8,6 @@ upssched - Timer helper for scheduling events from upsmon SYNOPSIS -------- - *upssched* NOTE: *upssched* should be run from linkman:upsmon[8] via the NOTIFYCMD. @@ -67,7 +66,7 @@ If your UPS goes on and off battery frequently, you can use this program to reduce the number of pager messages that are sent out. Rather than sending pages directly from linkman:upsmon[8], use a short timer here. If the timer triggers with the UPS still on battery, then send the page. -If the power returns before then, the timer can be cancelled and no page +If the power returns before then, the timer can be cancelled and no page is necessary. BACKGROUND @@ -93,7 +92,7 @@ no timers are present in the queue, the background process exits. This means that you will only see upssched running when one of two things is happening: - - There's a timer of some sort currently running + - There's a timer of some sort currently running - upsmon just called it, and you managed to catch the brief instance The final optimization handles the possibility of trying to cancel a timer @@ -113,5 +112,4 @@ linkman:upsmon[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsset.cgi.8 b/docs/man/upsset.cgi.8 index 363ed14..be36b86 100644 --- a/docs/man/upsset.cgi.8 +++ b/docs/man/upsset.cgi.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsset.cgi -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSSET\&.CGI" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSET\&.CGI" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsset.cgi.txt b/docs/man/upsset.cgi.txt index 78912dd..3cb7410 100644 --- a/docs/man/upsset.cgi.txt +++ b/docs/man/upsset.cgi.txt @@ -34,10 +34,10 @@ You should see a list of items with the descriptions on the left side and the possible options or input spaces on the right. After changing something, be sure to "Save changes" to update the values in your UPS. -If your UPS doesn't support any read/write variables, there will be +If your UPS doesn't support any read/write variables, there will be nothing to do on this page. -Setting values in read/write variables can also be done from the command +Setting values in read/write variables can also be done from the command line with linkman:upsrw[8]. INSTANT COMMANDS @@ -94,5 +94,4 @@ SEE ALSO Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsset.conf.5 b/docs/man/upsset.conf.5 index dbf8982..bd6a256 100644 --- a/docs/man/upsset.conf.5 +++ b/docs/man/upsset.conf.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upsset.conf -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSSET\&.CONF" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSET\&.CONF" "5" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsset.conf.txt b/docs/man/upsset.conf.txt index 02cd996..e04a927 100644 --- a/docs/man/upsset.conf.txt +++ b/docs/man/upsset.conf.txt @@ -26,8 +26,8 @@ your linkman:upsd.conf[5] file, tcp-wrappers (if available when NUT was built), and hopefully local firewall settings in your OS. *upsset* runs on your web server, so upsd will see it as a connection from -a host on an internal network. It doesn't know that the connection is -actually coming from someone on the outside. This is why you must +a host on an internal network. It doesn't know that the connection is +actually coming from someone on the outside. This is why you must secure it. On Apache, you can use the .htaccess file or put the directives in your @@ -39,10 +39,10 @@ method: allow from your.network.addresses -You will probably have to set "AllowOverride Limit" for this directory +You will probably have to set "AllowOverride Limit" for this directory in your server-level configuration file as well. -If this doesn't make sense, then stop reading and leave this program +If this doesn't make sense, then stop reading and leave this program alone. It's not something you absolutely need to have anyway. Assuming you have all this done, and it actually works (test it!), then @@ -55,10 +55,8 @@ web server, don't blame me. SEE ALSO -------- - linkman:upsset.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsstats.cgi.8 b/docs/man/upsstats.cgi.8 index 762ae85..e1925b3 100644 --- a/docs/man/upsstats.cgi.8 +++ b/docs/man/upsstats.cgi.8 @@ -1,13 +1,13 @@ '\" t .\" Title: upsstats.cgi -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSSTATS\&.CGI" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSTATS\&.CGI" "8" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/docs/man/upsstats.cgi.txt b/docs/man/upsstats.cgi.txt index e79e539..141cfef 100644 --- a/docs/man/upsstats.cgi.txt +++ b/docs/man/upsstats.cgi.txt @@ -59,5 +59,4 @@ linkman:upsimage.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/upsstats.html.5 b/docs/man/upsstats.html.5 index 9ac3fbd..2db5bb6 100644 --- a/docs/man/upsstats.html.5 +++ b/docs/man/upsstats.html.5 @@ -1,13 +1,13 @@ '\" t .\" Title: upsstats.html -.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 09/13/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.7.1-pre1 .\" Language: English .\" -.TH "UPSSTATS\&.HTML" "5" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "UPSSTATS\&.HTML" "5" "09/13/2013" "Network UPS Tools 2\&.7\&.1\-p" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -134,7 +134,7 @@ myups@localhost\&. .PP \fB@HOSTDESC@\fR .RS 4 -Insert the host\(cqs description from +Insert the hout\(cqs description from \fBhosts.conf\fR(5)\&. .RE .PP diff --git a/docs/man/upsstats.html.txt b/docs/man/upsstats.html.txt index ec869f4..d08c5d0 100644 --- a/docs/man/upsstats.html.txt +++ b/docs/man/upsstats.html.txt @@ -101,7 +101,7 @@ the current temperature scale. Insert the designation of the host being monitored, like `myups@localhost`. *@HOSTDESC@*:: -Insert the host's description from linkman:hosts.conf[5]. +Insert the hout's description from linkman:hosts.conf[5]. *@HOSTLINK@*:: Insert a link to upsstats.cgi with the "host" variable set to the @@ -143,7 +143,7 @@ status variables: ups.load;; UPS load - percentage - ups.temperature;; UPS temperature + ups.temperature;; UPS temperature 'extra' is where you can put additional definitions. Right now the valid definitions are colors for various parts of the bars drawn @@ -194,7 +194,7 @@ voltage trim/boost or "off" are yellow, and other events like being on battery or having a low battery are red. *@VAR* 'varname'*@*:: -Insert the current value of the status variable varname on the host being +Insert the current value of the status variable varname on the host being monitored, or "Not supported". *@RUNTIME@*:: @@ -232,5 +232,4 @@ linkman:upsstats.cgi[8], linkman:upsimage.cgi[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/usbhid-ups.8 b/docs/man/usbhid-ups.8 index 5efcc29..87f1e3d 100644 --- a/docs/man/usbhid-ups.8 +++ b/docs/man/usbhid-ups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: usbhid-ups .\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "USBHID\-UPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "USBHID\-UPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -32,9 +32,11 @@ usbhid-ups \- Driver for USB/HID UPS equipment .SH "NOTE" .sp This man page only documents the hardware\-specific features of the usbhid\-ups driver\&. For information about the core driver, see \fBnutupsdrv\fR(8)\&. +.sp +This driver, formerly called \fInewhidups\fR, replaces the legacy \fIhidups\fR driver, which only supported Linux systems\&. .SH "SUPPORTED HARDWARE" .sp -\fBusbhid\-ups\fR brings USB/HID UPS monitoring to NUT on all platforms supporting USB through libusb\&. It should detect any UPS that uses the HID Power Device Class, but the amount of data will vary depending on the manufacturer and model\&. +\fBusbhid\-ups\fR brings USB/HID UPS monitoring to NUT on all platform supporting USB through libusb\&. It should detect any UPS that uses the HID power device class, but the amount of data will vary depending on the manufacturer and model\&. .sp At the present time, usbhid\-ups supports: .sp @@ -79,17 +81,6 @@ all Dell USB models, .sp -1 .IP \(bu 2.3 .\} -all AMETEK Powervar UPM models, -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} some APC models, .RE .sp @@ -112,7 +103,7 @@ some Belkin models, .sp -1 .IP \(bu 2.3 .\} -some Cyber Power Systems models, +some Cyber Power Systems models\&. .RE .sp .RS 4 @@ -123,32 +114,10 @@ some Cyber Power Systems models, .sp -1 .IP \(bu 2.3 .\} -some Powercom models, +some TrippLite models .RE .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -some PowerWalker models, -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -some TrippLite models\&. -.RE -.sp -For a more complete list, refer to the NUT hardware compatibility list, available in the source distribution as data/driver\&.list, or on the NUT website\&. You may use the "explore" driver option to gather information from HID UPSes which are not yet supported; see below for details\&. +For a more complete list, refer to the NUT hardware compatibility list, available in the source distribution as data/drivers\&.list, or on the NUT website\&. You may use the "explore" driver option to gather information from HID UPSes which are not yet supported; see below for details\&. .sp This driver is known to work on: .sp @@ -211,50 +180,36 @@ than \fIondelay\fR, but the driver will \fBnot\fR warn you upon startup if it isn\(cqt\&. -.sp -Note that many Cyber Power Systems (CPS) models tend to divide this delay by 60 and round down, so the minimum advisable value is 60 to avoid powering off immediately after NUT sends the shutdown command to the UPS\&. .RE .PP \fBondelay\fR=\fInum\fR .RS 4 -Set the timer for the UPS to switch on in case the power returns after the kill power command had been sent, but before the actual switch off\&. This ensures the machines connected to the UPS are, in all cases, rebooted after a power failure\&. +Set the timer for the UPS to switch on in case the power returns after the kill power command had been sent but before the actual switch off\&. This ensures the machines connected to the UPS are, in all cases, rebooted after a power failure\&. .sp The default value is 30 (in seconds)\&. Usually this \fBmust be greater\fR than offdelay, but the driver will \fBnot\fR -warn you upon startup if it isn\(cqt\&. Some UPSes will restart no matter what, even if the power is (still) out at the moment this timer elapses\&. In that case, you could see whether setting -ondelay = \-1 +warn you upon startup if it isn\(cqt\&. Some UPS\(cqes will restart no matter what, even if the power is (still) out at the moment this timer elapses\&. In that case, you could try if setting +\fIondelay = \-1\fR in \fBups\&.conf\fR helps\&. -.sp -Note that many CPS models tend to divide this delay by 60 and round down, so the minimum advisable value is 120 to allow a short delay between when the UPS shuts down, and when the power returns\&. .RE .PP \fBpollfreq\fR=\fInum\fR .RS 4 -Set polling frequency for full updates, in seconds\&. Compared to the quick updates performed every "pollinterval" (the latter option is described in -\fBups.conf\fR(5)), the "pollfreq" interval is for polling the less\-critical variables\&. The default value is 30 (in seconds)\&. +Set polling frequency, in seconds, to reduce the USB data flow\&. Between two polling requests, the driver will wait for interrupts (aka UPS notifications), which are data changes returned by the UPS by itself\&. This mechanism allow to avoid or reduce staleness message, due to the UPS being temporarily overloaded with too much polling requests\&. The default value is 30 (in seconds)\&. .RE .PP \fBpollonly\fR .RS 4 -If this flag is set, the driver will not use Interrupt In transfers during the shorter "pollinterval" cycles (not recommended, but needed if these reports are broken on your UPS)\&. -.RE -.PP -\fBonlinedischarge\fR -.RS 4 -If this flag is set, the driver will treat -OL+DISCHRG -status as offline\&. For most devices this combination means calibration or similar maintenance; however some UPS models (e\&.g\&. CyberPower UT series) emit -OL+DISCHRG -when wall power is lost \(em and need this option to handle shutdowns\&. +If this flag is set, the driver will ignore interrupts it receives from the UPS (not recommended, but needed if these reports are broken on your UPS)\&. .RE .PP \fBvendor\fR=\fIregex\fR, \fBproduct\fR=\fIregex\fR, \fBserial\fR=\fIregex\fR, \fBvendorid\fR=\fIregex\fR, \fBproductid\fR=\fIregex\fR .RS 4 -Select a specific UPS, in case there is more than one connected via USB\&. Each option specifies an extended regular expression (see regex(7)) that must match the UPS\(cqs entire vendor/product/serial string (minus any surrounding whitespace), or the whole 4\-digit hexadecimal code for vendorid and productid\&. Try +Select a specific UPS, in case there is more than one connected via USB Each option specifies an extended regular expression (see regex(7)) that must match the UPS\(cqs entire vendor/product/serial string (minus any surrounding whitespace), or the whole 4\-digit hexadecimal code for vendorid and productid\&. Try \fB\-DD\fR for finding out the strings to match\&. .sp @@ -268,6 +223,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendor="Foo\&.Corporation\&.*" .RE .sp @@ -279,6 +235,7 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x vendorid=051d* (APC) .RE @@ -291,18 +248,14 @@ Examples: .sp -1 .IP \(bu 2.3 .\} + \-x product="\&.*(Smart|Back)\-?UPS\&.*" .RE .RE .PP \fBbus\fR=\fIregex\fR .RS 4 -Select a UPS on a specific USB bus or group of buses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. bus="002", bus="00[2\-3]")\&. -.RE -.PP -\fBdevice =\fR \fIregex\fR -.RS 4 -Select a UPS on a specific USB device or group of devices\&. The argument is a regular expression that must match the device name where the UPS is connected (e\&.g\&. device="001", device="00[1\-2]")\&. Note that device numbers are not guaranteed by the OS to be stable across re\-boots or device re\-plugging\&. +Select a UPS on a specific USB bus or group of busses\&. The argument is a regular expression that must match the bus name where the UPS is connected (e\&.g\&. bus="002", bus="00[2\-3]")\&. .RE .PP \fBexplore\fR @@ -314,23 +267,14 @@ With this option, the driver will connect to any device, including ones that are .RS 4 With this option, the driver activates a tweak to workaround buggy firmware returning invalid HID report length\&. Some APC Back\-UPS units are known to have this bug\&. .RE -.PP -\fBinterruptonly\fR -.RS 4 -If this flag is set, the driver will not poll UPS\&. This also implies using of INPUT flagged objects\&. Some Powercom units need this option\&. -.RE -.PP -\fBinterruptsize\fR=\fInum\fR -.RS 4 -Limit the number of bytes to read from interrupt pipe\&. For some Powercom units this option should be equal to 8\&. -.RE .SH "INSTALLATION" .sp This driver is not built by default\&. You can build it by using "configure \-\-with\-usb=yes"\&. Note that it will also install other USB drivers\&. .sp You also need to install manually the legacy hotplug files (libhidups and libhid\&.usermap, generally in /etc/hotplug/usb/), or the udev file (nut\-usbups\&.rules, generally in /etc/udev/rules\&.d/) to address the permission settings problem\&. For more information, refer to the README file in nut/scripts/hotplug or nut/scripts/udev\&. +.sp +On Linux with MGE equipment, you will need at least a 2\&.4\&.25 or 2\&.6\&.2 kernel as well as libusb\-0\&.1\&.8 or later to disable hiddev support and avoid conflict\&. .SH "IMPLEMENTATION" -.SS "Selecting a specific UPS" .sp The driver ignores the "port" value in \fBups\&.conf\fR\&. Unlike previous versions of this driver, it is now possible to control multiple UPS units simultaneously with this driver, provided they can be distinguished by setting some combination of the "vendor", "product", "serial", "vendorid", and "productid" options\&. For instance: .sp @@ -350,11 +294,6 @@ The driver ignores the "port" value in \fBups\&.conf\fR\&. Unlike previous versi .if n \{\ .RE .\} -.SS "USB Polling and Interrupt Transfers" -.sp -The \fBusbhid\-ups\fR driver has two polling intervals\&. The "pollinterval" configuration option controls what can be considered the "inner loop", where the driver polls and waits briefly for "interrupt" reports\&. The "pollfreq" option is for less frequent updates of a larger set of values, and as such, we recommend setting that interval to several times the value of "pollinterval"\&. -.sp -Many UPSes will respond to a USB Interrupt In transfer with HID reports corresponding to values which have changed\&. This saves the driver from having to poll each value individually with USB Control transfers\&. Since the OB and LB status flags are important for a clean shutdown, the driver also explicitly polls the HID paths corresponding to those status bits during the inner "pollinterval" time period\&. The "pollonly" option can be used to skip the Interrupt In transfers if they are known not to work\&. .SH "KNOWN ISSUES AND BUGS" .SS "Repetitive timeout and staleness" .sp @@ -372,9 +311,7 @@ ret \-110 .RE .\} .sp -In this case, simply modify the general parameter "pollinterval" to a higher value (such as 10 seconds)\&. This should solve the issue\&. -.sp -Note that if you increase "pollinterval" beyond 10 or 15 seconds, you might also want to increase "pollfreq" by the same factor\&. +In this case, simply modify the general parameter "pollinterval" to a higher value (like 10 for 10 seconds)\&. This should solve the issue\&. .SS "Got EPERM: Operation not permitted upon driver startup" .sp You have forgotten to install the hotplug files, as explained in the INSTALLATION section above\&. Don\(cqt forget to restart hotplug so that it applies these changes\&. @@ -383,70 +320,9 @@ You have forgotten to install the hotplug files, as explained in the INSTALLATIO The hardware which was used for development of this driver is almost certainly different from what you have, and not all manufacturers follow the USB HID Power Device Class specifications to the letter\&. You don\(cqt want to find out that yours has issues here when a power failure hits your server room and you\(cqre not around to manually restart your servers\&. .sp If you rely on the UPS to shutdown your systems in case of mains failure and to restart them when the power returns, you \fBmust\fR test this\&. You can do so by running \fIupsmon \-c fsd\fR\&. With the mains present, this should bring your systems down and then cycle the power to restart them again\&. If you do the same without mains present, it should do the same, but in this case, the outputs shall remain off until mains power is applied again\&. -.SS "UPS cuts power too soon" -.sp -Note that many Cyber Power Systems (CPS) models tend to divide offdelay by 60 and round down, so the minimum advisable value is 60 (seconds) to avoid powering off immediately after NUT sends the shutdown command to the UPS\&. -.SS "UPS does not set battery\&.charge\&.low but says OK" -.sp -Note that many Cyber Power Systems (CPS) models tend to allow only certain values for battery\&.charge\&.low and anything outside of the set of allowed values are rounded or ignored\&. -.sp -A shell loop like this can help you map out the allowed values: -.sp -.if n \{\ -.RS 4 -.\} -.nf -for i in `seq 90 \-1 0`; do echo "set to $i"; \e - upsrw \-s battery\&.charge\&.low=$i \-u * \-p * cps\-big; \e - sleep 1; upsc cps\-big battery\&.charge\&.low; echo ""; \e -done -.fi -.if n \{\ -.RE -.\} -.sp -For example, for CPS PR1000LCDRTXL2U model, the only allowed values are [60,55,50,45,40,35,30,25,20] and in some cases, your UPS may effectively not support a value of 10 for the battery\&.charge\&.low setting\&. -.SH "HISTORY" -.sp -This driver, formerly called \fInewhidups\fR, replaces the legacy \fIhidups\fR driver, which only supported Linux systems\&. .SH "AUTHORS" .sp -Originally sponsored by MGE UPS SYSTEMS\&. -.sp -Now sponsored by Eaton http://opensource\&.eaton\&.com -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arnaud Quette -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Peter Selinger -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Arjen de Korte -.RE +Originally sponsored by MGE UPS SYSTEMS\&. Now sponsored by Eaton http://opensource\&.eaton\&.com Arnaud Quette, Peter Selinger, Arjen de Korte .SH "SEE ALSO" .SS "The core driver" .sp diff --git a/docs/man/usbhid-ups.txt b/docs/man/usbhid-ups.txt index bd5f7d1..1f6f729 100644 --- a/docs/man/usbhid-ups.txt +++ b/docs/man/usbhid-ups.txt @@ -1,4 +1,4 @@ -USBHID-UPS(8) +USBHID-UPS(8) ============= NAME @@ -13,12 +13,15 @@ This man page only documents the hardware-specific features of the usbhid-ups driver. For information about the core driver, see linkman:nutupsdrv[8]. +This driver, formerly called 'newhidups', replaces the legacy 'hidups' driver, +which only supported Linux systems. + SUPPORTED HARDWARE ------------------ -*usbhid-ups* brings USB/HID UPS monitoring to NUT on all platforms supporting -USB through libusb. It should detect any UPS that uses the HID Power Device -Class, but the amount of data will vary depending on the manufacturer and +*usbhid-ups* brings USB/HID UPS monitoring to NUT on all platform supporting +USB through libusb. It should detect any UPS that uses the HID power device +class, but the amount of data will vary depending on the manufacturer and model. At the present time, usbhid-ups supports: @@ -26,16 +29,13 @@ At the present time, usbhid-ups supports: - the newer Eaton USB models, - all MGE USB models, - all Dell USB models, - - all AMETEK Powervar UPM models, - some APC models, - some Belkin models, - - some Cyber Power Systems models, - - some Powercom models, - - some PowerWalker models, - - some TrippLite models. + - some Cyber Power Systems models. + - some TrippLite models For a more complete list, refer to the NUT hardware compatibility list, -available in the source distribution as data/driver.list, or on the +available in the source distribution as data/drivers.list, or on the NUT website. You may use the "explore" driver option to gather information from HID UPSes which are not yet supported; see below for details. @@ -58,43 +58,30 @@ sent (via the *-k* switch). + The default value is 20 (in seconds). Usually this *must be lower* than 'ondelay', but the driver will *not* warn you upon startup if it isn't. -+ -Note that many Cyber Power Systems (CPS) models tend to divide this delay by -60 and round down, so the minimum advisable value is 60 to avoid powering off -immediately after NUT sends the shutdown command to the UPS. - + *ondelay*='num':: Set the timer for the UPS to switch on in case the power returns after the -kill power command had been sent, but before the actual switch off. This +kill power command had been sent but before the actual switch off. This ensures the machines connected to the UPS are, in all cases, rebooted after a power failure. + The default value is 30 (in seconds). Usually this *must be greater* than offdelay, but the driver will *not* warn you upon startup if it -isn't. Some UPSes will restart no matter what, even if the power is -(still) out at the moment this timer elapses. In that case, you could see -whether setting `ondelay = -1` in *ups.conf* helps. -+ -Note that many CPS models tend to divide this delay by 60 and round down, so -the minimum advisable value is 120 to allow a short delay between when the UPS -shuts down, and when the power returns. +isn't. Some UPS'es will restart no matter what, even if the power is +(still) out at the moment this timer elapses. In that case, you could try +if setting 'ondelay = -1' in *ups.conf* helps. *pollfreq*='num':: -Set polling frequency for full updates, in seconds. Compared to the quick -updates performed every "pollinterval" (the latter option is described in -linkman:ups.conf[5]), the "pollfreq" interval is for polling the less-critical -variables. The default value is 30 (in seconds). +Set polling frequency, in seconds, to reduce the USB data flow. +Between two polling requests, the driver will wait for interrupts (aka UPS +notifications), which are data changes returned by the UPS by itself. +This mechanism allow to avoid or reduce staleness message, due to the UPS +being temporarily overloaded with too much polling requests. +The default value is 30 (in seconds). *pollonly*:: -If this flag is set, the driver will not use Interrupt In transfers during the -shorter "pollinterval" cycles (not recommended, but needed if these reports -are broken on your UPS). - -*onlinedischarge*:: -If this flag is set, the driver will treat `OL+DISCHRG` status as offline. -For most devices this combination means calibration or similar maintenance; -however some UPS models (e.g. CyberPower UT series) emit `OL+DISCHRG` when -wall power is lost -- and need this option to handle shutdowns. +If this flag is set, the driver will ignore interrupts it receives from the +UPS (not recommended, but needed if these reports are broken on your UPS). *vendor*='regex':: *product*='regex':: @@ -103,13 +90,13 @@ wall power is lost -- and need this option to handle shutdowns. *productid*='regex':: Select a specific UPS, in case there is more than one connected via -USB. Each option specifies an extended regular expression (see +USB Each option specifies an extended regular expression (see regex(7)) that must match the UPS's entire vendor/product/serial string (minus any surrounding whitespace), or the whole 4-digit hexadecimal code for vendorid and productid. Try *-DD* for finding out the strings to match. + -Examples: +Examples: - `-x vendor="Foo.Corporation.*"` - `-x vendorid=051d*` (APC) @@ -117,17 +104,9 @@ Examples: *bus*='regex':: -Select a UPS on a specific USB bus or group of buses. The argument is +Select a UPS on a specific USB bus or group of busses. The argument is a regular expression that must match the bus name where the UPS is -connected (e.g. bus="002", bus="00[2-3]"). - -*device =* 'regex':: - -Select a UPS on a specific USB device or group of devices. The argument is -a regular expression that must match the device name where the UPS is -connected (e.g. device="001", device="00[1-2]"). -Note that device numbers are not guaranteed by the OS to be stable across -re-boots or device re-plugging. +connected (e.g. bus="002", bus="00[2-3]"). *explore*:: With this option, the driver will connect to any device, including @@ -141,14 +120,6 @@ With this option, the driver activates a tweak to workaround buggy firmware returning invalid HID report length. Some APC Back-UPS units are known to have this bug. -*interruptonly*:: -If this flag is set, the driver will not poll UPS. This also implies using of -INPUT flagged objects. Some Powercom units need this option. - -*interruptsize*='num':: -Limit the number of bytes to read from interrupt pipe. For some Powercom units -this option should be equal to 8. - INSTALLATION ------------ @@ -162,12 +133,11 @@ and libhid.usermap, generally in /etc/hotplug/usb/), or the udev file permission settings problem. For more information, refer to the README file in nut/scripts/hotplug or nut/scripts/udev. +On Linux with MGE equipment, you will need at least a 2.4.25 or 2.6.2 kernel as +well as libusb-0.1.8 or later to disable hiddev support and avoid conflict. + IMPLEMENTATION -------------- - -Selecting a specific UPS -~~~~~~~~~~~~~~~~~~~~~~~~ - The driver ignores the "port" value in *ups.conf*. Unlike previous versions of this driver, it is now possible to control multiple UPS units simultaneously with this driver, provided they can be distinguished @@ -183,23 +153,6 @@ by setting some combination of the "vendor", "product", "serial", port = auto vendorid = 09ae -USB Polling and Interrupt Transfers -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The *usbhid-ups* driver has two polling intervals. The "pollinterval" -configuration option controls what can be considered the "inner loop", where -the driver polls and waits briefly for "interrupt" reports. The "pollfreq" -option is for less frequent updates of a larger set of values, and as such, we -recommend setting that interval to several times the value of "pollinterval". - -Many UPSes will respond to a USB Interrupt In transfer with HID reports -corresponding to values which have changed. This saves the driver from having -to poll each value individually with USB Control transfers. Since the `OB` and -`LB` status flags are important for a clean shutdown, the driver also -explicitly polls the HID paths corresponding to those status bits during the -inner "pollinterval" time period. The "pollonly" option can be used to skip -the Interrupt In transfers if they are known not to work. - KNOWN ISSUES AND BUGS --------------------- @@ -214,10 +167,7 @@ The result is that your system log will have lots of messages like: ret -110 In this case, simply modify the general parameter "pollinterval" to a higher -value (such as 10 seconds). This should solve the issue. - -Note that if you increase "pollinterval" beyond 10 or 15 seconds, you might -also want to increase "pollfreq" by the same factor. +value (like 10 for 10 seconds). This should solve the issue. Got EPERM: Operation not permitted upon driver startup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -243,59 +193,20 @@ If you do the same without mains present, it should do the same, but in this case, the outputs shall remain off until mains power is applied again. -UPS cuts power too soon -~~~~~~~~~~~~~~~~~~~~~~~ - -Note that many Cyber Power Systems (CPS) models tend to divide `offdelay` -by 60 and round down, so the minimum advisable value is 60 (seconds) to avoid -powering off immediately after NUT sends the shutdown command to the UPS. - -UPS does not set battery.charge.low but says OK -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Note that many Cyber Power Systems (CPS) models tend to allow only certain -values for `battery.charge.low` and anything outside of the set of allowed -values are rounded or ignored. - -A shell loop like this can help you map out the allowed values: - -==== - for i in `seq 90 -1 0`; do echo "set to $i"; \ - upsrw -s battery.charge.low=$i -u * -p * cps-big; \ - sleep 1; upsc cps-big battery.charge.low; echo ""; \ - done -==== - -For example, for CPS PR1000LCDRTXL2U model, the only allowed values are -`[60,55,50,45,40,35,30,25,20]` and in some cases, your UPS may effectively -not support a value of 10 for the `battery.charge.low` setting. - -HISTORY -------- - -This driver, formerly called 'newhidups', replaces the legacy 'hidups' driver, -which only supported Linux systems. - AUTHORS ------- Originally sponsored by MGE UPS SYSTEMS. - Now sponsored by Eaton - -* Arnaud Quette -* Peter Selinger -* Arjen de Korte +Arnaud Quette, Peter Selinger, Arjen de Korte SEE ALSO -------- The core driver ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources ~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/man/victronups.8 b/docs/man/victronups.8 index 1be425a..1fc6868 100644 --- a/docs/man/victronups.8 +++ b/docs/man/victronups.8 @@ -1,13 +1,13 @@ '\" t .\" Title: victronups -.\" Author: [see the "AUTHORS" section] -.\" Generator: DocBook XSL Stylesheets vsnapshot -.\" Date: 04/26/2022 +.\" Author: [see the "AUTHOR" section] +.\" Generator: DocBook XSL Stylesheets v1.76.1 +.\" Date: 07/26/2013 .\" Manual: NUT Manual -.\" Source: Network UPS Tools 2.8.0 +.\" Source: Network UPS Tools 2.6.5 .\" Language: English .\" -.TH "VICTRONUPS" "8" "04/26/2022" "Network UPS Tools 2\&.8\&.0" "NUT Manual" +.TH "VICTRONUPS" "8" "07/26/2013" "Network UPS Tools 2\&.6\&.5" "NUT Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -41,27 +41,7 @@ The Match Lite line may only report a handful of variables\&. This is usually no .sp If your Victron cable is broken or missing, use this diagram to build a clone: .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -https://github\&.com/networkupstools/nut/blob/master/docs/cables/ge\-imv\-victron\&.txt -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -docs/cables/ge\-imv\-victron\&.txt -.RE +docs/cables/victron\&.txt .SH "EXTRA ARGUMENTS" .sp This driver supports the following optional setting in the \fBups.conf\fR(5): @@ -78,29 +58,9 @@ Set delay before shutdown on UPS .SH "BUGS" .sp The protocol for this UPS is not officially documented\&. -.SH "AUTHORS" +.SH "AUTHOR" .sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Radek Benedikt -.RE -.sp -.RS 4 -.ie n \{\ -\h'-04'\(bu\h'+03'\c -.\} -.el \{\ -.sp -1 -.IP \(bu 2.3 -.\} -Daniel Prynych -.RE +Radek Benedikt , Daniel Prynych .SH "SEE ALSO" .SS "The core driver:" .sp diff --git a/docs/man/victronups.txt b/docs/man/victronups.txt index 17be94d..7c8e98a 100644 --- a/docs/man/victronups.txt +++ b/docs/man/victronups.txt @@ -1,21 +1,18 @@ VICTRONUPS(8) ============= -NAME +NAME ---- - victronups - Driver for IMV/Victron UPS unit Match, Match Lite, NetUps NOTE ---- - This man page only documents the hardware-specific features of the the -victronups driver. For information about the core driver, see +victronups driver. For information about the core driver, see linkman:nutupsdrv[8]. SUPPORTED HARDWARE ------------------ - The victronups driver should recognize all Victron models that use a serial protocol at 1200 bps. These include Match Lite, Match and the NetUps line. @@ -28,12 +25,10 @@ CABLING If your Victron cable is broken or missing, use this diagram to build a clone: -* https://github.com/networkupstools/nut/blob/master/docs/cables/ge-imv-victron.txt -* link:docs/cables/ge-imv-victron.txt[] +docs/cables/victron.txt EXTRA ARGUMENTS --------------- - This driver supports the following optional setting in the linkman:ups.conf[5]: @@ -46,24 +41,20 @@ Set delay before shutdown on UPS BUGS ---- - The protocol for this UPS is not officially documented. -AUTHORS -------- - -* Radek Benedikt -* Daniel Prynych +AUTHOR +------ +Radek Benedikt , +Daniel Prynych SEE ALSO -------- The core driver: ~~~~~~~~~~~~~~~~ - linkman:nutupsdrv[8] Internet resources: ~~~~~~~~~~~~~~~~~~~ - The NUT (Network UPS Tools) home page: http://www.networkupstools.org/ diff --git a/docs/net-protocol.txt b/docs/net-protocol.txt index 0af9433..650effa 100644 --- a/docs/net-protocol.txt +++ b/docs/net-protocol.txt @@ -13,7 +13,6 @@ query commands as authentication is impossible over a UDP socket. A library, named libupsclient, that implement this protocol is provided in both static and shared version to help the client application development. - Old command removal notice -------------------------- @@ -21,40 +20,31 @@ Before version 1.5.0, a number of old commands were supported. These have been removed from the specification. For more information, consult an older version of the software. - Command reference ----------------- -Multi-word elements are contained within "quotes" for easier parsing. +Multi-word elements are contained within "quotes" for easier parsing. Embedded quotes are escaped with backslashes. Embedded backslashes are also escaped by representing them as \\. This protocol is intended to be interpreted with parseconf (NUT parser) or something similar. - Revision history ---------------- Here's a table to present the various changes that happened to the NUT network protocol, over the time: -[options="header,autowidth",frame="topbot",grid="rows",cols="^.^,^.^,<",align="center"] +[options="header",style="asciidoc",cols="^.^,^.^,<"] |=============================================================================== |Protocol version |NUT version |Description |1.0 |< 1.5.0 |Original protocol (legacy version) |1.1 |>= 1.5.0 |Original protocol (without old commands) .2+|1.2 .2+|>= 2.6.4 |Add "LIST CLIENTS" and "NETVER" commands |Add ranges of values for writable variables -.4+|1.3 .4+|>= 2.8.0 |Add "cmdparam" to "INSTCMD" - |Add "TRACKING" commands (GET, SET) - |Add "PRIMARY" as alias to older "MASTER" - (implementation tested to be backwards - compatible in `upsd` and `upsmon`) - |Add "PROTVER" as alias to older "NETVER" |=============================================================================== -NOTE: Any new version of the protocol implies an update of `NUT_NETVERSION` -in 'configure.ac' file. - +NOTE: any new version of the protocol implies an update of NUT_NETVERSION +in *configure.in*. GET --- @@ -63,7 +53,6 @@ Retrieve a single response from the server. Possible sub-commands: - NUMLOGINS ~~~~~~~~~ @@ -78,12 +67,11 @@ Response: NUMLOGINS su700 1 '' is the number of clients which have done LOGIN for this UPS. -This is used by the upsmon in primary mode to determine how many clients are +This is used by the master upsmon to determine how many clients are still connected when starting the shutdown process. This replaces the old "REQ NUMLOGINS" command. - UPSDESC ~~~~~~~ @@ -103,7 +91,6 @@ is not set, upsd will return "Unavailable". This can be used to provide human-readable descriptions instead of a cryptic "upsname@hostname" string. - VAR ~~~ @@ -119,7 +106,6 @@ Response: This replaces the old "REQ" command. - TYPE ~~~~ @@ -138,24 +124,13 @@ Response: - 'RW': this variable may be set to another value with SET - 'ENUM': an enumerated type, which supports a few specific values - 'STRING:n': this is a string of maximum length n -- 'RANGE': this is an numeric, either integer or float, comprised in the -range (see LIST RANGE) -- 'NUMBER': this is a simple numeric value, either integer or float +- 'RANGE': this is an integer, comprised in the range (see LIST RANGE) ENUM, STRING and RANGE are usually associated with RW, but not always. -The default , when omitted, is numeric, so either integer or float. -Each driver is then responsible for handling values as either integer or -float. - -Note that float values are expressed using decimal (base 10) english-based -representation, so using a dot, in non-scientific notation. So hexadecimal, -exponents, and comma for thousands separator are forbidden. -For example: "1200.20" is valid, while "1,200.20" and "1200,20" are invalid. - +The default , when omitted, is integer. This replaces the old "VARTYPE" command. - DESC ~~~~ @@ -178,7 +153,6 @@ provide for localization and internationalization. This replaces the old "VARDESC" command. - CMDDESC ~~~~~~~ @@ -196,27 +170,6 @@ This is like DESC above, but it applies to the instant commands. This replaces the old "INSTCMDDESC" command. - -TRACKING -~~~~~~~~ - -Form: - - GET TRACKING (activation status of TRACKING) - GET TRACKING (execution status of a command / setvar) - GET TRACKING 1bd31808-cb49-4aec-9d75-d056e6f018d2 - -Response: - - ON (TRACKING feature is enabled) - OFF (TRACKING feature is disabled) - PENDING (command execution is pending) - SUCCESS (command was successfully executed) - ERR UNKNOWN (command execution failed with unknown error) - ERR INVALID-ARGUMENT (command execution failed due to missing or invalid argument) - ERR FAILED (command execution failed) - - LIST ---- @@ -230,7 +183,6 @@ of client possible. You can send a LIST query and then go off and wait for it to get back to you. When it arrives, you don't need complicated state machines to remember which list is which. - UPS ~~~ @@ -259,7 +211,6 @@ handle situations where a single upsd supports multiple drivers. Clients which perform a UPS discovery process may find this useful. - VAR ~~~ @@ -283,7 +234,6 @@ Response: This replaces the old "LISTVARS" command. - RW ~~ @@ -307,7 +257,6 @@ Response: This replaces the old "LISTRW" command. - CMD ~~~ @@ -331,7 +280,6 @@ Response: This replaces the old "LISTINSTCMD" command. - ENUM ~~~~ @@ -358,7 +306,6 @@ This replaces the old "ENUM" command. NOTE: this does not support the old "SELECTED" notation. You must request the current value separately. - RANGE ~~~~~ @@ -380,7 +327,6 @@ Response: ... END LIST RANGE su700 input.transfer.low - CLIENT ~~~~~~ @@ -401,59 +347,21 @@ Response: CLIENT ups1 192.168.1.2 END LIST CLIENT ups1 - SET --- -VAR -~~~ - Form: SET VAR "" SET VAR su700 ups.id "My UPS" -Response: - - OK (if TRACKING is not enabled) - OK TRACKING (if TRACKING is enabled) - ERR [...] (see Error responses) - - -TRACKING -~~~~~~~~ - -Form: - - SET TRACKING - SET TRACKING ON - SET TRACKING OFF - -Response: - - OK - ERR INVALID-ARGUMENT (if is not "ON" or "OFF") - ERR USERNAME-REQUIRED (if not yet authenticated) - ERR PASSWORD-REQUIRED (if not yet authenticated) - - INSTCMD ------- Form: - INSTCMD [] + INSTCMD INSTCMD su700 test.panel.start - INSTCMD su700 load.off.delay 120 - -NOTE: is an additional and optional parameter for the command. - -Response: - - OK (if TRACKING is not enabled) - OK TRACKING (if TRACKING is enabled) - ERR [...] (see Error responses) - LOGOUT ------ @@ -469,7 +377,6 @@ Response: Used to disconnect gracefully from the server. - LOGIN ----- @@ -480,24 +387,19 @@ Form: Response: OK (upon success) + or <> -or <> - -NOTE: This requires "upsmon secondary" or "upsmon primary" in upsd.users +NOTE: This requires "upsmon slave" or "upsmon master" in upsd.users Use this to log the fact that a system is drawing power from this UPS. -The upsmon primary will wait until the count of attached systems reaches -1 -- itself. This allows the secondaries to shut down first. +The upsmon master will wait until the count of attached systems reaches +1 - itself. This allows the slaves to shut down first. NOTE: You probably shouldn't send this command unless you are upsmon, or a upsmon replacement. - -PRIMARY (since NUT 2.8.0) or MASTER (deprecated) ------------------------------------------------- - -NOTE: This command was renamed in NUT 2.8.0 to "PRIMARY" with the older -name "MASTER" kept as deprecated alias for compatibility. +MASTER +------ Form: @@ -505,26 +407,13 @@ Form: Response: - OK MASTER-GRANTED (upon success) + OK (upon success) + or <> -Form: - - PRIMARY - -Response: - - OK PRIMARY-GRANTED (upon success) - -or <> - -NOTE: This requires "upsmon primary" in upsd.users - -NOTE: Previously documented response was just `OK` -- clients checking -that server reply *starts with* that keyword would handle all cases. +NOTE: This requires "upsmon master" in upsd.users This function doesn't do much by itself. It is used by upsmon to make -sure that primary-mode functions like FSD are available if necessary. - +sure that master-level functions like FSD are available if necessary. FSD --- @@ -536,40 +425,24 @@ Form: Response: OK FSD-SET (success) + or <> -or <> - -NOTE: This requires "upsmon primary" in upsd.users, or "FSD" action +NOTE: This requires "upsmon master" in upsd.users, or "FSD" action granted in upsd.users -upsmon in primary mode is the primary user of this function. It sets this +upsmon in master mode is the primary user of this function. It sets this "forced shutdown" flag on any UPS when it plans to power it off. This is -done so that secondary systems will know about it and shut down before the +done so that slave systems will know about it and shut down before the power disappears. Setting this flag makes "FSD" appear in a STATUS request for this UPS. Finding "FSD" in a status request should be treated just like a "OB LB". -It should be noted that FSD is currently a latch -- once set, there is +It should be noted that FSD is currently a latch - once set, there is no way to clear it short of restarting upsd or dropping then re-adding it in the ups.conf. This may cause issues when upsd is running on a system that is not shut down due to the UPS event. -Note also that certain drivers can propagate the "FSD" state declared by -the smarter UPSes themselves, e.g. when an UPS is charging after an outage -and its battery level is below the "safe for load" threshold configured on -the device itself. In this case the device usually does not power up its -outlets automatically, but it can be forced by the systems administrator. -The rationale behind such FSD during charging allows enough power to be -guaranteed for systems to both boot and shut down safely, if the wall -power disappears again, trading off prolonged unavailability of the shut -down servers for the safety of their data. In such cases, administrators -should be ready to disarm their upsmon clients until the batteries are -charged, to avoid quick shutdowns of quickly restored servers -- but only -if they are sure about the wall power being restored for good (e.g. outage -was due to maintenance). - - PASSWORD -------- @@ -580,13 +453,11 @@ Form: Response: OK (upon success) - -or <> + or <> Sets the password associated with a connection. Used for later authentication for commands that require it. - USERNAME -------- @@ -597,13 +468,11 @@ Form: Response: OK (upon success) - -or <> + or <> Sets the username associated with a connection. This is also used for authentication, specifically in conjunction with the upsd.users file. - STARTTLS -------- @@ -614,21 +483,18 @@ Form: Response: OK STARTTLS - -or <> + or <> This tells upsd to switch to TLS mode internally, so all future communications will be encrypted. You must also change to TLS mode in the client after receiving the OK, or the connection will be useless. - Other commands -------------- - HELP: lists the commands supported by this server - VER: shows the version of the server currently in use - NETVER: shows the version of the network protocol currently in use - (aliased as PROTVER since NUT v2.8.0, or formal protocol version 1.3) These three are not intended to be used directly by programs. Humans can make use of this program by using telnet or netcat. If you use @@ -636,8 +502,6 @@ telnet, make sure you don't have it set to negotiate extra options. upsd doesn't speak telnet and will probably misunderstand your first request due to the extra junk in the buffer. - -[[np-errors]] Error responses --------------- @@ -679,13 +543,13 @@ sending a valid command like GET with an invalid subcommand. - 'INSTCMD-FAILED' + -upsd failed to deliver the instant command request to the driver. +upsd failed to deliver the instant command request to the driver. No further information is available to the client. This typically indicates a dead or broken driver. - 'SET-FAILED' + -upsd failed to deliver the set request to the driver. This is +upsd failed to deliver the set request to the driver. This is just like INSTCMD-FAILED above. - 'READONLY' @@ -714,7 +578,7 @@ start it again. - 'DRIVER-NOT-CONNECTED' + upsd can't perform the requested command, since the driver for that -UPS is not connected. This usually means that the driver is not +UPS is not connected. This usually means that the driver is not running, or if it is, the ups.conf is misconfigured. - 'DATA-STALE' @@ -735,7 +599,7 @@ There is presently a limit of one LOGIN record per connection. - 'INVALID-PASSWORD' + -The client sent an invalid PASSWORD -- perhaps an empty one. +The client sent an invalid PASSWORD - perhaps an empty one. - 'ALREADY-SET-PASSWORD' + @@ -771,15 +635,13 @@ receiving this response. - 'INVALID-VALUE' + -The value specified in the request is not valid. This usually +The value specified in the request is not valid. This usually applies to a SET of an ENUM type which is using a value which is not in the list of allowed values. - Future ideas ------------ - Dense lists ~~~~~~~~~~~ @@ -787,6 +649,11 @@ The LIST commands may be given the ability to handle options some day. For example, "LIST VARS +DESC" would return the current value like now, but it would also append the description of that variable. +Command status +~~~~~~~~~~~~~~ + +After sending an INSTCMD or SET, a client will eventually be able to +poll to see whether it was completed successfully by the driver. Get collection ~~~~~~~~~~~~~~ diff --git a/docs/new-clients.txt b/docs/new-clients.txt index 1b07900..c4b929e 100644 --- a/docs/new-clients.txt +++ b/docs/new-clients.txt @@ -23,7 +23,7 @@ to give access to upsd and UPS status information. Both static and shared versions are provided. These library files and associated header files are not installed by -default. You must `./configure --with-dev` to enable building and +default. You must `./configure --with-lib` to enable building and installing these files. The libraries can then be built and installed with `make` and `make install` as usual. This must be done before building other (non-NUT) programs which depend on them. @@ -51,86 +51,28 @@ and commands with an object-oriented API in C++ and C. For more information, refer to the linkman:libnutclient[3] manual page. ------- #include - #include - #include - #include - using namespace nut; using namespace std; - - /* argv[1] is the mandatory NUT device name (@localhost), - * used to list variables from - * argv[2] is an optional command. When provided, it will be - * executed and possibly with status tracking enabled - */ - int main(int argc, char **argv) + + int main(int argc, char** argv) { - Client *client; try { // Connection - client = new TcpClient("localhost", 3493); - - if (argc >= 2) - { - // Reading data from device - Device mydev = client->getDevice(argv[1]); - cout << "Description: " << mydev.getDescription() << endl; - Variable var = mydev.getVariable("device.model"); - cout << "Model: " << var.getValue()[0] << endl; - - if (argc >= 3) - { - // Authenticate to NUT server - const char *user = getenv("NUT_USER"); - const char *password = getenv("NUT_PASSWD"); - client->authenticate(user ? user : "", password ? password : ""); - - // Enable command tracking, if available - if (client->hasFeature(Client::TRACKING)) - { - cout << "Server can do command tracking" << std::endl; - client->setFeature(Client::TRACKING, true); - } - else - { - std::cout << "Server can't do command tracking" << std::endl; - } - - // Perform an asynchronous command - TrackingID id = mydev.executeCommand(argv[2]); - TrackingResult result; - do - { - sleep(1); - result = client->getTrackingResult(id); - } - while (result == PENDING); - - // Display result of command - const char *output = ""; - switch (result) - { - case SUCCESS: output = "SUCCESS"; break; - case FAILURE: output = "FAILURE"; break; - case UNKNOWN: output = "UNKNOWN"; break; - } - cout << "Command sent, result=" << output << endl; - } - } + Client* client = new TcpClient("localhost", 3493); + Device mydev = client->getDevice("myups"); + cout << mydev.getDescription() << endl; + Variable var = mydev.getVariable("device.model"); + cout << var.getValue()[0] << endl; } - catch (NutException &ex) + catch(NutException& ex) { cerr << "Unexpected problem : " << ex.str() << endl; } - delete client; return 0; } ------- - Configuration helpers ~~~~~~~~~~~~~~~~~~~~~ @@ -146,8 +88,7 @@ Python The PyNUT module, contributed by David Goncalves, can be used for connecting a Python script to `upsd`. Note that this code (and the accompanying NUT-Monitor -application, later separated into NUT-Monitor-py2gtk2 and NUT-Monitor-py3qt5, -suitable for two generations of Python ecosystem) is licensed under the GPL v3. +application) is licensed under the GPL v3. The `PyNUTClient` class abstracts the connection to the server. In order to list the status variables for `ups1` on the local `upsd`, the following @@ -184,7 +125,6 @@ of the results. The Perl class instance encapsulates a single UPS, where the Python class instance represents a connection to the server (which may service multiple UPS units). ------- use UPS::Nut; $ups = new UPS::Nut( NAME => "myups", @@ -207,10 +147,10 @@ multiple UPS units). ; print $other_ups{MFR}, " ", $other_ups{MODEL}, "\n"; ------- Java ---- -The NUT Java support has been externalized. +The NUT java support have been externalized. It is available at https://github.com/networkupstools/jnut + diff --git a/docs/new-drivers.txt b/docs/new-drivers.txt index 7e17372..0300db5 100644 --- a/docs/new-drivers.txt +++ b/docs/new-drivers.txt @@ -1,58 +1,41 @@ Creating a new driver to support another device =============================================== -This chapter will present the process of creating a new driver to support +This chapter will present the process to create a new driver to support another device. -Since NUT already supports many major power device protocols through -several generic drivers (genericups, usbhid-ups, snmp-ups, blazer_* and -nutdrv_qx), creation of new drivers has become rare. +Since NUT already supports all major power devices protocols, through +several generic drivers (genericups, usbhid-ups, snmp-ups, blazer_*, ...), +creation of new drivers has become rare. -So most of the time, this process will be limited to completing one of these -generic drivers. +So most of the time, it will be limited to completing one of these +generic driver. Smart vs. Contact-closure ------------------------- -If your UPS only does contact closure readings over an RS-232 serial port, then -go straight to the <> chapter for -information on adding support. It's a lot easier to add a few lines to a -header file than it is to create a whole new driver. +If your UPS only does contact closure readings, then go straight to the +<> chapter for information on +adding support. It's a lot easier to add a few lines to a header file +than it is to create a whole new driver. Serial vs. USB vs. SNMP and more -------------------------------- -If your UPS connects to your computer via a USB port, then it most likely -appears as a USB HID device (this is the simplest way for the vendor to write -a Windows control program for it). What comes next depends on whether the -vendor implemented the HID PDC (Power Device Class) specification, or simply -used the HID protocol to transport serial data to the UPS microcontroller. - -A rough heuristic is to check the length of the HID Descriptor length -(`wDescriptorLength` in `lsusb -v` output). If it is less than 200 bytes long, -the UPS probably has a glorified USB-to-serial converter built in. Since the -query strings often start with the letter `Q`, this family of protocols is -often referred to as `Q*` in the NUT documentation. See the -<> chapter for more details. - -Otherwise, if the HID Descriptor is longer, you can go to the -<> chapter. You can probably add support for -your device by writing a new subdriver to the existing usbhid-ups driver, -which is easier (and more maintainable) than writing an entire new driver. - -If your USB UPS does not appear to fall into either of these two categories, -feel free to contact the `nut-upsdev` mailing list with details of your -device. +If your UPS connects to your computer via a USB port, then go straight +to the <> chapter. You can probably add +support for your device by writing a new subdriver to the existing +usbhid-ups driver, which is easier than writing an entire new driver. Similarly, if your UPS connects to your computer via an SNMP network -card, you can probably add support for your device by adding a new +card, you can probably add support for your device by writing a new subdriver to the existing snmp-ups driver. Instructions are provided in the <> chapter. Overall concept --------------- -The basic design of drivers is simple. `main.c` handles most of the work +The basic design of drivers is simple. main.c handles most of the work for you. You don't have to worry about arguments, config files, or anything else like that. Your only concern is talking to the hardware and providing data to the outside world. @@ -60,8 +43,8 @@ and providing data to the outside world. Skeleton driver --------------- -Familiarize yourself with the design of `skel.c` in the drivers directory. -It shows a few examples of the functions that `main.c` will call to obtain +Familiarize yourself with the design of skel.c in the drivers directory. +It shows a few examples of the functions that main will call to obtain updated information from the hardware. Essential structure @@ -76,9 +59,8 @@ This structure tracks several description information about the driver: * *version*: the driver's own version. For sub driver information, refer below to sub_upsdrv_info. This value has the form "X.YZ", and is published by main as "driver.version.internal". - * *authors*: the driver's author(s) name. If multiple authors are listed, - separate them with a newline character so that it can be broken - up by author if needed. + * *authors*: the driver's author(s) name. If multiple authors are listed, separate + them with a newline character so that it can be broken up by author if needed. * *status*: the driver development status. The following values are allowed: - DRV_BROKEN: setting this value will cause main to print an error and exit. This is only used during conversions of the driver core @@ -90,10 +72,10 @@ This structure tracks several description information about the driver: doesn't take it for granted. - DRV_BETA: this value means that the driver is more stable and complete. But it is still not recommended for production systems. - - DRV_STABLE: the driver is suitable for production systems, but - not 100 % feature complete. - - DRV_COMPLETE: this is the gold level! It implies that 100 % of - the protocol is implemented, and a full QA pass. + - DRV_STABLE: the driver is suitable for production systems, but not + 100 % feature complete. + - DRV_COMPLETE: this is the gold level! It implies that 100 % of the + protocol is implemented, and a full QA pass. * *subdrv_info*: array of upsdrv_info_t for sub driver(s) information. For example, this is used by usbhid-ups. @@ -105,7 +87,7 @@ Essential functions upsdrv_initups ~~~~~~~~~~~~~~ -Open the port (`device_path`) and do any low-level things that it may need +Open the port (device_path) and do any low-level things that it may need to start using that port. If you have to set DTR or RTS on a serial port, do it here. @@ -120,14 +102,14 @@ possible for your hardware. If there is a way to detect that hardware and it doesn't appear to be connected, display an error and exit. This is the last time your driver is allowed to bail out. -This is usually a good place to create variables like `ups.mfr`, -`ups.model`, `ups.serial`, and other "one time only" items. +This is usually a good place to create variables like ups.mfr, +ups.model, ups.serial, and other "one time only" items. upsdrv_updateinfo ~~~~~~~~~~~~~~~~~ Poll the hardware, and update any variables that you care about -monitoring. Use `dstate_setinfo()` to store the new values. +monitoring. Use dstate_setinfo() to store the new values. Do at most one pass of the variables. You MUST return from this function or upsd will be unable to read data from your driver. main @@ -143,7 +125,7 @@ answer the next time it is called. You must never abort from upsdrv_updateinfo(), even when the UPS doesn't seem to be attached anymore. If the connection with the UPS is lost, the driver should retry to re-establish communication for as long as it is -running. Calling `exit()` or any of the `fatal*()` functions is specifically +running. Calling exit() or any of the fatal*() functions is specifically not allowed anymore. upsdrv_shutdown @@ -162,15 +144,15 @@ process. Data types ---------- -To be of any use, you must supply data in `ups.status`. That is the +To be of any use, you must supply data in ups.status. That is the minimum needed to let upsmon do its job. Whenever possible, you should also provide anything else that can be monitored by the driver. Some obvious things are the manufacturer name and model name, voltage data, and so on. -If you can't figure out some value automatically, use the `ups.conf` +If you can't figure out some value automatically, use the ups.conf options to let the user tell you. This can be useful when a driver -needs to support many similar hardware models, but can't probe to see +needs to support many similar hardware models but can't probe to see what is actually attached. Manipulating the data @@ -207,50 +189,46 @@ UPS status flags like on line (OL) and on battery (OB) live in ups.status. Don't manipulate this by hand. There are functions which will do this for you. - status_init() -- before doing anything else + status_init() - before doing anything else - status_set(val) -- add a status word (OB, OL, etc) + status_set(val) - add a status word (OB, OL, etc) - status_commit() -- push out the update + status_commit() - push out the update Possible values for status_set: - OL -- On line (mains is present) - OB -- On battery (mains is not present) - LB -- Low battery - HB -- High battery - RB -- The battery needs to be replaced - CHRG -- The battery is charging - DISCHRG -- The battery is discharging (inverter is providing load power) - BYPASS -- UPS bypass circuit is active -- no battery protection is available - CAL -- UPS is currently performing runtime calibration (on battery) - OFF -- UPS is offline and is not supplying power to the load - OVER -- UPS is overloaded - TRIM -- UPS is trimming incoming voltage (called "buck" in some hardware) - BOOST -- UPS is boosting incoming voltage - FSD -- Forced Shutdown (restricted use, see the note below) + OL - On line (mains is present) + OB - On battery (mains is not present) + LB - Low battery + HB - High battery + RB - The battery needs to be replaced + CHRG - The battery is charging + DISCHRG - The battery is discharging (inverter is providing load power) + BYPASS - UPS bypass circuit is active - no battery protection is available + CAL - UPS is currently performing runtime calibration (on battery) + OFF - UPS is offline and is not supplying power to the load + OVER - UPS is overloaded + TRIM - UPS is trimming incoming voltage (called "buck" in some hardware) + BOOST - UPS is boosting incoming voltage + FSD - Forced Shutdown (restricted use, see the note below) Anything else will not be recognized by the usual clients. Coordinate with the nut-upsdev list before creating something new, since there will be duplication and ugliness otherwise. [NOTE] -============================================================================== +================================================================================ -- upsd injects `FSD` by itself following that command by a primary upsmon +- upsd injects "FSD" by itself following that command by a master upsmon process. Drivers must not set that value, apart from specific cases (see below). -- As an exception, drivers may set `FSD` when an imminent shutdown has been +- As an exception, drivers may set "FSD" when an imminent shutdown has been detected. In this case, the "on battery + low battery" condition should not be -met. Otherwise, setting status to `OB LB` should be preferred. +met. Otherwise, setting status to "OB LB" should be prefered. -- the `OL` and `OB` flags are an indication of the input line status only. - -- the `CHRG` and `DISCHRG` flags are being replaced with -`battery.charger.status`. See the linkdoc:user-manual[NUT command and -variable naming scheme,nut-names] for more information. -============================================================================== +- the OL and OB flags are an indication of the input line status only. +================================================================================ UPS alarms ---------- @@ -258,11 +236,11 @@ UPS alarms These work like ups.status, and have three special functions which you must use to manage them. - alarm_init() -- before doing anything else + alarm_init() - before doing anything else - alarm_set() -- add an alarm word + alarm_set() - add an alarm word - alarm_commit() -- push the value into ups.alarm + alarm_commit() - push the value into ups.alarm NOTE: the ALARM flag in ups.status is automatically set whenever you use alarm_set. To remove that flag from ups.status, call alarm_init and @@ -277,10 +255,6 @@ flag in ups.status. There is no official list of alarm words as of this writing, so don't use these functions until you check with the upsdev list. -Also refer to the <> chapter -of the user manual and developer guide for information related to alarms -handling in daisychain mode. - Staleness control ----------------- @@ -291,7 +265,7 @@ else to ensure that it is really available. If the attempts to contact the UPS fail, you must call dstate_datastale() to inform the server and clients. -- dstate_dataok() +- dstate_dataok() + You must call this if polls are succeeding. A good place to call this is the bottom of upsdrv_updateinfo(). @@ -362,14 +336,13 @@ logic 1. This function unlocks the port if possible and closes the fd. You should call this in your upsdrv_cleanup handler. - - ssize_t ser_send_char(int fd, unsigned char ch) + - int ser_send_char(int fd, char ch) This attempts to write one character and returns the return value from write. You could call write directly, but using this function allows for future error handling in one place. - - ssize_t ser_send_pace(int fd, useconds_t d_usec, - const char *fmt, ...) + - int ser_send_pace(int fd, unsigned long d_usec, const char *fmt, ...) If you need to send a formatted buffer with an intercharacter delay, use this function. There are a number of UPS controllers which can't take @@ -380,22 +353,21 @@ one. The return value is the number of characters that was sent to the port, or -1 if something failed. - - ssize_t ser_send(int fd, const char *fmt, ...) + - int ser_send(int fd, const char *fmt, ...) Like ser_send_pace, but without a delay. Only use this if you're sure that your UPS can handle characters at the full line rate. - - ssize_t ser_send_buf(int fd, const void *buf, size_t buflen) + - int ser_send_buf(int fd, const char *buf, size_t buflen) This sends a raw buffer to the fd. It is typically used for binary transmissions. It returns the results of the call to write. - - ssize_t ser_send_buf_pace(int fd, useconds_t d_usec, - const void *buf, size_t buflen) + - int ser_send_buf_pace(int fd, unsigned long d_usec, const char *buf, size_t buflen) This is just ser_send_buf with an intercharacter delay. - - ssize_t ser_get_char(int fd, void *ch, time_t d_sec, useconds_t d_usec) + - int ser_get_char(int fd, char *ch, long d_sec, long d_usec) This will wait up to d_sec seconds + d_usec microseconds for one character to arrive, storing it at ch. It returns 1 on success, -1 @@ -406,8 +378,7 @@ back to the usual idle loop in main in time to answer the PINGs from upsd. That will cause an oscillation between staleness and normal behavior. - - ssize_t ser_get_buf(int fd, void *buf, size_t buflen, - time_t d_sec, useconds_t d_usec) + - int ser_get_buf(int fd, char *buf, size_t buflen, long d_sec, long d_usec) Like ser_get_char, but this one reads up to buflen bytes storing all of them in buf. The buffer is zeroed regardless of success or failure. It @@ -415,8 +386,7 @@ returns the number of bytes read, -1 on failure and 0 on a timeout. This is essentially a single read() function with a timeout. - - ssize_t ser_get_buf_len(int fd, void *buf, size_t buflen, - time_t d_sec, useconds_t d_usec) + - int ser_get_buf_len(int fd, char *buf, size_t buflen, long d_sec, long d_usec) Like ser_get_buf, but this one waits for buflen bytes to arrive, storing all of them in buf. The buffer is zeroed regardless of success @@ -426,9 +396,8 @@ and 0 on a timeout. This should only be used for binary reads. See ser_get_line for protocols that are terminated by characters like CR or LF. - - ssize_t ser_get_line(int fd, void *buf, size_t buflen, - char endchar, const char *ignset, - time_t d_sec, useconds_t d_usec) + - int ser_get_line(int fd, char *buf, size_t buflen, char endchar, + const char *ignset, long d_sec, long d_usec) This is the reading function you should use if your UPS tends to send responses like "OK\r" or "1234\n". It reads up to buflen bytes and @@ -440,27 +409,26 @@ failure and 0 on a timeout. If the character matches the ignset with strchr(), it will not be added to the buffer. If you don't need to ignore any characters, just pass it -an empty string -- `""`. +an empty string - "". -The buffer is always cleared and is always `null`-terminated. It does -this by reading at most `(buflen - 1)` bytes. +The buffer is always cleared and is always null-terminated. It does +this by reading at most (buflen - 1) bytes. NOTE: any other data which is read after the endchar in the serial -buffer will be lost forever. As a result, you should not use this +buffer will be lost forever. As a result, you should not use this unless your UPS uses a polled protocol. -Let's say your endchar is `\n` and your UPS sends `"OK\n1234\nabcd\n"`. -This function will `read()` all of that, find the first `\n`, and stop -there. Your driver will get `"OK"`, and the rest is gone forever. +Let's say your endchar is \n and your UPS sends "OK\n1234\nabcd\n". +This function will read() all of that, find the first \n, and stop +there. Your driver will get "OK", and the rest is gone forever. This also means that you should not "pipeline" commands to the UPS. Send a query, then read the response, then send the next query. - - ssize_t ser_get_line_alert(int fd, void *buf, size_t buflen, - char endchar, const char *ignset, - const char *alertset, - void handler(char ch), - time_t d_sec, useconds_t d_usec) + + - int ser_get_line_alert(int fd, char *buf, size_t buflen, + char endchar, const char *ignset, const char *alertset, + void handler(char ch), long d_sec, long d_usec) This is just like ser_get_line, but it allows you to specify a set of alert characters which may be received at any time. They are not added @@ -471,7 +439,7 @@ Implementation note: this function actually does all of the work, and ser_get_line is just a wrapper that sets an empty alertset and a NULL handler. - - ssize_t ser_flush_in(int fd, const char *ignset, int verbose) + - int ser_flush_in(int fd, const char *ignset, int verbose) This function will drain the input buffer. If verbose is set to a positive number, then it will announce the characters which have been @@ -482,7 +450,7 @@ This function returns the number of characters which were read, so you can check for extra bytes by looking for a nonzero return value. Zero will also be returned if the read fails for some reason. - - int ser_flush_io(int fd) + - int set_flush_io(int fd) This function drains both the in- and output buffers. Return zero on success. @@ -523,14 +491,11 @@ Drivers which use USB functions should include usb-common.h and use these: Structure and macro ~~~~~~~~~~~~~~~~~~~ - -You should use the usb_device_id_t structure, and the USB_DEVICE macro to + +You should us the usb_device_id structure, and the USB_DEVICE macro to declare the supported devices. This allows the automatic extraction of -USB information, to generate the Hotplug, udev and UPower support files. - -The structure allows to convey `uint16_t` values of VendorID and ProductID, -and an optional matching-function callback to interrogate the device in -more detail (constrain known supported firmware versions, OEM brands, etc.) +USB information, to generate the HAL, Hotplug, udev and DeviceKit-power +support files. For example: @@ -539,36 +504,30 @@ For example: #define SOMEVENDOR_VENDORID 0xXXXX /* USB IDs device table */ -static usb_device_id_t sv_usb_device_table [] = { +static usb_device_id sv_usb_device_table [] = { /* some models 1 */ { USB_DEVICE(SOMEVENDOR_VENDORID, 0xYYYY), NULL }, - /* various models */ { USB_DEVICE(SOMEVENDOR_VENDORID, 0xZZZZ), NULL }, { USB_DEVICE(SOMEVENDOR_VENDORID, 0xAAAA), NULL }, - /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; -------------------------------------------------------------------------------- Function ~~~~~~~~ - - is_usb_device_supported(usb_device_id_t *usb_device_id_list, - USBDevice_t *device) + - is_usb_device_supported(usb_device_id **usb_device_id_list, + int dev_VendorID, int dev_ProductID) -Call this in your device opening / matching function. Pass your usb_device_id_t -list structure, and a set of VendorID, DeviceID, as well as Vendor, Product and -Serial strings, possibly also Bus, bcdDevice (device release number) and Device -name on the bus strings, in the USBDevice_t fields describing the specific piece -of hardware you are inspecting. +Call this in your device opening / matching function. Pass your usb_device_id +structure, and a set of VendorID / DeviceID. -This function returns one of the following value: +This function returns one of the following value: - NOT_SUPPORTED (0), -- POSSIBLY_SUPPORTED (1, returned when the VendorID is matched, but the -DeviceID is unknown), +- POSSIBLY_SUPPORTED (1, returned when the VendorID is matched, but the DeviceID is unknown), - or SUPPORTED (2). For implementation examples, refer to the various USB drivers, and search for @@ -608,15 +567,15 @@ function. Right now, there are only two possibilities: SET ~~~ -If your driver's function for handling variable set events is called +If your driver's function for handling variable set events is called my_ups_set(), then you'd do this to add the pointer: upsh.setvar = my_ups_set; my_ups_set() will receive two parameters: - const char * -- the variable being changed - const char * -- the new value + const char * - the variable being changed + const char * - the new value You should return either STAT_SET_HANDLED if your driver recognizes the command, or STAT_SET_UNKNOWN if it doesn't. Other possibilities will be @@ -632,8 +591,8 @@ arriving from the server. Your function will receive two args: - const char * -- the command name - const char * -- (reserved) + const char * - the command name + const char * - (reserved) You should return either STAT_INSTCMD_HANDLED or STAT_INSTCMD_UNKNOWN depending on whether your driver can handle the requested command. @@ -740,26 +699,6 @@ latter accepts either "\n", "\n\r" or "\r\n" as line termination. You can define other termination characters as well, but can't undefine "\r" and "\n" (so if you need these as data, this is not for you). -Adding the driver into the tree -------------------------------- - -In order to build your new driver, it needs to be added to -`drivers/Makefile.am`. At the moment, there are several driver list variables -corresponding to the general protocol of the driver (`SERIAL_DRIVERLIST`, -`SNMP_DRIVERLIST`, etc.). If your driver does not fit into one of these -categories, please discuss it on the nut-upsdev mailing list. - -There are also `*_SOURCES` and optional `*_LDADD` variables to list the source -files, and any additional linker flags. If your driver uses the C math -library, be sure to add `-lm`, since this flag is not always included by -default on embedded systems. - -When you add a driver to one of these lists, pay attention to the backslash -continuation characters (`\\`) at the end of the lines. - -The `automake` program converts the `Makefile.am` files into `Makefile.in` -files to be processed by `./configure`. See the discussion in <> -about automating the rebuild process for these files. [[contact-closure]] diff --git a/docs/nut-hal.txt b/docs/nut-hal.txt new file mode 100644 index 0000000..de0e53c --- /dev/null +++ b/docs/nut-hal.txt @@ -0,0 +1,118 @@ +Desc: NUT integration with FreeDesktop HAL - Hardware Abstraction Layer +File: nut-hal.txt +Date: 05 March 2008 +Auth: Arnaud Quette + +This document introduces NUT integration with FreeDesktop HAL +(Hardware Abstraction Layer), also called Integrated Power Management (IPM). + +Introduction +------------ + +This feature, also known as the Common Power Management integration, +allows NUT drivers to feed the HAL system, which will itself feeds +applications such as the Gnome Power Manager, in charge of the +system protection and notification. + +This allows a better integration with the HAL supported systems +(Linux, *BSD and Solaris), and to reuse applications that have +been written to support laptop batteries. This also means that +we avoid the code / application redundancy by not using the upsd +and upsmon / NUT Client layer. + +Since the NUT driver subset is limited to USB only, at least for +the moment, this should allow this feature to be shipped with a +base system. + +From a user point of view, since all the needed components are +present on the system, we can achieve a full plug and play system. +That is to say when you plug your USB UPS, the needed driver is +automatically loaded and the according application (ie GPM) is +made available (displayed) at runtime without having to install +anything else than the base system. Nothing more to install, +nothing more to configure... + +Detailed usage +--------------- + +Since this feature is still a work in progress, the below information +details how to get, install and test it. + +Note that the minimum HAL version required is 0.5.8 + +* install libhal-dev and its dependencies (libdbus-dev) +or equivalent packages for your system. + +* "./configure --with-hal && make" from within the nut dir + +* either do a "make install" or simply copy the file +drivers/hald-addon* to the HAL addons directory (ie +/usr/lib/hal/ on Debian) or equivalent dir. + +* copy the scripts/hal/20-ups-nut-device.fdi file to +$datadir/hal/fdi/information/20thirdparty +for example on Debian: /usr/share/hal/fdi/information/20thirdparty/ + +* create the (nut user and) group for the udev rule: +addgroup --quiet --system nut + +* add the hal user (ex: haldaemon) to the nut group using: +adduser --quiet haldaemon nut + +* restart HAL (ie using "/etc/init.d/dbus restart"). +I've personaly used "killall hal" and restarted it using +"hald --daemon=no --verbose=yes" to see the verbose logs + +* plug your UPS' USB cord into your computer + +* you should now see the UPS using: +- [kde-]hal-device-manager, +- gnome power manager (standard applet for battery management), which +will pop up and state that there is an UPS +- ... + +Packaging information +--------------------- + +The HAL support in NUT must currently be packaged separatly (ie in a +specific nut-hal package) and must conflict with the classic nut packages. +This is in order to: +- allow shipping of the HAL support only in the base system, +without including all the NUT drivers and software, +- prevent the NUT HAL addons to get an exclusive +and automatic access on a device, when a user only want to use the +USB support with a classic NUT installation. + +This will be addressed when the new NUT configuration framework +will be merged in the main code branch. + +Developing information +---------------------- + +As of NUT 2.2.2, the HAL integration also provide a DBus interface to +allow the calling of two method: +- Shutdown +- SetBeeper (boolean) + +Example: +dbus-send --system --print-reply --dest=org.freedesktop.Hal \ + /org/freedesktop/Hal/devices/usb_device_463_ffff_1H2E300AH \ + org.freedesktop.Hal.Device.UPS.Shutdown + +For development purposes, you might want to set the environment variable +"NUT_HAL_DEBUG" to something between "1" and "5". This matches the NUT debug +levels (-DDDDD). + +Credits +------- + +Thanks to the following people who made this possible: +- David Zeuthen, HAL Project Leader, +- Richard Hughes, Gnome Power Manager Developer. + +References +---------- + +* FreeDesktop HAL: http://freedesktop.org/wiki/Software_2fhal +* Gnome Power Manager: http://www.gnome.org/projects/gnome-power-manager/ + diff --git a/docs/nut-names.txt b/docs/nut-names.txt index efe1ae2..ebee1fe 100644 --- a/docs/nut-names.txt +++ b/docs/nut-names.txt @@ -1,68 +1,21 @@ ifndef::external_title[] -NUT variable names and instant commands -======================================= +NUT command and variable naming scheme +====================================== endif::external_title[] -[NOTE] -.RFC xxxx Recording Document -==== -This document is defined by (pending) RFC xxxx and is referenced as the -document of record for the variable names and the instant commands used -in the protocol described by the RFC. +This is a dump of the standard variables and command names used in NUT. +Don't use a name with any of the dstate functions unless it exists here. -On behalf of the RFC, this document records the names of variables -describing the abstracted state of an UPS or similar power distribution -device, and the instant commands sent to the UPS using command `INSTCMD`, -as used in commands and messages between the Attachment Daemon (the `upsd` -in case of NUT implementation of the standard) and the clients. -==== +If you need a new variable or command name, contact the Development Team +first. -This document defines the standard names of NUT commands and variables. -Developers should use the names recorded here, with dstate functions and -data mappings provided in NUT drivers for interactions with power devices. +Put another way: if you make up a name that's not in this list and it +gets into the tree, and then we come up with a better name later, clients +that use the undocumented variable will break when it is changed. -If you need to express a state which cannot be described by any existing -name, please make a request to the NUT developers' mailing list for -definition and assignment of a new name. Clients using unrecorded names -risk breaking at a future update. If you wish to experiment with new -concepts before obtaining your requested variable name, you should use -a name of the form `experimental.x.y` for those states. - -Put another way: if you make up a name that is not in this list and it -gets into the source code tree, and then the NUT community comes up with -a better name later, clients that already use the undocumented variable -will break when it is eventually changed. An explicitly "experimental" -data point is less surprising in this regard. - -NOTE: In the descriptions, "opaque" means programs should not attempt to -parse the value for that variable as it may vary greatly from one UPS -(or similar device) to the next. These strings are best handled directly -by the user. - - -Time and Date format --------------------- - -When possible, dates should be expressed in ISO 8601 and RFC 3339 compatible -Calendar format, that is to say "YYYY-MM-DD", or otherwise a Combined Date -and Time representation (`T
"]||(!O.indexOf("
"]||!O.indexOf("
"]||!o.support.htmlSerialize&&[1,"div
","
"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}}); +/* + * Sizzle CSS Selector Engine - v0.9.3 + * Copyright 2009, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * More information: http://sizzlejs.com/ + */ +(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return UT[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="

";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="
";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("
").append(M.responseText.replace(//g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='
';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file diff --git a/docs/website/scripts/nut_jquery.js b/docs/website/scripts/nut_jquery.js new file mode 100644 index 0000000..76e9fa7 --- /dev/null +++ b/docs/website/scripts/nut_jquery.js @@ -0,0 +1,577 @@ +var NUT = { + + // UPS table DOM ids + listID: "#ups_list", + listBodyID: "#ups_list_body", + + // Field names + fields: [ + "manufacturer", + "device-type", + "support-level", + "model", + "comment", + "driver" + ], + + // Actual HTML table columns + columns: [ + [ "manufacturer" ], + [ "model", "comment" ], + [ "driver" ], + [ "support-level" ], + ], + + // driver => connection type mappings + driverMap: function(driver) { + + // Try not to catch "usb" across a word boundary: + if (driver.match(/_usb|usbserial|usbhid-ups/)) + return "USB"; + + // TODO: what about IPMI/powerman-pdu? + if (driver.match(/snmp-ups|netxml-ups/)) + return "Network"; + + return "Serial"; + + }, + + // Support level => CSS class mappings + supportLevelClasses: { + 0: "", + 1: "red", + 2: "orange", + 3: "yellow", + 4: "blue", + 5: "green" + }, + + tableCache: false, + + // Parse GET parameters from window url and return them as a hash + // The call format is: + // stable-hcl.html?= + // Refer to docs/stable-hcl.txt for examples + parseGetParameters: function() { + + var url = window.location.href; + url = url.replace(/#$/, ""); + + var fieldPos = url.indexOf("?"); + + var get = {}; + + if (fieldPos > -1) { + + var fileName = url.substring(0, fieldPos); + var getList = url.substring(fieldPos + 1).split("&"); + + for (var i = 0; i < getList.length; i++) { + + var getField = getList[i].split("="); + + key = unescape(getField[0]).toLowerCase(); + + value = unescape(getField[1]); + + // just in case there are any old links out there. + if (key === "manufacturer" && value === "Tripp-Lite") { + value = "Tripp Lite"; + } + + get[key] = value; + + } + + } + + return get; + + }, + + // UPS filter renderers by data column index + filterRenderers: { + + "support-level": function(value) { + + var result = []; + + for (var i = 0; i < value; i++) + result.push("*"); + + return result.join(""); + + }, + + "driver": function(value) { + + return this.driverMap(value); + + }, + + "device-type": function(value) { + + var map = { + "pdu": "Power Distribution Unit", + "ups": "Uninterruptible Power Supply", + "scd": "Solar Controller Device" + } + + return map[value]; + + } + + }, + + // Specific filter handlers + filterHandlers: { + + // Filter functions: + // @param {string} value value to filter + // @param {array} row raw data fields + // @return {boolean} true if value passes the filter, false otherwise + + "driver": function(value, row) { + + var driver = row[this.fields.indexOf("driver")]; + + if (this.driverMap(driver) == value) + return true; + + return false; + + }, + + "support-level": function(value, row) { + + var level = row[this.fields.indexOf("support-level")]; + + if (level >= value) + return true; + + return false; + + } + + }, + + // Returns rendered UPS data according to column index + // @param {integer} index + // @param {string} value + renderFilter: function(index, value) { + + var renderer = this.filterRenderers[this.fields[index]]; + + if (typeof renderer == "function") + return renderer.call(this, value); + + return value; + + }, + + // Initialization method + init: function() { + + this.initFilters(); + this.sortUPSData(UPSData); + this.buildUPSList(UPSData); + this.buildFilters(UPSData); + + var get = this.parseGetParameters(); + + for (var param in get) { + + var filter = $("#"+param); + + if (filter) { + + filter.val(get[param]); + + this.doFilter(); + + } + + } + + }, + + // Initialize filter filters references + initFilters: function() { + + // Display filters fieldset hidden by default for user-agents not using javascript + $("#filters-set").show(); + + this.filters = { + + "support-level": { + index: this.fields.indexOf("support-level"), + field: $("#support-level") + }, + + "device-type": { + index: this.fields.indexOf("device-type"), + field: $("#device-type") + }, + + "manufacturer": { + index: this.fields.indexOf("manufacturer"), + field: $("#manufacturer") + }, + + "model": { + index: this.fields.indexOf("model"), + field: $("#model") + }, + + "driver": { + index: this.fields.indexOf("driver"), + field: $("#connection") + } + + } + + }, + + // Sorts table data by manufacturer and driver + // @param {Object} data + sortUPSData: function(data) { + + var mI = this.fields.indexOf("manufacturer"), + dI = this.fields.indexOf("driver"); + + data.sort(function(a, b) { + + var toLower = function(ar) { + + var res = ar.slice(); + + res.forEach(function(i, index) { + + if (typeof i == "string") + res[index] = i.toLowerCase() + + }); + + return res; + + } + + var c = toLower(a), + d = toLower(b); + + return c[mI] == d[mI] ? c[dI] > d[dI] : c[mI] > d[mI]; + + }); + + }, + + // Builds UPS list from provided data + // @param {array} data + buildUPSList: function(data) { + + var list = $(this.listBodyID); + + // Initialize table cache + if (!this.tableCache) + this.tableCache = list.html(); + + // If we're rebuilding the original table, just use the one in cache + if (data == UPSData && this.tableCache) { + list.html(this.tableCache); + return; + } + + list.empty(); + + // Bailout if no data + if (!data || data.length == 0) + return; + + // Build rows + var cellHistory = [], rows = []; + + var rowHistory = data[0][0]; + + var classes = [ "even", "odd" ], + manufIndex = this.fields.indexOf("manufacturer"), + currentClass = 0; + + data.forEach(function(upsRow, rowIndex) { + + if (upsRow[manufIndex] != rowHistory) { + currentClass = Number(!currentClass); + rowHistory = upsRow[manufIndex]; + } + + var cells = []; + + // Build cells + this.columns.forEach(function(column, colIndex) { + + var cellContent = []; + + column.forEach(function(field) { + cellContent.push(upsRow[this.fields.indexOf(field)]) + }, this); + + cellContent = cellContent.join("
"); + + // Inspect the last cell on this column and increase row span if the current cell has the same content + var cH = cellHistory[colIndex]; + + if (column.indexOf("driver") == -1 && cH && cH.html == cellContent) + cH.rowSpan += 1; + else { + + var cell = ""; + + if (column.indexOf("driver") != -1) { + + cell = { + html: cellContent, + rowSpan: 1, + cls: this.supportLevelClasses[upsRow[this.fields.indexOf("support-level") || ""]] + }; + + } else { + + cell = { + html: cellContent, + rowSpan: 1, + cls: classes[currentClass] + } + + } + + if (column.indexOf("support-level") != -1) + cell.cls += " hidden"; + + cells.push(cell); + + cellHistory[colIndex] = cell; + + } + + }, this); + + rows.push(cells); + + }, this); + + // Generate actual rows/cells tags + rows.forEach(function(r, index) { + + r.forEach(function(c, index) { + r[index] = [ "", c.html, "" ].join(""); + }); + + rows[index] = [ "", r.join(""), "" ].join(""); + + }); + + list.html(rows.join("")); + + }, + + // Initialize filters event listeners + // @param {Object} data + buildFilters: function(data) { + + for (var f in this.filters) { + + var filter = this.filters[f]; + + this.populateCombo(data, filter); + + filter.field.change(this.doFilter); + + var op = $("#op-" + (filter.index)); + + if (op) + op.change(this.doFilter); + + } + + }, + + // Load data in filter combos + // @param {array} data + // @param {object} combo + // @param {integer} index + populateCombo: function(data, filter) { + + var values = []; + var valueDict = {}; + + var combo = filter.field; + var oldValue = combo.val(); + + combo.html(""); + + // Special case for connection type + if (filter.field.attr("id") == "connection") { + + [ "Serial", "USB", "Network" ].forEach(function(type) { + + values.push([ type, type ]); + + }, this); + + } else { + + data.forEach(function(row) { + + var value = row[filter.index]; + + if (value != "" && !valueDict[value]) { + + values.push([ value, this.renderFilter(filter.index, value) ]); + + valueDict[value] = true; + + } + + }, this); + + values = values.sort(); + + } + + values.forEach(function(value) { + + var option = $(document.createElement("option")); + + option.val(value[0]); + option.text(value[1]); + + combo.append(option); + + }, this); + + combo.val(oldValue); + + }, + + // Apply selected filters on UPS list + doFilter: function() { + + var initialRows = UPSData.slice(); + var filteredRows = UPSData.slice(); + + // Applies a single filter on provided UPS data set + // @param {string} value + // @param {integer} index + // @param {array} data + // @returns {array} filtered data set + var applyFilter = function(value, index, data) { + + var tmpData = []; + tmpData = data.slice(); + + tmpData.forEach(function(row, rowIndex) { + + var field = row[index]; + + var handler = this.filterHandlers[this.fields[index]]; + + if (handler) { + + if (!handler.apply(this, [ value, row ])) + data.splice(data.indexOf(row), 1); + + } else if (row[index] != value) + data.splice(data.indexOf(row), 1); + + }, this); + + return data; + + } + + // Sequentially apply filters + for (var f in NUT.filters) { + + var filter = NUT.filters[f]; + var value = filter.field.val(); + + // Is filter active, i.e have the user picked a value in the filter combo + if (value != "-1") { + var opField = $("#op-" + filter.index); + filteredRows = applyFilter.apply(NUT, [ value, filter.index, filteredRows ]); + } + + } + + // Rebuild UPS list and combos according to filtered data + NUT.buildUPSList(filteredRows); + + [ "manufacturer", "model", "driver" ].forEach(function(id) { + + if (this.id != id) + this.populateCombo(filteredRows, this.filters[id]); + + }, NUT); + + }, + + resetCombos: function() { + + for (var f in this.filters) { + + var field = this.filters[f].field; + + this.populateCombo(UPSData, this.filters[f]); + + field.val("-1"); + + } + + this.buildUPSList(UPSData); + + } + +} + +if (typeof Array.prototype.indexOf != "function") { + + Array.prototype.indexOf = function(elt) { + + var i = 0; + + while (i < this.length) { + + if (this[i] == elt) + return i; + + i++; + + } + + return -1; + + } + +} + +if (typeof Array.prototype.forEach != "function") { + + Array.prototype.forEach = function(cb, scope) { + + for (var i = 0, n = this.length; i < n; i++) { + + if (i in this) + cb.call(scope, this[i], i, this); + + } + + } + +} + +// Global initialization +$(function() { + + NUT.init.call(NUT); + +}); diff --git a/docs/website/scripts/toc.js b/docs/website/scripts/toc.js new file mode 100644 index 0000000..be6daba --- /dev/null +++ b/docs/website/scripts/toc.js @@ -0,0 +1,69 @@ +/* Author: Mihai Bazon, September 2002 + * http://students.infoiasi.ro/~mishoo + * + * Table Of Content generator + * Version: 0.4 + * + * Feel free to use this script under the terms of the GNU General Public + * License, as long as you do not remove or alter this notice. + */ + + /* modified by Troy D. Hanson, September 2006. License: GPL */ + /* modified by Stuart Rackham, October 2006. License: GPL */ + +function getText(el) { + var text = ""; + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. + text += i.data; + else if (i.firstChild != null) + text += getText(i); + } + return text; +} + +function TocEntry(el, text, toclevel) { + this.element = el; + this.text = text; + this.toclevel = toclevel; +} + +function tocEntries(el, toclevels) { + var result = new Array; + var re = new RegExp('[hH]([2-'+(toclevels+1)+'])'); + // Function that scans the DOM tree for header elements (the DOM2 + // nodeIterator API would be a better technique but not supported by all + // browsers). + var iterate = function (el) { + for (var i = el.firstChild; i != null; i = i.nextSibling) { + if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { + var mo = re.exec(i.tagName) + if (mo) + result[result.length] = new TocEntry(i, getText(i), mo[1]-1); + iterate(i); + } + } + } + iterate(el); + return result; +} + +// This function does the work. toclevels = 1..4. +function generateToc(toclevels) { + var toc = document.getElementById("toc"); + var entries = tocEntries(document.getElementsByTagName("body")[0], toclevels); + for (var i = 0; i < entries.length; ++i) { + var entry = entries[i]; + if (entry.element.id == "") + entry.element.id = "toc" + i; + var a = document.createElement("a"); + a.href = "#" + entry.element.id; + a.appendChild(document.createTextNode(entry.text)); + var div = document.createElement("div"); + div.appendChild(a); + div.className = "toclevel" + entry.toclevel; + toc.appendChild(div); + } + if (entries.length == 0) + document.getElementById("header").removeChild(toc); +} diff --git a/docs/website/ups-protocols.txt b/docs/website/ups-protocols.txt new file mode 100644 index 0000000..fd20cc6 --- /dev/null +++ b/docs/website/ups-protocols.txt @@ -0,0 +1,110 @@ + +WARNING: this is a Work In Progress document. For the time being, you +should refer to the +link:http://old.networkupstools.org/protocols/[old NUT website library]. + +UPS Protocols +------------- + +All protocol information on this site is provided in the hope that it will be +useful. + +Some are officialy provided by the manufacturers, while others are the result of +reverse engineering work. + +However, UPS hardware is plentiful and varied. Test your software thoroughly, as +these documents may not always reflect the reality within your equipment! + +APC +~~~ + +- link:ups-protocols/apcsmart.html[APC's smart protocol] - unofficial decoding work + +Belkin +~~~~~~ + +- link:ups-protocols/belkinsmart.html[Belkin's smart protocol] - unofficial decoding work on the Regulator Pro + +- link:ups-protocols/belkinuniversal.html[Belkin Universal UPS] - courtesy of Peter Selinger + +Eaton +~~~~~ + +- Eaton Protocols Library - all official Eaton documents are here, including Powerware, MGE, ... + +- Best Fortress protocol - for LI 520, 720, 1020, and 1420 models + +- SOLA/Best Power protocol (Phoenixtec) - courtesy of Invensys Energy Systems + +MicroDowell +~~~~~~~~~~~ + +- MicroDowell UPS Serial Protocol v3.3.1 (PDF, 225KB) + +MGE +~~~ + +- MGE Protocols Library - all official MGE documents are here + +ONEAC +~~~~~ + +- ONEAC serial information - two scans + +Opti-UPS +~~~~~~~~ + +- Opti-UPS protocol - more guesswork + +Powercom +~~~~~~~~ + +All these document are officially provided by Powercom + +- link:ups-protocols/powercom/Software_USB_communication_controller_BNT_series.doc[USB information for BNT series] +- link:ups-protocols/powercom/Software_USB_communication_controller_IMPERIAL_series_R21.doc[USB information for IMPERIAL series] +- link:ups-protocols/powercom/Software_USB_communication_controller_SKP_series.doc[USB information for SKP series] +- link:ups-protocols/powercom/Software_USB_communication_controller_WOW_series.doc[USB information for WOW series] + +PowerKinetics +~~~~~~~~~~~~~ + +- PowerKinetics MiniCOL protocol - courtesy of PowerKinetics technical support + +Riello +~~~~~~ + +All these document are officially provided by Riello + +- link:ups-protocols/riello/PSGPSER-0104.pdf[GPSER protocol] +- link:ups-protocols/riello/PSSENTR-0100.pdf[Sentry HPS / HTS protocol] +- link:ups-protocols/riello/Riello_UPS_protocol_list.pdf[UPS protocol list] + +Standard protocols +~~~~~~~~~~~~~~~~~~ + +SEC +^^^ +- link:ups-protocols/sec.html[SEC protocol] - superset of the US9003, below + +- link:ups-protocols/sec-standard.html[SEC standard UPS Communication interface] - 15 scanned pages + +- link:us9003.html[US9003 UPS Communication Interface] + +SNMP +^^^^ + +- link:ups-protocols/snmp.html[SNMP] +- link:http://powerquality.eaton.com/Support/Software-Drivers/Downloads/connectivity-firmware/bestpwr2.mib[Best Power MIB] + +USB/HID Power Devices Class +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +- link:http://www.usb.org/developers/devclass_docs/pdcv10.pdf[USB Usage Tables for HID Power Devices] (offsite PDF, 351K) + + +Various +~~~~~~~ + +- link:ups-protocols/megatec.html[Megatec] UPS Protocol + diff --git a/docs/website/web-layout.conf b/docs/website/web-layout.conf new file mode 100644 index 0000000..29ba745 --- /dev/null +++ b/docs/website/web-layout.conf @@ -0,0 +1,185 @@ +# +# Network UPS Tools website layout (based on AsciiDoc's). +# Three division CSS based layout +# +# Simulated frames using CSS (fixed banner and menu, scrolling content). +# NOTE: This layout does not work with IE6. +# +# +-----------------------------------------------------+ +# | #layout-banner | +# +--------------+--------------------------------------+ +# | | | +# | | | +# | #layout-menu | #layout-content | +# | | | +# | | | +# | | | +# +--------------+--------------------------------------+ +# +# Each of the three divisions is enclosed in a same-named *-box division +# which position and size the layout. +# +# - The #layout-content division is a container for AsciiDoc page documents. +# - Documents rendered in the #layout-content use the standard AsciiDoc +# xhtml11 backend stylesheets. + +[specialwords] +#emphasizedwords=(?u)\\?\bNetwork UPS Tools\b +#monospacedwords=(?u)\\?\basciidoc\(1\) (?u)\\?\ba2x\(1\) + +[header] + + + +Network UPS Tools - {doctitle} + + + + + +{doctype-manpage} +ifdef::quirks[] + +endif::quirks[] + + + +ifdef::toc[] + + +endif::toc[] +ifdef::hcl[] + + + +endif::hcl[] + + + + +
+
+ +
Network UPS Tools
+
Power Devices support
+
+
+ +
+
+# Article, book header. +ifndef::doctype-manpage[] + +ifdef::toc[] +
+
Table of Contents
+ +
+endif::toc[] +endif::doctype-manpage[] +# Man page header. +ifdef::doctype-manpage[] + +endif::doctype-manpage[] + +[footer] + +
+
+ + +endif::analytics[] + + diff --git a/docs/website/website.txt b/docs/website/website.txt new file mode 100644 index 0000000..18ff58a --- /dev/null +++ b/docs/website/website.txt @@ -0,0 +1,19 @@ +Welcome +======= + +The primary goal of the Network UPS Tools (NUT) project is to provide support +for Power Devices, such as Uninterruptible Power Supplies, Power Distribution +Units and Solar Controllers. + +NUT provides many control and monitoring link:features.html[features], with a +uniform control and management interface. + +More than 100 different manufacturers, and several thousands models are +link:stable-hcl.html[compatible]. + +This software is the combined effort of many +link:acknowledgements.html[individuals and companies]. + +News +---- +include::news.txt[] diff --git a/docs/xhtml.xsl b/docs/xhtml.xsl deleted file mode 100644 index e8dc331..0000000 --- a/docs/xhtml.xsl +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 98fe667..f8158d5 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -1,17 +1,12 @@ # Network UPS Tools: drivers -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libparseconf.la \ -$(top_builddir)/clients/libupsclient.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - # by default, link programs in this directory with libcommon.la # (libtool version of the static lib, in order to access LTLIBOBJS) #FIXME: SERLIBS is only useful for LDADD_DRIVERS_SERIAL not for LDADD_COMMON -LDADD_COMMON = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la -LDADD_DRIVERS = libdummy.la $(LDADD_COMMON) -LDADD_DRIVERS_SERIAL = libdummy_serial.la $(LDADD_DRIVERS) $(SERLIBS) +LDADD_COMMON = ../common/libcommon.la ../common/libparseconf.la +LDADD_DRIVERS = $(LDADD_COMMON) main.o dstate.o +LDADD_HAL_DRIVERS = $(LDADD_COMMON) libnuthalmain.a +LDADD_DRIVERS_SERIAL = $(LDADD_DRIVERS) $(SERLIBS) serial.o # most targets are drivers, so make this the default LDADD = $(LDADD_DRIVERS_SERIAL) @@ -19,9 +14,15 @@ LDADD = $(LDADD_DRIVERS_SERIAL) # files. In any case, CFLAGS are only -I options, so there is no harm, # but only add them if we really use the target. AM_CFLAGS = -I$(top_srcdir)/include +if WITH_HAL + AM_CFLAGS += $(LIBHAL_CFLAGS) +endif if WITH_USB AM_CFLAGS += $(LIBUSB_CFLAGS) endif +if WITH_SNMP + AM_CFLAGS += $(LIBNETSNMP_CFLAGS) +endif if WITH_NEON AM_CFLAGS += $(LIBNEON_CFLAGS) endif @@ -31,34 +32,26 @@ endif if WITH_IPMI AM_CFLAGS += $(LIBIPMI_CFLAGS) endif -if WITH_MODBUS - AM_CFLAGS += $(LIBMODBUS_CFLAGS) -endif SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \ bestfortress bestuferrups bestups dummy-ups etapro everups \ gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \ - mge-utalk microdowell microsol-apc mge-shut oneac optiups powercom rhino \ - safenet nutdrv_siemens-sitop skel solis tripplite tripplitesu upscode2 victronups powerpanel \ - blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser + oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \ + safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \ + blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser \ + nutdrv_qx SNMP_DRIVERLIST = snmp-ups USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ - blazer_usb richcomm_usb riello_usb \ - nutdrv_atcl_usb + blazer_usb richcomm_usb riello_usb nutdrv_qx USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST) -SERIAL_USB_DRIVERLIST = \ - nutdrv_qx +HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \ + hald-addon-tripplite_usb hald-addon-blazer_usb hald-addon-riello_usb \ + hald-addon-nutdrv_qx NEONXML_DRIVERLIST = netxml-ups MACOSX_DRIVERLIST = macosx-ups -MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus huawei-ups2000 socomec_jbus adelsystem_cbi -LINUX_I2C_DRIVERLIST = asem pijuice -POWERMAN_DRIVERLIST = powerman-pdu -IPMI_DRIVERLIST = nut-ipmipsu # distribute all drivers, even ones that are not built by default -EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(USB_DRIVERLIST) $(SERIAL_USB_DRIVERLIST) -EXTRA_PROGRAMS += $(SNMP_DRIVERLIST) $(NEONXML_DRIVERLIST) $(MACOSX_DRIVERLIST) -EXTRA_PROGRAMS += $(LINUX_I2C_DRIVERLIST) +EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(SNMP_DRIVERLIST) $(USB_DRIVERLIST) $(NEONXML_DRIVERLIST) $(MACOSX_DRIVERLIST) # construct the list of drivers to build if SOME_DRIVERS @@ -66,11 +59,7 @@ if SOME_DRIVERS else driverexec_PROGRAMS = if WITH_SERIAL - driverexec_PROGRAMS += $(SERIAL_DRIVERLIST) $(SERIAL_USB_DRIVERLIST) -else -if WITH_USB - driverexec_PROGRAMS += $(SERIAL_USB_DRIVERLIST) -endif + driverexec_PROGRAMS += $(SERIAL_DRIVERLIST) endif if WITH_SNMP driverexec_PROGRAMS += $(SNMP_DRIVERLIST) @@ -78,30 +67,28 @@ endif if WITH_USB driverexec_PROGRAMS += $(USB_LIBUSB_DRIVERLIST) endif +if WITH_HAL + halexecdir = $(HAL_CALLOUTS_PATH) + halexec_PROGRAMS = $(HAL_DRIVERLIST) +endif if WITH_NEON driverexec_PROGRAMS += $(NEONXML_DRIVERLIST) endif if WITH_LIBPOWERMAN - driverexec_PROGRAMS += $(POWERMAN_DRIVERLIST) + driverexec_PROGRAMS += powerman-pdu endif if WITH_IPMI - driverexec_PROGRAMS += $(IPMI_DRIVERLIST) + driverexec_PROGRAMS += nut-ipmipsu endif if WITH_MACOSX driverexec_PROGRAMS += $(MACOSX_DRIVERLIST) endif -if WITH_LINUX_I2C - driverexec_PROGRAMS += $(LINUX_I2C_DRIVERLIST) -endif -if WITH_MODBUS - driverexec_PROGRAMS += $(MODBUS_DRIVERLIST) -endif else driverexec_PROGRAMS += skel endif # always build upsdrvctl -sbin_PROGRAMS = upsdrvctl +driverexec_PROGRAMS += upsdrvctl # ========================================================================== # Driver build details @@ -119,7 +106,6 @@ bcmxcp_LDADD = $(LDADD) -lm belkin_SOURCES = belkin.c belkinunv_SOURCES = belkinunv.c bestfcom_SOURCES = bestfcom.c -bestfortress_SOURCES = bestfortress.c bestuferrups_SOURCES = bestuferrups.c bestups_SOURCES = bestups.c blazer_ser_SOURCES = blazer.c blazer_ser.c @@ -135,11 +121,9 @@ liebert_SOURCES = liebert.c liebert_esp2_SOURCES = liebert-esp2.c masterguard_SOURCES = masterguard.c metasys_SOURCES = metasys.c -metasys_LDADD = $(LDADD) -lm +oldmge_shut_SOURCES = mge-shut.c hidparser.c mge_utalk_SOURCES = mge-utalk.c microdowell_SOURCES = microdowell.c -microsol_apc_SOURCES = microsol-apc.c microsol-common.c -microsol_apc_LDADD = $(LDADD) -lm oneac_SOURCES = oneac.c optiups_SOURCES = optiups.c powercom_SOURCES = powercom.c @@ -149,9 +133,7 @@ powerpanel_LDADD = $(LDADD) -lm rhino_SOURCES = rhino.c rhino_LDADD = $(LDADD) -lm safenet_SOURCES = safenet.c -nutdrv_siemens_sitop_SOURCES = nutdrv_siemens_sitop.c solis_SOURCES = solis.c -solis_LDADD = $(LDADD) -lm tripplite_SOURCES = tripplite.c tripplite_LDADD = $(LDADD) -lm tripplitesu_SOURCES = tripplitesu.c @@ -166,7 +148,7 @@ riello_ser_LDADD = $(LDADD) -lm # dummy dummy_ups_SOURCES = dummy-ups.c dummy_ups_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/clients -dummy_ups_LDADD = $(LDADD_DRIVERS) $(top_builddir)/clients/libupsclient.la +dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la if WITH_SSL dummy_ups_CFLAGS += $(LIBSSL_CFLAGS) dummy_ups_LDADD += $(LIBSSL_LIBS) @@ -187,65 +169,60 @@ skel_SOURCES = skel.c skel_LDADD = $(LDADD_DRIVERS) # USB -if WITH_LIBUSB_0_1 -LIBUSB_IMPL = libusb0.c -endif -if WITH_LIBUSB_1_0 -LIBUSB_IMPL = libusb1.c -endif -USBHID_UPS_SUBDRIVERS = apc-hid.c arduino-hid.c belkin-hid.c cps-hid.c explore-hid.c \ +USBHID_UPS_SUBDRIVERS = apc-hid.c belkin-hid.c cps-hid.c explore-hid.c \ liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-hid.c \ - openups-hid.c powervar-hid.c delta_ups-hid.c ever-hid.c legrand-hid.c salicru-hid.c -usbhid_ups_SOURCES = usbhid-ups.c libhid.c $(LIBUSB_IMPL) hidparser.c \ + openups-hid.c +usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c \ usb-common.c $(USBHID_UPS_SUBDRIVERS) -usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm +usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -tripplite_usb_SOURCES = tripplite_usb.c $(LIBUSB_IMPL) usb-common.c +tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c -bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm +bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -blazer_usb_SOURCES = blazer.c blazer_usb.c $(LIBUSB_IMPL) usb-common.c +blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm -nutdrv_atcl_usb_SOURCES = nutdrv_atcl_usb.c usb-common.c -nutdrv_atcl_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) - richcomm_usb_SOURCES = richcomm_usb.c usb-common.c richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -riello_usb_SOURCES = riello.c riello_usb.c $(LIBUSB_IMPL) usb-common.c +riello_usb_SOURCES = riello.c riello_usb.c libusb.c usb-common.c riello_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm # HID-over-serial mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c # per-target CFLAGS are necessary here -mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE=1 -mge_shut_LDADD = $(LDADD) -lm +mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE +mge_shut_LDADD = $(LDADD) # SNMP -# Please keep the MIB table below sorted roughly alphabetically (incidentally -# by vendor too) to ease maintenance and codebase fork resynchronisations -snmp_ups_SOURCES = snmp-ups.c snmp-ups-helpers.c \ - apc-mib.c apc-pdu-mib.c \ - baytech-mib.c bestpower-mib.c \ - compaq-mib.c cyberpower-mib.c \ - delta_ups-mib.c \ - eaton-pdu-genesis2-mib.c eaton-pdu-marlin-mib.c eaton-pdu-marlin-helpers.c \ - eaton-pdu-pulizzi-mib.c eaton-pdu-revelation-mib.c \ - eaton-ats16-nmc-mib.c eaton-ats16-nm2-mib.c apc-ats-mib.c eaton-ats30-mib.c \ - emerson-avocent-pdu-mib.c \ - hpe-pdu-mib.c huawei-mib.c \ - ietf-mib.c \ - mge-mib.c \ - netvision-mib.c \ - powerware-mib.c \ - raritan-pdu-mib.c raritan-px2-mib.c \ - xppc-mib.c -snmp_ups_CFLAGS = $(AM_CFLAGS) -snmp_ups_CFLAGS += $(LIBNETSNMP_CFLAGS) -snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS) -lm +snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \ + ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \ + bestpower-mib.c cyberpower-mib.c delta_ups-mib.c +snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS) + +# HAL +hald_addon_usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c \ + $(USBHID_UPS_SUBDRIVERS) +hald_addon_usbhid_ups_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) + +hald_addon_tripplite_usb_SOURCES = tripplite_usb.c libusb.c +hald_addon_tripplite_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm + +hald_addon_bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c +hald_addon_bcmxcp_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) + +hald_addon_blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c +hald_addon_blazer_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm + +hald_addon_riello_usb_SOURCES = riello.c riello_usb.c libusb.c +hald_addon_riello_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm + +hald_addon_nutdrv_qx_SOURCES = nutdrv_qx.c libusb.c $(NUTDRV_QX_SUBDRIVERS) +hald_addon_nutdrv_qx_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm +hald_addon_nutdrv_qx_CFLAGS = $(AM_CFLAGS) -DQX_USB # NEON XML/HTTP netxml_ups_SOURCES = netxml-ups.c mge-xml.c @@ -258,11 +235,8 @@ powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LIBS) # IPMI PSU nut_ipmipsu_SOURCES = nut-ipmipsu.c if WITH_FREEIPMI - nut_ipmipsu_SOURCES += nut-libfreeipmi.c + nut_ipmipsu_SOURCES += nut-libfreeipmi.c endif -# FIXME: Hacky hot-fix for build agents of varying OS generations: -# Different versions of IPMI libs requested 'unsigned int *' or 'int *' args: -#nut_ipmipsu_CFLAGS = $(AM_CFLAGS) -Wno-pointer-sign nut_ipmipsu_LDADD = $(LDADD) $(LIBIPMI_LIBS) # Mac OS X metadriver @@ -270,49 +244,22 @@ macosx_ups_LDADD = $(LDADD_DRIVERS) macosx_ups_LDFLAGS = $(LDFLAGS) -framework IOKit -framework CoreFoundation macosx_ups_SOURCES = macosx-ups.c -# Modbus drivers -phoenixcontact_modbus_SOURCES = phoenixcontact_modbus.c -phoenixcontact_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) -generic_modbus_SOURCES = generic_modbus.c -generic_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) -adelsystem_cbi_SOURCES = adelsystem_cbi.c -adelsystem_cbi_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) - -# Huawei UPS2000 driver -# (this is both a Modbus and a serial driver) -huawei_ups2000_SOURCES = huawei-ups2000.c -huawei_ups2000_LDADD = $(LDADD_DRIVERS_SERIAL) $(LIBMODBUS_LIBS) - -# Socomec JBUS driver -# (this is a Modbus driver) -socomec_jbus_SOURCES = socomec_jbus.c -socomec_jbus_LDADD = $(LDADD_DRIVERS_SERIAL) $(LIBMODBUS_LIBS) - -# Linux I2C drivers -asem_LDADD = $(LDADD_DRIVERS) -asem_SOURCES = asem.c -pijuice_LDADD = $(LDADD_DRIVERS) -pijuice_SOURCES = pijuice.c - # nutdrv_qx USB/Serial nutdrv_qx_SOURCES = nutdrv_qx.c nutdrv_qx_LDADD = $(LDADD_DRIVERS) -lm nutdrv_qx_CFLAGS = $(AM_CFLAGS) if WITH_SERIAL nutdrv_qx_CFLAGS += -DQX_SERIAL -nutdrv_qx_LDADD += libdummy_serial.la $(SERLIBS) +nutdrv_qx_LDADD += $(SERLIBS) serial.o endif if WITH_USB nutdrv_qx_CFLAGS += -DQX_USB -nutdrv_qx_SOURCES += $(LIBUSB_IMPL) usb-common.c +nutdrv_qx_SOURCES += libusb.c usb-common.c nutdrv_qx_LDADD += $(LIBUSB_LIBS) endif -NUTDRV_QX_SUBDRIVERS = nutdrv_qx_bestups.c nutdrv_qx_blazer-common.c \ - nutdrv_qx_masterguard.c \ - nutdrv_qx_mecer.c nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c \ - nutdrv_qx_mustek.c nutdrv_qx_q1.c nutdrv_qx_voltronic.c \ - nutdrv_qx_voltronic-qs.c nutdrv_qx_voltronic-qs-hex.c nutdrv_qx_zinto.c \ - nutdrv_qx_hunnox.c nutdrv_qx_ablerex.c +NUTDRV_QX_SUBDRIVERS = nutdrv_qx_blazer-common.c nutdrv_qx_mecer.c \ + nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c nutdrv_qx_mustek.c \ + nutdrv_qx_voltronic.c nutdrv_qx_zinto.c nutdrv_qx_SOURCES += $(NUTDRV_QX_SUBDRIVERS) # ---------------------------------------------------------------------- @@ -320,44 +267,32 @@ nutdrv_qx_SOURCES += $(NUTDRV_QX_SUBDRIVERS) # tracking (which is automatic), but to ensure these files are # distributed by "make dist". -dist_noinst_HEADERS = apc-mib.h apc-iem-mib.h apc-hid.h arduino-hid.h baytech-mib.h bcmxcp.h bcmxcp_ser.h \ - bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \ - dummy-ups.h explore-hid.h gamatronic.h genericups.h \ - hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h nut_libusb.h liebert-hid.h \ - main.h mge-hid.h mge-mib.h mge-utalk.h \ - mge-xml.h microdowell.h microsol-apc.h microsol-common.h netvision-mib.h netxml-ups.h nut-ipmi.h oneac.h \ +dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \ + bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \ + dstate-hal.h dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.h \ + hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h libusb.h liebert-hid.h \ + main.h main-hal.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.h \ + mge-xml.h microdowell.h netvision-mib.h netxml-ups.h nut-ipmi.h oneac.h \ powercom.h powerpanel.h powerp-bin.h powerp-txt.h powerware-mib.h raritan-pdu-mib.h \ safenet.h serial.h snmp-ups.h solis.h tripplite.h tripplite-hid.h \ upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h \ apcsmart.h apcsmart_tabs.h apcsmart-old.h apcupsd-ups.h cyberpower-mib.h riello.h openups-hid.h \ - delta_ups-mib.h nutdrv_qx.h nutdrv_qx_bestups.h nutdrv_qx_blazer-common.h \ - nutdrv_qx_masterguard.h \ - nutdrv_qx_mecer.h nutdrv_qx_ablerex.h \ - nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h nutdrv_qx_hunnox.h \ - nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_voltronic-qs-hex.h nutdrv_qx_zinto.h \ - xppc-mib.h huawei-mib.h eaton-ats16-nmc-mib.h eaton-ats16-nm2-mib.h apc-ats-mib.h raritan-px2-mib.h eaton-ats30-mib.h \ - apc-pdu-mib.h ever-hid.h eaton-pdu-genesis2-mib.h eaton-pdu-marlin-mib.h eaton-pdu-marlin-helpers.h \ - eaton-pdu-pulizzi-mib.h eaton-pdu-revelation-mib.h emerson-avocent-pdu-mib.h legrand-hid.h \ - hpe-pdu-mib.h powervar-hid.h delta_ups-hid.h generic_modbus.h salicru-hid.h adelsystem_cbi.h + delta_ups-mib.h nutdrv_qx.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \ + nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_voltronic.h \ + nutdrv_qx_zinto.h # Define a dummy library so that Automake builds rules for the # corresponding object files. This library is not actually built, -# as a final product. It was necessary for Automake-technical reasons, +EXTRA_LIBRARIES = libdummy.a +libdummy_a_SOURCES = main.c dstate.c serial.c + +# the nuthalmain library combines the code for main-hal.c and +# dstate-hal.c. It is necessary for Automake-technical reasons, # because per-object CFLAGS can only be specified for libraries, not # for object files. This library is used during the build process, # and is not meant to be installed. -EXTRA_LTLIBRARIES = libdummy.la libdummy_serial.la -libdummy_la_SOURCES = main.c dstate.c -libdummy_la_LDFLAGS = -no-undefined -static -libdummy_serial_la_SOURCES = serial.c -libdummy_serial_la_LDFLAGS = -no-undefined -static -dummy: +EXTRA_LIBRARIES += libnuthalmain.a +libnuthalmain_a_SOURCES = main-hal.c dstate-hal.c usb-common.c -CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps +MOSTLYCLEANFILES = libnuthalmain.a diff --git a/drivers/Makefile.in b/drivers/Makefile.in index 0f9df89..b85633c 100644 --- a/drivers/Makefile.in +++ b/drivers/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,61 +19,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -92,65 +55,57 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@WITH_USB_TRUE@am__append_1 = $(LIBUSB_CFLAGS) -@WITH_NEON_TRUE@am__append_2 = $(LIBNEON_CFLAGS) -@WITH_LIBPOWERMAN_TRUE@am__append_3 = $(LIBPOWERMAN_CFLAGS) -@WITH_IPMI_TRUE@am__append_4 = $(LIBIPMI_CFLAGS) -@WITH_MODBUS_TRUE@am__append_5 = $(LIBMODBUS_CFLAGS) -EXTRA_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_3) $(am__EXEEXT_4) \ - $(am__EXEEXT_5) $(am__EXEEXT_6) $(am__EXEEXT_7) \ - $(am__EXEEXT_8) -@SOME_DRIVERS_FALSE@driverexec_PROGRAMS = $(am__EXEEXT_9) \ +@WITH_HAL_TRUE@am__append_1 = $(LIBHAL_CFLAGS) +@WITH_USB_TRUE@am__append_2 = $(LIBUSB_CFLAGS) +@WITH_SNMP_TRUE@am__append_3 = $(LIBNETSNMP_CFLAGS) +@WITH_NEON_TRUE@am__append_4 = $(LIBNEON_CFLAGS) +@WITH_LIBPOWERMAN_TRUE@am__append_5 = $(LIBPOWERMAN_CFLAGS) +@WITH_IPMI_TRUE@am__append_6 = $(LIBIPMI_CFLAGS) +EXTRA_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4) \ + $(am__EXEEXT_5) $(am__EXEEXT_6) +@SOME_DRIVERS_FALSE@driverexec_PROGRAMS = $(am__EXEEXT_7) \ +@SOME_DRIVERS_FALSE@ $(am__EXEEXT_8) $(am__EXEEXT_9) \ @SOME_DRIVERS_FALSE@ $(am__EXEEXT_10) $(am__EXEEXT_11) \ @SOME_DRIVERS_FALSE@ $(am__EXEEXT_12) $(am__EXEEXT_13) \ -@SOME_DRIVERS_FALSE@ $(am__EXEEXT_15) $(am__EXEEXT_17) \ -@SOME_DRIVERS_FALSE@ $(am__EXEEXT_18) $(am__EXEEXT_19) \ -@SOME_DRIVERS_FALSE@ $(am__EXEEXT_21) +@SOME_DRIVERS_FALSE@ upsdrvctl$(EXEEXT) @SOME_DRIVERS_TRUE@driverexec_PROGRAMS = $(DRIVER_BUILD_LIST) \ +@SOME_DRIVERS_TRUE@ $(am__EXEEXT_7) $(am__EXEEXT_8) \ @SOME_DRIVERS_TRUE@ $(am__EXEEXT_9) $(am__EXEEXT_10) \ @SOME_DRIVERS_TRUE@ $(am__EXEEXT_11) $(am__EXEEXT_12) \ -@SOME_DRIVERS_TRUE@ $(am__EXEEXT_13) $(am__EXEEXT_15) \ -@SOME_DRIVERS_TRUE@ $(am__EXEEXT_17) $(am__EXEEXT_18) \ -@SOME_DRIVERS_TRUE@ $(am__EXEEXT_19) $(am__EXEEXT_21) \ -@SOME_DRIVERS_TRUE@ skel$(EXEEXT) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__append_6 = $(SERIAL_DRIVERLIST) $(SERIAL_USB_DRIVERLIST) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_FALSE@@WITH_USB_TRUE@am__append_7 = $(SERIAL_USB_DRIVERLIST) +@SOME_DRIVERS_TRUE@ $(am__EXEEXT_13) skel$(EXEEXT) \ +@SOME_DRIVERS_TRUE@ upsdrvctl$(EXEEXT) +@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__append_7 = $(SERIAL_DRIVERLIST) @SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__append_8 = $(SNMP_DRIVERLIST) @SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__append_9 = $(USB_LIBUSB_DRIVERLIST) +@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@halexec_PROGRAMS = \ +@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@ $(am__EXEEXT_14) @SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__append_10 = $(NEONXML_DRIVERLIST) -@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_11 = $(POWERMAN_DRIVERLIST) -@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__append_12 = $(IPMI_DRIVERLIST) +@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__append_11 = powerman-pdu +@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__append_12 = nut-ipmipsu @SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__append_13 = $(MACOSX_DRIVERLIST) -@SOME_DRIVERS_FALSE@@WITH_LINUX_I2C_TRUE@am__append_14 = $(LINUX_I2C_DRIVERLIST) -@SOME_DRIVERS_FALSE@@WITH_MODBUS_TRUE@am__append_15 = $(MODBUS_DRIVERLIST) -sbin_PROGRAMS = upsdrvctl$(EXEEXT) -@WITH_SSL_TRUE@am__append_16 = $(LIBSSL_CFLAGS) -@WITH_SSL_TRUE@am__append_17 = $(LIBSSL_LIBS) -@WITH_FREEIPMI_TRUE@am__append_18 = nut-libfreeipmi.c -@WITH_SERIAL_TRUE@am__append_19 = -DQX_SERIAL -@WITH_SERIAL_TRUE@am__append_20 = libdummy_serial.la $(SERLIBS) -@WITH_USB_TRUE@am__append_21 = -DQX_USB -@WITH_USB_TRUE@am__append_22 = $(LIBUSB_IMPL) usb-common.c -@WITH_USB_TRUE@am__append_23 = $(LIBUSB_LIBS) +@WITH_SSL_TRUE@am__append_14 = $(LIBSSL_CFLAGS) +@WITH_SSL_TRUE@am__append_15 = $(LIBSSL_LIBS) +@WITH_FREEIPMI_TRUE@am__append_16 = nut-libfreeipmi.c +@WITH_SERIAL_TRUE@am__append_17 = -DQX_SERIAL +@WITH_SERIAL_TRUE@am__append_18 = $(SERLIBS) serial.o +@WITH_USB_TRUE@am__append_19 = -DQX_USB +@WITH_USB_TRUE@am__append_20 = libusb.c usb-common.c +@WITH_USB_TRUE@am__append_21 = $(LIBUSB_LIBS) subdir = drivers +DIST_COMMON = $(dist_noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -159,94 +114,70 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(dist_noinst_HEADERS) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +ARFLAGS = cru +libdummy_a_AR = $(AR) $(ARFLAGS) +libdummy_a_LIBADD = +am_libdummy_a_OBJECTS = main.$(OBJEXT) dstate.$(OBJEXT) \ + serial.$(OBJEXT) +libdummy_a_OBJECTS = $(am_libdummy_a_OBJECTS) +libnuthalmain_a_AR = $(AR) $(ARFLAGS) +libnuthalmain_a_LIBADD = +am_libnuthalmain_a_OBJECTS = main-hal.$(OBJEXT) dstate-hal.$(OBJEXT) \ + usb-common.$(OBJEXT) +libnuthalmain_a_OBJECTS = $(am_libnuthalmain_a_OBJECTS) am__EXEEXT_1 = al175$(EXEEXT) bcmxcp$(EXEEXT) belkin$(EXEEXT) \ belkinunv$(EXEEXT) bestfcom$(EXEEXT) bestfortress$(EXEEXT) \ bestuferrups$(EXEEXT) bestups$(EXEEXT) dummy-ups$(EXEEXT) \ etapro$(EXEEXT) everups$(EXEEXT) gamatronic$(EXEEXT) \ genericups$(EXEEXT) isbmex$(EXEEXT) liebert$(EXEEXT) \ liebert-esp2$(EXEEXT) masterguard$(EXEEXT) metasys$(EXEEXT) \ - mge-utalk$(EXEEXT) microdowell$(EXEEXT) microsol-apc$(EXEEXT) \ + oldmge-shut$(EXEEXT) mge-utalk$(EXEEXT) microdowell$(EXEEXT) \ mge-shut$(EXEEXT) oneac$(EXEEXT) optiups$(EXEEXT) \ powercom$(EXEEXT) rhino$(EXEEXT) safenet$(EXEEXT) \ - nutdrv_siemens-sitop$(EXEEXT) skel$(EXEEXT) solis$(EXEEXT) \ - tripplite$(EXEEXT) tripplitesu$(EXEEXT) upscode2$(EXEEXT) \ - victronups$(EXEEXT) powerpanel$(EXEEXT) blazer_ser$(EXEEXT) \ - clone$(EXEEXT) clone-outlet$(EXEEXT) ivtscd$(EXEEXT) \ - apcsmart$(EXEEXT) apcsmart-old$(EXEEXT) apcupsd-ups$(EXEEXT) \ - riello_ser$(EXEEXT) -am__EXEEXT_2 = usbhid-ups$(EXEEXT) bcmxcp_usb$(EXEEXT) \ + skel$(EXEEXT) solis$(EXEEXT) tripplite$(EXEEXT) \ + tripplitesu$(EXEEXT) upscode2$(EXEEXT) victronups$(EXEEXT) \ + powerpanel$(EXEEXT) blazer_ser$(EXEEXT) clone$(EXEEXT) \ + clone-outlet$(EXEEXT) ivtscd$(EXEEXT) apcsmart$(EXEEXT) \ + apcsmart-old$(EXEEXT) apcupsd-ups$(EXEEXT) riello_ser$(EXEEXT) \ + nutdrv_qx$(EXEEXT) +am__EXEEXT_2 = snmp-ups$(EXEEXT) +am__EXEEXT_3 = usbhid-ups$(EXEEXT) bcmxcp_usb$(EXEEXT) \ tripplite_usb$(EXEEXT) blazer_usb$(EXEEXT) \ - richcomm_usb$(EXEEXT) riello_usb$(EXEEXT) \ - nutdrv_atcl_usb$(EXEEXT) -am__EXEEXT_3 = $(am__EXEEXT_2) -am__EXEEXT_4 = nutdrv_qx$(EXEEXT) -am__EXEEXT_5 = snmp-ups$(EXEEXT) -am__EXEEXT_6 = netxml-ups$(EXEEXT) -am__EXEEXT_7 = macosx-ups$(EXEEXT) -am__EXEEXT_8 = asem$(EXEEXT) pijuice$(EXEEXT) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__EXEEXT_9 = $(am__EXEEXT_1) \ -@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@ $(am__EXEEXT_4) -@SOME_DRIVERS_FALSE@@WITH_SERIAL_FALSE@@WITH_USB_TRUE@am__EXEEXT_10 = $(am__EXEEXT_4) -@SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__EXEEXT_11 = $(am__EXEEXT_5) -@SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__EXEEXT_12 = $(am__EXEEXT_2) -@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__EXEEXT_13 = $(am__EXEEXT_6) -am__EXEEXT_14 = powerman-pdu$(EXEEXT) -@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__EXEEXT_15 = \ -@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@ $(am__EXEEXT_14) -am__EXEEXT_16 = nut-ipmipsu$(EXEEXT) -@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__EXEEXT_17 = $(am__EXEEXT_16) -@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__EXEEXT_18 = $(am__EXEEXT_7) -@SOME_DRIVERS_FALSE@@WITH_LINUX_I2C_TRUE@am__EXEEXT_19 = \ -@SOME_DRIVERS_FALSE@@WITH_LINUX_I2C_TRUE@ $(am__EXEEXT_8) -am__EXEEXT_20 = phoenixcontact_modbus$(EXEEXT) generic_modbus$(EXEEXT) \ - huawei-ups2000$(EXEEXT) socomec_jbus$(EXEEXT) \ - adelsystem_cbi$(EXEEXT) -@SOME_DRIVERS_FALSE@@WITH_MODBUS_TRUE@am__EXEEXT_21 = \ -@SOME_DRIVERS_FALSE@@WITH_MODBUS_TRUE@ $(am__EXEEXT_20) -am__installdirs = "$(DESTDIR)$(driverexecdir)" "$(DESTDIR)$(sbindir)" -PROGRAMS = $(driverexec_PROGRAMS) $(sbin_PROGRAMS) -libdummy_la_LIBADD = -am_libdummy_la_OBJECTS = main.lo dstate.lo -libdummy_la_OBJECTS = $(am_libdummy_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libdummy_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libdummy_la_LDFLAGS) $(LDFLAGS) -o $@ -libdummy_serial_la_LIBADD = -am_libdummy_serial_la_OBJECTS = serial.lo -libdummy_serial_la_OBJECTS = $(am_libdummy_serial_la_OBJECTS) -libdummy_serial_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(AM_CFLAGS) $(CFLAGS) $(libdummy_serial_la_LDFLAGS) \ - $(LDFLAGS) -o $@ -am_adelsystem_cbi_OBJECTS = adelsystem_cbi.$(OBJEXT) -adelsystem_cbi_OBJECTS = $(am_adelsystem_cbi_OBJECTS) -am__DEPENDENCIES_1 = -adelsystem_cbi_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) + richcomm_usb$(EXEEXT) riello_usb$(EXEEXT) nutdrv_qx$(EXEEXT) +am__EXEEXT_4 = $(am__EXEEXT_3) +am__EXEEXT_5 = netxml-ups$(EXEEXT) +am__EXEEXT_6 = macosx-ups$(EXEEXT) +@SOME_DRIVERS_FALSE@@WITH_SERIAL_TRUE@am__EXEEXT_7 = $(am__EXEEXT_1) +@SOME_DRIVERS_FALSE@@WITH_SNMP_TRUE@am__EXEEXT_8 = $(am__EXEEXT_2) +@SOME_DRIVERS_FALSE@@WITH_USB_TRUE@am__EXEEXT_9 = $(am__EXEEXT_3) +@SOME_DRIVERS_FALSE@@WITH_NEON_TRUE@am__EXEEXT_10 = $(am__EXEEXT_5) +@SOME_DRIVERS_FALSE@@WITH_LIBPOWERMAN_TRUE@am__EXEEXT_11 = powerman-pdu$(EXEEXT) +@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@am__EXEEXT_12 = \ +@SOME_DRIVERS_FALSE@@WITH_IPMI_TRUE@ nut-ipmipsu$(EXEEXT) +@SOME_DRIVERS_FALSE@@WITH_MACOSX_TRUE@am__EXEEXT_13 = $(am__EXEEXT_6) +am__installdirs = "$(DESTDIR)$(driverexecdir)" \ + "$(DESTDIR)$(halexecdir)" +am__EXEEXT_14 = hald-addon-usbhid-ups$(EXEEXT) \ + hald-addon-bcmxcp_usb$(EXEEXT) \ + hald-addon-tripplite_usb$(EXEEXT) \ + hald-addon-blazer_usb$(EXEEXT) hald-addon-riello_usb$(EXEEXT) \ + hald-addon-nutdrv_qx$(EXEEXT) +PROGRAMS = $(driverexec_PROGRAMS) $(halexec_PROGRAMS) am_al175_OBJECTS = al175.$(OBJEXT) al175_OBJECTS = $(am_al175_OBJECTS) al175_LDADD = $(LDADD) -am__DEPENDENCIES_2 = libdummy_serial.la $(LDADD_DRIVERS) \ - $(am__DEPENDENCIES_1) +am__DEPENDENCIES_1 = +am__DEPENDENCIES_2 = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) serial.o al175_DEPENDENCIES = $(am__DEPENDENCIES_2) am_apcsmart_OBJECTS = apcsmart.$(OBJEXT) apcsmart_tabs.$(OBJEXT) apcsmart_OBJECTS = $(am_apcsmart_OBJECTS) @@ -259,12 +190,9 @@ apcsmart_old_DEPENDENCIES = $(am__DEPENDENCIES_2) am_apcupsd_ups_OBJECTS = apcupsd_ups-apcupsd-ups.$(OBJEXT) apcupsd_ups_OBJECTS = $(am_apcupsd_ups_OBJECTS) apcupsd_ups_DEPENDENCIES = $(LDADD_DRIVERS) -apcupsd_ups_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +apcupsd_ups_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(apcupsd_ups_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_asem_OBJECTS = asem.$(OBJEXT) -asem_OBJECTS = $(am_asem_OBJECTS) -asem_DEPENDENCIES = $(LDADD_DRIVERS) am_bcmxcp_OBJECTS = bcmxcp.$(OBJEXT) bcmxcp_ser.$(OBJEXT) bcmxcp_OBJECTS = $(am_bcmxcp_OBJECTS) am__DEPENDENCIES_3 = $(am__DEPENDENCIES_2) @@ -285,8 +213,8 @@ am_bestfcom_OBJECTS = bestfcom.$(OBJEXT) bestfcom_OBJECTS = $(am_bestfcom_OBJECTS) bestfcom_LDADD = $(LDADD) bestfcom_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_bestfortress_OBJECTS = bestfortress.$(OBJEXT) -bestfortress_OBJECTS = $(am_bestfortress_OBJECTS) +bestfortress_SOURCES = bestfortress.c +bestfortress_OBJECTS = bestfortress.$(OBJEXT) bestfortress_LDADD = $(LDADD) bestfortress_DEPENDENCIES = $(am__DEPENDENCIES_2) am_bestuferrups_OBJECTS = bestuferrups.$(OBJEXT) @@ -300,12 +228,8 @@ bestups_DEPENDENCIES = $(am__DEPENDENCIES_2) am_blazer_ser_OBJECTS = blazer.$(OBJEXT) blazer_ser.$(OBJEXT) blazer_ser_OBJECTS = $(am_blazer_ser_OBJECTS) blazer_ser_DEPENDENCIES = $(am__DEPENDENCIES_3) -am__blazer_usb_SOURCES_DIST = blazer.c blazer_usb.c libusb0.c \ - libusb1.c usb-common.c -@WITH_LIBUSB_0_1_FALSE@@WITH_LIBUSB_1_0_TRUE@am__objects_1 = libusb1.$(OBJEXT) -@WITH_LIBUSB_0_1_TRUE@am__objects_1 = libusb0.$(OBJEXT) am_blazer_usb_OBJECTS = blazer.$(OBJEXT) blazer_usb.$(OBJEXT) \ - $(am__objects_1) usb-common.$(OBJEXT) + libusb.$(OBJEXT) usb-common.$(OBJEXT) blazer_usb_OBJECTS = $(am_blazer_usb_OBJECTS) blazer_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_clone_OBJECTS = clone.$(OBJEXT) @@ -319,9 +243,9 @@ clone_outlet_DEPENDENCIES = $(am__DEPENDENCIES_2) am_dummy_ups_OBJECTS = dummy_ups-dummy-ups.$(OBJEXT) dummy_ups_OBJECTS = $(am_dummy_ups_OBJECTS) @WITH_SSL_TRUE@am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) -dummy_ups_DEPENDENCIES = $(LDADD_DRIVERS) \ - $(top_builddir)/clients/libupsclient.la $(am__DEPENDENCIES_4) -dummy_ups_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +dummy_ups_DEPENDENCIES = $(LDADD_DRIVERS) ../clients/libupsclient.la \ + $(am__DEPENDENCIES_4) +dummy_ups_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(dummy_ups_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_etapro_OBJECTS = etapro.$(OBJEXT) @@ -336,17 +260,60 @@ am_gamatronic_OBJECTS = gamatronic.$(OBJEXT) gamatronic_OBJECTS = $(am_gamatronic_OBJECTS) gamatronic_LDADD = $(LDADD) gamatronic_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_generic_modbus_OBJECTS = generic_modbus.$(OBJEXT) -generic_modbus_OBJECTS = $(am_generic_modbus_OBJECTS) -generic_modbus_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_genericups_OBJECTS = genericups.$(OBJEXT) genericups_OBJECTS = $(am_genericups_OBJECTS) genericups_LDADD = $(LDADD) genericups_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_huawei_ups2000_OBJECTS = huawei-ups2000.$(OBJEXT) -huawei_ups2000_OBJECTS = $(am_huawei_ups2000_OBJECTS) -huawei_ups2000_DEPENDENCIES = $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) +am_hald_addon_bcmxcp_usb_OBJECTS = bcmxcp_usb.$(OBJEXT) \ + bcmxcp.$(OBJEXT) +hald_addon_bcmxcp_usb_OBJECTS = $(am_hald_addon_bcmxcp_usb_OBJECTS) +hald_addon_bcmxcp_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_hald_addon_blazer_usb_OBJECTS = blazer.$(OBJEXT) \ + blazer_usb.$(OBJEXT) libusb.$(OBJEXT) +hald_addon_blazer_usb_OBJECTS = $(am_hald_addon_blazer_usb_OBJECTS) +hald_addon_blazer_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = \ + hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_mecer.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_megatec.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_mustek.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_voltronic.$(OBJEXT) \ + hald_addon_nutdrv_qx-nutdrv_qx_zinto.$(OBJEXT) +am_hald_addon_nutdrv_qx_OBJECTS = \ + hald_addon_nutdrv_qx-nutdrv_qx.$(OBJEXT) \ + hald_addon_nutdrv_qx-libusb.$(OBJEXT) $(am__objects_1) +hald_addon_nutdrv_qx_OBJECTS = $(am_hald_addon_nutdrv_qx_OBJECTS) +hald_addon_nutdrv_qx_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +hald_addon_nutdrv_qx_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +am_hald_addon_riello_usb_OBJECTS = riello.$(OBJEXT) \ + riello_usb.$(OBJEXT) libusb.$(OBJEXT) +hald_addon_riello_usb_OBJECTS = $(am_hald_addon_riello_usb_OBJECTS) +hald_addon_riello_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_hald_addon_tripplite_usb_OBJECTS = tripplite_usb.$(OBJEXT) \ + libusb.$(OBJEXT) +hald_addon_tripplite_usb_OBJECTS = \ + $(am_hald_addon_tripplite_usb_OBJECTS) +hald_addon_tripplite_usb_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_2 = apc-hid.$(OBJEXT) belkin-hid.$(OBJEXT) \ + cps-hid.$(OBJEXT) explore-hid.$(OBJEXT) liebert-hid.$(OBJEXT) \ + mge-hid.$(OBJEXT) powercom-hid.$(OBJEXT) \ + tripplite-hid.$(OBJEXT) idowell-hid.$(OBJEXT) \ + openups-hid.$(OBJEXT) +am_hald_addon_usbhid_ups_OBJECTS = usbhid-ups.$(OBJEXT) \ + libhid.$(OBJEXT) libusb.$(OBJEXT) hidparser.$(OBJEXT) \ + $(am__objects_2) +hald_addon_usbhid_ups_OBJECTS = $(am_hald_addon_usbhid_ups_OBJECTS) +hald_addon_usbhid_ups_DEPENDENCIES = $(LDADD_HAL_DRIVERS) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_isbmex_OBJECTS = isbmex.$(OBJEXT) isbmex_OBJECTS = $(am_isbmex_OBJECTS) isbmex_DEPENDENCIES = $(am__DEPENDENCIES_3) @@ -365,7 +332,7 @@ liebert_esp2_DEPENDENCIES = $(am__DEPENDENCIES_2) am_macosx_ups_OBJECTS = macosx-ups.$(OBJEXT) macosx_ups_OBJECTS = $(am_macosx_ups_OBJECTS) macosx_ups_DEPENDENCIES = $(LDADD_DRIVERS) -macosx_ups_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +macosx_ups_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(macosx_ups_LDFLAGS) $(LDFLAGS) -o $@ am_masterguard_OBJECTS = masterguard.$(OBJEXT) @@ -374,15 +341,16 @@ masterguard_LDADD = $(LDADD) masterguard_DEPENDENCIES = $(am__DEPENDENCIES_2) am_metasys_OBJECTS = metasys.$(OBJEXT) metasys_OBJECTS = $(am_metasys_OBJECTS) -metasys_DEPENDENCIES = $(am__DEPENDENCIES_3) +metasys_LDADD = $(LDADD) +metasys_DEPENDENCIES = $(am__DEPENDENCIES_2) am_mge_shut_OBJECTS = mge_shut-usbhid-ups.$(OBJEXT) \ mge_shut-libshut.$(OBJEXT) mge_shut-libhid.$(OBJEXT) \ mge_shut-hidparser.$(OBJEXT) mge_shut-mge-hid.$(OBJEXT) mge_shut_OBJECTS = $(am_mge_shut_OBJECTS) mge_shut_DEPENDENCIES = $(am__DEPENDENCIES_3) -mge_shut_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(mge_shut_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +mge_shut_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(mge_shut_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_mge_utalk_OBJECTS = mge-utalk.$(OBJEXT) mge_utalk_OBJECTS = $(am_mge_utalk_OBJECTS) mge_utalk_LDADD = $(LDADD) @@ -391,62 +359,41 @@ am_microdowell_OBJECTS = microdowell.$(OBJEXT) microdowell_OBJECTS = $(am_microdowell_OBJECTS) microdowell_LDADD = $(LDADD) microdowell_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_microsol_apc_OBJECTS = microsol-apc.$(OBJEXT) \ - microsol-common.$(OBJEXT) -microsol_apc_OBJECTS = $(am_microsol_apc_OBJECTS) -microsol_apc_DEPENDENCIES = $(am__DEPENDENCIES_3) am_netxml_ups_OBJECTS = netxml-ups.$(OBJEXT) mge-xml.$(OBJEXT) netxml_ups_OBJECTS = $(am_netxml_ups_OBJECTS) netxml_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am__nut_ipmipsu_SOURCES_DIST = nut-ipmipsu.c nut-libfreeipmi.c -@WITH_FREEIPMI_TRUE@am__objects_2 = nut-libfreeipmi.$(OBJEXT) -am_nut_ipmipsu_OBJECTS = nut-ipmipsu.$(OBJEXT) $(am__objects_2) +@WITH_FREEIPMI_TRUE@am__objects_3 = nut-libfreeipmi.$(OBJEXT) +am_nut_ipmipsu_OBJECTS = nut-ipmipsu.$(OBJEXT) $(am__objects_3) nut_ipmipsu_OBJECTS = $(am_nut_ipmipsu_OBJECTS) nut_ipmipsu_DEPENDENCIES = $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_1) -am_nutdrv_atcl_usb_OBJECTS = nutdrv_atcl_usb.$(OBJEXT) \ - usb-common.$(OBJEXT) -nutdrv_atcl_usb_OBJECTS = $(am_nutdrv_atcl_usb_OBJECTS) -nutdrv_atcl_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) -am__nutdrv_qx_SOURCES_DIST = nutdrv_qx.c libusb0.c libusb1.c \ - usb-common.c nutdrv_qx_bestups.c nutdrv_qx_blazer-common.c \ - nutdrv_qx_masterguard.c nutdrv_qx_mecer.c nutdrv_qx_megatec.c \ - nutdrv_qx_megatec-old.c nutdrv_qx_mustek.c nutdrv_qx_q1.c \ - nutdrv_qx_voltronic.c nutdrv_qx_voltronic-qs.c \ - nutdrv_qx_voltronic-qs-hex.c nutdrv_qx_zinto.c \ - nutdrv_qx_hunnox.c nutdrv_qx_ablerex.c -@WITH_LIBUSB_0_1_FALSE@@WITH_LIBUSB_1_0_TRUE@am__objects_3 = nutdrv_qx-libusb1.$(OBJEXT) -@WITH_LIBUSB_0_1_TRUE@am__objects_3 = nutdrv_qx-libusb0.$(OBJEXT) -@WITH_USB_TRUE@am__objects_4 = $(am__objects_3) \ +am__nutdrv_qx_SOURCES_DIST = nutdrv_qx.c libusb.c usb-common.c \ + nutdrv_qx_blazer-common.c nutdrv_qx_mecer.c \ + nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c nutdrv_qx_mustek.c \ + nutdrv_qx_voltronic.c nutdrv_qx_zinto.c +@WITH_USB_TRUE@am__objects_4 = nutdrv_qx-libusb.$(OBJEXT) \ @WITH_USB_TRUE@ nutdrv_qx-usb-common.$(OBJEXT) -am__objects_5 = nutdrv_qx-nutdrv_qx_bestups.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_blazer-common.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_masterguard.$(OBJEXT) \ +am__objects_5 = nutdrv_qx-nutdrv_qx_blazer-common.$(OBJEXT) \ nutdrv_qx-nutdrv_qx_mecer.$(OBJEXT) \ nutdrv_qx-nutdrv_qx_megatec.$(OBJEXT) \ nutdrv_qx-nutdrv_qx_megatec-old.$(OBJEXT) \ nutdrv_qx-nutdrv_qx_mustek.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_q1.$(OBJEXT) \ nutdrv_qx-nutdrv_qx_voltronic.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_voltronic-qs.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_voltronic-qs-hex.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_zinto.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_hunnox.$(OBJEXT) \ - nutdrv_qx-nutdrv_qx_ablerex.$(OBJEXT) + nutdrv_qx-nutdrv_qx_zinto.$(OBJEXT) am_nutdrv_qx_OBJECTS = nutdrv_qx-nutdrv_qx.$(OBJEXT) $(am__objects_4) \ $(am__objects_5) nutdrv_qx_OBJECTS = $(am_nutdrv_qx_OBJECTS) -@WITH_SERIAL_TRUE@am__DEPENDENCIES_5 = libdummy_serial.la \ -@WITH_SERIAL_TRUE@ $(am__DEPENDENCIES_1) +@WITH_SERIAL_TRUE@am__DEPENDENCIES_5 = $(am__DEPENDENCIES_1) serial.o @WITH_USB_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_1) nutdrv_qx_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_5) \ $(am__DEPENDENCIES_6) -nutdrv_qx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +nutdrv_qx_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(nutdrv_qx_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_nutdrv_siemens_sitop_OBJECTS = nutdrv_siemens_sitop.$(OBJEXT) -nutdrv_siemens_sitop_OBJECTS = $(am_nutdrv_siemens_sitop_OBJECTS) -nutdrv_siemens_sitop_LDADD = $(LDADD) -nutdrv_siemens_sitop_DEPENDENCIES = $(am__DEPENDENCIES_2) +am_oldmge_shut_OBJECTS = mge-shut.$(OBJEXT) hidparser.$(OBJEXT) +oldmge_shut_OBJECTS = $(am_oldmge_shut_OBJECTS) +oldmge_shut_LDADD = $(LDADD) +oldmge_shut_DEPENDENCIES = $(am__DEPENDENCIES_2) am_oneac_OBJECTS = oneac.$(OBJEXT) oneac_OBJECTS = $(am_oneac_OBJECTS) oneac_LDADD = $(LDADD) @@ -455,13 +402,6 @@ am_optiups_OBJECTS = optiups.$(OBJEXT) optiups_OBJECTS = $(am_optiups_OBJECTS) optiups_LDADD = $(LDADD) optiups_DEPENDENCIES = $(am__DEPENDENCIES_2) -am_phoenixcontact_modbus_OBJECTS = phoenixcontact_modbus.$(OBJEXT) -phoenixcontact_modbus_OBJECTS = $(am_phoenixcontact_modbus_OBJECTS) -phoenixcontact_modbus_DEPENDENCIES = $(LDADD_DRIVERS) \ - $(am__DEPENDENCIES_1) -am_pijuice_OBJECTS = pijuice.$(OBJEXT) -pijuice_OBJECTS = $(am_pijuice_OBJECTS) -pijuice_DEPENDENCIES = $(LDADD_DRIVERS) am_powercom_OBJECTS = powercom.$(OBJEXT) powercom_OBJECTS = $(am_powercom_OBJECTS) powercom_DEPENDENCIES = $(am__DEPENDENCIES_3) @@ -482,10 +422,8 @@ richcomm_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_riello_ser_OBJECTS = riello.$(OBJEXT) riello_ser.$(OBJEXT) riello_ser_OBJECTS = $(am_riello_ser_OBJECTS) riello_ser_DEPENDENCIES = $(am__DEPENDENCIES_3) -am__riello_usb_SOURCES_DIST = riello.c riello_usb.c libusb0.c \ - libusb1.c usb-common.c am_riello_usb_OBJECTS = riello.$(OBJEXT) riello_usb.$(OBJEXT) \ - $(am__objects_1) usb-common.$(OBJEXT) + libusb.$(OBJEXT) usb-common.$(OBJEXT) riello_usb_OBJECTS = $(am_riello_usb_OBJECTS) riello_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_safenet_OBJECTS = safenet.$(OBJEXT) @@ -495,46 +433,22 @@ safenet_DEPENDENCIES = $(am__DEPENDENCIES_2) am_skel_OBJECTS = skel.$(OBJEXT) skel_OBJECTS = $(am_skel_OBJECTS) skel_DEPENDENCIES = $(LDADD_DRIVERS) -am_snmp_ups_OBJECTS = snmp_ups-snmp-ups.$(OBJEXT) \ - snmp_ups-snmp-ups-helpers.$(OBJEXT) snmp_ups-apc-mib.$(OBJEXT) \ - snmp_ups-apc-pdu-mib.$(OBJEXT) snmp_ups-baytech-mib.$(OBJEXT) \ - snmp_ups-bestpower-mib.$(OBJEXT) snmp_ups-compaq-mib.$(OBJEXT) \ - snmp_ups-cyberpower-mib.$(OBJEXT) \ - snmp_ups-delta_ups-mib.$(OBJEXT) \ - snmp_ups-eaton-pdu-genesis2-mib.$(OBJEXT) \ - snmp_ups-eaton-pdu-marlin-mib.$(OBJEXT) \ - snmp_ups-eaton-pdu-marlin-helpers.$(OBJEXT) \ - snmp_ups-eaton-pdu-pulizzi-mib.$(OBJEXT) \ - snmp_ups-eaton-pdu-revelation-mib.$(OBJEXT) \ - snmp_ups-eaton-ats16-nmc-mib.$(OBJEXT) \ - snmp_ups-eaton-ats16-nm2-mib.$(OBJEXT) \ - snmp_ups-apc-ats-mib.$(OBJEXT) \ - snmp_ups-eaton-ats30-mib.$(OBJEXT) \ - snmp_ups-emerson-avocent-pdu-mib.$(OBJEXT) \ - snmp_ups-hpe-pdu-mib.$(OBJEXT) snmp_ups-huawei-mib.$(OBJEXT) \ - snmp_ups-ietf-mib.$(OBJEXT) snmp_ups-mge-mib.$(OBJEXT) \ - snmp_ups-netvision-mib.$(OBJEXT) \ - snmp_ups-powerware-mib.$(OBJEXT) \ - snmp_ups-raritan-pdu-mib.$(OBJEXT) \ - snmp_ups-raritan-px2-mib.$(OBJEXT) snmp_ups-xppc-mib.$(OBJEXT) +am_snmp_ups_OBJECTS = snmp-ups.$(OBJEXT) apc-mib.$(OBJEXT) \ + baytech-mib.$(OBJEXT) compaq-mib.$(OBJEXT) eaton-mib.$(OBJEXT) \ + ietf-mib.$(OBJEXT) mge-mib.$(OBJEXT) netvision-mib.$(OBJEXT) \ + powerware-mib.$(OBJEXT) raritan-pdu-mib.$(OBJEXT) \ + bestpower-mib.$(OBJEXT) cyberpower-mib.$(OBJEXT) \ + delta_ups-mib.$(OBJEXT) snmp_ups_OBJECTS = $(am_snmp_ups_OBJECTS) snmp_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) -snmp_ups_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(snmp_ups_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_socomec_jbus_OBJECTS = socomec_jbus.$(OBJEXT) -socomec_jbus_OBJECTS = $(am_socomec_jbus_OBJECTS) -socomec_jbus_DEPENDENCIES = $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_1) am_solis_OBJECTS = solis.$(OBJEXT) solis_OBJECTS = $(am_solis_OBJECTS) -solis_DEPENDENCIES = $(am__DEPENDENCIES_3) +solis_LDADD = $(LDADD) +solis_DEPENDENCIES = $(am__DEPENDENCIES_2) am_tripplite_OBJECTS = tripplite.$(OBJEXT) tripplite_OBJECTS = $(am_tripplite_OBJECTS) tripplite_DEPENDENCIES = $(am__DEPENDENCIES_3) -am__tripplite_usb_SOURCES_DIST = tripplite_usb.c libusb0.c libusb1.c \ - usb-common.c -am_tripplite_usb_OBJECTS = tripplite_usb.$(OBJEXT) $(am__objects_1) \ +am_tripplite_usb_OBJECTS = tripplite_usb.$(OBJEXT) libusb.$(OBJEXT) \ usb-common.$(OBJEXT) tripplite_usb_OBJECTS = $(am_tripplite_usb_OBJECTS) tripplite_usb_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) @@ -548,249 +462,99 @@ upscode2_DEPENDENCIES = $(am__DEPENDENCIES_3) am_upsdrvctl_OBJECTS = upsdrvctl.$(OBJEXT) upsdrvctl_OBJECTS = $(am_upsdrvctl_OBJECTS) upsdrvctl_DEPENDENCIES = $(LDADD_COMMON) -am__usbhid_ups_SOURCES_DIST = usbhid-ups.c libhid.c libusb0.c \ - libusb1.c hidparser.c usb-common.c apc-hid.c arduino-hid.c \ - belkin-hid.c cps-hid.c explore-hid.c liebert-hid.c mge-hid.c \ - powercom-hid.c tripplite-hid.c idowell-hid.c openups-hid.c \ - powervar-hid.c delta_ups-hid.c ever-hid.c legrand-hid.c \ - salicru-hid.c -am__objects_6 = apc-hid.$(OBJEXT) arduino-hid.$(OBJEXT) \ - belkin-hid.$(OBJEXT) cps-hid.$(OBJEXT) explore-hid.$(OBJEXT) \ - liebert-hid.$(OBJEXT) mge-hid.$(OBJEXT) powercom-hid.$(OBJEXT) \ - tripplite-hid.$(OBJEXT) idowell-hid.$(OBJEXT) \ - openups-hid.$(OBJEXT) powervar-hid.$(OBJEXT) \ - delta_ups-hid.$(OBJEXT) ever-hid.$(OBJEXT) \ - legrand-hid.$(OBJEXT) salicru-hid.$(OBJEXT) am_usbhid_ups_OBJECTS = usbhid-ups.$(OBJEXT) libhid.$(OBJEXT) \ - $(am__objects_1) hidparser.$(OBJEXT) usb-common.$(OBJEXT) \ - $(am__objects_6) + libusb.$(OBJEXT) hidparser.$(OBJEXT) usb-common.$(OBJEXT) \ + $(am__objects_2) usbhid_ups_OBJECTS = $(am_usbhid_ups_OBJECTS) usbhid_ups_DEPENDENCIES = $(LDADD_DRIVERS) $(am__DEPENDENCIES_1) am_victronups_OBJECTS = victronups.$(OBJEXT) victronups_OBJECTS = $(am_victronups_OBJECTS) victronups_LDADD = $(LDADD) victronups_DEPENDENCIES = $(am__DEPENDENCIES_2) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/adelsystem_cbi.Po \ - ./$(DEPDIR)/al175.Po ./$(DEPDIR)/apc-hid.Po \ - ./$(DEPDIR)/apcsmart-old.Po ./$(DEPDIR)/apcsmart.Po \ - ./$(DEPDIR)/apcsmart_tabs.Po \ - ./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po \ - ./$(DEPDIR)/arduino-hid.Po ./$(DEPDIR)/asem.Po \ - ./$(DEPDIR)/bcmxcp.Po ./$(DEPDIR)/bcmxcp_ser.Po \ - ./$(DEPDIR)/bcmxcp_usb.Po ./$(DEPDIR)/belkin-hid.Po \ - ./$(DEPDIR)/belkin.Po ./$(DEPDIR)/belkinunv.Po \ - ./$(DEPDIR)/bestfcom.Po ./$(DEPDIR)/bestfortress.Po \ - ./$(DEPDIR)/bestuferrups.Po ./$(DEPDIR)/bestups.Po \ - ./$(DEPDIR)/blazer.Po ./$(DEPDIR)/blazer_ser.Po \ - ./$(DEPDIR)/blazer_usb.Po ./$(DEPDIR)/clone-outlet.Po \ - ./$(DEPDIR)/clone.Po ./$(DEPDIR)/cps-hid.Po \ - ./$(DEPDIR)/delta_ups-hid.Po ./$(DEPDIR)/dstate.Plo \ - ./$(DEPDIR)/dummy_ups-dummy-ups.Po ./$(DEPDIR)/etapro.Po \ - ./$(DEPDIR)/ever-hid.Po ./$(DEPDIR)/everups.Po \ - ./$(DEPDIR)/explore-hid.Po ./$(DEPDIR)/gamatronic.Po \ - ./$(DEPDIR)/generic_modbus.Po ./$(DEPDIR)/genericups.Po \ - ./$(DEPDIR)/hidparser.Po ./$(DEPDIR)/huawei-ups2000.Po \ - ./$(DEPDIR)/idowell-hid.Po ./$(DEPDIR)/isbmex.Po \ - ./$(DEPDIR)/ivtscd.Po ./$(DEPDIR)/legrand-hid.Po \ - ./$(DEPDIR)/libhid.Po ./$(DEPDIR)/libusb0.Po \ - ./$(DEPDIR)/libusb1.Po ./$(DEPDIR)/liebert-esp2.Po \ - ./$(DEPDIR)/liebert-hid.Po ./$(DEPDIR)/liebert.Po \ - ./$(DEPDIR)/macosx-ups.Po ./$(DEPDIR)/main.Plo \ - ./$(DEPDIR)/masterguard.Po ./$(DEPDIR)/metasys.Po \ - ./$(DEPDIR)/mge-hid.Po ./$(DEPDIR)/mge-utalk.Po \ - ./$(DEPDIR)/mge-xml.Po ./$(DEPDIR)/mge_shut-hidparser.Po \ - ./$(DEPDIR)/mge_shut-libhid.Po ./$(DEPDIR)/mge_shut-libshut.Po \ - ./$(DEPDIR)/mge_shut-mge-hid.Po \ - ./$(DEPDIR)/mge_shut-usbhid-ups.Po ./$(DEPDIR)/microdowell.Po \ - ./$(DEPDIR)/microsol-apc.Po ./$(DEPDIR)/microsol-common.Po \ - ./$(DEPDIR)/netxml-ups.Po ./$(DEPDIR)/nut-ipmipsu.Po \ - ./$(DEPDIR)/nut-libfreeipmi.Po ./$(DEPDIR)/nutdrv_atcl_usb.Po \ - ./$(DEPDIR)/nutdrv_qx-libusb0.Po \ - ./$(DEPDIR)/nutdrv_qx-libusb1.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po \ - ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po \ - ./$(DEPDIR)/nutdrv_qx-usb-common.Po \ - ./$(DEPDIR)/nutdrv_siemens_sitop.Po ./$(DEPDIR)/oneac.Po \ - ./$(DEPDIR)/openups-hid.Po ./$(DEPDIR)/optiups.Po \ - ./$(DEPDIR)/phoenixcontact_modbus.Po ./$(DEPDIR)/pijuice.Po \ - ./$(DEPDIR)/powercom-hid.Po ./$(DEPDIR)/powercom.Po \ - ./$(DEPDIR)/powerman-pdu.Po ./$(DEPDIR)/powerp-bin.Po \ - ./$(DEPDIR)/powerp-txt.Po ./$(DEPDIR)/powerpanel.Po \ - ./$(DEPDIR)/powervar-hid.Po ./$(DEPDIR)/rhino.Po \ - ./$(DEPDIR)/richcomm_usb.Po ./$(DEPDIR)/riello.Po \ - ./$(DEPDIR)/riello_ser.Po ./$(DEPDIR)/riello_usb.Po \ - ./$(DEPDIR)/safenet.Po ./$(DEPDIR)/salicru-hid.Po \ - ./$(DEPDIR)/serial.Plo ./$(DEPDIR)/skel.Po \ - ./$(DEPDIR)/snmp_ups-apc-ats-mib.Po \ - ./$(DEPDIR)/snmp_ups-apc-mib.Po \ - ./$(DEPDIR)/snmp_ups-apc-pdu-mib.Po \ - ./$(DEPDIR)/snmp_ups-baytech-mib.Po \ - ./$(DEPDIR)/snmp_ups-bestpower-mib.Po \ - ./$(DEPDIR)/snmp_ups-compaq-mib.Po \ - ./$(DEPDIR)/snmp_ups-cyberpower-mib.Po \ - ./$(DEPDIR)/snmp_ups-delta_ups-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-ats30-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po \ - ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po \ - ./$(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po \ - ./$(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po \ - ./$(DEPDIR)/snmp_ups-hpe-pdu-mib.Po \ - ./$(DEPDIR)/snmp_ups-huawei-mib.Po \ - ./$(DEPDIR)/snmp_ups-ietf-mib.Po \ - ./$(DEPDIR)/snmp_ups-mge-mib.Po \ - ./$(DEPDIR)/snmp_ups-netvision-mib.Po \ - ./$(DEPDIR)/snmp_ups-powerware-mib.Po \ - ./$(DEPDIR)/snmp_ups-raritan-pdu-mib.Po \ - ./$(DEPDIR)/snmp_ups-raritan-px2-mib.Po \ - ./$(DEPDIR)/snmp_ups-snmp-ups-helpers.Po \ - ./$(DEPDIR)/snmp_ups-snmp-ups.Po \ - ./$(DEPDIR)/snmp_ups-xppc-mib.Po ./$(DEPDIR)/socomec_jbus.Po \ - ./$(DEPDIR)/solis.Po ./$(DEPDIR)/tripplite-hid.Po \ - ./$(DEPDIR)/tripplite.Po ./$(DEPDIR)/tripplite_usb.Po \ - ./$(DEPDIR)/tripplitesu.Po ./$(DEPDIR)/upscode2.Po \ - ./$(DEPDIR)/upsdrvctl.Po ./$(DEPDIR)/usb-common.Po \ - ./$(DEPDIR)/usbhid-ups.Po ./$(DEPDIR)/victronups.Po +am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libdummy_la_SOURCES) $(libdummy_serial_la_SOURCES) \ - $(adelsystem_cbi_SOURCES) $(al175_SOURCES) $(apcsmart_SOURCES) \ - $(apcsmart_old_SOURCES) $(apcupsd_ups_SOURCES) $(asem_SOURCES) \ - $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) $(belkin_SOURCES) \ - $(belkinunv_SOURCES) $(bestfcom_SOURCES) \ - $(bestfortress_SOURCES) $(bestuferrups_SOURCES) \ - $(bestups_SOURCES) $(blazer_ser_SOURCES) $(blazer_usb_SOURCES) \ - $(clone_SOURCES) $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) \ - $(etapro_SOURCES) $(everups_SOURCES) $(gamatronic_SOURCES) \ - $(generic_modbus_SOURCES) $(genericups_SOURCES) \ - $(huawei_ups2000_SOURCES) $(isbmex_SOURCES) $(ivtscd_SOURCES) \ - $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \ + $(al175_SOURCES) $(apcsmart_SOURCES) $(apcsmart_old_SOURCES) \ + $(apcupsd_ups_SOURCES) $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) \ + $(belkin_SOURCES) $(belkinunv_SOURCES) $(bestfcom_SOURCES) \ + bestfortress.c $(bestuferrups_SOURCES) $(bestups_SOURCES) \ + $(blazer_ser_SOURCES) $(blazer_usb_SOURCES) $(clone_SOURCES) \ + $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \ + $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \ + $(hald_addon_bcmxcp_usb_SOURCES) \ + $(hald_addon_blazer_usb_SOURCES) \ + $(hald_addon_nutdrv_qx_SOURCES) \ + $(hald_addon_riello_usb_SOURCES) \ + $(hald_addon_tripplite_usb_SOURCES) \ + $(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \ + $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ $(macosx_ups_SOURCES) $(masterguard_SOURCES) \ $(metasys_SOURCES) $(mge_shut_SOURCES) $(mge_utalk_SOURCES) \ - $(microdowell_SOURCES) $(microsol_apc_SOURCES) \ - $(netxml_ups_SOURCES) $(nut_ipmipsu_SOURCES) \ - $(nutdrv_atcl_usb_SOURCES) $(nutdrv_qx_SOURCES) \ - $(nutdrv_siemens_sitop_SOURCES) $(oneac_SOURCES) \ - $(optiups_SOURCES) $(phoenixcontact_modbus_SOURCES) \ - $(pijuice_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ + $(microdowell_SOURCES) $(netxml_ups_SOURCES) \ + $(nut_ipmipsu_SOURCES) $(nutdrv_qx_SOURCES) \ + $(oldmge_shut_SOURCES) $(oneac_SOURCES) $(optiups_SOURCES) \ + $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ $(powerpanel_SOURCES) $(rhino_SOURCES) $(richcomm_usb_SOURCES) \ $(riello_ser_SOURCES) $(riello_usb_SOURCES) $(safenet_SOURCES) \ - $(skel_SOURCES) $(snmp_ups_SOURCES) $(socomec_jbus_SOURCES) \ - $(solis_SOURCES) $(tripplite_SOURCES) $(tripplite_usb_SOURCES) \ + $(skel_SOURCES) $(snmp_ups_SOURCES) $(solis_SOURCES) \ + $(tripplite_SOURCES) $(tripplite_usb_SOURCES) \ $(tripplitesu_SOURCES) $(upscode2_SOURCES) \ $(upsdrvctl_SOURCES) $(usbhid_ups_SOURCES) \ $(victronups_SOURCES) -DIST_SOURCES = $(libdummy_la_SOURCES) $(libdummy_serial_la_SOURCES) \ - $(adelsystem_cbi_SOURCES) $(al175_SOURCES) $(apcsmart_SOURCES) \ - $(apcsmart_old_SOURCES) $(apcupsd_ups_SOURCES) $(asem_SOURCES) \ - $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) $(belkin_SOURCES) \ - $(belkinunv_SOURCES) $(bestfcom_SOURCES) \ - $(bestfortress_SOURCES) $(bestuferrups_SOURCES) \ - $(bestups_SOURCES) $(blazer_ser_SOURCES) \ - $(am__blazer_usb_SOURCES_DIST) $(clone_SOURCES) \ +DIST_SOURCES = $(libdummy_a_SOURCES) $(libnuthalmain_a_SOURCES) \ + $(al175_SOURCES) $(apcsmart_SOURCES) $(apcsmart_old_SOURCES) \ + $(apcupsd_ups_SOURCES) $(bcmxcp_SOURCES) $(bcmxcp_usb_SOURCES) \ + $(belkin_SOURCES) $(belkinunv_SOURCES) $(bestfcom_SOURCES) \ + bestfortress.c $(bestuferrups_SOURCES) $(bestups_SOURCES) \ + $(blazer_ser_SOURCES) $(blazer_usb_SOURCES) $(clone_SOURCES) \ $(clone_outlet_SOURCES) $(dummy_ups_SOURCES) $(etapro_SOURCES) \ - $(everups_SOURCES) $(gamatronic_SOURCES) \ - $(generic_modbus_SOURCES) $(genericups_SOURCES) \ - $(huawei_ups2000_SOURCES) $(isbmex_SOURCES) $(ivtscd_SOURCES) \ - $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ + $(everups_SOURCES) $(gamatronic_SOURCES) $(genericups_SOURCES) \ + $(hald_addon_bcmxcp_usb_SOURCES) \ + $(hald_addon_blazer_usb_SOURCES) \ + $(hald_addon_nutdrv_qx_SOURCES) \ + $(hald_addon_riello_usb_SOURCES) \ + $(hald_addon_tripplite_usb_SOURCES) \ + $(hald_addon_usbhid_ups_SOURCES) $(isbmex_SOURCES) \ + $(ivtscd_SOURCES) $(liebert_SOURCES) $(liebert_esp2_SOURCES) \ $(macosx_ups_SOURCES) $(masterguard_SOURCES) \ $(metasys_SOURCES) $(mge_shut_SOURCES) $(mge_utalk_SOURCES) \ - $(microdowell_SOURCES) $(microsol_apc_SOURCES) \ - $(netxml_ups_SOURCES) $(am__nut_ipmipsu_SOURCES_DIST) \ - $(nutdrv_atcl_usb_SOURCES) $(am__nutdrv_qx_SOURCES_DIST) \ - $(nutdrv_siemens_sitop_SOURCES) $(oneac_SOURCES) \ - $(optiups_SOURCES) $(phoenixcontact_modbus_SOURCES) \ - $(pijuice_SOURCES) $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ + $(microdowell_SOURCES) $(netxml_ups_SOURCES) \ + $(am__nut_ipmipsu_SOURCES_DIST) $(am__nutdrv_qx_SOURCES_DIST) \ + $(oldmge_shut_SOURCES) $(oneac_SOURCES) $(optiups_SOURCES) \ + $(powercom_SOURCES) $(powerman_pdu_SOURCES) \ $(powerpanel_SOURCES) $(rhino_SOURCES) $(richcomm_usb_SOURCES) \ - $(riello_ser_SOURCES) $(am__riello_usb_SOURCES_DIST) \ - $(safenet_SOURCES) $(skel_SOURCES) $(snmp_ups_SOURCES) \ - $(socomec_jbus_SOURCES) $(solis_SOURCES) $(tripplite_SOURCES) \ - $(am__tripplite_usb_SOURCES_DIST) $(tripplitesu_SOURCES) \ - $(upscode2_SOURCES) $(upsdrvctl_SOURCES) \ - $(am__usbhid_ups_SOURCES_DIST) $(victronups_SOURCES) + $(riello_ser_SOURCES) $(riello_usb_SOURCES) $(safenet_SOURCES) \ + $(skel_SOURCES) $(snmp_ups_SOURCES) $(solis_SOURCES) \ + $(tripplite_SOURCES) $(tripplite_usb_SOURCES) \ + $(tripplitesu_SOURCES) $(upscode2_SOURCES) \ + $(upsdrvctl_SOURCES) $(usbhid_ups_SOURCES) \ + $(victronups_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(dist_noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -801,7 +565,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -815,7 +578,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -828,8 +590,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -839,15 +604,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -858,29 +622,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -900,9 +656,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -911,16 +664,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -934,7 +683,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -945,12 +693,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -969,21 +713,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -997,9 +738,10 @@ udevdir = @udevdir@ # by default, link programs in this directory with libcommon.la # (libtool version of the static lib, in order to access LTLIBOBJS) #FIXME: SERLIBS is only useful for LDADD_DRIVERS_SERIAL not for LDADD_COMMON -LDADD_COMMON = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la -LDADD_DRIVERS = libdummy.la $(LDADD_COMMON) -LDADD_DRIVERS_SERIAL = libdummy_serial.la $(LDADD_DRIVERS) $(SERLIBS) +LDADD_COMMON = ../common/libcommon.la ../common/libparseconf.la +LDADD_DRIVERS = $(LDADD_COMMON) main.o dstate.o +LDADD_HAL_DRIVERS = $(LDADD_COMMON) libnuthalmain.a +LDADD_DRIVERS_SERIAL = $(LDADD_DRIVERS) $(SERLIBS) serial.o # most targets are drivers, so make this the default LDADD = $(LDADD_DRIVERS_SERIAL) @@ -1007,29 +749,28 @@ LDADD = $(LDADD_DRIVERS_SERIAL) # files. In any case, CFLAGS are only -I options, so there is no harm, # but only add them if we really use the target. AM_CFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) \ - $(am__append_3) $(am__append_4) $(am__append_5) + $(am__append_3) $(am__append_4) $(am__append_5) \ + $(am__append_6) SERIAL_DRIVERLIST = al175 bcmxcp belkin belkinunv bestfcom \ bestfortress bestuferrups bestups dummy-ups etapro everups \ gamatronic genericups isbmex liebert liebert-esp2 masterguard metasys \ - mge-utalk microdowell microsol-apc mge-shut oneac optiups powercom rhino \ - safenet nutdrv_siemens-sitop skel solis tripplite tripplitesu upscode2 victronups powerpanel \ - blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser + oldmge-shut mge-utalk microdowell mge-shut oneac optiups powercom rhino \ + safenet skel solis tripplite tripplitesu upscode2 victronups powerpanel \ + blazer_ser clone clone-outlet ivtscd apcsmart apcsmart-old apcupsd-ups riello_ser \ + nutdrv_qx SNMP_DRIVERLIST = snmp-ups USB_LIBUSB_DRIVERLIST = usbhid-ups bcmxcp_usb tripplite_usb \ - blazer_usb richcomm_usb riello_usb \ - nutdrv_atcl_usb + blazer_usb richcomm_usb riello_usb nutdrv_qx USB_DRIVERLIST = $(USB_LIBUSB_DRIVERLIST) -SERIAL_USB_DRIVERLIST = \ - nutdrv_qx +HAL_DRIVERLIST = hald-addon-usbhid-ups hald-addon-bcmxcp_usb \ + hald-addon-tripplite_usb hald-addon-blazer_usb hald-addon-riello_usb \ + hald-addon-nutdrv_qx NEONXML_DRIVERLIST = netxml-ups MACOSX_DRIVERLIST = macosx-ups -MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus huawei-ups2000 socomec_jbus adelsystem_cbi -LINUX_I2C_DRIVERLIST = asem pijuice -POWERMAN_DRIVERLIST = powerman-pdu -IPMI_DRIVERLIST = nut-ipmipsu +@SOME_DRIVERS_FALSE@@WITH_HAL_TRUE@halexecdir = $(HAL_CALLOUTS_PATH) # ========================================================================== # Driver build details @@ -1047,7 +788,6 @@ bcmxcp_LDADD = $(LDADD) -lm belkin_SOURCES = belkin.c belkinunv_SOURCES = belkinunv.c bestfcom_SOURCES = bestfcom.c -bestfortress_SOURCES = bestfortress.c bestuferrups_SOURCES = bestuferrups.c bestups_SOURCES = bestups.c blazer_ser_SOURCES = blazer.c blazer_ser.c @@ -1063,11 +803,9 @@ liebert_SOURCES = liebert.c liebert_esp2_SOURCES = liebert-esp2.c masterguard_SOURCES = masterguard.c metasys_SOURCES = metasys.c -metasys_LDADD = $(LDADD) -lm +oldmge_shut_SOURCES = mge-shut.c hidparser.c mge_utalk_SOURCES = mge-utalk.c microdowell_SOURCES = microdowell.c -microsol_apc_SOURCES = microsol-apc.c microsol-common.c -microsol_apc_LDADD = $(LDADD) -lm oneac_SOURCES = oneac.c optiups_SOURCES = optiups.c powercom_SOURCES = powercom.c @@ -1077,9 +815,7 @@ powerpanel_LDADD = $(LDADD) -lm rhino_SOURCES = rhino.c rhino_LDADD = $(LDADD) -lm safenet_SOURCES = safenet.c -nutdrv_siemens_sitop_SOURCES = nutdrv_siemens_sitop.c solis_SOURCES = solis.c -solis_LDADD = $(LDADD) -lm tripplite_SOURCES = tripplite.c tripplite_LDADD = $(LDADD) -lm tripplitesu_SOURCES = tripplitesu.c @@ -1094,9 +830,9 @@ riello_ser_LDADD = $(LDADD) -lm # dummy dummy_ups_SOURCES = dummy-ups.c dummy_ups_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/clients \ - $(am__append_16) -dummy_ups_LDADD = $(LDADD_DRIVERS) \ - $(top_builddir)/clients/libupsclient.la $(am__append_17) + $(am__append_14) +dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la \ + $(am__append_15) # Clone drivers clone_SOURCES = clone.c @@ -1112,57 +848,54 @@ skel_SOURCES = skel.c skel_LDADD = $(LDADD_DRIVERS) # USB -@WITH_LIBUSB_0_1_TRUE@LIBUSB_IMPL = libusb0.c -@WITH_LIBUSB_1_0_TRUE@LIBUSB_IMPL = libusb1.c -USBHID_UPS_SUBDRIVERS = apc-hid.c arduino-hid.c belkin-hid.c cps-hid.c explore-hid.c \ +USBHID_UPS_SUBDRIVERS = apc-hid.c belkin-hid.c cps-hid.c explore-hid.c \ liebert-hid.c mge-hid.c powercom-hid.c tripplite-hid.c idowell-hid.c \ - openups-hid.c powervar-hid.c delta_ups-hid.c ever-hid.c legrand-hid.c salicru-hid.c + openups-hid.c -usbhid_ups_SOURCES = usbhid-ups.c libhid.c $(LIBUSB_IMPL) hidparser.c \ +usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c \ usb-common.c $(USBHID_UPS_SUBDRIVERS) -usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm -tripplite_usb_SOURCES = tripplite_usb.c $(LIBUSB_IMPL) usb-common.c +usbhid_ups_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) +tripplite_usb_SOURCES = tripplite_usb.c libusb.c usb-common.c tripplite_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c usb-common.c -bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm -blazer_usb_SOURCES = blazer.c blazer_usb.c $(LIBUSB_IMPL) usb-common.c +bcmxcp_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) +blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c usb-common.c blazer_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm -nutdrv_atcl_usb_SOURCES = nutdrv_atcl_usb.c usb-common.c -nutdrv_atcl_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) richcomm_usb_SOURCES = richcomm_usb.c usb-common.c richcomm_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -riello_usb_SOURCES = riello.c riello_usb.c $(LIBUSB_IMPL) usb-common.c +riello_usb_SOURCES = riello.c riello_usb.c libusb.c usb-common.c riello_usb_LDADD = $(LDADD_DRIVERS) $(LIBUSB_LIBS) -lm # HID-over-serial mge_shut_SOURCES = usbhid-ups.c libshut.c libhid.c hidparser.c mge-hid.c # per-target CFLAGS are necessary here -mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE=1 -mge_shut_LDADD = $(LDADD) -lm +mge_shut_CFLAGS = $(AM_CFLAGS) -DSHUT_MODE +mge_shut_LDADD = $(LDADD) # SNMP -# Please keep the MIB table below sorted roughly alphabetically (incidentally -# by vendor too) to ease maintenance and codebase fork resynchronisations -snmp_ups_SOURCES = snmp-ups.c snmp-ups-helpers.c \ - apc-mib.c apc-pdu-mib.c \ - baytech-mib.c bestpower-mib.c \ - compaq-mib.c cyberpower-mib.c \ - delta_ups-mib.c \ - eaton-pdu-genesis2-mib.c eaton-pdu-marlin-mib.c eaton-pdu-marlin-helpers.c \ - eaton-pdu-pulizzi-mib.c eaton-pdu-revelation-mib.c \ - eaton-ats16-nmc-mib.c eaton-ats16-nm2-mib.c apc-ats-mib.c eaton-ats30-mib.c \ - emerson-avocent-pdu-mib.c \ - hpe-pdu-mib.c huawei-mib.c \ - ietf-mib.c \ - mge-mib.c \ - netvision-mib.c \ - powerware-mib.c \ - raritan-pdu-mib.c raritan-px2-mib.c \ - xppc-mib.c +snmp_ups_SOURCES = snmp-ups.c apc-mib.c baytech-mib.c compaq-mib.c eaton-mib.c \ + ietf-mib.c mge-mib.c netvision-mib.c powerware-mib.c raritan-pdu-mib.c \ + bestpower-mib.c cyberpower-mib.c delta_ups-mib.c -snmp_ups_CFLAGS = $(AM_CFLAGS) $(LIBNETSNMP_CFLAGS) -snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS) -lm +snmp_ups_LDADD = $(LDADD_DRIVERS) $(LIBNETSNMP_LIBS) + +# HAL +hald_addon_usbhid_ups_SOURCES = usbhid-ups.c libhid.c libusb.c hidparser.c \ + $(USBHID_UPS_SUBDRIVERS) + +hald_addon_usbhid_ups_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) +hald_addon_tripplite_usb_SOURCES = tripplite_usb.c libusb.c +hald_addon_tripplite_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm +hald_addon_bcmxcp_usb_SOURCES = bcmxcp_usb.c bcmxcp.c +hald_addon_bcmxcp_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) +hald_addon_blazer_usb_SOURCES = blazer.c blazer_usb.c libusb.c +hald_addon_blazer_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm +hald_addon_riello_usb_SOURCES = riello.c riello_usb.c libusb.c +hald_addon_riello_usb_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm +hald_addon_nutdrv_qx_SOURCES = nutdrv_qx.c libusb.c $(NUTDRV_QX_SUBDRIVERS) +hald_addon_nutdrv_qx_LDADD = $(LDADD_HAL_DRIVERS) $(LIBUSB_LIBS) $(LIBHAL_LIBS) -lm +hald_addon_nutdrv_qx_CFLAGS = $(AM_CFLAGS) -DQX_USB # NEON XML/HTTP netxml_ups_SOURCES = netxml-ups.c mge-xml.c @@ -1173,10 +906,7 @@ powerman_pdu_SOURCES = powerman-pdu.c powerman_pdu_LDADD = $(LDADD) $(LIBPOWERMAN_LIBS) # IPMI PSU -nut_ipmipsu_SOURCES = nut-ipmipsu.c $(am__append_18) -# FIXME: Hacky hot-fix for build agents of varying OS generations: -# Different versions of IPMI libs requested 'unsigned int *' or 'int *' args: -#nut_ipmipsu_CFLAGS = $(AM_CFLAGS) -Wno-pointer-sign +nut_ipmipsu_SOURCES = nut-ipmipsu.c $(am__append_16) nut_ipmipsu_LDADD = $(LDADD) $(LIBIPMI_LIBS) # Mac OS X metadriver @@ -1184,82 +914,48 @@ macosx_ups_LDADD = $(LDADD_DRIVERS) macosx_ups_LDFLAGS = $(LDFLAGS) -framework IOKit -framework CoreFoundation macosx_ups_SOURCES = macosx-ups.c -# Modbus drivers -phoenixcontact_modbus_SOURCES = phoenixcontact_modbus.c -phoenixcontact_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) -generic_modbus_SOURCES = generic_modbus.c -generic_modbus_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) -adelsystem_cbi_SOURCES = adelsystem_cbi.c -adelsystem_cbi_LDADD = $(LDADD_DRIVERS) $(LIBMODBUS_LIBS) - -# Huawei UPS2000 driver -# (this is both a Modbus and a serial driver) -huawei_ups2000_SOURCES = huawei-ups2000.c -huawei_ups2000_LDADD = $(LDADD_DRIVERS_SERIAL) $(LIBMODBUS_LIBS) - -# Socomec JBUS driver -# (this is a Modbus driver) -socomec_jbus_SOURCES = socomec_jbus.c -socomec_jbus_LDADD = $(LDADD_DRIVERS_SERIAL) $(LIBMODBUS_LIBS) - -# Linux I2C drivers -asem_LDADD = $(LDADD_DRIVERS) -asem_SOURCES = asem.c -pijuice_LDADD = $(LDADD_DRIVERS) -pijuice_SOURCES = pijuice.c - # nutdrv_qx USB/Serial -nutdrv_qx_SOURCES = nutdrv_qx.c $(am__append_22) \ +nutdrv_qx_SOURCES = nutdrv_qx.c $(am__append_20) \ $(NUTDRV_QX_SUBDRIVERS) -nutdrv_qx_LDADD = $(LDADD_DRIVERS) -lm $(am__append_20) \ - $(am__append_23) -nutdrv_qx_CFLAGS = $(AM_CFLAGS) $(am__append_19) $(am__append_21) -NUTDRV_QX_SUBDRIVERS = nutdrv_qx_bestups.c nutdrv_qx_blazer-common.c \ - nutdrv_qx_masterguard.c \ - nutdrv_qx_mecer.c nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c \ - nutdrv_qx_mustek.c nutdrv_qx_q1.c nutdrv_qx_voltronic.c \ - nutdrv_qx_voltronic-qs.c nutdrv_qx_voltronic-qs-hex.c nutdrv_qx_zinto.c \ - nutdrv_qx_hunnox.c nutdrv_qx_ablerex.c +nutdrv_qx_LDADD = $(LDADD_DRIVERS) -lm $(am__append_18) \ + $(am__append_21) +nutdrv_qx_CFLAGS = $(AM_CFLAGS) $(am__append_17) $(am__append_19) +NUTDRV_QX_SUBDRIVERS = nutdrv_qx_blazer-common.c nutdrv_qx_mecer.c \ + nutdrv_qx_megatec.c nutdrv_qx_megatec-old.c nutdrv_qx_mustek.c \ + nutdrv_qx_voltronic.c nutdrv_qx_zinto.c # ---------------------------------------------------------------------- # List of header files. The purpose of this list is not dependency # tracking (which is automatic), but to ensure these files are # distributed by "make dist". -dist_noinst_HEADERS = apc-mib.h apc-iem-mib.h apc-hid.h arduino-hid.h baytech-mib.h bcmxcp.h bcmxcp_ser.h \ - bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \ - dummy-ups.h explore-hid.h gamatronic.h genericups.h \ - hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h nut_libusb.h liebert-hid.h \ - main.h mge-hid.h mge-mib.h mge-utalk.h \ - mge-xml.h microdowell.h microsol-apc.h microsol-common.h netvision-mib.h netxml-ups.h nut-ipmi.h oneac.h \ +dist_noinst_HEADERS = apc-mib.h apc-hid.h baytech-mib.h bcmxcp.h \ + bcmxcp_io.h belkin.h belkin-hid.h bestpower-mib.h blazer.h cps-hid.h dstate.h \ + dstate-hal.h dummy-ups.h eaton-mib.h explore-hid.h gamatronic.h genericups.h \ + hidparser.h hidtypes.h ietf-mib.h libhid.h libshut.h libusb.h liebert-hid.h \ + main.h main-hal.h mge-hid.h mge-mib.h mge-shut.h mge-utalk.h \ + mge-xml.h microdowell.h netvision-mib.h netxml-ups.h nut-ipmi.h oneac.h \ powercom.h powerpanel.h powerp-bin.h powerp-txt.h powerware-mib.h raritan-pdu-mib.h \ safenet.h serial.h snmp-ups.h solis.h tripplite.h tripplite-hid.h \ upshandler.h usb-common.h usbhid-ups.h powercom-hid.h compaq-mib.h idowell-hid.h \ apcsmart.h apcsmart_tabs.h apcsmart-old.h apcupsd-ups.h cyberpower-mib.h riello.h openups-hid.h \ - delta_ups-mib.h nutdrv_qx.h nutdrv_qx_bestups.h nutdrv_qx_blazer-common.h \ - nutdrv_qx_masterguard.h \ - nutdrv_qx_mecer.h nutdrv_qx_ablerex.h \ - nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_q1.h nutdrv_qx_hunnox.h \ - nutdrv_qx_voltronic.h nutdrv_qx_voltronic-qs.h nutdrv_qx_voltronic-qs-hex.h nutdrv_qx_zinto.h \ - xppc-mib.h huawei-mib.h eaton-ats16-nmc-mib.h eaton-ats16-nm2-mib.h apc-ats-mib.h raritan-px2-mib.h eaton-ats30-mib.h \ - apc-pdu-mib.h ever-hid.h eaton-pdu-genesis2-mib.h eaton-pdu-marlin-mib.h eaton-pdu-marlin-helpers.h \ - eaton-pdu-pulizzi-mib.h eaton-pdu-revelation-mib.h emerson-avocent-pdu-mib.h legrand-hid.h \ - hpe-pdu-mib.h powervar-hid.h delta_ups-hid.h generic_modbus.h salicru-hid.h adelsystem_cbi.h + delta_ups-mib.h nutdrv_qx.h nutdrv_qx_blazer-common.h nutdrv_qx_mecer.h \ + nutdrv_qx_megatec.h nutdrv_qx_megatec-old.h nutdrv_qx_mustek.h nutdrv_qx_voltronic.h \ + nutdrv_qx_zinto.h # Define a dummy library so that Automake builds rules for the # corresponding object files. This library is not actually built, -# as a final product. It was necessary for Automake-technical reasons, + +# the nuthalmain library combines the code for main-hal.c and +# dstate-hal.c. It is necessary for Automake-technical reasons, # because per-object CFLAGS can only be specified for libraries, not # for object files. This library is used during the build process, # and is not meant to be installed. -EXTRA_LTLIBRARIES = libdummy.la libdummy_serial.la -libdummy_la_SOURCES = main.c dstate.c -libdummy_la_LDFLAGS = -no-undefined -static -libdummy_serial_la_SOURCES = serial.c -libdummy_serial_la_LDFLAGS = -no-undefined -static -CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) -MAINTAINERCLEANFILES = Makefile.in .dirstamp +EXTRA_LIBRARIES = libdummy.a libnuthalmain.a +libdummy_a_SOURCES = main.c dstate.c serial.c +libnuthalmain_a_SOURCES = main-hal.c dstate-hal.c usb-common.c +MOSTLYCLEANFILES = libnuthalmain.a all: all-am .SUFFIXES: @@ -1276,13 +972,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu drivers/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu drivers/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -1293,6 +990,14 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +libdummy.a: $(libdummy_a_OBJECTS) $(libdummy_a_DEPENDENCIES) $(EXTRA_libdummy_a_DEPENDENCIES) + -rm -f libdummy.a + $(libdummy_a_AR) libdummy.a $(libdummy_a_OBJECTS) $(libdummy_a_LIBADD) + $(RANLIB) libdummy.a +libnuthalmain.a: $(libnuthalmain_a_OBJECTS) $(libnuthalmain_a_DEPENDENCIES) $(EXTRA_libnuthalmain_a_DEPENDENCIES) + -rm -f libnuthalmain.a + $(libnuthalmain_a_AR) libnuthalmain.a $(libnuthalmain_a_OBJECTS) $(libnuthalmain_a_LIBADD) + $(RANLIB) libnuthalmain.a install-driverexecPROGRAMS: $(driverexec_PROGRAMS) @$(NORMAL_INSTALL) @list='$(driverexec_PROGRAMS)'; test -n "$(driverexecdir)" || list=; \ @@ -1302,12 +1007,10 @@ install-driverexecPROGRAMS: $(driverexec_PROGRAMS) fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -1328,8 +1031,7 @@ uninstall-driverexecPROGRAMS: @list='$(driverexec_PROGRAMS)'; test -n "$(driverexecdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(driverexecdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(driverexecdir)" && rm -f $$files @@ -1342,21 +1044,19 @@ clean-driverexecPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -install-sbinPROGRAMS: $(sbin_PROGRAMS) +install-halexecPROGRAMS: $(halexec_PROGRAMS) @$(NORMAL_INSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + @list='$(halexec_PROGRAMS)'; test -n "$(halexecdir)" || list=; \ if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ + echo " $(MKDIR_P) '$(DESTDIR)$(halexecdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(halexecdir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -1367,292 +1067,212 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS) while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(halexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(halexecdir)$$dir" || exit $$?; \ } \ ; done -uninstall-sbinPROGRAMS: +uninstall-halexecPROGRAMS: @$(NORMAL_UNINSTALL) - @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ + @list='$(halexec_PROGRAMS)'; test -n "$(halexecdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(sbindir)" && rm -f $$files + echo " ( cd '$(DESTDIR)$(halexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(halexecdir)" && rm -f $$files -clean-sbinPROGRAMS: - @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ +clean-halexecPROGRAMS: + @list='$(halexec_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - -libdummy.la: $(libdummy_la_OBJECTS) $(libdummy_la_DEPENDENCIES) $(EXTRA_libdummy_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdummy_la_LINK) $(libdummy_la_OBJECTS) $(libdummy_la_LIBADD) $(LIBS) - -libdummy_serial.la: $(libdummy_serial_la_OBJECTS) $(libdummy_serial_la_DEPENDENCIES) $(EXTRA_libdummy_serial_la_DEPENDENCIES) - $(AM_V_CCLD)$(libdummy_serial_la_LINK) $(libdummy_serial_la_OBJECTS) $(libdummy_serial_la_LIBADD) $(LIBS) - -adelsystem_cbi$(EXEEXT): $(adelsystem_cbi_OBJECTS) $(adelsystem_cbi_DEPENDENCIES) $(EXTRA_adelsystem_cbi_DEPENDENCIES) - @rm -f adelsystem_cbi$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(adelsystem_cbi_OBJECTS) $(adelsystem_cbi_LDADD) $(LIBS) - al175$(EXEEXT): $(al175_OBJECTS) $(al175_DEPENDENCIES) $(EXTRA_al175_DEPENDENCIES) @rm -f al175$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(al175_OBJECTS) $(al175_LDADD) $(LIBS) - + $(LINK) $(al175_OBJECTS) $(al175_LDADD) $(LIBS) apcsmart$(EXEEXT): $(apcsmart_OBJECTS) $(apcsmart_DEPENDENCIES) $(EXTRA_apcsmart_DEPENDENCIES) @rm -f apcsmart$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(apcsmart_OBJECTS) $(apcsmart_LDADD) $(LIBS) - + $(LINK) $(apcsmart_OBJECTS) $(apcsmart_LDADD) $(LIBS) apcsmart-old$(EXEEXT): $(apcsmart_old_OBJECTS) $(apcsmart_old_DEPENDENCIES) $(EXTRA_apcsmart_old_DEPENDENCIES) @rm -f apcsmart-old$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(apcsmart_old_OBJECTS) $(apcsmart_old_LDADD) $(LIBS) - + $(LINK) $(apcsmart_old_OBJECTS) $(apcsmart_old_LDADD) $(LIBS) apcupsd-ups$(EXEEXT): $(apcupsd_ups_OBJECTS) $(apcupsd_ups_DEPENDENCIES) $(EXTRA_apcupsd_ups_DEPENDENCIES) @rm -f apcupsd-ups$(EXEEXT) - $(AM_V_CCLD)$(apcupsd_ups_LINK) $(apcupsd_ups_OBJECTS) $(apcupsd_ups_LDADD) $(LIBS) - -asem$(EXEEXT): $(asem_OBJECTS) $(asem_DEPENDENCIES) $(EXTRA_asem_DEPENDENCIES) - @rm -f asem$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(asem_OBJECTS) $(asem_LDADD) $(LIBS) - + $(apcupsd_ups_LINK) $(apcupsd_ups_OBJECTS) $(apcupsd_ups_LDADD) $(LIBS) bcmxcp$(EXEEXT): $(bcmxcp_OBJECTS) $(bcmxcp_DEPENDENCIES) $(EXTRA_bcmxcp_DEPENDENCIES) @rm -f bcmxcp$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bcmxcp_OBJECTS) $(bcmxcp_LDADD) $(LIBS) - + $(LINK) $(bcmxcp_OBJECTS) $(bcmxcp_LDADD) $(LIBS) bcmxcp_usb$(EXEEXT): $(bcmxcp_usb_OBJECTS) $(bcmxcp_usb_DEPENDENCIES) $(EXTRA_bcmxcp_usb_DEPENDENCIES) @rm -f bcmxcp_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bcmxcp_usb_OBJECTS) $(bcmxcp_usb_LDADD) $(LIBS) - + $(LINK) $(bcmxcp_usb_OBJECTS) $(bcmxcp_usb_LDADD) $(LIBS) belkin$(EXEEXT): $(belkin_OBJECTS) $(belkin_DEPENDENCIES) $(EXTRA_belkin_DEPENDENCIES) @rm -f belkin$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(belkin_OBJECTS) $(belkin_LDADD) $(LIBS) - + $(LINK) $(belkin_OBJECTS) $(belkin_LDADD) $(LIBS) belkinunv$(EXEEXT): $(belkinunv_OBJECTS) $(belkinunv_DEPENDENCIES) $(EXTRA_belkinunv_DEPENDENCIES) @rm -f belkinunv$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(belkinunv_OBJECTS) $(belkinunv_LDADD) $(LIBS) - + $(LINK) $(belkinunv_OBJECTS) $(belkinunv_LDADD) $(LIBS) bestfcom$(EXEEXT): $(bestfcom_OBJECTS) $(bestfcom_DEPENDENCIES) $(EXTRA_bestfcom_DEPENDENCIES) @rm -f bestfcom$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bestfcom_OBJECTS) $(bestfcom_LDADD) $(LIBS) - + $(LINK) $(bestfcom_OBJECTS) $(bestfcom_LDADD) $(LIBS) bestfortress$(EXEEXT): $(bestfortress_OBJECTS) $(bestfortress_DEPENDENCIES) $(EXTRA_bestfortress_DEPENDENCIES) @rm -f bestfortress$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bestfortress_OBJECTS) $(bestfortress_LDADD) $(LIBS) - + $(LINK) $(bestfortress_OBJECTS) $(bestfortress_LDADD) $(LIBS) bestuferrups$(EXEEXT): $(bestuferrups_OBJECTS) $(bestuferrups_DEPENDENCIES) $(EXTRA_bestuferrups_DEPENDENCIES) @rm -f bestuferrups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bestuferrups_OBJECTS) $(bestuferrups_LDADD) $(LIBS) - + $(LINK) $(bestuferrups_OBJECTS) $(bestuferrups_LDADD) $(LIBS) bestups$(EXEEXT): $(bestups_OBJECTS) $(bestups_DEPENDENCIES) $(EXTRA_bestups_DEPENDENCIES) @rm -f bestups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(bestups_OBJECTS) $(bestups_LDADD) $(LIBS) - + $(LINK) $(bestups_OBJECTS) $(bestups_LDADD) $(LIBS) blazer_ser$(EXEEXT): $(blazer_ser_OBJECTS) $(blazer_ser_DEPENDENCIES) $(EXTRA_blazer_ser_DEPENDENCIES) @rm -f blazer_ser$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(blazer_ser_OBJECTS) $(blazer_ser_LDADD) $(LIBS) - + $(LINK) $(blazer_ser_OBJECTS) $(blazer_ser_LDADD) $(LIBS) blazer_usb$(EXEEXT): $(blazer_usb_OBJECTS) $(blazer_usb_DEPENDENCIES) $(EXTRA_blazer_usb_DEPENDENCIES) @rm -f blazer_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(blazer_usb_OBJECTS) $(blazer_usb_LDADD) $(LIBS) - + $(LINK) $(blazer_usb_OBJECTS) $(blazer_usb_LDADD) $(LIBS) clone$(EXEEXT): $(clone_OBJECTS) $(clone_DEPENDENCIES) $(EXTRA_clone_DEPENDENCIES) @rm -f clone$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(clone_OBJECTS) $(clone_LDADD) $(LIBS) - + $(LINK) $(clone_OBJECTS) $(clone_LDADD) $(LIBS) clone-outlet$(EXEEXT): $(clone_outlet_OBJECTS) $(clone_outlet_DEPENDENCIES) $(EXTRA_clone_outlet_DEPENDENCIES) @rm -f clone-outlet$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(clone_outlet_OBJECTS) $(clone_outlet_LDADD) $(LIBS) - + $(LINK) $(clone_outlet_OBJECTS) $(clone_outlet_LDADD) $(LIBS) dummy-ups$(EXEEXT): $(dummy_ups_OBJECTS) $(dummy_ups_DEPENDENCIES) $(EXTRA_dummy_ups_DEPENDENCIES) @rm -f dummy-ups$(EXEEXT) - $(AM_V_CCLD)$(dummy_ups_LINK) $(dummy_ups_OBJECTS) $(dummy_ups_LDADD) $(LIBS) - + $(dummy_ups_LINK) $(dummy_ups_OBJECTS) $(dummy_ups_LDADD) $(LIBS) etapro$(EXEEXT): $(etapro_OBJECTS) $(etapro_DEPENDENCIES) $(EXTRA_etapro_DEPENDENCIES) @rm -f etapro$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(etapro_OBJECTS) $(etapro_LDADD) $(LIBS) - + $(LINK) $(etapro_OBJECTS) $(etapro_LDADD) $(LIBS) everups$(EXEEXT): $(everups_OBJECTS) $(everups_DEPENDENCIES) $(EXTRA_everups_DEPENDENCIES) @rm -f everups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(everups_OBJECTS) $(everups_LDADD) $(LIBS) - + $(LINK) $(everups_OBJECTS) $(everups_LDADD) $(LIBS) gamatronic$(EXEEXT): $(gamatronic_OBJECTS) $(gamatronic_DEPENDENCIES) $(EXTRA_gamatronic_DEPENDENCIES) @rm -f gamatronic$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(gamatronic_OBJECTS) $(gamatronic_LDADD) $(LIBS) - -generic_modbus$(EXEEXT): $(generic_modbus_OBJECTS) $(generic_modbus_DEPENDENCIES) $(EXTRA_generic_modbus_DEPENDENCIES) - @rm -f generic_modbus$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(generic_modbus_OBJECTS) $(generic_modbus_LDADD) $(LIBS) - + $(LINK) $(gamatronic_OBJECTS) $(gamatronic_LDADD) $(LIBS) genericups$(EXEEXT): $(genericups_OBJECTS) $(genericups_DEPENDENCIES) $(EXTRA_genericups_DEPENDENCIES) @rm -f genericups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(genericups_OBJECTS) $(genericups_LDADD) $(LIBS) - -huawei-ups2000$(EXEEXT): $(huawei_ups2000_OBJECTS) $(huawei_ups2000_DEPENDENCIES) $(EXTRA_huawei_ups2000_DEPENDENCIES) - @rm -f huawei-ups2000$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(huawei_ups2000_OBJECTS) $(huawei_ups2000_LDADD) $(LIBS) - + $(LINK) $(genericups_OBJECTS) $(genericups_LDADD) $(LIBS) +hald-addon-bcmxcp_usb$(EXEEXT): $(hald_addon_bcmxcp_usb_OBJECTS) $(hald_addon_bcmxcp_usb_DEPENDENCIES) $(EXTRA_hald_addon_bcmxcp_usb_DEPENDENCIES) + @rm -f hald-addon-bcmxcp_usb$(EXEEXT) + $(LINK) $(hald_addon_bcmxcp_usb_OBJECTS) $(hald_addon_bcmxcp_usb_LDADD) $(LIBS) +hald-addon-blazer_usb$(EXEEXT): $(hald_addon_blazer_usb_OBJECTS) $(hald_addon_blazer_usb_DEPENDENCIES) $(EXTRA_hald_addon_blazer_usb_DEPENDENCIES) + @rm -f hald-addon-blazer_usb$(EXEEXT) + $(LINK) $(hald_addon_blazer_usb_OBJECTS) $(hald_addon_blazer_usb_LDADD) $(LIBS) +hald-addon-nutdrv_qx$(EXEEXT): $(hald_addon_nutdrv_qx_OBJECTS) $(hald_addon_nutdrv_qx_DEPENDENCIES) $(EXTRA_hald_addon_nutdrv_qx_DEPENDENCIES) + @rm -f hald-addon-nutdrv_qx$(EXEEXT) + $(hald_addon_nutdrv_qx_LINK) $(hald_addon_nutdrv_qx_OBJECTS) $(hald_addon_nutdrv_qx_LDADD) $(LIBS) +hald-addon-riello_usb$(EXEEXT): $(hald_addon_riello_usb_OBJECTS) $(hald_addon_riello_usb_DEPENDENCIES) $(EXTRA_hald_addon_riello_usb_DEPENDENCIES) + @rm -f hald-addon-riello_usb$(EXEEXT) + $(LINK) $(hald_addon_riello_usb_OBJECTS) $(hald_addon_riello_usb_LDADD) $(LIBS) +hald-addon-tripplite_usb$(EXEEXT): $(hald_addon_tripplite_usb_OBJECTS) $(hald_addon_tripplite_usb_DEPENDENCIES) $(EXTRA_hald_addon_tripplite_usb_DEPENDENCIES) + @rm -f hald-addon-tripplite_usb$(EXEEXT) + $(LINK) $(hald_addon_tripplite_usb_OBJECTS) $(hald_addon_tripplite_usb_LDADD) $(LIBS) +hald-addon-usbhid-ups$(EXEEXT): $(hald_addon_usbhid_ups_OBJECTS) $(hald_addon_usbhid_ups_DEPENDENCIES) $(EXTRA_hald_addon_usbhid_ups_DEPENDENCIES) + @rm -f hald-addon-usbhid-ups$(EXEEXT) + $(LINK) $(hald_addon_usbhid_ups_OBJECTS) $(hald_addon_usbhid_ups_LDADD) $(LIBS) isbmex$(EXEEXT): $(isbmex_OBJECTS) $(isbmex_DEPENDENCIES) $(EXTRA_isbmex_DEPENDENCIES) @rm -f isbmex$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(isbmex_OBJECTS) $(isbmex_LDADD) $(LIBS) - + $(LINK) $(isbmex_OBJECTS) $(isbmex_LDADD) $(LIBS) ivtscd$(EXEEXT): $(ivtscd_OBJECTS) $(ivtscd_DEPENDENCIES) $(EXTRA_ivtscd_DEPENDENCIES) @rm -f ivtscd$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(ivtscd_OBJECTS) $(ivtscd_LDADD) $(LIBS) - + $(LINK) $(ivtscd_OBJECTS) $(ivtscd_LDADD) $(LIBS) liebert$(EXEEXT): $(liebert_OBJECTS) $(liebert_DEPENDENCIES) $(EXTRA_liebert_DEPENDENCIES) @rm -f liebert$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(liebert_OBJECTS) $(liebert_LDADD) $(LIBS) - + $(LINK) $(liebert_OBJECTS) $(liebert_LDADD) $(LIBS) liebert-esp2$(EXEEXT): $(liebert_esp2_OBJECTS) $(liebert_esp2_DEPENDENCIES) $(EXTRA_liebert_esp2_DEPENDENCIES) @rm -f liebert-esp2$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(liebert_esp2_OBJECTS) $(liebert_esp2_LDADD) $(LIBS) - + $(LINK) $(liebert_esp2_OBJECTS) $(liebert_esp2_LDADD) $(LIBS) macosx-ups$(EXEEXT): $(macosx_ups_OBJECTS) $(macosx_ups_DEPENDENCIES) $(EXTRA_macosx_ups_DEPENDENCIES) @rm -f macosx-ups$(EXEEXT) - $(AM_V_CCLD)$(macosx_ups_LINK) $(macosx_ups_OBJECTS) $(macosx_ups_LDADD) $(LIBS) - + $(macosx_ups_LINK) $(macosx_ups_OBJECTS) $(macosx_ups_LDADD) $(LIBS) masterguard$(EXEEXT): $(masterguard_OBJECTS) $(masterguard_DEPENDENCIES) $(EXTRA_masterguard_DEPENDENCIES) @rm -f masterguard$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(masterguard_OBJECTS) $(masterguard_LDADD) $(LIBS) - + $(LINK) $(masterguard_OBJECTS) $(masterguard_LDADD) $(LIBS) metasys$(EXEEXT): $(metasys_OBJECTS) $(metasys_DEPENDENCIES) $(EXTRA_metasys_DEPENDENCIES) @rm -f metasys$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(metasys_OBJECTS) $(metasys_LDADD) $(LIBS) - + $(LINK) $(metasys_OBJECTS) $(metasys_LDADD) $(LIBS) mge-shut$(EXEEXT): $(mge_shut_OBJECTS) $(mge_shut_DEPENDENCIES) $(EXTRA_mge_shut_DEPENDENCIES) @rm -f mge-shut$(EXEEXT) - $(AM_V_CCLD)$(mge_shut_LINK) $(mge_shut_OBJECTS) $(mge_shut_LDADD) $(LIBS) - + $(mge_shut_LINK) $(mge_shut_OBJECTS) $(mge_shut_LDADD) $(LIBS) mge-utalk$(EXEEXT): $(mge_utalk_OBJECTS) $(mge_utalk_DEPENDENCIES) $(EXTRA_mge_utalk_DEPENDENCIES) @rm -f mge-utalk$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(mge_utalk_OBJECTS) $(mge_utalk_LDADD) $(LIBS) - + $(LINK) $(mge_utalk_OBJECTS) $(mge_utalk_LDADD) $(LIBS) microdowell$(EXEEXT): $(microdowell_OBJECTS) $(microdowell_DEPENDENCIES) $(EXTRA_microdowell_DEPENDENCIES) @rm -f microdowell$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(microdowell_OBJECTS) $(microdowell_LDADD) $(LIBS) - -microsol-apc$(EXEEXT): $(microsol_apc_OBJECTS) $(microsol_apc_DEPENDENCIES) $(EXTRA_microsol_apc_DEPENDENCIES) - @rm -f microsol-apc$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(microsol_apc_OBJECTS) $(microsol_apc_LDADD) $(LIBS) - + $(LINK) $(microdowell_OBJECTS) $(microdowell_LDADD) $(LIBS) netxml-ups$(EXEEXT): $(netxml_ups_OBJECTS) $(netxml_ups_DEPENDENCIES) $(EXTRA_netxml_ups_DEPENDENCIES) @rm -f netxml-ups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(netxml_ups_OBJECTS) $(netxml_ups_LDADD) $(LIBS) - + $(LINK) $(netxml_ups_OBJECTS) $(netxml_ups_LDADD) $(LIBS) nut-ipmipsu$(EXEEXT): $(nut_ipmipsu_OBJECTS) $(nut_ipmipsu_DEPENDENCIES) $(EXTRA_nut_ipmipsu_DEPENDENCIES) @rm -f nut-ipmipsu$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(nut_ipmipsu_OBJECTS) $(nut_ipmipsu_LDADD) $(LIBS) - -nutdrv_atcl_usb$(EXEEXT): $(nutdrv_atcl_usb_OBJECTS) $(nutdrv_atcl_usb_DEPENDENCIES) $(EXTRA_nutdrv_atcl_usb_DEPENDENCIES) - @rm -f nutdrv_atcl_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(nutdrv_atcl_usb_OBJECTS) $(nutdrv_atcl_usb_LDADD) $(LIBS) - + $(LINK) $(nut_ipmipsu_OBJECTS) $(nut_ipmipsu_LDADD) $(LIBS) nutdrv_qx$(EXEEXT): $(nutdrv_qx_OBJECTS) $(nutdrv_qx_DEPENDENCIES) $(EXTRA_nutdrv_qx_DEPENDENCIES) @rm -f nutdrv_qx$(EXEEXT) - $(AM_V_CCLD)$(nutdrv_qx_LINK) $(nutdrv_qx_OBJECTS) $(nutdrv_qx_LDADD) $(LIBS) - -nutdrv_siemens-sitop$(EXEEXT): $(nutdrv_siemens_sitop_OBJECTS) $(nutdrv_siemens_sitop_DEPENDENCIES) $(EXTRA_nutdrv_siemens_sitop_DEPENDENCIES) - @rm -f nutdrv_siemens-sitop$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(nutdrv_siemens_sitop_OBJECTS) $(nutdrv_siemens_sitop_LDADD) $(LIBS) - + $(nutdrv_qx_LINK) $(nutdrv_qx_OBJECTS) $(nutdrv_qx_LDADD) $(LIBS) +oldmge-shut$(EXEEXT): $(oldmge_shut_OBJECTS) $(oldmge_shut_DEPENDENCIES) $(EXTRA_oldmge_shut_DEPENDENCIES) + @rm -f oldmge-shut$(EXEEXT) + $(LINK) $(oldmge_shut_OBJECTS) $(oldmge_shut_LDADD) $(LIBS) oneac$(EXEEXT): $(oneac_OBJECTS) $(oneac_DEPENDENCIES) $(EXTRA_oneac_DEPENDENCIES) @rm -f oneac$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(oneac_OBJECTS) $(oneac_LDADD) $(LIBS) - + $(LINK) $(oneac_OBJECTS) $(oneac_LDADD) $(LIBS) optiups$(EXEEXT): $(optiups_OBJECTS) $(optiups_DEPENDENCIES) $(EXTRA_optiups_DEPENDENCIES) @rm -f optiups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(optiups_OBJECTS) $(optiups_LDADD) $(LIBS) - -phoenixcontact_modbus$(EXEEXT): $(phoenixcontact_modbus_OBJECTS) $(phoenixcontact_modbus_DEPENDENCIES) $(EXTRA_phoenixcontact_modbus_DEPENDENCIES) - @rm -f phoenixcontact_modbus$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(phoenixcontact_modbus_OBJECTS) $(phoenixcontact_modbus_LDADD) $(LIBS) - -pijuice$(EXEEXT): $(pijuice_OBJECTS) $(pijuice_DEPENDENCIES) $(EXTRA_pijuice_DEPENDENCIES) - @rm -f pijuice$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(pijuice_OBJECTS) $(pijuice_LDADD) $(LIBS) - + $(LINK) $(optiups_OBJECTS) $(optiups_LDADD) $(LIBS) powercom$(EXEEXT): $(powercom_OBJECTS) $(powercom_DEPENDENCIES) $(EXTRA_powercom_DEPENDENCIES) @rm -f powercom$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(powercom_OBJECTS) $(powercom_LDADD) $(LIBS) - + $(LINK) $(powercom_OBJECTS) $(powercom_LDADD) $(LIBS) powerman-pdu$(EXEEXT): $(powerman_pdu_OBJECTS) $(powerman_pdu_DEPENDENCIES) $(EXTRA_powerman_pdu_DEPENDENCIES) @rm -f powerman-pdu$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(powerman_pdu_OBJECTS) $(powerman_pdu_LDADD) $(LIBS) - + $(LINK) $(powerman_pdu_OBJECTS) $(powerman_pdu_LDADD) $(LIBS) powerpanel$(EXEEXT): $(powerpanel_OBJECTS) $(powerpanel_DEPENDENCIES) $(EXTRA_powerpanel_DEPENDENCIES) @rm -f powerpanel$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(powerpanel_OBJECTS) $(powerpanel_LDADD) $(LIBS) - + $(LINK) $(powerpanel_OBJECTS) $(powerpanel_LDADD) $(LIBS) rhino$(EXEEXT): $(rhino_OBJECTS) $(rhino_DEPENDENCIES) $(EXTRA_rhino_DEPENDENCIES) @rm -f rhino$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(rhino_OBJECTS) $(rhino_LDADD) $(LIBS) - + $(LINK) $(rhino_OBJECTS) $(rhino_LDADD) $(LIBS) richcomm_usb$(EXEEXT): $(richcomm_usb_OBJECTS) $(richcomm_usb_DEPENDENCIES) $(EXTRA_richcomm_usb_DEPENDENCIES) @rm -f richcomm_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(richcomm_usb_OBJECTS) $(richcomm_usb_LDADD) $(LIBS) - + $(LINK) $(richcomm_usb_OBJECTS) $(richcomm_usb_LDADD) $(LIBS) riello_ser$(EXEEXT): $(riello_ser_OBJECTS) $(riello_ser_DEPENDENCIES) $(EXTRA_riello_ser_DEPENDENCIES) @rm -f riello_ser$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(riello_ser_OBJECTS) $(riello_ser_LDADD) $(LIBS) - + $(LINK) $(riello_ser_OBJECTS) $(riello_ser_LDADD) $(LIBS) riello_usb$(EXEEXT): $(riello_usb_OBJECTS) $(riello_usb_DEPENDENCIES) $(EXTRA_riello_usb_DEPENDENCIES) @rm -f riello_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(riello_usb_OBJECTS) $(riello_usb_LDADD) $(LIBS) - + $(LINK) $(riello_usb_OBJECTS) $(riello_usb_LDADD) $(LIBS) safenet$(EXEEXT): $(safenet_OBJECTS) $(safenet_DEPENDENCIES) $(EXTRA_safenet_DEPENDENCIES) @rm -f safenet$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(safenet_OBJECTS) $(safenet_LDADD) $(LIBS) - + $(LINK) $(safenet_OBJECTS) $(safenet_LDADD) $(LIBS) skel$(EXEEXT): $(skel_OBJECTS) $(skel_DEPENDENCIES) $(EXTRA_skel_DEPENDENCIES) @rm -f skel$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(skel_OBJECTS) $(skel_LDADD) $(LIBS) - + $(LINK) $(skel_OBJECTS) $(skel_LDADD) $(LIBS) snmp-ups$(EXEEXT): $(snmp_ups_OBJECTS) $(snmp_ups_DEPENDENCIES) $(EXTRA_snmp_ups_DEPENDENCIES) @rm -f snmp-ups$(EXEEXT) - $(AM_V_CCLD)$(snmp_ups_LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD) $(LIBS) - -socomec_jbus$(EXEEXT): $(socomec_jbus_OBJECTS) $(socomec_jbus_DEPENDENCIES) $(EXTRA_socomec_jbus_DEPENDENCIES) - @rm -f socomec_jbus$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(socomec_jbus_OBJECTS) $(socomec_jbus_LDADD) $(LIBS) - + $(LINK) $(snmp_ups_OBJECTS) $(snmp_ups_LDADD) $(LIBS) solis$(EXEEXT): $(solis_OBJECTS) $(solis_DEPENDENCIES) $(EXTRA_solis_DEPENDENCIES) @rm -f solis$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(solis_OBJECTS) $(solis_LDADD) $(LIBS) - + $(LINK) $(solis_OBJECTS) $(solis_LDADD) $(LIBS) tripplite$(EXEEXT): $(tripplite_OBJECTS) $(tripplite_DEPENDENCIES) $(EXTRA_tripplite_DEPENDENCIES) @rm -f tripplite$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tripplite_OBJECTS) $(tripplite_LDADD) $(LIBS) - + $(LINK) $(tripplite_OBJECTS) $(tripplite_LDADD) $(LIBS) tripplite_usb$(EXEEXT): $(tripplite_usb_OBJECTS) $(tripplite_usb_DEPENDENCIES) $(EXTRA_tripplite_usb_DEPENDENCIES) @rm -f tripplite_usb$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tripplite_usb_OBJECTS) $(tripplite_usb_LDADD) $(LIBS) - + $(LINK) $(tripplite_usb_OBJECTS) $(tripplite_usb_LDADD) $(LIBS) tripplitesu$(EXEEXT): $(tripplitesu_OBJECTS) $(tripplitesu_DEPENDENCIES) $(EXTRA_tripplitesu_DEPENDENCIES) @rm -f tripplitesu$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(tripplitesu_OBJECTS) $(tripplitesu_LDADD) $(LIBS) - + $(LINK) $(tripplitesu_OBJECTS) $(tripplitesu_LDADD) $(LIBS) upscode2$(EXEEXT): $(upscode2_OBJECTS) $(upscode2_DEPENDENCIES) $(EXTRA_upscode2_DEPENDENCIES) @rm -f upscode2$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upscode2_OBJECTS) $(upscode2_LDADD) $(LIBS) - + $(LINK) $(upscode2_OBJECTS) $(upscode2_LDADD) $(LIBS) upsdrvctl$(EXEEXT): $(upsdrvctl_OBJECTS) $(upsdrvctl_DEPENDENCIES) $(EXTRA_upsdrvctl_DEPENDENCIES) @rm -f upsdrvctl$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsdrvctl_OBJECTS) $(upsdrvctl_LDADD) $(LIBS) - + $(LINK) $(upsdrvctl_OBJECTS) $(upsdrvctl_LDADD) $(LIBS) usbhid-ups$(EXEEXT): $(usbhid_ups_OBJECTS) $(usbhid_ups_DEPENDENCIES) $(EXTRA_usbhid_ups_DEPENDENCIES) @rm -f usbhid-ups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(usbhid_ups_OBJECTS) $(usbhid_ups_LDADD) $(LIBS) - + $(LINK) $(usbhid_ups_OBJECTS) $(usbhid_ups_LDADD) $(LIBS) victronups$(EXEEXT): $(victronups_OBJECTS) $(victronups_DEPENDENCIES) $(EXTRA_victronups_DEPENDENCIES) @rm -f victronups$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(victronups_OBJECTS) $(victronups_LDADD) $(LIBS) + $(LINK) $(victronups_OBJECTS) $(victronups_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -1660,923 +1280,507 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adelsystem_cbi.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/al175.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart-old.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart_tabs.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arduino-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asem.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_ser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkinunv.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfcom.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfortress.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestuferrups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer_ser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clone-outlet.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clone.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cps-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delta_ups-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstate.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_ups-dummy-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etapro.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ever-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/everups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/explore-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamatronic.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/generic_modbus.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genericups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hidparser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/huawei-ups2000.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idowell-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isbmex.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ivtscd.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/legrand-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb0.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb1.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-esp2.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macosx-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masterguard.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metasys.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-utalk.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-xml.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-hidparser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libhid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libshut.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-mge-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-usbhid-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/microdowell.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/microsol-apc.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/microsol-common.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netxml-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-ipmipsu.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-libfreeipmi.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_atcl_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-libusb0.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-libusb1.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-usb-common.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_siemens_sitop.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oneac.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openups-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optiups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/phoenixcontact_modbus.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pijuice.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powercom-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powercom.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerman-pdu.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerp-bin.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerp-txt.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerpanel.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powervar-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rhino.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/richcomm_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello_ser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safenet.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/salicru-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serial.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skel.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-apc-ats-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-apc-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-apc-pdu-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-baytech-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-bestpower-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-compaq-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-cyberpower-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-delta_ups-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-ats30-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-hpe-pdu-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-huawei-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-ietf-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-mge-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-netvision-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-powerware-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-raritan-pdu-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-raritan-px2-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-snmp-ups-helpers.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-snmp-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp_ups-xppc-mib.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socomec_jbus.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solis.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite-hid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite_usb.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplitesu.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upscode2.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsdrvctl.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-common.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbhid-ups.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/victronups.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/al175.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apc-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart-old.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcsmart_tabs.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/baytech-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_ser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bcmxcp_usb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/belkinunv.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfcom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestfortress.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestpower-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestuferrups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bestups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer_ser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blazer_usb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clone-outlet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clone.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/compaq-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cps-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cyberpower-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delta_ups-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstate-hal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dstate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dummy_ups-dummy-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaton-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/etapro.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/everups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/explore-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamatronic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genericups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-libusb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hidparser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idowell-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ietf-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isbmex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ivtscd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libhid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libusb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-esp2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/liebert.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macosx-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main-hal.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/masterguard.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metasys.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-shut.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-utalk.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge-xml.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-hidparser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libhid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-libshut.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-mge-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mge_shut-usbhid-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/microdowell.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netvision-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netxml-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-ipmipsu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut-libfreeipmi.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-libusb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutdrv_qx-usb-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oneac.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openups-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/optiups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powercom-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powercom.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerman-pdu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerp-bin.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerp-txt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerpanel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/powerware-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raritan-pdu-mib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rhino.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/richcomm_usb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello_ser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/riello_usb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/safenet.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serial.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/snmp-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solis.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite-hid.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplite_usb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tripplitesu.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upscode2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsdrvctl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usb-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usbhid-ups.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/victronups.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< apcupsd_ups-apcupsd-ups.o: apcupsd-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -MT apcupsd_ups-apcupsd-ups.o -MD -MP -MF $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo -c -o apcupsd_ups-apcupsd-ups.o `test -f 'apcupsd-ups.c' || echo '$(srcdir)/'`apcupsd-ups.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo $(DEPDIR)/apcupsd_ups-apcupsd-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apcupsd-ups.c' object='apcupsd_ups-apcupsd-ups.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -MT apcupsd_ups-apcupsd-ups.o -MD -MP -MF $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo -c -o apcupsd_ups-apcupsd-ups.o `test -f 'apcupsd-ups.c' || echo '$(srcdir)/'`apcupsd-ups.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo $(DEPDIR)/apcupsd_ups-apcupsd-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='apcupsd-ups.c' object='apcupsd_ups-apcupsd-ups.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -c -o apcupsd_ups-apcupsd-ups.o `test -f 'apcupsd-ups.c' || echo '$(srcdir)/'`apcupsd-ups.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -c -o apcupsd_ups-apcupsd-ups.o `test -f 'apcupsd-ups.c' || echo '$(srcdir)/'`apcupsd-ups.c apcupsd_ups-apcupsd-ups.obj: apcupsd-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -MT apcupsd_ups-apcupsd-ups.obj -MD -MP -MF $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo -c -o apcupsd_ups-apcupsd-ups.obj `if test -f 'apcupsd-ups.c'; then $(CYGPATH_W) 'apcupsd-ups.c'; else $(CYGPATH_W) '$(srcdir)/apcupsd-ups.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo $(DEPDIR)/apcupsd_ups-apcupsd-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apcupsd-ups.c' object='apcupsd_ups-apcupsd-ups.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -MT apcupsd_ups-apcupsd-ups.obj -MD -MP -MF $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo -c -o apcupsd_ups-apcupsd-ups.obj `if test -f 'apcupsd-ups.c'; then $(CYGPATH_W) 'apcupsd-ups.c'; else $(CYGPATH_W) '$(srcdir)/apcupsd-ups.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/apcupsd_ups-apcupsd-ups.Tpo $(DEPDIR)/apcupsd_ups-apcupsd-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='apcupsd-ups.c' object='apcupsd_ups-apcupsd-ups.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -c -o apcupsd_ups-apcupsd-ups.obj `if test -f 'apcupsd-ups.c'; then $(CYGPATH_W) 'apcupsd-ups.c'; else $(CYGPATH_W) '$(srcdir)/apcupsd-ups.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(apcupsd_ups_CFLAGS) $(CFLAGS) -c -o apcupsd_ups-apcupsd-ups.obj `if test -f 'apcupsd-ups.c'; then $(CYGPATH_W) 'apcupsd-ups.c'; else $(CYGPATH_W) '$(srcdir)/apcupsd-ups.c'; fi` dummy_ups-dummy-ups.o: dummy-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -MT dummy_ups-dummy-ups.o -MD -MP -MF $(DEPDIR)/dummy_ups-dummy-ups.Tpo -c -o dummy_ups-dummy-ups.o `test -f 'dummy-ups.c' || echo '$(srcdir)/'`dummy-ups.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dummy_ups-dummy-ups.Tpo $(DEPDIR)/dummy_ups-dummy-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy-ups.c' object='dummy_ups-dummy-ups.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -MT dummy_ups-dummy-ups.o -MD -MP -MF $(DEPDIR)/dummy_ups-dummy-ups.Tpo -c -o dummy_ups-dummy-ups.o `test -f 'dummy-ups.c' || echo '$(srcdir)/'`dummy-ups.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dummy_ups-dummy-ups.Tpo $(DEPDIR)/dummy_ups-dummy-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dummy-ups.c' object='dummy_ups-dummy-ups.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -c -o dummy_ups-dummy-ups.o `test -f 'dummy-ups.c' || echo '$(srcdir)/'`dummy-ups.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -c -o dummy_ups-dummy-ups.o `test -f 'dummy-ups.c' || echo '$(srcdir)/'`dummy-ups.c dummy_ups-dummy-ups.obj: dummy-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -MT dummy_ups-dummy-ups.obj -MD -MP -MF $(DEPDIR)/dummy_ups-dummy-ups.Tpo -c -o dummy_ups-dummy-ups.obj `if test -f 'dummy-ups.c'; then $(CYGPATH_W) 'dummy-ups.c'; else $(CYGPATH_W) '$(srcdir)/dummy-ups.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dummy_ups-dummy-ups.Tpo $(DEPDIR)/dummy_ups-dummy-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy-ups.c' object='dummy_ups-dummy-ups.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -MT dummy_ups-dummy-ups.obj -MD -MP -MF $(DEPDIR)/dummy_ups-dummy-ups.Tpo -c -o dummy_ups-dummy-ups.obj `if test -f 'dummy-ups.c'; then $(CYGPATH_W) 'dummy-ups.c'; else $(CYGPATH_W) '$(srcdir)/dummy-ups.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/dummy_ups-dummy-ups.Tpo $(DEPDIR)/dummy_ups-dummy-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dummy-ups.c' object='dummy_ups-dummy-ups.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -c -o dummy_ups-dummy-ups.obj `if test -f 'dummy-ups.c'; then $(CYGPATH_W) 'dummy-ups.c'; else $(CYGPATH_W) '$(srcdir)/dummy-ups.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(dummy_ups_CFLAGS) $(CFLAGS) -c -o dummy_ups-dummy-ups.obj `if test -f 'dummy-ups.c'; then $(CYGPATH_W) 'dummy-ups.c'; else $(CYGPATH_W) '$(srcdir)/dummy-ups.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx.o: nutdrv_qx.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx.c' object='hald_addon_nutdrv_qx-nutdrv_qx.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c + +hald_addon_nutdrv_qx-nutdrv_qx.obj: nutdrv_qx.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx.c' object='hald_addon_nutdrv_qx-nutdrv_qx.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` + +hald_addon_nutdrv_qx-libusb.o: libusb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-libusb.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Tpo -c -o hald_addon_nutdrv_qx-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='hald_addon_nutdrv_qx-libusb.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c + +hald_addon_nutdrv_qx-libusb.obj: libusb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-libusb.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Tpo -c -o hald_addon_nutdrv_qx-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-libusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='hald_addon_nutdrv_qx-libusb.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.o: nutdrv_qx_blazer-common.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_blazer-common.c' object='hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c + +hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.obj: nutdrv_qx_blazer-common.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_blazer-common.c' object='hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_mecer.o: nutdrv_qx_mecer.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_mecer.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mecer.c' object='hald_addon_nutdrv_qx-nutdrv_qx_mecer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c + +hald_addon_nutdrv_qx-nutdrv_qx_mecer.obj: nutdrv_qx_mecer.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_mecer.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mecer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mecer.c' object='hald_addon_nutdrv_qx-nutdrv_qx_mecer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_megatec.o: nutdrv_qx_megatec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_megatec.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec.c' object='hald_addon_nutdrv_qx-nutdrv_qx_megatec.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c + +hald_addon_nutdrv_qx-nutdrv_qx_megatec.obj: nutdrv_qx_megatec.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_megatec.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec.c' object='hald_addon_nutdrv_qx-nutdrv_qx_megatec.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.o: nutdrv_qx_megatec-old.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec-old.c' object='hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c + +hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.obj: nutdrv_qx_megatec-old.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec-old.c' object='hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_mustek.o: nutdrv_qx_mustek.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_mustek.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mustek.c' object='hald_addon_nutdrv_qx-nutdrv_qx_mustek.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c + +hald_addon_nutdrv_qx-nutdrv_qx_mustek.obj: nutdrv_qx_mustek.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_mustek.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_mustek.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mustek.c' object='hald_addon_nutdrv_qx-nutdrv_qx_mustek.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_voltronic.o: nutdrv_qx_voltronic.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_voltronic.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_voltronic.c' object='hald_addon_nutdrv_qx-nutdrv_qx_voltronic.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c + +hald_addon_nutdrv_qx-nutdrv_qx_voltronic.obj: nutdrv_qx_voltronic.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_voltronic.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_voltronic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_voltronic.c' object='hald_addon_nutdrv_qx-nutdrv_qx_voltronic.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` + +hald_addon_nutdrv_qx-nutdrv_qx_zinto.o: nutdrv_qx_zinto.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_zinto.o -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_zinto.c' object='hald_addon_nutdrv_qx-nutdrv_qx_zinto.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c + +hald_addon_nutdrv_qx-nutdrv_qx_zinto.obj: nutdrv_qx_zinto.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -MT hald_addon_nutdrv_qx-nutdrv_qx_zinto.obj -MD -MP -MF $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o hald_addon_nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/hald_addon_nutdrv_qx-nutdrv_qx_zinto.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_zinto.c' object='hald_addon_nutdrv_qx-nutdrv_qx_zinto.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(hald_addon_nutdrv_qx_CFLAGS) $(CFLAGS) -c -o hald_addon_nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` mge_shut-usbhid-ups.o: usbhid-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.o -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usbhid-ups.c' object='mge_shut-usbhid-ups.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.o -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='mge_shut-usbhid-ups.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.o `test -f 'usbhid-ups.c' || echo '$(srcdir)/'`usbhid-ups.c mge_shut-usbhid-ups.obj: usbhid-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.obj -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usbhid-ups.c' object='mge_shut-usbhid-ups.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-usbhid-ups.obj -MD -MP -MF $(DEPDIR)/mge_shut-usbhid-ups.Tpo -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-usbhid-ups.Tpo $(DEPDIR)/mge_shut-usbhid-ups.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usbhid-ups.c' object='mge_shut-usbhid-ups.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-usbhid-ups.obj `if test -f 'usbhid-ups.c'; then $(CYGPATH_W) 'usbhid-ups.c'; else $(CYGPATH_W) '$(srcdir)/usbhid-ups.c'; fi` mge_shut-libshut.o: libshut.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.o -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libshut.c' object='mge_shut-libshut.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.o -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='mge_shut-libshut.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.o `test -f 'libshut.c' || echo '$(srcdir)/'`libshut.c mge_shut-libshut.obj: libshut.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.obj -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libshut.c' object='mge_shut-libshut.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libshut.obj -MD -MP -MF $(DEPDIR)/mge_shut-libshut.Tpo -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libshut.Tpo $(DEPDIR)/mge_shut-libshut.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libshut.c' object='mge_shut-libshut.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libshut.obj `if test -f 'libshut.c'; then $(CYGPATH_W) 'libshut.c'; else $(CYGPATH_W) '$(srcdir)/libshut.c'; fi` mge_shut-libhid.o: libhid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.o -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhid.c' object='mge_shut-libhid.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.o -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='mge_shut-libhid.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.o `test -f 'libhid.c' || echo '$(srcdir)/'`libhid.c mge_shut-libhid.obj: libhid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.obj -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libhid.c' object='mge_shut-libhid.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-libhid.obj -MD -MP -MF $(DEPDIR)/mge_shut-libhid.Tpo -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-libhid.Tpo $(DEPDIR)/mge_shut-libhid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libhid.c' object='mge_shut-libhid.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-libhid.obj `if test -f 'libhid.c'; then $(CYGPATH_W) 'libhid.c'; else $(CYGPATH_W) '$(srcdir)/libhid.c'; fi` mge_shut-hidparser.o: hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.o -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hidparser.c' object='mge_shut-hidparser.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.o -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='mge_shut-hidparser.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c mge_shut-hidparser.obj: hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.obj -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hidparser.c' object='mge_shut-hidparser.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-hidparser.obj -MD -MP -MF $(DEPDIR)/mge_shut-hidparser.Tpo -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-hidparser.Tpo $(DEPDIR)/mge_shut-hidparser.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='hidparser.c' object='mge_shut-hidparser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` mge_shut-mge-hid.o: mge-hid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.o -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mge-hid.c' object='mge_shut-mge-hid.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.o -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='mge_shut-mge-hid.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.o `test -f 'mge-hid.c' || echo '$(srcdir)/'`mge-hid.c mge_shut-mge-hid.obj: mge-hid.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.obj -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mge-hid.c' object='mge_shut-mge-hid.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -MT mge_shut-mge-hid.obj -MD -MP -MF $(DEPDIR)/mge_shut-mge-hid.Tpo -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mge_shut-mge-hid.Tpo $(DEPDIR)/mge_shut-mge-hid.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mge-hid.c' object='mge_shut-mge-hid.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(mge_shut_CFLAGS) $(CFLAGS) -c -o mge_shut-mge-hid.obj `if test -f 'mge-hid.c'; then $(CYGPATH_W) 'mge-hid.c'; else $(CYGPATH_W) '$(srcdir)/mge-hid.c'; fi` nutdrv_qx-nutdrv_qx.o: nutdrv_qx.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo -c -o nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx.c' object='nutdrv_qx-nutdrv_qx.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo -c -o nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx.c' object='nutdrv_qx-nutdrv_qx.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx.o `test -f 'nutdrv_qx.c' || echo '$(srcdir)/'`nutdrv_qx.c nutdrv_qx-nutdrv_qx.obj: nutdrv_qx.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo -c -o nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx.c' object='nutdrv_qx-nutdrv_qx.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo -c -o nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx.c' object='nutdrv_qx-nutdrv_qx.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx.obj `if test -f 'nutdrv_qx.c'; then $(CYGPATH_W) 'nutdrv_qx.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx.c'; fi` -nutdrv_qx-libusb0.o: libusb0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb0.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb0.Tpo -c -o nutdrv_qx-libusb0.o `test -f 'libusb0.c' || echo '$(srcdir)/'`libusb0.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-libusb0.Tpo $(DEPDIR)/nutdrv_qx-libusb0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb0.c' object='nutdrv_qx-libusb0.o' libtool=no @AMDEPBACKSLASH@ +nutdrv_qx-libusb.o: libusb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb.Tpo -c -o nutdrv_qx-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-libusb.Tpo $(DEPDIR)/nutdrv_qx-libusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='nutdrv_qx-libusb.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb0.o `test -f 'libusb0.c' || echo '$(srcdir)/'`libusb0.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb.o `test -f 'libusb.c' || echo '$(srcdir)/'`libusb.c -nutdrv_qx-libusb0.obj: libusb0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb0.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb0.Tpo -c -o nutdrv_qx-libusb0.obj `if test -f 'libusb0.c'; then $(CYGPATH_W) 'libusb0.c'; else $(CYGPATH_W) '$(srcdir)/libusb0.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-libusb0.Tpo $(DEPDIR)/nutdrv_qx-libusb0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb0.c' object='nutdrv_qx-libusb0.obj' libtool=no @AMDEPBACKSLASH@ +nutdrv_qx-libusb.obj: libusb.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb.Tpo -c -o nutdrv_qx-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-libusb.Tpo $(DEPDIR)/nutdrv_qx-libusb.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libusb.c' object='nutdrv_qx-libusb.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb0.obj `if test -f 'libusb0.c'; then $(CYGPATH_W) 'libusb0.c'; else $(CYGPATH_W) '$(srcdir)/libusb0.c'; fi` - -nutdrv_qx-libusb1.o: libusb1.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb1.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb1.Tpo -c -o nutdrv_qx-libusb1.o `test -f 'libusb1.c' || echo '$(srcdir)/'`libusb1.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-libusb1.Tpo $(DEPDIR)/nutdrv_qx-libusb1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb1.c' object='nutdrv_qx-libusb1.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb1.o `test -f 'libusb1.c' || echo '$(srcdir)/'`libusb1.c - -nutdrv_qx-libusb1.obj: libusb1.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-libusb1.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-libusb1.Tpo -c -o nutdrv_qx-libusb1.obj `if test -f 'libusb1.c'; then $(CYGPATH_W) 'libusb1.c'; else $(CYGPATH_W) '$(srcdir)/libusb1.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-libusb1.Tpo $(DEPDIR)/nutdrv_qx-libusb1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libusb1.c' object='nutdrv_qx-libusb1.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb1.obj `if test -f 'libusb1.c'; then $(CYGPATH_W) 'libusb1.c'; else $(CYGPATH_W) '$(srcdir)/libusb1.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-libusb.obj `if test -f 'libusb.c'; then $(CYGPATH_W) 'libusb.c'; else $(CYGPATH_W) '$(srcdir)/libusb.c'; fi` nutdrv_qx-usb-common.o: usb-common.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-usb-common.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-usb-common.Tpo -c -o nutdrv_qx-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-usb-common.Tpo $(DEPDIR)/nutdrv_qx-usb-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usb-common.c' object='nutdrv_qx-usb-common.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-usb-common.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-usb-common.Tpo -c -o nutdrv_qx-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-usb-common.Tpo $(DEPDIR)/nutdrv_qx-usb-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usb-common.c' object='nutdrv_qx-usb-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-usb-common.o `test -f 'usb-common.c' || echo '$(srcdir)/'`usb-common.c nutdrv_qx-usb-common.obj: usb-common.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-usb-common.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-usb-common.Tpo -c -o nutdrv_qx-usb-common.obj `if test -f 'usb-common.c'; then $(CYGPATH_W) 'usb-common.c'; else $(CYGPATH_W) '$(srcdir)/usb-common.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-usb-common.Tpo $(DEPDIR)/nutdrv_qx-usb-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='usb-common.c' object='nutdrv_qx-usb-common.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-usb-common.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-usb-common.Tpo -c -o nutdrv_qx-usb-common.obj `if test -f 'usb-common.c'; then $(CYGPATH_W) 'usb-common.c'; else $(CYGPATH_W) '$(srcdir)/usb-common.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-usb-common.Tpo $(DEPDIR)/nutdrv_qx-usb-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usb-common.c' object='nutdrv_qx-usb-common.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-usb-common.obj `if test -f 'usb-common.c'; then $(CYGPATH_W) 'usb-common.c'; else $(CYGPATH_W) '$(srcdir)/usb-common.c'; fi` - -nutdrv_qx-nutdrv_qx_bestups.o: nutdrv_qx_bestups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_bestups.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Tpo -c -o nutdrv_qx-nutdrv_qx_bestups.o `test -f 'nutdrv_qx_bestups.c' || echo '$(srcdir)/'`nutdrv_qx_bestups.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_bestups.c' object='nutdrv_qx-nutdrv_qx_bestups.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_bestups.o `test -f 'nutdrv_qx_bestups.c' || echo '$(srcdir)/'`nutdrv_qx_bestups.c - -nutdrv_qx-nutdrv_qx_bestups.obj: nutdrv_qx_bestups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_bestups.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Tpo -c -o nutdrv_qx-nutdrv_qx_bestups.obj `if test -f 'nutdrv_qx_bestups.c'; then $(CYGPATH_W) 'nutdrv_qx_bestups.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_bestups.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_bestups.c' object='nutdrv_qx-nutdrv_qx_bestups.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_bestups.obj `if test -f 'nutdrv_qx_bestups.c'; then $(CYGPATH_W) 'nutdrv_qx_bestups.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_bestups.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-usb-common.obj `if test -f 'usb-common.c'; then $(CYGPATH_W) 'usb-common.c'; else $(CYGPATH_W) '$(srcdir)/usb-common.c'; fi` nutdrv_qx-nutdrv_qx_blazer-common.o: nutdrv_qx_blazer-common.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_blazer-common.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_blazer-common.c' object='nutdrv_qx-nutdrv_qx_blazer-common.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_blazer-common.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_blazer-common.c' object='nutdrv_qx-nutdrv_qx_blazer-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_blazer-common.o `test -f 'nutdrv_qx_blazer-common.c' || echo '$(srcdir)/'`nutdrv_qx_blazer-common.c nutdrv_qx-nutdrv_qx_blazer-common.obj: nutdrv_qx_blazer-common.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_blazer-common.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_blazer-common.c' object='nutdrv_qx-nutdrv_qx_blazer-common.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_blazer-common.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo -c -o nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_blazer-common.c' object='nutdrv_qx-nutdrv_qx_blazer-common.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` - -nutdrv_qx-nutdrv_qx_masterguard.o: nutdrv_qx_masterguard.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_masterguard.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Tpo -c -o nutdrv_qx-nutdrv_qx_masterguard.o `test -f 'nutdrv_qx_masterguard.c' || echo '$(srcdir)/'`nutdrv_qx_masterguard.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_masterguard.c' object='nutdrv_qx-nutdrv_qx_masterguard.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_masterguard.o `test -f 'nutdrv_qx_masterguard.c' || echo '$(srcdir)/'`nutdrv_qx_masterguard.c - -nutdrv_qx-nutdrv_qx_masterguard.obj: nutdrv_qx_masterguard.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_masterguard.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Tpo -c -o nutdrv_qx-nutdrv_qx_masterguard.obj `if test -f 'nutdrv_qx_masterguard.c'; then $(CYGPATH_W) 'nutdrv_qx_masterguard.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_masterguard.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_masterguard.c' object='nutdrv_qx-nutdrv_qx_masterguard.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_masterguard.obj `if test -f 'nutdrv_qx_masterguard.c'; then $(CYGPATH_W) 'nutdrv_qx_masterguard.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_masterguard.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_blazer-common.obj `if test -f 'nutdrv_qx_blazer-common.c'; then $(CYGPATH_W) 'nutdrv_qx_blazer-common.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_blazer-common.c'; fi` nutdrv_qx-nutdrv_qx_mecer.o: nutdrv_qx_mecer.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mecer.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_mecer.c' object='nutdrv_qx-nutdrv_qx_mecer.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mecer.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mecer.c' object='nutdrv_qx-nutdrv_qx_mecer.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mecer.o `test -f 'nutdrv_qx_mecer.c' || echo '$(srcdir)/'`nutdrv_qx_mecer.c nutdrv_qx-nutdrv_qx_mecer.obj: nutdrv_qx_mecer.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mecer.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_mecer.c' object='nutdrv_qx-nutdrv_qx_mecer.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mecer.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo -c -o nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mecer.c' object='nutdrv_qx-nutdrv_qx_mecer.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mecer.obj `if test -f 'nutdrv_qx_mecer.c'; then $(CYGPATH_W) 'nutdrv_qx_mecer.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mecer.c'; fi` nutdrv_qx-nutdrv_qx_megatec.o: nutdrv_qx_megatec.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_megatec.c' object='nutdrv_qx-nutdrv_qx_megatec.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec.c' object='nutdrv_qx-nutdrv_qx_megatec.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec.o `test -f 'nutdrv_qx_megatec.c' || echo '$(srcdir)/'`nutdrv_qx_megatec.c nutdrv_qx-nutdrv_qx_megatec.obj: nutdrv_qx_megatec.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_megatec.c' object='nutdrv_qx-nutdrv_qx_megatec.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec.c' object='nutdrv_qx-nutdrv_qx_megatec.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec.obj `if test -f 'nutdrv_qx_megatec.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec.c'; fi` nutdrv_qx-nutdrv_qx_megatec-old.o: nutdrv_qx_megatec-old.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec-old.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_megatec-old.c' object='nutdrv_qx-nutdrv_qx_megatec-old.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec-old.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec-old.c' object='nutdrv_qx-nutdrv_qx_megatec-old.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec-old.o `test -f 'nutdrv_qx_megatec-old.c' || echo '$(srcdir)/'`nutdrv_qx_megatec-old.c nutdrv_qx-nutdrv_qx_megatec-old.obj: nutdrv_qx_megatec-old.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec-old.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_megatec-old.c' object='nutdrv_qx-nutdrv_qx_megatec-old.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_megatec-old.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo -c -o nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_megatec-old.c' object='nutdrv_qx-nutdrv_qx_megatec-old.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_megatec-old.obj `if test -f 'nutdrv_qx_megatec-old.c'; then $(CYGPATH_W) 'nutdrv_qx_megatec-old.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_megatec-old.c'; fi` nutdrv_qx-nutdrv_qx_mustek.o: nutdrv_qx_mustek.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mustek.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_mustek.c' object='nutdrv_qx-nutdrv_qx_mustek.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mustek.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mustek.c' object='nutdrv_qx-nutdrv_qx_mustek.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mustek.o `test -f 'nutdrv_qx_mustek.c' || echo '$(srcdir)/'`nutdrv_qx_mustek.c nutdrv_qx-nutdrv_qx_mustek.obj: nutdrv_qx_mustek.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mustek.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_mustek.c' object='nutdrv_qx-nutdrv_qx_mustek.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_mustek.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo -c -o nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_mustek.c' object='nutdrv_qx-nutdrv_qx_mustek.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` - -nutdrv_qx-nutdrv_qx_q1.o: nutdrv_qx_q1.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_q1.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Tpo -c -o nutdrv_qx-nutdrv_qx_q1.o `test -f 'nutdrv_qx_q1.c' || echo '$(srcdir)/'`nutdrv_qx_q1.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_q1.c' object='nutdrv_qx-nutdrv_qx_q1.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_q1.o `test -f 'nutdrv_qx_q1.c' || echo '$(srcdir)/'`nutdrv_qx_q1.c - -nutdrv_qx-nutdrv_qx_q1.obj: nutdrv_qx_q1.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_q1.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Tpo -c -o nutdrv_qx-nutdrv_qx_q1.obj `if test -f 'nutdrv_qx_q1.c'; then $(CYGPATH_W) 'nutdrv_qx_q1.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_q1.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_q1.c' object='nutdrv_qx-nutdrv_qx_q1.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_q1.obj `if test -f 'nutdrv_qx_q1.c'; then $(CYGPATH_W) 'nutdrv_qx_q1.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_q1.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_mustek.obj `if test -f 'nutdrv_qx_mustek.c'; then $(CYGPATH_W) 'nutdrv_qx_mustek.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_mustek.c'; fi` nutdrv_qx-nutdrv_qx_voltronic.o: nutdrv_qx_voltronic.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic.c' object='nutdrv_qx-nutdrv_qx_voltronic.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_voltronic.c' object='nutdrv_qx-nutdrv_qx_voltronic.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic.o `test -f 'nutdrv_qx_voltronic.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic.c nutdrv_qx-nutdrv_qx_voltronic.obj: nutdrv_qx_voltronic.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic.c' object='nutdrv_qx-nutdrv_qx_voltronic.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_voltronic.c' object='nutdrv_qx-nutdrv_qx_voltronic.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` - -nutdrv_qx-nutdrv_qx_voltronic-qs.o: nutdrv_qx_voltronic-qs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic-qs.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic-qs.o `test -f 'nutdrv_qx_voltronic-qs.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic-qs.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic-qs.c' object='nutdrv_qx-nutdrv_qx_voltronic-qs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic-qs.o `test -f 'nutdrv_qx_voltronic-qs.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic-qs.c - -nutdrv_qx-nutdrv_qx_voltronic-qs.obj: nutdrv_qx_voltronic-qs.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic-qs.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic-qs.obj `if test -f 'nutdrv_qx_voltronic-qs.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic-qs.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic-qs.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic-qs.c' object='nutdrv_qx-nutdrv_qx_voltronic-qs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic-qs.obj `if test -f 'nutdrv_qx_voltronic-qs.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic-qs.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic-qs.c'; fi` - -nutdrv_qx-nutdrv_qx_voltronic-qs-hex.o: nutdrv_qx_voltronic-qs-hex.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic-qs-hex.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic-qs-hex.o `test -f 'nutdrv_qx_voltronic-qs-hex.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic-qs-hex.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic-qs-hex.c' object='nutdrv_qx-nutdrv_qx_voltronic-qs-hex.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic-qs-hex.o `test -f 'nutdrv_qx_voltronic-qs-hex.c' || echo '$(srcdir)/'`nutdrv_qx_voltronic-qs-hex.c - -nutdrv_qx-nutdrv_qx_voltronic-qs-hex.obj: nutdrv_qx_voltronic-qs-hex.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_voltronic-qs-hex.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Tpo -c -o nutdrv_qx-nutdrv_qx_voltronic-qs-hex.obj `if test -f 'nutdrv_qx_voltronic-qs-hex.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic-qs-hex.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic-qs-hex.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_voltronic-qs-hex.c' object='nutdrv_qx-nutdrv_qx_voltronic-qs-hex.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic-qs-hex.obj `if test -f 'nutdrv_qx_voltronic-qs-hex.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic-qs-hex.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic-qs-hex.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_voltronic.obj `if test -f 'nutdrv_qx_voltronic.c'; then $(CYGPATH_W) 'nutdrv_qx_voltronic.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_voltronic.c'; fi` nutdrv_qx-nutdrv_qx_zinto.o: nutdrv_qx_zinto.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_zinto.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_zinto.c' object='nutdrv_qx-nutdrv_qx_zinto.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_zinto.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_zinto.c' object='nutdrv_qx-nutdrv_qx_zinto.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_zinto.o `test -f 'nutdrv_qx_zinto.c' || echo '$(srcdir)/'`nutdrv_qx_zinto.c nutdrv_qx-nutdrv_qx_zinto.obj: nutdrv_qx_zinto.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_zinto.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_zinto.c' object='nutdrv_qx-nutdrv_qx_zinto.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_zinto.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo -c -o nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutdrv_qx_zinto.c' object='nutdrv_qx-nutdrv_qx_zinto.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` - -nutdrv_qx-nutdrv_qx_hunnox.o: nutdrv_qx_hunnox.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_hunnox.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Tpo -c -o nutdrv_qx-nutdrv_qx_hunnox.o `test -f 'nutdrv_qx_hunnox.c' || echo '$(srcdir)/'`nutdrv_qx_hunnox.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_hunnox.c' object='nutdrv_qx-nutdrv_qx_hunnox.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_hunnox.o `test -f 'nutdrv_qx_hunnox.c' || echo '$(srcdir)/'`nutdrv_qx_hunnox.c - -nutdrv_qx-nutdrv_qx_hunnox.obj: nutdrv_qx_hunnox.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_hunnox.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Tpo -c -o nutdrv_qx-nutdrv_qx_hunnox.obj `if test -f 'nutdrv_qx_hunnox.c'; then $(CYGPATH_W) 'nutdrv_qx_hunnox.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_hunnox.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_hunnox.c' object='nutdrv_qx-nutdrv_qx_hunnox.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_hunnox.obj `if test -f 'nutdrv_qx_hunnox.c'; then $(CYGPATH_W) 'nutdrv_qx_hunnox.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_hunnox.c'; fi` - -nutdrv_qx-nutdrv_qx_ablerex.o: nutdrv_qx_ablerex.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_ablerex.o -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Tpo -c -o nutdrv_qx-nutdrv_qx_ablerex.o `test -f 'nutdrv_qx_ablerex.c' || echo '$(srcdir)/'`nutdrv_qx_ablerex.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_ablerex.c' object='nutdrv_qx-nutdrv_qx_ablerex.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_ablerex.o `test -f 'nutdrv_qx_ablerex.c' || echo '$(srcdir)/'`nutdrv_qx_ablerex.c - -nutdrv_qx-nutdrv_qx_ablerex.obj: nutdrv_qx_ablerex.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -MT nutdrv_qx-nutdrv_qx_ablerex.obj -MD -MP -MF $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Tpo -c -o nutdrv_qx-nutdrv_qx_ablerex.obj `if test -f 'nutdrv_qx_ablerex.c'; then $(CYGPATH_W) 'nutdrv_qx_ablerex.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_ablerex.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Tpo $(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutdrv_qx_ablerex.c' object='nutdrv_qx-nutdrv_qx_ablerex.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_ablerex.obj `if test -f 'nutdrv_qx_ablerex.c'; then $(CYGPATH_W) 'nutdrv_qx_ablerex.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_ablerex.c'; fi` - -snmp_ups-snmp-ups.o: snmp-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-snmp-ups.o -MD -MP -MF $(DEPDIR)/snmp_ups-snmp-ups.Tpo -c -o snmp_ups-snmp-ups.o `test -f 'snmp-ups.c' || echo '$(srcdir)/'`snmp-ups.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-snmp-ups.Tpo $(DEPDIR)/snmp_ups-snmp-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='snmp-ups.c' object='snmp_ups-snmp-ups.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-snmp-ups.o `test -f 'snmp-ups.c' || echo '$(srcdir)/'`snmp-ups.c - -snmp_ups-snmp-ups.obj: snmp-ups.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-snmp-ups.obj -MD -MP -MF $(DEPDIR)/snmp_ups-snmp-ups.Tpo -c -o snmp_ups-snmp-ups.obj `if test -f 'snmp-ups.c'; then $(CYGPATH_W) 'snmp-ups.c'; else $(CYGPATH_W) '$(srcdir)/snmp-ups.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-snmp-ups.Tpo $(DEPDIR)/snmp_ups-snmp-ups.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='snmp-ups.c' object='snmp_ups-snmp-ups.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-snmp-ups.obj `if test -f 'snmp-ups.c'; then $(CYGPATH_W) 'snmp-ups.c'; else $(CYGPATH_W) '$(srcdir)/snmp-ups.c'; fi` - -snmp_ups-snmp-ups-helpers.o: snmp-ups-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-snmp-ups-helpers.o -MD -MP -MF $(DEPDIR)/snmp_ups-snmp-ups-helpers.Tpo -c -o snmp_ups-snmp-ups-helpers.o `test -f 'snmp-ups-helpers.c' || echo '$(srcdir)/'`snmp-ups-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-snmp-ups-helpers.Tpo $(DEPDIR)/snmp_ups-snmp-ups-helpers.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='snmp-ups-helpers.c' object='snmp_ups-snmp-ups-helpers.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-snmp-ups-helpers.o `test -f 'snmp-ups-helpers.c' || echo '$(srcdir)/'`snmp-ups-helpers.c - -snmp_ups-snmp-ups-helpers.obj: snmp-ups-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-snmp-ups-helpers.obj -MD -MP -MF $(DEPDIR)/snmp_ups-snmp-ups-helpers.Tpo -c -o snmp_ups-snmp-ups-helpers.obj `if test -f 'snmp-ups-helpers.c'; then $(CYGPATH_W) 'snmp-ups-helpers.c'; else $(CYGPATH_W) '$(srcdir)/snmp-ups-helpers.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-snmp-ups-helpers.Tpo $(DEPDIR)/snmp_ups-snmp-ups-helpers.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='snmp-ups-helpers.c' object='snmp_ups-snmp-ups-helpers.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-snmp-ups-helpers.obj `if test -f 'snmp-ups-helpers.c'; then $(CYGPATH_W) 'snmp-ups-helpers.c'; else $(CYGPATH_W) '$(srcdir)/snmp-ups-helpers.c'; fi` - -snmp_ups-apc-mib.o: apc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-apc-mib.Tpo -c -o snmp_ups-apc-mib.o `test -f 'apc-mib.c' || echo '$(srcdir)/'`apc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-mib.Tpo $(DEPDIR)/snmp_ups-apc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-mib.c' object='snmp_ups-apc-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-mib.o `test -f 'apc-mib.c' || echo '$(srcdir)/'`apc-mib.c - -snmp_ups-apc-mib.obj: apc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-apc-mib.Tpo -c -o snmp_ups-apc-mib.obj `if test -f 'apc-mib.c'; then $(CYGPATH_W) 'apc-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-mib.Tpo $(DEPDIR)/snmp_ups-apc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-mib.c' object='snmp_ups-apc-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-mib.obj `if test -f 'apc-mib.c'; then $(CYGPATH_W) 'apc-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-mib.c'; fi` - -snmp_ups-apc-pdu-mib.o: apc-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-pdu-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-apc-pdu-mib.Tpo -c -o snmp_ups-apc-pdu-mib.o `test -f 'apc-pdu-mib.c' || echo '$(srcdir)/'`apc-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-pdu-mib.Tpo $(DEPDIR)/snmp_ups-apc-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-pdu-mib.c' object='snmp_ups-apc-pdu-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-pdu-mib.o `test -f 'apc-pdu-mib.c' || echo '$(srcdir)/'`apc-pdu-mib.c - -snmp_ups-apc-pdu-mib.obj: apc-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-pdu-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-apc-pdu-mib.Tpo -c -o snmp_ups-apc-pdu-mib.obj `if test -f 'apc-pdu-mib.c'; then $(CYGPATH_W) 'apc-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-pdu-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-pdu-mib.Tpo $(DEPDIR)/snmp_ups-apc-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-pdu-mib.c' object='snmp_ups-apc-pdu-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-pdu-mib.obj `if test -f 'apc-pdu-mib.c'; then $(CYGPATH_W) 'apc-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-pdu-mib.c'; fi` - -snmp_ups-baytech-mib.o: baytech-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-baytech-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-baytech-mib.Tpo -c -o snmp_ups-baytech-mib.o `test -f 'baytech-mib.c' || echo '$(srcdir)/'`baytech-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-baytech-mib.Tpo $(DEPDIR)/snmp_ups-baytech-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='baytech-mib.c' object='snmp_ups-baytech-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-baytech-mib.o `test -f 'baytech-mib.c' || echo '$(srcdir)/'`baytech-mib.c - -snmp_ups-baytech-mib.obj: baytech-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-baytech-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-baytech-mib.Tpo -c -o snmp_ups-baytech-mib.obj `if test -f 'baytech-mib.c'; then $(CYGPATH_W) 'baytech-mib.c'; else $(CYGPATH_W) '$(srcdir)/baytech-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-baytech-mib.Tpo $(DEPDIR)/snmp_ups-baytech-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='baytech-mib.c' object='snmp_ups-baytech-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-baytech-mib.obj `if test -f 'baytech-mib.c'; then $(CYGPATH_W) 'baytech-mib.c'; else $(CYGPATH_W) '$(srcdir)/baytech-mib.c'; fi` - -snmp_ups-bestpower-mib.o: bestpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-bestpower-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-bestpower-mib.Tpo -c -o snmp_ups-bestpower-mib.o `test -f 'bestpower-mib.c' || echo '$(srcdir)/'`bestpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-bestpower-mib.Tpo $(DEPDIR)/snmp_ups-bestpower-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bestpower-mib.c' object='snmp_ups-bestpower-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-bestpower-mib.o `test -f 'bestpower-mib.c' || echo '$(srcdir)/'`bestpower-mib.c - -snmp_ups-bestpower-mib.obj: bestpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-bestpower-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-bestpower-mib.Tpo -c -o snmp_ups-bestpower-mib.obj `if test -f 'bestpower-mib.c'; then $(CYGPATH_W) 'bestpower-mib.c'; else $(CYGPATH_W) '$(srcdir)/bestpower-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-bestpower-mib.Tpo $(DEPDIR)/snmp_ups-bestpower-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bestpower-mib.c' object='snmp_ups-bestpower-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-bestpower-mib.obj `if test -f 'bestpower-mib.c'; then $(CYGPATH_W) 'bestpower-mib.c'; else $(CYGPATH_W) '$(srcdir)/bestpower-mib.c'; fi` - -snmp_ups-compaq-mib.o: compaq-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-compaq-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-compaq-mib.Tpo -c -o snmp_ups-compaq-mib.o `test -f 'compaq-mib.c' || echo '$(srcdir)/'`compaq-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-compaq-mib.Tpo $(DEPDIR)/snmp_ups-compaq-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compaq-mib.c' object='snmp_ups-compaq-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-compaq-mib.o `test -f 'compaq-mib.c' || echo '$(srcdir)/'`compaq-mib.c - -snmp_ups-compaq-mib.obj: compaq-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-compaq-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-compaq-mib.Tpo -c -o snmp_ups-compaq-mib.obj `if test -f 'compaq-mib.c'; then $(CYGPATH_W) 'compaq-mib.c'; else $(CYGPATH_W) '$(srcdir)/compaq-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-compaq-mib.Tpo $(DEPDIR)/snmp_ups-compaq-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compaq-mib.c' object='snmp_ups-compaq-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-compaq-mib.obj `if test -f 'compaq-mib.c'; then $(CYGPATH_W) 'compaq-mib.c'; else $(CYGPATH_W) '$(srcdir)/compaq-mib.c'; fi` - -snmp_ups-cyberpower-mib.o: cyberpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-cyberpower-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-cyberpower-mib.Tpo -c -o snmp_ups-cyberpower-mib.o `test -f 'cyberpower-mib.c' || echo '$(srcdir)/'`cyberpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-cyberpower-mib.Tpo $(DEPDIR)/snmp_ups-cyberpower-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cyberpower-mib.c' object='snmp_ups-cyberpower-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-cyberpower-mib.o `test -f 'cyberpower-mib.c' || echo '$(srcdir)/'`cyberpower-mib.c - -snmp_ups-cyberpower-mib.obj: cyberpower-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-cyberpower-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-cyberpower-mib.Tpo -c -o snmp_ups-cyberpower-mib.obj `if test -f 'cyberpower-mib.c'; then $(CYGPATH_W) 'cyberpower-mib.c'; else $(CYGPATH_W) '$(srcdir)/cyberpower-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-cyberpower-mib.Tpo $(DEPDIR)/snmp_ups-cyberpower-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='cyberpower-mib.c' object='snmp_ups-cyberpower-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-cyberpower-mib.obj `if test -f 'cyberpower-mib.c'; then $(CYGPATH_W) 'cyberpower-mib.c'; else $(CYGPATH_W) '$(srcdir)/cyberpower-mib.c'; fi` - -snmp_ups-delta_ups-mib.o: delta_ups-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-delta_ups-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-delta_ups-mib.Tpo -c -o snmp_ups-delta_ups-mib.o `test -f 'delta_ups-mib.c' || echo '$(srcdir)/'`delta_ups-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-delta_ups-mib.Tpo $(DEPDIR)/snmp_ups-delta_ups-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delta_ups-mib.c' object='snmp_ups-delta_ups-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-delta_ups-mib.o `test -f 'delta_ups-mib.c' || echo '$(srcdir)/'`delta_ups-mib.c - -snmp_ups-delta_ups-mib.obj: delta_ups-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-delta_ups-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-delta_ups-mib.Tpo -c -o snmp_ups-delta_ups-mib.obj `if test -f 'delta_ups-mib.c'; then $(CYGPATH_W) 'delta_ups-mib.c'; else $(CYGPATH_W) '$(srcdir)/delta_ups-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-delta_ups-mib.Tpo $(DEPDIR)/snmp_ups-delta_ups-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='delta_ups-mib.c' object='snmp_ups-delta_ups-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-delta_ups-mib.obj `if test -f 'delta_ups-mib.c'; then $(CYGPATH_W) 'delta_ups-mib.c'; else $(CYGPATH_W) '$(srcdir)/delta_ups-mib.c'; fi` - -snmp_ups-eaton-pdu-genesis2-mib.o: eaton-pdu-genesis2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-genesis2-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Tpo -c -o snmp_ups-eaton-pdu-genesis2-mib.o `test -f 'eaton-pdu-genesis2-mib.c' || echo '$(srcdir)/'`eaton-pdu-genesis2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-genesis2-mib.c' object='snmp_ups-eaton-pdu-genesis2-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-genesis2-mib.o `test -f 'eaton-pdu-genesis2-mib.c' || echo '$(srcdir)/'`eaton-pdu-genesis2-mib.c - -snmp_ups-eaton-pdu-genesis2-mib.obj: eaton-pdu-genesis2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-genesis2-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Tpo -c -o snmp_ups-eaton-pdu-genesis2-mib.obj `if test -f 'eaton-pdu-genesis2-mib.c'; then $(CYGPATH_W) 'eaton-pdu-genesis2-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-genesis2-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-genesis2-mib.c' object='snmp_ups-eaton-pdu-genesis2-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-genesis2-mib.obj `if test -f 'eaton-pdu-genesis2-mib.c'; then $(CYGPATH_W) 'eaton-pdu-genesis2-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-genesis2-mib.c'; fi` - -snmp_ups-eaton-pdu-marlin-mib.o: eaton-pdu-marlin-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-marlin-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Tpo -c -o snmp_ups-eaton-pdu-marlin-mib.o `test -f 'eaton-pdu-marlin-mib.c' || echo '$(srcdir)/'`eaton-pdu-marlin-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-marlin-mib.c' object='snmp_ups-eaton-pdu-marlin-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-marlin-mib.o `test -f 'eaton-pdu-marlin-mib.c' || echo '$(srcdir)/'`eaton-pdu-marlin-mib.c - -snmp_ups-eaton-pdu-marlin-mib.obj: eaton-pdu-marlin-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-marlin-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Tpo -c -o snmp_ups-eaton-pdu-marlin-mib.obj `if test -f 'eaton-pdu-marlin-mib.c'; then $(CYGPATH_W) 'eaton-pdu-marlin-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-marlin-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-marlin-mib.c' object='snmp_ups-eaton-pdu-marlin-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-marlin-mib.obj `if test -f 'eaton-pdu-marlin-mib.c'; then $(CYGPATH_W) 'eaton-pdu-marlin-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-marlin-mib.c'; fi` - -snmp_ups-eaton-pdu-marlin-helpers.o: eaton-pdu-marlin-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-marlin-helpers.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Tpo -c -o snmp_ups-eaton-pdu-marlin-helpers.o `test -f 'eaton-pdu-marlin-helpers.c' || echo '$(srcdir)/'`eaton-pdu-marlin-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-marlin-helpers.c' object='snmp_ups-eaton-pdu-marlin-helpers.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-marlin-helpers.o `test -f 'eaton-pdu-marlin-helpers.c' || echo '$(srcdir)/'`eaton-pdu-marlin-helpers.c - -snmp_ups-eaton-pdu-marlin-helpers.obj: eaton-pdu-marlin-helpers.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-marlin-helpers.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Tpo -c -o snmp_ups-eaton-pdu-marlin-helpers.obj `if test -f 'eaton-pdu-marlin-helpers.c'; then $(CYGPATH_W) 'eaton-pdu-marlin-helpers.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-marlin-helpers.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-marlin-helpers.c' object='snmp_ups-eaton-pdu-marlin-helpers.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-marlin-helpers.obj `if test -f 'eaton-pdu-marlin-helpers.c'; then $(CYGPATH_W) 'eaton-pdu-marlin-helpers.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-marlin-helpers.c'; fi` - -snmp_ups-eaton-pdu-pulizzi-mib.o: eaton-pdu-pulizzi-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-pulizzi-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Tpo -c -o snmp_ups-eaton-pdu-pulizzi-mib.o `test -f 'eaton-pdu-pulizzi-mib.c' || echo '$(srcdir)/'`eaton-pdu-pulizzi-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-pulizzi-mib.c' object='snmp_ups-eaton-pdu-pulizzi-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-pulizzi-mib.o `test -f 'eaton-pdu-pulizzi-mib.c' || echo '$(srcdir)/'`eaton-pdu-pulizzi-mib.c - -snmp_ups-eaton-pdu-pulizzi-mib.obj: eaton-pdu-pulizzi-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-pulizzi-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Tpo -c -o snmp_ups-eaton-pdu-pulizzi-mib.obj `if test -f 'eaton-pdu-pulizzi-mib.c'; then $(CYGPATH_W) 'eaton-pdu-pulizzi-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-pulizzi-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-pulizzi-mib.c' object='snmp_ups-eaton-pdu-pulizzi-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-pulizzi-mib.obj `if test -f 'eaton-pdu-pulizzi-mib.c'; then $(CYGPATH_W) 'eaton-pdu-pulizzi-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-pulizzi-mib.c'; fi` - -snmp_ups-eaton-pdu-revelation-mib.o: eaton-pdu-revelation-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-revelation-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Tpo -c -o snmp_ups-eaton-pdu-revelation-mib.o `test -f 'eaton-pdu-revelation-mib.c' || echo '$(srcdir)/'`eaton-pdu-revelation-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-revelation-mib.c' object='snmp_ups-eaton-pdu-revelation-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-revelation-mib.o `test -f 'eaton-pdu-revelation-mib.c' || echo '$(srcdir)/'`eaton-pdu-revelation-mib.c - -snmp_ups-eaton-pdu-revelation-mib.obj: eaton-pdu-revelation-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-pdu-revelation-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Tpo -c -o snmp_ups-eaton-pdu-revelation-mib.obj `if test -f 'eaton-pdu-revelation-mib.c'; then $(CYGPATH_W) 'eaton-pdu-revelation-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-revelation-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Tpo $(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-pdu-revelation-mib.c' object='snmp_ups-eaton-pdu-revelation-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-pdu-revelation-mib.obj `if test -f 'eaton-pdu-revelation-mib.c'; then $(CYGPATH_W) 'eaton-pdu-revelation-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-pdu-revelation-mib.c'; fi` - -snmp_ups-eaton-ats16-nmc-mib.o: eaton-ats16-nmc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats16-nmc-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Tpo -c -o snmp_ups-eaton-ats16-nmc-mib.o `test -f 'eaton-ats16-nmc-mib.c' || echo '$(srcdir)/'`eaton-ats16-nmc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats16-nmc-mib.c' object='snmp_ups-eaton-ats16-nmc-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats16-nmc-mib.o `test -f 'eaton-ats16-nmc-mib.c' || echo '$(srcdir)/'`eaton-ats16-nmc-mib.c - -snmp_ups-eaton-ats16-nmc-mib.obj: eaton-ats16-nmc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats16-nmc-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Tpo -c -o snmp_ups-eaton-ats16-nmc-mib.obj `if test -f 'eaton-ats16-nmc-mib.c'; then $(CYGPATH_W) 'eaton-ats16-nmc-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats16-nmc-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats16-nmc-mib.c' object='snmp_ups-eaton-ats16-nmc-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats16-nmc-mib.obj `if test -f 'eaton-ats16-nmc-mib.c'; then $(CYGPATH_W) 'eaton-ats16-nmc-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats16-nmc-mib.c'; fi` - -snmp_ups-eaton-ats16-nm2-mib.o: eaton-ats16-nm2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats16-nm2-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Tpo -c -o snmp_ups-eaton-ats16-nm2-mib.o `test -f 'eaton-ats16-nm2-mib.c' || echo '$(srcdir)/'`eaton-ats16-nm2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats16-nm2-mib.c' object='snmp_ups-eaton-ats16-nm2-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats16-nm2-mib.o `test -f 'eaton-ats16-nm2-mib.c' || echo '$(srcdir)/'`eaton-ats16-nm2-mib.c - -snmp_ups-eaton-ats16-nm2-mib.obj: eaton-ats16-nm2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats16-nm2-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Tpo -c -o snmp_ups-eaton-ats16-nm2-mib.obj `if test -f 'eaton-ats16-nm2-mib.c'; then $(CYGPATH_W) 'eaton-ats16-nm2-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats16-nm2-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats16-nm2-mib.c' object='snmp_ups-eaton-ats16-nm2-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats16-nm2-mib.obj `if test -f 'eaton-ats16-nm2-mib.c'; then $(CYGPATH_W) 'eaton-ats16-nm2-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats16-nm2-mib.c'; fi` - -snmp_ups-apc-ats-mib.o: apc-ats-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-ats-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-apc-ats-mib.Tpo -c -o snmp_ups-apc-ats-mib.o `test -f 'apc-ats-mib.c' || echo '$(srcdir)/'`apc-ats-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-ats-mib.Tpo $(DEPDIR)/snmp_ups-apc-ats-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-ats-mib.c' object='snmp_ups-apc-ats-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-ats-mib.o `test -f 'apc-ats-mib.c' || echo '$(srcdir)/'`apc-ats-mib.c - -snmp_ups-apc-ats-mib.obj: apc-ats-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-apc-ats-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-apc-ats-mib.Tpo -c -o snmp_ups-apc-ats-mib.obj `if test -f 'apc-ats-mib.c'; then $(CYGPATH_W) 'apc-ats-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-ats-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-apc-ats-mib.Tpo $(DEPDIR)/snmp_ups-apc-ats-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='apc-ats-mib.c' object='snmp_ups-apc-ats-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-apc-ats-mib.obj `if test -f 'apc-ats-mib.c'; then $(CYGPATH_W) 'apc-ats-mib.c'; else $(CYGPATH_W) '$(srcdir)/apc-ats-mib.c'; fi` - -snmp_ups-eaton-ats30-mib.o: eaton-ats30-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats30-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats30-mib.Tpo -c -o snmp_ups-eaton-ats30-mib.o `test -f 'eaton-ats30-mib.c' || echo '$(srcdir)/'`eaton-ats30-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats30-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats30-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats30-mib.c' object='snmp_ups-eaton-ats30-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats30-mib.o `test -f 'eaton-ats30-mib.c' || echo '$(srcdir)/'`eaton-ats30-mib.c - -snmp_ups-eaton-ats30-mib.obj: eaton-ats30-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-eaton-ats30-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-eaton-ats30-mib.Tpo -c -o snmp_ups-eaton-ats30-mib.obj `if test -f 'eaton-ats30-mib.c'; then $(CYGPATH_W) 'eaton-ats30-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats30-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-eaton-ats30-mib.Tpo $(DEPDIR)/snmp_ups-eaton-ats30-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='eaton-ats30-mib.c' object='snmp_ups-eaton-ats30-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-eaton-ats30-mib.obj `if test -f 'eaton-ats30-mib.c'; then $(CYGPATH_W) 'eaton-ats30-mib.c'; else $(CYGPATH_W) '$(srcdir)/eaton-ats30-mib.c'; fi` - -snmp_ups-emerson-avocent-pdu-mib.o: emerson-avocent-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-emerson-avocent-pdu-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Tpo -c -o snmp_ups-emerson-avocent-pdu-mib.o `test -f 'emerson-avocent-pdu-mib.c' || echo '$(srcdir)/'`emerson-avocent-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Tpo $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='emerson-avocent-pdu-mib.c' object='snmp_ups-emerson-avocent-pdu-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-emerson-avocent-pdu-mib.o `test -f 'emerson-avocent-pdu-mib.c' || echo '$(srcdir)/'`emerson-avocent-pdu-mib.c - -snmp_ups-emerson-avocent-pdu-mib.obj: emerson-avocent-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-emerson-avocent-pdu-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Tpo -c -o snmp_ups-emerson-avocent-pdu-mib.obj `if test -f 'emerson-avocent-pdu-mib.c'; then $(CYGPATH_W) 'emerson-avocent-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/emerson-avocent-pdu-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Tpo $(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='emerson-avocent-pdu-mib.c' object='snmp_ups-emerson-avocent-pdu-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-emerson-avocent-pdu-mib.obj `if test -f 'emerson-avocent-pdu-mib.c'; then $(CYGPATH_W) 'emerson-avocent-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/emerson-avocent-pdu-mib.c'; fi` - -snmp_ups-hpe-pdu-mib.o: hpe-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-hpe-pdu-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-hpe-pdu-mib.Tpo -c -o snmp_ups-hpe-pdu-mib.o `test -f 'hpe-pdu-mib.c' || echo '$(srcdir)/'`hpe-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-hpe-pdu-mib.Tpo $(DEPDIR)/snmp_ups-hpe-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hpe-pdu-mib.c' object='snmp_ups-hpe-pdu-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-hpe-pdu-mib.o `test -f 'hpe-pdu-mib.c' || echo '$(srcdir)/'`hpe-pdu-mib.c - -snmp_ups-hpe-pdu-mib.obj: hpe-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-hpe-pdu-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-hpe-pdu-mib.Tpo -c -o snmp_ups-hpe-pdu-mib.obj `if test -f 'hpe-pdu-mib.c'; then $(CYGPATH_W) 'hpe-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/hpe-pdu-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-hpe-pdu-mib.Tpo $(DEPDIR)/snmp_ups-hpe-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hpe-pdu-mib.c' object='snmp_ups-hpe-pdu-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-hpe-pdu-mib.obj `if test -f 'hpe-pdu-mib.c'; then $(CYGPATH_W) 'hpe-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/hpe-pdu-mib.c'; fi` - -snmp_ups-huawei-mib.o: huawei-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-huawei-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-huawei-mib.Tpo -c -o snmp_ups-huawei-mib.o `test -f 'huawei-mib.c' || echo '$(srcdir)/'`huawei-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-huawei-mib.Tpo $(DEPDIR)/snmp_ups-huawei-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='huawei-mib.c' object='snmp_ups-huawei-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-huawei-mib.o `test -f 'huawei-mib.c' || echo '$(srcdir)/'`huawei-mib.c - -snmp_ups-huawei-mib.obj: huawei-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-huawei-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-huawei-mib.Tpo -c -o snmp_ups-huawei-mib.obj `if test -f 'huawei-mib.c'; then $(CYGPATH_W) 'huawei-mib.c'; else $(CYGPATH_W) '$(srcdir)/huawei-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-huawei-mib.Tpo $(DEPDIR)/snmp_ups-huawei-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='huawei-mib.c' object='snmp_ups-huawei-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-huawei-mib.obj `if test -f 'huawei-mib.c'; then $(CYGPATH_W) 'huawei-mib.c'; else $(CYGPATH_W) '$(srcdir)/huawei-mib.c'; fi` - -snmp_ups-ietf-mib.o: ietf-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-ietf-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-ietf-mib.Tpo -c -o snmp_ups-ietf-mib.o `test -f 'ietf-mib.c' || echo '$(srcdir)/'`ietf-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-ietf-mib.Tpo $(DEPDIR)/snmp_ups-ietf-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ietf-mib.c' object='snmp_ups-ietf-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-ietf-mib.o `test -f 'ietf-mib.c' || echo '$(srcdir)/'`ietf-mib.c - -snmp_ups-ietf-mib.obj: ietf-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-ietf-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-ietf-mib.Tpo -c -o snmp_ups-ietf-mib.obj `if test -f 'ietf-mib.c'; then $(CYGPATH_W) 'ietf-mib.c'; else $(CYGPATH_W) '$(srcdir)/ietf-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-ietf-mib.Tpo $(DEPDIR)/snmp_ups-ietf-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='ietf-mib.c' object='snmp_ups-ietf-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-ietf-mib.obj `if test -f 'ietf-mib.c'; then $(CYGPATH_W) 'ietf-mib.c'; else $(CYGPATH_W) '$(srcdir)/ietf-mib.c'; fi` - -snmp_ups-mge-mib.o: mge-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-mge-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-mge-mib.Tpo -c -o snmp_ups-mge-mib.o `test -f 'mge-mib.c' || echo '$(srcdir)/'`mge-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-mge-mib.Tpo $(DEPDIR)/snmp_ups-mge-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mge-mib.c' object='snmp_ups-mge-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-mge-mib.o `test -f 'mge-mib.c' || echo '$(srcdir)/'`mge-mib.c - -snmp_ups-mge-mib.obj: mge-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-mge-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-mge-mib.Tpo -c -o snmp_ups-mge-mib.obj `if test -f 'mge-mib.c'; then $(CYGPATH_W) 'mge-mib.c'; else $(CYGPATH_W) '$(srcdir)/mge-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-mge-mib.Tpo $(DEPDIR)/snmp_ups-mge-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='mge-mib.c' object='snmp_ups-mge-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-mge-mib.obj `if test -f 'mge-mib.c'; then $(CYGPATH_W) 'mge-mib.c'; else $(CYGPATH_W) '$(srcdir)/mge-mib.c'; fi` - -snmp_ups-netvision-mib.o: netvision-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-netvision-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-netvision-mib.Tpo -c -o snmp_ups-netvision-mib.o `test -f 'netvision-mib.c' || echo '$(srcdir)/'`netvision-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-netvision-mib.Tpo $(DEPDIR)/snmp_ups-netvision-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='netvision-mib.c' object='snmp_ups-netvision-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-netvision-mib.o `test -f 'netvision-mib.c' || echo '$(srcdir)/'`netvision-mib.c - -snmp_ups-netvision-mib.obj: netvision-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-netvision-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-netvision-mib.Tpo -c -o snmp_ups-netvision-mib.obj `if test -f 'netvision-mib.c'; then $(CYGPATH_W) 'netvision-mib.c'; else $(CYGPATH_W) '$(srcdir)/netvision-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-netvision-mib.Tpo $(DEPDIR)/snmp_ups-netvision-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='netvision-mib.c' object='snmp_ups-netvision-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-netvision-mib.obj `if test -f 'netvision-mib.c'; then $(CYGPATH_W) 'netvision-mib.c'; else $(CYGPATH_W) '$(srcdir)/netvision-mib.c'; fi` - -snmp_ups-powerware-mib.o: powerware-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-powerware-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-powerware-mib.Tpo -c -o snmp_ups-powerware-mib.o `test -f 'powerware-mib.c' || echo '$(srcdir)/'`powerware-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-powerware-mib.Tpo $(DEPDIR)/snmp_ups-powerware-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='powerware-mib.c' object='snmp_ups-powerware-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-powerware-mib.o `test -f 'powerware-mib.c' || echo '$(srcdir)/'`powerware-mib.c - -snmp_ups-powerware-mib.obj: powerware-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-powerware-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-powerware-mib.Tpo -c -o snmp_ups-powerware-mib.obj `if test -f 'powerware-mib.c'; then $(CYGPATH_W) 'powerware-mib.c'; else $(CYGPATH_W) '$(srcdir)/powerware-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-powerware-mib.Tpo $(DEPDIR)/snmp_ups-powerware-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='powerware-mib.c' object='snmp_ups-powerware-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-powerware-mib.obj `if test -f 'powerware-mib.c'; then $(CYGPATH_W) 'powerware-mib.c'; else $(CYGPATH_W) '$(srcdir)/powerware-mib.c'; fi` - -snmp_ups-raritan-pdu-mib.o: raritan-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-raritan-pdu-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-raritan-pdu-mib.Tpo -c -o snmp_ups-raritan-pdu-mib.o `test -f 'raritan-pdu-mib.c' || echo '$(srcdir)/'`raritan-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-raritan-pdu-mib.Tpo $(DEPDIR)/snmp_ups-raritan-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raritan-pdu-mib.c' object='snmp_ups-raritan-pdu-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-raritan-pdu-mib.o `test -f 'raritan-pdu-mib.c' || echo '$(srcdir)/'`raritan-pdu-mib.c - -snmp_ups-raritan-pdu-mib.obj: raritan-pdu-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-raritan-pdu-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-raritan-pdu-mib.Tpo -c -o snmp_ups-raritan-pdu-mib.obj `if test -f 'raritan-pdu-mib.c'; then $(CYGPATH_W) 'raritan-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/raritan-pdu-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-raritan-pdu-mib.Tpo $(DEPDIR)/snmp_ups-raritan-pdu-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raritan-pdu-mib.c' object='snmp_ups-raritan-pdu-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-raritan-pdu-mib.obj `if test -f 'raritan-pdu-mib.c'; then $(CYGPATH_W) 'raritan-pdu-mib.c'; else $(CYGPATH_W) '$(srcdir)/raritan-pdu-mib.c'; fi` - -snmp_ups-raritan-px2-mib.o: raritan-px2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-raritan-px2-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-raritan-px2-mib.Tpo -c -o snmp_ups-raritan-px2-mib.o `test -f 'raritan-px2-mib.c' || echo '$(srcdir)/'`raritan-px2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-raritan-px2-mib.Tpo $(DEPDIR)/snmp_ups-raritan-px2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raritan-px2-mib.c' object='snmp_ups-raritan-px2-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-raritan-px2-mib.o `test -f 'raritan-px2-mib.c' || echo '$(srcdir)/'`raritan-px2-mib.c - -snmp_ups-raritan-px2-mib.obj: raritan-px2-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-raritan-px2-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-raritan-px2-mib.Tpo -c -o snmp_ups-raritan-px2-mib.obj `if test -f 'raritan-px2-mib.c'; then $(CYGPATH_W) 'raritan-px2-mib.c'; else $(CYGPATH_W) '$(srcdir)/raritan-px2-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-raritan-px2-mib.Tpo $(DEPDIR)/snmp_ups-raritan-px2-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='raritan-px2-mib.c' object='snmp_ups-raritan-px2-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-raritan-px2-mib.obj `if test -f 'raritan-px2-mib.c'; then $(CYGPATH_W) 'raritan-px2-mib.c'; else $(CYGPATH_W) '$(srcdir)/raritan-px2-mib.c'; fi` - -snmp_ups-xppc-mib.o: xppc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-xppc-mib.o -MD -MP -MF $(DEPDIR)/snmp_ups-xppc-mib.Tpo -c -o snmp_ups-xppc-mib.o `test -f 'xppc-mib.c' || echo '$(srcdir)/'`xppc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-xppc-mib.Tpo $(DEPDIR)/snmp_ups-xppc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xppc-mib.c' object='snmp_ups-xppc-mib.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-xppc-mib.o `test -f 'xppc-mib.c' || echo '$(srcdir)/'`xppc-mib.c - -snmp_ups-xppc-mib.obj: xppc-mib.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -MT snmp_ups-xppc-mib.obj -MD -MP -MF $(DEPDIR)/snmp_ups-xppc-mib.Tpo -c -o snmp_ups-xppc-mib.obj `if test -f 'xppc-mib.c'; then $(CYGPATH_W) 'xppc-mib.c'; else $(CYGPATH_W) '$(srcdir)/xppc-mib.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/snmp_ups-xppc-mib.Tpo $(DEPDIR)/snmp_ups-xppc-mib.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xppc-mib.c' object='snmp_ups-xppc-mib.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(snmp_ups_CFLAGS) $(CFLAGS) -c -o snmp_ups-xppc-mib.obj `if test -f 'xppc-mib.c'; then $(CYGPATH_W) 'xppc-mib.c'; else $(CYGPATH_W) '$(srcdir)/xppc-mib.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nutdrv_qx_CFLAGS) $(CFLAGS) -c -o nutdrv_qx-nutdrv_qx_zinto.obj `if test -f 'nutdrv_qx_zinto.c'; then $(CYGPATH_W) 'nutdrv_qx_zinto.c'; else $(CYGPATH_W) '$(srcdir)/nutdrv_qx_zinto.c'; fi` mostlyclean-libtool: -rm -f *.lo @@ -2584,15 +1788,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -2604,11 +1819,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -2617,29 +1836,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -2673,7 +1874,7 @@ check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(HEADERS) installdirs: - for dir in "$(DESTDIR)$(driverexecdir)" "$(DESTDIR)$(sbindir)"; do \ + for dir in "$(DESTDIR)$(driverexecdir)" "$(DESTDIR)$(halexecdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -2696,9 +1897,9 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -2707,158 +1908,13 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-driverexecPROGRAMS clean-generic clean-libtool \ - clean-sbinPROGRAMS mostlyclean-am +clean-am: clean-driverexecPROGRAMS clean-generic clean-halexecPROGRAMS \ + clean-libtool mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/adelsystem_cbi.Po - -rm -f ./$(DEPDIR)/al175.Po - -rm -f ./$(DEPDIR)/apc-hid.Po - -rm -f ./$(DEPDIR)/apcsmart-old.Po - -rm -f ./$(DEPDIR)/apcsmart.Po - -rm -f ./$(DEPDIR)/apcsmart_tabs.Po - -rm -f ./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po - -rm -f ./$(DEPDIR)/arduino-hid.Po - -rm -f ./$(DEPDIR)/asem.Po - -rm -f ./$(DEPDIR)/bcmxcp.Po - -rm -f ./$(DEPDIR)/bcmxcp_ser.Po - -rm -f ./$(DEPDIR)/bcmxcp_usb.Po - -rm -f ./$(DEPDIR)/belkin-hid.Po - -rm -f ./$(DEPDIR)/belkin.Po - -rm -f ./$(DEPDIR)/belkinunv.Po - -rm -f ./$(DEPDIR)/bestfcom.Po - -rm -f ./$(DEPDIR)/bestfortress.Po - -rm -f ./$(DEPDIR)/bestuferrups.Po - -rm -f ./$(DEPDIR)/bestups.Po - -rm -f ./$(DEPDIR)/blazer.Po - -rm -f ./$(DEPDIR)/blazer_ser.Po - -rm -f ./$(DEPDIR)/blazer_usb.Po - -rm -f ./$(DEPDIR)/clone-outlet.Po - -rm -f ./$(DEPDIR)/clone.Po - -rm -f ./$(DEPDIR)/cps-hid.Po - -rm -f ./$(DEPDIR)/delta_ups-hid.Po - -rm -f ./$(DEPDIR)/dstate.Plo - -rm -f ./$(DEPDIR)/dummy_ups-dummy-ups.Po - -rm -f ./$(DEPDIR)/etapro.Po - -rm -f ./$(DEPDIR)/ever-hid.Po - -rm -f ./$(DEPDIR)/everups.Po - -rm -f ./$(DEPDIR)/explore-hid.Po - -rm -f ./$(DEPDIR)/gamatronic.Po - -rm -f ./$(DEPDIR)/generic_modbus.Po - -rm -f ./$(DEPDIR)/genericups.Po - -rm -f ./$(DEPDIR)/hidparser.Po - -rm -f ./$(DEPDIR)/huawei-ups2000.Po - -rm -f ./$(DEPDIR)/idowell-hid.Po - -rm -f ./$(DEPDIR)/isbmex.Po - -rm -f ./$(DEPDIR)/ivtscd.Po - -rm -f ./$(DEPDIR)/legrand-hid.Po - -rm -f ./$(DEPDIR)/libhid.Po - -rm -f ./$(DEPDIR)/libusb0.Po - -rm -f ./$(DEPDIR)/libusb1.Po - -rm -f ./$(DEPDIR)/liebert-esp2.Po - -rm -f ./$(DEPDIR)/liebert-hid.Po - -rm -f ./$(DEPDIR)/liebert.Po - -rm -f ./$(DEPDIR)/macosx-ups.Po - -rm -f ./$(DEPDIR)/main.Plo - -rm -f ./$(DEPDIR)/masterguard.Po - -rm -f ./$(DEPDIR)/metasys.Po - -rm -f ./$(DEPDIR)/mge-hid.Po - -rm -f ./$(DEPDIR)/mge-utalk.Po - -rm -f ./$(DEPDIR)/mge-xml.Po - -rm -f ./$(DEPDIR)/mge_shut-hidparser.Po - -rm -f ./$(DEPDIR)/mge_shut-libhid.Po - -rm -f ./$(DEPDIR)/mge_shut-libshut.Po - -rm -f ./$(DEPDIR)/mge_shut-mge-hid.Po - -rm -f ./$(DEPDIR)/mge_shut-usbhid-ups.Po - -rm -f ./$(DEPDIR)/microdowell.Po - -rm -f ./$(DEPDIR)/microsol-apc.Po - -rm -f ./$(DEPDIR)/microsol-common.Po - -rm -f ./$(DEPDIR)/netxml-ups.Po - -rm -f ./$(DEPDIR)/nut-ipmipsu.Po - -rm -f ./$(DEPDIR)/nut-libfreeipmi.Po - -rm -f ./$(DEPDIR)/nutdrv_atcl_usb.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-libusb0.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-libusb1.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-usb-common.Po - -rm -f ./$(DEPDIR)/nutdrv_siemens_sitop.Po - -rm -f ./$(DEPDIR)/oneac.Po - -rm -f ./$(DEPDIR)/openups-hid.Po - -rm -f ./$(DEPDIR)/optiups.Po - -rm -f ./$(DEPDIR)/phoenixcontact_modbus.Po - -rm -f ./$(DEPDIR)/pijuice.Po - -rm -f ./$(DEPDIR)/powercom-hid.Po - -rm -f ./$(DEPDIR)/powercom.Po - -rm -f ./$(DEPDIR)/powerman-pdu.Po - -rm -f ./$(DEPDIR)/powerp-bin.Po - -rm -f ./$(DEPDIR)/powerp-txt.Po - -rm -f ./$(DEPDIR)/powerpanel.Po - -rm -f ./$(DEPDIR)/powervar-hid.Po - -rm -f ./$(DEPDIR)/rhino.Po - -rm -f ./$(DEPDIR)/richcomm_usb.Po - -rm -f ./$(DEPDIR)/riello.Po - -rm -f ./$(DEPDIR)/riello_ser.Po - -rm -f ./$(DEPDIR)/riello_usb.Po - -rm -f ./$(DEPDIR)/safenet.Po - -rm -f ./$(DEPDIR)/salicru-hid.Po - -rm -f ./$(DEPDIR)/serial.Plo - -rm -f ./$(DEPDIR)/skel.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-ats-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-baytech-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-bestpower-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-compaq-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-cyberpower-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-delta_ups-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats30-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-hpe-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-huawei-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-ietf-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-mge-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-netvision-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-powerware-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-raritan-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-raritan-px2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-snmp-ups-helpers.Po - -rm -f ./$(DEPDIR)/snmp_ups-snmp-ups.Po - -rm -f ./$(DEPDIR)/snmp_ups-xppc-mib.Po - -rm -f ./$(DEPDIR)/socomec_jbus.Po - -rm -f ./$(DEPDIR)/solis.Po - -rm -f ./$(DEPDIR)/tripplite-hid.Po - -rm -f ./$(DEPDIR)/tripplite.Po - -rm -f ./$(DEPDIR)/tripplite_usb.Po - -rm -f ./$(DEPDIR)/tripplitesu.Po - -rm -f ./$(DEPDIR)/upscode2.Po - -rm -f ./$(DEPDIR)/upsdrvctl.Po - -rm -f ./$(DEPDIR)/usb-common.Po - -rm -f ./$(DEPDIR)/usbhid-ups.Po - -rm -f ./$(DEPDIR)/victronups.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -2881,7 +1937,7 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-driverexecPROGRAMS install-sbinPROGRAMS +install-exec-am: install-driverexecPROGRAMS install-halexecPROGRAMS install-html: install-html-am @@ -2904,151 +1960,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/adelsystem_cbi.Po - -rm -f ./$(DEPDIR)/al175.Po - -rm -f ./$(DEPDIR)/apc-hid.Po - -rm -f ./$(DEPDIR)/apcsmart-old.Po - -rm -f ./$(DEPDIR)/apcsmart.Po - -rm -f ./$(DEPDIR)/apcsmart_tabs.Po - -rm -f ./$(DEPDIR)/apcupsd_ups-apcupsd-ups.Po - -rm -f ./$(DEPDIR)/arduino-hid.Po - -rm -f ./$(DEPDIR)/asem.Po - -rm -f ./$(DEPDIR)/bcmxcp.Po - -rm -f ./$(DEPDIR)/bcmxcp_ser.Po - -rm -f ./$(DEPDIR)/bcmxcp_usb.Po - -rm -f ./$(DEPDIR)/belkin-hid.Po - -rm -f ./$(DEPDIR)/belkin.Po - -rm -f ./$(DEPDIR)/belkinunv.Po - -rm -f ./$(DEPDIR)/bestfcom.Po - -rm -f ./$(DEPDIR)/bestfortress.Po - -rm -f ./$(DEPDIR)/bestuferrups.Po - -rm -f ./$(DEPDIR)/bestups.Po - -rm -f ./$(DEPDIR)/blazer.Po - -rm -f ./$(DEPDIR)/blazer_ser.Po - -rm -f ./$(DEPDIR)/blazer_usb.Po - -rm -f ./$(DEPDIR)/clone-outlet.Po - -rm -f ./$(DEPDIR)/clone.Po - -rm -f ./$(DEPDIR)/cps-hid.Po - -rm -f ./$(DEPDIR)/delta_ups-hid.Po - -rm -f ./$(DEPDIR)/dstate.Plo - -rm -f ./$(DEPDIR)/dummy_ups-dummy-ups.Po - -rm -f ./$(DEPDIR)/etapro.Po - -rm -f ./$(DEPDIR)/ever-hid.Po - -rm -f ./$(DEPDIR)/everups.Po - -rm -f ./$(DEPDIR)/explore-hid.Po - -rm -f ./$(DEPDIR)/gamatronic.Po - -rm -f ./$(DEPDIR)/generic_modbus.Po - -rm -f ./$(DEPDIR)/genericups.Po - -rm -f ./$(DEPDIR)/hidparser.Po - -rm -f ./$(DEPDIR)/huawei-ups2000.Po - -rm -f ./$(DEPDIR)/idowell-hid.Po - -rm -f ./$(DEPDIR)/isbmex.Po - -rm -f ./$(DEPDIR)/ivtscd.Po - -rm -f ./$(DEPDIR)/legrand-hid.Po - -rm -f ./$(DEPDIR)/libhid.Po - -rm -f ./$(DEPDIR)/libusb0.Po - -rm -f ./$(DEPDIR)/libusb1.Po - -rm -f ./$(DEPDIR)/liebert-esp2.Po - -rm -f ./$(DEPDIR)/liebert-hid.Po - -rm -f ./$(DEPDIR)/liebert.Po - -rm -f ./$(DEPDIR)/macosx-ups.Po - -rm -f ./$(DEPDIR)/main.Plo - -rm -f ./$(DEPDIR)/masterguard.Po - -rm -f ./$(DEPDIR)/metasys.Po - -rm -f ./$(DEPDIR)/mge-hid.Po - -rm -f ./$(DEPDIR)/mge-utalk.Po - -rm -f ./$(DEPDIR)/mge-xml.Po - -rm -f ./$(DEPDIR)/mge_shut-hidparser.Po - -rm -f ./$(DEPDIR)/mge_shut-libhid.Po - -rm -f ./$(DEPDIR)/mge_shut-libshut.Po - -rm -f ./$(DEPDIR)/mge_shut-mge-hid.Po - -rm -f ./$(DEPDIR)/mge_shut-usbhid-ups.Po - -rm -f ./$(DEPDIR)/microdowell.Po - -rm -f ./$(DEPDIR)/microsol-apc.Po - -rm -f ./$(DEPDIR)/microsol-common.Po - -rm -f ./$(DEPDIR)/netxml-ups.Po - -rm -f ./$(DEPDIR)/nut-ipmipsu.Po - -rm -f ./$(DEPDIR)/nut-libfreeipmi.Po - -rm -f ./$(DEPDIR)/nutdrv_atcl_usb.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-libusb0.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-libusb1.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_ablerex.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_bestups.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_blazer-common.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_hunnox.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_masterguard.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mecer.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec-old.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_megatec.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_mustek.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_q1.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs-hex.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic-qs.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_voltronic.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-nutdrv_qx_zinto.Po - -rm -f ./$(DEPDIR)/nutdrv_qx-usb-common.Po - -rm -f ./$(DEPDIR)/nutdrv_siemens_sitop.Po - -rm -f ./$(DEPDIR)/oneac.Po - -rm -f ./$(DEPDIR)/openups-hid.Po - -rm -f ./$(DEPDIR)/optiups.Po - -rm -f ./$(DEPDIR)/phoenixcontact_modbus.Po - -rm -f ./$(DEPDIR)/pijuice.Po - -rm -f ./$(DEPDIR)/powercom-hid.Po - -rm -f ./$(DEPDIR)/powercom.Po - -rm -f ./$(DEPDIR)/powerman-pdu.Po - -rm -f ./$(DEPDIR)/powerp-bin.Po - -rm -f ./$(DEPDIR)/powerp-txt.Po - -rm -f ./$(DEPDIR)/powerpanel.Po - -rm -f ./$(DEPDIR)/powervar-hid.Po - -rm -f ./$(DEPDIR)/rhino.Po - -rm -f ./$(DEPDIR)/richcomm_usb.Po - -rm -f ./$(DEPDIR)/riello.Po - -rm -f ./$(DEPDIR)/riello_ser.Po - -rm -f ./$(DEPDIR)/riello_usb.Po - -rm -f ./$(DEPDIR)/safenet.Po - -rm -f ./$(DEPDIR)/salicru-hid.Po - -rm -f ./$(DEPDIR)/serial.Plo - -rm -f ./$(DEPDIR)/skel.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-ats-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-apc-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-baytech-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-bestpower-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-compaq-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-cyberpower-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-delta_ups-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats16-nm2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats16-nmc-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-ats30-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-genesis2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-helpers.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-marlin-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-pulizzi-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-eaton-pdu-revelation-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-emerson-avocent-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-hpe-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-huawei-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-ietf-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-mge-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-netvision-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-powerware-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-raritan-pdu-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-raritan-px2-mib.Po - -rm -f ./$(DEPDIR)/snmp_ups-snmp-ups-helpers.Po - -rm -f ./$(DEPDIR)/snmp_ups-snmp-ups.Po - -rm -f ./$(DEPDIR)/snmp_ups-xppc-mib.Po - -rm -f ./$(DEPDIR)/socomec_jbus.Po - -rm -f ./$(DEPDIR)/solis.Po - -rm -f ./$(DEPDIR)/tripplite-hid.Po - -rm -f ./$(DEPDIR)/tripplite.Po - -rm -f ./$(DEPDIR)/tripplite_usb.Po - -rm -f ./$(DEPDIR)/tripplitesu.Po - -rm -f ./$(DEPDIR)/upscode2.Po - -rm -f ./$(DEPDIR)/upsdrvctl.Po - -rm -f ./$(DEPDIR)/usb-common.Po - -rm -f ./$(DEPDIR)/usbhid-ups.Po - -rm -f ./$(DEPDIR)/victronups.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -3065,41 +1977,26 @@ ps: ps-am ps-am: -uninstall-am: uninstall-driverexecPROGRAMS uninstall-sbinPROGRAMS +uninstall-am: uninstall-driverexecPROGRAMS uninstall-halexecPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-driverexecPROGRAMS clean-generic clean-libtool \ - clean-sbinPROGRAMS cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-driverexecPROGRAMS install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-driverexecPROGRAMS clean-generic clean-halexecPROGRAMS \ + clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-driverexecPROGRAMS \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-halexecPROGRAMS install-html install-html-am \ install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-driverexecPROGRAMS uninstall-sbinPROGRAMS + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-driverexecPROGRAMS \ + uninstall-halexecPROGRAMS -.PRECIOUS: Makefile - - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libparseconf.la \ -$(top_builddir)/clients/libupsclient.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dummy: - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/drivers/adelsystem_cbi.c b/drivers/adelsystem_cbi.c deleted file mode 100644 index cda2696..0000000 --- a/drivers/adelsystem_cbi.c +++ /dev/null @@ -1,1344 +0,0 @@ -/* adelsystem_cbi.c - driver for ADELSYSTEM CB/CBI DC-UPS - * - * Copyright (C) - * 2022 Dimitris Economou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* - * code indentation with tabstop=4 - */ - -#include "main.h" -#include "adelsystem_cbi.h" -#include -#include - -#define DRIVER_NAME "NUT ADELSYSTEM DC-UPS CB/CBI driver" -#define DRIVER_VERSION "0.01" - -/* variables */ -static modbus_t *mbctx = NULL; /* modbus memory context */ -static devstate_t *dstate = NULL; /* device state context */ -static int errcnt = 0; /* modbus access error counter */ -static char *device_mfr = DEVICE_MFR; /* device manufacturer */ -static char *device_model = DEVICE_MODEL; /* device model */ -static char *device_type = DEVICE_TYPE; /* device model */ -static int ser_baud_rate = BAUD_RATE; /* serial port baud rate */ -static char ser_parity = PARITY; /* serial port parity */ -static int ser_data_bit = DATA_BIT; /* serial port data bit */ -static int ser_stop_bit = STOP_BIT; /* serial port stop bit */ -static int dev_slave_id = MODBUS_SLAVE_ID; /* set device ID to default value */ -static uint32_t mod_resp_to_s = MODRESP_TIMEOUT_s; /* set the modbus response time out (s) */ -static uint32_t mod_resp_to_us = MODRESP_TIMEOUT_us; /* set the modbus response time out (us) */ -static uint32_t mod_byte_to_s = MODBYTE_TIMEOUT_s; /* set the modbus byte time out (us) */ -static uint32_t mod_byte_to_us = MODBYTE_TIMEOUT_us; /* set the modbus byte time out (us) */ - - -/* initialize alarm structs */ -void alrminit(void); - -/* initialize register start address and hex address from register number */ -void reginit(void); - -/* read registers' memory region */ -int read_all_regs(modbus_t *mb, uint16_t *data); - -/* get config vars set by -x or defined in ups.conf driver section */ -void get_config_vars(void); - -/* get device state */ -int get_dev_state(devreg_t regindx, devstate_t **dvstat); - -/* create a new modbus context based on connection type (serial or TCP) */ -modbus_t *modbus_new(const char *port); - -/* reconnect upon communication error */ -void modbus_reconnect(void); - -/* modbus register read function */ -int register_read(modbus_t *mb, int addr, regtype_t type, void *data); - -/* modbus register write function */ -int register_write(modbus_t *mb, int addr, regtype_t type, void *data); - -/* instant command triggered by upsd */ -int upscmd(const char *cmd, const char *arg); - -/* count the time elapsed since start */ -long time_elapsed(struct timeval *start); - - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Dimitris Economou \n", - DRV_BETA, - {NULL} -}; - -/* - * driver functions - */ - -/* read configuration variables from ups.conf and connect to ups device */ -void upsdrv_initups(void) -{ - int rval; - upsdebugx(2, "upsdrv_initups"); - - dstate = (devstate_t *)xmalloc(sizeof(devstate_t)); - alrminit(); - reginit(); - get_config_vars(); - - /* open communication port */ - mbctx = modbus_new(device_path); - if (mbctx == NULL) { - fatalx(EXIT_FAILURE, "modbus_new_rtu: Unable to open communication port context"); - } - - /* set slave ID */ - rval = modbus_set_slave(mbctx, dev_slave_id); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_slave: Invalid modbus slave ID %d", dev_slave_id); - } - - /* connect to modbus device */ - if (modbus_connect(mbctx) == -1) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: error(%s)", modbus_strerror(errno)); - } - - /* set modbus response timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_response_timeout(mbctx, mod_resp_to_s, mod_resp_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_response_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { - /* Older libmodbus API (with timeval), and we have - * checked at configure time that we can put uint32_t - * into its fields. They are probably "long" on many - * systems as respectively time_t and suseconds_t - - * but that is not guaranteed; for more details see - * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html - */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_resp_to_s; - to.tv_usec = mod_resp_to_us; - /* void */ modbus_set_response_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#else -# error "Can not use libmodbus API for timeouts" -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ - - /* set modbus byte time out */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_byte_timeout(mbctx, mod_byte_to_s, mod_byte_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_byte_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_byte_to_s; - to.tv_usec = mod_byte_to_us; - /* void */ modbus_set_byte_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ - -} - -/* initialize ups driver information */ -void upsdrv_initinfo(void) -{ - devstate_t *ds = dstate; /* device state context */ - upsdebugx(2, "upsdrv_initinfo"); - - /* set device information */ - dstate_setinfo("device.mfr", "%s", device_mfr); - dstate_setinfo("device.model", "%s", device_model); - dstate_setinfo("device.type", "%s", device_type); - - /* read ups model */ - get_dev_state(PRDN, &ds); - dstate_setinfo("ups.model", "%s", ds->product.name); - upslogx(LOG_INFO, "ups.model = %s", ds->product.name); - - /* register instant commands */ - dstate_addcmd("load.off"); - - /* set callback for instant commands */ - upsh.instcmd = upscmd; -} - - -/* update UPS signal state */ -void upsdrv_updateinfo(void) -{ - int rval; /* return value */ - int i; /* local index */ - devstate_t *ds = dstate; /* device state */ - - upsdebugx(2, "upsdrv_updateinfo"); - - errcnt = 0; /* initialize error counter to zero */ - status_init(); /* initialize ups.status update */ - alarm_init(); /* initialize ups.alarm update */ -#if READALL_REGS == 1 - rval = read_all_regs(mbctx, regs_data); - if (rval == -1) { - errcnt++; - } else { -#endif - /* - * update UPS status regarding MAINS and SHUTDOWN request - * - OL: On line (mains is present) - * - OB: On battery (mains is not present) - */ - rval = get_dev_state(MAIN, &ds); - if (rval == -1) { - errcnt++; - } else { - if (ds->alrm->alrm[MAINS_AVAIL_I].actv) { - status_set("OB"); - alarm_set(mains->alrm[MAINS_AVAIL_I].descr); - upslogx(LOG_INFO, "ups.status = OB"); - } else { - status_set("OL"); - upslogx(LOG_INFO, "ups.status = OL"); - } - if (ds->alrm->alrm[SHUTD_REQST_I].actv) { - status_set("FSD"); - alarm_set(mains->alrm[SHUTD_REQST_I].descr); - upslogx(LOG_INFO, "ups.status = FSD"); - } - } - - /* - * update UPS status regarding battery voltage - */ - rval = get_dev_state(BVAL, &ds); - if (rval == -1) { - errcnt++; - } else { - if (ds->alrm->alrm[BVAL_LOALRM_I].actv) { - status_set("LB"); - alarm_set(bval->alrm[BVAL_LOALRM_I].descr); - upslogx(LOG_INFO, "ups.status = LB"); - } - if (ds->alrm->alrm[BVAL_HIALRM_I].actv) { - status_set("HB"); - alarm_set(bval->alrm[BVAL_HIALRM_I].descr); - upslogx(LOG_INFO, "ups.status = HB"); - } - if (ds->alrm->alrm[BVAL_BSTSFL_I].actv) { - alarm_set(bval->alrm[BVAL_BSTSFL_I].descr); - upslogx(LOG_INFO, "battery start with battery flat"); - } - } - - /* get "battery.voltage" */ - rval = get_dev_state(BATV, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("battery.voltage", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "battery.voltage = %s", ds->reg.strval); - } - /* - * update UPS status regarding battery charger status - */ - - /* get "battery.charger.status" */ - rval = get_dev_state(CHRG, &ds); - if (rval == -1) { - errcnt++; - } else { - if (ds->charge.state == CHRG_BULK || ds->charge.state == CHRG_ABSR) { - status_set("CHRG"); - upslogx(LOG_INFO, "ups.status = CHRG"); - } - dstate_setinfo("battery.charger.status", "%s", ds->charge.info); - upslogx(LOG_DEBUG, "battery.charger.status = %s", ds->charge.info); - } - rval = get_dev_state(PMNG, &ds); - if (rval == -1) { - errcnt++; - } else { - if (ds->power.state == PMNG_BCKUP) { - status_set("DISCHRG"); - dstate_setinfo("battery.charger.status", "discharging"); - upslogx(LOG_INFO, "ups.status = DISCHRG"); - } - if (ds->power.state == PMNG_BOOST) { - status_set("BOOST"); - upslogx(LOG_INFO, "ups.status = BOOST"); - } - } - - /* - * update UPS battery state of charge - */ - rval = get_dev_state(BSOC, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("battery.charge", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "battery.charge = %s", ds->reg.strval); - } - - /* - * update UPS AC input state - */ - rval = get_dev_state(VACA, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s is active", ds->alrm->alrm[i].descr); - } - } - } - rval = get_dev_state(VAC, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("input.voltage", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "input.voltage = %s", ds->reg.strval); - } - - /* - * update UPS onboard temperature state - */ - rval = get_dev_state(OBTA, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s is active", ds->alrm->alrm[i].descr); - } - } - } - rval = get_dev_state(OTMP, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("ups.temperature", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "ups.temperature = %s", ds->reg.strval); - } - /* - * update UPS battery temperature state - */ - rval = get_dev_state(BSTA, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s alarm is active", ds->alrm->alrm[i].descr); - } - } - } - rval = get_dev_state(BTMP, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("battery.temperature", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "battery.temperature = %s", ds->reg.strval); - } - rval = get_dev_state(TBUF, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("battery.runtime", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "battery.runtime = %s", ds->reg.strval); - } - - /* - * update UPS device failure state - */ - rval = get_dev_state(DEVF, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s alarm is active", ds->alrm->alrm[i].descr); - } - } - } - - /* - * update UPS SoH and SoC states - */ - rval = get_dev_state(SCSH, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s alarm is active", ds->alrm->alrm[i].descr); - } - } - } - - /* - * update UPS battery state - */ - rval = get_dev_state(BSTA, &ds); - if (rval == -1) { - errcnt++; - } else { - for (i = 0; i < ds->alrm->alrm_c; i++) { - if (ds->alrm->alrm[i].actv) { - alarm_set(ds->alrm->alrm[i].descr); - upsdebugx(3, "%s alarm is active", ds->alrm->alrm[i].descr); - } - } - } - - /* - * update UPS load status - */ - rval = get_dev_state(LVDC, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("output.voltage", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "output.voltage = %s", ds->reg.strval); - } - rval = get_dev_state(LCUR, &ds); - if (rval == -1) { - errcnt++; - } else { - dstate_setinfo("output.current", "%s", ds->reg.strval); - upslogx(LOG_DEBUG, "output.current = %s", ds->reg.strval); - } -#if READALL_REGS == 1 - } -#endif - /* check for communication errors */ - if (errcnt == 0) { - alarm_commit(); - status_commit(); - dstate_dataok(); - } else { - upsdebugx(2, "Communication errors: %d", errcnt); - dstate_datastale(); - } -} - -/* shutdown UPS */ -void upsdrv_shutdown(void) -{ - int rval; - int cnt = FSD_REPEAT_CNT; /* shutdown repeat counter */ - struct timeval start; - long etime; - - /* retry sending shutdown command on error */ - while ((rval = upscmd("load.off", NULL)) != STAT_INSTCMD_HANDLED && cnt > 0) { - rval = gettimeofday(&start, NULL); - if (rval < 0) { - upslogx(LOG_ERR, "upscmd: gettimeofday: %s", strerror(errno)); - } - - /* wait for an increasing time interval before sending shutdown command */ - while ((etime = time_elapsed(&start)) < ( FSD_REPEAT_INTRV / cnt)); - upsdebugx(2, "ERROR: load.off failed, wait for %lims, retries left: %d\n", etime, cnt - 1); - cnt--; - } - switch (rval) { - case STAT_INSTCMD_FAILED: - case STAT_INSTCMD_INVALID: - fatalx(EXIT_FAILURE, "shutdown failed"); - case STAT_INSTCMD_UNKNOWN: - fatalx(EXIT_FAILURE, "shutdown not supported"); - default: - break; - } - upslogx(LOG_INFO, "shutdown command executed"); -} - -/* print driver usage info */ -void upsdrv_help(void) -{ -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "ser_baud_rate", "serial port baud rate"); - addvar(VAR_VALUE, "ser_parity", "serial port parity"); - addvar(VAR_VALUE, "ser_data_bit", "serial port data bit"); - addvar(VAR_VALUE, "ser_stop_bit", "serial port stop bit"); - addvar(VAR_VALUE, "dev_slave_id", "device modbus slave ID"); - addvar(VAR_VALUE, "mod_resp_to_s", "modbus response timeout (s)"); - addvar(VAR_VALUE, "mod_resp_to_us", "modbus response timeout (us)"); - addvar(VAR_VALUE, "mod_byte_to_s", "modbus byte timeout (s)"); - addvar(VAR_VALUE, "mod_byte_to_us", "modbus byte timeout (us)"); -} - -/* close modbus connection and free modbus context allocated memory */ -void upsdrv_cleanup(void) -{ - if (mbctx != NULL) { - modbus_close(mbctx); - modbus_free(mbctx); - } - if (dstate != NULL) { - free(dstate); - } -} - -/* - * driver support functions - */ - -/* initialize alarm structs */ -void alrminit(void) -{ - mains = alloc_alrm_ar(mains_c, sizeof(mains_ar)); - alrm_ar_init(mains, mains_ar, mains_c); - vaca = alloc_alrm_ar(vaca_c, sizeof(vaca_ar)); - alrm_ar_init(vaca, vaca_ar, vaca_c); - devf = alloc_alrm_ar(devf_c, sizeof(devf_ar)); - alrm_ar_init(devf, devf_ar, devf_c); - btsf = alloc_alrm_ar(btsf_c, sizeof(btsf_ar)); - alrm_ar_init(btsf, btsf_ar, btsf_c); - bval = alloc_alrm_ar(bval_c, sizeof(bval_ar)); - alrm_ar_init(bval, bval_ar, bval_c); - shsc = alloc_alrm_ar(shsc_c, sizeof(shsc_ar)); - alrm_ar_init(shsc, shsc_ar, shsc_c); - bsta = alloc_alrm_ar(bsta_c, sizeof(bsta_ar)); - alrm_ar_init(bsta, bsta_ar, bsta_c); - obta = alloc_alrm_ar(obta_c, sizeof(obta_ar)); - alrm_ar_init(obta, obta_ar, obta_c); -} - -/* initialize register start address and hex address from register number */ -void reginit(void) -{ - int i; /* local index */ - - for (i = 0; i < MODBUS_NUMOF_REGS; i++) { - int rnum = regs[i].num; - switch (regs[i].type) { - case COIL: - regs[i].saddr = rnum - 1; - regs[i].xaddr = 0x0 + regs[i].num - 1; - break; - case INPUT_B: - rnum -= 10000; - regs[i].saddr = rnum - 1; - regs[i].xaddr = 0x10000 + rnum - 1; - break; - case INPUT_R: - rnum -= 30000; - regs[i].saddr = rnum - 1; - regs[i].xaddr = 0x30000 + rnum - 1; - break; - case HOLDING: - rnum -= 40000; - regs[i].saddr = rnum - 1; - regs[i].xaddr = 0x40000 + rnum - 1; - break; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: - upslogx(LOG_ERR, - "Invalid register type %d for register %d", - regs[i].type, - regs[i].num - ); - upsdebugx(3, - "Invalid register type %d for register %d", - regs[i].type, - regs[i].num - ); -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } - upsdebugx(3, - "reginit: num:%d, type: %d saddr: %d, xaddr: 0x%x", - regs[i].num, - regs[i].type, - regs[i].saddr, - regs[i].xaddr - ); - } -} - -/* read registers' memory region */ -int read_all_regs(modbus_t *mb, uint16_t *data) -{ - int rval; - - /* read all HOLDING registers */ - rval = modbus_read_registers(mb, regs[H_REG_STARTIDX].xaddr, MAX_H_REGS, data); - if (rval == -1) { - upslogx(LOG_ERR, - "ERROR:(%s) modbus_read: addr:0x%x, length:%8d, path:%s\n", - modbus_strerror(errno), - regs[H_REG_STARTIDX].xaddr, - MAX_H_REGS, - device_path - ); - - /* on BROKEN PIPE, INVALID CRC and INVALID DATA error try to reconnect */ - if (errno == EPIPE || errno == EMBBADDATA || errno == EMBBADCRC) { - upsdebugx(1, "register_read: error(%s)", modbus_strerror(errno)); - modbus_reconnect(); - } - } - - /* no COIL, INPUT_B or INPUT_R register regions to read */ - - return rval; -} - -/* Read a modbus register */ -int register_read(modbus_t *mb, int addr, regtype_t type, void *data) -{ - int rval = -1; - - /* register bit masks */ - uint mask8 = 0x00FF; - uint mask16 = 0xFFFF; - - switch (type) { - case COIL: - rval = modbus_read_bits(mb, addr, 1, (uint8_t *)data); - *(uint *)data = *(uint *)data & mask8; - break; - case INPUT_B: - rval = modbus_read_input_bits(mb, addr, 1, (uint8_t *)data); - *(uint *)data = *(uint *)data & mask8; - break; - case INPUT_R: - rval = modbus_read_input_registers(mb, addr, 1, (uint16_t *)data); - *(uint *)data = *(uint *)data & mask16; - break; - case HOLDING: - rval = modbus_read_registers(mb, addr, 1, (uint16_t *)data); - *(uint *)data = *(uint *)data & mask16; - break; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: - upsdebugx(2,"ERROR: register_read: invalid register type %d\n", type); - break; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } - if (rval == -1) { - upslogx(LOG_ERR, - "ERROR:(%s) modbus_read: addr:0x%x, type:%8s, path:%s\n", - modbus_strerror(errno), - addr, - (type == COIL) ? "COIL" : - (type == INPUT_B) ? "INPUT_B" : - (type == INPUT_R) ? "INPUT_R" : "HOLDING", - device_path - ); - - /* on BROKEN PIPE, INVALID CRC and INVALID DATA error try to reconnect */ - if (errno == EPIPE || errno == EMBBADDATA || errno == EMBBADCRC) { - upsdebugx(1, "register_read: error(%s)", modbus_strerror(errno)); - modbus_reconnect(); - } - } - upsdebugx(3, "register addr: 0x%x, register type: %d read: %d",addr, type, *(uint *)data); - return rval; -} - -/* write a modbus register */ -int register_write(modbus_t *mb, int addr, regtype_t type, void *data) -{ - int rval = -1; - - /* register bit masks */ - uint mask8 = 0x00FF; - uint mask16 = 0xFFFF; - - switch (type) { - case COIL: - *(uint *)data = *(uint *)data & mask8; - rval = modbus_write_bit(mb, addr, *(uint8_t *)data); - break; - case HOLDING: - *(uint *)data = *(uint *)data & mask16; - rval = modbus_write_register(mb, addr, *(uint16_t *)data); - break; - - case INPUT_B: - case INPUT_R: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - upsdebugx(2,"ERROR: register_write: invalid register type %d\n", type); - break; - } - if (rval == -1) { - upslogx(LOG_ERR, - "ERROR:(%s) modbus_write: addr:0x%x, type:%8s, path:%s\n", - modbus_strerror(errno), - addr, - (type == COIL) ? "COIL" : - (type == INPUT_B) ? "INPUT_B" : - (type == INPUT_R) ? "INPUT_R" : "HOLDING", - device_path - ); - - /* on BROKEN PIPE error try to reconnect */ - if (errno == EPIPE) { - upsdebugx(1, "register_write: error(%s)", modbus_strerror(errno)); - modbus_reconnect(); - } - } - upsdebugx(3, "register addr: 0x%x, register type: %d read: %d",addr, type, *(uint *)data); - return rval; -} - -/* returns the time elapsed since start in milliseconds */ -long time_elapsed(struct timeval *start) -{ - long rval; - struct timeval end; - - rval = gettimeofday(&end, NULL); - if (rval < 0) { - upslogx(LOG_ERR, "time_elapsed: %s", strerror(errno)); - } - if (start->tv_usec < end.tv_usec) { - suseconds_t nsec = (end.tv_usec - start->tv_usec) / 1000000 + 1; - end.tv_usec -= 1000000 * nsec; - end.tv_sec += nsec; - } - if (start->tv_usec - end.tv_usec > 1000000) { - suseconds_t nsec = (start->tv_usec - end.tv_usec) / 1000000; - end.tv_usec += 1000000 * nsec; - end.tv_sec -= nsec; - } - rval = (end.tv_sec - start->tv_sec) * 1000 + (end.tv_usec - start->tv_usec) / 1000; - - return rval; -} - -/* instant command triggered by upsd */ -int upscmd(const char *cmd, const char *arg) -{ - int rval; - int data; - - if (!strcasecmp(cmd, "load.off")) { - data = 1; - rval = register_write(mbctx, regs[FSD].xaddr, regs[FSD].type, &data); - if (rval == -1) { - upslogx(2, - "ERROR:(%s) modbus_write_register: addr:0x%08x, regtype: %d, path:%s\n", - modbus_strerror(errno), - regs[FSD].xaddr, - regs[FSD].type, - device_path - ); - upslogx(LOG_NOTICE, "load.off: failed (communication error) [%s] [%s]", cmd, arg); - rval = STAT_INSTCMD_FAILED; - } else { - upsdebugx(2, "load.off: addr: 0x%x, data: %d", regs[FSD].xaddr, data); - rval = STAT_INSTCMD_HANDLED; - } - } else { - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmd, arg); - rval = STAT_INSTCMD_UNKNOWN; - } - return rval; -} - -/* read device state, returns 0 on success or -1 on communication error - it formats state depending on register semantics */ -int get_dev_state(devreg_t regindx, devstate_t **dvstat) -{ - int i; /* local index */ - int n; - int rval; /* return value */ - static char *ptr = NULL; /* temporary pointer */ - uint reg_val; /* register value */ -#if READALL_REGS == 0 - uint num; /* register number */ - regtype_t rtype; /* register type */ - int addr; /* register address */ -#endif - devstate_t *state; /* device state */ - - state = *dvstat; -#if READALL_REGS == 1 - reg_val = regs_data[regindx]; - rval = 0; -#elif READALL_REGS == 0 - num = regs[regindx].num; - addr = regs[regindx].xaddr; - rtype = regs[regindx].type; - rval = register_read(mbctx, addr, rtype, ®_val); - if (rval == -1) { - return rval; - } - upsdebugx(3, - "get_dev_state: num: %d, addr: 0x%x, regtype: %d, data: %d", - num, - addr, - rtype, - reg_val - ); -#endif - /* process register data */ - switch (regindx) { - case CHRG: /* "ups.charge" */ - if (reg_val == CHRG_NONE) { - state->charge.state = CHRG_NONE; - state->charge.info = chrgs_i[CHRG_NONE]; - } else if (reg_val == CHRG_RECV) { - state->charge.state = CHRG_RECV; - state->charge.info = chrgs_i[CHRG_RECV]; - } else if (reg_val == CHRG_BULK) { - state->charge.state = CHRG_BULK; - state->charge.info = chrgs_i[CHRG_BULK]; - } else if (reg_val == CHRG_ABSR) { - state->charge.state = CHRG_ABSR; - state->charge.info = chrgs_i[CHRG_ABSR]; - } else if (reg_val == CHRG_FLOAT) { - state->charge.state = CHRG_FLOAT; - state->charge.info = chrgs_i[CHRG_FLOAT]; - } - upsdebugx(3, "get_dev_state: charge.state: %s", state->charge.info); - break; - case BATV: /* "battery.voltage" */ - case LVDC: /* "output.voltage" */ - case LCUR: /* "output.current" */ - if (reg_val != 0) { - state->reg.val.ui16 = reg_val; - double fval = reg_val / 1000.00; /* convert mV to V, mA to A */ - n = snprintf(NULL, 0, "%.2f", fval); - if (ptr != NULL) { - free(ptr); - } - char *fval_s = (char *)xmalloc(sizeof(char) * (n + 1)); - ptr = fval_s; - sprintf(fval_s, "%.2f", fval); - state->reg.strval = fval_s; - } else { - state->reg.val.ui16 = 0; - state->reg.strval = "0.00"; - } - upsdebugx(3, "get_dev_state: variable: %s", state->reg.strval); - break; - case TBUF: - case BSOH: - case BCEF: - case VAC: /* "input.voltage" */ - if (reg_val != 0) { - state->reg.val.ui16 = reg_val; - n = snprintf(NULL, 0, "%d", reg_val); - if (ptr != NULL) { - free(ptr); - } - char *reg_val_s = (char *)xmalloc(sizeof(char) * (n + 1)); - ptr = reg_val_s; - sprintf(reg_val_s, "%d", reg_val); - state->reg.strval = reg_val_s; - } else { - state->reg.val.ui16 = 0; - state->reg.strval = "0"; - } - upsdebugx(3, "get_dev_state: variable: %s", state->reg.strval); - break; - case BSOC: /* "battery.charge" */ - if (reg_val != 0) { - state->reg.val.ui16 = reg_val; - double fval = (double )reg_val * regs[BSOC].scale; - n = snprintf(NULL, 0, "%.2f", fval); - if (ptr != NULL) { - free(ptr); - } - char *fval_s = (char *)xmalloc(sizeof(char) * (n + 1)); - ptr = fval_s; - sprintf(fval_s, "%.2f", fval); - state->reg.strval = fval_s; - } else { - state->reg.val.ui16 = 0; - state->reg.strval = "0.00"; - } - upsdebugx(3, "get_dev_state: variable: %s", state->reg.strval); - break; - case BTMP: /* "battery.temperature" */ - case OTMP: /* "ups.temperature" */ - state->reg.val.ui16 = reg_val; - double fval = reg_val - 273.15; - n = snprintf(NULL, 0, "%.2f", fval); - char *fval_s = (char *)xmalloc(sizeof(char) * (n + 1)); - if (ptr != NULL) { - free(ptr); - } - ptr = fval_s; - sprintf(fval_s, "%.2f", fval); - state->reg.strval = fval_s; - upsdebugx(3, "get_dev_state: variable: %s", state->reg.strval); - break; - case PMNG: /* "ups.status" & "battery.charge" */ - if (reg_val == PMNG_BCKUP) { - state->power.state = PMNG_BCKUP; - state->power.info = pwrmng_i[PMNG_BCKUP]; - } else if (reg_val == PMNG_CHRGN) { - state->power.state = PMNG_CHRGN; - state->power.info = pwrmng_i[PMNG_CHRGN]; - } else if (reg_val == PMNG_BOOST) { - state->power.state = PMNG_BOOST; - state->power.info = pwrmng_i[PMNG_BOOST]; - } else if (reg_val == PMNG_NCHRG) { - state->power.state = PMNG_NCHRG; - state->power.info = pwrmng_i[PMNG_NCHRG]; - } - upsdebugx(3, "get_dev_state: power.state: %s", state->reg.strval); - break; - case PRDN: /* "ups.model" */ - for (i = 0; i < DEV_NUMOF_MODELS; i++) { - if (prdnm_i[i].val == reg_val) { - break; - } - } - state->product.val = reg_val; - state->product.name = prdnm_i[i].name; - upsdebugx(3, "get_dev_state: product.name: %s", state->product.name); - break; - case BSTA: - if (reg_val & BSTA_REVPOL_M) { - bsta->alrm[BSTA_REVPOL_I].actv = 1; - } else { - bsta->alrm[BSTA_REVPOL_I].actv = 0; - } - if (reg_val & BSTA_NOCNND_M) { - bsta->alrm[BSTA_NOCNND_I].actv = 1; - } else { - bsta->alrm[BSTA_NOCNND_I].actv = 0; - } - if (reg_val & BSTA_CLSHCR_M) { - bsta->alrm[BSTA_CLSHCR_I].actv = 1; - } else { - bsta->alrm[BSTA_CLSHCR_I].actv = 0; - } - if (reg_val & BSTA_SULPHD_M) { - bsta->alrm[BSTA_SULPHD_I].actv = 1; - } else { - bsta->alrm[BSTA_SULPHD_I].actv = 0; - } - if (reg_val & BSTA_CHEMNS_M) { - bsta->alrm[BSTA_CHEMNS_I].actv = 1; - } else { - bsta->alrm[BSTA_CHEMNS_I].actv = 0; - } - if (reg_val & BSTA_CNNFLT_M) { - bsta->alrm[BSTA_CNNFLT_I].actv = 1; - } else { - bsta->alrm[BSTA_CNNFLT_I].actv = 0; - } - state->alrm = bsta; - break; - case SCSH: - if (reg_val & SHSC_HIRESI_M) { - shsc->alrm[SHSC_HIRESI_I].actv = 1; - } else { - shsc->alrm[SHSC_HIRESI_I].actv = 0; - } - if (reg_val & SHSC_LOCHEF_M) { - shsc->alrm[SHSC_LOCHEF_I].actv = 1; - } else { - shsc->alrm[SHSC_LOCHEF_I].actv = 0; - } - if (reg_val & SHSC_LOEFCP_M) { - shsc->alrm[SHSC_LOEFCP_I].actv = 1; - } else { - shsc->alrm[SHSC_LOEFCP_I].actv = 0; - } - if (reg_val & SHSC_LOWSOC_M) { - shsc->alrm[SHSC_LOWSOC_I].actv = 1; - } else { - shsc->alrm[SHSC_LOWSOC_I].actv = 0; - } - state->alrm = shsc; - break; - case BVAL: - if (reg_val & BVAL_HIALRM_M) { - bval->alrm[BVAL_HIALRM_I].actv = 1; - } else { - bval->alrm[BVAL_HIALRM_I].actv = 0; - } - if (reg_val & BVAL_LOALRM_M) { - bval->alrm[BVAL_LOALRM_I].actv = 1; - } else { - bval->alrm[BVAL_LOALRM_I].actv = 0; - } - if (reg_val & BVAL_BSTSFL_M) { - bval->alrm[BVAL_BSTSFL_I].actv = 1; - } else { - bval->alrm[BVAL_BSTSFL_I].actv = 0; - } - state->alrm = bval; - break; - case BTSF: - if (reg_val & BTSF_FCND_M) { - btsf->alrm[BTSF_FCND_I].actv = 1; - } else { - btsf->alrm[BTSF_FCND_I].actv = 0; - } - if (reg_val & BTSF_NCND_M) { - btsf->alrm[BTSF_NCND_I].actv = 1; - } else { - btsf->alrm[BTSF_NCND_I].actv = 0; - } - state->alrm = btsf; - break; - case DEVF: - if (reg_val & DEVF_RCALRM_M) { - devf->alrm[DEVF_RCALRM_I].actv = 1; - } else { - devf->alrm[DEVF_RCALRM_I].actv = 0; - } - if (reg_val & DEVF_INALRM_M) { - devf->alrm[DEVF_INALRM_I].actv = 1; - } else { - devf->alrm[DEVF_INALRM_I].actv = 0; - } - if (reg_val & DEVF_LFNAVL_M) { - devf->alrm[DEVF_LFNAVL_I].actv = 1; - } else { - devf->alrm[DEVF_LFNAVL_I].actv = 0; - } - state->alrm = devf; - break; - case VACA: - if (reg_val & VACA_HIALRM_M) { - vaca->alrm[VACA_HIALRM_I].actv = 1; - } else { - vaca->alrm[VACA_HIALRM_I].actv = 0; - } - if (reg_val == VACA_LOALRM_M) { - vaca->alrm[VACA_LOALRM_I].actv = 1; - } else { - vaca->alrm[VACA_LOALRM_I].actv = 0; - } - state->alrm = vaca; - break; - case MAIN: - if (reg_val & MAINS_AVAIL_M) { - mains->alrm[MAINS_AVAIL_I].actv = 1; - } else { - mains->alrm[MAINS_AVAIL_I].actv = 0; - } - if (reg_val == SHUTD_REQST_M) { - mains->alrm[SHUTD_REQST_I].actv = 1; - } else { - mains->alrm[SHUTD_REQST_I].actv = 0; - } - state->alrm = mains; - break; - case OBTA: - if (reg_val == OBTA_HIALRM_V) { - obta->alrm[OBTA_HIALRM_I].actv = 1; - } - state->alrm = obta; - break; - case BINH: - case FSD: - break; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: - state->reg.val.ui16 = reg_val; - n = snprintf(NULL, 0, "%d", reg_val); - if (ptr != NULL) { - free(ptr); - } - char *reg_val_s = (char *)xmalloc(sizeof(char) * (n + 1)); - ptr = reg_val_s; - sprintf(reg_val_s, "%d", reg_val); - state->reg.strval = reg_val_s; - break; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } - return rval; -} - -/* get driver configuration parameters */ -void get_config_vars(void) -{ - - /* check if serial baud rate is set and get the value */ - if (testvar("ser_baud_rate")) { - ser_baud_rate = (int)strtol(getval("ser_baud_rate"), NULL, 10); - } - upsdebugx(2, "ser_baud_rate %d", ser_baud_rate); - - /* check if serial parity is set and get the value */ - if (testvar("ser_parity")) { - /* Dereference the char* we get */ - char *sp = getval("ser_parity"); - if (sp) { - /* TODO? Sanity-check the char we get? */ - ser_parity = *sp; - } else { - upsdebugx(2, "Could not determine ser_parity, will keep default"); - } - } - upsdebugx(2, "ser_parity %c", ser_parity); - - /* check if serial data bit is set and get the value */ - if (testvar("ser_data_bit")) { - ser_data_bit = (int)strtol(getval("ser_data_bit"), NULL, 10); - } - upsdebugx(2, "ser_data_bit %d", ser_data_bit); - - /* check if serial stop bit is set and get the value */ - if (testvar("ser_stop_bit")) { - ser_stop_bit = (int)strtol(getval("ser_stop_bit"), NULL, 10); - } - upsdebugx(2, "ser_stop_bit %d", ser_stop_bit); - - /* check if device ID is set and get the value */ - if (testvar("dev_slave_id")) { - dev_slave_id = (int)strtol(getval("dev_slave_id"), NULL, 10); - } - upsdebugx(2, "dev_slave_id %d", dev_slave_id); - - /* check if response time out (s) is set and get the value */ - if (testvar("mod_resp_to_s")) { - mod_resp_to_s = (uint32_t)strtol(getval("mod_resp_to_s"), NULL, 10); - } - upsdebugx(2, "mod_resp_to_s %d", mod_resp_to_s); - - /* check if response time out (us) is set and get the value */ - if (testvar("mod_resp_to_us")) { - mod_resp_to_us = (uint32_t) strtol(getval("mod_resp_to_us"), NULL, 10); - if (mod_resp_to_us > 999999) { - fatalx(EXIT_FAILURE, "get_config_vars: Invalid mod_resp_to_us %d", mod_resp_to_us); - } - } - upsdebugx(2, "mod_resp_to_us %d", mod_resp_to_us); - - /* check if byte time out (s) is set and get the value */ - if (testvar("mod_byte_to_s")) { - mod_byte_to_s = (uint32_t)strtol(getval("mod_byte_to_s"), NULL, 10); - } - upsdebugx(2, "mod_byte_to_s %d", mod_byte_to_s); - - /* check if byte time out (us) is set and get the value */ - if (testvar("mod_byte_to_us")) { - mod_byte_to_us = (uint32_t) strtol(getval("mod_byte_to_us"), NULL, 10); - if (mod_byte_to_us > 999999) { - fatalx(EXIT_FAILURE, "get_config_vars: Invalid mod_byte_to_us %d", mod_byte_to_us); - } - } - upsdebugx(2, "mod_byte_to_us %d", mod_byte_to_us); -} - -/* create a new modbus context based on connection type (serial or TCP) */ -modbus_t *modbus_new(const char *port) -{ - modbus_t *mb; - char *sp; - if (strstr(port, "/dev/tty") != NULL) { - mb = modbus_new_rtu(port, ser_baud_rate, ser_parity, ser_data_bit, ser_stop_bit); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_rtu: Unable to open serial port context\n"); - } - } else if ((sp = strchr(port, ':')) != NULL) { - char *tcp_port = xmalloc(sizeof(sp)); - strcpy(tcp_port, sp + 1); - *sp = '\0'; - mb = modbus_new_tcp(port, (int)strtoul(tcp_port, NULL, 10)); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_tcp: Unable to connect to %s\n", port); - } - free(tcp_port); - } else { - mb = modbus_new_tcp(port, 502); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_tcp: Unable to connect to %s\n", port); - } - } - return mb; -} - -/* reconnect to modbus server upon connection error */ -void modbus_reconnect(void) -{ - int rval; - - upsdebugx(1, "modbus_reconnect, trying to reconnect to modbus server"); - - /* clear current modbus context */ - modbus_close(mbctx); - modbus_free(mbctx); - - /* open communication port */ - mbctx = modbus_new(device_path); - if (mbctx == NULL) { - fatalx(EXIT_FAILURE, "modbus_new_rtu: Unable to open communication port context"); - } - - /* set slave ID */ - rval = modbus_set_slave(mbctx, dev_slave_id); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_slave: Invalid modbus slave ID %d", dev_slave_id); - } - - /* connect to modbus device */ - if (modbus_connect(mbctx) == -1) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: %s", modbus_strerror(errno)); - } - - /* set modbus response timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_response_timeout(mbctx, mod_resp_to_s, mod_resp_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_response_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_resp_to_s; - to.tv_usec = mod_resp_to_us; - /* void */ modbus_set_response_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ - - /* set modbus byte timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_byte_timeout(mbctx, mod_byte_to_s, mod_byte_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_byte_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_byte_to_s; - to.tv_usec = mod_byte_to_us; - /* void */ modbus_set_byte_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ -} - diff --git a/drivers/adelsystem_cbi.h b/drivers/adelsystem_cbi.h deleted file mode 100644 index 023586b..0000000 --- a/drivers/adelsystem_cbi.h +++ /dev/null @@ -1,531 +0,0 @@ -/* adelsystem_cbi.h - Driver for ADELSYSTEM CB/CBI DC-UPS - * - * Copyright (C) - * 2022 Dimitris Economou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* - * code indentation with tabstop=4 - */ - -#ifndef ADELSYSTEM_CBI_H -#define ADELSYSTEM_CBI_H - -#include - -/* UPS device details */ -#define DEVICE_MFR "ADELSYSTEM" -#define DEVICE_TYPE "DC-UPS" -#define DEVICE_MODEL "CBI2801224A" - -/* serial access parameters */ -#define BAUD_RATE 9600 -#define PARITY 'N' -#define DATA_BIT 8 -#define STOP_BIT 1 - -/* - * modbus response and byte timeouts - * us: 1 - 999999 - */ -#define MODRESP_TIMEOUT_s 0 -#define MODRESP_TIMEOUT_us 200000 -#define MODBYTE_TIMEOUT_s 0 -#define MODBYTE_TIMEOUT_us 50000 - -/* modbus access parameters */ -#define MODBUS_SLAVE_ID 5 - -/* number of modbus registers */ -#define MODBUS_NUMOF_REGS 98 - -/* max HOLDING registers */ -#define MAX_H_REGS 120 - -/* start HOLDING register index */ -#define H_REG_STARTIDX 0 - -/* read all regs preprocessor flag */ -#ifndef READALL_REGS -#define READALL_REGS 1 -#endif - -/* number of device models */ -#define DEV_NUMOF_MODELS 10 - -/* shutdown repeat on error */ -#define FSD_REPEAT_CNT 3 - -/* shutdown repeat interval in ms */ -#define FSD_REPEAT_INTRV 1500 - -/* definition of register type */ -enum regtype { - COIL = 0, - INPUT_B, - INPUT_R, - HOLDING -}; -typedef enum regtype regtype_t; - -/* product name info, "device.model" */ -struct prodname { - uint16_t val; - char *name; -}; -typedef struct prodname prodname_t; -static prodname_t prdnm_i[] = { - {1, "CBI1235A"}, - {2, "CBI2420A"}, - {3, "CBI4810A"}, - {4, "CBI2801224"}, - {7, "CBI480W"}, - {8, "CB122410A"}, - {9, "CB480W"}, - {11, "CB12245AJ"}, - {12, "CB1235A"}, - {13, "CB2420A"}, - {14, "CB4810A"} -}; - -/* charging status info, "battery.charger.status" */ -static char *chrgs_i[] = { - "none", - "resting", /* recovering */ - "charging", /* bulk */ - "charging", /* absorb */ - "floating" /* float */ -}; -struct chrgs { - int state; - char *info; -}; -typedef struct chrgs chrgs_t; - -/* power management info, "ups.status", "battery.charger.status" */ -static char *pwrmng_i[] = { - "backup", /* "OB", "discharging" */ - "charging", /* "OL" */ - "boost", - "not charging" -}; -struct pwrmng { - int state; - char *info; -}; -typedef struct pwrmng pwrmng_t; - -/* general modbus register value */ -struct reg { - union val { - uint16_t ui16; - uint8_t ui8; - } val; - char *strval; -}; -typedef struct reg reg_t; - -/* general alarm struct */ -struct alrm { - int actv; /* active flag */ - char *descr; /* description field */ -}; -typedef struct alrm alrm_t; - -/* general alarm array */ -struct alrm_ar { - int alrm_c; /* alarm count */ - alrm_t *alrm; /* alarm array */ -}; -typedef struct alrm_ar alrm_ar_t; - -/* - * BIT MASKS and VALUES - */ - -/* Charging status */ -#define CHRG_NONE 0 -#define CHRG_RECV 1 -#define CHRG_BULK 2 -#define CHRG_ABSR 3 -#define CHRG_FLOAT 4 - -/* power management */ -#define PMNG_BCKUP 0 -#define PMNG_CHRGN 1 -#define PMNG_BOOST 2 -#define PMNG_NCHRG 3 - -/* product name */ -#define PRDN_MAX 14 - -/* Mains alarm masks */ -#define MAINS_AVAIL_M 0x0001 /* 0: available (OL) 1: not available (OB) */ -#define SHUTD_REQST_M 0x0002 /* shutdown requested */ - -/* Mains alarm indices */ -#define MAINS_AVAIL_I 0 /* 0: available (OL) 1: not available (OB) */ -#define SHUTD_REQST_I 1 /* shutdown requested */ - -/* AC input voltage alarm masks */ -#define VACA_HIALRM_M 0x0001 /* high alarm */ -#define VACA_LOALRM_M 0x0002 /* low alarm */ - -/* AC input voltage alarm indices */ -#define VACA_HIALRM_I 0 /* high alarm */ -#define VACA_LOALRM_I 1 /* low alarm */ - -/* Onboard temperature alarm value */ -#define OBTA_HIALRM_V 1 /* high alarm */ - -/* Onboard temperature alarm index */ -#define OBTA_HIALRM_I 0 /* high alarm */ - -/* Device failure alarm masks */ -#define DEVF_RCALRM_M 0x0001 /* rectifier failure */ -#define DEVF_INALRM_M 0x0006 /* internal failure */ -#define DEVF_LFNAVL_M 0x0008 /* lifetest not available */ - -/* Device failure alarm indices */ -#define DEVF_RCALRM_I 0 /* rectifier failure */ -#define DEVF_INALRM_I 1 /* internal failure */ -#define DEVF_LFNAVL_I 2 /* lifetest not available */ - -/* Battery temp sensor failure alarm masks */ -#define BTSF_FCND_M 0x0001 /* connection fault */ -#define BTSF_NCND_M 0x0002 /* not connected */ - -/* Battery temp sensor failure alarm indices */ -#define BTSF_FCND_I 0 /* connection fault */ -#define BTSF_NCND_I 1 /* not connected */ - -/* Battery voltage alarm masks */ -#define BVAL_HIALRM_M 0x0001 /* high voltage */ -#define BVAL_LOALRM_M 0x0002 /* low voltage */ -#define BVAL_BSTSFL_M 0x0004 /* battery start with battery flat */ - -/* Battery voltage alarm indices */ -#define BVAL_HIALRM_I 0 /* high voltage */ -#define BVAL_LOALRM_I 1 /* low voltage */ -#define BVAL_BSTSFL_I 2 /* battery start with battery flat */ - -/* SoH and SoC alarm masks */ -#define SHSC_HIRESI_M 0x0001 /* high internal resistance */ -#define SHSC_LOCHEF_M 0x0002 /* low charge efficiency */ -#define SHSC_LOEFCP_M 0x0004 /* low effective capacity */ -#define SHSC_LOWSOC_M 0x0040 /* low state of charge */ - -/* SoH and SoC alarm indices */ -#define SHSC_HIRESI_I 0 /* high internal resistance */ -#define SHSC_LOCHEF_I 1 /* low charge efficiency */ -#define SHSC_LOEFCP_I 2 /* low effective capacity */ -#define SHSC_LOWSOC_I 3 /* low state of charge */ - -/* Battery status alarm masks */ -#define BSTA_REVPOL_M 0x0001 /* reversed polarity */ -#define BSTA_NOCNND_M 0x0002 /* not connected */ -#define BSTA_CLSHCR_M 0x0004 /* cell short circuit */ -#define BSTA_SULPHD_M 0x0008 /* sulphated */ -#define BSTA_CHEMNS_M 0x0010 /* chemistry not supported */ -#define BSTA_CNNFLT_M 0x0020 /* connection fault */ - -/* Battery status alarm indices */ -#define BSTA_REVPOL_I 0 /* reversed polarity */ -#define BSTA_NOCNND_I 1 /* not connected */ -#define BSTA_CLSHCR_I 2 /* cell short circuit */ -#define BSTA_SULPHD_I 3 /* sulphated */ -#define BSTA_CHEMNS_I 4 /* chemistry not supported */ -#define BSTA_CNNFLT_I 5 /* connection fault */ - -/* Allocate alarm arrays */ -static inline -alrm_ar_t *alloc_alrm_ar(int as, size_t n) -{ - alrm_ar_t *ret = xcalloc(sizeof(alrm_t) + n, 1); - if (ret) { - memcpy(ret, - &(alrm_ar_t const) { - .alrm_c = as - }, - sizeof(alrm_ar_t) - ); - } - return ret; -} - -/* Initialize alarm arrays */ -static inline -void alrm_ar_init(alrm_ar_t *ar_ptr, alrm_t *a_ptr, int as) -{ - ar_ptr->alrm_c = as; - ar_ptr->alrm = a_ptr; -} - -/* input mains and shutdown alarms */ -static alrm_t mains_ar[] = { - {0, "input voltage not available"}, - {0, "ups shutdown requested"} -}; -static int mains_c = 2; -static alrm_ar_t *mains; - -/* AC input voltage alarms */ -static alrm_t vaca_ar[] = { - {0, "input voltage high alarm"}, - {0, "input voltage low alarm"} -}; -static int vaca_c = 2; -static alrm_ar_t *vaca; - -/* device failure alarms */ -static alrm_t devf_ar[] = { - {0, "UPS rectifier failure"}, - {0, "UPS internal failure"}, - {0, "UPS lifetest not available"} -}; -static int devf_c = 3; -static alrm_ar_t *devf; - -/* battery sensor failure alarms */ -static alrm_t btsf_ar[] = { - {0, "battery temp sensor connection fault"}, - {0, "battery temp sensor not connected"} -}; -static int btsf_c = 2; -static alrm_ar_t *btsf; - -/* battery voltage alarms */ -static alrm_t bval_ar[] = { - {0, "battery high voltage"}, - {0, "battery low voltage"}, - {0, "battery start with battery flat"} -}; -static int bval_c = 3; -static alrm_ar_t *bval; - -/* battery SoH and SoC alarms */ -static alrm_t shsc_ar[] = { - {0, "battery high internal resistance"}, - {0, "battery low charge efficiency"}, - {0, "battery low effective capacity"}, - {0, "battery low state of charge"} -}; -static int shsc_c = 4; -static alrm_ar_t *shsc; - -/* battery status alarm */ -static alrm_t bsta_ar[] = { - {0, "battery reversed polarity"}, - {0, "battery not connected"}, - {0, "battery cell short circuit"}, - {0, "battery sulphated"}, - {0, "battery chemistry not supported"}, - {0, "battery connection fault"} -}; -static int bsta_c = 4; -static alrm_ar_t *bsta; - -/* onboard temperature alarm */ -static alrm_t obta_ar[] = { - {0, "onboard temperature high"} -}; -static int obta_c = 4; -static alrm_ar_t *obta; - -/* UPS device reg enum */ -enum devreg { - CHRG = 4, /* Charging status, "battery.charger.status" */ - BATV = 7, /* Battery voltage, "battery.voltage" */ - BCEF = 18, /* Battery charge efficiency factor (CEF) */ - BSOH = 20, /* Battery state-of-health */ - BSOC = 22, /* Battery state-of-charge, "battery.charge" */ - BTMP = 25, /* Battery temperature in Kelvin units, "battery.temperature" */ - PMNG = 5, /* Power management, "ups.status" */ - OTMP = 28, /* Onboard temperature, "ups.temperature" */ - PRDN = 67, /* Product name, "ups.model" */ - VAC = 29, /* AC voltage, "input.voltage" */ - LVDC = 10, /* Load voltage, "output.voltage" */ - LCUR = 19, /* Load current, "output.current" */ - BINH = 87, /* Backup inhibit */ - FSD = 40, /* Force shutdown */ - TBUF = 103, /* Time buffering, "battery.runtime" */ - BSTA = 31, /* Battery status alarms */ - SCSH, /* SoH and SoC alarms */ - BVAL = 34, /* Battery voltage alarm */ - BTSF = 43, /* Battery temp sensor failure */ - DEVF = 42, /* Device failure */ - OBTA = 46, /* On board temp alarm */ - VACA = 44, /* VAC alarms */ - MAIN /* Mains status */ -}; -typedef enum devreg devreg_t; - -/* UPS register attributes */ -struct regattr { - int num; - int saddr; /* register start address */ - int xaddr; /* register hex address */ - float scale; /* scale */ - regtype_t type; /* register type */ -}; -typedef struct regattr regattr_t; - -/* UPS device state info union */ -union devstate { - prodname_t product; /* ups model name */ - chrgs_t charge; /* charging status */ - pwrmng_t power; /* ups status */ - reg_t reg; /* state register*/ - alrm_ar_t *alrm; /* alarm statuses */ -}; - -typedef union devstate devstate_t; - -/* device register memory image */ -static uint16_t regs_data[MAX_H_REGS]; - -/* ADELSYSTEM CBI registers */ -static regattr_t regs[] = { - {40001, 0, 0, 1, HOLDING}, /* Address of slave unit */ - {40002, 0, 0, 1, HOLDING}, /* Baud rate for serial communication */ - {40003, 0, 0, 1, HOLDING}, /* Parity bit for serial communication */ - {40004, 0, 0, 1, HOLDING}, - {40005, 0, 0, 1, HOLDING}, /* Charging status */ - {40006, 0, 0, 1, HOLDING}, /* Power management - * 0:Backup 1:Charging 2:boost 3:Not charging - */ - {40007, 0, 0, 1, HOLDING}, /* Nominal output voltage */ - {40008, 0, 0, 1, HOLDING}, /* Battery voltage */ - {40009, 0, 0, 1, HOLDING}, /* Parameter map version ID */ - {40010, 0, 0, 1, HOLDING}, /* Software ID */ - {40011, 0, 0, 1, HOLDING}, /* Output load voltage */ - {40012, 0, 0, 1, HOLDING}, - {40013, 0, 0, 1, HOLDING}, - {40014, 0, 0, 1, HOLDING}, /* Battery charge current */ - {40015, 0, 0, 1, HOLDING}, - {40016, 0, 0, .1, HOLDING}, /* Battery capacity consumed */ - {40017, 0, 0, 1, HOLDING}, /* Battery discharge current */ - {40018, 0, 0, .1, HOLDING}, /* Effective battery capacity */ - {40019, 0, 0, 1, HOLDING}, /* Battery charge efficiency factor (CEF) */ - {40020, 0, 0, 1, HOLDING}, /* Output load current */ - {40021, 0, 0, 1, HOLDING}, /* Battery state-of-health */ - {40022, 0, 0, 1, HOLDING}, /* Time remaining to 100% discharge */ - {40023, 0, 0, .1, HOLDING}, /* Battery state-of-charge */ - {40024, 0, 0, 1, HOLDING}, /* Battery type currently selected */ - {40025, 0, 0, 1, HOLDING}, - {40026, 0, 0, 1, HOLDING}, /* Battery temperature in Kelvin units */ - {40027, 0, 0, 1, HOLDING}, /* Configuration mode */ - {40028, 0, 0, .1, HOLDING}, /* Battery net internal resistance */ - {40029, 0, 0, 1, HOLDING}, /* On-board temperature */ - {40030, 0, 0, 1, HOLDING}, /* AC input voltage */ - {40031, 0, 0, 1, HOLDING}, - {40032, 0, 0, 1, HOLDING}, /* Battery status alarm */ - {40033, 0, 0, 1, HOLDING}, /* Battery State of Charge and State of Health */ - {40034, 0, 0, 1, HOLDING}, /* Load output off duration after PC shutdown */ - {40035, 0, 0, 1, HOLDING}, /* Battery voltage alarm */ - {40036, 0, 0, 1, HOLDING}, /* Low AC input voltage alarm threshold */ - {40037, 0, 0, 1, HOLDING}, /* High AC input voltage alarm threshold */ - {40038, 0, 0, 1, HOLDING}, /* Load alarm */ - {40039, 0, 0, 1, HOLDING}, /* Device variant */ - {40040, 0, 0, 1, HOLDING}, - {40041, 0, 0, 1, HOLDING}, /* Force shutdown */ - {40042, 0, 0, 1, HOLDING}, - {40043, 0, 0, 1, HOLDING}, /* Device failure */ - {40044, 0, 0, 1, HOLDING}, /* Battery temperature sensor failure */ - {40045, 0, 0, 1, HOLDING}, /* AC input voltage alarm */ - {40046, 0, 0, 1, HOLDING}, /* Mains status */ - {40047, 0, 0, 1, HOLDING}, /* On board temperature alarm */ - {40048, 0, 0, 1, HOLDING}, /* Number of charge cycles completed */ - {40049, 0, 0, 1, HOLDING}, /* Charge cycles not completed */ - {40050, 0, 0, .1, HOLDING}, /* Ah charged */ - {40051, 0, 0, 1, HOLDING}, /* Total run time */ - {40052, 0, 0, 1, HOLDING}, /* Number of low battery voltage events */ - {40053, 0, 0, 1, HOLDING}, /* Number of high battery voltage events */ - {40054, 0, 0, 1, HOLDING}, /* Number of low VAC events at mains input */ - {40055, 0, 0, 1, HOLDING}, /* Number of High VAC events at mains input */ - {40056, 0, 0, 1, HOLDING}, /* Number of over temperature inside events */ - {40057, 0, 0, 1, HOLDING}, /* Number of mains-backup transitions */ - {40058, 0, 0, 1, HOLDING}, /* Number power boost events */ - {40059, 0, 0, 1, HOLDING}, /* Highest battery voltage */ - {40060, 0, 0, 1, HOLDING}, /* Highest output load voltage */ - {40061, 0, 0, .1, HOLDING}, /* Maximum depth of discharge */ - {40062, 0, 0, 1, HOLDING}, /* Lowest battery voltage */ - {40063, 0, 0, 1, HOLDING}, /* Lowest output load voltage */ - {40064, 0, 0, .1, HOLDING}, /* Average depth of discharge */ - {40065, 0, 0, 1, HOLDING}, /* History clear all */ - {40066, 0, 0, 1, HOLDING}, /* Factory settings */ - {40067, 0, 0, 1, HOLDING}, /* Product name */ - {40068, 0, 0, 1, HOLDING}, - {40069, 0, 0, 1, HOLDING}, /* Reset internal battery model */ - {40070, 0, 0, 1, HOLDING}, - {40071, 0, 0, 1, HOLDING}, /* Deep discharge battery prevention */ - {40072, 0, 0, 1, HOLDING}, /* Maximum charge current */ - {40073, 0, 0, 1, HOLDING}, /* Bulk voltage */ - {40074, 0, 0, 1, HOLDING}, /* Max bulk timer */ - {40075, 0, 0, 1, HOLDING}, /* Min bulk timer */ - {40076, 0, 0, 1, HOLDING}, - {40077, 0, 0, 1, HOLDING}, /* Absorption voltage */ - {40078, 0, 0, 1, HOLDING}, /* Max absorption timer */ - {40079, 0, 0, 1, HOLDING}, /* Min absorption timer */ - {40080, 0, 0, 1, HOLDING}, /* Return Amperes to float */ - {40081, 0, 0, 1, HOLDING}, /* Return amps timer */ - {40082, 0, 0, 1, HOLDING}, /* Float voltage */ - {40083, 0, 0, 1, HOLDING}, /* Force boost charge */ - {40084, 0, 0, 1, HOLDING}, /* Return to bulk voltage from float */ - {40085, 0, 0, 1, HOLDING}, /* Return to bulk delay */ - {40086, 0, 0, 1, HOLDING}, - {40087, 0, 0, 1, HOLDING}, /* Switchoff voltage without mains */ - {40088, 0, 0, 1, HOLDING}, /* Backup Inhibit 0 = Backup allowed - * 1 = Backup not allowed - */ - {40089, 0, 0, 1, HOLDING}, /* Number of battery cells */ - {40090, 0, 0, 1, HOLDING}, /* Temperature compensation coefficient */ - {40091, 0, 0, 1, HOLDING}, - {40092, 0, 0, 1, HOLDING}, /* Lifetest enable */ - {40093, 0, 0, 1, HOLDING}, /* Max alarm temp */ - {40094, 0, 0, 1, HOLDING}, /* Min alarm temp */ - {40095, 0, 0, 1, HOLDING}, - {40096, 0, 0, 1, HOLDING}, - {40097, 0, 0, 1, HOLDING}, /* Low battery threshold */ - {40098, 0, 0, 1, HOLDING}, /* SoC/SoH test period */ - {40099, 0, 0, 1, HOLDING}, /* Manual SoC/SoH test request */ - {40100, 0, 0, 1, HOLDING}, /* SoC/SoH test possible */ - {40101, 0, 0, .1, HOLDING}, /* Nominal battery internal resistance */ - {40102, 0, 0, .1, HOLDING}, /* Nominal battery cables resistance */ - {40103, 0, 0, 1, HOLDING}, /* Firmware ID */ - {40104, 0, 0, 1, HOLDING}, /* Time buffering */ - {40105, 0, 0, .1, HOLDING}, /* Battery capacity C20 */ - {40106, 0, 0, .1, HOLDING}, /* Battery Capacity C10 */ - {40107, 0, 0, 1, HOLDING}, /* Device switchoff delay */ - {40108, 0, 0, .1, HOLDING}, /* Battery Capacity C5 */ - {40109, 0, 0, .1, HOLDING}, /* Battery Capacity C2 */ - {40110, 0, 0, 1, HOLDING}, - {40111, 0, 0, 1, HOLDING}, /* PC power supply removal delay */ - {40112, 0, 0, .1, HOLDING}, /* Battery Capacity C1 */ - {40113, 0, 0, .1, HOLDING}, /* Low state-of-charge */ - {40114, 0, 0, 1, HOLDING}, - {40115, 0, 0, 1, HOLDING}, - {40116, 0, 0, 1, HOLDING}, - {40117, 0, 0, 1, HOLDING}, - {40118, 0, 0, 1, HOLDING}, - {40119, 0, 0, 1, HOLDING}, - {40120, 0, 0, 1, HOLDING} /* Zero-SoC reference */ -}; -#endif /* ADELSYSTEM_CBI_H */ - diff --git a/drivers/al175.c b/drivers/al175.c index f014435..4b4b652 100644 --- a/drivers/al175.c +++ b/drivers/al175.c @@ -47,12 +47,13 @@ #include #include + #include "nut_stdint.h" typedef uint8_t byte_t; #define DRIVER_NAME "Eltek AL175/COMLI driver" -#define DRIVER_VERSION "0.13" +#define DRIVER_VERSION "0.11" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -79,7 +80,7 @@ upsdrv_info_t upsdrv_info = { */ typedef struct { byte_t *buf; /*!< the whole buffer address */ - size_t buf_size; /*!< the whole buffer size */ + unsigned buf_size; /*!< the whole buffer size */ byte_t *begin; /*!< begin of content */ byte_t *end; /*!< one-past-end of content */ @@ -114,7 +115,7 @@ typedef struct { * @param size size in bytes * @return xmalloc'ed memory as raw_data */ -static raw_data_t raw_xmalloc(size_t size) +raw_data_t raw_xmalloc(size_t size) { raw_data_t data; @@ -131,7 +132,7 @@ static raw_data_t raw_xmalloc(size_t size) * free raw_data buffer * @param buf raw_data buffer to free */ -static void raw_free(raw_data_t *buf) +void raw_free(raw_data_t *buf) { free(buf->buf); @@ -163,8 +164,8 @@ typedef struct { * @see 1. INTRODUCTION */ typedef struct { - size_t addr; /*!< Addr[5:8] */ - size_t len; /*!< NOB[9:10] */ + unsigned addr; /*!< Addr[5:8] */ + unsigned len; /*!< NOB[9:10] */ } io_head_t; /** @@ -190,7 +191,7 @@ typedef struct { /** * convert hex string to int * @param head input string - * @param len string length + * @param count string length * @return parsed value (>=0) if success, -1 on error */ static long from_hex(const byte_t *head, unsigned len) @@ -232,7 +233,7 @@ static long from_hex(const byte_t *head, unsigned len) static byte_t compute_bcc(const byte_t *buf, size_t count) { byte_t bcc=0; - size_t i; + unsigned i; for (i=0; i> 7 ) | - (byte_t)( (x & 0x40) >> 5 ) | - (byte_t)( (x & 0x20) >> 3 ) | - (byte_t)( (x & 0x10) >> 1 ) | - (byte_t)( (x & 0x08) << 1 ) | - (byte_t)( (x & 0x04) << 3 ) | - (byte_t)( (x & 0x02) << 5 ) | - (byte_t)( (x & 0x01) << 7 ); + x = ( (x & 0x80) >> 7 ) | + ( (x & 0x40) >> 5 ) | + ( (x & 0x20) >> 3 ) | + ( (x & 0x10) >> 1 ) | + ( (x & 0x08) << 1 ) | + ( (x & 0x04) << 3 ) | + ( (x & 0x02) << 5 ) | + ( (x & 0x01) << 7 ); *buf = x; ++buf; @@ -332,7 +333,7 @@ static void comli_prepare(raw_data_t *dest, const comli_head_t *h, const void *b fatalx(EXIT_FAILURE, "too small dest in comli_prepare\n"); out[0] = STX; - snprintf((char *)out+1, 10+1, "%02X%1i%1i%04zX%02zX", h->msg.id, h->msg.stamp, h->msg.type, h->io.addr, h->io.len); + snprintf((char *)out+1, 10+1, "%02X%1i%1i%04X%02X", h->msg.id, h->msg.stamp, h->msg.type, h->io.addr, h->io.len); memcpy(out+11, buf, count); reverse_bits(out+11, count); @@ -354,7 +355,7 @@ static void comli_prepare(raw_data_t *dest, const comli_head_t *h, const void *b * @param addr start address of requested area * @param count no. of requested bytes */ -static void al_prep_read_req(raw_data_t *dest, size_t addr, size_t count) +static void al_prep_read_req(raw_data_t *dest, unsigned addr, size_t count) { comli_head_t h; @@ -392,29 +393,11 @@ static void al_prep_activate(raw_data_t *dest, byte_t cmd, byte_t subcmd, uint16 h.io.len = 8; /* NOTE: doc says we should use ASCII coding here, but the actual - * values are > 0x80, so we use binary coding. And have to - * make this "fit" into the char array required by snprintf */ - data[0] = (char)cmd; - data[1] = (char)subcmd; + * values are > 0x80, so we use binary coding */ + data[0] = cmd; + data[1] = subcmd; - /* FIXME? One CI testcase builder claims here that - * warning: '%2X' directive output may be truncated writing - * between 2 and 4 bytes into a region of size between 3 and 5 - * [-Wformat-truncation=] - * but none others do, and I can't figure out how it thinks so :/ - * - * Per https://stackoverflow.com/questions/51534284/how-to-circumvent-format-truncation-warning-in-gcc - * https://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg521037.html - * and simlar googlable sources, this seems to be a bug-or-feature - * linked to non-zero optimization level and/or not checking for the - * return value (conveys runtime errors if any do happen). - */ - assert (pr1 <= UINT8_MAX); - assert (pr2 <= UINT8_MAX); - assert (pr3 <= UINT8_MAX); - if (0 > snprintf(data+2, 6+1, "%2X%2X%2X", pr1, pr2, pr3)) { - data[8] = '\0'; - } + snprintf(data+2, 6+1, "%2X%2X%2X", pr1, pr2, pr3); comli_prepare(dest, &h, data, 8); } @@ -434,9 +417,6 @@ static int comli_check_frame(/*const*/ raw_data_t f) int bcc; byte_t *tail; - if ( (f.end - f.begin) < 2 ) - return -1; - if (*f.begin!=STX) return -1; @@ -447,7 +427,7 @@ static int comli_check_frame(/*const*/ raw_data_t f) if (tail[0]!=ETX) return -1; - bcc = compute_bcc(f.begin+1, (size_t)(f.end - f.begin) - 2 /*STX & BCC*/); + bcc = compute_bcc(f.begin+1, (f.end - f.begin) - 2/*STX & BCC*/); if (bcc!= tail[1]) return -1; @@ -478,11 +458,11 @@ static int al_parse_reply_head(io_head_t *io, const raw_data_t raw_reply_head) * begin end */ - size_t io_addr, io_len; + unsigned long io_addr, io_len; const byte_t *reply_head = raw_reply_head.begin - 1; if ( (raw_reply_head.end - raw_reply_head.begin) != 10) { - upsdebugx(3, "%s: wrong size\t(%i != 10)", __func__, (int)(raw_reply_head.end - raw_reply_head.begin)); + upsdebugx(3, "%s: wrong size\t(%i != 10)", __func__, (raw_reply_head.end - raw_reply_head.begin)); return -1; /* wrong size */ } @@ -501,24 +481,20 @@ static int al_parse_reply_head(io_head_t *io, const raw_data_t raw_reply_head) return -1; /* wrong type */ } - /* Avoid signed/unsigned implicit conversion warnings - * At least, when shuffling a signed long into unsigned long, - * don't have to worry about overflows */ - io_addr = (size_t)from_hex(&reply_head[5], 4); - if (io_addr == -1UL) { - upsdebugx(3, "%s: invalid addr\t('%c%c%c%c')", __func__, - reply_head[5], reply_head[6], reply_head[7], reply_head[8]); + io_addr = from_hex(&reply_head[5], 4); + if (io_addr==-1UL) { + upsdebugx(3, "%s: invalid addr\t('%c%c%c%c')", __func__, reply_head[5],reply_head[6],reply_head[7],reply_head[8]); return -1; /* wrong addr */ } - io_len = (size_t)from_hex(&reply_head[9], 2); - if (io_len == -1UL) { - upsdebugx(3, "%s: invalid nob\t('%c%c')", __func__, reply_head[9], reply_head[10]); + io_len = from_hex(&reply_head[9], 2); + if (io_len==-1UL) { + upsdebugx(3, "%s: invalid nob\t('%c%c')", __func__, reply_head[9],reply_head[10]); return -1; /* wrong NOB */ } if (io_len > IO_LEN_MAX) { - upsdebugx(3, "nob too big\t(%zu > %i)", io_len, IO_LEN_MAX); + upsdebugx(3, "nob too big\t(%lu > %i)", io_len, IO_LEN_MAX); return -1; /* too much data claimed */ } @@ -554,8 +530,8 @@ static int al_parse_reply(io_head_t *io_head, raw_data_t *io_buf, /*const*/ raw_ */ int err; - size_t i; - const byte_t *reply = NULL; + unsigned i; + const byte_t *reply = raw_reply.begin - 1; /* 1: extract header and parse it */ /*const*/ raw_data_t raw_reply_head = raw_reply; @@ -572,15 +548,15 @@ static int al_parse_reply(io_head_t *io_head, raw_data_t *io_buf, /*const*/ raw_ reply = raw_reply.begin - 1; if ( (raw_reply.end - raw_reply.begin) != (ptrdiff_t)(10 + io_head->len)) { - upsdebugx(3, "%s: corrupt sentence\t(%i != %zi)", - __func__, (int)(raw_reply.end - raw_reply.begin), 10 + io_head->len); + upsdebugx(3, "%s: corrupt sentence\t(%i != %i)", + __func__, raw_reply.end - raw_reply.begin, 10 + io_head->len); return -1; /* corrupt sentence */ } /* extract the data */ if (io_buf->buf_size < io_head->len) { - upsdebugx(3, "%s: too much data to fit in io_buf\t(%zu > %zu)", + upsdebugx(3, "%s: too much data to fit in io_buf\t(%u > %u)", __func__, io_head->len, io_buf->buf_size); return -1; /* too much data to fit in io_buf */ } @@ -591,11 +567,9 @@ static int al_parse_reply(io_head_t *io_head, raw_data_t *io_buf, /*const*/ raw_ for (i=0; ilen; ++i) *(io_buf->end++) = reply[11+i]; - assert(io_buf->end - io_buf->begin >= 0); - size_t io_buf_len = (size_t)(io_buf->end - io_buf->begin); - reverse_bits(io_buf->begin, io_buf_len ); + reverse_bits(io_buf->begin, (io_buf->end - io_buf->begin) ); - upsdebug_hex(3, "\t\t--> payload", io_buf->begin, io_buf_len); + upsdebug_hex(3, "\t\t--> payload", io_buf->begin, (io_buf->end - io_buf->begin)); return 0; /* all ok */ } @@ -623,7 +597,7 @@ static int al_check_ack(/*const*/ raw_data_t raw_ack) const byte_t *ack = raw_ack.begin - 1; if ( (raw_ack.end - raw_ack.begin) !=5) { - upsdebugx(3, "%s: wrong size\t(%i != 5)", __func__, (int)(raw_ack.end - raw_ack.begin)); + upsdebugx(3, "%s: wrong size\t(%i != 5)", __func__, raw_ack.end - raw_ack.begin); return -1; /* wrong size */ } @@ -674,11 +648,7 @@ static void ser_disable_flow_control (void) tcgetattr (upsfd, &tio); - /* Clumsy rewrite of a one-liner - * tio.c_iflag &= ~ (IXON | IXOFF); - * to avoid type conversion warnings */ - tcflag_t x = (IXON | IXOFF); - tio.c_iflag &= ~ x; + tio.c_iflag &= ~ (IXON | IXOFF); tio.c_cc[VSTART] = _POSIX_VDISABLE; tio.c_cc[VSTOP] = _POSIX_VDISABLE; @@ -702,20 +672,17 @@ static void flush_rx_queue() */ static int tx(const char *dmsg, /*const*/ raw_data_t frame) { - ssize_t err; + int err; - assert(frame.end - frame.begin >= 0); - size_t frame_len = (size_t)(frame.end - frame.begin); + upsdebug_ascii(3, dmsg, frame.begin, (frame.end - frame.begin)); - upsdebug_ascii(3, dmsg, frame.begin, frame_len); - - err = ser_send_buf(upsfd, frame.begin, frame_len ); + err = ser_send_buf(upsfd, frame.begin, (frame.end - frame.begin) ); if (err==-1) { upslogx(LOG_ERR, "failed to send frame to PRS: %s", strerror(errno)); return -1; } - if (err != (ssize_t)frame_len) { + if (err != (frame.end - frame.begin)) { upslogx(LOG_ERR, "sent incomplete frame to PRS"); return -1; } @@ -745,7 +712,7 @@ static void io_new_transaction(int timeout) * @return -1 (error) 0 (timeout) >0 (got it) * */ -static ssize_t get_char(char *ch) +static int get_char(char *ch) { time_t now = time(NULL); long rx_timeout; @@ -767,7 +734,7 @@ static ssize_t get_char(char *ch) * @return -1 (error) 0 (timeout) >0 (no. of characters actually read) * */ -static ssize_t get_buf(byte_t *buf, size_t len) +static int get_buf(byte_t *buf, size_t len) { time_t now = time(NULL); long rx_timeout; @@ -787,7 +754,7 @@ static ssize_t get_buf(byte_t *buf, size_t len) static int scan_for(char c) { char in; - ssize_t err; + int err; while (1) { err = get_char(&in); @@ -809,7 +776,7 @@ static int scan_for(char c) */ static int recv_command_ack() { - ssize_t err; + int err; raw_data_t ack; byte_t ack_buf[8]; @@ -831,8 +798,7 @@ static int recv_command_ack() ack.end += 7; /* frame constructed - let's verify it */ - assert (ack.end - ack.begin >= 0); - upsdebug_ascii(3, "rx (ack):\t\t", ack.begin, (size_t)(ack.end - ack.begin)); + upsdebug_ascii(3, "rx (ack):\t\t", ack.begin, (ack.end - ack.begin)); /* generic layout */ err = comli_check_frame(ack); @@ -855,12 +821,11 @@ static int recv_command_ack() */ static int recv_register_data(io_head_t *io, raw_data_t *io_buf) { - ssize_t err; - int ret; + int err, ret; raw_data_t reply_head; raw_data_t reply; - byte_t reply_head_buf[11]; + byte_t reply_head_buf[11]; /* 1: STX */ err = scan_for(STX); @@ -878,8 +843,7 @@ static int recv_register_data(io_head_t *io, raw_data_t *io_buf) reply_head.end += 10; - assert (reply_head.end - reply_head.begin >= 0); - upsdebug_ascii(3, "rx (head):\t", reply_head.begin, (size_t)(reply_head.end - reply_head.begin)); + upsdebug_ascii(3, "rx (head):\t", reply_head.begin, (reply_head.end - reply_head.begin)); /* 3: check header, extract IO info */ @@ -891,21 +855,18 @@ static int recv_register_data(io_head_t *io, raw_data_t *io_buf) reply_head.begin -= 1; /* restore STX */ - upsdebugx(4, "\t\t--> addr: 0x%zx len: 0x%zx", io->addr, io->len); + upsdebugx(4, "\t\t--> addr: 0x%x len: 0x%x", io->addr, io->len); /* 4: allocate space for full reply and copy header there */ reply = raw_xmalloc(11/*head*/ + io->len/*data*/ + 2/*ETX BCC*/); - assert (reply_head.end - reply_head.begin >= 0); - size_t reply_head_len = (size_t)(reply_head.end - reply_head.begin); - - memcpy(reply.end, reply_head.begin, reply_head_len); - reply.end += reply_head_len; + memcpy(reply.end, reply_head.begin, (reply_head.end - reply_head.begin)); + reply.end += (reply_head.end - reply_head.begin); /* 5: receive tail of the frame */ err = get_buf(reply.end, io->len + 2); if (err!=(int)(io->len+2)) { - upsdebugx(4, "rx_tail failed, err=%zi (!= %zi)", err, io->len+2); + upsdebugx(4, "rx_tail failed, err=%i (!= %i)", err, io->len+2); ret = -1; goto out; } @@ -913,8 +874,7 @@ static int recv_register_data(io_head_t *io, raw_data_t *io_buf) /* frame constructed, let's verify it */ - assert (reply.end - reply.begin >= 0); - upsdebug_ascii(3, "rx (head+data):\t", reply.begin, (size_t)(reply.end - reply.begin)); + upsdebug_ascii(3, "rx (head+data):\t", reply.begin, (reply.end - reply.begin)); /* generic layout */ err = comli_check_frame(reply); @@ -972,7 +932,7 @@ static int al175_do(byte_t cmd, byte_t subcmd, uint16_t pr1, uint16_t pr2, uint1 * 'READ REGISTER' * */ -static int al175_read(byte_t *dst, size_t addr, size_t count) +static int al175_read(byte_t *dst, unsigned addr, size_t count) { int err; raw_data_t REQ_frame; @@ -1000,12 +960,11 @@ static int al175_read(byte_t *dst, size_t addr, size_t count) if (err==-1) return -1; - if ((rx_data.end - rx_data.begin) < 0 || - (size_t)(rx_data.end - rx_data.begin) != count) + if ((rx_data.end - rx_data.begin) != (int)count) return -1; if ( (io.addr != addr) || (io.len != count) ) { - upsdebugx(3, "%s: io_head mismatch\t(%zx,%zx != %zx,%zx)", + upsdebugx(3, "%s: io_head mismatch\t(%x,%x != %x,%x)", __func__, io.addr, io.len, addr, count); return -1; } @@ -1024,8 +983,8 @@ static int al175_read(byte_t *dst, size_t addr, size_t count) * see 8. ACTIVATE COMMANDS */ -typedef uint16_t mm_t; /* minutes */ -typedef uint16_t VV_t; /* voltage */ +typedef int mm_t; /* minutes */ +typedef int VV_t; /* voltage */ #define Z1 , 0 #define Z2 , 0, 0 @@ -1033,30 +992,10 @@ typedef uint16_t VV_t; /* voltage */ #define ACT int -/* Declare to keep compiler happy even if some routines below are not used currently */ -ACT TOGGLE_PRS_ONOFF (void); -ACT CANCEL_BOOST (void); -ACT STOP_BATTERY_TEST (void); -ACT START_BATTERY_TEST (VV_t EndVolt, mm_t Minutes); -ACT SET_FLOAT_VOLTAGE (VV_t v); -ACT SET_BOOST_VOLTAGE (VV_t v); -ACT SET_HIGH_BATTERY_LIMIT (VV_t Vhigh); -ACT SET_LOW_BATTERY_LIMIT (VV_t Vlow); -ACT SET_DISCONNECT_LEVEL_AND_DELAY (VV_t level, mm_t delay); -ACT RESET_ALARMS (void); -ACT CHANGE_COMM_PROTOCOL (void); -ACT SET_VOLTAGE_AT_ZERO_T (VV_t v); -ACT SET_SLOPE_AT_ZERO_T (VV_t mv_per_degree); -ACT SET_MAX_TCOMP_VOLTAGE (VV_t v); -ACT SET_MIN_TCOMP_VOLTAGE (VV_t v); -ACT SWITCH_TEMP_COMP (uint16_t on); -ACT SWITCH_SYM_ALARM (void); - -/* Implement */ ACT TOGGLE_PRS_ONOFF () { return al175_do(0x81, 0x80 Z3); } ACT CANCEL_BOOST () { return al175_do(0x82, 0x80 Z3); } ACT STOP_BATTERY_TEST () { return al175_do(0x83, 0x80 Z3); } -ACT START_BATTERY_TEST (VV_t EndVolt, mm_t Minutes) +ACT START_BATTERY_TEST (VV_t EndVolt, unsigned Minutes) { return al175_do(0x83, 0x81, EndVolt, Minutes Z1); } ACT SET_FLOAT_VOLTAGE (VV_t v) { return al175_do(0x87, 0x80, v Z2); } @@ -1076,7 +1015,7 @@ ACT SET_SLOPE_AT_ZERO_T (VV_t mv_per_degree) ACT SET_MAX_TCOMP_VOLTAGE (VV_t v) { return al175_do(0x8a, 0x82, v Z2); } ACT SET_MIN_TCOMP_VOLTAGE (VV_t v) { return al175_do(0x8a, 0x83, v Z2); } -ACT SWITCH_TEMP_COMP (uint16_t on) { return al175_do(0x8b, 0x80, on Z2); } +ACT SWITCH_TEMP_COMP (int on) { return al175_do(0x8b, 0x80, on Z2); } ACT SWITCH_SYM_ALARM () { return al175_do(0x8c, 0x80 Z3); } @@ -1263,9 +1202,6 @@ void upsdrv_updateinfo(void) } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* TODO use TOGGLE_PRS_ONOFF for shutdown */ @@ -1310,7 +1246,7 @@ static int instcmd(const char *cmdname, const char *extra) return (!err ? STAT_INSTCMD_HANDLED : STAT_INSTCMD_FAILED); } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } diff --git a/drivers/apc-ats-mib.c b/drivers/apc-ats-mib.c deleted file mode 100644 index 56a6779..0000000 --- a/drivers/apc-ats-mib.c +++ /dev/null @@ -1,453 +0,0 @@ -/* apcats-mib.c - subdriver to monitor apcats SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * 2016 Arnaud Quette - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-snmp-subdriver script. It must be customized! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "apc-ats-mib.h" - -#define APC_ATS_MIB_VERSION "0.6" - -#define APC_ATS_SYSOID ".1.3.6.1.4.1.318.1.3.11" -#define APC_ATS_OID_MODEL_NAME ".1.3.6.1.4.1.318.1.1.8.1.5.0" - -static info_lkp_t apc_ats_sensitivity_info[] = { - { 1, "high", NULL, NULL }, - { 2, "low", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t apc_ats_output_status_info[] = { - { 1, "OFF", NULL, NULL }, /* fail */ - { 2, "OL", NULL, NULL }, /* ok */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t apc_ats_outletgroups_name_info[] = { - { 1, "total", NULL, NULL }, - { 2, "bank1", NULL, NULL }, - { 3, "bank2", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t apc_ats_outletgroups_status_info[] = { - { 1, "OL", NULL, NULL }, /* normal */ - { 2, "", NULL, NULL }, /* lowload */ - { 3, "", NULL, NULL }, /* nearoverload */ - { 4, "OVER", NULL, NULL }, /* overload */ - { 0, NULL, NULL, NULL } -}; - -/* APC ATS Snmp2NUT lookup table */ -static snmp_info_t apc_ats_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* ats2IdentManufacturer.0 = STRING: EATON */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "APC", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* atsIdentModelNumber.0 = STRING: "AP7724" */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, APC_ATS_OID_MODEL_NAME, NULL, SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware! */ - /* atsIdentHardwareRev.0 = STRING: "R01" */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware.aux! */ - /* atsIdentFirmwareRev.0 = STRING: "3.0.5" */ - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* atsIdentFirmwareDate.0 = STRING: "09/13/11" */ - /*{ "unmapped.atsIdentFirmwareDate", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.3.0", NULL, SU_FLAG_OK, NULL },*/ - /* atsIdentSerialNumber.0 = STRING: "5A1516T15268" */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.mfr.date! */ - /* atsIdentDateOfManufacture.0 = STRING: "04/18/2015" */ - { "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigProductName.0 = STRING: "m-ups-04" */ - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.4.1.0", NULL, SU_FLAG_OK, NULL }, - - /* Input collection */ - /* atsIdentNominalLineVoltage.0 = INTEGER: 230 */ - { "input.voltage.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.7.0", NULL, SU_FLAG_OK, NULL }, - /* atsIdentNominalLineFrequency.0 = INTEGER: 50 */ - { "input.frequency.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.8.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusSelectedSource.0 = INTEGER: sourceB(2) */ - { "input.source", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigPreferredSource.0 = INTEGER: sourceB(2) */ - { "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.318.1.1.8.4.2.0", NULL, SU_FLAG_OK, NULL }, - /* atsInputVoltage.1.1.1 = INTEGER: 216 */ - { "input.1.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputVoltage.2.1.1 = INTEGER: 215 */ - { "input.2.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.3.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputFrequency.1 = INTEGER: 50 */ - { "input.1.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputFrequency.2 = INTEGER: 50 */ - { "input.2.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* atsConfigVoltageSensitivity.0 = INTEGER: high(1) */ - { "input.sensitivity", ST_FLAG_RW, 1, ".1.3.6.1.4.1.318.1.1.8.4.4.0", NULL, SU_FLAG_OK, &apc_ats_sensitivity_info[0] }, - /* FIXME: RFC for input.count! */ - /* atsNumInputs.0 = INTEGER: 2 */ - { "input.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.1.0", NULL, SU_FLAG_OK, NULL }, - - /* Output collection */ - /* atsOutputFrequency.1 = INTEGER: 50 */ - { "output.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankOutputVoltage.1 = INTEGER: 215 */ - { "output.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.6.1", NULL, SU_FLAG_OK, NULL }, - - /* UPS collection */ - /* FIXME: RFC for device.status! */ - /* atsStatusVoltageOutStatus.0 = INTEGER: ok(2) */ - { "ups.status", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.15.0", NULL, SU_FLAG_OK, &apc_ats_output_status_info[0] }, - - /* Outlet groups collection */ - /* Note: prefer the OutputBank data to the ConfigBank ones */ - /* atsConfigBankTableSize.0 = INTEGER: 3 */ - /*{ "outlet.group.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.13.0", NULL, SU_FLAG_OK, NULL },*/ - /* atsOutputBankTableSize.0 = INTEGER: 3 */ - { "outlet.group.count", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.4.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankTableIndex.%i = INTEGER: %i */ - /*{ "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.4.14.1.1.%i", NULL, SU_FLAG_OK, NULL },*/ - /* atsOutputBankTableIndex.%i = INTEGER: %i */ - { "outlet.group.%i.id", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.1.%i", NULL, SU_FLAG_OK | SU_OUTLET_GROUP, NULL }, - /* atsConfigBank.%i = INTEGER: total(1) */ - /*{ "outlet.group.%i.name", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.2.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, &apc_ats_group_name_info[0] },*/ - /* atsOutputBank.1 = INTEGER: total(1) */ - { "outlet.group.%i.name", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.3.%i", NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP, &apc_ats_outletgroups_name_info[0] }, - /* atsOutputBankCurrent.%i = Gauge32: 88 */ - { "outlet.group.%i.current", 0, 0.1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.4.%i", NULL, SU_OUTLET_GROUP, NULL }, - /* atsOutputBankState.%i = INTEGER: normal(1) */ - { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.5.%i", NULL, SU_OUTLET_GROUP, &apc_ats_outletgroups_status_info[0] }, - /* atsOutputBankOutputVoltage.%i = INTEGER: 215 */ - { "outlet.group.%i.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.6.%i", NULL, SU_OUTLET_GROUP, NULL }, - /* atsOutputBankPower.1 = INTEGER: 1883 */ - { "outlet.group.%i.realpower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.15.%i", NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP, NULL }, - - -#if 0 /* FIXME: Remaining data to be processed */ - /* atsIdentDeviceRating.0 = INTEGER: 32 */ - { "unmapped.atsIdentDeviceRating", 0, 1, ".1.3.6.1.4.1.318.1.1.8.1.9.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationNumInputs.0 = INTEGER: 2 */ - { "unmapped.atsCalibrationNumInputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationNumInputPhases.0 = INTEGER: 1 */ - { "unmapped.atsCalibrationNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationInputTableIndex.1.1.1 = INTEGER: 1 */ - { "unmapped.atsCalibrationInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationInputTableIndex.2.1.1 = INTEGER: 2 */ - { "unmapped.atsCalibrationInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.1.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationInputPhaseTableIndex.1.1.1 = INTEGER: 1 */ - { "unmapped.atsCalibrationInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationInputPhaseTableIndex.2.1.1 = INTEGER: 1 */ - { "unmapped.atsCalibrationInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.2.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsLineVoltageCalibrationFactor.1.1.1 = INTEGER: 487 */ - { "unmapped.atsLineVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsLineVoltageCalibrationFactor.2.1.1 = INTEGER: 488 */ - { "unmapped.atsLineVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.1.3.1.3.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltages.0 = INTEGER: 5 */ - { "unmapped.atsCalibrationPowerSupplyVoltages", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.1.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltageTableIndex.1 = INTEGER: 1 */ - { "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltageTableIndex.2 = INTEGER: 2 */ - { "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltageTableIndex.3 = INTEGER: 3 */ - { "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltageTableIndex.4 = INTEGER: 4 */ - { "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltageTableIndex.5 = INTEGER: 5 */ - { "unmapped.atsCalibrationPowerSupplyVoltageTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltage.1 = INTEGER: powerSupply24V(1) */ - { "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltage.2 = INTEGER: powerSupply12V(2) */ - { "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltage.3 = INTEGER: powerSupply(3) */ - { "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltage.4 = INTEGER: powerSupply24VSourceB(4) */ - { "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationPowerSupplyVoltage.5 = INTEGER: powerSupplyMinus12V(5) */ - { "unmapped.atsCalibrationPowerSupplyVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* atsPowerSupplyVoltageCalibrationFactor.1 = INTEGER: 521 */ - { "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* atsPowerSupplyVoltageCalibrationFactor.2 = INTEGER: 1076 */ - { "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* atsPowerSupplyVoltageCalibrationFactor.3 = INTEGER: 2560 */ - { "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* atsPowerSupplyVoltageCalibrationFactor.4 = INTEGER: 521 */ - { "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* atsPowerSupplyVoltageCalibrationFactor.5 = INTEGER: 975 */ - { "unmapped.atsPowerSupplyVoltageCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.2.2.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationNumOutputs.0 = INTEGER: 1 */ - { "unmapped.atsCalibrationNumOutputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.1.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationNumOutputPhases.0 = INTEGER: 1 */ - { "unmapped.atsCalibrationNumOutputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.2.0", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationOutputTableIndex.1.phase1.1 = INTEGER: 1 */ - { "unmapped.atsCalibrationOutputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsCalibrationOutputPhasesTableIndex.1.phase1.1 = INTEGER: phase1(1) */ - { "unmapped.atsCalibrationOutputPhasesTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputCurrentCalibrationFactor.1.phase1.1 = INTEGER: 487 */ - { "unmapped.atsOutputCurrentCalibrationFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.8.2.3.3.1.3.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsControlResetATS.0 = INTEGER: none(1) */ - { "unmapped.atsControlResetATS", 0, 1, ".1.3.6.1.4.1.318.1.1.8.3.1.0", NULL, SU_FLAG_OK, NULL }, - /* atsControlClearAllAlarms.0 = INTEGER: -1 */ - { "unmapped.atsControlClearAllAlarms", 0, 1, ".1.3.6.1.4.1.318.1.1.8.3.2.0", NULL, SU_FLAG_OK, NULL }, - - /* atsConfigFrontPanelLockout.0 = INTEGER: enableFrontPanel(2) */ - { "unmapped.atsConfigFrontPanelLockout", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.3.0", NULL, SU_FLAG_OK, NULL }, - - /* atsConfigTransferVoltageRange.0 = INTEGER: medium(2) */ - { "unmapped.atsConfigTransferVoltageRange", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.5.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigCurrentLimit.0 = INTEGER: 32 */ - { "unmapped.atsConfigCurrentLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.6.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigResetValues.0 = INTEGER: -1 */ - { "unmapped.atsConfigResetValues", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.7.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigLineVRMS.0 = INTEGER: 230 */ - { "unmapped.atsConfigLineVRMS", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.8.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigLineVRMSNarrowLimit.0 = INTEGER: 16 */ - { "unmapped.atsConfigLineVRMSNarrowLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.9.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigLineVRMSMediumLimit.0 = INTEGER: 23 */ - { "unmapped.atsConfigLineVRMSMediumLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.10.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigLineVRMSWideLimit.0 = INTEGER: 30 */ - { "unmapped.atsConfigLineVRMSWideLimit", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.11.0", NULL, SU_FLAG_OK, NULL }, - /* atsConfigFrequencyDeviation.0 = INTEGER: two(2) */ - { "unmapped.atsConfigFrequencyDeviation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.12.0", NULL, SU_FLAG_OK, NULL }, - - /* Outlet groups collection */ - /* atsConfigBankLowLoadThreshold.1 = INTEGER: 0 */ - { "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankLowLoadThreshold.2 = INTEGER: 0 */ - { "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankLowLoadThreshold.3 = INTEGER: 0 */ - { "unmapped.atsConfigBankLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankNearOverLoadThreshold.1 = INTEGER: 28 */ - { "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankNearOverLoadThreshold.2 = INTEGER: 12 */ - { "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankNearOverLoadThreshold.3 = INTEGER: 12 */ - { "unmapped.atsConfigBankNearOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankOverLoadThreshold.1 = INTEGER: 32 */ - { "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankOverLoadThreshold.2 = INTEGER: 16 */ - { "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* atsConfigBankOverLoadThreshold.3 = INTEGER: 16 */ - { "unmapped.atsConfigBankOverLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.14.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* atsConfigPhaseTableSize.0 = INTEGER: 0 */ - { "unmapped.atsConfigPhaseTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.8.4.15.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusCommStatus.0 = INTEGER: atsCommEstablished(2) */ - { "unmapped.atsStatusCommStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.1.0", NULL, SU_FLAG_OK, NULL }, - - /* atsStatusRedundancyState.0 = INTEGER: atsFullyRedundant(2) */ - { "unmapped.atsStatusRedundancyState", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusOverCurrentState.0 = INTEGER: atsCurrentOK(2) */ - { "unmapped.atsStatusOverCurrentState", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatus5VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */ - { "unmapped.atsStatus5VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.5.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatus24VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */ - { "unmapped.atsStatus24VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatus24VSourceBPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */ - { "unmapped.atsStatus24VSourceBPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.7.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusPlus12VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */ - { "unmapped.atsStatusPlus12VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.8.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusMinus12VPowerSupply.0 = INTEGER: atsPowerSupplyOK(2) */ - { "unmapped.atsStatusMinus12VPowerSupply", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.9.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusSwitchStatus.0 = INTEGER: ok(2) */ - { "unmapped.atsStatusSwitchStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.10.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusFrontPanel.0 = INTEGER: unlocked(2) */ - { "unmapped.atsStatusFrontPanel", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.11.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusSourceAStatus.0 = INTEGER: ok(2) */ - { "unmapped.atsStatusSourceAStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.12.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusSourceBStatus.0 = INTEGER: ok(2) */ - { "unmapped.atsStatusSourceBStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.13.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusPhaseSyncStatus.0 = INTEGER: inSync(1) */ - { "unmapped.atsStatusPhaseSyncStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.14.0", NULL, SU_FLAG_OK, NULL }, - - /* atsStatusHardwareStatus.0 = INTEGER: ok(2) */ - { "unmapped.atsStatusHardwareStatus", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.1.16.0", NULL, SU_FLAG_OK, NULL }, - /* atsStatusResetMaxMinValues.0 = INTEGER: -1 */ - { "unmapped.atsStatusResetMaxMinValues", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.2.1.0", NULL, SU_FLAG_OK, NULL }, - - /* atsInputTableIndex.1 = INTEGER: 1 */ - { "unmapped.atsInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputTableIndex.2 = INTEGER: 2 */ - { "unmapped.atsInputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* atsNumInputPhases.1 = INTEGER: 1 */ - { "unmapped.atsNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* atsNumInputPhases.2 = INTEGER: 1 */ - { "unmapped.atsNumInputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* atsInputVoltageOrientation.1 = INTEGER: singlePhase(2) */ - { "unmapped.atsInputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputVoltageOrientation.2 = INTEGER: singlePhase(2) */ - { "unmapped.atsInputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - - /* atsInputType.1 = INTEGER: main(2) */ - { "unmapped.atsInputType", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputType.2 = INTEGER: main(2) */ - { "unmapped.atsInputType", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* atsInputName.1 = STRING: "Source A" */ - { "unmapped.atsInputName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputName.2 = STRING: "Source B" */ - { "unmapped.atsInputName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.8.5.3.2.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* atsInputPhaseTableIndex.1.1.1 = INTEGER: 1 */ - { "unmapped.atsInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputPhaseTableIndex.2.1.1 = INTEGER: 2 */ - { "unmapped.atsInputPhaseTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.1.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputPhaseIndex.1.1.1 = INTEGER: 1 */ - { "unmapped.atsInputPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputPhaseIndex.2.1.1 = INTEGER: 1 */ - { "unmapped.atsInputPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.2.2.1.1", NULL, SU_FLAG_OK, NULL }, - - /* atsInputMaxVoltage.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMaxVoltage.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.4.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinVoltage.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.5.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinVoltage.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.5.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputCurrent.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.6.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputCurrent.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.6.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMaxCurrent.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.7.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMaxCurrent.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.7.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinCurrent.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.8.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinCurrent.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.8.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputPower.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.9.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputPower.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.9.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMaxPower.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.10.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMaxPower.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.10.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinPower.1.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.11.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsInputMinPower.2.1.1 = INTEGER: -1 */ - { "unmapped.atsInputMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.3.3.1.11.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsNumOutputs.0 = INTEGER: 1 */ - { "unmapped.atsNumOutputs", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.1.0", NULL, SU_FLAG_OK, NULL }, - /* atsOutputTableIndex.1 = INTEGER: 1 */ - { "unmapped.atsOutputTableIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* atsNumOutputPhases.1 = INTEGER: 1 */ - { "unmapped.atsNumOutputPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputVoltageOrientation.1 = INTEGER: singlePhase(2) */ - { "unmapped.atsOutputVoltageOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputPhase.1 = INTEGER: phase1(1) */ - { "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputPhase.2 = INTEGER: phase1(1) */ - { "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputPhase.3 = INTEGER: phase1(1) */ - { "unmapped.atsOutputPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.2.3", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputBankMaxCurrent.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxCurrent.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxCurrent.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.7.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinCurrent.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinCurrent.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinCurrent.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinCurrent", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.8.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankLoad.1 = INTEGER: 1883 */ - { "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankLoad.2 = INTEGER: 984 */ - { "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankLoad.3 = INTEGER: 898 */ - { "unmapped.atsOutputBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.9.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxLoad.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxLoad.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxLoad.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.10.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinLoad.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinLoad.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinLoad.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.11.3", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputBankPercentLoad.1 = INTEGER: 25 */ - { "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankPercentLoad.2 = INTEGER: 13 */ - { "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankPercentLoad.3 = INTEGER: 12 */ - { "unmapped.atsOutputBankPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.12.3", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputBankMaxPercentLoad.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPercentLoad.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPercentLoad.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.13.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentLoad.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentLoad.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentLoad.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.14.3", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputBankMaxPower.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPower.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPower.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.16.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPower.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPower.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPower.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.17.3", NULL, SU_FLAG_OK, NULL }, - - /* atsOutputBankPercentPower.1 = INTEGER: 25 */ - { "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankPercentPower.2 = INTEGER: 13 */ - { "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankPercentPower.3 = INTEGER: 12 */ - { "unmapped.atsOutputBankPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.18.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPercentPower.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPercentPower.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMaxPercentPower.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMaxPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.19.3", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentPower.1 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.1", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentPower.2 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.2", NULL, SU_FLAG_OK, NULL }, - /* atsOutputBankMinPercentPower.3 = INTEGER: -1 */ - { "unmapped.atsOutputBankMinPercentPower", 0, 1, ".1.3.6.1.4.1.318.1.1.8.5.4.5.1.20.3", NULL, SU_FLAG_OK, NULL }, -#endif /* 0 */ - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t apc_ats = { "apc_ats", APC_ATS_MIB_VERSION, NULL, APC_ATS_OID_MODEL_NAME, apc_ats_mib, APC_ATS_SYSOID, NULL }; diff --git a/drivers/apc-ats-mib.h b/drivers/apc-ats-mib.h deleted file mode 100644 index 7a44a04..0000000 --- a/drivers/apc-ats-mib.h +++ /dev/null @@ -1,29 +0,0 @@ -/* apcats-mib.h - subdriver to monitor apcats SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef APCATS_MIB_H -#define APCATS_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t apc_ats; - -#endif /* APCATS_MIB_H */ diff --git a/drivers/apc-hid.c b/drivers/apc-hid.c index 36afaf1..1d85621 100644 --- a/drivers/apc-hid.c +++ b/drivers/apc-hid.c @@ -27,22 +27,21 @@ */ #include "main.h" /* for getval() */ -#include "hidparser.h" /* for FindObject_with_ID_Node() */ #include "usbhid-ups.h" #include "apc-hid.h" #include "usb-common.h" -#define APC_HID_VERSION "APC HID 0.98" +#define APC_HID_VERSION "APC HID 0.95" /* APC */ #define APC_VENDORID 0x051d /* Tweaks */ -static char * tweak_max_report[] = { +char * tweak_max_report[] = { /* Back-UPS ES 700 does NOT overflow. */ /* Back-UPS ES 725 does NOT overflow. */ /* Back-UPS ES 525 overflows on ReportID 0x0c - (UPS.PowerSummary.RemainingCapacity). */ + (UPS.PowerSummary.RemainingCapacity).*/ "Back-UPS ES 525", /* Back-UPS CS 650 overflows on ReportID 0x46 */ "Back-UPS CS", @@ -51,10 +50,7 @@ static char * tweak_max_report[] = { /* Don't use interrupt pipe on 5G models (used by proprietary protocol) */ static void *disable_interrupt_pipe(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - if (use_interrupt_pipe == TRUE) { - /* FIXME? Suggest data from "device" to help the setup below? */ upslogx(LOG_INFO, "interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)"); use_interrupt_pipe= FALSE; } @@ -66,11 +62,6 @@ static void *general_apc_check(USBDevice_t *device) { int i = 0; - if (!device->Product) { - upslogx(LOG_WARNING, "device->Product is NULL so it is not possible to determine whether to activate max_report_size workaround"); - return NULL; - } - /* Some models of Back-UPS overflow on some ReportID. * This results in some data not being exposed and IO errors on * WIN32, causing endless reconnection or driver's failure */ @@ -88,15 +79,13 @@ static void *general_apc_check(USBDevice_t *device) /* USB IDs device table */ static usb_device_id_t apc_usb_device_table[] = { - /* APC AP9584 Serial->USB kit */ - { USB_DEVICE(APC_VENDORID, 0x0000), NULL }, /* various models */ { USB_DEVICE(APC_VENDORID, 0x0002), general_apc_check }, /* various 5G models */ { USB_DEVICE(APC_VENDORID, 0x0003), disable_interrupt_pipe }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; /* returns statically allocated string - must not use it again before @@ -128,69 +117,53 @@ static const char *apc_date_conversion_fun(double value) return buf; } -static double apc_date_conversion_reverse(const char *date_string) -{ - int year, month, day; - long date; - - sscanf(date_string, "%04d/%02d/%02d", &year, &month, &day); - if(year >= 2070 || month > 12 || day > 31) - return 0; - year %= 100; - date = ((year / 10 & 0x0F) << 4) + (year % 10); - date += ((month / 10 & 0x0F) << 20) + ((month % 10) << 16); - date += ((day / 10 & 0x0F) << 12) + ((day % 10) << 8); - - return (double) date; -} - -static info_lkp_t apc_date_conversion[] = { - { 0, NULL, apc_date_conversion_fun, apc_date_conversion_reverse } +info_lkp_t apc_date_conversion[] = { + { 0, NULL, apc_date_conversion_fun } }; /* This was determined empirically from observing a BackUPS LS 500 */ static info_lkp_t apcstatusflag_info[] = { - { 8, "!off", NULL, NULL }, /* Normal operation */ - { 16, "!off", NULL, NULL }, /* This occurs briefly during power-on, and corresponds to status 'DISCHRG'. */ - { 0, "off", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 8, "!off", NULL }, /* Normal operation */ + { 16, "!off", NULL }, /* This occurs briefly during power-on, and corresponds to status 'DISCHRG'. */ + { 0, "off", NULL }, + { 0, NULL, NULL } }; /* Reason of the last battery transfer (from apcupsd) */ static info_lkp_t apc_linefailcause_vrange_info[] = { - { 1, "vrange", NULL, NULL }, /* Low line voltage */ - { 2, "vrange", NULL, NULL }, /* High line voltage */ - { 4, "vrange", NULL, NULL }, /* notch, spike, or blackout */ - { 8, "vrange", NULL, NULL }, /* Notch or blackout */ - { 9, "vrange", NULL, NULL }, /* Spike or blackout */ - { 0, "!vrange", NULL, NULL }, /* No transfers have ocurred */ - { 0, NULL, NULL, NULL } + { 1, "vrange", NULL }, /* Low line voltage */ + { 2, "vrange", NULL }, /* High line voltage */ + { 4, "vrange", NULL }, /* notch, spike, or blackout */ + { 8, "vrange", NULL }, /* Notch or blackout */ + { 9, "vrange", NULL }, /* Spike or blackout */ + { 0, "!vrange", NULL }, /* No transfers have ocurred */ + { 0, NULL, NULL } }; static info_lkp_t apc_linefailcause_frange_info[] = { - { 7, "frange", NULL, NULL }, /* Input frequency out of range */ - { 0, "!frange", NULL, NULL }, /* No transfers have ocurred */ - { 0, NULL, NULL, NULL } + { 7, "frange", NULL }, /* Input frequency out of range */ + { 0, "!frange", NULL }, /* No transfers have ocurred */ + { 0, NULL, NULL } }; #if 0 /* these input.transfer.reason can't be mapped at the moment... */ - { 3, "ripple", NULL, NULL }, /* Ripple */ - { 5, "self test", NULL, NULL }, /* Self Test or Discharge Calibration commanded - * Test usage, front button, or 2 week self test */ - { 6, "forced", NULL, NULL }, /* DelayBeforeShutdown or APCDelayBeforeShutdown */ - { 10, "forced", NULL, NULL }, /* Graceful shutdown by accessories */ - { 11, "self test", NULL, NULL }, /* Test usage invoked */ - { 12, "self test", NULL, NULL }, /* Front button initiated self test */ - { 13, "self test", NULL, NULL }, /* 2 week self test */ - { 0, NULL, NULL, NULL } + { 3, "ripple", NULL }, /* Ripple */ + { 5, "self test", NULL }, /* Self Test or Discharge Calibration commanded + * Test usage, front button, or 2 week self test */ + { 6, "forced", NULL }, /* DelayBeforeShutdown or APCDelayBeforeShutdown */ + { 10, "forced", NULL }, /* Graceful shutdown by accessories */ + { 11, "self test", NULL }, /* Test usage invoked */ + { 12, "self test", NULL }, /* Front button initiated self test */ + { 13, "self test", NULL }, /* 2 week self test */ + { 0, NULL, NULL } #endif static info_lkp_t apc_sensitivity_info[] = { - { 0, "low", NULL, NULL }, - { 1, "medium", NULL, NULL }, - { 2, "high", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 0, "low", NULL }, + { 1, "medium", NULL }, + { 2, "high", NULL }, + { 0, NULL, NULL } }; /* --------------------------------------------------------------- */ @@ -334,7 +307,7 @@ static hid_info_t apc_hid2nut[] = { { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.1f", 0, NULL }, /* Back-UPS 500 */ { "battery.temperature", 0, 0, "UPS.Battery.Temperature", NULL, "%s", 0, kelvin_celsius_conversion }, { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", 0, stringid_conversion }, - { "battery.mfr.date", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Battery.ManufacturerDate", NULL, "%s", HU_FLAG_SEMI_STATIC, date_conversion }, + { "battery.mfr.date", 0, 0, "UPS.Battery.ManufacturerDate", NULL, "%s", 0, date_conversion }, { "battery.mfr.date", 0, 0, "UPS.PowerSummary.APCBattReplaceDate", NULL, "%s", 0, apc_date_conversion }, /* Back-UPS 500, Back-UPS ES/CyberFort 500 */ { "battery.date", 0, 0, "UPS.Battery.APCBattReplaceDate", NULL, "%s", 0, apc_date_conversion }, /* Observed values: 0x0 on Back-UPS ES 650, 0x92501 on Back-UPS BF500 whose manufacture date was 2005/01/20 - this makes little sense but at least it's a valid date. */ @@ -402,7 +375,7 @@ static hid_info_t apc_hid2nut[] = { { "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "input.transfer.high", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "input.sensitivity", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.APCSensitivity", NULL, "%s", HU_FLAG_SEMI_STATIC, apc_sensitivity_info }, - + /* Output page */ { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.1f", 0, NULL }, { "output.voltage.nominal", 0, 0, "UPS.Output.ConfigVoltage", NULL, "%.1f", 0, NULL }, @@ -415,7 +388,7 @@ static hid_info_t apc_hid2nut[] = { /* { "ambient.temperature", 0, 0, "UPS.APCEnvironment.APCProbe2.Temperature", NULL, "%.1f", 0, kelvin_celsius_conversion }, { "ambient.humidity", 0, 0, "UPS.APCEnvironment.APCProbe2.Humidity", NULL, "%.1f", 0, NULL }, -*/ + */ /* instant commands. */ /* test.* split into subset while waiting for extradata support @@ -449,7 +422,7 @@ static hid_info_t apc_hid2nut[] = { { "shutdown.reboot", 0, 0, "UPS.APCGeneralCollection.APCDelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL }, /* used by APC BackUPS CS */ { "shutdown.return", 0, 0, "UPS.Output.APCDelayBeforeReboot", NULL, "1", HU_TYPE_CMD, NULL }, - + { "beeper.on", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, { "beeper.off", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, @@ -516,73 +489,6 @@ static int apc_claim(HIDDevice_t *hd) { } } -/* apc_fix_report_desc - * - * The Back-UPS XS 1400U reports incorrect logical min/max values for the - * UPS.Input.ConfigVoltage and UPS.Input.Voltage when operating in a - * 220-240V region. Detect this and fix it. - * This same fix may be applicable to other APC UPS units as well, though - * the report IDs may be different. - */ -static int apc_fix_report_desc(HIDDevice_t *pDev, HIDDesc_t *pDesc_arg) { - HIDData_t *pData; - int res = 0; - - int vendorID = pDev->VendorID; - int productID = pDev->ProductID; - if (vendorID != APC_VENDORID || productID != 0x0002) { - return 0; - } - - upsdebugx(3, "Attempting Report Descriptor fix for UPS: Vendor: %04x, Product: %04x", vendorID, productID); - - /* Look at the High Voltage Transfer logical max value: - * If the HVT logmax is greater than the configured or input voltage limit - * then the configured/input voltage limits are probably incorrect. - * Arbitrarily set the input voltage logical min/max to 0 .. 2*HVT logmax and the - * configured (nominal) input voltage logical max to 255 (it's a single byte value) - - * Path: UPS.Input.ConfigVoltage, Type: Feature, ReportID: 0x30, Offset: 0, Size: 8 - * Path: UPS.Input.Voltage, Type: Feature, ReportID: 0x31, Offset: 0, Size: 16 - * Path: UPS.Input.HighVoltageTransfer, Type: Feature, ReportID: 0x33, Offset: 0, Size: 16 - */ - - if ((pData=FindObject_with_ID_Node(pDesc_arg, 0x33, USAGE_POW_HIGH_VOLTAGE_TRANSFER))) { - long hvt_logmin = pData->LogMin; - long hvt_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: highVoltageTransfer LogMin: %ld LogMax: %ld", hvt_logmin, hvt_logmax); - - if ((pData=FindObject_with_ID_Node(pDesc_arg, 0x31, USAGE_POW_VOLTAGE))) { - long voltage_logmin = pData->LogMin; - long voltage_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: voltage LogMin: %ld LogMax: %ld", - voltage_logmin, voltage_logmax); - - if (hvt_logmax > voltage_logmax) { - pData->LogMin = 0; /* a reasonable lower limit for voltage */ - pData->LogMax = hvt_logmax * 2; /* it may be smoking at this point */ - upsdebugx(3, "Fixing Report Descriptor. Set voltage LogMin = %ld, LogMax = %ld", - pData->LogMin , pData->LogMax); - res = 1; - } - } - if ((pData=FindObject_with_ID_Node(pDesc_arg, 0x30, USAGE_POW_CONFIG_VOLTAGE))) { - long cvoltage_logmin = pData->LogMin; - long cvoltage_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: configVoltage LogMin: %ld LogMax: %ld", - cvoltage_logmin, cvoltage_logmax); - - if (hvt_logmax > cvoltage_logmax) { - pData->LogMax = 255; - upsdebugx(3, "Fixing Report Descriptor. Set configVoltage LogMin = %ld, LogMax = %ld", - pData->LogMin , pData->LogMax); - res = 1; - } - } - } - return res; -} - subdriver_t apc_subdriver = { APC_HID_VERSION, apc_claim, @@ -591,5 +497,4 @@ subdriver_t apc_subdriver = { apc_format_model, apc_format_mfr, apc_format_serial, - apc_fix_report_desc, }; diff --git a/drivers/apc-hid.h b/drivers/apc-hid.h index ef828df..071136a 100644 --- a/drivers/apc-hid.h +++ b/drivers/apc-hid.h @@ -1,6 +1,6 @@ /* apc-hid.h - data to monitor APC USB/HID devices with NUT * - * Copyright (C) + * Copyright (C) * 2003 - 2005 Arnaud Quette * 2005 John Stamp * 2005 Peter Selinger @@ -31,4 +31,6 @@ extern subdriver_t apc_subdriver; +extern int max_report_size; + #endif /* APC_HID_H */ diff --git a/drivers/apc-iem-mib.h b/drivers/apc-iem-mib.h deleted file mode 100644 index 65904e6..0000000 --- a/drivers/apc-iem-mib.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef APC_IEM_MIB_H -#define APC_IEM_MIB_H - -/* - * FIXME: The below is needed because the main driver body uses this to determine - * whether a conversion from Fahrenheit to Celsius is needed (which really should - * be solved in subdriver specific formatting functions, like we do in usbhid-ups - * This is used in both snmp-ups.c and apc.c logics. - */ - -/* IEM ambient variables */ -/* IEM: integrated environment monitor probe */ - -#define APCC_OID_IEM_TEMP ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1" -#define APCC_OID_IEM_TEMP_UNIT ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1" -#define APCC_IEM_FAHRENHEIT 2 -#define APCC_OID_IEM_HUMID ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1" - -#endif /* APC_IEM_MIB_H */ diff --git a/drivers/apc-mib.c b/drivers/apc-mib.c index 1ac0a27..8851a6f 100644 --- a/drivers/apc-mib.c +++ b/drivers/apc-mib.c @@ -26,14 +26,10 @@ #include "apc-mib.h" -#define APCC_MIB_VERSION "1.6" - -#define APC_UPS_DEVICE_MODEL ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" -/* FIXME: Find a better oid_auto_check vs sysOID for this one? */ -#define APC_UPS_SYSOID APC_UPS_DEVICE_MODEL +#define APCC_MIB_VERSION "1.2" /* Other APC sysOID: - * + * * examples found on the Net and other sources: * 'enterprises.apc.products.system.smartUPS.smartUPS700' * - from fence agents @@ -47,7 +43,7 @@ * .1.3.6.1.4.1.318.1.3.2.8 */ -/* TODO: find the right sysOID for this MIB +/* TODO: find the right sysOID for this MIB * Ie ".1.3.6.1.4.1.318.1.1.1" or ".1.3.6.1.4.1.318" or? */ /* .1.3.6.1.4.1.318.1.1.1 @@ -64,75 +60,75 @@ #define APCC_OID_BATT_STATUS ".1.3.6.1.4.1.318.1.1.1.2.1.1.0" /* Defines for APCC_OID_BATT_STATUS */ static info_lkp_t apcc_batt_info[] = { - { 1, "", NULL, NULL }, /* unknown */ - { 2, "", NULL, NULL }, /* batteryNormal */ - { 3, "LB", NULL, NULL }, /* batteryLow */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* unknown */ + { 2, "" }, /* batteryNormal */ + { 3, "LB" }, /* batteryLow */ + { 0, "NULL" } } ; #define APCC_OID_POWER_STATUS ".1.3.6.1.4.1.318.1.1.1.4.1.1.0" /* Defines for APCC_OID_POWER_STATUS */ static info_lkp_t apcc_pwr_info[] = { - { 1, "", NULL, NULL }, /* unknown */ - { 2, "OL", NULL, NULL }, /* onLine */ - { 3, "OB", NULL, NULL }, /* onBattery */ - { 4, "OL BOOST", NULL, NULL }, /* onSmartBoost */ - { 5, "OFF", NULL, NULL }, /* timedSleeping */ - { 6, "OFF", NULL, NULL }, /* softwareBypass */ - { 7, "OFF", NULL, NULL }, /* off */ - { 8, "", NULL, NULL }, /* rebooting */ - { 9, "BYPASS", NULL, NULL }, /* switchedBypass */ - { 10, "BYPASS", NULL, NULL }, /* hardwareFailureBypass */ - { 11, "OFF", NULL, NULL }, /* sleepingUntilPowerReturn */ - { 12, "OL TRIM", NULL, NULL }, /* onSmartTrim */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* unknown */ + { 2, "OL" }, /* onLine */ + { 3, "OB" }, /* onBattery */ + { 4, "BOOST" }, /* onSmartBoost */ + { 5, "OFF" }, /* timedSleeping */ + { 6, "OFF" }, /* softwareBypass */ + { 7, "OFF" }, /* off */ + { 8, "" }, /* rebooting */ + { 9, "BYPASS" }, /* switchedBypass */ + { 10, "BYPASS" }, /* hardwareFailureBypass */ + { 11, "OFF" }, /* sleepingUntilPowerReturn */ + { 12, "TRIM" }, /* onSmartTrim */ + { 0, "NULL" } } ; #define APCC_OID_CAL_RESULTS ".1.3.6.1.4.1.318.1.1.1.7.2.6.0" static info_lkp_t apcc_cal_info[] = { - { 1, "", NULL, NULL }, /* Calibration Successful */ - { 2, "", NULL, NULL }, /* Calibration not done, battery capacity below 100% */ - { 3, "CAL", NULL, NULL }, /* Calibration in progress */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* Calibration Successful */ + { 2, "" }, /* Calibration not done, battery capacity below 100% */ + { 3, "CAL" }, /* Calibration in progress */ + { 0, "NULL" } }; #define APCC_OID_NEEDREPLBATT ".1.3.6.1.4.1.318.1.1.1.2.2.4.0" static info_lkp_t apcc_battrepl_info[] = { - { 1, "", NULL, NULL }, /* No battery needs replacing */ - { 2, "RB", NULL, NULL }, /* Batteries need to be replaced */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* No battery needs replacing */ + { 2, "RB" }, /* Batteries need to be replaced */ + { 0, "NULL" } }; #define APCC_OID_TESTDIAGRESULTS ".1.3.6.1.4.1.318.1.1.1.7.2.3.0" static info_lkp_t apcc_testdiag_results[] = { - { 1, "Ok", NULL, NULL }, - { 2, "Failed", NULL, NULL }, - { 3, "InvalidTest", NULL, NULL }, - { 4, "TestInProgress", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Ok" }, + { 2, "Failed" }, + { 3, "InvalidTest" }, + { 4, "TestInProgress"}, + { 0, "NULL" } }; #define APCC_OID_SENSITIVITY ".1.3.6.1.4.1.318.1.1.1.5.2.7.0" static info_lkp_t apcc_sensitivity_modes[] = { - { 1, "auto", NULL, NULL }, - { 2, "low", NULL, NULL }, - { 3, "medium", NULL, NULL }, - { 4, "high", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "auto" }, + { 2, "low" }, + { 3, "medium" }, + { 4, "high" }, + { 0, "NULL" } }; #define APCC_OID_TRANSFERREASON "1.3.6.1.4.1.318.1.1.1.3.2.5.0" static info_lkp_t apcc_transfer_reasons[] = { - { 1, "noTransfer", NULL, NULL }, - { 2, "highLineVoltage", NULL, NULL }, - { 3, "brownout", NULL, NULL }, - { 4, "blackout", NULL, NULL }, - { 5, "smallMomentarySag", NULL, NULL }, - { 6, "deepMomentarySag", NULL, NULL }, - { 7, "smallMomentarySpike", NULL, NULL }, - { 8, "largeMomentarySpike", NULL, NULL }, - { 9, "selfTest", NULL, NULL }, - { 10, "rateOfVoltageChange", NULL, NULL } + { 1, "noTransfer" }, + { 2, "highLineVoltage" }, + { 3, "brownout" }, + { 4, "blackout" }, + { 5, "smallMomentarySag" }, + { 6, "deepMomentarySag" }, + { 7, "smallMomentarySpike" }, + { 8, "largeMomentarySpike" }, + { 9, "selfTest" }, + { 10, "rateOfVoltageChange" } }; /* --- */ @@ -151,11 +147,6 @@ static info_lkp_t apcc_transfer_reasons[] = { static snmp_info_t apcc_mib[] = { - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* info elements. */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "APC", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, @@ -192,10 +183,8 @@ static snmp_info_t apcc_mib[] = { { "input.frequency", 0, 1, ".1.3.6.1.4.1.318.1.1.1.3.2.4.0", "", SU_FLAG_OK, NULL }, { "input.transfer.low", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.3.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, { "input.transfer.high", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.2.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, - { "input.transfer.reason", ST_FLAG_STRING, 1, APCC_OID_TRANSFERREASON, "", SU_TYPE_INT | SU_FLAG_OK, apcc_transfer_reasons }, + { "input.transfer.reason", ST_FLAG_STRING, 1, APCC_OID_TRANSFERREASON, "", SU_TYPE_INT | SU_FLAG_OK, apcc_transfer_reasons }, { "input.sensitivity", ST_FLAG_STRING | ST_FLAG_RW, 1, APCC_OID_SENSITIVITY, "", SU_TYPE_INT | SU_FLAG_OK, apcc_sensitivity_modes }, - { "ups.power", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.9.0", "", SU_FLAG_OK, NULL }, - { "ups.realpower", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.8.0", "", SU_FLAG_OK, NULL }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_POWER_STATUS, "OFF", SU_FLAG_OK | SU_STATUS_PWR, apcc_pwr_info }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_BATT_STATUS, "", @@ -209,8 +198,8 @@ static snmp_info_t apcc_mib[] = { { "ups.load", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.3.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL }, { "ups.load", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.3.0", "", SU_FLAG_OK, NULL }, { "ups.firmware", ST_FLAG_STRING, 16, ".1.3.6.1.4.1.318.1.1.1.1.2.1.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.delay.shutdown", ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.10.0", "", SU_TYPE_TIME | SU_FLAG_OK, NULL }, - { "ups.delay.start", ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.9.0", "", SU_TYPE_TIME | SU_FLAG_OK, NULL }, + { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.10.0", "", SU_FLAG_OK, NULL }, + { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.9.0", "", SU_FLAG_OK, NULL }, { "battery.charge", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.1.0", "", SU_FLAG_OK|SU_FLAG_NEGINVALID|SU_FLAG_UNIQUE, NULL }, { "battery.charge", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.1.0", "", SU_FLAG_OK, NULL }, { "battery.charge.restart", ST_FLAG_STRING | ST_FLAG_RW, 3, ".1.3.6.1.4.1.318.1.1.1.5.2.6.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, @@ -224,10 +213,10 @@ static snmp_info_t apcc_mib[] = { { "battery.current.total", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.2.3.6.0", "", SU_FLAG_OK, NULL }, { "battery.packs", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.5.0", "", SU_FLAG_OK, NULL }, { "battery.packs.bad", 0, 1, ".1.3.6.1.4.1.318.1.1.1.2.2.6.0", "", SU_FLAG_OK, NULL }, - { "battery.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.2.1.3.0", "", SU_FLAG_OK | SU_FLAG_STATIC, NULL }, - { "ups.id", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.1.1.2.0", "", SU_FLAG_OK | SU_FLAG_STATIC, NULL }, + { "battery.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.2.1.3.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL }, + { "ups.id", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.1.1.2.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL }, { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, APCC_OID_TESTDIAGRESULTS, "", SU_FLAG_OK, apcc_testdiag_results }, - { "ups.test.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.7.2.4.0", "", SU_FLAG_OK | SU_FLAG_STATIC, NULL }, + { "ups.test.date", ST_FLAG_STRING | ST_FLAG_RW, 8, ".1.3.6.1.4.1.318.1.1.1.7.2.4.0", "", SU_FLAG_OK | SU_FLAG_STATIC | SU_TYPE_STRING, NULL }, { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.318.1.1.1.4.3.1.0", "", SU_FLAG_OK | SU_FLAG_UNIQUE, NULL }, { "output.voltage", 0, 1, ".1.3.6.1.4.1.318.1.1.1.4.2.1.0", "", SU_FLAG_OK, NULL }, { "output.phases", ST_FLAG_STRING, 2, ".1.3.6.1.4.1.318.1.1.1.9.3.2.1.2.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, @@ -276,32 +265,38 @@ static snmp_info_t apcc_mib[] = { { "ambient.humidity", 0, 1, ".1.3.6.1.4.1.318.1.1.2.1.2.0", "", SU_FLAG_OK, NULL }, { "ambient.1.humidity.alarm.high", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.6.1", "", SU_FLAG_OK, NULL }, { "ambient.1.humidity.alarm.low", 0, 1, ".1.3.6.1.4.1.318.1.1.10.1.2.2.1.7.1", "", SU_FLAG_OK, NULL }, + + /* IEM ambient variables */ /* IEM: integrated environment monitor probe */ +#define APCC_OID_IEM_TEMP ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1" +#define APCC_OID_IEM_TEMP_UNIT ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1" +#define APCC_IEM_FAHRENHEIT 2 +#define APCC_OID_IEM_HUMID ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.6.1" { "ambient.temperature", 0, 1, APCC_OID_IEM_TEMP, "", SU_FLAG_OK, NULL }, { "ambient.humidity", 0, 1, APCC_OID_IEM_HUMID, "", SU_FLAG_OK, NULL }, /* instant commands. */ - { "load.off", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.1.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "load.on", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.6.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "shutdown.stayoff", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.1.0", "3", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "load.off", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.2.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "load.on", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.2.6.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "shutdown.stayoff", 0, 3, ".1.3.6.1.4.1.318.1.1.1.6.2.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* { CMD_SDRET, 0, APCC_REBOOT_GRACEFUL, APCC_OID_REBOOT, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */ - { "shutdown.return", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.1.1.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "test.failure.start", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.4.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "test.panel.start", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.5.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "bypass.start", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.7.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "bypass.stop", 0, 1, ".1.3.6.1.4.1.318.1.1.1.6.2.7.0", "3", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "test.battery.start", 0, 1, ".1.3.6.1.4.1.318.1.1.1.7.2.2.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "calibrate.start", 0, 1, ".1.3.6.1.4.1.318.1.1.1.7.2.5.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "calibrate.stop", 0, 1, ".1.3.6.1.4.1.318.1.1.1.7.2.5.0", "3", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "reset.input.minmax", 0, 1, ".1.3.6.1.4.1.318.1.1.1.9.1.1.0", "2", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "shutdown.return", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.1.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.failure.start", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.2.4.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.panel.start", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.2.5.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "bypass.start", 0, 2, ".1.3.6.1.4.1.318.1.1.1.6.2.7.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "bypass.stop", 0, 3, ".1.3.6.1.4.1.318.1.1.1.6.2.7.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.battery.start", 0, 2, ".1.3.6.1.4.1.318.1.1.1.7.2.2.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "calibrate.start", 0, 2, ".1.3.6.1.4.1.318.1.1.1.7.2.5.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "calibrate.stop", 0, 3, ".1.3.6.1.4.1.318.1.1.1.7.2.5.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "reset.input.minmax", 0, 2, ".1.3.6.1.4.1.318.1.1.1.9.1.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t apc = { "apcc", APCC_MIB_VERSION, APCC_OID_POWER_STATUS, APC_UPS_DEVICE_MODEL, apcc_mib, APC_UPS_SYSOID, NULL }; +mib2nut_info_t apc = { "apcc", APCC_MIB_VERSION, APCC_OID_POWER_STATUS, ".1.3.6.1.4.1.318.1.1.1.1.1.1.0", apcc_mib }; /* vim:ts=4:sw=4:et: diff --git a/drivers/apc-mib.h b/drivers/apc-mib.h index 0b510ea..e5aeb07 100644 --- a/drivers/apc-mib.h +++ b/drivers/apc-mib.h @@ -3,7 +3,15 @@ #include "main.h" #include "snmp-ups.h" -#include "apc-iem-mib.h" + +/* + * FIXME: The below is needed because the main driver body uses this to determine + * whether a conversion from Fahrenheit to Celsius is needed (which really should + * be solved in subdriver specific formatting functions, like we do in usbhid-ups + */ +#define APCC_OID_IEM_TEMP ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.4.1" +#define APCC_OID_IEM_TEMP_UNIT ".1.3.6.1.4.1.318.1.1.10.2.3.2.1.5.1" +#define APCC_IEM_FAHRENHEIT 2 extern mib2nut_info_t apc; diff --git a/drivers/apc-pdu-mib.c b/drivers/apc-pdu-mib.c deleted file mode 100644 index 38963d5..0000000 --- a/drivers/apc-pdu-mib.c +++ /dev/null @@ -1,972 +0,0 @@ -/* apc-pdu-mib.c - subdriver to monitor APC PDU using PowerNet-MIB SNMP with NUT - * - * Copyright (C) 2016 - Eaton - * Authors: Tomas Halman - * Arnaud Quette - * - * Based on initial work and data from Opengear - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "apc-pdu-mib.h" - -#define APC_PDU_MIB_VERSION "0.4" - -#define APC_PDU_MIB_SYSOID_RPDU ".1.3.6.1.4.1.318.1.3.4.4" -#define APC_PDU_MIB_SYSOID_RPDU2 ".1.3.6.1.4.1.318.1.3.4.5" -#define APC_PDU_MIB_SYSOID_MSP ".1.3.6.1.4.1.318.1.3.4.6" -#define APC_PDU_DEVICE_MODEL ".1.3.6.1.4.1.318.1.1.4.1.4.0" - - -static info_lkp_t apc_pdu_sw_outlet_status_info[] = { - { 1, "on", NULL, NULL }, - { 2, "off", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t apc_pdu_sw_outlet_switchability_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "yes", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* POWERNET-MIB Snmp2NUT lookup table */ -static snmp_info_t apc_pdu_mib[] = { - - /* Device page */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "APC", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* sPDUIdentModelNumber.0 = STRING: "AP7900" */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.4.0", - "Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, - SU_FLAG_STALE | SU_FLAG_OK, NULL }, - { "device.description", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.1.5.0", NULL, - SU_FLAG_STALE | SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, - SU_FLAG_STALE | SU_FLAG_OK, NULL }, - /* FIXME: to be RFC'ed */ - { "device.uptime", 0, 1, ".1.3.6.1.2.1.1.3.0", NULL, SU_FLAG_OK | SU_FLAG_NEGINVALID, NULL }, - /* sPDUIdentSerialNumber.0 = STRING: "5A1234E00874" */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.5.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* sPDUIdentModelNumber.0 = STRING: "AP7900" */ - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.4.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* sPDUIdentHardwareRev.0 = STRING: "B2" */ - { "device.version", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* sPDUIdentFirmwareRev.0 = STRING: "v3.7.3" */ - /* FIXME: to be moved to device.firmware */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUIdentDateOfManufacture.0 = STRING: "08/13/2012" */ - /* FIXME: to be moved to the device collection! */ - { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.1.3.0", NULL, SU_FLAG_OK, NULL }, - - /* Input */ - /* rPDUIdentDevicePowerWatts.0 = INTEGER: 0 */ - { "input.realpower", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.16.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadStatusLoad.1 = Gauge32: 0 */ - { "input.current", 0, 0.1, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceLinetoLineVoltage.0 = INTEGER: 120 */ - { "input.voltage.nominal", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.15.0", NULL, SU_FLAG_OK | SU_FLAG_NEGINVALID, NULL }, - - /* Outlets */ - { "outlet.count", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.%i", "%i", - SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, NULL }, - /* sPDUOutletCtlName.%i = STRING: "Testing Name" */ - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.4.2.1.4.%i", NULL, - SU_FLAG_STALE | SU_FLAG_OK | SU_OUTLET, NULL }, - /* sPDUOutletCtl.1 = INTEGER: outletOn(1) */ - { "outlet.%i.status", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.4.2.1.3.%i", NULL, - SU_FLAG_OK | SU_OUTLET, &apc_pdu_sw_outlet_status_info[0] }, - /* Also use this OID to determine switchability ; its presence means "yes" */ - /* sPDUOutletCtl.1 = INTEGER: outletOn(1) */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.4.2.1.3.%i", "yes", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, &apc_pdu_sw_outlet_switchability_info[0] }, - - - -#if 0 /* keep following scan for future development */ - - /* sPDUMasterControlSwitch.0 = INTEGER: noCommand(6) */ - { "unmapped.sPDUMasterControlSwitch", 0, 1, ".1.3.6.1.4.1.318.1.1.4.2.1.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUMasterState.0 = STRING: "On On On On On On On On " */ - { "unmapped.sPDUMasterState", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.2.2.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUMasterPending.0 = STRING: "No No No No No No No No " */ - { "unmapped.sPDUMasterPending", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.2.3.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUMasterConfigPowerOn.0 = INTEGER: 0 */ - { "unmapped.sPDUMasterConfigPowerOn", 0, 1, ".1.3.6.1.4.1.318.1.1.4.3.1.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUMasterConfigReboot.0 = INTEGER: 0 */ - { "unmapped.sPDUMasterConfigReboot", 0, 1, ".1.3.6.1.4.1.318.1.1.4.3.2.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUMasterConfigPDUName.0 = STRING: "RackPDU" */ - { "unmapped.sPDUMasterConfigPDUName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.3.3.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlTableSize.0 = INTEGER: 8 */ - - /* sPDUOutletControlIndex.1 = INTEGER: 1 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.2 = INTEGER: 2 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.3 = INTEGER: 3 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.4 = INTEGER: 4 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.5 = INTEGER: 5 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.6 = INTEGER: 6 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.7 = INTEGER: 7 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletControlIndex.8 = INTEGER: 8 */ - { "unmapped.sPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.1 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.2 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.3 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.4 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.5 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.6 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.7 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPending.8 = INTEGER: noCommandPending(2) */ - { "unmapped.sPDUOutletPending", 0, 1, ".1.3.6.1.4.1.318.1.1.4.4.2.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigTableSize.0 = INTEGER: 8 */ - { "unmapped.sPDUOutletConfigTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.1 = INTEGER: 1 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.2 = INTEGER: 2 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.3 = INTEGER: 3 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.4 = INTEGER: 4 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.5 = INTEGER: 5 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.6 = INTEGER: 6 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.7 = INTEGER: 7 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletConfigIndex.8 = INTEGER: 8 */ - { "unmapped.sPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.1 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.2 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.3 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.4 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.5 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.6 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.7 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOnTime.8 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.1 = STRING: "Testing Name" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.2 = STRING: "Testing 2" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.3 = STRING: "Outlet 3" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.4 = STRING: "Outlet 4" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.5 = STRING: "Outlet 5" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.6 = STRING: "Outlet 6" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.7 = STRING: "Outlet 7" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletName.8 = STRING: "Outlet 8" */ - { "unmapped.sPDUOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.4.5.2.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.1 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.2 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.3 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.4 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.5 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.6 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.7 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletPowerOffTime.8 = INTEGER: 0 */ - { "unmapped.sPDUOutletPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.1 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.2 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.3 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.4 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.4", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.5 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.5", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.6 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.6", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.7 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.7", NULL, SU_FLAG_OK, NULL }, - /* sPDUOutletRebootDuration.8 = INTEGER: 5 */ - { "unmapped.sPDUOutletRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.4.5.2.1.5.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentName.0 = STRING: "RackPDU" */ - { "unmapped.rPDUIdentName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentHardwareRev.0 = STRING: "B2" */ - { "unmapped.rPDUIdentHardwareRev", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentFirmwareRev.0 = STRING: "v3.7.3" */ - { "unmapped.rPDUIdentFirmwareRev", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDateOfManufacture.0 = STRING: "08/13/2012" */ - { "unmapped.rPDUIdentDateOfManufacture", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentModelNumber.0 = STRING: "AP7900" */ - { "unmapped.rPDUIdentModelNumber", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.5.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentSerialNumber.0 = STRING: "5A1234E00874" */ - { "unmapped.rPDUIdentSerialNumber", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceRating.0 = INTEGER: 12 */ - { "unmapped.rPDUIdentDeviceRating", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.7.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceNumOutlets.0 = INTEGER: 8 */ - { "unmapped.rPDUIdentDeviceNumOutlets", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.8.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceNumPhases.0 = INTEGER: 1 */ - { "input.phases", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.9.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceNumBreakers.0 = INTEGER: 0 */ - { "unmapped.rPDUIdentDeviceNumBreakers", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.10.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceBreakerRating.0 = INTEGER: 0 */ - { "unmapped.rPDUIdentDeviceBreakerRating", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.11.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceOrientation.0 = INTEGER: orientHorizontal(1) */ - { "unmapped.rPDUIdentDeviceOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.12.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceOutletLayout.0 = INTEGER: seqPhaseToNeutral(1) */ - { "unmapped.rPDUIdentDeviceOutletLayout", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.13.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceDisplayOrientation.0 = INTEGER: displayNormal(1) */ - { "unmapped.rPDUIdentDeviceDisplayOrientation", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.14.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDeviceLinetoLineVoltage.0 = INTEGER: 120 */ - { "unmapped.rPDUIdentDeviceLinetoLineVoltage", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.15.0", NULL, SU_FLAG_OK, NULL }, - - /* rPDUIdentDevicePowerFactor.0 = INTEGER: 1000 */ - { "unmapped.rPDUIdentDevicePowerFactor", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.17.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUIdentDevicePowerVA.0 = INTEGER: 0 */ - { "unmapped.rPDUIdentDevicePowerVA", 0, 1, ".1.3.6.1.4.1.318.1.1.12.1.18.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevMaxPhaseLoad.0 = INTEGER: 12 */ - { "unmapped.rPDULoadDevMaxPhaseLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevNumPhases.0 = INTEGER: 1 */ - { "unmapped.rPDULoadDevNumPhases", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevMaxBankLoad.0 = INTEGER: 0 */ - { "unmapped.rPDULoadDevMaxBankLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevNumBanks.0 = INTEGER: 0 */ - { "unmapped.rPDULoadDevNumBanks", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevBankTableSize.0 = INTEGER: 0 */ - { "unmapped.rPDULoadDevBankTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.5.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadDevMaxOutletTableSize.0 = INTEGER: 0 */ - { "unmapped.rPDULoadDevMaxOutletTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.1.7.0", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadPhaseConfigIndex.phase1 = INTEGER: phase1(1) */ - { "unmapped.rPDULoadPhaseConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.2.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadPhaseConfigLowLoadThreshold.phase1 = INTEGER: 0 */ - { "unmapped.rPDULoadPhaseConfigLowLoadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.2.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadPhaseConfigNearOverloadThreshold.phase1 = INTEGER: 8 */ - { "unmapped.rPDULoadPhaseConfigNearOverloadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.2.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadPhaseConfigOverloadThreshold.phase1 = INTEGER: 12 */ - { "unmapped.rPDULoadPhaseConfigOverloadThreshold", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.2.1.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadPhaseConfigAlarm.phase1 = INTEGER: noLoadAlarm(1) */ - { "unmapped.rPDULoadPhaseConfigAlarm", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.2.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadStatusIndex.1 = INTEGER: 1 */ - { "unmapped.rPDULoadStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadStatusLoadState.1 = INTEGER: phaseLoadNormal(1) */ - { "unmapped.rPDULoadStatusLoadState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadStatusPhaseNumber.1 = INTEGER: 1 */ - { "unmapped.rPDULoadStatusPhaseNumber", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* rPDULoadStatusBankNumber.1 = INTEGER: 0 */ - { "unmapped.rPDULoadStatusBankNumber", 0, 1, ".1.3.6.1.4.1.318.1.1.12.2.3.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletDevCommand.0 = INTEGER: noCommandAll(1) */ - { "unmapped.rPDUOutletDevCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletDevColdstartDelay.0 = INTEGER: 0 */ - { "unmapped.rPDUOutletDevColdstartDelay", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletDevNumCntrlOutlets.0 = INTEGER: 8 */ - { "unmapped.rPDUOutletDevNumCntrlOutlets", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletDevNumTotalOutlets.0 = INTEGER: 8 */ - { "unmapped.rPDUOutletDevNumTotalOutlets", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletDevMonitoredOutlets.0 = INTEGER: 0 */ - { "unmapped.rPDUOutletDevMonitoredOutlets", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.1.5.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletPhaseIndex.phase1 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.2.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletPhaseOverloadRestriction.phase1 = INTEGER: alwaysAllowTurnON(1) */ - { "unmapped.rPDUOutletPhaseOverloadRestriction", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.2.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.1 = INTEGER: 1 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.2 = INTEGER: 2 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.3 = INTEGER: 3 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.4 = INTEGER: 4 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.5 = INTEGER: 5 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.6 = INTEGER: 6 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.7 = INTEGER: 7 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlIndex.8 = INTEGER: 8 */ - { "unmapped.rPDUOutletControlIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.1 = STRING: "Testing Name" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.2 = STRING: "Testing 2" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.3 = STRING: "Outlet 3" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.4 = STRING: "Outlet 4" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.5 = STRING: "Outlet 5" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.6 = STRING: "Outlet 6" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.7 = STRING: "Outlet 7" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletName.8 = STRING: "Outlet 8" */ - { "unmapped.rPDUOutletControlOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.1 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.2 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.3 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.4 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.5 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.6 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.7 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletPhase.8 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletControlOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.1 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.2 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.3 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.4 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.5 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.6 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.7 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletCommand.8 = INTEGER: immediateOn(1) */ - { "unmapped.rPDUOutletControlOutletCommand", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.1 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.2 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.3 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.4 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.5 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.6 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.7 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletControlOutletBank.8 = INTEGER: 0 */ - { "unmapped.rPDUOutletControlOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.3.1.1.5.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.1 = INTEGER: 1 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.2 = INTEGER: 2 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.3 = INTEGER: 3 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.4 = INTEGER: 4 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.5 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.6 = INTEGER: 6 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.7 = INTEGER: 7 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigIndex.8 = INTEGER: 8 */ - { "unmapped.rPDUOutletConfigIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.1 = STRING: "Testing Name" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.2 = STRING: "Testing 2" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.3 = STRING: "Outlet 3" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.4 = STRING: "Outlet 4" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.5 = STRING: "Outlet 5" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.6 = STRING: "Outlet 6" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.7 = STRING: "Outlet 7" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletName.8 = STRING: "Outlet 8" */ - { "unmapped.rPDUOutletConfigOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.1 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.2 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.3 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.4 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.5 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.6 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.7 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletPhase.8 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletConfigOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.1 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.2 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.3 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.4 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.5 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.6 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.7 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOnTime.8 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOnTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.1 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.2 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.3 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.4 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.5 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.6 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.7 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigPowerOffTime.8 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigPowerOffTime", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.5.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.1 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.2 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.3 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.4 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.5 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.6 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.7 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigRebootDuration.8 = INTEGER: 5 */ - { "unmapped.rPDUOutletConfigRebootDuration", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.6.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.1 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.2 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.3 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.4 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.5 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.6 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.7 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigOutletBank.8 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.1.1.7.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletConfigMonitoredTableSize.0 = INTEGER: 0 */ - { "unmapped.rPDUOutletConfigMonitoredTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.4.2.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.1 = INTEGER: 1 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.2 = INTEGER: 2 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.3 = INTEGER: 3 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.4 = INTEGER: 4 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.5 = INTEGER: 5 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.6 = INTEGER: 6 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.7 = INTEGER: 7 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusIndex.8 = INTEGER: 8 */ - { "unmapped.rPDUOutletStatusIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.1 = STRING: "Testing Name" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.2 = STRING: "Testing 2" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.3 = STRING: "Outlet 3" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.4 = STRING: "Outlet 4" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.5 = STRING: "Outlet 5" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.6 = STRING: "Outlet 6" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.7 = STRING: "Outlet 7" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletName.8 = STRING: "Outlet 8" */ - { "unmapped.rPDUOutletStatusOutletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.1 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.2 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.3 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.4 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.5 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.6 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.7 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletPhase.8 = INTEGER: phase1(1) */ - { "unmapped.rPDUOutletStatusOutletPhase", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.1 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.2 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.3 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.4 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.5 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.6 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.7 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletState.8 = INTEGER: outletStatusOn(1) */ - { "unmapped.rPDUOutletStatusOutletState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.1 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.2 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.3 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.4 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.5 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.6 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.7 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusCommandPending.8 = INTEGER: outletStatusNoCommandPending(2) */ - { "unmapped.rPDUOutletStatusCommandPending", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.5.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.1 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.2 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.3 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.4 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.5 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.6 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.7 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusOutletBank.8 = INTEGER: 0 */ - { "unmapped.rPDUOutletStatusOutletBank", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.6.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.1 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.2 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.2", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.3 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.3", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.4 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.4", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.5 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.5", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.6 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.6", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.7 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.7", NULL, SU_FLAG_OK, NULL }, - /* rPDUOutletStatusLoad.8 = Gauge32: 0 */ - { "unmapped.rPDUOutletStatusLoad", 0, 1, ".1.3.6.1.4.1.318.1.1.12.3.5.1.1.7.8", NULL, SU_FLAG_OK, NULL }, - /* rPDUPowerSupply1Status.0 = INTEGER: powerSupplyOneOk(1) */ - { "unmapped.rPDUPowerSupply1Status", 0, 1, ".1.3.6.1.4.1.318.1.1.12.4.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUPowerSupply2Status.0 = INTEGER: powerSupplyTwoOk(1) */ - { "unmapped.rPDUPowerSupply2Status", 0, 1, ".1.3.6.1.4.1.318.1.1.12.4.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUPowerSupplyAlarm.0 = INTEGER: allAvailablePowerSuppliesOK(1) */ - { "unmapped.rPDUPowerSupplyAlarm", 0, 1, ".1.3.6.1.4.1.318.1.1.12.4.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusBankTableSize.0 = INTEGER: 0 */ - { "unmapped.rPDUStatusBankTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusPhaseTableSize.0 = INTEGER: 1 */ - { "unmapped.rPDUStatusPhaseTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.3.0", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusPhaseIndex.1 = INTEGER: 1 */ - { "unmapped.rPDUStatusPhaseIndex", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusPhaseNumber.1 = INTEGER: 1 */ - { "unmapped.rPDUStatusPhaseNumber", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusPhaseState.1 = INTEGER: phaseLoadNormal(1) */ - { "unmapped.rPDUStatusPhaseState", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* rPDUStatusOutletTableSize.0 = INTEGER: 0 */ - { "unmapped.rPDUStatusOutletTableSize", 0, 1, ".1.3.6.1.4.1.318.1.1.12.5.5.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.1.0 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.1.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.1.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.2.1 = STRING: "Rack PDU_ISX" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.3.1 = STRING: "5A1234E00874" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.4.1 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.5.1 = STRING: "Rack PDU" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.6.1 = STRING: "1" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.7.1 = STRING: "Unknown" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.8.1 = INTEGER: 255 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.8.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.9.1 = STRING: "RackPDU" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.9.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.10.1 = INTEGER: 255 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.10.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.11.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.11.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.12.1 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.12.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.13.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.2.1.13.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.2.1.14.1 = STRING: "SB-1" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.2.1.14.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.3.0 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.3.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.1.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.1.2 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.4.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.2.1 = STRING: "5A1234E00874" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.2.2 = STRING: "5A1234E00874" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.3.1 = STRING: "apc_hw02_aos_373.bin" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.3.2 = STRING: "apc_hw02_rpdu_373.bin" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.4.1 = STRING: "v3.7.3" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.4.1.4.2 = STRING: "v3.7.3" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.4.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.5.0 = INTEGER: 19 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.5.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.2 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.3 = INTEGER: 3 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.4 = INTEGER: 4 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.5 = INTEGER: 5 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.6 = INTEGER: 6 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.7 = INTEGER: 7 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.8 = INTEGER: 8 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.9 = INTEGER: 9 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.10 = INTEGER: 10 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.11 = INTEGER: 11 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.12 = INTEGER: 12 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.13 = INTEGER: 13 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.13", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.14 = INTEGER: 14 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.14", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.15 = INTEGER: 15 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.15", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.16 = INTEGER: 16 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.16", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.17 = INTEGER: 17 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.17", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.18 = INTEGER: 18 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.18", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.1.19 = INTEGER: 19 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.1.19", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.2 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.3 = INTEGER: 3 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.4 = INTEGER: 4 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.5 = INTEGER: 5 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.6 = INTEGER: 6 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.7 = INTEGER: 7 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.8 = INTEGER: 8 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.9 = INTEGER: 9 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.10 = INTEGER: 10 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.11 = INTEGER: 11 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.12 = INTEGER: 12 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.13 = INTEGER: 13 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.13", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.14 = INTEGER: 14 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.14", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.15 = INTEGER: 15 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.15", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.16 = INTEGER: 16 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.16", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.17 = INTEGER: 17 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.17", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.18 = INTEGER: 18 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.18", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.2.19 = INTEGER: 19 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.2.19", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.1 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.2 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.3 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.4 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.5 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.6 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.7 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.8 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.9 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.10 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.11 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.12 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.13 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.13", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.14 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.14", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.15 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.15", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.16 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.16", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.17 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.17", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.18 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.18", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.3.19 = STRING: "0" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.3.19", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.1 = STRING: "MTYx" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.2 = STRING: "MjM=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.3 = STRING: "ODA=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.4 = STRING: "OTk1MA==" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.5 = STRING: "OTk1MA==" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.6 = STRING: "NDQz" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.7 = STRING: "MjI=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.8 = STRING: "MjI=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.9 = STRING: "MTIz" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.10 = STRING: "MjU=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.11 = STRING: "MjE=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.12 = STRING: "MjE=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.13 = STRING: "Njg=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.13", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.14 = STRING: "NTQ2" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.14", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.15 = STRING: "MTgxMg==" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.15", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.16 = STRING: "MTYx" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.16", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.17 = STRING: "MjE=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.17", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.18 = STRING: "MjE=" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.18", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.4.19 = STRING: "OTk1MQ==" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.6.1.4.19", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.1 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.2 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.3 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.4 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.5 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.6 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.7 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.8 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.9 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.10 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.11 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.12 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.13 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.13", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.14 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.14", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.15 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.15", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.16 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.16", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.17 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.17", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.18 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.18", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.6.1.5.19 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.6.1.5.19", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.7.0 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.7.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.1.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.8.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.2.1 = STRING: "power" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.8.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.3.1 = STRING: "pdu" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.8.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.4.1 = STRING: "rpdu" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.8.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.5.1 = STRING: "version7" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.2.8.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.8.1.6.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.8.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.9.0 = INTEGER: 0 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.9.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.10.0 = INTEGER: 0 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.10.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.2.12.0 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.2.12.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.4.1.0 = INTEGER: 0 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.4.1.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.4.3.0 = STRING: ",<1 digit type identifier>" */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.4.3.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.4.4.0 = INTEGER: 0 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.4.4.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.1.0 = INTEGER: 12 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.1 = INTEGER: 1 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.2 = INTEGER: 2 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.3 = INTEGER: 3 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.4 = INTEGER: 4 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.5 = INTEGER: 5 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.6 = INTEGER: 6 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.7 = INTEGER: 7 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.8 = INTEGER: 8 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.9 = INTEGER: 9 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.10 = INTEGER: 10 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.11 = INTEGER: 11 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.1.12 = INTEGER: 12 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.1.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.1 = INTEGER: 3841 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.2 = INTEGER: 3843 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.3 = INTEGER: 3845 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.4 = INTEGER: 3848 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.5 = INTEGER: 3862 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.6 = INTEGER: 3864 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.7 = INTEGER: 3856 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.8 = INTEGER: 3858 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.9 = INTEGER: 3860 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.9", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.10 = INTEGER: 3871 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.10", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.11 = INTEGER: 3873 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.11", NULL, SU_FLAG_OK, NULL }, - /* experimental.5.2.1.2.12 = INTEGER: 3875 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.5.2.1.2.12", NULL, SU_FLAG_OK, NULL }, - /* experimental.6.1.1.0 = Hex-STRING: 07 00 00 00 */ - { "unmapped.experimental", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.318.1.4.6.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.7.1.0 = INTEGER: 4 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.7.1.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.7.3.0 = INTEGER: 4 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.7.3.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.7.4.0 = INTEGER: 3 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.7.4.0", NULL, SU_FLAG_OK, NULL }, - /* experimental.7.5.0 = INTEGER: 3 */ - { "unmapped.experimental", 0, 1, ".1.3.6.1.4.1.318.1.4.7.5.0", NULL, SU_FLAG_OK, NULL }, -#endif /* scan result */ - - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t apc_pdu_rpdu = { "apc_pdu", APC_PDU_MIB_VERSION, NULL, APC_PDU_DEVICE_MODEL, apc_pdu_mib, APC_PDU_MIB_SYSOID_RPDU, NULL }; -mib2nut_info_t apc_pdu_rpdu2 = { "apc_pdu", APC_PDU_MIB_VERSION, NULL, APC_PDU_DEVICE_MODEL, apc_pdu_mib, APC_PDU_MIB_SYSOID_RPDU2, NULL }; -mib2nut_info_t apc_pdu_msp = { "apc_pdu", APC_PDU_MIB_VERSION, NULL, APC_PDU_DEVICE_MODEL, apc_pdu_mib, APC_PDU_MIB_SYSOID_MSP, NULL }; diff --git a/drivers/apc-pdu-mib.h b/drivers/apc-pdu-mib.h deleted file mode 100644 index 224330a..0000000 --- a/drivers/apc-pdu-mib.h +++ /dev/null @@ -1,31 +0,0 @@ -/* powernet-mib-mib.h - subdriver to monitor PowerNet-MIB SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef APC_PDU_MIB_H -#define APC_PDU_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t apc_pdu_rpdu; -extern mib2nut_info_t apc_pdu_rpdu2; -extern mib2nut_info_t apc_pdu_msp; - -#endif /* APC_PDU_MIB_H */ diff --git a/drivers/apcsmart-old.c b/drivers/apcsmart-old.c index 0a2f451..5c06372 100644 --- a/drivers/apcsmart-old.c +++ b/drivers/apcsmart-old.c @@ -22,10 +22,9 @@ #include "main.h" #include "serial.h" #include "apcsmart-old.h" -#include "nut_stdint.h" #define DRIVER_NAME "APC Smart protocol driver" -#define DRIVER_VERSION "2.2" +#define DRIVER_VERSION "2.1" static upsdrv_info_t table_info = { "APC command table", @@ -78,7 +77,7 @@ static apc_vartab_t *vartab_lookup_name(const char *var) static const char *convert_data(apc_vartab_t *cmd_entry, const char *upsval) { static char tmp[128]; - long tval; + int tval; switch(cmd_entry->flags & APC_FORMATMASK) { case APC_F_PERCENT: @@ -98,14 +97,14 @@ static const char *convert_data(apc_vartab_t *cmd_entry, const char *upsval) tval = 60 * 60 * strtol(upsval, NULL, 10); - snprintf(tmp, sizeof(tmp), "%ld", tval); + snprintf(tmp, sizeof(tmp), "%d", tval); return tmp; case APC_F_MINUTES: /* Convert to seconds - NUT standard time measurement */ tval = 60 * strtol(upsval, NULL, 10); /* Ignore errors - Theres not much we can do */ - snprintf(tmp, sizeof(tmp), "%ld", tval); + snprintf(tmp, sizeof(tmp), "%d", tval); return tmp; case APC_F_REASON: @@ -198,9 +197,9 @@ static void alert_handler(char ch) ups_status_set(); } -static ssize_t read_buf(char *buf, size_t buflen) +static int read_buf(char *buf, size_t buflen) { - ssize_t ret; + int ret; ret = ser_get_line_alert(upsfd, buf, buflen, ENDCHAR, POLL_IGNORE, POLL_ALERT, alert_handler, SER_WAIT_SEC, SER_WAIT_USEC); @@ -214,9 +213,9 @@ static ssize_t read_buf(char *buf, size_t buflen) return ret; } -static ssize_t poll_data(apc_vartab_t *vt) +static int poll_data(apc_vartab_t *vt) { - ssize_t ret; + int ret; char tmp[SMALLBUF]; if ((vt->flags & APC_PRESENT) == 0) @@ -252,7 +251,7 @@ static ssize_t poll_data(apc_vartab_t *vt) /* check for support or just update a named variable */ static int query_ups(const char *var, int first) { - ssize_t ret; + int ret; char temp[256]; const char *ptr; apc_vartab_t *vt; @@ -271,7 +270,7 @@ static int query_ups(const char *var, int first) return 0; /* empty the input buffer (while allowing the alert handler to run) */ - ret = ser_get_line_alert(upsfd, temp, sizeof(temp), ENDCHAR, + ret = ser_get_line_alert(upsfd, temp, sizeof(temp), ENDCHAR, POLL_IGNORE, POLL_ALERT, alert_handler, 0, 0); ret = ser_send_char(upsfd, vt->cmd); @@ -281,7 +280,7 @@ static int query_ups(const char *var, int first) return 0; } - ret = ser_get_line_alert(upsfd, temp, sizeof(temp), ENDCHAR, + ret = ser_get_line_alert(upsfd, temp, sizeof(temp), ENDCHAR, POLL_IGNORE, POLL_ALERT, alert_handler, SER_WAIT_SEC, SER_WAIT_USEC); @@ -306,9 +305,7 @@ static void do_capabilities(void) { const char *ptr, *entptr; char upsloc, temp[512], cmd, loc, etmp[16], *endtemp; - int matrix, valid; - size_t i, nument, entlen; - ssize_t ret; + int nument, entlen, i, matrix, ret, valid; apc_vartab_t *vt; upsdebugx(1, "APC - About to get capabilities string"); @@ -330,7 +327,7 @@ static void do_capabilities(void) } /* note different IGN set since ^Z returns things like # */ - ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, MINIGNCHARS, SER_WAIT_SEC, SER_WAIT_USEC); if ((ret < 1) || (!strcmp(temp, "NA"))) { @@ -350,7 +347,7 @@ static void do_capabilities(void) if (temp[0] != '#') { upsdebugx(1, "Unrecognized capability start char %c", temp[0]); upsdebugx(1, "Please report this error [%s]", temp); - upslogx(LOG_ERR, "ERROR: unknown capability start char %c!", + upslogx(LOG_ERR, "ERROR: unknown capability start char %c!", temp[0]); return; @@ -378,7 +375,7 @@ static void do_capabilities(void) if (quirk_capability_overflow) return; - fatalx(EXIT_FAILURE, + fatalx(EXIT_FAILURE, "Capability string has overflowed\n" "Please report this error\n" "ERROR: capability overflow!" @@ -387,17 +384,8 @@ static void do_capabilities(void) cmd = ptr[0]; loc = ptr[1]; - if (ptr[2] < 48 || ptr[3] < 48) { - upsdebugx(0, - "%s: nument (%d) or entlen (%d) out of range", - __func__, (ptr[2] - 48), (ptr[3] - 48)); - fatalx(EXIT_FAILURE, - "nument or entlen out of range\n" - "Please report this error\n" - "ERROR: capability overflow!"); - } - nument = (size_t)ptr[2] - 48; - entlen = (size_t)ptr[3] - 48; + nument = ptr[2] - 48; + entlen = ptr[3] - 48; entptr = &ptr[4]; vt = vartab_lookup_char(cmd); @@ -405,7 +393,7 @@ static void do_capabilities(void) /* mark this as writable */ if (valid) { - upsdebugx(1, "Supported capability: %02x (%c) - %s", + upsdebugx(1, "Supported capability: %02x (%c) - %s", cmd, loc, vt->name); dstate_setflags(vt->name, ST_FLAG_RW); @@ -429,7 +417,7 @@ static void do_capabilities(void) static int update_status(void) { - ssize_t ret; + int ret; char buf[SMALLBUF]; upsdebugx(4, "update_status"); @@ -461,7 +449,7 @@ static int update_status(void) static void oldapcsetup(void) { - ssize_t ret = 0; + int ret = 0; /* really old models ignore REQ_MODEL, so find them first */ ret = query_ups("ups.model", 1); @@ -504,7 +492,7 @@ static void protocol_verify(unsigned char cmd) /* handle special data for our two strings */ if (apc_vartab[i].flags & APC_STRING) { - dstate_setflags(apc_vartab[i].name, + dstate_setflags(apc_vartab[i].name, ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux(apc_vartab[i].name, APC_STRLEN); @@ -536,8 +524,8 @@ static void protocol_verify(unsigned char cmd) if (found) return; - if (isprint((size_t)cmd)) - upsdebugx(1, "protocol_verify: 0x%02x [%c] unrecognized", + if (isprint(cmd)) + upsdebugx(1, "protocol_verify: 0x%02x [%c] unrecognized", cmd, cmd); else upsdebugx(1, "protocol_verify: 0x%02x unrecognized", cmd); @@ -546,7 +534,7 @@ static void protocol_verify(unsigned char cmd) /* some hardware is a special case - hotwire the list of cmdchars */ static int firmware_table_lookup(void) { - ssize_t ret; + int ret; unsigned int i, j; char buf[SMALLBUF]; @@ -559,7 +547,7 @@ static int firmware_table_lookup(void) return 0; } - ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, IGNCHARS, + ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, IGNCHARS, SER_WAIT_SEC, SER_WAIT_USEC); /* @@ -606,22 +594,21 @@ static int firmware_table_lookup(void) /* matched - run the cmdchars from the table */ for (j = 0; j < strlen(compat_tab[i].cmdchars); j++) - protocol_verify((const unsigned char)(compat_tab[i].cmdchars[j])); + protocol_verify(compat_tab[i].cmdchars[j]); return 1; /* matched */ } } upsdebugx(2, "Not found in table - trying normal method"); - return 0; + return 0; } static void getbaseinfo(void) { unsigned int i; - ssize_t ret = 0; - char *alrts, temp[512]; - unsigned char *cmds; + int ret = 0; + char *alrts, *cmds, temp[512]; /* * try firmware lookup first; we could start with 'a', but older models @@ -643,7 +630,7 @@ static void getbaseinfo(void) return; } - ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, SER_WAIT_SEC, SER_WAIT_USEC); if ((ret < 1) || (!strcmp(temp, "NA"))) { @@ -665,17 +652,17 @@ static void getbaseinfo(void) } *alrts++ = 0; - cmds = (unsigned char*)strchr(alrts, '.'); + cmds = strchr(alrts, '.'); if (cmds == NULL) { fatalx(EXIT_FAILURE, "Unable to find APC command string"); } *cmds++ = 0; - for (i = 0; i < strlen((char *)cmds); i++) + for (i = 0; i < strlen(cmds); i++) protocol_verify(cmds[i]); /* if capabilities are supported, add them here */ - if (strchr((char *)cmds, APC_CAPABILITY)) + if (strchr(cmds, APC_CAPABILITY)) do_capabilities(); upsdebugx(1, "APC - UPS capabilities determined"); @@ -685,8 +672,7 @@ static void getbaseinfo(void) static int do_cal(int start) { char temp[256]; - long tval; - ssize_t ret; + int tval, ret; ret = ser_send_char(upsfd, APC_STATUS); @@ -724,7 +710,7 @@ static int do_cal(int start) ret = read_buf(temp, sizeof(temp)); if ((ret < 1) || (!strcmp(temp, "NA")) || (!strcmp(temp, "NO"))) { - upslogx(LOG_WARNING, "Stop calibration failed: %s", + upslogx(LOG_WARNING, "Stop calibration failed: %s", temp); return STAT_INSTCMD_HANDLED; /* FUTURE: failure */ } @@ -761,8 +747,7 @@ static int do_cal(int start) /* get the UPS talking to us in smart mode */ static int smartmode(void) { - ssize_t ret; - int tries; + int ret, tries; char temp[256]; for (tries = 0; tries < 5; tries++) { @@ -774,7 +759,7 @@ static int smartmode(void) return 0; } - ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, SER_WAIT_SEC, SER_WAIT_USEC); if (ret > 0) @@ -793,7 +778,7 @@ static int smartmode(void) } /* eat the response (might be NA, might be something else) */ - ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS, SER_WAIT_SEC, SER_WAIT_USEC); } @@ -803,7 +788,7 @@ static int smartmode(void) /* * all shutdown commands should respond with 'OK' or '*' */ -static long sdok(void) +static int sdok(void) { char temp[16]; @@ -820,10 +805,8 @@ static long sdok(void) } /* soft hibernate: S - working only when OB, otherwise ignored */ -static long sdcmd_S(long dummy) +static int sdcmd_S(int dummy) { - NUT_UNUSED_VARIABLE(dummy); - ser_flush_in(upsfd, IGNCHARS, nut_debug_level); upsdebugx(1, "Issuing soft hibernate"); @@ -833,7 +816,7 @@ static long sdcmd_S(long dummy) } /* soft hibernate, hack version for CS 350 */ -static long sdcmd_CS(long tval) +static int sdcmd_CS(int tval) { upsdebugx(1, "Using CS 350 'force OB' shutdown method"); if (tval & APC_STAT_OL) { @@ -849,10 +832,9 @@ static long sdcmd_CS(long tval) * note: works differently for older and new models, see help function for * detailed info */ -static long sdcmd_ATn(long cnt) +static int sdcmd_ATn(int cnt) { - long n = 0; - long mmax, ret; + int n = 0, mmax, ret; const char *strval; char timer[4]; @@ -865,13 +847,10 @@ static long sdcmd_ATn(long cnt) n = 0; } - if (cnt > INT_MAX || cnt < 0) { - fatalx(EXIT_FAILURE, "Error: %s: cnt (%ld) is out of range", __func__, cnt); - } - snprintf(timer, sizeof(timer), "%.*ld", (int)cnt, n); + snprintf(timer, sizeof(timer), "%.*d", cnt, n); ser_flush_in(upsfd, IGNCHARS, nut_debug_level); - upsdebugx(1, "Issuing hard hibernate with %ld minutes additional wakeup delay", n*6); + upsdebugx(1, "Issuing hard hibernate with %d minutes additional wakeup delay", n*6); ser_send_char(upsfd, APC_CMD_GRACEDOWN); usleep(CMDLONGDELAY); @@ -895,10 +874,8 @@ static long sdcmd_ATn(long cnt) } /* shutdown: K - delayed poweroff */ -static long sdcmd_K(long dummy) +static int sdcmd_K(int dummy) { - NUT_UNUSED_VARIABLE(dummy); - ser_flush_in(upsfd, IGNCHARS, nut_debug_level); upsdebugx(1, "Issuing delayed poweroff"); @@ -910,10 +887,8 @@ static long sdcmd_K(long dummy) } /* shutdown: Z - immediate poweroff */ -static long sdcmd_Z(long dummy) +static int sdcmd_Z(int dummy) { - NUT_UNUSED_VARIABLE(dummy); - ser_flush_in(upsfd, IGNCHARS, nut_debug_level); upsdebugx(1, "Issuing immediate poweroff"); @@ -924,7 +899,7 @@ static long sdcmd_Z(long dummy) return sdok(); } -static long (*sdlist[])(long) = { +static int (*sdlist[])(int) = { sdcmd_S, sdcmd_ATn, /* for @nnn version */ sdcmd_K, @@ -942,9 +917,9 @@ static long (*sdlist[])(long) = { #define SDCNT 6 -static void upsdrv_shutdown_simple(long status) +static void upsdrv_shutdown_simple(int status) { - long sdtype = 0; + unsigned int sdtype = 0; char *strval; if ((strval = getval("sdtype"))) { @@ -1000,7 +975,7 @@ static void upsdrv_shutdown_simple(long status) } } -static void upsdrv_shutdown_advanced(long status) +static void upsdrv_shutdown_advanced(int status) { const char *strval; const char deforder[] = {48 + SDIDX_S, @@ -1009,7 +984,7 @@ static void upsdrv_shutdown_advanced(long status) 48 + SDIDX_Z, 0}; size_t i; - long n; + int n; strval = getval("advorder"); @@ -1051,8 +1026,7 @@ static void upsdrv_shutdown_advanced(long status) void upsdrv_shutdown(void) { char temp[32]; - ssize_t ret; - long status; + int ret, status; if (!smartmode()) upsdebugx(1, "SM detection failed. Trying a shutdown command anyway"); @@ -1092,7 +1066,7 @@ static void init_serial_0095B(void) static void update_info_normal(void) { - size_t i; + int i; upsdebugx(3, "update_info_normal: starting"); @@ -1112,7 +1086,7 @@ static void update_info_normal(void) static void update_info_all(void) { - size_t i; + int i; upsdebugx(3, "update_info_all: starting"); @@ -1129,8 +1103,7 @@ static void update_info_all(void) static int setvar_enum(apc_vartab_t *vt, const char *val) { - int i; - ssize_t ret; + int i, ret; char orig[256], temp[256]; const char *ptr; @@ -1210,7 +1183,7 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) vt->name); return STAT_SET_HANDLED; /* FUTURE: failed */ - } + } } upslogx(LOG_ERR, "setvar: gave up after 6 tries for %s", @@ -1224,8 +1197,8 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) static int setvar_string(apc_vartab_t *vt, const char *val) { - size_t i; - ssize_t ret; + unsigned int i; + int ret; char temp[256]; ser_flush_in(upsfd, IGNCHARS, nut_debug_level); @@ -1259,7 +1232,7 @@ static int setvar_string(apc_vartab_t *vt, const char *val) usleep(UPSDELAY); for (i = 0; i < strlen(val); i++) { - ret = ser_send_char(upsfd, (const unsigned char)(val[i])); + ret = ser_send_char(upsfd, val[i]); if (ret != 1) { upslog_with_errno(LOG_ERR, "setvar_string: ser_send_char failed"); @@ -1328,7 +1301,7 @@ static int setvar(const char *varname, const char *val) /* actually send the instcmd's char to the ups */ static int do_cmd(apc_cmdtab_t *ct) { - ssize_t ret; + int ret; char buf[SMALLBUF]; ser_flush_in(upsfd, IGNCHARS, nut_debug_level); @@ -1401,14 +1374,13 @@ static int instcmd(const char *cmdname, const char *extra) ct = &apc_cmdtab[i]; if (!ct) { - upslogx(LOG_WARNING, "instcmd: unknown command [%s] [%s]", - cmdname, extra); + upslogx(LOG_WARNING, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } if ((ct->flags & APC_PRESENT) == 0) { - upslogx(LOG_WARNING, "instcmd: command [%s] [%s] is not supported", - cmdname, extra); + upslogx(LOG_WARNING, "instcmd: command [%s] is not supported", + cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -1423,7 +1395,7 @@ static int instcmd(const char *cmdname, const char *extra) /* nothing special here */ return do_cmd(ct); -} +} /* install pointers to functions for msg handlers called from msgparse */ static void setuphandlers(void) @@ -1467,7 +1439,7 @@ void upsdrv_initinfo(void) const char *pmod, *pser; if (!smartmode()) { - fatalx(EXIT_FAILURE, + fatalx(EXIT_FAILURE, "Unable to detect an APC Smart protocol UPS on port %s\n" "Check the cabling, port name or model name and try again", device_path ); diff --git a/drivers/apcsmart-old.h b/drivers/apcsmart-old.h index 6c24da7..f143cfa 100644 --- a/drivers/apcsmart-old.h +++ b/drivers/apcsmart-old.h @@ -18,9 +18,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_APCSMART_OLD_H_SEEN -#define NUT_APCSMART_OLD_H_SEEN 1 - #include #include #include "serial.h" @@ -60,14 +57,14 @@ /* status bits */ -#define APC_STAT_CAL 1L /* calibration */ -#define APC_STAT_TRIM 2L /* SmartTrim */ -#define APC_STAT_BOOST 4L /* SmartBoost */ -#define APC_STAT_OL 8L /* on line */ -#define APC_STAT_OB 16L /* on battery */ -#define APC_STAT_OVER 32L /* overload */ -#define APC_STAT_LB 64L /* low battery */ -#define APC_STAT_RB 128L /* replace battery */ +#define APC_STAT_CAL 1 /* calibration */ +#define APC_STAT_TRIM 2 /* SmartTrim */ +#define APC_STAT_BOOST 4 /* SmartBoost */ +#define APC_STAT_OL 8 /* on line */ +#define APC_STAT_OB 16 /* on battery */ +#define APC_STAT_OVER 32 /* overload */ +#define APC_STAT_LB 64 /* low battery */ +#define APC_STAT_RB 128 /* replace battery */ /* serial protocol: special commands - initialization and such */ #define APC_STATUS 'Q' @@ -108,10 +105,10 @@ typedef struct { const char *name; /* the variable name */ unsigned int flags; /* various flags */ - unsigned char cmd; /* command character */ + char cmd; /* command character */ } apc_vartab_t; -static apc_vartab_t apc_vartab[] = { +apc_vartab_t apc_vartab[] = { { "ups.firmware.old", 0, 'V' }, { "ups.firmware", 0, 'b' }, @@ -144,7 +141,7 @@ static apc_vartab_t apc_vartab[] = { { "input.transfer.low", APC_F_VOLT, 'l' }, { "input.transfer.high", APC_F_VOLT, 'u' }, - { "input.transfer.reason", + { "input.transfer.reason", APC_POLL|APC_F_REASON, 'G' }, { "input.voltage.maximum", @@ -154,30 +151,30 @@ static apc_vartab_t apc_vartab[] = { { "output.current", APC_POLL|APC_F_AMP, '/' }, { "output.voltage", APC_POLL|APC_F_VOLT, 'O' }, - { "output.voltage.nominal", + { "output.voltage.nominal", APC_F_VOLT, 'o' }, { "ambient.humidity", APC_POLL|APC_F_PERCENT, 'h' }, - { "ambient.humidity.high", + { "ambient.humidity.high", APC_F_PERCENT, '{' }, - { "ambient.humidity.low", + { "ambient.humidity.low", APC_F_PERCENT, '}' }, - { "ambient.temperature", + { "ambient.temperature", APC_POLL|APC_F_CELSIUS, 't' }, - { "ambient.temperature.high", + { "ambient.temperature.high", APC_F_CELSIUS, '[' }, - { "ambient.temperature.low", + { "ambient.temperature.low", APC_F_CELSIUS, ']' }, { "battery.date", APC_STRING, 'x' }, { "battery.charge", APC_POLL|APC_F_PERCENT, 'f' }, - { "battery.charge.restart", + { "battery.charge.restart", APC_F_PERCENT, 'e' }, { "battery.voltage", APC_POLL|APC_F_VOLT, 'B' }, - { "battery.voltage.nominal", + { "battery.voltage.nominal", 0, 'g' }, { "battery.runtime", APC_POLL|APC_F_MINUTES, 'j' }, @@ -186,7 +183,7 @@ static apc_vartab_t apc_vartab[] = { { "battery.packs", APC_F_DEC, '>' }, { "battery.packs.bad", APC_F_DEC, '<' }, - { "battery.alarm.threshold", + { "battery.alarm.threshold", 0, 'k' }, /* todo: @@ -218,10 +215,10 @@ static apc_vartab_t apc_vartab[] = { typedef struct { const char *name; int flags; - unsigned char cmd; + char cmd; } apc_cmdtab_t; -static apc_cmdtab_t apc_cmdtab[] = +apc_cmdtab_t apc_cmdtab[] = { { "load.off", APC_NASTY|APC_REPEAT, APC_CMD_OFF }, { "load.on", APC_REPEAT, APC_CMD_ON }, @@ -249,7 +246,7 @@ static apc_cmdtab_t apc_cmdtab[] = /* compatibility with hardware that doesn't do APC_CMDSET ('a') */ -static struct { +struct { const char *firmware; const char *cmdchars; int flags; @@ -292,5 +289,3 @@ static struct { { NULL, NULL, 0 }, }; - -#endif /* NUT_APCSMART_OLD_H_SEEN */ diff --git a/drivers/apcsmart.c b/drivers/apcsmart.c index bb82e19..018b29d 100644 --- a/drivers/apcsmart.c +++ b/drivers/apcsmart.c @@ -20,17 +20,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "main.h" /* Must be first, includes "config.h" */ - #include #include #include #include #include /* strcasecmp() */ +#include "main.h" #include "serial.h" #include "timehead.h" -#include "nut_stdint.h" #include "apcsmart.h" #include "apcsmart_tabs.h" @@ -46,7 +44,7 @@ upsdrv_info_t upsdrv_info = { { &apc_tab_info, NULL } }; -static long ups_status = 0; +static int ups_status = 0; /* some forwards */ @@ -111,7 +109,7 @@ static const char *prtchr(char x) static char info[32]; curr = (curr + 8) & 0x1F; - snprintf(info + curr, 8, isprint((size_t)x) ? "%c" : "0x%02x", x); + snprintf(info + curr, 8, isprint(x) ? "%c" : "0x%02x", x); return info + curr; } @@ -137,11 +135,11 @@ static int rexhlp(const char *rex, const char *val) static const char *convert_data(apc_vartab_t *vt, const char *upsval) { static char temp[APC_LBUF]; - long tval; + int tval; /* this should never happen */ if (strlen(upsval) >= sizeof(temp)) { - upslogx(LOG_CRIT, "%s: the length of [%s] is too big", __func__, vt->name); + logx(LOG_CRIT, "the length of [%s] is too big", vt->name); memcpy(temp, upsval, sizeof(temp) - 1); temp[sizeof(temp) - 1] = '\0'; return temp; @@ -165,14 +163,14 @@ static const char *convert_data(apc_vartab_t *vt, const char *upsval) tval = 60 * 60 * strtol(upsval, NULL, 10); - snprintf(temp, sizeof(temp), "%ld", tval); + snprintf(temp, sizeof(temp), "%d", tval); return temp; case APC_F_MINUTES: /* Convert to seconds - NUT standard time measurement */ tval = 60 * strtol(upsval, NULL, 10); /* Ignore errors - there's not much we can do */ - snprintf(temp, sizeof(temp), "%ld", tval); + snprintf(temp, sizeof(temp), "%d", tval); return temp; case APC_F_REASON: @@ -190,7 +188,7 @@ static const char *convert_data(apc_vartab_t *vt, const char *upsval) } /* this should never happen */ - upslogx(LOG_CRIT, "%s: unable to convert [%s]", __func__, vt->name); + logx(LOG_CRIT, "unable to convert [%s]", vt->name); strcpy(temp, upsval); return temp; } @@ -246,17 +244,17 @@ static void apc_ser_diff(struct termios *tioset, struct termios *tioget) { "susp", VSUSP }, { "time", VTIME }, { "werase", VWERASE }, - { NULL, 0 }, + { NULL }, }, *cp; /* clear status flags so that they don't affect our binary compare */ #if defined(PENDIN) || defined(FLUSHO) for (i = 0; i < sizeof(tio)/sizeof(tio[0]); i++) { #ifdef PENDIN - tio[i]->c_lflag &= ~(unsigned int)PENDIN; + tio[i]->c_lflag &= ~PENDIN; #endif #ifdef FLUSHO - tio[i]->c_lflag &= ~(unsigned int)FLUSHO; + tio[i]->c_lflag &= ~FLUSHO; #endif } #endif /* defined(PENDIN) || defined(FLUSHO) */ @@ -298,9 +296,9 @@ static void apc_ser_set(void) val = getval("cable"); if (val && !strcasecmp(val, ALT_CABLE_1)) { if (ser_set_dtr(upsfd, 1) == -1) - fatalx(EXIT_FAILURE, "%s: ser_set_dtr(%s) failed", __func__, device_path); + fatx("ser_set_dtr(%s) failed", device_path); if (ser_set_rts(upsfd, 0) == -1) - fatalx(EXIT_FAILURE, "%s: ser_set_rts(%s) failed", __func__, device_path); + fatx("ser_set_rts(%s) failed", device_path); } /* @@ -315,7 +313,7 @@ static void apc_ser_set(void) errno = 0; if (tcgetattr(upsfd, &tio)) - fatal_with_errno(EXIT_FAILURE, "%s: tcgetattr(%s)", __func__, device_path); + fate("tcgetattr(%s)", device_path); /* set port mode: common stuff, canonical processing */ @@ -325,10 +323,10 @@ static void apc_ser_set(void) #ifdef NOKERNINFO tio.c_lflag |= NOKERNINFO; #endif - tio.c_lflag &= ~(unsigned int)(ISIG | IEXTEN); + tio.c_lflag &= ~(ISIG | IEXTEN); tio.c_iflag |= (IGNCR | IGNPAR); - tio.c_iflag &= ~(unsigned int)(IXON | IXOFF); + tio.c_iflag &= ~(IXON | IXOFF); tio.c_cc[VEOL] = '*'; /* specially handled in apc_read() */ #ifdef _POSIX_VDISABLE @@ -339,7 +337,7 @@ static void apc_ser_set(void) #endif if (tcflush(upsfd, TCIOFLUSH)) - fatal_with_errno(EXIT_FAILURE, "%s: tcflush(%s)", __func__, device_path); + fate("tcflush(%s)", device_path); /* * warn: @@ -348,11 +346,11 @@ static void apc_ser_set(void) * test. */ if (tcsetattr(upsfd, TCSANOW, &tio)) - fatal_with_errno(EXIT_FAILURE, "%s: tcsetattr(%s)", __func__, device_path); + fate("tcsetattr(%s)", device_path); memset(&tio_chk, 0, sizeof(tio_chk)); if (tcgetattr(upsfd, &tio_chk)) - fatal_with_errno(EXIT_FAILURE, "%s: tcgetattr(%s)", __func__, device_path); + fate("tcgetattr(%s)", device_path); apc_ser_diff(&tio, &tio_chk); } @@ -387,44 +385,44 @@ static void alert_handler(char ch) { switch (ch) { case '!': /* clear OL, set OB */ - upsdebugx(1, "%s: %s", __func__, "OB"); + debx(1, "OB"); ups_status &= ~APC_STAT_OL; ups_status |= APC_STAT_OB; break; case '$': /* clear OB, set OL */ - upsdebugx(1, "%s: %s", __func__, "OL"); + debx(1, "OL"); ups_status &= ~APC_STAT_OB; ups_status |= APC_STAT_OL; break; case '%': /* set LB */ - upsdebugx(1, "%s: %s", __func__, "LB"); + debx(1, "LB"); ups_status |= APC_STAT_LB; break; case '+': /* clear LB */ - upsdebugx(1, "%s: %s", __func__, "not LB"); + debx(1, "not LB"); ups_status &= ~APC_STAT_LB; break; case '#': /* set RB */ - upsdebugx(1, "%s: %s", __func__, "RB"); + debx(1, "RB"); ups_status |= APC_STAT_RB; break; case '?': /* set OVER */ - upsdebugx(1, "%s: %s", __func__, "OVER"); + debx(1, "OVER"); ups_status |= APC_STAT_OVER; break; case '=': /* clear OVER */ - upsdebugx(1, "%s: %s", __func__, "not OVER"); + debx(1, "not OVER"); ups_status &= ~APC_STAT_OVER; break; default: - upsdebugx(1, "%s: got 0x%02x (unhandled)", __func__, ch); + debx(1, "got 0x%02x (unhandled)", ch); break; } @@ -436,18 +434,13 @@ static void alert_handler(char ch) * function is subtly different from generic ser_get_line_alert() */ #define apc_read(b, l, f) apc_read_i(b, l, f, __func__, __LINE__) -static ssize_t apc_read_i(char *buf, size_t buflen, int flags, const char *fn, unsigned int ln) +static int apc_read_i(char *buf, size_t buflen, int flags, const char *fn, unsigned int ln) { const char *iset = IGN_CHARS, *aset = ""; size_t count = 0; - ssize_t i, ret; - int sec = 3, usec = 0; + int i, ret, sec = 3, usec = 0; char temp[APC_LBUF]; - if (buflen > (size_t)SSIZE_MAX) { - fatalx (EXIT_FAILURE, "Error: apc_read_i called with buflen too large"); - } - if (upsfd == -1) return 0; if (flags & SER_D0) { @@ -522,7 +515,7 @@ static ssize_t apc_read_i(char *buf, size_t buflen, int flags, const char *fn, u /* standard "line received" condition */ if (temp[i] == ENDCHAR) { ser_comm_good(); - return (ssize_t)count; + return count; } /* * '*' is set as a secondary EOL; convert to 'OK' only as a @@ -564,14 +557,13 @@ static ssize_t apc_read_i(char *buf, size_t buflen, int flags, const char *fn, u } ser_comm_good(); - /* buflen range limited above */ - return (ssize_t)count; + return count; } #define apc_write(code) apc_write_i(code, __func__, __LINE__) -static ssize_t apc_write_i(unsigned char code, const char *fn, unsigned int ln) +static int apc_write_i(unsigned char code, const char *fn, unsigned int ln) { - ssize_t ret; + int ret; errno = 0; if (upsfd == -1) @@ -604,12 +596,12 @@ static ssize_t apc_write_i(unsigned char code, const char *fn, unsigned int ln) * confusing "success". */ #define apc_write_long(code) apc_write_long_i(code, __func__, __LINE__) -static ssize_t apc_write_long_i(const char *code, const char *fn, unsigned int ln) +static int apc_write_long_i(const char *code, const char *fn, unsigned int ln) { char temp[APC_LBUF]; - ssize_t ret; + int ret; - ret = apc_write_i((const unsigned char)(*code), fn, ln); + ret = apc_write_i(*code, fn, ln); if (ret != 1) return ret; /* peek for the answer - anything at this point is failure */ @@ -629,10 +621,10 @@ static ssize_t apc_write_long_i(const char *code, const char *fn, unsigned int l } #define apc_write_rep(code) apc_write_rep_i(code, __func__, __LINE__) -static ssize_t apc_write_rep_i(unsigned char code, const char *fn, unsigned int ln) +static int apc_write_rep_i(unsigned char code, const char *fn, unsigned int ln) { char temp[APC_LBUF]; - ssize_t ret; + int ret; ret = apc_write_i(code, fn, ln); if (ret != 1) @@ -668,9 +660,9 @@ static void apc_flush(int flags) } /* apc specific wrappers around set/del info - to handle "packed" variables */ -static void apc_dstate_delinfo(apc_vartab_t *vt, int skip) +void apc_dstate_delinfo(apc_vartab_t *vt, int skip) { - char *name, *nidx; + char name[vt->nlen0], *nidx; int c; /* standard not packed var */ @@ -679,11 +671,6 @@ static void apc_dstate_delinfo(apc_vartab_t *vt, int skip) return; } - if ( !(name = xmalloc(sizeof(char) * vt->nlen0)) ) { - upslogx(LOG_ERR, "apc_dstate_delinfo() failed to allocate buffer"); - return; - } - strcpy(name, vt->name); nidx = strstr(name,".0.") + 1; @@ -693,13 +680,12 @@ static void apc_dstate_delinfo(apc_vartab_t *vt, int skip) } vt->cnt = 0; - free(name); } -static void apc_dstate_setinfo(apc_vartab_t *vt, const char *upsval) +void apc_dstate_setinfo(apc_vartab_t *vt, const char *upsval) { - char *name, *nidx; - char *temp, *vidx[APC_PACK_MAX], *com, *curr; + char name[vt->nlen0], *nidx; + char temp[strlen(upsval) + 1], *vidx[APC_PACK_MAX], *com, *curr; int c; /* standard not packed var */ @@ -708,17 +694,6 @@ static void apc_dstate_setinfo(apc_vartab_t *vt, const char *upsval) return; } - if ( !(name = xmalloc(sizeof(char) * vt->nlen0)) ) { - upslogx(LOG_ERR, "apc_dstate_setinfo() failed to allocate buffer"); - return; - } - - if ( !(temp = xmalloc(sizeof(char) * (strlen(upsval) + 1))) ) { - upslogx(LOG_ERR, "apc_dstate_setinfo() failed to allocate buffer"); - free(name); - return; - } - /* we have to set proper name for dstate_setinfo() calls */ strcpy(name, vt->name); nidx = strstr(name,".0.") + 1; @@ -759,20 +734,17 @@ static void apc_dstate_setinfo(apc_vartab_t *vt, const char *upsval) else dstate_setinfo(name, "N/A"); } - - free(name); - free(temp); } static const char *preread_data(apc_vartab_t *vt) { - ssize_t ret; + int ret; static char temp[APC_LBUF]; - upsdebugx(1, "%s: %s [%s]", __func__, vt->name, prtchr(vt->cmd)); + debx(1, "%s [%s]", vt->name, prtchr(vt->cmd)); apc_flush(0); - ret = apc_write((const unsigned char)vt->cmd); + ret = apc_write(vt->cmd); if (ret != 1) return 0; @@ -781,7 +753,7 @@ static const char *preread_data(apc_vartab_t *vt) if (ret < 1 || !strcmp(temp, "NA")) { if (ret >= 0) - upslogx(LOG_ERR, "%s: %s [%s] timed out or not supported", __func__, vt->name, prtchr(vt->cmd)); + logx(LOG_ERR, "%s [%s] timed out or not supported", vt->name, prtchr(vt->cmd)); return 0; } @@ -795,18 +767,18 @@ static int poll_data(apc_vartab_t *vt) if (!(vt->flags & APC_PRESENT)) return 1; - upsdebugx(1, "%s: %s [%s]", __func__, vt->name, prtchr(vt->cmd)); + debx(1, "%s [%s]", vt->name, prtchr(vt->cmd)); apc_flush(SER_AA); - if (apc_write((const unsigned char)vt->cmd) != 1) + if (apc_write(vt->cmd) != 1) return 0; if (apc_read(temp, sizeof(temp), SER_AA) < 1) return 0; /* automagically no longer supported by the hardware somehow */ if (!strcmp(temp, "NA")) { - upslogx(LOG_WARNING, "%s: verified variable %s [%s] returned NA, removing", __func__, vt->name, prtchr(vt->cmd)); - vt->flags &= ~(unsigned int)APC_PRESENT; + logx(LOG_WARNING, "verified variable %s [%s] returned NA, removing", vt->name, prtchr(vt->cmd)); + vt->flags &= ~APC_PRESENT; apc_dstate_delinfo(vt, 0); } else apc_dstate_setinfo(vt, temp); @@ -816,10 +788,10 @@ static int poll_data(apc_vartab_t *vt) static int update_status(void) { - ssize_t ret; + int ret; char buf[APC_LBUF]; - upsdebugx(1, "%s: [%s]", __func__, prtchr(APC_STATUS)); + debx(1, "[%s]", prtchr(APC_STATUS)); apc_flush(SER_AA); if (apc_write(APC_STATUS) != 1) @@ -828,7 +800,7 @@ static int update_status(void) if ((ret < 1) || (!strcmp(buf, "NA"))) { if (ret >= 0) - upslogx(LOG_WARNING, "%s: %s", __func__, "failed"); + logx(LOG_WARNING, "failed"); return 0; } @@ -844,15 +816,15 @@ static int update_status(void) static inline void confirm_cv(unsigned char cmd, const char *tag, const char *name) { - upsdebugx(1, "%s [%s] - %s supported", name, prtchr((char)cmd), tag); + upsdebugx(1, "%s [%s] - %s supported", name, prtchr(cmd), tag); } static inline void warn_cv(unsigned char cmd, const char *tag, const char *name) { if (tag && name) - upslogx(LOG_WARNING, "%s [%s] - %s invalid", name, prtchr((char)cmd), tag); + upslogx(LOG_WARNING, "%s [%s] - %s invalid", name, prtchr(cmd), tag); else - upslogx(LOG_WARNING, "[%s] unrecognized", prtchr((char)cmd)); + upslogx(LOG_WARNING, "[%s] unrecognized", prtchr(cmd)); } static void var_string_setup(apc_vartab_t *vt) @@ -881,7 +853,7 @@ static int var_verify(apc_vartab_t *vt) temp = preread_data(vt); /* no conversion here, validator should operate on raw values */ if (!temp || !rexhlp(vt->regex, temp)) { - warn_cv((const unsigned char)vt->cmd, "variable", vt->name); + warn_cv(vt->cmd, "variable", vt->name); return 0; } @@ -889,7 +861,7 @@ static int var_verify(apc_vartab_t *vt) apc_dstate_setinfo(vt, temp); var_string_setup(vt); - confirm_cv((const unsigned char)vt->cmd, "variable", vt->name); + confirm_cv(vt->cmd, "variable", vt->name); return 1; } @@ -920,9 +892,9 @@ static void deprecate_vars(void) temp = preread_data(vt); /* no conversion here, validator should operate on raw values */ if (!temp || !rexhlp(vt->regex, temp)) { - vt->flags &= ~(unsigned int)APC_PRESENT; + vt->flags &= ~APC_PRESENT; - warn_cv((const unsigned char)vt->cmd, "variable combination", vt->name); + warn_cv(vt->cmd, "variable combination", vt->name); continue; } @@ -931,13 +903,13 @@ static void deprecate_vars(void) vtn = &apc_vartab[j]; if (strcmp(vtn->name, vt->name) && vtn->cmd != vt->cmd) continue; - vtn->flags &= ~(unsigned int)APC_PRESENT; + vtn->flags &= ~APC_PRESENT; } apc_dstate_setinfo(vt, temp); var_string_setup(vt); - confirm_cv((const unsigned char)vt->cmd, "variable combination", vt->name); + confirm_cv(vt->cmd, "variable combination", vt->name); } } @@ -945,9 +917,7 @@ static void apc_getcaps(int qco) { const char *ptr, *entptr; char upsloc, temp[APC_LBUF], cmd, loc, etmp[APC_SBUF], *endtemp; - int matrix, valid; - size_t nument, entlen, i; - ssize_t ret; + int nument, entlen, i, matrix, ret, valid; apc_vartab_t *vt; /* @@ -981,7 +951,7 @@ static void apc_getcaps(int qco) * as capability support was reported earlier */ if (ret >= 0) - upslogx(LOG_WARNING, "%s", "APC cannot do capabilities but said it could !"); + upslogx(LOG_WARNING, "APC cannot do capabilities but said it could !"); return; } @@ -1019,19 +989,8 @@ static void apc_getcaps(int qco) cmd = ptr[0]; loc = ptr[1]; - - if (ptr[2] < 48 || ptr[3] < 48) { - upsdebugx(0, - "%s: nument (%d) or entlen (%d) out of range", - __func__, (ptr[2] - 48), (ptr[3] - 48)); - fatalx(EXIT_FAILURE, - "nument or entlen out of range\n" - "Please report this error\n" - "ERROR: capability overflow!"); - } - - nument = (size_t)ptr[2] - 48; - entlen = (size_t)ptr[3] - 48; + nument = ptr[2] - 48; + entlen = ptr[3] - 48; entptr = &ptr[4]; vt = vt_lookup_char(cmd); @@ -1045,7 +1004,7 @@ static void apc_getcaps(int qco) /* make sure setvar knows what this is */ vt->flags |= APC_RW | APC_ENUM; - } else if (vt && (vt->flags & APC_PACK)) + } else if (vt->flags & APC_PACK) /* * Currently we assume - basing on the following * feedback: @@ -1177,7 +1136,7 @@ static void oldapcsetup(void) /* some hardware is a special case - hotwire the list of cmdchars */ static int firmware_table_lookup(void) { - ssize_t ret; + int ret; unsigned int i, j; char buf[APC_LBUF]; @@ -1189,7 +1148,7 @@ static int firmware_table_lookup(void) if ((ret = apc_read(buf, sizeof(buf), SER_TO)) < 0) return 0; - /* + /* * Some UPSes support both 'V' and 'b'. As 'b' doesn't always return * firmware version, we attempt that only if 'V' doesn't work. */ @@ -1235,7 +1194,7 @@ static int firmware_table_lookup(void) /* matched - run the cmdchars from the table */ upsdebugx(1, "parsing out supported cmds and vars"); for (j = 0; j < strlen(apc_compattab[i].cmdchars); j++) - protocol_verify((const unsigned char)(apc_compattab[i].cmdchars[j])); + protocol_verify(apc_compattab[i].cmdchars[j]); deprecate_vars(); return 1; /* matched */ @@ -1248,9 +1207,8 @@ static int firmware_table_lookup(void) static int getbaseinfo(void) { unsigned int i; - ssize_t ret; - int qco; - char *cmds, *tail, temp[APC_LBUF]; + int ret, qco; + char *cmds, temp[APC_LBUF]; /* * try firmware lookup first; we could start with 'a', but older models @@ -1285,17 +1243,10 @@ static int getbaseinfo(void) /* * returned set is verified for validity above, so just extract * what's interesting for us - * - * the known format is: - * ver.alerts.commands[.stuff] */ - cmds = strchr(temp, '.'); - cmds = strchr(cmds + 1, '.'); - tail = strchr(++cmds, '.'); - if (tail) - *tail = 0; - for (i = 0; i < strlen(cmds); i++) - protocol_verify((const unsigned char)cmds[i]); + cmds = strrchr(temp, '.'); + for (i = 1; i < strlen(cmds); i++) + protocol_verify(cmds[i]); deprecate_vars(); /* if capabilities are supported, add them here */ @@ -1310,8 +1261,7 @@ static int getbaseinfo(void) static int do_cal(int start) { char temp[APC_LBUF]; - long tval; - ssize_t ret; + int tval, ret; apc_flush(SER_AA); ret = apc_write(APC_STATUS); @@ -1324,7 +1274,7 @@ static int do_cal(int start) /* if we can't check the current calibration status, bail out */ if ((ret < 1) || (!strcmp(temp, "NA"))) { - upslogx(LOG_WARNING, "%s", "runtime calibration state undeterminable"); + upslogx(LOG_WARNING, "runtime calibration state undeterminable"); return STAT_INSTCMD_HANDLED; /* FUTURE: failure */ } @@ -1333,13 +1283,13 @@ static int do_cal(int start) if (tval & APC_STAT_CAL) { /* calibration currently happening */ if (start == 1) { /* requested start while calibration still running */ - upslogx(LOG_NOTICE, "%s", "runtime calibration already in progress"); + upslogx(LOG_NOTICE, "runtime calibration already in progress"); return STAT_INSTCMD_HANDLED; /* FUTURE: failure */ } /* stop requested */ - upslogx(LOG_NOTICE, "%s", "stopping runtime calibration"); + upslogx(LOG_NOTICE, "stopping runtime calibration"); ret = apc_write(APC_CMD_CALTOGGLE); @@ -1360,11 +1310,11 @@ static int do_cal(int start) /* calibration not happening */ if (start == 0) { /* stop requested */ - upslogx(LOG_NOTICE, "%s", "runtime calibration not occurring"); + upslogx(LOG_NOTICE, "runtime calibration not occurring"); return STAT_INSTCMD_HANDLED; /* FUTURE: failure */ } - upslogx(LOG_NOTICE, "%s", "starting runtime calibration"); + upslogx(LOG_NOTICE, "starting runtime calibration"); ret = apc_write(APC_CMD_CALTOGGLE); @@ -1397,7 +1347,7 @@ static int smartmode(void) ret = apc_read(temp, sizeof(temp), 0); if ((ret < 1) || (!strcmp(temp, "NA")) || (!strcmp(temp, "NO"))) { - upslogx(LOG_CRIT, "%s", "enabling smartmode failed !"); + upslogx(LOG_CRIT, "enabling smartmode failed !"); return 0; } @@ -1413,8 +1363,7 @@ static int smartmode(void) */ static int smartmode(int cnt) { - ssize_t ret; - int tries; + int ret, tries; char temp[APC_LBUF]; for (tries = 0; tries < cnt; tries++) { @@ -1448,7 +1397,7 @@ static int smartmode(int cnt) */ static int sdok(int ign) { - ssize_t ret; + int ret; char temp[APC_SBUF]; /* @@ -1460,14 +1409,14 @@ static int sdok(int ign) if (ret < 0) return STAT_INSTCMD_FAILED; - upsdebugx(1, "%s: got \"%s\"", __func__, temp); + debx(1, "got \"%s\"", temp); if ((!ret && ign) || !strcmp(temp, "OK")) { - upsdebugx(1, "%s: %s", __func__, "last shutdown cmd succeeded"); + debx(1, "last shutdown cmd succeded"); return STAT_INSTCMD_HANDLED; } - upsdebugx(1, "%s: %s", __func__, "last shutdown cmd failed"); + debx(1, "last shutdown cmd failed"); return STAT_INSTCMD_FAILED; } @@ -1476,7 +1425,7 @@ static int sdcmd_S(const void *foo) { apc_flush(0); if (!foo) - upsdebugx(1, "%s: issuing [%s]", __func__, prtchr(APC_CMD_SOFTDOWN)); + debx(1, "issuing [%s]", prtchr(APC_CMD_SOFTDOWN)); if (apc_write(APC_CMD_SOFTDOWN) != 1) return STAT_INSTCMD_FAILED; return sdok(0); @@ -1485,23 +1434,13 @@ static int sdcmd_S(const void *foo) /* soft hibernate, hack version for CS 350 & co. */ static int sdcmd_CS(const void *foo) { - ssize_t ret; - useconds_t cshd = 3500000; + int ret; char temp[APC_SBUF]; - const char *val; - NUT_UNUSED_VARIABLE(foo); - /* TODO: Catch overflows? - * Let compilers complain about (non-)casting on systems - * where useconds_t is not a good target for strtod() output - */ - if ((val = getval("cshdelay"))) - cshd = (strtod(val, NULL) * 1000000); - - upsdebugx(1, "%s: issuing CS 'hack' [%s+%s] with %2.1f sec delay", __func__, prtchr(APC_CMD_SIMPWF), prtchr(APC_CMD_SOFTDOWN), (double)cshd / 1000000); + debx(1, "issuing CS 'hack' [%s+%s]", prtchr(APC_CMD_SIMPWF), prtchr(APC_CMD_SOFTDOWN)); if (ups_status & APC_STAT_OL) { apc_flush(0); - upsdebugx(1, "%s: issuing [%s]", __func__, prtchr(APC_CMD_SIMPWF)); + debx(1, "issuing [%s]", prtchr(APC_CMD_SIMPWF)); ret = apc_write(APC_CMD_SIMPWF); if (ret != 1) { return STAT_INSTCMD_FAILED; @@ -1511,7 +1450,6 @@ static int sdcmd_CS(const void *foo) if (ret < 0) { return STAT_INSTCMD_FAILED; } - usleep(cshd); } /* continue with regular soft hibernate */ return sdcmd_S((void *)1); @@ -1524,8 +1462,7 @@ static int sdcmd_CS(const void *foo) */ static int sdcmd_AT(const void *str) { - ssize_t ret; - size_t cnt, padto, i; + int ret, cnt, padto, i; const char *awd = str; char temp[APC_SBUF], *ptr; @@ -1542,26 +1479,21 @@ static int sdcmd_AT(const void *str) } strcpy(ptr, awd); - upsdebugx(1, "%s: issuing [%s] with %ld minutes of additional wakeup delay", - __func__, prtchr(APC_CMD_GRACEDOWN), strtol(awd, NULL, 10)*6); + debx(1, "issuing [%s] with %d minutes of additional wakeup delay", + prtchr(APC_CMD_GRACEDOWN), (int)strtol(awd, NULL, 10)*6); apc_flush(0); ret = apc_write_long(temp); - /* Range-check: padto is 2 or 3 per above */ - if (ret != (ssize_t)padto + 1) { - upslogx(LOG_ERR, - "issuing [%s] with %zu digits failed", - prtchr(APC_CMD_GRACEDOWN), padto); + if (ret != padto + 1) { + upslogx(LOG_ERR, "issuing [%s] with %d digits failed", prtchr(APC_CMD_GRACEDOWN), padto); return STAT_INSTCMD_FAILED; } ret = sdok(0); if (ret == STAT_INSTCMD_HANDLED || padto == 3) - return (int)ret; + return ret; - upslogx(LOG_ERR, - "command [%s] with 2 digits doesn't work - try 3 digits", - prtchr(APC_CMD_GRACEDOWN)); + upslogx(LOG_ERR, "command [%s] with 2 digits doesn't work - try 3 digits", prtchr(APC_CMD_GRACEDOWN)); /* * "tricky" part - we tried @nn variation and it (unsurprisingly) * failed; we have to abort the sequence with something bogus to have @@ -1578,10 +1510,9 @@ static int sdcmd_AT(const void *str) /* shutdown: K - delayed poweroff */ static int sdcmd_K(const void *foo) { - ssize_t ret; - NUT_UNUSED_VARIABLE(foo); + int ret; - upsdebugx(1, "%s: issuing [%s]", __func__, prtchr(APC_CMD_SHUTDOWN)); + debx(1, "issuing [%s]", prtchr(APC_CMD_SHUTDOWN)); apc_flush(0); ret = apc_write_rep(APC_CMD_SHUTDOWN); @@ -1594,10 +1525,9 @@ static int sdcmd_K(const void *foo) /* shutdown: Z - immediate poweroff */ static int sdcmd_Z(const void *foo) { - ssize_t ret; - NUT_UNUSED_VARIABLE(foo); + int ret; - upsdebugx(1, "%s: issuing [%s]", __func__, prtchr(APC_CMD_OFF)); + debx(1, "issuing [%s]", prtchr(APC_CMD_OFF)); apc_flush(0); ret = apc_write_rep(APC_CMD_OFF); @@ -1611,14 +1541,13 @@ static int sdcmd_Z(const void *foo) static void upsdrv_shutdown_simple(void) { - long sdtype = 0; + unsigned int sdtype = 0; const char *val; if ((val = getval("sdtype"))) sdtype = strtol(val, NULL, 10); - upsdebugx(1, "%s: currently: %s, sdtype: %ld", __func__, - (ups_status & APC_STAT_OL) ? "on-line" : "on battery", sdtype); + debx(1, "currently: %s, sdtype: %d", (ups_status & APC_STAT_OL) ? "on-line" : "on battery", sdtype); switch (sdtype) { @@ -1669,8 +1598,7 @@ static void upsdrv_shutdown_advanced(void) val = getval("advorder"); len = strlen(val); - upsdebugx(1, "%s: currently: %s, advorder: %s", __func__, - (ups_status & APC_STAT_OL) ? "on-line" : "on battery", val); + debx(1, "currently: %s, advorder: %s", (ups_status & APC_STAT_OL) ? "on-line" : "on battery", val); /* * try each method in the list with a little bit of handling in certain @@ -1696,7 +1624,7 @@ void upsdrv_shutdown(void) char temp[APC_LBUF]; if (!smartmode(1)) - upslogx(LOG_WARNING, "%s: %s", __func__, "setting SmartMode failed !"); + logx(LOG_WARNING, "setting SmartMode failed !"); /* check the line status */ @@ -1704,15 +1632,15 @@ void upsdrv_shutdown(void) if (apc_read(temp, sizeof(temp), SER_D1) == 1) { ups_status = strtol(temp, 0, 16); } else { - upslogx(LOG_WARNING, "%s: %s", __func__, "status read failed, assuming LB+OB"); + logx(LOG_WARNING, "status read failed, assuming LB+OB"); ups_status = APC_STAT_LB | APC_STAT_OB; } } else { - upslogx(LOG_WARNING, "%s: %s", __func__, "status write failed, assuming LB+OB"); + logx(LOG_WARNING, "status write failed, assuming LB+OB"); ups_status = APC_STAT_LB | APC_STAT_OB; } - if (testvar("advorder") && toupper((size_t)*getval("advorder")) != 'N') + if (testvar("advorder") && toupper(*getval("advorder")) != 'N') upsdrv_shutdown_advanced(); else upsdrv_shutdown_simple(); @@ -1722,31 +1650,30 @@ static int update_info(int all) { int i; - upsdebugx(1, "%s: starting scan%s", __func__, all ? " (all vars)" : ""); + debx(1, "starting scan%s", all ? " (all vars)" : ""); for (i = 0; apc_vartab[i].name != NULL; i++) { if (!all && (apc_vartab[i].flags & APC_POLL) == 0) continue; if (!poll_data(&apc_vartab[i])) { - upsdebugx(1, "%s: %s", __func__, "aborting scan"); + debx(1, "aborting scan"); return 0; } } - upsdebugx(1, "%s: %s", __func__, "scan completed"); + debx(1, "scan completed"); return 1; } static int setvar_enum(apc_vartab_t *vt, const char *val) { - int i; - ssize_t ret; + int i, ret; char orig[APC_LBUF], temp[APC_LBUF]; const char *ptr; apc_flush(SER_AA); - if (apc_write((const unsigned char)vt->cmd) != 1) + if (apc_write(vt->cmd) != 1) return STAT_SET_FAILED; ret = apc_read(orig, sizeof(orig), SER_AA); @@ -1758,13 +1685,13 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) /* suppress redundant changes - easier on the eeprom */ if (!strcmp(ptr, val)) { - upslogx(LOG_INFO, "%s: ignoring SET %s='%s' (unchanged value)", - __func__, vt->name, val); + logx(LOG_INFO, "ignoring SET %s='%s' (unchanged value)", + vt->name, val); return STAT_SET_HANDLED; /* FUTURE: no change */ } - for (i = 0; i < 32; i++) { + for (i = 0; i < 6; i++) { if (apc_write(APC_NEXTVAL) != 1) return STAT_SET_FAILED; @@ -1781,7 +1708,7 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) return STAT_SET_FAILED; /* see what it rotated onto */ - if (apc_write((const unsigned char)vt->cmd) != 1) + if (apc_write(vt->cmd) != 1) return STAT_SET_FAILED; ret = apc_read(temp, sizeof(temp), SER_AA); @@ -1791,10 +1718,10 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) ptr = convert_data(vt, temp); - upsdebugx(1, "%s: rotate - got [%s], want [%s]", __func__, ptr, val); + debx(1, "rotate - got [%s], want [%s]", ptr, val); if (!strcmp(ptr, val)) { /* got it */ - upslogx(LOG_INFO, "%s: SET %s='%s'", __func__, vt->name, val); + logx(LOG_INFO, "SET %s='%s'", vt->name, val); /* refresh data from the hardware */ poll_data(vt); @@ -1804,13 +1731,13 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) /* check for wraparound */ if (!strcmp(ptr, orig)) { - upslogx(LOG_ERR, "%s: variable %s wrapped", __func__, vt->name); + logx(LOG_ERR, "variable %s wrapped", vt->name); return STAT_SET_FAILED; } } - upslogx(LOG_ERR, "%s: gave up after 6 tries for %s", __func__, vt->name); + logx(LOG_ERR, "gave up after 6 tries for %s", vt->name); /* refresh data from the hardware */ poll_data(vt); @@ -1820,18 +1747,18 @@ static int setvar_enum(apc_vartab_t *vt, const char *val) static int setvar_string(apc_vartab_t *vt, const char *val) { - size_t i; - ssize_t ret; + unsigned int i; + int ret; char temp[APC_LBUF], *ptr; /* sanitize length */ if (strlen(val) > APC_STRLEN) { - upslogx(LOG_ERR, "%s: value (%s) too long", __func__, val); + logx(LOG_ERR, "value (%s) too long", val); return STAT_SET_FAILED; } apc_flush(SER_AA); - if (apc_write((const unsigned char)vt->cmd) != 1) + if (apc_write(vt->cmd) != 1) return STAT_SET_FAILED; ret = apc_read(temp, sizeof(temp), SER_AA); @@ -1841,8 +1768,8 @@ static int setvar_string(apc_vartab_t *vt, const char *val) /* suppress redundant changes - easier on the eeprom */ if (!strcmp(temp, val)) { - upslogx(LOG_INFO, "%s: ignoring SET %s='%s' (unchanged value)", - __func__, vt->name, val); + logx(LOG_INFO, "ignoring SET %s='%s' (unchanged value)", + vt->name, val); return STAT_SET_HANDLED; /* FUTURE: no change */ } @@ -1861,19 +1788,19 @@ static int setvar_string(apc_vartab_t *vt, const char *val) ret = apc_read(temp, sizeof(temp), SER_AA); if (ret < 1) { - upslogx(LOG_ERR, "%s: %s", __func__, "short final read"); + logx(LOG_ERR, "short final read"); return STAT_SET_FAILED; } if (!strcmp(temp, "NO")) { - upslogx(LOG_ERR, "%s: %s", __func__, "got NO at final read"); + logx(LOG_ERR, "got NO at final read"); return STAT_SET_FAILED; } /* refresh data from the hardware */ poll_data(vt); - upslogx(LOG_INFO, "%s: SET %s='%s'", __func__, vt->name, val); + logx(LOG_INFO, "SET %s='%s'", vt->name, val); return STAT_SET_HANDLED; /* FUTURE: success */ } @@ -1888,7 +1815,7 @@ static int setvar(const char *varname, const char *val) return STAT_SET_UNKNOWN; if ((vt->flags & APC_RW) == 0) { - upslogx(LOG_WARNING, "%s: [%s] is not writable", __func__, varname); + logx(LOG_WARNING, "[%s] is not writable", varname); return STAT_SET_UNKNOWN; } @@ -1898,7 +1825,7 @@ static int setvar(const char *varname, const char *val) if (vt->flags & APC_STRING) return setvar_string(vt, val); - upslogx(LOG_WARNING, "%s: unknown type for [%s]", __func__, varname); + logx(LOG_WARNING, "unknown type for [%s]", varname); return STAT_SET_UNKNOWN; } @@ -1906,7 +1833,7 @@ static int setvar(const char *varname, const char *val) static int do_loadon(void) { apc_flush(0); - upsdebugx(1, "%s: issuing [%s]", __func__, prtchr(APC_CMD_ON)); + debx(1, "issuing [%s]", prtchr(APC_CMD_ON)); if (apc_write_rep(APC_CMD_ON) != 2) return STAT_INSTCMD_FAILED; @@ -1917,24 +1844,23 @@ static int do_loadon(void) * the next status update) */ - upsdebugx(1, "%s: [%s] completed", __func__, prtchr(APC_CMD_ON)); + debx(1, "[%s] completed", prtchr(APC_CMD_ON)); return STAT_INSTCMD_HANDLED; } /* actually send the instcmd's char to the ups */ static int do_cmd(const apc_cmdtab_t *ct) { - ssize_t ret; - int c; + int ret, c; char temp[APC_LBUF]; apc_flush(SER_AA); if (ct->flags & APC_REPEAT) { - ret = apc_write_rep((const unsigned char)ct->cmd); + ret = apc_write_rep(ct->cmd); c = 2; } else { - ret = apc_write((const unsigned char)ct->cmd); + ret = apc_write(ct->cmd); c = 1; } @@ -1948,13 +1874,13 @@ static int do_cmd(const apc_cmdtab_t *ct) return STAT_INSTCMD_FAILED; if (strcmp(temp, "OK")) { - upslogx(LOG_WARNING, "%s: got [%s] after command [%s]", - __func__, temp, ct->name); + logx(LOG_WARNING, "got [%s] after command [%s]", + temp, ct->name); return STAT_INSTCMD_FAILED; } - upslogx(LOG_INFO, "%s: %s completed", __func__, ct->name); + logx(LOG_INFO, "%s completed", ct->name); return STAT_INSTCMD_HANDLED; } @@ -1972,8 +1898,8 @@ static int instcmd_chktime(apc_cmdtab_t *ct, const char *ext) /* you have to hit this in a small window or it fails */ if ((elapsed < MINCMDTIME) || (elapsed > MAXCMDTIME)) { - upsdebugx(1, "%s: outside window for [%s %s] (%2.0f)", - __func__, ct->name, ext ? ext : "\b", elapsed); + debx(1, "outside window for [%s %s] (%2.0f)", + ct->name, ext ? ext : "\b", elapsed); return 0; } @@ -2003,14 +1929,14 @@ static int instcmd(const char *cmd, const char *ext) } if (!ct) { - upslogx(LOG_WARNING, "%s: unknown command [%s %s]", __func__, cmd, + logx(LOG_WARNING, "unknown command [%s %s]", cmd, ext ? ext : "\b"); return STAT_INSTCMD_INVALID; } if (!(ct->flags & APC_PRESENT)) { - upslogx(LOG_WARNING, "%s: command [%s %s] recognized, but" - " not supported by your UPS model", __func__, cmd, + logx(LOG_WARNING, "command [%s %s] recognized, but" + " not supported by your UPS model", cmd, ext ? ext : "\b"); return STAT_INSTCMD_INVALID; } @@ -2040,10 +1966,10 @@ static int instcmd(const char *cmd, const char *ext) if (!ext || !*ext) return sdcmd_S(0); - if (toupper((size_t)*ext) == 'A') + if (toupper(*ext) == 'A') return sdcmd_AT(ext + 3); - if (toupper((size_t)*ext) == 'C') + if (toupper(*ext) == 'C') return sdcmd_CS(0); } @@ -2067,7 +1993,6 @@ void upsdrv_makevartable(void) addvar(VAR_VALUE, "awd", "hard hibernate's additional wakeup delay"); addvar(VAR_VALUE, "sdtype", "simple shutdown method"); addvar(VAR_VALUE, "advorder", "advanced shutdown control"); - addvar(VAR_VALUE, "cshdelay", "CS hack delay"); } void upsdrv_help(void) @@ -2099,11 +2024,6 @@ void upsdrv_initups(void) fatalx(EXIT_FAILURE, "invalid value (%s) for option 'advorder'", val); } - /* sanitize cshdelay */ - if ((val = getval("cshdelay")) && !rexhlp(APC_CSHDFMT, val)) { - fatalx(EXIT_FAILURE, "invalid value (%s) for option 'cshdelay'", val); - } - upsfd = extrafd = ser_open(device_path); apc_ser_set(); @@ -2171,7 +2091,7 @@ void upsdrv_updateinfo(void) /* try to wake up a dead ups once in awhile */ if (dstate_is_stale()) { if (!last_worked) - upsdebugx(1, "%s: %s", __func__, "comm lost"); + debx(1, "comm lost"); /* reset this so a full update runs when the UPS returns */ last_full = 0; @@ -2180,7 +2100,7 @@ void upsdrv_updateinfo(void) return; /* become aggressive after a few tries */ - upsdebugx(1, "%s: nudging ups with 'Y', iteration #%d ...", __func__, last_worked); + debx(1, "nudging ups with 'Y', iteration #%d ...", last_worked); if (!smartmode(1)) return; diff --git a/drivers/apcsmart.h b/drivers/apcsmart.h index fe7bd1a..c0155db 100644 --- a/drivers/apcsmart.h +++ b/drivers/apcsmart.h @@ -20,11 +20,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_APCSMART_H_SEEN -#define NUT_APCSMART_H_SEEN 1 +#ifndef __apcsmart_h__ +#define __apcsmart_h__ #define DRIVER_NAME "APC Smart protocol driver" -#define DRIVER_VERSION "3.2" +#define DRIVER_VERSION "3.1" #define ALT_CABLE_1 "940-0095B" @@ -126,14 +126,14 @@ /* status bits */ -#define APC_STAT_CAL (1L << 0) /* calibration */ -#define APC_STAT_TRIM (1L << 1) /* SmartTrim */ -#define APC_STAT_BOOST (1L << 2) /* SmartBoost */ -#define APC_STAT_OL (1L << 3) /* on line */ -#define APC_STAT_OB (1L << 4) /* on battery */ -#define APC_STAT_OVER (1L << 5) /* overload */ -#define APC_STAT_LB (1L << 6) /* low battery */ -#define APC_STAT_RB (1L << 7) /* replace battery */ +#define APC_STAT_CAL (1 << 0) /* calibration */ +#define APC_STAT_TRIM (1 << 1) /* SmartTrim */ +#define APC_STAT_BOOST (1 << 2) /* SmartBoost */ +#define APC_STAT_OL (1 << 3) /* on line */ +#define APC_STAT_OB (1 << 4) /* on battery */ +#define APC_STAT_OVER (1 << 5) /* overload */ +#define APC_STAT_LB (1 << 6) /* low battery */ +#define APC_STAT_RB (1 << 7) /* replace battery */ /* * serial protocol: special commands - initialization and such @@ -143,7 +143,7 @@ #define APC_GOSMART 'Y' #define APC_GODUMB 'R' #define APC_CMDSET 'a' -#define APC_CMDSET_FMT "^[0-9]\\.[^.]*\\.[^.]+(\\.[^.]+)?$" +#define APC_CMDSET_FMT "^[0-9]\\.[^.]*\\.[^.]+$" #define APC_CAPS '\032' /* ^Z */ #define APC_NEXTVAL '-' #define APC_FW_OLD 'V' @@ -161,7 +161,12 @@ /* advorder method regex format*/ #define APC_ADVFMT "^([0-4]{1,5}|[Nn][Oo])$" -/* cshdelay format */ -#define APC_CSHDFMT "^([0-9]\\.?|[0-9]?\\.[0-9])$" +/* error logging/debug related macros */ -#endif /* NUT_APCSMART_H_SEEN */ +#define fatx(fmt, ...) fatalx(EXIT_FAILURE, "%s: " fmt, __func__ , ## __VA_ARGS__) +#define fate(fmt, ...) fatal_with_errno(EXIT_FAILURE, "%s: " fmt, __func__ , ## __VA_ARGS__) + +#define logx(lev, fmt, ...) upslogx(lev, "%s: " fmt, __func__ , ## __VA_ARGS__) +#define debx(lev, fmt, ...) upsdebugx(lev, "%s: " fmt, __func__ , ## __VA_ARGS__) + +#endif diff --git a/drivers/apcsmart_tabs.c b/drivers/apcsmart_tabs.c index 0955e01..9cefa42 100644 --- a/drivers/apcsmart_tabs.c +++ b/drivers/apcsmart_tabs.c @@ -23,55 +23,55 @@ /* APC_MULTI variables *must* be listed in order of preference */ apc_vartab_t apc_vartab[] = { -/* name cmd flags regex nlen0 cnt */ - { "ups.temperature", 'C', APC_POLL|APC_F_CELSIUS, NULL, 0, 0 }, - { "ups.load", 'P', APC_POLL|APC_F_PERCENT, NULL, 0, 0 }, - { "ups.test.interval", 'E', APC_F_HOURS, NULL, 0, 0 }, - { "ups.test.result", 'X', APC_POLL, NULL, 0, 0 }, - { "ups.delay.start", 'r', APC_F_SECONDS, NULL, 0, 0 }, - { "ups.delay.shutdown", 'p', APC_F_SECONDS, NULL, 0, 0 }, - { "ups.id", 'c', APC_STRING, NULL, 0, 0 }, - { "ups.contacts", 'i', APC_POLL|APC_F_HEX, NULL, 0, 0 }, - { "ups.display.language", '\014', 0, NULL, 0, 0 }, - { "input.voltage", 'L', APC_POLL|APC_F_VOLT, NULL, 0, 0 }, - { "input.frequency", 'F', APC_POLL|APC_F_DEC, NULL, 0, 0 }, - { "input.sensitivity", 's', 0, NULL, 0, 0 }, - { "input.quality", '9', APC_POLL|APC_F_HEX, NULL, 0, 0 }, - { "input.transfer.low", 'l', APC_F_VOLT, NULL, 0, 0 }, - { "input.transfer.high", 'u', APC_F_VOLT, NULL, 0, 0 }, - { "input.transfer.reason", 'G', APC_POLL|APC_F_REASON, NULL, 0, 0 }, - { "input.voltage.maximum", 'M', APC_POLL|APC_F_VOLT, NULL, 0, 0 }, - { "input.voltage.minimum", 'N', APC_POLL|APC_F_VOLT, NULL, 0, 0 }, - { "output.current", '/', APC_POLL|APC_F_AMP, NULL, 0, 0 }, - { "output.voltage", 'O', APC_POLL|APC_F_VOLT, NULL, 0, 0 }, - { "output.voltage.nominal", 'o', APC_F_VOLT, NULL, 0, 0 }, - { "ambient.humidity", 'h', APC_POLL|APC_F_PERCENT, NULL, 0, 0 }, - { "ambient.0.humidity", 'H', APC_POLL|APC_PACK|APC_F_PERCENT, NULL, 0, 0 }, - { "ambient.0.humidity.high", '{', APC_POLL|APC_PACK|APC_F_PERCENT, NULL, 0, 0 }, - { "ambient.0.humidity.low", '}', APC_POLL|APC_PACK|APC_F_PERCENT, NULL, 0, 0 }, - { "ambient.temperature", 't', APC_POLL|APC_F_CELSIUS, NULL, 0, 0 }, - { "ambient.0.temperature", 'T', APC_MULTI|APC_POLL|APC_PACK|APC_F_CELSIUS, "^[0-9]{2}\\.[0-9]{2}$", 0, 0 }, - { "ambient.0.temperature.high", '[', APC_POLL|APC_PACK|APC_F_CELSIUS, NULL, 0, 0 }, - { "ambient.0.temperature.low", ']', APC_POLL|APC_PACK|APC_F_CELSIUS, NULL, 0, 0 }, - { "battery.date", 'x', APC_STRING, NULL, 0, 0 }, - { "battery.charge", 'f', APC_POLL|APC_F_PERCENT, NULL, 0, 0 }, - { "battery.charge.restart", 'e', APC_F_PERCENT, NULL, 0, 0 }, - { "battery.voltage", 'B', APC_POLL|APC_F_VOLT, NULL, 0, 0 }, - { "battery.voltage.nominal", 'g', 0, NULL, 0, 0 }, - { "battery.runtime", 'j', APC_POLL|APC_F_MINUTES, NULL, 0, 0 }, - { "battery.runtime.low", 'q', APC_F_MINUTES, NULL, 0, 0 }, - { "battery.packs", '>', APC_F_DEC, NULL, 0, 0 }, - { "battery.packs.bad", '<', APC_F_DEC, NULL, 0, 0 }, - { "battery.alarm.threshold", 'k', 0, NULL, 0, 0 }, - { "device.uptime", 'T', APC_MULTI|APC_POLL|APC_F_HOURS, "^[0-9]{3}\\.[0-9]{1}$", 0, 0 }, - { "ups.serial", 'n', 0, NULL, 0, 0 }, - { "ups.mfr.date", 'm', 0, NULL, 0, 0 }, - { "ups.model", '\001', 0, NULL, 0, 0 }, - { "ups.firmware.aux", 'v', 0, NULL, 0, 0 }, - { "ups.firmware", 'b', APC_MULTI, "^[[:alnum:]]+\\.[[:alnum:]]+\\.[[:alnum:]]+$", 0, 0 }, - { "ups.firmware", 'V', APC_MULTI, NULL, 0, 0 }, - { NULL, 0, 0, NULL, 0, 0 } + { "ups.temperature", 'C', APC_POLL|APC_F_CELSIUS }, + { "ups.load", 'P', APC_POLL|APC_F_PERCENT }, + { "ups.test.interval", 'E', APC_F_HOURS }, + { "ups.test.result", 'X', APC_POLL }, + { "ups.delay.start", 'r', APC_F_SECONDS }, + { "ups.delay.shutdown", 'p', APC_F_SECONDS }, + { "ups.id", 'c', APC_STRING }, + { "ups.contacts", 'i', APC_POLL|APC_F_HEX }, + { "ups.display.language", '\014' }, + { "input.voltage", 'L', APC_POLL|APC_F_VOLT }, + { "input.frequency", 'F', APC_POLL|APC_F_DEC }, + { "input.sensitivity", 's', }, + { "input.quality", '9', APC_POLL|APC_F_HEX }, + { "input.transfer.low", 'l', APC_F_VOLT }, + { "input.transfer.high", 'u', APC_F_VOLT }, + { "input.transfer.reason", 'G', APC_POLL|APC_F_REASON }, + { "input.voltage.maximum", 'M', APC_POLL|APC_F_VOLT }, + { "input.voltage.minimum", 'N', APC_POLL|APC_F_VOLT }, + { "output.current", '/', APC_POLL|APC_F_AMP }, + { "output.voltage", 'O', APC_POLL|APC_F_VOLT }, + { "output.voltage.nominal", 'o', APC_F_VOLT }, + { "ambient.humidity", 'h', APC_POLL|APC_F_PERCENT }, + { "ambient.0.humidity", 'H', APC_POLL|APC_PACK|APC_F_PERCENT }, + { "ambient.0.humidity.high", '{', APC_POLL|APC_PACK|APC_F_PERCENT }, + { "ambient.0.humidity.low", '}', APC_POLL|APC_PACK|APC_F_PERCENT }, + { "ambient.temperature", 't', APC_POLL|APC_F_CELSIUS }, + { "ambient.0.temperature", 'T', APC_MULTI|APC_POLL|APC_PACK|APC_F_CELSIUS, "^[0-9]{2}\\.[0-9]{2}$" }, + { "ambient.0.temperature.high", '[', APC_POLL|APC_PACK|APC_F_CELSIUS }, + { "ambient.0.temperature.low", ']', APC_POLL|APC_PACK|APC_F_CELSIUS }, + { "battery.date", 'x', APC_STRING }, + { "battery.charge", 'f', APC_POLL|APC_F_PERCENT }, + { "battery.charge.restart", 'e', APC_F_PERCENT }, + { "battery.voltage", 'B', APC_POLL|APC_F_VOLT }, + { "battery.voltage.nominal", 'g', }, + { "battery.runtime", 'j', APC_POLL|APC_F_MINUTES }, + { "battery.runtime.low", 'q', APC_F_MINUTES }, + { "battery.packs", '>', APC_F_DEC }, + { "battery.packs.bad", '<', APC_F_DEC }, + { "battery.alarm.threshold", 'k', }, + { "device.uptime", 'T', APC_MULTI|APC_POLL|APC_F_HOURS, "^[0-9]{3}\\.[0-9]{1}$" }, + { "ups.serial", 'n', }, + { "ups.mfr.date", 'm', }, + { "ups.model", '\001' }, + { "ups.firmware.aux", 'v', }, + { "ups.firmware", 'b', APC_MULTI, "^[[:alnum:]]+\\.[[:alnum:]]+\\.[[:alnum:]]+$" }, + { "ups.firmware", 'V', APC_MULTI }, + + { NULL } /* todo: I = alarm enable (hex field) - split into alarm.n.enable @@ -94,19 +94,19 @@ apc_cmdtab_t apc_cmdtab[] = { APC_CMD_GRACEDOWN, APC_NASTY }, { "shutdown.return", "^([Cc][Ss]|)$", APC_CMD_SOFTDOWN, APC_NASTY }, - { "shutdown.stayoff", NULL, APC_CMD_SHUTDOWN, APC_NASTY|APC_REPEAT }, - { "load.off", NULL, APC_CMD_OFF, APC_NASTY|APC_REPEAT }, - { "load.on", NULL, APC_CMD_ON, APC_REPEAT }, - { "calibrate.start", NULL, APC_CMD_CALTOGGLE, 0 }, - { "calibrate.stop", NULL, APC_CMD_CALTOGGLE, 0 }, - { "test.panel.start", NULL, APC_CMD_FPTEST, 0 }, - { "test.failure.start", NULL, APC_CMD_SIMPWF, 0 }, - { "test.battery.start", NULL, APC_CMD_BTESTTOGGLE, 0 }, - { "test.battery.stop", NULL, APC_CMD_BTESTTOGGLE, 0 }, - { "bypass.start", NULL, APC_CMD_BYPTOGGLE, 0 }, - { "bypass.stop", NULL, APC_CMD_BYPTOGGLE, 0 }, + { "shutdown.stayoff", 0, APC_CMD_SHUTDOWN, APC_NASTY|APC_REPEAT }, + { "load.off", 0, APC_CMD_OFF, APC_NASTY|APC_REPEAT }, + { "load.on", 0, APC_CMD_ON, APC_REPEAT }, + { "calibrate.start", 0, APC_CMD_CALTOGGLE, 0 }, + { "calibrate.stop", 0, APC_CMD_CALTOGGLE, 0 }, + { "test.panel.start", 0, APC_CMD_FPTEST, 0 }, + { "test.failure.start", 0, APC_CMD_SIMPWF, 0 }, + { "test.battery.start", 0, APC_CMD_BTESTTOGGLE, 0 }, + { "test.battery.stop", 0, APC_CMD_BTESTTOGGLE, 0 }, + { "bypass.start", 0, APC_CMD_BYPTOGGLE, 0 }, + { "bypass.stop", 0, APC_CMD_BYPTOGGLE, 0 }, - { NULL, NULL, 0, 0 } + { NULL } }; /* compatibility with hardware that doesn't do APC_CMDSET ('a') */ @@ -151,16 +151,11 @@ apc_compattab_t apc_compattab[] = { */ { "set\1", "@789ABCFGKLMNOPQRSUVWXYZ", 0 }, - { NULL, NULL, 0 } + { NULL } }; upsdrv_info_t apc_tab_info = { "APC command table", - APC_TABLE_VERSION, - "Russell Kroll \n" \ - "Nigel Metheringham \n" \ - "Michal Soltys ", - DRV_STABLE, - { NULL } + APC_TABLE_VERSION }; diff --git a/drivers/apcsmart_tabs.h b/drivers/apcsmart_tabs.h index 2e2e44c..3d43b53 100644 --- a/drivers/apcsmart_tabs.h +++ b/drivers/apcsmart_tabs.h @@ -20,8 +20,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_APCSMART_TABS_H_SEEN -#define NUT_APCSMART_TABS_H_SEEN 1 +#ifndef __apcsmart_tabs_h__ +#define __apcsmart_tabs_h__ #include "main.h" @@ -103,4 +103,4 @@ extern apc_cmdtab_t apc_cmdtab[]; extern apc_compattab_t apc_compattab[]; extern upsdrv_info_t apc_tab_info; -#endif /* NUT_APCSMART_TABS_H_SEEN */ +#endif diff --git a/drivers/apcupsd-ups.c b/drivers/apcupsd-ups.c index 29d20dd..1cfc39b 100644 --- a/drivers/apcupsd-ups.c +++ b/drivers/apcupsd-ups.c @@ -16,8 +16,6 @@ */ -#include "config.h" - #include #include #include @@ -26,12 +24,9 @@ #include "main.h" #include "apcupsd-ups.h" -#include "attribute.h" #define DRIVER_NAME "apcupsd network client UPS driver" -#define DRIVER_VERSION "0.6" - -#define POLL_INTERVAL_MIN 10 +#define DRIVER_VERSION "0.04" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -42,7 +37,7 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static uint16_t port=3551; +static int port=3551; static struct sockaddr_in host; static void process(char *item,char *data) @@ -59,8 +54,9 @@ static void process(char *item,char *data) { case DU_FLAG_STATUS: status_init(); - if(!strcmp(data,"COMMLOST")||!strcmp(data,"NETWORK ERROR")|| - !strcmp(data,"ERROR"))status_set("OFF"); + if(!strcmp(data,"COMMLOST")||!strcmp(data,"SHUTTING DOWN")|| + !strcmp(data,"NETWORK ERROR")||!strcmp(data,"ERROR")) + status_set("OFF"); else if(!strcmp(data,"SELFTEST"))status_set("OB"); else for(;(data=strtok(data," "));data=NULL) { @@ -70,8 +66,7 @@ static void process(char *item,char *data) else if(!strcmp(data,"ONLINE"))status_set("OL"); else if(!strcmp(data,"ONBATT"))status_set("OB"); else if(!strcmp(data,"OVERLOAD"))status_set("OVER"); - else if(!strcmp(data,"SHUTTING DOWN")|| - !strcmp(data,"LOWBATT"))status_set("LB"); + else if(!strcmp(data,"LOWBATT"))status_set("LB"); else if(!strcmp(data,"REPLACEBATT"))status_set("RB"); else if(!strcmp(data,"NOBATT"))status_set("BYPASS"); } @@ -133,41 +128,24 @@ static void process(char *item,char *data) data[(int)nut_data[i].info_len]=0; dstate_setinfo(nut_data[i].info_type,"%s",data); } - else - { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - /* default_value acts as a format string in this case */ - dstate_setinfo(nut_data[i].info_type, - nut_data[i].default_value, - atof(data)*nut_data[i].info_len); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } + else dstate_setinfo(nut_data[i].info_type, + nut_data[i].default_value, + atof(data)*nut_data[i].info_len); break; } } static int getdata(void) { - ssize_t x; - int fd_flags; - uint16_t n; + int x, fd_flags; + short n; char *item; char *data; struct pollfd p; char bfr[1024]; for(x=0;nut_data[x].info_type;x++) - if(!(nut_data[x].drv_flags & DU_FLAG_INIT) && !(nut_data[x].drv_flags & DU_FLAG_PRESERVE)) + if(!(nut_data[x].drv_flags&DU_FLAG_INIT)) dstate_delinfo(nut_data[x].info_type); if((p.fd=socket(AF_INET,SOCK_STREAM,0))==-1) @@ -214,12 +192,6 @@ static int getdata(void) return 0; } else if(x<0||x>=(int)sizeof(bfr)) - /* Note: LGTM.com suggests "Comparison is always false because x >= 0" - * for the line above, probably because ntohs() returns an uint type. - * I am reluctant to fix this one, because googling for headers from - * random OSes showed various types used as the return value (uint16_t, - * unsigned_short, u_short, in_port_t...) - */ { upsdebugx(1,"apcupsd communication error"); close(p.fd); @@ -228,7 +200,7 @@ static int getdata(void) if(poll(&p,1,15000)!=1)break; - if(read(p.fd,bfr,(size_t)x)!=x) + if(read(p.fd,bfr,x)!=x) { upsdebugx(1,"apcupsd communication error"); close(p.fd); @@ -265,21 +237,16 @@ void upsdrv_initinfo(void) if(!port)fatalx(EXIT_FAILURE,"invalid host or port specified!"); if(getdata())fatalx(EXIT_FAILURE,"can't communicate with apcupsd!"); else dstate_dataok(); - - poll_interval = (poll_interval > POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval; + poll_interval=60; } void upsdrv_updateinfo(void) { if(getdata())upslogx(LOG_ERR,"can't communicate with apcupsd!"); else dstate_dataok(); - - poll_interval = (poll_interval > POLL_INTERVAL_MIN) ? POLL_INTERVAL_MIN : poll_interval; + poll_interval=60; } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { fatalx(EXIT_FAILURE, "shutdown not supported"); @@ -303,11 +270,9 @@ void upsdrv_initups(void) /* TODO: fix parsing since bare IPv6 addresses contain colons */ if((p=strchr(device_path,':'))) { - int i; *p++=0; - i=atoi(p); - if(i<1||i>65535)i=0; - port = (uint16_t)i; + port=atoi(p); + if(port<1||port>65535)port=0; } } else device_path="localhost"; diff --git a/drivers/apcupsd-ups.h b/drivers/apcupsd-ups.h index 8abdbf4..14bf923 100644 --- a/drivers/apcupsd-ups.h +++ b/drivers/apcupsd-ups.h @@ -18,9 +18,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_APCUPSD_UPS_H_SEEN -#define NUT_APCUPSD_UPS_H_SEEN 1 - /* from usbhid-ups.h */ /* --------------------------------------------------------------- */ /* Struct & data for ups.status processing */ @@ -44,8 +41,7 @@ typedef struct { #define STATUS_CHRG 1024 /* charging */ #define STATUS_DISCHRG 2048 /* discharging */ -/* -static status_lkp_t status_info[] = { +status_lkp_t status_info[] = { { "CAL", STATUS_CAL }, { "TRIM", STATUS_TRIM }, { "BOOST", STATUS_BOOST }, @@ -60,7 +56,6 @@ static status_lkp_t status_info[] = { { "DISCHRG", STATUS_DISCHRG }, { "NULL", 0 }, }; -*/ /* from usbhid-ups.h */ typedef struct { @@ -94,7 +89,6 @@ typedef struct { #define DU_FLAG_TIME 8 #define DU_FLAG_FW1 16 #define DU_FLAG_FW2 32 -#define DU_FLAG_PRESERVE 64 /* ------------ */ /* Data table */ @@ -130,21 +124,14 @@ static apcuspd_info_t nut_data[] = { "LINEFREQ", "input.frequency", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, { "OUTPUTV", "output.voltage", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, { "LINEFREQ", "output.frequency", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, - { "BCHARGE", "battery.charge", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_PRESERVE, NULL }, + { "BCHARGE", "battery.charge", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, { "MBATTCHG", "battery.charge.low", ST_FLAG_RW, 1, "%.0f", DU_FLAG_NONE, NULL }, { "BATTDATE", "battery.date", ST_FLAG_STRING /* | ST_FLAG_RW */, 16, NULL, DU_FLAG_DATE, NULL }, { "BATTV", "battery.voltage", 0, 1, "%1.1f", DU_FLAG_NONE, NULL }, { "NOMBATTV", "battery.voltage.nominal", 0, 1, "%1.1f", DU_FLAG_NONE, NULL }, - { "TIMELEFT", "battery.runtime", ST_FLAG_RW, 60, "%1.1f", DU_FLAG_PRESERVE, NULL }, + { "TIMELEFT", "battery.runtime", ST_FLAG_RW, 60, "%1.1f", DU_FLAG_NONE, NULL }, { "MINTIMEL", "battery.runtime.low", ST_FLAG_RW, 60, "%.0f", DU_FLAG_NONE, NULL }, { "RETPCT", "battery.charge.restart", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, { "NOMPOWER", "ups.realpower.nominal", 0, 1, "%1.1f", DU_FLAG_INIT, NULL }, - { "LOAD_W", "ups.realpower", 0, 1, "%1.1f", DU_FLAG_NONE, NULL }, - { "LOADAPNT", "power.percent", ST_FLAG_RW, 1, "%1.1f", DU_FLAG_NONE, NULL }, - { "OUTCURNT", "output.current", 0, 1, "%1.2f", DU_FLAG_NONE, NULL }, - { "LOAD_VA", "ups.power", 0, 1, "%1.1f", DU_FLAG_NONE, NULL }, - { "NOMAPNT", "ups.power.nominal", 0, 1, "%.0f", DU_FLAG_INIT, NULL }, { NULL, NULL, 0, 0, NULL, DU_FLAG_NONE, NULL } }; - -#endif /* NUT_APCUPSD_UPS_H_SEEN */ diff --git a/drivers/arduino-hid.c b/drivers/arduino-hid.c deleted file mode 100644 index 5b74c12..0000000 --- a/drivers/arduino-hid.c +++ /dev/null @@ -1,148 +0,0 @@ -/* arduino-hid.c - subdriver to monitor Arduino USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2021 Alex Bratchik - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-usbhid-subdriver script. It must be customized. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be first */ - -#include "usbhid-ups.h" -#include "arduino-hid.h" -#include "main.h" /* for getval() */ -#include "usb-common.h" - -#define ARDUINO_HID_VERSION "Arduino HID 0.2" -/* FIXME: experimental flag to be put in upsdrv_info */ - -/* Arduino */ -#define ARDUINO_VENDORID 0x2341 -#define ARDUINO_VENDORID2 0x2A03 - -/* USB IDs device table */ -static usb_device_id_t arduino_usb_device_table[] = { - /* Arduino Leonardo, Leonardo ETH and Pro Micro*/ - { USB_DEVICE(ARDUINO_VENDORID, 0x0036), NULL }, - { USB_DEVICE(ARDUINO_VENDORID, 0x8036), NULL }, - { USB_DEVICE(ARDUINO_VENDORID2, 0x0036), NULL }, - { USB_DEVICE(ARDUINO_VENDORID2, 0x8036), NULL }, - { USB_DEVICE(ARDUINO_VENDORID2, 0x0040), NULL }, - { USB_DEVICE(ARDUINO_VENDORID2, 0x8040), NULL }, - - /* Terminating entry */ - { 0, 0, NULL } -}; - -static usb_communication_subdriver_t *usb = &usb_subdriver; - - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -/* ARDUINO usage table */ -static usage_lkp_t arduino_usage_lkp[] = { - { NULL, 0 } -}; - -static usage_tables_t arduino_utab[] = { - arduino_usage_lkp, - hid_usage_lkp, - NULL, -}; - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t arduino_hid2nut[] = { - - /* USB HID PDC defaults */ - { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL}, - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL}, - { "ups.timer.start", 0, 0, "UPS.PowerSummary.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - { "ups.timer.shutdown", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - { "ups.timer.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, - - /* USB HID PDC defaults */ - { "load.off.delay", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 0, "UPS.PowerSummary.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, - { "shutdown.stop", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "-1", HU_TYPE_CMD, NULL }, - { "shutdown.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *arduino_format_model(HIDDevice_t *hd) { - return hd->Product; -} - -static const char *arduino_format_mfr(HIDDevice_t *hd) { - return hd->Vendor ? hd->Vendor : "Arduino"; -} - -static const char *arduino_format_serial(HIDDevice_t *hd) { - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if - * the device is supported by this subdriver, else 0. */ -static int arduino_claim(HIDDevice_t *hd) -{ - int status = is_usb_device_supported(arduino_usb_device_table, hd); - - switch (status) { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - usb->hid_ep_in=4; - usb->hid_ep_out=5; - usb->hid_rep_index = 2; - return 1; - } - possibly_supported("Arduino", hd); - return 0; - - case SUPPORTED: - usb->hid_ep_in=4; - usb->hid_ep_out=5; - usb->hid_rep_index = 2; - return 1; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t arduino_subdriver = { - ARDUINO_HID_VERSION, - arduino_claim, - arduino_utab, - arduino_hid2nut, - arduino_format_model, - arduino_format_mfr, - arduino_format_serial, - fix_report_desc, -}; diff --git a/drivers/arduino-hid.h b/drivers/arduino-hid.h deleted file mode 100644 index 025c211..0000000 --- a/drivers/arduino-hid.h +++ /dev/null @@ -1,31 +0,0 @@ -/* arduino-hid.h - subdriver to monitor Arduino USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2021 Alex Bratchik - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef ARDUINO_HID_H -#define ARDUINO_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t arduino_subdriver; - -#endif /* ARDUINO_HID_H */ diff --git a/drivers/asem.c b/drivers/asem.c deleted file mode 100644 index 7b0af43..0000000 --- a/drivers/asem.c +++ /dev/null @@ -1,441 +0,0 @@ -/* asem.c - driver for ASEM PB 1300 hardware, accessible through i2c. - - Copyright (C) 2014 Giuseppe Corbelli - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - ASEM SPA contributed with support and documentation. - Copan Italia SPA funded the development. - - There are 2 versions of the charger. Older one is based on Max1667, - newer one is a custom solution. Both are on address 0x09. - To be compatible with both versions just read bit 15 of address 0x13 - to have online/on battery status. - Battery monitor is a BQ2060 at address 0x0B. - - Beware that the SystemIO memory used by the i2c controller is reserved by ACPI. - On Linux, as of 3.5.x kernel only a native driver (i2c_i801) is available, - so you need to boot with acpi_enforce_resources=lax option. -*/ - -#include "main.h" - -#include -#include -#include - -/* Depends on i2c-dev.h, Linux only - * Linux I2C userland is a bit of a mess until distros refresh to - * the i2c-tools 4.x release that profides i2c/smbus.h for userspace - * instead of (re)using linux/i2c-dev.h, which conflicts with a - * kernel header of the same name. - * - * See: - * https://i2c.wiki.kernel.org/index.php/Plans_for_I2C_Tools_4 - */ -#if HAVE_LINUX_SMBUS_H -# include -#endif -#if HAVE_LINUX_I2C_DEV_H -# include /* for I2C_SLAVE */ -# if !HAVE_LINUX_SMBUS_H -# ifndef I2C_FUNC_I2C -# include -# endif -# endif -#endif - -#include - -#ifndef __STR__ -# define __STR__(x) #x -#endif -#ifndef __XSTR__ -# define __XSTR__(x) __STR__(x) -#endif - -#define DRIVER_NAME "ASEM" -#define DRIVER_VERSION "0.11" - -/* Valid on ASEM PB1300 UPS */ -#define BQ2060_ADDRESS 0x0B -#define CHARGER_ADDRESS 0x09 - -#define CMD_DEVICENAME 0x21 - -#define LOW_BATTERY_THRESHOLD 25 -#define HIGH_BATTERY_THRESHOLD 75 - -#define ACCESS_DEVICE(fd, address) \ - if (ioctl(fd, I2C_SLAVE, address) < 0) { \ - fatal_with_errno(EXIT_FAILURE, "Failed to acquire bus access and/or talk to i2c slave 0x%02X", address); \ - } - -static unsigned long lb_threshold = LOW_BATTERY_THRESHOLD; -static unsigned long hb_threshold = HIGH_BATTERY_THRESHOLD; - -static char *valid_devicename_data[] = { - "ASEM SPA", - NULL -}; - -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Giuseppe Corbelli ", - DRV_EXPERIMENTAL, - {NULL} -}; - -void upsdrv_initinfo(void) -{ - __s32 i2c_status; - __u8 buffer[10]; - unsigned short year, month, day; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT -# pragma GCC diagnostic ignored "-Wextra-semi-stmt" -#endif - /* Current definition of this macro ends with a brace; - * we keep the useless trailing ";" for readability */ - ACCESS_DEVICE(upsfd, BQ2060_ADDRESS); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic pop -#endif - - /* Set capacity mode in mA(h) */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x03); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read BatteryMode word data"); - } - /* Clear 15th bit */ - i2c_status = i2c_smbus_write_word_data(upsfd, 0x03, i2c_status & ~0x8000); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not set BatteryMode word data"); - } - - /* Device name */ - memset(buffer, 0, 10); - i2c_status = i2c_smbus_read_block_data(upsfd, 0x21, buffer); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read DeviceName block data"); - } - upsdebugx(1, "UPS model %s", (char *) buffer); - dstate_setinfo("ups.model", "%s", (char *) buffer); - - /* Manufacturing date */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x1B); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read ManufactureDate word data"); - } - /* (Year - 1980) * 512 */ - year = (i2c_status >> 9) & 0x000000FF; - /* Month * 32 */ - month = (i2c_status >> 4) & 0x0000001F; - day = i2c_status & 0x0000001F; - upsdebugx(1, "UPS manufacturing date %d-%02d-%02d (%d)", year + 1980, month, day, i2c_status); - dstate_setinfo("ups.mfr.date", "%d-%02d-%02d", year + 1980, month, day); - - /* Device chemistry */ - memset(buffer, 0, 10); - i2c_status = i2c_smbus_read_block_data(upsfd, 0x22, buffer); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read DeviceChemistry block data"); - } - upsdebugx(1, "Battery chemistry %s", (char *) buffer); - dstate_setinfo("battery.type", "%s", (char *) buffer); - - /* Serial number */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x1C); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read SerialNumber block data"); - } - upsdebugx(1, "Serial Number %d", i2c_status); - dstate_setinfo("ups.serial", "%d", i2c_status); -} - -void upsdrv_updateinfo(void) -{ - static char online; - static char discharging; - static char fully_charged; - static unsigned short charge_percentage; - static unsigned short voltage; - static unsigned short capacity; - static signed short current; - static __s32 i2c_status; - static __s32 temperature; - static __s32 runtime_to_empty; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT -# pragma GCC diagnostic ignored "-Wextra-semi-stmt" -#endif - /* Current definition of this macro ends with a brace; - * we keep the useless trailing ";" for readability */ - ACCESS_DEVICE(upsfd, CHARGER_ADDRESS); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic pop -#endif - /* Charger only supplies online/offline status */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x13); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read charger status word at address 0x13"); - return; - } - online = (i2c_status & 0x8000) != 0; - upsdebugx(3, "Charger status 0x%02X, online %d", i2c_status, online); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT -# pragma GCC diagnostic ignored "-Wextra-semi-stmt" -#endif - /* Current definition of this macro ends with a brace; - * we keep the useless trailing ";" for readability */ - ACCESS_DEVICE(upsfd, BQ2060_ADDRESS); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic pop -#endif - i2c_status = i2c_smbus_read_word_data(upsfd, 0x16); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read bq2060 status word at address 0x16"); - return; - } - upsdebugx(3, "bq2060 status 0x04%X", i2c_status); - /* Busy, leave data as stale, try next time */ - if (i2c_status & 0x0001) { - dstate_datastale(); - upslogx(LOG_NOTICE, "bq2060 is busy"); - return; - } - /* Error, leave data as stale, try next time */ - if (i2c_status & 0x000F) { - dstate_datastale(); - upslogx(LOG_WARNING, "bq2060 returned error code 0x%02X", i2c_status & 0x000F); - return; - } - - discharging = (i2c_status & 0x0040); - fully_charged = (i2c_status & 0x0020); - - /* Charge percentage */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x0D); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read charge percentage from bq2060 at address 0x0D"); - return; - } - charge_percentage = i2c_status & 0xFFFF; - upsdebugx(3, "Charge percentage %03d", charge_percentage); - - /* Battery voltage in mV */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x09); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read voltage from bq2060 at address 0x09"); - return; - } - voltage = i2c_status & 0x0000FFFF; - upsdebugx(3, "Battery voltage %d mV", voltage); - - /* Temperature in °K */ - temperature = i2c_smbus_read_word_data(upsfd, 0x08); - if (temperature == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read temperature from bq2060 at address 0x08"); - return; - } - upsdebugx(3, "Temperature %4.1f K", temperature / 10.0); - - /* Current load in mA, positive for charge, negative for discharge */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x0A); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read current from bq2060 at address 0x0A"); - return; - } - current = i2c_status & 0x0000FFFF; - upsdebugx(3, "Current %d mA", current); - - /* Current capacity */ - i2c_status = i2c_smbus_read_word_data(upsfd, 0x0F); - if (i2c_status == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read RemainingCapacity word data"); - return; - } - capacity = i2c_status & 0x0000FFFF; - upsdebugx(3, "Current capacity %d mAh", capacity); - - /* Expected runtime capacity, averaged by gauge */ - runtime_to_empty = i2c_smbus_read_word_data(upsfd, 0x12); - if (runtime_to_empty == -1) { - dstate_datastale(); - upslogx(LOG_ERR, "Could not read AverageTimeToEmpty word data"); - return; - } - upsdebugx(3, "Expected run-time to empty %d m", runtime_to_empty); - - status_init(); - status_set(online ? "OL" : "OB"); - if (!discharging && !fully_charged) - status_set("CHRG"); - else if (discharging && current < 0) - status_set("DISCHRG"); - - if (charge_percentage >= hb_threshold) - status_set("HB"); - else if (charge_percentage <= lb_threshold) - status_set("LB"); - - /* In V */ - dstate_setinfo("battery.voltage", "%2.3f", voltage / 1000.0); - /* In mAh */ - dstate_setinfo("battery.current", "%2.3f", current / 1000.0); - dstate_setinfo("battery.charge", "%d", charge_percentage); - /* In mAh */ - dstate_setinfo("battery.capacity", "%2.3f", capacity / 1000.0); - /* In °C */ - dstate_setinfo("ups.temperature", "%4.1f", (temperature / 10.0) - 273.15); - /* In seconds */ - dstate_setinfo("battery.runtime", "%d", runtime_to_empty * 60); - status_commit(); - dstate_dataok(); -} - -void upsdrv_shutdown(void) - __attribute__((noreturn)); - -void upsdrv_shutdown(void) -{ - /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ - - /* maybe try to detect the UPS here, but try a shutdown even if - it doesn't respond at first if possible */ - - /* replace with a proper shutdown function */ - fatalx(EXIT_FAILURE, "shutdown not supported"); - - /* you may have to check the line status since the commands - for toggling power are frequently different for OL vs. OB */ - - /* OL: this must power cycle the load if possible */ - - /* OB: the load must remain off until the power returns */ -} - -void upsdrv_help(void) -{ - /* Redundant */ - printf("\nASEM options\n"); - printf(" HIGH/low battery thresholds\n"); - printf(" lb = " __XSTR__(LOW_BATTERY_THRESHOLD) " (battery is low under this level)\n"); - printf(" hb = " __XSTR__(HIGH_BATTERY_THRESHOLD) " (battery is high above this level)\n"); -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "lb", "Low battery threshold, default " __XSTR__(LOW_BATTERY_THRESHOLD)); - addvar(VAR_VALUE, "hb", "High battery threshold, default " __XSTR__(HIGH_BATTERY_THRESHOLD)); -} - -void upsdrv_initups(void) -{ - __s32 i2c_status; - __u8 DeviceName_buffer[10]; - unsigned int i; - unsigned long x; - char *DeviceName; - char *option; - - upsfd = open(device_path, O_RDWR); - if (upsfd < 0) { - fatal_with_errno(EXIT_FAILURE, "Could not open device port '%s'", device_path); - } - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT -# pragma GCC diagnostic ignored "-Wextra-semi-stmt" -#endif - /* Current definition of this macro ends with a brace; - * we keep the useless trailing ";" for readability */ - ACCESS_DEVICE(upsfd, BQ2060_ADDRESS); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT) -# pragma GCC diagnostic pop -#endif - - /* Get ManufacturerName */ - memset(DeviceName_buffer, 0, 10); - i2c_status = i2c_smbus_read_block_data(upsfd, 0x20, DeviceName_buffer); - if (i2c_status == -1) { - fatal_with_errno(EXIT_FAILURE, "Could not read DeviceName block data"); - } - i = 0; - while ( (DeviceName = valid_devicename_data[i++]) ) { - if (0 == memcmp(DeviceName, DeviceName_buffer, i2c_status)) - break; - } - if (!DeviceName) { - fatal_with_errno(EXIT_FAILURE, "Device '%s' unknown", (char *) DeviceName_buffer); - } - upsdebugx(1, "Found device '%s' on port '%s'", (char *) DeviceName, device_path); - dstate_setinfo("ups.mfr", "%s", (char *) DeviceName); - - option = getval("lb"); - if (option) { - x = strtoul(option, NULL, 0); - if ((x == 0) && (errno != 0)) { - upslogx(LOG_WARNING, "Invalid value specified for low battery threshold: '%s'", option); - } else { - lb_threshold = x; - } - } - option = getval("hb"); - if (option) { - x = strtoul(option, NULL, 0); - if ((x == 0) && (errno != 0)) { - upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s'", option); - } else if ((x < 1) || (x > 100)) { - upslogx(LOG_WARNING, "Invalid value specified for high battery threshold: '%s' (must be 1 < hb <= 100)", option); - } else { - hb_threshold = x; - } - } - /* Invalid values specified */ - if (lb_threshold > hb_threshold) { - upslogx(LOG_WARNING, "lb > hb specified in options. Returning to defaults."); - lb_threshold = LOW_BATTERY_THRESHOLD; - hb_threshold = HIGH_BATTERY_THRESHOLD; - } - - upslogx(LOG_NOTICE, "High battery threshold is %lu, low battery threshold is %lu", lb_threshold, hb_threshold); -} - -void upsdrv_cleanup(void) -{ - close(upsfd); -} diff --git a/drivers/baytech-mib.c b/drivers/baytech-mib.c index 43098cd..d17c0a5 100644 --- a/drivers/baytech-mib.c +++ b/drivers/baytech-mib.c @@ -2,7 +2,7 @@ * * Copyright (C) 2009 * Opengear - * Arnaud Quette + * Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,76 +23,69 @@ #include "baytech-mib.h" -/* NOTE: last badly versioned release was "4032" but should be "X.Y[Z]"! */ -#define BAYTECH_MIB_VERSION "0.4034" +#define BAYTECH_MIB_VERSION "4031" /* Baytech MIB */ #define BAYTECH_OID_MIB ".1.3.6.1.4.1.4779" #define BAYTECH_OID_MODEL_NAME ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1" -static info_lkp_t baytech_outlet_status_info[] = { - { -1, "error", NULL, NULL }, - { 0, "off", NULL, NULL }, - { 1, "on", NULL, NULL }, - { 2, "cycling", NULL, NULL }, /* transitional status */ - { 0, NULL, NULL, NULL } +static info_lkp_t outlet_status_info[] = { + { -1, "error" }, + { 0, "off" }, + { 1, "on" }, + { 2, "cycling" }, /* transitional status */ + { 0, NULL } }; /* Snmp2NUT lookup table for BayTech MIBs */ static snmp_info_t baytech_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* Device page */ { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "BayTech", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1", - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, /* UPS page */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Baytech", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1", - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.3.0", - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.2.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.1.1.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.10.2.1", NULL, 0, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.10.2.1", NULL, 0, NULL, NULL }, /* Outlet page */ { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.count", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.2.1.15.1", "0", 0, NULL }, - { "outlet.current", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.6.2.1", NULL, 0, NULL }, - { "outlet.voltage", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.8.2.1", NULL, 0, NULL }, + { "outlet.current", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.6.2.1", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.1, ".1.3.6.1.4.1.4779.1.3.5.5.1.8.2.1", NULL, 0, NULL, NULL }, /* outlet template definition */ - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_OUTLET, &baytech_outlet_status_info[0] }, - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.4.1.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.6.1.3.2.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_OUTLET | SU_FLAG_OK, NULL }, - { "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_OUTLET, &outlet_status_info[0], NULL }, + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4779.1.3.5.3.1.4.1.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.6.1.3.2.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_OUTLET | SU_FLAG_OK, NULL, NULL }, + { "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL, NULL }, /* instant commands. */ - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", "1", SU_TYPE_CMD | SU_OUTLET, NULL }, + { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.4779.1.3.5.3.1.3.1.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } }; -mib2nut_info_t baytech = { "baytech", BAYTECH_MIB_VERSION, NULL, BAYTECH_OID_MODEL_NAME, baytech_mib, BAYTECH_OID_MIB, NULL }; +mib2nut_info_t baytech = { "baytech", BAYTECH_MIB_VERSION, "", BAYTECH_OID_MODEL_NAME, baytech_mib }; diff --git a/drivers/bcmxcp.c b/drivers/bcmxcp.c index e0ea904..ad3c5eb 100644 --- a/drivers/bcmxcp.c +++ b/drivers/bcmxcp.c @@ -9,7 +9,7 @@ Copyright (C) 2004 Kjell Claesson 2004 Tore Ørpetveit - 2011 - 2015 Arnaud Quette + 2011 - 2012 Arnaud Quette Thanks to Tore Ørpetveit that sent me the manuals for bcm/xcp. @@ -22,7 +22,7 @@ ojw0000 2007Apr5 Oliver Wilcock - modified to control individual load segments (outlet.2.shutdown.return) on Powerware PW5125. Modified to support setvar for outlet.n.delay.start by Rich Wrenn (RFW) 9-3-11. - Modified to support setvar for outlet.n.delay.shutdown by Arnaud Quette, 9-12-11 + Modified to support setvar for outlet.n.delay.shutdown by Arnaud Quette, 9-12-11 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,85 +40,84 @@ This program is free software; you can redistribute it and/or modify TODO List: - Extend the parsing of the Standard ID Block, to read: + Extend the parsing of the Standard ID Block, to read: - Config Block Length: (High priority) - Give information if config block is - present, and how long it is, if it exist. - If config block exist, read the config block and parse the - 'Length of the Extended Limits Configuration Block' for - extended configuration commands + Config Block Length: (High priority) + Give information if config block is + present, and how long it is, if it exist. + If config block exist, read the config block and parse the + 'Length of the Extended Limits Configuration Block' for + extended configuration commands - Statistic map Size: (Low priority) - May be used to se if there is a Statistic Map. - It holds data on the utility power quality for - the past month and since last reset. Number of - times on battery and how long. Up time and utility - frequency deviation. (Only larger ups'es) + Statistic map Size: (Low priority) + May be used to se if there is a Statistic Map. + It holds data on the utility power quality for + the past month and since last reset. Number of + times on battery and how long. Up time and utility + frequency deviation. (Only larger ups'es) - Size of Alarm History Log: (Low priority) - See if it have any alarm history block and enable - command to dump it. + Size of Alarm History Log: (Low priority) + See if it have any alarm history block and enable + command to dump it. - Maximum Supported Command Length: ( Med. to High priority) - Give info about the ups receive buffer size. + Maximum Supported Command Length: ( Med. to High priority) + Give info about the ups receive buffer size. - Size of Alarm Block: ( Med. to High priority) - Make a smarter handling of the Active alarm's if we know the length - of the Active Alarm Block. Don't need the long loop to parse the - alarm's. Maybe use another way to set up the alarm struct in the - 'init_alarm_map'. + Size of Alarm Block: ( Med. to High priority) + Make a smarter handling of the Active alarm's if we know the length + of the Active Alarm Block. Don't need the long loop to parse the + alarm's. Maybe use another way to set up the alarm struct in the + 'init_alarm_map'. - Parse 'Communication Capabilities Block' ( Low priority) - Get info of the connected ports ID, number of baud rates, - command and respnse length. + Parse 'Communication Capabilities Block' ( Low priority) + Get info of the connected ports ID, number of baud rates, + command and respnse length. - Parse 'Communication Port List Block': ( Low priority) - This block gives info about the communication ports. Some ups'es - have multiple comport's, and use one port for eatch load segment. - In this block it is possible to get: - Number of ports. (In this List) - This Comport id (Which Comm Port is reporting this block.) - Comport id (Id for eatch port listed. The first comport ID=1) - Baudrate of the listed port. - Serial config. - Port usage: - What this Comm Port is being used for: - 0 = Unknown usage, No communication occurring. - 1 = Undefined / Unknown communication occurring - 2 = Waiting to communicate with a UPS - 3 = Communication established with a UPS - 4 = Waiting to communicate with software or adapter - 5 = Communication established software (e.g., LanSafe) - or adapter (e.g., ConnectUPS) - 6 = Communicating with a Display Device - 7 = Multi-drop Serial channel - 8 = Communicating with an Outlet Controller - Number of outlets. (Number of Outlets "assigned to" (controlled by) this Comm Port) - Outlet number. (Each assigned Outlet is listed (1-64)) + Parse 'Communication Port List Block': ( Low priority) + This block gives info about the communication ports. Some ups'es + have multiple comport's, and use one port for eatch load segment. + In this block it is possible to get: + Number of ports. (In this List) + This Comport id (Which Comm Port is reporting this block.) + Comport id (Id for eatch port listed. The first comport ID=1) + Baudrate of the listed port. + Serial config. + Port usage: + What this Comm Port is being used for: + 0 = Unknown usage, No communication occurring. + 1 = Undefined / Unknown communication occurring + 2 = Waiting to communicate with a UPS + 3 = Communication established with a UPS + 4 = Waiting to communicate with software or adapter + 5 = Communication established software (e.g., LanSafe) + or adapter (e.g., ConnectUPS) + 6 = Communicating with a Display Device + 7 = Multi-drop Serial channel + 8 = Communicating with an Outlet Controller + Number of outlets. (Number of Outlets "assigned to" (controlled by) this Comm Port) + Outlet number. (Each assigned Outlet is listed (1-64)) - 'Set outlet parameter command (0x97)' to alter the delay - settings or turn the outlet on or off with a delay (0 - 32767 seconds) + 'Set outlet parameter command (0x97)' to alter the delay + settings or turn the outlet on or off with a delay (0 - 32767 seconds) - Rewrite some parts of the driver, to minimise code duplication. (Like the instant commands) + Rewrite some parts of the driver, to minimise code duplication. (Like the instant commands) - Implement support for Password Authorization (XCP spec, §4.3.2) + Implement support for Password Authorization (XCP spec, §4.3.2) - Complete support for settable variables (upsh.setvar) + Complete support for settable variables (upsh.setvar) */ #include "main.h" #include /* For ldexp() */ #include /*for FLT_MAX */ - #include "nut_stdint.h" /* for uint8_t, uint16_t, uint32_t, ... */ #include "bcmxcp_io.h" #include "bcmxcp.h" #define DRIVER_NAME "BCMXCP UPS driver" -#define DRIVER_VERSION "0.32" +#define DRIVER_VERSION "0.28" #define MAX_NUT_NAME_LENGTH 128 #define NUT_OUTLET_POSITION 7 @@ -130,18 +129,16 @@ upsdrv_info_t upsdrv_info = { "Martin Schroeder \n" \ "Kjell Claesson \n" \ "Tore Ørpetveit \n" \ - "Arnaud Quette \n" \ "Wolfgang Ocker \n" \ "Oliver Wilcock\n" \ "Prachi Gandhi \n" \ - "Alf Høgemark \n" \ - "Gavrilov Igor", + "Alf Høgemark ", DRV_STABLE, { &comm_upsdrv_info, NULL } }; -static uint16_t get_word(const unsigned char*); -static uint32_t get_long(const unsigned char*); +static int get_word(const unsigned char*); +static long int get_long(const unsigned char*); static float get_float(const unsigned char *data); static void init_command_map(void); static void init_meter_map(void); @@ -149,114 +146,84 @@ static void init_alarm_map(void); static bool_t init_command(int size); static void init_config(void); static void init_limit(void); -static void init_ext_vars(void); static void init_topology(void); static void init_ups_meter_map(const unsigned char *map, unsigned char len); static void init_ups_alarm_map(const unsigned char *map, unsigned char len); -static bool_t set_alarm_support_in_alarm_map(const unsigned char *map, const unsigned int mapIndex, const unsigned int bitmask, const unsigned int alarmMapIndex, const unsigned int alarmBlockIndex); +static bool_t set_alarm_support_in_alarm_map(const unsigned char *map, const int mapIndex, const int bitmask, const int alarmMapIndex, const int alarmBlockIndex); static void decode_meter_map_entry(const unsigned char *entry, const unsigned char format, char* value); -static unsigned char init_outlet(unsigned char len); +static int init_outlet(unsigned char len); static void init_system_test_capabilities(void); static int instcmd(const char *cmdname, const char *extra); static int setvar(const char *varname, const char *val); -static int decode_instcmd_exec(const ssize_t res, const unsigned char exec_status, const char *cmdname, const char *success_msg); -static int decode_setvar_exec(const ssize_t res, const unsigned char exec_status, const char *cmdname, const char *success_msg); +static int decode_instcmd_exec(const int res, const unsigned char exec_status, const char *cmdname, const char *success_msg); static float calculate_ups_load(const unsigned char *data); static const char *nut_find_infoval(info_lkp_t *xcp2info, const double value, const bool_t debug_output_nonexisting); -/* static const char *FreqTol[3] = {"+/-2%", "+/-5%", "+/-7"}; */ -static const char *ABMStatus[4] = { - "charging", - "discharging", - "floating", - "resting" - }; -static const char *OutletStatus[9] = { - "unknown", - "on/closed", - "off/open", - "on with pending", - "off with pending", - "unknown", - "unknown", - "failed and closed", - "failed and open" - }; - +const char *FreqTol[3] = {"+/-2%", "+/-5%", "+/-7"}; +const char *ABMStatus[4] = {"Charging", "Discharging", "Floating", "Resting"}; /* Standard Authorization Block */ -static unsigned char AUTHOR[4] = {0xCF, 0x69, 0xE8, 0xD5}; -static int nphases = 0; -static uint16_t outlet_block_len = 0; -static const char *cpu_name[5] = { - "Cont:", - "Inve:", - "Rect:", - "Netw:", - "Disp:" - }; -static const char *horn_stat[3] = { - "disabled", - "enabled", - "muted" - }; +unsigned char AUTHOR[4] = {0xCF, 0x69, 0xE8, 0xD5}; +int nphases = 0; +int outlet_block_len = 0; +const char *cpu_name[5] = {"Cont:", "Inve:", "Rect:", "Netw:", "Disp:"}; + + /* Battery test results */ -static info_lkp_t batt_test_info[] = { - { 0, "No test initiated", NULL, NULL }, - { 1, "In progress", NULL, NULL }, - { 2, "Done and passed", NULL, NULL }, - { 3, "Aborted", NULL, NULL }, - { 4, "Done and error", NULL, NULL }, - { 5, "Test scheduled", NULL, NULL }, +info_lkp_t batt_test_info[] = { + { 0, "No test initiated", NULL }, + { 1, "In progress", NULL }, + { 2, "Done and passed", NULL }, + { 3, "Aborted", NULL }, + { 4, "Done and error", NULL }, + { 5, "Test scheduled", NULL }, /* Not sure about the meaning of the below ones! */ - { 6, NULL, NULL, NULL }, /* The string was present but it has now been removed */ - { 7, NULL, NULL, NULL }, /* The string was not installed at the last power up */ - { 0, NULL, NULL, NULL } + { 6, NULL, NULL }, /* The string was present but it has now been removed */ + { 7, NULL, NULL }, /* The string was not installed at the last power up */ + { 0, NULL, NULL } }; /* Topology map results */ -static info_lkp_t topology_info[] = { - { BCMXCP_TOPOLOGY_OFFLINE_SWITCHER_1P, "Off-line switcher, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_LINEINT_UPS_1P, "Line-Interactive UPS, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_LINEINT_UPS_2P, "Line-Interactive UPS, Two Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_LINEINT_UPS_3P, "Line-Interactive UPS, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_1P, "Dual AC Input, On-Line UPS, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_2P, "Dual AC Input, On-Line UPS, Two Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_3P, "Dual AC Input, On-Line UPS, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_ONLINE_UPS_1P, "On-Line UPS, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_ONLINE_UPS_2P, "On-Line UPS, Two Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_ONLINE_UPS_3P, "On-Line UPS, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_1P, "Parallel Redundant On-Line UPS, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_2P, "Parallel Redundant On-Line UPS, Two Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_3P, "Parallel Redundant On-Line UPS, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_1P, "Parallel for Capacity On-Line UPS, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_2P, "Parallel for Capacity On-Line UPS, Two Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_3P, "Parallel for Capacity On-Line UPS, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_SYSTEM_BYPASS_MODULE_3P, "System Bypass Module, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_HOT_TIE_CABINET_3P, "Hot-Tie Cabinet, Three Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_OUTLET_CONTROLLER_1P, "Outlet Controller, Single Phase", NULL, NULL }, - { BCMXCP_TOPOLOGY_DUAL_AC_STATIC_SWITCH_3P, "Dual AC Input Static Switch Module, 3 Phase", NULL, NULL }, - { 0, NULL, NULL, NULL } +info_lkp_t topology_info[] = { + { BCMXCP_TOPOLOGY_OFFLINE_SWITCHER_1P, "Off-line switcher, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_LINEINT_UPS_1P, "Line-Interactive UPS, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_LINEINT_UPS_2P, "Line-Interactive UPS, Two Phase", NULL }, + { BCMXCP_TOPOLOGY_LINEINT_UPS_3P, "Line-Interactive UPS, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_1P, "Dual AC Input, On-Line UPS, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_2P, "Dual AC Input, On-Line UPS, Two Phase", NULL }, + { BCMXCP_TOPOLOGY_DUAL_AC_ONLINE_UPS_3P, "Dual AC Input, On-Line UPS, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_ONLINE_UPS_1P, "On-Line UPS, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_ONLINE_UPS_2P, "On-Line UPS, Two Phase", NULL }, + { BCMXCP_TOPOLOGY_ONLINE_UPS_3P, "On-Line UPS, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_1P, "Parallel Redundant On-Line UPS, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_2P, "Parallel Redundant On-Line UPS, Two Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_REDUND_ONLINE_UPS_3P, "Parallel Redundant On-Line UPS, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_1P, "Parallel for Capacity On-Line UPS, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_2P, "Parallel for Capacity On-Line UPS, Two Phase", NULL }, + { BCMXCP_TOPOLOGY_PARA_CAPACITY_ONLINE_UPS_3P, "Parallel for Capacity On-Line UPS, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_SYSTEM_BYPASS_MODULE_3P, "System Bypass Module, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_HOT_TIE_CABINET_3P, "Hot-Tie Cabinet, Three Phase", NULL }, + { BCMXCP_TOPOLOGY_OUTLET_CONTROLLER_1P, "Outlet Controller, Single Phase", NULL }, + { BCMXCP_TOPOLOGY_DUAL_AC_STATIC_SWITCH_3P, "Dual AC Input Static Switch Module, 3 Phase", NULL }, + { 0, NULL, NULL } }; /* Command map results */ -static info_lkp_t command_map_info[] = { - { PW_INIT_BAT_TEST, "test.battery.start", NULL, NULL }, - { PW_LOAD_OFF_RESTART, "shutdown.return", NULL, NULL }, - { PW_UPS_OFF, "shutdown.stayoff", NULL, NULL }, - { PW_UPS_ON, "load.on", NULL, NULL }, - { PW_GO_TO_BYPASS, "bypass.start", NULL, NULL }, - { 0, NULL, NULL, NULL } +info_lkp_t command_map_info[] = { + { PW_INIT_BAT_TEST, "test.battery.start", NULL }, + { PW_LOAD_OFF_RESTART, "shutdown.return", NULL }, + { PW_UPS_OFF, "shutdown.stayoff", NULL }, + { 0, NULL, NULL } }; /* System test capabilities results */ -static info_lkp_t system_test_info[] = { - { PW_SYS_TEST_GENERAL, "test.system.start", NULL, NULL }, -/* { PW_SYS_TEST_SCHEDULE_BATTERY_COMMISSION, "test.battery.start.delayed", NULL, NULL }, */ -/* { PW_SYS_TEST_ALTERNATE_AC_INPUT, "test.alternate_acinput.start", NULL, NULL }, */ - { PW_SYS_TEST_FLASH_LIGHTS, "test.panel.start", NULL, NULL }, - { 0, NULL, NULL, NULL } +info_lkp_t system_test_info[] = { + { PW_SYS_TEST_GENERAL, "test.system.start", NULL }, +/* { PW_SYS_TEST_SCHEDULE_BATTERY_COMMISSION, "test.battery.start.delayed", NULL }, */ +/* { PW_SYS_TEST_ALTERNATE_AC_INPUT, "test.alternate_acinput.start", NULL }, */ + { PW_SYS_TEST_FLASH_LIGHTS, "test.panel.start", NULL }, + { 0, NULL, NULL } }; /* allocate storage for shared variables (extern in bcmxcp.h) */ @@ -271,10 +238,10 @@ BCMXCP_STATUS_t /* get_word function from nut driver metasys.c */ -uint16_t get_word(const unsigned char *buffer) /* return a short integer reading a word in the supplied buffer */ +int get_word(const unsigned char *buffer) /* return an integer reading a word in the supplied buffer */ { unsigned char a, b; - uint16_t result; + int result; a = buffer[0]; b = buffer[1]; @@ -284,10 +251,10 @@ uint16_t get_word(const unsigned char *buffer) /* return a short integer reading } /* get_long function from nut driver metasys.c for meter readings*/ -uint32_t get_long(const unsigned char *buffer) /* return a long integer reading 4 bytes in the supplied buffer.*/ +long int get_long(const unsigned char *buffer) /* return a long integer reading 4 bytes in the supplied buffer.*/ { unsigned char a, b, c, d; - uint32_t result; + long int result; a = buffer[0]; b = buffer[1]; @@ -383,7 +350,7 @@ unsigned char calc_checksum(const unsigned char *buf) int i; c = 0; - for (i = 0; i < 2 + buf[1]; i++) + for(i = 0; i < 2 + buf[1]; i++) c -= buf[i]; return c; @@ -437,7 +404,7 @@ void init_command_map() bcmxcp_command_map[PW_SELECT_SUBMODULE].command_desc = "PW_SELECT_SUBMODULE"; bcmxcp_command_map[PW_AUTHORIZATION_CODE].command_desc = "PW_AUTHORIZATION_CODE"; - for (i = 0; i < BCMXCP_COMMAND_MAP_MAX; i++) { + for(i = 0; i < BCMXCP_COMMAND_MAP_MAX; i++) { bcmxcp_command_map[i].command_byte = 0; } } @@ -602,7 +569,7 @@ void init_alarm_map() bcmxcp_alarm_map[BCMXCP_ALARM_HEATSINK_TEMP_SENSOR_FAIL].alarm_desc = "HEATSINK_TEMP_SENSOR_FAIL"; bcmxcp_alarm_map[BCMXCP_ALARM_RECTIFIER_CURRENT_OVER_125].alarm_desc = "RECTIFIER_CURRENT_OVER_125"; bcmxcp_alarm_map[BCMXCP_ALARM_RECTIFIER_FAULT_INTERRUPT_FAIL].alarm_desc = "RECTIFIER_FAULT_INTERRUPT_FAIL"; - bcmxcp_alarm_map[BCMXCP_ALARM_RECTIFIER_POWER_CAPACITOR_FAIL].alarm_desc = "RECTIFIER_POWER_CAPACITOR_FAIL"; + bcmxcp_alarm_map[BCMXCP_ALARM_RECTIFIER_POWER_CAPASITOR_FAIL].alarm_desc = "RECTIFIER_POWER_CAPASITOR_FAIL"; bcmxcp_alarm_map[BCMXCP_ALARM_INVERTER_PROGRAM_STACK_ERROR].alarm_desc = "INVERTER_PROGRAM_STACK_ERROR"; bcmxcp_alarm_map[BCMXCP_ALARM_INVERTER_BOARD_SELFTEST_FAIL].alarm_desc = "INVERTER_BOARD_SELFTEST_FAIL"; bcmxcp_alarm_map[BCMXCP_ALARM_INVERTER_AD_SELFTEST_FAIL].alarm_desc = "INVERTER_AD_SELFTEST_FAIL"; @@ -777,8 +744,7 @@ bool_t init_command(int size) unsigned char answer[PW_ANSWER_MAX_SIZE]; unsigned char commandByte; const char* nutvalue; - ssize_t res; - int iIndex = 0, ncounter, NumComms = 0, i; + int res, iIndex = 0, ncounter, NumComms = 0, i; upsdebugx(1, "entering init_command(%i)", size); @@ -794,11 +760,11 @@ bool_t init_command(int size) res = answer[iIndex]; NumComms = (int)res; /* Number of commands implemented in this UPS */ - upsdebugx(3, "Number of commands implemented in ups %zd", res); + upsdebugx(3, "Number of commands implemented in ups %d", res); iIndex++; res = answer[iIndex]; /* Entry length - bytes reported for each command */ iIndex++; - upsdebugx(5, "bytes per command %zd", res); + upsdebugx(5, "bytes per command %d", res); /* In case of debug - make explanation of values */ upsdebugx(2, "Index\tCmd byte\tDescription"); @@ -809,7 +775,7 @@ bool_t init_command(int size) for (ncounter = 0; ncounter < NumComms; ncounter++) { commandByte = answer[iIndex]; - if (commandByte < BCMXCP_COMMAND_MAP_MAX) { + if(commandByte >= 0 && commandByte < BCMXCP_COMMAND_MAP_MAX) { upsdebugx(2, "%03d\t%02x\t%s", ncounter, commandByte, bcmxcp_command_map[commandByte].command_desc); bcmxcp_command_map[commandByte].command_byte = commandByte; } @@ -821,9 +787,9 @@ bool_t init_command(int size) } /* Map supported commands to instcmd */ - for (i = 0; i < BCMXCP_COMMAND_MAP_MAX; i++) { - if (bcmxcp_command_map[i].command_desc != NULL) { - if (bcmxcp_command_map[i].command_byte > 0) { + for(i = 0; i < BCMXCP_COMMAND_MAP_MAX; i++) { + if(bcmxcp_command_map[i].command_desc != NULL) { + if(bcmxcp_command_map[i].command_byte > 0) { if ((nutvalue = nut_find_infoval(command_map_info, bcmxcp_command_map[i].command_byte, FALSE)) != NULL) { dstate_addcmd(nutvalue); upsdebugx(2, "Added support for instcmd %s", nutvalue); @@ -869,7 +835,7 @@ void init_ups_meter_map(const unsigned char *map, unsigned char len) void decode_meter_map_entry(const unsigned char *entry, const unsigned char format, char* value) { - uint32_t lValue = 0; + long lValue = 0; char sFormat[32]; float fValue; unsigned char dd, mm, yy, cc, hh, ss; @@ -897,19 +863,7 @@ void decode_meter_map_entry(const unsigned char *entry, const unsigned char form fValue = get_float(entry); /* Format is packed BCD */ snprintf(sFormat, 31, "%%%d.%df", ((format & 0xf0) >> 4), (format & 0x0f)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, 127, sFormat, fValue); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } else if (format == 0xe2) { /* Seconds */ @@ -957,7 +911,7 @@ void decode_meter_map_entry(const unsigned char *entry, const unsigned char form void init_ups_alarm_map(const unsigned char *map, unsigned char len) { unsigned int iIndex = 0; - unsigned int alarm = 0; + int alarm = 0; /* In case of debug - make explanation of values */ upsdebugx(2, "Index\tAlarm\tSupported"); @@ -966,116 +920,104 @@ void init_ups_alarm_map(const unsigned char *map, unsigned char len) for (iIndex = 0; iIndex < len && iIndex < BCMXCP_ALARM_MAP_MAX / 8; iIndex++) { /* Bit 0 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x01, iIndex * 8, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x01, iIndex * 8, alarm) == TRUE) alarm++; /* Bit 1 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x02, iIndex * 8 + 1, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x02, iIndex * 8 + 1, alarm) == TRUE) alarm++; /* Bit 2 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x04, iIndex * 8 + 2, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x04, iIndex * 8 + 2, alarm) == TRUE) alarm++; /* Bit 3 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x08, iIndex * 8 + 3, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x08, iIndex * 8 + 3, alarm) == TRUE) alarm++; /* Bit 4 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x10, iIndex * 8 + 4, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x10, iIndex * 8 + 4, alarm) == TRUE) alarm++; /* Bit 5 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x20, iIndex * 8 + 5, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x20, iIndex * 8 + 5, alarm) == TRUE) alarm++; /* Bit 6 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x40, iIndex * 8 + 6, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x40, iIndex * 8 + 6, alarm) == TRUE) alarm++; /* Bit 7 */ - if (set_alarm_support_in_alarm_map(map, iIndex, 0x80, iIndex * 8 + 7, alarm) == TRUE) + if(set_alarm_support_in_alarm_map(map, iIndex, 0x80, iIndex * 8 + 7, alarm) == TRUE) alarm++; } upsdebugx(2, "\n"); } -bool_t set_alarm_support_in_alarm_map( - const unsigned char *map, - const unsigned int mapIndex, - const unsigned int bitmask, - const unsigned int alarmMapIndex, - const unsigned int alarmBlockIndex -) { - /* Check what the alarm block tells about the support for the alarm */ - if (map[mapIndex] & bitmask) - { - /* Set alarm active */ - assert (alarmBlockIndex < INT_MAX); - bcmxcp_alarm_map[alarmMapIndex].alarm_block_index = (int)alarmBlockIndex; - } - else - { - /* Set alarm inactive */ - bcmxcp_alarm_map[alarmMapIndex].alarm_block_index = -1; - } - - /* Return if the alarm was supported or not */ - if (bcmxcp_alarm_map[alarmMapIndex].alarm_block_index >= 0) { - /* Debug info */ - upsdebugx(2, "%04d\t%s\tYes", bcmxcp_alarm_map[alarmMapIndex].alarm_block_index, bcmxcp_alarm_map[alarmMapIndex].alarm_desc); - return TRUE; +bool_t set_alarm_support_in_alarm_map(const unsigned char *map, const int mapIndex, const int bitmask, const int alarmMapIndex, const int alarmBlockIndex) { + /* Check what the alarm block tells about the support for the alarm */ + if (map[mapIndex] & bitmask) + { + /* Set alarm active */ + bcmxcp_alarm_map[alarmMapIndex].alarm_block_index = alarmBlockIndex; + } + else + { + /* Set alarm inactive */ + bcmxcp_alarm_map[alarmMapIndex].alarm_block_index = -1; + } + + /* Return if the alarm was supported or not */ + if(bcmxcp_alarm_map[alarmMapIndex].alarm_block_index >= 0) { + /* Debug info */ + upsdebugx(2, "%04d\t%s\tYes", bcmxcp_alarm_map[alarmMapIndex].alarm_block_index, bcmxcp_alarm_map[alarmMapIndex].alarm_desc); + return TRUE; + } + else { + /* Debug info */ + upsdebugx(3, "%04d\t%s\tNo", bcmxcp_alarm_map[alarmMapIndex].alarm_block_index, bcmxcp_alarm_map[alarmMapIndex].alarm_desc); + return FALSE; } - else { - /* Debug info */ - upsdebugx(3, "%04d\t%s\tNo", bcmxcp_alarm_map[alarmMapIndex].alarm_block_index, bcmxcp_alarm_map[alarmMapIndex].alarm_desc); - return FALSE; - } } -unsigned char init_outlet(unsigned char len) +int init_outlet(unsigned char len) { - /* Note: (bug?) the argument "len" is not practically used in code below - * Callers know it as "outlet_block_len" in their routines and it is greater than 8 - */ unsigned char answer[PW_ANSWER_MAX_SIZE]; - int iIndex = 0; - ssize_t res; - unsigned char num_outlet, size_outlet, num; - unsigned char outlet_num, outlet_state; - uint16_t auto_dly_off, auto_dly_on; - char outlet_name[64]; + int iIndex = 0, res, num; + int num_outlet, size_outlet; + int outlet_num, outlet_state; + short auto_dly_off, auto_dly_on; + char outlet_name[25]; res = command_read_sequence(PW_OUT_MON_BLOCK_REQ, answer); if (res <= 0) fatal_with_errno(EXIT_FAILURE, "Could not communicate with the ups"); else - upsdebugx(1, "init_outlet(%i), res=%zi", len, res); + upsdebugx(1, "init_outlet(%i), res=%i", len, res); num_outlet = answer[iIndex++]; - upsdebugx(2, "Number of outlets: %u", num_outlet); + upsdebugx(2, "Number of outlets: %d", num_outlet); size_outlet = answer[iIndex++]; - upsdebugx(2, "Number of bytes: %u", size_outlet); + upsdebugx(2, "Number of bytes: %d", size_outlet); - for (num = 1 ; num <= num_outlet ; num++) { + for(num = 1 ; num <= num_outlet ; num++) { outlet_num = answer[iIndex++]; - upsdebugx(2, "Outlet number: %u", outlet_num); - snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%u.id", num); - dstate_setinfo(outlet_name, "%u", outlet_num); + upsdebugx(2, "Outlet number: %d", outlet_num); + snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%d.id", num); + dstate_setinfo(outlet_name, "%d", outlet_num); outlet_state = answer[iIndex++]; - upsdebugx(2, "Outlet state: %u", outlet_state); - snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%u.status", num); - if (outlet_state>0 && outlet_state <9) - dstate_setinfo(outlet_name, "%s", OutletStatus[outlet_state]); + upsdebugx(2, "Outlet state: %d", outlet_state); + snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%d.status", num); + dstate_setinfo(outlet_name, "%s", (outlet_state & 0x01 ? "On" : "Off")); auto_dly_off = get_word(answer+iIndex); iIndex += 2; - upsdebugx(2, "Auto delay off: %u", auto_dly_off); - snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%u.delay.shutdown", num); - dstate_setinfo(outlet_name, "%u", auto_dly_off); + upsdebugx(2, "Auto delay off: %d", auto_dly_off); + snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%d.delay.shutdown", num); + dstate_setinfo(outlet_name, "%d", auto_dly_off); dstate_setflags(outlet_name, ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux(outlet_name, 5); auto_dly_on = get_word(answer+iIndex); iIndex += 2; - upsdebugx(2, "Auto delay on: %u", auto_dly_on); - snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%u.delay.start", num); - dstate_setinfo(outlet_name, "%u", auto_dly_on); + upsdebugx(2, "Auto delay on: %d", auto_dly_on); + snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%d.delay.start", num); + dstate_setinfo(outlet_name, "%d", auto_dly_on); dstate_setflags(outlet_name, ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux(outlet_name, 5); } @@ -1083,93 +1025,10 @@ unsigned char init_outlet(unsigned char len) return num_outlet; } -void init_ext_vars(void) -{ - unsigned char answer[PW_ANSWER_MAX_SIZE], cbuf[5]; - ssize_t length = 0; - int index = 0; - - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - cbuf[0] = PW_SET_CONF_COMMAND; - cbuf[1] = PW_CONF_REQ; - cbuf[2] = 0x0; - cbuf[3] = 0x0; - - length = command_write_sequence(cbuf, 4, answer); - if (length <= 0) - fatal_with_errno(EXIT_FAILURE, "Could not communicate with the ups"); - if (length < 4) /* UPS doesn't have configurable vars */ - return; - for (index=3; index < length; index++) { - switch(answer[index]) { - case PW_CONF_LOW_DEV_LIMIT: dstate_setinfo("input.transfer.boost.high", "%d", 0); - dstate_setflags("input.transfer.boost.high", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("input.transfer.boost.high", 3); - break; - - case PW_CONF_HIGH_DEV_LIMIT: dstate_setinfo("input.transfer.trim.low", "%d", 0); - dstate_setflags("input.transfer.trim.low", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("input.transfer.trim.low", 3); - break; - - case PW_CONF_LOW_BATT: dstate_setinfo("battery.runtime.low", "%d", 0); - dstate_setflags("battery.runtime.low", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("battery.runtime.low", 2); - break; - - case PW_CONF_BEEPER: dstate_addcmd("beeper.disable"); - dstate_addcmd("beeper.enable"); - dstate_addcmd("beeper.mute"); - break; - - case PW_CONF_RETURN_DELAY: dstate_setinfo("input.transfer.delay", "%d", 0); - dstate_setflags("input.transfer.delay", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("input.transfer.delay", 5); - break; - - case PW_CONF_RETURN_CAP: dstate_setinfo("battery.charge.restart", "%d", 0); - dstate_setflags("battery.charge.restart", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("battery.charge.restart", 3); - break; - - case PW_CONF_MAX_TEMP: dstate_setinfo("ambient.temperature.high", "%d", 0); - dstate_setflags("ambient.temperature.high", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("ambient.temperature.high", 3); - break; - - case PW_CONF_NOMINAL_OUT_VOLTAGE: dstate_setinfo("output.voltage.nominal", "%d", 0); - dstate_setflags("output.voltage.nominal", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("output.voltage.nominal", 3); - break; - - case PW_CONF_SLEEP_TH_LOAD: dstate_setinfo("battery.energysave.load", "%d", 0); - dstate_setflags("battery.energysave.load", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("battery.energysave.load", 3); - break; - - case PW_CONF_SLEEP_DELAY: dstate_setinfo("battery.energysave.delay", "%d", 0); - dstate_setflags("battery.energysave.delay", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("battery.energysave.delay", 3); - break; - - case PW_CONF_BATT_STRINGS: dstate_setinfo("battery.packs", "%d", 0); - dstate_setflags("battery.packs", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("battery.packs", 1); - break; - - } - } -} - - void init_config(void) { unsigned char answer[PW_ANSWER_MAX_SIZE]; - uint16_t voltage = 0, frequency = 0, tmp = 0; - ssize_t res; + int voltage = 0, frequency = 0, res; char sValue[17]; char sPartNumber[17]; @@ -1183,47 +1042,29 @@ void init_config(void) /* Nominal output voltage of ups */ voltage = get_word((answer + BCMXCP_CONFIG_BLOCK_NOMINAL_OUTPUT_VOLTAGE)); if (voltage != 0) - dstate_setinfo("output.voltage.nominal", "%u", voltage); + dstate_setinfo("output.voltage.nominal", "%d", voltage); /* Nominal Output Frequency */ - frequency = get_word((answer + BCMXCP_CONFIG_BLOCK_NOMINAL_OUTPUT_FREQ)); + frequency = get_word((answer+BCMXCP_CONFIG_BLOCK_NOMINAL_OUTPUT_FREQ)); if (frequency != 0) - dstate_setinfo("output.frequency.nominal", "%u", frequency); - - /*Number of EBM*/ - tmp = (uint16_t) *(answer + BCMXCP_CONFIG_BLOCK_BATTERY_DATA_WORD3); - if (tmp != 0) - dstate_setinfo("battery.packs", "%u", tmp); - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif - /* NOTE: We intentionally limit the amount of characters picked from - * "answer" into "sValue" and "sPartNumber" buffers (16 byte + NUL). - */ + dstate_setinfo("output.frequency.nominal", "%d", frequency); /* UPS serial number */ snprintf(sValue, sizeof(sValue), "%s", answer + BCMXCP_CONFIG_BLOCK_SERIAL_NUMBER); - if (sValue[0] != '\0') + if(sValue[0] != '\0') dstate_setinfo("ups.serial", "%s", sValue); - + /* UPS Part Number*/ snprintf(sPartNumber, sizeof(sPartNumber), "%s", answer + BCMXCP_CONFIG_BLOCK_PART_NUMBER); - if (sPartNumber[0] != '\0') + if(sPartNumber[0] != '\0') dstate_setinfo("device.part", "%s", sPartNumber); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif } void init_limit(void) { unsigned char answer[PW_ANSWER_MAX_SIZE]; - uint16_t value; - ssize_t res; + int value, res; + const char *horn_stat[3] = {"disabled", "enabled", "muted"}; res = command_read_sequence(PW_LIMIT_BLOCK_REQ, answer); if (res <= 0) { @@ -1233,114 +1074,80 @@ void init_limit(void) /* Nominal input voltage */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_NOMINAL_INPUT_VOLTAGE)); if (value != 0) { - dstate_setinfo("input.voltage.nominal", "%u", value); + dstate_setinfo("input.voltage.nominal", "%d", value); } /* Nominal input frequency */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_NOMINAL_INPUT_FREQ)); if (value != 0) { - uint16_t fnom = value; - dstate_setinfo("input.frequency.nominal", "%u", value); + int fnom = value; + dstate_setinfo("input.frequency.nominal", "%d", value); /* Input frequency deviation */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_FREQ_DEV_LIMIT)); if (value != 0) { value /= 100; - dstate_setinfo("input.frequency.low", "%u", fnom - value); - dstate_setinfo("input.frequency.high", "%u", fnom + value); + dstate_setinfo("input.frequency.low", "%d", fnom - value); + dstate_setinfo("input.frequency.high", "%d", fnom + value); } } /* Bypass Voltage Low Deviation Limit / Transfer to Boost Voltage */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_VOLTAGE_LOW_DEV_LIMIT)); if (value != 0) { - dstate_setinfo("input.transfer.boost.high", "%u", value); + dstate_setinfo("input.transfer.boost.high", "%d", value); } /* Bypass Voltage High Deviation Limit / Transfer to Buck Voltage */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_VOLTAGE_HIGE_DEV_LIMIT)); if (value != 0) { - dstate_setinfo("input.transfer.trim.low", "%u", value); + dstate_setinfo("input.transfer.trim.low", "%d", value); } /* Low battery warning */ bcmxcp_status.lowbatt = answer[BCMXCP_EXT_LIMITS_BLOCK_LOW_BATT_WARNING] * 60; - /* Check if we should warn the user that her shutdown delay is too long? */ + /* Check if we should warn the user that her shutdown delay is to long? */ if (bcmxcp_status.shutdowndelay > bcmxcp_status.lowbatt) - upslogx(LOG_WARNING, - "Shutdown delay longer than battery capacity when Low Battery " - "warning is given. (max %d seconds)", bcmxcp_status.lowbatt); + upslogx(LOG_WARNING, "Shutdown delay longer than battery capacity when Low Battery warning is given. (max %d seconds)", bcmxcp_status.lowbatt); /* Horn Status: */ value = answer[BCMXCP_EXT_LIMITS_BLOCK_HORN_STATUS]; - if (value <= 2) { + if (value >= 0 && value <= 2) { dstate_setinfo("ups.beeper.status", "%s", horn_stat[value]); } /* Minimum Supported Input Voltage */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_MIN_INPUT_VOLTAGE)); if (value != 0) { - dstate_setinfo("input.transfer.low", "%u", value); + dstate_setinfo("input.transfer.low", "%d", value); } /* Maximum Supported Input Voltage */ value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_MAX_INPUT_VOLTAGE)); if (value != 0) { - dstate_setinfo("input.transfer.high", "%u", value); + dstate_setinfo("input.transfer.high", "%d", value); } /* Ambient Temperature Lower Alarm Limit */ value = answer[BCMXCP_EXT_LIMITS_BLOCK_AMBIENT_TEMP_LOW]; if (value != 0) { - dstate_setinfo("ambient.temperature.low", "%u", value); + dstate_setinfo("ambient.temperature.low", "%d", value); } /* Ambient Temperature Upper Alarm Limit */ value = answer[BCMXCP_EXT_LIMITS_BLOCK_AMBIENT_TEMP_HIGE]; if (value != 0) { - dstate_setinfo("ambient.temperature.high", "%u", value); + dstate_setinfo("ambient.temperature.high", "%d", value); } - - /*Sleep minimum load*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_SLEEP_TH_LOAD]; - if (value != 0) { - dstate_setinfo("battery.energysave.load", "%u", value); - } - - /* Sleep delay*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_SLEEP_DELAY]; - if (value != 0) { - dstate_setinfo("battery.energysave.delay", "%u", value); - } - - /* Low batt minutes warning*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_LOW_BATT_WARNING]; - if (value != 0) { - dstate_setinfo("battery.runtime.low", "%u", value); - } - - /* Return to mains delay */ - value = get_word(answer + BCMXCP_EXT_LIMITS_BLOCK_RETURN_STAB_DELAY); - if (value != 0) { - dstate_setinfo("input.transfer.delay", "%u", value); - } - - /* Minimum return capacity*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_BATT_CAPACITY_RETURN]; - if (value != 0) { - dstate_setinfo("battery.charge.restart", "%u", value); - } - } void init_topology(void) { unsigned char answer[PW_ANSWER_MAX_SIZE]; const char* nutvalue; - uint16_t value; - ssize_t res; + int res, value; res = command_read_sequence(PW_UPS_TOP_DATA_REQ, answer); if (res <= 0) @@ -1357,12 +1164,11 @@ void init_system_test_capabilities(void) { unsigned char answer[PW_ANSWER_MAX_SIZE], cbuf[5]; const char* nutvalue; - ssize_t res; - int value, i; + int res, value, i; /* Query what system test capabilities are supported */ send_write_command(AUTHOR, 4); - + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_INIT_SYS_TEST; @@ -1373,13 +1179,13 @@ void init_system_test_capabilities(void) return; } - if ((unsigned char)answer[0] != BCMXCP_RETURN_ACCEPTED) { + if((unsigned char)answer[0] != BCMXCP_RETURN_ACCEPTED) { upsdebugx(2, "System test capabilities list not supported"); return; } /* Add instcmd for system test capabilities */ - for (i = 3; i < res; i++) { + for(i = 3; i < res; i++) { value = answer[i]; if ((nutvalue = nut_find_infoval(system_test_info, value, TRUE)) != NULL) { upsdebugx(2, "Added support for instcmd %s", nutvalue); @@ -1392,13 +1198,11 @@ void upsdrv_initinfo(void) { unsigned char answer[PW_ANSWER_MAX_SIZE]; char *pTmp; - char outlet_name[64]; + char outlet_name[27]; char power_rating[10]; - ssize_t res; - unsigned int ncpu = 0; - size_t buf; - uint16_t iRating = 0, iIndex = 0, len; - uint16_t conf_block_len = 0, alarm_block_len = 0, cmd_list_len = 0, topology_block_len = 0; + int iRating = 0, iIndex = 0, res, len; + int ncpu = 0, buf; + int conf_block_len = 0, alarm_block_len = 0, cmd_list_len = 0, topology_block_len = 0; bool_t got_cmd_list = FALSE; /* Init BCM/XCP command descriptions */ @@ -1408,18 +1212,10 @@ void upsdrv_initinfo(void) init_alarm_map(); /* Get vars from ups.conf */ - if (getval("shutdown_delay") != NULL) { - int tmp = atoi(getval("shutdown_delay")); - if (tmp >= 0) { - bcmxcp_status.shutdowndelay = (unsigned int)tmp; - } else { - fatal_with_errno(EXIT_FAILURE, - "Invalid setting for shutdown_delay: %s", - getval("shutdown_delay")); - } - } else { + if (getval("shutdown_delay") != NULL) + bcmxcp_status.shutdowndelay = atoi(getval("shutdown_delay")); + else bcmxcp_status.shutdowndelay = 120; - } /* Get information on UPS from UPS ID block */ res = command_read_sequence(PW_ID_BLOCK_REQ, answer); @@ -1429,7 +1225,6 @@ void upsdrv_initinfo(void) /* Get number of CPU's in ID block */ len = answer[iIndex++]; - /* No overflow checks, len value is byte-sized here */ buf = len * 11; pTmp = xmalloc(buf+1); @@ -1464,7 +1259,7 @@ void upsdrv_initinfo(void) iRating = get_word(answer+iIndex) * 50; iIndex += 2; } - dstate_setinfo("ups.power.nominal", "%u", iRating); + dstate_setinfo("ups.power.nominal", "%d", iRating); /* Get information on Phases from UPS */ nphases = (answer[iIndex++]); @@ -1494,81 +1289,75 @@ void upsdrv_initinfo(void) if (strstr(pTmp, power_rating) == NULL) { snprintfcat(pTmp, len+10, " %s", power_rating); } - dstate_setinfo("ups.model", "%s", str_rtrim(pTmp, ' ')); + dstate_setinfo("ups.model", "%s", rtrim(pTmp, ' ')); free(pTmp); /* Get meter map info from ups, and init our map */ len = answer[iIndex++]; - upsdebugx(2, "Length of meter map: %u\n", len); - /* Here and below, no range check needed - just initialized from unsigned char array */ - init_ups_meter_map(answer+iIndex, (unsigned char)len); + upsdebugx(2, "Length of meter map: %d\n", len); + init_ups_meter_map(answer+iIndex, len); iIndex += len; /* Next is alarm map */ len = answer[iIndex++]; - upsdebugx(2, "Length of alarm map: %u\n", len); - init_ups_alarm_map(answer+iIndex, (unsigned char)len); + upsdebugx(2, "Length of alarm map: %d\n", len); + init_ups_alarm_map(answer+iIndex, len); iIndex += len; /* Then the Config_block_length */ conf_block_len = get_word(answer+iIndex); - upsdebugx(2, "Length of Config_block: %u\n", conf_block_len); + upsdebugx(2, "Length of Config_block: %d\n", conf_block_len); iIndex += 2; /* Next is statistics map */ len = answer[iIndex++]; - upsdebugx(2, "Length of statistics map: %u\n", len); - /* init_statistics_map(answer+iIndex, (unsigned char)len); */ + upsdebugx(2, "Length of statistics map: %d\n", len); + /* init_statistics_map(answer+iIndex, len); */ iIndex += len; /* Size of the alarm history log */ len = get_word(answer+iIndex); - upsdebugx(2, "Length of alarm history log: %u\n", len); + upsdebugx(2, "Length of alarm history log: %d\n", len); iIndex += 2; /* Size of custom event log, always 0 according to spec */ iIndex += 2; + /* Size of topology block */ topology_block_len = get_word(answer+iIndex); - upsdebugx(2, "Length of topology block: %u\n", topology_block_len); + upsdebugx(2, "Length of topology block: %d\n", topology_block_len); iIndex += 2; /* Maximum supported command length */ len = answer[iIndex++]; - upsdebugx(2, "Length of max supported command length: %u\n", len); + upsdebugx(2, "Length of max supported command length: %d\n", len); /* Size of command list block */ - if (iIndex < (unsigned int)res) + if (iIndex < res) cmd_list_len = get_word(answer+iIndex); - upsdebugx(2, "Length of command list: %u\n", cmd_list_len); + upsdebugx(2, "Length of command list: %d\n", cmd_list_len); iIndex += 2; /* Size of outlet monitoring block */ - if (iIndex < (unsigned int)res) + if (iIndex < res) outlet_block_len = get_word(answer+iIndex); - upsdebugx(2, "Length of outlet_block: %u\n", outlet_block_len); + upsdebugx(2, "Length of outlet_block: %d\n", outlet_block_len); iIndex += 2; /* Size of the alarm block */ - if (iIndex < (unsigned int)res) + if (iIndex < res) alarm_block_len = get_word(answer+iIndex); - upsdebugx(2, "Length of alarm_block: %u\n", alarm_block_len); + upsdebugx(2, "Length of alarm_block: %d\n", alarm_block_len); /* End of UPS ID block request */ /* Due to a bug in PW5115 firmware, we need to use blocklength > 8. The protocol state that outlet block is only implemented if there is at least 2 outlet block. 5115 has only one outlet, but has outlet block! */ if (outlet_block_len > 8) { - if (outlet_block_len > 255) - fatal_with_errno(EXIT_FAILURE, "outlet_block_len overflow: %u", outlet_block_len); - len = init_outlet((unsigned char)outlet_block_len /* arg ignored */); + len = init_outlet(outlet_block_len); - for (res = 1 ; (unsigned int)res <= (unsigned int)len ; res++) { - snprintf(outlet_name, sizeof(outlet_name) - 1, "outlet.%zd.shutdown.return", res); - dstate_addcmd(outlet_name); - snprintf(outlet_name, sizeof(outlet_name) - 1, "outlet.%zd.load.on", res); - dstate_addcmd(outlet_name); - snprintf(outlet_name, sizeof(outlet_name) - 1, "outlet.%zd.load.off", res); + for(res = 1 ; res <= len ; res++) { + snprintf(outlet_name, sizeof(outlet_name)-1, "outlet.%d.shutdown.return", res); dstate_addcmd(outlet_name); } } @@ -1583,7 +1372,7 @@ void upsdrv_initinfo(void) if (cmd_list_len) got_cmd_list = init_command(cmd_list_len); /* Add default commands if we were not able to query UPS for support */ - if (got_cmd_list == FALSE) { + if(got_cmd_list == FALSE) { dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); dstate_addcmd("test.battery.start"); @@ -1595,8 +1384,6 @@ void upsdrv_initinfo(void) if (bcmxcp_command_map[PW_INIT_SYS_TEST].command_byte > 0) { init_system_test_capabilities(); } - /* Get information about configurable external variables*/ - init_ext_vars(); upsh.instcmd = instcmd; upsh.setvar = setvar; @@ -1607,9 +1394,7 @@ void upsdrv_updateinfo(void) unsigned char answer[PW_ANSWER_MAX_SIZE]; unsigned char status, topology; char sValue[128]; - int iIndex; - ssize_t res; - uint16_t value; + int iIndex, res; bool_t has_ups_load = FALSE; int batt_status = 0; const char *nutvalue; @@ -1618,14 +1403,14 @@ void upsdrv_updateinfo(void) /* Get info from UPS */ res = command_read_sequence(PW_METER_BLOCK_REQ, answer); - if (res <= 0) { + if (res <= 0){ upslogx(LOG_ERR, "Short read from UPS"); dstate_datastale(); return; } /* Loop thru meter map, get all data UPS is willing to offer */ - for (iIndex = 0; iIndex < BCMXCP_METER_MAP_MAX; iIndex++) { + for (iIndex = 0; iIndex < BCMXCP_METER_MAP_MAX; iIndex++){ if (bcmxcp_meter_map[iIndex].format != 0 && bcmxcp_meter_map[iIndex].nut_entity != NULL) { decode_meter_map_entry(answer + bcmxcp_meter_map[iIndex].meter_block_index, bcmxcp_meter_map[iIndex].format, sValue); @@ -1634,16 +1419,16 @@ void upsdrv_updateinfo(void) dstate_setinfo(bcmxcp_meter_map[iIndex].nut_entity, "%s", sValue); /* Check if we read ups.load */ - if (has_ups_load == FALSE && !strcasecmp(bcmxcp_meter_map[iIndex].nut_entity, "ups.load")) { + if(has_ups_load == FALSE && !strcasecmp(bcmxcp_meter_map[iIndex].nut_entity, "ups.load")) { has_ups_load = TRUE; } } } /* Calculate ups.load if UPS does not report it directly */ - if (has_ups_load == FALSE) { + if(has_ups_load == FALSE) { calculated_load = calculate_ups_load(answer); - if (calculated_load >= 0.0f) { + if(calculated_load >= 0.0f) { dstate_setinfo("ups.load", "%5.1f", calculated_load); } } @@ -1652,14 +1437,12 @@ void upsdrv_updateinfo(void) The protocol state that outlet block is only implemented if there is at least 2 outlet block. 5115 has only one outlet, but has outlet block. */ if (outlet_block_len > 8) { - if (outlet_block_len > 255) - fatal_with_errno(EXIT_FAILURE, "outlet_block_len overflow: %u", outlet_block_len); - init_outlet((unsigned char)outlet_block_len /* arg ignored */); + init_outlet(outlet_block_len); } /* Get alarm info from UPS */ res = command_read_sequence(PW_CUR_ALARM_REQ, answer); - if (res <= 0) { + if (res <= 0){ upslogx(LOG_ERR, "Short read from UPS"); dstate_datastale(); return; @@ -1673,7 +1456,7 @@ void upsdrv_updateinfo(void) alarm_init(); /* Loop thru alarm map, get all alarms UPS is willing to offer */ - for (iIndex = 0; iIndex < BCMXCP_ALARM_MAP_MAX; iIndex++) { + for (iIndex = 0; iIndex < BCMXCP_ALARM_MAP_MAX; iIndex++){ if (bcmxcp_alarm_map[iIndex].alarm_block_index >= 0 && bcmxcp_alarm_map[iIndex].alarm_desc != NULL) { if (answer[bcmxcp_alarm_map[iIndex].alarm_block_index] > 0) { alarm_set(bcmxcp_alarm_map[iIndex].alarm_desc); @@ -1781,8 +1564,8 @@ void upsdrv_updateinfo(void) * Powerware 9130 output: * 03 0a d7 25 42 0a d7 25 42 00 9a 19 6d 43 cd cc 4c 3e 01 00 01 03 */ - upsdebug_hex(2, "Battery Status", answer, (size_t)res); - batt_status = answer[BCMXCP_BATTDATA_BLOCK_BATT_TEST_STATUS]; + upsdebug_hex(2, "Battery Status", answer, res); + batt_status = answer[0]; if ((nutvalue = nut_find_infoval(batt_test_info, batt_status, TRUE)) != NULL) { dstate_setinfo("ups.test.result", "%s", nutvalue); @@ -1791,127 +1574,8 @@ void upsdrv_updateinfo(void) else { upsdebugx(1, "Failed to extract Battery Status from answer"); } - - /*Extracting internal batteries ABM status*/ - /*Placed first in ABM statuses list. For examples above - on position BCMXCP_BATTDATA_BLOCK_NUMBER_OF_STRINGS (18): - PW5115RM - 0 - no external strings, no status bytes, - so next byte (19) - number of ABM statuses, next (20) - first ABM Status for internal batteries. - - PW9130 - 1 - one external string, so one additional status byte (#19 - 00 - no test run), next(20) - number of ABM statuses, - next (21) - ABM Status for internal batteries. - */ - value = - *(answer + BCMXCP_BATTDATA_BLOCK_NUMBER_OF_STRINGS + - *(answer + BCMXCP_BATTDATA_BLOCK_NUMBER_OF_STRINGS) * 1 + 2); - upsdebugx(2, "ABM Status = %u ", value); - if (value < 5) - dstate_setinfo("battery.charger.status", "%s", ABMStatus[value-1]); } - - res = command_read_sequence(PW_LIMIT_BLOCK_REQ, answer); - if (res <= 0) { - upsdebugx(1, "Failed to read EXT LIMITs from UPS"); - } else - { - /* Nominal input voltage */ - value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_NOMINAL_INPUT_VOLTAGE)); - - if (value != 0) { - dstate_setinfo("input.voltage.nominal", "%u", value); - } - - /* Bypass Voltage Low Deviation Limit / Transfer to Boost Voltage */ - value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_VOLTAGE_LOW_DEV_LIMIT)); - - if (value != 0) { - dstate_setinfo("input.transfer.boost.high", "%u", value); - } - - /* Bypass Voltage High Deviation Limit / Transfer to Buck Voltage */ - value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_VOLTAGE_HIGE_DEV_LIMIT)); - - if (value != 0) { - dstate_setinfo("input.transfer.trim.low", "%u", value); - } - - /* Minimum Supported Input Voltage */ - value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_MIN_INPUT_VOLTAGE)); - - if (value != 0) { - dstate_setinfo("input.transfer.low", "%u", value); - } - - /* Maximum Supported Input Voltage */ - value = get_word((answer + BCMXCP_EXT_LIMITS_BLOCK_MAX_INPUT_VOLTAGE)); - - if (value != 0) { - dstate_setinfo("input.transfer.high", "%u", value); - } - - /* Horn Status: */ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_HORN_STATUS]; - - if (value <= 2) { - dstate_setinfo("ups.beeper.status", "%s", horn_stat[value]); - } - /* AAmbient Temperature Upper Alarm Limit */ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_AMBIENT_TEMP_HIGE]; - - if (value != 0) { - dstate_setinfo("ambient.temperature.high", "%u", value); - } - - /*Sleep minimum load*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_SLEEP_TH_LOAD]; - if (value != 0) { - dstate_setinfo("battery.energysave.load", "%u", value); - } - - /* Sleep delay*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_SLEEP_DELAY]; - if (value != 0) { - dstate_setinfo("battery.energysave.delay", "%u", value); - } - - /* Low batt minutes warning*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_LOW_BATT_WARNING]; - if (value != 0) { - dstate_setinfo("battery.runtime.low", "%u", value); - } - - /* Return to mains delay */ - value = get_word(answer + BCMXCP_EXT_LIMITS_BLOCK_RETURN_STAB_DELAY); - if (value != 0) { - dstate_setinfo("input.transfer.delay", "%u", value); - } - - /* Minimum return capacity*/ - value = answer[BCMXCP_EXT_LIMITS_BLOCK_BATT_CAPACITY_RETURN]; - if (value != 0) { - dstate_setinfo("battery.charge.restart", "%u", value); - } - } - - res = command_read_sequence(PW_CONFIG_BLOCK_REQ, answer); - if (res <= 0) { - upsdebugx(1, "Failed to read CONF BLOCK from UPS"); - } - else - { - /*Nominal output voltage*/ - value = get_word((answer + BCMXCP_CONFIG_BLOCK_NOMINAL_OUTPUT_VOLTAGE)); - - if (value != 0) - dstate_setinfo("output.voltage.nominal", "%u", value); - /*Number of EBM*/ - value = (uint16_t) *(answer + BCMXCP_CONFIG_BLOCK_BATTERY_DATA_WORD3); - if (value != 0) - dstate_setinfo("battery.packs", "%u", value); - - } - - dstate_dataok(); } @@ -1970,14 +1634,40 @@ static int instcmd(const char *cmdname, const char *extra) { unsigned char answer[128], cbuf[6]; char success_msg[40]; - char namebuf[MAX_NUT_NAME_LENGTH]; char varname[32]; const char *varvalue = NULL; - ssize_t res; - int sec, outlet_num; + int res, sec; int sddelay = 0x03; /* outlet off in 3 seconds, by default */ - upsdebugx(1, "entering instcmd(%s)(%s)", cmdname, extra); + upsdebugx(1, "entering instcmd(%s)", cmdname); + + /* ojw0000 outlet power cycle for PW5125 and perhaps others */ + if (!strcasecmp(cmdname, "outlet.1.shutdown.return") + || !strcasecmp(cmdname, "outlet.2.shutdown.return") + || !strcasecmp(cmdname, "outlet.3.shutdown.return") + ) { + send_write_command(AUTHOR, 4); + + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + + /* Get the shutdown delay, if any */ + snprintf(varname, sizeof(varname)-1, "outlet.%c.delay.shutdown", cmdname[7]); + if ((varvalue = dstate_getinfo(varname)) != NULL) { + sddelay = atoi(varvalue); + } + + cbuf[0] = PW_LOAD_OFF_RESTART; + cbuf[1] = sddelay & 0xff; + cbuf[2] = sddelay >> 8; /* high byte of the 2 byte time argument */ + cbuf[3] = cmdname[7] - '0'; /* which outlet load segment? Assumes outlet number at position 8 of the command string. */ + + res = command_write_sequence(cbuf, 4, answer); + + sec = (256 * (unsigned char)answer[3]) + (unsigned char)answer[2]; + snprintf(success_msg, sizeof(success_msg)-1, "Going down in %d sec", sec); + + return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, success_msg); + } /* ojw0000 end outlet power cycle */ if (!strcasecmp(cmdname, "shutdown.return")) { send_write_command(AUTHOR, 4); @@ -2006,26 +1696,6 @@ static int instcmd(const char *cmdname, const char *extra) return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, "Going down NOW"); } - if (!strcasecmp(cmdname, "load.on")) { - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - res = command_read_sequence(PW_UPS_ON, answer); - - return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, "Enabling"); - } - - if (!strcasecmp(cmdname, "bypass.start")) { - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - res = command_read_sequence(PW_GO_TO_BYPASS, answer); - - return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, "Bypass enabled"); - } - /* Note: test result will be parsed from Battery status block, * part of the update loop, and published into ups.test.result */ @@ -2046,11 +1716,11 @@ static int instcmd(const char *cmdname, const char *extra) answer from the test. Or return, as we may lose line power and need to do a shutdown.*/ - } - + } + if (!strcasecmp(cmdname, "test.system.start")) { send_write_command(AUTHOR, 4); - + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_INIT_SYS_TEST; @@ -2062,7 +1732,7 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "test.panel.start")) { send_write_command(AUTHOR, 4); - + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ cbuf[0] = PW_INIT_SYS_TEST; @@ -2073,98 +1743,11 @@ static int instcmd(const char *cmdname, const char *extra) return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, "Testing panel now"); } - if (!strcasecmp(cmdname, "beeper.disable") || !strcasecmp(cmdname, "beeper.enable") || !strcasecmp(cmdname, "beeper.mute")) { - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - cbuf[0] = PW_SET_CONF_COMMAND; - cbuf[1] = PW_CONF_BEEPER; - switch (cmdname[7]) { - - case 'd': - case 'D': { - cbuf[2] = 0x0; /*disable beeper*/ - break; - } - case 'e': - case 'E': { - cbuf[2] = 0x1; /*enable beeper*/ - break; - } - case 'm': - case 'M': { - cbuf[2] = 0x2; - break; /*mute beeper*/ - } - } - cbuf[3] = 0x0; /*padding*/ - - res = command_write_sequence(cbuf, 4, answer); - return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, "Beeper status changed"); - } - - strncpy(namebuf, cmdname, sizeof(namebuf)); - namebuf[NUT_OUTLET_POSITION] = 'n'; /* Assumes a maximum of 9 outlets */ - - if (!strcasecmp(namebuf, "outlet.n.shutdown.return")) { - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - /* Get the shutdown delay, if any */ - snprintf(varname, sizeof(varname)-1, "outlet.%c.delay.shutdown", cmdname[NUT_OUTLET_POSITION]); - if ((varvalue = dstate_getinfo(varname)) != NULL) { - sddelay = atoi(varvalue); - } - - /*if -1 then use global shutdown_delay from ups.conf*/ - if (sddelay == -1) sddelay = (int)bcmxcp_status.shutdowndelay; - - outlet_num = cmdname[NUT_OUTLET_POSITION] - '0'; - if (outlet_num < 1 || outlet_num > 9) - return STAT_INSTCMD_FAILED; - - cbuf[0] = PW_LOAD_OFF_RESTART; - cbuf[1] = sddelay & 0xff; - cbuf[2] = (unsigned char)(sddelay >> 8); /* high byte of the 2 byte time argument */ - cbuf[3] = (unsigned char)outlet_num; /* which outlet load segment? Assumes outlet number at position 8 of the command string. */ - - res = command_write_sequence(cbuf, 4, answer); - - sec = (256 * (unsigned char)answer[3]) + (unsigned char)answer[2]; - snprintf(success_msg, sizeof(success_msg)-1, "Going down in %d sec", sec); - - return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, success_msg); - } - - if (!strcasecmp(namebuf, "outlet.n.load.on") || !strcasecmp(namebuf, "outlet.n.load.off")) { - send_write_command(AUTHOR, 4); - - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - outlet_num = cmdname[NUT_OUTLET_POSITION] - '0'; - if (outlet_num < 1 || outlet_num > 9) - return STAT_INSTCMD_FAILED; - - - cbuf[0] = (cmdname[NUT_OUTLET_POSITION+8] == 'n') ? PW_UPS_ON : PW_UPS_OFF; /* Cmd oN or not*/ - cbuf[1] = (unsigned char)outlet_num; /* Outlet number */ - - res = command_write_sequence(cbuf, 2, answer); - snprintf(success_msg, sizeof(success_msg)-1, - "Outlet %d is %s", - outlet_num, - ((cmdname[NUT_OUTLET_POSITION+8] == 'n') ? "On" : "Off")); - - return decode_instcmd_exec(res, (unsigned char)answer[0], cmdname, success_msg); - } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } -static int decode_instcmd_exec(const ssize_t res, const unsigned char exec_status, const char *cmdname, const char *success_msg) +static int decode_instcmd_exec(const int res, const unsigned char exec_status, const char *cmdname, const char *success_msg) { if (res <= 0) { upslogx(LOG_ERR, "[%s] Short read from UPS", cmdname); @@ -2178,32 +1761,39 @@ static int decode_instcmd_exec(const ssize_t res, const unsigned char exec_statu upslogx(LOG_NOTICE, "[%s] %s", cmdname, success_msg); upsdrv_comm_good(); return STAT_INSTCMD_HANDLED; + break; } case BCMXCP_RETURN_ACCEPTED_PARAMETER_ADJUST: { upslogx(LOG_NOTICE, "[%s] Parameter adjusted", cmdname); upslogx(LOG_NOTICE, "[%s] %s", cmdname, success_msg); upsdrv_comm_good(); return STAT_INSTCMD_HANDLED; + break; } case BCMXCP_RETURN_BUSY: { upslogx(LOG_NOTICE, "[%s] Busy or disbled by front panel", cmdname); return STAT_INSTCMD_FAILED; + break; } case BCMXCP_RETURN_UNRECOGNISED: { upslogx(LOG_NOTICE, "[%s] Unrecognised command byte or corrupt checksum", cmdname); return STAT_INSTCMD_FAILED; + break; } case BCMXCP_RETURN_INVALID_PARAMETER: { upslogx(LOG_NOTICE, "[%s] Invalid parameter", cmdname); return STAT_INSTCMD_INVALID; + break; } case BCMXCP_RETURN_PARAMETER_OUT_OF_RANGE: { upslogx(LOG_NOTICE, "[%s] Parameter out of range", cmdname); return STAT_INSTCMD_INVALID; + break; } default: { upslogx(LOG_NOTICE, "[%s] Not supported", cmdname); return STAT_INSTCMD_INVALID; + break; } } } @@ -2223,339 +1813,101 @@ int setvar (const char *varname, const char *val) { unsigned char answer[128], cbuf[5]; char namebuf[MAX_NUT_NAME_LENGTH]; - char success_msg[SMALLBUF]; - ssize_t res; - int sec, outlet_num, tmp; + int res, sec, outlet_num; int onOff_setting = PW_AUTO_OFF_DELAY; upsdebugx(1, "entering setvar(%s, %s)", varname, val); - if (!strcasecmp(varname, "input.transfer.boost.high")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 460) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_LOW_DEV_LIMIT; - cbuf[2]=tmp&0xff; - cbuf[3]=(unsigned char)(tmp>>8); - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " BOOST threshold volage set to %d V", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "input.transfer.trim.low")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 110 || tmp > 540) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_HIGH_DEV_LIMIT; - cbuf[2]=tmp&0xff; - cbuf[3]=(unsigned char)(tmp>>8); - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " TRIM threshold volage set to %d V", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "battery.runtime.low")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 30) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_LOW_BATT; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Low battery warning time set to %d min", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "input.transfer.delay")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 1 || tmp > 18000) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_RETURN_DELAY; - cbuf[2]=tmp&0xff; - cbuf[3]=(unsigned char)(tmp>>8); - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Mains return delay set to %d sec", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "battery.charge.restart")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 100) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_RETURN_CAP; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Mains return minimum battery capacity set to %d %%", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - - if (!strcasecmp(varname, "ambient.temperature.high")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 100) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_MAX_TEMP; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Maximum temperature set to %d C", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "output.voltage.nominal")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 460) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_NOMINAL_OUT_VOLTAGE; - cbuf[2]=tmp&0xff; - cbuf[3]=(unsigned char)(tmp>>8); - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Nominal output voltage set to %d V", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "battery.energysave.load")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 100) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_SLEEP_TH_LOAD; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, " Minimum load before sleep countdown set to %d %%", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - } - - if (!strcasecmp(varname, "battery.energysave.delay")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 255) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_SLEEP_DELAY; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, - " Delay before sleep shutdown set to %d min", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - - - } - - if (!strcasecmp(varname, "battery.packs")) { - - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - - tmp=atoi(val); - if (tmp < 0 || tmp > 5) { - return STAT_SET_INVALID; - } - - cbuf[0]=PW_SET_CONF_COMMAND; - cbuf[1]=PW_CONF_BATT_STRINGS; - cbuf[2]=tmp&0xff; - cbuf[3]=0x0; - - res = command_write_sequence(cbuf, 4, answer); - snprintf(success_msg, sizeof(success_msg)-1, "EBM Count set to %d ", tmp); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); - } - strncpy(namebuf, varname, sizeof(namebuf)); namebuf[NUT_OUTLET_POSITION] = 'n'; /* Assumes a maximum of 9 outlets */ - if ( (!strcasecmp(namebuf, "outlet.n.delay.start")) || - (!strcasecmp(namebuf, "outlet.n.delay.shutdown"))) { + if ( (strcasecmp(namebuf, "outlet.n.delay.start")) && + (strcasecmp(namebuf, "outlet.n.delay.shutdown")) ) { + return STAT_SET_UNKNOWN; + } + if (outlet_block_len <= 8) { + return STAT_SET_INVALID; + } - if (outlet_block_len <= 8) { - return STAT_SET_INVALID; - } + if (!strcasecmp(namebuf, "outlet.n.delay.start")) { + onOff_setting = PW_AUTO_ON_DELAY; + } - if (!strcasecmp(namebuf, "outlet.n.delay.start")) { - onOff_setting = PW_AUTO_ON_DELAY; - } + send_write_command(AUTHOR, 4); + sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ - send_write_command(AUTHOR, 4); - sleep(PW_SLEEP); /* Need to. Have to wait at least 0,25 sec max 16 sec */ + outlet_num = varname[NUT_OUTLET_POSITION] - '0'; + if (outlet_num < 1 || outlet_num > 9) { + return STAT_SET_INVALID; + } - outlet_num = varname[NUT_OUTLET_POSITION] - '0'; - if (outlet_num < 1 || outlet_num > 9) { - return STAT_SET_INVALID; - } + sec = atoi(val); + /* Check value: + * 0-32767 are valid values + * -1 means no Automatic off or restart + * for Auto Off Delay: + * 0-30 are valid but ill-advised */ + if (sec < -1 || sec > 0x7FFF) { + return STAT_SET_INVALID; + } - sec = atoi(val); - /* Check value: - * 0-32767 are valid values - * -1 means no Automatic off or restart - * for Auto Off Delay: - * 0-30 are valid but ill-advised */ - if (sec < -1 || sec > 0x7FFF) { - return STAT_SET_INVALID; - } + cbuf[0] = PW_SET_OUTLET_COMMAND; /* Cmd */ + cbuf[1] = onOff_setting; /* Set Auto Off (1) or On (2) Delay */ + cbuf[2] = outlet_num; /* Outlet number */ + cbuf[3] = sec&0xff; /* Delay in seconds LSB */ + cbuf[4] = sec>>8; /* Delay in seconds MSB */ - cbuf[0] = PW_SET_OUTLET_COMMAND; /* Cmd */ - cbuf[1] = (unsigned char)onOff_setting; /* Set Auto Off (1) or On (2) Delay */ - cbuf[2] = (unsigned char)outlet_num; /* Outlet number */ - cbuf[3] = sec&0xff; /* Delay in seconds LSB */ - cbuf[4] = (unsigned char)(sec>>8); /* Delay in seconds MSB */ - - res = command_write_sequence(cbuf, 5, answer); - snprintf(success_msg, sizeof(success_msg)-1, - "Outlet %d %s delay set to %d sec", - outlet_num, - (onOff_setting == PW_AUTO_ON_DELAY) ? "start" : "shutdown", - sec); - - return decode_setvar_exec(res, (unsigned char)answer[0], varname, success_msg); + res = command_write_sequence(cbuf, 5, answer); + if (res <= 0) { + upslogx(LOG_ERR, "Short read from UPS"); + dstate_datastale(); + return -1; + } + switch ((unsigned char) answer[0]) { + case BCMXCP_RETURN_ACCEPTED: { + upslogx(LOG_NOTICE,"Outlet %d %s delay set to %d sec", + outlet_num, (onOff_setting == PW_AUTO_ON_DELAY)?"start":"shutdown", sec); + dstate_setinfo(varname, "%d", sec); + upsdrv_comm_good(); + return STAT_SET_HANDLED; + break; + } + case BCMXCP_RETURN_ACCEPTED_PARAMETER_ADJUST: { + upslogx(LOG_NOTICE,"Outlet %d %s delay set, but UPS adjusted parameter %d sec", + outlet_num, (onOff_setting == PW_AUTO_ON_DELAY)?"start":"shutdown", sec); + dstate_setinfo(varname, "%d", sec); + upsdrv_comm_good(); + return STAT_SET_HANDLED; + break; + } + case BCMXCP_RETURN_BUSY: { + upslogx(LOG_NOTICE, "Set [%s] failed due to UPS busy", varname); + /* TODO: we should probably retry... */ + return STAT_SET_UNKNOWN; + break; + } + case BCMXCP_RETURN_PARAMETER_OUT_OF_RANGE: { + upslogx(LOG_NOTICE, "Set [%s %s] failed due to parameter out of range", varname, val); + return STAT_SET_UNKNOWN; + break; + } + case BCMXCP_RETURN_INVALID_PARAMETER: { + upslogx(LOG_NOTICE, "Set [%s %s] failed due to invalid parameter", varname, val); + return STAT_SET_UNKNOWN; + break; + } + default: { + upslogx(LOG_NOTICE, "Set [%s] not supported", varname); + return STAT_SET_FAILED; + break; + } } return STAT_SET_INVALID; } -static int decode_setvar_exec(const ssize_t res, const unsigned char exec_status, const char *cmdname, const char *success_msg) -{ - if (res <= 0) { - upslogx(LOG_ERR, "[%s] Short read from UPS", cmdname); - dstate_datastale(); - return STAT_SET_FAILED; - } - - /* Decode the status code from command execution */ - switch (exec_status) { - case BCMXCP_RETURN_ACCEPTED: { - upslogx(LOG_NOTICE, "[%s] %s", cmdname, success_msg); - upsdrv_comm_good(); - return STAT_SET_HANDLED; - } - case BCMXCP_RETURN_ACCEPTED_PARAMETER_ADJUST: { - upslogx(LOG_NOTICE, "[%s] Parameter adjusted", cmdname); - upslogx(LOG_NOTICE, "[%s] %s", cmdname, success_msg); - upsdrv_comm_good(); - return STAT_SET_HANDLED; - } - case BCMXCP_RETURN_BUSY: { - upslogx(LOG_NOTICE, "[%s] Busy or disbled by front panel", cmdname); - return STAT_SET_FAILED; - } - case BCMXCP_RETURN_UNRECOGNISED: { - upslogx(LOG_NOTICE, "[%s] Unrecognised command byte or corrupt checksum", cmdname); - return STAT_SET_FAILED; - } - case BCMXCP_RETURN_INVALID_PARAMETER: { - upslogx(LOG_NOTICE, "[%s] Invalid parameter", cmdname); - return STAT_SET_INVALID; - } - case BCMXCP_RETURN_PARAMETER_OUT_OF_RANGE: { - upslogx(LOG_NOTICE, "[%s] Parameter out of range", cmdname); - return STAT_SET_INVALID; - } - default: { - upslogx(LOG_NOTICE, "[%s] Not supported", cmdname); - return STAT_SET_INVALID; - } - } -} - /******************************* * Extracted from usbhid-ups.c * *******************************/ @@ -2577,8 +1929,9 @@ static const char *nut_find_infoval(info_lkp_t *xcp2info, const double value, co return info_lkp->nut_value; } } - if (debug_output_nonexisting == TRUE) { + if(debug_output_nonexisting == TRUE) { upsdebugx(3, "nut_find_infoval: no matching INFO_* value for this XCP value (%g)", value); } return NULL; } + diff --git a/drivers/bcmxcp.h b/drivers/bcmxcp.h index 7050d1c..7d24f76 100644 --- a/drivers/bcmxcp.h +++ b/drivers/bcmxcp.h @@ -1,6 +1,6 @@ -/* +/* * bcmxcp.h -- header for BCM/XCP module - */ + */ #ifndef _POWERWARE_H #define _POWERWARE_H @@ -16,13 +16,12 @@ #define PW_COMMAND_START_BYTE (unsigned char)0xAB #define PW_LAST_SEQ (unsigned char)0x80 /* bit flag to indicate final sequence */ #define PW_SEQ_MASK (unsigned char)0x7F /* bit mask to extract just the sequence # */ -#define PW_HEADER_LENGTH 4 /* Size of response header */ #define PW_ANSWER_MAX_SIZE 256 -/* No Autorisation required */ +/* No Autorisation required */ #define PW_ID_BLOCK_REQ (unsigned char)0x31 /* Model name, ... length 1 */ -#define PW_EVENT_HISTORY_LOG_REQ (unsigned char)0x32 /* List alarms that have occurred. length 1 */ +#define PW_EVENT_HISTORY_LOG_REQ (unsigned char)0x32 /* List alarms that have occured. length 1 */ #define PW_STATUS_REQ (unsigned char)0x33 /* On Line, On Bypass, ... length 1-2 */ #define PW_METER_BLOCK_REQ (unsigned char)0x34 /* Current UPS status (Load, utility,...) length 1 */ #define PW_CUR_ALARM_REQ (unsigned char)0x35 /* Current alarm and event request. length 1 */ @@ -78,22 +77,6 @@ #define PW_TURN_OFF_DELAY 3 #define PW_TURN_ON_DELAY 4 -/* Config vars*/ -#define PW_CONF_BYPASS_FREQ_DEV_LIMIT 0x01 -#define PW_CONF_LOW_DEV_LIMIT 0x02 -#define PW_CONF_HIGH_DEV_LIMIT 0x03 -#define PW_CONF_PHASE_DEV_LIMIT 0x04 -#define PW_CONF_LOW_BATT 0x05 -#define PW_CONF_BEEPER 0x06 -#define PW_CONF_RETURN_DELAY 0x07 -#define PW_CONF_RETURN_CAP 0x08 -#define PW_CONF_MAX_TEMP 0x0a -#define PW_CONF_NOMINAL_OUT_VOLTAGE 0x0b -#define PW_CONF_SLEEP_TH_LOAD 0x0d -#define PW_CONF_SLEEP_DELAY 0x0e -#define PW_CONF_BATT_STRINGS 0x0f -#define PW_CONF_REQ 0xff - /* Config block offsets */ #define BCMXCP_CONFIG_BLOCK_MACHINE_TYPE_CODE 0 #define BCMXCP_CONFIG_BLOCK_MODEL_NUMBER 2 @@ -114,18 +97,6 @@ #define BCMXCP_CONFIG_BLOCK_PART_NUMBER 48 #define BCMXCP_CONFIG_BLOCK_SERIAL_NUMBER 64 -/*Battery block offsets*/ - -#define BCMXCP_BATTDATA_BLOCK_BATT_TEST_STATUS 0 -#define BCMXCP_BATTDATA_BLOCK_BATT_VOLTS_T1 1 -#define BCMXCP_BATTDATA_BLOCK_BATT_VOLTS_T2 5 -#define BCMXCP_BATTDATA_BLOCK_TEST_DURATION 9 -#define BCMXCP_BATTDATA_BLOCK_UTIL_VOLT 10 -#define BCMXCP_BATTDATA_BLOCK_INPUT_CURRENT 14 -#define BCMXCP_BATTDATA_BLOCK_NUMBER_OF_STRINGS 18 -/*BATT_TEST_STATUS for external strings (1 byte each) if BCMXCP_BATTDATA_BLOCK_NUMBER_OF_STRINGS == 0 no external test statuses at all*/ -/*next - number of ABM Statuses - at least 1 for internal batteries*/ - /* Index for Extende Limits block offsets */ #define BCMXCP_EXT_LIMITS_BLOCK_NOMINAL_INPUT_VOLTAGE 0 #define BCMXCP_EXT_LIMITS_BLOCK_NOMINAL_INPUT_FREQ 2 @@ -143,8 +114,6 @@ #define BCMXCP_EXT_LIMITS_BLOCK_BATT_CAPACITY_RETURN 24 #define BCMXCP_EXT_LIMITS_BLOCK_AMBIENT_TEMP_LOW 25 #define BCMXCP_EXT_LIMITS_BLOCK_AMBIENT_TEMP_HIGE 26 -#define BCMXCP_EXT_LIMITS_BLOCK_SLEEP_TH_LOAD 29 -#define BCMXCP_EXT_LIMITS_BLOCK_SLEEP_DELAY 30 /* Indexes for meter map */ #define BCMXCP_METER_MAP_OUTPUT_VOLTS_AB 0 /* mapped */ @@ -355,8 +324,7 @@ #define BCMXCP_ALARM_HEATSINK_TEMP_SENSOR_FAIL 74 #define BCMXCP_ALARM_RECTIFIER_CURRENT_OVER_125 75 #define BCMXCP_ALARM_RECTIFIER_FAULT_INTERRUPT_FAIL 76 -#define BCMXCP_ALARM_RECTIFIER_POWER_CAPACITOR_FAIL 77 -#define BCMXCP_ALARM_RECTIFIER_POWER_CAPASITOR_FAIL 77 /* Legacy - typo */ +#define BCMXCP_ALARM_RECTIFIER_POWER_CAPASITOR_FAIL 77 #define BCMXCP_ALARM_INVERTER_PROGRAM_STACK_ERROR 78 #define BCMXCP_ALARM_INVERTER_BOARD_SELFTEST_FAIL 79 #define BCMXCP_ALARM_INVERTER_AD_SELFTEST_FAIL 80 @@ -412,7 +380,7 @@ #define BCMXCP_ALARM_LARGE_CHARGER_INPUT_CURRENT 130 #define BCMXCP_ALARM_INV_VOLT_TOO_LOW_FOR_RAMP_LEVEL 131 #define BCMXCP_ALARM_LOSS_OF_REDUNDANCY 132 -#define BCMXCP_ALARM_LOSS_OF_SYNC_BUS 133 +#define BCMXCP_ALARM_LOSS_OF_SYNC_BUS 133 #define BCMXCP_ALARM_RECTIFIER_BREAKER_SHUNT_TRIP 134 #define BCMXCP_ALARM_LOSS_OF_CHARGER_SYNC 135 #define BCMXCP_ALARM_INVERTER_LOW_LEVEL_TEST_TIMEOUT 136 diff --git a/drivers/bcmxcp_io.h b/drivers/bcmxcp_io.h index 5293e05..b785a37 100644 --- a/drivers/bcmxcp_io.h +++ b/drivers/bcmxcp_io.h @@ -1,6 +1,6 @@ -/* +/* * bcmxcp_io.h -- header for BCM/XCP IO module - */ + */ #ifndef BCMXCP_IO__ #define BCMXCP_IO__ @@ -8,10 +8,10 @@ #include "main.h" /* for usbdrv_info_t */ void send_read_command(unsigned char command); -void send_write_command(unsigned char *command, size_t command_length); -ssize_t get_answer(unsigned char *data, unsigned char command); -ssize_t command_read_sequence(unsigned char command, unsigned char *data); -ssize_t command_write_sequence(unsigned char *command, size_t command_length, unsigned char *answer); +void send_write_command(unsigned char *command, int command_length); +int get_answer(unsigned char *data, unsigned char command); +int command_read_sequence(unsigned char command, unsigned char *data); +int command_write_sequence(unsigned char *command, int command_length, unsigned char *answer); void upsdrv_initups(void); void upsdrv_cleanup(void); void upsdrv_reconnect(void); diff --git a/drivers/bcmxcp_ser.c b/drivers/bcmxcp_ser.c index 58595f3..74cecf9 100644 --- a/drivers/bcmxcp_ser.c +++ b/drivers/bcmxcp_ser.c @@ -1,12 +1,11 @@ #include "main.h" #include "bcmxcp.h" #include "bcmxcp_io.h" -#include "bcmxcp_ser.h" #include "serial.h" -#include "nut_stdint.h" + #define SUBDRIVER_NAME "RS-232 communication subdriver" -#define SUBDRIVER_VERSION "0.21" +#define SUBDRIVER_VERSION "0.20" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -19,8 +18,10 @@ upsdrv_info_t comm_upsdrv_info = { #define PW_MAX_BAUD 5 -/* NOT static: also used from nut-scanner, so extern'ed via bcmxcp_ser.h */ -pw_baud_rate_t pw_baud_rates[] = { +struct pw_baud_rate { + int rate; + int name; +} pw_baud_rates[] = { { B19200, 19200 }, { B9600, 9600 }, { B4800, 4800 }, @@ -30,19 +31,12 @@ pw_baud_rate_t pw_baud_rates[] = { { 0, 0 } }; -/* NOT static: also used from nut-scanner, so extern'ed via bcmxcp_ser.h */ -unsigned char BCMXCP_AUTHCMD[4] = {0xCF, 0x69, 0xE8, 0xD5}; /* Authorisation command */ +unsigned char AUT[4] = {0xCF, 0x69, 0xE8, 0xD5}; /* Autorisation command */ -static void send_command(unsigned char *command, size_t command_length) +static void send_command(unsigned char *command, int command_length) { - int retry = 0; - ssize_t sent; - unsigned char sbuf[1024]; - - if (command_length > UCHAR_MAX) { - upsdebugx (3, "%s: ERROR: command_length too long for the character protocol", __func__); - return; - } + int retry = 0, sent; + unsigned char sbuf[128]; /* Prepare the send buffer */ sbuf[0] = PW_COMMAND_START_BYTE; @@ -65,12 +59,7 @@ static void send_command(unsigned char *command, size_t command_length) sent = ser_send_buf(upsfd, sbuf, command_length); - if (sent < 0) { - upslogx(LOG_ERR, "%s(): error reading from ser_send_buf()", __func__); - return; - } - - if ((size_t)sent == command_length) { + if (sent == command_length) { return; } } @@ -81,90 +70,87 @@ void send_read_command(unsigned char command) send_command(&command, 1); } -void send_write_command(unsigned char *command, size_t command_length) +void send_write_command(unsigned char *command, int command_length) { send_command(command, command_length); } /* get the answer of a command from the ups. And check that the answer is for this command */ -ssize_t get_answer(unsigned char *data, unsigned char command) +int get_answer(unsigned char *data, unsigned char command) { unsigned char my_buf[128]; /* packet has a maximum length of 121+5 bytes */ - ssize_t res; - size_t length, end_length = 0, endblock = 0, start = 0; + int length, end_length = 0, res, endblock = 0, start = 0; unsigned char block_number, sequence, pre_sequence = 0; - while (endblock != 1) { + while (endblock != 1){ do { /* Read PW_COMMAND_START_BYTE byte */ res = ser_get_char(upsfd, my_buf, 1, 0); if (res != 1) { - upsdebugx(1, - "Receive error (PW_COMMAND_START_BYTE): %zd, cmd=%x!!!\n", - res, command); + upsdebugx(1,"Receive error (PW_COMMAND_START_BYTE): %d, cmd=%x!!!\n", res, command); return -1; } start++; } while ((my_buf[0] != PW_COMMAND_START_BYTE) && (start < 128)); - + if (start == 128) { ser_comm_fail("Receive error (PW_COMMAND_START_BYTE): packet not on start!!%x\n", my_buf[0]); return -1; } /* Read block number byte */ - res = ser_get_char(upsfd, my_buf + 1, 1, 0); + res = ser_get_char(upsfd, my_buf+1, 1, 0); if (res != 1) { - ser_comm_fail("Receive error (Block number): %zd!!!\n", res); + ser_comm_fail("Receive error (Block number): %d!!!\n", res); return -1; } block_number = (unsigned char)my_buf[1]; if (command <= 0x43) { - if ((command - 0x30) != block_number) { + if ((command - 0x30) != block_number){ ser_comm_fail("Receive error (Request command): %x!!!\n", block_number); return -1; } } if (command >= 0x89) { - if ((command == 0xA0) && (block_number != 0x01)) { + if ((command == 0xA0) && (block_number != 0x01)){ ser_comm_fail("Receive error (Requested only mode command): %x!!!\n", block_number); return -1; } - if ((command != 0xA0) && (block_number != 0x09)) { + if ((command != 0xA0) && (block_number != 0x09)){ ser_comm_fail("Receive error (Control command): %x!!!\n", block_number); return -1; } } /* Read data length byte */ - res = ser_get_char(upsfd, my_buf + 2, 1, 0); + res = ser_get_char(upsfd, my_buf+2, 1, 0); if (res != 1) { - ser_comm_fail("Receive error (length): %zd!!!\n", res); + ser_comm_fail("Receive error (length): %d!!!\n", res); return -1; } length = (unsigned char)my_buf[2]; if (length < 1) { - ser_comm_fail("Receive error (length): packet length %zx!!!\n", length); + ser_comm_fail("Receive error (length): packet length %x!!!\n", length); return -1; } /* Read sequence byte */ - res = ser_get_char(upsfd, my_buf + 3, 1, 0); + res = ser_get_char(upsfd, my_buf+3, 1, 0); if (res != 1) { - ser_comm_fail("Receive error (sequence): %zd!!!\n", res); + ser_comm_fail("Receive error (sequence): %d!!!\n", res); return -1; } @@ -181,23 +167,19 @@ ssize_t get_answer(unsigned char *data, unsigned char command) pre_sequence = sequence; - /* Try to read all the remaining bytes */ - res = ser_get_buf_len(upsfd, my_buf + 4, length, 1, 0); - if (res < 0) { - ser_comm_fail("%s(): ser_get_buf_len() returned error code %zd", __func__, res); - return res; - } + /* Try to read all the remainig bytes */ + res = ser_get_buf_len(upsfd, my_buf+4, length, 1, 0); - if ((size_t)res != length) { - ser_comm_fail("Receive error (data): got %zd bytes instead of %zu!!!\n", res, length); + if (res != length) { + ser_comm_fail("Receive error (data): got %d bytes instead of %d!!!\n", res, length); return -1; } /* Get the checksum byte */ - res = ser_get_char(upsfd, my_buf + (4 + length), 1, 0); + res = ser_get_char(upsfd, my_buf+(4+length), 1, 0); if (res != 1) { - ser_comm_fail("Receive error (checksum): %zx!!!\n", res); + ser_comm_fail("Receive error (checksum): %x!!!\n", res); return -1; } @@ -207,7 +189,7 @@ ssize_t get_answer(unsigned char *data, unsigned char command) return -1; } - memcpy(data+end_length, my_buf + 4, length); + memcpy(data+end_length, my_buf+4, length); end_length += length; } @@ -215,14 +197,12 @@ ssize_t get_answer(unsigned char *data, unsigned char command) upsdebug_hex (5, "get_answer", data, end_length); ser_comm_good(); - assert(end_length < SSIZE_MAX); - return (ssize_t)end_length; + return end_length; } -static ssize_t command_sequence(unsigned char *command, size_t command_length, unsigned char *answer) +static int command_sequence(unsigned char *command, int command_length, unsigned char *answer) { - ssize_t bytes_read; - int retry = 0; + int bytes_read, retry = 0; while (retry++ < PW_MAX_TRY) { @@ -243,9 +223,9 @@ static ssize_t command_sequence(unsigned char *command, size_t command_length, u } /* Sends a single command (length=1). and get the answer */ -ssize_t command_read_sequence(unsigned char command, unsigned char *answer) +int command_read_sequence(unsigned char command, unsigned char *answer) { - ssize_t bytes_read; + int bytes_read; bytes_read = command_sequence(&command, 1, answer); @@ -257,9 +237,9 @@ ssize_t command_read_sequence(unsigned char command, unsigned char *answer) } /* Sends a setup command (length > 1) */ -ssize_t command_write_sequence(unsigned char *command, size_t command_length, unsigned char *answer) +int command_write_sequence(unsigned char *command, int command_length, unsigned char *answer) { - ssize_t bytes_read; + int bytes_read; bytes_read = command_sequence(command, command_length, answer); @@ -275,80 +255,18 @@ void upsdrv_comm_good() ser_comm_good(); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif - -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -static void pw_comm_setup(const char *port) +void pw_comm_setup(const char *port) { unsigned char command = PW_SET_REQ_ONLY_MODE; unsigned char id_command = PW_ID_BLOCK_REQ; unsigned char answer[256]; - int i = 0; - ssize_t ret = -1; - speed_t mybaud = 0, baud; + int i = 0, baud, mybaud = 0, ret = -1; if (getval("baud_rate") != NULL) { - int br = atoi(getval("baud_rate")); - /* Note that atoi() behavior on erroneous input is undefined */ - if (br < 0) { - upslogx(LOG_ERR, "baud_rate option is invalid"); - return; - } - - /* FIXME: speed_t does not define a SPEED_MAX value nor - * guarantee that it is an int (just a typedef from - * termios.h happens to say that on some systems)... - * But since we convert this setting from int, we assume... - */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -/* Note for gating macros above: unsuffixed HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - * means support of contexts both inside and outside function body, so the push - * above and pop below (outside this finction) are not used. - */ -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -/* Note that the individual warning pragmas for use inside function bodies - * are named without a _INSIDEFUNC suffix, for simplicity and legacy reasons - */ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - switch(sizeof(speed_t)) { - case 8: assert (br < INT64_MAX); break; - case 4: assert (br < INT32_MAX); break; - case 2: assert (br < INT16_MAX); break; - default: assert (br < INT_MAX); - } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - baud = (speed_t)br; - - for (i = 0; i < PW_MAX_BAUD; i++) { + baud = atoi(getval("baud_rate")); + + for(i = 0; i < PW_MAX_BAUD; i++) { if (baud == pw_baud_rates[i].name) { mybaud = pw_baud_rates[i].rate; break; @@ -362,7 +280,7 @@ static void pw_comm_setup(const char *port) ser_set_speed(upsfd, device_path, mybaud); ser_send_char(upsfd, 0x1d); /* send ESC to take it out of menu */ usleep(90000); - send_write_command(BCMXCP_AUTHCMD, 4); + send_write_command(AUT, 4); usleep(500000); ret = command_sequence(&command, 1, answer); if (ret <= 0) { @@ -371,14 +289,11 @@ static void pw_comm_setup(const char *port) } if (ret > 0) { - /* Cast baud into max length unsigned, despite the POSIX - * standard some systems vary in definition of this type - */ - upslogx(LOG_INFO, "Connected to UPS on %s with baudrate %llu", port, (unsigned long long int)baud); + upslogx(LOG_INFO, "Connected to UPS on %s with baudrate %d", port, baud); return; } - upslogx(LOG_ERR, "No response from UPS on %s with baudrate %llu", port, (unsigned long long int)baud); + upslogx(LOG_ERR, "No response from UPS on %s with baudrate %d", port, baud); } upslogx(LOG_INFO, "Attempting to autodect baudrate"); @@ -388,7 +303,7 @@ static void pw_comm_setup(const char *port) ser_set_speed(upsfd, device_path, pw_baud_rates[i].rate); ser_send_char(upsfd, 0x1d); /* send ESC to take it out of menu */ usleep(90000); - send_write_command(BCMXCP_AUTHCMD, 4); + send_write_command(AUT, 4); usleep(500000); ret = command_sequence(&command, 1, answer); if (ret <= 0) { @@ -397,18 +312,15 @@ static void pw_comm_setup(const char *port) } if (ret > 0) { - upslogx(LOG_INFO, "Connected to UPS on %s with baudrate %zu", port, pw_baud_rates[i].name); + upslogx(LOG_INFO, "Connected to UPS on %s with baudrate %d", port, pw_baud_rates[i].name); return; } - upsdebugx(2, "No response from UPS on %s with baudrate %zu", port, pw_baud_rates[i].name); + upsdebugx(2, "No response from UPS on %s with baudrate %d", port, pw_baud_rates[i].name); } fatalx(EXIT_FAILURE, "Can't connect to the UPS on port %s!\n", port); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif void upsdrv_initups(void) { diff --git a/drivers/bcmxcp_ser.h b/drivers/bcmxcp_ser.h deleted file mode 100644 index 1f3f880..0000000 --- a/drivers/bcmxcp_ser.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * bcmxcp_ser.h -- header for BCM/XCP RS-232 module - */ - -#ifndef BCMXCP_SER__ -#define BCMXCP_SER__ - -#include "serial.h" /* pulls termios.h to define speed_t */ - -/* This header is needed for this line, to avoid warnings about it not - * being static in C file (can't hide, is also needed by nut-scanner) - */ -extern unsigned char BCMXCP_AUTHCMD[4]; - -typedef struct { - speed_t rate; /* Value like B19200 defined in termios.h; note: NOT the bitrate numerically */ - size_t name; /* Actual rate... WHY is this "name" - number to print interactively? */ -} pw_baud_rate_t; - -extern pw_baud_rate_t pw_baud_rates[]; - -#endif /* BCMXCP_SER__ */ diff --git a/drivers/bcmxcp_usb.c b/drivers/bcmxcp_usb.c index e219714..2788029 100644 --- a/drivers/bcmxcp_usb.c +++ b/drivers/bcmxcp_usb.c @@ -9,9 +9,10 @@ #include #include #include +#include #define SUBDRIVER_NAME "USB communication subdriver" -#define SUBDRIVER_VERSION "0.27" +#define SUBDRIVER_VERSION "0.22" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -33,8 +34,6 @@ upsdrv_info_t comm_upsdrv_info = { /* Hewlett Packard */ #define HP_VENDORID 0x03f0 -static USBDevice_t curDevice; - /* USB functions */ usb_dev_handle *nutusb_open(const char *port); int nutusb_close(usb_dev_handle *dev_h, const char *port); @@ -43,36 +42,27 @@ void nutusb_comm_fail(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); void nutusb_comm_good(void); /* function pointer, set depending on which device is used */ -/* FIXME? Use usb_ctrl_* typedefs*/ -static int (*usb_set_descriptor)(usb_dev_handle *udev, unsigned char type, - unsigned char index, void *buf, size_t size); +int (*usb_set_descriptor)(usb_dev_handle *udev, unsigned char type, + unsigned char index, void *buf, int size); /* usb_set_descriptor() for Powerware devices */ -/* FIXME? Use usb_ctrl_* typedefs*/ -static int usb_set_powerware(usb_dev_handle *udev, unsigned char type, unsigned char index, void *buf, size_t size) +static int usb_set_powerware(usb_dev_handle *udev, unsigned char type, unsigned char index, void *buf, int size) { - assert (size < INT_MAX); - return usb_control_msg(udev, USB_ENDPOINT_OUT, USB_REQ_SET_DESCRIPTOR, (type << 8) + index, 0, buf, (int)size, 1000); + return usb_control_msg(udev, USB_ENDPOINT_OUT, USB_REQ_SET_DESCRIPTOR, (type << 8) + index, 0, buf, size, 1000); } static void *powerware_ups(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); usb_set_descriptor = &usb_set_powerware; return NULL; } /* usb_set_descriptor() for Phoenixtec devices */ -/* FIXME? Use usb_ctrl_* typedefs*/ -static int usb_set_phoenixtec(usb_dev_handle *udev, unsigned char type, unsigned char index, void *buf, size_t size) +static int usb_set_phoenixtec(usb_dev_handle *udev, unsigned char type, unsigned char index, void *buf, int size) { - NUT_UNUSED_VARIABLE(index); - NUT_UNUSED_VARIABLE(type); - assert (size < INT_MAX); - return usb_control_msg(udev, 0x42, 0x0d, (0x00 << 8) + 0x0, 0, buf, (int)size, 1000); + return usb_control_msg(udev, 0x42, 0x0d, (0x00 << 8) + 0x0, 0, buf, size, 1000); } static void *phoenixtec_ups(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); usb_set_descriptor = &usb_set_phoenixtec; return NULL; } @@ -89,18 +79,18 @@ static usb_device_id_t pw_usb_device_table[] = { { USB_DEVICE(HP_VENDORID, 0x1f01), &phoenixtec_ups }, /* T750 */ { USB_DEVICE(HP_VENDORID, 0x1f02), &phoenixtec_ups }, - + /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; /* limit the amount of spew that goes in the syslog when we lose the UPS */ #define USB_ERR_LIMIT 10 /* start limiting after 10 in a row */ #define USB_ERR_RATE 10 /* then only print every 10th error */ -#define XCP_USB_TIMEOUT 5000 /* in msec */ +#define XCP_USB_TIMEOUT 5000 /* global variables */ -static usb_dev_handle *upsdev = NULL; +usb_dev_handle *upsdev = NULL; extern int exit_flag; static unsigned int comm_failures = 0; @@ -119,7 +109,7 @@ void send_read_command(unsigned char command) } } -void send_write_command(unsigned char *command, size_t command_length) +void send_write_command(unsigned char *command, int command_length) { unsigned char sbuf[128]; @@ -138,69 +128,42 @@ void send_write_command(unsigned char *command, size_t command_length) } } -#define PW_HEADER_SIZE (PW_HEADER_LENGTH + 1) -#define PW_CMD_BUFSIZE 256 /* get the answer of a command from the ups. And check that the answer is for this command */ -ssize_t get_answer(unsigned char *data, unsigned char command) +int get_answer(unsigned char *data, unsigned char command) { - unsigned char buf[PW_CMD_BUFSIZE], *my_buf = buf; - ssize_t res; - int endblock, need_data; - long elapsed_time; /* milliseconds */ - ssize_t tail; - size_t bytes_read, end_length, length; + unsigned char buf[1024], *my_buf = buf; + int length, end_length, res, endblock, bytes_read, ellapsed_time; unsigned char block_number, sequence, seq_num; struct timeval start_time, now; if (upsdev == NULL) return -1; - need_data = PW_HEADER_SIZE; /* 4 - cmd response header length, 1 for csum */ + length = 1; /* non zero to enter the read loop */ end_length = 0; /* total length of sequence(s), not counting header(s) */ endblock = 0; /* signal the last sequence in the block */ bytes_read = 0; /* total length of data read, including XCP header */ res = 0; - elapsed_time = 0; + ellapsed_time = 0; seq_num = 1; /* current theoric sequence */ upsdebugx(1, "entering get_answer(%x)", command); /* Store current time */ gettimeofday(&start_time, NULL); - memset(&buf, 0x0, PW_CMD_BUFSIZE); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Stay ahead of possible redefinitions... */ - assert (XCP_USB_TIMEOUT < INT_MAX); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - - while ( (!endblock) && ((XCP_USB_TIMEOUT - elapsed_time) > 0) ) { + while ( (!endblock) && ((XCP_USB_TIMEOUT - ellapsed_time) > 0) ) { /* Get (more) data if needed */ - if (need_data > 0) { - res = usb_interrupt_read(upsdev, - 0x81, - (usb_ctrl_charbuf) buf + bytes_read, - 128, - (int)(XCP_USB_TIMEOUT - elapsed_time)); + if ((length - (bytes_read - 5)) > 0) { + res = usb_interrupt_read(upsdev, 0x81, + (char *)&buf[bytes_read], + (PW_ANSWER_MAX_SIZE - bytes_read), + (XCP_USB_TIMEOUT - ellapsed_time)); /* Update time */ gettimeofday(&now, NULL); - elapsed_time = (now.tv_sec - start_time.tv_sec)*1000 + + ellapsed_time = (now.tv_sec - start_time.tv_sec)*1000 + (now.tv_usec - start_time.tv_usec)/1000; /* Check libusb return value */ @@ -218,50 +181,58 @@ ssize_t get_answer(unsigned char *data, unsigned char command) /* FIXME: */ continue; } - /* Else, we got some input bytes */ - bytes_read += (size_t)res; - need_data -= res; + + /* Else, we got some input bytes */ + bytes_read += res; upsdebug_hex(1, "get_answer", buf, bytes_read); } - if (need_data > 0) /* We need more data */ - continue; - /* Now validate XCP frame */ /* Check header */ - if ( my_buf[0] != PW_COMMAND_START_BYTE ) { - upsdebugx(2, "get_answer: wrong header 0xab vs %02x", my_buf[0]); - /* Sometime we read something wrong. bad cables? bad ports? */ - my_buf = memchr(my_buf, PW_COMMAND_START_BYTE, bytes_read); - if (!my_buf) - return -1; + if ( my_buf[0] != 0xAB ) { + upsdebugx(2, "get_answer: wrong header"); + return -1; } + /* These validations seem not needed! */ /* Read block number byte */ block_number = my_buf[1]; upsdebugx(1, "get_answer: block_number = %x", block_number); +#if 0 + if (command <= 0x43) { + if ((command - 0x30) != block_number){ + nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of %x), COMMAND: %x!\n", + block_number, (command - 0x30), command); + return -1; + } + } + + if (command >= 0x89) { + if ((command == 0xA0) && (block_number != 0x01)){ + nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of 0x01), COMMAND: %x!\n", block_number, command); + return -1; + } + else if ((command != 0xA0) && (block_number != 0x09)){ + nutusb_comm_fail("Receive error (Request command): BLOCK: %x (instead of 0x09), COMMAND: %x!\n", block_number, command); + return -1; + } + } +#endif /* if 0 */ /* Check data length byte (remove the header length) */ length = my_buf[2]; - upsdebugx(3, "get_answer: data length = %zu", length); - if (bytes_read < (length + PW_HEADER_SIZE)) { - if (need_data < 0) --need_data; /* count zerro byte too */ - need_data += length + 1; /* packet lenght + checksum */ - upsdebugx(2, "get_answer: need to read %d more data", need_data); + upsdebugx(3, "get_answer: data length = %d", length); + if ((bytes_read - 5) < length) { + upsdebugx(2, "get_answer: need to read %d more data", length - (bytes_read - 5)); continue; } /* Check if Length conforms to XCP (121 for normal, 140 for Test mode) */ /* Use the more generous length for testing */ - if (length > 140) { + if (length > 140 ) { upsdebugx(2, "get_answer: bad length"); return -1; } - if (bytes_read >= SSIZE_MAX) { - upsdebugx(2, "get_answer: bad length (incredibly large read)"); - return -1; - } - /* Test the Sequence # */ sequence = my_buf[3]; if ((sequence & PW_SEQ_MASK) != seq_num) { @@ -289,40 +260,25 @@ ssize_t get_answer(unsigned char *data, unsigned char command) } else { seq_num++; - upsdebugx(2, "get_answer: next sequence is %d", seq_num); } /* copy the current valid XCP frame back */ - memcpy(data+end_length, my_buf + 4, length); + memcpy(data+end_length, my_buf+4, length); /* increment pointers to process the next sequence */ end_length += length; - - /* Work around signedness of comparison result, SSIZE_MAX checked above: */ - tail = (ssize_t)bytes_read; - tail -= (ssize_t)(length + PW_HEADER_SIZE); - if (tail > 0) - my_buf = memmove(&buf[0], my_buf + length + PW_HEADER_SIZE, (size_t)tail); - else if (tail == 0) - my_buf = &buf[0]; - else { /* if (tail < 0) */ - upsdebugx(1, "get_answer(): did not expect to get negative tail size: %zd", tail); - return -1; - } - - bytes_read = (size_t)tail; + my_buf += length + 5; } upsdebug_hex (5, "get_answer", data, end_length); - assert (end_length < SSIZE_MAX); - return (ssize_t)end_length; + return end_length; } /* Sends a single command (length=1). and get the answer */ -ssize_t command_read_sequence(unsigned char command, unsigned char *data) +int command_read_sequence(unsigned char command, unsigned char *data) { - ssize_t bytes_read = 0; - size_t retry = 0; - + int bytes_read = 0; + int retry = 0; + while ((bytes_read < 1) && (retry < 5)) { send_read_command(command); bytes_read = get_answer(data, command); @@ -339,10 +295,10 @@ ssize_t command_read_sequence(unsigned char command, unsigned char *data) } /* Sends a setup command (length > 1) */ -ssize_t command_write_sequence(unsigned char *command, size_t command_length, unsigned char *answer) +int command_write_sequence(unsigned char *command, int command_length, unsigned char *answer) { - ssize_t bytes_read = 0; - size_t retry = 0; + int bytes_read = 0; + int retry = 0; while ((bytes_read < 1) && (retry < 5)) { send_write_command(command, command_length); @@ -375,11 +331,6 @@ void upsdrv_cleanup(void) { upslogx(LOG_ERR, "CLOSING\n"); nutusb_close(upsdev, "USB"); - free(curDevice.Vendor); - free(curDevice.Product); - free(curDevice.Serial); - free(curDevice.Bus); - free(curDevice.Device); } void upsdrv_reconnect(void) @@ -394,9 +345,6 @@ void upsdrv_reconnect(void) } /* USB functions */ -static void nutusb_open_error(const char *port) - __attribute__((noreturn)); - static void nutusb_open_error(const char *port) { printf("Unable to find POWERWARE UPS device on USB bus (%s)\n\n", port); @@ -412,59 +360,14 @@ static void nutusb_open_error(const char *port) /* FIXME: this part of the opening can go into common... */ static usb_dev_handle *open_powerware_usb(void) { -#if WITH_LIBUSB_1_0 - libusb_device **devlist; - ssize_t devcount = 0; - libusb_device_handle *udev; - struct libusb_device_descriptor dev_desc; - uint8_t bus; - int i; - - devcount = libusb_get_device_list(NULL, &devlist); - if (devcount <= 0) - fatal_with_errno(EXIT_FAILURE, "No USB device found"); - - for (i = 0; i < devcount; i++) { - - libusb_device *device = devlist[i]; - libusb_get_device_descriptor(device, &dev_desc); - - if (dev_desc.bDeviceClass != LIBUSB_CLASS_PER_INTERFACE) { - continue; - } - - curDevice.VendorID = dev_desc.idVendor; - curDevice.ProductID = dev_desc.idProduct; - bus = libusb_get_bus_number(device); - curDevice.Bus = (char *)malloc(4); - if (curDevice.Bus == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - sprintf(curDevice.Bus, "%03d", bus); - - /* FIXME: we should also retrieve - * dev->descriptor.iManufacturer - * dev->descriptor.iProduct - * dev->descriptor.iSerialNumber - * as in libusb.c->libusb_open() - * This is part of the things to put in common... */ - - if (is_usb_device_supported(pw_usb_device_table, &curDevice) == SUPPORTED) { - libusb_open(device, &udev); - libusb_free_device_list(devlist, 1); - return udev; - } - } - libusb_free_device_list(devlist, 1); -#else /* not WITH_LIBUSB_1_0 */ - struct usb_bus *busses = usb_get_busses(); + struct usb_bus *busses = usb_get_busses(); struct usb_bus *bus; + USBDevice_t curDevice; for (bus = busses; bus; bus = bus->next) { struct usb_device *dev; - + for (dev = bus->devices; dev; dev = dev->next) { if (dev->descriptor.bDeviceClass != USB_CLASS_PER_INTERFACE) { @@ -473,7 +376,7 @@ static usb_dev_handle *open_powerware_usb(void) curDevice.VendorID = dev->descriptor.idVendor; curDevice.ProductID = dev->descriptor.idProduct; - curDevice.Bus = xstrdup(bus->dirname); + curDevice.Bus = strdup(bus->dirname); /* FIXME: we should also retrieve * dev->descriptor.iManufacturer @@ -487,7 +390,6 @@ static usb_dev_handle *open_powerware_usb(void) } } } -#endif /* WITH_LIBUSB_1_0 */ return 0; } @@ -496,22 +398,13 @@ usb_dev_handle *nutusb_open(const char *port) int dev_claimed = 0; usb_dev_handle *dev_h = NULL; int retry, errout = 0; - int ret = 0; upsdebugx(1, "entering nutusb_open()"); - warn_if_bad_usb_port_filename(device_path); /* Initialize Libusb */ -#if WITH_LIBUSB_1_0 - if (libusb_init(NULL) < 0) { - libusb_exit(NULL); - fatal_with_errno(EXIT_FAILURE, "Failed to init libusb 1.0"); - } -#else /* not WITH_LIBUSB_1_0 */ usb_init(); usb_find_busses(); usb_find_devices(); -#endif /* WITH_LIBUSB_1_0 */ for (retry = 0; retry < MAX_TRY ; retry++) { @@ -521,12 +414,12 @@ usb_dev_handle *nutusb_open(const char *port) errout = 1; } else { - upsdebugx(1, "device %s opened successfully", curDevice.Bus); + upsdebugx(1, "device %s opened successfully", usb_device(dev_h)->filename); errout = 0; - if ((ret = usb_claim_interface(dev_h, 0)) < 0) + if (usb_claim_interface(dev_h, 0) < 0) { - upsdebugx(1, "Can't claim POWERWARE USB interface: %s", nut_usb_strerror(ret)); + upsdebugx(1, "Can't claim POWERWARE USB interface: %s", usb_strerror()); errout = 1; } else { @@ -535,13 +428,9 @@ usb_dev_handle *nutusb_open(const char *port) } /* FIXME: the above part of the opening can go into common... up to here at least */ - if ((ret = usb_clear_halt(dev_h, 0x81)) < 0) + if (usb_clear_halt(dev_h, 0x81) < 0) { - upsdebugx(1, "Can't reset POWERWARE USB endpoint: %s", nut_usb_strerror(ret)); - if (dev_claimed) - usb_release_interface(dev_h, 0); - usb_reset(dev_h); - sleep(5); /* Wait reconnect */ + upsdebugx(1, "Can't reset POWERWARE USB endpoint: %s", usb_strerror()); errout = 1; } else @@ -565,7 +454,8 @@ usb_dev_handle *nutusb_open(const char *port) if (dev_h && dev_claimed) usb_release_interface(dev_h, 0); - nutusb_close(dev_h, port); + if (dev_h) + usb_close(dev_h); if (errout == 1) nutusb_open_error(port); @@ -576,21 +466,13 @@ usb_dev_handle *nutusb_open(const char *port) /* FIXME: this part can go into common... */ int nutusb_close(usb_dev_handle *dev_h, const char *port) { - int ret = 0; - NUT_UNUSED_VARIABLE(port); - if (dev_h) { usb_release_interface(dev_h, 0); -#if WITH_LIBUSB_1_0 - libusb_close(dev_h); - libusb_exit(NULL); -#else - ret = usb_close(dev_h); -#endif + return usb_close(dev_h); } - - return ret; + + return 0; } void nutusb_comm_fail(const char *fmt, ...) @@ -647,3 +529,4 @@ void nutusb_comm_good(void) upslogx(LOG_NOTICE, "Communications with UPS re-established"); comm_failures = 0; } + diff --git a/drivers/belkin-hid.c b/drivers/belkin-hid.c index c1aaccf..e95b17a 100644 --- a/drivers/belkin-hid.c +++ b/drivers/belkin-hid.c @@ -1,9 +1,9 @@ /* belkin-hid.c - data to monitor Belkin UPS Systems USB/HID devices with NUT * * Copyright (C) - * 2003 - 2008 Arnaud Quette + * 2003 - 2008 Arnaud Quette * 2005 Peter Selinger - * 2011, 2014 Charles Lepple + * 2011 Charles Lepple * * Sponsored by MGE UPS SYSTEMS * @@ -29,22 +29,20 @@ #include "belkin-hid.h" #include "usb-common.h" -#include /* for fabs() */ - -#define BELKIN_HID_VERSION "Belkin/Liebert HID 0.18" +#define BELKIN_HID_VERSION "Belkin HID 0.15" /* Belkin */ #define BELKIN_VENDORID 0x050d /* Liebert */ #define LIEBERT_VENDORID 0x10af - -/*! USB IDs device table. - * Note that there are at least two Liebert firmware types which both report +/* Note that there are at least two Liebert firmware types which both report * a VID:PID of 10af:0001. The newer ones tend not to have the Belkin broken * Usage Pages (and therefore use standard HID PDC paths) but they have * incorrect exponents for some fields. */ + +/* USB IDs device table */ static usb_device_id_t belkin_usb_device_table[] = { /* F6C800-UNV */ { USB_DEVICE(BELKIN_VENDORID, 0x0980), NULL }, @@ -62,22 +60,14 @@ static usb_device_id_t belkin_usb_device_table[] = { { USB_DEVICE(BELKIN_VENDORID, 0x0751), NULL }, /* F6H375-USB */ { USB_DEVICE(BELKIN_VENDORID, 0x0375), NULL }, - /* Regulator PRO-USB */ - { USB_DEVICE(BELKIN_VENDORID, 0x0f51), NULL }, /* F6C1100-UNV, F6C1200-UNV */ { USB_DEVICE(BELKIN_VENDORID, 0x1100), NULL }, - /* Liebert GXT4 UPS */ - { USB_DEVICE(LIEBERT_VENDORID, 0x0004), NULL }, /* Liebert PowerSure PSA UPS */ { USB_DEVICE(LIEBERT_VENDORID, 0x0001), NULL }, - /* Liebert PowerSure PSI 1440 */ - { USB_DEVICE(LIEBERT_VENDORID, 0x0004), NULL }, - /* Liebert GXT3 */ - { USB_DEVICE(LIEBERT_VENDORID, 0x0008), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; static const char *liebert_online_fun(double value); @@ -90,35 +80,35 @@ static const char *liebert_config_voltage_fun(double value); static const char *liebert_line_voltage_fun(double value); static info_lkp_t liebert_online_info[] = { - { 0, NULL, liebert_online_fun, NULL } + { 0, NULL, liebert_online_fun } }; static info_lkp_t liebert_discharging_info[] = { - { 0, NULL, liebert_discharging_fun, NULL } + { 0, NULL, liebert_discharging_fun } }; static info_lkp_t liebert_charging_info[] = { - { 0, NULL, liebert_charging_fun, NULL } + { 0, NULL, liebert_charging_fun } }; static info_lkp_t liebert_lowbatt_info[] = { - { 0, NULL, liebert_lowbatt_fun, NULL } + { 0, NULL, liebert_lowbatt_fun } }; static info_lkp_t liebert_replacebatt_info[] = { - { 0, NULL, liebert_replacebatt_fun, NULL } + { 0, NULL, liebert_replacebatt_fun } }; static info_lkp_t liebert_shutdownimm_info[] = { - { 0, NULL, liebert_shutdownimm_fun, NULL } + { 0, NULL, liebert_shutdownimm_fun } }; static info_lkp_t liebert_config_voltage_info[] = { - { 0, NULL, liebert_config_voltage_fun, NULL }, + { 0, NULL, liebert_config_voltage_fun }, }; static info_lkp_t liebert_line_voltage_info[] = { - { 0, NULL, liebert_line_voltage_fun, NULL }, + { 0, NULL, liebert_line_voltage_fun }, }; static double liebert_config_voltage_mult = 1.0; @@ -165,7 +155,7 @@ static const char *liebert_shutdownimm_fun(double value) static const char *liebert_config_voltage_fun(double value) { if( value < 1 ) { - if( fabs(value - 1e-7) < 1e-9 ) { + if( abs(value - 1e-7) < 1e-9 ) { liebert_config_voltage_mult = 1e8; liebert_line_voltage_mult = 1e7; /* stomp this in case input voltage was low */ upsdebugx(2, "ConfigVoltage = %g -> assuming correction factor = %g", @@ -183,7 +173,7 @@ static const char *liebert_config_voltage_fun(double value) static const char *liebert_line_voltage_fun(double value) { if( value < 1 ) { - if( fabs(value - 1e-7) < 1e-9 ) { + if( abs(value - 1e-7) < 1e-9 ) { liebert_line_voltage_mult = 1e7; upsdebugx(2, "Input/OutputVoltage = %g -> assuming correction factor = %g", value, liebert_line_voltage_mult); @@ -211,7 +201,7 @@ static const char *belkin_firmware_conversion_fun(double value) } static info_lkp_t belkin_firmware_conversion[] = { - { 0, NULL, belkin_firmware_conversion_fun, NULL } + { 0, NULL, belkin_firmware_conversion_fun } }; static const char *belkin_upstype_conversion_fun(double value) @@ -234,7 +224,7 @@ static const char *belkin_upstype_conversion_fun(double value) } static info_lkp_t belkin_upstype_conversion[] = { - { 0, NULL, belkin_upstype_conversion_fun, NULL } + { 0, NULL, belkin_upstype_conversion_fun } }; static const char *belkin_sensitivity_conversion_fun(double value) @@ -251,17 +241,17 @@ static const char *belkin_sensitivity_conversion_fun(double value) } static info_lkp_t belkin_sensitivity_conversion[] = { - { 0, NULL, belkin_sensitivity_conversion_fun, NULL } + { 0, NULL, belkin_sensitivity_conversion_fun } }; static info_lkp_t belkin_test_info[] = { - { 0, "No test initiated", NULL, NULL }, - { 1, "Done and passed", NULL, NULL }, - { 2, "Done and warning", NULL, NULL }, - { 3, "Done and error", NULL, NULL }, - { 4, "Aborted", NULL, NULL }, - { 5, "In progress", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 0, "No test initiated", NULL }, + { 1, "Done and passed", NULL }, + { 2, "Done and warning", NULL }, + { 3, "Done and error", NULL }, + { 4, "Aborted", NULL }, + { 5, "In progress", NULL }, + { 0, NULL, NULL } }; static const char *belkin_overload_conversion_fun(double value) @@ -274,7 +264,7 @@ static const char *belkin_overload_conversion_fun(double value) } static info_lkp_t belkin_overload_conversion[] = { - { 0, NULL, belkin_overload_conversion_fun, NULL } + { 0, NULL, belkin_overload_conversion_fun } }; static const char *belkin_overheat_conversion_fun(double value) @@ -287,7 +277,7 @@ static const char *belkin_overheat_conversion_fun(double value) } static info_lkp_t belkin_overheat_conversion[] = { - { 0, NULL, belkin_overheat_conversion_fun, NULL } + { 0, NULL, belkin_overheat_conversion_fun } }; static const char *belkin_commfault_conversion_fun(double value) @@ -300,7 +290,7 @@ static const char *belkin_commfault_conversion_fun(double value) } static info_lkp_t belkin_commfault_conversion[] = { - { 0, NULL, belkin_commfault_conversion_fun, NULL } + { 0, NULL, belkin_commfault_conversion_fun } }; static const char *belkin_awaitingpower_conversion_fun(double value) @@ -313,7 +303,7 @@ static const char *belkin_awaitingpower_conversion_fun(double value) } static info_lkp_t belkin_awaitingpower_conversion[] = { - { 0, NULL, belkin_awaitingpower_conversion_fun, NULL } + { 0, NULL, belkin_awaitingpower_conversion_fun } }; static const char *belkin_online_conversion_fun(double value) @@ -326,7 +316,7 @@ static const char *belkin_online_conversion_fun(double value) } static info_lkp_t belkin_online_conversion[] = { - { 0, NULL, belkin_online_conversion_fun, NULL } + { 0, NULL, belkin_online_conversion_fun } }; static const char *belkin_lowbatt_conversion_fun(double value) @@ -339,7 +329,7 @@ static const char *belkin_lowbatt_conversion_fun(double value) } static info_lkp_t belkin_lowbatt_conversion[] = { - { 0, NULL, belkin_lowbatt_conversion_fun, NULL } + { 0, NULL, belkin_lowbatt_conversion_fun } }; static const char *belkin_depleted_conversion_fun(double value) @@ -352,7 +342,7 @@ static const char *belkin_depleted_conversion_fun(double value) } static info_lkp_t belkin_depleted_conversion[] = { - { 0, NULL, belkin_depleted_conversion_fun, NULL } + { 0, NULL, belkin_depleted_conversion_fun } }; static const char *belkin_replacebatt_conversion_fun(double value) @@ -365,7 +355,7 @@ static const char *belkin_replacebatt_conversion_fun(double value) } static info_lkp_t belkin_replacebatt_conversion[] = { - { 0, NULL, belkin_replacebatt_conversion_fun, NULL } + { 0, NULL, belkin_replacebatt_conversion_fun } }; /* --------------------------------------------------------------- */ @@ -529,22 +519,6 @@ static hid_info_t belkin_hid2nut[] = { yet implemented) workaround, see the belkinunv(8) man page. -PS 2005/08/28 */ -#if 0 - /* added for debugging Liebert GXT3 : */ - { "unmapped.ups.powersummary.iserialnumber", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.imanufacturer", 0, 0, "UPS.PowerSummary.iManufacturer", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.ioeminformation", 0, 0, "UPS.PowerSummary.iOEMInformation", NULL, "%s", 0, stringid_conversion }, - { "unmapped.ups.powersummary.designcapacity", 0, 0, "UPS.PowerSummary.DesignCapacity", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.remainingtimelimit", 0, 0, "UPS.PowerSummary.RemainingTimeLimit", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.capacitymode", 0, 0, "UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.rechargeable", 0, 0, "UPS.PowerSummary.Rechargeable", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.batterypresent", 0, 0, "UPS.PowerSummary.BatteryPresent", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.fullchargecapacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.capacitygranularity1", 0, 0, "UPS.PowerSummary.CapacityGranularity1", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.capacitygranularity2", 0, 0, "UPS.PowerSummary.CapacityGranularity2", NULL, "%.0f", 0, NULL }, - { "unmapped.ups.powersummary.iproduct", 0, 0, "UPS.PowerSummary.iProduct", NULL, "%.0f", 0, NULL }, -#endif - /* end of structure. */ { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; @@ -641,5 +615,4 @@ subdriver_t belkin_subdriver = { belkin_format_model, belkin_format_mfr, belkin_format_serial, - fix_report_desc, }; diff --git a/drivers/belkin-hid.h b/drivers/belkin-hid.h index 7c5a483..d37db9e 100644 --- a/drivers/belkin-hid.h +++ b/drivers/belkin-hid.h @@ -1,7 +1,7 @@ /* belkin-hid.h - data to monitor Belkin UPS Systems USB/HID devices with NUT * - * Copyright (C) - * 2003 - 2005 Arnaud Quette + * Copyright (C) + * 2003 - 2005 Arnaud Quette * 2005 Peter Selinger * * Sponsored by MGE UPS SYSTEMS diff --git a/drivers/belkin.c b/drivers/belkin.c index 6757fc7..ad5a658 100644 --- a/drivers/belkin.c +++ b/drivers/belkin.c @@ -28,10 +28,10 @@ #include "belkin.h" #define DRIVER_NAME "Belkin Smart protocol driver" -#define DRIVER_VERSION "0.25" +#define DRIVER_VERSION "0.24" -static ssize_t init_communication(void); -static ssize_t get_belkin_reply(char *buf); +static int init_communication(void); +static int get_belkin_reply(char *buf); /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -51,10 +51,9 @@ static void send_belkin_command(char cmd, const char *subcmd, const char *data) upsdebugx(3, "Send Command: %s, %s", subcmd, data); } -static ssize_t init_communication(void) +static int init_communication(void) { - int i; - ssize_t res; + int i, res; char temp[SMALLBUF]; for (i = 0; i < 10; i++) { @@ -108,9 +107,9 @@ static char *get_belkin_field(const char *in, char *out, size_t outlen, size_t n return NULL; } -static ssize_t get_belkin_reply(char *buf) +static int get_belkin_reply(char *buf) { - ssize_t ret; + int ret; long cnt; char tmp[8]; @@ -120,11 +119,10 @@ static ssize_t get_belkin_reply(char *buf) ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 2, 0); if (ret != 7) { - ser_comm_fail("Initial read returned %zd bytes", ret); + ser_comm_fail("Initial read returned %d bytes", ret); return -1; } - /* cnt is <=999 so long is overkill; ok to cast into useconds_t though */ tmp[7] = 0; cnt = strtol(tmp + 4, NULL, 10); upsdebugx(3, "Received: %s", tmp); @@ -139,15 +137,15 @@ static ssize_t get_belkin_reply(char *buf) } /* give it time to respond to us */ - usleep(5000 * (useconds_t)cnt); + usleep(5000 * cnt); - ret = ser_get_buf_len(upsfd, (unsigned char *)buf, (size_t)cnt, 2, 0); + ret = ser_get_buf_len(upsfd, (unsigned char *)buf, cnt, 2, 0); buf[cnt] = 0; upsdebugx(3, "Received: %s", buf); if (ret != cnt) { - ser_comm_fail("Second read returned %zd bytes, expected %ld", ret, cnt); + ser_comm_fail("Second read returned %d bytes, expected %ld", ret, cnt); return -1; } @@ -156,9 +154,9 @@ static ssize_t get_belkin_reply(char *buf) return ret; } -static ssize_t do_broken_rat(char *buf) +static int do_broken_rat(char *buf) { - ssize_t ret; + int ret; long cnt; char tmp[8]; @@ -168,11 +166,10 @@ static ssize_t do_broken_rat(char *buf) ret = ser_get_buf_len(upsfd, (unsigned char *)tmp, 7, 2, 0); if (ret != 7) { - ser_comm_fail("Initial read returned %zd bytes", ret); + ser_comm_fail("Initial read returned %d bytes", ret); return -1; } - /* cnt is <=999 so long is overkill; ok to cast into useconds_t though */ tmp[7] = 0; cnt = strtol(tmp + 4, NULL, 10); upsdebugx(3, "Received: %s", tmp); @@ -187,20 +184,20 @@ static ssize_t do_broken_rat(char *buf) } /* give it time to respond to us */ - usleep(5000 * (useconds_t)cnt); + usleep(5000 * cnt); /* firmware 001 only sends 50 bytes instead of the proper 53 */ if (cnt == 53) { cnt = 50; } - ret = ser_get_buf_len(upsfd, (unsigned char *)buf, (size_t)cnt, 2, 0); + ret = ser_get_buf_len(upsfd, (unsigned char *)buf, cnt, 2, 0); buf[cnt] = 0; upsdebugx(3, "Received: %s", buf); if (ret != cnt) { - ser_comm_fail("Second read returned %zd bytes, expected %ld", ret, cnt); + ser_comm_fail("Second read returned %d bytes, expected %ld", ret, cnt); return -1; } @@ -213,7 +210,7 @@ static ssize_t do_broken_rat(char *buf) void upsdrv_updateinfo(void) { static int retry = 0; - ssize_t res; + int res; char temp[SMALLBUF], st[SMALLBUF]; send_belkin_command(STATUS, STAT_STATUS, ""); @@ -265,14 +262,14 @@ void upsdrv_updateinfo(void) get_belkin_field(temp, st, sizeof(st), 10); res = atoi(st); get_belkin_field(temp, st, sizeof(st), 2); - + if (*st == '1' || res < LOW_BAT) { status_set("LB"); /* low battery */ } get_belkin_field(temp, st, sizeof(st), 10); dstate_setinfo("battery.charge", "%.0f", strtod(st, NULL)); - + get_belkin_field(temp, st, sizeof(st), 9); dstate_setinfo("battery.temperature", "%.0f", strtod(st, NULL)); @@ -305,7 +302,7 @@ void upsdrv_updateinfo(void) get_belkin_field(temp, st, sizeof(st), 7); dstate_setinfo("ups.load", "%.0f", strtod(st, NULL)); } - + send_belkin_command(STATUS, TEST_RESULT, ""); res = get_belkin_reply(temp); if (res > 0) { @@ -351,7 +348,7 @@ void upsdrv_updateinfo(void) /* power down the attached load immediately */ void upsdrv_shutdown(void) { - ssize_t res; + int res; res = init_communication(); if (res < 0) { @@ -374,7 +371,7 @@ void upsdrv_shutdown(void) /* handle "beeper.disable" */ static void do_beeper_off(void) { - ssize_t res; + int res; char temp[SMALLBUF]; const char *arg; @@ -456,7 +453,7 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -485,12 +482,12 @@ void upsdrv_initups(void) void upsdrv_initinfo(void) { - ssize_t res; + int res; char temp[SMALLBUF], st[SMALLBUF]; res = init_communication(); if (res < 0) { - fatalx(EXIT_FAILURE, + fatalx(EXIT_FAILURE, "Unable to detect an Belkin Smart protocol UPS on port %s\n" "Check the cabling, port name or model name and try again", device_path ); diff --git a/drivers/belkinunv.c b/drivers/belkinunv.c index c508563..c5abda2 100644 --- a/drivers/belkinunv.c +++ b/drivers/belkinunv.c @@ -47,7 +47,7 @@ input.voltage.nominal output.frequency output.voltage - ups.beeper.status (RW) enabled/disabled/muted + ups.beeper.status (RW) enabled/disabled/muted ups.firmware ups.load ups.model @@ -55,12 +55,12 @@ ups.status ups.temperature ups.test.result - ups.delay.restart read-only: time to restart - ups.delay.shutdown read-only: time to shutdown + ups.delay.restart read-only: time to restart + ups.delay.shutdown read-only: time to shutdown ups.type ONLINE/OFFLINE/LINEINT - + COMMANDS: - + beeper.disable beeper.enable beeper.mute @@ -94,7 +94,7 @@ #include "serial.h" #define DRIVER_NAME "Belkin 'Universal UPS' driver" -#define DRIVER_VERSION "0.08" +#define DRIVER_VERSION "0.07" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -111,48 +111,48 @@ upsdrv_info_t upsdrv_info = { #define MAXMSGSIZE 25 /* definitions of register numbers for Belkin UPS */ -#define REG_VOLTRATING 0x01 -#define REG_FREQRATING 0x02 -#define REG_POWERRATING 0x03 +#define REG_VOLTRATING 0x01 +#define REG_FREQRATING 0x02 +#define REG_POWERRATING 0x03 #define REG_BATVOLTRATING 0x04 -#define REG_XFER_LO 0x06 -#define REG_XFER_LO_MAX 0x07 -#define REG_XFER_LO_MIN 0x08 -#define REG_XFER_HI 0x09 -#define REG_XFER_HI_MAX 0x0a -#define REG_XFER_HI_MIN 0x0b -#define REG_VOLTSENS 0x0c -#define REG_UPSMODEL 0x0d -#define REG_UPSMODEL2 0x0e -#define REG_FIRMWARE 0x0f -#define REG_TESTSTATUS 0x10 -#define REG_ALARMSTATUS 0x11 +#define REG_XFER_LO 0x06 +#define REG_XFER_LO_MAX 0x07 +#define REG_XFER_LO_MIN 0x08 +#define REG_XFER_HI 0x09 +#define REG_XFER_HI_MAX 0x0a +#define REG_XFER_HI_MIN 0x0b +#define REG_VOLTSENS 0x0c +#define REG_UPSMODEL 0x0d +#define REG_UPSMODEL2 0x0e +#define REG_FIRMWARE 0x0f +#define REG_TESTSTATUS 0x10 +#define REG_ALARMSTATUS 0x11 #define REG_SHUTDOWNTIMER 0x15 #define REG_RESTARTTIMER 0x16 -#define REG_INPUTVOLT 0x18 -#define REG_INPUTFREQ 0x19 -#define REG_TEMPERATURE 0x1a -#define REG_OUTPUTVOLT 0x1b -#define REG_OUTPUTFREQ 0x1c -#define REG_LOAD 0x1e -#define REG_BATSTAT2 0x1f -#define REG_BATVOLT 0x20 -#define REG_BATLEVEL 0x21 -#define REG_UPSSTATUS 0x22 -#define REG_BATSTATUS 0x23 -#define REG_TIMELEFT 0x3f +#define REG_INPUTVOLT 0x18 +#define REG_INPUTFREQ 0x19 +#define REG_TEMPERATURE 0x1a +#define REG_OUTPUTVOLT 0x1b +#define REG_OUTPUTFREQ 0x1c +#define REG_LOAD 0x1e +#define REG_BATSTAT2 0x1f +#define REG_BATVOLT 0x20 +#define REG_BATLEVEL 0x21 +#define REG_UPSSTATUS 0x22 +#define REG_BATSTATUS 0x23 +#define REG_TIMELEFT 0x3f /* flags for REG_UPSSTATUS */ #define US_ACFAILURE 0x0001 #define US_OVERLOAD 0x0010 -#define US_OFF 0x0020 +#define US_OFF 0x0020 #define US_OVERHEAT 0x0040 #define US_UPSFAULT 0x0080 #define US_WAITING 0x2000 #define US_BUZZER 0x8000 /* flags for REG_BATSTATUS */ -#define BS_LOW 0x04 +#define BS_LOW 0x04 #define BS_CHARGING 0x10 #define BS_ONBATTERY 0x20 #define BS_DEPLETED 0x40 @@ -161,24 +161,24 @@ upsdrv_info_t upsdrv_info = { /* size of an array */ #define asize(x) ((int)(sizeof(x)/sizeof(x[0]))) -static const char *upstype[3] = { - "ONLINE", - "OFFLINE", +const char *upstype[3] = { + "ONLINE", + "OFFLINE", "LINEINT" }; -static const char *voltsens[3] = { - "normal", - "medium", +const char *voltsens[3] = { + "normal", + "medium", "low" }; -static const char *teststatus[6] = { - "no test performed", - "test passed", - "test failed", - "test failed", - "test aborted", +const char *teststatus[6] = { + "no test performed", + "test passed", + "test failed", + "test failed", + "test aborted", "test in progress" }; @@ -247,7 +247,7 @@ static void belkin_nut_open_tty(void) byte, checksum). Return length of message, or -1 if not well-formed */ static int belkin_nut_receive(unsigned char *buf, int bufsize) { - ssize_t r; + int r; int n=0; int len; @@ -285,8 +285,7 @@ static int belkin_nut_receive(unsigned char *buf, int bufsize) { if (n+len > bufsize) { return -1; } - /* Casting is okay, len is range-limited to unsigned char */ - r = ser_get_buf_len(upsfd, &buf[4], (size_t)len, 3, 0); + r = ser_get_buf_len(upsfd, &buf[4], len, 3, 0); if (r!=len) { upslogx(LOG_ERR, "Short read from UPS"); return -1; @@ -303,10 +302,9 @@ static int belkin_nut_receive(unsigned char *buf, int bufsize) { /* read the value of a string register from UPS. Return NULL on failure, else an allocated string. */ -static char *belkin_nut_read_str(unsigned char reg) { +static char *belkin_nut_read_str(int reg) { unsigned char buf[MAXMSGSIZE]; - ssize_t r; - size_t len; + int len, r; char *str; /* send the request */ @@ -337,10 +335,6 @@ static char *belkin_nut_read_str(unsigned char reg) { } /* convert the answer to a string */ - if (buf[2] < 1) { - upslogx(LOG_ERR, "Invalid response from UPS: string too short to be true"); - return NULL; - } len = buf[2]-1; str = (char *)xmalloc(len+1); memcpy(str, &buf[4], len); @@ -350,10 +344,9 @@ static char *belkin_nut_read_str(unsigned char reg) { /* read the value of an integer register from UPS. Return -1 on failure. */ -static int belkin_nut_read_int(unsigned char reg) { +static int belkin_nut_read_int(int reg) { unsigned char buf[MAXMSGSIZE]; - int len; - ssize_t r; + int len, r; /* send the request */ buf[0] = 0x7e; @@ -396,9 +389,9 @@ static int belkin_nut_read_int(unsigned char reg) { /* write the value of an integer register to UPS. Return -1 on failure, else 0 */ -static int belkin_nut_write_int(unsigned char reg, int val) { +static int belkin_nut_write_int(int reg, int val) { unsigned char buf[MAXMSGSIZE]; - ssize_t r; + int r; /* send the request */ buf[0] = 0x7e; @@ -408,7 +401,7 @@ static int belkin_nut_write_int(unsigned char reg, int val) { buf[4] = val & 0xff; buf[5] = (val>>8) & 0xff; buf[6] = belkin_checksum(buf, 6); - + r = ser_send_buf(upsfd, buf, 7); if (r<0) { upslogx(LOG_ERR, "Failed write to UPS"); @@ -452,14 +445,14 @@ static int belkin_std_open_tty(const char *device) { struct termios tios; struct flock flock; char buf[128]; - ssize_t r; - + int r; + /* open the device */ fd = open(device, O_RDWR | O_NONBLOCK); if (fd == -1) { return -1; } - + /* set communications parameters: 2400 baud, 8 bits, 1 stop bit, no parity, enable reading, hang up when done, ignore modem control lines. */ @@ -472,7 +465,7 @@ static int belkin_std_open_tty(const char *device) { close(fd); return -1; } - + /* signal the UPS to enter "smart" mode. This is done by setting RTS and dropping DTR for at least 0.25 seconds. RTS and DTR refer to two specific pins in the 9-pin serial connector. Note: this must @@ -489,7 +482,7 @@ static int belkin_std_open_tty(const char *device) { close(fd); return -1; } - + /* lock the port */ memset(&flock, 0, sizeof(flock)); flock.l_type = F_RDLCK; @@ -498,11 +491,11 @@ static int belkin_std_open_tty(const char *device) { close(fd); return -1; } - + /* sleep at least 0.25 seconds for the UPS to wake up. Belkin's own software sleeps 1 second, so that's what we do, too. */ usleep(1000000); - + /* flush incoming data again, and read any remaining garbage bytes. There should not be any. */ r = tcflush(fd, TCIFLUSH); @@ -510,27 +503,27 @@ static int belkin_std_open_tty(const char *device) { close(fd); return -1; } - + r = read(fd, buf, 127); if (r == -1 && errno != EAGAIN) { close(fd); return -1; } - + /* leave port in non-blocking state */ - + return fd; } /* blocking read with 1-second timeout (use non-blocking i/o) */ static int belkin_std_upsread(int fd, unsigned char *buf, int n) { int count = 0; - ssize_t r; + int r; int tries = 0; - + while (count < n) { - r = read(fd, &buf[count], (size_t)(n-count)); - if (r==-1 && errno==EAGAIN) { + r = read(fd, &buf[count], n-count); + if (r==-1 && errno==EAGAIN) { /* non-blocking i/o, no data available */ usleep(100000); tries++; @@ -549,12 +542,12 @@ static int belkin_std_upsread(int fd, unsigned char *buf, int n) { /* blocking write with 1-second timeout (use non-blocking i/o) */ static int belkin_std_upswrite(int fd, unsigned char *buf, int n) { int count = 0; - ssize_t r; + int r; int tries = 0; while (count < n) { - r = write(fd, &buf[count], (size_t)(n-count)); - if (r==-1 && errno==EAGAIN) { + r = write(fd, &buf[count], n-count); + if (r==-1 && errno==EAGAIN) { /* non-blocking i/o, no data available */ usleep(100000); tries++; @@ -619,7 +612,7 @@ static int belkin_std_receive(int fd, unsigned char *buf, int bufsize) { /* read the value of an integer register from UPS. Return -1 on failure. */ -static int belkin_std_read_int(int fd, unsigned char reg) { +static int belkin_std_read_int(int fd, int reg) { unsigned char buf[MAXMSGSIZE]; int len, r; @@ -661,10 +654,10 @@ static int belkin_std_read_int(int fd, unsigned char reg) { /* write the value of an integer register to UPS. Return -1 on failure, else 0 */ -static int belkin_std_write_int(int fd, unsigned char reg, int val) { +static int belkin_std_write_int(int fd, int reg, int val) { unsigned char buf[MAXMSGSIZE]; int r; - + /* send the request */ buf[0] = 0x7e; buf[1] = 0x04; @@ -673,12 +666,12 @@ static int belkin_std_write_int(int fd, unsigned char reg, int val) { buf[4] = val & 0xff; buf[5] = (val>>8) & 0xff; buf[6] = belkin_checksum(buf, 6); - + r = belkin_std_upswrite(fd, buf, 7); if (r<0) { return -1; } - + /* receive the acknowledgement */ r = belkin_std_receive(fd, buf, MAXMSGSIZE); if (r<0) { @@ -717,19 +710,7 @@ static void updatestatus(int smode, const char *fmt, ...) { /* read formatted argument string */ va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(buf, sizeof(buf), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif buf[sizeof(buf)-1] = 0; va_end(ap); @@ -783,13 +764,13 @@ static int belkin_wait(void) if (dstate_getinfo("driver.flag.flash")) { flash = 1; } - + if (dstate_getinfo("driver.flag.silent")) { smode = 0; } else if (dstate_getinfo("driver.flag.dumbterm")) { smode = 2; } - + updatestatus(smode, "Connecting to UPS..."); failcount = 0; fd = -1; @@ -843,7 +824,7 @@ static int belkin_wait(void) } /* successfully got data from UPS */ failcount = 0; - + if (bs & BS_ONBATTERY) { st = ST_BATTERY; } else if (ov>0) { @@ -926,29 +907,29 @@ void upsdrv_initinfo(void) /* read writable values and declare them writable */ val = belkin_nut_read_int(REG_VOLTSENS); - if (val!=-1) { - dstate_setinfo("input.sensitivity", "%s", (val>=0 && val=0 && val 0) { @@ -1058,13 +1039,13 @@ void upsdrv_updateinfo(void) /* new read everything else */ val = belkin_nut_read_int(REG_XFER_LO); - if (val!=-1) { - dstate_setinfo("input.transfer.low", "%d", val); + if (val!=-1) { + dstate_setinfo("input.transfer.low", "%d", val); } val = belkin_nut_read_int(REG_XFER_HI); - if (val!=-1) { - dstate_setinfo("input.transfer.high", "%d", val); + if (val!=-1) { + dstate_setinfo("input.transfer.high", "%d", val); } val = belkin_nut_read_int(REG_VOLTSENS); @@ -1079,7 +1060,7 @@ void upsdrv_updateinfo(void) val = belkin_nut_read_int(REG_ALARMSTATUS); if (val!=-1) { - dstate_setinfo("ups.beeper.status", "%s", (val==1) ? "disabled" : (val&1) ? "muted" : "enabled"); + dstate_setinfo("ups.beeper.status", "%s", val==1 ? "disabled" : val&1 ? "muted" : "enabled"); } val = belkin_nut_read_int(REG_SHUTDOWNTIMER); @@ -1151,7 +1132,7 @@ void upsdrv_shutdown(void) /* Note: this UPS cannot (apparently) be put into "soft shutdown" mode; thus the -k option should not normally be used; instead, a workaround using the "-x wait" option - should be used; see belkinunv(8) for details. + should be used; see belkinunv(8) for details. In case somebody uses the -k option, the best we can do here is a timed shutdown; this will wake up the attached @@ -1164,7 +1145,7 @@ void upsdrv_shutdown(void) option instead, as suggested on the belkinunv(8) man page. */ - upslogx(LOG_WARNING, "You are using the -k option, which is broken for this driver.\nShutting down for 10 minutes and hoping for the best"); + upslogx(LOG_WARNING, "You are using the -k option, which is broken for this driver.\nShutting down for 10 minutes and hoping for the best"); belkin_nut_write_int(REG_RESTARTTIMER, 10); /* 10 minutes */ belkin_nut_write_int(REG_SHUTDOWNTIMER, 1); /* 1 second */ @@ -1174,8 +1155,8 @@ int instcmd(const char *cmdname, const char *extra) { int r; - /* We use test.failure.start to initiate a "deep battery test". - This does not really simulate a 'power failure', because we + /* We use test.failure.start to initiate a "deep battery test". + This does not really simulate a 'power failure', because we won't start shutdown procedures during a test. We use test.battery.start to initiate a "10-second battery test". */ @@ -1196,43 +1177,35 @@ int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "test.failure.start")) { r = belkin_nut_write_int(REG_TESTSTATUS, 2); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "test.failure.stop")) { r = belkin_nut_write_int(REG_TESTSTATUS, 3); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "test.battery.start")) { r = belkin_nut_write_int(REG_TESTSTATUS, 1); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "test.battery.stop")) { r = belkin_nut_write_int(REG_TESTSTATUS, 3); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "beeper.disable")) { r = belkin_nut_write_int(REG_ALARMSTATUS, 1); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "beeper.enable")) { r = belkin_nut_write_int(REG_ALARMSTATUS, 2); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "beeper.mute")) { r = belkin_nut_write_int(REG_ALARMSTATUS, 3); - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "shutdown.stayoff")) { r = belkin_nut_write_int(REG_RESTARTTIMER, 0); r |= belkin_nut_write_int(REG_SHUTDOWNTIMER, 1); /* 1 second */ - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "shutdown.reboot")) { @@ -1244,13 +1217,11 @@ int instcmd(const char *cmdname, const char *extra) the UPS will stay off between 60 and 120 seconds */ r = belkin_nut_write_int(REG_RESTARTTIMER, 2); /* 2 minutes */ r |= belkin_nut_write_int(REG_SHUTDOWNTIMER, 1); /* 1 second */ - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "shutdown.reboot.graceful")) { r = belkin_nut_write_int(REG_RESTARTTIMER, 2); /* 2 minutes */ r |= belkin_nut_write_int(REG_SHUTDOWNTIMER, 40); /* 40 seconds */ - if (r == -1) upslogx(LOG_WARNING, "Command '%s' failed", cmdname); return STAT_INSTCMD_HANDLED; /* Future: failure if r==-1 */ } if (!strcasecmp(cmdname, "reset.input.minmax")) { @@ -1260,7 +1231,7 @@ int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } diff --git a/drivers/bestfcom.c b/drivers/bestfcom.c index c53aa95..54ea93e 100644 --- a/drivers/bestfcom.c +++ b/drivers/bestfcom.c @@ -1,4 +1,4 @@ -/* +/* bestfcom.c - model specific routines for Best Power F-Command ups models This module is yet another rewritten mangle of the bestuferrups @@ -45,7 +45,7 @@ #include "serial.h" #define DRIVER_NAME "Best Ferrups/Fortress driver" -#define DRIVER_VERSION "0.13" +#define DRIVER_VERSION "0.12" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -83,7 +83,7 @@ upsdrv_info_t upsdrv_info = { #include /* Blob of UPS configuration data from the formatconfig string */ -static struct { +struct { int valid; /* set to 1 when this is filled in */ float idealbvolts; /* various interesting battery voltages */ @@ -114,24 +114,24 @@ void upsdrv_initinfo (void) */ dstate_setinfo("ups.mfr", "%s", "Best Power"); switch(fc.model) { - case MExxxx: - dstate_setinfo("ups.model", "%s ME%d", fc.name, fc.va); - break; - case MDxxxx: - dstate_setinfo("ups.model", "%s MD%d", fc.name, fc.va); - break; - case FDxxxx: - dstate_setinfo("ups.model", "%s FD%d", fc.name, fc.va); - break; - case FExxxx: - dstate_setinfo("ups.model", "%s FE%d", fc.name, fc.va); - break; - case LIxxxx: - dstate_setinfo("ups.model", "%s LI%d", fc.name, fc.va); - break; - default: - fatalx(EXIT_FAILURE, "Unknown model - oops!"); /* Will never get here, upsdrv_initups() will catch */ - } + case MExxxx: + dstate_setinfo("ups.model", "%s ME%d", fc.name, fc.va); + break; + case MDxxxx: + dstate_setinfo("ups.model", "%s MD%d", fc.name, fc.va); + break; + case FDxxxx: + dstate_setinfo("ups.model", "%s FD%d", fc.name, fc.va); + break; + case FExxxx: + dstate_setinfo("ups.model", "%s FE%d", fc.name, fc.va); + break; + case LIxxxx: + dstate_setinfo("ups.model", "%s LI%d", fc.name, fc.va); + break; + default: + fatalx(EXIT_FAILURE, "Unknown model - oops!"); /* Will never get here, upsdrv_initups() will catch */ + } dstate_setinfo("ups.power.nominal", "%d", fc.va); dstate_setinfo("ups.realpower.nominal", "%d", fc.watts); @@ -162,7 +162,7 @@ void upsdrv_initinfo (void) /* atoi() without the freebie octal conversion */ -static int bcd2i (const char *bcdstring, const int bcdlen) +int bcd2i (const char *bcdstring, const int bcdlen) { int i, digit, total = 0, factor = 1; for (i = 1; i < bcdlen; i++) @@ -181,8 +181,7 @@ static int bcd2i (const char *bcdstring, const int bcdlen) #define POLL_ALERT "{" static void alert_handler(char ch) { - char buf[SMALLBUF]; - NUT_UNUSED_VARIABLE(ch); + char buf[256]; /* Received an Inverter status alarm : * "\r\n{Inverter: On}\r\n=>" @@ -196,10 +195,10 @@ static void alert_handler(char ch) time^M^M^JFeb 20, 22:13:32^M^J^M^J=>id^M^JUnit ID "ME3.1K12345"^M^J^M^J=> ---------------------------------------------------- */ -static ssize_t execute(const char *cmd, char *result, size_t resultsize) +static int execute(const char *cmd, char *result, int resultsize) { - ssize_t ret; - char buf[SMALLBUF]; + int ret; + char buf[256]; unsigned char ch; /* Check for the Inverter status alarm if pending : @@ -251,32 +250,11 @@ void upsdrv_updateinfo(void) if (! fc.valid) { upsdebugx(1, "upsupdate run before ups_ident() read ups config"); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* NOTE: This assert() always fails because of "0": - * error: will never be executed [-Werror,-Wunreachable-code] - * ((0) ? (void) (0) : __assert_fail ("0", "bestfcom.c", 254, __PRETTY_FUNCTION__)); - * ^ - */ assert(0); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif } if (execute("f\r", fstring, sizeof(fstring)) >= 80) { - int inverter=0, charger=0, vin=0, vout=0, btimeleft=0, linestat=0, + int inverter=0, charger=0, vin=0, vout=0, btimeleft=0, linestat=0, alstat=0, vaout=0; double ampsout=0.0, vbatt=0.0, battpercent=0.0, loadpercent=0.0, @@ -291,7 +269,7 @@ void upsdrv_updateinfo(void) /* Charger status. 0=off 1=on */ charger = bcd2i(&fstring[18], 2); - + /* Input Voltage. integer number */ vin = bcd2i(&fstring[24], 4); @@ -299,7 +277,7 @@ void upsdrv_updateinfo(void) vout = bcd2i(&fstring[28], 4); /* Battery voltage. int times 10 */ - vbatt = ((double)(bcd2i(&fstring[50], 4)) / 10.0); + vbatt = ((double)bcd2i(&fstring[50], 4) / 10.0); /* Alarm status reg 1. Bitmask */ alstat = bcd2i(&fstring[20], 2); @@ -308,14 +286,14 @@ void upsdrv_updateinfo(void) alstat = alstat | (bcd2i(&fstring[22], 2) << 8); /* AC line frequency */ - acfreq = ((double)(bcd2i(&fstring[54], 4)) / 100.0); + acfreq = ((double)bcd2i(&fstring[54], 4) / 100.0); /* Runtime remaining (UPS reports minutes) */ btimeleft = bcd2i(&fstring[58], 4) * 60; if (fc.model != FDxxxx) { /* Iout. int times 10 */ - ampsout = ((double)(bcd2i(&fstring[36], 4)) / 10.0); + ampsout = ((double)bcd2i(&fstring[36], 4) / 10.0); /* Volt-amps out. int */ vaout = bcd2i(&fstring[40], 6); @@ -326,40 +304,40 @@ void upsdrv_updateinfo(void) } if (fc.model != LIxxxx) { - upstemp = (double)(bcd2i(&fstring[62], 4)); + upstemp = (double) bcd2i(&fstring[62], 4); } /* Percent Load */ switch(fc.model) { - case LIxxxx: - case FDxxxx: - case FExxxx: - case MExxxx: - if (execute("d 16\r", tmp, sizeof(tmp)) > 0) { - int l; - sscanf(tmp, "16 FullLoad%% %d", &l); - loadpercent = (double) l; - } - break; - case MDxxxx: - if (execute("d 22\r", tmp, sizeof(tmp)) > 0) { - int l; - sscanf(tmp, "22 FullLoad%% %d", &l); - loadpercent = (double) l; - } - break; - default: /* Will never happen, caught in upsdrv_initups() */ - fatalx(EXIT_FAILURE, "Unknown model in upsdrv_updateinfo()"); + case LIxxxx: + case FDxxxx: + case FExxxx: + case MExxxx: + if (execute("d 16\r", tmp, sizeof(tmp)) > 0) { + int l; + sscanf(tmp, "16 FullLoad%% %d", &l); + loadpercent = (double) l; + } + break; + case MDxxxx: + if (execute("d 22\r", tmp, sizeof(tmp)) > 0) { + int l; + sscanf(tmp, "22 FullLoad%% %d", &l); + loadpercent = (double) l; + } + break; + default: /* Will never happen, caught in upsdrv_initups() */ + fatalx(EXIT_FAILURE, "Unknown model in upsdrv_updateinfo()"); } /* Compute battery percent left based on battery voltages. */ - battpercent = ((vbatt - fc.emptyvolts) + battpercent = ((vbatt - fc.emptyvolts) / (fc.idealbvolts - fc.emptyvolts) * 100.0); - if (battpercent < 0.0) + if (battpercent < 0.0) battpercent = 0.0; else if (battpercent > 100.0) battpercent = 100.0; - + /* Compute status string */ { int lowbatt, lowvolts, overload, replacebatt, boosting, trimming; @@ -375,7 +353,7 @@ void upsdrv_updateinfo(void) lowvolts = (vbatt <= fc.lowvolts); status_init(); - + if (inverter) { if (inverter_status < 1) { upsdebugx(1, "Inverter On, charger: %d battery time left: %d", @@ -466,7 +444,7 @@ void upsdrv_shutdown(void) { /* NB: hard-wired password */ ser_send(upsfd, "pw377\r"); - ser_send(upsfd, "o 10 a\r"); /* power off in 10 seconds and restart when line power returns, FE7K required a min of 5 seconds for off to function */ + ser_send(upsfd, "off 1 a\r"); /* power off in 1 second and restart when line power returns */ } /* list flags and values that you want to receive via -x */ @@ -499,10 +477,10 @@ static void sync_serial(void) { static void setup_serial(void) { struct termios tio; - + if (tcgetattr(upsfd, &tio) == -1) fatal_with_errno(EXIT_FAILURE, "tcgetattr"); - + tio.c_iflag = IXON | IXOFF; tio.c_oflag = 0; tio.c_cflag = (CS8 | CREAD | HUPCL | CLOCAL); @@ -547,11 +525,11 @@ Version: 8.07 Released: 08/01/1995 */ -static void upsdrv_init_nofc(void) +void upsdrv_init_nofc(void) { char tmp[256], rstring[1024]; - /* This is a Best UPS + /* This is a Best UPS * Set initial values for old Fortress??? */ @@ -599,8 +577,7 @@ static void upsdrv_init_nofc(void) } } else if (strstr(rstring, "Model: FE") - || strstr(rstring, "Model: FE")) - { + || strstr(rstring, "Model: FE")){ fc.model = FExxxx; fc.type = FERRUPS; snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups"); @@ -609,55 +586,56 @@ static void upsdrv_init_nofc(void) /* How does the old Fortress respond to this? */ upsdebugx(2, "Old Best Fortress???"); /* fc.model = FORTRESS; */ - } + } if (fc.model == UNKNOWN) { fatalx(EXIT_FAILURE, "Unknown model %s in upsdrv_init_nofc()", rstring); } switch(fc.model) { - case MExxxx: - case MDxxxx: - case FDxxxx: - /* determine shutdown battery voltage */ - if (execute("d 27\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "27 LowBatt %f", &fc.emptyvolts); - } - /* determine near low battery voltage */ - if (execute("d 30\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "30 NLBatt %f", &fc.lowvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 28\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "28 Hi Batt %f", &fc.fullvolts); - } - fc.fullvolts = 13.70; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - case FExxxx: - if (execute("d 45\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "45 RatedVA %d", &fc.va); /* 4300 */ - } - if (execute("d 46\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "46 RatedW %d", &fc.watts); /* 3000 */ - } - if (execute("d 65\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "65 LoBatV %f", &fc.emptyvolts); /* 41.00 */ - } - if (execute("d 66\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "66 NLBatV %f", &fc.lowvolts); /* 44.00 */ - } - if (execute("d 67\r", tmp, sizeof(tmp)) > 0) { - sscanf(tmp, "67 HiBatV %f", &fc.fullvolts); /* 59.60 */ - } - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - if (fc.va < 1.0) { - fatalx(EXIT_FAILURE, "Error determining Ferrups UPS rating."); - } - break; - default: - fatalx(EXIT_FAILURE, "Unknown model %s in upsdrv_init_nofc()", rstring); + case MExxxx: + case MDxxxx: + case FDxxxx: + /* determine shutdown battery voltage */ + if (execute("d 27\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "27 LowBatt %f", &fc.emptyvolts); + } + /* determine near low battery voltage */ + if (execute("d 30\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "30 NLBatt %f", &fc.lowvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 28\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "28 Hi Batt %f", &fc.fullvolts); + } + fc.fullvolts = 13.70; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + case FExxxx: + if (execute("d 45\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "45 RatedVA %d", &fc.va); /* 4300 */ + } + if (execute("d 46\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "46 RatedW %d", &fc.watts); /* 3000 */ + } + if (execute("d 65\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "65 LoBatV %f", &fc.emptyvolts); /* 41.00 */ + } + if (execute("d 66\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "66 NLBatV %f", &fc.lowvolts); /* 44.00 */ + } + if (execute("d 67\r", tmp, sizeof(tmp)) > 0) { + sscanf(tmp, "67 HiBatV %f", &fc.fullvolts); /* 59.60 */ + } + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + if (fc.va < 1.0) { + fatalx(EXIT_FAILURE, "Error determining Ferrups UPS rating."); + } + break; + default: + fatalx(EXIT_FAILURE, "Unknown model %s in upsdrv_init_nofc()", rstring); + break; } fc.valid = 1; } @@ -679,7 +657,7 @@ Model: [0,1] => 00 = unk, 01 = Patriot/SPS, 02 = FortressII, 03 = Ferrups, 04 = [2,3] => 00 = LI520, 01 = LI720, 02 = LI1020, 03 = LI1420, 07 = ??? */ -static void upsdrv_init_fc(const char *fcstring) +void upsdrv_init_fc(const char *fcstring) { char tmp[256]; @@ -731,24 +709,24 @@ static void upsdrv_init_fc(const char *fcstring) } switch(fc.model) { - case LIxxxx: - fc.va = bcd2i(&fcstring[11], 5); - fc.watts = bcd2i(&fcstring[16], 5); + case LIxxxx: + fc.va = bcd2i(&fcstring[11], 5); + fc.watts = bcd2i(&fcstring[16], 5); - /* determine shutdown battery voltage */ - fc.emptyvolts= ((double)(bcd2i(&fcstring[57], 4)) / 10.0); + /* determine shutdown battery voltage */ + fc.emptyvolts= ((double)bcd2i(&fcstring[57], 4) / 10.0); - /* determine fully charged battery voltage */ - fc.lowvolts= ((double)(bcd2i(&fcstring[53], 4)) / 10.0); + /* determine fully charged battery voltage */ + fc.lowvolts= ((double)bcd2i(&fcstring[53], 4) / 10.0); - /* determine fully charged battery voltage */ - fc.fullvolts= ((double)(bcd2i(&fcstring[49], 4)) / 10.0); + /* determine fully charged battery voltage */ + fc.fullvolts= ((double)bcd2i(&fcstring[49], 4) / 10.0); - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - default: - fatalx(EXIT_FAILURE, "Unknown model %s in upsdrv_init_fc()", tmp); + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + default: + fatalx(EXIT_FAILURE, "Unknown model %s in upsdrv_init_fc()", tmp); } fc.valid = 1; } diff --git a/drivers/bestfortress.c b/drivers/bestfortress.c index 97300f6..b12dd15 100644 --- a/drivers/bestfortress.c +++ b/drivers/bestfortress.c @@ -22,7 +22,6 @@ #include "main.h" #include "serial.h" -#include "nut_stdint.h" #define UPSDELAY 50000 /* 50 ms delay required for reliable operation */ #define SER_WAIT_SEC 2 /* allow 2.0 sec for ser_get calls */ @@ -35,7 +34,7 @@ #endif #define DRIVER_NAME "Best Fortress UPS driver" -#define DRIVER_VERSION "0.06" +#define DRIVER_VERSION "0.05" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -67,16 +66,16 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.delay.shutdown", "10"); /* write only */ /* tunable via front panel: (european voltage level) - parameter factory default range - INFO_LOWXFER 196 V p7=nnn 160-210 - INFO_HIGHXFER 254 V p8=nnn 215-274 - INFO_LOBATTIME 2 min p2=n 1-5 + parameter factory default range + INFO_LOWXFER 196 V p7=nnn 160-210 + INFO_HIGHXFER 254 V p8=nnn 215-274 + INFO_LOBATTIME 2 min p2=n 1-5 comm mode p6=0 dumb DONT USE (will lose access to parameter setting!) - p6=1 B1200 - p6=2 B2400 - P6=3 B4800 - p6=4 B9600 + p6=1 B1200 + p6=2 B2400 + P6=3 B4800 + p6=4 B9600 maybe cycle through speeds to autodetect? echo off e0 @@ -117,7 +116,7 @@ static int checksum (char * s) int sum; for (i = 40, sum = 0; s[0] && s[1] && i > 0; i--, s += 2) { sum += (fromhex (s[0]) << 4) + fromhex (s[1]); - } + } return sum; } @@ -127,8 +126,7 @@ static inline int setinfo_int (const char *key, const char * s, size_t len) char buf[10]; int val; - if (len > sizeof(buf)) - len = sizeof(buf)-1; + if (len > sizeof(buf)) len = sizeof(buf)-1; strncpy (buf, s, len); buf[len] = 0; val = atoi(buf); @@ -143,8 +141,7 @@ static inline void setinfo_int_minutes (const char *key, const char * s, size_t { char buf[10]; - if (len > sizeof(buf)) - len = sizeof(buf)-1; + if (len > sizeof(buf)) len = sizeof(buf)-1; strncpy (buf, s, len); buf[len] = 0; dstate_setinfo (key, "%d", 60*atoi (buf)); @@ -154,85 +151,47 @@ static inline void setinfo_int_minutes (const char *key, const char * s, size_t static inline void setinfo_float (const char *key, const char * fmt, const char * s, size_t len, double factor) { char buf[10]; - if (len > sizeof(buf)) - len = sizeof(buf)-1; + if (len > sizeof(buf)) len = sizeof(buf)-1; strncpy (buf, s, len); buf[len] = 0; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - dstate_setinfo (key, fmt, factor * (double)(atoi (buf))); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + dstate_setinfo (key, fmt, factor * (double)atoi (buf)); } static int upssend(const char *fmt,...) { - int ret; + int ret; char buf[1024], *p; - va_list ap; + va_list ap; unsigned int sent = 0; - useconds_t d_usec = UPSDELAY; + int d_usec = UPSDELAY; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(buf, sizeof(buf), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); if ((ret < 1) || (ret >= (int) sizeof(buf))) upslogx(LOG_WARNING, "ser_send_pace: vsnprintf needed more " "than %d bytes", (int)sizeof(buf)); - - for (p = buf; *p && sent < INT_MAX - 1; p++) { + for (p = buf; *p; p++) { if (write(upsfd, p, 1) != 1) return -1; - /* Note: LGTM.com analysis warns that here - * "Comparison is always true because d_usec >= 2" - * since we initialize with UPSDELAY above. - * Do not remove this check just in case that - * initialization changes, or run-time value - * becomes modified, in later iterations. - */ - if (d_usec > 0) + if (d_usec) usleep(d_usec); sent++; - if (sent >= INT_MAX) { - upslogx(LOG_WARNING, "ser_send_pace: sent more than INT_MAX, aborting"); - } } - return (int)sent; + return sent; } -static ssize_t upsrecv(char *buf,size_t bufsize,char ec,const char *ic) +static int upsrecv(char *buf,size_t bufsize,char ec,const char *ic) { return ser_get_line(upsfd, buf, bufsize - 1, ec, ic, - SER_WAIT_SEC, SER_WAIT_USEC); + SER_WAIT_SEC, SER_WAIT_USEC); } -static ssize_t upsflushin(int f, int verbose, const char *ignset) +static int upsflushin(int f,int verbose,const char *ignset) { - NUT_UNUSED_VARIABLE(f); return ser_flush_in(upsfd, ignset, verbose); } @@ -240,13 +199,12 @@ static ssize_t upsflushin(int f, int verbose, const char *ignset) void upsdrv_updateinfo(void) { char temp[256]; - char *p = NULL; + char *p; int loadva; - size_t len = 0; - ssize_t recv; + int len, recv; int retry; char ch; - int checksum_ok = -1, is_online = 1, is_off, low_batt, trimming, boosting; + int checksum_ok, is_online=1, is_off, low_batt, trimming, boosting; upsdebugx(1, "upsdrv_updateinfo"); @@ -263,8 +221,8 @@ void upsdrv_updateinfo(void) } } while (temp[2] == 0); - upsdebugx(1, "upsdrv_updateinfo: received %zi bytes (try %i)", recv, retry); - upsdebug_hex(5, "buffer", temp, (size_t)recv); + upsdebugx(1, "upsdrv_updateinfo: received %i bytes (try %i)", recv, retry); + upsdebug_hex(5, "buffer", temp, recv); /* syslog (LOG_DAEMON | LOG_NOTICE,"ups: got %d chars '%s'\n", recv, temp + 2); */ /* status example: @@ -279,7 +237,7 @@ void upsdrv_updateinfo(void) /* last bytes are a checksum: interpret response as hex string, sum of all bytes must be zero */ - checksum_ok = ( (checksum (temp+2) & 0xff) == 0 ); + checksum_ok = (checksum (temp+2) & 0xff) == 0; /* setinfo (INFO_, ""); */ /* I can't figure out why this is missing the first two chars. @@ -297,19 +255,12 @@ void upsdrv_updateinfo(void) sleep(SER_WAIT_SEC); } - if (!p || len < 1 || checksum_ok < 0) { - upsdebugx(2, "pointer to data not initialized after processing"); - dstate_datastale(); - return; - } - if (!checksum_ok) { upsdebugx(2, "checksum corruption"); - upsdebug_hex(3, "buffer", temp, (size_t)len); + upsdebug_hex(3, "buffer", temp, len); dstate_datastale(); return; } - /* upslogx(LOG_INFO, "updateinfo: %s", p); */ setinfo_int ("input.voltage", p+24,4); @@ -358,11 +309,9 @@ void upsdrv_updateinfo(void) /* all UPS tunable parameters are set with command 'p%d=%s' */ -static int setparam (int parameter, int dlen, const char * data) +int setparam (int parameter, int dlen, const char * data) { char reply[80]; - /* Note the use of "%*s" - parameter (int)dlen specifies - * the string width reserved for data */ upssend ("p%d=%*s\r", parameter, dlen, data); if (upsrecv (reply, sizeof(reply), ENDCHAR, "") < 0) return 0; return strncmp (reply, "OK", 2) == 0; @@ -389,7 +338,7 @@ static void autorestart (int restart) /* set UPS parameters */ static int upsdrv_setvar (const char *var, const char * data) { int parameter; - size_t len = strlen(data); + int len = strlen(data); upsdebugx(1, "Setvar: %s %s", var, data); if (strcmp("input.transfer.low", var) == 0) { parameter = 7; @@ -405,9 +354,8 @@ static int upsdrv_setvar (const char *var, const char * data) { return STAT_SET_UNKNOWN; } ups_setsuper (1); - assert (len < INT_MAX); - if (setparam (parameter, (int)len, data)) { - dstate_setinfo (var, "%*s", (int)len, data); + if (setparam (parameter, len, data)) { + dstate_setinfo (var, "%*s", len, data); } ups_setsuper (0); return STAT_SET_HANDLED; @@ -448,7 +396,7 @@ static int instcmd (const char *cmdname, const char *extra) upssend ("OFF%s\r", p); return STAT_INSTCMD_HANDLED; } - upslogx(LOG_INFO, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_INFO, "instcmd: unknown command %s", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -463,7 +411,7 @@ void upsdrv_makevartable(void) addvar (VAR_VALUE, "max_load", "rated VA load VA"); } -static struct { +struct { const char * val; speed_t speed; } speed_table[] = { diff --git a/drivers/bestpower-mib.c b/drivers/bestpower-mib.c index 51ba1a6..29c1926 100644 --- a/drivers/bestpower-mib.c +++ b/drivers/bestpower-mib.c @@ -22,7 +22,7 @@ #include "bestpower-mib.h" -#define BESTPOWER_MIB_VERSION "0.4" +#define BESTPOWER_MIB_VERSION "0.1" #define BESTPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.2947.1.1.2.0" /* @@ -32,37 +32,30 @@ /* TODO: find the right sysOID for this MIB * #define BESTPOWER_SYSOID ".1.3.6.1.4.1.2947???" */ -#define BESTPOWER_SYSOID BESTPOWER_OID_MODEL_NAME static info_lkp_t bestpower_power_status[] = { - { 1, "OL", NULL, NULL }, - { 2, "OB", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "OL" }, + { 2, "OB" }, + { 0, "NULL" } } ; /* Snmp2NUT lookup table for Best Power MIB */ static snmp_info_t bestpower_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* Device page */ { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ups", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, /*.1.3.6.1.4.1.2947.1.1.1.0 = STRING: "Ferrups" .1.3.6.1.4.1.2947.1.1.2.0 = STRING: "FE850VA"*/ { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, BESTPOWER_OID_MODEL_NAME, - "Best Ferrups", SU_FLAG_STATIC, NULL }, + "Best Ferrups", SU_FLAG_STATIC, NULL, NULL }, { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2947.1.1.5.0", "", SU_FLAG_STATIC, NULL }, { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2947.1.1.7.0", - "", SU_FLAG_STATIC, NULL }, + "", SU_FLAG_STATIC, NULL }, { "ups.power", 0, 1, ".1.3.6.1.4.1.2947.1.1.3.0", "", 0, NULL }, { "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2947.1.1.8.0", "", @@ -84,8 +77,8 @@ static snmp_info_t bestpower_mib[] = { 0, NULL }, /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } } ; -mib2nut_info_t bestpower = { "bestpower", BESTPOWER_MIB_VERSION, NULL, - BESTPOWER_OID_MODEL_NAME, bestpower_mib, BESTPOWER_SYSOID, NULL }; +mib2nut_info_t bestpower = { "bestpower", BESTPOWER_MIB_VERSION, "", + BESTPOWER_OID_MODEL_NAME, bestpower_mib }; diff --git a/drivers/bestuferrups.c b/drivers/bestuferrups.c index 8bed32b..d60cb02 100644 --- a/drivers/bestuferrups.c +++ b/drivers/bestuferrups.c @@ -1,4 +1,4 @@ -/* +/* bestuferrups.c - model specific routines for Best Power Micro-Ferrups This module is a 40% rewritten mangle of the bestfort module by @@ -33,7 +33,7 @@ #include "serial.h" #define DRIVER_NAME "Best Ferrups Series ME/RE/MD driver" -#define DRIVER_VERSION "0.04" +#define DRIVER_VERSION "0.03" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -61,46 +61,46 @@ upsdrv_info_t upsdrv_info = { #include #include -static int debugging = 0; +int debugging = 0; + /* Blob of UPS configuration data from the formatconfig string */ -static struct { - int valid; /* set to 1 when this is filled in */ +struct { + int valid; /* set to 1 when this is filled in */ - float idealbvolts; /* various interestin battery voltages */ - float fullvolts; - float emptyvolts; - int va; /* capacity of UPS in Volt-Amps */ - int watts; /* capacity of UPS in watts */ - int model; /* enumerated model type */ + float idealbvolts; /* various interestin battery voltages */ + float fullvolts; + float emptyvolts; + int va; /* capacity of UPS in Volt-Amps */ + int watts; /* capacity of UPS in watts */ + int model; /* enumerated model type */ } fc; /* Forward decls */ /* Set up all the funky shared memory stuff used to communicate with upsd */ -void upsdrv_initinfo (void) +void upsdrv_initinfo (void) { /* now set up room for all future variables that are supported */ dstate_setinfo("ups.mfr", "%s", "Best Power"); - switch(fc.model) - { - case ME3100: - dstate_setinfo("ups.model", "Micro Ferrups (ME) %d", fc.va); - break; - case MD1KVA: - dstate_setinfo("ups.model", "Micro Ferrups (MD) %d", fc.va); - break; - case RE1800: - dstate_setinfo("ups.model", "Micro Ferrups (RE) %d", fc.va); - break; - default: - fatalx(EXIT_FAILURE, "UPS model not matched!"); /* Will never get here, upsdrv_initups() will catch */ - } - fprintf(stderr, "Best Power %s detected\n", + switch(fc.model) { + case ME3100: + dstate_setinfo("ups.model", "Micro Ferrups (ME) %d", fc.va); + break; + case MD1KVA: + dstate_setinfo("ups.model", "Micro Ferrups (MD) %d", fc.va); + break; + case RE1800: + dstate_setinfo("ups.model", "Micro Ferrups (RE) %d", fc.va); + break; + default: + fatalx(EXIT_FAILURE, "UPS model not matched!"); /* Will never get here, upsdrv_initups() will catch */ + } + fprintf(stderr, "Best Power %s detected\n", dstate_getinfo("ups.model")); - fprintf(stderr, "Battery voltages %5.1f nominal, %5.1f full, %5.1f empty\n", + fprintf(stderr, "Battery voltages %5.1f nominal, %5.1f full, %5.1f empty\n", fc.idealbvolts, fc.fullvolts, fc.emptyvolts); @@ -114,259 +114,236 @@ time^M^M^JFeb 20, 22:13:32^M^J^M^J=>id^M^JUnit ID "ME3.1K12345"^M^J^M^J=> ---------------------------------------------------- */ -static ssize_t execute(const char *cmd, char *result, size_t resultsize) +static int execute(const char *cmd, char *result, int resultsize) { - ssize_t ret; - char buf[256]; - - ser_send(upsfd, "%s", cmd); - ser_get_line(upsfd, buf, sizeof(buf), '\012', "", 3, 0); - ret = ser_get_line(upsfd, result, resultsize, '\015', "\012", 3, 0); - ser_get_line(upsfd, buf, sizeof(buf), '>', "", 3, 0); - return ret; + int ret; + char buf[256]; + + ser_send(upsfd, "%s", cmd); + ser_get_line(upsfd, buf, sizeof(buf), '\012', "", 3, 0); + ret = ser_get_line(upsfd, result, resultsize, '\015', "\012", 3, 0); + ser_get_line(upsfd, buf, sizeof(buf), '>', "", 3, 0); + return ret; } void upsdrv_updateinfo(void) { - char fstring[512]; + char fstring[512]; - if (! fc.valid) { - fprintf(stderr, - "upsupdate run before ups_ident() read ups config\n"); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* NOTE: This assert() always fails because of "0": - * error: will never be executed [-Werror,-Wunreachable-code] - * ((0) ? (void) (0) : __assert_fail ("0", "bestuferrups.c", 138, __PRETTY_FUNCTION__)); - * ^ - */ - assert(0); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - } + if (! fc.valid) { + fprintf(stderr, + "upsupdate run before ups_ident() read ups config\n"); + assert(0); + } - if (execute("f\r", fstring, sizeof(fstring)) > 0) { - int inverter=0, charger=0, vin=0, vout=0, btimeleft=0, linestat=0, - alstat=0, vaout=0; - double ampsout=0.0, vbatt=0.0, battpercent=0.0, loadpercent=0.0, - hstemp=0.0, acfreq=0.0, ambtemp=0.0; - char tmp[16]; + if (execute("f\r", fstring, sizeof(fstring)) > 0) { + int inverter=0, charger=0, vin=0, vout=0, btimeleft=0, linestat=0, + alstat=0, vaout=0; + double ampsout=0.0, vbatt=0.0, battpercent=0.0, loadpercent=0.0, + hstemp=0.0, acfreq=0.0, ambtemp=0.0; + char tmp[16]; - /* Inverter status: 0=off 1=on */ - memcpy(tmp, fstring+16, 2); - tmp[2] = '\0'; - inverter = atoi(tmp); + /* Inverter status. 0=off 1=on */ + memcpy(tmp, fstring+16, 2); + tmp[2] = '\0'; + inverter = atoi(tmp); - /* Charger status: 0=off 1=on */ - memcpy(tmp, fstring+18, 2); - tmp[2] = '\0'; - charger = atoi(tmp); + /* Charger status. 0=off 1=on */ + memcpy(tmp, fstring+18, 2); + tmp[2] = '\0'; + charger = atoi(tmp); + + /* Input Voltage. integer number */ + memcpy(tmp, fstring+24, 4); + tmp[4] = '\0'; + vin = atoi(tmp); - /* Input Voltage. integer number */ - memcpy(tmp, fstring+24, 4); - tmp[4] = '\0'; - vin = atoi(tmp); + /* Output Voltage. integer number */ + memcpy(tmp, fstring+28, 4); + tmp[4] = '\0'; + vout = atoi(tmp); - /* Output Voltage. integer number */ - memcpy(tmp, fstring+28, 4); - tmp[4] = '\0'; - vout = atoi(tmp); + /* Iout. int times 10 */ + memcpy(tmp, fstring+36, 4); + tmp[4] = '\0'; + ampsout = ((double)(atoi(tmp)) / 10.0); - /* Iout: int times 10 */ - memcpy(tmp, fstring+36, 4); - tmp[4] = '\0'; - ampsout = ((double)(atoi(tmp)) / 10.0); + /* Battery voltage. int times 10 */ + memcpy(tmp, fstring+50, 4); + tmp[4] = '\0'; + vbatt = ((double)(atoi(tmp)) / 10.0); - /* Battery voltage: int times 10 */ - memcpy(tmp, fstring+50, 4); - tmp[4] = '\0'; - vbatt = ((double)(atoi(tmp)) / 10.0); + /* Volt-amps out. int */ + memcpy(tmp, fstring+40, 6); + tmp[6] = '\0'; + vaout = atoi(tmp); - /* Volt-amps out: int */ - memcpy(tmp, fstring+40, 6); - tmp[6] = '\0'; - vaout = atoi(tmp); + /* Line status. Bitmask */ + memcpy(tmp, fstring+72, 2); + tmp[2] = '\0'; + linestat = atoi(tmp); - /* Line status. Bitmask */ - memcpy(tmp, fstring+72, 2); - tmp[2] = '\0'; - linestat = atoi(tmp); + /* Alarm status reg 1. Bitmask */ + memcpy(tmp, fstring+20, 2); + tmp[2] = '\0'; + alstat = atoi(tmp); - /* Alarm status reg 1. Bitmask */ - memcpy(tmp, fstring+20, 2); - tmp[2] = '\0'; - alstat = atoi(tmp); + /* Alarm status reg 2. Bitmask */ + memcpy(tmp, fstring+22, 2); + tmp[2] = '\0'; + alstat = alstat | (atoi(tmp) << 8); - /* Alarm status reg 2. Bitmask */ - memcpy(tmp, fstring+22, 2); - tmp[2] = '\0'; - alstat = alstat | (atoi(tmp) << 8); + /* AC line frequency */ + memcpy(tmp, fstring+54, 4); + tmp[4]= '\0'; + acfreq = ((double)(atoi(tmp)) / 100.0); - /* AC line frequency */ - memcpy(tmp, fstring+54, 4); - tmp[4]= '\0'; - acfreq = ((double)(atoi(tmp)) / 100.0); + /* Runtime remaining */ + memcpy(tmp, fstring+58, 4); + tmp[4]= '\0'; + btimeleft = atoi(tmp); - /* Runtime remaining */ - memcpy(tmp, fstring+58, 4); - tmp[4]= '\0'; - btimeleft = atoi(tmp); + /* UPS Temperature */ + memcpy(tmp, fstring+62, 4); + tmp[4]= '\0'; + ambtemp = (double)(atoi(tmp)); - /* UPS Temperature */ - memcpy(tmp, fstring+62, 4); - tmp[4]= '\0'; - ambtemp = (double)(atoi(tmp)); + /* Percent Load */ + switch(fc.model) { + case ME3100: + if (execute("d 16\r", fstring, sizeof(fstring)) > 0) { + int l; + sscanf(fstring, "16 FullLoad%% %d", &l); + loadpercent = (double) l; + } + break; + case RE1800: + if (execute("d 16\r", fstring, sizeof(fstring)) > 0) { + int l; + sscanf(fstring, "16 FullLoad%% %d", &l); + loadpercent = (double) l; + } + if (execute("d 12\r", fstring, sizeof(fstring)) > 0) { + int l; + sscanf(fstring, "12 HS Temp %dC", &l); + hstemp = (double) l; + } + break; + case MD1KVA: + if (execute("d 22\r", fstring, sizeof(fstring)) > 0) { + int l; + sscanf(fstring, "22 FullLoad%% %d", &l); + loadpercent = (double) l; + } + break; + default: /* Will never happen, caught in upsdrv_initups() */ + fatalx(EXIT_FAILURE, "Unknown model in upsdrv_updateinfo()"); + } + /* Compute battery percent left based on battery voltages. */ + battpercent = ((vbatt - fc.emptyvolts) + / (fc.fullvolts - fc.emptyvolts) * 100.0); + if (battpercent < 0.0) + battpercent = 0.0; + else if (battpercent > 100.0) + battpercent = 100.0; + + /* Compute status string */ + { + int lowbatt, overload, replacebatt, boosting, trimming; - /* Percent Load */ - switch(fc.model) - { - case ME3100: - if (execute("d 16\r", fstring, sizeof(fstring)) > 0) { - int l; - sscanf(fstring, "16 FullLoad%% %d", &l); - loadpercent = (double) l; - } - break; - case RE1800: - if (execute("d 16\r", fstring, sizeof(fstring)) > 0) { - int l; - sscanf(fstring, "16 FullLoad%% %d", &l); - loadpercent = (double) l; - } - if (execute("d 12\r", fstring, sizeof(fstring)) > 0) { - int l; - sscanf(fstring, "12 HS Temp %dC", &l); - hstemp = (double) l; - } - break; - case MD1KVA: - if (execute("d 22\r", fstring, sizeof(fstring)) > 0) { - int l; - sscanf(fstring, "22 FullLoad%% %d", &l); - loadpercent = (double) l; - } - break; - default: /* Will never happen, caught in upsdrv_initups() */ - fatalx(EXIT_FAILURE, "Unknown model in upsdrv_updateinfo()"); - } - /* Compute battery percent left based on battery voltages. */ - battpercent = ((vbatt - fc.emptyvolts) - / (fc.fullvolts - fc.emptyvolts) * 100.0); - if (battpercent < 0.0) - battpercent = 0.0; - else if (battpercent > 100.0) - battpercent = 100.0; + lowbatt = alstat & (1<<1); + overload = alstat & (1<<6); + replacebatt = alstat & (1<<10); + boosting = inverter && (linestat & (1<<2)) && (vin < 115); + trimming = inverter && (linestat & (1<<2)) && (vin > 115); - /* Compute status string */ - { - int lowbatt, overload, replacebatt, boosting, trimming; + status_init(); + + if (inverter) + status_set("OB"); + else + status_set("OL"); - lowbatt = alstat & (1<<1); - overload = alstat & (1<<6); - replacebatt = alstat & (1<<10); - boosting = inverter && (linestat & (1<<2)) && (vin < 115); - trimming = inverter && (linestat & (1<<2)) && (vin > 115); + if (lowbatt) + status_set("LB"); - status_init(); + if (trimming) + status_set("TRIM"); - if (inverter) - status_set("OB"); - else - status_set("OL"); + if (boosting) + status_set("BOOST"); - if (lowbatt) - status_set("LB"); + if (replacebatt) + status_set("RB"); - if (trimming) - status_set("TRIM"); + if (overload) + status_set("OVER"); - if (boosting) - status_set("BOOST"); + status_commit(); + } - if (replacebatt) - status_set("RB"); + if (debugging) { + fprintf(stderr, + "Poll: inverter %d charger %d vin %d vout %d vaout %d btimeleft %d\n", + inverter, charger, vin, vout, vaout, btimeleft); + fprintf(stderr, + " ampsout %5.1f vbatt %5.1f batpcnt %5.1f loadpcnt %5.1f upstemp %5.1f acfreq %5.2f ambtemp %5.1f\n", + ampsout, vbatt, battpercent, loadpercent, hstemp, acfreq, ambtemp); - if (overload) - status_set("OVER"); + } - status_commit(); - } + /* Stuff information into info structures */ - /* FIXME: change to upsdebugx() and friends */ - if (debugging) { - fprintf(stderr, - "Poll: inverter %d charger %d vin %d vout %d vaout %d btimeleft %d\n", - inverter, charger, vin, vout, vaout, btimeleft); - fprintf(stderr, - " ampsout %5.1f vbatt %5.1f batpcnt %5.1f loadpcnt %5.1f upstemp %5.1f acfreq %5.2f ambtemp %5.1f\n", - ampsout, vbatt, battpercent, loadpercent, hstemp, acfreq, ambtemp); + dstate_setinfo("input.voltage", "%05.1f", (double)vin); + dstate_setinfo("output.voltage", "%05.1f", (double)vout); + dstate_setinfo("battery.charge", "%02.1f", battpercent); + dstate_setinfo("ups.load", "%02.1f", loadpercent); + dstate_setinfo("battery.voltage", "%02.1f", vbatt); + dstate_setinfo("input.frequency", "%05.2f", (double)acfreq); + dstate_setinfo("ups.temperature", "%05.1f", (double)hstemp); + dstate_setinfo("battery.runtime", "%d", btimeleft); + dstate_setinfo("ambient.temperature", "%05.1f", (double)ambtemp); - } + dstate_dataok(); + /* Tim: With out this return, it always falls over to the + datastate() at the end of the function */ + return; + } else { - /* Stuff information into info structures */ + dstate_datastale(); - dstate_setinfo("input.voltage", "%05.1f", (double)vin); - dstate_setinfo("output.voltage", "%05.1f", (double)vout); - dstate_setinfo("battery.charge", "%02.1f", battpercent); - dstate_setinfo("ups.load", "%02.1f", loadpercent); - dstate_setinfo("battery.voltage", "%02.1f", vbatt); - dstate_setinfo("input.frequency", "%05.2f", (double)acfreq); - dstate_setinfo("ups.temperature", "%05.1f", (double)hstemp); - dstate_setinfo("battery.runtime", "%d", btimeleft); - dstate_setinfo("ambient.temperature", "%05.1f", (double)ambtemp); + } /* if (execute("f\r", fstring, sizeof(fstring)) > 0) */ - dstate_dataok(); - /* Tim: With out this return, it always falls over to the - datastate() at the end of the function */ - return; - } else { - - dstate_datastale(); - - } /* if (execute("f\r", fstring, sizeof(fstring)) > 0) */ - - dstate_datastale(); - return; + dstate_datastale(); + return; } static void ups_sync(void) { - char buf[256]; + char buf[256]; - printf ("Syncing: "); - fflush (stdout); + printf ("Syncing: "); + fflush (stdout); - /* A bit better sanity might be good here. As is, we expect the - human to observe the time being totally not a time. */ + /* A bit better sanity might be good here. As is, we expect the + human to observe the time being totally not a time. */ - if (execute("time\r", buf, sizeof(buf)) > 0) { - fprintf(stderr, "UPS Time: %s\n", buf); - } else { - fatalx(EXIT_FAILURE, "Error connecting to UPS"); - } + if (execute("time\r", buf, sizeof(buf)) > 0) { + fprintf(stderr, "UPS Time: %s\n", buf); + } else { + fatalx(EXIT_FAILURE, "Error connecting to UPS"); + } } /* power down the attached load immediately */ void upsdrv_shutdown(void) { /* NB: hard-wired password */ - ser_send(upsfd, "pw377\r"); - ser_send(upsfd, "off 1 a\r"); /* power off in 1 second and restart when line power returns */ + ser_send(upsfd, "pw377\r"); + ser_send(upsfd, "off 1 a\r"); /* power off in 1 second and restart when line power returns */ } /* list flags and values that you want to receive via -x */ @@ -392,12 +369,12 @@ static void sync_serial(void) { /* Begin code stolen from bestups.c */ static void setup_serial(void) -{ - struct termios tio; - +{ + struct termios tio; + if (tcgetattr(upsfd, &tio) == -1) fatal_with_errno(EXIT_FAILURE, "tcgetattr"); - + tio.c_iflag = IXON | IXOFF; tio.c_oflag = 0; tio.c_cflag = (CS8 | CREAD | HUPCL | CLOCAL); @@ -422,100 +399,99 @@ static void setup_serial(void) void upsdrv_initups () { - char temp[256], fcstring[512]; + char temp[256], fcstring[512]; - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B1200); - setup_serial(); - ups_sync(); + upsfd = ser_open(device_path); + ser_set_speed(upsfd, device_path, B1200); + setup_serial(); + ups_sync(); - fc.model = UNKNOWN; - /* Obtain Model */ - if (execute("id\r", fcstring, sizeof(fcstring)) < 1) { - fatalx(EXIT_FAILURE, "Failed execute in ups_ident()"); - } + fc.model = UNKNOWN; + /* Obtain Model */ + if (execute("id\r", fcstring, sizeof(fcstring)) < 1) { + fatalx(EXIT_FAILURE, "Failed execute in ups_ident()"); + } + + /* response is a one-line packed string starting with $ */ + if (memcmp(fcstring, "Unit", 4)) { + fatalx(EXIT_FAILURE, + "Bad response from formatconfig command in ups_ident()\n" + "id: %s\n", fcstring + ); + } - /* response is a one-line packed string starting with $ */ - if (memcmp(fcstring, "Unit", 4)) { - fatalx(EXIT_FAILURE, - "Bad response from formatconfig command in ups_ident()\n" - "id: %s\n", fcstring - ); - } + if (debugging) + fprintf(stderr, "id: %s\n", fcstring); + + /* chars 4:2 are a two-digit ascii hex enumerated model code */ + memcpy(temp, fcstring+9, 2); + temp[2] = '\0'; - /* FIXME: upsdebugx() */ - if (debugging) - fprintf(stderr, "id: %s\n", fcstring); + if (memcmp(temp, "ME", 2) == 0) { + fc.model = ME3100; + } else if ((memcmp(temp, "RE", 2) == 0)) { + fc.model = RE1800; + } else if (memcmp(temp, "C1", 2) == 0) { + /* Better way to identify unit is using "d 15\r", which results in + "15 M# MD1KVA", "id\r" yields "Unit ID "C1K03588"" */ + fc.model = MD1KVA; + } + + switch(fc.model) { + case ME3100: + fc.va = 3100; + fc.watts = 2200; + /* determine shutdown battery voltage */ + if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); + } + fc.fullvolts = 54.20; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + case RE1800: + fc.va = 1800; + fc.watts = 1200; + /* determine shutdown battery voltage */ + if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); + } + fc.fullvolts = 54.20; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + case MD1KVA: + fc.va = 1100; + fc.watts = 770; /* Approximate, based on 0.7 power factor */ + /* determine shutdown battery voltage */ + if (execute("d 27\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "27 LowBatt %f", &fc.emptyvolts); + } + /* determine fully charged battery voltage */ + if (execute("d 28\r", fcstring, sizeof(fcstring)) > 0) { + sscanf(fcstring, "28 Hi Batt %f", &fc.fullvolts); + } + fc.fullvolts = 13.70; + /* determine "ideal" voltage by a guess */ + fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; + break; + default: + fatalx(EXIT_FAILURE, "Uknown model %s in ups_ident()", temp); + } - /* chars 4:2 are a two-digit ascii hex enumerated model code */ - memcpy(temp, fcstring+9, 2); - temp[2] = '\0'; - - if (memcmp(temp, "ME", 2) == 0) { - fc.model = ME3100; - } else if ((memcmp(temp, "RE", 2) == 0)) { - fc.model = RE1800; - } else if (memcmp(temp, "C1", 2) == 0) { - /* Better way to identify unit is using "d 15\r", which results in - "15 M# MD1KVA", "id\r" yields "Unit ID "C1K03588"" */ - fc.model = MD1KVA; - } - - switch(fc.model) { - case ME3100: - fc.va = 3100; - fc.watts = 2200; - /* determine shutdown battery voltage */ - if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); - } - fc.fullvolts = 54.20; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - case RE1800: - fc.va = 1800; - fc.watts = 1200; - /* determine shutdown battery voltage */ - if (execute("d 29\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "29 LowBat %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 31\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "31 HiBatt %f", &fc.fullvolts); - } - fc.fullvolts = 54.20; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - case MD1KVA: - fc.va = 1100; - fc.watts = 770; /* Approximate, based on 0.7 power factor */ - /* determine shutdown battery voltage */ - if (execute("d 27\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "27 LowBatt %f", &fc.emptyvolts); - } - /* determine fully charged battery voltage */ - if (execute("d 28\r", fcstring, sizeof(fcstring)) > 0) { - sscanf(fcstring, "28 Hi Batt %f", &fc.fullvolts); - } - fc.fullvolts = 13.70; - /* determine "ideal" voltage by a guess */ - fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts; - break; - default: - fatalx(EXIT_FAILURE, "Unknown model %s in ups_ident()", temp); - } - - fc.valid = 1; - return; + fc.valid = 1; + return; } void upsdrv_cleanup(void) { - ser_close(upsfd, device_path); + ser_close(upsfd, device_path); } diff --git a/drivers/bestups.c b/drivers/bestups.c index 4f63aa5..854bddf 100644 --- a/drivers/bestups.c +++ b/drivers/bestups.c @@ -1,10 +1,5 @@ /* bestups.c - model specific routines for Best-UPS Fortress models - OBSOLETION WARNING: Please to not base new development on this - codebase, instead create a new subdriver for nutdrv_qx which - generally covers all Megatec/Qx protocol family and aggregates - device support from such legacy drivers over time. - Copyright (C) 1999 Russell Kroll ID config option by Jason White @@ -28,7 +23,7 @@ #include "serial.h" #define DRIVER_NAME "Best UPS driver" -#define DRIVER_VERSION "1.07" +#define DRIVER_VERSION "1.06" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -127,14 +122,13 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } static int get_ident(char *buf, size_t bufsize) { - int i; - ssize_t ret; + int i, ret; char *ID; ID = getval("ID"); /* user-supplied override from ups.conf */ @@ -148,7 +142,7 @@ static int get_ident(char *buf, size_t bufsize) for (i = 0; i < MAXTRIES; i++) { ser_send_pace(upsfd, UPSDELAY, "\rID\r"); - ret = ser_get_line(upsfd, buf, bufsize, ENDCHAR, "", + ret = ser_get_line(upsfd, buf, bufsize, ENDCHAR, "", SER_WAIT_SEC, SER_WAIT_USEC); if (ret > 0) @@ -216,7 +210,7 @@ static void ups_ident(void) if ((!model) || (!rating)) { fatalx(EXIT_FAILURE, "Didn't get a valid ident string"); } - + model_set(model, rating); /* Battery voltage multiplier */ @@ -246,13 +240,12 @@ static void ups_ident(void) static void ups_sync(void) { char buf[256]; - int i; - ssize_t ret; + int i, ret; for (i = 0; i < MAXTRIES; i++) { ser_send_pace(upsfd, UPSDELAY, "\rQ1\r"); - ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, "", + ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, "", SER_WAIT_SEC, SER_WAIT_USEC); /* return once we get something that looks usable */ @@ -270,7 +263,7 @@ void upsdrv_initinfo(void) ups_sync(); ups_ident(); - printf("Detected %s %s on %s\n", dstate_getinfo("ups.mfr"), + printf("Detected %s %s on %s\n", dstate_getinfo("ups.mfr"), dstate_getinfo("ups.model"), device_path); /* paranoia - cancel any shutdown that might already be running */ @@ -284,14 +277,13 @@ void upsdrv_initinfo(void) static int ups_on_line(void) { - int i; - ssize_t ret; + int i, ret; char temp[256], pstat[32]; for (i = 0; i < MAXTRIES; i++) { ser_send_pace(upsfd, UPSDELAY, "\rQ1\r"); - ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, "", + ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, "", SER_WAIT_SEC, SER_WAIT_USEC); /* Q1 must return 46 bytes starting with a ( */ @@ -311,7 +303,7 @@ static int ups_on_line(void) upslogx(LOG_ERR, "Status read failed: assuming on battery"); return 0; /* on battery */ -} +} void upsdrv_shutdown(void) { @@ -327,10 +319,10 @@ void upsdrv_shutdown(void) void upsdrv_updateinfo(void) { - char involt[16], outvolt[16], loadpct[16], acfreq[16], + char involt[16], outvolt[16], loadpct[16], acfreq[16], battvolt[16], upstemp[16], pstat[16], buf[256]; float bvoltp; - ssize_t ret; + int ret; ret = ser_send_pace(upsfd, UPSDELAY, "\rQ1\r"); @@ -343,7 +335,7 @@ void upsdrv_updateinfo(void) /* these things need a long time to respond completely */ usleep(200000); - ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, "", + ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR, "", SER_WAIT_SEC, SER_WAIT_USEC); if (ret < 1) { @@ -353,13 +345,13 @@ void upsdrv_updateinfo(void) } if (ret < 46) { - ser_comm_fail("Poll failed: short read (got %zd bytes)", ret); + ser_comm_fail("Poll failed: short read (got %d bytes)", ret); dstate_datastale(); return; } if (ret > 46) { - ser_comm_fail("Poll failed: response too long (got %zd bytes)", + ser_comm_fail("Poll failed: response too long (got %d bytes)", ret); dstate_datastale(); return; @@ -374,7 +366,7 @@ void upsdrv_updateinfo(void) ser_comm_good(); - sscanf(buf, "%*c%s %*s %s %s %s %s %s %s", involt, outvolt, + sscanf(buf, "%*c%s %*s %s %s %s %s %s %s", involt, outvolt, loadpct, acfreq, battvolt, upstemp, pstat); /* Guesstimation of battery charge left (inaccurate) */ @@ -436,15 +428,6 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - upsdebugx(0, - "Please note that this driver is deprecated and will not receive\n" - "new development. If it works for managing your devices - fine,\n" - "but if you are running it to try setting up a new device, please\n" - "consider the newer nutdrv_qx instead, which should handle all 'Qx'\n" - "protocol variants for NUT. (Please also report if your device works\n" - "with this driver, but nutdrv_qx would not actually support it with\n" - "any subdriver!)\n"); - upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); } diff --git a/drivers/blazer.c b/drivers/blazer.c index 6e06b42..cbcfadc 100644 --- a/drivers/blazer.c +++ b/drivers/blazer.c @@ -1,11 +1,6 @@ /* * blazer.c: driver core for Megatec/Q1 protocol based UPSes * - * OBSOLETION WARNING: Please to not base new development on this - * codebase, instead create a new subdriver for nutdrv_qx which - * generally covers all Megatec/Qx protocol family and aggregates - * device support from such legacy drivers over time. - * * A document describing the protocol implemented by this driver can be * found online at http://www.networkupstools.org/ups-protocols/megatec.html * @@ -30,10 +25,11 @@ #include "main.h" #include "blazer.h" -#include "nut_float.h" -static long ondelay = 3; /* minutes */ -static long offdelay = 30; /* seconds */ +#include + +static int ondelay = 3; /* minutes */ +static int offdelay = 30; /* seconds */ static int proto; static int online = 1; @@ -82,7 +78,7 @@ static const struct { { "mustek", "QS\r", "F\r", "I\r" }, { "megatec/old", "D\r", "F\r", "I\r" }, { "zinto", "Q1\r", "F\r", "FW?\r" }, - { NULL, NULL, NULL, NULL } + { NULL } }; @@ -181,7 +177,7 @@ static int blazer_status(const char *cmd) { "input.frequency", "%.1f", strtod }, { "battery.voltage", "%.2f", blazer_battery }, { "ups.temperature", "%.1f", strtod }, - { NULL, NULL, NULL } + { NULL } }; char buf[SMALLBUF], *val, *last = NULL; @@ -215,20 +211,7 @@ static int blazer_status(const char *cmd) continue; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif dstate_setinfo(status[i].var, status[i].fmt, status[i].conv(val, NULL)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } if (!val) { @@ -321,7 +304,7 @@ static int blazer_rating(const char *cmd) { "input.current.nominal", "%.1f", strtod }, { "battery.voltage.nominal", "%.1f", blazer_packs }, { "input.frequency.nominal", "%.0f", strtod }, - { NULL, NULL, NULL } + { NULL } }; char buf[SMALLBUF], *val, *last = NULL; @@ -355,20 +338,7 @@ static int blazer_rating(const char *cmd) continue; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif dstate_setinfo(rating[i].var, rating[i].fmt, rating[i].conv(val, NULL)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } return 0; @@ -384,7 +354,7 @@ static int blazer_vendor(const char *cmd) { "ups.mfr", 15 }, { "ups.model", 10 }, { "ups.firmware", 10 }, - { NULL, 0 } + { NULL } }; char buf[SMALLBUF]; @@ -411,7 +381,7 @@ static int blazer_vendor(const char *cmd) snprintf(val, sizeof(val), "%.*s", information[i].len, &buf[index]); - dstate_setinfo(information[i].var, "%s", str_rtrim(val, ' ')); + dstate_setinfo(information[i].var, "%s", rtrim(val, ' ')); } return 0; @@ -431,7 +401,7 @@ static int blazer_instcmd(const char *cmdname, const char *extra) { "test.battery.start.deep", "TL\r" }, { "test.battery.start.quick", "T\r" }, { "test.battery.stop", "CT\r" }, - { NULL, NULL } + { NULL } }; char buf[SMALLBUF] = ""; @@ -480,18 +450,18 @@ static int blazer_instcmd(const char *cmdname, const char *extra) if (ondelay == 0) { if (offdelay < 60) { - snprintf(buf, sizeof(buf), "S.%ld\r", offdelay / 6); + snprintf(buf, sizeof(buf), "S.%d\r", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "S%02ld\r", offdelay / 60); + snprintf(buf, sizeof(buf), "S%02d\r", offdelay / 60); } } else if (offdelay < 60) { - snprintf(buf, sizeof(buf), "S.%ldR%04ld\r", offdelay / 6, ondelay); + snprintf(buf, sizeof(buf), "S.%dR%04d\r", offdelay / 6, ondelay); } else { - snprintf(buf, sizeof(buf), "S%02ldR%04ld\r", offdelay / 60, ondelay); + snprintf(buf, sizeof(buf), "S%02dR%04d\r", offdelay / 60, ondelay); } @@ -504,22 +474,20 @@ static int blazer_instcmd(const char *cmdname, const char *extra) */ if (offdelay < 60) { - snprintf(buf, sizeof(buf), "S.%ldR0000\r", offdelay / 6); + snprintf(buf, sizeof(buf), "S.%dR0000\r", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "S%02ldR0000\r", offdelay / 60); + snprintf(buf, sizeof(buf), "S%02dR0000\r", offdelay / 60); } } else if (!strcasecmp(cmdname, "test.battery.start")) { - long delay = extra ? strtol(extra, NULL, 10) : 10; + int delay = extra ? strtol(extra, NULL, 10) : 10; if ((delay < 1) || (delay > 99)) { - upslogx(LOG_ERR, - "instcmd: command [%s] failed, delay [%s] out of range", - cmdname, extra); + upslogx(LOG_ERR, "instcmd: command [%s] failed, delay [%s] out of range", cmdname, extra); return STAT_INSTCMD_FAILED; } - snprintf(buf, sizeof(buf), "T%02ld\r", delay); + snprintf(buf, sizeof(buf), "T%02d\r", delay); } else { upslogx(LOG_ERR, "instcmd: command [%s] not found", cmdname); return STAT_INSTCMD_UNKNOWN; @@ -568,7 +536,7 @@ void blazer_initups(void) } if ((ondelay < 0) || (ondelay > 9999)) { - fatalx(EXIT_FAILURE, "Start delay '%ld' out of range [0..9999]", ondelay); + fatalx(EXIT_FAILURE, "Start delay '%d' out of range [0..9999]", ondelay); } val = getval("offdelay"); @@ -577,7 +545,7 @@ void blazer_initups(void) } if ((offdelay < 12) || (offdelay > 600)) { - fatalx(EXIT_FAILURE, "Shutdown delay '%ld' out of range [12..600]", offdelay); + fatalx(EXIT_FAILURE, "Shutdown delay '%d' out of range [12..600]", offdelay); } /* Truncate to nearest setable value */ @@ -605,7 +573,7 @@ static void blazer_initbattery(void) /* If no values were provided by the user in ups.conf, try to guesstimate * battery.charge, but announce it! */ - if ( (!d_equal(batt.volt.nom, 1)) && ((d_equal(batt.volt.high, -1)) || (d_equal(batt.volt.low, -1)))) { + if ((batt.volt.nom != 1) && ((batt.volt.high == -1) || (batt.volt.low == -1))) { upslogx(LOG_INFO, "No values provided for battery high/low voltages in ups.conf\n"); /* Basic formula, which should cover most cases */ @@ -615,7 +583,7 @@ static void blazer_initbattery(void) /* Publish these data too */ dstate_setinfo("battery.voltage.low", "%.2f", batt.volt.low); dstate_setinfo("battery.voltage.high", "%.2f", batt.volt.high); - + upslogx(LOG_INFO, "Using 'guestimation' (low: %f, high: %f)!", batt.volt.low, batt.volt.high); } @@ -696,18 +664,9 @@ void blazer_initinfo(void) const char *protocol = getval("protocol"); int retry; - upsdebugx(0, - "Please note that this driver is deprecated and will not receive\n" - "new development. If it works for managing your devices - fine,\n" - "but if you are running it to try setting up a new device, please\n" - "consider the newer nutdrv_qx instead, which should handle all 'Qx'\n" - "protocol variants for NUT. (Please also report if your device works\n" - "with this driver, but nutdrv_qx would not actually support it with\n" - "any subdriver!)\n"); - for (proto = 0; command[proto].status; proto++) { - int ret = -1; + int ret; if (protocol && strcasecmp(protocol, command[proto].name)) { upsdebugx(2, "Skipping %s protocol...", command[proto].name); @@ -739,7 +698,7 @@ void blazer_initinfo(void) } if (command[proto].rating && !testvar("norating")) { - int ret = -1; + int ret; for (retry = 1; retry <= MAXTRIES; retry++) { @@ -759,7 +718,7 @@ void blazer_initinfo(void) } if (command[proto].vendor && !testvar("novendor")) { - int ret = -1; + int ret; for (retry = 1; retry <= MAXTRIES; retry++) { @@ -780,8 +739,8 @@ void blazer_initinfo(void) blazer_initbattery(); - dstate_setinfo("ups.delay.start", "%ld", 60 * ondelay); - dstate_setinfo("ups.delay.shutdown", "%ld", offdelay); + dstate_setinfo("ups.delay.start", "%d", 60 * ondelay); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); dstate_addcmd("beeper.toggle"); dstate_addcmd("load.off"); @@ -849,8 +808,6 @@ void upsdrv_updateinfo(void) dstate_dataok(); } -void upsdrv_shutdown(void) - __attribute__((noreturn)); void upsdrv_shutdown(void) { @@ -878,7 +835,7 @@ void upsdrv_shutdown(void) continue; } - fatalx(EXIT_SUCCESS, "Shutting down in %ld seconds", offdelay); + fatalx(EXIT_SUCCESS, "Shutting down in %d seconds", offdelay); } diff --git a/drivers/blazer.h b/drivers/blazer.h index 6a8c71c..2337858 100644 --- a/drivers/blazer.h +++ b/drivers/blazer.h @@ -1,11 +1,6 @@ /* * blazer.h: defines/macros for Megatec/Q1 protocol based UPSes * - * OBSOLETION WARNING: Please to not base new development on this - * codebase, instead create a new subdriver for nutdrv_qx which - * generally covers all Megatec/Qx protocol family and aggregates - * device support from such legacy drivers over time. - * * A document describing the protocol implemented by this driver can be * found online at "http://www.networkupstools.org/protocols/megatec.html". * @@ -45,7 +40,7 @@ * Returns < 0 on error, 0 on timeout and the number of bytes send/read on * success. */ -ssize_t blazer_command(const char *cmd, char *buf, size_t buflen); +int blazer_command(const char *cmd, char *buf, size_t buflen); void blazer_makevartable(void); void blazer_initups(void); diff --git a/drivers/blazer_ser.c b/drivers/blazer_ser.c index a906181..5c75726 100644 --- a/drivers/blazer_ser.c +++ b/drivers/blazer_ser.c @@ -1,11 +1,6 @@ /* * blazer_ser.c: support for Megatec/Q1 serial protocol based UPSes * - * OBSOLETION WARNING: Please to not base new development on this - * codebase, instead create a new subdriver for nutdrv_qx which - * generally covers all Megatec/Qx protocol family and aggregates - * device support from such legacy drivers over time. - * * A document describing the protocol implemented by this driver can be * found online at "http://www.networkupstools.org/protocols/megatec.html". * @@ -31,7 +26,7 @@ #include "blazer.h" #define DRIVER_NAME "Megatec/Q1 protocol serial driver" -#define DRIVER_VERSION "1.58" +#define DRIVER_VERSION "1.56" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -49,10 +44,10 @@ upsdrv_info_t upsdrv_info = { * Returns < 0 on error, 0 on timeout and the number of bytes read on * success. */ -ssize_t blazer_command(const char *cmd, char *buf, size_t buflen) +int blazer_command(const char *cmd, char *buf, size_t buflen) { #ifndef TESTING - ssize_t ret; + int ret; ser_flush_io(upsfd); @@ -95,18 +90,17 @@ ssize_t blazer_command(const char *cmd, char *buf, size_t buflen) continue; } - /* TODO: Range-check int vs ssize_t values */ - return (ssize_t)snprintf(buf, buflen, "%s", testing[i].answer); + return snprintf(buf, buflen, "%s", testing[i].answer); } - return (ssize_t)snprintf(buf, buflen, "%s", testing[i].cmd); + return snprintf(buf, buflen, "%s", testing[i].cmd); #endif } void upsdrv_help(void) { - printf("Read The Fine Manual ('man 8 blazer_ser')\n"); + printf("Read The Fine Manual ('man 8 blazer')\n"); } @@ -130,7 +124,7 @@ void upsdrv_initups(void) { "reverse", 0, 1 }, { "both", 1, 1 }, { "none", 0, 0 }, - { NULL, 0, 0 } + { NULL } }; int i; diff --git a/drivers/blazer_usb.c b/drivers/blazer_usb.c index fc3f78b..e3ef3fc 100644 --- a/drivers/blazer_usb.c +++ b/drivers/blazer_usb.c @@ -1,17 +1,11 @@ /* * blazer_usb.c: support for Megatec/Q1 USB protocol based UPSes * - * OBSOLETION WARNING: Please to not base new development on this - * codebase, instead create a new subdriver for nutdrv_qx which - * generally covers all Megatec/Qx protocol family and aggregates - * device support from such legacy drivers over time. - * * A document describing the protocol implemented by this driver can be * found online at "http://www.networkupstools.org/protocols/megatec.html". * * Copyright (C) 2003-2009 Arjen de Korte * Copyright (C) 2011-2012 Arnaud Quette - * Copyright (C) 2016 Eaton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -29,12 +23,12 @@ */ #include "main.h" -#include "nut_libusb.h" +#include "libusb.h" #include "usb-common.h" #include "blazer.h" #define DRIVER_NAME "Megatec/Q1 protocol USB driver" -#define DRIVER_VERSION "0.14" +#define DRIVER_VERSION "0.10" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -67,15 +61,15 @@ static int cypress_command(const char *cmd, char *buf, size_t buflen) memset(tmp, 0, sizeof(tmp)); snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ /* ret = usb->set_report(udev, 0, (unsigned char *)&tmp[i], 8); */ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, (usb_ctrl_charbuf)&tmp[i], 8, 5000); + 0x09, 0x200, 0, &tmp[i], 8, 5000); if (ret <= 0) { - upsdebugx(3, "send: %s", ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } } @@ -84,27 +78,24 @@ static int cypress_command(const char *cmd, char *buf, size_t buflen) memset(buf, 0, buflen); - for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += (size_t)ret) { + for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += ret) { /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)&buf[i], 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&buf[i], 8, 1000); + ret = usb_interrupt_read(udev, 0x81, &buf[i], 8, 1000); /* * Any errors here mean that we are unable to read a reply (which * will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s", ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } } upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - /* TODO: Range-check before cast */ - return (int)i; + return i; } @@ -118,9 +109,7 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen) /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)tmp, 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&tmp, 8, 1000); + ret = usb_interrupt_read(udev, 0x81, tmp, 8, 1000); /* * This USB to serial implementation is crappy. In order to read correct @@ -129,34 +118,32 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen) */ switch (ret) { - case ERROR_PIPE: /** Pipe error or Broken pipe */ + case -EPIPE: /* Broken pipe */ usb_clear_halt(udev, 0x81); - break; - - case ERROR_TIMEOUT: /** Operation or Connection timed out */ + case -ETIMEDOUT: /* Connection timed out */ break; } if (ret < 0) { - upsdebugx(3, "flush: %s", nut_usb_strerror(ret)); + upsdebugx(3, "flush: %s", usb_strerror()); break; } - upsdebug_hex(4, "dump", tmp, (size_t)ret); + upsdebug_hex(4, "dump", tmp, ret); } memset(tmp, 0, sizeof(tmp)); snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ /* ret = usb->set_report(udev, 0, (unsigned char *)&tmp[i], 8); */ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, (usb_ctrl_charbuf)&tmp[i], 8, 1000); + 0x09, 0x200, 0, &tmp[i], 8, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s", ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } } @@ -165,46 +152,43 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen) memset(buf, 0, buflen); - for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += (size_t)ret) { + for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += ret) { /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)&buf[i], 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&buf[i], 8, 1000); + ret = usb_interrupt_read(udev, 0x81, &buf[i], 8, 1000); /* * Any errors here mean that we are unable to read a reply (which * will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s", ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } } upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - /* TODO: Range-check before cast */ - return (int)i; + return i; } static int ippon_command(const char *cmd, char *buf, size_t buflen) { char tmp[64]; - int ret, len; + int ret; size_t i; snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x2, 0, (usb_ctrl_charbuf)&tmp[i], 8, 1000); + 0x09, 0x2, 0, &tmp[i], 8, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s", (ret != ERROR_TIMEOUT) ? nut_usb_strerror(ret) : "Connection timed out"); + upsdebugx(3, "send: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out"); return ret; } } @@ -212,32 +196,21 @@ static int ippon_command(const char *cmd, char *buf, size_t buflen) upsdebugx(3, "send: %.*s", (int)strcspn(tmp, "\r"), tmp); /* Read all 64 bytes of the reply in one large chunk */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&tmp, sizeof(tmp), 1000); + ret = usb_interrupt_read(udev, 0x81, tmp, sizeof(tmp), 1000); /* * Any errors here mean that we are unable to read a reply (which * will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s", (ret != ERROR_TIMEOUT) ? nut_usb_strerror(ret) : "Connection timed out"); + upsdebugx(3, "read: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out"); return ret; } - /* - * As Ippon will always return 64 bytes in response, we have to - * calculate and return length of actual response data here. - * Empty response will look like 0x00 0x0D, otherwise it will be - * data string terminated by 0x0D. - */ - len = (int)strcspn(tmp, "\r"); - upsdebugx(3, "read: %.*s", len, tmp); - if (len > 0) { - len ++; - } - snprintf(buf, buflen, "%.*s", len, tmp); - return len; + snprintf(buf, buflen, "%.*s", ret, tmp); + + upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); + return ret; } @@ -261,7 +234,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) { "Q\r", 0x07, '\r' }, { "C\r", 0x0b, '\r' }, { "CT\r", 0x0b, '\r' }, - { NULL, 0, '\0' } + { NULL } }; int i; @@ -280,16 +253,14 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) if (langid_fix != -1) { /* Apply langid_fix value */ - ret = usb_get_string(udev, command[i].index, langid_fix, - (usb_ctrl_charbuf)buf, buflen); + ret = usb_get_string(udev, command[i].index, langid_fix, buf, buflen); } else { - ret = usb_get_string_simple(udev, command[i].index, - (usb_ctrl_charbuf)buf, buflen); + ret = usb_get_string_simple(udev, command[i].index, buf, buflen); } if (ret <= 0) { - upsdebugx(3, "read: %s", ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } @@ -299,7 +270,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) if (langid_fix != -1) { /* Limit this check, at least for now */ /* Invalid receive size - message corrupted */ - if (ret != buf[0]) + if (ret != buf[0]) { upsdebugx(1, "size mismatch: %d / %d", ret, buf[0]); continue; @@ -308,7 +279,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) /* Simple unicode -> ASCII inplace conversion * FIXME: this code is at least shared with mge-shut/libshut * Create a common function? */ - size_t di, si, size = (size_t)buf[0]; + unsigned int di, si, size = buf[0]; for (di = 0, si = 2; si < size; si += 2) { if (di >= (buflen - 1)) break; @@ -319,9 +290,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) buf[di++] = buf[si]; } buf[di] = 0; - /* with buf a char* array, practical "size" limit and - * so "di" are small enough to cast to int */ - ret = (int)di; + ret = di; } /* "UPS No Ack" has a special meaning */ @@ -348,8 +317,6 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) static void *cypress_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &cypress_command; return NULL; } @@ -357,8 +324,6 @@ static void *cypress_subdriver(USBDevice_t *device) static void *ippon_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &ippon_command; return NULL; } @@ -366,8 +331,6 @@ static void *ippon_subdriver(USBDevice_t *device) static void *krauler_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &krauler_command; return NULL; } @@ -375,8 +338,6 @@ static void *krauler_subdriver(USBDevice_t *device) static void *phoenix_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &phoenix_command; return NULL; } @@ -395,16 +356,13 @@ static usb_device_id_t blazer_usb_id[] = { { USB_DEVICE(0x06da, 0x0601), &phoenix_subdriver }, /* Online Zinto A */ { USB_DEVICE(0x0f03, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */ { USB_DEVICE(0x14f0, 0x00c9), &phoenix_subdriver }, /* GE EP series */ - - /* Terminating entry */ - { 0, 0, NULL } + /* end of list */ + {-1, -1, NULL} }; static int device_match_func(USBDevice_t *hd, void *privdata) { - NUT_UNUSED_VARIABLE(privdata); - if (subdriver_command) { return 1; } @@ -436,10 +394,10 @@ static USBDeviceMatcher_t device_matcher = { * Returns < 0 on error, 0 on timeout and the number of bytes read on * success. */ -ssize_t blazer_command(const char *cmd, char *buf, size_t buflen) +int blazer_command(const char *cmd, char *buf, size_t buflen) { #ifndef TESTING - ssize_t ret; + int ret; if (udev == NULL) { ret = usb->open(&udev, &usbdevice, reopen_matcher, NULL); @@ -456,58 +414,42 @@ ssize_t blazer_command(const char *cmd, char *buf, size_t buflen) switch (ret) { - case ERROR_BUSY: /* Device or resource busy */ + case -EBUSY: /* Device or resource busy */ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver"); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ case -EPERM: /* Operation not permitted */ fatal_with_errno(EXIT_FAILURE, "Permissions problem"); -# ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -# endif -#endif /* WITH_LIBUSB_0_1 */ - case ERROR_PIPE: /* Broken pipe */ + case -EPIPE: /* Broken pipe */ if (usb_clear_halt(udev, 0x81) == 0) { upsdebugx(1, "Stall condition cleared"); break; } -#if (defined ETIME) && ETIME && WITH_LIBUSB_0_1 - goto fallthrough_case_etime; +#ifdef ETIME case -ETIME: /* Timer expired */ - fallthrough_case_etime: #endif if (usb_reset(udev) == 0) { upsdebugx(1, "Device reset handled"); } - goto fallthrough_case_reconnect; - case ERROR_NO_DEVICE: /* No such device */ - case ERROR_ACCESS: /* Permission denied */ - case ERROR_IO: /* I/O error */ -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ + case -ENODEV: /* No such device */ + case -EACCES: /* Permission denied */ + case -EIO: /* I/O error */ case -ENXIO: /* No such device or address */ -#endif - case ERROR_NOT_FOUND: /* No such file or directory */ - fallthrough_case_reconnect: + case -ENOENT: /* No such file or directory */ /* Uh oh, got to reconnect! */ usb->close(udev); udev = NULL; break; - case ERROR_TIMEOUT: /* Connection timed out */ - case ERROR_OVERFLOW: /* Value too large for defined data type */ -#if EPROTO && WITH_LIBUSB_0_1 + case -ETIMEDOUT: /* Connection timed out */ + case -EOVERFLOW: /* Value too large for defined data type */ case -EPROTO: /* Protocol error */ -#endif default: break; } return ret; -#else /* if TESTING: */ +#else const struct { const char *command; const char *answer; @@ -528,49 +470,31 @@ ssize_t blazer_command(const char *cmd, char *buf, size_t buflen) continue; } - /* TODO: Range-check int vs ssize_t values */ - return (ssize_t)snprintf(buf, buflen, "%s", testing[i].answer); + return snprintf(buf, buflen, "%s", testing[i].answer); } - return (ssize_t)snprintf(buf, buflen, "%s", testing[i].command); -#endif /* TESTING */ + return snprintf(buf, buflen, "%s", testing[i].command); +#endif } -#ifndef TESTING -static const struct subdriver_t { - const char *name; - int (*command)(const char *cmd, char *buf, size_t buflen); -} subdriver[] = { - { "cypress", &cypress_command }, - { "phoenix", &phoenix_command }, - { "ippon", &ippon_command }, - { "krauler", &krauler_command }, - { NULL, NULL } -}; -#endif /* TESTING */ void upsdrv_help(void) { -#ifndef TESTING - printf("\nAcceptable values for 'subdriver' via -x or ups.conf in this driver: "); - size_t i; - - for (i = 0; subdriver[i].name != NULL; i++) { - if (i>0) - printf(", "); - printf("%s", subdriver[i].name); - } - printf("\n\n"); -#endif /* TESTING */ - - printf("Read The Fine Manual ('man 8 blazer_usb')\n"); + printf("Read The Fine Manual ('man 8 blazer')\n"); } void upsdrv_makevartable(void) { addvar(VAR_VALUE, "subdriver", "Serial-over-USB subdriver selection"); - nut_usb_addvars(); + addvar(VAR_VALUE, "vendorid", "Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal)"); + addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); + + addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); + addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); + addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); + + addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); addvar(VAR_VALUE, "langid_fix", "Apply the language ID workaround to the krauler subdriver (0x409 or 0x4095)"); @@ -581,12 +505,22 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { #ifndef TESTING + const struct { + const char *name; + int (*command)(const char *cmd, char *buf, size_t buflen); + } subdriver[] = { + { "cypress", &cypress_command }, + { "phoenix", &phoenix_command }, + { "ippon", &ippon_command }, + { "krauler", &krauler_command }, + { NULL } + }; + int ret, langid; char tbuf[255]; /* Some devices choke on size > 255 */ - char *regex_array[7]; - char *subdrv = getval("subdriver"); + char *regex_array[6]; - warn_if_bad_usb_port_filename(device_path); + char *subdrv = getval("subdriver"); regex_array[0] = getval("vendorid"); regex_array[1] = getval("productid"); @@ -594,17 +528,14 @@ void upsdrv_initups(void) regex_array[3] = getval("product"); regex_array[4] = getval("serial"); regex_array[5] = getval("bus"); - regex_array[6] = getval("device"); /* check for language ID workaround (#1) */ if (getval("langid_fix")) { /* skip "0x" prefix and set back to hexadecimal */ - unsigned int u_langid_fix; - if ( (sscanf(getval("langid_fix") + 2, "%x", &u_langid_fix) != 1) || (u_langid_fix > INT_MAX) ) { + if (sscanf(getval("langid_fix") + 2, "%x", &langid_fix) != 1) { upslogx(LOG_NOTICE, "Error enabling language ID workaround"); } else { - langid_fix = (int)u_langid_fix; upsdebugx(2, "language ID workaround enabled (using '0x%x')", langid_fix); } } @@ -654,7 +585,7 @@ void upsdrv_initups(void) "and make sure you have an up-to-date version of NUT. If this does not help,\n" "try running the driver with at least 'subdriver', 'vendorid' and 'productid'\n" "options specified. Please refer to the man page for details about these options\n" - "(man 8 blazer_usb).\n"); + "(man 8 blazer).\n"); } if (!subdriver_command) { @@ -683,13 +614,13 @@ void upsdrv_initups(void) * in the descriptor. See USB 2.0 specification, section 9.6.7, for * more information on this. * This should allow automatic application of the workaround */ - ret = usb_get_string(udev, 0, 0, (usb_ctrl_charbuf)tbuf, sizeof(tbuf)); + ret = usb_get_string(udev, 0, 0, tbuf, sizeof(tbuf)); if (ret >= 4) { - langid = (unsigned char)tbuf[2] | ((unsigned char)tbuf[3] << 8); + langid = tbuf[2] | (tbuf[3] << 8); upsdebugx(1, "First supported language ID: 0x%x (please report to the NUT maintainer!)", langid); } } -#endif /* TESTING */ +#endif blazer_initups(); } @@ -710,6 +641,5 @@ void upsdrv_cleanup(void) free(usbdevice.Product); free(usbdevice.Serial); free(usbdevice.Bus); - free(usbdevice.Device); -#endif /* TESTING */ +#endif } diff --git a/drivers/clone-outlet.c b/drivers/clone-outlet.c index 127909c..99d150c 100644 --- a/drivers/clone-outlet.c +++ b/drivers/clone-outlet.c @@ -20,14 +20,13 @@ #include "main.h" #include "parseconf.h" -#include "nut_stdint.h" #include #include #include #define DRIVER_NAME "clone outlet UPS Driver" -#define DRIVER_VERSION "0.02" +#define DRIVER_VERSION "0.01" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -67,7 +66,7 @@ static int dumpdone = 0; static PCONF_CTX_t sock_ctx; static time_t last_heard = 0, last_ping = 0, last_connfail = 0; -static int parse_args(size_t numargs, char **arg) +static int parse_args(int numargs, char **arg) { if (numargs < 1) { return 0; @@ -143,28 +142,13 @@ static int parse_args(size_t numargs, char **arg) static int sstate_connect(void) { - ssize_t ret; - int fd, len; + int ret, fd; const char *dumpcmd = "DUMPALL\n"; struct sockaddr_un sa; memset(&sa, '\0', sizeof(sa)); sa.sun_family = AF_UNIX; - len = snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/%s", dflt_statepath(), device_path); - - if (len < 0) { - fatalx(EXIT_FAILURE, "Can't create a unix domain socket: " - "failed to prepare the pathname"); - } - if ((uintmax_t)len >= (uintmax_t)sizeof(sa.sun_path)) { - fatalx(EXIT_FAILURE, - "Can't create a unix domain socket: pathname '%s/%s' " - "is too long (%zu) for 'struct sockaddr_un->sun_path' " - "on this system (%zu)", - dflt_statepath(), device_path, - strlen(dflt_statepath()) + 1 + strlen(device_path), - sizeof(sa.sun_path)); - } + snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/%s", dflt_statepath(), device_path); fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -247,7 +231,7 @@ static void sstate_disconnect(void) static int sstate_sendline(const char *buf) { - ssize_t ret; + int ret; if (upsfd < 0) { return -1; /* failed */ @@ -266,8 +250,7 @@ static int sstate_sendline(const char *buf) static int sstate_readline(void) { - int i; - ssize_t ret; + int i, ret; char buf[SMALLBUF]; if (upsfd < 0) { diff --git a/drivers/clone.c b/drivers/clone.c index 00a95b4..c8beb83 100644 --- a/drivers/clone.c +++ b/drivers/clone.c @@ -18,18 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" #include "main.h" #include "parseconf.h" -#include "attribute.h" -#include "nut_stdint.h" #include #include #include #define DRIVER_NAME "Clone UPS driver" -#define DRIVER_VERSION "0.03" +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -42,8 +39,8 @@ upsdrv_info_t upsdrv_info = { static struct { struct { - long start; - long shutdown; + int start; + int shutdown; } timer; char status[ST_MAX_VALUE_LEN]; } ups = { { -1, -1 }, "WAIT" }; @@ -60,7 +57,7 @@ static struct { } battery = { { 0, 0 }, { 0, 0 } }; static int dumpdone = 0, online = 1, outlet = 1; -static long offdelay = 120, ondelay = 30; +static int offdelay = 120, ondelay = 30; static PCONF_CTX_t sock_ctx; static time_t last_poll = 0, last_heard = 0, @@ -69,7 +66,7 @@ static time_t last_poll = 0, last_heard = 0, static int instcmd(const char *cmdname, const char *extra); -static int parse_args(size_t numargs, char **arg) +static int parse_args(int numargs, char **arg) { if (numargs < 1) { return 0; @@ -159,28 +156,13 @@ static int parse_args(size_t numargs, char **arg) static int sstate_connect(void) { - ssize_t ret; - int fd, len; + int ret, fd; const char *dumpcmd = "DUMPALL\n"; struct sockaddr_un sa; memset(&sa, '\0', sizeof(sa)); sa.sun_family = AF_UNIX; - len = snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/%s", dflt_statepath(), device_path); - - if (len < 0) { - fatalx(EXIT_FAILURE, "Can't create a unix domain socket: " - "failed to prepare the pathname"); - } - if ((uintmax_t)len >= (uintmax_t)sizeof(sa.sun_path)) { - fatalx(EXIT_FAILURE, - "Can't create a unix domain socket: pathname '%s/%s' " - "is too long (%zu) for 'struct sockaddr_un->sun_path' " - "on this system (%zu)", - dflt_statepath(), device_path, - strlen(dflt_statepath()) + 1 + strlen(device_path), - sizeof(sa.sun_path)); - } + snprintf(sa.sun_path, sizeof(sa.sun_path), "%s/%s", dflt_statepath(), device_path); fd = socket(AF_UNIX, SOCK_STREAM, 0); @@ -263,7 +245,7 @@ static void sstate_disconnect(void) static int sstate_sendline(const char *buf) { - ssize_t ret; + int ret; if (upsfd < 0) { return -1; /* failed */ @@ -282,8 +264,7 @@ static int sstate_sendline(const char *buf) static int sstate_readline(void) { - int i; - ssize_t ret; + int i, ret; char buf[SMALLBUF]; if (upsfd < 0) { @@ -400,7 +381,7 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -453,11 +434,11 @@ void upsdrv_initinfo(void) battery.runtime.low = strtod(val, NULL); } - dstate_setinfo("ups.delay.shutdown", "%ld", offdelay); - dstate_setinfo("ups.delay.start", "%ld", ondelay); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); + dstate_setinfo("ups.delay.start", "%d", ondelay); - dstate_setinfo("ups.timer.shutdown", "%ld", ups.timer.shutdown); - dstate_setinfo("ups.timer.start", "%ld", ups.timer.start); + dstate_setinfo("ups.timer.shutdown", "%d", ups.timer.shutdown); + dstate_setinfo("ups.timer.start", "%d", ups.timer.start); upsh.instcmd = instcmd; upsh.setvar = setvar; @@ -532,16 +513,13 @@ void upsdrv_updateinfo(void) } } - dstate_setinfo("ups.timer.shutdown", "%ld", ups.timer.shutdown); - dstate_setinfo("ups.timer.start", "%ld", ups.timer.start); + dstate_setinfo("ups.timer.shutdown", "%d", ups.timer.shutdown); + dstate_setinfo("ups.timer.start", "%d", ups.timer.start); last_poll = now; } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { fatalx(EXIT_FAILURE, "shutdown not supported"); diff --git a/drivers/compaq-mib.c b/drivers/compaq-mib.c index 114299a..febb9c0 100644 --- a/drivers/compaq-mib.c +++ b/drivers/compaq-mib.c @@ -30,10 +30,12 @@ #include "compaq-mib.h" -#define CPQPOWER_MIB_VERSION "1.66" +#define CPQPOWER_MIB_VERSION "1.5" -#define DEFAULT_ONDELAY "30" -#define DEFAULT_OFFDELAY "20" +#define DEFAULT_ONDELAY 30 +#define DEFAULT_OFFDELAY 20 +#define STR_DEFAULT_ONDELAY "30" +#define STR_DEFAULT_OFFDELAY "20" /* Note: RFC-1628 (UPS MIB) is also supported on these devices! */ @@ -80,91 +82,86 @@ #define CPQPOWER_OID_ALARM_OB ".1.3.6.1.4.1.232.165.3.7.3.0" /* UPS-MIB::upsOnBattery */ #define CPQPOWER_OID_ALARM_LB ".1.3.6.1.4.1.232.165.3.7.4.0" /* UPS-MIB::upsLowBattery */ -#define IETF_OID_AGENTREV ".1.3.6.1.2.1.33.1.1.4.0" /* UPS-MIB::upsIdentAgentSoftwareVersion.0 */ -/* Not used, as no longer supported by MIB ver. 1.76 (Github issue 118) static info_lkp_t cpqpower_alarm_ob[] = { - { 1, "OB", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; -*/ + { 1, "OB" }, + { 0, "NULL" } +} ; -/* Not used, as no longer supported by MIB ver. 1.76 (Github issue 118) static info_lkp_t cpqpower_alarm_lb[] = { - { 1, "LB", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; -*/ + { 1, "LB" }, + { 0, "NULL" } +} ; /* Defines for CPQPOWER_OID_POWER_STATUS (1) */ static info_lkp_t cpqpower_pwr_info[] = { - { 1, "" /* other */, NULL, NULL }, - { 2, "OFF" /* none */, NULL, NULL }, - { 3, "OL" /* normal */, NULL, NULL }, - { 4, "OL BYPASS" /* bypass */, NULL, NULL }, - { 5, "OB" /* battery */, NULL, NULL }, - { 6, "OL BOOST" /* booster */, NULL, NULL }, - { 7, "OL TRIM" /* reducer */, NULL, NULL }, - { 8, "OL" /* parallelCapacity */, NULL, NULL }, - { 9, "OL" /* parallelRedundant */, NULL, NULL }, - { 10, "OL" /* HighEfficiencyMode */, NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" /* other */ }, + { 2, "OFF" /* none */ }, + { 3, "OL" /* normal */ }, + { 4, "OL BYPASS" /* bypass */ }, + { 5, "OB" /* battery */ }, + { 6, "OL BOOST" /* booster */ }, + { 7, "OL TRIM" /* reducer */ }, + { 8, "OL" /* parallelCapacity */ }, + { 9, "OL" /* parallelRedundant */ }, + { 10, "OL" /* HighEfficiencyMode */ }, + { 0, "NULL" } } ; static info_lkp_t cpqpower_mode_info[] = { - { 1, "", NULL, NULL }, - { 2, "", NULL, NULL }, - { 3, "normal", NULL, NULL }, - { 4, "", NULL, NULL }, - { 5, "", NULL, NULL }, - { 6, "", NULL, NULL }, - { 7, "", NULL, NULL }, - { 8, "parallel capacity", NULL, NULL }, - { 9, "parallel redundancy", NULL, NULL }, - {10, "high efficiency", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" }, + { 2, "" }, + { 3, "normal" }, + { 4, "" }, + { 5, "" }, + { 6, "" }, + { 7, "" }, + { 8, "parallel capacity" }, + { 9, "parallel redundancy" }, + {10, "high efficiency" }, + { 0, "NULL" } }; static info_lkp_t cpqpower_battery_abm_status[] = { - { 1, "CHRG", NULL, NULL }, - { 2, "DISCHRG", NULL, NULL }, -/* { 3, "Floating", NULL, NULL }, */ -/* { 4, "Resting", NULL, NULL }, */ -/* { 5, "Unknown", NULL, NULL }, */ - { 0, NULL, NULL, NULL } + { 1, "CHRG" }, + { 2, "DISCHRG" }, +/* { 3, "Floating" }, */ +/* { 4, "Resting" }, */ +/* { 5, "Unknown" }, */ + { 0, "NULL" } } ; /* Defines for CPQPOWER_OID_UPS_TEST_RES */ static info_lkp_t cpqpower_test_res_info[] = { - { 1, "Unknown", NULL, NULL }, - { 2, "Done and passed", NULL, NULL }, - { 3, "Done and error", NULL, NULL }, - { 4, "In progress", NULL, NULL }, - { 5, "Not supported", NULL, NULL }, - { 6, "Inhibited", NULL, NULL }, - { 7, "Scheduled", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Unknown" }, + { 2, "Done and passed" }, + { 3, "Done and error" }, + { 4, "In progress" }, + { 5, "Not supported" }, + { 6, "Inhibited" }, + { 7, "Scheduled" }, + { 0, "NULL" } } ; -#define CPQPOWER_START_TEST "1" +#define CPQPOWER_START_TEST 1 static info_lkp_t cpqpower_outlet_status_info[] = { - { 1, "on", NULL, NULL }, - { 2, "off", NULL, NULL }, - { 3, "pendingOff", NULL, NULL }, /* transitional status */ - { 4, "pendingOn", NULL, NULL }, /* transitional status */ - { 5, "unknown", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "on" }, + { 2, "off" }, + { 3, "pendingOff" }, /* transitional status */ + { 4, "pendingOn" }, /* transitional status */ + { 5, "unknown" }, + { 0, NULL } }; /* Ugly hack: having the matching OID present means that the outlet is * switchable. So, it should not require this value lookup */ static info_lkp_t cpqpower_outlet_switchability_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "yes", NULL, NULL }, - { 3, "yes", NULL, NULL }, - { 4, "yes", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "yes" }, + { 2, "yes" }, + { 3, "yes" }, + { 4, "yes" }, + { 0, NULL } }; #define CPQPOWER_OID_SD_AFTER_DELAY ".1.3.6.1.4.1.232.165.3.8.1.0" /* UPS-MIB::upsControlOutputOffDelay */ @@ -173,12 +170,6 @@ static info_lkp_t cpqpower_outlet_switchability_info[] = { /* Snmp2NUT lookup table */ static snmp_info_t cpqpower_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* UPS page */ /* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_MFR_NAME, "HP/Compaq", SU_FLAG_STATIC, NULL }, @@ -188,9 +179,7 @@ static snmp_info_t cpqpower_mib[] = { /* FIXME: split between firmware and firmware.aux ("00.01.0019;00.01.0004") * UPS Firmware Revision : 00.01.0004 * Communication Board Firmware Revision : 00.01.0019 */ - /* FIXME: the 2 "firmware" entries below should be SU_FLAG_SEMI_STATIC */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_FIRMREV, "", 0, NULL }, - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_AGENTREV, "", 0, NULL }, + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_FIRMREV, "", SU_FLAG_STATIC, NULL }, { "ups.load", 0, 1.0, CPQPOWER_OID_LOAD_LEVEL, "", 0, NULL }, { "ups.realpower", 0, 1.0, CPQPOWER_OID_OUT_POWER, "", SU_OUTPUT_1, NULL }, { "ups.realpower", 0, 1.0, ".1.3.6.1.4.1.232.165.3.9.3.0", "", SU_OUTPUT_1, NULL }, @@ -199,10 +188,9 @@ static snmp_info_t cpqpower_mib[] = { { "ups.L3.realpower", 0, 0.1, CPQPOWER_OID_OUT_POWER ".3", "", SU_OUTPUT_3, NULL }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_POWER_STATUS, "OFF", SU_STATUS_PWR, cpqpower_pwr_info }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_BATT_STATUS, "", SU_STATUS_PWR, cpqpower_battery_abm_status }, - /* The next two lines are no longer supported by MIB ver. 1.76 (Github issue 118) - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_OB, "", SU_STATUS_BATT, cpqpower_alarm_ob }, - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_LB, "", SU_STATUS_BATT, cpqpower_alarm_lb }, */ - /* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", SU_STATUS_BATT, ietf_batt_info }, */ + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_OB, "", SU_STATUS_BATT, cpqpower_alarm_ob }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_ALARM_LB, "", SU_STATUS_BATT, cpqpower_alarm_lb }, +/* { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_BATT_STATUS, "", SU_STATUS_BATT, ietf_batt_info }, */ /* FIXME: this should use either .1.3.6.1.4.1.232.165.3.11.1.0 (upsTopologyType) * or .1.3.6.1.4.1.232.165.3.11.2.0 (upsTopoMachineCode) */ { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, CPQPOWER_OID_POWER_STATUS, "", SU_STATUS_PWR, cpqpower_mode_info }, @@ -220,8 +208,8 @@ static snmp_info_t cpqpower_mib[] = { * flywheel(7) * fuelcell(8) */ - { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.1.0", DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.2.0", DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.1.0", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.8.2.0", STR_DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "ups.timer.shutdown", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_FLAG_OK, NULL }, { "ups.timer.start", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_FLAG_OK, NULL }, @@ -239,7 +227,7 @@ static snmp_info_t cpqpower_mib[] = { { "battery.status", 0, 0.1, ".1.3.6.1.4.1.232.165.3.2.5.0", "", 0, NULL }, */ /* Input page */ - { "input.phases", 0, 1.0, CPQPOWER_OID_IN_LINES, "", 0, NULL }, + { "input.phases", 0, 1.0, CPQPOWER_OID_IN_LINES, "", SU_FLAG_SETINT, NULL, &input_phases }, /* { "input.phase", 0, 1.0, CPQPOWER_OID_IN_PHASE, "", SU_OUTPUT_1, NULL }, */ { "input.frequency", 0, 0.1, CPQPOWER_OID_IN_FREQ , "", 0, NULL }, { "input.voltage", 0, 1.0, CPQPOWER_OID_IN_VOLTAGE, "", SU_OUTPUT_1, NULL }, @@ -261,7 +249,7 @@ static snmp_info_t cpqpower_mib[] = { { "input.quality", 0, 1.0, CPQPOWER_OID_IN_LINEBADS, "", 0, NULL }, /* Output page */ - { "output.phases", 0, 1.0, CPQPOWER_OID_OUT_LINES, "", 0, NULL }, + { "output.phases", 0, 1.0, CPQPOWER_OID_OUT_LINES, "", SU_FLAG_SETINT, NULL, &output_phases }, /* { "output.phase", 0, 1.0, CPQPOWER_OID_OUT_PHASE, "", SU_OUTPUT_1, NULL }, */ { "output.frequency", 0, 0.1, CPQPOWER_OID_OUT_FREQUENCY, "", 0, NULL }, /* FIXME: handle multiplier (0.1 there) */ @@ -298,42 +286,42 @@ static snmp_info_t cpqpower_mib[] = { /* outlet template definition */ /* FIXME always true? */ - { "outlet.%i.switchable", ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, &cpqpower_outlet_switchability_info[0] }, - { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL }, - /* { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_NAME ".%i", NULL, SU_OUTLET, NULL }, */ - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.3.10.2.1.2.%i", NULL, SU_FLAG_OK | SU_OUTLET, &cpqpower_outlet_status_info[0] }, + { "outlet.%i.switchable", ST_FLAG_STRING, 3, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, &cpqpower_outlet_switchability_info[0], NULL }, + { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.1.%i", "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + /* { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_NAME ".%i", NULL, SU_OUTLET, NULL, NULL }, */ + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.3.10.2.1.2.%i", NULL, SU_FLAG_OK | SU_OUTLET, &cpqpower_outlet_status_info[0], NULL }, /* FIXME: come up with a suitable varname! * - The delay after going On Battery until the Receptacle is automatically turned Off. * A value of -1 means that this Output should never be turned Off automatically, but must be turned Off only by command. - * { "outlet.%i.autoswitch.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOffDelay + * { "outlet.%i.autoswitch.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOffDelay * - Seconds delay after the Outlet is signaled to turn On before the Output is Automatically turned ON. * A value of -1 means that this Output should never be turned On automatically, but only when specifically commanded to do so. - * { "outlet.%i.autoswitch.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOnDelay + * { "outlet.%i.autoswitch.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, ".1.3.6.1.4.1.232.165.3.10.2.1.5.%i", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, // upsRecepAutoOnDelay */ /* FIXME: also define .stop (as for 'shutdown.reboot') * and .delay */ - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.3.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.4.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL }, + { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.3.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.4.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, /* FIXME: also define a .delay or map to "outlet.%i.delay.shutdown" */ - { "outlet.%i.load.cycle", 0, 1, ".1.3.6.1.4.1.232.165.3.10.2.1.7.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL }, + { "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.232.165.3.10.2.1.7.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, /* instant commands. */ /* We need to duplicate load.{on,off} Vs load.{on,off}.delay, since * "0" cancels the shutdown, so we put "1" (second) for immediate off! */ - { "load.off", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "1", SU_TYPE_CMD, NULL }, - { "load.on", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", "1", SU_TYPE_CMD, NULL }, - { "shutdown.stop", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "0", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "load.off", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD, NULL }, + { "load.on", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_TYPE_CMD, NULL }, + { "shutdown.stop", 0, 0, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* FIXME: need ups.{timer,delay}.{start,shutdown} param counterparts! */ - { "load.off.delay", 0, 1, ".1.3.6.1.4.1.232.165.3.8.1.0", DEFAULT_OFFDELAY, SU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 1, ".1.3.6.1.4.1.232.165.3.8.2.0", DEFAULT_ONDELAY, SU_TYPE_CMD, NULL }, + { "load.off.delay", 0, DEFAULT_OFFDELAY, ".1.3.6.1.4.1.232.165.3.8.1.0", "", SU_TYPE_CMD, NULL }, + { "load.on.delay", 0, DEFAULT_ONDELAY, ".1.3.6.1.4.1.232.165.3.8.2.0", "", SU_TYPE_CMD, NULL }, /* { CMD_SHUTDOWN, 0, CPQPOWER_OFF_GRACEFUL, CPQPOWER_OID_OFF, "", 0, NULL }, */ - { "shutdown.reboot", 0, 1, ".1.3.6.1.4.1.232.165.3.8.6.0", "0", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "test.battery.start", 0, 1, ".1.3.6.1.4.1.232.165.3.7.1.0", CPQPOWER_START_TEST, SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "shutdown.reboot", 0, 0, ".1.3.6.1.4.1.232.165.3.8.6.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.battery.start", 0, CPQPOWER_START_TEST, ".1.3.6.1.4.1.232.165.3.7.1.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, NULL, CPQPOWER_OID_MFR_NAME, cpqpower_mib, CPQPOWER_SYSOID, NULL }; +mib2nut_info_t compaq = { "cpqpower", CPQPOWER_MIB_VERSION, "", CPQPOWER_OID_MFR_NAME, cpqpower_mib, CPQPOWER_SYSOID }; diff --git a/drivers/cps-hid.c b/drivers/cps-hid.c index 71f9a5b..a6d64ba 100644 --- a/drivers/cps-hid.c +++ b/drivers/cps-hid.c @@ -24,107 +24,54 @@ */ #include "main.h" /* for getval() */ -#include "nut_float.h" -#include "hidparser.h" /* for FindObject_with_ID_Node() */ #include "usbhid-ups.h" #include "cps-hid.h" #include "usb-common.h" -#define CPS_HID_VERSION "CyberPower HID 0.6" +#define CPS_HID_VERSION "CyberPower HID 0.3" /* Cyber Power Systems */ #define CPS_VENDORID 0x0764 -/* Values for correcting the HID on some models - * where LogMin and LogMax are set incorrectly in the HID. - */ -#define CPS_VOLTAGE_LOGMIN 0 -#define CPS_VOLTAGE_LOGMAX 511 /* Includes safety margin. */ - -/*! Battery voltage scale factor. +/* * For some devices, the reported battery voltage is off by factor * of 1.5 so we need to apply a scale factor to it to get the real * battery voltage. By default, the factor is 1 (no scaling). */ static double battery_scale = 1; -static int might_need_battery_scale = 0; -static int battery_scale_checked = 0; - -/*! If the ratio of the battery voltage to the nominal battery voltage exceeds - * this factor, we assume that the battery voltage needs to be scaled by 2/3. - */ -static const double battery_voltage_sanity_check = 1.4; static void *cps_battery_scale(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - - might_need_battery_scale = 1; + battery_scale = 0.667; return NULL; } /* USB IDs device table */ static usb_device_id_t cps_usb_device_table[] = { - /* 900AVR/BC900D */ + /* 900AVR/BC900D, CP1200AVR/BC1200D */ { USB_DEVICE(CPS_VENDORID, 0x0005), NULL }, - /* Dynex DX-800U?, CP1200AVR/BC1200D, CP825AVR-G, CP1000AVRLCD, CP1000PFCLCD, CP1500C, CP550HG, etc. */ + /* Dynex DX-800U? */ { USB_DEVICE(CPS_VENDORID, 0x0501), &cps_battery_scale }, /* OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U */ { USB_DEVICE(CPS_VENDORID, 0x0601), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; -/*! Adjusts @a battery_scale if voltage is well above nominal. - */ -static void cps_adjust_battery_scale(double batt_volt) -{ - const char *batt_volt_nom_str; - double batt_volt_nom; - - if(battery_scale_checked) { - return; - } - - batt_volt_nom_str = dstate_getinfo("battery.voltage.nominal"); - if(!batt_volt_nom_str) { - upsdebugx(2, "%s: 'battery.voltage.nominal' not available yet; skipping scale determination", __func__); - return; - } - - batt_volt_nom = strtod(batt_volt_nom_str, NULL); - if(d_equal(batt_volt_nom, 0)) { - upsdebugx(3, "%s: 'battery.voltage.nominal' is %s", __func__, batt_volt_nom_str); - return; - } - - if( (batt_volt / batt_volt_nom) > battery_voltage_sanity_check ) { - upslogx(LOG_INFO, "%s: battery readings will be scaled by 2/3", __func__); - battery_scale = 2.0/3; - } - - battery_scale_checked = 1; -} - /* returns statically allocated string - must not use it again before done with result! */ static const char *cps_battvolt_fun(double value) { static char buf[8]; - if(might_need_battery_scale) { - cps_adjust_battery_scale(value); - } - - upsdebugx(5, "%s: battery_scale = %.3f", __func__, battery_scale); snprintf(buf, sizeof(buf), "%.1f", battery_scale * value); return buf; } static info_lkp_t cps_battvolt[] = { - { 0, NULL, &cps_battvolt_fun, NULL } + { 0, NULL, &cps_battvolt_fun } }; /* returns statically allocated string - must not use it again before @@ -140,7 +87,7 @@ static const char *cps_battcharge_fun(double value) } static info_lkp_t cps_battcharge[] = { - { 0, NULL, &cps_battcharge_fun, NULL } + { 0, NULL, &cps_battcharge_fun } }; /* --------------------------------------------------------------- */ @@ -203,14 +150,12 @@ static hid_info_t cps_hid2nut[] = { { "BOOL", 0, 0, "UPS.Output.Overload", NULL, NULL, 0, overload_info }, /* Input page */ - { "input.frequency", 0, 0, "UPS.Input.Frequency", NULL, "%.1f", 0, NULL }, { "input.voltage.nominal", 0, 0, "UPS.Input.ConfigVoltage", NULL, "%.0f", 0, NULL }, { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.1f", 0, NULL }, { "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, { "input.transfer.high", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, /* Output page */ - { "output.frequency", 0, 0, "UPS.Output.Frequency", NULL, "%.1f", 0, NULL }, { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.1f", 0, NULL }, { "output.voltage.nominal", 0, 0, "UPS.Output.ConfigVoltage", NULL, "%.0f", 0, NULL }, @@ -269,62 +214,6 @@ static int cps_claim(HIDDevice_t *hd) { } } -/* CPS Models like CP900EPFCLCD return a syntactically legal but incorrect - * Report Descriptor whereby the Input High Transfer Max/Min values - * are used for the Output Voltage Usage Item limits. - * Additionally the Input Voltage LogMax is set incorrectly for EU models. - * This corrects them by finding and applying fixed - * voltage limits as being more appropriate. - */ - -static int cps_fix_report_desc(HIDDevice_t *pDev, HIDDesc_t *pDesc_arg) { - HIDData_t *pData; - - int vendorID = pDev->VendorID; - int productID = pDev->ProductID; - if (vendorID != CPS_VENDORID || productID != 0x0501) { - return 0; - } - - upsdebugx(3, "Attempting Report Descriptor fix for UPS: Vendor: %04x, Product: %04x", vendorID, productID); - - /* Apply the fix cautiously by looking for input voltage, high voltage transfer and output voltage report usages. - * If the output voltage log min/max equals high voltage transfer log min/max then the bug is present. - * To fix it Set both the input and output voltages to pre-defined settings. - */ - - if ((pData=FindObject_with_ID_Node(pDesc_arg, 16, USAGE_POW_HIGH_VOLTAGE_TRANSFER))) { - long hvt_logmin = pData->LogMin; - long hvt_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: hvt input LogMin: %ld LogMax: %ld", hvt_logmin, hvt_logmax); - - if ((pData=FindObject_with_ID_Node(pDesc_arg, 18, USAGE_POW_VOLTAGE))) { - long output_logmin = pData->LogMin; - long output_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: output LogMin: %ld LogMax: %ld", - output_logmin, output_logmax); - - if (hvt_logmin == output_logmin && hvt_logmax == output_logmax) { - pData->LogMin = CPS_VOLTAGE_LOGMIN; - pData->LogMax = CPS_VOLTAGE_LOGMAX; - upsdebugx(3, "Fixing Report Descriptor. Set Output Voltage LogMin = %d, LogMax = %d", - CPS_VOLTAGE_LOGMIN , CPS_VOLTAGE_LOGMAX); - if ((pData=FindObject_with_ID_Node(pDesc_arg, 15, USAGE_POW_VOLTAGE))) { - long input_logmin = pData->LogMin; - long input_logmax = pData->LogMax; - upsdebugx(4, "Report Descriptor: input LogMin: %ld LogMax: %ld", - input_logmin, input_logmax); - upsdebugx(3, "Fixing Report Descriptor. Set Input Voltage LogMin = %d, LogMax = %d", - CPS_VOLTAGE_LOGMIN , CPS_VOLTAGE_LOGMAX); - } - - return 1; - } - } - } - return 0; -} - subdriver_t cps_subdriver = { CPS_HID_VERSION, cps_claim, @@ -333,5 +222,4 @@ subdriver_t cps_subdriver = { cps_format_model, cps_format_mfr, cps_format_serial, - cps_fix_report_desc, }; diff --git a/drivers/cyberpower-mib.c b/drivers/cyberpower-mib.c index aa43295..e2d81cd 100644 --- a/drivers/cyberpower-mib.c +++ b/drivers/cyberpower-mib.c @@ -1,7 +1,7 @@ /* cyberpower-mib.c - data to monitor Cyberpower RMCARD * * Copyright (C) 2010 - Eric Schultz - * + * * derived (i.e. basically copied and modified) of bestpower by: * Copyright (C) 2010 - Arnaud Quette * @@ -24,153 +24,58 @@ #include "cyberpower-mib.h" -#define CYBERPOWER_MIB_VERSION "0.51" +#define CYBERPOWER_MIB_VERSION "0.1" #define CYBERPOWER_OID_MODEL_NAME ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" -/* CPS-MIB::ups */ -#define CYBERPOWER_SYSOID ".1.3.6.1.4.1.3808.1.1.1" +#define CYBERPOWER_SYSOID ".1.3.6.1.4.1.3808" -/* https://www.cyberpowersystems.com/products/software/mib-files/ */ -/* Per CPS MIB 2.9 upsBaseOutputStatus OBJECT-TYPE: */ static info_lkp_t cyberpower_power_status[] = { - { 1, "NULL", NULL, NULL }, /* unknown */ - { 2, "OL", NULL, NULL }, /* onLine */ - { 3, "OB", NULL, NULL }, /* onBattery */ - { 4, "OL BOOST", NULL, NULL }, /* onBoost */ - { 5, "OFF", NULL, NULL }, /* onSleep */ - { 6, "OFF", NULL, NULL }, /* off */ - { 7, "OL", NULL, NULL }, /* rebooting */ - { 8, "OL", NULL, NULL }, /* onECO */ - { 9, "OL BYPASS", NULL, NULL }, /* onBypass */ - { 10, "OL TRIM", NULL, NULL }, /* onBuck */ - { 11, "OL OVER", NULL, NULL }, /* onOverload */ - { 0, NULL, NULL, NULL } + { 2, "OL" }, + { 3, "OB" }, + { 4, "OL" }, + { 5, "OL" }, + { 7, "OL" }, + { 1, "NULL" }, + { 6, "NULL" }, + { 0, "NULL" } } ; -static info_lkp_t cyberpower_battery_status[] = { - { 1, "", NULL, NULL }, /* unknown */ - { 2, "", NULL, NULL }, /* batteryNormal */ - { 3, "LB", NULL, NULL }, /* batteryLow */ - { 0, NULL, NULL, NULL } -} ; - -static info_lkp_t cyberpower_cal_status[] = { - { 1, "", NULL, NULL }, /* Calibration Successful */ - { 2, "", NULL, NULL }, /* Calibration Invalid */ - { 3, "CAL", NULL, NULL }, /* Calibration in progress */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t cyberpower_battrepl_status[] = { - { 1, "", NULL, NULL }, /* No battery needs replacing */ - { 2, "RB", NULL, NULL }, /* Batteries need to be replaced */ - { 0, NULL, NULL, NULL } -}; - /* Snmp2NUT lookup table for CyberPower MIB */ static snmp_info_t cyberpower_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* Device page */ { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ups", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "CYBERPOWER", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, CYBERPOWER_OID_MODEL_NAME, - "CyberPower", SU_FLAG_STATIC, NULL }, + "CyberPower", SU_FLAG_STATIC, NULL, NULL }, { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.3.0", "", SU_FLAG_STATIC, NULL }, { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.1.0", - "", SU_FLAG_STATIC, NULL }, + "", SU_FLAG_STATIC, NULL }, { "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.1.2.2.0", "", 0, NULL }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.4.1.1.0", "", - SU_FLAG_OK | SU_STATUS_PWR, &cyberpower_power_status[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.2.1.1.0", "", - SU_FLAG_OK | SU_STATUS_BATT, &cyberpower_battery_status[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.7.2.7.0", "", - SU_FLAG_OK | SU_STATUS_CAL, &cyberpower_cal_status[0] }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.3808.1.1.1.2.2.5.0", "", - SU_FLAG_OK | SU_STATUS_RB, &cyberpower_battrepl_status[0] }, - { "ups.load", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.4.2.3.0", "", - 0, NULL }, + 0 /*SU_STATUS_PWR*/, &cyberpower_power_status[0] }, - /* Battery runtime is expressed in seconds */ - { "battery.runtime", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.4.0", "", + /* Battery runtime is expressed in minutes */ + { "battery.runtime", 0, 60.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.4.0", "", 0, NULL }, /* The elapsed time in seconds since the * UPS has switched to battery power */ { "battery.runtime.elapsed", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.1.2.0", "", 0, NULL }, - /* Different generations/models reported "battery.voltage" by different OIDs: */ - { "battery.voltage", 0, 0.1, ".1.3.6.1.2.1.33.1.2.5.0", "", - 0, NULL }, { "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.2.2.2.0", "", 0, NULL }, - { "battery.voltage.nominal", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.8.0", "", - 0, NULL }, - /* Different generations/models reported "battery.current" by different OIDs: */ - { "battery.current", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.4.2.4.0", "", - 0, NULL }, { "battery.current", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.2.2.7.0", "", 0, NULL }, - { "battery.charge", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.1.0", "", - 0, NULL }, - { "battery.temperature", 0, 1.0, ".1.3.6.1.4.1.3808.1.1.1.2.2.3.0", "", - 0, NULL }, - - { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.3.2.1.0", "", - 0, NULL }, - { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.3.2.4.0", "", - 0, NULL }, - - { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.4.2.1.0", "", - 0, NULL }, - { "output.frequency", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.4.2.2.0", "", - 0, NULL }, - { "output.current", 0, 0.1, ".1.3.6.1.4.1.3808.1.1.1.4.2.4.0", "", - 0, NULL }, - - /* Delays affecting instant commands */ - - /* upsAdvanceConfigReturnDelay */ - { "ups.delay.start", ST_FLAG_RW, 1.0, ".1.3.6.1.4.1.3808.1.1.1.5.2.9.0", "0", - SU_FLAG_OK | SU_TYPE_TIME, NULL }, - /* Not provided by CPS-MIB */ - { "ups.delay.reboot", 0, 1.0, NULL, "0", - SU_FLAG_OK | SU_FLAG_ABSENT, NULL }, - /* upsAdvanceConfigSleepDelay */ - { "ups.delay.shutdown", ST_FLAG_RW, 1.0, ".1.3.6.1.4.1.3808.1.1.1.5.2.11.0", "60", - SU_FLAG_OK | SU_TYPE_TIME, NULL }, - /* instant commands. */ - /* upsAdvanceControlUpsOff */ - { "load.off", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.6.2.1.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceControlTurnOnUPS */ - { "load.on", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.6.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceControlUpsOff */ - { "shutdown.stayoff", 0, 3, ".1.3.6.1.4.1.3808.1.1.1.6.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceControlUpsSleep */ - { "shutdown.return", 0, 3, ".1.3.6.1.4.1.3808.1.1.1.6.2.3.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceControlSimulatePowerFail */ - { "test.failure.start", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.6.2.4.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceTestIndicators */ - { "test.panel.start", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.7.2.5.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceTestDiagnostics */ - { "test.battery.start", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.7.2.2.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* upsAdvanceTestRuntimeCalibration */ - { "calibrate.start", 0, 2, ".1.3.6.1.4.1.3808.1.1.1.7.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - { "calibrate.stop", 0, 3, ".1.3.6.1.4.1.3808.1.1.1.7.2.6.0", NULL, SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } } ; -mib2nut_info_t cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, NULL, - CYBERPOWER_OID_MODEL_NAME, cyberpower_mib, CYBERPOWER_SYSOID, NULL }; +mib2nut_info_t cyberpower = { "cyberpower", CYBERPOWER_MIB_VERSION, "", + CYBERPOWER_OID_MODEL_NAME, cyberpower_mib, CYBERPOWER_SYSOID }; diff --git a/drivers/delta_ups-hid.c b/drivers/delta_ups-hid.c deleted file mode 100644 index 49d5af9..0000000 --- a/drivers/delta_ups-hid.c +++ /dev/null @@ -1,323 +0,0 @@ -/* delta_ups-hid.c - data mapping subdriver to monitor Delta UPS USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2020 Luka Kovacic - * 2021 Jungeon Kim - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be first */ - -#include "usbhid-ups.h" -#include "delta_ups-hid.h" -#include "main.h" /* for getval() */ -#include "usb-common.h" - -#define DELTA_UPS_HID_VERSION "Delta UPS HID 0.6" - -/* Delta UPS */ -#define DELTA_UPS_VENDORID 0x05dd - -/* USB IDs device table */ -static usb_device_id_t delta_ups_usb_device_table[] = { - /* Delta RT Series, Single Phase, 1/2/3 kVA */ - /* Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA */ - { USB_DEVICE(DELTA_UPS_VENDORID, 0x041b), NULL }, - - /* Terminating entry */ - { 0, 0, NULL } -}; - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -/* DELTA usage table */ -static usage_lkp_t delta_ups_usage_lkp[] = { - { "DELTA1", 0x00000000 }, - { "DELTA2", 0xff000055 }, -/* { "DELTA3", 0xffff0010 }, */ - { "DeltaCustom", 0xffff0010 }, - { "DELTA4", 0xffff0056 }, -/* { "DELTA5", 0xffff0057 }, */ - { "DeltaConfigTransferLowMax", 0xffff0057 }, -/* { "DELTA6", 0xffff0058 }, */ - { "DeltaConfigTransferLowMin", 0xffff0058 }, -/* { "DELTA7", 0xffff0059 }, */ - { "DeltaConfigTransferHighMax", 0xffff0059 }, -/* { "DELTA8", 0xffff005a }, */ - { "DeltaConfigTransferHighMin", 0xffff005a }, - { "DELTA9", 0xffff0060 }, -/* { "DELTA10", 0xffff0061 }, */ - { "DeltaConfigExternalBatteryPack", 0xffff0061 }, - { "DELTA11", 0xffff0062 }, - { "DELTA12", 0xffff0063 }, - { "DELTA13", 0xffff0064 }, - { "DELTA14", 0xffff0065 }, - { "DELTA15", 0xffff0066 }, - { "DELTA16", 0xffff0067 }, - { "DELTA17", 0xffff0068 }, -/* { "DELTA18", 0xffff0075 }, */ - { "DeltaModelName", 0xffff0075 }, - { "DELTA19", 0xffff0076 }, -/* { "DELTA20", 0xffff007c }, */ - { "DeltaUPSType", 0xffff007c }, - { "DELTA21", 0xffff007d }, -/* { "DELTA22", 0xffff0081 }, */ - { "DeltaConfigStartPowerRestoreDelay", 0xffff0081 }, -/* { "DELTA23", 0xffff0091 }, */ - { "DeltaOutputSource", 0xffff0091 }, - { "DELTA24", 0xffff0092 }, - { "DELTA25", 0xffff0093 }, - { "DELTA26", 0xffff0094 }, - { "DELTA27", 0xffff0095 }, - { "DELTA28", 0xffff0096 }, - { "DELTA29", 0xffff0097 }, - { "DELTA30", 0xffff0098 }, - { "DELTA31", 0xffff0099 }, - { "DELTA32", 0xffff009a }, -/* { "DELTA33", 0xffff009b }, */ - { "DeltaConfigSensitivity", 0xffff009b }, -/* { "DELTA34", 0xffff009c }, */ - { "DeltaConfigStartPowerRestore", 0xffff009c }, - - /* Terminating entry */ - { NULL, 0 } -}; - -static usage_tables_t delta_ups_utab[] = { - delta_ups_usage_lkp, - hid_usage_lkp, - NULL, -}; - -/* --------------------------------------------------------------- */ -/* Helper lookup tables and mapping functions */ -/* --------------------------------------------------------------- */ - -static info_lkp_t delta_ups_sensitivity_info[] = { - { 0, "normal", NULL, NULL }, - { 1, "reduced", NULL, NULL }, - { 2, "low", NULL, NULL }, - - /* Terminating entry */ - { 0, NULL, NULL, NULL } -}; - -static const char *delta_ups_type_fun(double value) -{ - static const char* upstypes[] = { - "online", - "offline", - "line-interactive", - "3-phase", - "split-phase" - }; - - int type = (int)value & 0xf; - if (type == 6) { - type = 4; - } else if (2 < type && type <= 5) { - type -= 2; - } - - if (type < 0 || type > 4) { - return NULL; - } - - return upstypes[type]; -} - -static info_lkp_t delta_ups_type_info[] = { - { 0, NULL, delta_ups_type_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t delta_ups_output_source_info[] = { - { 0, "normal", NULL, NULL }, - { 1, "battery", NULL, NULL }, - { 2, "bypass/reserve", NULL, NULL }, - { 3, "reducing", NULL, NULL }, - { 4, "boosting", NULL, NULL }, - { 5, "manual bypass", NULL, NULL }, - { 6, "other", NULL, NULL }, - { 7, "no output", NULL, NULL }, - { 8, "on eco", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t delta_ups_hid2nut[] = { - { "input.sensitivity", ST_FLAG_RW, 0, "UPS.DeltaCustom.[1].DeltaConfigSensitivity", NULL, "%s", 0, delta_ups_sensitivity_info }, - { "input.voltage.nominal", 0, 0, "UPS.PowerSummary.Input.ConfigVoltage", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, - { "input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "input.transfer.low", ST_FLAG_RW, 0, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.1f", 0, NULL }, - { "input.transfer.high", ST_FLAG_RW, 0, "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.1f", 0, NULL }, - { "input.transfer.low.min", 0, 0, "UPS.PowerConverter.Output.DeltaConfigTransferLowMin", NULL, "%.1f", HU_FLAG_STATIC, NULL }, - { "input.transfer.low.max", 0, 0, "UPS.PowerConverter.Output.DeltaConfigTransferLowMax", NULL, "%.1f", HU_FLAG_STATIC, NULL }, - { "input.transfer.high.min", 0, 0, "UPS.PowerConverter.Output.DeltaConfigTransferHighMin", NULL, "%.1f", HU_FLAG_STATIC, NULL }, - { "input.transfer.high.max", 0, 0, "UPS.PowerConverter.Output.DeltaConfigTransferHighMax", NULL, "%.1f", HU_FLAG_STATIC, NULL }, - /* FIXME: Check vs hardware, is this an "input" or "outlet/outpu" value after all? */ - { "input.source", 0, 0, "UPS.OutletSystem.Outlet.DeltaOutputSource", NULL, "%s", 0, delta_ups_output_source_info }, - { "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - - { "battery.voltage.nominal", 0, 0, "UPS.BatterySystem.Battery.ConfigVoltage", NULL, "%.1f", HU_FLAG_STATIC, NULL }, - { "battery.voltage", 0, 0, "UPS.BatterySystem.Battery.Voltage", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - { "battery.charge", 0, 0, "UPS.BatterySystem.Battery.RemainingCapacity", NULL, "%.0f", 0, NULL }, - { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, -/* { "battery.charge.low", 0, 0, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, */ - { "battery.charge.warning", 0, 0, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "battery.temperature", 0, 0, "UPS.BatterySystem.Temperature", NULL, "%s", HU_FLAG_QUICK_POLL, kelvin_celsius_conversion }, - { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, - { "battery.capacity", 0, 0, "UPS.PowerSummary.DesignCapacity", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "battery.capacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - - { "output.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, - { "output.frequency.nominal", 0, 0, "UPS.Flow.ConfigFrequency", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - - { "ups.beeper.status", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", HU_FLAG_QUICK_POLL, beeper_info }, - { "ups.test.result", 0, 0, "UPS.BatterySystem.Test", NULL, "%s", 0, test_read_info }, - { "ups.type", 0, 0, "UPS.DeltaCustom.[1].DeltaUPSType", NULL, "%s", HU_FLAG_STATIC, delta_ups_type_info }, - { "ups.start.auto", ST_FLAG_RW, 0, "UPS.DeltaCustom.[1].DeltaConfigStartPowerRestore", NULL, "%s", 0, yes_no_info }, - { "ups.power.nominal", 0, 0, "UPS.Flow.ConfigApparentPower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "ups.realpower", 0, 0, "UPS.OutletSystem.Outlet.ActivePower", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - { "ups.load", 0, 0, "UPS.OutletSystem.Outlet.PercentLoad", NULL, "%.1f", HU_FLAG_QUICK_POLL, NULL }, - /* Per comments to PR #807 these 3 declarations are populated elsewhere, - * by delta_ups_format_*() functions hooks; see: - * https://github.com/networkupstools/nut/pull/807#discussion_r501496383 - */ -/* { "ups.mfr", 0, 0, "UPS.PowerSummary.iManufacturer", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, - { "ups.model", 0, 0, "UPS.PowerSummary.iProduct", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, - { "ups.serial", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, -*/ - { "ups.delay.start", ST_FLAG_RW, 0, "UPS.OutletSystem.Outlet.DeltaConfigStartPowerRestoreDelay", NULL, "%.0f", 0, NULL }, -/* mge-hid.c simlar configurable settings: - { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL }, - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL }, -... - { "ups.timer.shutdown", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, -*/ - { "ups.timer.start", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - { "ups.timer.shutdown", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - { "ups.timer.reboot", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, NULL, HU_FLAG_QUICK_POLL, off_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.InternalFailure", NULL, NULL, HU_FLAG_QUICK_POLL, commfault_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, HU_FLAG_QUICK_POLL, shutdownimm_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, lowbatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FullyCharged", NULL, NULL, HU_FLAG_QUICK_POLL, fullycharged_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FullyDischarged", NULL, NULL, HU_FLAG_QUICK_POLL, depleted_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, HU_FLAG_QUICK_POLL, replacebatt_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.VoltageOutOfRange", NULL, NULL, HU_FLAG_QUICK_POLL, vrange_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Buck", NULL, NULL, HU_FLAG_QUICK_POLL, trim_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Boost", NULL, NULL, HU_FLAG_QUICK_POLL, boost_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Overload", NULL, NULL, HU_FLAG_QUICK_POLL, overload_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.Used", NULL, NULL, HU_FLAG_QUICK_POLL, nobattery_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.OverTemperature", NULL, NULL, HU_FLAG_QUICK_POLL, overheat_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.InternalFailure", NULL, NULL, HU_FLAG_QUICK_POLL, commfault_info }, - { "BOOL", 0, 0, "UPS.PowerConverter.PresentStatus.AwaitingPower", NULL, NULL, HU_FLAG_QUICK_POLL, awaitingpower_info }, - - { "beeper.on", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - { "beeper.off", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, - { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - { "beeper.disable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL }, - { "beeper.mute", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, - - /* 10 seconds battery test */ - { "test.battery.start.quick", 0, 0, "UPS.BatterySystem.Test", NULL, "1", HU_TYPE_CMD, NULL }, - /* test until battery low */ - { "test.battery.start.deep", 0, 0, "UPS.BatterySystem.Test", NULL, "2", HU_TYPE_CMD, NULL }, - { "test.battery.stop", 0, 0, "UPS.BatterySystem.Test", NULL, "3", HU_TYPE_CMD, NULL }, - - { "load.on.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, - { "load.off.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - - { "shutdown.stop", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, "-1", HU_TYPE_CMD, NULL }, - { "shutdown.reboot", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL }, - - /* Terminating entry */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *delta_ups_format_mfr(HIDDevice_t *hd) { - return hd->Vendor ? hd->Vendor : "Delta"; -} - -static const char *delta_ups_format_model(HIDDevice_t *hd) { - static char model[SMALLBUF]; - HIDGetItemString(udev, "UPS.DeltaCustom.[1].DeltaModelName", model, sizeof(model), delta_ups_utab); - - if (strlen(model) < 1) { - return hd->Product; - } - - return model; -} - -static const char *delta_ups_format_serial(HIDDevice_t *hd) { - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if - * the device is supported by this subdriver, else 0. */ -static int delta_ups_claim(HIDDevice_t *hd) { - int status = is_usb_device_supported(delta_ups_usb_device_table, hd); - - switch (status) { - case SUPPORTED: - return 1; - - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - return 1; - } - possibly_supported("Delta", hd); - return 0; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t delta_ups_subdriver = { - DELTA_UPS_HID_VERSION, - delta_ups_claim, - delta_ups_utab, - delta_ups_hid2nut, - delta_ups_format_model, - delta_ups_format_mfr, - delta_ups_format_serial, - fix_report_desc, -}; diff --git a/drivers/delta_ups-hid.h b/drivers/delta_ups-hid.h deleted file mode 100644 index d8c039f..0000000 --- a/drivers/delta_ups-hid.h +++ /dev/null @@ -1,31 +0,0 @@ -/* delta_ups-hid.h - data mapping subdriver to monitor Delta UPS USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2021 Jungeon Kim - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef DELTA_UPS_HID_H -#define DELTA_UPS_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t delta_ups_subdriver; - -#endif /* DELTA_UPS_HID_H */ diff --git a/drivers/delta_ups-mib.c b/drivers/delta_ups-mib.c index 770b0d7..7b10858 100644 --- a/drivers/delta_ups-mib.c +++ b/drivers/delta_ups-mib.c @@ -7,7 +7,7 @@ * gen-snmp-subdriver.sh script. It must be customized! * * MIB reference: http://www.networkupstools.org/ups-protocols/snmp/DeltaUPSv4.mib - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -25,38 +25,38 @@ #include "delta_ups-mib.h" -#define DELTA_UPS_MIB_VERSION "0.5" +#define DELTA_UPS_MIB_VERSION "0.2" #define DELTA_UPS_SYSOID ".1.3.6.1.4.1.2254.2.4" /* To create a value lookup structure (as needed on the 2nd line of the example * below), use the following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t delta_ups_onbatt_info[] = { - * { 1, "OB", NULL, NULL }, - * { 2, "OL", NULL, NULL }, - * { 0, NULL, NULL, NULL } + * static info_lkp_t onbatt_info[] = { + * { 1, "OB" }, + * { 2, "OL" }, + * { 0, "NULL" } * }; */ static info_lkp_t delta_ups_upstype_info[] = { - { 1, "on-line", NULL, NULL }, - { 2, "off-line", NULL, NULL }, - { 3, "line-interactive", NULL, NULL }, - { 4, "3phase", NULL, NULL }, - { 5, "splite-phase", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "on-line" }, + { 2, "off-line" }, + { 3, "line-interactive" }, + { 4, "3phase" }, + { 5, "splite-phase" }, + { 0, "NULL" } }; static info_lkp_t delta_ups_pwr_info[] = { - { 0, "OL", NULL, NULL }, /* normal */ - { 1, "OB", NULL, NULL }, /* battery */ - { 2, "BYPASS", NULL, NULL }, /* bypass */ - { 3, "TRIM", NULL, NULL }, /* reducing */ - { 4, "BOOST", NULL, NULL }, /* boosting */ - { 5, "BYPASS", NULL, NULL }, /* manualBypass */ - /*{ 6, "NULL", NULL, NULL },*/ /* other */ - { 7, "OFF", NULL, NULL }, /* none */ - { 0, NULL, NULL, NULL } + { 0, "OL" }, /* normal */ + { 1, "OB" }, /* battery */ + { 2, "BYPASS" }, /* bypass */ + { 3, "TRIM" }, /* reducing */ + { 4, "BOOST" }, /* boosting */ + { 5, "BYPASS" }, /* manualBypass */ + /*{ 6, "NULL" },*/ /* other */ + { 7, "OFF" }, /* none */ + { 0, "NULL" } } ; /* DELTA_UPS Snmp2NUT lookup table */ @@ -73,25 +73,21 @@ static snmp_info_t delta_ups_mib[] = { * dfl: default value * flags: snmp-ups internal flags (FIXME: ...) * oid2info: lookup table between OID and NUT values + * setvar: variable to set for SU_FLAG_SETINT * * Example: * { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, delta_ups_onbatt_info }, + * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info }, * * To create a value lookup structure (as needed on the 2nd line), use the * following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t delta_ups_onbatt_info[] = { + * static info_lkp_t onbatt_info[] = { * { 1, "OB" }, * { 2, "OL" }, - * { 0, NULL } + * { 0, "NULL" } * }; */ - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* dupsIdentManufacturer.0 = STRING: "Socomec" */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2254.2.4.1.1.0", NULL, SU_FLAG_OK, NULL }, /* dupsIdentModel.0 = STRING: "NETYS RT 1/1 UPS" */ @@ -362,4 +358,4 @@ static snmp_info_t delta_ups_mib[] = { { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t delta_ups = { "delta_ups", DELTA_UPS_MIB_VERSION, NULL, NULL, delta_ups_mib, DELTA_UPS_SYSOID, NULL }; +mib2nut_info_t delta_ups = { "delta_ups", DELTA_UPS_MIB_VERSION, NULL, NULL, delta_ups_mib, DELTA_UPS_SYSOID }; diff --git a/drivers/dstate-hal.c b/drivers/dstate-hal.c new file mode 100644 index 0000000..6728f0f --- /dev/null +++ b/drivers/dstate-hal.c @@ -0,0 +1,710 @@ +/* dstate-hal.c - Network UPS Tools driver-side state management + This is a compatibility interface that encapsulate the HAL bridge + into the NUT dstate API for NUT drivers + + Copyright (C) 2006-2007 Arnaud Quette + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include +#include +#include +#include +#include +#include +#include + +#include "common.h" +#include "config.h" +#include "dstate-hal.h" +#include "extstate.h" +/* #include "state.h" +#include "parseconf.h" */ + +#include + +/* FIXME: export command and RW variables (using the HAL example: addon-cpufreq and macbook addon) */ +/* beeper.enable, beeper.disable => SetBeeper(bool) + beeper.toggle => ToggleBeeper(void) + +org.freedesktop.Hal.Device.UPS.SetSounder (bool) + + +Shutdown() or ShutOff() + shutdown.return + shutdown.stayoff + shutdown.reboot + shutdown.reboot.graceful + +#define UPS_ERROR_GENERAL "GeneralError" +#define UPS_ERROR_UNSUPPORTED_FEATURE "FeatureNotSupported" +#define UPS_ERROR_PERMISSION_DENIED "PermissionDenied" + +****** implementation ******* + +#define DBUS_INTERFACE "org.freedesktop.Hal.Device.UPS" + +if (!libhal_device_claim_interface(halctx, udi, DBUS_INTERFACE, + + " \n" + " \n" + " \n" + " \n" + + &dbus_dbus_error)) { + fprintf(stderr, "Cannot claim interface: %s", dbus_dbus_error.message); + goto Error; + } + + +*/ + +/* + * static int sockfd = -1, stale = 1, alarm_active = 0; + * static struct st_tree_t *dtree_root = NULL; + * static struct conn_t *connhead = NULL; + * static struct cmdlist_t *cmdhead = NULL; + * static char *sockfn = NULL; + * static char status_buf[ST_MAX_VALUE_LEN], + * alarm_buf[ST_MAX_VALUE_LEN]; + */ + +struct ups_handler upsh; + +LibHalContext *halctx = NULL; +char *udi; +int ac_present = 0; /* 0 = false ; 1 = true */ +extern char *dbus_methods_introspection; + +static void* runtime_handler(LibHalChangeSet *cs, char* runtime); +static void* level_handler(LibHalChangeSet *cs, char* critical_level); +static void* battery_type_handler(LibHalChangeSet *cs, char* battery_type); + +/* Structure to lookup between NUT and HAL data */ +typedef struct { + const char *nut_name; /* NUT variable name */ + const char *hal_name; /* HAL variable name */ + int hal_type; /* HAL variable type */ + void *(*fun)(LibHalChangeSet *cs, + char *value); /* conversion function. */ +} info_lkp_t; + +enum hal_type_t +{ + NONE = 0, + HAL_TYPE_INT, + HAL_TYPE_BOOL, + HAL_TYPE_STRING +}; + +/* Structure to lookup between NUT commands and HAL/DBus methods */ +typedef struct { + char *nut_name; /* NUT command name */ + char *hal_name; /* HAL/DBus method name */ + char *xml_introspection; /* HAL/DBus method introspection */ +/* FIXME: how to lookup param values between HAL and NUT?? */ +/* void *(*fun)(LibHalChangeSet *cs, + char *value);*/ /* NUT function */ +} method_lkp_t; + +#if 0 +/* Data to lookup between NUT commands and HAL/DBus methods + * for dstate_addcmd() */ +static method_lkp_t nut2hal_cmd[] = +{ + /* ups.status is handled by status_set() calls */ + { + "beeper.enable", + "SetBeeper", + " \n" + " \n" + " \n" + " \n" + }, + + /* Terminating element */ + { NULL, NULL, NULL } +}; +#endif + +/* Data to lookup between NUT and HAL for dstate_setinfo() */ +static info_lkp_t nut2hal_info[] = +{ + /* ups.status is handled by status_set() calls */ + { "battery.charge.low", "battery.charge_level.low", HAL_TYPE_INT, *level_handler }, + /* { "battery.charge.low", "battery.reporting.low", HAL_TYPE_INT, NULL }, */ + { "battery.charge.low", "battery.alarm.design", HAL_TYPE_INT, NULL }, + + { "battery.charge", "battery.charge_level.current", HAL_TYPE_INT, NULL }, + { "battery.charge", "battery.charge_level.percentage", HAL_TYPE_INT, NULL }, + { "battery.charge", "battery.reporting.current", HAL_TYPE_INT, NULL }, + { "battery.charge", "battery.reporting.percentage", HAL_TYPE_INT, NULL }, + { "battery.runtime", "battery.remaining_time", HAL_TYPE_INT, *runtime_handler }, + /* raw version (PbAc) */ + { "battery.type", "battery.reporting.technology", HAL_TYPE_STRING, NULL }, + /* Human readable version */ + { "battery.type", "battery.technology", HAL_TYPE_STRING, *battery_type_handler }, + + /* AQ note: Not sure it fits! */ + /* HAL marked as mandatory! */ + { "battery.voltage", "battery.voltage.current", HAL_TYPE_INT, NULL }, + { "battery.voltage.nominal", "battery.voltage.design", HAL_TYPE_INT, NULL }, + + { "ups.mfr", "battery.vendor", HAL_TYPE_STRING, NULL }, + { "ups.model", "battery.model", HAL_TYPE_STRING, NULL }, + { "ups.serial", "battery.serial", HAL_TYPE_STRING, NULL }, + + /* Terminating element */ + { NULL, NULL, NONE, NULL } +}; + +/* Functions to lookup between NUT and HAL */ +static info_lkp_t *find_nut_info(const char *nut_varname, info_lkp_t *prev_info_item); + +/* HAL accessors wrappers */ +void hal_set_string(LibHalChangeSet *cs, const char *key, const char *value); +void hal_set_int(LibHalChangeSet *cs, const char *key, const int value); +void hal_set_bool(LibHalChangeSet *cs, const char *key, const dbus_bool_t value); +int hal_get_int(const char *key); +char *hal_get_string(const char *key); + +/* Handle warning charge level according to the critical level */ +static void* level_handler(LibHalChangeSet *cs, char* critical_level) +{ + /* Magic formula to generate the warning level */ + int int_critical_level = atoi(critical_level); + /* warning level = critical + 1/3 of (100 % - critical level), approx at the leat mod 10 */ + int int_warning_level = int_critical_level + ((100 - int_critical_level) / 3); + int_warning_level -= (int_warning_level % 10); + + /* Set the critical level value */ + hal_set_int (cs, "battery.charge_level.low", int_critical_level); + hal_set_int (cs, "battery.reporting.low", int_critical_level); + + /* Set the warning level value (FIXME: set to 50 % for now) */ + hal_set_int (cs, "battery.charge_level.warning", int_warning_level); + hal_set_int (cs, "battery.reporting.warning", int_warning_level); + + return NULL; /* Nothing to return */ +} + +/* Handle runtime exposition according to the AC status */ +static void* runtime_handler(LibHalChangeSet *cs, char* runtime) +{ + if (ac_present == 0) { + /* unSet the runtime auto computation and rely upon NUT.battery.runtime*/ + hal_set_bool (cs, "battery.remaining_time.calculate_per_time", FALSE); + + /* Set the runtime value */ + hal_set_int (cs, "battery.remaining_time", atoi(runtime)); + } + else { + /* Set the runtime auto computation */ + hal_set_bool (cs, "battery.remaining_time.calculate_per_time", TRUE); + + /* Set the runtime value */ + hal_set_int (cs, "battery.remaining_time", 0); + } + return NULL; /* Nothing to return */ +} + +/* Handle the battery technology reporting */ +static void* battery_type_handler(LibHalChangeSet *cs, char* battery_type) +{ + if (!strncmp (battery_type, "PbAc", 4)) { + hal_set_string(cs, "battery.technology", "lead-acid"); + } + /* FIXME: manage other types (lithium-ion, lithium-polymer, + * nickel-metal-hydride, unknown */ + + return NULL; /* Nothing to return */ +} + +/******************************************************************** + * dstate compatibility interface + *******************************************************************/ +void dstate_init(const char *prog, const char *port) +{ + DBusError dbus_error; + LibHalChangeSet *cs; + + dbus_error_init (&dbus_error); + + cs = libhal_device_new_changeset (udi); + if (cs == NULL) { + fatalx (EXIT_FAILURE, "Cannot initialize changeset"); + } + + /* UPS always report charge as percent */ + hal_set_string (cs, "battery.charge_level.unit", "percent"); + hal_set_string (cs, "battery.reporting.unit", "percent"); + hal_set_string (cs, "battery.alarm.unit", "percent"); + + /* Various UPSs assumptions */ + /****************************/ + /* UPS are always rechargeable! */ + /* FIXME: Check for NUT extension however: ie HID->UPS.PowerSummary.Rechargeable + * into battery.rechargeable + * or always expose it? + */ + hal_set_bool (cs, "battery.is_rechargeable", TRUE); + + /* UPS always has a max battery charge of 100 % */ + hal_set_int (cs, "battery.charge_level.design", 100); + hal_set_int (cs, "battery.charge_level.last_full", 100); + hal_set_int (cs, "battery.reporting.design", 100); + hal_set_int (cs, "battery.reporting.last_full", 100); + + /* NUT always express Voltage in Volts "V" */ + /* But not all UPSs provide the data + * battery.voltage.{design,current} */ + hal_set_string (cs, "battery.voltage.unit", "V"); + + /* UPS always have a battery! */ + /* Note(AQU): wrong with some solar panel usage, where the UPS */ + /* is just an energy source switch! */ + /* FIXME: to be processed (need possible NUT extension) */ + hal_set_bool (cs, "battery.present", TRUE); + + /* FIXME: can be improved?! (implies "info.recall.vendor") */ + hal_set_bool (cs, "info.is_recalled", FALSE); + + /* Set generic properties */ + hal_set_string (cs, "battery.type", "ups"); + libhal_device_add_capability (halctx, udi, "battery", &dbus_error); + libhal_device_add_capability (halctx, udi, "ac_adaptor", &dbus_error); + + /* FIXME: can be improved?! Set granularity (1 %)*/ + hal_set_int (cs, "battery.charge_level.granularity_1", 1); + hal_set_int (cs, "battery.charge_level.granularity_2", 1); + hal_set_int (cs, "battery.reporting.granularity_1", 1); + hal_set_int (cs, "battery.reporting.granularity_2", 1); + + dbus_error_init (&dbus_error); + /* NOTE: commit_changeset won't do IPC if set is empty */ + libhal_device_commit_changeset (halctx, cs, &dbus_error); + libhal_device_free_changeset (cs); + + if (dbus_error_is_set (&dbus_error)) + dbus_error_free (&dbus_error); +} + + +const char *dstate_getinfo(const char *var) +{ + info_lkp_t *nut2hal_info = find_nut_info(var, NULL); + +/* FIXME: use the data exposed by NUT on the DBus when available */ + + if (nut2hal_info != NULL) { + + switch (nut2hal_info->hal_type) + { +/* case HAL_TYPE_INT: + static char value[8]; + snprintf(value, sizeof(value), "%i", hal_get_int(nut2hal_info->hal_name)); + return value; + case HAL_TYPE_BOOL: + hal_set_bool(cs, nut2hal_info->hal_name, TRUE); + break; +*/ + case HAL_TYPE_STRING: + return hal_get_string(nut2hal_info->hal_name); + } + } + return NULL; +} + +int dstate_setinfo(const char *var, const char *fmt, ...) +{ + va_list ap; + int ret = 1; + LibHalChangeSet *cs; + DBusError dbus_error; + char value[ST_MAX_VALUE_LEN]; + info_lkp_t *nut2hal_info = NULL, *prev_nut2hal_info = NULL; + + va_start(ap, fmt); + vsnprintf(value, sizeof(value), fmt, ap); + va_end(ap); + + cs = libhal_device_new_changeset (udi); + if (cs == NULL) { + fatalx (EXIT_FAILURE, "Cannot initialize changeset"); + } + + /* Loop on getting HAL variable(s) matching this NUT variable */ + while ( (nut2hal_info = find_nut_info(var, prev_nut2hal_info)) != NULL) + { + upsdebugx(2, "dstate_setinfo: %s => %s (%s)\n", var, nut2hal_info->hal_name, value); + + if (nut2hal_info->fun != NULL) + nut2hal_info->fun(cs, value); + else { + switch (nut2hal_info->hal_type) + { + case HAL_TYPE_INT: + hal_set_int(cs, nut2hal_info->hal_name, atoi(value)); + break; + case HAL_TYPE_BOOL: + /* FIXME: howto lookup TRUE/FALSE? */ + hal_set_bool(cs, nut2hal_info->hal_name, TRUE); + break; + case HAL_TYPE_STRING: + hal_set_string(cs, nut2hal_info->hal_name, value); + break; + } + } + prev_nut2hal_info = nut2hal_info; + } + + dbus_error_init (&dbus_error); + /* NOTE: commit_changeset won't do IPC if set is empty */ + libhal_device_commit_changeset(halctx,cs,&dbus_error); + libhal_device_free_changeset (cs); + + if (dbus_error_is_set (&dbus_error)) + dbus_error_free (&dbus_error); + + return ret; +} + + +int dstate_addenum(const char *var, const char *fmt, ...) +{ + return 0; +} + +int dstate_addrange(const char *var, const int min, const int max) +{ + return 0; +} + +const st_tree_t *dstate_getroot(void) +{ + return NULL; +} + +int dstate_delinfo(const char *var) +{ + return 0; +} + +int dstate_delcmd(const char *var) +{ + return 0; +} + +void dstate_setflags(const char *var, int flags) +{ + return; +} + +void dstate_setaux(const char *var, int aux) +{ + return; +} + +void dstate_dataok(void) +{ + return; +} + +void dstate_datastale(void) +{ + return; +} + +void dstate_free(void) +{ + return; +} + +/* extrafd: provided for waking up based on the driver's UPS fd */ +int dstate_poll_fds(struct timeval timeout, int extrafd) +{ + /* drivers expect us to limit the polling rate here */ + sleep(timeout.tv_sec); + + /* the timeout expired */ + return 1; +} + +/* clean out the temp space for a new pass */ +void status_init(void) +{ + /* Nothing to do */ + return; +} + +/* ups.status element conversion */ +void status_set(const char *buf) +{ + upsdebugx(2, "status_set: %s", buf); + + /* Note: only usbhid-ups supported devices expose [DIS]CHRG status */ + /* along with the standard OL (online) / OB (on battery) status! */ + if ( (strcmp(buf, "DISCHRG") == 0) || (strcmp(buf, "OB") == 0) ) + { + ac_present = 0; + } + else if ( (strcmp(buf, "CHRG") == 0) || (strcmp(buf, "OL") == 0) ) + { + ac_present = 1; + } + else + upsdebugx(2, "status_set: dropping status %s (not managed)\n", buf); + + return; +} + +/* write the status_buf into the externally visible dstate storage */ +void status_commit(void) +{ + LibHalChangeSet *cs; + DBusError dbus_error; + int curlevel, warnlevel, lowlevel; + + upsdebugx(2, "status_commit"); + + cs = libhal_device_new_changeset (udi); + if (cs == NULL) { + fatalx (EXIT_FAILURE, "Cannot initialize changeset"); + } + + /* Retrieve the levels */ + curlevel = hal_get_int ("battery.charge_level.current"); + warnlevel = hal_get_int ("battery.charge_level.warning"); + lowlevel = hal_get_int ("battery.charge_level.low"); + + /* Set AC present status */ + /* Note: UPSs are also AC adaptors! */ + hal_set_bool (cs, "ac_adaptor.present", (ac_present == 0)?FALSE:TRUE); + + /* Set discharging status */ + hal_set_bool (cs, "battery.rechargeable.is_discharging", (ac_present == 0)?TRUE:FALSE); + + /* Set charging status */ + if (curlevel != 100) + hal_set_bool (cs, "battery.rechargeable.is_charging", (ac_present == 0)?FALSE:TRUE); + + /* Set the battery status (FIXME: are these values valid?) */ + if (curlevel <= lowlevel) + hal_set_string(cs, "battery.charge_level.capacity_state", "critical"); + else if (curlevel <= warnlevel) + hal_set_string(cs, "battery.charge_level.capacity_state", "warning"); /*low?*/ + else + hal_set_string(cs, "battery.charge_level.capacity_state", "ok"); + + dbus_error_init (&dbus_error); + /* NOTE: commit_changeset won't do IPC if set is empty */ + libhal_device_commit_changeset (halctx, cs, &dbus_error); + libhal_device_free_changeset (cs); + + if (dbus_error_is_set (&dbus_error)) + dbus_error_free (&dbus_error); + + return; +} + +/* similar functions for ups.alarm */ +void alarm_init(void) +{ + return; +} + +void alarm_set(const char *buf) +{ + return; +} + +void alarm_commit(void) +{ + return; +} + +/* FIXME: complete and use nut2hal_cmd */ +/* Register DBus methods, by feeling the methods buffer */ +void dstate_addcmd(const char *cmdname) +{ + DBusError dbus_error; + dbus_error_init (&dbus_error); + + upsdebugx(2, "dstate_addcmd: %s\n", cmdname); + + /* beeper.{on,off} */ + /* FIXME: how to deal with beeper.toggle */ + if (!strncasecmp(cmdname, "beeper.disable", 14)) + { + strcat(dbus_methods_introspection, + " \n" + " \n" + " \n" + " \n"); + } +} + + + +/******************************************************************* + * internal functions + *******************************************************************/ + +/**************** + * HAL wrappers * + ****************/ +/* Only update HAL string values if there are real changes */ +void hal_set_string(LibHalChangeSet *cs, const char *key, const char *value) +{ + DBusError dbus_error; + char *new_value = NULL; + + upsdebugx(2, "hal_set_string: %s => %s", key, value); + + dbus_error_init(&dbus_error); + + /* Check if the property already exists */ + if (libhal_device_property_exists (halctx, udi, key, &dbus_error) == TRUE) { + + new_value = libhal_device_get_property_string (halctx, udi, + key, &dbus_error); + + /* Check if the value has really changed */ + if (strcmp(value, new_value)) + libhal_changeset_set_property_string (cs, key, value); + + /* Free the new_value string */ + if (new_value != NULL) + libhal_free_string (new_value); + } + else { + libhal_changeset_set_property_string (cs, key, value); + } +} + +/* Only update HAL int values if there are real changes */ +void hal_set_int(LibHalChangeSet *cs, const char *key, const int value) +{ + DBusError dbus_error; + int new_value; + + upsdebugx(2, "hal_set_int: %s => %i", key, value); + + dbus_error_init(&dbus_error); + + /* Check if the property already exists */ + if (libhal_device_property_exists (halctx, udi, key, &dbus_error) == TRUE) { + + new_value = libhal_device_get_property_int (halctx, udi, + key, &dbus_error); + + /* Check if the value has really changed */ + if (value != new_value) + libhal_changeset_set_property_int (cs, key, value); + } + else { + libhal_changeset_set_property_int (cs, key, value); + } +} + +char *hal_get_string(const char *key) +{ + DBusError dbus_error; + char *value = NULL; + + upsdebugx(2, "hal_get_string: %s", key); + + dbus_error_init(&dbus_error); + + /* Check if the property already exists */ + if (libhal_device_property_exists (halctx, udi, key, &dbus_error) == TRUE) { + + value = libhal_device_get_property_string (halctx, udi, + key, &dbus_error); + } + return value; +} + +int hal_get_int(const char *key) +{ + DBusError dbus_error; + int value = -1; + + upsdebugx(2, "hal_get_int: %s", key); + + dbus_error_init(&dbus_error); + + /* Check if the property already exists */ + if (libhal_device_property_exists (halctx, udi, key, &dbus_error) == TRUE) { + + value = libhal_device_get_property_int (halctx, udi, + key, &dbus_error); + } + return value; +} + +/* Only update HAL int values if there are real changes */ +void hal_set_bool(LibHalChangeSet *cs, const char *key, const dbus_bool_t value) +{ + DBusError dbus_error; + dbus_bool_t new_value; + + upsdebugx(2, "hal_set_bool: %s => %s", key, (value==TRUE)?"true":"false"); + + dbus_error_init(&dbus_error); + + /* Check if the property already exists */ + if (libhal_device_property_exists (halctx, udi, key, &dbus_error) == TRUE) { + + new_value = libhal_device_get_property_bool (halctx, udi, + key, &dbus_error); + + /* Check if the value has really changed */ + if (value != new_value) + libhal_changeset_set_property_bool (cs, key, value); + } + else { + libhal_changeset_set_property_bool (cs, key, value); + } +} + +/* find the next info element definition in info array + * that matches nut_varname, and that is after prev_info_item + * if specified. + * Note that 1 nut item can matches several HAL items + */ +static info_lkp_t *find_nut_info(const char *nut_varname, info_lkp_t *prev_info_item) +{ + info_lkp_t *info_item; + + upsdebugx(2, "find_nut_info: looking up => %s\n", nut_varname); + + if (prev_info_item != NULL) { + /* Start from the item following prev_info_item */ + info_item = ++prev_info_item; + } + else { + info_item = nut2hal_info; + } + + for ( ; info_item != NULL && info_item->nut_name != NULL ; info_item++) { + + if (!strcasecmp(info_item->nut_name, nut_varname)) + return info_item; + } + + return NULL; +} diff --git a/drivers/dstate-hal.h b/drivers/dstate-hal.h new file mode 100644 index 0000000..6a2ad2f --- /dev/null +++ b/drivers/dstate-hal.h @@ -0,0 +1,94 @@ +/* dstate-hal.h - Network UPS Tools driver-side state management + + Copyright (C) 2006 Arnaud Quette + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef DSTATE_HAL_H_SEEN +#define DSTATE_HAL_H_SEEN 1 + +#include "state.h" +#include "attribute.h" + +/*#include "parseconf.h"*/ +#include "upshandler.h" + +#include +#include +#include +#include + +#define DS_LISTEN_BACKLOG 16 +#define DS_MAX_READ 256 /* don't read forever from upsd */ + +/* HAL specific */ +#define DBUS_INTERFACE "org.freedesktop.Hal.Device.UPS" + +DBusHandlerResult dbus_filter_function(DBusConnection *connection, + DBusMessage *message, + void *user_data); + +gboolean dbus_init_local (void); + +#define HAL_WARNING + +/* track client connections */ +/* typedef struct conn_s { + * int fd; + * PCONF_CTX_t ctx; + * struct conn_s *next; + *} conn_t; + */ + extern struct ups_handler upsh; + +void dstate_init(const char *prog, const char *port); +int dstate_poll_fds(struct timeval timeout, int extrafd); +int dstate_setinfo(const char *var, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +int dstate_addenum(const char *var, const char *fmt, ...) + __attribute__ ((__format__ (__printf__, 2, 3))); +int dstate_addrange(const char *var, const int min, const int max); +void dstate_setflags(const char *var, int flags); +void dstate_setaux(const char *var, int aux); +const char *dstate_getinfo(const char *var); +void dstate_addcmd(const char *cmdname); +int dstate_delinfo(const char *var); +int dstate_delenum(const char *var, const char *val); +int dstate_delcmd(const char *cmd); +void dstate_free(void); +const st_tree_t *dstate_getroot(void); +const cmdlist_t *dstate_getcmdlist(void); + +void dstate_dataok(void); +void dstate_datastale(void); + +int dstate_is_stale(void); + +/* clean out the temp space for a new pass */ +void status_init(void); + +/* add a status element */ +void status_set(const char *buf); + +/* write the temporary status_buf into ups.status */ +void status_commit(void); + +/* similar functions for ups.alarm */ +void alarm_init(void); +void alarm_set(const char *buf); +void alarm_commit(void); + +#endif /* DSTATE_HAL_H_SEEN */ diff --git a/drivers/dstate.c b/drivers/dstate.c index b37e889..2e5bd7e 100644 --- a/drivers/dstate.c +++ b/drivers/dstate.c @@ -1,9 +1,9 @@ /* dstate.c - Network UPS Tools driver-side state management Copyright (C) - 2003 Russell Kroll - 2008 Arjen de Korte - 2012 - 2017 Arnaud Quette + 2003 Russell Kroll + 2008 Arjen de Korte + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,8 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -34,8 +32,6 @@ #include "dstate.h" #include "state.h" #include "parseconf.h" -#include "attribute.h" -#include "nut_stdint.h" static int sockfd = -1, stale = 1, alarm_active = 0, ignorelb = 0; static char *sockfn = NULL; @@ -47,9 +43,6 @@ struct ups_handler upsh; /* this may be a frequent stumbling point for new users, so be verbose here */ -static void sock_fail(const char *fn) - __attribute__((noreturn)); - static void sock_fail(const char *fn) { int sockerr; @@ -77,7 +70,7 @@ static void sock_fail(const char *fn) user->pw_name, (int)user->pw_uid); printf("Things to try:\n\n"); - printf(" - set different owners or permissions on %s\n\n", + printf(" - set different owners or permissions on %s\n\n", dflt_statepath()); printf(" - run this as some other user " "(try -u )\n"); @@ -94,9 +87,9 @@ static void sock_fail(const char *fn) printf(" - mkdir %s\n", dflt_statepath()); break; } - + /* - * there - that wasn't so bad. every helpful line of code here + * there - that wasn't so bad. every helpful line of code here * prevents one more "help me" mail to the list a year from now */ @@ -109,8 +102,6 @@ static int sock_open(const char *fn) int ret, fd; struct sockaddr_un ssaddr; - check_unix_socket_filename(fn); - fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { @@ -172,26 +163,13 @@ static void sock_disconnect(conn_t *conn) static void send_to_all(const char *fmt, ...) { - ssize_t ret; + int ret; char buf[ST_SOCK_BUF_LEN]; - size_t buflen; va_list ap; conn_t *conn, *cnext; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(buf, sizeof(buf), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); if (ret < 1) { @@ -199,130 +177,43 @@ static void send_to_all(const char *fmt, ...) return; } - if (ret <= INT_MAX) - upsdebugx(5, "%s: %.*s", __func__, (int)(ret-1), buf); - - buflen = strlen(buf); - if (buflen >= SSIZE_MAX) { - /* Can't compare buflen to ret... though should not happen with ST_SOCK_BUF_LEN */ - upslog_with_errno(LOG_NOTICE, "%s failed: buffered message too large", __func__); - return; - } + upsdebugx(5, "%s: %.*s", __func__, ret-1, buf); for (conn = connhead; conn; conn = cnext) { cnext = conn->next; - ret = write(conn->fd, buf, buflen); + ret = write(conn->fd, buf, strlen(buf)); - if ((ret < 1) || (ret != (ssize_t)buflen)) { - upsdebugx(0, "WARNING: %s: write %zd bytes to " - "socket %d failed (ret=%zd), disconnecting: %s", - __func__, buflen, conn->fd, ret, strerror(errno)); - upsdebugx(6, "failed write: %s", buf); + if (ret != (int)strlen(buf)) { + upsdebugx(2, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd); sock_disconnect(conn); - - /* TOTHINK: Maybe fallback elsewhere in other cases? */ - if (ret < 0 && errno == EAGAIN && do_synchronous == -1) { - upsdebugx(0, "%s: synchronous mode was 'auto', " - "will try 'on' for next connections", - __func__); - do_synchronous = 1; - } - - dstate_setinfo("driver.parameter.synchronous", "%s", - (do_synchronous==1)?"yes":((do_synchronous==0)?"no":"auto")); - } else { - upsdebugx(6, "%s: write %zd bytes to socket %d succeeded " - "(ret=%zd): %s", - __func__, buflen, conn->fd, ret, buf); } } } static int send_to_one(conn_t *conn, const char *fmt, ...) { - ssize_t ret; + int ret; va_list ap; char buf[ST_SOCK_BUF_LEN]; - size_t buflen; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(buf, sizeof(buf), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); - upsdebugx(2, "%s: sending %.*s", __func__, (int)strcspn(buf, "\n"), buf); if (ret < 1) { upsdebugx(2, "%s: nothing to write", __func__); return 1; } - buflen = strlen(buf); - if (buflen >= SSIZE_MAX) { - /* Can't compare buflen to ret... though should not happen with ST_SOCK_BUF_LEN */ - upslog_with_errno(LOG_NOTICE, "%s failed: buffered message too large", __func__); - return 0; /* failed */ - } + upsdebugx(5, "%s: %.*s", __func__, ret-1, buf); - if (ret <= INT_MAX) - upsdebugx(5, "%s: %.*s", __func__, (int)(ret-1), buf); + ret = write(conn->fd, buf, strlen(buf)); -/* - upsdebugx(0, "%s: writing %zd bytes to socket %d: %s", - __func__, buflen, conn->fd, buf); -*/ - - ret = write(conn->fd, buf, buflen); - - if (ret < 0) { - /* Hacky bugfix: throttle down for upsd to read that */ - upsdebugx(1, "%s: had to throttle down to retry " - "writing %zd bytes to socket %d " - "(ret=%zd, errno=%d, strerror=%s): %s", - __func__, buflen, conn->fd, - ret, errno, strerror(errno), - buf); - usleep(200); - ret = write(conn->fd, buf, buflen); - if (ret == (ssize_t)buflen) { - upsdebugx(1, "%s: throttling down helped", __func__); - } - } - - if ((ret < 1) || (ret != (ssize_t)buflen)) { - upsdebugx(0, "WARNING: %s: write %zd bytes to " - "socket %d failed (ret=%zd), disconnecting: %s", - __func__, buflen, conn->fd, ret, strerror(errno)); - upsdebugx(6, "failed write: %s", buf); + if (ret != (int)strlen(buf)) { + upsdebugx(2, "write %d bytes to socket %d failed", (int)strlen(buf), conn->fd); sock_disconnect(conn); - - /* TOTHINK: Maybe fallback elsewhere in other cases? */ - if (ret < 0 && errno == EAGAIN && do_synchronous == -1) { - upsdebugx(0, "%s: synchronous mode was 'auto', " - "will try 'on' for next connections", - __func__); - do_synchronous = 1; - } - - dstate_setinfo("driver.parameter.synchronous", "%s", - (do_synchronous==1)?"yes":((do_synchronous==0)?"no":"auto")); - return 0; /* failed */ - } else { - upsdebugx(6, "%s: write %zd bytes to socket %d succeeded " - "(ret=%zd): %s", - __func__, buflen, conn->fd, ret, buf); } return 1; /* OK */ @@ -333,7 +224,7 @@ static void sock_connect(int sock) int fd, ret; conn_t *conn; struct sockaddr_un sa; -#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) +#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) int salen; #else socklen_t salen; @@ -346,35 +237,24 @@ static void sock_connect(int sock) return; } - /* enable nonblocking I/O? - * -1 = auto (try async, allow fallback to sync) - * 0 = async - * 1 = sync - */ - if (do_synchronous < 1) { - upsdebugx(0, "%s: enabling asynchronous mode (%s)", - __func__, (do_synchronous<0)?"auto":"fixed"); + /* enable nonblocking I/O */ - ret = fcntl(fd, F_GETFL, 0); + ret = fcntl(fd, F_GETFL, 0); - if (ret < 0) { - upslog_with_errno(LOG_ERR, "fcntl get on unix fd failed"); - close(fd); - return; - } - - ret = fcntl(fd, F_SETFL, ret | O_NDELAY); - - if (ret < 0) { - upslog_with_errno(LOG_ERR, "fcntl set O_NDELAY on unix fd failed"); - close(fd); - return; - } - } - else { - upsdebugx(0, "%s: keeping default synchronous mode", __func__); + if (ret < 0) { + upslog_with_errno(LOG_ERR, "fcntl get on unix fd failed"); + close(fd); + return; } + ret = fcntl(fd, F_SETFL, ret | O_NDELAY); + + if (ret < 0) { + upslog_with_errno(LOG_ERR, "fcntl set O_NDELAY on unix fd failed"); + close(fd); + return; + } + conn = xcalloc(1, sizeof(*conn)); conn->fd = fd; @@ -428,7 +308,7 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) /* provide any auxiliary data */ if (node->aux) { - if (!send_to_one(conn, "SETAUX %s %ld\n", node->var, node->aux)) { + if (!send_to_one(conn, "SETAUX %s %d\n", node->var, node->aux)) { return 0; } } @@ -446,9 +326,6 @@ static int st_tree_dump_conn(st_tree_t *node, conn_t *conn) if (node->flags & ST_FLAG_STRING) { snprintfcat(flist, sizeof(flist), " STRING"); } - if (node->flags & ST_FLAG_NUMBER) { - snprintfcat(flist, sizeof(flist), " NUMBER"); - } if (!send_to_one(conn, "SETFLAGS %s\n", flist)) { return 0; @@ -475,17 +352,8 @@ static int cmd_dump_conn(conn_t *conn) return 1; } - -static void send_tracking(conn_t *conn, const char *id, int value) +static int sock_arg(conn_t *conn, int numarg, char **arg) { - send_to_one(conn, "TRACKING %s %i\n", id, value); -} - -static int sock_arg(conn_t *conn, size_t numarg, char **arg) -{ - upsdebugx(6, "Driver on %s is now handling %s with %zu args", - sockfn, numarg ? arg[0] : "", numarg); - if (numarg < 1) { return 0; } @@ -522,40 +390,20 @@ static int sock_arg(conn_t *conn, size_t numarg, char **arg) return 0; } - /* INSTCMD [] [TRACKING ] */ + /* INSTCMD []*/ if (!strcasecmp(arg[0], "INSTCMD")) { - int ret; - char *cmdname = arg[1]; - char *cmdparam = NULL; - char *cmdid = NULL; - - /* Check if and TRACKING were provided */ - if (numarg == 3) { - cmdparam = arg[2]; - } else if (numarg == 4 && !strcasecmp(arg[2], "TRACKING")) { - cmdid = arg[3]; - } else if (numarg == 5 && !strcasecmp(arg[3], "TRACKING")) { - cmdparam = arg[2]; - cmdid = arg[4]; - } else if (numarg != 2) { - upslogx(LOG_NOTICE, "Malformed INSTCMD request"); - return 0; - } - - if (cmdid) - upsdebugx(3, "%s: TRACKING = %s", __func__, cmdid); /* try the new handler first if present */ if (upsh.instcmd) { - ret = upsh.instcmd(cmdname, cmdparam); + if (numarg > 2) { + upsh.instcmd(arg[1], arg[2]); + return 1; + } - /* send back execution result */ - if (cmdid) - send_tracking(conn, cmdid, ret); - - /* The command was handled, status is a separate consideration */ + upsh.instcmd(arg[1], NULL); return 1; } + upslogx(LOG_NOTICE, "Got INSTCMD, but driver lacks a handler"); return 1; } @@ -564,33 +412,12 @@ static int sock_arg(conn_t *conn, size_t numarg, char **arg) return 0; } - /* SET [TRACKING ] */ + /* SET */ if (!strcasecmp(arg[0], "SET")) { - int ret; - char *setid = NULL; - - /* Check if TRACKING was provided */ - if (numarg == 5) { - if (!strcasecmp(arg[3], "TRACKING")) { - setid = arg[4]; - } - else { - upslogx(LOG_NOTICE, "Got SET with unsupported parameters (%s/%s)", - arg[3], arg[4]); - return 0; - } - upsdebugx(3, "%s: TRACKING = %s", __func__, setid); - } /* try the new handler first if present */ if (upsh.setvar) { - ret = upsh.setvar(arg[1], arg[2]); - - /* send back execution result */ - if (setid) - send_tracking(conn, setid, ret); - - /* The command was handled, status is a separate consideration */ + upsh.setvar(arg[1], arg[2]); return 1; } @@ -604,7 +431,7 @@ static int sock_arg(conn_t *conn, size_t numarg, char **arg) static void sock_read(conn_t *conn) { - ssize_t ret, i; + int i, ret; char buf[SMALLBUF]; ret = read(conn->fd, buf, sizeof(buf)); @@ -635,7 +462,7 @@ static void sock_read(conn_t *conn) upslogx(LOG_INFO, "Unknown command on socket: "); - for (arg = 0; arg < conn->ctx.numargs && arg < INT_MAX; arg++) { + for (arg = 0; arg < conn->ctx.numargs; arg++) { upslogx(LOG_INFO, "arg %d: %s", (int)arg, conn->ctx.arglist[arg]); } } @@ -674,19 +501,12 @@ static void sock_close(void) /* interface */ -char * dstate_init(const char *prog, const char *devname) +void dstate_init(const char *prog, const char *devname) { char sockname[SMALLBUF]; /* do this here for now */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif signal(SIGPIPE, SIG_IGN); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif if (devname) { snprintf(sockname, sizeof(sockname), "%s/%s-%s", dflt_statepath(), prog, devname); @@ -697,9 +517,6 @@ char * dstate_init(const char *prog, const char *devname) sockfd = sock_open(sockname); upsdebugx(2, "dstate_init: sock %s open on fd %d", sockname, sockfd); - - /* NOTE: Caller must free this string */ - return xstrdup(sockname); } /* returns 1 if timeout expired or data is available on UPS fd, 0 otherwise */ @@ -747,7 +564,7 @@ int dstate_poll_fds(struct timeval timeout, int extrafd) timeout.tv_sec -= now.tv_sec; timeout.tv_usec -= now.tv_usec; } - + ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) { @@ -796,19 +613,7 @@ int dstate_setinfo(const char *var, const char *fmt, ...) va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(value, sizeof(value), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); ret = state_setinfo(&dtree_root, var, value); @@ -827,19 +632,7 @@ int dstate_addenum(const char *var, const char *fmt, ...) va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif vsnprintf(value, sizeof(value), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); ret = state_addenum(dtree_root, var, value); @@ -858,9 +651,7 @@ int dstate_addrange(const char *var, const int min, const int max) ret = state_addrange(dtree_root, var, min, max); if (ret == 1) { - send_to_all("ADDRANGE %s %i %i\n", var, min, max); - /* Also add the "NUMBER" flag for ranges */ - dstate_addflags(var, ST_FLAG_NUMBER); + send_to_all("ADDRANGE %s %i %i\n", var, min, max); } return ret; @@ -901,51 +692,11 @@ void dstate_setflags(const char *var, int flags) snprintfcat(flist, sizeof(flist), " STRING"); } - if (flags & ST_FLAG_NUMBER) { - snprintfcat(flist, sizeof(flist), " NUMBER"); - } - /* update listeners */ send_to_all("SETFLAGS %s\n", flist); } -void dstate_addflags(const char *var, const int addflags) -{ - int flags = state_getflags(dtree_root, var); - - if (flags == -1) { - upslogx(LOG_ERR, "%s: cannot get flags of '%s'", __func__, var); - return; - } - - /* Already set */ - if ((flags & addflags) == addflags) - return; - - flags |= addflags; - - dstate_setflags(var, flags); -} - -void dstate_delflags(const char *var, const int delflags) -{ - int flags = state_getflags(dtree_root, var); - - if (flags == -1) { - upslogx(LOG_ERR, "%s: cannot get flags of '%s'", __func__, var); - return; - } - - /* Already not set */ - if (!(flags & delflags)) - return; - - flags &= ~delflags; - - dstate_setflags(var, flags); -} - -void dstate_setaux(const char *var, long aux) +void dstate_setaux(const char *var, int aux) { st_tree_t *sttmp; @@ -964,7 +715,7 @@ void dstate_setaux(const char *var, long aux) sttmp->aux = aux; /* update listeners */ - send_to_all("SETAUX %s %ld\n", var, aux); + send_to_all("SETAUX %s %d\n", var, aux); } const char *dstate_getinfo(const char *var) @@ -1020,7 +771,7 @@ int dstate_delrange(const char *var, const int min, const int max) /* update listeners */ if (ret == 1) { - send_to_all("DELRANGE %s %i %i\n", var, min, max); + send_to_all("DELRANGE %s \"%i %i\"\n", var, min, max); } return ret; @@ -1044,7 +795,7 @@ void dstate_free(void) { state_infofree(dtree_root); dtree_root = NULL; - + state_cmdfree(cmdhead); cmdhead = NULL; @@ -1149,111 +900,17 @@ void status_commit(void) void alarm_init(void) { - /* reinit global counter */ - alarm_active = 0; - - device_alarm_init(); + memset(alarm_buf, 0, sizeof(alarm_buf)); } -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif void alarm_set(const char *buf) { - int ret; if (strlen(alarm_buf) > 0) { - ret = snprintfcat(alarm_buf, sizeof(alarm_buf), " %s", buf); + snprintfcat(alarm_buf, sizeof(alarm_buf), " %s", buf); } else { - ret = snprintfcat(alarm_buf, sizeof(alarm_buf), "%s", buf); - } - - if (ret < 0) { - /* Should we also try to print the potentially unusable buf? - * Generally - likely not. But if it is short enough... - * Note: LARGEBUF was the original limit mismatched vs alarm_buf - * size before PR #986. - */ - char alarm_tmp[LARGEBUF]; - memset(alarm_tmp, 0, sizeof(alarm_tmp)); - /* A bit of complexity to keep both (int)snprintf(...) and (size_t)sizeof(...) happy */ - int ibuflen = snprintf(alarm_tmp, sizeof(alarm_tmp), "%s", buf); - size_t buflen; - if (ibuflen < 0) { - alarm_tmp[0] = 'N'; - alarm_tmp[1] = '/'; - alarm_tmp[2] = 'A'; - alarm_tmp[3] = '\0'; - buflen = strlen(alarm_tmp); - } else { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -/* Note for gating macros above: unsuffixed HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - * means support of contexts both inside and outside function body, so the push - * above and pop below (outside this finction) are not used. - */ -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -/* Note that the individual warning pragmas for use inside function bodies - * are named without a _INSIDEFUNC suffix, for simplicity and legacy reasons - */ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((unsigned long long int)ibuflen < SIZE_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - buflen = (size_t)ibuflen; - } else { - buflen = SIZE_MAX; - } - } - upslogx(LOG_ERR, "%s: error setting alarm_buf to: %s%s", - __func__, alarm_tmp, ( (buflen < sizeof(alarm_tmp)) ? "" : "..." ) ); - } else if ((size_t)ret > sizeof(alarm_buf)) { - char alarm_tmp[LARGEBUF]; - memset(alarm_tmp, 0, sizeof(alarm_tmp)); - int ibuflen = snprintf(alarm_tmp, sizeof(alarm_tmp), "%s", buf); - size_t buflen; - if (ibuflen < 0) { - alarm_tmp[0] = 'N'; - alarm_tmp[1] = '/'; - alarm_tmp[2] = 'A'; - alarm_tmp[3] = '\0'; - buflen = strlen(alarm_tmp); - } else { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((unsigned long long int)ibuflen < SIZE_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - buflen = (size_t)ibuflen; - } else { - buflen = SIZE_MAX; - } - } - upslogx(LOG_WARNING, "%s: result was truncated while setting or appending " - "alarm_buf (limited to %zu bytes), with message: %s%s", - __func__, sizeof(alarm_buf), alarm_tmp, - ( (buflen < sizeof(alarm_tmp)) ? "" : "..." )); + snprintfcat(alarm_buf, sizeof(alarm_buf), "%s", buf); } } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif /* write the status_buf into the info array */ void alarm_commit(void) @@ -1266,259 +923,3 @@ void alarm_commit(void) alarm_active = 0; } } - -void device_alarm_init(void) -{ - /* only clear the buffer, don't touch the alarms counter */ - memset(alarm_buf, 0, sizeof(alarm_buf)); -} - -/* same as above, but writes to "device.X.ups.alarm" or "ups.alarm" */ -void device_alarm_commit(const int device_number) -{ - char info_name[20]; - - memset(info_name, 0, 20); - - if (device_number != 0) /* would then go into "device.%i.alarm" */ - snprintf(info_name, 20, "device.%i.ups.alarm", device_number); - else /* would then go into "device.alarm" */ - snprintf(info_name, 20, "ups.alarm"); - - /* Daisychain subdevices note: - * increase the counter when alarms are present on a subdevice, but - * don't decrease the count. Otherwise, we may not get the ALARM flag - * in ups.status, while there are some alarms present on device.X */ - if (strlen(alarm_buf) > 0) { - dstate_setinfo(info_name, "%s", alarm_buf); - alarm_active++; - } else { - dstate_delinfo(info_name); - } -} - -/* For devices where we do not have phase-count info (no mapping provided - * in the tables), nor in the device data/protocol, we can still guesstimate - * and report a value. This routine may also replace an existing value, e.g. - * if we've found new data disproving old one (e.g. if the 3-phase UPS was - * disbalanced when the driver was started, so we thought it is 1-phase in - * practice, and then the additional lines came up loaded, hence the bools - * "may_reevaluate" and the readonly flag "may_change_dstate" (so the caller - * can query the current apparent situation, without changing any dstates). - * It is up to callers to decide if they already have data they want to keep. - * The "xput_prefix" is e.g. "input." or "input.bypass." or "output." with - * the trailing dot where applicable - we use this string verbatim below. - * The "inited_phaseinfo" and "num_phases" are addresses of caller's own - * variables to store the flag (if we have successfully inited) and the - * discovered amount of phases, or NULL if caller does not want to track it. - * - * NOTE: The code below can detect if the device is 1, 2 (split phase) or 3 - * phases. - * - * Returns: - * -1 Runtime/input error (non fatal, but routine was skipped) - * 0 Nothing changed: could not determine a value - * 1 A phase value was just determined (and set, if not read-only mode) - * 2 Nothing changed: already inited (and may_reevaluate==false) - * 3 Nothing changed: detected a value but it is already published - * as a dstate; populated inited_phaseinfo and num_phases though - */ -int dstate_detect_phasecount( - const char *xput_prefix, - const int may_change_dstate, - int *inited_phaseinfo, - int *num_phases, - const int may_reevaluate -) { - /* If caller does not want either of these back - loopback the values below */ - int local_inited_phaseinfo = 0, local_num_phases = -1; - /* Temporary local value storage */ - int old_num_phases = -1, detected_phaseinfo = 0; - - if (!inited_phaseinfo) - inited_phaseinfo = &local_inited_phaseinfo; - if (!num_phases) - num_phases = &local_num_phases; - old_num_phases = *num_phases; - - upsdebugx(3, "Entering %s('%s', %i, %i, %i, %i)", __func__, - xput_prefix, may_change_dstate, *inited_phaseinfo, *num_phases, may_reevaluate); - - if (!(*inited_phaseinfo) || may_reevaluate) { - const char *v1, *v2, *v3, *v0, - *v1n, *v2n, *v3n, - *v12, *v23, *v31, - *c1, *c2, *c3, *c0; - char buf[MAX_STRING_SIZE]; /* For concatenation of "xput_prefix" with items we want to query */ - size_t xput_prefix_len; - size_t bufrw_max; - char *bufrw_ptr = NULL; - - if (!xput_prefix) { - upsdebugx(0, "%s(): Bad xput_prefix was passed: it is NULL - function skipped", __func__); - return -1; - } - - xput_prefix_len = strlen(xput_prefix); - if (xput_prefix_len < 1) { - upsdebugx(0, "%s(): Bad xput_prefix was passed: it is empty - function skipped", __func__); - return -1; - } - - bufrw_max = sizeof(buf) - xput_prefix_len; - if (bufrw_max <= 15) { - /* We need to append max ~13 chars per below, so far */ - upsdebugx(0, "%s(): Bad xput_prefix was passed: it is too long - function skipped", __func__); - return -1; - } - memset(buf, 0, sizeof(buf)); - strncpy(buf, xput_prefix, sizeof(buf)); - bufrw_ptr = buf + xput_prefix_len ; - - /* We either have defined and non-zero (numeric) values below, or NULLs. - * Note that as "zero" we should expect any valid numeric representation - * of a zero value as some drivers may save strangely formatted values. - * For now, we limit the level of paranoia with missing dstate entries, - * empty entries, and actual single zero character as contents of the - * string. Other obscure cases (string of multiple zeroes, a floating - * point zero, surrounding whitespace etc. may be solved if the need - * does arise in the future. Arguably, drivers' translation/mapping - * tables should take care of this with converion routine and numeric - * data type flags. */ -#define dstate_getinfo_nonzero(var, suffix) \ - do { strncpy(bufrw_ptr, suffix, bufrw_max); \ - if ( (var = dstate_getinfo(buf)) ) { \ - if ( (var[0] == '0' && var[1] == '\0') || \ - (var[0] == '\0') ) { \ - var = NULL; \ - } \ - } \ - } while(0) - - dstate_getinfo_nonzero(v1, "L1.voltage"); - dstate_getinfo_nonzero(v2, "L2.voltage"); - dstate_getinfo_nonzero(v3, "L3.voltage"); - dstate_getinfo_nonzero(v1n, "L1-N.voltage"); - dstate_getinfo_nonzero(v2n, "L2-N.voltage"); - dstate_getinfo_nonzero(v3n, "L3-N.voltage"); - dstate_getinfo_nonzero(v1n, "L1-N.voltage"); - dstate_getinfo_nonzero(v12, "L1-L2.voltage"); - dstate_getinfo_nonzero(v23, "L2-L3.voltage"); - dstate_getinfo_nonzero(v31, "L3-L1.voltage"); - dstate_getinfo_nonzero(c1, "L1.current"); - dstate_getinfo_nonzero(c2, "L2.current"); - dstate_getinfo_nonzero(c3, "L3.current"); - dstate_getinfo_nonzero(v0, "voltage"); - dstate_getinfo_nonzero(c0, "current"); - - if ( (v1 && v2 && !v3) || - (v1n && v2n && !v3n) || - (c1 && c2 && !c3) || - (v12 && !v23 && !v31) ) { - upsdebugx(5, "%s(): determined a 2-phase case", __func__); - *num_phases = 2; - *inited_phaseinfo = 1; - detected_phaseinfo = 1; - } else if ( (v1 && v2 && v3) || - (v1n && v2n && v3n) || - (c1 && (c2 || c3)) || - (c2 && (c1 || c3)) || - (c3 && (c1 || c2)) || - v12 || v23 || v31 ) { - upsdebugx(5, "%s(): determined a 3-phase case", __func__); - *num_phases = 3; - *inited_phaseinfo = 1; - detected_phaseinfo = 1; - } else if ( /* We definitely have only one non-zero line */ - !v12 && !v23 && !v31 && ( - (c0 && !c1 && !c2 && !c3) || - (v0 && !v1 && !v2 && !v3) || - (c1 && !c2 && !c3) || - (!c1 && c2 && !c3) || - (!c1 && !c2 && c3) || - (v1 && !v2 && !v3) || - (!v1 && v2 && !v3) || - (!v1 && !v2 && v3) || - (v1n && !v2n && !v3n) || - (!v1n && v2n && !v3n) || - (!v1n && !v2n && v3n) ) ) { - *num_phases = 1; - *inited_phaseinfo = 1; - detected_phaseinfo = 1; - upsdebugx(5, "%s(): determined a 1-phase case", __func__); - } else { - upsdebugx(5, "%s(): could not determine the phase case", __func__); - } - - if (detected_phaseinfo) { - const char *oldphases; - strncpy(bufrw_ptr, "phases", bufrw_max); - oldphases = dstate_getinfo(buf); - - if (oldphases) { - if (atoi(oldphases) == *num_phases) { - /* Technically, a bit has changed: we have set the flag which may have been missing before */ - upsdebugx(5, "%s(): Nothing changed, with a valid reason; dstate already published with the same value: %s=%s (detected %d)", - __func__, buf, oldphases, *num_phases); - return 3; - } - } - - if ( (*num_phases != old_num_phases) || (!oldphases) ) { - if (may_change_dstate) { - dstate_setinfo(buf, "%d", *num_phases); - upsdebugx(3, "%s(): calculated non-XML value for NUT variable %s was set to %d", - __func__, buf, *num_phases); - } else { - upsdebugx(3, "%s(): calculated non-XML value for NUT variable %s=%d but did not set its dstate (read-only request)", - __func__, buf, *num_phases); - } - return 1; - } - } - - upsdebugx(5, "%s(): Nothing changed: could not determine a value", __func__); - return 0; - } - - upsdebugx(5, "%s(): Nothing changed, with a valid reason; already inited", __func__); - return 2; -} - -/* Dump the data tree (in upsc-like format) to stdout */ -/* Actual implementation */ -static int dstate_tree_dump(const st_tree_t *node) -{ - int ret; - - if (!node) { - return 1; /* not an error */ - } - - if (node->left) { - ret = dstate_tree_dump(node->left); - - if (!ret) { - return 0; /* write failed in the child */ - } - } - - printf("%s: %s\n", node->var, node->val); - - if (node->right) { - return dstate_tree_dump(node->right); - } - - return 1; /* everything's OK here ... */ -} - -/* Dump the data tree (in upsc-like format) to stdout */ -/* Public interface */ -void dstate_dump(void) -{ - upsdebugx(3, "Entering %s", __func__); - - const st_tree_t *node = (const st_tree_t *)dstate_getroot(); - - dstate_tree_dump(node); -} diff --git a/drivers/dstate.h b/drivers/dstate.h index 94829df..b4a5aa9 100644 --- a/drivers/dstate.h +++ b/drivers/dstate.h @@ -2,7 +2,7 @@ Copyright (C) 2003 Russell Kroll - 2012-2017 Arnaud Quette + 2012 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,7 +22,6 @@ #ifndef DSTATE_H_SEEN #define DSTATE_H_SEEN 1 -#include "timehead.h" #include "state.h" #include "attribute.h" @@ -32,10 +31,6 @@ #define DS_LISTEN_BACKLOG 16 #define DS_MAX_READ 256 /* don't read forever from upsd */ -#ifndef MAX_STRING_SIZE -#define MAX_STRING_SIZE 128 -#endif - /* track client connections */ typedef struct conn_s { int fd; @@ -46,11 +41,7 @@ typedef struct conn_s { extern struct ups_handler upsh; - /* asynchronous (nonblocking) Vs synchronous (blocking) I/O - * Defaults to nonblocking, for backward compatibility */ - extern int do_synchronous; - -char * dstate_init(const char *prog, const char *devname); +void dstate_init(const char *prog, const char *devname); int dstate_poll_fds(struct timeval timeout, int extrafd); int dstate_setinfo(const char *var, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); @@ -58,9 +49,7 @@ int dstate_addenum(const char *var, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); int dstate_addrange(const char *var, const int min, const int max); void dstate_setflags(const char *var, int flags); -void dstate_addflags(const char *var, const int addflags); -void dstate_delflags(const char *var, const int delflags); -void dstate_setaux(const char *var, long aux); +void dstate_setaux(const char *var, int aux); const char *dstate_getinfo(const char *var); void dstate_addcmd(const char *cmdname); int dstate_delinfo(const char *var); @@ -89,16 +78,5 @@ void status_commit(void); void alarm_init(void); void alarm_set(const char *buf); void alarm_commit(void); -void device_alarm_init(void); -void device_alarm_commit(const int device_number); - -int dstate_detect_phasecount( - const char *xput_prefix, - const int may_change_dstate, - int *inited_phaseinfo, - int *num_phases, - const int may_reevaluate); - -void dstate_dump(void); #endif /* DSTATE_H_SEEN */ diff --git a/drivers/dummy-ups.c b/drivers/dummy-ups.c index c75cc1e..7dbb991 100644 --- a/drivers/dummy-ups.c +++ b/drivers/dummy-ups.c @@ -1,7 +1,7 @@ /* dummy-ups.c - NUT simulation and device repeater driver Copyright (C) - 2005 - 2015 Arnaud Quette + 2005 - 2010 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,22 +29,18 @@ * * poll the "port" file for change */ -#include "config.h" /* must be the first header */ - #include #include #include -#include #include #include "main.h" #include "parseconf.h" -#include "nut_stdint.h" #include "upsclient.h" #include "dummy-ups.h" #define DRIVER_NAME "Device simulation and repeater driver" -#define DRIVER_VERSION "0.15" +#define DRIVER_VERSION "0.13" /* driver description structure */ upsdrv_info_t upsdrv_info = @@ -56,40 +52,16 @@ upsdrv_info_t upsdrv_info = { NULL } }; -enum drivermode { - MODE_NONE = 0, +#define MODE_NONE 0 +#define MODE_DUMMY 1 /* use the embedded defintion or a definition file */ +#define MODE_REPEATER 2 /* use libupsclient to repeat an UPS */ +#define MODE_META 3 /* consolidate data from several UPSs (TBS) */ - /* use the embedded defintion or a definition file, parsed in a - * loop again and again (often with TIMER lines to delay changes) - * Default mode for files with *.seq naming pattern - * (legacy-compatibility note: and other patterns except *.dev) - */ - MODE_DUMMY_LOOP, - - /* use the embedded defintion or a definition file, parsed once - * - * This allows to spin up a dummy device with initial readings - * and retain in memory whatever SET VAR was sent by clients later. - * This is also less stressful on system resources to run the dummy. - * - * Default mode for files with *.dev naming pattern - */ - MODE_DUMMY_ONCE, - - /* use libupsclient to repeat another UPS */ - MODE_REPEATER, - - /* consolidate data from several UPSs (TBS) */ - MODE_META -}; -typedef enum drivermode drivermode_t; - -static drivermode_t mode = MODE_NONE; +int mode=MODE_NONE; /* parseconf context, for dummy mode using a file */ -static PCONF_CTX_t *ctx = NULL; -static time_t next_update = -1; -static struct stat datafile_stat; +PCONF_CTX_t *ctx=NULL; +time_t next_update = -1; #define MAX_STRING_SIZE 128 @@ -105,7 +77,7 @@ static int upsclient_update_vars(void); /* connection information */ static char *client_upsname = NULL, *hostname = NULL; static UPSCONN_t *ups = NULL; -static uint16_t port; +static int port; /* Driver functions */ @@ -115,8 +87,7 @@ void upsdrv_initinfo(void) switch (mode) { - case MODE_DUMMY_ONCE: - case MODE_DUMMY_LOOP: + case MODE_DUMMY: /* Initialise basic essential variables */ for ( item = nut_data ; item->info_type != NULL ; item++ ) { @@ -140,7 +111,6 @@ void upsdrv_initinfo(void) dstate_dataok(); break; - case MODE_META: case MODE_REPEATER: /* Obtain the target name */ @@ -169,35 +139,10 @@ void upsdrv_initinfo(void) } /* FIXME: commands and settable variable! */ break; - - case MODE_NONE: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: + case MODE_NONE: fatalx(EXIT_FAILURE, "no suitable definition found!"); -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif + break; } upsh.instcmd = instcmd; @@ -212,48 +157,11 @@ void upsdrv_updateinfo(void) switch (mode) { - case MODE_DUMMY_LOOP: + case MODE_DUMMY: /* Now get user's defined variables */ if (parse_data_file(upsfd) >= 0) dstate_dataok(); break; - - case MODE_DUMMY_ONCE: - /* less stress on the sys */ - if (ctx == NULL && next_update == -1) { - struct stat fs; - char fn[SMALLBUF]; - - if (device_path[0] == '/') - snprintf(fn, sizeof(fn), "%s", device_path); - else - snprintf(fn, sizeof(fn), "%s/%s", confpath(), device_path); - - if (0 != fstat (upsfd, &fs) && 0 != stat (fn, &fs)) { - upsdebugx(2, "Can't open %s currently", fn); - /* retry ASAP until we get a file */ - memset(&datafile_stat, 0, sizeof(struct stat)); - next_update = 1; - } else { - if (datafile_stat.st_mtim.tv_sec != fs.st_mtim.tv_sec) { - upsdebugx(2, "upsdrv_updateinfo: input file was already read once to the end, but changed later - re-reading"); - /* updated file => retry ASAP */ - next_update = 1; - datafile_stat = fs; - } - } - } - - if (ctx == NULL && next_update == -1) { - upsdebugx(2, "upsdrv_updateinfo: NO-OP: input file was already read once to the end"); - dstate_dataok(); - } else { - /* initial parsing interrupted by e.g. TIMER line */ - if (parse_data_file(upsfd) >= 0) - dstate_dataok(); - } - break; - case MODE_META: case MODE_REPEATER: if (upsclient_update_vars() > 0) @@ -274,48 +182,19 @@ void upsdrv_updateinfo(void) } } break; - case MODE_NONE: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: break; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif } } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { fatalx(EXIT_FAILURE, "shutdown not supported"); } static int instcmd(const char *cmdname, const char *extra) -{ +{ /* if (!strcasecmp(cmdname, "test.battery.stop")) { ser_send_buf(upsfd, ...); @@ -327,7 +206,7 @@ static int instcmd(const char *cmdname, const char *extra) * if (mode == MODE_META) => ? */ - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -337,30 +216,13 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { - addvar(VAR_VALUE, "mode", "Specify mode instead of guessing it from port value (dummy = dummy-loop, dummy-once, repeater)"); /* meta */ } void upsdrv_initups(void) { - const char *val; - - val = dstate_getinfo("driver.parameter.mode"); - if (val) { - if (!strcmp(val, "dummy-loop") - && !strcmp(val, "dummy-once") - && !strcmp(val, "dummy") - && !strcmp(val, "repeater") - /* && !strcmp(val, "meta") */ - ) { - fatalx(EXIT_FAILURE, "Unsupported mode was specified: %s", val); - } - } - /* check the running mode... */ - if ( (!val && strchr(device_path, '@')) - || (val && !strcmp(val, "repeater")) - /*|| (val && !strcmp(val, "meta")) */ - ) { + if (strchr(device_path, '@')) + { upsdebugx(1, "Repeater mode"); mode = MODE_REPEATER; dstate_setinfo("driver.parameter.mode", "repeater"); @@ -368,95 +230,9 @@ void upsdrv_initups(void) } else { - char fn[SMALLBUF]; - mode = MODE_NONE; - - if (val) { - if (!strcmp(val, "dummy-loop")) { - upsdebugx(2, "Dummy (simulation) mode looping infinitely was explicitly requested"); - mode = MODE_DUMMY_LOOP; - } else - if (!strcmp(val, "dummy-once")) { - upsdebugx(2, "Dummy (simulation) mode with data read once was explicitly requested"); - mode = MODE_DUMMY_ONCE; - } else - if (!strcmp(val, "dummy")) { - upsdebugx(2, "Dummy (simulation) mode default (looping infinitely) was explicitly requested"); - mode = MODE_DUMMY_LOOP; - } - } - - if (mode == MODE_NONE) { - if (str_ends_with(device_path, ".seq")) { - upsdebugx(2, "Dummy (simulation) mode with a sequence file name pattern (looping infinitely)"); - mode = MODE_DUMMY_LOOP; - } else if (str_ends_with(device_path, ".dev")) { - upsdebugx(2, "Dummy (simulation) mode with a device data dump file name pattern (read once)"); - mode = MODE_DUMMY_ONCE; - } - } - - /* Report decisions similar to those above, - * just a bit shorter and at another level */ - switch (mode) { - case MODE_DUMMY_ONCE: - upsdebugx(1, "Dummy (simulation) mode using data read once"); - dstate_setinfo("driver.parameter.mode", "dummy-once"); - break; - - case MODE_DUMMY_LOOP: - upsdebugx(1, "Dummy (simulation) mode looping infinitely"); - dstate_setinfo("driver.parameter.mode", "dummy-loop"); - break; - - case MODE_NONE: - case MODE_REPEATER: - case MODE_META: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: - /* This was the only mode until MODE_DUMMY_LOOP - * got split from MODE_DUMMY_ONCE in NUT v2.8.0 - * so we keep the previously known mode string - * and it remains default when we are not sure - */ - upsdebugx(1, "Dummy (simulation) mode default (looping infinitely)"); - mode = MODE_DUMMY_LOOP; - dstate_setinfo("driver.parameter.mode", "dummy"); - break; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } - - if (device_path[0] == '/') - snprintf(fn, sizeof(fn), "%s", device_path); - else - snprintf(fn, sizeof(fn), "%s/%s", confpath(), device_path); - - if (0 != fstat (upsfd, &datafile_stat) && 0 != stat (device_path, &datafile_stat)) { - upsdebugx(2, "Can't open %s currently", device_path); - } + upsdebugx(1, "Dummy (simulation) mode"); + mode = MODE_DUMMY; + dstate_setinfo("driver.parameter.mode", "dummy"); } } @@ -533,12 +309,6 @@ static int setvar(const char *varname, const char *val) if (item->info_flags & ST_FLAG_STRING) dstate_setaux(item->info_type, item->info_len); } - else - { - upsdebugx(2, "setvar: unknown variable (%s), using default flags", varname); - dstate_setflags(varname, ST_FLAG_STRING | ST_FLAG_RW); - dstate_setaux(varname, 32); - } } return STAT_SET_HANDLED; } @@ -550,7 +320,7 @@ static int setvar(const char *varname, const char *val) static int upsclient_update_vars(void) { int ret; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; @@ -571,7 +341,7 @@ static int upsclient_update_vars(void) /* VAR */ if (numa < 4) { - upsdebugx(1, "Error: insufficient data (got %zu args, need at least 4)", numa); + upsdebugx(1, "Error: insufficient data (got %d args, need at least 4)", numa); } upsdebugx(5, "Received: %s %s %s %s", @@ -623,7 +393,6 @@ static int is_valid_data(const char* varname) static int is_valid_value(const char* varname, const char *value) { dummy_info_t *item; - NUT_UNUSED_VARIABLE(value); if ( (item = find_info(varname)) != NULL) { @@ -648,14 +417,13 @@ static void upsconf_err(const char *errmsg) /* for dummy mode * parse the definition file and process its content - */ -static int parse_data_file(int arg_upsfd) + */ +static int parse_data_file(int upsfd) { char fn[SMALLBUF]; char *ptr, var_value[MAX_STRING_SIZE]; - size_t value_args = 0, counter; + int value_args = 0, counter; time_t now; - NUT_UNUSED_VARIABLE(arg_upsfd); time(&now); @@ -757,7 +525,7 @@ static int parse_data_file(int arg_upsfd) ctx->arglist[0], var_value, ctx->errmsg); } else - { + { upsdebugx(3, "parse_data_file: added \"%s\" with value \"%s\"", ctx->arglist[0], var_value); } diff --git a/drivers/dummy-ups.h b/drivers/dummy-ups.h index 34240a5..49294ca 100644 --- a/drivers/dummy-ups.h +++ b/drivers/dummy-ups.h @@ -18,11 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_DUMMY_UPS_H_SEEN -#define NUT_DUMMY_UPS_H_SEEN 1 - /* This file lists all valid data with their type and info. - * + * * These are then enabled through a definition file, specified * as the "port" parameter (only the file name, not the path). * @@ -116,9 +113,7 @@ typedef struct { /* --------------------------------------------------------------- */ /* FIXME: need to enforce value check with enum or bounds */ -/* This array is only used from dummy-ups.c (there's a namesake - * for apcupsd-ups.c defined elsewhere) */ -static dummy_info_t nut_data[] = +dummy_info_t nut_data[] = { /* Essential variables, loaded before parsing the definition file */ { "ups.mfr", ST_FLAG_STRING | ST_FLAG_RW, 32, "Dummy Manufacturer", DU_FLAG_INIT, NULL }, @@ -191,7 +186,7 @@ battery.packs.bad { "ambient.humidity.high", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, { "ambient.humidity.low", ST_FLAG_RW, 1, NULL, DU_FLAG_NONE, NULL }, /* -FIXME: how to manage these? (i.e. index ) +FIXME: how to manage these? outlet.n.id outlet.n.desc outlet.n.switch @@ -200,7 +195,6 @@ outlet.n.switchable outlet.n.autoswitch.charge.low outlet.n.delay.shutdown outlet.n.delay.start -... driver.name driver.version @@ -239,5 +233,3 @@ beeper.disable /* end of structure. */ { NULL, 0, 0, NULL, DU_FLAG_NONE, NULL } }; - -#endif /* NUT_DUMMY_UPS_H_SEEN */ diff --git a/drivers/eaton-ats16-nm2-mib.c b/drivers/eaton-ats16-nm2-mib.c deleted file mode 100644 index 1980c30..0000000 --- a/drivers/eaton-ats16-nm2-mib.c +++ /dev/null @@ -1,280 +0,0 @@ -/* eaton-ats16-nm2-mib.c - subdriver to monitor Eaton ATS16 SNMP devices with NUT - * using newer Network-M2 cards - * - * Copyright (C) - * 2011-2012 Arnaud Quette - * 2016-2020 Eaton (author: Arnaud Quette ) - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-snmp-subdriver script. It must be customized! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "eaton-ats16-nm2-mib.h" - -#define EATON_ATS16_NM2_MIB_VERSION "0.22" - -#define EATON_ATS16_NM2_SYSOID ".1.3.6.1.4.1.534.10.2" /* newer Network-M2 */ -#define EATON_ATS16_NM2_MODEL ".1.3.6.1.4.1.534.10.2.1.2.0" - -static info_lkp_t eaton_ats16_nm2_source_info[] = { - { 1, "init", NULL, NULL }, - { 2, "diagnosis", NULL, NULL }, - { 3, "off", NULL, NULL }, - { 4, "1", NULL, NULL }, - { 5, "2", NULL, NULL }, - { 6, "safe", NULL, NULL }, - { 7, "fault", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nm2_sensitivity_info[] = { - { 1, "normal", NULL, NULL }, - { 2, "high", NULL, NULL }, - { 3, "low", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nm2_input_frequency_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "out-of-range", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nm2_input_voltage_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "derated-range", NULL, NULL }, /* Voltage derated */ - { 3, "out-of-range", NULL, NULL }, /* Voltage out of range triggered */ - { 4, "unknown", NULL, NULL }, /* "missing" */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nm2_test_result_info[] = { - { 1, "done and passed", NULL, NULL }, - { 2, "done and warning", NULL, NULL }, - { 3, "done and error", NULL, NULL }, - { 4, "aborted", NULL, NULL }, - { 5, "in progress", NULL, NULL }, - { 6, "no test initiated", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nm2_output_status_info[] = { - { 1, "OFF", NULL, NULL }, /* Output not powered */ - { 2, "OL", NULL, NULL }, /* Output powered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 1, "opened", NULL, NULL }, - { 2, "closed", NULL, NULL }, - { 3, "opened", NULL, NULL }, /* openWithNotice */ - { 4, "closed", NULL, NULL }, /* closedWithNotice */ - { 0, NULL, NULL, NULL } -}; - -/* EATON_ATS Snmp2NUT lookup table */ -static snmp_info_t eaton_ats16_nm2_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* ats2IdentManufacturer.0 = STRING: EATON */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.1.0", "Eaton", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentModel.0 = STRING: Eaton ATS */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.2.0", "ATS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware! */ - /* FIXME: the 2 "firmware" entries below should be SU_FLAG_SEMI_STATIC */ - /* ats2IdentFWVersion.0 = STRING: 00.00.0009 */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware.aux! */ - /* ats2IdentRelease.0 = STRING: 1.7.5 */ - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.7.0", NULL, SU_FLAG_OK, NULL }, - /* ats2IdentSerialNumber.0 = STRING: GA04F23009 */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.5.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentPartNumber.0 = STRING: EATS16N */ - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.6.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentAgentVersion.0 = STRING: 301F23C28 */ - /* { "unmapped.ats2IdentAgentVersion", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.7.0", NULL, SU_FLAG_OK, NULL, NULL }, */ - /* ats2InputDephasing.0 = INTEGER: 2 degrees */ - /* { "unmapped.ats2InputDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.2.1.1.0", NULL, SU_FLAG_OK, NULL, NULL }, */ - - /* Input collection */ - /* ats2InputIndex.source1 = INTEGER: source1(1) */ - { "input.1.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2InputIndex.source2 = INTEGER: source2(2) */ - { "input.2.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.2", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2InputVoltage.source1 = INTEGER: 2292 0.1 V */ - { "input.1.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputVoltage.source2 = INTEGER: 2432 0.1 V */ - { "input.2.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusVoltage.source1 = INTEGER: normalRange(1) */ - { "input.1.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.1", NULL, SU_FLAG_OK, eaton_ats16_nm2_input_voltage_status_info }, - /* ats2InputStatusVoltage.source2 = INTEGER: normalRange(1) */ - { "input.2.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.2", NULL, SU_FLAG_OK, eaton_ats16_nm2_input_voltage_status_info }, - /* ats2InputFrequency.source1 = INTEGER: 500 0.1 Hz */ - { "input.1.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputFrequency.source2 = INTEGER: 500 0.1 Hz */ - { "input.2.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusFrequency.source1 = INTEGER: good(1) */ - { "input.1.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.1", NULL, SU_FLAG_OK, eaton_ats16_nm2_input_frequency_status_info }, - /* ats2InputStatusFrequency.source2 = INTEGER: good(1) */ - { "input.2.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.2", NULL, SU_FLAG_OK, eaton_ats16_nm2_input_frequency_status_info }, - /* ats2ConfigSensitivity.0 = INTEGER: normal(1) */ - { "input.sensitivity", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.6.0", NULL, SU_FLAG_OK, &eaton_ats16_nm2_sensitivity_info[0] }, - /* ats2OperationMode.0 = INTEGER: source1(4) */ - { "input.source", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.2.4.0", NULL, SU_FLAG_OK, eaton_ats16_nm2_source_info }, - /* ats2ConfigPreferred.0 = INTEGER: source1(1) */ - { "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2InputDephasing = INTEGER: 181 */ - { "input.phase.shift", 0, 1, ".1.3.6.1.4.1.534.10.2.2.1.1.0", NULL, SU_FLAG_OK, NULL }, - - /* Output collection */ - /* ats2OutputVoltage.0 = INTEGER: 2304 0.1 V */ - { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigOutputVoltage.0 = INTEGER: 230 1 V */ - { "output.voltage.nominal", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.4.0", NULL, SU_FLAG_OK, NULL }, - /* ats2OutputCurrent.0 = INTEGER: 5 0.1 A */ - { "output.current", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.2.0", NULL, SU_FLAG_OK, NULL }, - - /* UPS collection */ - /* FIXME: RFC for device.test.result! */ - /* ats2ConfigTransferTest.0 = INTEGER: noTestInitiated(6) */ - { "ups.test.result", 0, 1, ".1.3.6.1.4.1.534.10.2.4.8.0", NULL, SU_FLAG_OK, eaton_ats16_nm2_test_result_info }, - /* FIXME: RFC for device.status! */ - /* ats2StatusOutput.0 = INTEGER: outputPowered(2) */ - { "ups.status", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.2.0", NULL, SU_FLAG_OK, eaton_ats16_nm2_output_status_info }, - - /* Ambient collection */ - /* ats2EnvRemoteTemp.0 = INTEGER: 0 degrees Centigrade */ - { "ambient.temperature", 0, 1, ".1.3.6.1.4.1.534.10.2.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteTempLowerLimit.0 = INTEGER: 5 degrees Centigrade */ - { "ambient.temperature.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteTempUpperLimit.0 = INTEGER: 40 degrees Centigrade */ - { "ambient.temperature.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.6.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidity.0 = INTEGER: 0 percent */ - { "ambient.humidity", 0, 1, ".1.3.6.1.4.1.534.10.2.5.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidityLowerLimit.0 = INTEGER: 5 percent */ - { "ambient.humidity.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.7.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidityUpperLimit.0 = INTEGER: 90 percent */ - { "ambient.humidity.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.8.0", NULL, SU_FLAG_OK, NULL }, - /* Dry contacts on EMP001 TH module */ - /* ats2ContactState.1 = INTEGER: open(1) */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.10.2.5.4.1.3.1", - NULL, SU_FLAG_OK, &eaton_ats16_ambient_drycontacts_info[0] }, - /* ats2ContactState.2 = INTEGER: open(1) */ - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.10.2.5.4.1.3.2", - NULL, SU_FLAG_OK, &eaton_ats16_ambient_drycontacts_info[0] }, - -#if 0 /* FIXME: Remaining data to be processed */ - /* ats2InputStatusDephasing.0 = INTEGER: normal(1) */ - { "unmapped.ats2InputStatusDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.3.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusIndex.source1 = INTEGER: source1(1) */ - { "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusIndex.source2 = INTEGER: source2(2) */ - { "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - - /* ats2InputStatusGood.source1 = INTEGER: voltageAndFreqNormalRange(2) */ - { "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusGood.source2 = INTEGER: voltageAndFreqNormalRange(2) */ - { "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusInternalFailure.source1 = INTEGER: good(1) */ - { "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusInternalFailure.source2 = INTEGER: good(1) */ - { "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - - /* ats2InputStatusUsed.source1 = INTEGER: poweringLoad(2) */ - { "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusUsed.source2 = INTEGER: notPoweringLoad(1) */ - { "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusInternalFailure.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.1.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2StatusOverload.0 = INTEGER: noOverload(1) */ - { "unmapped.ats2StatusOverload", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusOverTemperature.0 = INTEGER: noOverTemperature(1) */ - { "unmapped.ats2StatusOverTemperature", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.4.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusShortCircuit.0 = INTEGER: noShortCircuit(1) */ - { "unmapped.ats2StatusShortCircuit", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusCommunicationLost.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusCommunicationLost", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.6.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusConfigurationFailure.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusConfigurationFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.7.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeRTC.0 = Wrong Type (should be Counter32): Gauge32: 19191036 */ - { "unmapped.ats2ConfigTimeRTC", 0, 1, ".1.3.6.1.4.1.534.10.2.4.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeTextDate.0 = STRING: 08/11/1970 */ - { "unmapped.ats2ConfigTimeTextDate", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeTextTime.0 = STRING: 02/50/36 */ - { "unmapped.ats2ConfigTimeTextTime", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigInputVoltageRating.0 = INTEGER: 1 1 V */ - { "unmapped.ats2ConfigInputVoltageRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigInputFrequencyRating.0 = INTEGER: 50 Hz */ - { "unmapped.ats2ConfigInputFrequencyRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.3.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2ConfigTransferMode.0 = INTEGER: standard(1) */ - { "unmapped.ats2ConfigTransferMode", 0, 1, ".1.3.6.1.4.1.534.10.2.4.7.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2ConfigBrownoutLow.0 = INTEGER: 202 1 V */ - { "unmapped.ats2ConfigBrownoutLow", 0, 1, ".1.3.6.1.4.1.534.10.2.4.9.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigBrownoutLowDerated.0 = INTEGER: 189 1 V */ - { "unmapped.ats2ConfigBrownoutLowDerated", 0, 1, ".1.3.6.1.4.1.534.10.2.4.10.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigBrownoutHigh.0 = INTEGER: 258 1 V */ - { "unmapped.ats2ConfigBrownoutHigh", 0, 1, ".1.3.6.1.4.1.534.10.2.4.11.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigHysteresisVoltage.0 = INTEGER: 5 1 V */ - { "unmapped.ats2ConfigHysteresisVoltage", 0, 1, ".1.3.6.1.4.1.534.10.2.4.12.0", NULL, SU_FLAG_OK, NULL }, - - /* Ambient collection */ - /* ats2EnvNumContacts.0 = INTEGER: 2 */ - { "unmapped.ats2EnvNumContacts", 0, 1, ".1.3.6.1.4.1.534.10.2.5.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactIndex.1 = INTEGER: 1 */ - { "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactIndex.2 = INTEGER: 2 */ - { "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactType.1 = INTEGER: notUsed(4) */ - { "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactType.2 = INTEGER: notUsed(4) */ - { "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactState.1 = INTEGER: open(1) */ - { "unmapped.ats2ContactState", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactState.2 = INTEGER: open(1) */ - { "unmapped.ats2ContactState", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactDescr.1 = STRING: Input #1 */ - { "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactDescr.2 = STRING: Input #2 */ - { "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.2", NULL, SU_FLAG_OK, NULL }, -#endif /* if 0 */ - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -/* Note: keep the legacy definition intact, to avoid breaking compatibility */ - -/* FIXME: The lines below are duplicated to fix an issue with the code generator (nut-snmpinfo.py -> line is discarding) */ -/* Note: - * due to a bug in tools/nut-snmpinfo.py, prepending a 2nd mib2nut_info_t - * declaration with a comment line results in data extraction not being - * done for all entries in the file. Hence the above comment line being - * after its belonging declaration! */ - -/*mib2nut_info_t eaton_ats16_nm2 = { "eaton_ats16_nm2", EATON_ATS16_NM2_MIB_VERSION, NULL, EATON_ATS16_NM2_MODEL, eaton_ats16_nm2_mib, EATON_ATS16_NM2_SYSOID, NULL };*/ -mib2nut_info_t eaton_ats16_nm2 = { "eaton_ats16_nm2", EATON_ATS16_NM2_MIB_VERSION, NULL, EATON_ATS16_NM2_MODEL, eaton_ats16_nm2_mib, EATON_ATS16_NM2_SYSOID, NULL }; diff --git a/drivers/eaton-ats16-nm2-mib.h b/drivers/eaton-ats16-nm2-mib.h deleted file mode 100644 index 4fcd18c..0000000 --- a/drivers/eaton-ats16-nm2-mib.h +++ /dev/null @@ -1,30 +0,0 @@ -/* eaton_ats16-nm2-mib.h - subdriver to monitor Eaton ATS16 NM2 SNMP devices with NUT - * - * Copyright (C) - * 2011-2012 Arnaud Quette - * 2016-2017 Eaton (author: Arnaud Quette ) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_ATS16_NM2_MIB_H -#define EATON_ATS16_NM2_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t eaton_ats16_nm2; - -#endif /* EATON_ATS16_NM2_MIB_H */ diff --git a/drivers/eaton-ats16-nmc-mib.c b/drivers/eaton-ats16-nmc-mib.c deleted file mode 100644 index 8cf2496..0000000 --- a/drivers/eaton-ats16-nmc-mib.c +++ /dev/null @@ -1,275 +0,0 @@ -/* eaton-ats16-nmc-mib.c - subdriver to monitor Eaton ATS16 NMC SNMP devices with NUT - * using legacy NMC cards - * - * Copyright (C) - * 2011-2012 Arnaud Quette - * 2016-2020 Eaton (author: Arnaud Quette ) - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-snmp-subdriver script. It must be customized! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "eaton-ats16-nmc-mib.h" - -#define EATON_ATS16_NMC_MIB_VERSION "0.21" - -#define EATON_ATS16_NMC_SYSOID ".1.3.6.1.4.1.705.1" /* legacy NMC */ -#define EATON_ATS16_NMC_MODEL ".1.3.6.1.4.1.534.10.2.1.2.0" - -static info_lkp_t eaton_ats16_nmc_source_info[] = { - { 1, "init", NULL, NULL }, - { 2, "diagnosis", NULL, NULL }, - { 3, "off", NULL, NULL }, - { 4, "1", NULL, NULL }, - { 5, "2", NULL, NULL }, - { 6, "safe", NULL, NULL }, - { 7, "fault", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nmc_sensitivity_info[] = { - { 1, "normal", NULL, NULL }, - { 2, "high", NULL, NULL }, - { 3, "low", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nmc_input_frequency_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "out-of-range", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nmc_input_voltage_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "derated-range", NULL, NULL }, /* Voltage derated */ - { 3, "out-of-range", NULL, NULL }, /* Voltage out of range triggered */ - { 4, "unknown", NULL, NULL }, /* "missing" */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nmc_test_result_info[] = { - { 1, "done and passed", NULL, NULL }, - { 2, "done and warning", NULL, NULL }, - { 3, "done and error", NULL, NULL }, - { 4, "aborted", NULL, NULL }, - { 5, "in progress", NULL, NULL }, - { 6, "no test initiated", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_nmc_output_status_info[] = { - { 1, "OFF", NULL, NULL }, /* Output not powered */ - { 2, "OL", NULL, NULL }, /* Output powered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats16_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 1, "opened", NULL, NULL }, - { 2, "closed", NULL, NULL }, - { 3, "opened", NULL, NULL }, /* openWithNotice */ - { 4, "closed", NULL, NULL }, /* closedWithNotice */ - { 0, NULL, NULL, NULL } -}; - -/* EATON_ATS_NMC Snmp2NUT lookup table */ -static snmp_info_t eaton_ats16_nmc_mib[] = { - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* ats2IdentManufacturer.0 = STRING: EATON */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.1.0", "Eaton", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentModel.0 = STRING: Eaton ATS */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.2.0", "ATS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware! */ - /* FIXME: the 2 "firmware" entries below should be SU_FLAG_SEMI_STATIC */ - /* ats2IdentFWVersion.0 = STRING: 00.00.0009 */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* FIXME: RFC for device.firmware.aux! */ - /* ats2IdentRelease.0 = STRING: JF */ - { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.4.0", NULL, SU_FLAG_OK, NULL }, - /* ats2IdentSerialNumber.0 = STRING: GA04F23009 */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.5.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentPartNumber.0 = STRING: EATS16N */ - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.6.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2IdentAgentVersion.0 = STRING: 301F23C28 */ - /* { "unmapped.ats2IdentAgentVersion", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.1.7.0", NULL, SU_FLAG_OK, NULL, NULL }, */ - /* ats2InputDephasing.0 = INTEGER: 2 degrees */ - /* { "unmapped.ats2InputDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.2.1.1.0", NULL, SU_FLAG_OK, NULL, NULL }, */ - - /* Input collection */ - /* ats2InputIndex.source1 = INTEGER: source1(1) */ - { "input.1.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2InputIndex.source2 = INTEGER: source2(2) */ - { "input.2.id", 0, 1, ".1.3.6.1.4.1.534.10.2.2.2.1.1.2", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* ats2InputVoltage.source1 = INTEGER: 2292 0.1 V */ - { "input.1.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputVoltage.source2 = INTEGER: 2432 0.1 V */ - { "input.2.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusVoltage.source1 = INTEGER: normalRange(1) */ - { "input.1.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.1", NULL, SU_FLAG_OK, eaton_ats16_nmc_input_voltage_status_info }, - /* ats2InputStatusVoltage.source2 = INTEGER: normalRange(1) */ - { "input.2.voltage.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.5.2", NULL, SU_FLAG_OK, eaton_ats16_nmc_input_voltage_status_info }, - /* ats2InputFrequency.source1 = INTEGER: 500 0.1 Hz */ - { "input.1.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputFrequency.source2 = INTEGER: 500 0.1 Hz */ - { "input.2.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusFrequency.source1 = INTEGER: good(1) */ - { "input.1.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.1", NULL, SU_FLAG_OK, eaton_ats16_nmc_input_frequency_status_info }, - /* ats2InputStatusFrequency.source2 = INTEGER: good(1) */ - { "input.2.frequency.status", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.2.2", NULL, SU_FLAG_OK, eaton_ats16_nmc_input_frequency_status_info }, - /* ats2ConfigSensitivity.0 = INTEGER: normal(1) */ - { "input.sensitivity", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.6.0", NULL, SU_FLAG_OK, &eaton_ats16_nmc_sensitivity_info[0] }, - /* ats2OperationMode.0 = INTEGER: source1(4) */ - { "input.source", ST_FLAG_STRING, 1, ".1.3.6.1.4.1.534.10.2.2.4.0", NULL, SU_FLAG_OK, eaton_ats16_nmc_source_info }, - /* ats2ConfigPreferred.0 = INTEGER: source1(1) */ - { "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2InputDephasing = INTEGER: 181 */ - { "input.phase.shift", 0, 1, ".1.3.6.1.4.1.534.10.2.2.1.1.0", NULL, SU_FLAG_OK, NULL }, - - /* Output collection */ - /* ats2OutputVoltage.0 = INTEGER: 2304 0.1 V */ - { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigOutputVoltage.0 = INTEGER: 230 1 V */ - { "output.voltage.nominal", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.4.4.0", NULL, SU_FLAG_OK, NULL }, - /* ats2OutputCurrent.0 = INTEGER: 5 0.1 A */ - { "output.current", 0, 0.1, ".1.3.6.1.4.1.534.10.2.2.3.2.0", NULL, SU_FLAG_OK, NULL }, - - /* UPS collection */ - /* FIXME: RFC for device.test.result! */ - /* ats2ConfigTransferTest.0 = INTEGER: noTestInitiated(6) */ - { "ups.test.result", 0, 1, ".1.3.6.1.4.1.534.10.2.4.8.0", NULL, SU_FLAG_OK, eaton_ats16_nmc_test_result_info }, - /* FIXME: RFC for device.status! */ - /* ats2StatusOutput.0 = INTEGER: outputPowered(2) */ - { "ups.status", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.2.0", NULL, SU_FLAG_OK, eaton_ats16_nmc_output_status_info }, - - /* Ambient collection */ - /* ats2EnvRemoteTemp.0 = INTEGER: 0 degrees Centigrade */ - { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.10.2.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteTempLowerLimit.0 = INTEGER: 5 degrees Centigrade */ - { "ambient.temperature.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteTempUpperLimit.0 = INTEGER: 40 degrees Centigrade */ - { "ambient.temperature.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.6.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidity.0 = INTEGER: 0 percent */ - { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.10.2.5.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidityLowerLimit.0 = INTEGER: 5 percent */ - { "ambient.humidity.low", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.7.0", NULL, SU_FLAG_OK, NULL }, - /* ats2EnvRemoteHumidityUpperLimit.0 = INTEGER: 90 percent */ - { "ambient.humidity.high", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.2.5.8.0", NULL, SU_FLAG_OK, NULL }, - /* Dry contacts on EMP001 TH module */ - /* ats2ContactState.1 = INTEGER: open(1) */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.10.2.5.4.1.3.1", - NULL, SU_FLAG_OK, &eaton_ats16_ambient_drycontacts_info[0] }, - /* ats2ContactState.2 = INTEGER: open(1) */ - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.10.2.5.4.1.3.2", - NULL, SU_FLAG_OK, &eaton_ats16_ambient_drycontacts_info[0]}, - -#if 0 /* FIXME: Remaining data to be processed */ - /* ats2InputStatusDephasing.0 = INTEGER: normal(1) */ - { "unmapped.ats2InputStatusDephasing", 0, 1, ".1.3.6.1.4.1.534.10.2.3.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusIndex.source1 = INTEGER: source1(1) */ - { "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusIndex.source2 = INTEGER: source2(2) */ - { "unmapped.ats2InputStatusIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - - /* ats2InputStatusGood.source1 = INTEGER: voltageAndFreqNormalRange(2) */ - { "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusGood.source2 = INTEGER: voltageAndFreqNormalRange(2) */ - { "unmapped.ats2InputStatusGood", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusInternalFailure.source1 = INTEGER: good(1) */ - { "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusInternalFailure.source2 = INTEGER: good(1) */ - { "unmapped.ats2InputStatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - - /* ats2InputStatusUsed.source1 = INTEGER: poweringLoad(2) */ - { "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* ats2InputStatusUsed.source2 = INTEGER: notPoweringLoad(1) */ - { "unmapped.ats2InputStatusUsed", 0, 1, ".1.3.6.1.4.1.534.10.2.3.2.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusInternalFailure.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusInternalFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.1.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2StatusOverload.0 = INTEGER: noOverload(1) */ - { "unmapped.ats2StatusOverload", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusOverTemperature.0 = INTEGER: noOverTemperature(1) */ - { "unmapped.ats2StatusOverTemperature", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.4.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusShortCircuit.0 = INTEGER: noShortCircuit(1) */ - { "unmapped.ats2StatusShortCircuit", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.5.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusCommunicationLost.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusCommunicationLost", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.6.0", NULL, SU_FLAG_OK, NULL }, - /* ats2StatusConfigurationFailure.0 = INTEGER: good(1) */ - { "unmapped.ats2StatusConfigurationFailure", 0, 1, ".1.3.6.1.4.1.534.10.2.3.3.7.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeRTC.0 = Wrong Type (should be Counter32): Gauge32: 19191036 */ - { "unmapped.ats2ConfigTimeRTC", 0, 1, ".1.3.6.1.4.1.534.10.2.4.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeTextDate.0 = STRING: 08/11/1970 */ - { "unmapped.ats2ConfigTimeTextDate", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigTimeTextTime.0 = STRING: 02/50/36 */ - { "unmapped.ats2ConfigTimeTextTime", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.4.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigInputVoltageRating.0 = INTEGER: 1 1 V */ - { "unmapped.ats2ConfigInputVoltageRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.2.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigInputFrequencyRating.0 = INTEGER: 50 Hz */ - { "unmapped.ats2ConfigInputFrequencyRating", 0, 1, ".1.3.6.1.4.1.534.10.2.4.3.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2ConfigTransferMode.0 = INTEGER: standard(1) */ - { "unmapped.ats2ConfigTransferMode", 0, 1, ".1.3.6.1.4.1.534.10.2.4.7.0", NULL, SU_FLAG_OK, NULL }, - - /* ats2ConfigBrownoutLow.0 = INTEGER: 202 1 V */ - { "unmapped.ats2ConfigBrownoutLow", 0, 1, ".1.3.6.1.4.1.534.10.2.4.9.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigBrownoutLowDerated.0 = INTEGER: 189 1 V */ - { "unmapped.ats2ConfigBrownoutLowDerated", 0, 1, ".1.3.6.1.4.1.534.10.2.4.10.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigBrownoutHigh.0 = INTEGER: 258 1 V */ - { "unmapped.ats2ConfigBrownoutHigh", 0, 1, ".1.3.6.1.4.1.534.10.2.4.11.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ConfigHysteresisVoltage.0 = INTEGER: 5 1 V */ - { "unmapped.ats2ConfigHysteresisVoltage", 0, 1, ".1.3.6.1.4.1.534.10.2.4.12.0", NULL, SU_FLAG_OK, NULL }, - - /* Ambient collection */ - /* ats2EnvNumContacts.0 = INTEGER: 2 */ - { "unmapped.ats2EnvNumContacts", 0, 1, ".1.3.6.1.4.1.534.10.2.5.3.0", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactIndex.1 = INTEGER: 1 */ - { "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactIndex.2 = INTEGER: 2 */ - { "unmapped.ats2ContactIndex", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactType.1 = INTEGER: notUsed(4) */ - { "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactType.2 = INTEGER: notUsed(4) */ - { "unmapped.ats2ContactType", 0, 1, ".1.3.6.1.4.1.534.10.2.5.4.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactDescr.1 = STRING: Input #1 */ - { "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* ats2ContactDescr.2 = STRING: Input #2 */ - { "unmapped.ats2ContactDescr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.2.5.4.1.4.2", NULL, SU_FLAG_OK, NULL }, -#endif /* if 0 */ - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -/* Note: keep the legacy definition intact, to avoid breaking compatibility */ - -/* FIXME: The lines below are duplicated to fix an issue with the code generator (nut-snmpinfo.py -> line is discarding) */ -/* Note: - * due to a bug in tools/nut-snmpinfo.py, prepending a 2nd mib2nut_info_t - * declaration with a comment line results in data extraction not being - * done for all entries in the file. Hence the above comment line being - * after its belonging declaration! */ - -/*mib2nut_info_t eaton_ats16_nmc = { "eaton_ats16_nmc", EATON_ATS16_NMC_MIB_VERSION, NULL, EATON_ATS16_NMC_MODEL, EATON_ATS16_NMC_mib, EATON_ATS16_NMC_SYSOID, NULL }; */ -mib2nut_info_t eaton_ats16_nmc = { "eaton_ats16_nmc", EATON_ATS16_NMC_MIB_VERSION, NULL, EATON_ATS16_NMC_MODEL, eaton_ats16_nmc_mib, EATON_ATS16_NMC_SYSOID, NULL }; diff --git a/drivers/eaton-ats16-nmc-mib.h b/drivers/eaton-ats16-nmc-mib.h deleted file mode 100644 index 14431b0..0000000 --- a/drivers/eaton-ats16-nmc-mib.h +++ /dev/null @@ -1,30 +0,0 @@ -/* eaton_ats16-nmc-mib.h - subdriver to monitor Eaton ATS16 NMC SNMP devices with NUT - * - * Copyright (C) - * 2011-2012 Arnaud Quette - * 2016-2017 Eaton (author: Arnaud Quette ) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_ATS16_NMC_MIB_H -#define EATON_ATS16_NMC_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t eaton_ats16_nmc; - -#endif /* EATON_ATS16_NMC_MIB_H */ diff --git a/drivers/eaton-ats30-mib.c b/drivers/eaton-ats30-mib.c deleted file mode 100644 index ec03aab..0000000 --- a/drivers/eaton-ats30-mib.c +++ /dev/null @@ -1,372 +0,0 @@ -/* eaton-ats30-mib.c - subdriver to monitor eaton_ats30 SNMP devices with NUT - * - * Copyright (C) 2017 Eaton - * Author: Tomas Halman - * 2011-2012 Arnaud Quette - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-snmp-subdriver script. It must be customized! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "eaton-ats30-mib.h" - -#define EATON_ATS30_MIB_VERSION "0.03" - -#define EATON_ATS30_SYSOID ".1.3.6.1.4.1.534.10.1" -#define EATON_ATS30_MODEL ".1.3.6.1.4.1.534.10.1.2.1.0" - -static info_lkp_t eaton_ats30_source_info[] = { - { 1, "init", NULL, NULL }, - { 2, "diagnosis", NULL, NULL }, - { 3, "off", NULL, NULL }, - { 4, "1", NULL, NULL }, - { 5, "2", NULL, NULL }, - { 6, "safe", NULL, NULL }, - { 7, "fault", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_ats30_input_sensitivity[] = { - { 1, "high", NULL, NULL }, - { 2, "low", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* - * bitmap values of atsStatus.atsFailureIndicator - * - * 1 atsFailureSwitchFault N/A - * 2 atsFailureNoOutput OFF - * 3 atsFailureOutputOC OVER - * 4 atsFailureOverTemperature N/A - */ -static info_lkp_t eaton_ats30_status_info[] = { - { 0, "OL", NULL, NULL }, - { 1, "OL", NULL, NULL }, /* SwitchFault */ - { 2, "OFF", NULL, NULL }, /* NoOutput */ - { 3, "OFF", NULL, NULL }, /* SwitchFault + NoOutput */ - { 4, "OL OVER", NULL, NULL }, /* OutputOC */ - { 5, "OL OVER", NULL, NULL }, /* OutputOC + SwitchFault */ - { 6, "OFF OVER", NULL, NULL }, /* OutputOC + NoOutput */ - { 7, "OFF OVER", NULL, NULL }, /* OutputOC + SwitchFault + NoOutput */ - { 8, "OL", NULL, NULL }, /* OverTemperature */ - { 9, "OL", NULL, NULL }, /* OverTemperature + SwitchFault */ - { 10, "OFF", NULL, NULL }, /* OverTemperature + NoOutput */ - { 11, "OFF", NULL, NULL }, /* OverTemperature + SwitchFault + NoOutput */ - { 12, "OL OVER", NULL, NULL }, /* OverTemperature + OutputOC */ - { 13, "OL OVER", NULL, NULL }, /* OverTemperature + OutputOC + SwitchFault */ - { 14, "OFF OVER", NULL, NULL }, /* OverTemperature + OutputOC + NoOutput */ - { 15, "OFF OVER", NULL, NULL }, /* OverTemperature + OutputOC + SwitchFault + NoOutput */ - { 0, NULL, NULL, NULL } -}; - -/* EATON_ATS30 Snmp2NUT lookup table */ -static snmp_info_t eaton_ats30_mib[] = { - /* device type: ats */ - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "ats", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* enterprises.534.10.1.1.1.0 = STRING: "Eaton" */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.1.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.1.2.0 = STRING: "01.12.13b" -- SNMP agent version */ - /* { "device.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.1.2.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.1.3.1.0 = INTEGER: 1 */ - /* { "unmapped.enterprise", 0, 1, ".1.3.6.1.4.1.534.10.1.1.3.1.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.2.1.0 = STRING: "STS30002SR10019 " */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.2.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.2.2.0 = STRING: "1A0003AR00.00.00" -- Firmware */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.2.2.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.2.3.0 = STRING: "2014-09-17 " -- Release date */ - /* { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.2.3.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.2.4.0 = STRING: "JA00E52021 " */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.2.4.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.2.5.0 = STRING: " " -- Device ID codes */ - /* { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.2.5.0", NULL, SU_FLAG_OK, NULL }, */ - - /* ats measure */ - /* =========== */ - /* enterprises.534.10.1.3.1.1.1.1 = INTEGER: 1 */ - { "input.1.id", 0, 1, ".1.3.6.1.4.1.534.10.1.3.1.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.1.1.1.2 = INTEGER: 2 */ - { "input.2.id", 0, 1, ".1.3.6.1.4.1.534.10.1.3.1.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.1.1.2.1 = INTEGER: 2379 */ - { "input.1.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.1.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.1.1.2.2 = INTEGER: 0 */ - { "input.2.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.1.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.1.1.3.1 = INTEGER: 500 */ - { "input.1.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.1.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.1.1.3.2 = INTEGER: 0 */ - { "input.2.frequency", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.1.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.2.1.0 = INTEGER: 2375 */ - { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.2.1.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.2.2.0 = INTEGER: 0 */ - { "output.current", 0, 0.1, ".1.3.6.1.4.1.534.10.1.3.2.2.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.3.0 = INTEGER: 25 -- internal temperature in celsius */ - { "ups.temperature", 0, 1, ".1.3.6.1.4.1.534.10.1.3.3.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.4.0 = INTEGER: 77 -- internal temperature in fahrenheit */ - /* { "ups.temperatureF", 0, 1, ".1.3.6.1.4.1.534.10.1.3.4.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.3.5.0 = INTEGER: 37937541 */ - { "device.uptime", 0, 1, ".1.3.6.1.4.1.534.10.1.3.5.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.3.6.0 = INTEGER: 284 */ - /* { "unmapped.atsMessureTransferedTimes", 0, 1, ".1.3.6.1.4.1.534.10.1.3.6.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.3.7.0 = INTEGER: 4 */ - { "input.source", 0, 1, ".1.3.6.1.4.1.534.10.1.3.7.0", NULL, SU_FLAG_OK, eaton_ats30_source_info }, - - /* atsStatus */ - /* ========= */ -#if 0 - /* NOTE: Unused OIDs are left as comments for potential future improvements */ - /* enterprises.534.10.1.4.1.0 = INTEGER: 7 */ - { "unmapped.atsInputFlowIndicator", 0, 1, ".1.3.6.1.4.1.534.10.1.4.1.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.1.1 = INTEGER: 1 -- atsInputFlowTable start */ - { "unmapped.atsInputFlowIndex.1", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.1.2 = INTEGER: 2 */ - { "unmapped.atsInputFlowIndex.2", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.2.1 = INTEGER: 1 */ - { "unmapped.atsInputFlowRelay.1", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.2.2 = INTEGER: 2 */ - { "unmapped.atsInputFlowRelay.2", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.3.1 = INTEGER: 1 */ - { "unmapped.atsInputFlowSCR.1", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.3.2 = INTEGER: 2 */ - { "unmapped.atsInputFlowSCR.2", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.4.1 = INTEGER: 1 */ - { "unmapped.atsInputFlowParallelRelay.1", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.2.1.4.2 = INTEGER: 2 */ - { "unmapped.atsInputFlowParallelRelay.2", 0, 1, ".1.3.6.1.4.1.534.10.1.4.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.3.0 = INTEGER: 58720256 */ - { "unmapped.atsInputFailureIndicator", 0, 1, ".1.3.6.1.4.1.534.10.1.4.3.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.1.1 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.1.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.2.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.2.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.3.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.3.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.4.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.4.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.5.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.5.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.6.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.6.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.7.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.7.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.7.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.8.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.8.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.8.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.8.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.9.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.9.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.9.2 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.9.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.10.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.10.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.10.2 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.10.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.11.1 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.11.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.4.1.11.2 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.4.1.11.2", NULL, SU_FLAG_OK, NULL }, -#endif /* 0 */ - - /* enterprises.atsFailureIndicator = INTEGER: 0 */ - { "ups.status", 0, 1, ".1.3.6.1.4.1.534.10.1.4.5.0", NULL, SU_FLAG_OK, eaton_ats30_status_info }, - -#if 0 - /* enterprises.534.10.1.4.6.1.0 = INTEGER: 2 -- atsFailure start */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.6.1.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.6.2.0 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.6.2.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.6.3.0 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.6.3.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.4.6.4.0 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.4.6.4.0", NULL, SU_FLAG_OK, NULL }, -#endif /* 0 */ - - /* atsLog */ - /* ====== */ -#if 0 - /* We are not interested in log */ - /* enterprises.534.10.1.5.1.0 = INTEGER: 272 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.1.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.1 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.3 = INTEGER: 3 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.3", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.4 = INTEGER: 4 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.5 = INTEGER: 5 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.6 = INTEGER: 6 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.7 = INTEGER: 7 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.8 = INTEGER: 8 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.9 = INTEGER: 9 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.9", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.1.10 = INTEGER: 10 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.1.10", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.1 = INTEGER: 1482323677 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.2 = INTEGER: 1480076955 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.3 = INTEGER: 1480069128 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.3", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.4 = INTEGER: 1480069093 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.4", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.5 = INTEGER: 1478693745 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.5", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.6 = INTEGER: 1478693741 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.6", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.7 = INTEGER: 1466604406 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.7", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.8 = INTEGER: 1466604386 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.8", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.9 = INTEGER: 1466604386 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.9", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.2.10 = INTEGER: 1463038288 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.2.10", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.1 = INTEGER: 41 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.2 = INTEGER: 41 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.3 = INTEGER: 44 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.3", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.4 = INTEGER: 44 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.4", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.5 = INTEGER: 44 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.5", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.6 = INTEGER: 41 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.6", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.7 = INTEGER: 41 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.7", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.8 = INTEGER: 46 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.8", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.9 = INTEGER: 45 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.9", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.3.10 = INTEGER: 41 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.5.2.1.3.10", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.1 = STRING: "12:34:37 12/21/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.2 = STRING: "12:29:15 11/25/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.3 = STRING: "10:18:48 11/25/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.3", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.4 = STRING: "10:18:13 11/25/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.4", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.5 = STRING: "12:15:45 11/09/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.5", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.6 = STRING: "12:15:41 11/09/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.6", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.7 = STRING: "14:06:46 06/22/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.7", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.8 = STRING: "14:06:26 06/22/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.8", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.9 = STRING: "14:06:26 06/22/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.9", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.5.2.1.4.10 = STRING: "07:31:28 05/12/2016" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.5.2.1.4.10", NULL, SU_FLAG_OK, NULL }, -#endif /* 0 */ - - /* atsConfig */ - /* ========= */ -#if 0 - /* enterprises.534.10.1.6.1.1.0 = INTEGER: 538562409 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.1.1.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.1.2.0 = STRING: "01/24/2017" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.6.1.2.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.1.3.0 = STRING: "08:40:09" */ - { "unmapped.enterprises", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.10.1.6.1.3.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.1.1 = INTEGER: 1 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.1.2 = INTEGER: 2 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.1.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.2.1 = INTEGER: 1700 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.2.2 = INTEGER: 1700 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.2.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.3.1 = INTEGER: 1800 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.3.2 = INTEGER: 1800 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.3.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.4.1 = INTEGER: 2640 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.4.2 = INTEGER: 2640 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.4.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.5.1 = INTEGER: 3000 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.5.2 = INTEGER: 3000 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.5.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.6.1 = INTEGER: 50 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.6.2 = INTEGER: 50 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.6.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.7.1 = INTEGER: 40 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.2.1.7.2 = INTEGER: 40 */ - { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.6.2.1.7.2", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.3.0 = INTEGER: 2640 */ - { "unmapped.atsConfigInputVoltageRating", 0, 1, ".1.3.6.1.4.1.534.10.1.6.3.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.4.0 = INTEGER: 26 */ - { "unmapped.atsConfigRandomTime", 0, 1, ".1.3.6.1.4.1.534.10.1.6.4.0", NULL, SU_FLAG_OK, NULL }, -#endif /* 0 */ - - /* enterprises.534.10.1.6.5.0 = INTEGER: 1 */ - { "input.source.preferred", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.1.6.5.0", NULL, SU_FLAG_OK, NULL }, - /* enterprises.534.10.1.6.6.0 = INTEGER: 2 */ - { "input.sensitivity", ST_FLAG_RW, 1, ".1.3.6.1.4.1.534.10.1.6.6.0", NULL, SU_FLAG_OK, eaton_ats30_input_sensitivity }, - - /* enterprises.534.10.1.6.7.0 = INTEGER: 2 */ - /* { "unmapped.atsConfigTest", 0, 1, ".1.3.6.1.4.1.534.10.1.6.7.0", NULL, SU_FLAG_OK, NULL }, */ - - /* atsUpgrade */ - /* ========== */ -#if 0 - /* We are not interested in atsUpgrade */ - /* enterprises.534.10.1.7.1.0 = INTEGER: 1 */ - /* { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.7.1.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.7.2.0 = INTEGER: 1 */ - /* { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.7.2.0", NULL, SU_FLAG_OK, NULL }, */ - /* enterprises.534.10.1.7.3.0 = INTEGER: 0 */ - /* { "unmapped.enterprises", 0, 1, ".1.3.6.1.4.1.534.10.1.7.3.0", NULL, SU_FLAG_OK, NULL }, */ -#endif /* 0 */ - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t eaton_ats30 = { "eaton_ats30", EATON_ATS30_MIB_VERSION, NULL, EATON_ATS30_MODEL, eaton_ats30_mib, EATON_ATS30_SYSOID, NULL }; diff --git a/drivers/eaton-ats30-mib.h b/drivers/eaton-ats30-mib.h deleted file mode 100644 index 09b0b18..0000000 --- a/drivers/eaton-ats30-mib.h +++ /dev/null @@ -1,29 +0,0 @@ -/* eaton_ats30-mib.h - subdriver to monitor eaton_ats30 SNMP devices with NUT - * - * Copyright (C) 2017 Eaton - * Author: Tomas Halman - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_ATS30_MIB_H -#define EATON_ATS30_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t eaton_ats30; - -#endif /* EATON_ATS30_MIB_H */ diff --git a/drivers/eaton-mib.c b/drivers/eaton-mib.c new file mode 100644 index 0000000..b06006e --- /dev/null +++ b/drivers/eaton-mib.c @@ -0,0 +1,460 @@ +/* eaton-mib.c - data to monitor Eaton Aphel PDUs (Basic and Complex) + * + * Copyright (C) 2008 - 2012 + * Arnaud Quette + * Arnaud Quette + * + * Supported by Eaton + * and previously MGE Office Protection Systems + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "eaton-mib.h" + +#define EATON_APHEL_MIB_VERSION "0.46" + +/* APHEL-GENESIS-II-MIB (monitored ePDU) + * ************************************* + * Note: we should also be able to support this one using netxml-ups! + */ + +#define APHEL1_OID_MIB ".1.3.6.1.4.1.17373" +#define APHEL1_SYSOID APHEL1_OID_MIB +#define APHEL1_OID_MODEL_NAME ".1.3.6.1.4.1.17373.3.1.1.0" +#define APHEL1_OID_FIRMREV ".1.3.6.1.4.1.17373.3.1.2.0" +#define APHEL1_OID_DEVICE_NAME ".1.3.6.1.4.1.17373.3.1.3.0" +#define APHEL1_OID_UNIT_MACADDR ".1.3.6.1.4.1.17373.3.1.4.0" +/* needs concat ..0 */ +#define APHEL1_OID_OUTLET_CURRENT ".1.3.6.1.4.1.17373.3.2" + +/* Snmp2NUT lookup table for GenesisII MIB */ +static snmp_info_t eaton_aphel_genesisII_mib[] = { + /* Device page */ + { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "device.model", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_MODEL_NAME, + "Eaton Powerware ePDU Monitored", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + + /* UPS page */ + { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_MODEL_NAME, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_DEVICE_NAME, + "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_FIRMREV, "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_UNIT_MACADDR, "unknown", + 0, NULL, NULL }, + + /* Outlet page */ + /* we can't use template since there is no counterpart to outlet.count */ + { "outlet.1.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".1.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.2.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".2.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.3.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".3.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.4.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".4.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.5.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".5.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.6.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".6.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.7.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".7.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + { "outlet.8.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".8.0", NULL, SU_FLAG_NEGINVALID, NULL, NULL }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } +}; + + +/* APHEL PDU-MIB - Revelation MIB (Managed ePDU) + * ********************************************* */ + +#define AR_BASE_OID ".1.3.6.1.4.1.534.6.6.6" +#define APHEL2_SYSOID AR_BASE_OID +#define APHEL2_OID_MODEL_NAME AR_OID_MODEL_NAME + +#define AR_OID_MODEL_NAME AR_BASE_OID ".1.1.12.0" +#define AR_OID_DEVICE_NAME AR_BASE_OID ".1.1.13.0" +#define AR_OID_FIRMREV AR_BASE_OID ".1.1.1.0" +#define AR_OID_SERIAL AR_BASE_OID ".1.1.2.0" +#define AR_OID_UNIT_MACADDR AR_BASE_OID ".1.1.6.0" + +#define AR_OID_UNIT_CURRENT AR_BASE_OID ".1.3.1.1" +#define AR_OID_UNIT_VOLTAGE AR_BASE_OID ".1.3.1.2" +#define AR_OID_UNIT_ACTIVEPOWER AR_BASE_OID ".1.3.1.3" +#define AR_OID_UNIT_APPARENTPOWER AR_BASE_OID ".1.3.1.4" +#define AR_OID_UNIT_CPUTEMPERATURE AR_BASE_OID ".1.3.1.5.0" + +#define AR_OID_OUTLET_INDEX AR_BASE_OID ".1.2.2.1.1" +#define AR_OID_OUTLET_NAME AR_BASE_OID ".1.2.2.1.2" +#define AR_OID_OUTLET_STATUS AR_BASE_OID ".1.2.2.1.3" + +static info_lkp_t outlet_status_info[] = { + { -1, "error" }, + { 0, "off" }, + { 1, "on" }, + { 2, "cycling" }, /* transitional status */ + { 0, NULL } +}; + +#define DO_OFF 0 +#define DO_ON 1 +#define DO_CYCLE 2 + +#define AR_OID_OUTLET_COUNT AR_BASE_OID ".1.2.1.0" +#define AR_OID_OUTLET_CURRENT AR_BASE_OID ".1.2.2.1.4" +#define AR_OID_OUTLET_MAXCURRENT AR_BASE_OID ".1.2.2.1.5" +#define AR_OID_OUTLET_VOLTAGE AR_BASE_OID ".1.2.2.1.6" +#define AR_OID_OUTLET_ACTIVEPOWER AR_BASE_OID ".1.2.2.1.7" +#define AR_OID_OUTLET_APPARENTPOWER AR_BASE_OID ".1.2.2.1.8" +#define AR_OID_OUTLET_POWERFACTOR AR_BASE_OID ".1.2.2.1.9" + +/* Snmp2NUT lookup table for Eaton Revelation MIB */ +static snmp_info_t eaton_aphel_revelation_mib[] = { + /* Device page */ + { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "device.model", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_MODEL_NAME, + "Eaton Powerware ePDU Managed", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_SERIAL, "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + + /* UPS page */ + { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_MODEL_NAME, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, + "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_SERIAL, "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_FIRMREV, "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_UNIT_MACADDR, "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.temperature", 0, 1, AR_OID_UNIT_CPUTEMPERATURE, NULL, 0, NULL, NULL }, + + /* Outlet page */ + { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "outlet.count", 0, 1, AR_OID_OUTLET_COUNT, "0", 0, NULL }, + { "outlet.current", 0, 0.001, AR_OID_UNIT_CURRENT ".0", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.001, AR_OID_UNIT_VOLTAGE ".0", NULL, 0, NULL, NULL }, + { "outlet.realpower", 0, 1.0, AR_OID_UNIT_ACTIVEPOWER ".0", NULL, 0, NULL, NULL }, + { "outlet.power", 0, 1.0, AR_OID_UNIT_APPARENTPOWER ".0", NULL, 0, NULL, NULL }, + + /* outlet template definition + * Caution: the index of the data start at 0, while the name is +1 + * ie outlet.1 => .0 */ + { "outlet.%i.switchable", 0, 1, AR_OID_OUTLET_INDEX ".%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL, NULL }, + { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_NAME ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_STATUS ".%i", NULL, SU_FLAG_OK | SU_OUTLET, &outlet_status_info[0], NULL }, + { "outlet.%i.current", 0, 0.001, AR_OID_OUTLET_CURRENT ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.current.maximum", 0, 0.001, AR_OID_OUTLET_MAXCURRENT ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.realpower", 0, 1.0, AR_OID_OUTLET_ACTIVEPOWER ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.voltage", 0, 1.0, AR_OID_OUTLET_VOLTAGE ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.powerfactor", 0, 0.01, AR_OID_OUTLET_POWERFACTOR ".%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.power", 0, 1.0, AR_OID_OUTLET_APPARENTPOWER ".%i", NULL, SU_OUTLET, NULL, NULL }, + + /* FIXME: + * - delay for startup/shutdown sequence + * - support for multiple Ambient sensors ( max. 8), starting at index '0' + * ambient.%i.temperature => .1.3.6.1.4.1.534.6.6.6.2.2.1.3.%i + * ambient.%i.humidity => .1.3.6.1.4.1.534.6.6.6.2.4.1.3.%i + */ + + /* Ambient page */ + /* We use critical levels, for both temperature and humidity, + * since warning levels are also available! */ + { "ambient.temperature", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.2.1.3.0", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.low", 0, 1.0, "1.3.6.1.4.1.534.6.6.6.2.2.1.6.0", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.high", 0, 1.0, "1.3.6.1.4.1.534.6.6.6.2.2.1.7.0", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.3.0", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.low", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.6.0", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.high", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.7.0", NULL, SU_FLAG_OK, NULL, NULL }, + + /* instant commands. */ + /* Note that load.cycle might be replaced by / mapped on shutdown.reboot */ + /* no counterpart found! + { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, */ + { "outlet.%i.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } +}; + +/* Eaton PDU-MIB - Marlin MIB + * ************************** */ + +#define EATON_MARLIN_MIB_VERSION "0.06" +#define EATON_MARLIN_SYSOID ".1.3.6.1.4.1.534.6.6.7" +#define EATON_MARLIN_OID_MODEL_NAME ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0" + +static info_lkp_t marlin_outlet_status_info[] = { + { 0, "off" }, + { 1, "on" }, + { 2, "pendingOff" }, /* transitional status */ + { 3, "pendingOn" }, /* transitional status */ + { 0, NULL } +}; + +/* Ugly hack: having the matching OID present means that the outlet is + * switchable. So, it should not require this value lookup */ +static info_lkp_t outlet_switchability_info[] = { + { -1, "yes" }, + { 0, "yes" }, + { 0, NULL } +}; + +/* Snmp2NUT lookup table for Eaton Marlin MIB */ +static snmp_info_t eaton_marlin_mib[] = { + /* Device page */ + { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0", + "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + /* FIXME: need RFC validation on this variable + * { "device.part", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */ + + /* UPS page */ + { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.4.1.534.6.6.7.1.2.1.2.0", + "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + + /* FIXME: use unitName.0 (ePDU)? + * { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, + "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */ + { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.5.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + /* TODO: + * The below possibly requires (?) the use of + * int snprint_hexstring(char *buf, size_t buf_len, const u_char *, size_t); + * { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + * + date reformating callback + * 2011-8-29,16:27:25.0,+1:0 + * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 + * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + */ + + /* Input page */ + { "input.phases", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + /* inputType.0.1 singlePhase (1) iso.3.6.1.4.1.534.6.6.7.3.1.1.2.0.1 */ + { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.0.1", NULL, 0, NULL, NULL }, + { "input.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.1", NULL, 0, NULL, NULL }, + /* FIXME: check multiplier */ + { "input.current", 0, 0.01, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL }, + + /* Ambient page */ + /* We use critical levels, for both temperature and humidity, + * since warning levels are also available! */ + { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.0.1", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.low", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.temperature.high", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.0.1", NULL, SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.low", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + { "ambient.humidity.high", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.0.1", NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL, NULL }, + + /* Outlet page */ + { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "outlet.count", 0, 1, ".1.3.6.1.4.1.534.6.6.7.1.2.1.22.0", "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + /* The below ones are the same as the input.* equivalent */ + { "outlet.frequency", 0, 0.1, ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.0.1", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.0.1.1", NULL, 0, NULL, NULL }, + { "outlet.current", 0, 0.01, ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", NULL, 0, NULL, NULL }, + /* There is also a .2 available (ie .1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.2) */ + { "outlet.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.0.1.2", NULL, 0, NULL, NULL }, + /* There is also a .2 available (ie .1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.2) */ + { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.0.1.1", NULL, 0, NULL, NULL }, + + /* outlet template definition + * Indexes start from 1, ie outlet.1 => .1 */ + /* Note: the first definition is used to determine the base index (ie 0 or 1) */ + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.1.1.3.0.%i", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.2.0.%i", + NULL, SU_FLAG_OK | SU_OUTLET, &marlin_outlet_status_info[0], NULL }, + /* FIXME: or use ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.0.1", though it's related to groups! */ + { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.0.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.0.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.voltage", 0, 0.001, ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.0.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.0.%i", NULL, SU_OUTLET, NULL, NULL }, + /* FIXME: handle non switchable units (only measurements), which do not expose this OID */ + { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.0.%i", "no", SU_FLAG_STATIC | SU_FLAG_OK, &outlet_switchability_info[0], NULL }, + + /* TODO: handle statistics + * outletWh.0.1 + * outletWhTimer.0.1 + */ + + /* instant commands. */ + /* Notes: + * - load.cycle might be replaced by / mapped on shutdown.reboot + * - outletControl{Off,On,Reboot}Cmd values: + * 0-n : Timer + * -1 : Cancel + * we currently use "0", so instant On | Off | Reboot... */ + /* no counterpart found! + { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL, NULL }, */ + + /* TODO: handle delays */ + { "outlet.%i.load.off", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.cycle", 0, 0, ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.0.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } +}; + +/* Pulizzi Monitored ePDU (Basic model, SNMP only) + * FIXME: to be completed + * + * Warning: there are 2 versions: + * - SA built MI.mib (old MIB) + * #define PULIZZI1_OID_MIB ".1.3.6.1.4.1.20677.3.1.1" + * #define PULIZZI1_OID_MODEL_NAME ".1.3.6.1.4.1.20677.3.1.1.1.2.0" + * - Eaton-Powerware-Monitored-ePDU_1.0.E.mib (new MIB) Vertical SW + */ + + +/* Pulizzi Switched ePDU */ + +#define EATON_PULIZZI_SW_MIB_VERSION "0.1" + +#define PULIZZI_SW_OID_MIB ".1.3.6.1.4.1.20677.3.1.1" +#define PULIZZI_SW_OID_MODEL_NAME ".1.3.6.1.4.1.20677.2.1.1.0" + +/* Some buggy FW also report sysOID = ".1.3.6.1.4.1.20677.1" */ +#define EATON_PULIZZI_SWITCHED1_SYSOID ".1.3.6.1.4.1.20677.1" +#define EATON_PULIZZI_SWITCHED2_SYSOID ".1.3.6.1.4.1.20677.2" + + +static info_lkp_t pulizzi_sw_outlet_status_info[] = { + { 1, "on" }, + { 2, "off" }, + { 0, NULL } +}; + +/* simply remap the above status to "yes" */ +static info_lkp_t pulizzi_sw_outlet_switchability_info[] = { + { 1, "yes" }, + { 2, "yes" }, + { 0, NULL } +}; + +/* Snmp2NUT lookup table for Eaton Pulizzi Switched ePDU MIB */ +static snmp_info_t eaton_pulizzi_switched_mib[] = { + /* Device page */ + { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "device.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME, + "Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + + /* UPS page */ + { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME, + "Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + /* FIXME: to be moved to the device collection! */ + { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.4.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.3.0", + "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.2.6.0", + "unknown", 0, NULL, NULL }, + + /* Outlet page */ + /* Note: outlet.count is deduced, with guestimate_outlet_count() */ + { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + + { "outlet.current", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.2.0", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.1.0", NULL, 0, NULL, NULL }, + { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.3.0", NULL, 0, NULL, NULL }, + + /* outlet template definition + * Notes: + * - indexes start from 1, ie outlet.1 => .1 + * - the first definition is used to determine the base index (ie 0 or 1) + * - outlet.count is estimated, based on the below OID iteration capabilities */ + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0", + NULL, SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_status_info[0], NULL }, + { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + /* we use the same OID as outlet.n.status..., to expose switchability */ + { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0", "yes", SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_switchability_info[0], NULL }, + /* FIXME: need to be added to the namespace! */ + { "outlet.%i.delay.reboot", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.5.0", NULL, SU_OUTLET, NULL, NULL }, + /* "outlet1SequenceTime" is used for global sequence */ + { "outlet.%i.delay.start", ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.4.0", NULL, SU_OUTLET, NULL, NULL }, + + /* instant commands. */ + /* FIXME: not exposed as "outlet.load...", or otherwise specific processing applies (template instanciation) */ + { "load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "load.off", 0, 2, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "load.on.delay", 0, 3, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "load.off.delay", 0, 4, ".1.3.6.1.4.1.20677.2.6.2.1.0", NULL, SU_TYPE_CMD, NULL, NULL }, + + /* WARNING: outlet 1 => index 2! */ + { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL }, + { "outlet.%i.load.off", 0, 2, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL }, + { "outlet.%i.load.cycle", 0, 3, ".1.3.6.1.4.1.20677.2.6.2.%i.0", NULL, SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL, NULL }, + + /* end of structure. */ + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } +}; + + +mib2nut_info_t aphel_genesisII = { "aphel_genesisII", EATON_APHEL_MIB_VERSION, "", APHEL1_OID_MODEL_NAME, eaton_aphel_genesisII_mib, APHEL1_SYSOID }; +mib2nut_info_t aphel_revelation = { "aphel_revelation", EATON_APHEL_MIB_VERSION, "", APHEL2_OID_MODEL_NAME, eaton_aphel_revelation_mib, APHEL2_SYSOID }; +mib2nut_info_t eaton_marlin = { "eaton_epdu", EATON_MARLIN_MIB_VERSION, "", EATON_MARLIN_OID_MODEL_NAME, eaton_marlin_mib, EATON_MARLIN_SYSOID }; + +/*mib2nut_info_t pulizzi_monitored = { "pulizzi_monitored", EATON_PULIZZI_MIB_VERSION, "", PULIZZI1_OID_MODEL_NAME, eaton_pulizzi_monitored_mib, PULIZZI1_OID_MIB };*/ +mib2nut_info_t pulizzi_switched1 = { "pulizzi_switched1", EATON_PULIZZI_SW_MIB_VERSION, "", EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED1_SYSOID }; +mib2nut_info_t pulizzi_switched2 = { "pulizzi_switched2", EATON_PULIZZI_SW_MIB_VERSION, "", EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED2_SYSOID }; diff --git a/drivers/eaton-mib.h b/drivers/eaton-mib.h new file mode 100644 index 0000000..d5223e6 --- /dev/null +++ b/drivers/eaton-mib.h @@ -0,0 +1,13 @@ +#ifndef EATON_MIB_H +#define EATON_MIB_H + +#include "main.h" +#include "snmp-ups.h" + +extern mib2nut_info_t aphel_genesisII; +extern mib2nut_info_t aphel_revelation; +extern mib2nut_info_t eaton_marlin; +extern mib2nut_info_t pulizzi_switched1; +extern mib2nut_info_t pulizzi_switched2; + +#endif /* EATON_MIB_H */ diff --git a/drivers/eaton-pdu-genesis2-mib.c b/drivers/eaton-pdu-genesis2-mib.c deleted file mode 100644 index 22ff01e..0000000 --- a/drivers/eaton-pdu-genesis2-mib.c +++ /dev/null @@ -1,95 +0,0 @@ -/* eaton-pdu-genesis2-mib.c - data to monitor Eaton ePDUs branded as: - * G1 Aphel based ePDUs (Basic) - GenesisII - * - * Copyright (C) 2008 - 2019 - * Arnaud Quette - * Arnaud Quette - * Copyright (C) 2015 - 2017 - * Jim Klimov - * - * Supported by Eaton - * and previously MGE Office Protection Systems - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "eaton-pdu-genesis2-mib.h" - -#define EATON_APHEL_GENESIS2_MIB_VERSION "0.52" - -/* APHEL-GENESIS-II-MIB (monitored ePDU) - * ************************************* - * Note: There is also a basic XML interface, but not worth - * implementing in netxml-ups! - */ - -#define APHEL1_OID_MIB ".1.3.6.1.4.1.17373" -#define APHEL1_SYSOID APHEL1_OID_MIB -#define APHEL1_OID_MODEL_NAME ".1.3.6.1.4.1.17373.3.1.1.0" -#define APHEL1_OID_FIRMREV ".1.3.6.1.4.1.17373.3.1.2.0" -#define APHEL1_OID_DEVICE_NAME ".1.3.6.1.4.1.17373.3.1.3.0" -#define APHEL1_OID_UNIT_MACADDR ".1.3.6.1.4.1.17373.3.1.4.0" -/* needs concat ..0 */ -#define APHEL1_OID_OUTLET_CURRENT ".1.3.6.1.4.1.17373.3.2" - -/* Snmp2NUT lookup table for GenesisII MIB */ -static snmp_info_t eaton_aphel_genesisII_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device page */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_MODEL_NAME, - "Eaton Powerware ePDU Monitored", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_UNIT_MACADDR, "unknown", - 0, NULL }, - - /* UPS page */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_MODEL_NAME, - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_DEVICE_NAME, - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, APHEL1_OID_FIRMREV, "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - - /* Outlet page */ - /* we can't use template since there is no counterpart to outlet.count */ - { "outlet.1.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".1.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.2.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".2.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.3.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".3.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.4.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".4.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.5.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".5.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.6.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".6.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.7.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".7.0", NULL, SU_FLAG_NEGINVALID, NULL }, - { "outlet.8.current", 0, 0.1, APHEL1_OID_OUTLET_CURRENT ".8.0", NULL, SU_FLAG_NEGINVALID, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - - -mib2nut_info_t aphel_genesisII = { "aphel_genesisII", EATON_APHEL_GENESIS2_MIB_VERSION, NULL, APHEL1_OID_MODEL_NAME, eaton_aphel_genesisII_mib, APHEL1_SYSOID, NULL }; diff --git a/drivers/eaton-pdu-genesis2-mib.h b/drivers/eaton-pdu-genesis2-mib.h deleted file mode 100644 index df9dc0c..0000000 --- a/drivers/eaton-pdu-genesis2-mib.h +++ /dev/null @@ -1,32 +0,0 @@ -/* eaton-pdu-genesis2-mib.h - subdriver to monitor Eaton ePDU SNMP devices with NUT - * - * Copyright (C) - * 2010 Arjen de Korte - * 2011 - 2012 Arnaud Quette - * 2017 Arnaud Quette - * 2017 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_EPDU_GENESIS_MIB_H -#define EATON_EPDU_GENESIS_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t aphel_genesisII; - -#endif /* EATON_EPDU_GENESIS_MIB_H */ diff --git a/drivers/eaton-pdu-marlin-helpers.c b/drivers/eaton-pdu-marlin-helpers.c deleted file mode 100644 index 421045f..0000000 --- a/drivers/eaton-pdu-marlin-helpers.c +++ /dev/null @@ -1,91 +0,0 @@ -/* eaton-pdu-marlin-helpers.c - helper routines for eaton-pdu-marlin-mib.c - * to monitor Eaton ePDUs branded as: - * G2 Marlin SW / MI / MO / MA - * G3 Shark SW / MI / MO / MA - * - * Copyright (C) 2017-2019 - * Arnaud Quette - * Copyright (C) 2017 - * Jim Klimov - * - * Supported by Eaton - * and previously MGE Office Protection Systems - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "config.h" /* must be the first header */ - -#include -#include -#include - -#include "eaton-pdu-marlin-helpers.h" -#include "dstate.h" -#include "common.h" -/* Allow access to temperature_unit */ -#include "snmp-ups.h" - -/* Take string "unitsPresent" (ex: "0,3,4,5"), and count the amount - * of "," separators+1 using an inline function */ -long marlin_device_count_fun(const char *daisy_dev_list) -{ - long count = 0, i; - - for (i = 0; daisy_dev_list[i] != '\0'; i++) { - if (daisy_dev_list[i] == ',') { - /* Each comma means a new device in the list */ - count ++; - } - } - if (i > 0 && (daisy_dev_list[i - 1] != ',') ) { - /* Non-empty string => at least one device, and no trailing commas */ - count ++; - } - - upsdebugx(3, "%s: counted devices in '%s', got %ld", - __func__, daisy_dev_list, count); - return count; -} - -/* Temperature unit consideration: - * only store the device unit, for converting to Celsius. - * Don't publish the device unit, since NUT will publish - * as Celsius in all cases */ -const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value) -{ - long snmp_value = *((long*)raw_snmp_value); - switch (snmp_value) { - case 0: - /* store the value, for temperature processing */ - temperature_unit = TEMPERATURE_KELVIN; - break; - case 1: - /* store the value, for temperature processing */ - temperature_unit = TEMPERATURE_CELSIUS; - break; - case 2: - /* store the value, for temperature processing */ - temperature_unit = TEMPERATURE_FAHRENHEIT; - break; - default: - /* store the value, for temperature processing */ - temperature_unit = TEMPERATURE_UNKNOWN; - break; - } - return "celsius"; -} diff --git a/drivers/eaton-pdu-marlin-helpers.h b/drivers/eaton-pdu-marlin-helpers.h deleted file mode 100644 index fc9890e..0000000 --- a/drivers/eaton-pdu-marlin-helpers.h +++ /dev/null @@ -1,29 +0,0 @@ -/* eaton-pdu-marlin-helpers.h - helper for subdriver to monitor certain - * Eaton ePDU SNMP devices with NUT - * - * Copyright (C) - * 2017-2019 Arnaud Quette - * 2017 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_EPDU_MARLIN_HELPERS_H -#define EATON_EPDU_MARLIN_HELPERS_H - -long marlin_device_count_fun(const char *daisy_dev_list); -const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value); - -#endif /* EATON_EPDU_MARLIN_HELPERS_H */ diff --git a/drivers/eaton-pdu-marlin-mib.c b/drivers/eaton-pdu-marlin-mib.c deleted file mode 100644 index bed4bbe..0000000 --- a/drivers/eaton-pdu-marlin-mib.c +++ /dev/null @@ -1,1366 +0,0 @@ -/* eaton-pdu-marlin-mib.c - data to monitor Eaton ePDUs branded as: - * G2 Marlin SW / MI / MO / MA - * G3 Shark SW / MI / MO / MA - * - * Copyright (C) 2008 - 2020 - * Arnaud Quette - * Arnaud Quette - * Copyright (C) 2015 - 2017 - * Jim Klimov - * - * Supported by Eaton - * and previously MGE Office Protection Systems - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "eaton-pdu-marlin-mib.h" -#if WITH_SNMP_LKP_FUN -#include "eaton-pdu-marlin-helpers.h" -#endif - -/* Eaton PDU-MIB - Marlin MIB - * ************************** */ - -#define EATON_MARLIN_MIB_VERSION "0.69" -#define EATON_MARLIN_SYSOID ".1.3.6.1.4.1.534.6.6.7" -#define EATON_MARLIN_OID_MODEL_NAME ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0" - -static info_lkp_t marlin_outlet_status_info[] = { - { 0, "off", NULL, NULL }, - { 1, "on", NULL, NULL }, - { 2, "pendingOff", NULL, NULL }, /* transitional status */ - { 3, "pendingOn", NULL, NULL }, /* transitional status */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_outletgroups_status_info[] = { - { 0, "off", NULL, NULL }, - { 1, "on", NULL, NULL }, - { 2, "rebooting", NULL, NULL }, /* transitional status */ - { 3, "mixed", NULL, NULL }, /* transitional status, not sure what it means! */ - { 0, NULL, NULL, NULL } -}; - -/* Ugly hack for older G2 ePDU: - * having the matching OID present means that the outlet/unit is - * switchable. So, it should not require this value lookup */ -static info_lkp_t g2_unit_outlet_switchability_info[] = { - { -1, "yes", NULL, NULL }, - { 0, "yes", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_outlet_switchability_info[] = { - { 1, "yes", NULL, NULL }, /* switchable */ - { 2, "no", NULL, NULL }, /* notSwitchable */ - { 0, NULL, NULL, NULL } -}; - -/* Overall outlets switchability info for the unit. - * This is refined per-outlet, depending on user configuration, - * possibly disabling switchability of some outlets */ -static info_lkp_t marlin_unit_switchability_info[] = { - { 0, "no", NULL, NULL }, /* unknown */ - { 1, "yes", NULL, NULL }, /* switched */ - { 2, "no", NULL, NULL }, /* advancedMonitored */ - { 3, "yes", NULL, NULL }, /* managed */ - { 4, "no", NULL, NULL }, /* monitored */ - { 0, NULL, NULL, NULL } -}; - -/* The physical type of outlet */ -static info_lkp_t marlin_outlet_type_info[] = { - { 0, "unknown", NULL, NULL }, - { 1, "iecC13", NULL, NULL }, - { 2, "iecC19", NULL, NULL }, - { 10, "uk", NULL, NULL }, - { 11, "french", NULL, NULL }, - { 12, "schuko", NULL, NULL }, - { 20, "nema515", NULL, NULL }, - { 21, "nema51520", NULL, NULL }, - { 22, "nema520", NULL, NULL }, - { 23, "nemaL520", NULL, NULL }, - { 24, "nemaL530", NULL, NULL }, - { 25, "nema615", NULL, NULL }, - { 26, "nema620", NULL, NULL }, - { 27, "nemaL620", NULL, NULL }, - { 28, "nemaL630", NULL, NULL }, - { 29, "nemaL715", NULL, NULL }, - { 30, "rf203p277", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_ambient_presence_info[] = { - { -1, "unknown", NULL, NULL }, - { 0, "no", NULL, NULL }, /* disconnected */ - { 1, "yes", NULL, NULL }, /* connected */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_emp002_ambient_presence_info[] = { - { 0, "unknown", NULL, NULL }, - { 2, "yes", NULL, NULL }, /* communicationOK */ - { 3, "no", NULL, NULL }, /* communicationLost */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_status_info[] = { - { 0, "good", NULL, NULL }, /* No threshold triggered */ - { 1, "warning-low", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "critical-low", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "warning-high", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "critical-high", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_frequency_status_info[] = { - { 0, "good", NULL, NULL }, /* No threshold triggered */ - { 1, "out-of-range", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 0, "opened", NULL, NULL }, - { 1, "closed", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_voltage_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low voltage warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low voltage critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high voltage warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high voltage critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_current_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low current warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low current critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high current warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high current critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_frequency_alarm_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "frequency out of range!", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_temperature_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low temperature warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low temperature critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high temperature warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high temperature critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_threshold_humidity_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low humidity warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low humidity critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high humidity warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high humidity critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_outlet_group_type_info[] = { - { 0, "unknown", NULL, NULL }, - { 1, "breaker1pole", NULL, NULL }, - { 2, "breaker2pole", NULL, NULL }, - { 3, "breaker3pole", NULL, NULL }, - { 4, "outlet-section", NULL, NULL }, - { 5, "user-defined", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_input_type_info[] = { - { 1, "1", NULL, NULL }, /* singlePhase */ - { 2, "2", NULL, NULL }, /* splitPhase */ - { 3, "3", NULL, NULL }, /* threePhaseDelta */ - { 4, "3", NULL, NULL }, /* threePhaseWye */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_outlet_group_phase_info[] = { - { 0, "unknown", NULL, NULL }, /* unknown */ - { 1, "1", NULL, NULL }, /* singlePhase */ - { 2, "1-N", NULL, NULL }, /* phase1toN */ - { 3, "2-N", NULL, NULL }, /* phase2toN */ - { 4, "3-N", NULL, NULL }, /* phase3toN */ - { 5, "1-2", NULL, NULL }, /* phase1to2 */ - { 6, "2-3", NULL, NULL }, /* phase2to3 */ - { 7, "3-1", NULL, NULL }, /* phase3to1 */ - { 0, NULL, NULL, NULL } -}; - -#if WITH_SNMP_LKP_FUN -/* Note: eaton_sensor_temperature_unit_fun() is defined in eaton-pdu-marlin-helpers.c - * and su_temperature_read_fun() is in snmp-ups.c - * Future work for DMF might provide same-named routines via LUA-C gateway. - */ - -#if WITH_SNMP_LKP_FUN_DUMMY -/* Temperature unit consideration */ -const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value) { - /* snmp_value here would be a (long*) */ - NUT_UNUSED_VARIABLE(raw_snmp_value); - return "unknown"; -} -/* FIXME: please DMF, though this should be in snmp-ups.c or equiv. */ -const char *su_temperature_read_fun(void *raw_snmp_value) { - /* snmp_value here would be a (long*) */ - NUT_UNUSED_VARIABLE(raw_snmp_value); - return "dummy"; -} -#endif // WITH_SNMP_LKP_FUN_DUMMY - -static info_lkp_t eaton_sensor_temperature_unit_info[] = { - { 0, "dummy", eaton_sensor_temperature_unit_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t eaton_sensor_temperature_read_info[] = { - { 0, "dummy", su_temperature_read_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -#else // if not WITH_SNMP_LKP_FUN: - -/* FIXME: For now, DMF codebase falls back to old implementation with static - * lookup/mapping tables for this, which can easily go into the DMF XML file. - */ -static info_lkp_t eaton_sensor_temperature_unit_info[] = { - { 0, "kelvin", NULL, NULL }, - { 1, "celsius", NULL, NULL }, - { 2, "fahrenheit", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -#endif // WITH_SNMP_LKP_FUN - -/* Extracted from powerware-mib.c ; try to commonalize */ -static info_lkp_t marlin_ambient_drycontacts_polarity_info[] = { - { 0, "normal-opened", NULL, NULL }, - { 1, "normal-closed", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t marlin_ambient_drycontacts_state_info[] = { - { 0, "inactive", NULL, NULL }, - { 1, "active", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -#if WITH_SNMP_LKP_FUN -/* Note: marlin_device_count_fun() is defined in eaton-pdu-marlin-helpers.c - * Future work for DMF might provide a same-named routine via LUA-C gateway. - */ - -# if WITH_SNMP_LKP_FUN_DUMMY -long marlin_device_count_fun(const char *daisy_dev_list) - { return 1; } -# endif /* WITH_SNMP_LKP_FUN_DUMMY */ - -static info_lkp_t marlin_device_count_info[] = { - { 1, "dummy", NULL, marlin_device_count_fun }, - { 0, NULL, NULL, NULL } -}; - -#else /* if not WITH_SNMP_LKP_FUN: */ - -/* FIXME: For now, DMF codebase falls back to old implementation with static - * lookup/mapping tables for this, which can easily go into the DMF XML file. - */ - -#endif /* WITH_SNMP_LKP_FUN */ - - -/* Snmp2NUT lookup table for Eaton Marlin MIB */ -static snmp_info_t eaton_marlin_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, - ".1.3.6.1.2.1.1.1.0", - NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, - ".1.3.6.1.2.1.1.4.0", - NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, - ".1.3.6.1.2.1.1.6.0", - NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, - NULL, - "EATON", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", - "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, - NULL, - "pdu", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.3.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* For daisychain, there is only 1 physical interface! */ - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.2.1.2.2.1.6.2", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* Daisychained devices support */ - /* FIXME : Should this be a static value, or can we expect the amount of - * daisy-chained devices to change without restart of the driver by user? - * If this is a critical matter, should a detected change of amount of - * daisy-chained devices, outlet counts, etc. cause restart/reinit of - * this running driver instance? - */ -#if WITH_SNMP_LKP_FUN - /* Number of daisychained units is processed according to present units - * in the chain with new G3 firmware (02.00.0051, since autumn 2017): - * Take string "unitsPresent" (ex: "0,3,4,5"), and count the amount - * of "," separators+1 using an inline function */ - /* FIXME: inline func */ - { "device.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.1.1.0", - "0", SU_FLAG_STATIC | SU_FLAG_UNIQUE, - &marlin_device_count_info[0] /* devices_count */ }, -#endif - /* Notes: this older/fallback definition is used to: - * - estimate the number of devices, based on the below OID iteration capabilities - * - determine the base index of the SNMP OID (ie 0 or 1) */ - { "device.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", - "1", SU_FLAG_STATIC -#if WITH_SNMP_LKP_FUN - | SU_FLAG_UNIQUE -#endif - , NULL /* devices_count */ }, - - /* UPS collection */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, - NULL, - "EATON", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, - "1.3.6.1.4.1.534.6.6.7.1.2.1.2.%i", - "Eaton Powerware ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* FIXME: use unitName.0 (ePDU)? - * { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, */ - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.4.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: this entry should be SU_FLAG_SEMI_STATIC */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.5.%i", - "", SU_FLAG_OK, NULL }, - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, - NULL, - "pdu", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* FIXME: needs a date reformating callback - * 2011-8-29,16:27:25.0,+1:0 - * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 - * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - */ - - /* Input collection */ - /* Note: a larger ePDU can have several inputs. The "%i" iterators - * in key names are currently available for daisychain devs, outlets, - * and groups - but not for inputs. These would likely evolve later - * to "input.%i.something" with default (non-%i) same as .1 instance. - * At this time only a single-input (or first of several inputs) is - * supported by this mapping. - */ - /* Historically, some of these data were previously published as - * outlet.{realpower,...} - * However, it's more suitable and logic to have these on input.{...} - */ - /* Note: the below gives the number of input, not the number of phase(s)! */ - /* inputCount.0; Value (Integer): 1 - { "input.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.20.0", - NULL, SU_FLAG_STATIC, NULL }, */ - /* Note: for daisychain mode, we must handle phase(s) per device, - * not as a whole. In case of daisychain, support of the UNIQUE - * field is not yet implemented (FIXME) so the last resolved OID - * value wins. If a more-preferable OID is not implemented by device, - * this is ok - the previous available value remains in place. */ - /* inputType.%i.1 = INTEGER: singlePhase (1) */ - { "input.phases", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.2.%i.1", - NULL, SU_FLAG_STATIC, - &marlin_input_type_info[0] }, - - /* Frequency is measured globally */ - { "input.frequency", 0, 0.1, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", - NULL, 0, NULL }, - { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_frequency_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.4.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_frequency_alarm_info[0] }, - - /* inputCurrentPercentLoad (measured globally) - * Current percent load, based on the rated current capacity */ - /* FIXME: input.load is mapped on input.L1.load for both single and 3phase !!! */ - { "input.load", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L1.load", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L2.load", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L3.load", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* FIXME: - * - Voltage is only measured per phase, as mV! - * so input.voltage == input.L1.voltage for both single and 3phase - * - As per NUT namespace (http://www.networkupstools.org/docs/developer-guide.chunked/apas01.html#_valid_contexts) - * Voltage has to be expressed either phase-phase or phase-neutral - * This is depending on OID inputVoltageMeasType - * INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7) - * => RFC input.Lx.voltage.context */ - { "input.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", - NULL, 0, NULL }, - { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_voltage_alarms_info[0] }, - { "input.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", - NULL, 0, NULL }, - { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_voltage_alarms_info[0] }, - { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.2", - NULL, 0, NULL }, - { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.2", - NULL, SU_FLAG_OK, - &marlin_threshold_voltage_alarms_info[0] }, - { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.3", - NULL, 0, NULL }, - { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.4.%i.1.3", - NULL, SU_FLAG_OK, - &marlin_threshold_voltage_alarms_info[0] }, - { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.5.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.6.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.7.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.8.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* FIXME: - * - input.current is mapped on input.L1.current for both single and 3phase !!! */ - { "input.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", - NULL, 0, NULL }, - { "input.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", - NULL, 0, NULL }, - { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_current_alarms_info[0] }, - { "input.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.0.1.1", - NULL, 0, NULL }, - { "input.L1.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.1", - NULL, 0, NULL }, - { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.1", - NULL, SU_FLAG_OK, - &marlin_threshold_current_alarms_info[0] }, - { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.2", - NULL, 0, NULL }, - { "input.L2.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.2", - NULL, 0, NULL }, - { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.2", - NULL, SU_FLAG_OK, - &marlin_threshold_current_alarms_info[0] }, - { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.3", - NULL, 0, NULL }, - { "input.L3.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.3.%i.1.3", - NULL, 0, NULL }, - { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.5.%i.1.3", - NULL, SU_FLAG_OK, - &marlin_threshold_current_alarms_info[0] }, - { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.6.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.7.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.8.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.9.%i.1.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* Sum of all phases realpower, valid for Shark 1ph/3ph only */ - { "input.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.5.1.4.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */ - { "input.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* Fallback 2: Sum of the phase realpower, valid for Marlin 1ph only */ - { "input.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L1.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L2.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L3.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* Sum of all phases apparent power, valid for Shark 1ph/3ph only */ - { "input.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.5.1.3.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* Fallback 1: Sum of all phases realpower, valid for Marlin 3ph only */ - { "input.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* Fallback 2: Sum of the phase realpower, valid for Marlin 1ph only */ - { "input.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L1.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L2.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "input.L3.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* Input feed: a feed (A or B) is tied to an input, and this - * sub-collection describes the properties of an actual cable. - */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream ; check type (number? string?) and flags */ - /* { "input.feed.%i.id", 0, 1, "???.%i.%i", NULL, SU_FLAG_NEGINVALID, NULL }, */ - /* Feed name(s) of the ePDU power input(s), can be set by user (FIXME: rename to .desc?) - * inputFeedName.0.1 = Value (OctetString): Feed A - */ - /* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => refreshed from time to time or upon call to setvar */ -/* { "input.%i.feed.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - * ".1.3.6.1.4.1.534.6.6.7.3.1.1.10.%i.%i", - * NULL, SU_FLAG_SEMI_STATIC | SU_FLAG_OK | SU_TYPE_DAISY_1, NULL }, - */ - { "input.feed.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.10.%i.1", - NULL, SU_FLAG_SEMI_STATIC | SU_FLAG_OK | SU_TYPE_DAISY_1, NULL }, - /* Feed color (integer RGB) - * inputFeedColor.0.1 = Gauge32: 0 (black) - */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream */ -/* { "input.%i.feed.color", 0, 1, - * ".1.3.6.1.4.1.534.6.6.7.3.1.1.9.%i.%i", - * NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_TYPE_DAISY_1, NULL }, - */ - { "input.feed.color", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.9.%i.1", - NULL, SU_FLAG_SEMI_STATIC | SU_FLAG_OK | SU_TYPE_DAISY_1, NULL }, - /* inputPowerCapacity.0.1 = INTEGER: 2300 */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream */ - { "input.realpower.nominal", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.5.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* Ambient collection */ - /* EMP001 (legacy) mapping */ - /* Note: this is still published, beside from the new daisychained version! */ - { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.3.%i.1", - NULL, SU_FLAG_OK, - &marlin_ambient_presence_info[0] }, - { "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.5.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_temperature_alarms_info[0] }, - { "ambient.temperature", 0, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.4.%i.1", - NULL, SU_FLAG_OK, NULL }, - /* Low and high threshold use the respective critical levels */ - { "ambient.temperature.low", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.high", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.1.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.5.%i.1", - NULL, SU_FLAG_OK, - &marlin_threshold_humidity_alarms_info[0] }, - { "ambient.humidity", 0, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.4.%i.1", - NULL, SU_FLAG_OK, NULL }, - /* Low and high threshold use the respective critical levels */ - { "ambient.humidity.low", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.high", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", NULL, - SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.6.7.7.2.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* Dry contacts on TH module */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.1", - NULL, SU_FLAG_OK, - &marlin_ambient_drycontacts_info[0] }, - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.7.3.1.4.%i.2", - NULL, SU_FLAG_OK, - &marlin_ambient_drycontacts_info[0] }, - - - /* EMP002 (EATON EMP MIB) mapping, including daisychain support */ - /* Warning: indexes start at '1' not '0'! */ - /* sensorCount.0 */ - { "ambient.count", ST_FLAG_RW, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.1.0", - "0", SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* CommunicationStatus.n */ - { "ambient.%i.present", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.1.4.1.1.%i", - NULL, SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_emp002_ambient_presence_info[0] }, - /* sensorName.n: OctetString EMPDT1H1C2 @1 */ - { "ambient.%i.name", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.3.1.1.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorManufacturer.n */ - { "ambient.%i.mfr", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.6.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorModel.n */ - { "ambient.%i.model", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.7.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorSerialNumber.n */ - { "ambient.%i.serial", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.9.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorUuid.n */ - { "ambient.%i.id", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.2.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorAddress.n */ - { "ambient.%i.address", 0, 1, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.4.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorMonitoredBy.n */ - { "ambient.%i.parent.serial", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.5.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* sensorFirmwareVersion.n */ - { "ambient.%i.firmware", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.1.2.1.10.%i", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* temperatureUnit.1 - * MUST be before the temperature data reading! */ - { "ambient.%i.temperature.unit", 0, 1.0, - ".1.3.6.1.4.1.534.6.8.1.2.5.0", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &eaton_sensor_temperature_unit_info[0] }, - /* temperatureValue.n.1 */ - { "ambient.%i.temperature", 0, 0.1, - ".1.3.6.1.4.1.534.6.8.1.2.3.1.3.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, -#if WITH_SNMP_LKP_FUN - &eaton_sensor_temperature_read_info[0] -#else - NULL -#endif - }, - { "ambient.%i.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.2.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.2.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_threshold_temperature_alarms_info[0] }, - /* FIXME: ambient.n.temperature.{minimum,maximum} */ - /* temperatureThresholdLowCritical.n.1 */ - { "ambient.%i.temperature.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.2.2.1.6.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* temperatureThresholdLowWarning.n.1 */ - { "ambient.%i.temperature.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.2.2.1.5.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* temperatureThresholdHighWarning.n.1 */ - { "ambient.%i.temperature.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.2.2.1.7.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* temperatureThresholdHighCritical.n.1 */ - { "ambient.%i.temperature.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.2.2.1.8.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* humidityValue.n.1 */ - { "ambient.%i.humidity", 0, 0.1, - ".1.3.6.1.4.1.534.6.8.1.3.3.1.3.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - { "ambient.%i.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.3.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.3.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_threshold_humidity_alarms_info[0] }, - /* FIXME: consider ambient.n.humidity.{minimum,maximum} */ - /* humidityThresholdLowCritical.n.1 */ - { "ambient.%i.humidity.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.3.2.1.6.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* humidityThresholdLowWarning.n.1 */ - { "ambient.%i.humidity.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.3.2.1.5.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* humidityThresholdHighWarning.n.1 */ - { "ambient.%i.humidity.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.3.2.1.7.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* humidityThresholdHighCritical.n.1 */ - { "ambient.%i.humidity.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.534.6.8.1.3.2.1.8.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* digitalInputName.n.{1,2} */ - { "ambient.%i.contacts.1.name", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.4.2.1.1.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - { "ambient.%i.contacts.2.name", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.4.2.1.1.%i.2", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, NULL }, - /* digitalInputPolarity.n */ - { "ambient.%i.contacts.1.config", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.4.2.1.3.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_ambient_drycontacts_polarity_info[0] }, - { "ambient.%i.contacts.2.config", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.4.2.1.3.%i.2", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_ambient_drycontacts_polarity_info[0] }, - /* XUPS-MIB::xupsContactState.n */ - { "ambient.%i.contacts.1.status", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.4.3.1.3.%i.1", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_ambient_drycontacts_state_info[0] }, - { "ambient.%i.contacts.2.status", ST_FLAG_STRING, 1.0, - ".1.3.6.1.4.1.534.6.8.1.4.3.1.3.%i.2", - "", SU_AMBIENT_TEMPLATE | SU_TYPE_DAISY_MASTER_ONLY, - &marlin_ambient_drycontacts_state_info[0] }, - - /* Outlet collection */ - { "outlet.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.22.%i", - "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "outlet.id", 0, 1, - NULL, - "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, - NULL, - "All outlets", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* UnitType - * used to depict the overall outlets switchability of the unit on G3 and newer ePDU*/ - { "outlet.switchable", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.10.%i", - "no", SU_FLAG_STATIC | SU_FLAG_UNIQUE, - &marlin_unit_switchability_info[0] }, - /* Ugly hack for older G2 ePDU: check the first outlet to determine unit switchability */ - { "outlet.switchable", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.1", - "no", SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_FLAG_OK | SU_TYPE_DAISY_1, - &g2_unit_outlet_switchability_info[0] }, - /* The below ones are the same as the input.* equivalent */ - /* FIXME: transition period, TO BE REMOVED, moved to input.* */ - { "outlet.frequency", 0, 0.1, - ".1.3.6.1.4.1.534.6.6.7.3.1.1.3.%i.1", - NULL, 0, NULL }, - { "outlet.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.3.2.1.3.%i.1.1", - NULL, 0, NULL }, - { "outlet.current", 0, 0.01, - ".1.3.6.1.4.1.534.6.6.7.3.3.1.4.%i.1.1", - NULL, 0, NULL }, - { "outlet.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.4.%i.1.4", - NULL, 0, NULL }, - { "outlet.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.3.4.1.3.%i.1.4", - NULL, 0, NULL }, - - /* outlet template definition - * Indexes start from 1, ie outlet.1 => .1 */ - /* Note: the first definition is used to determine the base index (ie 0 or 1) */ - /* Outlet friendly name, which can be modified by the user - * outletName: = OctetString: "Outlet A16" - */ - /* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => - * refreshed from time to time or upon call to setvar */ - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.1.1.3.%i.%i", - NULL, SU_FLAG_SEMI_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, - NULL }, - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.2.%i.%i", - NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_outlet_status_info[0] }, - - /* Numeric identifier of the outlet, tied to the whole unit */ - /* NOTE: For daisychain devices ATM the last listed value presented by - * the SNMP device is kept by the driver - no SU_FLAG_UNIQUE here yet. - * Verified that a non-implemented OID does not publish empty values. */ - /* Fallback in firmwares issued before Sep 2017 is to use the - * outletID: Outlet physical name, related to its number in the group - * ex: first outlet of the second group (B) is B1, or can default to - * the outlet number (represented as string) and is a read-only string - * outletID.0.8 = Value (OctetString): "8" - */ - { "outlet.%i.id", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.7.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, - NULL }, - - /* Fallback in firmwares issued before Sep 2017 (outletID): */ - { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.1.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, - NULL }, - /* Preferred: Outlet physical name OID in new G3 firmware (02.00.0051) - * is named outletDesignator (other MIBs outletPhysicalName) - * and is a read-only string provided by firmware - * outletDesignator.0.1 = Value (OctetString): "A1" - * outletPhysicalName.0.16 = Value (OctetString): "A16" - */ - { "outlet.%i.name", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.1.1.6.%i.%i", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, - NULL }, - - /* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1") - * Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */ - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_threshold_status_info[0] }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.4.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_threshold_current_alarms_info[0] }, - { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.4.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.6.5.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.2.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_threshold_status_info[0] }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_threshold_voltage_alarms_info[0] }, - { "outlet.%i.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.4.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.6.3.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.6.5.1.2.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* outletControlSwitchable */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.9.%i.%i", - "no", SU_OUTLET | SU_FLAG_UNIQUE | SU_TYPE_DAISY_1, - &marlin_outlet_switchability_info[0] }, - /* FIXME: handle non switchable units (only measurements), which do not expose this OID */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", - "no", SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1, - &g2_unit_outlet_switchability_info[0] }, - { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.1.1.5.%i.%i", - "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, - &marlin_outlet_type_info[0] }, - - /* TODO: handle statistics - * outletWh.0.1 - * outletWhTimer.0.1 - */ - - /* Outlet groups collection */ - { "outlet.group.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.21.%i", - "0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL }, - /* outlet groups template definition - * Indexes start from 1, ie outlet.group.1 => .1 */ - /* Note: the first definition is used to determine the base index (ie 0 or 1) */ - /* groupID.0.1 = OctetString: A */ - { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* User-friendly (writeable) description of the outlet group: - * groupName.0.1 = OctetString: Factory Group 1 - * groupName.0.2 = OctetString: Branch Circuit B - */ - /* FIXME: SU_FLAG_SEMI_STATIC or SU_FLAG_SETTING => - * refreshed from time to time or upon call to setvar */ - { "outlet.group.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.3.%i.%i", - NULL, SU_FLAG_SEMI_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - NULL }, - /* Outlet-group physical name, a read-only string, - * is named groupDesignator (other MIBs groupPhysicalName) - * groupPhysicalName.0.1 = Value (OctetString): A - * groupDesignator.0.2 = Value (OctetString): B - */ - { "outlet.group.%i.name", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.8.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - NULL }, - /* Outlet-group color: groupColor (other MIBs groupBkgColor) - * groupColor.0.1 = Value (Gauge32): 16051527 (0xF4ED47) - */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream */ - { "outlet.group.%i.color", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.7.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - NULL }, - /* groupType.0.1 = Integer: outletSection (4) */ - { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.4.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_outlet_group_type_info[0] }, - /* Phase to which an outlet-group is connected: - * We use the following OID, which gives the voltage measurement type - * groupVoltageMeasType.0.1; Value (Integer): singlePhase (1) - */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream ; check type (number? string?) and flags (daisy?) */ - { "outlet.group.%i.phase", 0, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_outlet_group_phase_info[0] }, - /* groupControlStatus.0.1 = Integer: on (1) */ - { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.2.%i.%i", - NULL, SU_FLAG_OK | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_outletgroups_status_info[0] }, - /* groupChildCount.0.1 = Integer: 12 */ - { "outlet.group.%i.count", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.6.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupVoltage.0.1 = Integer: 243080 */ - { "outlet.group.%i.voltage", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.3.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupVoltageThStatus.0.1 = Integer: good (0) */ - { "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_threshold_status_info[0] }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_threshold_voltage_alarms_info[0] }, - { "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - { "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - { "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - { "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.3.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrent.0.1 = Integer: 0 */ - { "outlet.group.%i.current", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.3.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentCapacity.0.1 = Integer: 16000 */ - { "outlet.group.%i.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.2.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentThStatus.0.1 = Integer: good (0) */ - { "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_threshold_status_info[0] }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.4.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &marlin_threshold_current_alarms_info[0] }, - /* groupCurrentPercentLoad.0.1 = Integer: 0 */ - { "outlet.group.%i.load", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.10.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentThLowerWarning.0.1 = Integer: 0 */ - { "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.5.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentThLowerCritical.0.1 = Integer: -1 */ - { "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.6.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentThUpperWarning.0.1 = Integer: 12800 */ - { "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupCurrentThUpperCritical.0.1 = Integer: 16000 */ - { "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.534.6.6.7.5.4.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupWatts.0.1 = Integer: 2670 */ - { "outlet.group.%i.realpower", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.5.5.1.3.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupVA.0.1 = Integer: 3132 */ - { "outlet.group.%i.power", 0, 1.0, - ".1.3.6.1.4.1.534.6.6.7.5.5.1.2.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - NULL }, - /* Input to which an outlet-group is connected - * groupInputIndex.0.1 = Integer: 1 - */ - /* FIXME: RFC on key name is needed when backporting to NUT upstream */ - { "outlet.group.%i.input", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.1.1.9.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - NULL }, - - /* instant commands. */ - /* Notes: - * - load.cycle might be replaced by / mapped on shutdown.reboot - * - outletControl{Off,On,Reboot}Cmd values: - * 0-n : Timer - * -1 : Cancel - * we currently use "0", so instant On | Off | Reboot... */ - /* no counterpart found! - { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", - NULL, SU_TYPE_CMD, NULL }, - { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", - NULL, SU_TYPE_CMD, NULL }, - { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", - NULL, SU_TYPE_CMD, NULL }, */ - - /* Delays handling: - * 0-n :Time in seconds until the group command is issued - * -1:Cancel a pending group-level Off/On/Reboot command */ - { "outlet.%i.load.off", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.on", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.cycle", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* Per-outlet shutdown / startup delay (configuration point, not the timers) - * outletControlShutoffDelay.0.3 = INTEGER: 120 - * outletControlSequenceDelay.0.8 = INTEGER: 8 - * (by default each output socket startup is delayed by its number in seconds) - */ - { "outlet.%i.delay.shutdown", ST_FLAG_RW, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.10.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.delay.start", ST_FLAG_RW, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - { "outlet.%i.load.off.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.on.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.cycle.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.5.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* Per-outlet shutdown / startup timers - * outletControlOffCmd.0.1 = INTEGER: -1 - * outletControlOnCmd.0.1 = INTEGER: -1 - */ - { "outlet.%i.timer.shutdown", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.3.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.timer.start", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.6.6.1.4.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* Delays handling: - * 0-n :Time in seconds until the group command is issued - * -1:Cancel a pending group-level Off/On/Reboot command */ - /* groupControlOffCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.off", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupControl0nCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.on", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupControlRebootCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.cycle", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - { "outlet.group.%i.load.off.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.3.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupControl0nCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.on.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.4.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* groupControlRebootCmd.0.1 = Integer: -1 */ - { "outlet.group.%i.load.cycle.delay", 0, 1, - ".1.3.6.1.4.1.534.6.6.7.5.6.1.5.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - - -mib2nut_info_t eaton_marlin = { "eaton_epdu", EATON_MARLIN_MIB_VERSION, NULL, EATON_MARLIN_OID_MODEL_NAME, eaton_marlin_mib, EATON_MARLIN_SYSOID, NULL }; diff --git a/drivers/eaton-pdu-marlin-mib.h b/drivers/eaton-pdu-marlin-mib.h deleted file mode 100644 index 9014bb7..0000000 --- a/drivers/eaton-pdu-marlin-mib.h +++ /dev/null @@ -1,32 +0,0 @@ -/* eaton-pdu-marlin-mib.h - subdriver to monitor Eaton ePDU SNMP devices with NUT - * - * Copyright (C) - * 2010 Arjen de Korte - * 2011 - 2012 Arnaud Quette - * 2017 Arnaud Quette - * 2017 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_EPDU_MARLIN_MIB_H -#define EATON_EPDU_MARLIN_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t eaton_marlin; - -#endif /* EATON_EPDU_MARLIN_MIB_H */ diff --git a/drivers/eaton-pdu-pulizzi-mib.c b/drivers/eaton-pdu-pulizzi-mib.c deleted file mode 100644 index 65de73e..0000000 --- a/drivers/eaton-pdu-pulizzi-mib.c +++ /dev/null @@ -1,142 +0,0 @@ -/* eaton-pdu-pulizzi-mib.c - data to monitor Eaton ePDUs branded as: - * G1 Pulizzi Monitored and Switched ePDUs - * - * Copyright (C) 2008 - 2017 - * Arnaud Quette - * Arnaud Quette - * Copyright (C) 2015 - 2017 - * Jim Klimov - * - * Supported by Eaton - * and previously MGE Office Protection Systems - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "eaton-pdu-pulizzi-mib.h" - -/* Pulizzi Monitored ePDU (Basic model, SNMP only) - * FIXME: to be completed - * - * Warning: there are 2 versions: - * - SA built MI.mib (old MIB) - * #define PULIZZI1_OID_MIB ".1.3.6.1.4.1.20677.3.1.1" - * #define PULIZZI1_OID_MODEL_NAME ".1.3.6.1.4.1.20677.3.1.1.1.2.0" - * - Eaton-Powerware-Monitored-ePDU_1.0.E.mib (new MIB) Vertical SW - */ - - -/* Pulizzi Switched ePDU */ - -#define EATON_PULIZZI_SW_MIB_VERSION "0.5" - -#define PULIZZI_SW_OID_MIB ".1.3.6.1.4.1.20677.3.1.1" -#define PULIZZI_SW_OID_MODEL_NAME ".1.3.6.1.4.1.20677.2.1.1.0" - -/* Some buggy FW also report sysOID = ".1.3.6.1.4.1.20677.1" */ -#define EATON_PULIZZI_SWITCHED1_SYSOID ".1.3.6.1.4.1.20677.1" -#define EATON_PULIZZI_SWITCHED2_SYSOID ".1.3.6.1.4.1.20677.2" - - -static info_lkp_t pulizzi_sw_outlet_status_info[] = { - { 1, "on", NULL, NULL }, - { 2, "off", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* simply remap the above status to "yes" */ -static info_lkp_t pulizzi_sw_outlet_switchability_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "yes", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Snmp2NUT lookup table for Eaton Pulizzi Switched ePDU MIB */ -static snmp_info_t eaton_pulizzi_switched_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device page */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME, - "Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.2.6.0", - "unknown", 0, NULL }, - - /* UPS page */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, PULIZZI_SW_OID_MODEL_NAME, - "Switched ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: to be moved to the device collection! */ - { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.4.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.1.3.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* Outlet page */ - /* Note: outlet.count is deduced, with guestimate_outlet_count() */ - { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - - { "outlet.current", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.2.0", NULL, 0, NULL }, - { "outlet.voltage", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.1.0", NULL, 0, NULL }, - { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.20677.2.8.6.4.3.0", NULL, 0, NULL }, - - /* outlet template definition - * Notes: - * - indexes start from 1, ie outlet.1 => .1 - * - the first definition is used to determine the base index (ie 0 or 1) - * - outlet.count is estimated, based on the below OID iteration capabilities */ - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.1.%i.1.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, NULL }, - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0", - NULL, SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_status_info[0] }, - { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL }, - /* we use the same OID as outlet.n.status..., to expose switchability */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.20677.2.6.3.%i.0", "yes", SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET, &pulizzi_sw_outlet_switchability_info[0] }, - /* FIXME: need to be added to the namespace! */ - { "outlet.%i.delay.reboot", ST_FLAG_RW, 1, ".1.3.6.1.4.1.20677.2.6.1.%i.5.0", NULL, SU_OUTLET, NULL }, - /* "outlet1SequenceTime" is used for global sequence */ - { "outlet.%i.delay.start", ST_FLAG_RW, 1, ".1.3.6.1.4.1.20677.2.6.1.%i.4.0", NULL, SU_OUTLET, NULL }, - - /* instant commands. */ - /* FIXME: not exposed as "outlet.load...", or otherwise specific processing applies (template instanciation) */ - { "load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", "1", SU_TYPE_CMD, NULL }, - { "load.off", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", "2", SU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", "3", SU_TYPE_CMD, NULL }, - { "load.off.delay", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.1.0", "4", SU_TYPE_CMD, NULL }, - - /* WARNING: outlet 1 => index 2, so SU_CMD_OFFSET! */ - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.%i.0", "1", SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL }, - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.%i.0", "2", SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL }, - { "outlet.%i.load.cycle", 0, 1, ".1.3.6.1.4.1.20677.2.6.2.%i.0", "3", SU_TYPE_CMD | SU_OUTLET | SU_CMD_OFFSET, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - - -/*mib2nut_info_t pulizzi_monitored = { "pulizzi_monitored", EATON_PULIZZI_MIB_VERSION, NULL, PULIZZI1_OID_MODEL_NAME, eaton_pulizzi_monitored_mib, PULIZZI1_OID_MIB };*/ -mib2nut_info_t pulizzi_switched1 = { "pulizzi_switched1", EATON_PULIZZI_SW_MIB_VERSION, NULL, EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED1_SYSOID, NULL }; -mib2nut_info_t pulizzi_switched2 = { "pulizzi_switched2", EATON_PULIZZI_SW_MIB_VERSION, NULL, EATON_PULIZZI_SWITCHED1_SYSOID, eaton_pulizzi_switched_mib, EATON_PULIZZI_SWITCHED2_SYSOID, NULL }; diff --git a/drivers/eaton-pdu-pulizzi-mib.h b/drivers/eaton-pdu-pulizzi-mib.h deleted file mode 100644 index 5c08fb6..0000000 --- a/drivers/eaton-pdu-pulizzi-mib.h +++ /dev/null @@ -1,33 +0,0 @@ -/* eaton-pdu-pulizzi-mib.h - subdriver to monitor Eaton ePDU SNMP devices with NUT - * - * Copyright (C) - * 2010 Arjen de Korte - * 2011 - 2012 Arnaud Quette - * 2017 Arnaud Quette - * 2017 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_EPDU_PULIZZI_MIB_H -#define EATON_EPDU_PULIZZI_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t pulizzi_switched1; -extern mib2nut_info_t pulizzi_switched2; - -#endif /* EATON_EPDU_PULIZZI_MIB_H */ diff --git a/drivers/eaton-pdu-revelation-mib.c b/drivers/eaton-pdu-revelation-mib.c deleted file mode 100644 index 8c1cd83..0000000 --- a/drivers/eaton-pdu-revelation-mib.c +++ /dev/null @@ -1,182 +0,0 @@ -/* eaton-pdu-revelation-mib.c - data to monitor Eaton ePDUs branded as: - * G1 Aphel based ePDUs (Complex) - Revelation - * - * Copyright (C) 2008 - 2017 - * Arnaud Quette - * Arnaud Quette - * Copyright (C) 2015 - 2017 - * Jim Klimov - * - * Supported by Eaton - * and previously MGE Office Protection Systems - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "eaton-pdu-revelation-mib.h" - -#define EATON_APHEL_REVELATION_MIB_VERSION "0.52" - -/* APHEL PDU-MIB - Revelation MIB (Managed ePDU) - * ********************************************* */ - -#define AR_BASE_OID ".1.3.6.1.4.1.534.6.6.6" -#define APHEL2_SYSOID AR_BASE_OID -#define APHEL2_OID_MODEL_NAME AR_OID_MODEL_NAME - -#define AR_OID_MODEL_NAME AR_BASE_OID ".1.1.12.0" -#define AR_OID_DEVICE_NAME AR_BASE_OID ".1.1.13.0" -#define AR_OID_FIRMREV AR_BASE_OID ".1.1.1.0" -#define AR_OID_SERIAL AR_BASE_OID ".1.1.2.0" -#define AR_OID_UNIT_MACADDR AR_BASE_OID ".1.1.6.0" - -#define AR_OID_UNIT_CURRENT AR_BASE_OID ".1.3.1.1" -#define AR_OID_UNIT_VOLTAGE AR_BASE_OID ".1.3.1.2" -#define AR_OID_UNIT_ACTIVEPOWER AR_BASE_OID ".1.3.1.3" -#define AR_OID_UNIT_APPARENTPOWER AR_BASE_OID ".1.3.1.4" -#define AR_OID_UNIT_CPUTEMPERATURE AR_BASE_OID ".1.3.1.5.0" - -#define AR_OID_OUTLET_INDEX AR_BASE_OID ".1.2.2.1.1" -#define AR_OID_OUTLET_NAME AR_BASE_OID ".1.2.2.1.2" -#define AR_OID_OUTLET_STATUS AR_BASE_OID ".1.2.2.1.3" - -static info_lkp_t revelation_outlet_status_info[] = { - { -1, "error", NULL, NULL }, - { 0, "off", NULL, NULL }, - { 1, "on", NULL, NULL }, - { 2, "cycling", NULL, NULL }, /* transitional status */ - { 0, NULL, NULL, NULL } -}; - -/* Ugly hack: having the matching OID present means that the outlet is - * switchable. So, it should not require this value lookup */ -static info_lkp_t revelation_outlet_switchability_info[] = { - { -1, "yes", NULL, NULL }, - { 0, "yes", NULL, NULL }, - { 1, "yes", NULL, NULL }, - { 2, "yes", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -#define DO_OFF "0" -#define DO_ON "1" -#define DO_CYCLE "2" - -#define AR_OID_OUTLET_COUNT AR_BASE_OID ".1.2.1.0" -#define AR_OID_OUTLET_CURRENT AR_BASE_OID ".1.2.2.1.4" -#define AR_OID_OUTLET_MAXCURRENT AR_BASE_OID ".1.2.2.1.5" -#define AR_OID_OUTLET_VOLTAGE AR_BASE_OID ".1.2.2.1.6" -#define AR_OID_OUTLET_ACTIVEPOWER AR_BASE_OID ".1.2.2.1.7" -#define AR_OID_OUTLET_APPARENTPOWER AR_BASE_OID ".1.2.2.1.8" -#define AR_OID_OUTLET_POWERFACTOR AR_BASE_OID ".1.2.2.1.9" - -/* Snmp2NUT lookup table for Eaton Revelation MIB */ -static snmp_info_t eaton_aphel_revelation_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_MODEL_NAME, - "Eaton Powerware ePDU Managed", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_SERIAL, "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_UNIT_MACADDR, "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* hardwareRev.0 = Integer: 26 */ - /* FIXME: not compliant! to be RFC'ed */ - { "device.revision", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.6.1.1.7.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* UPS collection */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "EATON | Powerware", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_MODEL_NAME, - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_SERIAL, "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_FIRMREV, "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.temperature", 0, 1, AR_OID_UNIT_CPUTEMPERATURE, NULL, 0, NULL }, - - /* Outlet collection */ - { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.count", 0, 1, AR_OID_OUTLET_COUNT, "0", 0, NULL }, - { "outlet.current", 0, 0.001, AR_OID_UNIT_CURRENT ".0", NULL, 0, NULL }, - { "outlet.voltage", 0, 0.001, AR_OID_UNIT_VOLTAGE ".0", NULL, 0, NULL }, - { "outlet.realpower", 0, 1.0, AR_OID_UNIT_ACTIVEPOWER ".0", NULL, 0, NULL }, - { "outlet.power", 0, 1.0, AR_OID_UNIT_APPARENTPOWER ".0", NULL, 0, NULL }, - - /* outlet template definition - * Caution: the index of the data start at 0, while the name is +1 - * ie outlet.1 => .0 */ - { "outlet.%i.switchable", 0, 1, AR_OID_OUTLET_STATUS ".%i", "yes", SU_FLAG_STATIC | SU_OUTLET, &revelation_outlet_switchability_info[0] }, - { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL }, - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_NAME ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_OUTLET_STATUS ".%i", NULL, SU_FLAG_OK | SU_OUTLET, &revelation_outlet_status_info[0] }, - { "outlet.%i.current", 0, 0.001, AR_OID_OUTLET_CURRENT ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.current.maximum", 0, 0.001, AR_OID_OUTLET_MAXCURRENT ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.realpower", 0, 1.0, AR_OID_OUTLET_ACTIVEPOWER ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.voltage", 0, 1.0, AR_OID_OUTLET_VOLTAGE ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.powerfactor", 0, 0.01, AR_OID_OUTLET_POWERFACTOR ".%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.power", 0, 1.0, AR_OID_OUTLET_APPARENTPOWER ".%i", NULL, SU_OUTLET, NULL }, - - /* FIXME: - * - delay for startup/shutdown sequence - * - support for multiple Ambient sensors ( max. 8), starting at index '0' - * ambient.%i.temperature => .1.3.6.1.4.1.534.6.6.6.2.2.1.3.%i - * ambient.%i.humidity => .1.3.6.1.4.1.534.6.6.6.2.4.1.3.%i - */ - - /* Ambient collection */ - /* We use critical levels, for both temperature and humidity, - * since warning levels are also available! */ - { "ambient.temperature", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.2.1.3.0", NULL, SU_FLAG_OK, NULL }, - { "ambient.temperature.low", 0, 1.0, "1.3.6.1.4.1.534.6.6.6.2.2.1.6.0", NULL, SU_FLAG_OK, NULL }, - { "ambient.temperature.high", 0, 1.0, "1.3.6.1.4.1.534.6.6.6.2.2.1.7.0", NULL, SU_FLAG_OK, NULL }, - { "ambient.humidity", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.3.0", NULL, SU_FLAG_OK, NULL }, - { "ambient.humidity.low", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.6.0", NULL, SU_FLAG_OK, NULL }, - { "ambient.humidity.high", 0, 1.0, ".1.3.6.1.4.1.534.6.6.6.2.4.1.7.0", NULL, SU_FLAG_OK, NULL }, - - /* instant commands. */ - /* Note that load.cycle might be replaced by / mapped on shutdown.reboot */ - /* no counterpart found! - { "outlet.load.off", 0, DO_OFF, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL }, - { "outlet.load.on", 0, DO_ON, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL }, - { "outlet.load.cycle", 0, DO_CYCLE, AR_OID_OUTLET_STATUS ".0", NULL, SU_TYPE_CMD, NULL }, */ - { "outlet.%i.load.off", 0, 1, AR_OID_OUTLET_STATUS ".%i", DO_OFF, SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.on", 0, 1, AR_OID_OUTLET_STATUS ".%i", DO_ON, SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.cycle", 0, 1, AR_OID_OUTLET_STATUS ".%i", DO_CYCLE, SU_TYPE_CMD | SU_OUTLET, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - - -mib2nut_info_t aphel_revelation = { "aphel_revelation", EATON_APHEL_REVELATION_MIB_VERSION, NULL, APHEL2_OID_MODEL_NAME, eaton_aphel_revelation_mib, APHEL2_SYSOID, NULL }; diff --git a/drivers/eaton-pdu-revelation-mib.h b/drivers/eaton-pdu-revelation-mib.h deleted file mode 100644 index 3cd2645..0000000 --- a/drivers/eaton-pdu-revelation-mib.h +++ /dev/null @@ -1,32 +0,0 @@ -/* eaton-pdu-revelation-mib.h - subdriver to monitor Eaton ePDU SNMP devices with NUT - * - * Copyright (C) - * 2010 Arjen de Korte - * 2011 - 2012 Arnaud Quette - * 2017 Arnaud Quette - * 2017 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EATON_EPDU_REVELATION_MIB_H -#define EATON_EPDU_REVELATION_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t aphel_revelation; - -#endif /* EATON_EPDU_REVELATION_MIB_H */ diff --git a/drivers/emerson-avocent-pdu-mib.c b/drivers/emerson-avocent-pdu-mib.c deleted file mode 100644 index cffe555..0000000 --- a/drivers/emerson-avocent-pdu-mib.c +++ /dev/null @@ -1,191 +0,0 @@ -/* emerson-avocent-pdu-mib.c - subdriver to monitor Emerson Avocent PDUs with NUT - * - * Copyright (C) - * 2008-2018 Arnaud Quette - * 2009 Opengear - * 2017-2019 Eaton (Arnaud Quette ) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ -#define OPENGEAR_MULTIPLE_BANKS 1 - -#include "emerson-avocent-pdu-mib.h" - -#define EMERSON_AVOCENT_MIB_VERSION "1.3" -#define EMERSON_AVOCENT_SYSOID ".1.3.6.1.4.1.10418.17.1.7" -#define EMERSON_AVOCENT_OID_MODEL_NAME ".1.3.6.1.4.1.10418.17.2.1.2.0" - -/* FIXME: Avocent PM's seem to have 3 temperature sensors (index 1, 2, 3) - * for the embedded temperature (equivalent to ups.temperature) */ -#define AVOCENT_OID_UNIT_TEMPERATURE ".1.3.6.1.4.1.10418.17.2.5.3.1.17.1.1" - -/* Same as above for humidity... */ -#define AVOCENT_OID_UNIT_HUMIDITY ".1.3.6.1.4.1.10418.17.2.5.3.1.24.1" - -#define AVOCENT_OID_OUTLET_COUNT ".1.3.6.1.4.1.10418.17.2.5.3.1.8.%i.%i" - -/* FIXME: This is actually pmPowerMgmtPDUTableCurrent1Value */ -#define AVOCENT_OID_UNIT_CURRENT ".1.3.6.1.4.1.10418.17.2.5.3.1.10.1.1" -/* FIXME: This is actually pmPowerMgmtPDUTableVoltage1Value */ -#define AVOCENT_OID_UNIT_VOLTAGE ".1.3.6.1.4.1.10418.17.2.5.3.1.31.1.1" -#define AVOCENT_OID_UNIT_MACADDR ".1.3.6.1.2.1.2.2.1.6.1" - -#ifdef OPENGEAR_MULTIPLE_BANKS -#define AVOCENT_OID_OUTLET_ID ".1.3.6.1.4.1.10418.17.2.5.5.1.3" -#define AVOCENT_OID_OUTLET_NAME ".1.3.6.1.4.1.10418.17.2.5.5.1.4" -#define AVOCENT_OID_OUTLET_STATUS ".1.3.6.1.4.1.10418.17.2.5.5.1.5" -/* This the actual value for the Current of the sensor. */ -#define AVOCENT_OID_OUTLET_LOAD ".1.3.6.1.4.1.10418.17.2.5.5.1.50" -#define AVOCENT_OID_OUTLET_CONTROL ".1.3.6.1.4.1.10418.17.2.5.5.1.6" -#else -#define AVOCENT_OID_OUTLET_ID ".1.3.6.1.4.1.10418.17.2.5.5.1.3.1.1" -#define AVOCENT_OID_OUTLET_NAME ".1.3.6.1.4.1.10418.17.2.5.5.1.4.1.1" -#define AVOCENT_OID_OUTLET_STATUS ".1.3.6.1.4.1.10418.17.2.5.5.1.5.1.1" -#define AVOCENT_OID_OUTLET_LOAD ".1.3.6.1.4.1.10418.17.2.5.5.1.50.1.1" -#define AVOCENT_OID_OUTLET_CONTROL ".1.3.6.1.4.1.10418.17.2.5.5.1.6.1.1" -#endif - -static info_lkp_t avocent_outlet_status_info[] = { - { 1, "off", NULL, NULL }, - { 2, "on", NULL, NULL }, -/* { 3, "offLocked", NULL, NULL }, - { 4, "onLocked", NULL, NULL }, - { 5, "offCycle", NULL, NULL }, - { 6, "onPendingOff", NULL, NULL }, - { 7, "offPendingOn", NULL, NULL }, - { 8, "onPendingCycle", NULL, NULL }, - { 9, "notSet", NULL, NULL }, - { 10, "onFixed", NULL, NULL }, - { 11, "offShutdown", NULL, NULL }, - { 12, "tripped", NULL, NULL },*/ - { 0, NULL, NULL, NULL } -}; - -static snmp_info_t emerson_avocent_pdu_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device page */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Avocent", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.10418.17.2.5.3.1.5.1.%i", /* EMERSON_AVOCENT_OID_MODEL_NAME */ - "Avocent SNMP PDU", SU_FLAG_ABSENT | SU_FLAG_OK | SU_FLAG_NAINVALID, NULL }, - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.10418.17.2.1.4.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* Daisychained devices support - * Notes: this definition is used to: - * - estimate the number of devices, based on the below OID iteration capabilities - * - determine the base index of the SNMP OID (ie 0 or 1) */ - { "device.count", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.2.1.4.1", - "1", SU_FLAG_STATIC, NULL }, - - /* UPS page */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Avocent", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, EMERSON_AVOCENT_OID_MODEL_NAME, - "Avocent SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.10418.17.2.1.1.0", - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.10418.17.2.1.4.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.10418.17.2.1.7.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, AVOCENT_OID_UNIT_MACADDR, - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* Outlet page */ - { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.count", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.3.1.8.1.%i", "0", SU_FLAG_STATIC | SU_FLAG_ZEROINVALID | SU_FLAG_OK, NULL }, - - /* outlets */ - /* NOTE: there is a bug in Avocent FW: - * index '0' should not respond (and is not in subtree mode) but answers - * to unitary get, since OIDs start at index '1'. - *Use the status data below to test since '0' is not a supported value */ - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.10418.17.2.5.5.1.5.1.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1 | SU_FLAG_ZEROINVALID, &avocent_outlet_status_info[0] }, - { "outlet.%i.id", 0, 1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.3.1.%i.%i", NULL, SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.10418.17.2.5.5.1.4.1.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1 | SU_FLAG_NAINVALID, NULL }, - /* pmPowerMgmtOutletsTableCurrentValue.1.1.1; Value (Integer): 0 */ - { "outlet.%i.current", 0, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.50.1.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTableCurrentHighCritical.1.1.1; Value (Integer): 160 */ - { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.100.1.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTableCurrentHighWarning.1.1.1; Value (Integer): 120 */ - { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.101.1.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTableCurrentLowWarning.1.1.1; Value (Integer): 0 */ - { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.102.1.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTableCurrentLowCritical.1.1.1; Value (Integer): 0 */ - { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.103.1.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTablePowerValue.1.1.1; Value (Integer): 0 */ - { "outlet.%i.realpower", 0, 0.1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.60.1.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pmPowerMgmtOutletsTableVoltageValue.1.1.1; Value (Integer): 238 */ - { "outlet.%i.voltage", 0, 1, - ".1.3.6.1.4.1.10418.17.2.5.5.1.70.1.%i.%i", NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* TODO: handle statistics - * pmPowerMgmtOutletsTableEnergyValue.1.1.1; Value (Integer): 0 (Wh) - * pmPowerMgmtOutletsTableEnergyStartTime.1.1.1; Value (OctetString): 2018-02-13 10:40:09 - * pmPowerMgmtOutletsTableEnergyReset.1.1.1; Value (Integer): noAction (1) - */ - - /* Outlet groups collection */ - /* pmPowerMgmtNumberOfOutletGroup.0; Value (Integer): 0 */ - { "outlet.group.count", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.6.%i", - "0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL }, - - /* TODO: support for "Banks" (not sure to understand what is this?!) - * pmPowerMgmtTotalNumberOfBanks.0; Value (Integer): 6 - * pmPowerMgmtBanksTableName.1.1.1; Value (OctetString): 18-bf-ffP0_1_A - */ - - /* According to MIB Power Control values are: - * noAction(1), - * powerOn(2), - * powerOff(3), - * powerCycle(4), - * powerLock(5), - * powerUnlock(6) - */ - { "outlet.%i.load.cycle", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.5.1.6.1.%i.%i", "4", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.5.1.6.1.%i.%i", "3", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.10418.17.2.5.5.1.6.1.%i.%i", "2", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t emerson_avocent_pdu = { "emerson_avocent_pdu", EMERSON_AVOCENT_MIB_VERSION, NULL, EMERSON_AVOCENT_OID_MODEL_NAME, emerson_avocent_pdu_mib, EMERSON_AVOCENT_SYSOID, NULL }; diff --git a/drivers/emerson-avocent-pdu-mib.h b/drivers/emerson-avocent-pdu-mib.h deleted file mode 100644 index fb98075..0000000 --- a/drivers/emerson-avocent-pdu-mib.h +++ /dev/null @@ -1,31 +0,0 @@ -/* emerson-avocent-pdu-mib.h - subdriver to monitor Emerson Avocent PDUs with NUT - * - * Copyright (C) - * 2008-2018 Arnaud Quette - * 2009 Opengear - * 2018 Eaton (Arnaud Quette ) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EMERSON_AVOCENT_PDU_MIB_H -#define EMERSON_AVOCENT_PDU_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t emerson_avocent_pdu; - -#endif /* EMERSON_AVOCENT_PDU_MIB_H */ diff --git a/drivers/etapro.c b/drivers/etapro.c index 85b88d5..6690348 100644 --- a/drivers/etapro.c +++ b/drivers/etapro.c @@ -52,10 +52,9 @@ #include "main.h" #include "serial.h" -#include "nut_stdint.h" #define DRIVER_NAME "ETA PRO driver" -#define DRIVER_VERSION "0.05" +#define DRIVER_VERSION "0.04" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -113,10 +112,7 @@ etapro_get_response(const char *resp_type) upslogx(LOG_ERR, "bad response format (%s)", tmp); return -1; } - if (val > INT_MAX) { - upslogx(LOG_WARNING, "got value too big in response"); - } - return (int)val; + return val; } static void @@ -194,7 +190,7 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } diff --git a/drivers/ever-hid.c b/drivers/ever-hid.c deleted file mode 100644 index 9f6a674..0000000 --- a/drivers/ever-hid.c +++ /dev/null @@ -1,787 +0,0 @@ -/* ever-hid.c - subdriver to monitor EVER USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2017 EVER Power Systems [https://ever.eu/] - * 2020 - 2022 Jim Klimov - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-usbhid-subdriver script. It must be customized. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be first */ - -#include "usbhid-ups.h" -#include "ever-hid.h" -#include "main.h" /* for getval() */ -#include "usb-common.h" - -#define EVER_HID_VERSION "Ever HID 0.1" -/* FIXME: experimental flag to be put in upsdrv_info */ - -/* Ever */ -#define EVER_VENDORID 0x2e51 - -/* ST Microelectronics */ -#define STMICRO_VENDORID 0x0483 - -/* USB IDs device table */ -static usb_device_id_t ever_usb_device_table[] = { - - { USB_DEVICE(STMICRO_VENDORID, 0xa113), NULL }, - { USB_DEVICE(EVER_VENDORID, 0xffff), NULL}, - { USB_DEVICE(EVER_VENDORID, 0x0000), NULL}, - - /* Terminating entry */ - { 0, 0, NULL } -}; - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -static const char *ever_format_hardware_fun(double value) -{ - /*TODO - add exception handling for v1.0b0B */ - const char* hard_rev[27] = {"0", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; - static char model[10]; - snprintf(model, sizeof(model), "rev.%sv%02u", - (&hard_rev[ ((unsigned int)value & 0xFF00)>>8 ])[0], - (unsigned int)value & 0xFF ); - return model; -} - -static const char *ever_format_version_fun(double value) -{ - /*upsdebugx(1, "UPS ups_firmware_conversion_fun VALUE: %d", (long)value ); */ - static char model[10]; - snprintf(model, sizeof(model), "v%X.%Xb%02d", - ((unsigned int)value & 0xF000)>>12, - ((unsigned int)value & 0xF00)>>8, - ((int)value & 0xFF) ); - return model; -} - -static const char *ever_mac_address_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - int mac_adress_report_id = 210; - int len = reportbuf->len[mac_adress_report_id]; - const void *buf = reportbuf->data[mac_adress_report_id]; - - static char line[100]; - line[0] = '\0'; - int n = 0; /* number of characters currently in line */ - int i; /* number of bytes output from buffer */ - - /* skip first elemnt which is a report id */ - for (i = 1; i < len; i++) { - n = snprintfcat(line, sizeof(line), n ? ":%02x" : "%02x", - ((unsigned char *)buf)[i]); - } - - return line; -} - -static const char *ever_ip_address_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - static int report_counter = 1; - int report_id = 211; - - if(report_counter == 1) - report_id = 211; /* notification dest ip */ - else if(report_counter == 2) - report_id = 230; /* ip address */ - else if(report_counter == 3) - report_id = 231; /* network mask */ - else if(report_counter == 4) - report_id = 232; /* default gateway */ - - report_counter== 4 ? report_counter=1 : report_counter++; - - int len = reportbuf->len[report_id]; - const void *buf = reportbuf->data[report_id]; - - static char line[100]; - line[0] = '\0'; - int n = 0; /* number of characters currently in line */ - int i; /* number of bytes output from buffer */ - - /*skip first element which is a report id */ - for (i = 1; i < len; i++) - { - n = snprintfcat(line, sizeof(line), n ? ".%d" : "%d", - ((unsigned char *)buf)[i]); - } - - return line; -} - -static const char *ever_packets_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - static int report_counter = 1; - int report_id = 215; - - if(report_counter == 1 ) - report_id = 215; - else if(report_counter == 2 ) - report_id = 216; - else if(report_counter == 3 ) - report_id = 217; - else if(report_counter == 4 ) - report_id = 218; - - report_counter== 4 ? report_counter=1 : report_counter++; - - int len = reportbuf->len[report_id]; - const unsigned char *buf = reportbuf->data[report_id]; - - static char line[100]; - line[0] = '\0'; - - /*skip first elemnt which is a report id */ - - if(len < 5) - return ""; - - int res = (int)buf[1]; - res |= (int)buf[2] << 8; - res |= (int)buf[3] << 16; - res |= (int)buf[4] << 24; - - snprintf(line, sizeof(line), "%d", res); - return line; - -} - -static const char* ever_workmode_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - int workmode_report_id = 74; - int workmode = -1; - const unsigned char *buf = reportbuf->data[workmode_report_id]; - - static char line[100]; - line[0] = '\0'; - - /*skip first element which is a report id */ - snprintfcat(line, sizeof(line), "%d", buf[1]); - - workmode = atoi(line); - - switch(workmode) - { - case 1: - return "UNKNOWN"; - - case 2: - return "STOP"; - - case 4: - return "ONLINE"; - - case 8: - return "ONBATTERY"; - - case 16: - return "WATCH"; - - case 32: - return "WAITING"; - - case 64: - return "EMERGENCY"; - - default: - return "UNKNOWN"; - } - -} - -static const char* ever_messages_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - int messages_report_id = 75; - const unsigned char *buf = reportbuf->data[messages_report_id]; - - static char line[200]; - line[0] = '\0'; - - /*skip first element which is a report id */ - int messages = (int)buf[1]; - messages |= (int)buf[2] << 8; - - int n = 0; /* number of characters currently in line */ - - /* duplicate of ups.status: OB LB */ - /* - if(messages & 0x01) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "OVERLOAD"); - if(messages & 0x02) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "BATTERY_LOW"); - */ - if(messages & 0x04) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "BOOST"); - if(messages & 0x08) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "BUCK"); - if(messages & 0x10) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "BOOST_BLOCKED"); - if(messages & 0x20) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "BUCK_BLOCKED"); - if(messages & 0x40) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "CHARGING"); - if(messages & 0x80) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "FAN_ON"); - if(messages & 0x100) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "EPO_BLOCKED"); - if(messages & 0x200) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "NEED_REPLACMENT"); - if(messages & 0x400 || messages & 0x800) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "OVERHEAT"); - if(messages & 0x1000) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "WAITING_FOR_MIN_CHARGE"); - if(messages & 0x2000) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "MAINS_OUT_OF_RANGE"); - return line; -} - -static const char* ever_alarms_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - int alarms_report_id = 76; - - const unsigned char *buf = reportbuf->data[alarms_report_id]; - - static char line[200]; - line[0] = '\0'; - - /*skip first element which is a report id */ - int alarms = (int)buf[1]; - alarms |= (int)buf[2] << 8; - - int n = 0; /* number of characters currently in line */ - - if(alarms & 0x01) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "OVERLOAD"); - if(alarms & 0x02) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "SHORT-CIRCUIT"); - if(alarms & 0x04 || alarms & 0x08) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "OVERHEAT"); - if(alarms & 0x10) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "EPO"); - if(alarms & 0x20) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "INERNAL_ERROR"); - if(alarms & 0x40) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "REVERSE_POWER_SUPPLY"); - if(alarms & 0x80) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "NO_INETERNAL_COMM"); - if(alarms & 0x100) - n = snprintfcat(line, sizeof(line), n ? " %s" : "%s", "CRITICAL_BATT_VOLTAGE"); - - return line; -} - -static const char* ever_on_off_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - - int workmode_report_id = 74; - int workmode = -1; - const unsigned char *buf = reportbuf->data[workmode_report_id]; - - static char line[100]; - line[0] = '\0'; - - /*skip first element which is a report id */ - snprintfcat(line, sizeof(line), "%d", buf[1]); - - workmode = atoi(line); - - if(workmode != 0x04 && workmode != 0x08) - return "off"; - - return "!off"; -} - -static info_lkp_t ever_format_hardware[] = { - { 0, NULL, ever_format_hardware_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_format_version[] = { - { 0, NULL, ever_format_version_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_mac_address[] = { - { 0, NULL, ever_mac_address_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_ip_address[] = { - { 0, NULL, ever_ip_address_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_packets[] = { - { 0, NULL, ever_packets_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_workmode[] = { - { 0, NULL, ever_workmode_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_messages[] = { - { 0, NULL, ever_messages_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_alarms[] = { - { 0, NULL, ever_alarms_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t ever_on_off_info[] = { - { 0, NULL, ever_on_off_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - - -/* EVER usage table */ -static usage_lkp_t ever_usage_lkp[] = { - { "EVER1", 0x00000000 }, - { "EVER2", 0xff000000 }, - { "EVER3", 0xff000001 }, - { "EVER4", 0xff000002 }, - { "EVER5", 0xff000003 }, - { "EVER6", 0xff000004 }, - { "EVER7", 0xff000005 }, - { "EVER8", 0xff000006 }, - { "EVER9", 0xff000007 }, - { "EVER10", 0xff000008 }, - { "EVER11", 0xff000009 }, - { "EVER12", 0xff000010 }, - { "EVER13", 0xff000011 }, - { "EVER14", 0xff000012 }, - { "EVER15", 0xff000013 }, - { "EVER16", 0xff000014 }, - { "EVER17", 0xff000015 }, - { "EVER18", 0xff000016 }, - { "EVER19", 0xff000017 }, - { "EVER20", 0xff000018 }, - { "EVER21", 0xff000019 }, - { "EVER22", 0xff00001a }, - { "EVER23", 0xff00001b }, - { "EVER24", 0xff00001c }, - { "EVER25", 0xff00001d }, - { "EVER26", 0xff00001e }, - { "EVER27", 0xff00001f }, - { "EVER28", 0xff000020 }, - { "EVER29", 0xff000021 }, - { "EVER30", 0xff000022 }, - { "EVER31", 0xff000023 }, - { "EVER32", 0xff000030 }, - { "EVER33", 0xff000031 }, - { "EVER34", 0xff000032 }, - { "EVER35", 0xff000033 }, - { "EVER36", 0xff000034 }, - { "EVER37", 0xff000035 }, - { "EVER38", 0xff000036 }, - { "EVER39", 0xff000037 }, - { "EVER40", 0xff000038 }, - { "EVER41", 0xff000039 }, - { "EVER42", 0xff000040 }, - { "EVER43", 0xff000041 }, - { "EVER44", 0xff000042 }, - { "EVER45", 0xff000043 }, - { "EVER46", 0xff000044 }, - { "EVER47", 0xff000045 }, - { "EVER48", 0xff000046 }, - { "EVER49", 0xff000050 }, - { "EVER50", 0xff000051 }, - { "EVER51", 0xff000052 }, - { "EVER52", 0xff000053 }, - { "EVER53", 0xff000054 }, - { "EVER54", 0xff000060 }, - { "EVER55", 0xff000061 }, - { "EVER56", 0xff000062 }, - { "EVER57", 0xff000063 }, - { "EVER58", 0xff000064 }, - { "EVER59", 0xff000066 }, - { "EVER60", 0xff000067 }, - { "EVER61", 0xff000068 }, - { "EVER62", 0xff000069 }, - { "EVER63", 0xff00006a }, - { "EVER64", 0xff00006b }, - { "EVER65", 0xff00006c }, - { "EVER66", 0xff00006d }, - { "EVER67", 0xff00006e }, - { "EVER68", 0xff00006f }, - { "EVER69", 0xff000070 }, - { "EVER70", 0xff000071 }, - { "EVER71", 0xff000072 }, - { "EVER72", 0xff000073 }, - { "EVER73", 0xff000074 }, - { "EVER74", 0xff000075 }, - { "EVER75", 0xff000076 }, - { "EVER76", 0xff000077 }, - { "EVER77", 0xff000078 }, - { "EVER78", 0xff000079 }, - { "EVER79", 0xff00007a }, - { "EVER80", 0xff00007b }, - { "EVER81", 0xff00007c }, - { "EVER82", 0xff00007d }, - { "EVER83", 0xff00007e }, - { "EVER84", 0xff00007f }, - { "EVER85", 0xff000080 }, - { "EVER86", 0xff000081 }, - { "EVER87", 0xff000082 }, - { "EVER88", 0xff000083 }, - { "EVER89", 0xff000084 }, - { "EVER90", 0xff000085 }, - { "EVER91", 0xff000086 }, - { "EVER92", 0xff000087 }, - { "EVER93", 0xff000088 }, - { "EVER94", 0xff000089 }, - { "EVER95", 0xff00008a }, - { "EVER96", 0xff00008b }, - { "EVER97", 0xff000090 }, - { "EVER98", 0xff000091 }, - { "EVER99", 0xff000092 }, - { "EVER100", 0xff000093 }, - { "EVER101", 0xff000094 }, - { "EVER102", 0xff000095 }, - { "EVER103", 0xff000096 }, - { "EVER104", 0xff000097 }, - { NULL, 0 } -}; - -static usage_tables_t ever_utab[] = { - ever_usage_lkp, - hid_usage_lkp, - NULL, -}; - - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t ever_hid2nut[] = { - - /* Note: fields marked with "experimental." prefix were proposed without - * an exact match vs. docs/nut-names.txt definitions. PRs are welcome to - * analyze and map those values into standard NUT variable names, or to - * raise discussion on mailing lists and define new names via consensus. - * There is a lot of interesting info listed below. - * - * Note: mappings that were applied below (as committed 2022-02-09) may - * be wrong and are based mostly on cursory reading of original names. - * In particular, not sure if the skipped "id.*" fields were identifiers - * or some "internal device" etc. - */ - - /* experimental: "NUT variable names" do not currently have - * any battery.*id data points: */ - { "experimental.battery.batteryid", 0, 0, "UPS.BatterySystem.Battery.BatteryID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.systemid", 0, 0, "UPS.BatterySystem.BatterySystemID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.chargerid", 0, 0, "UPS.BatterySystem.Charger.ChargerID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.input_flowid", 0, 0, "UPS.BatterySystem.Input.FlowID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.input_id", 0, 0, "UPS.BatterySystem.Input.InputID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.output_flowid", 0, 0, "UPS.BatterySystem.Output.FlowID", NULL, "%.0f", 0, NULL }, - { "experimental.battery.output_id", 0, 0, "UPS.BatterySystem.Output.OutputID", NULL, "%.0f", 0, NULL }, - - /* experimental: "NUT variable names" do not currently have - * any id (nor version) data points for FW/HW of components: */ - /* not implemented*/ - /* { "experimental.id.ups_type", 0, 0, "UPS.EVER1.EVER12", NULL, "%s", 0, ever_format_model }, */ - { "experimental.id.firmware_version_inverter", 0, 0, "UPS.EVER1.EVER13", NULL, "%s", 0, ever_format_version }, - { "experimental.id.firmware_version_interfaces", 0, 0, "UPS.EVER1.EVER14", NULL, "%s", 0, ever_format_version }, - { "experimental.id.hardware_version", 0, 0, "UPS.EVER1.EVER15", NULL, "%s", 0, ever_format_hardware }, - { "experimental.id.protocol_version_inverter", 0, 0, "UPS.EVER1.EVER16", NULL, "%s", 0, ever_format_version }, - { "experimental.id.protocol_version_interfaces", 0, 0, "UPS.EVER1.EVER17", NULL, "%s", 0, ever_format_version }, - - /* WAS: "experimental.inverter_info.heatsink_temperature" */ - { "ups.temperature", 0, 0, "UPS.EVER1.EVER42", NULL, "%s", 0, kelvin_celsius_conversion }, - /* WAS: "experimental.inverter_info.battery_temperature" */ - { "battery.temperature", 0, 0, "UPS.EVER1.EVER43", NULL, "%s", 0, kelvin_celsius_conversion }, - /* WAS: "experimental.ups_info.output_powerfactor" */ - { "powerfactor", 0, 0, "UPS.EVER1.EVER44", NULL, "%.0f", 0, NULL }, - - /* experimental: Should these be HU_TYPE_CMD entries? - * Or are they really settings? */ - { "experimental.control.ups_on", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER45.EVER46", NULL, "%.0f", 0, NULL }, - { "experimental.control.clear_fault", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER45.EVER47", NULL, "%.0f", 0, NULL }, - { "experimental.control.clear_battery_fault", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER45.EVER48", NULL, "%.0f", 0, NULL }, - { "experimental.control.epo_blocked", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER49.EVER50", NULL, "%.0f", 0, NULL }, - { "experimental.control.green_mode", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER49.EVER51", NULL, "%.0f", 0, NULL }, - { "experimental.control.button_sound", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER49.EVER52", NULL, "%.0f", 0, NULL }, - { "experimental.control.audible_alarm", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER49.EVER53", NULL, "%.0f", 0, NULL }, - - /* WAS: "experimental.config.output_voltage" */ - { "output.voltage", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.EVER1.EVER54", NULL, "%.0f", 0, NULL }, - - /* not implemented*/ - /* - { "experimental.config.min_output_voltage", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.EVER1.EVER55", NULL, "%.0f", 0, NULL }, - { "experimental.config.max_output_voltage", ST_FLAG_RW | ST_FLAG_STRING, 3, "UPS.EVER1.EVER56", NULL, "%.0f", 0, NULL }, - { "experimental.config.min_output_frequency", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER57", NULL, "%.1f", 0, NULL }, - { "experimental.config.max_output_frequency", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.EVER1.EVER58", NULL, "%.1f", 0, NULL }, - */ - /* experimental: what units is this counted in? - * is "ups.load.high" a suitable mapping here? or "battery.voltage.high"? - */ - { "experimental.config.overload_clearance_threshold", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.EVER1.EVER59", NULL, "%.0f", 0, NULL }, - { "experimental.config.stb_charge", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.EVER1.EVER60", NULL, "%.0f", 0, NULL }, - /* WAS: "experimental.config.number_of_ebms" - * Should this be a string? rw? - */ - { "battery.packs.external", ST_FLAG_RW | ST_FLAG_STRING, 1, "UPS.EVER1.EVER61", NULL, "%.0f", 0, NULL }, - - { "experimental.statistics.mains_loss_counter", 0, 0, "UPS.EVER1.EVER62", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.lowering_AVR_trigger_counter", 0, 0, "UPS.EVER1.EVER63", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.rising_AVR_trigger_counter", 0, 0, "UPS.EVER1.EVER64", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.overload_counter", 0, 0, "UPS.EVER1.EVER65", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.short_circuit_counter", 0, 0, "UPS.EVER1.EVER66", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.discharge_counter", 0, 0, "UPS.EVER1.EVER67", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.overheat_counter", 0, 0, "UPS.EVER1.EVER68", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.mains_operation_time", 0, 0, "UPS.EVER1.EVER69", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.autonomous_operation_time", 0, 0, "UPS.EVER1.EVER70", NULL, "%.0f", 0, NULL }, - { "experimental.statistics.overload_operation_time", 0, 0, "UPS.EVER1.EVER71", NULL, "%.0f", 0, NULL }, - - { "experimental.networkcard.mac_address", 0, 0, "UPS.EVER1.EVER72", NULL, "%s", 0, ever_mac_address }, - { "experimental.networkcard.notification_destination_ip", 0, 0, "UPS.EVER1.EVER73", NULL, "%s", 0, ever_ip_address }, - { "experimental.networkcard.send_packets", 0, 0, "UPS.EVER1.EVER77", NULL, "%s", 0, ever_packets }, - { "experimental.networkcard.received_packets", 0, 0, "UPS.EVER1.EVER78", NULL, "%s", 0, ever_packets }, - { "experimental.networkcard.send_packets_err", 0, 0, "UPS.EVER1.EVER79", NULL, "%s", 0, ever_packets }, - { "experimental.networkcard.received_packets_err", 0, 0, "UPS.EVER1.EVER80", NULL, "%s", 0, ever_packets }, - { "experimental.networkcard.config_dhcp_enabled", 0, 0, "UPS.EVER1.EVER85.EVER86", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_ethernet_enabled", 0, 0, "UPS.EVER1.EVER85.EVER87", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_http_enabled", 0, 0, "UPS.EVER1.EVER85.EVER88", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_snmp_enabled", 0, 0, "UPS.EVER1.EVER85.EVER89", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_snmp_trap_enabled", 0, 0, "UPS.EVER1.EVER85.EVER90", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_readonly", 0, 0, "UPS.EVER1.EVER85.EVER91", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.config_restart_eth", 0, 0, "UPS.EVER1.EVER85.EVER96", NULL, "%.0f", 0, NULL }, - { "experimental.networkcard.ip_address", 0, 0, "UPS.EVER1.EVER93", NULL, "%s", 0, ever_ip_address }, - { "experimental.networkcard.network_mask", 0, 0, "UPS.EVER1.EVER94", NULL, "%s", 0, ever_ip_address }, - { "experimental.networkcard.default_gateway", 0, 0, "UPS.EVER1.EVER95", NULL, "%s", 0, ever_ip_address }, - - /* WAS: "experimental.id.config_active_power" */ - { "ups.realpower.nominal", 0, 0, "UPS.Flow.ConfigActivePower", NULL, "%.0f", 0, NULL }, - /* WAS: "experimental.id.config_apparent_power" - * Other HID subdrivers use "ups.power.nominal" mostly (often HU_FLAG_STATIC); - * once of each: "ups.realpower.nominal", "ups.realpower". - * Is this even a run-time value or a hardware property? - */ - { "ups.power.nominal", 0, 0, "UPS.Flow.ConfigApparentPower", NULL, "%.0f", 0, NULL }, - - /* WAS: "experimental.ups.config_frequency" - * Here and next: is this about input or output?.. - * Other drivers have "input.frequency.nominal" on numbered Flows - * As a "nominal", should it be HU_FLAG_SEMI_STATIC or HU_FLAG_STATIC maybe? - * Note there are non-nominal values in "powerconverter" below, - * so the questions here may be somewhat irrelevant... - */ - { "output.frequency.nominal", 0, 0, "UPS.Flow.ConfigFrequency", NULL, "%.0f", 0, NULL }, - /* WAS: "experimental.ups.config_voltage" */ - { "output.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.0f", 0, NULL }, - { "experimental.ups.flow_id", 0, 0, "UPS.Flow.FlowID", NULL, "%.0f", 0, NULL }, - - /* NOTE: NUT variable names define "outlet.n.*" names for numbering all - * separately manageable outlets; the numberless value (or outlet.0.*) - * is reserved to represent common properties of all outlets, if there - * are more than one outlet (group). - * Mapping below arbitrarily assigns n=1 but really this should be tied - * to actual outlet counts (see %i mappings in other drivers). - */ - /* WAS: experimental.outlet.outlet_id */ - { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.OutletID", NULL, "%.0f", 0, NULL }, - /* WAS: */ - { "experimental.outlet.1.present", 0, 0, "UPS.OutletSystem.Outlet.PresentStatus.Present", NULL, "%.0f", 0, yes_no_info }, - { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.PresentStatus.Switchable", NULL, "%.0f", 0, yes_no_info }, - /* WAS: experimental.outlet.switch_on_off */ - { "outlet.1.status", 0, 0, "UPS.OutletSystem.Outlet.PresentStatus.SwitchOn/Off", NULL, "%.0f", 0, NULL }, - { "experimental.outlet.1.undefined", 0, 0, "UPS.OutletSystem.Outlet.PresentStatus.Undefined", NULL, "%.0f", 0, NULL }, - { "experimental.outlet.1.system_id", 0, 0, "UPS.OutletSystem.OutletSystemID", NULL, "%.0f", 0, NULL }, - /* experimental: Should these be HU_TYPE_CMD entries? - * Or are they really settings? */ - { "experimental.outlet.1.switch_off_control", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.OutletSystem.Outlet.SwitchOffControl", NULL, "%.0f", 0, NULL }, - { "experimental.outlet.1.switch_on_control", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.OutletSystem.Outlet.SwitchOnControl", NULL, "%.0f", 0, NULL }, - - { "experimental.powerconverter.input_flow_id", 0, 0, "UPS.PowerConverter.Input.FlowID", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.input_frequency */ - { "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%.0f", 0, NULL }, - { "experimental.powerconverter.input_id", 0, 0, "UPS.PowerConverter.Input.InputID", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.input_voltage */ - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_active_power */ - { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_apparent_power */ - { "ups.power", 0, 0, "UPS.PowerConverter.Output.ApparentPower", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_current */ - { "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%.0f", 0, NULL }, - { "experimental.powerconverter.output_flowid", 0, 0, "UPS.PowerConverter.Output.FlowID", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_frequency */ - { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.0f", 0, NULL }, - { "experimental.powerconverter.output_id", 0, 0, "UPS.PowerConverter.Output.OutputID", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_percent_load - * Note: several original readings map into "ups.load", first served wins - */ - { "ups.load", 0, 0, "UPS.PowerConverter.Output.PercentLoad", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powerconverter.output_voltage */ - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.0f", 0, NULL }, - { "experimental.powerconverter.powerconverterid", 0, 0, "UPS.PowerConverter.PowerConverterID", NULL, "%.0f", 0, NULL }, - { "experimental.powersummary.capacity_granularity_1", 0, 0, "UPS.PowerSummary.CapacityGranularity1", NULL, "%.0f", 0, NULL }, - { "experimental.powersummary.capacity_granularity_2", 0, 0, "UPS.PowerSummary.CapacityGranularity2", NULL, "%.0f", 0, NULL }, - /* WAS: */ - { "experimental.powersummary.capacity_mode", 0, 0, "UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.delay_before_shutdown */ - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL }, - /* WAS: experimental.powersummary.design_capacity */ - { "battery.capacity", 0, 0, "UPS.PowerSummary.DesignCapacity", NULL, "%.0f", 0, NULL }, - { "experimental.powersummary.flow_id", 0, 0, "UPS.PowerSummary.FlowID", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.full_charge_capacity */ - { "battery.capacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.idevice_chemistry */ - { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.percent_load - * Note: several original readings map into "ups.load", first served wins - */ - { "ups.load", 0, 0, "UPS.PowerSummary.PercentLoad", NULL, "%.0f", 0, NULL }, - { "experimental.powersummary.rechargeable", 0, 0, "UPS.PowerSummary.Rechargeable", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.remaining_capacity */ - { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.remaining_time_limit */ - { "battery.runtime.low", ST_FLAG_RW | ST_FLAG_NUMBER, 0, "UPS.PowerSummary.RemainingTimeLimit", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.run_time_to_empty */ - { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.voltage */ - { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.0f", 0, NULL }, - /* WAS: experimental.powersummary.delay_before_shutdown */ - { "ups.timer.shutdown", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL }, - - /* not implemented*/ - /* { "unmapped.ups.powersummary.powersummaryid", 0, 0, "UPS.PowerSummary.PowerSummaryID", NULL, "%.0f", 0, NULL }, */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.AwaitingPower", NULL, NULL, HU_FLAG_QUICK_POLL, awaitingpower_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BatteryPresent", NULL, NULL, 0, nobattery_info }, - - /* not implemented*/ - /* { "experimental.ups.presentstatus.belowremainingcapacitylimit", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, "%.0f", 0, NULL }, */ - /* { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Boost", NULL, NULL, 0, boost_info }, */ - /* { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Buck", NULL, NULL, 0, trim_info }, */ - /* { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.CommunicationLost", NULL, NULL, 0, commfault_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - /* not implemented*/ - /* { "experimental.ups.powersummary.presentstatus.good", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, "%.0f", 0, NULL }, */ - /* { "experimental.ups.powersummary.presentstatus.internalfailure", 0, 0, "UPS.PowerSummary.PresentStatus.InternalFailure", NULL, "%.0f", 0, NULL }, */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, 0, replacebatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Overload", NULL, NULL, HU_FLAG_QUICK_POLL, overload_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.OverTemperature", NULL, NULL, 0, overheat_info }, - /* not implemented*/ - /* { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL, NULL, 0, lowbatt_info }, */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, 0, shutdownimm_info }, - - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER19", NULL, NULL, 0, overload_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER20", NULL, NULL, 0, lowbatt_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER21", NULL, NULL, 0, boost_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER22", NULL, NULL, 0, trim_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER25", NULL, NULL, 0, charging_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER18.EVER28", NULL, NULL, 0, replacebatt_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER32.EVER33", NULL, NULL, 0, overload_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER32.EVER40", NULL, "%.0f", 0, commfault_info }, - { "BOOL", 0, 0, "UPS.EVER1.EVER97.EVER102", NULL, "%s", 0, ever_on_off_info }, - - /* ever workmodes, messages & alarms */ - { "experimental.status.workmode", 0, 0, "UPS.EVER1.EVER97.EVER98", NULL, "%s", 0, ever_workmode }, - { "experimental.status.messages", 0, 0, "UPS.EVER1.EVER18.EVER28", NULL, NULL, 0, ever_messages }, - { "experimental.status.alarms", 0, 0, "UPS.EVER1.EVER32.EVER33", NULL, NULL, 0, ever_alarms }, - - /* instant commands */ - /* experimental: With the same fields here, are the commands different? - * Per NUT command names, should be: documented load.off stays off, like - * shutdown.stayoff, but shutdown.return may return if wall power comes back! - * In many drivers, similar command with "-1" instead of DEFAULT_OFFDELAY - * serves as a shutdown.stop (to abort a pending shutdown). - */ - { "load.off.delay", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - { "shutdown.return", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *ever_format_model(HIDDevice_t *hd) { - return hd->Product; -} - -static const char *ever_format_mfr(HIDDevice_t *hd) { - return hd->Vendor ? hd->Vendor : "Ever"; -} - -static const char *ever_format_serial(HIDDevice_t *hd) { - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -static int ever_claim(HIDDevice_t *hd) -{ - int status = is_usb_device_supported(ever_usb_device_table, hd); - - switch (status) - { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - return 1; - } - possibly_supported("Ever", hd); - return 0; - - case SUPPORTED: - return 1; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t ever_subdriver = { - EVER_HID_VERSION, - ever_claim, - ever_utab, - ever_hid2nut, - ever_format_model, - ever_format_mfr, - ever_format_serial, - fix_report_desc, -}; diff --git a/drivers/ever-hid.h b/drivers/ever-hid.h deleted file mode 100644 index bf47bc1..0000000 --- a/drivers/ever-hid.h +++ /dev/null @@ -1,32 +0,0 @@ -/* everhid-hid.h - subdriver to monitor Everhid USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2017 EVER Power Systems [https://ever.eu/] - * 2020 - 2022 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef EVER_HID_H -#define EVER_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t ever_subdriver; - -#endif /* EVER_HID_H */ diff --git a/drivers/everups.c b/drivers/everups.c index 63ccea8..7cd9328 100644 --- a/drivers/everups.c +++ b/drivers/everups.c @@ -1,4 +1,4 @@ -/* everups.c - support for Ever UPS models (serial) +/* everups.c - support for Ever UPS models Copyright (C) 2001 Bartek Szady @@ -20,8 +20,8 @@ #include "main.h" #include "serial.h" -#define DRIVER_NAME "Ever UPS driver (serial)" -#define DRIVER_VERSION "0.04" +#define DRIVER_NAME "Ever UPS driver" +#define DRIVER_VERSION "0.03" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -64,9 +64,9 @@ static int InitUpsType(void) static const char *GetTypeUpsName(void) { - switch(upstype) - { - case 67: return "NET 500-DPC"; + switch(upstype) + { + case 67: return "NET 500-DPC"; case 68: return "NET 700-DPC"; case 69: return "NET 1000-DPC"; case 70: return "NET 1400-DPC"; @@ -95,7 +95,7 @@ void upsdrv_updateinfo(void) unsigned long acuV; unsigned long lineV; double fVal; - + if (!Code(2)) { upslog_with_errno(LOG_INFO, "Code failed"); dstate_datastale(); @@ -106,7 +106,7 @@ void upsdrv_updateinfo(void) ser_get_char(upsfd, recBuf, 3, 0); if ((recBuf[0] & 1) !=0) standby=1; - else + else battery=(recBuf[0] &4) !=0; if (Code(1)) { /*Accumulator voltage value*/ ser_send_char(upsfd, 189); diff --git a/drivers/explore-hid.c b/drivers/explore-hid.c index f9e8690..40154e1 100644 --- a/drivers/explore-hid.c +++ b/drivers/explore-hid.c @@ -25,7 +25,7 @@ #include "usbhid-ups.h" #include "explore-hid.h" -#define EXPLORE_HID_VERSION "EXPLORE HID 0.2" +#define EXPLORE_HID_VERSION "EXPLORE HID 0.1" static usage_tables_t explore_utab[] = { hid_usage_lkp, @@ -57,13 +57,11 @@ static const char *explore_format_serial(HIDDevice_t *hd) { /* this function allows the subdriver to "claim" a device: return 1 if * the device is supported by this subdriver, else 0. */ static int explore_claim(HIDDevice_t *hd) { - NUT_UNUSED_VARIABLE(hd); - - if (testvar("explore")) { - return 1; - } else { - return 0; - } + if (testvar("explore")) { + return 1; + } else { + return 0; + } } subdriver_t explore_subdriver = { @@ -74,5 +72,4 @@ subdriver_t explore_subdriver = { explore_format_model, explore_format_mfr, explore_format_serial, - fix_report_desc, }; diff --git a/drivers/gamatronic.c b/drivers/gamatronic.c index b0be56d..acc56a3 100644 --- a/drivers/gamatronic.c +++ b/drivers/gamatronic.c @@ -2,9 +2,7 @@ * * SEC UPS Driver ported to the new NUT API for Gamatronic UPS Usage. * - * TODO: Replace lots of printf() by upslogx() or upsdebugx() below! - * - * Copyright (C) + * Copyright (C) * 2001 John Marley * 2002 Jules Taplin * 2002 Eric Lawson @@ -26,14 +24,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - + #include "main.h" -#include "serial.h" +#include "serial.h" #include "gamatronic.h" -#include "nut_stdint.h" #define DRIVER_NAME "Gamatronic UPS driver" -#define DRIVER_VERSION "0.03" +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -48,279 +45,274 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -#define ENDCHAR '\r' -#define IGNCHARS "" -#define SER_WAIT_SEC 1 /* allow 3.0 sec for ser_get calls */ +#define ENDCHAR '\r' +#define IGNCHARS "" +#define SER_WAIT_SEC 1 /* allow 3.0 sec for ser_get calls */ #define SER_WAIT_USEC 0 -static int sec_upsrecv (char *buf) +int sec_upsrecv (char *buf) { - char lenbuf[4]; - int ret; - ser_get_line(upsfd, buf, 140, ENDCHAR, IGNCHARS,SER_WAIT_SEC, SER_WAIT_USEC); - if (buf[0] == SEC_MSG_STARTCHAR) { - switch (buf[1]) { - case SEC_NAK: - return(-1); - case SEC_ACK: - return(0); - case SEC_DATAMSG: - strncpy(lenbuf, buf+2, 3); - lenbuf[3] = '\0'; - ret = atoi(lenbuf); - if (ret > 0) { - strcpy(buf,buf+5); - return(ret); - } - else return (-2); - default: - return(-2); + char lenbuf[4]; + int ret; + + + ser_get_line(upsfd, buf, 140, ENDCHAR, IGNCHARS,SER_WAIT_SEC, SER_WAIT_USEC); + if (buf[0] == SEC_MSG_STARTCHAR){ + switch (buf[1]){ + case SEC_NAK: + return(-1); + case SEC_ACK: + return(0); + case SEC_DATAMSG: + strncpy(lenbuf,buf+2,3); + ret = atoi(lenbuf); + if (ret > 0){ + strcpy(buf,buf+5); + return(ret);} + else return (-2); + default: + return(-2); } - } - else - return (-2); + } + else + { return (-2); } } -static ssize_t sec_cmd(const char mode, const char *command, char *msgbuf, ssize_t *buflen) +int sec_cmd(const char mode, const char *command, char *msgbuf, int *buflen) { - char msg[140]; - ssize_t ret; + char msg[140]; + int ret; - memset(msg, 0, sizeof(msg)); + memset(msg, 0, sizeof(msg)); - /* create the message string */ - if (*buflen > 0) { - snprintf(msg, sizeof(msg), "%c%c%03zd%s%s", SEC_MSG_STARTCHAR, - mode, (*buflen)+3, command, msgbuf); - } - else { - snprintf(msg, sizeof(msg), "%c%c003%s", SEC_MSG_STARTCHAR, - mode, command); - } - upsdebugx(1, "PC-->UPS: \"%s\"",msg); - ret = ser_send(upsfd, "%s", msg); + /* create the message string */ + if (*buflen > 0) { + snprintf(msg, sizeof(msg), "%c%c%03d%s%s", SEC_MSG_STARTCHAR, + mode, (*buflen)+3, command, msgbuf); + } + else { + snprintf(msg, sizeof(msg), "%c%c003%s", SEC_MSG_STARTCHAR, + mode, command); + } + upsdebugx(1, "PC-->UPS: \"%s\"",msg); + ret = ser_send(upsfd, "%s", msg); + + upsdebugx(1, " send returned: %d",ret); - upsdebugx(1, " send returned: %zd",ret); + if (ret == -1) return -1; - if (ret == -1) return -1; + ret = sec_upsrecv(msg); - ret = sec_upsrecv(msg); - if (ret < 0) return -1; + if (ret < 0) return -1; - strncpy(msgbuf, msg, (size_t)ret); + if (ret >= 0) { + strncpy(msgbuf, msg, ret); upsdebugx(1, "UPS<--PC: \"%s\"",msg); + } +/* *(msgbuf+ret) = '\0';*/ -/* - *(msgbuf+ret) = '\0'; -*/ - - *buflen = ret; - return ret; + *buflen = ret; + return ret; } -static void addquery(const char *cmd, int field, int varnum, int pollflag) +void addquery(const char *cmd, int field, int varnum, int pollflag) { - int q; + int q; - for (q=0; q 0) { + + if (strcmp(sec_varlist[sqv(q,f)].value, r) != 0 ) { - for (q=0; q 0) { - if (strcmp(sec_varlist[sqv(q,f)].value, r) != 0) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif - /* NOTE: We intentionally limit the amount - * of characters picked from "r" buffer - * into respectively sized "*.value" - */ - int len = snprintf(sec_varlist[sqv(q,f)].value, - sizeof(sec_varlist[sqv(q,f)].value), "%s", r); - - if (len < 0) { - upsdebugx(1, "%s: got an error while extracting value", __func__); - } - - if ((intmax_t)len > (intmax_t)sizeof(sec_varlist[sqv(q,f)].value) - || (intmax_t)strnlen(r, sizeof(retbuf)) > (intmax_t)sizeof(sec_varlist[sqv(q,f)].value) - ) { - upsdebugx(1, "%s: value was truncated", __func__); - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif - sec_setinfo(sqv(q,f), r); - } - - /* If SEC VAR is alarm and it's on, add it to the alarm property */ - if (sec_varlist[sqv(q,f)].flags & FLAG_ALARM && strcmp(r,"1")== 0) { - alarm_set(sec_varlist[sqv(q,f)].name); - } - } - - if (n == NULL) break; - r = n+1; + snprintf(sec_varlist[sqv(q,f)].value, + sizeof(sec_varlist[sqv(q,f)].value), "%s", r); + + sec_setinfo(sqv(q,f), r); } + + /* If SEC VAR is alarm and its on, add it to the alarm property */ + + if (sec_varlist[sqv(q,f)].flags & FLAG_ALARM && strcmp(r,"1")== 0) { + alarm_set(sec_varlist[sqv(q,f)].name); } + + } + + + if (n == NULL) break; + r = n+1; + } } -} + } void upsdrv_initinfo(void) { - ssize_t msglen; - int v; - char *a, *p, avail_list[300]; - - /* find out which variables/commands this UPS supports */ - msglen = 0; - sec_cmd(SEC_POLLCMD, SEC_AVAILP1, avail_list, &msglen); - p = avail_list + msglen; - if (p != avail_list) *p++ = ','; - msglen = 0; - sec_cmd(SEC_POLLCMD, SEC_AVAILP2, p, &msglen); - *(p+msglen) = '\0'; - - if (strlen(avail_list) == 0) { - fatalx(EXIT_FAILURE, "No available variables found!"); - } - a = avail_list; - while ((p = strtok(a, ",")) != NULL) { - a = NULL; - v = atoi(p); - /* don't bother adding a write-only variable */ - if (sec_varlist[v].flags == FLAG_WONLY) continue; - addquery(sec_varlist[v].cmd, sec_varlist[v].field, v, sec_varlist[v].poll); - } - - /* poll one time values */ - sec_poll(FLAG_POLLONCE); - - printf("UPS: %s %s\n", dstate_getinfo("ups.mfr"), dstate_getinfo("ups.model")); + int msglen, v; + char *a,*p,avail_list[300]; + + /* find out which variables/commands this UPS supports */ + msglen = 0; + sec_cmd(SEC_POLLCMD, SEC_AVAILP1, avail_list, &msglen); + p = avail_list + msglen; + if (p != avail_list) *p++ = ','; + msglen = 0; + sec_cmd(SEC_POLLCMD, SEC_AVAILP2, p, &msglen); + *(p+msglen) = '\0'; + + + if (strlen(avail_list) == 0){ + fatalx(EXIT_FAILURE, "No available variables found!");} + a = avail_list; + while ((p = strtok(a, ",")) != NULL) { + a = NULL; + v = atoi(p); + /* don't bother adding a write-only variable */ + if (sec_varlist[v].flags == FLAG_WONLY) continue; + addquery(sec_varlist[v].cmd, sec_varlist[v].field, v, sec_varlist[v].poll); + } + + /* poll one time values */ + + sec_poll(FLAG_POLLONCE); + + printf("UPS: %s %s\n", dstate_getinfo("ups.mfr"), dstate_getinfo("ups.model")); + + } void upsdrv_updateinfo(void) { + + alarm_init(); /* poll status values values */ sec_poll(FLAG_POLL); alarm_commit(); update_pseudovars(); dstate_dataok(); + } void upsdrv_shutdown(void) { - ssize_t msglen; + int msg_len; char msgbuf[SMALLBUF]; - msglen = snprintf(msgbuf, sizeof(msgbuf), "-1"); - sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msglen); + msg_len = snprintf(msgbuf, sizeof(msgbuf), "-1"); + sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msg_len); - msglen = snprintf(msgbuf, sizeof(msgbuf), "1"); - sec_cmd(SEC_SETCMD, SEC_AUTORESTART, msgbuf, &msglen); + msg_len = snprintf(msgbuf, sizeof(msgbuf), "1"); + sec_cmd(SEC_SETCMD, SEC_AUTORESTART, msgbuf, &msg_len); - msglen = snprintf(msgbuf, sizeof(msgbuf), "2"); - sec_cmd(SEC_SETCMD, SEC_SHUTTYPE,msgbuf, &msglen); + msg_len = snprintf(msgbuf, sizeof(msgbuf), "2"); + sec_cmd(SEC_SETCMD, SEC_SHUTTYPE,msgbuf, &msg_len); - msglen = snprintf(msgbuf, sizeof(msgbuf), "5"); - sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msglen); + msg_len = snprintf(msgbuf, sizeof(msgbuf), "5"); + sec_cmd(SEC_SETCMD, SEC_SHUTDOWN, msgbuf, &msg_len); } /* -int instcmd(const char *cmdname, const char *extra) +static int instcmd(const char *cmdname, const char *extra) { if (!strcasecmp(cmdname, "test.battery.stop")) { ser_send_buf(upsfd, ...); @@ -346,39 +338,40 @@ void upsdrv_makevartable(void) /* addvar(VAR_VALUE, "foo", "Override foo setting"); */ } -static void setup_serial(const char *port) +void setup_serial(const char *port) { - char temp[140]; - int i; - ssize_t ret; + char temp[140]; + int i,ret; + - /* Detect the ups baudrate */ - for (i=0; i<5; i++) { - ser_set_speed(upsfd, device_path, baud_rates[i].rate); - ret = ser_send(upsfd, "^P003MAN"); - ret = sec_upsrecv(temp); - if (ret >= -1) break; - } + /* Detect the ups baudrate */ + + + for (i=0; i<5; i++) { + + ser_set_speed(upsfd, device_path,baud_rates[i].rate); + ret = ser_send(upsfd, "^P003MAN"); + ret = sec_upsrecv(temp); + if (ret >= -1) break; - if (i == 5) { - printf("Can't talk to UPS on port %s!\n",port); - printf("Check the cabling and portname and try again\n"); - printf("Please note that this driver only support UPS Models with SEC Protocol\n"); - ser_close(upsfd, device_path); - exit (1); - } - else - printf("Connected to UPS on %s baudrate: %zu\n", - port, baud_rates[i].name); + } + if (i == 5) { + printf("Can't talk to UPS on port %s!\n",port); + printf("Check the cabling and portname and try again\n"); + printf("Please note that this driver only support UPS Models with SEC Protorol\n"); + ser_close(upsfd, device_path); + exit (1); + } +printf("Connected to UPS on %s baudrate: %d\n",port, baud_rates[i].name); } void upsdrv_initups(void) { - upsfd = ser_open(device_path); - setup_serial(device_path); + upsfd = ser_open(device_path); + setup_serial(device_path); /* upsfd = ser_open(device_path); */ /* ser_set_speed(upsfd, device_path, B1200); */ - + /* probe ups type */ /* to get variables and flags from the command line, use this: @@ -406,10 +399,12 @@ void upsdrv_initups(void) /* the upsh handlers can't be done here, as they get initialized * shortly after upsdrv_initups returns to main. */ + + } void upsdrv_cleanup(void) { /* free(dynamic_mem); */ - ser_close(upsfd, device_path); + ser_close(upsfd, device_path); } diff --git a/drivers/gamatronic.h b/drivers/gamatronic.h index 7760284..85c3290 100644 --- a/drivers/gamatronic.h +++ b/drivers/gamatronic.h @@ -2,13 +2,13 @@ * * SEC UPS Driver ported to the new NUT API for Gamatronic UPS Usage. * - * Copyright (C) + * Copyright (C) * 2001 John Marley * 2002 Jules Taplin * 2002 Eric Lawson * 2005 Arnaud Quette * 2005 Nadav Moskovitch - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or @@ -24,10 +24,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ - -#ifndef NUT_GAMATRONIC_H_SEEN -#define NUT_GAMATRONIC_H_SEEN 1 - + #define SEC_MSG_STARTCHAR '^' #define SEC_POLLCMD 'P' #define SEC_SETCMD 'S' @@ -66,11 +63,10 @@ #define FLAG_POLL 0 /* For commands that polled normaly */ #define FLAG_POLLONCE 1 /* For commands that only polled once */ - /* Some baud rates for setup_serial() */ -static struct { - speed_t rate; /* Value like B19200 defined in termios.h; note: NOT the bitrate numerically */ - size_t name; /* Actual rate... WHY is this "name" - number to print interactively? */ +struct { + int rate; + int name; } baud_rates[] = { { B1200, 1200 }, { B2400, 2400 }, @@ -84,7 +80,7 @@ static struct { /* macro for checking whether a variable is supported */ -typedef struct { +struct { const char *setcmd; /* INFO_x define from shared.h */ const char *name; /* Human readable text (also in shared-tables.h) */ int unit; /* Variable should be divided by this */ @@ -94,110 +90,108 @@ typedef struct { int poll; /* poll flag */ int flags; /* Flags for addinfo() */ char value[SEC_MAX_VARSIZE]; -} sec_varlist_t; - -static sec_varlist_t sec_varlist[] = { - { "", "", 0, "", 0, 0, 0, 0, "" }, - /*setcmd name unit cmd field size poll flags value */ - { "", "Awaiting Power ", 1, SEC_ALARMSTAT, 13, 2, 0, FLAG_ALARM, ""}, - { "", "Bypass Bad ", 1, SEC_ALARMSTAT, 5, 2, 0, FLAG_ALARM, ""}, - { "", "Charger Failure ", 1, SEC_ALARMSTAT, 8, 2, 0, FLAG_ALARM, ""}, - { "", "Fan Failure ", 1, SEC_ALARMSTAT, 10, 2, 0, FLAG_ALARM, ""}, - { "", "Fuse Failure ", 1, SEC_ALARMSTAT, 11, 2, 0, FLAG_ALARM, ""}, - { "", "General Fault ", 1, SEC_ALARMSTAT, 12, 2, 0, FLAG_ALARM, ""}, - { "", "Input Bad ", 1, SEC_ALARMSTAT, 2, 2, 0, FLAG_ALARM, ""}, - { "", "Output Bad ", 1, SEC_ALARMSTAT, 3, 2, 0, FLAG_ALARM, ""}, - { "", "Output Off ", 1, SEC_ALARMSTAT, 6, 2, 0, FLAG_ALARM, ""}, - { "", "Overload ", 1, SEC_ALARMSTAT, 4, 2, 0, FLAG_ALARM, ""}, - { "", "Shutdown Imminent ", 1, SEC_ALARMSTAT, 15, 2, 0, FLAG_ALARM, ""}, - { "", "Shutdown Pending ", 1, SEC_ALARMSTAT, 14, 2, 0, FLAG_ALARM, ""}, - { "", "System Off ", 1, SEC_ALARMSTAT, 9, 2, 0, FLAG_ALARM, ""}, - { "", "Temperature ", 1, SEC_ALARMSTAT, 1, 2, 0, FLAG_ALARM, ""}, - { "", "UPS Shutdown ", 1, SEC_ALARMSTAT, 7, 2, 0, FLAG_ALARM, ""}, - { "", "Audible Alarm", 1, SEC_NOMINAL, 8, 4, FLAG_POLLONCE, FLAG_RW, ""}, - { "", "Auto Restart", 1, SEC_AUTORESTART, 1, 2, FLAG_POLLONCE, FLAG_RW, ""}, - { "", "Battery Charge", 1, SEC_BATTSTAT, 3, 4, 0, 0, ""}, - { "", "Battery Condition", 1, SEC_BATTSTAT, 1, 3, 0, 0, ""}, - { "battery.current", "Battery Current", 10, SEC_BATTSTAT, 8, 9999, 0, 0, ""}, - { "battery.date", "Battery Installed", 1, SEC_NOMINAL, 11, 8, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Battery Status", 1, SEC_BATTSTAT, 2, 3, 0, 0, ""}, - { "battery.temperature", "Battery Temperature", 1, SEC_BATTSTAT, 9, 99, 0, 0, ""}, - { "battery.voltage", "Battery Voltage", 10, SEC_BATTSTAT, 7, 9999, 0, 0, ""}, - { "", "Bypass Current 1", 10, SEC_BYPASSSTAT, 4, 9999, 0, 0, ""}, - { "", "Bypass Current 2", 10, SEC_BYPASSSTAT, 7, 9999, 0, 0, ""}, - { "", "Bypass Current 3", 10, SEC_BYPASSSTAT, 10, 9999, 0, 0, ""}, - { "", "Bypass Frequency", 10, SEC_BYPASSSTAT, 1, 999, 0, 0, ""}, - { "", "Bypass Num Lines", 1, SEC_BYPASSSTAT, 2, 9, 0, 0, ""}, - { "", "Bypass Power 1", 1, SEC_BYPASSSTAT, 5, 99999, 0, 0, ""}, - { "", "Bypass Power 2", 1, SEC_BYPASSSTAT, 8, 99999, 0, 0, ""}, - { "", "Bypass Power 3", 1, SEC_BYPASSSTAT, 11, 99999, 0, 0, ""}, - { "", "Bypass Voltage 1", 10, SEC_BYPASSSTAT, 3, 9999, 0, 0, ""}, - { "", "Bypass Voltage 2", 10, SEC_BYPASSSTAT, 6, 9999, 0, 0, ""}, - { "", "Bypass Voltage 3", 10, SEC_BYPASSSTAT, 9, 9999, 0, 0, ""}, - { "battery.charge", "Estimated Charge", 1, SEC_BATTSTAT, 6, 999, 0, 0, ""}, - { "battery.runtime.low", "Estimated Minutes", 60, SEC_BATTSTAT, 5, 999, 0, FLAG_MULTI, ""}, - { "input.transfer.high", "High Volt Xfer Pt", 1, SEC_NOMINAL, 10, 999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "ups.id", "Identification", 1, SEC_UPSID, 1, 64, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Input Current 1", 10, SEC_INPUTSTAT, 5, 9999, 0, 0, ""}, - { "", "Input Current 2", 10, SEC_INPUTSTAT, 9, 9999, 0, 0, ""}, - { "", "Input Current 3", 10, SEC_INPUTSTAT, 13, 9999, 0, 0, ""}, - { "input.frequency", "Input Frequency 1", 10, SEC_INPUTSTAT, 3, 999, 0, 0, ""}, - { "", "Input Frequency 2", 10, SEC_INPUTSTAT, 7, 999, 0, 0, ""}, - { "", "Input Frequency 3", 10, SEC_INPUTSTAT, 11, 999, 0, 0, ""}, - { "", "Input Line Bads", 1, SEC_INPUTSTAT, 1, 999, 0, 0, ""}, - { "", "Input Num Lines", 1, SEC_INPUTSTAT, 2, 9, 0, 0, ""}, - { "", "Input Power 1", 1, SEC_INPUTSTAT, 6, 99999, 0, 0, ""}, - { "", "Input Power 2", 1, SEC_INPUTSTAT, 10, 99999, 0, 0, ""}, - { "", "Input Power 3", 1, SEC_INPUTSTAT, 14, 99999, 0, 0, ""}, - { "input.voltage", "Input Voltage 1", 10, SEC_INPUTSTAT, 4, 9999, 0, 0, ""}, - { "", "Input Voltage 2", 10, SEC_INPUTSTAT, 8, 9999, 0, 0, ""}, - { "", "Input Voltage 3", 10, SEC_INPUTSTAT, 12, 9999, 0, 0, ""}, - { "input.transfer.low", "Low Volt Xfer Pt", 1, SEC_NOMINAL, 9, 999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "ups.mfr", "Manufacturer", 1, SEC_MFR, 1, 32, FLAG_POLLONCE, FLAG_STRING, ""}, - { "ups.model", "Model", 1, SEC_MOD, 1, 64, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Nominal Battery Life", 1, SEC_NOMINAL, 12, 99999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Nominal Input Frequency", 10, SEC_NOMINAL, 2, 999, FLAG_POLLONCE, FLAG_RW, ""}, - { "input.voltage.nominal", "Nominal Input Voltage", 1, SEC_NOMINAL, 1, 999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Nominal Low Battery Time", 1, SEC_NOMINAL, 7, 99, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Nominal Output Frequency", 10, SEC_NOMINAL, 4, 999, FLAG_POLLONCE, FLAG_RW, ""}, - { "", "Nominal Output Power", 1, SEC_NOMINAL, 6, 99999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Nominal Output Voltage", 1, SEC_NOMINAL, 3, 999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "ups.power.nominal", "Nominal VA Rating", 1, SEC_NOMINAL, 5, 99999, FLAG_POLLONCE, FLAG_STRING, ""}, - { "output.current", "Output Current 1", 10, SEC_OUTPUTSTAT, 5, 9999, 0, 0, ""}, - { "", "Output Current 2", 10, SEC_OUTPUTSTAT, 9, 9999, 0, 0, ""}, - { "", "Output Current 3", 10, SEC_OUTPUTSTAT, 13, 9999, 0, 0, ""}, - { "output.frequency", "Output Frequency", 10, SEC_OUTPUTSTAT, 2, 999, 0, 0, ""}, - { "ups.load", "Output Load 1", 1, SEC_OUTPUTSTAT, 7, 999, 0, 0, ""}, - { "", "Output Load 2", 1, SEC_OUTPUTSTAT, 11, 999, 0, 0, ""}, - { "", "Output Load 3", 1, SEC_OUTPUTSTAT, 15, 999, 0, 0, ""}, - { "", "Output Num Lines", 1, SEC_OUTPUTSTAT, 3, 9, 0, 0, ""}, - { "", "Output Power 1", 1, SEC_OUTPUTSTAT, 6, 99999, 0, 0, ""}, - { "", "Output Power 2", 1, SEC_OUTPUTSTAT, 10, 99999, 0, 0, ""}, - { "", "Output Power 3", 1, SEC_OUTPUTSTAT, 14, 99999, 0, 0, ""}, - { "", "Output Source", 1, SEC_OUTPUTSTAT, 1, 6, 0, 0, ""}, - { "output.voltage", "Output Voltage 1", 10, SEC_OUTPUTSTAT, 4, 9999, 0, 0, ""}, - { "", "Output Voltage 2", 10, SEC_OUTPUTSTAT, 8, 9999, 0, 0, ""}, - { "", "Output Voltage 3", 10, SEC_OUTPUTSTAT, 12, 9999, 0, 0, ""}, - { "", "Reboot With Duration", 1, SEC_REBOOT, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY, ""}, - { "battery.runtime", "Seconds on Battery", 1, SEC_BATTSTAT, 4, 99999, 0, 0, ""}, - { "", "Shutdown Type", 1, SEC_SHUTTYPE, 1, 2, FLAG_POLLONCE, FLAG_RW, ""}, - { "ups.delay.shutdown", "Shutdown After Delay", 1, SEC_STARTDELAY, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY, ""}, - { "ups.firmware", "Software Version", 1, SEC_VERSION, 1, 32, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Startup After Delay", 1, SEC_STARTDELAY, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY, ""}, - { "", "Test Results Detail", 1, SEC_TESTRESULT, 2, 64, FLAG_POLLONCE, FLAG_STRING, ""}, - { "", "Test Results Summary", 1, SEC_TESTRESULT, 1, 6, FLAG_POLLONCE, 0, ""}, - { "", "Test Type", 1, SEC_TEST, 1, 5, FLAG_POLLONCE, FLAG_WONLY, ""}, - { "", "Baud Rate", 1, SEC_BAUDRATE, 1, 19200, FLAG_POLLONCE, FLAG_RW, ""}, +} sec_varlist[] = { + { "", "", 0, "", 0, 0, 0, 0 }, + /*setcmd name unit cmd field size poll flags */ + { "", "Awaiting Power ", 1, SEC_ALARMSTAT, 13, 2, 0, FLAG_ALARM}, + { "", "Bypass Bad ", 1, SEC_ALARMSTAT, 5, 2, 0, FLAG_ALARM}, + { "", "Charger Failure ", 1, SEC_ALARMSTAT, 8, 2, 0, FLAG_ALARM}, + { "", "Fan Failure ", 1, SEC_ALARMSTAT, 10, 2, 0, FLAG_ALARM}, + { "", "Fuse Failure ", 1, SEC_ALARMSTAT, 11, 2, 0, FLAG_ALARM}, + { "", "General Fault ", 1, SEC_ALARMSTAT, 12, 2, 0, FLAG_ALARM}, + { "", "Input Bad ", 1, SEC_ALARMSTAT, 2, 2, 0, FLAG_ALARM}, + { "", "Output Bad ", 1, SEC_ALARMSTAT, 3, 2, 0, FLAG_ALARM}, + { "", "Output Off ", 1, SEC_ALARMSTAT, 6, 2, 0, FLAG_ALARM}, + { "", "Overload ", 1, SEC_ALARMSTAT, 4, 2, 0, FLAG_ALARM}, + { "", "Shutdown Imminent ", 1, SEC_ALARMSTAT, 15, 2, 0, FLAG_ALARM}, + { "", "Shutdown Pending ", 1, SEC_ALARMSTAT, 14, 2, 0, FLAG_ALARM}, + { "", "System Off ", 1, SEC_ALARMSTAT, 9, 2, 0, FLAG_ALARM}, + { "", "Temperature ", 1, SEC_ALARMSTAT, 1, 2, 0, FLAG_ALARM}, + { "", "UPS Shutdown ", 1, SEC_ALARMSTAT, 7, 2, 0, FLAG_ALARM}, + { "", "Audible Alarm", 1, SEC_NOMINAL, 8, 4, FLAG_POLLONCE, FLAG_RW}, + { "", "Auto Restart", 1, SEC_AUTORESTART, 1, 2, FLAG_POLLONCE, FLAG_RW}, + { "", "Battery Charge", 1, SEC_BATTSTAT, 3, 4, 0, 0}, + { "", "Battery Condition", 1, SEC_BATTSTAT, 1, 3, 0, 0}, + { "battery.current", "Battery Current", 10, SEC_BATTSTAT, 8, 9999, 0, 0 }, + { "battery.date", "Battery Installed", 1, SEC_NOMINAL, 11, 8, FLAG_POLLONCE, FLAG_STRING}, + { "", "Battery Status", 1, SEC_BATTSTAT, 2, 3, 0, 0 }, + { "battery.temperature", "Battery Temperature", 1, SEC_BATTSTAT, 9, 99, 0, 0 }, + { "battery.voltage", "Battery Voltage", 10, SEC_BATTSTAT, 7, 9999, 0, 0 }, + { "", "Bypass Current 1", 10, SEC_BYPASSSTAT, 4, 9999, 0, 0 }, + { "", "Bypass Current 2", 10, SEC_BYPASSSTAT, 7, 9999, 0, 0 }, + { "", "Bypass Current 3", 10, SEC_BYPASSSTAT, 10, 9999, 0, 0 }, + { "", "Bypass Frequency", 10, SEC_BYPASSSTAT, 1, 999, 0, 0 }, + { "", "Bypass Num Lines", 1, SEC_BYPASSSTAT, 2, 9, 0, 0 }, + { "", "Bypass Power 1", 1, SEC_BYPASSSTAT, 5, 99999, 0, 0 }, + { "", "Bypass Power 2", 1, SEC_BYPASSSTAT, 8, 99999, 0, 0 }, + { "", "Bypass Power 3", 1, SEC_BYPASSSTAT, 11, 99999, 0, 0 }, + { "", "Bypass Voltage 1", 10, SEC_BYPASSSTAT, 3, 9999, 0, 0 }, + { "", "Bypass Voltage 2", 10, SEC_BYPASSSTAT, 6, 9999, 0, 0 }, + { "", "Bypass Voltage 3", 10, SEC_BYPASSSTAT, 9, 9999, 0, 0 }, + { "battery.charge", "Estimated Charge", 1, SEC_BATTSTAT, 6, 999, 0, 0 }, + { "battery.runtime.low", "Estimated Minutes", 60, SEC_BATTSTAT, 5, 999, 0, FLAG_MULTI }, + { "input.transfer.high", "High Volt Xfer Pt", 1, SEC_NOMINAL, 10, 999, FLAG_POLLONCE, FLAG_STRING}, + { "ups.id", "Identification", 1, SEC_UPSID, 1, 64, FLAG_POLLONCE, FLAG_STRING}, + { "", "Input Current 1", 10, SEC_INPUTSTAT, 5, 9999, 0, 0 }, + { "", "Input Current 2", 10, SEC_INPUTSTAT, 9, 9999, 0, 0 }, + { "", "Input Current 3", 10, SEC_INPUTSTAT, 13, 9999, 0, 0 }, + { "input.frequency", "Input Frequency 1", 10, SEC_INPUTSTAT, 3, 999, 0, 0 }, + { "", "Input Frequency 2", 10, SEC_INPUTSTAT, 7, 999, 0, 0 }, + { "", "Input Frequency 3", 10, SEC_INPUTSTAT, 11, 999, 0, 0 }, + { "", "Input Line Bads", 1, SEC_INPUTSTAT, 1, 999, 0, 0 }, + { "", "Input Num Lines", 1, SEC_INPUTSTAT, 2, 9, 0, 0 }, + { "", "Input Power 1", 1, SEC_INPUTSTAT, 6, 99999, 0, 0 }, + { "", "Input Power 2", 1, SEC_INPUTSTAT, 10, 99999, 0, 0 }, + { "", "Input Power 3", 1, SEC_INPUTSTAT, 14, 99999, 0, 0 }, + { "input.voltage", "Input Voltage 1", 10, SEC_INPUTSTAT, 4, 9999, 0, 0 }, + { "", "Input Voltage 2", 10, SEC_INPUTSTAT, 8, 9999, 0, 0 }, + { "", "Input Voltage 3", 10, SEC_INPUTSTAT, 12, 9999, 0, 0 }, + { "input.transfer.low", "Low Volt Xfer Pt", 1, SEC_NOMINAL, 9, 999, FLAG_POLLONCE, FLAG_STRING}, + { "ups.mfr", "Manufacturer", 1, SEC_MFR, 1, 32, FLAG_POLLONCE, FLAG_STRING}, + { "ups.model", "Model", 1, SEC_MOD, 1, 64, FLAG_POLLONCE, FLAG_STRING}, + { "", "Nominal Battery Life", 1, SEC_NOMINAL, 12, 99999, FLAG_POLLONCE, FLAG_STRING}, + { "", "Nominal Input Frequency", 10, SEC_NOMINAL, 2, 999, FLAG_POLLONCE, FLAG_RW}, + { "input.voltage.nominal", "Nominal Input Voltage", 1, SEC_NOMINAL, 1, 999, FLAG_POLLONCE, FLAG_STRING}, + { "", "Nominal Low Battery Time", 1, SEC_NOMINAL, 7, 99, FLAG_POLLONCE, FLAG_STRING}, + { "", "Nominal Output Frequency", 10, SEC_NOMINAL, 4, 999, FLAG_POLLONCE, FLAG_RW}, + { "", "Nominal Output Power", 1, SEC_NOMINAL, 6, 99999, FLAG_POLLONCE, FLAG_STRING}, + { "", "Nominal Output Voltage", 1, SEC_NOMINAL, 3, 999, FLAG_POLLONCE, FLAG_STRING}, + { "ups.power.nominal", "Nominal VA Rating", 1, SEC_NOMINAL, 5, 99999, FLAG_POLLONCE, FLAG_STRING}, + { "output.current", "Output Current 1", 10, SEC_OUTPUTSTAT, 5, 9999, 0, 0 }, + { "", "Output Current 2", 10, SEC_OUTPUTSTAT, 9, 9999, 0, 0 }, + { "", "Output Current 3", 10, SEC_OUTPUTSTAT, 13, 9999, 0, 0 }, + { "output.frequency", "Output Frequency", 10, SEC_OUTPUTSTAT, 2, 999, 0, 0 }, + { "ups.load", "Output Load 1", 1, SEC_OUTPUTSTAT, 7, 999, 0, 0 }, + { "", "Output Load 2", 1, SEC_OUTPUTSTAT, 11, 999, 0, 0 }, + { "", "Output Load 3", 1, SEC_OUTPUTSTAT, 15, 999, 0, 0 }, + { "", "Output Num Lines", 1, SEC_OUTPUTSTAT, 3, 9, 0, 0 }, + { "", "Output Power 1", 1, SEC_OUTPUTSTAT, 6, 99999, 0, 0 }, + { "", "Output Power 2", 1, SEC_OUTPUTSTAT, 10, 99999, 0, 0 }, + { "", "Output Power 3", 1, SEC_OUTPUTSTAT, 14, 99999, 0, 0 }, + { "", "Output Source", 1, SEC_OUTPUTSTAT, 1, 6, 0, 0}, + { "output.voltage", "Output Voltage 1", 10, SEC_OUTPUTSTAT, 4, 9999, 0, 0 }, + { "", "Output Voltage 2", 10, SEC_OUTPUTSTAT, 8, 9999, 0, 0 }, + { "", "Output Voltage 3", 10, SEC_OUTPUTSTAT, 12, 9999, 0, 0 }, + { "", "Reboot With Duration", 1, SEC_REBOOT, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY}, + { "battery.runtime", "Seconds on Battery", 1, SEC_BATTSTAT, 4, 99999, 0, 0 }, + { "", "Shutdown Type", 1, SEC_SHUTTYPE, 1, 2, FLAG_POLLONCE, FLAG_RW}, + { "ups.delay.shutdown", "Shutdown After Delay", 1, SEC_STARTDELAY, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY}, + { "ups.firmware", "Software Version", 1, SEC_VERSION, 1, 32, FLAG_POLLONCE, FLAG_STRING}, + { "", "Startup After Delay", 1, SEC_STARTDELAY, 1, 9999999, FLAG_POLLONCE, FLAG_WONLY}, + { "", "Test Results Detail", 1, SEC_TESTRESULT, 2, 64, FLAG_POLLONCE, FLAG_STRING}, + { "", "Test Results Summary", 1, SEC_TESTRESULT, 1, 6, FLAG_POLLONCE, 0}, + { "", "Test Type", 1, SEC_TEST, 1, 5, FLAG_POLLONCE, FLAG_WONLY}, + { "", "Baud Rate", 1, SEC_BAUDRATE, 1, 19200, FLAG_POLLONCE, FLAG_RW}, }; /* a type for the supported variables */ #define SEC_QUERYLIST_LEN 17 #define SEC_MAXFIELDS 16 -#define SEC_POLL 1 -#define SEC_POLLONCE 0 +#define SEC_POLL 1 +#define SEC_POLLONCE 0 -static struct { +struct { const char *command; /* sec command */ int varnum[SEC_MAXFIELDS]; /* sec variable number for each field */ int pollflag; @@ -205,4 +199,3 @@ static struct { #define sqv(a,b) sec_querylist[a].varnum[b] -#endif /* NUT_GAMATRONIC_H_SEEN */ diff --git a/drivers/generic_modbus.c b/drivers/generic_modbus.c deleted file mode 100644 index 478e838..0000000 --- a/drivers/generic_modbus.c +++ /dev/null @@ -1,1099 +0,0 @@ -/* generic_modbus.c - Driver for generic UPS connected via modbus RIO - * - * Copyright (C) - * 2021 Dimitris Economou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "generic_modbus.h" -#include -#include - -#define DRIVER_NAME "NUT Generic Modbus driver" -#define DRIVER_VERSION "0.03" - -/* variables */ -static modbus_t *mbctx = NULL; /* modbus memory context */ -static sigattr_t sigar[NUMOF_SIG_STATES]; /* array of ups signal attributes */ -static int errcnt = 0; /* modbus access error counter */ - -static char *device_mfr = DEVICE_MFR; /* device manufacturer */ -static char *device_model = DEVICE_MODEL; /* device model */ -static int ser_baud_rate = BAUD_RATE; /* serial port baud rate */ -static char ser_parity = PARITY; /* serial port parity */ -static int ser_data_bit = DATA_BIT; /* serial port data bit */ -static int ser_stop_bit = STOP_BIT; /* serial port stop bit */ -static int rio_slave_id = MODBUS_SLAVE_ID; /* set device ID to default value */ -static int FSD_pulse_duration = SHTDOWN_PULSE_DURATION; /* set the FSD pulse duration */ -static uint32_t mod_resp_to_s = MODRESP_TIMEOUT_s; /* set the modbus response time out (s) */ -static uint32_t mod_resp_to_us = MODRESP_TIMEOUT_us; /* set the modbus response time out (us) */ -static uint32_t mod_byte_to_s = MODBYTE_TIMEOUT_s; /* set the modbus byte time out (us) */ -static uint32_t mod_byte_to_us = MODBYTE_TIMEOUT_us; /* set the modbus byte time out (us) */ - - -/* get config vars set by -x or defined in ups.conf driver section */ -void get_config_vars(void); - -/* create a new modbus context based on connection type (serial or TCP) */ -modbus_t *modbus_new(const char *port); - -/* reconnect upon communication error */ -void modbus_reconnect(void); - -/* modbus register read function */ -int register_read(modbus_t *mb, int addr, regtype_t type, void *data); - -/* instant command triggered by upsd */ -int upscmd(const char *cmd, const char *arg); - -/* read signal status */ -int get_signal_state(devstate_t state); - -/* count the time elapsed since start */ -long time_elapsed(struct timeval *start); - -int register_write(modbus_t *mb, int addr, regtype_t type, void *data); - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Dimitris Economou \n", - DRV_BETA, - {NULL} -}; - -/* - * driver functions - */ - -/* initialize ups driver information */ -void upsdrv_initinfo(void) { - upsdebugx(2, "upsdrv_initinfo"); - - /* set device information */ - dstate_setinfo("device.mfr", "%s", device_mfr); - dstate_setinfo("device.model", "%s", device_model); - - /* register instant commands */ - if (sigar[FSD_T].addr != NOTUSED) { - dstate_addcmd("load.off"); - } - - /* set callback for instant commands */ - upsh.instcmd = upscmd; -} - -/* open serial connection and connect to modbus RIO */ -void upsdrv_initups(void) -{ - int rval; - upsdebugx(2, "upsdrv_initups"); - - get_config_vars(); - - /* open communication port */ - mbctx = modbus_new(device_path); - if (mbctx == NULL) { - fatalx(EXIT_FAILURE, "modbus_new_rtu: Unable to open communication port context"); - } - - /* set slave ID */ - rval = modbus_set_slave(mbctx, rio_slave_id); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_slave: Invalid modbus slave ID %d", rio_slave_id); - } - - /* connect to modbus device */ - if (modbus_connect(mbctx) == -1) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: error(%s)", modbus_strerror(errno)); - } - - /* set modbus response timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_response_timeout(mbctx, mod_resp_to_s, mod_resp_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_response_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { - /* Older libmodbus API (with timeval), and we have - * checked at configure time that we can put uint32_t - * into its fields. They are probably "long" on many - * systems as respectively time_t and suseconds_t - - * but that is not guaranteed; for more details see - * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_time.h.html - */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_resp_to_s; - to.tv_usec = mod_resp_to_us; - /* void */ modbus_set_response_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#else -# error "Can not use libmodbus API for timeouts" -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ - - /* set modbus byte time out */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_byte_timeout(mbctx, mod_byte_to_s, mod_byte_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_byte_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_byte_to_s; - to.tv_usec = mod_byte_to_us; - /* void */ modbus_set_byte_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ -} - -/* update UPS signal state */ -void upsdrv_updateinfo(void) -{ - int rval; - int online = -1; /* keep online state */ - errcnt = 0; - - upsdebugx(2, "upsdrv_updateinfo"); - status_init(); /* initialize ups.status update */ - alarm_init(); /* initialize ups.alarm update */ - - /* - * update UPS status regarding MAINS state either via OL | OB. - * if both statuses are mapped to contacts then only OL is evaluated. - */ - if (sigar[OL_T].addr != NOTUSED) { - rval = get_signal_state(OL_T); - upsdebugx(2, "OL value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[OL_T].noro)) { - status_set("OL"); - online = 1; - } else { - status_set("OB"); - online = 0; - - /* if DISCHRG state is not mapped to a contact and UPS is on - * batteries set status to DISCHRG state */ - if (sigar[DISCHRG_T].addr == NOTUSED) { - status_set("DISCHRG"); - dstate_setinfo("battery.charger.status", "discharging"); - } - - } - } else if (sigar[OB_T].addr != NOTUSED) { - rval = get_signal_state(OB_T); - upsdebugx(2, "OB value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[OB_T].noro)) { - status_set("OB"); - online = 0; - if (sigar[DISCHRG_T].addr == NOTUSED) { - status_set("DISCHRG"); - dstate_setinfo("battery.charger.status", "discharging"); - } - } else { - status_set("OL"); - online = 1; - } - } - - /* - * update UPS status regarding CHARGING state via HB. HB is usually - * mapped to "ready" contact when closed indicates a charging state > 85% - */ - if (sigar[HB_T].addr != NOTUSED) { - rval = get_signal_state(HB_T); - upsdebugx(2, "HB value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[HB_T].noro)) { - status_set("HB"); - dstate_setinfo("battery.charger.status", "resting"); - } else if (online == 1 && sigar[CHRG_T].addr == NOTUSED && errcnt == 0) { - status_set("CHRG"); - dstate_setinfo("battery.charger.status", "charging"); - } else if (online == 0 && sigar[DISCHRG_T].addr == NOTUSED && errcnt == 0) { - status_set("DISCHRG"); - dstate_setinfo("battery.charger.status", "discharging"); - } - } - - /* - * update UPS status regarding DISCHARGING state via LB. LB is mapped - * to "battery low" contact. - */ - if (sigar[LB_T].addr != NOTUSED) { - rval = get_signal_state(LB_T); - upsdebugx(2, "LB value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[LB_T].noro)) { - status_set("LB"); - alarm_set("Low Battery (Charge)"); - } - } - - /* - * update UPS status regarding battery HEALTH state via RB. RB is mapped - * to "replace battery" contact - */ - if (sigar[RB_T].addr != NOTUSED) { - rval = get_signal_state(RB_T); - upsdebugx(2, "RB value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[RB_T].noro)) { - status_set("RB"); - alarm_set("Replace Battery"); - } - } - - /* - * update UPS status regarding battery HEALTH state via RB. RB is mapped - * to "replace battery" contact - */ - if (sigar[CHRG_T].addr != NOTUSED) { - rval = get_signal_state(CHRG_T); - upsdebugx(2, "CHRG value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[CHRG_T].noro)) { - status_set("CHRG"); - dstate_setinfo("battery.charger.status", "charging"); - } - } else if (sigar[DISCHRG_T].addr != NOTUSED) { - rval = get_signal_state(DISCHRG_T); - upsdebugx(2, "DISCHRG value: %d", rval); - if (rval == -1) { - errcnt++; - } else if (rval == (1 ^ sigar[DISCHRG_T].noro)) { - status_set("DISCHRG"); - dstate_setinfo("battery.charger.status", "discharging"); - } - } - - /* check for communication errors */ - if (errcnt == 0) { - alarm_commit(); - status_commit(); - dstate_dataok(); - } else { - upsdebugx(2,"Communication errors: %d", errcnt); - dstate_datastale(); - } -} - -/* shutdown UPS */ -void upsdrv_shutdown(void) -{ - int rval; - int cnt = FSD_REPEAT_CNT; /* shutdown repeat counter */ - struct timeval start; - long etime; - - /* retry sending shutdown command on error */ - while ((rval = upscmd("load.off", NULL)) != STAT_INSTCMD_HANDLED && cnt > 0) { - rval = gettimeofday(&start, NULL); - if (rval < 0) { - upslogx(LOG_ERR, "upscmd: gettimeofday: %s", strerror(errno)); - } - - /* wait for an increasing time interval before sending shutdown command */ - while ((etime = time_elapsed(&start)) < ( FSD_REPEAT_INTRV / cnt)); - upsdebugx(2,"ERROR: load.off failed, wait for %lims, retries left: %d\n", etime, cnt - 1); - cnt--; - } - switch (rval) { - case STAT_INSTCMD_FAILED: - case STAT_INSTCMD_INVALID: - fatalx(EXIT_FAILURE, "shutdown failed"); - case STAT_INSTCMD_UNKNOWN: - fatalx(EXIT_FAILURE, "shutdown not supported"); - default: - break; - } - upslogx(LOG_INFO, "shutdown command executed"); -} - -/* print driver usage info */ -void upsdrv_help(void) -{ -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "device_mfr", "device manufacturer"); - addvar(VAR_VALUE, "device_model", "device model"); - addvar(VAR_VALUE, "ser_baud_rate", "serial port baud rate"); - addvar(VAR_VALUE, "ser_parity", "serial port parity"); - addvar(VAR_VALUE, "ser_data_bit", "serial port data bit"); - addvar(VAR_VALUE, "ser_stop_bit", "serial port stop bit"); - addvar(VAR_VALUE, "rio_slave_id", "RIO modbus slave ID"); - addvar(VAR_VALUE, "mod_resp_to_s", "modbus response timeout (s)"); - addvar(VAR_VALUE, "mod_resp_to_us", "modbus response timeout (us)"); - addvar(VAR_VALUE, "mod_byte_to_s", "modbus byte timeout (s)"); - addvar(VAR_VALUE, "mod_byte_to_us", "modbus byte timeout (us)"); - addvar(VAR_VALUE, "OL_addr", "modbus address for OL state"); - addvar(VAR_VALUE, "OB_addr", "modbus address for OB state"); - addvar(VAR_VALUE, "LB_addr", "modbus address for LB state"); - addvar(VAR_VALUE, "HB_addr", "modbus address for HB state"); - addvar(VAR_VALUE, "RB_addr", "modbus address for RB state"); - addvar(VAR_VALUE, "CHRG_addr", "modbus address for CHRG state"); - addvar(VAR_VALUE, "DISCHRG_addr", "modbus address for DISCHRG state"); - addvar(VAR_VALUE, "FSD_addr", "modbus address for FSD command"); - addvar(VAR_VALUE, "OL_regtype", "modbus register type for OL state"); - addvar(VAR_VALUE, "OB_regtype", "modbus register type for OB state"); - addvar(VAR_VALUE, "LB_regtype", "modbus register type for LB state"); - addvar(VAR_VALUE, "HB_regtype", "modbus register type for HB state"); - addvar(VAR_VALUE, "RB_regtype", "modbus register type for RB state"); - addvar(VAR_VALUE, "CHRG_regtype", "modbus register type for CHRG state"); - addvar(VAR_VALUE, "DISCHRG_regtype", "modbus register type for DISCHRG state"); - addvar(VAR_VALUE, "FSD_regtype", "modbus register type for FSD command"); - addvar(VAR_VALUE, "OL_noro", "NO/NC configuration for OL state"); - addvar(VAR_VALUE, "OB_noro", "NO/NC configuration for OB state"); - addvar(VAR_VALUE, "LB_noro", "NO/NC configuration for LB state"); - addvar(VAR_VALUE, "HB_noro", "NO/NC configuration for HB state"); - addvar(VAR_VALUE, "RB_noro", "NO/NC configuration for RB state"); - addvar(VAR_VALUE, "CHRG_noro", "NO/NC configuration for CHRG state"); - addvar(VAR_VALUE, "DISCHRG_noro", "NO/NC configuration for DISCHRG state"); - addvar(VAR_VALUE, "FSD_noro", "NO/NC configuration for FSD state"); - addvar(VAR_VALUE, "FSD_pulse_duration", "FSD pulse duration"); -} - -/* close modbus connection and free modbus context allocated memory */ -void upsdrv_cleanup(void) -{ - if (mbctx != NULL) { - modbus_close(mbctx); - modbus_free(mbctx); - } -} - -/* - * driver support functions - */ - -/* Read a modbus register */ -int register_read(modbus_t *mb, int addr, regtype_t type, void *data) -{ - int rval = -1; - - /* register bit masks */ - uint mask8 = 0x000F; - uint mask16 = 0x00FF; - - switch (type) { - case COIL: - rval = modbus_read_bits(mb, addr, 1, (uint8_t *)data); - *(uint *)data = *(uint *)data & mask8; - break; - case INPUT_B: - rval = modbus_read_input_bits(mb, addr, 1, (uint8_t *)data); - *(uint *)data = *(uint *)data & mask8; - break; - case INPUT_R: - rval = modbus_read_input_registers(mb, addr, 1, (uint16_t *)data); - *(uint *)data = *(uint *)data & mask16; - break; - case HOLDING: - rval = modbus_read_registers(mb, addr, 1, (uint16_t *)data); - *(uint *)data = *(uint *)data & mask16; - break; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: - upsdebugx(2,"ERROR: register_read: invalid register type %d\n", type); - break; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } - if (rval == -1) { - upslogx(LOG_ERR,"ERROR:(%s) modbus_read: addr:0x%x, type:%8s, path:%s\n", - modbus_strerror(errno), - addr, - (type == COIL) ? "COIL" : - (type == INPUT_B) ? "INPUT_B" : - (type == INPUT_R) ? "INPUT_R" : "HOLDING", - device_path - ); - - /* on BROKEN PIPE error try to reconnect */ - if (errno == EPIPE) { - upsdebugx(2, "register_read: error(%s)", modbus_strerror(errno)); - modbus_reconnect(); - } - } - upsdebugx(3, "register addr: 0x%x, register type: %d read: %d",addr, type, *(uint *)data); - return rval; -} - -/* write a modbus register */ -int register_write(modbus_t *mb, int addr, regtype_t type, void *data) -{ - int rval = -1; - - /* register bit masks */ - uint mask8 = 0x000F; - uint mask16 = 0x00FF; - - switch (type) { - case COIL: - *(uint *)data = *(uint *)data & mask8; - rval = modbus_write_bit(mb, addr, *(uint8_t *)data); - break; - case HOLDING: - *(uint *)data = *(uint *)data & mask16; - rval = modbus_write_register(mb, addr, *(uint16_t *)data); - break; - - case INPUT_B: - case INPUT_R: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - upsdebugx(2,"ERROR: register_write: invalid register type %d\n", type); - break; - } - if (rval == -1) { - upslogx(LOG_ERR,"ERROR:(%s) modbus_read: addr:0x%x, type:%8s, path:%s\n", - modbus_strerror(errno), - addr, - (type == COIL) ? "COIL" : - (type == INPUT_B) ? "INPUT_B" : - (type == INPUT_R) ? "INPUT_R" : "HOLDING", - device_path - ); - - /* on BROKEN PIPE error try to reconnect */ - if (errno == EPIPE) { - upsdebugx(2, "register_write: error(%s)", modbus_strerror(errno)); - modbus_reconnect(); - } - } - upsdebugx(3, "register addr: 0x%x, register type: %d read: %d",addr, type, *(uint *)data); - return rval; -} - -/* returns the time elapsed since start in milliseconds */ -long time_elapsed(struct timeval *start) -{ - long rval; - struct timeval end; - - rval = gettimeofday(&end, NULL); - if (rval < 0) { - upslogx(LOG_ERR, "time_elapsed: %s", strerror(errno)); - } - if (start->tv_usec < end.tv_usec) { - suseconds_t nsec = (end.tv_usec - start->tv_usec) / 1000000 + 1; - end.tv_usec -= 1000000 * nsec; - end.tv_sec += nsec; - } - if (start->tv_usec - end.tv_usec > 1000000) { - suseconds_t nsec = (start->tv_usec - end.tv_usec) / 1000000; - end.tv_usec += 1000000 * nsec; - end.tv_sec -= nsec; - } - rval = (end.tv_sec - start->tv_sec) * 1000 + (end.tv_usec - start->tv_usec) / 1000; - - return rval; -} - -/* instant command triggered by upsd */ -int upscmd(const char *cmd, const char *arg) -{ - int rval; - int data; - struct timeval start; - long etime; - - if (!strcasecmp(cmd, "load.off")) { - if (sigar[FSD_T].addr != NOTUSED && - (sigar[FSD_T].type == COIL || sigar[FSD_T].type == HOLDING) - ) { - data = 1 ^ sigar[FSD_T].noro; - rval = register_write(mbctx, sigar[FSD_T].addr, sigar[FSD_T].type, &data); - if (rval == -1) { - upslogx(2, "ERROR:(%s) modbus_write_register: addr:0x%08x, regtype: %d, path:%s\n", - modbus_strerror(errno), - sigar[FSD_T].addr, - sigar[FSD_T].type, - device_path - ); - upslogx(LOG_NOTICE, "load.off: failed (communication error) [%s] [%s]", cmd, arg); - rval = STAT_INSTCMD_FAILED; - } else { - upsdebugx(2, "load.off: addr: 0x%x, data: %d", sigar[FSD_T].addr, data); - rval = STAT_INSTCMD_HANDLED; - } - - /* if pulse has been defined and rising edge was successful */ - if (FSD_pulse_duration != NOTUSED && rval == STAT_INSTCMD_HANDLED) { - rval = gettimeofday(&start, NULL); - if (rval < 0) { - upslogx(LOG_ERR, "upscmd: gettimeofday: %s", strerror(errno)); - } - - /* wait for FSD_pulse_duration ms */ - while ((etime = time_elapsed(&start)) < FSD_pulse_duration); - - data = 0 ^ sigar[FSD_T].noro; - rval = register_write(mbctx, sigar[FSD_T].addr, sigar[FSD_T].type, &data); - if (rval == -1) { - upslogx(LOG_ERR, "ERROR:(%s) modbus_write_register: addr:0x%08x, regtype: %d, path:%s\n", - modbus_strerror(errno), - sigar[FSD_T].addr, - sigar[FSD_T].type, - device_path - ); - upslogx(LOG_NOTICE, "load.off: failed (communication error) [%s] [%s]", cmd, arg); - rval = STAT_INSTCMD_FAILED; - } else { - upsdebugx(2, "load.off: addr: 0x%x, data: %d, elapsed time: %lims", - sigar[FSD_T].addr, - data, - etime - ); - rval = STAT_INSTCMD_HANDLED; - } - } - } else { - upslogx(LOG_NOTICE,"load.off: failed (FSD address undefined or invalid register type) [%s] [%s]", - cmd, - arg - ); - rval = STAT_INSTCMD_FAILED; - } - } else { - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmd, arg); - rval = STAT_INSTCMD_UNKNOWN; - } - return rval; -} - -/* read signal state from modbus RIO, returns 0|1 state or -1 on communication error */ -int get_signal_state(devstate_t state) -{ - int rval = -1; - int reg_val; - regtype_t rtype = 0; /* register type */ - int addr = -1; /* register address */ - - /* assign register address and type */ - switch (state) { - case OL_T: - addr = sigar[OL_T].addr; - rtype = sigar[OL_T].type; - break; - case OB_T: - addr = sigar[OB_T].addr; - rtype = sigar[OB_T].type; - break; - case LB_T: - addr = sigar[LB_T].addr; - rtype = sigar[LB_T].type; - break; - case HB_T: - addr = sigar[HB_T].addr; - rtype = sigar[HB_T].type; - break; - case RB_T: - addr = sigar[RB_T].addr; - rtype = sigar[RB_T].type; - break; - case CHRG_T: - addr = sigar[CHRG_T].addr; - rtype = sigar[CHRG_T].type; - break; - case DISCHRG_T: - addr = sigar[DISCHRG_T].addr; - rtype = sigar[DISCHRG_T].type; - break; - - case BYPASS_T: - case CAL_T: - case FSD_T: - case OFF_T: - case OVER_T: - case TRIM_T: - case BOOST_T: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - break; - } - - rval = register_read(mbctx, addr, rtype, ®_val); - if (rval > -1) { - rval = reg_val; - } - upsdebugx(3, "get_signal_state: state: %d", reg_val); - return rval; -} - -/* get driver configuration parameters */ -void get_config_vars() -{ - int i; /* local index */ - - /* initialize sigar table */ - for (i = 0; i < NUMOF_SIG_STATES; i++) { - sigar[i].addr = NOTUSED; - sigar[i].noro = 0; /* ON corresponds to 1 (closed contact) */ - } - - /* check if device manufacturer is set ang get the value */ - if (testvar("device_mfr")) { - device_mfr = getval("device_mfr"); - } - upsdebugx(2, "device_mfr %s", device_mfr); - - /* check if device model is set ang get the value */ - if (testvar("device_model")) { - device_model = getval("device_model"); - } - upsdebugx(2, "device_model %s", device_model); - - /* check if serial baud rate is set ang get the value */ - if (testvar("ser_baud_rate")) { - ser_baud_rate = (int)strtol(getval("ser_baud_rate"), NULL, 10); - } - upsdebugx(2, "ser_baud_rate %d", ser_baud_rate); - - /* check if serial parity is set ang get the value */ - if (testvar("ser_parity")) { - /* Dereference the char* we get */ - char *sp = getval("ser_parity"); - if (sp) { - /* TODO? Sanity-check the char we get? */ - ser_parity = *sp; - } else { - upsdebugx(2, "Could not determine ser_parity, will keep default"); - } - } - upsdebugx(2, "ser_parity %c", ser_parity); - - /* check if serial data bit is set ang get the value */ - if (testvar("ser_data_bit")) { - ser_data_bit = (int)strtol(getval("ser_data_bit"), NULL, 10); - } - upsdebugx(2, "ser_data_bit %d", ser_data_bit); - - /* check if serial stop bit is set ang get the value */ - if (testvar("ser_stop_bit")) { - ser_stop_bit = (int)strtol(getval("ser_stop_bit"), NULL, 10); - } - upsdebugx(2, "ser_stop_bit %d", ser_stop_bit); - - /* check if device ID is set ang get the value */ - if (testvar("rio_slave_id")) { - rio_slave_id = (int)strtol(getval("rio_slave_id"), NULL, 10); - } - upsdebugx(2, "rio_slave_id %d", rio_slave_id); - - /* check if response time out (s) is set ang get the value */ - if (testvar("mod_resp_to_s")) { - mod_resp_to_s = (uint32_t)strtol(getval("mod_resp_to_s"), NULL, 10); - } - upsdebugx(2, "mod_resp_to_s %d", mod_resp_to_s); - - /* check if response time out (us) is set ang get the value */ - if (testvar("mod_resp_to_us")) { - mod_resp_to_us = (uint32_t) strtol(getval("mod_resp_to_us"), NULL, 10); - if (mod_resp_to_us > 999999) { - fatalx(EXIT_FAILURE, "get_config_vars: Invalid mod_resp_to_us %d", mod_resp_to_us); - } - } - upsdebugx(2, "mod_resp_to_us %d", mod_resp_to_us); - - /* check if byte time out (s) is set ang get the value */ - if (testvar("mod_byte_to_s")) { - mod_byte_to_s = (uint32_t)strtol(getval("mod_byte_to_s"), NULL, 10); - } - upsdebugx(2, "mod_byte_to_s %d", mod_byte_to_s); - - /* check if byte time out (us) is set ang get the value */ - if (testvar("mod_byte_to_us")) { - mod_byte_to_us = (uint32_t) strtol(getval("mod_byte_to_us"), NULL, 10); - if (mod_byte_to_us > 999999) { - fatalx(EXIT_FAILURE, "get_config_vars: Invalid mod_byte_to_us %d", mod_byte_to_us); - } - } - upsdebugx(2, "mod_byte_to_us %d", mod_byte_to_us); - - /* check if OL address is set and get the value */ - if (testvar("OL_addr")) { - sigar[OL_T].addr = (int)strtol(getval("OL_addr"), NULL, 0); - if (testvar("OL_noro")) { - sigar[OL_T].noro = (int)strtol(getval("OL_noro"), NULL, 10); - if (sigar[OL_T].noro != 1) { - sigar[OL_T].noro = 0; - } - } - } - - /* check if OL register type is set and get the value otherwise set to INPUT_B */ - if (testvar("OL_regtype")) { - sigar[OL_T].type = (unsigned int)strtol(getval("OL_regtype"), NULL, 10); - if (sigar[OL_T].type < COIL || sigar[OL_T].type > HOLDING) { - sigar[OL_T].type = INPUT_B; - } - } else { - sigar[OL_T].type = INPUT_B; - } - - /* check if OB address is set and get the value */ - if (testvar("OB_addr")) { - sigar[OB_T].addr = (int)strtol(getval("OB_addr"), NULL, 0); - } - if (testvar("OB_noro")) { - sigar[OB_T].noro = (int)strtol(getval("OB_noro"), NULL, 10); - if (sigar[OB_T].noro != 1) { - sigar[OB_T].noro = 0; - } - } - - /* check if OB register type is set and get the value otherwise set to INPUT_B */ - if (testvar("OB_regtype")) { - sigar[OB_T].type = (unsigned int)strtol(getval("OB_regtype"), NULL, 10); - if (sigar[OB_T].type < COIL || sigar[OB_T].type > HOLDING) { - sigar[OB_T].type = INPUT_B; - } - } else { - sigar[OB_T].type = INPUT_B; - } - - /* check if LB address is set and get the value */ - if (testvar("LB_addr")) { - sigar[LB_T].addr = (int)strtol(getval("LB_addr"), NULL, 0); - if (testvar("LB_noro")) { - sigar[LB_T].noro = (int)strtol(getval("LB_noro"), NULL, 10); - if (sigar[LB_T].noro != 1) { - sigar[LB_T].noro = 0; - } - } - } - - /* check if LB register type is set and get the value otherwise set to INPUT_B */ - if (testvar("LB_regtype")) { - sigar[LB_T].type = (unsigned int)strtol(getval("OB_regtype"), NULL, 10); - if (sigar[LB_T].type < COIL || sigar[LB_T].type > HOLDING) { - sigar[LB_T].type = INPUT_B; - } - } else { - sigar[LB_T].type = INPUT_B; - } - - /* check if HB address is set and get the value */ - if (testvar("HB_addr")) { - sigar[HB_T].addr = (int)strtol(getval("HB_addr"), NULL, 0); - if (testvar("HB_noro")) { - sigar[HB_T].noro = (int)strtol(getval("HB_noro"), NULL, 10); - if (sigar[HB_T].noro != 1) { - sigar[HB_T].noro = 0; - } - } - } - - /* check if HB register type is set and get the value otherwise set to INPUT_B */ - if (testvar("HB_regtype")) { - sigar[HB_T].type = (unsigned int)strtol(getval("HB_regtype"), NULL, 10); - if (sigar[HB_T].type < COIL || sigar[HB_T].type > HOLDING) { - sigar[HB_T].type = INPUT_B; - } - } else { - sigar[HB_T].type = INPUT_B; - } - - /* check if RB address is set and get the value */ - if (testvar("RB_addr")) { - sigar[RB_T].addr = (int)strtol(getval("RB_addr"), NULL, 0); - if (testvar("RB_noro")) { - sigar[RB_T].noro = (int)strtol(getval("RB_noro"), NULL, 10); - if (sigar[RB_T].noro != 1) { - sigar[RB_T].noro = 0; - } - } - } - - /* check if RB register type is set and get the value otherwise set to INPUT_B */ - if (testvar("RB_regtype")) { - sigar[RB_T].type = (unsigned int)strtol(getval("RB_regtype"), NULL, 10); - if (sigar[RB_T].type < COIL || sigar[RB_T].type > HOLDING) { - sigar[RB_T].type = INPUT_B; - } - } else { - sigar[RB_T].type = INPUT_B; - } - - /* check if CHRG address is set and get the value */ - if (testvar("CHRG_addr")) { - sigar[CHRG_T].addr = (int)strtol(getval("CHRG_addr"), NULL, 0); - if (testvar("CHRG_noro")) { - sigar[CHRG_T].noro = (int)strtol(getval("CHRG_noro"), NULL, 10); - if (sigar[CHRG_T].noro != 1) { - sigar[CHRG_T].noro = 0; - } - } - } - - /* check if CHRG register type is set and get the value otherwise set to INPUT_B */ - if (testvar("CHRG_regtype")) { - sigar[CHRG_T].type = (unsigned int)strtol(getval("CHRG_regtype"), NULL, 10); - if (sigar[CHRG_T].type < COIL || sigar[CHRG_T].type > HOLDING) { - sigar[CHRG_T].type = INPUT_B; - } - } else { - sigar[CHRG_T].type = INPUT_B; - } - - /* check if DISCHRG address is set and get the value */ - if (testvar("DISCHRG_addr")) { - sigar[DISCHRG_T].addr = (int)strtol(getval("DISCHRG_addr"), NULL, 0); - if (testvar("DISCHRG_noro")) { - sigar[DISCHRG_T].noro = (int)strtol(getval("DISCHRG_noro"), NULL, 10); - if (sigar[DISCHRG_T].noro != 1) { - sigar[DISCHRG_T].noro = 0; - } - } - } - - /* check if DISCHRG register type is set and get the value otherwise set to INPUT_B */ - if (testvar("DISCHRG_regtype")) { - sigar[DISCHRG_T].type = (unsigned int)strtol(getval("DISCHRG_regtype"), NULL, 10); - if (sigar[DISCHRG_T].type < COIL || sigar[DISCHRG_T].type > HOLDING) { - sigar[DISCHRG_T].type = INPUT_B; - } - } else { - sigar[DISCHRG_T].type = INPUT_B; - } - - /* check if FSD address is set and get the value */ - if (testvar("FSD_addr")) { - sigar[FSD_T].addr = (int)strtol(getval("FSD_addr"), NULL, 0); - if (testvar("FSD_noro")) { - sigar[FSD_T].noro = (int)strtol(getval("FSD_noro"), NULL, 10); - if (sigar[FSD_T].noro != 1) { - sigar[FSD_T].noro = 0; - } - } - } - - /* check if FSD register type is set and get the value otherwise set to COIL */ - if (testvar("FSD_regtype")) { - sigar[FSD_T].type = (unsigned int)strtol(getval("FSD_regtype"), NULL, 10); - if (sigar[FSD_T].type < COIL || sigar[FSD_T].type > HOLDING) { - sigar[FSD_T].type = COIL; - } - } else { - sigar[FSD_T].type = COIL; - } - - /* check if FSD pulse duration is set and get the value */ - if (testvar("FSD_pulse_duration")) { - FSD_pulse_duration = (int) strtol(getval("FSD_pulse_duration"), NULL, 10); - } - upsdebugx(2, "FSD_pulse_duration %d", FSD_pulse_duration); - - /* debug loop over signal array */ - for (i = 0; i < NUMOF_SIG_STATES; i++) { - if (sigar[i].addr != NOTUSED) { - char *signame; - switch (i) { - case OL_T: - signame = "OL"; - break; - case OB_T: - signame = "OB"; - break; - case LB_T: - signame = "LB"; - break; - case HB_T: - signame = "HB"; - break; - case RB_T: - signame = "RB"; - break; - case FSD_T: - signame = "FSD"; - break; - case CHRG_T: - signame = "CHRG"; - break; - case DISCHRG_T: - signame = "DISCHRG"; - break; - default: - signame = "NOTUSED"; - break; - } - upsdebugx(2, "%s, addr:0x%x, type:%d", signame, sigar[i].addr, sigar[i].type); - } - } -} - -/* create a new modbus context based on connection type (serial or TCP) */ -modbus_t *modbus_new(const char *port) -{ - modbus_t *mb; - char *sp; - if (strstr(port, "/dev/tty") != NULL) { - mb = modbus_new_rtu(port, ser_baud_rate, ser_parity, ser_data_bit, ser_stop_bit); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_rtu: Unable to open serial port context\n"); - } - } else if ((sp = strchr(port, ':')) != NULL) { - char *tcp_port = xmalloc(sizeof(sp)); - strcpy(tcp_port, sp + 1); - *sp = '\0'; - mb = modbus_new_tcp(port, (int)strtoul(tcp_port, NULL, 10)); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_tcp: Unable to connect to %s\n", port); - } - free(tcp_port); - } else { - mb = modbus_new_tcp(port, 502); - if (mb == NULL) { - upslogx(LOG_ERR, "modbus_new_tcp: Unable to connect to %s\n", port); - } - } - return mb; -} - -/* reconnect to modbus server upon connection error */ -void modbus_reconnect(void) -{ - int rval; - - upsdebugx(2, "modbus_reconnect, trying to reconnect to modbus server"); - - /* clear current modbus context */ - modbus_close(mbctx); - modbus_free(mbctx); - - /* open communication port */ - mbctx = modbus_new(device_path); - if (mbctx == NULL) { - fatalx(EXIT_FAILURE, "modbus_new_rtu: Unable to open communication port context"); - } - - /* set slave ID */ - rval = modbus_set_slave(mbctx, rio_slave_id); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_slave: Invalid modbus slave ID %d", rio_slave_id); - } - - /* connect to modbus device */ - if (modbus_connect(mbctx) == -1) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: %s", modbus_strerror(errno)); - } - - /* set modbus response timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_response_timeout(mbctx, mod_resp_to_s, mod_resp_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_response_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_resp_to_s; - to.tv_usec = mod_resp_to_us; - /* void */ modbus_set_response_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ - - /* set modbus byte timeout */ -#if (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32) || (defined NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields) - rval = modbus_set_byte_timeout(mbctx, mod_byte_to_s, mod_byte_to_us); - if (rval < 0) { - modbus_free(mbctx); - fatalx(EXIT_FAILURE, "modbus_set_byte_timeout: error(%s)", modbus_strerror(errno)); - } -#elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields) - { /* see comments above */ - struct timeval to; - memset(&to, 0, sizeof(struct timeval)); - to.tv_sec = mod_byte_to_s; - to.tv_usec = mod_byte_to_us; - /* void */ modbus_set_byte_timeout(mbctx, &to); - } -/* #elif (defined NUT_MODBUS_TIMEOUT_ARG_timeval) // some un-castable type in fields */ -#endif /* NUT_MODBUS_TIMEOUT_ARG_* */ -} diff --git a/drivers/generic_modbus.h b/drivers/generic_modbus.h deleted file mode 100644 index 3a6b8a5..0000000 --- a/drivers/generic_modbus.h +++ /dev/null @@ -1,111 +0,0 @@ -/* generic_modbus.h - Driver for generic UPS connected via modbus RIO - * - * Copyright (C) - * 2021 Dimitris Economou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUT_GENERIC_MODBUS_H -#define NUT_GENERIC_MODBUS_H - -/* UPS device details */ -#define DEVICE_MFR "UNKNOWN" -#define DEVICE_MODEL "unknown" - -/* serial access parameters */ -#define BAUD_RATE 9600 -#define PARITY 'N' -#define DATA_BIT 8 -#define STOP_BIT 1 - -/* - * modbus response and byte timeouts - * us: 1 - 999999 - */ -#define MODRESP_TIMEOUT_s 0 -#define MODRESP_TIMEOUT_us 200000 -#define MODBYTE_TIMEOUT_s 0 -#define MODBYTE_TIMEOUT_us 50000 - - -/* modbus access parameters */ -#define MODBUS_SLAVE_ID 5 - -/* shutdown repeat on error */ -#define FSD_REPEAT_CNT 3 - -/* shutdown repeat interval in ms */ -#define FSD_REPEAT_INTRV 1500 - -/* definition of register type */ -enum regtype { - COIL = 0, - INPUT_B, - INPUT_R, - HOLDING -}; -typedef enum regtype regtype_t; - -/* UPS device state enum */ -enum devstate { - OL_T = 0, - OB_T, - LB_T, - HB_T, - RB_T, - CHRG_T, - DISCHRG_T, - BYPASS_T, - CAL_T, - OFF_T, - OVER_T, - TRIM_T, - BOOST_T, - FSD_T -}; -typedef enum devstate devstate_t; - -/* UPS state signal attributes */ -struct sigattr { - int addr; /* register address */ - regtype_t type; /* register type */ - int noro; /* 1: normally open contact 0: normally closed contact. */ - /* noro is used to indicate the logical ON or OFF in regard - of the contact state. if noro is set to 1 then ON corresponds - to an open contact */ -}; -typedef struct sigattr sigattr_t; - -#define NUMOF_SIG_STATES 14 -#define NOTUSED -1 - -/* define the duration of the shutdown pulse */ -#define SHTDOWN_PULSE_DURATION NOTUSED - -/* - * associate PULS signals to NUT device states - * - * Ready contact <--> 1:HB, 0:CHRG - * Buffering contact <--> 1:OB, 0:OL - * Battery-low <--> 1:LB - * Replace Battery <--> 1:RB - * Inhibit buffering <--> 1:FSD - */ - - -#endif /* NUT_GENERIC_MODBUS_H */ diff --git a/drivers/genericups.c b/drivers/genericups.c index d6568dd..bc8ddc4 100644 --- a/drivers/genericups.c +++ b/drivers/genericups.c @@ -17,17 +17,14 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be first */ - #include #include "main.h" #include "serial.h" #include "genericups.h" -#include "nut_stdint.h" #define DRIVER_NAME "Generic contact-closure UPS driver" -#define DRIVER_VERSION "1.38" +#define DRIVER_VERSION "1.36" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -42,30 +39,19 @@ upsdrv_info_t upsdrv_info = { static void parse_output_signals(const char *value, int *line) { - int old_line = *line; /* parse signals the serial port can output */ *line = 0; - upsdebugx(4, "%s: enter", __func__); - - /* Note: for future drivers, please use strtok() or similar tokenizing - * methods, such that it is easier to spot configuration mistakes. With - * this code, a misspelled control line may go unnoticed. I'd fix it - * The Right Way (tm), but these UPSes are ancient. - */ if (strstr(value, "DTR") && !strstr(value, "-DTR")) { - upsdebugx(3, "%s: override DTR", __func__); *line |= TIOCM_DTR; } if (strstr(value, "RTS") && !strstr(value, "-RTS")) { - upsdebugx(3, "%s: override RTS", __func__); *line |= TIOCM_RTS; } if (strstr(value, "ST")) { - upsdebugx(3, "%s: override ST", __func__); *line |= TIOCM_ST; } @@ -84,37 +70,20 @@ static void parse_output_signals(const char *value, int *line) if (strstr(value, "DSR")) { fatalx(EXIT_FAILURE, "Can't override output with DSR (not an output)"); } - - if (strstr(value, "NULL") || strstr(value, "none")) { - upsdebugx(3, "%s: disable", __func__); - *line = 0; - } - - if(*line == old_line) { - upslogx(LOG_NOTICE, "%s: output overrides specified, but no effective difference - check for typos?", __func__); - } - - upsdebugx(4, "%s: exit", __func__); } static void parse_input_signals(const char *value, int *line, int *val) { /* parse signals the serial port can input */ - int old_line = *line, old_val = *val; *line = 0; *val = 0; - upsdebugx(4, "%s: enter", __func__); - if (strstr(value, "CTS")) { *line |= TIOCM_CTS; if (!strstr(value, "-CTS")) { - upsdebugx(3, "%s: override CTS (active low)", __func__); *val |= TIOCM_CTS; - } else { - upsdebugx(3, "%s: override CTS", __func__); } } @@ -122,10 +91,7 @@ static void parse_input_signals(const char *value, int *line, int *val) *line |= TIOCM_CD; if (!strstr(value, "-DCD")) { - upsdebugx(3, "%s: override DCD (active low)", __func__); *val |= TIOCM_CD; - } else { - upsdebugx(3, "%s: override DCD", __func__); } } @@ -133,10 +99,7 @@ static void parse_input_signals(const char *value, int *line, int *val) *line |= TIOCM_RNG; if (!strstr(value, "-RNG")) { - upsdebugx(3, "%s: override RNG (active low)", __func__); *val |= TIOCM_RNG; - } else { - upsdebugx(3, "%s: override RNG", __func__); } } @@ -144,10 +107,7 @@ static void parse_input_signals(const char *value, int *line, int *val) *line |= TIOCM_DSR; if (!strstr(value, "-DSR")) { - upsdebugx(3, "%s: override DSR (active low)", __func__); *val |= TIOCM_DSR; - } else { - upsdebugx(3, "%s: override DSR", __func__); } } @@ -162,18 +122,6 @@ static void parse_input_signals(const char *value, int *line, int *val) if (strstr(value, "ST")) { fatalx(EXIT_FAILURE, "Can't override input with ST (not an input)"); } - - if (strstr(value, "NULL") || strstr(value, "none")) { - *line = 0; - *val = 0; - upsdebugx(3, "%s: disable", __func__); - } - - if((*line == old_line) && (*val == old_val)) { - upslogx(LOG_NOTICE, "%s: input overrides specified, but no effective difference - check for typos?", __func__); - } - - upsdebugx(4, "%s: exit", __func__); } void upsdrv_initinfo(void) @@ -201,22 +149,12 @@ void upsdrv_initinfo(void) parse_input_signals(v, &upstab[upstype].line_bl, &upstab[upstype].val_bl); upsdebugx(2, "parse_input_signals: LB overridden with %s\n", v); } - - if ((v = getval("RB")) != NULL) { - parse_input_signals(v, &upstab[upstype].line_rb, &upstab[upstype].val_rb); - upsdebugx(2, "parse_input_signals: RB overridden with %s\n", v); - } - - if ((v = getval("BYPASS")) != NULL) { - parse_input_signals(v, &upstab[upstype].line_bypass, &upstab[upstype].val_bypass); - upsdebugx(2, "parse_input_signals: BYPASS overridden with %s\n", v); - } } /* normal idle loop - keep up with the current state of the UPS */ void upsdrv_updateinfo(void) { - int flags, ol, bl, rb, bypass, ret; + int flags, ol, bl, ret; ret = ioctl(upsfd, TIOCMGET, &flags); @@ -227,13 +165,8 @@ void upsdrv_updateinfo(void) return; } - /* Always online when OL is disabled */ ol = ((flags & upstab[upstype].line_ol) == upstab[upstype].val_ol); - - /* Always have the flags cleared when other status flags are disabled */ - bl = upstab[upstype].line_bl != 0 && ((flags & upstab[upstype].line_bl) == upstab[upstype].val_bl); - rb = upstab[upstype].line_rb != 0 && ((flags & upstab[upstype].line_rb) == upstab[upstype].val_rb); - bypass = upstab[upstype].line_bypass != 0 && ((flags & upstab[upstype].line_bypass) == upstab[upstype].val_bypass); + bl = ((flags & upstab[upstype].line_bl) == upstab[upstype].val_bl); status_init(); @@ -247,17 +180,9 @@ void upsdrv_updateinfo(void) status_set("OB"); /* on battery */ } - if (rb) { - status_set("RB"); /* replace battery */ - } - - if (bypass) { - status_set("BYPASS"); /* battery bypass */ - } - status_commit(); - upsdebugx(5, "ups.status: %s %s %s %s\n", ol ? "OL" : "OB", bl ? "BL" : "", rb ? "RB" : "", bypass ? "BYPASS" : ""); + upsdebugx(5, "ups.status: %s %s\n", ol ? "OL" : "OB", bl ? "BL" : ""); ser_comm_good(); dstate_dataok(); @@ -336,37 +261,14 @@ void upsdrv_shutdown(void) } if (getval("sdtime")) { - long sdtime; + int sdtime; sdtime = strtol(getval("sdtime"), (char **) NULL, 10); - upslogx(LOG_INFO, "Holding shutdown signal for %ld seconds...\n", + upslogx(LOG_INFO, "Holding shutdown signal for %d seconds...\n", sdtime); - if (sdtime > 0) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Different platforms, different sizes, none fits all... */ - if (sizeof(long) > sizeof(unsigned int) && sdtime < (long)UINT_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - sleep((unsigned int)sdtime); - } else { - sleep(UINT_MAX); - } - } + sleep(sdtime); } } @@ -384,8 +286,6 @@ void upsdrv_makevartable(void) addvar(VAR_VALUE, "CP", "Override cable power setting"); addvar(VAR_VALUE, "OL", "Override on line signal"); addvar(VAR_VALUE, "LB", "Override low battery signal"); - addvar(VAR_VALUE, "RB", "Override replace battery signal"); - addvar(VAR_VALUE, "BYPASS", "Override battery bypass signal"); addvar(VAR_VALUE, "SD", "Override shutdown setting"); addvar(VAR_VALUE, "sdtime", "Hold time for shutdown value (seconds)"); } @@ -404,7 +304,7 @@ void upsdrv_initups(void) } /* don't hang up on last close */ - tio.c_cflag &= ~((tcflag_t)HUPCL); + tio.c_cflag &= ~HUPCL; if (tcsetattr(upsfd, TCSANOW, &tio)) { fatal_with_errno(EXIT_FAILURE, "tcsetattr"); diff --git a/drivers/genericups.h b/drivers/genericups.h index f4c3a45..eb1977e 100644 --- a/drivers/genericups.h +++ b/drivers/genericups.h @@ -17,18 +17,13 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_GENERICUPS_H_SEEN -#define NUT_GENERICUPS_H_SEEN 1 - -static struct { +struct { const char *mfr; /* value for INFO_MFR */ const char *model; /* value for INFO_MODEL */ const char *desc; /* used in -h listing */ int line_norm; int line_ol, val_ol; int line_bl, val_bl; - int line_rb, val_rb; - int line_bypass, val_bypass; int line_sd; } upstab[] = { @@ -39,8 +34,6 @@ static struct { TIOCM_DTR | TIOCM_RTS, /* cable power: DTR + RTS */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: RTS */ }, @@ -51,8 +44,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_RNG, 0, /* online: RNG off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: RTS */ }, @@ -63,11 +54,9 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR|TIOCM_RTS /* shutdown: DTR + RTS */ }, - + /* Type 3 */ { "PowerTech", "Comp1000", @@ -75,8 +64,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR | TIOCM_RTS /* shutdown: DTR + RTS */ }, @@ -87,8 +74,6 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ 0 /* shutdown: none */ }, @@ -99,8 +84,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR | TIOCM_RTS /* shutdown: DTR + RTS */ }, @@ -111,20 +94,16 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: set RTS */ }, /* Type 7 */ { "CyberPower", "Power99", - "CyberPower Power99", + "CyberPower Power99", TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR /* shutdown: set DTR */ }, @@ -135,8 +114,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ -1 /* shutdown: unknown */ }, @@ -147,8 +124,6 @@ static struct { 0, /* cable power: none */ TIOCM_CD, 0, /* online: CD off */ TIOCM_CTS, TIOCM_CTS, /* low battery: CTS on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: RTS */ }, @@ -159,8 +134,6 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR /* shutdown: DTR */ }, @@ -171,8 +144,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_ST /* shutdown: ST */ }, @@ -183,11 +154,9 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR /* shutdown: raise DTR */ }, - + /* Type 13 */ { "RPT", "Repoteck", @@ -195,8 +164,6 @@ static struct { TIOCM_DTR | TIOCM_RTS, /* cable power: DTR + RTS */ TIOCM_CD, TIOCM_CD, /* On-line : DCD on */ TIOCM_CTS, 0, /* Battery low: CTS off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_ST /* shutdown: TX BREA */ }, @@ -207,8 +174,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CD, TIOCM_CD, /* online: CD on */ TIOCM_CTS, 0, /* low battery: CTS off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: raise RTS */ }, @@ -219,8 +184,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_ST /* shutdown: ST (break) */ }, @@ -231,8 +194,6 @@ static struct { TIOCM_DTR | TIOCM_RTS, /* cable power: DTR + RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ -1 /* shutdown: unknown */ }, @@ -243,8 +204,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ -1 /* shutdown: unknown */ }, @@ -255,8 +214,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, TIOCM_CD, /* low battery: CAR on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ -1 /* shutdown: none */ }, @@ -267,8 +224,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: DCD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS /* shutdown: set RTS */ }, @@ -280,8 +235,6 @@ static struct { TIOCM_DTR, /* cable power: DTR */ TIOCM_CTS, 0, /* online: CTS off */ TIOCM_CD, TIOCM_CD, /* low battery: CD on */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_ST /* shutdown: ST (break) */ }, @@ -293,11 +246,9 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_RTS | TIOCM_DTR /* shutdown: RTS+DTR */ }, - + /* Type 22 (duplicate from 7)*/ { "Gamatronic Electronic Industries", "Generic Alarm UPS", @@ -305,23 +256,9 @@ static struct { TIOCM_RTS, /* cable power: RTS */ TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ TIOCM_CD, 0, /* low battery: CD off */ - 0, 0, /* replace battery: none */ - 0, 0, /* battery bypass: none */ TIOCM_DTR /* shutdown: DTR */ }, - /* Type 23 */ - { "Generic", - "Generic FTTx Battery Backup", - "FTTx (Fiber to the x) battery backup with 4-wire telemetry interface", - TIOCM_RTS, /* cable power: RTS */ - TIOCM_CTS, TIOCM_CTS, /* online: CTS on */ - TIOCM_CD, 0, /* low battery: CD off */ - TIOCM_RI, 0, /* replace battery: RI off */ - TIOCM_DSR, 0, /* battery bypass: DSR off */ - 0 /* shutdown: none */ - }, - /* add any new entries directly above this line */ { NULL, @@ -330,10 +267,6 @@ static struct { 0, 0, 0, 0, 0, - 0, 0, - 0, 0, 0 } }; - -#endif /* NUT_GENERICUPS_H_SEEN */ diff --git a/drivers/hidparser.c b/drivers/hidparser.c index 0d7b53f..1fb4a5e 100644 --- a/drivers/hidparser.c +++ b/drivers/hidparser.c @@ -22,30 +22,29 @@ * * -------------------------------------------------------------------------- */ -#include "config.h" /* must be first */ - #include #include +#include "config.h" #include "hidparser.h" -#include "nut_stdint.h" /* for int8_t, int16_t, int32_t */ -#include "common.h" /* for fatalx() */ +#include "nut_stdint.h" /* for int8_t, int16_t, int32_t */ + +/* to be implemented for DEBUG purpose */ +/* previously: #define ERROR(x) if(x) __asm { int 3 }; */ +#define ERROR(x) static const uint8_t ItemSize[4] = { 0, 1, 2, 4 }; /* * HIDParser struct * -------------------------------------------------------------------------- */ -/* FIXME? Should this structure remain with reasonable fixed int types, - * or changed to align with libusb API version and usb_ctrl_* typedefs? - */ typedef struct { const unsigned char *ReportDesc; /* Report Descriptor */ - size_t ReportDescSize; /* Size of Report Descriptor */ + int ReportDescSize; /* Size of Report Descriptor */ uint16_t Pos; /* Store current pos in descriptor */ uint8_t Item; /* Store current Item */ - uint32_t Value; /* Store current Value */ + long Value; /* Store current Value */ HIDData_t Data; /* Store current environment */ @@ -60,7 +59,7 @@ typedef struct { /* return 1 + the position of the leftmost "1" bit of an int, or 0 if none. */ -static inline unsigned int hibit(unsigned long x) +static inline unsigned int hibit(unsigned int x) { unsigned int res = 0; @@ -95,7 +94,7 @@ static void ResetLocalState(HIDParser_t* pParser) /* * GetReportOffset * - * Return pointer on current offset value for Report designed by + * Return pointer on current offset value for Report designed by * ReportID/ReportType * -------------------------------------------------------------------------- */ static uint8_t *GetReportOffset(HIDParser_t* pParser, const uint8_t ReportID, const uint8_t ReportType) @@ -125,10 +124,10 @@ static uint8_t *GetReportOffset(HIDParser_t* pParser, const uint8_t ReportID, co } /* - * FormatValue(uint32_t Value, uint8_t Size) + * FormatValue(long Value, uint8_t Size) * Format Value to fit with long format with respect of negative values * -------------------------------------------------------------------------- */ -static long FormatValue(uint32_t Value, uint8_t Size) +static long FormatValue(long Value, uint8_t Size) { switch(Size) { @@ -139,7 +138,7 @@ static long FormatValue(uint32_t Value, uint8_t Size) case 4: return (long)(int32_t)Value; default: - return (long)Value; + return Value; } } @@ -147,25 +146,36 @@ static long FormatValue(uint32_t Value, uint8_t Size) * HIDParse(HIDParser_t* pParser, HIDData_t *pData) * * Analyse Report descriptor stored in HIDParser struct and store local and - * global context. + * global context. * Return in pData the last object found. * Return -1 when there is no other Item to parse, 1 if a new object was found * or 0 if a continuation of a previous object was found. * -------------------------------------------------------------------------- */ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) { - int Found = -1, i; + int Found = -1; while ((Found < 0) && (pParser->Pos < pParser->ReportDescSize)) { /* Get new pParser->Item if current pParser->Count is empty */ if (pParser->Count == 0) { pParser->Item = pParser->ReportDesc[pParser->Pos++]; pParser->Value = 0; - for (i = 0; i < ItemSize[pParser->Item & SIZE_MASK]; i++) { - pParser->Value += (uint32_t)(pParser->ReportDesc[(pParser->Pos)+i]) << (8*i); +#if WORDS_BIGENDIAN + { + int i; + unsigned long valTmp = 0; + + for (i = 0; i < ItemSize[pParser->Item & SIZE_MASK]; i++) { + memcpy(&valTmp, &pParser->ReportDesc[(pParser->Pos)+i], 1); + pParser->Value += valTmp >> ((3-i)*8); + valTmp = 0; + } } +#else + memcpy(&pParser->Value, &pParser->ReportDesc[pParser->Pos], ItemSize[pParser->Item & SIZE_MASK]); +#endif /* Pos on next item */ - pParser->Pos += ItemSize[pParser->Item & SIZE_MASK]; + pParser->Pos += ItemSize[pParser->Item & SIZE_MASK]; } switch (pParser->Item & ITEM_MASK) @@ -180,7 +190,7 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) if ((pParser->Item & SIZE_MASK) > 2) { pParser->UsageTab[pParser->UsageSize] = pParser->Value; } else { - pParser->UsageTab[pParser->UsageSize] = ((HIDNode_t)(pParser->UPage) << 16) | (pParser->Value & 0xFFFF); + pParser->UsageTab[pParser->UsageSize] = (pParser->UPage << 16) | (pParser->Value & 0xFFFF); } /* Increment Usage stack size */ @@ -194,10 +204,10 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) /* Unstack UPage/Usage from UsageTab (never remove the last) */ if (pParser->UsageSize > 0) { - int j; - - for (j = 0; j < pParser->UsageSize; j++) { - pParser->UsageTab[j] = pParser->UsageTab[j+1]; + int i; + + for (i = 0; i < pParser->UsageSize; i++) { + pParser->UsageTab[i] = pParser->UsageTab[i+1]; } /* Remove Usage */ @@ -215,15 +225,15 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) case ITEM_END_COLLECTION : pParser->Data.Path.Size--; - + /* Remove Index if any */ if((pParser->Data.Path.Node[pParser->Data.Path.Size] & 0xffff0000) == 0x00ff0000) { pParser->Data.Path.Size--; } - + ResetLocalState(pParser); break; - + case ITEM_FEATURE: case ITEM_INPUT: case ITEM_OUTPUT: @@ -234,118 +244,96 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) /* It is a continuation of a previous object */ Found = 0; } - + /* Get new pParser->Count from global value */ if(pParser->Count == 0) { pParser->Count = pParser->ReportCount; } - + /* Get UPage/Usage from UsageTab and store them in pParser->Data.Path */ pParser->Data.Path.Node[pParser->Data.Path.Size] = pParser->UsageTab[0]; pParser->Data.Path.Size++; - + /* Unstack UPage/Usage from UsageTab (never remove the last) */ if(pParser->UsageSize > 0) { - int j; - - for (j = 0; j < pParser->UsageSize; j++) { - pParser->UsageTab[j] = pParser->UsageTab[j+1]; + int i; + + for (i = 0; i < pParser->UsageSize; i++) { + pParser->UsageTab[i] = pParser->UsageTab[i+1]; } - /* Remove Usage */ pParser->UsageSize--; } - + /* Copy data type */ pParser->Data.Type = (uint8_t)(pParser->Item & ITEM_MASK); - + /* Copy data attribute */ pParser->Data.Attribute = (uint8_t)pParser->Value; - + /* Store offset */ pParser->Data.Offset = *GetReportOffset(pParser, pParser->Data.ReportID, (uint8_t)(pParser->Item & ITEM_MASK)); - + /* Get Object in pData */ /* -------------------------------------------------------------------------- */ memcpy(pData, &pParser->Data, sizeof(HIDData_t)); /* -------------------------------------------------------------------------- */ - + /* Increment Report Offset */ *GetReportOffset(pParser, pParser->Data.ReportID, (uint8_t)(pParser->Item & ITEM_MASK)) += pParser->Data.Size; - + /* Remove path last node */ pParser->Data.Path.Size--; - + /* Decrement count */ pParser->Count--; - + if (pParser->Count == 0) { ResetLocalState(pParser); } break; - + case ITEM_REP_ID : pParser->Data.ReportID = (uint8_t)pParser->Value; break; - + case ITEM_REP_SIZE : pParser->Data.Size = (uint8_t)pParser->Value; break; - + case ITEM_REP_COUNT : pParser->ReportCount = (uint8_t)pParser->Value; break; - + case ITEM_UNIT_EXP : pParser->Data.UnitExp = (int8_t)pParser->Value; if (pParser->Data.UnitExp > 7) { pParser->Data.UnitExp |= 0xF0; } break; - + case ITEM_UNIT : - /* TOTHINK: Are there cases where Unit is not-signed, - * but a Value too big becomes signed after casting -- - * and unintentionally so? */ - pParser->Data.Unit = (long)pParser->Value; + pParser->Data.Unit = pParser->Value; break; - + case ITEM_LOG_MIN : pParser->Data.LogMin = FormatValue(pParser->Value, ItemSize[pParser->Item & SIZE_MASK]); break; - + case ITEM_LOG_MAX : pParser->Data.LogMax = FormatValue(pParser->Value, ItemSize[pParser->Item & SIZE_MASK]); - /* HACK: If treating the value as signed (FormatValue(...)) results in a LogMax that is - * less than the LogMin value then it is likely that the LogMax value has been - * incorrectly encoded by the UPS firmware (field too short and overflowed into sign - * bit). In that case, reinterpret it as an unsigned number and log the problem. - * This hack is not correct in the sense that it only looks at the LogMin value for - * this item, whereas the HID spec says that Logical values persist in global state. - */ - if (pParser->Data.LogMax < pParser->Data.LogMin) { - upslogx(LOG_WARNING, - "%s: LogMax is less than LogMin. " - "Vendor HID report descriptor may be incorrect; " - "interpreting LogMax %ld as %u in ReportID: 0x%02x", - __func__, - pParser->Data.LogMax, - pParser->Value, - pParser->Data.ReportID); - pParser->Data.LogMax = (long) pParser->Value; - } break; - + case ITEM_PHY_MIN : pParser->Data.PhyMin=FormatValue(pParser->Value, ItemSize[pParser->Item & SIZE_MASK]); pParser->Data.have_PhyMin = 1; break; - + case ITEM_PHY_MAX : pParser->Data.PhyMax=FormatValue(pParser->Value, ItemSize[pParser->Item & SIZE_MASK]); pParser->Data.have_PhyMax = 1; break; - + case ITEM_LONG : /* can't handle long items, but should at least skip them */ pParser->Pos += (uint8_t)(pParser->Value & 0xff); @@ -353,19 +341,10 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) } } /* while ((Found < 0) && (pParser->Pos < pParser->ReportDescSize)) */ - if(pParser->Data.Path.Size >= PATH_SIZE) - upslogx(LOG_ERR, "%s: HID path too long", __func__); - if(pParser->ReportDescSize >= REPORT_DSC_SIZE) - upslogx(LOG_ERR, "%s: Report descriptor too big", __func__); - if(pParser->UsageSize >= USAGE_TAB_SIZE) - upslogx(LOG_ERR, "%s: HID Usage too high", __func__); - - /* FIXME: comparison is always false due to limited range of data type [-Werror=type-limits] - * with ReportID beint uint8_t and MAX_REPORT being 500 currently */ - /* - if(pParser->Data.ReportID >= MAX_REPORT) - upslogx(LOG_ERR, "%s: Too many HID reports", __func__); - */ + ERROR(pParser->Data.Path.Size >= PATH_SIZE); + ERROR(pParser->ReportDescSize >= REPORT_DSC_SIZE); + ERROR(pParser->UsageSize >= USAGE_TAB_SIZE); + ERROR(pParser->Data.ReportID >= MAX_REPORT); return Found; } @@ -375,14 +354,14 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData) * Get pData characteristics from pData->Path * Return TRUE if object was found * -------------------------------------------------------------------------- */ -int FindObject(HIDDesc_t *pDesc_arg, HIDData_t *pData) +int FindObject(HIDDesc_t *pDesc, HIDData_t *pData) { - HIDData_t *pFoundData = FindObject_with_Path(pDesc_arg, &pData->Path, pData->Type); - + HIDData_t *pFoundData = FindObject_with_Path(pDesc, &pData->Path, pData->Type); + if (!pFoundData) { return 0; } - + memcpy(pData, pFoundData, sizeof(*pData)); return 1; } @@ -391,24 +370,24 @@ int FindObject(HIDDesc_t *pDesc_arg, HIDData_t *pData) * FindObject_with_Path * Get pData item with given Path and Type. Return NULL if not found. * -------------------------------------------------------------------------- */ -HIDData_t *FindObject_with_Path(HIDDesc_t *pDesc_arg, HIDPath_t *Path, uint8_t Type) +HIDData_t *FindObject_with_Path(HIDDesc_t *pDesc, HIDPath_t *Path, uint8_t Type) { - size_t i; - - for (i = 0; i < pDesc_arg->nitems; i++) { - HIDData_t *pData = &pDesc_arg->item[i]; + int i; + for (i = 0; i < pDesc->nitems; i++) { + HIDData_t *pData = &pDesc->item[i]; + if (pData->Type != Type) { continue; } - + if (memcmp(pData->Path.Node, Path->Node, (Path->Size) * sizeof(HIDNode_t))) { continue; } - + return pData; } - + return NULL; } @@ -417,85 +396,50 @@ HIDData_t *FindObject_with_Path(HIDDesc_t *pDesc_arg, HIDPath_t *Path, uint8_t T * Get pData item with given ReportID, Offset, and Type. Return NULL * if not found. * -------------------------------------------------------------------------- */ -HIDData_t *FindObject_with_ID(HIDDesc_t *pDesc_arg, uint8_t ReportID, uint8_t Offset, uint8_t Type) +HIDData_t *FindObject_with_ID(HIDDesc_t *pDesc, uint8_t ReportID, uint8_t Offset, uint8_t Type) { - size_t i; - - for (i = 0; i < pDesc_arg->nitems; i++) { - HIDData_t *pData = &pDesc_arg->item[i]; + int i; + for (i = 0; i < pDesc->nitems; i++) { + HIDData_t *pData = &pDesc->item[i]; + if (pData->ReportID != ReportID) { continue; } - + if (pData->Type != Type) { continue; } - + if (pData->Offset != Offset) { continue; } - + return pData; } - - return NULL; -} - -/* - * FindObject_with_ID_Node - * Get pData item with given ReportID and Node. Return NULL if not found. - * -------------------------------------------------------------------------- */ -HIDData_t *FindObject_with_ID_Node(HIDDesc_t *pDesc_arg, uint8_t ReportID, HIDNode_t Node) -{ - size_t i; - - for (i = 0; i < pDesc_arg->nitems; i++) { - HIDData_t *pData = &pDesc_arg->item[i]; - - if (pData->ReportID != ReportID) { - continue; - } - - HIDPath_t * pPath = &pData->Path; - uint8_t size = pPath->Size; - if (size == 0 || pPath->Node[size-1] != Node) { - continue; - } - - return pData; - } - + return NULL; } /* * GetValue * Extract data from a report stored in Buf. - * Use Offset, Size, LogMin, and LogMax of pData. - * Return response in *pValue. + * Use Value, Offset, Size and LogMax of pData. + * Return response in Value. * -------------------------------------------------------------------------- */ void GetValue(const unsigned char *Buf, HIDData_t *pData, long *pValue) { - /* Note: https://github.com/networkupstools/nut/issues/1023 - This conversion code can easily be sensitive to 32- vs 64- bit - compilation environments. Consider the possibility of overflow - in 32-bit representations when computing with extreme values, - for example LogMax-LogMin+1. - Test carefully in both environments if changing any declarations. - */ - int Weight, Bit; - unsigned long mask, signbit, magMax, magMin; - long value = 0; + long value = 0, rawvalue; + long range, mask, signbit, b, m; Bit = pData->Offset + 8; /* First byte of report is report ID */ - + for (Weight = 0; Weight < pData->Size; Weight++, Bit++) { int State = Buf[Bit >> 3] & (1 << (Bit & 7)); - + if(State) { - value += (1L << Weight); + value += (1 << Weight); } } @@ -521,25 +465,49 @@ void GetValue(const unsigned char *Buf, HIDData_t *pData, long *pValue) "throwing away higher-order bits" exacly means, so we try to do something sensible. -PS */ - /* determine representation without sign bit */ - magMax = pData->LogMax >= 0 ? (unsigned long)(pData->LogMax) : (unsigned long)(-(pData->LogMax + 1)); - magMin = pData->LogMin >= 0 ? (unsigned long)(pData->LogMin) : (unsigned long)(-(pData->LogMin + 1)); + rawvalue = value; /* remember this for later */ - /* calculate where the sign bit will be if needed */ - signbit = 1L << hibit(magMax > magMin ? magMax : magMin); + /* figure out how many bits are significant */ + range = pData->LogMax - pData->LogMin + 1; + if (range <= 0) { + /* makes no sense, give up */ + *pValue = value; + return; + } + b = hibit(range-1); - /* but only include sign bit in mask if negative numbers are involved */ - mask = (signbit - 1) | ((pData->LogMin < 0) ? signbit : 0); - - /* throw away excess high order bits (which may contain garbage) */ - value = (long)((unsigned long)(value) & mask); + /* throw away insignificant bits; the result is >= 0 */ + mask = (1 << b) - 1; + signbit = 1 << (b - 1); + value = value & mask; /* sign-extend it, if appropriate */ - if (pData->LogMin < 0 && ((unsigned long)(value) & signbit) != 0) { + if (pData->LogMin < 0 && (value & signbit) != 0) { value |= ~mask; } - /* clamp returned value to range [LogMin..LogMax] */ + /* if the resulting value is in the desired range, stop */ + if (value >= pData->LogMin && value <= pData->LogMax) { + *pValue = value; + return; + } + + /* else, try to reach interval by adjusting high-order bits */ + m = (value - pData->LogMin) & mask; + value = pData->LogMin + m; + if (value <= pData->LogMax) { + *pValue = value; + return; + } + + /* if everything else failed, sign-extend the original raw value, + and simply round it to the closest point in the interval. */ + value = rawvalue; + mask = (1 << pData->Size) - 1; + signbit = 1 << (pData->Size - 1); + if (pData->LogMin < 0 && (value & signbit) != 0) { + value |= ~mask; + } if (value < pData->LogMin) { value = pData->LogMin; } else if (value > pData->LogMax) { @@ -558,11 +526,11 @@ void GetValue(const unsigned char *Buf, HIDData_t *pData, long *pValue) void SetValue(const HIDData_t *pData, unsigned char *Buf, long Value) { int Weight, Bit; - + Bit = pData->Offset + 8; /* First byte of report is report ID */ for (Weight = 0; Weight < pData->Size; Weight++, Bit++) { - long State = Value & (1L << Weight); + int State = Value & (1 << Weight); if (State) { Buf[Bit >> 3] |= (1 << (Bit & 7)); @@ -578,109 +546,73 @@ void SetValue(const HIDData_t *pData, unsigned char *Buf, long Value) Output: parsed data structure. Returns allocated HIDDesc structure on success, NULL on failure with errno set. Note: the value returned by this function must be freed with Free_ReportDesc(). */ -HIDDesc_t *Parse_ReportDesc(const usb_ctrl_charbuf ReportDesc, const usb_ctrl_charbufsize n) +HIDDesc_t *Parse_ReportDesc(const unsigned char *ReportDesc, const int n) { - int ret = 0; - HIDDesc_t *pDesc_var; + int ret; + HIDDesc_t *pDesc; HIDParser_t *parser; - pDesc_var = calloc(1, sizeof(*pDesc_var)); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if (!pDesc_var - || n < 0 || (uintmax_t)n > SIZE_MAX - ) { + pDesc = calloc(1, sizeof(*pDesc)); + if (!pDesc) { return NULL; } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - pDesc_var->item = calloc(MAX_REPORT, sizeof(*pDesc_var->item)); - if (!pDesc_var->item) { - Free_ReportDesc(pDesc_var); + pDesc->item = calloc(MAX_REPORT, sizeof(*pDesc->item)); + if (!pDesc->item) { + Free_ReportDesc(pDesc); return NULL; } parser = calloc(1, sizeof(*parser)); if (!parser) { - Free_ReportDesc(pDesc_var); + Free_ReportDesc(pDesc); return NULL; } - parser->ReportDesc = (const unsigned char *)ReportDesc; - parser->ReportDescSize = (const size_t)n; + parser->ReportDesc = ReportDesc; + parser->ReportDescSize = n; - for (pDesc_var->nitems = 0; pDesc_var->nitems < MAX_REPORT; pDesc_var->nitems += (size_t)ret) { - uint8_t id; - size_t max; + for (pDesc->nitems = 0; pDesc->nitems < MAX_REPORT; pDesc->nitems += ret) { + int id, max; - ret = HIDParse(parser, &pDesc_var->item[pDesc_var->nitems]); + ret = HIDParse(parser, &pDesc->item[pDesc->nitems]); if (ret < 0) { break; } - id = pDesc_var->item[pDesc_var->nitems].ReportID; + id = pDesc->item[pDesc->nitems].ReportID; /* calculate bit range of this item within report */ - max = pDesc_var->item[pDesc_var->nitems].Offset + pDesc_var->item[pDesc_var->nitems].Size; + max = pDesc->item[pDesc->nitems].Offset + pDesc->item[pDesc->nitems].Size; /* convert to bytes */ max = (max + 7) >> 3; /* update report length */ - if (max > pDesc_var->replen[id]) { - pDesc_var->replen[id] = max; + if (max > pDesc->replen[id]) { + pDesc->replen[id] = max; } } - /* Sanity check: are there remaining HID objects that can't - * be processed? */ - if ((pDesc_var->nitems == MAX_REPORT) && (parser->Pos < parser->ReportDescSize)) - upslogx(LOG_ERR, "ERROR in %s: Too many HID objects", __func__); - free(parser); - if (pDesc_var->nitems == 0) { - Free_ReportDesc(pDesc_var); + if (pDesc->nitems == 0) { + Free_ReportDesc(pDesc); return NULL; } - pDesc_var->item = realloc(pDesc_var->item, pDesc_var->nitems * sizeof(*pDesc_var->item)); + pDesc->item = realloc(pDesc->item, pDesc->nitems * sizeof(*pDesc->item)); - return pDesc_var; + return pDesc; } /* free a parsed report descriptor, as allocated by Parse_ReportDesc() */ -void Free_ReportDesc(HIDDesc_t *pDesc_arg) +void Free_ReportDesc(HIDDesc_t *pDesc) { - if (!pDesc_arg) { + if (!pDesc) { return; } - free(pDesc_arg->item); - free(pDesc_arg); + free(pDesc->item); + free(pDesc); } diff --git a/drivers/hidparser.h b/drivers/hidparser.h index 1a2a3a7..5c91d6f 100644 --- a/drivers/hidparser.h +++ b/drivers/hidparser.h @@ -22,8 +22,8 @@ * * -------------------------------------------------------------------------- */ -#ifndef NUT_HID_PARSER_H_SEEN -#define NUT_HID_PARSER_H_SEEN +#ifndef HIDPARS_H +#define HIDPARS_H #ifdef __cplusplus @@ -32,38 +32,27 @@ extern "C" { /* *INDENT-ON* */ #endif /* __cplusplus */ -#include "config.h" #include "hidtypes.h" -/* Include "usb-common.h" or "libshut.h" as appropriate, to define the - * usb_ctrl_* types used below according to the backend USB API version - */ -#ifdef SHUT_MODE -# include "libshut.h" -#else -# include "usb-common.h" -#endif - /* * Parse_ReportDesc * -------------------------------------------------------------------------- */ -HIDDesc_t *Parse_ReportDesc(const usb_ctrl_charbuf ReportDesc, const usb_ctrl_charbufsize n); +HIDDesc_t *Parse_ReportDesc(const unsigned char *ReportDesc, const int n); /* * Free_ReportDesc * -------------------------------------------------------------------------- */ -void Free_ReportDesc(HIDDesc_t *pDesc_arg); +void Free_ReportDesc(HIDDesc_t *pDesc); /* * FindObject * -------------------------------------------------------------------------- */ -int FindObject(HIDDesc_t *pDesc_arg, HIDData_t *pData); +int FindObject(HIDDesc_t *pDesc, HIDData_t *pData); -HIDData_t *FindObject_with_Path(HIDDesc_t *pDesc_arg, HIDPath_t *Path, uint8_t Type); +HIDData_t *FindObject_with_Path(HIDDesc_t *pDesc, HIDPath_t *Path, uint8_t Type); -HIDData_t *FindObject_with_ID(HIDDesc_t *pDesc_arg, uint8_t ReportID, uint8_t Offset, uint8_t Type); +HIDData_t *FindObject_with_ID(HIDDesc_t *pDesc, uint8_t ReportID, uint8_t Offset, uint8_t Type); -HIDData_t *FindObject_with_ID_Node(HIDDesc_t *pDesc_arg, uint8_t ReportID, HIDNode_t Node); /* * GetValue * -------------------------------------------------------------------------- */ @@ -81,4 +70,4 @@ void SetValue(const HIDData_t *pData, unsigned char *Buf, long Value); /* *INDENT-ON* */ #endif /* __cplusplus */ -#endif /* NUT_HID_PARSER_H_SEEN */ +#endif diff --git a/drivers/hidtypes.h b/drivers/hidtypes.h index 87d42df..f7e2581 100644 --- a/drivers/hidtypes.h +++ b/drivers/hidtypes.h @@ -5,7 +5,6 @@ * * Copyright (C) * 1998-2003 MGE UPS SYSTEMS, Luc Descotils - * 2015 Eaton, Arnaud Quette (Update MAX_REPORT) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,11 +38,11 @@ extern "C" { /* * Constants * -------------------------------------------------------------------------- */ -#define PATH_SIZE 10 /* Deep max for Path */ -#define USAGE_TAB_SIZE 50 /* Size of usage stack */ -#define MAX_REPORT 500 /* Including FEATURE, INPUT and OUTPUT */ -#define REPORT_DSC_SIZE 6144 /* Size max of Report Descriptor */ -#define MAX_REPORT_TS 3 /* Max time validity of a report */ +#define PATH_SIZE 10 /* Deep max for Path */ +#define USAGE_TAB_SIZE 50 /* Size of usage stack */ +#define MAX_REPORT 300 /* Including FEATURE, INPUT and OUTPUT */ +#define REPORT_DSC_SIZE 6144 /* Size max of Report Descriptor */ +#define MAX_REPORT_TS 3 /* Max time validity of a report */ /* * Items @@ -91,186 +90,6 @@ extern "C" { #define ATTR_DATA_CST 0x01 #define ATTR_NVOL_VOL 0x80 -/* Usage Pages */ -/* For more details, please see docs/hid-subdrivers.txt */ -#define PAGE_POWER_DEVICE 0x84 -#define PAGE_BATTERY_SYSTEM 0x85 - -/* Usage within Power Device page */ -#define USAGE_POW_UNDEFINED 0x00840000 -#define USAGE_POW_I_NAME 0x00840001 -#define USAGE_POW_PRESENT_STATUS 0x00840002 -#define USAGE_POW_CHANGED_STATUS 0x00840003 -#define USAGE_POW_UPS 0x00840004 -#define USAGE_POW_POWER_SUPPLY 0x00840005 -#define USAGE_POW_PERIPHERAL_DEVICE 0x00840006 -#define USAGE_POW_BATTERY_SYSTEM 0x00840010 -#define USAGE_POW_BATTERY_SYSTEM_ID 0x00840011 -#define USAGE_POW_BATTERY 0x00840012 -#define USAGE_POW_BATTERY_ID 0x00840013 -#define USAGE_POW_CHARGER 0x00840014 -#define USAGE_POW_CHARGER_ID 0x00840015 -#define USAGE_POW_POWER_CONVERTER 0x00840016 -#define USAGE_POW_POWER_CONVERTER_ID 0x00840017 -#define USAGE_POW_OUTLET_SYSTEM 0x00840018 -#define USAGE_POW_OUTLET_SYSTEM_ID 0x00840019 -#define USAGE_POW_INPUT 0x0084001A -#define USAGE_POW_INPUT_ID 0x0084001B -#define USAGE_POW_OUTPUT 0x0084001C -#define USAGE_POW_OUTPUT_ID 0x0084001D -#define USAGE_POW_FLOW 0x0084001E -#define USAGE_POW_FLOW_ID 0x0084001F -#define USAGE_POW_OUTLET 0x00840020 -#define USAGE_POW_OUTLET_ID 0x00840021 -#define USAGE_POW_GANG 0x00840022 -#define USAGE_POW_GANG_ID 0x00840023 -#define USAGE_POW_POWER_SUMMARY 0x00840024 -#define USAGE_POW_POWER_SUMMARY_ID 0x00840025 -#define USAGE_POW_VOLTAGE 0x00840030 -#define USAGE_POW_CURRENT 0x00840031 -#define USAGE_POW_FREQUENCY 0x00840032 -#define USAGE_POW_APPARENT_POWER 0x00840033 -#define USAGE_POW_ACTIVE_POWER 0x00840034 -#define USAGE_POW_PERCENT_LOAD 0x00840035 -#define USAGE_POW_TEMPERATURE 0x00840036 -#define USAGE_POW_HUMIDITY 0x00840037 -#define USAGE_POW_BAD_COUNT 0x00840038 -#define USAGE_POW_CONFIG_VOLTAGE 0x00840040 -#define USAGE_POW_CONFIG_CURRENT 0x00840041 -#define USAGE_POW_CONFIG_FREQUENCY 0x00840042 -#define USAGE_POW_CONFIG_APPARENT_POWER 0x00840043 -#define USAGE_POW_CONFIG_ACTIVE_POWER 0x00840044 -#define USAGE_POW_CONFIG_PERCENT_LOAD 0x00840045 -#define USAGE_POW_CONFIG_TEMPERATURE 0x00840046 -#define USAGE_POW_CONFIG_HUMIDITY 0x00840047 -#define USAGE_POW_SWITCH_ON_CONTROL 0x00840050 -#define USAGE_POW_SWITCH_OFF_CONTROL 0x00840051 -#define USAGE_POW_TOGGLE_CONTROL 0x00840052 -#define USAGE_POW_LOW_VOLTAGE_TRANSFER 0x00840053 -#define USAGE_POW_HIGH_VOLTAGE_TRANSFER 0x00840054 -#define USAGE_POW_DELAY_BEFORE_REBOOT 0x00840055 -#define USAGE_POW_DELAY_BEFORE_STARTUP 0x00840056 -#define USAGE_POW_DELAY_BEFORE_SHUTDOWN 0x00840057 -#define USAGE_POW_TEST 0x00840058 -#define USAGE_POW_MODULE_RESET 0x00840059 -#define USAGE_POW_AUDIBLE_ALARM_CONTROL 0x0084005A -#define USAGE_POW_PRESENT 0x00840060 -#define USAGE_POW_GOOD 0x00840061 -#define USAGE_POW_INTERNAL_FAILURE 0x00840062 -#define USAGE_POW_VOLTAGE_OUT_OF_RANGE 0x00840063 -#define USAGE_POW_FREQUENCY_OUT_OF_RANGE 0x00840064 -#define USAGE_POW_OVERLOAD 0x00840065 -#define USAGE_POW_OVER_CHARGED 0x00840066 -#define USAGE_POW_OVER_TEMPERATURE 0x00840067 -#define USAGE_POW_SHUTDOWN_REQUESTED 0x00840068 -#define USAGE_POW_SHUTDOWN_IMMINENT 0x00840069 -#define USAGE_POW_SWITCH_ON_OFF 0x0084006B -#define USAGE_POW_SWITCHABLE 0x0084006C -#define USAGE_POW_USED 0x0084006D -#define USAGE_POW_BOOST 0x0084006E -#define USAGE_POW_BUCK 0x0084006F -#define USAGE_POW_INITIALIZED 0x00840070 -#define USAGE_POW_TESTED 0x00840071 -#define USAGE_POW_AWAITING_POWER 0x00840072 -#define USAGE_POW_COMMUNICATION_LOST 0x00840073 -#define USAGE_POW_I_MANUFACTURER 0x008400FD -#define USAGE_POW_I_PRODUCT 0x008400FE -#define USAGE_POW_I_SERIAL_NUMBER 0x008400FF - -/* Usage within Battery System page */ -#define USAGE_BAT_UNDEFINED 0x00850000 -#define USAGE_BAT_SMB_BATTERY_MODE 0x00850001 -#define USAGE_BAT_SMB_BATTERY_STATUS 0x00850002 -#define USAGE_BAT_SMB_ALARM_WARNING 0x00850003 -#define USAGE_BAT_SMB_CHARGER_MODE 0x00850004 -#define USAGE_BAT_SMB_CHARGER_STATUS 0x00850005 -#define USAGE_BAT_SMB_CHARGER_SPEC_INFO 0x00850006 -#define USAGE_BAT_SMB_SELECTOR_STATE 0x00850007 -#define USAGE_BAT_SMB_SELECTOR_PRESETS 0x00850008 -#define USAGE_BAT_SMB_SELECTOR_INFO 0x00850009 -#define USAGE_BAT_OPTIONAL_MFG_FUNCTION_1 0x00850010 -#define USAGE_BAT_OPTIONAL_MFG_FUNCTION_2 0x00850011 -#define USAGE_BAT_OPTIONAL_MFG_FUNCTION_3 0x00850012 -#define USAGE_BAT_OPTIONAL_MFG_FUNCTION_4 0x00850013 -#define USAGE_BAT_OPTIONAL_MFG_FUNCTION_5 0x00850014 -#define USAGE_BAT_CONNECTION_TO_SMBUS 0x00850015 -#define USAGE_BAT_OUTPUT_CONNECTION 0x00850016 -#define USAGE_BAT_CHARGER_CONNECTION 0x00850017 -#define USAGE_BAT_BATTERY_INSERTION 0x00850018 -#define USAGE_BAT_USE_NEXT 0x00850019 -#define USAGE_BAT_OK_TO_USE 0x0085001A -#define USAGE_BAT_BATTERY_SUPPORTED 0x0085001B -#define USAGE_BAT_SELECTOR_REVISION 0x0085001C -#define USAGE_BAT_CHARGING_INDICATOR 0x0085001D -#define USAGE_BAT_MANUFACTURER_ACCESS 0x00850028 -#define USAGE_BAT_REMAINING_CAPACITY_LIMIT 0x00850029 -#define USAGE_BAT_REMAINING_TIME_LIMIT 0x0085002A -#define USAGE_BAT_AT_RATE 0x0085002B -#define USAGE_BAT_CAPACITY_MODE 0x0085002C -#define USAGE_BAT_BROADCAST_TO_CHARGER 0x0085002D -#define USAGE_BAT_PRIMARY_BATTERY 0x0085002E -#define USAGE_BAT_CHARGE_CONTROLLER 0x0085002F -#define USAGE_BAT_TERMINATE_CHARGE 0x00850040 -#define USAGE_BAT_TERMINATE_DISCHARGE 0x00850041 -#define USAGE_BAT_BELOW_REMAINING_CAPACITY_LIMIT 0x00850042 -#define USAGE_BAT_REMAINING_TIME_LIMIT_EXPIRED 0x00850043 -#define USAGE_BAT_CHARGING 0x00850044 -#define USAGE_BAT_DISCHARGING 0x00850045 -#define USAGE_BAT_FULLY_CHARGED 0x00850046 -#define USAGE_BAT_FULLY_DISCHARGED 0x00850047 -#define USAGE_BAT_CONDITIONING_FLAG 0x00850048 -#define USAGE_BAT_AT_RATE_OK 0x00850049 -#define USAGE_BAT_SMB_ERROR_CODE 0x0085004A -#define USAGE_BAT_NEED_REPLACEMENT 0x0085004B -#define USAGE_BAT_AT_RATE_TIME_TO_FULL 0x00850060 -#define USAGE_BAT_AT_RATE_TIME_TO_EMPTY 0x00850061 -#define USAGE_BAT_AVERAGE_CURRENT 0x00850062 -#define USAGE_BAT_MAX_ERROR 0x00850063 -#define USAGE_BAT_RELATIVE_STATE_OF_CHARGE 0x00850064 -#define USAGE_BAT_ABSOLUTE_STATE_OF_CHARGE 0x00850065 -#define USAGE_BAT_REMAINING_CAPACITY 0x00850066 -#define USAGE_BAT_FULL_CHARGE_CAPACITY 0x00850067 -#define USAGE_BAT_RUN_TIME_TO_EMPTY 0x00850068 -#define USAGE_BAT_AVERAGE_TIME_TO_EMPTY 0x00850069 -#define USAGE_BAT_AVERAGE_TIME_TO_FULL 0x0085006A -#define USAGE_BAT_CYCLE_COUNT 0x0085006B -#define USAGE_BAT_BATT_PACK_MODEL_LEVEL 0x00850080 -#define USAGE_BAT_INTERNAL_CHARGE_CONTROLLER 0x00850081 -#define USAGE_BAT_PRIMARY_BATTERY_SUPPORT 0x00850082 -#define USAGE_BAT_DESIGN_CAPACITY 0x00850083 -#define USAGE_BAT_SPECIFICATION_INFO 0x00850084 -#define USAGE_BAT_MANUFACTURER_DATE 0x00850085 -#define USAGE_BAT_SERIAL_NUMBER 0x00850086 -#define USAGE_BAT_I_MANUFACTURER_NAME 0x00850087 -#define USAGE_BAT_I_DEVICE_NAME 0x00850088 -#define USAGE_BAT_I_DEVICE_CHEMISTRY 0x00850089 -#define USAGE_BAT_MANUFACTURER_DATA 0x0085008A -#define USAGE_BAT_RECHARGEABLE 0x0085008B -#define USAGE_BAT_WARNING_CAPACITY_LIMIT 0x0085008C -#define USAGE_BAT_CAPACITY_GRANULARITY_1 0x0085008D -#define USAGE_BAT_CAPACITY_GRANULARITY_2 0x0085008E -#define USAGE_BAT_I_OEMINFORMATION 0x0085008F -#define USAGE_BAT_INHIBIT_CHARGE 0x008500C0 -#define USAGE_BAT_ENABLE_POLLING 0x008500C1 -#define USAGE_BAT_RESET_TO_ZERO 0x008500C2 -#define USAGE_BAT_AC_PRESENT 0x008500D0 -#define USAGE_BAT_BATTERY_PRESENT 0x008500D1 -#define USAGE_BAT_POWER_FAIL 0x008500D2 -#define USAGE_BAT_ALARM_INHIBITED 0x008500D3 -#define USAGE_BAT_THERMISTOR_UNDER_RANGE 0x008500D4 -#define USAGE_BAT_THERMISTOR_HOT 0x008500D5 -#define USAGE_BAT_THERMISTOR_COLD 0x008500D6 -#define USAGE_BAT_THERMISTOR_OVER_RANGE 0x008500D7 -#define USAGE_BAT_VOLTAGE_OUT_OF_RANGE 0x008500D8 -#define USAGE_BAT_CURRENT_OUT_OF_RANGE 0x008500D9 -#define USAGE_BAT_CURRENT_NOT_REGULATED 0x008500DA -#define USAGE_BAT_VOLTAGE_NOT_REGULATED 0x008500DB -#define USAGE_BAT_MASTER_MODE 0x008500DC -#define USAGE_BAT_CHARGER_SELECTOR_SUPPORT 0x008500F0 -#define USAGE_BAT_CHARGER_SPEC 0x008500F1 -#define USAGE_BAT_LEVEL_2 0x008500F2 -#define USAGE_BAT_LEVEL_3 0x008500F3 - /* * HIDNode_t struct * @@ -291,7 +110,7 @@ typedef struct { /* * HIDData struct * - * Describe a HID Data with its location in report + * Describe a HID Data with its location in report * -------------------------------------------------------------------------- */ typedef struct { HIDPath_t Path; /* HID Path */ @@ -320,9 +139,9 @@ typedef struct { * Holds a parsed report descriptor * -------------------------------------------------------------------------- */ typedef struct { - size_t nitems; /* number of items in descriptor */ + int nitems; /* number of items in descriptor */ HIDData_t *item; /* list of items */ - size_t replen[256]; /* list of report lengths, in byte */ + int replen[256]; /* list of report lengths, in byte */ } HIDDesc_t; #ifdef __cplusplus diff --git a/drivers/hpe-pdu-mib.c b/drivers/hpe-pdu-mib.c deleted file mode 100644 index bf42987..0000000 --- a/drivers/hpe-pdu-mib.c +++ /dev/null @@ -1,899 +0,0 @@ -/* hpe-pdu-mib.c - subdriver to monitor HPE ePDU SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2016 Arnaud Quette - * 2019 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "hpe-pdu-mib.h" -#include "dstate.h" - -#define HPE_EPDU_MIB_VERSION "0.33" -#define HPE_EPDU_MIB_SYSOID ".1.3.6.1.4.1.232.165.7" -#define HPE_EPDU_OID_MODEL_NAME ".1.3.6.1.4.1.232.165.7.1.2.1.3.0" - -static info_lkp_t hpe_pdu_outlet_status_info[] = { - { 1, "off", NULL, NULL }, - { 2, "on", NULL, NULL }, - { 3, "pendingOff", NULL, NULL }, /* transitional status */ - { 4, "pendingOn", NULL, NULL }, /* transitional status */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_outletgroups_status_info[] = { - { 1, "N/A", NULL, NULL }, /* notApplicable, if group.type == outlet-section */ - { 2, "on", NULL, NULL }, /* breakerOn */ - { 3, "off", NULL, NULL }, /* breakerOff */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_outlet_switchability_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "no", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* The physical type of outlet */ -static info_lkp_t hpe_pdu_outlet_type_info[] = { - { 0, "unknown", NULL, NULL }, - { 1, "iecC13", NULL, NULL }, - { 2, "iecC19", NULL, NULL }, - { 10, "uk", NULL, NULL }, - { 11, "french", NULL, NULL }, - { 12, "schuko", NULL, NULL }, - { 20, "nema515", NULL, NULL }, - { 21, "nema51520", NULL, NULL }, - { 22, "nema520", NULL, NULL }, - { 23, "nemaL520", NULL, NULL }, - { 24, "nemaL530", NULL, NULL }, - { 25, "nema615", NULL, NULL }, - { 26, "nema620", NULL, NULL }, - { 27, "nemaL620", NULL, NULL }, - { 28, "nemaL630", NULL, NULL }, - { 29, "nemaL715", NULL, NULL }, - { 30, "rf203p277", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_ambient_presence_info[] = { - { -1, "unknown", NULL, NULL }, - { 1, "no", NULL, NULL }, /* disconnected */ - { 2, "yes", NULL, NULL }, /* connected */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "warning-low", NULL, NULL }, /* Warning low threshold triggered */ - { 3, "critical-low", NULL, NULL }, /* Critical low threshold triggered */ - { 4, "warning-high", NULL, NULL }, /* Warning high threshold triggered */ - { 5, "critical-high", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_frequency_status_info[] = { - { 1, "good", NULL, NULL }, /* No threshold triggered */ - { 2, "out-of-range", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 0, "unknown", NULL, NULL }, - { 1, "open", NULL, NULL }, - { 2, "closed", NULL, NULL }, - { 3, "bad", NULL, NULL }, /* FIXME: what to do with that? */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_voltage_alarms_info[] = { - { 1, "", NULL, NULL }, /* No threshold triggered */ - { 2, "low voltage warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 3, "low voltage critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 4, "high voltage warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 5, "high voltage critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_current_alarms_info[] = { - { 1, "", NULL, NULL }, /* No threshold triggered */ - { 2, "low current warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 3, "low current critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 4, "high current warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 5, "high current critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_frequency_alarm_info[] = { - { 1, "", NULL, NULL }, /* No threshold triggered */ - { 2, "frequency out of range!", NULL, NULL }, /* Frequency out of range triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_temperature_alarms_info[] = { - { 1, "", NULL, NULL }, /* No threshold triggered */ - { 2, "low temperature warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 3, "low temperature critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 4, "high temperature warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 5, "high temperature critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_threshold_humidity_alarms_info[] = { - { 1, "", NULL, NULL }, /* No threshold triggered */ - { 2, "low humidity warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 3, "low humidity critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 4, "high humidity warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 5, "high humidity critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_outlet_group_type_info[] = { - { 0, "unknown", NULL, NULL }, - { 1, "unknown", NULL, NULL }, - { 2, "breaker1pole", NULL, NULL }, - { 3, "breaker2pole", NULL, NULL }, - { 4, "breaker3pole", NULL, NULL }, - { 5, "outlet-section", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_input_type_info[] = { - { 1, "1", NULL, NULL }, /* singlePhase */ - { 2, "2", NULL, NULL }, /* splitPhase */ - { 3, "3", NULL, NULL }, /* threePhaseDelta */ - { 4, "3", NULL, NULL }, /* threePhaseWye */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t hpe_pdu_outlet_group_phase_info[] = { - { 1, "L1", NULL, NULL }, /* singlePhase */ - { 2, "L1", NULL, NULL }, /* phase1toN */ - { 3, "L2", NULL, NULL }, /* phase2toN */ - { 4, "L3", NULL, NULL }, /* phase3toN */ - { 5, "L1", NULL, NULL }, /* phase1to2 */ - { 6, "L2", NULL, NULL }, /* phase2to3 */ - { 7, "L3", NULL, NULL }, /* phase3to1 */ - { 0, NULL, NULL, NULL } -}; - -/* Snmp2NUT lookup table for HPE PDU MIB */ -static snmp_info_t hpe_pdu_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* Device collection */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "HPE", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* pdu2Model.0 = STRING: "HP 8.6kVA 208V 30A 3Ph NA/JP maPDU" */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.3.%i", - "HPE ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* pdu2SerialNumber.0 = STRING: "CN94230105" */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.7.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* pdu2PartNumber.0 = STRING: "H8B52A" */ - { "device.part", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.6.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* For daisychain, there is only 1 physical interface! */ - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.2.2.1.6.2", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* Daisychained devices support - * Notes: this definition is used to: - * - estimate the number of devices, based on the below OID iteration capabilities - * - determine the base index of the SNMP OID (ie 0 or 1) */ - /* pdu2NumberPDU.0 = INTEGER: 1 */ - { "device.count", 0, 1, - ".1.3.6.1.4.1.232.165.7.1.1.0", - "1", SU_FLAG_STATIC, NULL }, - - /* UPS collection */ - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "HPE", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.3.%i", - "HPE ePDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* FIXME: use unitName.0 (ePDU)? - * { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, AR_OID_DEVICE_NAME, - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, */ - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.7.%i", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: this entry should be SU_FLAG_SEMI_STATIC */ - /* pdu2FirmwareVersion.0 = STRING: "02.00.0043" */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.1.2.1.5.%i", - "", SU_FLAG_OK, NULL }, - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - - /* FIXME: needs a date reformating callback - * 2011-8-29,16:27:25.0,+1:0 - * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 - * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", - "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - */ - - /* Input collection */ - /* Note: for daisychain mode, we must handle phase(s) per device, not as a whole */ - /* pdu2InputType.0 = INTEGER: threePhaseWye(4) */ - { "input.phases", 0, 1, ".1.3.6.1.4.1.232.165.7.2.1.1.1.%i", - NULL, SU_FLAG_STATIC, &hpe_pdu_input_type_info[0] }, - - /* Frequency is measured globally */ - /* pdu2InputFrequency.0 = INTEGER: 500 */ - { "input.frequency", 0, 0.1, ".1.3.6.1.4.1.232.165.7.2.1.1.2.%i", - NULL, 0, NULL }, - /* pdu2InputFrequencyStatus.0 = INTEGER: good(1) */ - { "input.frequency.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.1.1.3.%i", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_frequency_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.1.1.3.%i", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_frequency_alarm_info[0] }, - /* inputCurrentPercentLoad (measured globally) - * Current percent load, based on the rated current capacity */ - /* FIXME: input.load is mapped on input.L1.load for both single and 3phase !!! */ - { "input.load", 0, 1.0, ".1.3.6.1.4.1.534.6.6.7.3.3.1.11.%i.1.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhaseCurrentPercentLoad.0.1 = INTEGER: 0 */ - { "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhaseCurrentPercentLoad.0.2 = INTEGER: 0 */ - { "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhaseCurrentPercentLoad.0.3 = INTEGER: 0 */ - { "input.L1.load", 0, 1.0, ".1.3.6.1.4.1.232.165.7.2.2.1.18.%i.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* FIXME: - * - Voltage is only measured per phase, as mV! - * so input.voltage == input.L1.voltage for both single and 3phase - * - As per NUT namespace (http://www.networkupstools.org/docs/developer-guide.chunked/apas01.html#_valid_contexts) - * Voltage has to be expressed either phase-phase or phase-neutral - * This is depending on OID inputVoltageMeasType - * INTEGER {singlePhase (1),phase1toN (2),phase2toN (3),phase3toN (4),phase1to2 (5),phase2to3 (6),phase3to1 (7) - * => RFC input.Lx.voltage.context */ - /* pdu2InputPhaseVoltage.0.1 = INTEGER: 216790 */ - { "input.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.1", - NULL, 0, NULL }, - /* pdu2InputPhaseVoltageThStatus.0.1 = INTEGER: good(1) */ - { "input.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] }, - /* pdu2InputPhaseVoltageThLowerWarning.0.1 = INTEGER: 190000 */ - { "input.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThLowerCritical.0.1 = INTEGER: 180000 */ - { "input.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperWarning.0.1 = INTEGER: 255000 */ - { "input.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperCritical.0.1 = INTEGER: 265000 */ - { "input.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltage.0.1 = INTEGER: 216790 */ - { "input.L1.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.1", - NULL, 0, NULL }, - /* pdu2InputPhaseVoltageThStatus.0.1 = INTEGER: good(1) */ - { "input.L1.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] }, - /* pdu2InputPhaseVoltageThLowerWarning.0.1 = INTEGER: 190000 */ - { "input.L1.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThLowerCritical.0.1 = INTEGER: 180000 */ - { "input.L1.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperWarning.0.1 = INTEGER: 255000 */ - { "input.L1.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperCritical.0.1 = INTEGER: 265000 */ - { "input.L1.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltage.0.2 = INTEGER: 216790 */ - { "input.L2.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.2", - NULL, 0, NULL }, - /* pdu2InputPhaseVoltageThStatus.0.2 = INTEGER: good(1) */ - { "input.L2.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] }, - /* pdu2InputPhaseVoltageThLowerWarning.0.2 = INTEGER: 190000 */ - { "input.L2.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThLowerCritical.0.2 = INTEGER: 180000 */ - { "input.L2.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperWarning.0.2 = INTEGER: 255000 */ - { "input.L2.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperCritical.0.2 = INTEGER: 265000 */ - { "input.L2.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltage.0.3 = INTEGER: 216790 */ - { "input.L3.voltage", 0, 0.001, ".1.3.6.1.4.1.232.165.7.2.2.1.3.%i.3", - NULL, 0, NULL }, - /* pdu2InputPhaseVoltageThStatus.0.3 = INTEGER: good(1) */ - { "input.L3.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.3", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L3.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.4.%i.3", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_voltage_alarms_info[0] }, - /* pdu2InputPhaseVoltageThLowerWarning.0.3 = INTEGER: 190000 */ - { "input.L3.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.5.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThLowerCritical.0.3 = INTEGER: 180000 */ - { "input.L3.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.6.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperWarning.0.3 = INTEGER: 255000 */ - { "input.L3.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.7.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseVoltageThUpperCritical.0.3 = INTEGER: 265000 */ - { "input.L3.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.8.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* FIXME: - * - input.current is mapped on input.L1.current for both single and 3phase !!! */ - /* pdu2InputPhaseCurrent.0.1 = INTEGER: 185 */ - { "input.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.1", - NULL, 0, NULL }, - /* pdu2InputPhaseCurrentRating.0.1 = INTEGER: 24000 */ - { "input.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThStatus.0.1 = INTEGER: good(1) */ - { "input.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2InputPhaseCurrentThLowerWarning.0.1 = INTEGER: 0 */ - { "input.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThLowerCritical.0.1 = INTEGER: -1 */ - { "input.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperWarning.0.1 = INTEGER: 19200 */ - { "input.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperCritical.0.1 = INTEGER: 24000 */ - { "input.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrent.0.1 = INTEGER: 185 */ - { "input.L1.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.1", - NULL, 0, NULL }, - /* pdu2InputPhaseCurrentRating.0.1 = INTEGER: 24000 */ - { "input.L1.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThStatus.0.1 = INTEGER: good(1) */ - { "input.L1.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L1.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2InputPhaseCurrentThLowerWarning.0.1 = INTEGER: 0 */ - { "input.L1.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThLowerCritical.0.1 = INTEGER: -1 */ - { "input.L1.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperWarning.0.1 = INTEGER: 19200 */ - { "input.L1.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperCritical.0.1 = INTEGER: 24000 */ - { "input.L1.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.1", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrent.0.2 = INTEGER: 185 */ - { "input.L2.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.2", - NULL, 0, NULL }, - /* pdu2InputPhaseCurrentRating.0.2 = INTEGER: 24000 */ - { "input.L2.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThStatus.0.2 = INTEGER: good(1) */ - { "input.L2.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2InputPhaseCurrentThLowerWarning.0.2 = INTEGER: 0 */ - { "input.L2.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThLowerCritical.0.2 = INTEGER: -1 */ - { "input.L2.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperWarning.0.2 = INTEGER: 19200 */ - { "input.L2.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperCritical.0.2 = INTEGER: 24000 */ - { "input.L2.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.2", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrent.0.3 = INTEGER: 185 */ - { "input.L3.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.11.%i.3", - NULL, 0, NULL }, - /* pdu2InputPhaseCurrentRating.0.3 = INTEGER: 24000 */ - { "input.L3.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.10.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThStatus.0.3 = INTEGER: good(1) */ - { "input.L3.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.3", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "L2.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.2.2.1.12.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2InputPhaseCurrentThLowerWarning.0.3 = INTEGER: 0 */ - { "input.L3.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.13.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThLowerCritical.0.3 = INTEGER: -1 */ - { "input.L3.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.14.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperWarning.0.3 = INTEGER: 19200 */ - { "input.L3.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.15.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPhaseCurrentThUpperCritical.0.3 = INTEGER: 24000 */ - { "input.L3.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.2.2.1.16.%i.3", - NULL, SU_FLAG_NEGINVALID, NULL }, - /* pdu2InputPowerWatts.0 = INTEGER: 19 */ - { "input.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.1.1.5.%i", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerWatts.0.1 = INTEGER: 19 */ - { "input.L1.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerWatts.0.2 = INTEGER: 0 */ - { "input.L2.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerWatts.0.3 = INTEGER: 0 */ - { "input.L3.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.21.%i.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* Sum of all phases apparent power, valid for Shark 1ph/3ph only */ - /* pdu2InputPowerVA.0 = INTEGER: 39 */ - { "input.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.1.1.4.%i", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_UNIQUE | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerVA.0.1 = INTEGER: 40 */ - { "input.L1.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerVA.0.2 = INTEGER: 0 */ - { "input.L2.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.2", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2InputPhasePowerVA.0.3 = INTEGER: 0 */ - { "input.L3.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.2.2.1.20.%i.3", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* TODO: handle statistics */ - /* pdu2InputPowerWattHour.0 = INTEGER: 91819 - { "unmapped.pdu2InputPowerWattHour", 0, 1, ".1.3.6.1.4.1.232.165.7.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, */ - /* pdu2InputPowerWattHourTimer.0 = STRING: "16/10/2017,17:58:53" - { "unmapped.pdu2InputPowerWattHourTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.2.1.1.7.0", NULL, SU_FLAG_OK, NULL }, */ - /* pdu2InputPowerFactor.0 = INTEGER: 483 */ - { "input.powerfactor", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.2.1.1.8.%i", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - - /* Ambient collection */ - /* pdu2TemperatureProbeStatus.0.1 = INTEGER: disconnected(1) */ - { "ambient.present", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.2.1.3.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_ambient_presence_info[0] }, - /* pdu2TemperatureThStatus.0.1 = INTEGER: good(1) */ - { "ambient.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.2.1.5.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.2.1.5.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_temperature_alarms_info[0] }, - /* pdu2TemperatureValue.0.1 = INTEGER: 0 */ - { "ambient.temperature", 0, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.4.%i.1", - NULL, SU_FLAG_OK, NULL }, - /* Low and high threshold use the respective critical levels */ - /* pdu2TemperatureThLowerCritical.0.1 = INTEGER: 50 */ - { "ambient.temperature.low", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2TemperatureThLowerWarning.0.1 = INTEGER: 100 */ - { "ambient.temperature.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2TemperatureThUpperCritical.0.1 = INTEGER: 650 */ - { "ambient.temperature.high", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.temperature.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2TemperatureThUpperWarning.0.1 = INTEGER: 200 */ - { "ambient.temperature.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.2.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2HumidityThStatus.0.1 = INTEGER: good(1) */ - { "ambient.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.3.1.5.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.3.1.5.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_threshold_humidity_alarms_info[0] }, - /* pdu2HumidityValue.0.1 = INTEGER: 0 */ - { "ambient.humidity", 0, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.4.%i.1", - NULL, SU_FLAG_OK, NULL }, - /* Low and high threshold use the respective critical levels */ - /* pdu2HumidityThLowerCritical.0.1 = INTEGER: 100 */ - { "ambient.humidity.low", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.low.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.7.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2HumidityThLowerWarning.0.1 = INTEGER: 200 */ - { "ambient.humidity.low.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.6.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2HumidityThUpperWarning.0.1 = INTEGER: 250 */ - { "ambient.humidity.high.warning", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.8.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* pdu2HumidityThUpperCritical.0.1 = INTEGER: 900 */ - { "ambient.humidity.high", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - { "ambient.humidity.high.critical", ST_FLAG_RW, 0.1, - ".1.3.6.1.4.1.232.165.7.4.3.1.9.%i.1", - NULL, SU_FLAG_NEGINVALID | SU_FLAG_OK, NULL }, - /* Dry contacts on TH module */ - /* pdu2ContactState.0.1 = INTEGER: contactBad(3) */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.4.1.4.%i.1", - NULL, SU_FLAG_OK, &hpe_pdu_ambient_drycontacts_info[0] }, - /* pdu2ContactState.0.2 = INTEGER: contactBad(3) */ - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.4.4.1.4.%i.2", - NULL, SU_FLAG_OK, &hpe_pdu_ambient_drycontacts_info[0] }, - - /* Outlet collection */ - { "outlet.id", 0, 1, NULL, - "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* pdu2OutletCount.0 = INTEGER: 24 */ - { "outlet.count", 0, 1, - ".1.3.6.1.4.1.232.165.7.1.2.1.12.%i", - "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* outlet template definition - * Indexes start from 1, ie outlet.1 => .1 */ - /* Note: the first definition is used to determine the base index (ie 0 or 1) */ - /* pdu2OutletName.0.%i = STRING: "Outlet L1-%i" */ - { "outlet.%i.desc", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.1.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlStatus.0.%i = INTEGER: on(2) */ - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.2.1.1.%i.%i", - NULL, SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_outlet_status_info[0] }, - /* Numeric identifier of the outlet, tied to the whole unit */ - { "outlet.%i.id", 0, 1, NULL, "%i", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - -#if 0 - /* FIXME: the last part of the OID gives the group number (i.e. %i.1 means "group 1") - * Need to address that, without multiple declaration (%i.%i, SU_OUTLET | SU_OUTLET_GROUP)? */ - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.1", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.2", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.3", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.4", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.5", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - { "outlet.%i.groupid", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.6.7.6.2.1.3.%i.%i.6", - NULL, SU_FLAG_STATIC | SU_FLAG_UNIQUE | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, -#endif - - /* pdu2OutletCurrent.0.%i = INTEGER: 0 */ - { "outlet.%i.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.5.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletCurrentThStatus.0.%i = INTEGER: good(1) */ - { "outlet.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.1.1.6.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_threshold_status_info[0] }, - { "outlet.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.1.1.6.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2OutletCurrentThLowerWarning.0.%i = INTEGER: 0 */ - { "outlet.%i.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletCurrentThLowerCritical.0.%i = INTEGER: -1 */ - { "outlet.%i.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletCurrentThUpperWarning.0.1 = INTEGER: 8000 */ - { "outlet.%i.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.9.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletCurrentThUpperCritical.0.1 = INTEGER: 10000 */ - { "outlet.%i.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.10.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletWatts.0.1 = INTEGER: 0 */ - { "outlet.%i.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.5.1.1.14.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletVA.0.%i = INTEGER: 0 */ - { "outlet.%i.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.5.1.1.13.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlSwitchable.0.%i = INTEGER: switchable(1) */ - { "outlet.%i.switchable", ST_FLAG_RW, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.2.1.8.%i.%i", - "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK | SU_TYPE_DAISY_1, - &hpe_pdu_outlet_switchability_info[0] }, - /* pdu2OutletType.0.%i = INTEGER: iecC13(1) */ - { "outlet.%i.type", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.5.1.1.3.%i.%i", - "unknown", SU_FLAG_STATIC | SU_OUTLET | SU_TYPE_DAISY_1, - &hpe_pdu_outlet_type_info[0] }, - /* pdu2OutletPowerFactor.0.%i = INTEGER: 1000 */ - { "outlet.%i.powerfactor", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.5.1.1.17.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* TODO: handle statistics */ - /* pdu2OutletWh.0.1 = INTEGER: 1167 - * Note: setting this to zero resets the counter and timestamp => instcmd ???counter???.reset - { "unmapped.pdu2OutletWh", 0, 1, ".1.3.6.1.4.1.232.165.7.5.1.1.15.%i.%i", NULL, SU_FLAG_OK, NULL }, */ - /* pdu2OutletWhTimer.0.1 = STRING: "25/03/2016,09:03:26" - { "unmapped.pdu2OutletWhTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.5.1.1.16.%i.%i", NULL, SU_FLAG_OK, NULL }, */ - - /* Outlet groups collection */ - /* pdu2GroupCount.0 = INTEGER: 3 */ - { "outlet.group.count", 0, 1, - ".1.3.6.1.4.1.232.165.7.1.2.1.11.%i", - "0", SU_FLAG_STATIC | SU_TYPE_DAISY_1, NULL }, - /* outlet groups template definition - * Indexes start from 1, ie outlet.group.1 => .1 */ - /* Note: the first definition is used to determine the base index (ie 0 or 1) */ - /* pdu2GroupIndex.0.%i = INTEGER: %i */ - { "outlet.group.%i.id", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.1.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupName.0.%i = STRING: "Section L1" */ - { "outlet.group.%i.name", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.2.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupType.0.%i = INTEGER: breaker2pole(3) */ - { "outlet.group.%i.type", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.3.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, &hpe_pdu_outlet_group_type_info[0] }, - /* pdu2GroupVoltageMeasType.0.1 = INTEGER: phase1to2(5) */ - { "outlet.group.%i.phase", 0, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.4.%i.%i", - NULL, SU_FLAG_STATIC | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_outlet_group_phase_info[0] }, - /* pdu2groupBreakerStatus.0.%i = INTEGER: breakerOn(2) */ - { "outlet.group.%i.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.27.%i.%i", - NULL, SU_FLAG_OK | SU_FLAG_NAINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_outletgroups_status_info[0] }, - /* pdu2GroupOutletCount.0.%i = INTEGER: 8 */ - { "outlet.group.%i.count", 0, 1, - ".1.3.6.1.4.1.232.165.7.3.1.1.26.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupVoltage.0.%i = INTEGER: 216760 */ - { "outlet.group.%i.voltage", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.5.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupVoltageThStatus.0.%i = INTEGER: good(1) */ - { "outlet.group.%i.voltage.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.6.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_threshold_status_info[0] }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.6.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_threshold_voltage_alarms_info[0] }, - /* pdu2GroupVoltageThLowerWarning.0.%i = INTEGER: 190000 */ - { "outlet.group.%i.voltage.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.7.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupVoltageThLowerCritical.0.%i = INTEGER: 180000 */ - { "outlet.group.%i.voltage.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.8.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupVoltageThUpperWarning.0.%i = INTEGER: 255000 */ - { "outlet.group.%i.voltage.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.9.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupVoltageThUpperCritical.0.%i = INTEGER: 265000 */ - { "outlet.group.%i.voltage.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.10.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrent.0.%i = INTEGER: 0 */ - { "outlet.group.%i.current", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.12.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2groupCurrentRating.0.%i = INTEGER: 16000 */ - { "outlet.group.%i.current.nominal", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.11.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrentThStatus.0.%i = INTEGER: good(1) */ - { "outlet.group.%i.current.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.13.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_threshold_status_info[0] }, - { "outlet.group.%i.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.232.165.7.3.1.1.13.%i.%i", - NULL, SU_OUTLET_GROUP | SU_TYPE_DAISY_1, - &hpe_pdu_threshold_current_alarms_info[0] }, - /* pdu2GroupCurrentThLowerWarning.0.%i = INTEGER: 0 */ - { "outlet.group.%i.current.low.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.14.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrentThLowerCritical.0.%i = INTEGER: -1 */ - { "outlet.group.%i.current.low.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.15.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrentThUpperWarning.0.%i = INTEGER: 12800 */ - { "outlet.group.%i.current.high.warning", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.16.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrentThUpperCritical.0.%i = INTEGER: 16000 */ - { "outlet.group.%i.current.high.critical", ST_FLAG_RW, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.17.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupCurrentPercentLoad.0.%i = INTEGER: 0 */ - { "outlet.group.%i.load", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.3.1.1.19.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupPowerWatts.0.%i = INTEGER: 0 */ - { "outlet.group.%i.realpower", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.3.1.1.21.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupPowerVA.0.%i = INTEGER: 0 */ - { "outlet.group.%i.power", 0, 1.0, - ".1.3.6.1.4.1.232.165.7.3.1.1.20.%i.%i", - NULL, SU_FLAG_NEGINVALID | SU_OUTLET_GROUP | SU_TYPE_DAISY_1, NULL }, - /* pdu2GroupPowerFactor.0.%i = INTEGER: 1000 */ - { "outlet.group.%i.powerfactor", 0, 0.001, - ".1.3.6.1.4.1.232.165.7.3.1.1.24.%i.%i", - NULL, SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* TODO: handle statistics */ - /* pdu2GroupPowerWattHour.0.%i = INTEGER: 1373 - * Note: setting this to zero resets the counter and timestamp => instcmd .reset - { "unmapped.pdu2GroupPowerWattHour", 0, 1, ".1.3.6.1.4.1.232.165.7.3.1.1.22.%i.%i", NULL, SU_FLAG_OK, NULL }, */ - /* pdu2GroupPowerWattHourTimer.0.%i = STRING: "25/03/2016,09:01:16" - { "unmapped.pdu2GroupPowerWattHourTimer", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.232.165.7.3.1.1.23.%i.%i", NULL, SU_FLAG_OK, NULL }, */ - - /* instant commands. */ - /* TODO: handle delays (outlet.%i.{on,off}.delay) */ - /* pdu2OutletControlOffCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.off", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.2.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlOnCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.on", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.3.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlRebootCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.cycle", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.4.%i.%i", - "0", SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - /* pdu2OutletControlOffCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.off.delay", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.2.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlOnCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.on.delay", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.3.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - /* pdu2OutletControlRebootCmd.0.%i = INTEGER: -1 */ - { "outlet.%i.load.cycle.delay", 0, 1, - ".1.3.6.1.4.1.232.165.7.5.2.1.4.%i.%i", - NULL, SU_TYPE_CMD | SU_OUTLET | SU_TYPE_DAISY_1, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - - -mib2nut_info_t hpe_pdu = { "hpe_epdu", HPE_EPDU_MIB_VERSION, NULL, HPE_EPDU_OID_MODEL_NAME, hpe_pdu_mib, HPE_EPDU_MIB_SYSOID, NULL }; diff --git a/drivers/hpe-pdu-mib.h b/drivers/hpe-pdu-mib.h deleted file mode 100644 index 0ccfcdf..0000000 --- a/drivers/hpe-pdu-mib.h +++ /dev/null @@ -1,30 +0,0 @@ -/* hpe-pdu-mib.h - subdriver to monitor HPE ePDU SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2016 Arnaud Quette - * 2019 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef HPE_EPDU_MIB_H -#define HPE_EPDU_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t hpe_pdu; - -#endif /* HPE_EPDU_MIB_H */ diff --git a/drivers/huawei-mib.c b/drivers/huawei-mib.c deleted file mode 100644 index 9ff193b..0000000 --- a/drivers/huawei-mib.c +++ /dev/null @@ -1,243 +0,0 @@ -/* huawei-mib.c - subdriver to monitor Huawei SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * 2015 Stuart Henderson - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "huawei-mib.h" - -#define HUAWEI_MIB_VERSION "0.4" - -#define HUAWEI_SYSOID ".1.3.6.1.4.1.8072.3.2.10" -#define HUAWEI_UPSMIB ".1.3.6.1.4.1.2011" -#define HUAWEI_OID_MODEL_NAME ".1.3.6.1.4.1.2011.6.174.1.2.100.1.2.1" - -/* To create a value lookup structure (as needed on the 2nd line of the example - * below), use the following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t huawei_onbatt_info[] = { - * { 1, "OB", NULL, NULL }, - * { 2, "OL", NULL, NULL }, - * { 0, NULL, NULL, NULL } - * }; - */ - -static info_lkp_t huawei_supplymethod_info[] = { - { 1, "", NULL, NULL }, /* no supply */ - { 2, "OL BYPASS", NULL, NULL }, - { 3, "OL", NULL, NULL }, - { 4, "OB", NULL, NULL }, - { 5, "", NULL, NULL }, /* combined */ - { 6, "OL ECO", NULL, NULL }, - { 7, "OB ECO", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t huawei_battstate_info[] = { - { 1, "", NULL, NULL }, /* not connected */ - { 2, "", NULL, NULL }, /* not charging or discharging */ - { 3, "", NULL, NULL }, /* hibernation */ - { 4, "", NULL, NULL }, /* float */ - { 5, "CHRG", NULL, NULL }, /* equalized charging */ - { 6, "DISCHRG", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t huawei_phase_info[] = { - { 1, "1", NULL, NULL }, - { 2, "3", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t huawei_voltrating_info[] = { - { 1, "200", NULL, NULL }, - { 2, "208", NULL, NULL }, - { 3, "220", NULL, NULL }, - { 4, "380", NULL, NULL }, - { 5, "400", NULL, NULL }, - { 6, "415", NULL, NULL }, - { 7, "480", NULL, NULL }, - { 8, "600", NULL, NULL }, - { 9, "690", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t huawei_freqrating_info[] = { - { 1, "50", NULL, NULL }, - { 2, "60", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t huawei_pwrrating_info[] = { - { 1, "80000", NULL, NULL }, - { 2, "100000", NULL, NULL }, - { 3, "120000", NULL, NULL }, - { 4, "160000", NULL, NULL }, - { 5, "200000", NULL, NULL }, - { 6, "30000", NULL, NULL }, - { 7, "40000", NULL, NULL }, - { 8, "60000", NULL, NULL }, - { 9, "2400000", NULL, NULL }, - { 10, "2500000", NULL, NULL }, - { 11, "2800000", NULL, NULL }, - { 12, "3000000", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Note: This is currently identical to ietf_test_result_info from IETF MIB - * We rename it here to a) allow evolution that may become incompatible; - * b) avoid namespace conflicts, especially with DMF loader of named objects - */ -static info_lkp_t huawei_test_result_info[] = { - { 1, "done and passed", NULL, NULL }, - { 2, "done and warning", NULL, NULL }, - { 3, "done and error", NULL, NULL }, - { 4, "aborted", NULL, NULL }, - { 5, "in progress", NULL, NULL }, - { 6, "no test initiated", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - - -/* HUAWEI Snmp2NUT lookup table */ -static snmp_info_t huawei_mib[] = { - - /* Data format: - * { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar }, - * - * info_type: NUT INFO_ or CMD_ element name - * info_flags: flags to set in addinfo - * info_len: length of strings if STR - * cmd value if CMD, multiplier otherwise - * OID: SNMP OID or NULL - * dfl: default value - * flags: snmp-ups internal flags (FIXME: ...) - * oid2info: lookup table between OID and NUT values - * - * Example: - * { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, huawei_onbatt_info }, - * - * To create a value lookup structure (as needed on the 2nd line), use the - * following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t huawei_onbatt_info[] = { - * { 1, "OB" }, - * { 2, "OL" }, - * { 0, NULL } - * }; - */ - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* UPS page */ - - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Huawei", SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.2.1", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.1.1.2.0", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - { "ups.time", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.11.1.0", NULL, SU_FLAG_OK, NULL }, /* seconds since epoch */ - - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.3.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.5.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - { "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.1.1", NULL, SU_FLAG_OK, huawei_supplymethod_info }, - { "ups.status", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.2.101.1.3.1", NULL, SU_STATUS_BATT | SU_FLAG_OK, huawei_battstate_info }, - - { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, huawei_test_result_info }, - - - /* Input page */ - - /* hwUpsCtrlInputStandard listed in MIB but not present on tested UPS5000-E */ - { "input.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.8", "3", SU_FLAG_ABSENT | SU_FLAG_OK, huawei_phase_info }, - - { "input.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.1.1", NULL, SU_FLAG_OK, NULL }, - { "input.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.2.1", NULL, SU_FLAG_OK, NULL }, - { "input.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.3.1", NULL, SU_FLAG_OK, NULL }, - - { "input.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.4.1", NULL, SU_FLAG_OK, NULL }, - - { "input.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.5.1", NULL, SU_FLAG_OK, NULL }, - { "input.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.6.1", NULL, SU_FLAG_OK, NULL }, - { "input.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.7.1", NULL, SU_FLAG_OK, NULL }, - - { "input.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.8.1", NULL, SU_FLAG_OK, NULL }, - { "input.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.9.1", NULL, SU_FLAG_OK, NULL }, - { "input.L3.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.3.100.1.10.1", NULL, SU_FLAG_OK, NULL }, - - { "input.bypass.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.1.1", NULL, SU_FLAG_OK, NULL }, - { "input.bypass.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.2.1", NULL, SU_FLAG_OK, NULL }, - { "input.bypass.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.3.1", NULL, SU_FLAG_OK, NULL }, - - { "input.bypass.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.5.100.1.4.1", NULL, SU_FLAG_OK, NULL }, - - - /* Output page */ - - /* hwUpsCtrlOutputStandard listed in MIB but not present on tested UPS5000-E */ - { "output.phases", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.102.100.1.9", "3", SU_FLAG_ABSENT | SU_FLAG_OK, huawei_phase_info }, - - { "output.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.1.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.2.1", NULL, SU_FLAG_OK, NULL }, - { "output.L3-N.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.3.1", NULL, SU_FLAG_OK, NULL }, - - { "output.L1.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.4.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.5.1", NULL, SU_FLAG_OK, NULL }, - { "output.L3.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.6.1", NULL, SU_FLAG_OK, NULL }, - - { "output.frequency", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.7.1", NULL, SU_FLAG_OK, NULL }, - - { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.8.1", NULL, SU_FLAG_OK, NULL }, - { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.9.1", NULL, SU_FLAG_OK, NULL }, - { "output.L1.realpower", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.10.1", NULL, SU_FLAG_OK, NULL }, - - { "output.L1.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.11.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.12.1", NULL, SU_FLAG_OK, NULL }, - { "output.L3.power", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.13.1", NULL, SU_FLAG_OK, NULL }, - - { "output.L1.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.14.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.15.1", NULL, SU_FLAG_OK, NULL }, - { "output.L3.power.percent", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.16.1", NULL, SU_FLAG_OK, NULL }, - - { "output.voltage.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.17.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, huawei_voltrating_info }, - { "output.frequency.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.18.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, huawei_freqrating_info }, - { "output.power.nominal", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.2011.6.174.1.2.100.1.6.1", NULL, SU_FLAG_STATIC | SU_FLAG_OK, huawei_pwrrating_info }, - - { "output.L1.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.19.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.20.1", NULL, SU_FLAG_OK, NULL }, - { "output.L2.powerfactor", 0, 0.01, ".1.3.6.1.4.1.2011.6.174.1.4.100.1.21.1", NULL, SU_FLAG_OK, NULL }, - - - /* Battery page */ - - { "battery.voltage", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.1.1", NULL, SU_FLAG_OK, NULL }, - { "battery.current", 0, 0.1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.2.1", NULL, SU_FLAG_OK, NULL }, - { "battery.charge", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.3.1", NULL, SU_FLAG_OK, NULL }, - { "battery.runtime", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.6.100.1.4.1", NULL, SU_FLAG_OK, NULL }, - - - /* { "unmapped.hwUpsBattTest", 0, 1, ".1.3.6.1.4.1.2011.6.174.1.103.101.1.6.1", NULL, SU_FLAG_OK, NULL }, */ - - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t huawei = { "huawei", HUAWEI_MIB_VERSION, NULL, HUAWEI_OID_MODEL_NAME, huawei_mib, HUAWEI_SYSOID, NULL }; diff --git a/drivers/huawei-mib.h b/drivers/huawei-mib.h deleted file mode 100644 index 326a71e..0000000 --- a/drivers/huawei-mib.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef HUAWEI_MIB_H -#define HUAWEI_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t huawei; - -#endif /* HUAWEI_MIB_H */ diff --git a/drivers/huawei-ups2000.c b/drivers/huawei-ups2000.c deleted file mode 100644 index c144fcc..0000000 --- a/drivers/huawei-ups2000.c +++ /dev/null @@ -1,2122 +0,0 @@ -/* - * huawei-ups2000.c - Driver for Huawei UPS2000 (1kVA-3kVA) - * - * Note: Huawei UPS2000 (1kVA-3kVA) can be accessed via RS-232, - * USB, or an optional RMS-MODBUS01B (RS-485) adapter. Only - * RS-232 and USB are supported, RS-485 is not. - * - * The USB port on the UPS is implemented via a MaxLinear RX21V1410 - * USB-to-serial converter, and can be recongized as a standard - * USB-CDC serial device. Unfortunately, the generic USB-CDC driver - * is incompatible with the specific chip configuration and cannot - * be used. A device-specific driver, "xr_serial", must be used. - * - * The driver has only been merged to Linux 5.12 or later, via the - * "xr_serial" kernel module. When the UPS2000 is connected via USB - * to a supported Linux system, you should see the following logs in - * "dmesg". - * - * xr_serial 1-1.2:1.1: xr_serial converter detected - * usb 1-1.2: xr_serial converter now attached to ttyUSB0 - * - * The driver must be "xr_serial". If your system doesn't have the - * necessary device driver, you will get this message instead: - * - * cdc_acm 1-1.2:1.0: ttyACM0: USB ACM device - * - * On other operating systems, USB cannot be used due to the absence - * of the driver. You must use connect UPS2000 to your computer via - * RS-232, either directly or using an USB-to-RS-232 converter supported - * by your Linux or BSD kernel. - * - * A document describing the protocol implemented by this driver can - * be found online at: - * - * https://support.huawei.com/enterprise/en/doc/EDOC1000110696 - * - * Huawei UPS2000 driver implemented by - * Copyright (C) 2020, 2021 Yifeng Li - * The author is not affiliated to Huawei or other manufacturers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be the first header */ - -#include -#include -#include "main.h" -#include "serial.h" - -#define DRIVER_NAME "NUT Huawei UPS2000 (1kVA-3kVA) RS-232 Modbus driver" -#define DRIVER_VERSION "0.02" - -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) -#define MODBUS_SLAVE_ID 1 - -/* - * Known UPS models. We only attempt to load the driver if - * the initial communication indicates the UPS is a known - * model of the UPS2000 series. - */ -static const char *supported_model[] = { - "UPS2000", "UPS2000A", - NULL -}; - -/* - * UPS2000 device identification. The information is obtained during - * initial communication using Modbus command 0x2B (read device identi- - * fication) to read the object 0x87 (device list). The object contains - * a list of fields, each with a type, length, and value. The object is - * parsed by ups2000_device_identification() and filled into the array - * of struct ups2000_ident. - * - * Fields of interest are: - * - * 0x87, int32 (Device Count): Only one UPS unit is supported, - * the driver aborts if more than one device is detected. - * - * 0x88, string (Device Description of the 1st unit): This is a - * ASCII string that contains information about the 1st UPS unit. - * This string, again, contains a list of fields. They are parsed - * further into the array ups2000_desc. - * - */ -#define UPS2000_IDENT_MAX_FIELDS 9 -#define UPS2000_IDENT_MAX_LEN 128 -#define UPS2000_IDENT_OFFSET -static struct { - uint8_t type; - uint8_t len; - uint8_t val[UPS2000_IDENT_MAX_LEN]; -} ups2000_ident[UPS2000_IDENT_MAX_FIELDS]; - -/* - * UPS2000 device description. The information is initially obtained - * as field 0x88 in the UPS2000 device identification. This field is - * a semicolon seperated ASCII string that contains multiple fields. - * It is parsed again by ups2000_device_identification() and filled - * into the ups2000_desc[] 2D array. The first dimension is used as - * a key to select the wanted field (defined in the following enmu, - * the second dimension is a NULL-terminated ASCII string. - * - * Note that ups2000_desc[0] is deliberately unused, the array begins - * at one, allowing mapping from UPS2000_DESC_* to ups2000_desc[] - * directly without using offsets. - */ -#define UPS2000_DESC_MAX_FIELDS 9 -#define UPS2000_DESC_MAX_LEN 128 -enum { - UPS2000_DESC_MODEL = 1, - UPS2000_DESC_FIRMWARE_REV, - UPS2000_DESC_PROTOCOL_REV, - UPS2000_DESC_ESN, - UPS2000_DESC_DEVICE_ID, /* currently unused */ - UPS2000_DESC_PARALLEL_ID /* currently unused */ -}; -static char ups2000_desc[UPS2000_DESC_MAX_FIELDS][UPS2000_DESC_MAX_LEN] = { { 0 } }; - -/* global variable for modbus communication */ -static modbus_t *modbus_ctx = NULL; - -/* - * How many seconds to wait before switching off/on/reboot the UPS? - * - * This can be set at startup time via a command-line argument, - * or at runtime by writing to RW variables "ups.delay.shutdown" - * and "ups.delay.start". See ups2000_delay_get/set. - */ -#define UPS2000_DELAY_INVALID 0xFFFF -static uint16_t ups2000_offdelay = UPS2000_DELAY_INVALID; -static uint16_t ups2000_ondelay = UPS2000_DELAY_INVALID; -static uint16_t ups2000_rebootdelay = UPS2000_DELAY_INVALID; - -/* - * Time when the current shutdown/reboot request is expected - * to complete. This is used to calculate the ETA, See - * ups2000_update_timers(). - */ -static time_t shutdown_at = 0; -static time_t reboot_at = 0; -static time_t start_at = 0; - -/* - * Is it safe to enter bypass mode? It's checked by ups2000_update_alarm() - * and used by ups2000_instcmd_bypass_start(). - */ -static bool bypass_available = 0; - -/* function prototypes */ -static int ups2000_update_info(void); -static int ups2000_update_status(void); -static int ups2000_update_alarm(void); -static int ups2000_update_timers(void); -static void ups2000_device_identification(void); -static size_t ups2000_read_serial(uint8_t *buf, size_t buf_len); -static int ups2000_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest); -static int ups2000_write_register(modbus_t *ctx, int addr, uint16_t val); -static int ups2000_write_registers(modbus_t *ctx, int addr, int nb, uint16_t *src); -static uint16_t crc16(uint8_t *buffer, uint16_t buffer_length); -static time_t time_seek(time_t t, int seconds); - -/* rw variables function prototypes */ -static int ups2000_update_rw_var(void); -static int setvar(const char *name, const char *val); -static int ups2000_autostart_set(const uint16_t reg, const char *string); -static int ups2000_autostart_get(const uint16_t reg); -static int ups2000_beeper_set(const uint16_t reg, const char *string); -static int ups2000_beeper_get(const uint16_t reg); -static void ups2000_delay_get(void); -static int ups2000_delay_set(const char *var, const char *string); - -/* instant command function prototypes */ -static void ups2000_init_instcmd(void); -static int instcmd(const char *cmd, const char *extra); -static int ups2000_instcmd_load_on(const uint16_t reg); -static int ups2000_instcmd_bypass_start(const uint16_t reg); -static int ups2000_instcmd_beeper_toggle(const uint16_t reg); -static int ups2000_instcmd_shutdown_stayoff(const uint16_t reg); -static int ups2000_instcmd_shutdown_return(const uint16_t reg); -static int ups2000_instcmd_shutdown_reboot(const uint16_t reg); -static int ups2000_instcmd_shutdown_reboot_graceful(const uint16_t reg); - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Yifeng Li \n", - DRV_EXPERIMENTAL, - { NULL } -}; - - -void upsdrv_initups(void) -{ - int r; - - upsdebugx(2, "upsdrv_initups"); - - /* - * This is an ugly workaround to a serious problem: libmodbus doesn't - * support device identification. Although there's a function called - * modbus_send_raw_request() for custom commands, but modbus_receive_ - * confirmation() assumes a message length in the header, which is - * incompatible with device identification - It simply stops reading - * in the middle of the message and cannot receive our message. Worse, - * there's no public API to receive a raw response. - * - * See: https://github.com/stephane/libmodbus/issues/231 - * - * Thus, the only thing we could do is opening it as a serial device - * for device identification, and reopen it via libmodbus for other - * commands as usual. We also have to copy the CRC-16 function from - * the libmodbus source code since there's no public API to use that... - */ - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B9600); - ser_set_rts(upsfd, 0); - ser_set_dtr(upsfd, 0); - - modbus_ctx = modbus_new_rtu(device_path, 9600, 'N', 8, 1); - if (modbus_ctx == NULL) - fatalx(EXIT_FAILURE, "Unable to create the libmodbus context"); - -#if LIBMODBUS_VERSION_CHECK(3, 1, 2) - /* It can take as slow as 1 sec. for the UPS to respond. */ - modbus_set_response_timeout(modbus_ctx, 1, 0); -#else - { - struct timeval timeout; - timeout.tv_sec = 1; - timeout.tv_usec = 0; - modbus_set_response_timeout(modbus_ctx, &timeout); - } -#endif - - r = modbus_set_slave(modbus_ctx, MODBUS_SLAVE_ID); - if (r < 0) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "Invalid slave ID %d", MODBUS_SLAVE_ID); - } - - if (modbus_connect(modbus_ctx) == -1) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: %s", modbus_strerror(errno)); - } -} - - -#define IDENT_REQUEST_LEN 7 -#define IDENT_RESPONSE_MAX_LEN 128 -#define IDENT_RESPONSE_HEADER_LEN 8 -#define IDENT_RESPONSE_CRC_LEN 2 -#define IDENT_FIELD_HEADER_LEN 2 -static void ups2000_device_identification(void) -{ - static const uint8_t ident_req[IDENT_REQUEST_LEN] = { - MODBUS_SLAVE_ID, /* addr */ - 0x2B, /* command: device identification */ - 0x0E, /* MEI type */ - 0x03, /* ReadDevID: extended identification */ - 0x87, /* Object ID: device list */ - 0x31, 0x75 /* CRC-16 */ - }; - - /* - * Response header: - * 0x01, 0x2B, 0x0E, 0x03, 0x03, 0x00, 0x00, 0x02 - * - * Response fields: - * header: 0x87, 0x04 // type (device counts), length - * data: uint32_t - * (e.g. 0x00, 0x00, 0x00, 0x01) - * - * header: 0x88, 0x?? // type (1st dev desc), length - * data: ASCII string - * (e.g. 1=UPS2000;2=V100R001C01SPC120;3=...) - * - * header: 0x89, 0x?? // type (2nd dev desc), length - * data: ASCII string - * - * ... - * header: 0xFF, 0x?? // type (120th dev desc), length - * data: ASCII string - * - * CRC-16: - * 0x??, 0x?? - */ - static const uint8_t expected_header[IDENT_RESPONSE_HEADER_LEN] = { - MODBUS_SLAVE_ID, - 0x2B, 0x0E, 0x03, 0x03, 0x00, 0x00, 0x02, - }; - - bool serial_fail = 0; /* unable to read from serial */ - uint16_t crc16_recv, crc16_calc; /* resp CRC */ - bool crc16_fail = 0; /* resp CRC failure */ - uint32_t ups_count = 0; /* number of UPS in the resp list */ - uint8_t ident_response[IDENT_RESPONSE_MAX_LEN]; /* resp buf */ - size_t ident_response_len; /* buf len */ - uint8_t *ident_response_end = NULL; /* buf end marker (excluding CRC) */ - uint8_t *ptr = NULL; /* buf iteratior */ - - /* a desc string copied from ups2000_ident[] */ - char *ups2000_ident_desc = NULL; - int i; - ssize_t r; - - /* attempt to obtain a response header with valid CRC. */ - for (i = 0; i < 3; i++) { - /* step 1: record response length and initialize ptr */ - upsdebugx(2, "ser_send_buf"); - - ser_flush_in(upsfd, "", nut_debug_level); - r = ser_send_buf(upsfd, ident_req, IDENT_REQUEST_LEN); - if (r != IDENT_REQUEST_LEN) { - fatalx(EXIT_FAILURE, "unable to send request!\n"); - } - - ident_response_len = ups2000_read_serial(ident_response, IDENT_RESPONSE_MAX_LEN); - ptr = ident_response; - ident_response_end = ptr + ident_response_len - IDENT_RESPONSE_CRC_LEN; - - /* step 2: check response length */ - if (ident_response_len == 0) { - upslogx(LOG_ERR, "unable to read from serial port %s, retry...", device_path); - serial_fail = 1; - continue; - } - else - serial_fail = 0; - - upsdebug_hex(2, "ups2000_read_serial() received", ptr, ident_response_len); - - if (ptr + IDENT_RESPONSE_HEADER_LEN > ident_response_end) { - fatalx(EXIT_FAILURE, "response header too short! " - "expected %d, received %zu.", - IDENT_RESPONSE_HEADER_LEN, ident_response_len); - } - - /* step 3: check response CRC-16 */ - crc16_recv = (uint16_t)((uint16_t)(ident_response_end[0]) << 8) | (uint16_t)(ident_response_end[1]); - if (ident_response_len < IDENT_RESPONSE_CRC_LEN - || (((uintmax_t)(ident_response_len) - IDENT_RESPONSE_CRC_LEN) > UINT16_MAX) - ) { - fatalx(EXIT_FAILURE, "response header shorter than CRC " - "or longer than UINT16_MAX!"); - } - - crc16_calc = crc16(ident_response, (uint16_t)(ident_response_len - IDENT_RESPONSE_CRC_LEN)); - if (crc16_recv == crc16_calc) { - crc16_fail = 0; - break; - } - crc16_fail = 1; - } - - /* step 4: check serial & CRC-16 verification status */ - if (serial_fail) - fatalx(EXIT_FAILURE, "unable to read from serial port %s!", device_path); - - if (crc16_fail) - fatalx(EXIT_FAILURE, "response CRC verification failed!"); - - /* step 5: check response header */ - if (memcmp(expected_header, ident_response, IDENT_RESPONSE_HEADER_LEN)) - fatalx(EXIT_FAILURE, "unexpected response header!"); - - ptr += IDENT_RESPONSE_HEADER_LEN; - - /* step 6: extract ident fields */ - memset(ups2000_ident, 0x00, sizeof(ups2000_ident)); - for (i = 0; i < UPS2000_IDENT_MAX_FIELDS; i++) { - uint8_t type, len; - - if (ptr + 2 > ident_response_end) - break; - - type = *ptr++; - len = *ptr++; - - if (len + 1 > UPS2000_IDENT_MAX_LEN) - fatalx(EXIT_FAILURE, "response field too long!"); - - ups2000_ident[i].type = type; - ups2000_ident[i].len = len; - /* - * Always zero-terminate the bytes, in case the data - * is an ASCII string (i.e. device desc string), libc - * string functions can be used. - */ - ups2000_ident[i].val[len] = '\0'; - - if (ptr + len > ident_response_end) - fatalx(EXIT_FAILURE, "response field too short!"); - - memcpy(ups2000_ident[i].val, ptr, len); - ptr += len; - } - - /* step 7: validate device identification field 0x87 and 0x88 */ - for (i = 0; i < UPS2000_IDENT_MAX_FIELDS; i++) { - /* only one device is supported */ - if (ups2000_ident[i].type == 0x87) { - /* so we assume 0x87 must be 1 */ - ups_count = - (uint32_t)(ups2000_ident[i].val[0]) << 24 | - (uint32_t)(ups2000_ident[i].val[1]) << 16 | - (uint32_t)(ups2000_ident[i].val[2]) << 8 | - (uint32_t)(ups2000_ident[i].val[3]); - } - if (ups2000_ident[i].type == 0x88) { - /* - * And only check 0x88, not 0x89, etc. Also copy the - * string for later parsing via strtok(). - */ - ups2000_ident_desc = strdup((char *) ups2000_ident[i].val); - break; - } - } - if (ups_count != 1) - fatalx(EXIT_FAILURE, "only 1 UPS is supported, %u found", ups_count); - - if (!ups2000_ident_desc) - fatalx(EXIT_FAILURE, "device desc string not found"); - - /* - * step 8: extract fields from the desc string. - * (1=UPS2000;2=V100R001C01SPC120;3=...) - */ - for (i = 0; i < UPS2000_DESC_MAX_FIELDS; i++) { - char *key; /* "1", "2", "3", ... */ - char *val; /* "UPS2000", "V100R001C01SPC120", ... */ - unsigned int idx = 0; - - if (i == 0) - key = strtok(ups2000_ident_desc, "="); - else - key = strtok(NULL, "="); - if (!key) - break; - - val = strtok(NULL, ";"); - if (!val) - break; - - r = str_to_uint_strict(key, &idx, 10); - if (!r || idx + 1 > UPS2000_DESC_MAX_FIELDS || idx < 1) - fatalx(EXIT_FAILURE, "desc index %d is invalid!", idx); - - if (strlen(val) + 1 > UPS2000_DESC_MAX_LEN) - fatalx(EXIT_FAILURE, "desc field %d too long!", idx); - - memcpy(ups2000_desc[idx], val, strlen(val) + 1); - } - free(ups2000_ident_desc); - - /* - * step 9: Validate desc fields that we are going to use are valid. - * - * Note: UPS2000_DESC_DEVICE_ID and UPS2000_DESC_PARALLEL_ID are - * currently unused and unchecked. - */ - for (i = UPS2000_DESC_MODEL; i <= UPS2000_DESC_ESN; i++) { - if (strlen(ups2000_desc[i]) == 0) - fatalx(EXIT_FAILURE, "desc field %d is missing!", i); - } -} - - -void upsdrv_initinfo(void) -{ - bool in_list = 0; - int i = 0; - - upsdebugx(2, "upsdrv_initinfo"); - - ups2000_device_identification(); - - /* check whether the UPS is a known model */ - for (i = 0; supported_model[i] != NULL; i++) { - if (!strcmp(supported_model[i], - ups2000_desc[UPS2000_DESC_MODEL])) { - in_list = 1; - } - } - if (!in_list) { - fatalx(EXIT_FAILURE, "Unknown UPS model %s", - ups2000_desc[UPS2000_DESC_MODEL]); - } - - dstate_setinfo("device.mfr", "Huawei"); - dstate_setinfo("device.type", "ups"); - dstate_setinfo("device.model", "%s", - ups2000_desc[UPS2000_DESC_MODEL]); - dstate_setinfo("device.serial", "%s", - ups2000_desc[UPS2000_DESC_ESN]); - - dstate_setinfo("ups.mfr", "Huawei"); - dstate_setinfo("ups.model", "%s", - ups2000_desc[UPS2000_DESC_MODEL]); - dstate_setinfo("ups.firmware", "%s", - ups2000_desc[UPS2000_DESC_FIRMWARE_REV]); - dstate_setinfo("ups.firmware.aux", "%s", - ups2000_desc[UPS2000_DESC_PROTOCOL_REV]); - dstate_setinfo("ups.serial", "%s", - ups2000_desc[UPS2000_DESC_ESN]); - dstate_setinfo("ups.type", "online"); - - /* RW variables */ - upsh.setvar = setvar; - - /* instant commands */ - ups2000_init_instcmd(); - upsh.instcmd = instcmd; -} - - -/* - * All registers are uint16_t. But the data they represent can - * be either an integer or a float. This information is used for - * error checking (int and float have different invalid values). - */ -enum { - REG_UINT16, - REG_UINT32, /* occupies two registers */ - REG_FLOAT, /* actually a misnomer, it should really be called - fixed-point number, but we follow the datasheet */ -}; -#define REG_UINT16_INVALID 0xFFFFU -#define REG_UINT32_INVALID 0xFFFFFFFFU -#define REG_FLOAT_INVALID 0x7FFFU - - -/* - * Declare UPS attribute variables, format strings, registers, - * and their scaling factors in a lookup table to avoid spaghetti - * code. - */ -static struct { - const char *name; - const char *fmt; - const uint16_t reg; - const int datatype; /* only UINT32 occupies 2 regs */ - const float scaling; /* scale it down to get the original */ -} ups2000_var[] = -{ - { "input.voltage", "%03.1f", 1000, REG_FLOAT, 10.0 }, - { "input.frequency", "%02.1f", 1003, REG_FLOAT, 10.0 }, - { "input.bypass.voltage", "%03.1f", 1004, REG_FLOAT, 10.0 }, - { "input.bypass.frequency", "%03.1f", 1007, REG_FLOAT, 10.0 }, - { "output.voltage", "%03.1f", 1008, REG_FLOAT, 10.0 }, - { "output.current", "%03.1f", 1011, REG_FLOAT, 10.0 }, - { "output.frequency", "%03.1f", 1014, REG_FLOAT, 10.0 }, - { "output.realpower", "%02.1f", 1015, REG_FLOAT, 0.01 }, /* 10 / 1 kW */ - { "output.power", "%03.1f", 1018, REG_FLOAT, 0.01 }, /* 10 / 1 kVA */ - { "ups.load", "%02.1f", 1021, REG_FLOAT, 10.0 }, - { "ups.temperature", "%02.1f", 1027, REG_FLOAT, 10.0 }, - { "battery.voltage", "%02.1f", 2000, REG_FLOAT, 10.0 }, - { "battery.charge", "%02.1f", 2003, REG_UINT16, 1.0 }, - { "battery.runtime", "%.0f", 2004, REG_UINT32, 1.0 }, - { "battery.packs", "%.0f", 2007, REG_UINT16, 1.0 }, - { "battery.capacity", "%.0f", 2033, REG_UINT16, 1.0 }, - { "ups.power.nominal", "%.0f", 9009, REG_FLOAT, 0.01 }, /* 10 / 1 kVA */ - { NULL, NULL, 0, 0, 0 }, -}; - - -static int ups2000_update_info(void) -{ - uint16_t reg[3][34]; - int i; - int r; - - upsdebugx(2, "ups2000_update_info"); - - /* - * All status registers have an offset of 10000 * ups_number. - * We only support 1 UPS, thus it's always 10000. Register - * 1000 becomes 11000. - */ - r = ups2000_read_registers(modbus_ctx, 11000, 28, reg[0]); - if (r != 28) - return 1; - - r = ups2000_read_registers(modbus_ctx, 12000, 34, reg[1]); - if (r != 34) - return 1; - - r = ups2000_read_registers(modbus_ctx, 19009, 1, ®[2][9]); - if (r != 1) - return 1; - - for (i = 0; ups2000_var[i].name != NULL; i++) { - uint16_t reg_id = ups2000_var[i].reg; - uint8_t page = (uint8_t)(reg_id / 1000 - 1); - uint8_t idx = (uint8_t)(reg_id % 1000); - uint32_t val; - bool invalid = 0; - - if (page == 8) /* hack for the lonely register 9009 */ - page = 2; - - if (page > 2 || idx > 33) /* also suppress compiler warn */ - fatalx(EXIT_FAILURE, "register calculation overflow!\n"); - - switch (ups2000_var[i].datatype) { - case REG_FLOAT: - val = reg[page][idx]; - if (val == REG_FLOAT_INVALID) - invalid = 1; - break; - case REG_UINT16: - val = reg[page][idx]; - if (val == REG_UINT16_INVALID) - invalid = 1; - break; - case REG_UINT32: - val = (uint32_t)(reg[page][idx]) << 16; - val |= (uint32_t)(reg[page][idx + 1]); - if (val == REG_UINT32_INVALID) - invalid = 1; - break; - default: - fatalx(EXIT_FAILURE, "invalid data type in register table!\n"); - } - - if (invalid) { - upslogx(LOG_ERR, "register %04d has invalid value %04x,", reg_id, val); - return 1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - dstate_setinfo(ups2000_var[i].name, ups2000_var[i].fmt, - (float) val / ups2000_var[i].scaling); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } - return 0; -} - - -/* - * A lookup table of all the status registers and the list of - * corresponding flags they represent. A register may set multiple - * status flags, represented by an array of flags_t. - * - * There are two types of flags. If the flag is a "status flag" - * for status_set(), for example, "OL" or "OB", the field - * "status_name" is used. If the flag is a "data variable" for - * dstate_setinfo(), the variable name and value is written in - * "var_name" and "var_val" fields. - * - * For each flag, if it's indicated by a specific value in a - * register, the "val" field is used. If a flag is indicated by - * a bit, the "bit" field should be used. Fields "val" and "bit" - * cannot be used at the same time, at least one must be "-1". - * - * Also, some important registers indicate basic system status - * (e.g. whether the UPS is on line power or battery), this info - * must always be available, and they are always expected to set - * at least one flag. If the important register does not set any - * flag, it means we've received an invalid or unknown value, - * and we must report an error. The "must_set_flag" field is used - * for this purpose. - */ -static struct { - const uint16_t reg; - bool must_set_flag; - struct flags_t { - const char *status_name; - const int16_t val; - const int bit; - const char *var_name, *var_val; - } flags[10]; -} ups2000_status_reg[] = -{ - { 1024, 1, { - { "OFF", 0, -1, NULL, NULL }, - { "BYPASS", 1, -1, NULL, NULL }, - { "OL", 2, -1, NULL, NULL }, - { "OB", 3, -1, NULL, NULL }, - { "OL ECO", 5, -1, NULL, NULL }, - { NULL, -1, -1, NULL, NULL }, - }}, - { 1043, 0, { - { "CAL", -1, 2, NULL, NULL }, /* battery self-test */ - { "LB", -1, 6, NULL, NULL }, - { NULL, -1, -1, NULL, NULL }, - }}, - /* - * Note: 3 = float charging, 4 = equalization charging, but - * both of them are reported as "charging", not "floating". - * The definition of "floating" in NUT is: "battery has - * completed its charge cycle, and waiting to go to resting - * mode", which is not true for UPS2000. - */ - { 2002, 1, { - { "", 2, -1, "battery.charger.status", "resting" }, - { "CHRG", 3, -1, "battery.charger.status", "charging" }, - { "CHRG", 4, -1, "battery.charger.status", "charging" }, - { "DISCHRG", 5, -1, "battery.charger.status", "discharging" }, - { NULL, -1, -1, NULL, NULL }, - }}, - { 0, 0, { { NULL, -1, -1, NULL, NULL } } } -}; - - -static int ups2000_update_status(void) -{ - int i, j; - int r; - - upsdebugx(2, "ups2000_update_status"); - - for (i = 0; ups2000_status_reg[i].reg != 0; i++) { - uint16_t reg, val; - struct flags_t *flag; - int flag_count = 0; - - reg = ups2000_status_reg[i].reg; - r = ups2000_read_registers(modbus_ctx, reg + 10000, 1, &val); - if (r != 1) - return 1; - - if (val == REG_UINT16_INVALID) { - upslogx(LOG_ERR, "register %04d has invalid value %04x,", reg, val); - return 1; - } - - flag = ups2000_status_reg[i].flags; - for (j = 0; flag[j].status_name != NULL; j++) { - /* - * if the register is equal to the "val" we are looking - * for, or if register has its n-th "bit" set... - */ - if ((flag[j].val != -1 && flag[j].val == val) || - (flag[j].bit != -1 && CHECK_BIT(val, flag[j].bit))) { - /* if it has a corresponding status flag */ - if (strlen(flag[j].status_name) != 0) - status_set(flag[j].status_name); - /* or if it has a corresponding dstate variable (or both) */ - if (flag[j].var_name && flag[j].var_val) - dstate_setinfo(flag[j].var_name, "%s", flag[j].var_val); - flag_count++; - } - } - if (ups2000_status_reg[i].must_set_flag && flag_count == 0) { - upslogx(LOG_ERR, "register %04d has invalid value %04x,", reg, val); - return 1; - } - } - - return 0; -} - - -/* - * A lookup table of all the alarm registers and the list of - * corresponding alarms they represent. Each alarm condition is - * listed by its register base address "reg" and its "bit" - * position. - * - * Each alarm condition has an "alarm_id", "alarm_cause_id", - * and "alarm_name". In addition, a few alarms conditions also - * indicates conditions related to batteries that is needed to - * be set via status_set(), those are listed in "status_name". - * Unused "status_name" is set to NULL. - * - * After an alarm is reported/cleared by the UPS, the "active" - * flag is changed to reflect its status. The error logging - * code uses this variable to issue warnings only when needed - * (i.e. only after a change, avoid issuing the same warning - * repeatedly). - */ -#define ALARM_CLEAR_AUTO 1 -#define ALARM_CLEAR_MANUAL 2 -#define ALARM_CLEAR_DEPENDING 3 - -static struct { - bool active; /* runtime: is this alarm currently active? */ - const uint16_t reg; /* alarm register to check */ - const int bit; /* alarm bit to check */ - const int alarm_clear; /* auto or manual clear */ - const int loglevel; /* warning or error */ - const int alarm_id, alarm_cause_id; - const char *status_name; /* corresponding NUT status word */ - const char *alarm_name; /* alarm string */ - const char *alarm_desc; /* brief explanation */ -} ups2000_alarm[] = -{ - { - false, 40156, 3, ALARM_CLEAR_AUTO, LOG_ALERT, - 30, 1, NULL, "UPS internal overtemperature", - "The ambient temperature is over 50-degree C. " - "Startup from standby mode is prohibited.", - }, - { - false, 40161, 1, ALARM_CLEAR_AUTO, LOG_WARNING, - 10, 1, NULL, "Abnormal bypass voltage", - "Bypass input is unavailable or out-of-range. Wait for " - "bypass input to recover, or change acceptable bypass " - "range via front panel.", - }, - { - false, 40161, 2, ALARM_CLEAR_AUTO, LOG_WARNING, - 10, 2, NULL, "Abnormal bypass frequency", - "Bypass input is unavailable or out-of-range. Wait for " - "bypass input to recover, or change acceptable bypass " - "range via front panel.", - }, - { - false, 40163, 3, ALARM_CLEAR_DEPENDING, LOG_WARNING, - 25, 1, NULL, "Battery overvoltage", - "When the UPS is started, voltage of each battery exceeds 15 V. " - "Or: current battery voltage exceeds 14.7 V.", - }, - { - false, 40164, 1, ALARM_CLEAR_AUTO, LOG_WARNING, - 29, 1, "RB", "Battery needs maintenance", - "During the last battery self-check, the battery voltage " - "was lower than the replacement threshold (11 V).", - }, - { - false, 40164, 3, ALARM_CLEAR_AUTO, LOG_WARNING, - 26, 1, NULL, "Battery undervoltage", - NULL, - }, - { - false, 40170, 4, ALARM_CLEAR_AUTO, LOG_ALERT, - 22, 1, NULL, "Battery disconnected", - "Battery is not connected, has loose connection, or faulty.", - }, - { - false, 40173, 5, ALARM_CLEAR_AUTO, LOG_ALERT, - 66, 1, "OVER", "Output overload (105%-110%)", - "UPS will shut down or transfer to bypass mode in 5-10 minutes.", - }, - { - false, 40173, 3, ALARM_CLEAR_AUTO, LOG_ALERT, - 66, 2, "OVER", "Output overload (110%-130%)", - "UPS will shut down or transfer to bypass mode in 30-60 seconds.", - }, - { - false, 40174, 0, ALARM_CLEAR_DEPENDING, LOG_ALERT, - 14, 1, NULL, "UPS startup timeout", - "The inverter output voltage is not within +/- 2 V of the " - "rated output. Or: battery is overdischarged.", - }, - { - false, 40179, 14, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 15, NULL, "Rectifier fault (internal fault)", - "Bus voltage is lower than 320 V.", - }, - { - false, 40179, 15, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 17, NULL, "Rectifier fault (internal fault)", - "Bus voltage is higher than 450 V.", - }, - { - false, 40180, 1, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 18, NULL, "Rectifier fault (internal fault)", - "Bus voltage is lower than 260 V.", - }, - { - false, 40180, 5, ALARM_CLEAR_AUTO, LOG_ALERT, - 42, 24, NULL, "EEPROM fault (internal fault)", - "Faulty EEPROM. All settings are restored to " - "factory default and cannot be saved.", - }, - { - false, 40180, 6, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 27, NULL, "Inverter fault (internal fault)", - "Inverter output overvoltage, undervoltage or " - "undercurrent.", - }, - { - false, 40180, 7, ALARM_CLEAR_DEPENDING, LOG_ALERT, - 42, 28, NULL, "Inverter fault (internal fault)", - "The inverter output voltage is lower than 100 V.", - }, - { - false, 40180, 10, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 31, NULL, "Inverter fault (internal fault)", - "The difference between the absolute value of the positive bus " - "voltage and that of the negative bus voltage is 100 V.", - }, - { - false, 40180, 11, ALARM_CLEAR_DEPENDING, LOG_ALERT, - 42, 32, NULL, "UPS internal overtemperature", - "The ambient temperature is over 50 degree C, " - "switching to bypass mode.", - - }, - { - false, 40180, 13, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 36, NULL, "Charger fault (internal fault)", - "The charger has no output. Faulty internal connections.", - - }, - { - false, 40182, 4, ALARM_CLEAR_MANUAL, LOG_ALERT, - 42, 42, NULL, "Charger fault (internal fault)", - "The charger has no output while the inverter is on, " - "battery undervoltage. Faulty switching transistor.", - }, - { - false, 40182, 13, ALARM_CLEAR_MANUAL, LOG_ALERT, - 66, 3, "OVER", "Output overload shutdown", - "UPS has shutdown or transferred to bypass mode.", - }, - { - false, 40182, 14, ALARM_CLEAR_MANUAL, LOG_ALERT, - 66, 4, "OVER", "Bypass output overload shutdown", - "UPS has shutdown, bypass output was overload and exceeded " - "time limit.", - }, - { false, 0, -1, -1, -1, -1, -1, NULL, NULL, NULL } -}; - - -/* don't spam the syslog */ -static time_t alarm_logged_since = 0; -#define UPS2000_LOG_INTERVAL 600 /* 10 minutes */ - - -static int ups2000_update_alarm(void) -{ - uint16_t val[27]; - int i; - int r; - - char alarm_buf[128]; - size_t all_alarms_len = 0; - - int alarm_count = 0; - bool alarm_logged = 0; - bool alarm_rtfm = 0; - time_t now = time(NULL); - - upsdebugx(2, "ups2000_update_alarm"); - - /* - * All alarm registers have an offset of 1024 * ups_number. - * We only support 1 UPS, it's always 1024. - */ - r = ups2000_read_registers(modbus_ctx, ups2000_alarm[0].reg + 1024, 27, val); - if (r != 27) - return 1; - - bypass_available = 1; /* register 40161 hack, see comments below */ - - for (i = 0; ups2000_alarm[i].alarm_id != -1; i++) { - int idx = ups2000_alarm[i].reg - ups2000_alarm[0].reg; - if (idx > 26 || idx < 0) - fatalx(EXIT_FAILURE, "register calculation overflow!\n"); - - if (CHECK_BIT(val[idx], ups2000_alarm[i].bit)) { - int gotlen; - if (ups2000_alarm[i].reg == 40161) - /* - * HACK: special treatment for register 40161. If this - * register indicates an alarm, we need to lock the - * "bypass.on" command as a software foolproof mechanism. - * It's written to the global "bypass_available" flag. - */ - bypass_available = 0; - - alarm_count++; - - gotlen = snprintf(alarm_buf, 128, "(ID %02d/%02d): %s!", - ups2000_alarm[i].alarm_id, - ups2000_alarm[i].alarm_cause_id, - ups2000_alarm[i].alarm_name); - - if (gotlen < 0 || (uintmax_t)gotlen > SIZE_MAX) { - fatalx(EXIT_FAILURE, "alarm_buf preparation over/under-flow!\n"); - } - - all_alarms_len += (size_t)gotlen; - alarm_set(alarm_buf); - - if (ups2000_alarm[i].status_name) - status_set(ups2000_alarm[i].status_name); - - /* - * Log the warning only if it's a new alarm, or if a long time - * has paseed since we first warned it. - */ - if (!ups2000_alarm[i].active || - difftime(now, alarm_logged_since) >= UPS2000_LOG_INTERVAL) { - int loglevel; - const char *alarm_word; - - /* - * Most text editors have syntax highlighting, adding an - * alarm word makes the log more readable - */ - loglevel = ups2000_alarm[i].loglevel; - if (loglevel <= LOG_ERR) { - alarm_word = "ERROR"; - /* - * If at least one error is serious, suggest reading - * manual. - */ - alarm_rtfm = 1; - } - else { - alarm_word = "WARNING"; - } - - upslogx(loglevel, "%s: alarm %02d, Cause %02d: %s!", - alarm_word, - ups2000_alarm[i].alarm_id, - ups2000_alarm[i].alarm_cause_id, - ups2000_alarm[i].alarm_name); - - if (ups2000_alarm[i].alarm_desc) - upslogx(loglevel, "%s", ups2000_alarm[i].alarm_desc); - - switch (ups2000_alarm[i].alarm_clear) { - case ALARM_CLEAR_AUTO: - upslogx(loglevel, "This alarm can be auto cleared."); - break; - case ALARM_CLEAR_MANUAL: - upslogx(loglevel, "This alarm can only be manual cleared " - "via front panel."); - break; - case ALARM_CLEAR_DEPENDING: - upslogx(loglevel, "This alarm is auto or manual cleared " - "depending on the specific problem."); - } - - ups2000_alarm[i].active = 1; - alarm_logged = 1; - } - - } - else { - if (ups2000_alarm[i].active) { - upslogx(LOG_WARNING, "Cleared alarm %02d, Cause %02d: %s", - ups2000_alarm[i].alarm_id, - ups2000_alarm[i].alarm_cause_id, - ups2000_alarm[i].alarm_name); - ups2000_alarm[i].active = 0; - alarm_logged = 1; - } - } - - } - - if (alarm_count > 0) { - /* append this to the alarm string as a friendly reminder */ - int gotlen = snprintf(alarm_buf, 128, "Check log for details!"); - - if (gotlen < 0 || (uintmax_t)gotlen > SIZE_MAX) { - fatalx(EXIT_FAILURE, "alarm_buf preparation over/under-flow!\n"); - } - - all_alarms_len += (size_t)gotlen; - alarm_set(alarm_buf); - - /* if the alarm string is too long, replace it with this */ - if (all_alarms_len + 1 > ST_MAX_VALUE_LEN) { - alarm_init(); /* discard all original alarms */ - snprintf(alarm_buf, 128, "UPS has %d alarms in effect, " - "check log for details!", alarm_count); - alarm_set(alarm_buf); - } - - /* - * If we are doing a syslog, write the final message and refresh the - * do-not-spam-the-log timer "alarm_logged_since". - */ - if (alarm_logged) { - upslogx(LOG_WARNING, "UPS has %d alarms in effect.", alarm_count); - if (alarm_rtfm) - upslogx(LOG_WARNING, "Read Huawei User Manual for " - "troubleshooting information."); - alarm_logged_since = time(NULL); - } - } - else { - upsdebugx(2, "UPS has 0 alarms in effect."); - - if (alarm_logged) { - upslogx(LOG_WARNING, "UPS has cleared all alarms."); - alarm_logged_since = time(NULL); - } - } - return 0; -} - - -void upsdrv_updateinfo(void) -{ - int err = 0; - - upsdebugx(2, "upsdrv_updateinfo"); - status_init(); - alarm_init(); - - err += ups2000_update_timers(); - err += ups2000_update_alarm(); - err += ups2000_update_info(); - err += ups2000_update_status(); - err += ups2000_update_rw_var(); - - if (err > 0) { - upsdebugx(2, "upsdrv_updateinfo failed, data stale."); - dstate_datastale(); - return; - } - - alarm_commit(); - status_commit(); - dstate_dataok(); - upsdebugx(2, "upsdrv_updateinfo done"); -} - - -/* - * A lookup table of simple RW (configurable) variable "name", and their - * "getter" and "setter". A "getter" function reads the variable from - * the UPS, and a "setter" overwrites it. - * - * This struct only handles simple variables, delays are handled in another - * table. - */ -static struct { - const char *name; - const uint16_t reg; - int (*const getter)(const uint16_t); - int (*const setter)(const uint16_t, const char *); -} ups2000_rw_var[] = -{ - { "ups.start.auto", 1044, ups2000_autostart_get, ups2000_autostart_set }, - { "ups.beeper.status", 1046, ups2000_beeper_get, ups2000_beeper_set }, - { NULL, 0, NULL, NULL }, -}; - - -/* - * A specialized lookup table of startup, reboot and shutdown delays, - * represented by RW variables. - */ -static struct ups2000_delay_t { - const char *name; /* RW variable name */ - uint16_t *const global_var; /* its corresponding global variable */ - const char *varname_cmdline; /* cmdline argument passed to us */ - const uint16_t min; /* minimum value allowed (seconds) */ - const uint16_t max; /* maximum value allowed (seconds) */ - const uint8_t step; /* can only be set in discrete steps */ - const uint16_t dfault; /* default value */ -} ups2000_rw_delay[] = -{ - /* 5940 = 99 min. */ - { "ups.delay.shutdown", &ups2000_offdelay, "offdelay", 6, 5940, 6, 60 }, - { "ups.delay.reboot", &ups2000_rebootdelay, "rebootdelay", 6, 5940, 6, 60 }, - { "ups.delay.start", &ups2000_ondelay, "ondelay", 60, 5940, 60, 60 }, - { NULL, NULL, NULL, 0, 0, 0, 0 }, -}; -enum { - SHUTDOWN, - REBOOT, - START -}; - - -static int ups2000_update_rw_var(void) -{ - int i; - int r; - - upsdebugx(2, "ups2000_update_rw_var"); - - for (i = 0; ups2000_rw_var[i].name != NULL; i++) { - r = ups2000_rw_var[i].getter(ups2000_rw_var[i].reg); - if (r != 0) - return 1; - } - - ups2000_delay_get(); - - return 0; -} - - -static int setvar(const char *name, const char *val) -{ - int i; - int r; - - for (i = 0; ups2000_rw_var[i].name != NULL; i++) { - if (!strcasecmp(ups2000_rw_var[i].name, name)) { - r = ups2000_rw_var[i].setter(ups2000_rw_var[i].reg, val); - goto found; - } - } - - for (i = 0; ups2000_rw_delay[i].name != NULL; i++) { - if (!strcasecmp(ups2000_rw_delay[i].name, name)) { - r = ups2000_rw_var[i].setter(ups2000_rw_var[i].reg, val); - goto found; - } - } - - return STAT_SET_UNKNOWN; - -found: - if (r == STAT_SET_FAILED) - upslogx(LOG_ERR, "setvar: setting variable [%s] to [%s] failed", name, val); - else if (r == STAT_SET_INVALID) - upslogx(LOG_WARNING, "setvar: [%s] is not valid for variable [%s]", val, name); - return r; -} - - -static int ups2000_autostart_get(const uint16_t reg) -{ - /* - * "ups.start.auto" is not supported because it overcomplicates - * the logic. The driver changes "ups.start.auto" internally to - * allow shutdown and reboot commands to do their jobs. If we make - * "ups.start.auto" an user configuration, it means we must (1) - * watch for UPS front panel updates and apply the user setting to - * the driver, and (2) save the restart setting temporally before - * restarting, track the UPS restart process, and program the value - * back later. - * - * Not supporting it greatly simplifies the logic - upsdrv_shutdown - * always put the UPS in a restartable mode, following the standard - * NUT behavior. Worse is better. (To prevent user confusion, we - * don't even report this variable, otherwise the user may attempt - * to change it using the front panel. - */ - NUT_UNUSED_VARIABLE(reg); - return 0; -} - - -/* - * Currently for internal use only, see comments above. - */ -static int ups2000_autostart_set(const uint16_t reg, const char *string) -{ - uint16_t val; - int r; - - if (!strcasecmp(string, "yes")) - val = 1; - else if (!strcasecmp(string, "no")) - val = 0; - else - return STAT_SET_INVALID; - - r = ups2000_write_register(modbus_ctx, reg + 10000, val); - if (r != 1) - return STAT_SET_FAILED; - - return STAT_SET_HANDLED; -} - - -static int ups2000_beeper_get(const uint16_t reg) -{ - uint16_t val; - int r; - - r = ups2000_read_registers(modbus_ctx, reg + 10000, 1, &val); - if (r != 1) - return -1; - - if (val != 0 && val != 1) - return -1; - - /* - * The register is "beeper disable", but we need to report whether it's - * enabled, thus we invert the boolean. - */ - if (val == 0) - dstate_setinfo("ups.beeper.status", "enabled"); - else - dstate_setinfo("ups.beeper.status", "disabled"); - - dstate_setflags("ups.beeper.status", ST_FLAG_RW); - dstate_addenum("ups.beeper.status", "enabled"); - dstate_addenum("ups.beeper.status", "disabled"); - - return 0; -} - - -static int ups2000_beeper_set(const uint16_t reg, const char *string) -{ - uint16_t val; - int r; - - if (!strcasecmp(string, "disabled") || !strcasecmp(string, "muted")) { - /* - * Temporary "muted" is not supported. Only permanent "disabled" - * is. This is why we only support "beeper.disable" as an instant - * command, not "beeper.muted". But when setting it as a variable, - * we try to be robust here and treat both as synonyms. - */ - val = 1; - } - else if (!strcasecmp(string, "enabled")) - val = 0; - else - return STAT_SET_INVALID; - - r = ups2000_write_register(modbus_ctx, reg + 10000, val); - if (r != 1) - return STAT_SET_FAILED; - - return STAT_SET_HANDLED; -} - - -/* - * Note: variables "ups.delay.{shutdown,start,reboot}" are software- - * only variables. We only get the user settings, validate its value - * and store them as global variables. The actual hardware register - * are only programmed when a shutdown/reboot is issued. - */ -static void ups2000_delay_get(void) -{ - char *cmdline; - int i; - int r; - - for (i = 0; ups2000_rw_delay[i].name != NULL; i++) { - struct ups2000_delay_t *delay; - - delay = &ups2000_rw_delay[i]; - if (*delay->global_var == UPS2000_DELAY_INVALID) { - cmdline = getval(delay->varname_cmdline); - if (cmdline) { - r = ups2000_delay_set(delay->name, cmdline); - if (r != STAT_SET_HANDLED) { - upslogx(LOG_ERR, "servar: %s is invalid. " - "Reverting to default %s %d seconds", - delay->varname_cmdline, - delay->varname_cmdline, - delay->dfault); - *delay->global_var = delay->dfault; - } - } - else { - *delay->global_var = delay->dfault; - upslogx(LOG_INFO, "setvar: use default %s %d seconds", - delay->varname_cmdline, delay->dfault); - } - } - - dstate_setinfo(delay->name, "%d", *delay->global_var); - dstate_setflags(delay->name, ST_FLAG_RW); - dstate_addrange(delay->name, delay->min, delay->max); - } -} - - -static int ups2000_delay_set(const char *var, const char *string) -{ - struct ups2000_delay_t *delay_schema = NULL; - uint16_t delay, delay_rounded; - int i; - int r; - - r = str_to_ushort_strict(string, &delay, 10); - if (!r) - return STAT_SET_INVALID; - - for (i = 0; ups2000_rw_delay[i].name != NULL; i++) { - if (!strcmp(ups2000_rw_delay[i].name, var)) { - delay_schema = &ups2000_rw_delay[i]; - break; - } - } - - if (!delay_schema) - return STAT_SET_UNKNOWN; - - if (delay > delay_schema->max) - return STAT_SET_INVALID; - if (delay < delay_schema->min) { - upslogx(LOG_NOTICE, "setvar: %s [%u] is too low, " - "it has been set to %u seconds\n", - delay_schema->varname_cmdline, delay, - delay_schema->min); - delay = delay_schema->min; - } - - if (delay % delay_schema->step != 0) { - delay_rounded = delay + delay_schema->step - delay % delay_schema->step; - upslogx(LOG_NOTICE, "setvar: %s [%u] is not a multiple of %d, " - "it has been rounded up to %u seconds\n", - delay_schema->varname_cmdline, delay, - delay_schema->step, delay_rounded); - delay = delay_rounded; - } - - *delay_schema->global_var = delay; - return STAT_SET_HANDLED; -} - - -/* - * A lookup table of all instant commands "cmd" and their - * corresponding registers "reg". For each instant command, - * it's handled by... - * - * 1. One register write, by writing "val1" to "reg1", the - * simplest case. - * - * 2. Two register writes, by writing "val1" to "reg1", and - * writing "val2" to "reg2". One after another. - * - * 3. Calling "*handler_func" and passing "reg1". This is - * used to handle commands that needs additional processing. - * If "reg1" is not necessary or unsuitable, "-1" is used. - */ -#define REG_NONE -1, -1 - -static struct ups2000_cmd_t { - const char *cmd; - const int16_t reg1, val1, reg2, val2; - int (*const handler_func)(const uint16_t); -} ups2000_cmd[] = -{ - { "test.battery.start.quick", 2028, 1, REG_NONE, NULL }, - { "test.battery.start.deep", 2021, 1, REG_NONE, NULL }, - { "test.battery.stop", 2023, 1, REG_NONE, NULL }, - { "beeper.enable", 1046, 0, REG_NONE, NULL }, - { "beeper.disable", 1046, 1, REG_NONE, NULL }, - { "load.off", 1045, 0, 1030, 1, NULL }, - { "bypass.stop", 1029, 1, 1045, 0, NULL }, - { "load.on", 1029, -1, REG_NONE, ups2000_instcmd_load_on }, - { "bypass.start", REG_NONE, REG_NONE, ups2000_instcmd_bypass_start }, - { "beeper.toggle", 1046, -1, REG_NONE, ups2000_instcmd_beeper_toggle }, - { "shutdown.stayoff", 1049, -1, REG_NONE, ups2000_instcmd_shutdown_stayoff }, - { "shutdown.return", REG_NONE, REG_NONE, ups2000_instcmd_shutdown_return }, - { "shutdown.reboot", REG_NONE, REG_NONE, ups2000_instcmd_shutdown_reboot }, - { "shutdown.reboot.graceful", REG_NONE, REG_NONE, ups2000_instcmd_shutdown_reboot_graceful }, - { NULL, -1, -1, -1, -1, NULL }, -}; - - -static void ups2000_init_instcmd(void) -{ - int i; - - for (i = 0; ups2000_cmd[i].cmd != NULL; i++) { - dstate_addcmd(ups2000_cmd[i].cmd); - } -} - - -static int instcmd(const char *cmd, const char *extra) -{ - int i; - int status; - struct ups2000_cmd_t *cmd_action = NULL; - NUT_UNUSED_VARIABLE(extra); - - for (i = 0; ups2000_cmd[i].cmd != NULL; i++) { - if (!strcasecmp(cmd, ups2000_cmd[i].cmd)) { - cmd_action = &ups2000_cmd[i]; - } - } - - if (!cmd_action) { - upslogx(LOG_WARNING, "instcmd: command [%s] unknown", cmd); - return STAT_INSTCMD_UNKNOWN; - } - - if (cmd_action->handler_func) { - /* handled by a function */ - if (cmd_action->reg1 < 0) { - upslogx(LOG_WARNING, "instcmd: command [%s] reg1 is negative", cmd); - return STAT_INSTCMD_UNKNOWN; - } else { - status = cmd_action->handler_func((uint16_t)cmd_action->reg1); - } - } - else if (cmd_action->reg1 >= 0 && cmd_action->val1 >= 0) { - /* handled by a register write */ - int r = ups2000_write_register(modbus_ctx, - 10000 + cmd_action->reg1, - (uint16_t)cmd_action->val1); - if (r == 1) - status = STAT_INSTCMD_HANDLED; - else - status = STAT_INSTCMD_FAILED; - - /* - * if the previous write succeeds and there is an additional - * register to write. - */ - if (r == 1 && cmd_action->reg2 >= 0 && cmd_action->val2 >= 0) { - r = ups2000_write_register(modbus_ctx, - 10000 + cmd_action->reg2, - (uint16_t)cmd_action->val2); - if (r == 1) - status = STAT_INSTCMD_HANDLED; - else - status = STAT_INSTCMD_FAILED; - } - } - else { - fatalx(EXIT_FAILURE, "invalid ups2000_cmd table!"); - } - - if (status == STAT_INSTCMD_FAILED) - upslogx(LOG_ERR, "instcmd: command [%s] failed", cmd); - else if (status == STAT_INSTCMD_HANDLED) - upslogx(LOG_INFO, "instcmd: command [%s] handled", cmd); - return status; -} - - -static int ups2000_instcmd_load_on(const uint16_t reg) -{ - int r; - const char *status; - - /* force refresh UPS status */ - status_init(); - r = ups2000_update_status(); - if (r != 0) { - /* - * When the UPS status is updated, the code must set either OL, OB, OL ECO, - * BYPASS, or OFF. These five options are mutually exclusive. If the register - * value is invalid and set none of these flags, failure code 1 is returned. - */ - dstate_datastale(); - return STAT_INSTCMD_FAILED; - } - status_commit(); - - status = dstate_getinfo("ups.status"); - if (strstr(status, "OFF")) { - /* no warning needed, continue at ups2000_write_register() below */ - } - else if (strstr(status, "OL") || strstr(status, "OB")) { - /* - * "Turning it on" has no effect if it's already on. Log a warning - * while still accepting and executing the command. - */ - upslogx(LOG_WARNING, "load.on: UPS is already on."); - upslogx(LOG_WARNING, "load.on: still executing command anyway."); - } - else if (strstr(status, "BYPASS")) { - /* - * If it's in bypass mode, reject this command. The UPS would otherwise - * enter normal mode, but "load.on" is not supposed to affect the - * normal/bypass status. Also log an error and suggest "bypass.stop". - */ - upslogx(LOG_ERR, "load.on error: UPS is already on, and is in bypass mode. " - "To enter normal mode, use bypass.stop"); - return STAT_INSTCMD_FAILED; - } - else { - /* unreachable, see comments for r != 0 at the beginning */ - upslogx(LOG_ERR, "load.on error: invalid ups.status (%s) detected. " - "Please file a bug report!", status); - return STAT_INSTCMD_FAILED; - } - - r = ups2000_write_register(modbus_ctx, 10000 + reg, 1); - if (r != 1) - return STAT_INSTCMD_FAILED; - return STAT_INSTCMD_HANDLED; -} - - -static int ups2000_instcmd_bypass_start(const uint16_t reg) -{ - int r; - NUT_UNUSED_VARIABLE(reg); - - /* force update alarms */ - alarm_init(); - r = ups2000_update_alarm(); - if (r != 0) - return STAT_INSTCMD_FAILED; - alarm_commit(); - - /* bypass input has a power failure, refuse to bypass */ - if (!bypass_available) { - upslogx(LOG_ERR, "bypass input is abnormal, refuse to enter bypass mode."); - return STAT_INSTCMD_FAILED; - } - - /* enable "bypass on shutdown" */ - r = ups2000_write_register(modbus_ctx, 10000 + 1045, 1); - if (r != 1) - return STAT_INSTCMD_FAILED; - - /* shutdown */ - r = ups2000_write_register(modbus_ctx, 10000 + 1030, 1); - if (r != 1) - return STAT_INSTCMD_FAILED; - - return STAT_INSTCMD_HANDLED; -} - - -static int ups2000_instcmd_beeper_toggle(const uint16_t reg) -{ - int r; - const char *string; - - r = ups2000_beeper_get(reg); - if (r != 0) - return STAT_INSTCMD_FAILED; - - string = dstate_getinfo("ups.beeper.status"); - if (!strcasecmp(string, "enabled")) - r = ups2000_beeper_set(reg, "disabled"); - else if (!strcasecmp(string, "disabled")) - r = ups2000_beeper_set(reg, "enabled"); - else - return STAT_INSTCMD_FAILED; - - if (r != STAT_SET_HANDLED) - return STAT_INSTCMD_FAILED; - - return STAT_INSTCMD_HANDLED; -} - - -/* - * "ups.shutdown.stayoff": wait an optional offdelay and shutdown. - * When the grid power returns, stay off. - */ -static int ups2000_instcmd_shutdown_stayoff(const uint16_t reg) -{ - uint16_t val; - int r; - - r = setvar("ups.start.auto", "no"); - if (r != STAT_SET_HANDLED) - return STAT_INSTCMD_FAILED; - - val = ups2000_offdelay * 10; /* scaling factor */ - val /= 60; /* convert to minutes */ - - r = ups2000_write_register(modbus_ctx, 10000 + reg, val); - if (r != 1) - return STAT_INSTCMD_FAILED; - - return STAT_INSTCMD_HANDLED; -} - - -/* - * Wait for "offdelay" second, turn off the load. Then, wait - * for "ondelay" seconds. If the grid power still exists or - * has returned after the timer, turn on the load. Otherwise, - * shutdown the UPS. When combined with "ups.start.auto", it - * guarantees the server can always be restarted even if there - * is a power race. - * - * "shutdown.return", "shutdown.reboot" and "shutdown.reboot. - * graceful" all rely on this function. - */ -static int ups2000_shutdown_guaranteed_return(uint16_t offdelay, uint16_t ondelay) -{ - int r; - uint16_t val[2]; - - r = setvar("ups.start.auto", "yes"); - if (r != STAT_SET_HANDLED) - return STAT_INSTCMD_FAILED; - - val[0] = (offdelay * 10) / 60; - val[1] = ondelay / 60; - - r = ups2000_write_registers(modbus_ctx, 1047 + 10000, 2, val); - if (r != 2) - return STAT_INSTCMD_FAILED; - - return STAT_INSTCMD_HANDLED; -} - - -/* - * "ups.shutdown.return": wait an optional "offdelay" and shutdown. - * When the grid power returns, power on the load. - */ -static int ups2000_instcmd_shutdown_return(const uint16_t reg) -{ - int r; - NUT_UNUSED_VARIABLE(reg); - - r = ups2000_shutdown_guaranteed_return(ups2000_offdelay, - ups2000_ondelay); - if (r == STAT_INSTCMD_HANDLED) { - shutdown_at = time_seek(time(NULL), ups2000_offdelay); - } - return r; -} - - -/* - * "ups.shutdown.reboot": shutdown as soon as possible using the - * smallest "rebootdelay" (inside the UPS, it's the same "ondelay" - * timer), restart after an "ondelay". - * - * In our implementation, it's like "ups.shutdown.return", just - * with a minimal "ondelay". - */ -static int ups2000_instcmd_shutdown_reboot(const uint16_t reg) -{ - int r; - NUT_UNUSED_VARIABLE(reg); - - r = ups2000_shutdown_guaranteed_return(ups2000_rw_delay[REBOOT].min, - ups2000_ondelay); - if (r == STAT_INSTCMD_HANDLED) { - reboot_at = time_seek(time(NULL), ups2000_rw_delay[REBOOT].min); - start_at = time_seek(reboot_at, ups2000_ondelay); - } - return r; -} - - -/* - * "ups.shutdown.reboot.graceful": shutdown after a "rebootdelay" - * (inside the UPS, it's the same "ondelay" timer), restart after - * an "ondelay". - * - * In our implementation, it's like "ups.shutdown.return", just - * with a "rebootdelay" instead of an "ondelay". - */ -static int ups2000_instcmd_shutdown_reboot_graceful(const uint16_t reg) -{ - int r; - NUT_UNUSED_VARIABLE(reg); - - r = ups2000_shutdown_guaranteed_return(ups2000_rebootdelay, - ups2000_ondelay); - if (r == STAT_INSTCMD_HANDLED) { - reboot_at = time_seek(time(NULL), ups2000_rebootdelay); - start_at = time_seek(reboot_at, ups2000_ondelay); - } - return r; -} - - -/* - * List of countdown timers and pointers to their corresponding - * global variables "at_time". They record estimated timestamps - * when the actions are supposed to be performed. - */ -static struct { - const char *name; - time_t *const at_time; -} ups2000_timers[] = { - { "ups.timer.reboot", &reboot_at }, - { "ups.timer.shutdown", &shutdown_at }, - { "ups.timer.start", &start_at }, - { NULL, NULL }, -}; - - -static int ups2000_update_timers(void) -{ - time_t now; - int eta; - int i; - - now = time(NULL); - - for (i = 0; ups2000_timers[i].name != NULL; i++) { - if (*ups2000_timers[i].at_time) { - eta = difftime(*ups2000_timers[i].at_time, now); - if (eta < 0) - eta = 0; - dstate_setinfo(ups2000_timers[i].name, "%d", eta); - } - else { - dstate_setinfo(ups2000_timers[i].name, "%d", -1); - } - } - return 0; -} - - -void upsdrv_shutdown(void) -{ - int r; - - r = instcmd("shutdown.reboot", ""); - if (r != STAT_INSTCMD_HANDLED) - fatalx(EXIT_FAILURE, "upsdrv_shutdown failed!"); -} - - -void upsdrv_help(void) -{ -} - - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ - char msg[64]; - - snprintf(msg, 64, "Set shutdown delay, in seconds, 6-second step" - " (default=%d)", ups2000_rw_delay[SHUTDOWN].dfault); - addvar(VAR_VALUE, "offdelay", msg); - - snprintf(msg, 64, "Set reboot delay, in seconds, 6-second step" - " (default=%d).", ups2000_rw_delay[REBOOT].dfault); - addvar(VAR_VALUE, "rebootdelay", msg); - - snprintf(msg, 64, "Set start delay, in seconds, 60-second step" - " (default=%d).", ups2000_rw_delay[START].dfault); - addvar(VAR_VALUE, "ondelay", msg); -} - - -void upsdrv_cleanup(void) -{ - if (modbus_ctx != NULL) { - modbus_close(modbus_ctx); - modbus_free(modbus_ctx); - } - ser_close(upsfd, device_path); -} - - -/* - * Seek time "t" forward or backward by n "seconds" without assuming - * the underlying type and format of "time_t". This ensures maximum - * portability. Although on POSIX and many other systems, "time_t" - * is guaranteed to be in seconds. - * - * On error, abort the program. - */ -static time_t time_seek(time_t t, int seconds) -{ - struct tm time_tm; - time_t time_output; - - if (!t) - fatalx(EXIT_FAILURE, "time_seek() failed!"); - - if (!gmtime_r(&t, &time_tm)) - fatalx(EXIT_FAILURE, "time_seek() failed!"); - - time_tm.tm_sec += seconds; - time_output = mktime(&time_tm); - - if (time_output == (time_t) -1) - fatalx(EXIT_FAILURE, "time_seek() failed!"); - - return time_output; -} - - -/* - * Read bytes from the UPS2000 serial port, until the buffer has - * nothing left to read (after ser_get_buf() times out). The buffer - * size is limited to buf_len (inclusive). - * - * On error, return 0. - * - * In the serial library, ser_get_buf() can be a short read, and - * ser_get_buf_let() requires a precalculated length, necessiates - * our own read function. - */ -static size_t ups2000_read_serial(uint8_t *buf, size_t buf_len) -{ - ssize_t bytes = 0; - size_t total = 0; - - /* wait 400 ms for the device to process our command */ - usleep(400 * 1000); - - while (buf_len > 0) { - bytes = ser_get_buf(upsfd, buf, buf_len, 1, 0); - if (bytes < 0) - return 0; /* read failure */ - else if (bytes == 0) - return total; /* nothing to read */ - - total += (size_t)bytes; /* increment byte counter */ - buf += bytes; /* advance buffer position */ - if ((size_t)bytes > buf_len) { - fatalx(EXIT_FAILURE, "ups2000_read_serial() read too much!"); - } - buf_len -= (size_t)bytes; /* decrement limiter */ - } - return 0; /* buffer exhaustion */ -} - - -/* - * Retry control. By default, we are in RETRY_ENABLE mode. For each - * register read, we retry three times (1 sec. between each attempt), - * before raising a fatal error and giving up. So far so good, but, - * if the link went down, all operation would fail and the program - * would become unresponsive due to excessive retrys. - * - * To prevent this problem, after the first fatal error, we stop all - * retry attempts by entering RETRY_DISABLE_TEMPORARY mode, allowing - * subsequent operation to fail without retry. Later, after the first - * success is encountered, we move back to RETRY_ENABLE mode. - */ -enum { - RETRY_ENABLE, - RETRY_DISABLE_TEMPORARY -}; -static int retry_status = RETRY_ENABLE; - - -/* - * Read one or more registers using libmodbus. - * - * This is simply a wrapper for libmodbus's modbus_read_registers() with - * retry and workaround logic. When an error has occured, we retry 3 times - * before giving up, allowing us to recover from non-fatal failures without - * triggering a data stale. - */ -static int ups2000_read_registers(modbus_t *ctx, int addr, int nb, uint16_t *dest) -{ - int i; - int r = -1; - - if (addr < 10000) - upslogx(LOG_ERR, "Invalid register read from %04d detected. " - "Please file a bug report!", addr); - - for (i = 0; i < 3; i++) { - r = modbus_read_registers(ctx, addr, nb, dest); - - /* generic retry for modbus read failures. */ - if (retry_status == RETRY_ENABLE && r != nb) { - upslogx(LOG_WARNING, "Register %04d has a read failure. Retrying...", addr); - sleep(1); - continue; - } - else if (r == nb) - retry_status = RETRY_ENABLE; - - /* - * Workaround for buggy register 2002 (battery status). Sometimes - * this register returns invalid values. This is a known problem - * and it's not fatal, so we use LOG_INFO. - */ - if (retry_status == RETRY_ENABLE && - addr == 12002 && (dest[0] < 2 || dest[0] > 5)) { - upslogx(LOG_INFO, "Battery status has a non-fatal read failure, it's usually harmless. Retrying... "); - sleep(1); - continue; - } - else if (addr == 12002 && dest[0] >= 2 && dest[0] <= 5) - retry_status = RETRY_ENABLE; - - return r; - } - - /* Give up */ - upslogx(LOG_WARNING, "Register %04d has a fatal read failure.", addr); - retry_status = RETRY_DISABLE_TEMPORARY; - return r; -} - - -static int ups2000_write_registers(modbus_t *ctx, int addr, int nb, uint16_t *src) -{ - int i; - int r = -1; - - if (addr < 10000) - upslogx(LOG_ERR, "Invalid register write to %04d detected. " - "Please file a bug report!", addr); - - for (i = 0; i < 3; i++) { - r = modbus_write_registers(ctx, addr, nb, src); - - /* generic retry for modbus write failures. */ - if (retry_status == RETRY_ENABLE && r != nb) { - upslogx(LOG_WARNING, "Register %04d has a write failure. Retrying...", addr); - sleep(1); - continue; - } - else if (r == nb) - retry_status = RETRY_ENABLE; - - return r; - } - - /* Give up */ - upslogx(LOG_WARNING, "Register %04d has a fatal write failure.", addr); - retry_status = RETRY_DISABLE_TEMPORARY; - return r; -} - - -static int ups2000_write_register(modbus_t *ctx, int addr, uint16_t val) -{ - return ups2000_write_registers(ctx, addr, 1, &val); -} - - -/* - * The following CRC-16 code was copied from libmodbus. - * - * Copyright (C) 2001-2011 Stéphane Raimbault - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - */ - -/* Table of CRC values for high-order byte */ -static const uint8_t table_crc_hi[] = { - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, - 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, - 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, - 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, - 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, - 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, - 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, - 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, - 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, - 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 -}; - -/* Table of CRC values for low-order byte */ -static const uint8_t table_crc_lo[] = { - 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06, - 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD, - 0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, - 0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A, - 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4, - 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6, 0xD2, 0x12, 0x13, 0xD3, - 0x11, 0xD1, 0xD0, 0x10, 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, - 0xF2, 0x32, 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4, - 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE, 0xFA, 0x3A, - 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38, 0x28, 0xE8, 0xE9, 0x29, - 0xEB, 0x2B, 0x2A, 0xEA, 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, - 0xEC, 0x2C, 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26, - 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0, 0xA0, 0x60, - 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62, 0x66, 0xA6, 0xA7, 0x67, - 0xA5, 0x65, 0x64, 0xA4, 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, - 0x6E, 0xAE, 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68, - 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA, 0xBE, 0x7E, - 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C, 0xB4, 0x74, 0x75, 0xB5, - 0x77, 0xB7, 0xB6, 0x76, 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, - 0x70, 0xB0, 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92, - 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54, 0x9C, 0x5C, - 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E, 0x5A, 0x9A, 0x9B, 0x5B, - 0x99, 0x59, 0x58, 0x98, 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, - 0x8A, 0x4A, 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C, - 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42, - 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 -}; - - -static uint16_t crc16(uint8_t * buffer, uint16_t buffer_length) -{ - uint8_t crc_hi = 0xFF; /* high CRC byte initialized */ - uint8_t crc_lo = 0xFF; /* low CRC byte initialized */ - unsigned int i; /* will index into CRC lookup */ - - /* pass through message buffer */ - while (buffer_length--) { - i = crc_hi ^ *buffer++; /* calculate the CRC */ - crc_hi = crc_lo ^ table_crc_hi[i]; - crc_lo = table_crc_lo[i]; - } - - return ((uint16_t)((uint16_t)(crc_hi) << 8) | (uint16_t)crc_lo); -} diff --git a/drivers/idowell-hid.c b/drivers/idowell-hid.c index f96958f..8545ff5 100644 --- a/drivers/idowell-hid.c +++ b/drivers/idowell-hid.c @@ -23,14 +23,12 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be first */ - #include "usbhid-ups.h" #include "idowell-hid.h" #include "main.h" /* for getval() */ #include "usb-common.h" -#define IDOWELL_HID_VERSION "iDowell HID 0.2" +#define IDOWELL_HID_VERSION "iDowell HID 0.1" /* FIXME: experimental flag to be put in upsdrv_info */ /* iDowell */ @@ -42,7 +40,7 @@ static usb_device_id_t idowell_usb_device_table[] = { { USB_DEVICE(IDOWELL_VENDORID, 0x0300), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; /* --------------------------------------------------------------- */ @@ -104,7 +102,7 @@ static hid_info_t idowell_hid2nut[] = { { "ups.timer.shutdown", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, { "ups.load", 0, 0, "UPS.PowerSummary.PercentLoad", NULL, "%.0f", 0, NULL }, { "ups.power.nominal", 0, 0, "UPS.Flow.[4].ConfigApparentPower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - + /* input page */ { "input.transfer.high", 0, 0, "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "input.transfer.low", 0, 0, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, @@ -168,5 +166,4 @@ subdriver_t idowell_subdriver = { idowell_format_model, idowell_format_mfr, idowell_format_serial, - fix_report_desc, }; diff --git a/drivers/ietf-mib.c b/drivers/ietf-mib.c index dd69a1e..f5d1f62 100644 --- a/drivers/ietf-mib.c +++ b/drivers/ietf-mib.c @@ -26,97 +26,80 @@ #include "ietf-mib.h" -#define IETF_MIB_VERSION "1.54" +#define IETF_MIB_VERSION "1.4" /* SNMP OIDs set */ #define IETF_OID_UPS_MIB "1.3.6.1.2.1.33.1." #define IETF_SYSOID ".1.3.6.1.2.1.33" -/* NOTE: Currently the Tripplite UPSes await user-validation of their - * real SNMP OID tree, so temporarily the IETF tree is used as "tripplite" - * for the mapping purposes; the devices ave their entry point OID though. - * For more details see: - * https://github.com/networkupstools/nut/issues/309 - * https://github.com/networkupstools/nut/issues/171 - * Also related to: - * https://github.com/networkupstools/nut/issues/270 - */ -#define TRIPPLITE_SYSOID ".1.3.6.1.4.1.850.1" - /* #define DEBUG */ static info_lkp_t ietf_battery_info[] = { - { 1, "" /* unknown */, NULL, NULL }, - { 2, "" /* batteryNormal */, NULL, NULL }, - { 3, "LB" /* batteryLow */, NULL, NULL }, - { 4, "LB" /* batteryDepleted */, NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" /* unknown */ }, + { 2, "" /* batteryNormal */}, + { 3, "LB" /* batteryLow */ }, + { 4, "LB" /* batteryDepleted */ }, + { 0, "NULL" } }; static info_lkp_t ietf_power_source_info[] = { - { 1, "" /* other */, NULL, NULL }, - { 2, "OFF" /* none */, NULL, NULL }, - { 3, "OL" /* normal */, NULL, NULL }, - { 4, "OL BYPASS" /* bypass */, NULL, NULL }, - { 5, "OB" /* battery */, NULL, NULL }, - { 6, "OL BOOST" /* booster */, NULL, NULL }, - { 7, "OL TRIM" /* reducer */, NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" /* other */ }, + { 2, "OFF" /* none */ }, + { 3, "OL" /* normal */ }, + { 4, "OL BYPASS" /* bypass */ }, + { 5, "OB" /* battery */ }, + { 6, "OL BOOST" /* booster */ }, + { 7, "OL TRIM" /* reducer */ }, + { 0, "NULL" } }; static info_lkp_t ietf_overload_info[] = { - { 1, "OVER", NULL, NULL }, /* output overload */ - { 0, NULL, NULL, NULL } + { 1, "OVER" }, /* output overload */ + { 0, "NULL" } }; static info_lkp_t ietf_test_active_info[] = { - { 1, "", NULL, NULL }, /* upsTestNoTestsInitiated */ - { 2, "", NULL, NULL }, /* upsTestAbortTestInProgress */ - { 3, "TEST", NULL, NULL }, /* upsTestGeneralSystemsTest */ - { 4, "TEST", NULL, NULL }, /* upsTestQuickBatteryTest */ - { 5, "CAL", NULL, NULL }, /* upsTestDeepBatteryCalibration */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* upsTestNoTestsInitiated */ + { 2, "" }, /* upsTestAbortTestInProgress */ + { 3, "TEST" }, /* upsTestGeneralSystemsTest */ + { 4, "TEST" }, /* upsTestQuickBatteryTest */ + { 5, "CAL" }, /* upsTestDeepBatteryCalibration */ + { 0, "NULL" } }; static info_lkp_t ietf_test_result_info[] = { - { 1, "done and passed", NULL, NULL }, - { 2, "done and warning", NULL, NULL }, - { 3, "done and error", NULL, NULL }, - { 4, "aborted", NULL, NULL }, - { 5, "in progress", NULL, NULL }, - { 6, "no test initiated", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "done and passed" }, + { 2, "done and warning" }, + { 3, "done and error" }, + { 4, "aborted" }, + { 5, "in progress" }, + { 6, "no test initiated" }, + { 0, "NULL" } }; #ifdef DEBUG static info_lkp_t ietf_shutdown_type_info[] = { - { 1, "output", NULL, NULL }, - { 2, "system", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "output" }, + { 2, "system" }, + { 0, "NULL" } }; #endif static info_lkp_t ietf_yes_no_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "no", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "yes" }, + { 2, "no" }, + { 0, "NULL" } }; static info_lkp_t ietf_beeper_status_info[] = { - { 1, "disabled", NULL, NULL }, - { 2, "enabled", NULL, NULL }, - { 3, "muted", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "disabled" }, + { 2, "enabled" }, + { 3, "muted" }, + { 0, "NULL" } }; /* Snmp2NUT lookup table info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */ static snmp_info_t ietf_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* The Device Identification group */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.1.0", "Generic", SU_FLAG_STATIC, NULL }, /* upsIdentManufacturer */ { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "1.2.0", "Generic SNMP UPS", SU_FLAG_STATIC, NULL }, /* upsIdentModel */ @@ -141,7 +124,7 @@ static snmp_info_t ietf_mib[] = { #ifdef DEBUG { "debug.upsInputLineBads", 0, 1.0, IETF_OID_UPS_MIB "3.1.0", "", 0, NULL }, /* upsInputLineBads */ #endif - { "input.phases", 0, 1.0, IETF_OID_UPS_MIB "3.2.0", "", 0, NULL }, /* upsInputNumLines */ + { "input.phases", 0, 1.0, IETF_OID_UPS_MIB "3.2.0", "", SU_FLAG_SETINT, NULL, &input_phases }, /* upsInputNumLines */ #ifdef DEBUG { "debug.upsInputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.1.1", "", SU_INPUT_1, NULL }, /* upsInputLineIndex */ { "debug.[1].upsInputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "3.3.1.1.1", "", SU_INPUT_3, NULL }, @@ -168,7 +151,7 @@ static snmp_info_t ietf_mib[] = { /* Output Group */ { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "4.1.0", "", SU_STATUS_PWR, ietf_power_source_info }, /* upsOutputSource */ { "output.frequency", 0, 0.1, IETF_OID_UPS_MIB "4.2.0", "", 0, NULL }, /* upsOutputFrequency */ - { "output.phases", 0, 1.0, IETF_OID_UPS_MIB "4.3.0", "", 0, NULL }, /* upsOutputNumLines */ + { "output.phases", 0, 1.0, IETF_OID_UPS_MIB "4.3.0", "", SU_FLAG_SETINT, NULL, &output_phases }, /* upsOutputNumLines */ #ifdef DEBUG { "debug.upsOutputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.1.1", "", SU_OUTPUT_1, NULL }, /* upsOutputLineIndex */ { "debug.[1].upsOutputLineIndex", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.1.1", "", SU_OUTPUT_3, NULL }, @@ -193,7 +176,7 @@ static snmp_info_t ietf_mib[] = { { "output.L3.power.percent", 0, 1.0, IETF_OID_UPS_MIB "4.4.1.5.3", "", SU_OUTPUT_3, NULL }, /* Bypass Group */ - { "input.bypass.phases", 0, 1.0, IETF_OID_UPS_MIB "5.2.0", "", 0, NULL }, /* upsBypassNumLines */ + { "input.bypass.phases", 0, 1.0, IETF_OID_UPS_MIB "5.2.0", "", SU_FLAG_SETINT, NULL, &bypass_phases }, /* upsBypassNumLines */ { "input.bypass.frequency", 0, 0.1, IETF_OID_UPS_MIB "5.1.0", "", SU_BYPASS_1 | SU_BYPASS_3, NULL }, /* upsBypassFrequency */ #ifdef DEBUG { "debug.upsBypassLineIndex", 0, 1.0, IETF_OID_UPS_MIB "5.3.1.1.1", "", SU_BYPASS_1, NULL }, /* upsBypassLineIndex */ @@ -247,10 +230,10 @@ static snmp_info_t ietf_mib[] = { /* Test Group */ { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "7.1.0", "", 0, ietf_test_active_info }, /* upsTestId */ - { "test.battery.stop", 0, 1, IETF_OID_UPS_MIB "7.1.0", "0", SU_TYPE_CMD, NULL }, /* upsTestAbortTestInProgress */ - { "test.battery.start", 0, 1, IETF_OID_UPS_MIB "7.1.0", "0", SU_TYPE_CMD, NULL }, /* upsTestGeneralSystemsTest */ - { "test.battery.start.quick", 0, 1, IETF_OID_UPS_MIB "7.1.0", "0", SU_TYPE_CMD, NULL }, /* upsTestQuickBatteryTest */ - { "test.battery.start.deep", 0, 1, IETF_OID_UPS_MIB "7.1.0", "0", SU_TYPE_CMD, NULL }, /* upsTestDeepBatteryCalibration */ + { "test.battery.stop", 0, 0, IETF_OID_UPS_MIB "7.1.0", IETF_OID_UPS_MIB "7.7.2", SU_TYPE_CMD, NULL }, /* upsTestAbortTestInProgress */ + { "test.battery.start", 0, 0, IETF_OID_UPS_MIB "7.1.0", IETF_OID_UPS_MIB "7.7.3", SU_TYPE_CMD, NULL }, /* upsTestGeneralSystemsTest */ + { "test.battery.start.quick", 0, 0, IETF_OID_UPS_MIB "7.1.0", IETF_OID_UPS_MIB "7.7.4", SU_TYPE_CMD, NULL }, /* upsTestQuickBatteryTest */ + { "test.battery.start.deep", 0, 0, IETF_OID_UPS_MIB "7.1.0", IETF_OID_UPS_MIB "7.7.5", SU_TYPE_CMD, NULL }, /* upsTestDeepBatteryCalibration */ #ifdef DEBUG { "debug.upsTestSpinLock", 0, 1.0, IETF_OID_UPS_MIB "7.2.0", "", 0, NULL }, /* upsTestSpinLock */ #endif @@ -266,9 +249,9 @@ static snmp_info_t ietf_mib[] = { { "debug.upsShutdownType", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "8.1.0", "", 0, ietf_shutdown_type_info }, /* upsShutdownType */ #endif { "ups.timer.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 8, IETF_OID_UPS_MIB "8.2.0", "", 0, NULL }, /* upsShutdownAfterDelay*/ - { "load.off", 0, 1, IETF_OID_UPS_MIB "8.2.0", "0", SU_TYPE_CMD, NULL }, + { "load.off", 0, 0, IETF_OID_UPS_MIB "8.2.0", "", SU_TYPE_CMD, NULL }, { "ups.timer.start", ST_FLAG_STRING | ST_FLAG_RW, 8, IETF_OID_UPS_MIB "8.3.0", "", 0, NULL }, /* upsStartupAfterDelay */ - { "load.on", 0, 1, IETF_OID_UPS_MIB "8.3.0", "0", SU_TYPE_CMD, NULL }, + { "load.on", 0, 0, IETF_OID_UPS_MIB "8.3.0", "", SU_TYPE_CMD, NULL }, { "ups.timer.reboot", ST_FLAG_STRING | ST_FLAG_RW, 8, IETF_OID_UPS_MIB "8.4.0", "", 0, NULL }, /* upsRebootWithDuration */ { "ups.start.auto", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "8.5.0", "", 0, ietf_yes_no_info }, /* upsAutoRestart */ @@ -281,9 +264,9 @@ static snmp_info_t ietf_mib[] = { { "output.realpower.nominal", 0, 1.0, IETF_OID_UPS_MIB "9.6.0", "", 0, NULL }, /* upsConfigOutputPower */ { "battery.runtime.low", 0, 60.0, IETF_OID_UPS_MIB "9.7.0", "", 0, NULL }, /* upsConfigLowBattTime */ { "ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_UPS_MIB "9.8.0", "", 0, ietf_beeper_status_info }, /* upsConfigAudibleStatus */ - { "beeper.disable", 0, 1, IETF_OID_UPS_MIB "9.8.0", "1", SU_TYPE_CMD, NULL }, - { "beeper.enable", 0, 1, IETF_OID_UPS_MIB "9.8.0", "2", SU_TYPE_CMD, NULL }, - { "beeper.mute", 0, 1, IETF_OID_UPS_MIB "9.8.0", "3", SU_TYPE_CMD, NULL }, + { "beeper.disable", 0, 1, IETF_OID_UPS_MIB "9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.enable", 0, 2, IETF_OID_UPS_MIB "9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.mute", 0, 3, IETF_OID_UPS_MIB "9.8.0", "", SU_TYPE_CMD, NULL }, { "input.transfer.low", 0, 1.0, IETF_OID_UPS_MIB "9.9.0", "", 0, NULL }, /* upsConfigLowVoltageTransferPoint */ { "input.transfer.high", 0, 1.0, IETF_OID_UPS_MIB "9.10.0", "", 0, NULL }, /* upsConfigHighVoltageTransferPoint */ @@ -291,12 +274,4 @@ static snmp_info_t ietf_mib[] = { { NULL, 0, 0, NULL, NULL, 0, NULL } }; -/* FIXME: Rename the structure here (or even relocate to new file) - * and in snmp-ups.c when the real TrippLite mappings get defined. */ -/* FIXME: Duplicate the line below to fix an issue with the code generator (nut-snmpinfo.py -> line is discarding) */ -/*mib2nut_info_t tripplite_ietf = { "tripplite", IETF_MIB_VERSION, NULL, NULL, ietf_mib, TRIPPLITE_SYSOID, NULL };*/ -mib2nut_info_t tripplite_ietf = { "tripplite", IETF_MIB_VERSION, NULL, NULL, ietf_mib, TRIPPLITE_SYSOID, NULL }; - -/* FIXME: Duplicate the line below to fix an issue with the code generator (nut-snmpinfo.py -> line is discarding) */ -/*mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_UPS_MIB "4.1.0", IETF_OID_UPS_MIB "1.1.0", ietf_mib, IETF_SYSOID, NULL };*/ -mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_UPS_MIB "4.1.0", IETF_OID_UPS_MIB "1.1.0", ietf_mib, IETF_SYSOID, NULL }; +mib2nut_info_t ietf = { "ietf", IETF_MIB_VERSION, IETF_OID_UPS_MIB "4.1.0", IETF_OID_UPS_MIB "1.1.0", ietf_mib, IETF_SYSOID }; diff --git a/drivers/ietf-mib.h b/drivers/ietf-mib.h index b9ddedc..d1c32ac 100644 --- a/drivers/ietf-mib.h +++ b/drivers/ietf-mib.h @@ -5,6 +5,5 @@ #include "snmp-ups.h" extern mib2nut_info_t ietf; -extern mib2nut_info_t tripplite_ietf; #endif /* IETF_MIB_H */ diff --git a/drivers/isbmex.c b/drivers/isbmex.c index 8762562..17328b2 100644 --- a/drivers/isbmex.c +++ b/drivers/isbmex.c @@ -27,7 +27,7 @@ #include #define DRIVER_NAME "ISBMEX UPS driver" -#define DRIVER_VERSION "0.07" +#define DRIVER_VERSION "0.06" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -40,7 +40,6 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -/* FIXME: Replace with proper upsdebugx() et al */ #define xDEBUG #ifdef DEBUG @@ -53,7 +52,7 @@ upsdrv_info_t upsdrv_info = { #define MAXTRIES 15 /* #define IGNCHARS "" */ -static float lagrange(unsigned int vbyte) +float lagrange(unsigned int vbyte) { float f0, f1, f2, f3, f4, f5, f6; float a, b, c, d, e, g, h; @@ -101,7 +100,7 @@ static float lagrange(unsigned int vbyte) return a + b + c + d + e + g + h; } -static float interpol(float vbytes) +float interpol(float vbytes) { const int x[7]={75,83,87,98,103,118,145}; const float f[7]={96.0,102.0,105.0,113.0,116.0,124.0,140.0}; @@ -142,187 +141,173 @@ void upsdrv_initinfo(void) dstate_setinfo("input.transfer.high", "140.0"); /* defined */ dstate_setinfo("output.voltage", "120.0"); /* defined */ - - /* addinfo(INFO_, "", 0, 0); */ - /*printf("Using %s %s on %s\n", getdata(INFO_MFR), getdata(INFO_MODEL), device_path);*/ + + /* addinfo(INFO_, "", 0, 0); */ + /*printf("Using %s %s on %s\n", getdata(INFO_MFR), getdata(INFO_MODEL), device_path);*/ } static const char *getpacket(int *we_know){ - fd_set readfds; - struct timeval tv; - int bytes_per_packet=0; - int ret; - static const char *packet_id=NULL; - static char buf[256]; - const char *s; - ssize_t r; + fd_set readfds; + struct timeval tv; + int bytes_per_packet=0; + int ret; + static const char *packet_id=NULL; + static char buf[256]; + const char *s; + ssize_t r; - bytes_per_packet=*we_know; - D(printf("getpacket with %d\n",bytes_per_packet);) - - FD_ZERO(&readfds); - FD_SET(upsfd,&readfds); + + bytes_per_packet=*we_know; + D(printf("getpacket with %d\n",bytes_per_packet);) + + FD_ZERO(&readfds); + FD_SET(upsfd,&readfds); /* Wait up to 2 seconds. */ - tv.tv_sec = 5; - tv.tv_usec = 0; + tv.tv_sec = 5; + tv.tv_usec = 0; + + ret=select(upsfd+1, &readfds, NULL, NULL, &tv); + if (!ret) { + s="Nothing received from UPS. Check cable conexion"; + upslogx(LOG_ERR, "%s", s); + D(printf("%s\n",s);) + return NULL; + } - ret=select(upsfd+1, &readfds, NULL, NULL, &tv); - if (!ret) { - s="Nothing received from UPS. Check cable conexion"; - upslogx(LOG_ERR, "%s", s); - D(printf("%s\n",s);) - return NULL; - } - - r=read(upsfd,buf,255); - D(printf("%zd bytes read: ",r);) - buf[r]=0; - if (bytes_per_packet && r < bytes_per_packet){ - ssize_t rr; - D(printf("short read...\n");) - usleep(500000); - tv.tv_sec = 2; - tv.tv_usec = 0; - ret=select(upsfd+1, &readfds, NULL, NULL, &tv); - if (!ret) return NULL; - /* Casting is okay since bytes_per_packet is small - * and r is smaller, so 255-r is positive */ - assert (r <= 255); - rr = read(upsfd, buf+r, (size_t)(255-r)); - r += rr; - if (r < bytes_per_packet) return NULL; - } - - if (!bytes_per_packet){ /* packet size determination */ - /* - if (r%10 && r%9) { - printf("disregarding incomplete packet\n"); - return NULL; - } - */ - if (r%10==0) - *we_know=10; - else if (r%9==0) - *we_know=9; - return NULL; - } - - /* by here we have bytes_per_packet and a complete packet */ - /* lets check if within the complete packet we have a valid packet */ - if (bytes_per_packet == 10) - packet_id="&&&"; - else - packet_id="***"; - s=strstr(buf,packet_id); - /* check validity of packet */ - if (!s) { - s="isbmex: no valid packet signature!"; - upslogx(LOG_ERR, "%s", s); - D(printf("%s\n",s);) - *we_know=0; - return NULL; - } - D(if (s != buf) printf("overlapping packet received\n");) - if ((int) strlen(s) < bytes_per_packet) { - D(printf("incomplete packet information\n");) - return NULL; - } + r=read(upsfd,buf,255); + D(printf("%d bytes read: ",r);) + buf[r]=0; + if (bytes_per_packet && r < bytes_per_packet){ + ssize_t rr; + D(printf("short read...\n");) + usleep(500000); + tv.tv_sec = 2; + tv.tv_usec = 0; + ret=select(upsfd+1, &readfds, NULL, NULL, &tv); + if (!ret) return NULL; + rr=read(upsfd,buf+r,255-r); + r += rr; + if (r < bytes_per_packet) return NULL; + } + + if (!bytes_per_packet){ /* packet size determination */ + /* if (r%10 && r%9) { + printf("disregarding incomplete packet\n"); + return NULL; + }*/ + if (r%10==0) *we_know=10; + else if (r%9==0) *we_know=9; + return NULL; + } + + /* by here we have bytes_per_packet and a complete packet */ + /* lets check if within the complete packet we have a valid packet */ + if (bytes_per_packet == 10) packet_id="&&&"; else packet_id="***"; + s=strstr(buf,packet_id); + /* check validity of packet */ + if (!s) { + s="isbmex: no valid packet signature!"; + upslogx(LOG_ERR, "%s", s); + D(printf("%s\n",s);) + *we_know=0; + return NULL; + } + D(if (s != buf) printf("overlapping packet received\n");) + if ((int) strlen(s) < bytes_per_packet) { + D(printf("incomplete packet information\n");) + return NULL; + } #ifdef DEBUG - printf("Got signal:"); - {int i;for (i=0;i",(unsigned char)s[i]);} - printf("\n"); + printf("Got signal:"); + {int i;for (i=0;i",(unsigned char)s[i]);} + printf("\n"); #endif - - return s; + + return s; } void upsdrv_updateinfo(void) { - static float high_volt=-1, low_volt=999; - const char *buf=NULL; - char buf2[17]; - int i; - static int bytes_per_packet=0; + static float high_volt=-1, low_volt=999; + const char *buf=NULL; + char buf2[17]; + int i; + static int bytes_per_packet=0; - for (i=0;i<5;i++) { - if ((buf=getpacket(&bytes_per_packet)) != NULL) break; - } - if (!bytes_per_packet || !buf) { - dstate_datastale(); - return; - } - - /* do the parsing */ - { - float in_volt,battpct,acfreq; - double d; - D(printf("parsing (%d bytes per packet)\n",bytes_per_packet);) - /* input voltage :*/ - if (bytes_per_packet==9) { - in_volt = lagrange((unsigned char)buf[3]); - } else { - in_volt = interpol(sqrt((float)((unsigned char)buf[3]*256+(unsigned char)buf[4]))); - } - snprintf(buf2,16,"%5.1f",in_volt); - D(printf("utility=%s\n",buf2);) - dstate_setinfo("input.voltage", "%s", buf2); - - if (in_volt >= high_volt) high_volt=in_volt; - snprintf(buf2,16,"%5.1f",high_volt); - D(printf("highvolt=%s\n",buf2);) - dstate_setinfo("input.voltage.maximum", "%s", buf2); - - if (in_volt <= low_volt) low_volt=in_volt; - snprintf(buf2,16,"%5.1f",low_volt); - D(printf("lowvolt=%s\n",buf2);) - dstate_setinfo("input.voltage.minimum", "%s", buf2); - - battpct = ((double)((unsigned char)buf[(bytes_per_packet==10)?5:4])-168.0)*(100.0/(215.0-168.0)); - snprintf(buf2,16,"%5.1f",battpct); - D(printf("battpct=%s\n",buf2);) - dstate_setinfo("battery.charge", "%s", buf2); - - d=(unsigned char)buf[(bytes_per_packet==10)?6:5]*256 - + (unsigned char)buf[(bytes_per_packet==10)?7:6]; - acfreq = 1000000/d; - snprintf(buf2,16,"%5.2f",acfreq); - D(printf("acfreq=%s\n",buf2);) - dstate_setinfo("input.frequency", "%s", buf2); - - D(printf("status: ");) - status_init(); - switch (buf[(bytes_per_packet==10)?8:7]){ - case 48: break; /* normal operation */ - case 49: D(printf("BOOST ");) - status_set("BOOST"); - break; - case 50: D(printf("TRIM ");) - status_set("TRIM"); - break; - default: break; - } - switch (buf[(bytes_per_packet==10)?9:8]){ - case 48: D(printf("OL ");) - status_set("OL"); - break; - case 50: D(printf("LB ");) - status_set("LB"); - /* break; */ - /* FIXME? Can this device set independently LB and OB? */ - goto fallthrough_LB_means_OB; - /* FALLTHRU */ - case 49: - fallthrough_LB_means_OB: - D(printf("OB ");) - status_set("OB"); - break; - default: break; - } - D(printf("\n");) - status_commit(); - } - dstate_dataok(); + for (i=0;i<5;i++) { + if ((buf=getpacket(&bytes_per_packet)) != NULL) break; + } + if (!bytes_per_packet || !buf) { + dstate_datastale(); return; + } + + /* do the parsing */ + { + float in_volt,battpct,acfreq; + double d; + D(printf("parsing (%d bytes per packet)\n",bytes_per_packet);) + /* input voltage :*/ + if (bytes_per_packet==9) { + in_volt = lagrange((unsigned char)buf[3]); + } else { + in_volt = interpol(sqrt((float)((unsigned char)buf[3]*256+(unsigned char)buf[4]))); + } + snprintf(buf2,16,"%5.1f",in_volt); + D(printf("utility=%s\n",buf2);) + dstate_setinfo("input.voltage", "%s", buf2); + + if (in_volt >= high_volt) high_volt=in_volt; + snprintf(buf2,16,"%5.1f",high_volt); + D(printf("highvolt=%s\n",buf2);) + dstate_setinfo("input.voltage.maximum", "%s", buf2); + + if (in_volt <= low_volt) low_volt=in_volt; + snprintf(buf2,16,"%5.1f",low_volt); + D(printf("lowvolt=%s\n",buf2);) + dstate_setinfo("input.voltage.minimum", "%s", buf2); + + battpct = ((double)((unsigned char)buf[(bytes_per_packet==10)?5:4])-168.0)*(100.0/(215.0-168.0)); + snprintf(buf2,16,"%5.1f",battpct); + D(printf("battpct=%s\n",buf2);) + dstate_setinfo("battery.charge", "%s", buf2); + + d=(unsigned char)buf[(bytes_per_packet==10)?6:5]*256 + + (unsigned char)buf[(bytes_per_packet==10)?7:6]; + acfreq = 1000000/d; + snprintf(buf2,16,"%5.2f",acfreq); + D(printf("acfreq=%s\n",buf2);) + dstate_setinfo("input.frequency", "%s", buf2); + + D(printf("status: ");) + status_init(); + switch (buf[(bytes_per_packet==10)?8:7]){ + case 48: break; /* normal operation */ + case 49: D(printf("BOOST ");) + status_set("BOOST"); + break; + case 50: D(printf("TRIM ");) + status_set("TRIM"); + default: break; + } + switch (buf[(bytes_per_packet==10)?9:8]){ + case 48: D(printf("OL ");) + status_set("OL"); + break; + case 50: D(printf("LB ");) + status_set("LB"); + case 49: D(printf("OB ");) + status_set("OB"); + break; + default: break; + } + D(printf("\n");) + status_commit(); + + + } + dstate_dataok(); + return; } void upsdrv_shutdown(void) @@ -331,9 +316,9 @@ void upsdrv_shutdown(void) * contact closure. Some ISB models with serial * support support contact closure, some don't. * If yours does support it, then a 12V signal - * on pin 9 does the trick (only when ups is + * on pin 9 does the trick (only when ups is * on OB condition) */ - /* + /* * here try to do the pin 9 trick, if it does not * work, else:*/ /* fatalx(EXIT_FAILURE, "Shutdown only supported with the Generic Driver, type 6 and special cable"); */ diff --git a/drivers/ivtscd.c b/drivers/ivtscd.c index 1c3cee7..d8ae507 100644 --- a/drivers/ivtscd.c +++ b/drivers/ivtscd.c @@ -18,13 +18,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" #include "main.h" #include "serial.h" -#include "attribute.h" #define DRIVER_NAME "IVT Solar Controller driver" -#define DRIVER_VERSION "0.03" +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -51,11 +49,10 @@ static struct { float temperature; } battery; -static ssize_t ivt_status(void) +static int ivt_status(void) { char reply[SMALLBUF]; - int i, j = 0; - ssize_t ret; + int ret, i, j = 0; ser_flush_io(upsfd); @@ -76,7 +73,7 @@ static ssize_t ivt_status(void) upsdebugx(3, "send: F"); sleep(1); /* allow controller some time to digest this */ - + /* * read: R:12,57;- 1,1;20;12,57;13,18;- 2,1; 1,5;\n */ @@ -93,7 +90,7 @@ static ssize_t ivt_status(void) } upsdebugx(3, "read: %.*s", (int)strcspn(reply, "\r\n"), reply); - upsdebug_hex(4, " \\_", reply, (size_t)ret); + upsdebug_hex(4, " \\_", reply, ret); for (i = 0; i < ret; i++) { switch(reply[i]) @@ -115,7 +112,7 @@ static ssize_t ivt_status(void) ret = sscanf(reply, "R:%f;%f;%f;%f;%f;%f;%f;", &battery.voltage.act, &battery.current.act, &battery.temperature, &battery.voltage.min, &battery.voltage.max, &battery.current.min, &battery.current.max); - upsdebugx(3, "Parsed %zd parameters from reply", ret); + upsdebugx(3, "Parsed %d parameters from reply", ret); return ret; } @@ -126,10 +123,10 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } - + void upsdrv_initinfo(void) { if (ivt_status() < 7) { @@ -180,9 +177,6 @@ void upsdrv_updateinfo(void) dstate_dataok(); } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { while (1) { diff --git a/drivers/legrand-hid.c b/drivers/legrand-hid.c deleted file mode 100644 index 3715553..0000000 --- a/drivers/legrand-hid.c +++ /dev/null @@ -1,236 +0,0 @@ -/* legrand-hid.c - subdriver to monitor Legrand USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2018 Gabriele Taormina , for Legrand - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "common.h" -#include "usbhid-ups.h" -#include "legrand-hid.h" -#include "main.h" -#include "usb-common.h" - -#define LEGRAND_HID_VERSION "Legrand HID 0.2" - -/* Legrand VendorID and ProductID */ -#define LEGRAND_VID 0x1cb0 /* Legrand */ -#define LEGRAND_PID_PDU 0x0038 /* Keor PDU model (800VA) */ -#define LEGRAND_PID_SP 0x0032 /* Keor SP model (600, 800, 1000, 1500, 2000VA version) */ - -static void *disable_interrupt_pipe(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - if (!use_interrupt_pipe) - return NULL; - use_interrupt_pipe = FALSE; - upslogx(LOG_INFO, "interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)"); - return NULL; -} - -/* USB IDs device table */ -static usb_device_id_t legrand_usb_device_table[] = { - { USB_DEVICE(LEGRAND_VID, LEGRAND_PID_PDU), disable_interrupt_pipe }, /* Legrand Keor PDU */ - { USB_DEVICE(LEGRAND_VID, LEGRAND_PID_SP), disable_interrupt_pipe }, /* Legrand Keor SP */ - - /* Terminating entry */ - { 0, 0, NULL } -}; - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -/* LEGRAND usage table */ -static usage_lkp_t legrand_usage_lkp[] = { - { NULL, 0 } -}; - -static usage_tables_t legrand_utab[] = { - legrand_usage_lkp, - hid_usage_lkp, - NULL, -}; - -static const char *legrand_times10(double value) -{ - static char buf[20]; - snprintf(buf, sizeof(buf), "%0.1f", value * 10); - return buf; -} - -static info_lkp_t legrand_times10_info[] = { - { 0, NULL, legrand_times10, NULL }, - { 0, NULL, NULL, NULL } -}; - -static const char *legrand_times100k(double value) -{ - static char buf[20]; - snprintf(buf, sizeof(buf), "%0.1f", value * 100000); - return buf; -} - -static info_lkp_t legrand_times100k_info[] = { - { 0, NULL, legrand_times100k, NULL }, - { 0, NULL, NULL, NULL } -}; - -static const char *legrand_times1M(double value) -{ - static char buf[20]; - snprintf(buf, sizeof(buf), "%0.1f", value * 1000000); - return buf; -} - -static info_lkp_t legrand_times1M_info[] = { - { 0, NULL, legrand_times1M, NULL }, - { 0, NULL, NULL, NULL } -}; - -static const char *legrand_times10M(double value) -{ - static char buf[20]; - snprintf(buf, sizeof(buf), "%0.1f", value * 10000000); - return buf; -} - -static info_lkp_t legrand_times10M_info[] = { - { 0, NULL, legrand_times10M, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t legrand_hid2nut[] = { - /* Input Data */ - { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.0f", 0, NULL }, - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%.0f", 0, legrand_times1M_info }, - { "input.transfer.high", 0, 0, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.transfer.high", 0, 0, "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, legrand_times10_info }, - { "input.transfer.low", 0, 0, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.transfer.low", 0, 0, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.voltage.nominal", 0, 0, "UPS.Input.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - - /* Battery Data */ - { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, divide_by_10_conversion }, - { "battery.voltage.nominal", 0, 0, "UPS.BatterySystem.Battery.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.0f", 0, divide_by_10_conversion }, - { "battery.voltage", 0, 0, "UPS.BatterySystem.Battery.Voltage", NULL, "%.0f", 0, legrand_times100k_info }, - { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, - { "battery.runtime", 0, 0, "UPS.PowerSummary.RuntimeToEmpty", NULL, "%.0f", 0, NULL }, - { "battery.charge.warning", 0, 0, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "battery.charge.low", 0, 0, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - - /* Output Data */ - { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.0f", 0, NULL }, - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.0f", 0, legrand_times10M_info }, - { "output.frequency", 0, 0, "UPS.Output.Frequency", NULL, "%.0f", 0, NULL }, - { "ups.load", 0, 0, "UPS.Output.PercentLoad", NULL, "%.0f", 0, NULL }, - { "ups.load", 0, 0, "UPS.OutletSystem.Outlet.PercentLoad", NULL, "%.0f", 0, NULL }, - { "ups.realpower.nominal", 0, 0, "UPS.Output.ConfigActivePower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "ups.realpower.nominal", 0, 0, "UPS.Flow.ConfigApparentPower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - - /* UPS Status */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, lowbatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - { "BOOL", 0, 0, "UPS.Output.Overload", NULL, NULL, HU_FLAG_QUICK_POLL, overload_info }, - - /* Delays */ - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL }, - { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL }, - { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Output.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL }, - { "ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Output.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_FLAG_ABSENT, NULL }, - { "load.off.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 0, "UPS.OutletSystem.Outlet.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, - { "load.off.delay", 0, 0, "UPS.Output.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 0, "UPS.Output.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, - - /* Battery Testing */ - { "test.battery.start.quick", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "1", HU_TYPE_CMD, NULL }, - { "test.battery.start.deep", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "2", HU_TYPE_CMD, NULL }, - { "test.battery.stop", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "3", HU_TYPE_CMD, NULL }, - { "test.battery.start.quick", 0, 0, "UPS.Output.Test", NULL, "1", HU_TYPE_CMD, NULL }, - { "test.battery.start.deep", 0, 0, "UPS.Output.Test", NULL, "2", HU_TYPE_CMD, NULL }, - { "test.battery.stop", 0, 0, "UPS.Output.Test", NULL, "3", HU_TYPE_CMD, NULL }, - - /* Buzzer */ - { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - { "beeper.disable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *legrand_format_model(HIDDevice_t *hd) -{ - return hd->Product; -} - -static const char *legrand_format_mfr(HIDDevice_t *hd) -{ - return hd->Vendor ? hd->Vendor : "Legrand"; -} - -static const char *legrand_format_serial(HIDDevice_t *hd) -{ - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if - * the device is supported by this subdriver, else 0. */ -static int legrand_claim(HIDDevice_t *hd) -{ - int status = is_usb_device_supported(legrand_usb_device_table, hd); - - switch (status) - { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) - return 1; - possibly_supported("Legrand", hd); - return 0; - - case SUPPORTED: - return 1; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t legrand_subdriver = { - LEGRAND_HID_VERSION, - legrand_claim, - legrand_utab, - legrand_hid2nut, - legrand_format_model, - legrand_format_mfr, - legrand_format_serial, - fix_report_desc, -}; diff --git a/drivers/legrand-hid.h b/drivers/legrand-hid.h deleted file mode 100644 index 59770cd..0000000 --- a/drivers/legrand-hid.h +++ /dev/null @@ -1,30 +0,0 @@ -/* legrand-hid.h - subdriver to monitor Legrand USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef LEGRAND_HID_H -#define LEGRAND_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t legrand_subdriver; - -#endif /* LEGRAND_HID_H */ diff --git a/drivers/libhid.c b/drivers/libhid.c index cbc0d8e..d0ba7c5 100644 --- a/drivers/libhid.c +++ b/drivers/libhid.c @@ -7,7 +7,7 @@ * John Stamp * Peter Selinger * Arjen de Korte - * + * * This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com * * The logic of this file is ripped from mge-shut driver (also from @@ -30,15 +30,8 @@ * * -------------------------------------------------------------------------- */ -#include "config.h" /* must be the first header */ - #include -#ifdef HAVE_STRING_H -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif +#include /* #include */ #include "libhid.h" #include "hidparser.h" @@ -49,7 +42,7 @@ #include "libshut.h" communication_subdriver_t *comm_driver = &shut_subdriver; #else - #include "nut_libusb.h" + #include "libusb.h" communication_subdriver_t *comm_driver = &usb_subdriver; #endif @@ -64,14 +57,7 @@ static int8_t get_unit_expo(const HIDData_t *hiddata); static double exponent(double a, int8_t b); /* Tweak flag for APC Back-UPS */ -size_t max_report_size = 0; - -/* Tweaks for Powercom, at least */ -int interrupt_only = 0; -size_t interrupt_size = 0; - -#define SMIN(a, b) ( ((intmax_t)(a) < (intmax_t)(b)) ? (a) : (b) ) -#define UMIN(a, b) ( ((uintmax_t)(a) < (uintmax_t)(b)) ? (a) : (b) ) +int max_report_size = 0; /* ---------------------------------------------------------------------- */ /* report buffering system */ @@ -100,14 +86,13 @@ void free_report_buffer(reportbuf_t *rbuf) /* allocate a new report buffer. Return pointer on success, else NULL with errno set. The returned data structure must later be freed with free_report_buffer(). */ -reportbuf_t *new_report_buffer(HIDDesc_t *arg_pDesc) +reportbuf_t *new_report_buffer(HIDDesc_t *pDesc) { HIDData_t *pData; reportbuf_t *rbuf; - int id; - size_t i; + int i, id; - if (!arg_pDesc) + if (!pDesc) return NULL; rbuf = calloc(1, sizeof(*rbuf)); @@ -116,9 +101,9 @@ reportbuf_t *new_report_buffer(HIDDesc_t *arg_pDesc) } /* now go through all items that are part of this report */ - for (i=0; initems; i++) { + for (i=0; initems; i++) { - pData = &arg_pDesc->item[i]; + pData = &pDesc->item[i]; id = pData->ReportID; @@ -127,7 +112,7 @@ reportbuf_t *new_report_buffer(HIDDesc_t *arg_pDesc) continue; /* first byte holds id */ - rbuf->len[id] = arg_pDesc->replen[id] + 1; + rbuf->len[id] = pDesc->replen[id] + 1; /* skip zero length reports */ if (rbuf->len[id] < 1) { @@ -158,94 +143,29 @@ reportbuf_t *new_report_buffer(HIDDesc_t *arg_pDesc) /* because buggy firmwares from APC return wrong report size, we either ask the report with the found report size or with the whole buffer size depending on the max_report_size flag */ -static int refresh_report_buffer(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, time_t age) +static int refresh_report_buffer(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, int age) { - usb_ctrl_repindex id = pData->ReportID; - int ret; - size_t r; + int id = pData->ReportID; + int r; - if (interrupt_only || rbuf->ts[id] + age > time(NULL)) { + if (rbuf->ts[id] + age > time(NULL)) { /* buffered report is still good; nothing to do */ upsdebug_hex(3, "Report[buf]", rbuf->data[id], rbuf->len[id]); return 0; } - r = max_report_size ? sizeof(rbuf->data[id]) : rbuf->len[id]; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)r > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX) { - upsdebugx(2, - "%s: suggested buffer size %zu exceeds " - "USB_CTRL_CHARBUFSIZE_MAX %ju; " - "report will be constrained", - __func__, r, (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX); - if ((uintmax_t)USB_CTRL_CHARBUFSIZE_MAX <= (uintmax_t)SIZE_MAX - && USB_CTRL_CHARBUFSIZE_MAX > 0) { - r = (size_t)USB_CTRL_CHARBUFSIZE_MAX - 1; - } else { - /* SIZE_MAX is obviously too much here; least common - * denominator across libs can be UINT8 or UINT16. - * We should never hit this codepath unless definition - * above is bonkers, anyway. - */ - r = (size_t)UINT8_MAX - 1; - } + r = comm_driver->get_report(udev, id, rbuf->data[id], + max_report_size ? (int)sizeof(rbuf->data[id]):rbuf->len[id]); - /* Avoid overflowing known buffer size, to be sure: */ - r = UMIN(r, sizeof(rbuf->data[id])); - if (!max_report_size) { - r = UMIN(r, rbuf->len[id]); - } - } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - ret = comm_driver->get_report(udev, id, - (usb_ctrl_charbuf)rbuf->data[id], - (usb_ctrl_charbufsize)r); - - if (ret <= 0) { + if (r <= 0) { return -1; } - r = (size_t)ret; if (rbuf->len[id] != r) { - /* e.g. if maxreportsize flag was set */ - upsdebugx(2, - "%s: expected %zu bytes, but got %zu instead", - __func__, rbuf->len[id], r); - upsdebug_hex(3, "Report[err]", - (usb_ctrl_charbuf)rbuf->data[id], r); + upsdebugx(2, "%s: expected %d bytes, but got %d instead", __func__, rbuf->len[id], r); + upsdebug_hex(3, "Report[err]", rbuf->data[id], r); } else { - upsdebug_hex(3, "Report[get]", - (usb_ctrl_charbuf)rbuf->data[id], rbuf->len[id]); + upsdebug_hex(3, "Report[get]", rbuf->data[id], rbuf->len[id]); } /* have (valid) report */ @@ -258,7 +178,7 @@ static int refresh_report_buffer(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDDa conversion is performed. If age>0, the read operation is buffered if the item's age is less than "age". On success, return 0 and store the answer in *value. On failure, return -1 and set errno. */ -static int get_item_buffered(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, long *Value, time_t age) +static int get_item_buffered(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, long *Value, int age) { int id = pData->ReportID; int r; @@ -278,70 +198,17 @@ static int get_item_buffered(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t -1 and set errno. The updated value is sent to the device. */ static int set_item_buffered(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t *pData, long Value) { - usb_ctrl_repindex id = pData->ReportID; - int ret; - size_t r = rbuf->len[id]; + int id = pData->ReportID; + int r; SetValue(pData, rbuf->data[id], Value); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)r > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX) { - upsdebugx(2, - "%s: suggested buffer size %zu exceeds " - "USB_CTRL_CHARBUFSIZE_MAX %ju; " - "item setting will be constrained", - __func__, r, (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX); - if ((uintmax_t)USB_CTRL_CHARBUFSIZE_MAX <= (uintmax_t)SIZE_MAX - && USB_CTRL_CHARBUFSIZE_MAX > 0) { - r = (size_t)USB_CTRL_CHARBUFSIZE_MAX - 1; - } else { - /* SIZE_MAX is obviously too much here; least common - * denominator across libs can be UINT8 or UINT16. - * We should never hit this codepath unless definition - * above is bonkers, anyway. - */ - r = (size_t)UINT8_MAX - 1; - } - } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - ret = comm_driver->set_report(udev, id, - (usb_ctrl_charbuf)rbuf->data[id], - (usb_ctrl_charbufsize)r); - if (ret <= 0) { + r = comm_driver->set_report(udev, id, rbuf->data[id], rbuf->len[id]); + if (r <= 0) { return -1; } - upsdebug_hex(3, "Report[set]", rbuf->data[id], r); + upsdebug_hex(3, "Report[set]", rbuf->data[id], rbuf->len[id]); /* expire report */ rbuf->ts[id] = 0; @@ -353,7 +220,7 @@ static int set_item_buffered(reportbuf_t *rbuf, hid_dev_handle_t udev, HIDData_t report has been obtained without having been explicitly requested, e.g., it arrived through an interrupt transfer. Returns 0 on success, -1 on error with errno set. */ -static int file_report_buffer(reportbuf_t *rbuf, unsigned char *buf, size_t buflen) +static int file_report_buffer(reportbuf_t *rbuf, unsigned char *buf, int buflen) { int id = buf[0]; @@ -361,9 +228,7 @@ static int file_report_buffer(reportbuf_t *rbuf, unsigned char *buf, size_t bufl memcpy(rbuf->data[id], buf, (buflen < rbuf->len[id]) ? buflen : rbuf->len[id]); if (rbuf->len[id] != buflen) { - upsdebugx(2, - "%s: expected %zu bytes, but got %zu instead", - __func__, rbuf->len[id], buflen); + upsdebugx(2, "%s: expected %d bytes, but got %d instead", __func__, rbuf->len[id], buflen); upsdebug_hex(3, "Report[err]", buf, buflen); } else { upsdebug_hex(3, "Report[int]", rbuf->data[id], rbuf->len[id]); @@ -401,15 +266,12 @@ static struct { * since it's used to produce sub-drivers "stub" using * scripts/subdriver/gen-usbhid-subdriver.sh */ -void HIDDumpTree(hid_dev_handle_t udev, HIDDevice_t *hd, usage_tables_t *utab) +void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab) { - size_t i; -#ifdef SHUT_MODE - NUT_UNUSED_VARIABLE(hd); -#else + int i; +#ifndef SHUT_MODE /* extract the VendorId for further testing */ - int vendorID = hd->VendorID; - int productID = hd->ProductID; + int vendorID = usb_device((struct usb_dev_handle *)udev)->descriptor.idVendor; #endif /* Do not go further if we already know nothing will be displayed. @@ -421,8 +283,6 @@ void HIDDumpTree(hid_dev_handle_t udev, HIDDevice_t *hd, usage_tables_t *utab) return; } - upsdebugx(1, "%zu HID objects found", pDesc->nitems); - for (i = 0; i < pDesc->nitems; i++) { double value; @@ -439,13 +299,6 @@ void HIDDumpTree(hid_dev_handle_t udev, HIDDevice_t *hd, usage_tables_t *utab) continue; } } - - /* skip report 0x54 for Tripplite SU3000LCD2UHV due to firmware bug */ - if ((vendorID == 0x09ae) && (productID == 0x1330)) { - if (pData->ReportID == 0x54) { - continue; - } - } #endif /* Get data value */ @@ -493,7 +346,7 @@ HIDData_t *HIDGetItemData(const char *hidpath, usage_tables_t *utab) } /* Get info on object (reportID, offset and size) */ - return FindObject_with_Path(pDesc, &Path, interrupt_only ? ITEM_INPUT:ITEM_FEATURE); + return FindObject_with_Path(pDesc, &Path, ITEM_FEATURE); } char *HIDGetDataItem(const HIDData_t *hiddata, usage_tables_t *utab) @@ -509,7 +362,7 @@ char *HIDGetDataItem(const HIDData_t *hiddata, usage_tables_t *utab) /* Return the physical value associated with the given HIDData path. * return 1 if OK, 0 on fail, -errno otherwise (ie disconnect). */ -int HIDGetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, time_t age) +int HIDGetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, int age) { int r; long hValue; @@ -525,10 +378,10 @@ int HIDGetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, ti } *Value = hValue; - + /* Convert Logical Min, Max and Value into Physical */ *Value = logical_to_physical(hiddata, hValue); - + /* Process exponents and units */ *Value *= exponent(10, get_unit_expo(hiddata)); @@ -547,78 +400,10 @@ int HIDGetItemValue(hid_dev_handle_t udev, const char *hidpath, double *Value, u */ char *HIDGetIndexString(hid_dev_handle_t udev, const int Index, char *buf, size_t buflen) { - usb_ctrl_strindex idx; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)Index > (uintmax_t)USB_CTRL_STRINDEX_MAX - || (intmax_t)Index < (intmax_t)USB_CTRL_STRINDEX_MIN - ) { - upsdebugx(2, - "%s: requested index number is out of range, " - "expected %jd < %i < %ju", - __func__, - (intmax_t)USB_CTRL_STRINDEX_MIN, - Index, - (uintmax_t)USB_CTRL_STRINDEX_MAX); - return NULL; - } - idx = (usb_ctrl_strindex)Index; - - if ((uintmax_t)buflen > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX) { - upsdebugx(2, - "%s: suggested buffer size %zu exceeds " - "USB_CTRL_CHARBUFSIZE_MAX %ju; " - "index string will be constrained", - __func__, buflen, - (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX); - - if ((uintmax_t)USB_CTRL_CHARBUFSIZE_MAX <= (uintmax_t)SIZE_MAX - && USB_CTRL_CHARBUFSIZE_MAX > 0) { - buflen = (size_t)USB_CTRL_CHARBUFSIZE_MAX - 1; - } else { - /* SIZE_MAX is obviously too much here; least common - * denominator across libs can be UINT8 or UINT16. - * We should never hit this codepath unless definition - * above is bonkers, anyway. - */ - buflen = (size_t)UINT8_MAX - 1; - } - } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - if (comm_driver->get_string(udev, idx, buf, (usb_ctrl_charbufsize)buflen) < 1) + if (comm_driver->get_string(udev, Index, buf, buflen) < 1) buf[0] = '\0'; - return str_rtrim(buf, '\n'); + return rtrim(buf, '\n'); } /* Return pointer to indexed string from HID path (empty if not found) @@ -640,7 +425,7 @@ char *HIDGetItemString(hid_dev_handle_t udev, const char *hidpath, char *buf, si */ int HIDSetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double Value) { - int r; + int i, r; long hValue; if (hiddata == NULL) { @@ -656,7 +441,7 @@ int HIDSetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double Value) /* Process exponents and units */ Value /= exponent(10, get_unit_expo(hiddata)); - + /* Convert Physical Min, Max and Value into Logical */ hValue = physical_to_logical(hiddata, Value); @@ -667,8 +452,10 @@ int HIDSetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double Value) } /* flush the report buffer (data may have changed) */ - memset(reportbuf->ts, 0, sizeof(reportbuf->ts)); - + for (i=0; i<256; i++) { + reportbuf->ts[i] = 0; + } + upsdebugx(4, "Set report succeeded"); return 1; } @@ -688,78 +475,17 @@ int HIDGetEvents(hid_dev_handle_t udev, HIDData_t **event, int eventsize) { unsigned char buf[SMALLBUF]; int itemCount = 0; - int buflen, ret; - size_t i, r; + int buflen, r, i; HIDData_t *pData; /* needs libusb-0.1.8 to work => use ifdef and autoconf */ - r = interrupt_size ? interrupt_size : sizeof(buf); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)r > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX) { - /* FIXME: Should we try here, or plain abort? */ - upsdebugx(2, - "%s: suggested buffer size %zu exceeds " - "USB_CTRL_CHARBUFSIZE_MAX %ju; " - "report will be constrained", - __func__, r, (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX); - - if ((uintmax_t)USB_CTRL_CHARBUFSIZE_MAX <= (uintmax_t)SIZE_MAX - && USB_CTRL_CHARBUFSIZE_MAX > 0) { - r = (size_t)USB_CTRL_CHARBUFSIZE_MAX - 1; - } else { - /* SIZE_MAX is obviously too much here; least common - * denominator across libs can be UINT8 or UINT16. - * We should never hit this codepath unless definition - * above is bonkers, anyway. - */ - r = (size_t)UINT8_MAX - 1; - } - - /* Avoid overflowing known buffer size, to be sure: */ - r = UMIN(r, sizeof(buf)); - } -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - buflen = comm_driver->get_interrupt( - udev, (usb_ctrl_charbuf)buf, - (usb_ctrl_charbufsize)r, - 750); - + buflen = comm_driver->get_interrupt(udev, buf, sizeof(buf), 250); if (buflen <= 0) { return buflen; /* propagate "error" or "no event" code */ } - ret = file_report_buffer(reportbuf, buf, (size_t)buflen); - if (ret < 0) { + r = file_report_buffer(reportbuf, buf, buflen); + if (r < 0) { upsdebug_with_errno(1, "%s: failed to buffer report", __func__); return -errno; } @@ -820,7 +546,7 @@ static double logical_to_physical(HIDData_t *Data, long logical) /* this should not really happen */ return (double)logical; } - + Factor = (double)(Data->PhyMax - Data->PhyMin) / (Data->LogMax - Data->LogMin); /* Convert Value */ physical = (double)((logical - Data->LogMin) * Factor) + Data->PhyMin; @@ -858,7 +584,7 @@ static long physical_to_logical(HIDData_t *Data, double physical) /* this should not really happen */ return (long)physical; } - + Factor = (double)(Data->LogMax - Data->LogMin) / (Data->PhyMax - Data->PhyMin); /* Convert Value */ logical = (long)((physical - Data->PhyMin) * Factor) + Data->LogMin; @@ -909,66 +635,38 @@ static int string_to_path(const char *string, HIDPath_t *path, usage_tables_t *u int i = 0; long usage; char buf[SMALLBUF]; - char *token, *last; - + char *token, *last; + snprintf(buf, sizeof(buf), "%s", string); for (token = strtok_r(buf, ".", &last); token != NULL; token = strtok_r(NULL, ".", &last)) { /* lookup tables first (to override defaults) */ - /* Note/FIXME?: we happen to process "usage" as a "signed long" - * while the HIDNode_t behind it is (currently) uint32_t. - * The method below returns `-1` for entries not found; however - * half of our permissible range may seem negative and be valid. - */ if ((usage = hid_lookup_usage(token, utab)) != -1) { - path->Node[i++] = (HIDNode_t)usage; + path->Node[i++] = usage; continue; - } else { - /* hid_lookup_usage() logs for itself: ... -> not found in lookup table */ - upsdebugx(5, "string_to_path: hid_lookup_usage failed, " - "checking if token %s is a raw value", token); } /* translate unnamed path components such as "ff860024" */ if (strlen(token) == strspn(token, "1234567890abcdefABCDEF")) { - long l = strtol(token, NULL, 16); - /* Note: currently per hidtypes.h, HIDNode_t == uint32_t */ - if (l < 0 || (uintmax_t)l > (uintmax_t)UINT32_MAX) { - upsdebugx(5, "string_to_path: badvalue (pathcomp): " - "%ld negative or %ju too large", - l, (uintmax_t)l); - goto badvalue; - } - path->Node[i++] = (HIDNode_t)l; + path->Node[i++] = strtol(token, NULL, 16); continue; } /* indexed collection */ if (strlen(token) == strspn(token, "[1234567890]")) { - int l = atoi(token + 1); /* +1: skip the bracket */ - if (l < 0 || (uintmax_t)l > (uintmax_t)UINT32_MAX) { - upsdebugx(5, "string_to_path: badvalue(indexed): " - "%d negative or %ju too large", - l, (uintmax_t)l); - goto badvalue; - } - path->Node[i++] = 0x00ff0000 + (HIDNode_t)l; + path->Node[i++] = 0x00ff0000 + atoi(token+1); continue; } -badvalue: /* Uh oh, typo in usage table? */ upsdebugx(1, "string_to_path: couldn't parse %s from %s", token, string); } - if (i < 0 || i > (int)UINT8_MAX) { - fatalx(EXIT_FAILURE, "Error: string_to_path(): length exceeded"); - } - path->Size = (uint8_t)i; /* by construct, i>=0; but anyway checked above to be sure */ + path->Size = i; upsdebugx(4, "string_to_path: depth = %d", path->Size); return i; @@ -981,7 +679,7 @@ static int path_to_string(char *string, size_t size, const HIDPath_t *path, usag const char *p; snprintf(string, size, "%s", ""); - + for (i = 0; i < path->Size; i++) { if (i > 0) @@ -995,22 +693,20 @@ static int path_to_string(char *string, size_t size, const HIDPath_t *path, usag } /* indexed collection */ - if ((path->Node[i] & 0xffff0000) == 0x00ff0000) + if ((path->Node[i] & 0xffff0000) == 0x00ff0000) { snprintfcat(string, size, "[%i]", path->Node[i] & 0x0000ffff); continue; } /* unnamed path components such as "ff860024" */ - snprintfcat(string, size, "%08x", path->Node[i]); + snprintfcat(string, size, "%08x", path->Node[i]); } return i; } -/* usage conversion string -> numeric - * Returns -1 for error, or a (HIDNode_t) ranged code value - */ +/* usage conversion string -> numeric */ static long hid_lookup_usage(const char *name, usage_tables_t *utab) { int i, j; @@ -1022,9 +718,8 @@ static long hid_lookup_usage(const char *name, usage_tables_t *utab) if (strcasecmp(utab[i][j].usage_name, name)) continue; - /* Note: currently per hidtypes.h, HIDNode_t == uint32_t */ - upsdebugx(5, "hid_lookup_usage: %s -> %08x", name, (uint32_t)utab[i][j].usage_code); - return (long)(utab[i][j].usage_code); + upsdebugx(5, "hid_lookup_usage: %s -> %08x", name, (unsigned int)utab[i][j].usage_code); + return utab[i][j].usage_code; } } @@ -1114,7 +809,7 @@ usage_lkp_t hid_usage_lkp[] = { { "SwitchOffControl", 0x00840051 }, { "ToggleControl", 0x00840052 }, { "LowVoltageTransfer", 0x00840053 }, - { "HighVoltageTransfer", 0x00840054 }, + { "HighVoltageTransfer", 0x00840054 }, { "DelayBeforeReboot", 0x00840055 }, { "DelayBeforeStartup", 0x00840056 }, { "DelayBeforeShutdown", 0x00840057 }, @@ -1127,7 +822,7 @@ usage_lkp_t hid_usage_lkp[] = { { "InternalFailure", 0x00840062 }, { "VoltageOutOfRange", 0x00840063 }, { "FrequencyOutOfRange", 0x00840064 }, - { "Overload", 0x00840065 }, + { "Overload", 0x00840065 }, /* Note: the correct spelling is "Overload", not "OverLoad", * according to the official specification, "Universal Serial * Bus Usage Tables for HID Power Devices", Release 1.0, diff --git a/drivers/libhid.h b/drivers/libhid.h index 23e34a1..0e513f9 100644 --- a/drivers/libhid.h +++ b/drivers/libhid.h @@ -26,30 +26,27 @@ * * -------------------------------------------------------------------------- */ -#ifndef NUT_LIBHID_H_SEEN -#define NUT_LIBHID_H_SEEN +#ifndef _LIBHID_H +#define _LIBHID_H #include "config.h" #include -#include "nut_stdint.h" #include "hidtypes.h" #include "timehead.h" #ifdef SHUT_MODE #include "libshut.h" - typedef SHUTDevice_t HIDDevice_t; - typedef char HIDDeviceMatcher_t; - typedef usb_dev_handle hid_dev_handle_t; - typedef shut_communication_subdriver_t communication_subdriver_t; - #define HID_DEV_HANDLE_CLOSED (hid_dev_handle_t)(-1) + typedef SHUTDevice_t HIDDevice_t; + typedef char HIDDeviceMatcher_t; + typedef int hid_dev_handle_t; + typedef shut_communication_subdriver_t communication_subdriver_t; #else - #include "nut_libusb.h" /* includes usb-common.h */ - typedef USBDevice_t HIDDevice_t; - typedef USBDeviceMatcher_t HIDDeviceMatcher_t; - typedef usb_dev_handle * hid_dev_handle_t; - typedef usb_communication_subdriver_t communication_subdriver_t; - #define HID_DEV_HANDLE_CLOSED (hid_dev_handle_t)(NULL) + #include "libusb.h" + typedef USBDevice_t HIDDevice_t; + typedef USBDeviceMatcher_t HIDDeviceMatcher_t; + typedef usb_dev_handle * hid_dev_handle_t; + typedef usb_communication_subdriver_t communication_subdriver_t; #endif /* use explicit booleans */ @@ -85,17 +82,13 @@ extern HIDDesc_t *pDesc; /* parsed Report Descriptor */ /* report buffer structure: holds data about most recent report for each given report id */ typedef struct reportbuf_s { - time_t ts[256]; /* timestamp when report was retrieved */ - size_t len[256]; /* size of report data */ - unsigned char *data[256]; /* report data (allocated) */ + time_t ts[256]; /* timestamp when report was retrieved */ + int len[256]; /* size of report data */ + unsigned char *data[256]; /* report data (allocated) */ } reportbuf_t; extern reportbuf_t *reportbuf; /* buffer for most recent reports */ -extern size_t max_report_size; -extern int interrupt_only; -extern size_t interrupt_size; - /* ---------------------------------------------------------------------- */ /* @@ -126,7 +119,7 @@ char *HIDGetDataItem(const HIDData_t *hiddata, usage_tables_t *utab); /* * HIDGetDataValue * -------------------------------------------------------------------------- */ -int HIDGetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, time_t age); +int HIDGetDataValue(hid_dev_handle_t udev, HIDData_t *hiddata, double *Value, int age); /* * HIDSetDataValue @@ -146,10 +139,10 @@ int HIDGetEvents(hid_dev_handle_t udev, HIDData_t **event, int eventlen); /* * Support functions * -------------------------------------------------------------------------- */ -void HIDDumpTree(hid_dev_handle_t udev, HIDDevice_t *hd, usage_tables_t *utab); +void HIDDumpTree(hid_dev_handle_t udev, usage_tables_t *utab); const char *HIDDataType(const HIDData_t *hiddata); void free_report_buffer(reportbuf_t *rbuf); reportbuf_t *new_report_buffer(HIDDesc_t *pDesc); -#endif /* NUT_LIBHID_H_SEEN */ +#endif /* _LIBHID_H */ diff --git a/drivers/libshut.c b/drivers/libshut.c index 817fda4..30651d0 100644 --- a/drivers/libshut.c +++ b/drivers/libshut.c @@ -29,8 +29,6 @@ * - validate / complete commands and data table in mge-hid from mge-shut */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -43,7 +41,7 @@ #include "common.h" /* for xmalloc, upsdebugx prototypes */ #define SHUT_DRIVER_NAME "SHUT communication driver" -#define SHUT_DRIVER_VERSION "0.86" +#define SHUT_DRIVER_VERSION "0.84" /* communication driver description structure */ upsdrv_info_t comm_upsdrv_info = { @@ -61,13 +59,13 @@ upsdrv_info_t comm_upsdrv_info = { * HID descriptor, completed with desc{type,len} */ struct my_hid_descriptor { - uint8_t bLength; - uint8_t bDescriptorType; - uint16_t bcdHID; - uint8_t bCountryCode; - uint8_t bNumDescriptors; - uint8_t bReportDescriptorType; - uint16_t wDescriptorLength; + uint8_t bLength; + uint8_t bDescriptorType; + uint16_t bcdHID; + uint8_t bCountryCode; + uint8_t bNumDescriptors; + uint8_t bReportDescriptorType; + uint16_t wDescriptorLength; }; /*!******************************************************** @@ -172,7 +170,7 @@ struct my_hid_descriptor { #define SHUT_NOK 0x15 /* sync signals are also used to set the notification level */ #define SHUT_SYNC 0x16 /* complete notifications - not yet managed */ - /* but needed for some early Ellipse models */ + /* but needed for some early Ellipse models */ #define SHUT_SYNC_LIGHT 0x17 /* partial notifications */ #define SHUT_SYNC_OFF 0x18 /* disable notifications - only do polling */ #define SHUT_PKT_LAST 0x80 @@ -182,54 +180,19 @@ struct my_hid_descriptor { /*! * SHUT functions for HID marshalling */ -/* Expected evaluated types for the API after typedefs: - * static int shut_get_descriptor(int upsfd, unsigned char type, - * unsigned char index, void *buf, int size); - * static int shut_get_string_simple(int upsfd, int index, - * char *buf, size_t buflen); - * static int libshut_get_report(int upsfd, int ReportId, - * unsigned char *raw_buf, int ReportSize ); - * static int libshut_set_report(int upsfd, int id, unsigned char *pkt, - * int reportlen); - * static int libshut_get_interrupt(int upsfd, unsigned char *buf, - * int bufsize, int timeout); - * static void libshut_close(int upsfd); - */ -static int shut_get_descriptor( - usb_dev_handle upsfd, - usb_ctrl_requesttype type, - usb_ctrl_descindex index, - void *buf, - usb_ctrl_charbufsize size); - -static int shut_get_string_simple( - usb_dev_handle upsfd, - usb_ctrl_strindex index, - char *buf, - usb_ctrl_charbufsize buflen); - -static int libshut_get_report( - usb_dev_handle upsfd, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize); - -static int libshut_set_report( - usb_dev_handle upsfd, - usb_ctrl_repindex id, - usb_ctrl_charbuf pkt, - usb_ctrl_charbufsize reportlen); - -static int libshut_get_interrupt( - usb_dev_handle upsfd, - usb_ctrl_charbuf buf, - usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout); - -static void libshut_close(usb_dev_handle upsfd); +int shut_get_descriptor(int upsfd, unsigned char type, + unsigned char index, void *buf, int size); +int shut_get_string_simple(int upsfd, int index, + char *buf, size_t buflen); +int libshut_get_report(int upsfd, int ReportId, + unsigned char *raw_buf, int ReportSize ); +int shut_set_report(int upsfd, int id, unsigned char *pkt, int reportlen); +int libshut_get_interrupt(int upsfd, unsigned char *buf, + int bufsize, int timeout); +void libshut_close(int upsfd); /* FIXME */ -static const char * shut_strerror(void) { return ""; } +const char * shut_strerror(void) { return ""; } /*! * From SHUT specifications @@ -242,7 +205,7 @@ typedef struct shut_ctrltransfer_s { uint16_t wValue; uint16_t wIndex; uint16_t wLength; - + uint32_t timeout; /* in milliseconds */ /* pointer to data */ @@ -296,63 +259,28 @@ typedef union device_desc_data_t { uint8_t raw_desc[18]; } device_desc_data_t; #endif - /* Low level SHUT (Serial HID UPS Transfer) routines */ -/* Expected evaluated types for the API after typedefs: -static void setline(int upsfd, int set); -static int shut_synchronise(int upsfd); -static int shut_wait_ack(int upsfd); -static int shut_interrupt_read(int upsfd, int ep, unsigned char *bytes, - int size, int timeout); -static int shut_control_msg(int upsfd, int requesttype, int request, int value, - int index, unsigned char *bytes, int size, int timeout); - */ -static void setline( - usb_dev_handle upsfd, - int set); - -static int shut_synchronise(usb_dev_handle upsfd); - -static int shut_wait_ack(usb_dev_handle upsfd); - -static int shut_interrupt_read( - usb_dev_handle upsfd, - usb_ctrl_endpoint ep, - usb_ctrl_charbuf bytes, - usb_ctrl_charbufsize size, - usb_ctrl_timeout_msec timeout); - -static int shut_control_msg( - usb_dev_handle upsfd, - usb_ctrl_requesttype requesttype, - usb_ctrl_request request, - usb_ctrl_msgvalue value, - usb_ctrl_repindex index, - usb_ctrl_charbuf bytes, - usb_ctrl_charbufsize size, - usb_ctrl_timeout_msec timeout); +void setline(int upsfd, int set); +int shut_synchronise(int upsfd); +int shut_wait_ack(int upsfd); +int shut_interrupt_read(int upsfd, int ep, unsigned char *bytes, + int size, int timeout); +int shut_control_msg(int upsfd, int requesttype, int request, int value, + int index, unsigned char *bytes, int size, int timeout); /* Data portability */ /* realign packet data according to Endianess */ -#define BYTESWAP(in) ((((uint16_t)in & 0x00FF) << 8) + (((uint16_t)in & 0xFF00) >> 8)) -static void align_request(struct shut_ctrltransfer_s *ctrl) +#define BYTESWAP(in) (((in & 0xFF) << 8) + ((in & 0xFF00) >> 8)) +static void align_request(struct shut_ctrltransfer_s *ctrl ) { -#if (defined (WORDS_BIGENDIAN)) && (WORDS_BIGENDIAN) - /* Sparc/Mips/... are big endian, USB/SHUT little endian */ +#if WORDS_BIGENDIAN + /* Sparc/Mips/... are big endian, USB/SHUT little endian */ (*ctrl).wValue = BYTESWAP((*ctrl).wValue); (*ctrl).wIndex = BYTESWAP((*ctrl).wIndex); (*ctrl).wLength = BYTESWAP((*ctrl).wLength); -#else - NUT_UNUSED_VARIABLE(ctrl); #endif } -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif /* On success, fill in the curDevice structure and return the report * descriptor length. On failure, return -1. * Note: When callback is not NULL, the report descriptor will be @@ -360,52 +288,34 @@ static void align_request(struct shut_ctrltransfer_s *ctrl) * information. This callback should return a value > 0 if the device * is accepted, or < 1 if not. */ -/* Expected evaluated types for the API after typedefs: - * static int libshut_open(int *arg_upsfd, SHUTDevice_t *curDevice, char *arg_device_path, - * int (*callback)(int arg_upsfd, SHUTDevice_t *hd, - * unsigned char *rdbuf, int rdlen)) - */ -static int libshut_open( - usb_dev_handle *arg_upsfd, - SHUTDevice_t *curDevice, - char *arg_device_path, - int (*callback)(usb_dev_handle arg_upsfd, SHUTDevice_t *hd, - usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen)) +int libshut_open(int *upsfd, SHUTDevice_t *curDevice, char *device_path, + int (*callback)(int upsfd, SHUTDevice_t *hd, unsigned char *rdbuf, int rdlen)) { - int ret, res; - /* Below we cast this buffer as sometimes containing entried of type - * "struct device_descriptor_s" or "struct my_hid_descriptor". - * Currently both of these are sized "2", and I don't see a way - * to require a "max()" of such sizes to align for generally. - */ - usb_ctrl_char buf[20] __attribute__((aligned(4))); + int ret, res; + unsigned char buf[20]; char string[MAX_STRING_SIZE]; struct my_hid_descriptor *desc; struct device_descriptor_s *dev_descriptor; - + /* report descriptor */ - usb_ctrl_char rdbuf[MAX_REPORT_SIZE]; - usb_ctrl_charbufsize rdlen; - /* All devices use HID descriptor at index 0. However, some newer - * Eaton units have a light HID descriptor at index 0, and the full - * version is at index 1 (in which case, bcdDevice == 0x0202) */ - usb_ctrl_descindex hid_desc_index = 0; + unsigned char rdbuf[MAX_REPORT_SIZE]; + int rdlen; - upsdebugx(2, "libshut_open: using port %s", arg_device_path); + upsdebugx(2, "libshut_open: using port %s", device_path); /* If device is still open, close it */ - if (*arg_upsfd > 0) { - ser_close(*arg_upsfd, arg_device_path); + if (*upsfd > 0) { + ser_close(*upsfd, device_path); } /* initialize serial port */ /* FIXME: add variable baudrate detection */ - *arg_upsfd = ser_open(arg_device_path); - ser_set_speed(*arg_upsfd, arg_device_path, B2400); - setline(*arg_upsfd, 1); + *upsfd = ser_open(device_path); + ser_set_speed(*upsfd, device_path, B2400); + setline(*upsfd, 0); /* initialise communication */ - if (!shut_synchronise(*arg_upsfd)) + if (!shut_synchronise(*upsfd)) { upsdebugx(2, "No communication with UPS"); return -1; @@ -419,22 +329,8 @@ static int libshut_open( } /* Get DEVICE descriptor */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wcast-align" -#endif dev_descriptor = (struct device_descriptor_s *)buf; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - res = shut_get_descriptor(*arg_upsfd, USB_DT_DEVICE, 0, buf, USB_DT_DEVICE_SIZE); + res = shut_get_descriptor(*upsfd, USB_DT_DEVICE, 0, buf, USB_DT_DEVICE_SIZE); /* res = shut_control_msg(devp, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, (USB_DT_DEVICE << 8) + 0, 0, buf, 0x9, SHUT_TIMEOUT); */ if (res < 0) @@ -465,10 +361,9 @@ static int libshut_open( curDevice->VendorID = dev_descriptor->idVendor; curDevice->ProductID = dev_descriptor->idProduct; curDevice->Bus = strdup("serial"); - curDevice->bcdDevice = dev_descriptor->bcdDevice; curDevice->Vendor = strdup("Eaton"); if (dev_descriptor->iManufacturer) { - ret = shut_get_string_simple(*arg_upsfd, dev_descriptor->iManufacturer, + ret = shut_get_string_simple(*upsfd, dev_descriptor->iManufacturer, string, MAX_STRING_SIZE); if (ret > 0) { curDevice->Vendor = strdup(string); @@ -477,7 +372,7 @@ static int libshut_open( /* ensure iProduct retrieval */ if (dev_descriptor->iProduct) { - ret = shut_get_string_simple(*arg_upsfd, dev_descriptor->iProduct, string, MAX_STRING_SIZE); + ret = shut_get_string_simple(*upsfd, dev_descriptor->iProduct, string, MAX_STRING_SIZE); } else { ret = 0; } @@ -488,7 +383,7 @@ static int libshut_open( } if (dev_descriptor->iSerialNumber) { - ret = shut_get_string_simple(*arg_upsfd, dev_descriptor->iSerialNumber, string, 0x25); + ret = shut_get_string_simple(*upsfd, dev_descriptor->iSerialNumber, string, 0x25); } else { ret = 0; } @@ -505,31 +400,11 @@ static int libshut_open( upsdebugx(2, "- Product: %s", curDevice->Product); upsdebugx(2, "- Serial Number: %s", curDevice->Serial); upsdebugx(2, "- Bus: %s", curDevice->Bus); - upsdebugx(2, "- Device release number: %04x", curDevice->bcdDevice); upsdebugx(2, "Device matches"); - if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) { - upsdebugx(1, "Eaton device v2.02. Using full report descriptor"); - hid_desc_index = 1; - } - /* Get HID descriptor */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wcast-align" -#endif desc = (struct my_hid_descriptor *)buf; -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - res = shut_get_descriptor(*arg_upsfd, USB_DT_HID, hid_desc_index, buf, 0x9); + res = shut_get_descriptor(*upsfd, USB_DT_HID, 0, buf, 0x9); /* res = shut_control_msg(devp, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, (USB_DT_HID << 8) + 0, 0, buf, 0x9, SHUT_TIMEOUT); */ @@ -543,92 +418,42 @@ static int libshut_open( { upsdebugx(2, "HID descriptor too short (expected %d, got %d)", 8, res); return -1; - } + } /* USB_LE16_TO_CPU(desc->wDescriptorLength); */ - desc->wDescriptorLength = (uint16_t)(buf[7]); - desc->wDescriptorLength |= (((uint16_t)buf[8]) << 8); + desc->wDescriptorLength = buf[7] | (buf[8] << 8); upsdebugx(2, "HID descriptor retrieved (Reportlen = %u)", desc->wDescriptorLength); -/* - if (!dev->config) { +/* if (!dev->config) { upsdebugx(2, " Couldn't retrieve descriptors"); return -1; - } -*/ + }*/ rdlen = desc->wDescriptorLength; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if (rdlen > sizeof(rdbuf) || rdlen > INT_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(2, - "HID descriptor too long %" PRI_NUT_USB_CTRL_CHARBUFSIZE - " (max %zu)", - rdlen, sizeof(rdbuf)); + if (rdlen > (int)sizeof(rdbuf)) { + upsdebugx(2, "HID descriptor too long %d (max %d)", rdlen, (int)sizeof(rdbuf)); return -1; } /* Get REPORT descriptor */ - res = shut_get_descriptor(*arg_upsfd, USB_DT_REPORT, hid_desc_index, rdbuf, rdlen); + res = shut_get_descriptor(*upsfd, USB_DT_REPORT, 0, rdbuf, rdlen); /* res = shut_control_msg(devp, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, - (USB_DT_REPORT << 8) + 0, 0, ReportDesc, + (USB_DT_REPORT << 8) + 0, 0, ReportDesc, desc->wDescriptorLength, SHUT_TIMEOUT); */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if (res >= 0 && (uintmax_t)res < (uintmax_t)SIZE_MAX && (size_t)res == rdlen) -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif + if (res == rdlen) { - res = callback(*arg_upsfd, curDevice, rdbuf, rdlen); + res = callback(*upsfd, curDevice, rdbuf, rdlen); if (res < 1) { upsdebugx(2, "Caller doesn't like this device"); return -1; } - upsdebugx(2, - "Report descriptor retrieved (Reportlen = %" - PRI_NUT_USB_CTRL_CHARBUFSIZE ")", rdlen); + upsdebugx(2, "Report descriptor retrieved (Reportlen = %d)", rdlen); upsdebugx(2, "Found HID device"); fflush(stdout); - return (int)rdlen; + return rdlen; } if (res < 0) @@ -637,53 +462,37 @@ static int libshut_open( } else { - upsdebugx(2, - "Report descriptor too short (expected %" - PRI_NUT_USB_CTRL_CHARBUFSIZE ", got %d)", - rdlen, res); + upsdebugx(2, "Report descriptor too short (expected %d, got %d)", rdlen, res); } - - upsdebugx(2, "libshut: No appropriate HID device found"); + + upsdebugx(2, "No appropriate HID device found"); fflush(stdout); return -1; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif -/* Expected evaluated types for the API after typedefs: - * static void libshut_close(int arg_upsfd) - */ -static void libshut_close(usb_dev_handle arg_upsfd) +void libshut_close(int upsfd) { - if (arg_upsfd < 1) { + if (upsfd < 1) { return; } - ser_close(arg_upsfd, NULL); + ser_close(upsfd, NULL); } -/* return the report of ID=type in report +/* return the report of ID=type in report * return -1 on failure, report length on success */ -/* Expected evaluated types for the API after typedefs: - * static int libshut_get_report(int arg_upsfd, int ReportId, - * unsigned char *raw_buf, int ReportSize) - */ -static int libshut_get_report( - usb_dev_handle arg_upsfd, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) +int libshut_get_report(int upsfd, int ReportId, + unsigned char *raw_buf, int ReportSize ) { - if (arg_upsfd < 1) { + if (upsfd < 1) { return 0; } upsdebugx(4, "Entering libshut_get_report"); - return shut_control_msg(arg_upsfd, + return shut_control_msg(upsfd, REQUEST_TYPE_GET_REPORT, /* == USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE, */ 0x01, @@ -692,61 +501,39 @@ static int libshut_get_report( } /* return ReportSize upon success ; -1 otherwise */ -/* Expected evaluated types for the API after typedefs: - * static int libshut_set_report(int arg_upsfd, int ReportId, - * unsigned char *raw_buf, int ReportSize) - */ -static int libshut_set_report( - usb_dev_handle arg_upsfd, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) +int libshut_set_report(int upsfd, int ReportId, + unsigned char *raw_buf, int ReportSize ) { int ret; - - if (arg_upsfd < 1) { + + if (upsfd < 1) { return 0; } - - upsdebugx(1, - "Entering libshut_set_report (report %x, " - "len %" PRI_NUT_USB_CTRL_CHARBUFSIZE ")", + + upsdebugx(1, "Entering libshut_set_report (report %x, len %i)", ReportId, ReportSize); - if ((uintmax_t)ReportSize > (uintmax_t)INT_MAX) { - upsdebugx(1, "%s: ReportSize exceeds INT_MAX", __func__); - return -1; - } - upsdebug_hex (4, "==> Report after set", raw_buf, ReportSize); - ret = shut_control_msg(arg_upsfd, + ret = shut_control_msg(upsfd, REQUEST_TYPE_SET_REPORT, /* == USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, */ 0x09, ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */ 0, raw_buf, ReportSize, SHUT_TIMEOUT); - - return ((ret == 0) ? (int)ReportSize : ret); + + return ((ret == 0) ? ReportSize : ret); } -/* Expected evaluated types for the API after typedefs: - * static int libshut_get_string(int arg_upsfd, - * int StringIdx, char *buf, size_t buflen) - */ -static int libshut_get_string( - usb_dev_handle arg_upsfd, - usb_ctrl_strindex StringIdx, - char *buf, - usb_ctrl_charbufsize buflen) +int libshut_get_string(int upsfd, int StringIdx, char *buf, size_t buflen) { int ret; - - if (arg_upsfd < 1) { + + if (upsfd < 1) { return -1; } - ret = shut_get_string_simple(arg_upsfd, StringIdx, buf, buflen); + ret = shut_get_string_simple(upsfd, StringIdx, buf, buflen); if (ret > 0) upsdebugx(2, "-> String: %s (len = %i/%i)", buf, ret, (int)buflen); else @@ -755,29 +542,22 @@ static int libshut_get_string( return ret; } -/* Expected evaluated types for the API after typedefs: - * static int libshut_get_interrupt(int arg_upsfd, unsigned char *buf, - * int bufsize, int timeout) - */ -static int libshut_get_interrupt( - usb_dev_handle arg_upsfd, - usb_ctrl_charbuf buf, - usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout) +int libshut_get_interrupt(int upsfd, unsigned char *buf, + int bufsize, int timeout) { int ret; - if (arg_upsfd < 1) { + if (upsfd < 1) { return -1; } /* FIXME: hardcoded interrupt EP => need to get EP descr for IF descr */ - ret = shut_interrupt_read(arg_upsfd, 0x81, buf, bufsize, timeout); + ret = shut_interrupt_read(upsfd, 0x81, buf, bufsize, timeout); if (ret > 0) upsdebugx(6, " ok"); else upsdebugx(6, " none (%i)", ret); - + return ret; } @@ -798,47 +578,41 @@ shut_communication_subdriver_t shut_subdriver = { /* * set RTS to on and DTR to off - * + * * set : 1 to set comm * set : 0 to stop commupsh. */ -/* Expected evaluated types for the API after typedefs: - * void setline(int arg_upsfd, int set) - */ -void setline(usb_dev_handle arg_upsfd, int set) +void setline(int upsfd, int set) { - if (arg_upsfd < 1) { + if (upsfd < 1) { return; } upsdebugx(3, "entering setline(%i)", set); if (set == 1) { - ser_set_dtr(arg_upsfd, 0); - ser_set_rts(arg_upsfd, 1); + ser_set_dtr(upsfd, 0); + ser_set_rts(upsfd, 1); } else { - ser_set_dtr(arg_upsfd, 1); - ser_set_rts(arg_upsfd, 0); + ser_set_dtr(upsfd, 1); + ser_set_rts(upsfd, 0); } } /***************************************************************************** * shut_synchronise () - * + * * initiate communication with the UPS * * return TRUE on success, FALSE on failure * *****************************************************************************/ -/* Expected evaluated types for the API after typedefs: - * int shut_synchronise(int arg_upsfd) - */ -int shut_synchronise(usb_dev_handle arg_upsfd) +int shut_synchronise(int upsfd) { int retCode = 0; - unsigned char c = SHUT_SYNC_OFF, reply; + u_char c = SHUT_SYNC_OFF, reply; int try; - + upsdebugx (2, "entering shut_synchronise()"); reply = '\0'; @@ -863,13 +637,13 @@ int shut_synchronise(usb_dev_handle arg_upsfd) { upsdebugx (3, "Syncing communication (try %i)", try); - if ((ser_send_char(arg_upsfd, c)) == -1) + if ((ser_send_char(upsfd, c)) == -1) { upsdebugx (3, "Communication error while writing to port"); continue; } - ser_get_char(arg_upsfd, &reply, 1, 0); + ser_get_char(upsfd, &reply, 1, 0); if (reply == c) { upsdebugx (3, "Syncing and notification setting done"); @@ -882,49 +656,37 @@ int shut_synchronise(usb_dev_handle arg_upsfd) /*! * Compute a SHUT checksum for the packet "buf" */ -/* Expected evaluated types for the API after typedefs: - * static unsigned char shut_checksum(const unsigned char *buf, int bufsize) - */ -static unsigned char shut_checksum( - const usb_ctrl_charbuf buf, - usb_ctrl_charbufsize bufsize) +u_char shut_checksum(const u_char *buf, int bufsize) { - usb_ctrl_charbufsize i; - unsigned char chk=0; - + int i; + u_char chk=0; + for(i=0; i0 && Retry<3) { /* if(serial_read (SHUT_TIMEOUT, &Start[0]) > 0) */ - if(ser_get_char(arg_upsfd, &Start[0], SHUT_TIMEOUT/1000, 0) > 0) + if(ser_get_char(upsfd, &Start[0], SHUT_TIMEOUT/1000, 0) > 0) { /* sdata.shut_pkt.bType = Start[0]; */ if(Start[0]==SHUT_SYNC) @@ -939,19 +701,17 @@ static int shut_packet_recv( memcpy(Buf, Start, 1); return 1; } - else + else { /* if((serial_read (SHUT_TIMEOUT, &Start[1]) > 0) && */ - if( (ser_get_char(arg_upsfd, &Start[1], SHUT_TIMEOUT/1000, 0) > 0) && + if( (ser_get_char(upsfd, &Start[1], SHUT_TIMEOUT/1000, 0) > 0) && ((Start[1]>>4)==(Start[1]&0x0F))) { upsdebug_hex(4, "Receive", Start, 2); Size=Start[1]&0x0F; if( Size > 8 ) { - upsdebugx (4, - "shut_packet_recv: invalid frame size = %d", - Size); - ser_send_char(arg_upsfd, SHUT_NOK); + upsdebugx (4, "shut_packet_recv: invalid frame size = %d", Size); + ser_send_char(upsfd, SHUT_NOK); Retry++; break; } @@ -959,13 +719,13 @@ static int shut_packet_recv( for(recv=0;recv OK", Chk[0]); @@ -975,7 +735,7 @@ static int shut_packet_recv( Pos+=Size; Retry=0; - ser_send_char(arg_upsfd, SHUT_OK); + ser_send_char(upsfd, SHUT_OK); /* shut_token_send(SHUT_OK); */ /* Check if there are more data to receive */ @@ -989,76 +749,50 @@ static int shut_packet_recv( datalen+=Pos; Pos=0; } - else { + else return Pos; - } } else - upsdebugx (4, - "need more data (%" PRI_NUT_USB_CTRL_CHARBUFSIZE ")!", - datalen); + upsdebugx (4, "need more data (%i)!", datalen); } else { upsdebugx (4, "shut_checksum: %02x => NOK", Chk[0]); - ser_send_char(arg_upsfd, SHUT_NOK); + ser_send_char(upsfd, SHUT_NOK); /* shut_token_send(SHUT_NOK); */ Retry++; } } - else { + else return 0; - } } } - else { + else Retry++; - } } /* while */ - + return 0; } /**********************************************************************/ -/* Expected evaluated types for the API after typedefs: - * static int shut_interrupt_read(int arg_upsfd, int ep, - * unsigned char *bytes, int size, - * int timeout) - */ -static int shut_interrupt_read( - usb_dev_handle arg_upsfd, - usb_ctrl_endpoint ep, - usb_ctrl_charbuf bytes, - usb_ctrl_charbufsize size, - usb_ctrl_timeout_msec timeout) +int shut_interrupt_read(int upsfd, int ep, unsigned char *bytes, int size, + int timeout) { /* usleep(timeout * 1000); -*/ + */ /* FIXME: to be written */ - NUT_UNUSED_VARIABLE(arg_upsfd); - NUT_UNUSED_VARIABLE(ep); - NUT_UNUSED_VARIABLE(bytes); - NUT_UNUSED_VARIABLE(size); - NUT_UNUSED_VARIABLE(timeout); return 0; } /**********************************************************************/ -/* Expected evaluated types for the API after typedefs: - * static int shut_get_string_simple(int arg_upsfd, int index, - * char *buf, size_t buflen) - */ -static int shut_get_string_simple( - usb_dev_handle arg_upsfd, - usb_ctrl_strindex index, - char *buf, - usb_ctrl_charbufsize buflen) +int shut_get_string_simple(int upsfd, int index, + char *buf, size_t buflen) { - usb_ctrl_char tbuf[255]; /* Some devices choke on size > 255 */ + unsigned char tbuf[255]; /* Some devices choke on size > 255 */ int ret, si, di; - - ret = shut_control_msg(arg_upsfd, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, + + ret = shut_control_msg(upsfd, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, 0x0, tbuf, buflen, SHUT_TIMEOUT); if (ret < 0) return ret; @@ -1078,20 +812,20 @@ static int shut_get_string_simple( if (tbuf[si + 1]) /* high byte */ buf[di++] = '?'; else - buf[di++] = (char)tbuf[si]; + buf[di++] = tbuf[si]; } buf[di] = 0; return di; } - -/* + +/* * Human Interface Device (HID) functions *********************************************************************/ /********************************************************************** - * shut_get_descriptor(int desctype, usb_ctrl_charbuf pkt) - * + * shut_get_descriptor(int desctype, u_char *pkt) + * * get descriptor specified by DescType and return it in Buf * * desctype - from shutdataType @@ -1100,50 +834,28 @@ static int shut_get_string_simple( * return 0 on success, -1 on failure, -2 on NACK * *********************************************************************/ -/* Expected evaluated types for the API after typedefs: - * static int shut_get_descriptor(int arg_upsfd, unsigned char type, - * unsigned char index, void *buf, int size) - */ -static int shut_get_descriptor( - usb_dev_handle arg_upsfd, - usb_ctrl_requesttype type, - usb_ctrl_descindex index, - void *buf, - usb_ctrl_charbufsize size) +int shut_get_descriptor(int upsfd, unsigned char type, + unsigned char index, void *buf, int size) { memset(buf, 0, size); - upsdebugx (2, - "entering shut_get_descriptor(n %02x, %" PRI_NUT_USB_CTRL_CHARBUFSIZE ")", - type, size); + upsdebugx (2, "entering shut_get_descriptor(n %02x, %i)", type, size); - return shut_control_msg(arg_upsfd, USB_ENDPOINT_IN+(type>=USB_DT_HID?1:0), + return shut_control_msg(upsfd, USB_ENDPOINT_IN+(type>=USB_DT_HID?1:0), USB_REQ_GET_DESCRIPTOR, (type << 8) + index, 0, buf, size, SHUT_TIMEOUT); } /* Take care of a SHUT transfer (sending and receiving data) */ -/* Expected evaluated types for the API after typedefs: - * static int shut_control_msg(int arg_upsfd, int requesttype, int request, - * int value, int index, unsigned char *bytes, int size, - * int timeout) - */ -static int shut_control_msg( - usb_dev_handle arg_upsfd, - usb_ctrl_requesttype requesttype, - usb_ctrl_request request, - usb_ctrl_msgvalue value, - usb_ctrl_repindex index, - usb_ctrl_charbuf bytes, - usb_ctrl_charbufsize size, - usb_ctrl_timeout_msec timeout) +int shut_control_msg(int upsfd, int requesttype, int request, + int value, int index, unsigned char *bytes, int size, int timeout) { unsigned char shut_pkt[11]; short Retry=1, set_pass = -1; - usb_ctrl_charbufsize data_size, remaining_size = size; + short data_size, remaining_size = size; int i; struct shut_ctrltransfer_s ctrl; int ret = 0; - + upsdebugx (3, "entering shut_control_msg"); /* deal for set requests */ @@ -1154,43 +866,14 @@ static int shut_control_msg( remaining_size+= 8; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - /* Note: checking against limits of protocol struct fields, - * not against USB_CTRL_REQUEST_MAX et al, which are mostly int - */ - if (requesttype < 0 || (uintmax_t)requesttype > UINT8_MAX - || request < 0 || (uintmax_t)request > UINT8_MAX - || value < 0 || (uintmax_t)value > UINT16_MAX - || index < 0 || (uintmax_t)index > UINT16_MAX - || (uintmax_t)size > UINT16_MAX - || (uintmax_t)timeout > UINT32_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx (1, "%s: input values out of range", __func__); - return -1; - } - /* build the control request */ - ctrl.bRequestType = (uint8_t)requesttype; - ctrl.bRequest = (uint8_t)request; - ctrl.wValue = (uint16_t)value; - ctrl.wIndex = (uint16_t)index; - ctrl.wLength = (uint16_t)size; + ctrl.bRequestType = requesttype; + ctrl.bRequest = request; + ctrl.wValue = value; + ctrl.wIndex = index; + ctrl.wLength = size; ctrl.data = bytes; - ctrl.timeout = (uint32_t)timeout; /* in milliseconds */ + ctrl.timeout = timeout; align_request(&ctrl); @@ -1211,64 +894,26 @@ static int shut_control_msg( /* Always 8 bytes payload for GET_REPORT with SHUT */ data_size = 8; } - + /* Forge the SHUT Frame */ shut_pkt[0] = SHUT_TYPE_REQUEST + ( ((requesttype == REQUEST_TYPE_SET_REPORT) && (remaining_size>8))? 0 : SHUT_PKT_LAST); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if (data_size < 0 || data_size > UCHAR_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(1, "%s: ERROR: data_size %" PRI_NUT_USB_CTRL_CHARBUFSIZE - " is out of range for SHUT packet", - __func__, data_size); - return -1; - } - if (data_size > 0x0F) { - upsdebugx(1, "%s: WARNING: data_size %" PRI_NUT_USB_CTRL_CHARBUFSIZE - " may be too large for SHUT packet?", - __func__, data_size); - /* Do not abort here - maybe there is intentional maths - * in the protocol with overlapping/shifted-away numbers? - */ - } - shut_pkt[1] = (unsigned char)(data_size<<4) + (unsigned char)data_size; + shut_pkt[1] = (data_size<<4) + data_size; if ( (requesttype == REQUEST_TYPE_SET_REPORT) && (remaining_size < 8) ) memcpy(&shut_pkt[2], bytes, data_size); /* we need to send ctrl.data */ else memcpy(&shut_pkt[2], &ctrl, 8); - shut_pkt[(data_size+3) - 1] = shut_checksum(&shut_pkt[2], (unsigned char)data_size); - + shut_pkt[(data_size+3) - 1] = shut_checksum(&shut_pkt[2], data_size); + /* Packets need only to be sent once * NACK handling should take care of the rest */ if (Retry == 1) { - ser_send_buf(arg_upsfd, shut_pkt, data_size+3); + ser_send_buf(upsfd, shut_pkt, data_size+3); upsdebug_hex(3, "shut_control_msg", shut_pkt, data_size+3); /* serial_send (shut_pkt, data_size+3); */ } - i = shut_wait_ack (arg_upsfd); + i = shut_wait_ack (upsfd); switch (i) { case 0: @@ -1279,45 +924,40 @@ static int shut_control_msg( Retry=1; break; - case -1: if (Retry >= MAX_TRY) { upsdebugx(2, "Max tries reached while waiting for ACK, still getting errors"); - + /* try to resync, and give one more try */ Retry--; - shut_synchronise(arg_upsfd); + shut_synchronise(upsfd); return i; } else { upsdebugx(4, "Retry = %i", Retry); /* Send a NACK to get a resend from the UPS */ - ser_send_char(arg_upsfd, SHUT_NOK); + ser_send_char(upsfd, SHUT_NOK); Retry++; } break; - case -3: /* FIXME: notification caught => to be processed */ /* Send a NACK for the moment, to get a resend from the UPS */ - ser_send_char(arg_upsfd, SHUT_NOK); + ser_send_char(upsfd, SHUT_NOK); Retry++; - goto fallthrough_default; - default: - fallthrough_default: - break; + ; } } if (remaining_size != 0) return -1; - + /* now receive data, except for SET_REPORT */ if (requesttype != REQUEST_TYPE_SET_REPORT) - ret = shut_packet_recv (arg_upsfd, bytes, size); + ret = shut_packet_recv (upsfd, bytes, size); return ret; } @@ -1328,17 +968,14 @@ static int shut_control_msg( * wait for an ACK packet * * returns 0 on success, -1 on error, -2 on NACK, -3 on NOTIFICATION - * + * *********************************************************************/ -/* Expected evaluated types for the API after typedefs: - * int shut_wait_ack(int arg_upsfd) - */ -int shut_wait_ack(usb_dev_handle arg_upsfd) +int shut_wait_ack(int upsfd) { int retCode = -1; - unsigned char c = '\0'; + u_char c = '\0'; - ser_get_char(arg_upsfd, &c, SHUT_TIMEOUT/1000, 0); + ser_get_char(upsfd, &c, SHUT_TIMEOUT/1000, 0); if (c == SHUT_OK) { upsdebugx (2, "shut_wait_ack(): ACK received"); @@ -1356,6 +993,6 @@ int shut_wait_ack(usb_dev_handle arg_upsfd) } else if (c == '\0') upsdebugx (2, "shut_wait_ack(): Nothing received"); - + return retCode; } diff --git a/drivers/libshut.h b/drivers/libshut.h index c39fd17..48f48bb 100644 --- a/drivers/libshut.h +++ b/drivers/libshut.h @@ -24,88 +24,13 @@ * * -------------------------------------------------------------------------- */ -#ifndef NUT_LIBSHUT_H_SEEN -#define NUT_LIBSHUT_H_SEEN 1 +#ifndef LIBSHUT_H +#define LIBSHUT_H #include "main.h" /* for subdrv_info_t */ -#include "nut_stdint.h" /* for uint16_t, size_t, PRIsize etc. */ +#include "nut_stdint.h" /* for uint16_t */ -extern upsdrv_info_t comm_upsdrv_info; - -/* These typedefs are also named in usb-common.h (=> nut_libusb.h), adhering - * to one or another libusb API version. For consistency of "ifdef SHUT_MODE" - * handling in libhid.c and some drivers, these symbolic names are used in - * all the headers and are expected to match binary code of object files at - * (monolithic) driver build time. - * - * The MIN/MAX definitions here are primarily to generalize range-check - * code (especially if anything is done outside the libraries). - * FIXME: It may make sense to constrain the limits to lowest common - * denominator that should fit alll of libusb-0.1, libusb-1.0 and libshut, - * so that any build of the practical (driver) code knows to not exceed - * any use-case. - * - * Types below were mined from existing method signatures; see also the - * my_hid_descriptor struct in libshut.c for practical fixed-size types. - */ - -/* Essentially the file descriptor type, "int" - as in ser_get_char() etc.: */ -typedef int usb_dev_handle; - -/* Originally "int" cast to "uint8_t" in shut_control_msg(), - * and "unsigned char" in shut_get_descriptor() */ -typedef unsigned char usb_ctrl_requesttype; -#define USB_CTRL_REQUESTTYPE_MIN 0 -#define USB_CTRL_REQUESTTYPE_MAX UCHAR_MAX - -typedef int usb_ctrl_request; -#define USB_CTRL_REQUEST_MIN INT_MIN -#define USB_CTRL_REQUEST_MAX INT_MAX - -typedef int usb_ctrl_endpoint; -#define USB_CTRL_ENDPOINT_MIN INT_MIN -#define USB_CTRL_ENDPOINT_MAX INT_MAX - -typedef int usb_ctrl_msgvalue; -#define USB_CTRL_MSGVALUE_MIN INT_MIN -#define USB_CTRL_MSGVALUE_MAX INT_MAX - -typedef int usb_ctrl_repindex; -#define USB_CTRL_REPINDEX_MIN INT_MIN -#define USB_CTRL_REPINDEX_MAX INT_MAX - -typedef int usb_ctrl_strindex; -#define USB_CTRL_STRINDEX_MIN INT_MIN -#define USB_CTRL_STRINDEX_MAX INT_MAX - -typedef unsigned char usb_ctrl_descindex; -#define USB_CTRL_DESCINDEX_MIN 0 -#define USB_CTRL_DESCINDEX_MAX UCHAR_MAX - -/* Here MIN/MAX should not matter much, type mostly used for casting */ -typedef unsigned char* usb_ctrl_charbuf; -typedef unsigned char usb_ctrl_char; -#define USB_CTRL_CHAR_MIN 0 -#define USB_CTRL_CHAR_MAX UCHAR_MAX - -typedef size_t usb_ctrl_charbufsize; /*typedef int usb_ctrl_charbufsize;*/ -#define USB_CTRL_CHARBUFSIZE_MIN 0 -#define USB_CTRL_CHARBUFSIZE_MAX SIZE_MAX -#define PRI_NUT_USB_CTRL_CHARBUFSIZE PRIsize - -typedef int usb_ctrl_timeout_msec; /* in milliseconds */ -#define USB_CTRL_TIMEOUTMSEC_MIN INT_MIN -#define USB_CTRL_TIMEOUTMSEC_MAX INT_MAX - -/* Same error-code definitions as in usb-common.h for libusb-0.1 API */ -#define ERROR_ACCESS -EACCES -#define ERROR_BUSY -EBUSY -#define ERROR_IO -EIO -#define ERROR_NO_DEVICE -ENODEV -#define ERROR_NOT_FOUND -ENOENT -#define ERROR_OVERFLOW -EOVERFLOW -#define ERROR_PIPE -EPIPE -#define ERROR_TIMEOUT -ETIMEDOUT +extern upsdrv_info_t comm_upsdrv_info; /*! * SHUTDevice_t: Describe a SHUT device. This structure contains exactly @@ -117,14 +42,12 @@ typedef int usb_ctrl_timeout_msec; /* in milliseconds */ * corresponding string did not exist or could not be retrieved. */ typedef struct SHUTDevice_s { - uint16_t VendorID; /*!< Device's Vendor ID */ - uint16_t ProductID; /*!< Device's Product ID */ - char* Vendor; /*!< Device's Vendor Name */ - char* Product; /*!< Device's Product Name */ - char* Serial; /*!< Product serial number */ - char* Bus; /*!< Bus name, e.g. "003" */ - uint16_t bcdDevice; /*!< Device release number */ - char *Device; /*!< Device name on the bus, e.g. "001" */ + uint16_t VendorID; /*!< Device's Vendor ID */ + uint16_t ProductID; /*!< Device's Product ID */ + char* Vendor; /*!< Device's Vendor Name */ + char* Product; /*!< Device's Product Name */ + char* Serial; /* Product serial number */ + char* Bus; /* Bus name, e.g. "003" */ } SHUTDevice_t; /*! @@ -132,28 +55,20 @@ typedef struct SHUTDevice_s { */ typedef struct shut_communication_subdriver_s { const char *name; /* name of this subdriver */ - const char *version; /* version of this subdriver */ - - int (*open)(usb_dev_handle *upsfd, /* try to open the next available */ + const char *version; /* version of this subdriver */ + int (*open)(int *upsfd, /* try to open the next available */ SHUTDevice_t *curDevice, /* device matching USBDeviceMatcher_t */ char *device_path, - int (*callback)(usb_dev_handle upsfd, SHUTDevice_t *hd, - usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen)); - - void (*close)(usb_dev_handle upsfd); - - int (*get_report)(usb_dev_handle upsfd, usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, usb_ctrl_charbufsize ReportSize); - - int (*set_report)(usb_dev_handle upsfd, usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, usb_ctrl_charbufsize ReportSize); - - int (*get_string)(usb_dev_handle upsfd, - usb_ctrl_strindex StringIdx, char *buf, usb_ctrl_charbufsize buflen); - - int (*get_interrupt)(usb_dev_handle upsfd, - usb_ctrl_charbuf buf, usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout); + int (*callback)(int upsfd, SHUTDevice_t *hd, unsigned char *rdbuf, int rdlen)); + void (*close)(int upsfd); + int (*get_report)(int upsfd, int ReportId, + unsigned char *raw_buf, int ReportSize ); + int (*set_report)(int upsfd, int ReportId, + unsigned char *raw_buf, int ReportSize ); + int (*get_string)(int upsfd, + int StringIdx, char *buf, size_t buflen); + int (*get_interrupt)(int upsfd, + unsigned char *buf, int bufsize, int timeout); } shut_communication_subdriver_t; extern shut_communication_subdriver_t shut_subdriver; @@ -169,4 +84,4 @@ extern shut_communication_subdriver_t shut_subdriver; /* Ellipse models */ #define DEFAULT_NOTIFICATION COMPLETE_NOTIFICATION -#endif /* NUT_LIBSHUT_H_SEEN */ +#endif /* LIBSHUT_H */ diff --git a/drivers/libusb.c b/drivers/libusb.c new file mode 100644 index 0000000..234b9f1 --- /dev/null +++ b/drivers/libusb.c @@ -0,0 +1,491 @@ +/*! + * @file libusb.c + * @brief HID Library - Generic USB communication sub driver (using libusb) + * + * @author Copyright (C) + * 2003 - 2007 Arnaud Quette + * 2005 - 2007 Peter Selinger + * + * This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com + * + * The logic of this file is ripped from mge-shut driver (also from + * Arnaud Quette), which is a "HID over serial link" UPS driver for + * Network UPS Tools + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * -------------------------------------------------------------------------- */ + +#include "config.h" /* for HAVE_USB_DETACH_KERNEL_DRIVER_NP flag */ +#include "common.h" /* for xmalloc, upsdebugx prototypes */ +#include "usb-common.h" +#include "libusb.h" + +/* USB standard timeout */ +#define USB_TIMEOUT 5000 + +#define USB_DRIVER_NAME "USB communication driver" +#define USB_DRIVER_VERSION "0.32" + +/* driver description structure */ +upsdrv_info_t comm_upsdrv_info = { + USB_DRIVER_NAME, + USB_DRIVER_VERSION, + NULL, + 0, + { NULL } +}; + +#define MAX_REPORT_SIZE 0x1800 + +static void libusb_close(usb_dev_handle *udev); + +/* From usbutils: workaround libusb API goofs: "byte" should never be sign extended; + * using "char" is trouble. Likewise, sizes should never be negative. + */ + +static inline int typesafe_control_msg(usb_dev_handle *dev, + unsigned char requesttype, unsigned char request, + int value, int index, + unsigned char *bytes, unsigned size, int timeout) +{ + return usb_control_msg(dev, requesttype, request, value, index, + (char *) bytes, (int) size, timeout); +} + +/* invoke matcher against device */ +static inline int matches(USBDeviceMatcher_t *matcher, USBDevice_t *device) { + if (!matcher) { + return 1; + } + return matcher->match_function(device, matcher->privdata); +} + +#define usb_control_msg typesafe_control_msg + +/* On success, fill in the curDevice structure and return the report + * descriptor length. On failure, return -1. + * Note: When callback is not NULL, the report descriptor will be + * passed to this function together with the udev and USBDevice_t + * information. This callback should return a value > 0 if the device + * is accepted, or < 1 if not. If it isn't accepted, the next device + * (if any) will be tried, until there are no more devices left. + */ +static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDeviceMatcher_t *matcher, + int (*callback)(usb_dev_handle *udev, USBDevice_t *hd, unsigned char *rdbuf, int rdlen)) +{ +#ifdef HAVE_USB_DETACH_KERNEL_DRIVER_NP + int retries; +#endif + int rdlen1, rdlen2; /* report descriptor length, method 1+2 */ + USBDeviceMatcher_t *m; + struct usb_device *dev; + struct usb_bus *bus; + usb_dev_handle *udev; + struct usb_interface_descriptor *iface; + + int ret, res; + unsigned char buf[20]; + unsigned char *p; + char string[256]; + int i; + + /* report descriptor */ + unsigned char rdbuf[MAX_REPORT_SIZE]; + int rdlen; + + /* libusb base init */ + usb_init(); + usb_find_busses(); + usb_find_devices(); + +#ifndef __linux__ /* SUN_LIBUSB (confirmed to work on Solaris and FreeBSD) */ + /* Causes a double free corruption in linux if device is detached! */ + libusb_close(*udevp); +#endif + + for (bus = usb_busses; bus; bus = bus->next) { + for (dev = bus->devices; dev; dev = dev->next) { + upsdebugx(2, "Checking device (%04X/%04X) (%s/%s)", dev->descriptor.idVendor, + dev->descriptor.idProduct, bus->dirname, dev->filename); + + /* supported vendors are now checked by the + supplied matcher */ + + /* open the device */ + *udevp = udev = usb_open(dev); + if (!udev) { + upsdebugx(2, "Failed to open device, skipping. (%s)", usb_strerror()); + continue; + } + + /* collect the identifying information of this + device. Note that this is safe, because + there's no need to claim an interface for + this (and therefore we do not yet need to + detach any kernel drivers). */ + + free(curDevice->Vendor); + free(curDevice->Product); + free(curDevice->Serial); + free(curDevice->Bus); + memset(curDevice, '\0', sizeof(*curDevice)); + + curDevice->VendorID = dev->descriptor.idVendor; + curDevice->ProductID = dev->descriptor.idProduct; + curDevice->Bus = strdup(bus->dirname); + + if (dev->descriptor.iManufacturer) { + ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, + string, sizeof(string)); + if (ret > 0) { + curDevice->Vendor = strdup(string); + } + } + + if (dev->descriptor.iProduct) { + ret = usb_get_string_simple(udev, dev->descriptor.iProduct, + string, sizeof(string)); + if (ret > 0) { + curDevice->Product = strdup(string); + } + } + + if (dev->descriptor.iSerialNumber) { + ret = usb_get_string_simple(udev, dev->descriptor.iSerialNumber, + string, sizeof(string)); + if (ret > 0) { + curDevice->Serial = strdup(string); + } + } + + upsdebugx(2, "- VendorID: %04x", curDevice->VendorID); + upsdebugx(2, "- ProductID: %04x", curDevice->ProductID); + upsdebugx(2, "- Manufacturer: %s", curDevice->Vendor ? curDevice->Vendor : "unknown"); + upsdebugx(2, "- Product: %s", curDevice->Product ? curDevice->Product : "unknown"); + upsdebugx(2, "- Serial Number: %s", curDevice->Serial ? curDevice->Serial : "unknown"); + upsdebugx(2, "- Bus: %s", curDevice->Bus ? curDevice->Bus : "unknown"); + + upsdebugx(2, "Trying to match device"); + for (m = matcher; m; m=m->next) { + ret = matches(m, curDevice); + if (ret==0) { + upsdebugx(2, "Device does not match - skipping"); + goto next_device; + } else if (ret==-1) { + fatal_with_errno(EXIT_FAILURE, "matcher"); + goto next_device; + } else if (ret==-2) { + upsdebugx(2, "matcher: unspecified error"); + goto next_device; + } + } + upsdebugx(2, "Device matches"); + + /* Now we have matched the device we wanted. Claim it. */ + +#ifdef HAVE_USB_DETACH_KERNEL_DRIVER_NP + /* this method requires at least libusb 0.1.8: + * it force device claiming by unbinding + * attached driver... From libhid */ + retries = 3; + while (usb_claim_interface(udev, 0) < 0) { + + upsdebugx(2, "failed to claim USB device: %s", usb_strerror()); + + if (usb_detach_kernel_driver_np(udev, 0) < 0) { + upsdebugx(2, "failed to detach kernel driver from USB device: %s", usb_strerror()); + } else { + upsdebugx(2, "detached kernel driver from USB device..."); + } + + if (retries-- > 0) { + continue; + } + + fatalx(EXIT_FAILURE, "Can't claim USB device [%04x:%04x]: %s", curDevice->VendorID, curDevice->ProductID, usb_strerror()); + } +#else + if (usb_claim_interface(udev, 0) < 0) { + fatalx(EXIT_FAILURE, "Can't claim USB device [%04x:%04x]: %s", curDevice->VendorID, curDevice->ProductID, usb_strerror()); + } +#endif + + /* set default interface */ + usb_set_altinterface(udev, 0); + + if (!callback) { + return 1; + } + + if (!dev->config) { /* ?? this should never happen */ + upsdebugx(2, " Couldn't retrieve descriptors"); + goto next_device; + } + + rdlen1 = -1; + rdlen2 = -1; + + /* Get HID descriptor */ + + /* FIRST METHOD: ask for HID descriptor directly. */ + /* res = usb_get_descriptor(udev, USB_DT_HID, 0, buf, 0x9); */ + res = usb_control_msg(udev, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, + (USB_DT_HID << 8) + 0, 0, buf, 0x9, USB_TIMEOUT); + + if (res < 0) { + upsdebugx(2, "Unable to get HID descriptor (%s)", usb_strerror()); + } else if (res < 9) { + upsdebugx(2, "HID descriptor too short (expected %d, got %d)", 8, res); + } else { + + upsdebug_hex(3, "HID descriptor, method 1", buf, 9); + + rdlen1 = buf[7] | (buf[8] << 8); + } + + if (rdlen1 < -1) { + upsdebugx(2, "Warning: HID descriptor, method 1 failed"); + } + + /* SECOND METHOD: find HID descriptor among "extra" bytes of + interface descriptor, i.e., bytes tucked onto the end of + descriptor 2. */ + + /* Note: on some broken UPS's (e.g. Tripp Lite Smart1000LCD), + only this second method gives the correct result */ + + /* for now, we always assume configuration 0, interface 0, + altsetting 0, as above. */ + iface = &dev->config[0].interface[0].altsetting[0]; + for (i=0; iextralen; i+=iface->extra[i]) { + upsdebugx(4, "i=%d, extra[i]=%02x, extra[i+1]=%02x", i, + iface->extra[i], iface->extra[i+1]); + if (i+9 <= iface->extralen && iface->extra[i] >= 9 && iface->extra[i+1] == 0x21) { + p = &iface->extra[i]; + upsdebug_hex(3, "HID descriptor, method 2", p, 9); + rdlen2 = p[7] | (p[8] << 8); + break; + } + } + + if (rdlen2 < -1) { + upsdebugx(2, "Warning: HID descriptor, method 2 failed"); + } + + /* when available, always choose the second value, as it + seems to be more reliable (it is the one reported e.g. by + lsusb). Note: if the need arises, can change this to use + the maximum of the two values instead. */ + rdlen = rdlen2 >= 0 ? rdlen2 : rdlen1; + + if (rdlen < 0) { + upsdebugx(2, "Unable to retrieve any HID descriptor"); + goto next_device; + } + if (rdlen1 >= 0 && rdlen2 >= 0 && rdlen1 != rdlen2) { + upsdebugx(2, "Warning: two different HID descriptors retrieved (Reportlen = %d vs. %d)", rdlen1, rdlen2); + } + + upsdebugx(2, "HID descriptor length %d", rdlen); + + if (rdlen > (int)sizeof(rdbuf)) { + upsdebugx(2, "HID descriptor too long %d (max %d)", rdlen, (int)sizeof(rdbuf)); + goto next_device; + } + + /* res = usb_get_descriptor(udev, USB_DT_REPORT, 0, bigbuf, rdlen); */ + res = usb_control_msg(udev, USB_ENDPOINT_IN+1, USB_REQ_GET_DESCRIPTOR, + (USB_DT_REPORT << 8) + 0, 0, rdbuf, rdlen, USB_TIMEOUT); + + if (res < 0) + { + upsdebug_with_errno(2, "Unable to get Report descriptor"); + goto next_device; + } + + if (res < rdlen) + { + upsdebugx(2, "Warning: report descriptor too short (expected %d, got %d)", rdlen, res); + rdlen = res; /* correct rdlen if necessary */ + } + + res = callback(udev, curDevice, rdbuf, rdlen); + if (res < 1) { + upsdebugx(2, "Caller doesn't like this device"); + goto next_device; + } + + upsdebugx(2, "Report descriptor retrieved (Reportlen = %d)", rdlen); + upsdebugx(2, "Found HID device"); + fflush(stdout); + + return rdlen; + + next_device: + usb_close(udev); + } + } + + *udevp = NULL; + upsdebugx(2, "No appropriate HID device found"); + fflush(stdout); + + return -1; +} + +/* + * Error handler for usb_get/set_* functions. Return value > 0 success, + * 0 unknown or temporary failure (ignored), < 0 permanent failure (reconnect) + */ +static int libusb_strerror(const int ret, const char *desc) +{ + if (ret > 0) { + return ret; + } + + switch(ret) + { + case -EBUSY: /* Device or resource busy */ + case -EPERM: /* Operation not permitted */ + case -ENODEV: /* No such device */ + case -EACCES: /* Permission denied */ + case -EIO: /* I/O error */ + case -ENXIO: /* No such device or address */ + case -ENOENT: /* No such file or directory */ + case -EPIPE: /* Broken pipe */ + case -ENOSYS: /* Function not implemented */ + upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror()); + return ret; + + case -ETIMEDOUT: /* Connection timed out */ + upsdebugx(2, "%s: Connection timed out", desc); + return 0; + + case -EOVERFLOW: /* Value too large for defined data type */ + case -EPROTO: /* Protocol error */ + upsdebugx(2, "%s: %s", desc, usb_strerror()); + return 0; + + default: /* Undetermined, log only */ + upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror()); + return 0; + } +} + +/* return the report of ID=type in report + * return -1 on failure, report length on success + */ + +static int libusb_get_report(usb_dev_handle *udev, int ReportId, unsigned char *raw_buf, int ReportSize ) +{ + int ret; + + upsdebugx(4, "Entering libusb_get_report"); + + if (!udev) { + return 0; + } + + ret = usb_control_msg(udev, + USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE, + 0x01, /* HID_REPORT_GET */ + ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */ + 0, raw_buf, ReportSize, USB_TIMEOUT); + + /* Ignore "protocol stall" (for unsupported request) on control endpoint */ + if (ret == -EPIPE) { + return 0; + } + + return libusb_strerror(ret, __func__); +} + +static int libusb_set_report(usb_dev_handle *udev, int ReportId, unsigned char *raw_buf, int ReportSize ) +{ + int ret; + + if (!udev) { + return 0; + } + + ret = usb_control_msg(udev, + USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, + 0x09, /* HID_REPORT_SET = 0x09*/ + ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */ + 0, raw_buf, ReportSize, USB_TIMEOUT); + + /* Ignore "protocol stall" (for unsupported request) on control endpoint */ + if (ret == -EPIPE) { + return 0; + } + + return libusb_strerror(ret, __func__); +} + +static int libusb_get_string(usb_dev_handle *udev, int StringIdx, char *buf, size_t buflen) +{ + int ret; + + if (!udev) { + return -1; + } + + ret = usb_get_string_simple(udev, StringIdx, buf, buflen); + + return libusb_strerror(ret, __func__); +} + +static int libusb_get_interrupt(usb_dev_handle *udev, unsigned char *buf, int bufsize, int timeout) +{ + int ret; + + if (!udev) { + return -1; + } + + /* FIXME: hardcoded interrupt EP => need to get EP descr for IF descr */ + ret = usb_interrupt_read(udev, 0x81, (char *)buf, bufsize, timeout); + + /* Clear stall condition */ + if (ret == -EPIPE) { + ret = usb_clear_halt(udev, 0x81); + } + + return libusb_strerror(ret, __func__); +} + +static void libusb_close(usb_dev_handle *udev) +{ + if (!udev) { + return; + } + + /* usb_release_interface() sometimes blocks and goes + into uninterruptible sleep. So don't do it. */ + /* usb_release_interface(udev, 0); */ + usb_close(udev); +} + +usb_communication_subdriver_t usb_subdriver = { + USB_DRIVER_VERSION, + USB_DRIVER_NAME, + libusb_open, + libusb_close, + libusb_get_report, + libusb_set_report, + libusb_get_string, + libusb_get_interrupt +}; diff --git a/drivers/libusb.h b/drivers/libusb.h new file mode 100644 index 0000000..66d2633 --- /dev/null +++ b/drivers/libusb.h @@ -0,0 +1,66 @@ +/*! + * @file libusb.h + * @brief HID Library - Generic USB backend for Generic HID Access (using MGE HIDParser) + * + * @author Copyright (C) + * 2003 - 2006 Arnaud Quette + * 2005 Peter Selinger + * + * This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com + * + * The logic of this file is ripped from mge-shut driver (also from + * Arnaud Quette), which is a "HID over serial link" UPS driver for + * Network UPS Tools + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + * -------------------------------------------------------------------------- */ + +#ifndef LIBUSB_H +#define LIBUSB_H + +#include "main.h" /* for subdrv_info_t */ +#include "usb-common.h" /* for USBDevice_t and USBDeviceMatcher_t */ + +#include /* libusb header file */ + +extern upsdrv_info_t comm_upsdrv_info; + +/*! + * usb_communication_subdriver_s: structure to describe the communication routines + * @name: can be either "shut" for Serial HID UPS Transfer (from MGE) or "usb" + */ +typedef struct usb_communication_subdriver_s { + const char *name; /* name of this subdriver */ + const char *version; /* version of this subdriver */ + int (*open)(usb_dev_handle **sdevp, /* try to open the next available */ + USBDevice_t *curDevice, /* device matching USBDeviceMatcher_t */ + USBDeviceMatcher_t *matcher, + int (*callback)(usb_dev_handle *udev, USBDevice_t *hd, unsigned char *rdbuf, int rdlen)); + void (*close)(usb_dev_handle *sdev); + int (*get_report)(usb_dev_handle *sdev, int ReportId, + unsigned char *raw_buf, int ReportSize ); + int (*set_report)(usb_dev_handle *sdev, int ReportId, + unsigned char *raw_buf, int ReportSize ); + int (*get_string)(usb_dev_handle *sdev, + int StringIdx, char *buf, size_t buflen); + int (*get_interrupt)(usb_dev_handle *sdev, + unsigned char *buf, int bufsize, int timeout); +} usb_communication_subdriver_t; + +extern usb_communication_subdriver_t usb_subdriver; + +#endif /* LIBUSB_H */ + diff --git a/drivers/libusb0.c b/drivers/libusb0.c deleted file mode 100644 index 643a0a7..0000000 --- a/drivers/libusb0.c +++ /dev/null @@ -1,773 +0,0 @@ -/*! - * @file libusb0.c - * @brief HID Library - Generic USB communication sub driver (using libusb 0.1) - * - * @author Copyright (C) - * 2003 - 2007 Arnaud Quette - * 2005 - 2007 Peter Selinger - * - * This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com - * - * The logic of this file is ripped from mge-shut driver (also from - * Arnaud Quette), which is a "HID over serial link" UPS driver for - * Network UPS Tools - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * -------------------------------------------------------------------------- */ - -#include "config.h" /* for HAVE_USB_DETACH_KERNEL_DRIVER_NP flag */ -#include "common.h" /* for xmalloc, upsdebugx prototypes */ -#include "usb-common.h" -#include "nut_libusb.h" - -#define USB_DRIVER_NAME "USB communication driver (libusb 0.1)" -#define USB_DRIVER_VERSION "0.43" - -/* driver description structure */ -upsdrv_info_t comm_upsdrv_info = { - USB_DRIVER_NAME, - USB_DRIVER_VERSION, - NULL, - 0, - { NULL } -}; - -#define MAX_REPORT_SIZE 0x1800 -#define MAX_RETRY 3 - -static void libusb_close(usb_dev_handle *udev); - -/*! Add USB-related driver variables with addvar() and dstate_setinfo(). - * This removes some code duplication across the USB drivers. - */ -void nut_usb_addvars(void) -{ - /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ - addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); - addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); - addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); - - addvar(VAR_VALUE, "vendorid", "Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal)"); - addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); - - addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); - addvar(VAR_VALUE, "device", "Regular expression to match USB device name"); - addvar(VAR_VALUE, "usb_set_altinterface", "Force redundant call to usb_set_altinterface() (value=bAlternateSetting; default=0)"); - - dstate_setinfo("driver.version.usb", "libusb-0.1 (or compat)"); -} - -/* From usbutils: workaround libusb (0.1) API goofs: - * "byte" should never be sign extended; - * using "char" is trouble. - * Likewise, sizes should never be negative. - */ - -/* -static inline int typesafe_control_msg(usb_dev_handle *dev, - unsigned char requesttype, unsigned char request, - int value, int index, - unsigned char *bytes, unsigned size, int timeout) -{ - return usb_control_msg(dev, requesttype, request, value, index, - (char *) bytes, (int) size, timeout); -} -*/ - -static inline int typesafe_control_msg( - usb_dev_handle *dev, - unsigned char requesttype, - unsigned char request, - int value, - int index, - usb_ctrl_charbuf bytes, - usb_ctrl_charbufsize size, - usb_ctrl_timeout_msec timeout) -{ - return usb_control_msg(dev, requesttype, request, value, index, - (char *) bytes, (int) size, timeout); -} - - -/* invoke matcher against device */ -static inline int matches(USBDeviceMatcher_t *matcher, USBDevice_t *device) { - if (!matcher) { - return 1; - } - return matcher->match_function(device, matcher->privdata); -} - -/*! If needed, set the USB alternate interface. - * - * In NUT 2.7.2 and earlier, the following call was made unconditionally: - * usb_set_altinterface(udev, 0); - * - * Although harmless on Linux and *BSD, this extra call prevents old Tripp Lite - * devices from working on Mac OS X (presumably the OS is already setting - * altinterface to 0). - */ -static int nut_usb_set_altinterface(usb_dev_handle *udev) -{ - int altinterface = 0, ret = 0; - char *alt_string, *endp = NULL; - - if(testvar("usb_set_altinterface")) { - alt_string = getval("usb_set_altinterface"); - if(alt_string) { - altinterface = (int)strtol(alt_string, &endp, 10); - if(endp && !(endp[0] == 0)) { - upslogx(LOG_WARNING, "%s: '%s' is not a valid number", __func__, alt_string); - } - if(altinterface < 0 || altinterface > 255) { - upslogx(LOG_WARNING, "%s: setting bAlternateInterface to %d will probably not work", __func__, altinterface); - } - } - /* set default interface */ - upsdebugx(2, "%s: calling usb_set_altinterface(udev, %d)", - __func__, altinterface); - ret = usb_set_altinterface(udev, altinterface); - if(ret != 0) { - upslogx(LOG_WARNING, "%s: usb_set_altinterface(udev, %d) returned %d (%s)", - __func__, altinterface, ret, usb_strerror() ); - } - upslogx(LOG_NOTICE, "%s: usb_set_altinterface() should not be necessary - " - "please email the nut-upsdev list with information about your UPS.", __func__); - } else { - upsdebugx(3, "%s: skipped usb_set_altinterface(udev, 0)", __func__); - } - return ret; -} - -#define usb_control_msg typesafe_control_msg - -/* On success, fill in the curDevice structure and return the report - * descriptor length. On failure, return -1. - * Note: When callback is not NULL, the report descriptor will be - * passed to this function together with the udev and USBDevice_t - * information. This callback should return a value > 0 if the device - * is accepted, or < 1 if not. If it isn't accepted, the next device - * (if any) will be tried, until there are no more devices left. - */ -static int libusb_open(usb_dev_handle **udevp, - USBDevice_t *curDevice, USBDeviceMatcher_t *matcher, - int (*callback)(usb_dev_handle *udev, - USBDevice_t *hd, usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen) - ) -{ - int retries; - usb_ctrl_charbufsize rdlen1, rdlen2; /* report descriptor length, method 1+2 */ - USBDeviceMatcher_t *m; - struct usb_device *dev; - struct usb_bus *bus; - usb_dev_handle *udev; - struct usb_interface_descriptor *iface; - - int ret, res; - usb_ctrl_char buf[20]; - usb_ctrl_char *p; - char string[256]; - int i; - int count_open_EACCESS = 0; - int count_open_errors = 0; - int count_open_attempts = 0; - - /* report descriptor */ - usb_ctrl_char rdbuf[MAX_REPORT_SIZE]; - usb_ctrl_charbufsize rdlen; - - /* libusb base init */ - usb_init(); - usb_find_busses(); - usb_find_devices(); - -#ifndef __linux__ /* SUN_LIBUSB (confirmed to work on Solaris and FreeBSD) */ - /* Causes a double free corruption in linux if device is detached! */ - libusb_close(*udevp); -#endif - - upsdebugx(3, "usb_busses=%p", (void*)usb_busses); - - for (bus = usb_busses; bus; bus = bus->next) { - for (dev = bus->devices; dev; dev = dev->next) { - /* int if_claimed = 0; */ - - count_open_attempts++; - - upsdebugx(2, "Checking device (%04X/%04X) (%s/%s)", - dev->descriptor.idVendor, dev->descriptor.idProduct, - bus->dirname, dev->filename); - - /* supported vendors are now checked by the - supplied matcher */ - - /* open the device */ - *udevp = udev = usb_open(dev); - if (!udev) { - /* It seems that with libusb-0.1 API we - * can only evaluate the string value of - * usb_strerror() return values - in the - * library source there is magic about - * tracking errors in their string buffer - * or as a printable errno, and no reliably - * usable way to learn of an EACCESS or - * other situation diagnostics otherwise. - * So we have to search for sub-strings - * and hope for locale to be right... - */ - char *libusb_error = usb_strerror(); - upsdebugx(1, "Failed to open device (%04X/%04X), skipping: %s", - dev->descriptor.idVendor, - dev->descriptor.idProduct, - libusb_error); - - count_open_errors++; - if (strcasestr(libusb_error, "Access denied") - || strcasestr(libusb_error, "insufficient permissions") - ) { - count_open_EACCESS++; - } - - continue; - } - - /* collect the identifying information of this - device. Note that this is safe, because - there's no need to claim an interface for - this (and therefore we do not yet need to - detach any kernel drivers). */ - - free(curDevice->Vendor); - free(curDevice->Product); - free(curDevice->Serial); - free(curDevice->Bus); - free(curDevice->Device); - memset(curDevice, '\0', sizeof(*curDevice)); - - curDevice->VendorID = dev->descriptor.idVendor; - curDevice->ProductID = dev->descriptor.idProduct; - curDevice->Bus = xstrdup(bus->dirname); - curDevice->Device = xstrdup(dev->filename); - curDevice->bcdDevice = dev->descriptor.bcdDevice; - - if (dev->descriptor.iManufacturer) { - retries = MAX_RETRY; - while (retries > 0) { - ret = usb_get_string_simple(udev, dev->descriptor.iManufacturer, - string, sizeof(string)); - if (ret > 0) { - curDevice->Vendor = xstrdup(string); - break; - } - retries--; - upsdebugx(1, "%s get iManufacturer failed, retrying...", __func__); - } - } - - if (dev->descriptor.iProduct) { - retries = MAX_RETRY; - while (retries > 0) { - ret = usb_get_string_simple(udev, dev->descriptor.iProduct, - string, sizeof(string)); - if (ret > 0) { - curDevice->Product = xstrdup(string); - break; - } - retries--; - upsdebugx(1, "%s get iProduct failed, retrying...", __func__); - } - } - - if (dev->descriptor.iSerialNumber) { - retries = MAX_RETRY; - while (retries > 0) { - ret = usb_get_string_simple(udev, dev->descriptor.iSerialNumber, - string, sizeof(string)); - if (ret > 0) { - curDevice->Serial = xstrdup(string); - break; - } - retries--; - upsdebugx(1, "%s get iSerialNumber failed, retrying...", __func__); - } - } - - upsdebugx(2, "- VendorID: %04x", curDevice->VendorID); - upsdebugx(2, "- ProductID: %04x", curDevice->ProductID); - upsdebugx(2, "- Manufacturer: %s", curDevice->Vendor ? curDevice->Vendor : "unknown"); - upsdebugx(2, "- Product: %s", curDevice->Product ? curDevice->Product : "unknown"); - upsdebugx(2, "- Serial Number: %s", curDevice->Serial ? curDevice->Serial : "unknown"); - upsdebugx(2, "- Bus: %s", curDevice->Bus ? curDevice->Bus : "unknown"); - upsdebugx(2, "- Device: %s", curDevice->Device ? curDevice->Device : "unknown"); - upsdebugx(2, "- Device release number: %04x", curDevice->bcdDevice); - - /* FIXME: extend to Eaton OEMs (HP, IBM, ...) */ - if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) { - usb_subdriver.hid_desc_index = 1; - } - - upsdebugx(2, "Trying to match device"); - for (m = matcher; m; m=m->next) { - ret = matches(m, curDevice); - if (ret==0) { - upsdebugx(2, "Device does not match - skipping"); - goto next_device; - } else if (ret==-1) { - fatal_with_errno(EXIT_FAILURE, "matcher"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif - goto next_device; -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif - } else if (ret==-2) { - upsdebugx(2, "matcher: unspecified error"); - goto next_device; - } - } - upsdebugx(2, "Device matches"); - - /* Now we have matched the device we wanted. Claim it. */ - -#ifdef HAVE_USB_DETACH_KERNEL_DRIVER_NP - /* this method requires at least libusb 0.1.8: - * it force device claiming by unbinding - * attached driver... From libhid */ - retries = MAX_RETRY; - while (usb_claim_interface(udev, usb_subdriver.hid_rep_index) < 0) { - - upsdebugx(2, "failed to claim USB device: %s", - usb_strerror()); - - if (usb_detach_kernel_driver_np(udev, usb_subdriver.hid_rep_index) < 0) { - upsdebugx(2, "failed to detach kernel driver from USB device: %s", - usb_strerror()); - } else { - upsdebugx(2, "detached kernel driver from USB device..."); - } - - if (retries-- > 0) { - continue; - } - - fatalx(EXIT_FAILURE, - "Can't claim USB device [%04x:%04x]@%d/%d: %s", - curDevice->VendorID, curDevice->ProductID, - usb_subdriver.hid_rep_index, - usb_subdriver.hid_desc_index, - usb_strerror()); - } -#else - if (usb_claim_interface(udev, usb_subdriver.hid_rep_index) < 0) { - fatalx(EXIT_FAILURE, - "Can't claim USB device [%04x:%04x]@%d/%d: %s", - curDevice->VendorID, curDevice->ProductID, - usb_subdriver.hid_rep_index, - usb_subdriver.hid_desc_index, - usb_strerror()); - } -#endif - /* if_claimed = 1; */ - - nut_usb_set_altinterface(udev); - - if (!callback) { - return 1; - } - - if (!dev->config) { /* ?? this should never happen */ - upsdebugx(2, " Couldn't retrieve descriptors"); - goto next_device; - } - - rdlen1 = -1; - rdlen2 = -1; - - /* Get HID descriptor */ - - /* FIRST METHOD: ask for HID descriptor directly. */ - /* res = usb_get_descriptor(udev, USB_DT_HID, hid_desc_index, buf, 0x9); */ - res = usb_control_msg(udev, - USB_ENDPOINT_IN + 1, - USB_REQ_GET_DESCRIPTOR, - (USB_DT_HID << 8) + usb_subdriver.hid_desc_index, - usb_subdriver.hid_rep_index, - buf, 0x9, USB_TIMEOUT); - - if (res < 0) { - upsdebugx(2, "Unable to get HID descriptor (%s)", - usb_strerror()); - } else if (res < 9) { - upsdebugx(2, "HID descriptor too short (expected %d, got %d)", 8, res); - } else { - - upsdebug_hex(3, "HID descriptor, method 1", buf, 9); - - rdlen1 = ((uint8_t)buf[7]) | (((uint8_t)buf[8]) << 8); - } - - if (rdlen1 < -1) { - upsdebugx(2, "Warning: HID descriptor, method 1 failed"); - } - upsdebugx(3, - "HID descriptor length (method 1) %" PRI_NUT_USB_CTRL_CHARBUFSIZE, - rdlen1); - - /* SECOND METHOD: find HID descriptor among "extra" bytes of - interface descriptor, i.e., bytes tucked onto the end of - descriptor 2. */ - - /* Note: on some broken UPS's (e.g. Tripp Lite Smart1000LCD), - only this second method gives the correct result */ - - /* for now, we always assume configuration 0, interface 0, - altsetting 0, as above. */ - iface = &dev->config[0].interface[usb_subdriver.hid_rep_index].altsetting[0]; - for (i=0; iextralen; i+=iface->extra[i]) { - upsdebugx(4, "i=%d, extra[i]=%02x, extra[i+1]=%02x", i, - iface->extra[i], iface->extra[i+1]); - - if (i+9 <= iface->extralen - && iface->extra[i] >= 9 - && iface->extra[i+1] == 0x21 - ) { - p = (usb_ctrl_char *)&iface->extra[i]; - upsdebug_hex(3, "HID descriptor, method 2", p, 9); - rdlen2 = ((uint8_t)p[7]) | (((uint8_t)p[8]) << 8); - break; - } - } - - if (rdlen2 < -1) { - upsdebugx(2, "Warning: HID descriptor, method 2 failed"); - } - upsdebugx(3, - "HID descriptor length (method 2) %" PRI_NUT_USB_CTRL_CHARBUFSIZE, - rdlen2); - - /* when available, always choose the second value, as it - seems to be more reliable (it is the one reported e.g. by - lsusb). Note: if the need arises, can change this to use - the maximum of the two values instead. */ - if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) { - upsdebugx(1, "Eaton device v2.02. Using full report descriptor"); - rdlen = rdlen1; - } - else { - rdlen = rdlen2 >= 0 ? rdlen2 : rdlen1; - } - - if (rdlen < 0) { - upsdebugx(2, "Unable to retrieve any HID descriptor"); - goto next_device; - } - if (rdlen1 >= 0 && rdlen2 >= 0 && rdlen1 != rdlen2) { - upsdebugx(2, "Warning: two different HID descriptors retrieved " - "(Reportlen = %" PRI_NUT_USB_CTRL_CHARBUFSIZE - " vs. %" PRI_NUT_USB_CTRL_CHARBUFSIZE ")", - rdlen1, rdlen2); - } - - upsdebugx(2, - "HID descriptor length %" PRI_NUT_USB_CTRL_CHARBUFSIZE, - rdlen); - - if ((uintmax_t)rdlen > sizeof(rdbuf)) { - upsdebugx(2, - "HID descriptor too long %" PRI_NUT_USB_CTRL_CHARBUFSIZE - " (max %zu)", - rdlen, sizeof(rdbuf)); - goto next_device; - } - - /* Note: rdlen is safe to cast to unsigned below, - * since the <0 case was ruled out above */ - /* res = usb_get_descriptor(udev, USB_DT_REPORT, hid_desc_index, bigbuf, rdlen); */ - res = usb_control_msg(udev, - USB_ENDPOINT_IN + 1, - USB_REQ_GET_DESCRIPTOR, - (USB_DT_REPORT << 8) + usb_subdriver.hid_desc_index, - usb_subdriver.hid_rep_index, - rdbuf, rdlen, USB_TIMEOUT); - - if (res < 0) - { - upsdebug_with_errno(2, "Unable to get Report descriptor"); - goto next_device; - } - - if (res < rdlen) - { - upsdebugx(2, "Warning: report descriptor too short " - "(expected %" PRI_NUT_USB_CTRL_CHARBUFSIZE - ", got %d)", rdlen, res); - rdlen = res; /* correct rdlen if necessary */ - } - - res = callback(udev, curDevice, rdbuf, rdlen); - if (res < 1) { - upsdebugx(2, "Caller doesn't like this device"); - goto next_device; - } - - upsdebugx(2, - "Report descriptor retrieved (Reportlen = %" - PRI_NUT_USB_CTRL_CHARBUFSIZE ")", rdlen); - upsdebugx(2, "Found HID device"); - fflush(stdout); - - return rdlen; - - next_device: - /* usb_release_interface() sometimes blocks - * and goes into uninterruptible sleep. - * So don't do it. */ - /* if (if_claimed) - usb_release_interface(udev, 0); */ - usb_close(udev); - } - } - - *udevp = NULL; - upsdebugx(2, "libusb0: No appropriate HID device found"); - fflush(stdout); - - if (count_open_attempts == 0) { - upslogx(LOG_WARNING, - "libusb0: Could not open any HID devices: " - "no USB buses found"); - } - else - if (count_open_errors > 0 - && count_open_errors == count_open_EACCESS - ) { - upslogx(LOG_WARNING, - "libusb0: Could not open any HID devices: " - "insufficient permissions on everything"); - } - - return -1; -} - -/* - * Error handler for usb_get/set_* functions. Return value > 0 success, - * 0 unknown or temporary failure (ignored), < 0 permanent failure (reconnect) - */ -static int libusb_strerror(const int ret, const char *desc) -{ - if (ret > 0) { - return ret; - } - - switch(ret) - { - case -EBUSY: /* Device or resource busy */ - case -EPERM: /* Operation not permitted */ - case -ENODEV: /* No such device */ - case -EACCES: /* Permission denied */ - case -EIO: /* I/O error */ - case -ENXIO: /* No such device or address */ - case -ENOENT: /* No such file or directory */ - case -EPIPE: /* Broken pipe */ - case -ENOSYS: /* Function not implemented */ - upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror()); - return ret; - - case -ETIMEDOUT: /* Connection timed out */ - upsdebugx(2, "%s: Connection timed out", desc); - return 0; - - case -EOVERFLOW: /* Value too large for defined data type */ -#ifdef EPROTO - case -EPROTO: /* Protocol error */ -#endif - upsdebugx(2, "%s: %s", desc, usb_strerror()); - return 0; - - default: /* Undetermined, log only */ - upslogx(LOG_DEBUG, "%s: %s", desc, usb_strerror()); - return 0; - } -} - -/* return the report of ID=type in report - * return -1 on failure, report length on success - */ - -/* Expected evaluated types for the API: - * static int libusb_get_report(usb_dev_handle *udev, - * int ReportId, unsigned char *raw_buf, int ReportSize) - */ -static int libusb_get_report( - usb_dev_handle *udev, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) -{ - int ret; - - upsdebugx(4, "Entering libusb_get_report"); - - if (!udev) { - return 0; - } - - ret = usb_control_msg(udev, - USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x01, /* HID_REPORT_GET */ - ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */ - usb_subdriver.hid_rep_index, - raw_buf, ReportSize, USB_TIMEOUT); - - /* Ignore "protocol stall" (for unsupported request) on control endpoint */ - if (ret == -EPIPE) { - return 0; - } - - return libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int libusb_set_report(usb_dev_handle *udev, - * int ReportId, unsigned char *raw_buf, int ReportSize) - */ -static int libusb_set_report( - usb_dev_handle *udev, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) -{ - int ret; - - if (!udev) { - return 0; - } - - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, /* HID_REPORT_SET = 0x09*/ - ReportId+(0x03<<8), /* HID_REPORT_TYPE_FEATURE */ - usb_subdriver.hid_rep_index, - raw_buf, ReportSize, USB_TIMEOUT); - - /* Ignore "protocol stall" (for unsupported request) on control endpoint */ - if (ret == -EPIPE) { - return 0; - } - - return libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int libusb_get_string(usb_dev_handle *udev, - * int StringIdx, char *buf, size_t buflen) - */ -static int libusb_get_string( - usb_dev_handle *udev, - usb_ctrl_strindex StringIdx, - char *buf, - usb_ctrl_charbufsize buflen) -{ - int ret; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - /* - * usb.h:int usb_get_string_simple(usb_dev_handle *dev, int index, - * usb.h- char *buf, size_t buflen); - */ - if (!udev - || StringIdx < 0 || (uintmax_t)StringIdx > INT_MAX - || buflen < 0 || (uintmax_t)buflen > (uintmax_t)SIZE_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - return -1; - } - - ret = usb_get_string_simple(udev, StringIdx, buf, (size_t)buflen); - - return libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int libusb_get_interrupt(usb_dev_handle *udev, - * unsigned char *buf, int bufsize, int timeout) - */ -static int libusb_get_interrupt( - usb_dev_handle *udev, - usb_ctrl_charbuf buf, - usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout) -{ - int ret; - - if (!udev) { - return -1; - } - - /* Interrupt EP is USB_ENDPOINT_IN with offset defined in hid_ep_in, which is 0 by default, unless overridden in subdriver. */ - ret = usb_interrupt_read(udev, USB_ENDPOINT_IN + usb_subdriver.hid_ep_in, (char *)buf, bufsize, timeout); - - /* Clear stall condition */ - if (ret == -EPIPE) { - ret = usb_clear_halt(udev, 0x81); - } - - return libusb_strerror(ret, __func__); -} - -static void libusb_close(usb_dev_handle *udev) -{ - if (!udev) { - return; - } - - /* usb_release_interface() sometimes blocks and goes - * into uninterruptible sleep. So don't do it. - */ - /* usb_release_interface(udev, 0); */ - usb_close(udev); -} - -usb_communication_subdriver_t usb_subdriver = { - USB_DRIVER_NAME, - USB_DRIVER_VERSION, - libusb_open, - libusb_close, - libusb_get_report, - libusb_set_report, - libusb_get_string, - libusb_get_interrupt, - LIBUSB_DEFAULT_INTERFACE, - LIBUSB_DEFAULT_DESC_INDEX, - LIBUSB_DEFAULT_HID_EP_IN, - LIBUSB_DEFAULT_HID_EP_OUT -}; diff --git a/drivers/libusb1.c b/drivers/libusb1.c deleted file mode 100644 index 55c0b03..0000000 --- a/drivers/libusb1.c +++ /dev/null @@ -1,907 +0,0 @@ -/*! - * @file libusb1.c - * @brief Generic USB communication backend (using libusb 1.0) - * - * @author Copyright (C) 2016 Eaton - * Copyright (C) 2016 Arnaud Quette - * Copyright (C) 2021 Jim Klimov - * - * The logic of this file is ripped from mge-shut driver (also from - * Arnaud Quette), which is a "HID over serial link" UPS driver for - * Network UPS Tools - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * -------------------------------------------------------------------------- */ - -#include "config.h" /* for HAVE_LIBUSB_DETACH_KERNEL_DRIVER flag */ -#include "common.h" /* for xmalloc, upsdebugx prototypes */ -#include "usb-common.h" -#include "nut_libusb.h" -#include "nut_stdint.h" - -#define USB_DRIVER_NAME "USB communication driver (libusb 1.0)" -#define USB_DRIVER_VERSION "0.43" - -/* driver description structure */ -upsdrv_info_t comm_upsdrv_info = { - USB_DRIVER_NAME, - USB_DRIVER_VERSION, - NULL, - 0, - { NULL } -}; - -#define MAX_REPORT_SIZE 0x1800 -#define MAX_RETRY 3 - -static void nut_libusb_close(libusb_device_handle *udev); - -/*! Add USB-related driver variables with addvar() and dstate_setinfo(). - * This removes some code duplication across the USB drivers. - */ -void nut_usb_addvars(void) -{ - const struct libusb_version *v = libusb_get_version(); - - /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ - addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); - addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); - addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); - - addvar(VAR_VALUE, "vendorid", "Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal)"); - addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); - - addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); - addvar(VAR_VALUE, "device", "Regular expression to match USB device name"); - addvar(VAR_VALUE, "usb_set_altinterface", "Force redundant call to usb_set_altinterface() (value=bAlternateSetting; default=0)"); - -#ifdef LIBUSB_API_VERSION - dstate_setinfo("driver.version.usb", "libusb-%u.%u.%u (API: 0x%x)", v->major, v->minor, v->micro, LIBUSB_API_VERSION); -#else /* no LIBUSB_API_VERSION */ - dstate_setinfo("driver.version.usb", "libusb-%u.%u.%u", v->major, v->minor, v->micro); -#endif /* LIBUSB_API_VERSION */ -} - -/* invoke matcher against device */ -static inline int matches(USBDeviceMatcher_t *matcher, USBDevice_t *device) { - if (!matcher) { - return 1; - } - return matcher->match_function(device, matcher->privdata); -} - -/*! If needed, set the USB alternate interface. - * - * In NUT 2.7.2 and earlier, the following call was made unconditionally: - * usb_set_altinterface(udev, 0); - * - * Although harmless on Linux and *BSD, this extra call prevents old Tripp Lite - * devices from working on Mac OS X (presumably the OS is already setting - * altinterface to 0). - */ -static int nut_usb_set_altinterface(libusb_device_handle *udev) -{ - int altinterface = 0, ret = 0; - char *alt_string, *endp = NULL; - - if(testvar("usb_set_altinterface")) { - alt_string = getval("usb_set_altinterface"); - if(alt_string) { - altinterface = (int)strtol(alt_string, &endp, 10); - if(endp && !(endp[0] == 0)) { - upslogx(LOG_WARNING, "%s: '%s' is not a valid number", __func__, alt_string); - } - if(altinterface < 0 || altinterface > 255) { - upslogx(LOG_WARNING, "%s: setting bAlternateInterface to %d will probably not work", __func__, altinterface); - } - } - /* set default interface */ - upsdebugx(2, "%s: calling libusb_set_interface_alt_setting(udev, %d, %d)", - __func__, usb_subdriver.hid_rep_index, altinterface); - ret = libusb_set_interface_alt_setting(udev, usb_subdriver.hid_rep_index, altinterface); - if(ret != 0) { - upslogx(LOG_WARNING, "%s: libusb_set_interface_alt_setting(udev, %d, %d) returned %d (%s)", - __func__, usb_subdriver.hid_rep_index, altinterface, ret, libusb_strerror((enum libusb_error)ret) ); - } - upslogx(LOG_NOTICE, "%s: libusb_set_interface_alt_setting() should not be necessary - " - "please email the nut-upsdev list with information about your UPS.", __func__); - } else { - upsdebugx(3, "%s: skipped libusb_set_interface_alt_setting(udev, %d, 0)", - __func__, usb_subdriver.hid_rep_index); - } - return ret; -} - -/* On success, fill in the curDevice structure and return the report - * descriptor length. On failure, return -1. - * Note: When callback is not NULL, the report descriptor will be - * passed to this function together with the udev and USBDevice_t - * information. This callback should return a value > 0 if the device - * is accepted, or < 1 if not. If it isn't accepted, the next device - * (if any) will be tried, until there are no more devices left. - */ -static int nut_libusb_open(libusb_device_handle **udevp, - USBDevice_t *curDevice, USBDeviceMatcher_t *matcher, - int (*callback)(libusb_device_handle *udev, - USBDevice_t *hd, usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen) - ) -{ - int retries; - /* libusb-1.0 usb_ctrl_charbufsize is uint16_t and we - * want the rdlen vars signed - so taking a wider type */ - int32_t rdlen1, rdlen2; /* report descriptor length, method 1+2 */ - USBDeviceMatcher_t *m; - libusb_device **devlist; - ssize_t devcount = 0; - size_t devnum; - struct libusb_device_descriptor dev_desc; - struct libusb_config_descriptor *conf_desc = NULL; - const struct libusb_interface_descriptor *if_desc; - libusb_device_handle *udev; - uint8_t bus; - int ret, res; - unsigned char buf[20]; - const unsigned char *p; - char string[256]; - int i; - int count_open_EACCESS = 0; - int count_open_errors = 0; - - /* report descriptor */ - unsigned char rdbuf[MAX_REPORT_SIZE]; - int32_t rdlen; - - /* libusb base init */ - if (libusb_init(NULL) < 0) { - libusb_exit(NULL); - fatal_with_errno(EXIT_FAILURE, "Failed to init libusb 1.0"); - } - -#ifndef __linux__ /* SUN_LIBUSB (confirmed to work on Solaris and FreeBSD) */ - /* Causes a double free corruption in linux if device is detached! */ - /* nut_libusb_close(*udevp); */ - if (*udevp) - libusb_close(*udevp); -#endif - - devcount = libusb_get_device_list(NULL, &devlist); - - /* devcount may be < 0, loop will get skipped; - * its SSIZE_MAX < SIZE_MAX for devnum */ - for (devnum = 0; (ssize_t)devnum < devcount; devnum++) { - /* int if_claimed = 0; */ - libusb_device *device = devlist[devnum]; - - libusb_get_device_descriptor(device, &dev_desc); - upsdebugx(2, "Checking device %zu of %zu (%04X/%04X)", - devnum + 1, devcount, - dev_desc.idVendor, dev_desc.idProduct); - - /* supported vendors are now checked by the supplied matcher */ - - /* open the device */ - ret = libusb_open(device, udevp); - if (ret != 0) { - upsdebugx(1, "Failed to open device (%04X/%04X), skipping: %s", - dev_desc.idVendor, - dev_desc.idProduct, - libusb_strerror((enum libusb_error)ret)); - count_open_errors++; - if (ret == LIBUSB_ERROR_ACCESS) { - count_open_EACCESS++; - } - continue; - } - udev = *udevp; - - /* collect the identifying information of this - device. Note that this is safe, because - there's no need to claim an interface for - this (and therefore we do not yet need to - detach any kernel drivers). */ - - free(curDevice->Vendor); - free(curDevice->Product); - free(curDevice->Serial); - free(curDevice->Bus); - free(curDevice->Device); - memset(curDevice, '\0', sizeof(*curDevice)); - - bus = libusb_get_bus_number(device); - curDevice->Bus = (char *)malloc(4); - if (curDevice->Bus == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - sprintf(curDevice->Bus, "%03d", bus); - curDevice->VendorID = dev_desc.idVendor; - curDevice->ProductID = dev_desc.idProduct; - curDevice->bcdDevice = dev_desc.bcdDevice; - - if (dev_desc.iManufacturer) { - retries = MAX_RETRY; - while (retries > 0) { - ret = libusb_get_string_descriptor_ascii(udev, dev_desc.iManufacturer, - (unsigned char*)string, sizeof(string)); - if (ret > 0) { - curDevice->Vendor = strdup(string); - if (curDevice->Vendor == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - break; - } - retries--; - upsdebugx(1, "%s get iManufacturer failed, retrying...", __func__); - } - } - - if (dev_desc.iProduct) { - retries = MAX_RETRY; - while (retries > 0) { - ret = libusb_get_string_descriptor_ascii(udev, dev_desc.iProduct, - (unsigned char*)string, sizeof(string)); - if (ret > 0) { - curDevice->Product = strdup(string); - if (curDevice->Product == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - break; - } - retries--; - upsdebugx(1, "%s get iProduct failed, retrying...", __func__); - } - } - - if (dev_desc.iSerialNumber) { - retries = MAX_RETRY; - while (retries > 0) { - ret = libusb_get_string_descriptor_ascii(udev, dev_desc.iSerialNumber, - (unsigned char*)string, sizeof(string)); - if (ret > 0) { - curDevice->Serial = strdup(string); - if (curDevice->Serial == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - break; - } - retries--; - upsdebugx(1, "%s get iSerialNumber failed, retrying...", __func__); - } - } - - upsdebugx(2, "- VendorID: %04x", curDevice->VendorID); - upsdebugx(2, "- ProductID: %04x", curDevice->ProductID); - upsdebugx(2, "- Manufacturer: %s", curDevice->Vendor ? curDevice->Vendor : "unknown"); - upsdebugx(2, "- Product: %s", curDevice->Product ? curDevice->Product : "unknown"); - upsdebugx(2, "- Serial Number: %s", curDevice->Serial ? curDevice->Serial : "unknown"); - upsdebugx(2, "- Bus: %s", curDevice->Bus ? curDevice->Bus : "unknown"); - upsdebugx(2, "- Device: %s", curDevice->Device ? curDevice->Device : "unknown"); - upsdebugx(2, "- Device release number: %04x", curDevice->bcdDevice); - - /* FIXME: extend to Eaton OEMs (HP, IBM, ...) */ - if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) { - usb_subdriver.hid_desc_index = 1; - } - - upsdebugx(2, "Trying to match device"); - for (m = matcher; m; m=m->next) { - ret = matches(m, curDevice); - if (ret==0) { - upsdebugx(2, "Device does not match - skipping"); - goto next_device; - } else if (ret==-1) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "matcher"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif - goto next_device; -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif - } else if (ret==-2) { - upsdebugx(2, "matcher: unspecified error"); - goto next_device; - } - } - upsdebugx(2, "Device matches"); - - - upsdebugx(2, "Reading first configuration descriptor"); - ret = libusb_get_config_descriptor(device, - (uint8_t)usb_subdriver.hid_rep_index, - &conf_desc); - /*ret = libusb_get_active_config_descriptor(device, &conf_desc);*/ - if (ret < 0) - upsdebugx(2, "result: %i (%s)", - ret, libusb_strerror((enum libusb_error)ret)); - - /* Now we have matched the device we wanted. Claim it. */ - -#if defined(HAVE_LIBUSB_KERNEL_DRIVER_ACTIVE) && defined(HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER) - /* Due to the way FreeBSD implements libusb_set_auto_detach_kernel_driver(), - * check to see if the kernel driver is active before setting - * the auto-detach flag. Otherwise, libusb_claim_interface() - * with the auto-detach flag only works if the driver is - * running as root. - * - * Is the kernel driver active? Consider the unimplemented - * return code to be equivalent to inactive here. - */ - if((ret = libusb_kernel_driver_active(udev, usb_subdriver.hid_rep_index)) == 1) { - upsdebugx(3, "libusb_kernel_driver_active() returned 1 (driver active)"); - /* Try the auto-detach kernel driver method. - * This function is not available on FreeBSD 10.1-10.3 */ - if ((ret = libusb_set_auto_detach_kernel_driver (udev, 1)) != LIBUSB_SUCCESS) { - upsdebugx(1, "failed to set kernel driver auto-detach " - "driver flag for USB device: %s", - libusb_strerror((enum libusb_error)ret)); - } else { - upsdebugx(2, "successfully set kernel driver auto-detach flag"); - } - } else { - upsdebugx(3, "libusb_kernel_driver_active() returned %d", ret); - } -#endif - -#if (defined HAVE_LIBUSB_DETACH_KERNEL_DRIVER) || (defined HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP) - /* Then, try the explicit detach method. - * This function is available on FreeBSD 10.1-10.3 */ - retries = MAX_RETRY; - while ((ret = libusb_claim_interface(udev, usb_subdriver.hid_rep_index)) != LIBUSB_SUCCESS) { - upsdebugx(2, "failed to claim USB device: %s", - libusb_strerror((enum libusb_error)ret)); - -# ifdef HAVE_LIBUSB_DETACH_KERNEL_DRIVER - if ((ret = libusb_detach_kernel_driver(udev, usb_subdriver.hid_rep_index)) != LIBUSB_SUCCESS) { -# else /* if defined HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP) */ - if ((ret = libusb_detach_kernel_driver_np(udev, usb_subdriver.hid_rep_index)) != LIBUSB_SUCCESS) { -# endif - if (ret == LIBUSB_ERROR_NOT_FOUND) - upsdebugx(2, "Kernel driver already detached"); - else - upsdebugx(1, "failed to detach kernel driver from USB device: %s", - libusb_strerror((enum libusb_error)ret)); - } else { - upsdebugx(2, "detached kernel driver from USB device..."); - } - - if (retries-- > 0) { - continue; - } - - libusb_free_config_descriptor(conf_desc); - libusb_free_device_list(devlist, 1); - fatalx(EXIT_FAILURE, - "Can't claim USB device [%04x:%04x]@%d/%d: %s", - curDevice->VendorID, curDevice->ProductID, - usb_subdriver.hid_rep_index, - usb_subdriver.hid_desc_index, - libusb_strerror((enum libusb_error)ret)); - } -#else - if ((ret = libusb_claim_interface(udev, usb_subdriver.hid_rep_index)) != LIBUSB_SUCCESS ) { - libusb_free_config_descriptor(conf_desc); - libusb_free_device_list(devlist, 1); - fatalx(EXIT_FAILURE, - "Can't claim USB device [%04x:%04x]@%d/%d: %s", - curDevice->VendorID, curDevice->ProductID, - usb_subdriver.hid_rep_index, - usb_subdriver.hid_desc_index, - libusb_strerror((enum libusb_error)ret)); - } -#endif - /* if_claimed = 1; */ - upsdebugx(2, "Claimed interface %d successfully", - usb_subdriver.hid_rep_index); - - nut_usb_set_altinterface(udev); - - if (!callback) { - libusb_free_config_descriptor(conf_desc); - libusb_free_device_list(devlist, 1); - return 1; - } - - if (!conf_desc) { /* ?? this should never happen */ - upsdebugx(2, " Couldn't retrieve descriptors"); - goto next_device; - } - - rdlen1 = -1; - rdlen2 = -1; - - /* Get HID descriptor */ - - /* FIRST METHOD: ask for HID descriptor directly. */ - /* libusb0: USB_ENDPOINT_IN + 1 */ - res = libusb_control_transfer(udev, - LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_STANDARD|LIBUSB_RECIPIENT_INTERFACE, - LIBUSB_REQUEST_GET_DESCRIPTOR, - (LIBUSB_DT_HID << 8) + usb_subdriver.hid_desc_index, - usb_subdriver.hid_rep_index, - buf, 0x9, USB_TIMEOUT); - - if (res < 0) { - upsdebugx(2, "Unable to get HID descriptor (%s)", - libusb_strerror((enum libusb_error)res)); - } else if (res < 9) { - upsdebugx(2, "HID descriptor too short (expected %d, got %d)", 8, res); - } else { - - upsdebug_hex(3, "HID descriptor, method 1", buf, 9); - - rdlen1 = ((uint8_t)buf[7]) | (((uint8_t)buf[8]) << 8); - } - - if (rdlen1 < -1) { - upsdebugx(2, "Warning: HID descriptor, method 1 failed"); - } - upsdebugx(3, "HID descriptor length (method 1) %d", rdlen1); - - /* SECOND METHOD: find HID descriptor among "extra" bytes of - interface descriptor, i.e., bytes tucked onto the end of - descriptor 2. */ - - /* Note: on some broken UPS's (e.g. Tripp Lite Smart1000LCD), - only this second method gives the correct result */ - - /* for now, we always assume configuration 0, interface 0, - altsetting 0, as above. */ - - if_desc = &(conf_desc->interface[usb_subdriver.hid_rep_index].altsetting[0]); - for (i = 0; i < if_desc->extra_length; i += if_desc->extra[i]) { - upsdebugx(4, "i=%d, extra[i]=%02x, extra[i+1]=%02x", i, - if_desc->extra[i], if_desc->extra[i+1]); - if (i+9 <= if_desc->extra_length && if_desc->extra[i] >= 9 && if_desc->extra[i+1] == 0x21) { - p = &if_desc->extra[i]; - upsdebug_hex(3, "HID descriptor, method 2", p, 9); - rdlen2 = ((uint8_t)p[7]) | (((uint8_t)p[8]) << 8); - break; - } - } - - /* we can now free the config descriptor */ - libusb_free_config_descriptor(conf_desc); - - if (rdlen2 < -1) { - upsdebugx(2, "Warning: HID descriptor, method 2 failed"); - } - upsdebugx(3, "HID descriptor length (method 2) %d", rdlen2); - - /* when available, always choose the second value, as it - seems to be more reliable (it is the one reported e.g. by - lsusb). Note: if the need arises, can change this to use - the maximum of the two values instead. */ - if ((curDevice->VendorID == 0x463) && (curDevice->bcdDevice == 0x0202)) { - upsdebugx(1, "Eaton device v2.02. Using full report descriptor"); - rdlen = rdlen1; - } - else { - rdlen = rdlen2 >= 0 ? rdlen2 : rdlen1; - } - - if (rdlen < 0) { - upsdebugx(2, "Unable to retrieve any HID descriptor"); - goto next_device; - } - if (rdlen1 >= 0 && rdlen2 >= 0 && rdlen1 != rdlen2) { - upsdebugx(2, "Warning: two different HID descriptors retrieved " - "(Reportlen = %d vs. %d)", rdlen1, rdlen2); - } - - upsdebugx(2, "HID descriptor length %d", rdlen); - - if (rdlen > (int)sizeof(rdbuf)) { - upsdebugx(2, "HID descriptor too long %d (max %d)", - rdlen, (int)sizeof(rdbuf)); - goto next_device; - } - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if ((uintmax_t)rdlen > UINT16_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(2, "HID descriptor too long %d (max %u)", - rdlen, UINT16_MAX); - goto next_device; - } - - /* libusb0: USB_ENDPOINT_IN + 1 */ - res = libusb_control_transfer(udev, - LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_STANDARD|LIBUSB_RECIPIENT_INTERFACE, - LIBUSB_REQUEST_GET_DESCRIPTOR, - (LIBUSB_DT_REPORT << 8) + usb_subdriver.hid_desc_index, - usb_subdriver.hid_rep_index, - rdbuf, (uint16_t)rdlen, USB_TIMEOUT); - - if (res < 0) - { - upsdebug_with_errno(2, "Unable to get Report descriptor"); - goto next_device; - } - - if (res < rdlen) - { - upsdebugx(2, "Warning: report descriptor too short " - "(expected %d, got %d)", rdlen, res); - rdlen = res; /* correct rdlen if necessary */ - } - - if (rdlen < USB_CTRL_CHARBUFSIZE_MIN - || (uintmax_t)rdlen > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX - ) { - upsdebugx(2, - "Report descriptor length is out of range on this device: " - "should be %ji < %d < %ju", - (intmax_t)USB_CTRL_CHARBUFSIZE_MIN, rdlen, - (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX); - goto next_device; - } - - res = callback(udev, curDevice, rdbuf, (usb_ctrl_charbufsize)rdlen); - if (res < 1) { - upsdebugx(2, "Caller doesn't like this device"); - goto next_device; - } - - upsdebugx(2, "Report descriptor retrieved (Reportlen = %d)", rdlen); - upsdebugx(2, "Found HID device"); - fflush(stdout); - libusb_free_device_list(devlist, 1); - - return rdlen; - - next_device: - /* usb_release_interface() sometimes blocks and goes - into uninterruptible sleep. So don't do it. */ - /* if (if_claimed) - libusb_release_interface(udev, usb_subdriver.hid_rep_index); */ - libusb_close(udev); - } - - *udevp = NULL; - libusb_free_device_list(devlist, 1); - upsdebugx(2, "libusb1: No appropriate HID device found"); - fflush(stdout); - - if (devcount < 1) { - upslogx(LOG_WARNING, - "libusb1: Could not open any HID devices: " - "no USB buses found"); - } - else - if (count_open_errors > 0 - || count_open_errors == count_open_EACCESS - ) { - upslogx(LOG_WARNING, - "libusb1: Could not open any HID devices: " - "insufficient permissions on everything"); - } - - return -1; -} - -/* - * Error handler for usb_get/set_* functions. Return value > 0 success, - * 0 unknown or temporary failure (ignored), < 0 permanent failure (reconnect) - */ -static int nut_libusb_strerror(const int ret, const char *desc) -{ - if (ret > 0) { - return ret; - } - - switch(ret) - { -#if 0 - /* FIXME: not sure how to map these ones! */ - case LIBUSB_ERROR_INVALID_PARAM: /** Invalid parameter */ - /** System call interrupted (perhaps due to signal) */ - case LIBUSB_ERROR_INTERRUPTED: - /** Insufficient memory */ - case LIBUSB_ERROR_NO_MEM: -#endif - - case LIBUSB_ERROR_BUSY: /** Resource busy */ - case LIBUSB_ERROR_NO_DEVICE: /** No such device (it may have been disconnected) */ - case LIBUSB_ERROR_ACCESS: /** Access denied (insufficient permissions) */ - case LIBUSB_ERROR_IO: /** Input/output error */ - case LIBUSB_ERROR_NOT_FOUND: /** Entity not found */ - case LIBUSB_ERROR_PIPE: /** Pipe error */ - /** Operation not supported or unimplemented on this platform */ - case LIBUSB_ERROR_NOT_SUPPORTED: - upslogx(LOG_DEBUG, "%s: %s", desc, libusb_strerror((enum libusb_error)ret)); - return ret; - - case LIBUSB_ERROR_TIMEOUT: /** Operation timed out */ - upsdebugx(2, "%s: Connection timed out", desc); - return 0; - - case LIBUSB_ERROR_OVERFLOW: /** Overflow */ -#ifdef EPROTO -/* FIXME: not sure how to map this one! */ - case -EPROTO: /* Protocol error */ -#endif - upsdebugx(2, "%s: %s", desc, libusb_strerror((enum libusb_error)ret)); - return 0; - - case LIBUSB_ERROR_OTHER: /** Other error */ - default: /** Undetermined, log only */ - upslogx(LOG_DEBUG, "%s: %s", desc, libusb_strerror((enum libusb_error)ret)); - return 0; - } -} - -/* return the report of ID=type in report - * return -1 on failure, report length on success - */ - -/* Expected evaluated types for the API: - * static int nut_libusb_get_report(libusb_device_handle *udev, - * int ReportId, unsigned char *raw_buf, int ReportSize) - */ -static int nut_libusb_get_report( - libusb_device_handle *udev, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) -{ - int ret; - - upsdebugx(4, "Entering libusb_get_report"); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if (!udev - || ReportId < 0 || (uintmax_t)ReportId > UINT16_MAX - || ReportSize < 0 || (uintmax_t)ReportSize > UINT16_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - return 0; - } - - /* libusb0: USB_ENDPOINT_IN + USB_TYPE_CLASS + USB_RECIP_INTERFACE */ - ret = libusb_control_transfer(udev, - LIBUSB_ENDPOINT_IN|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE, - 0x01, /* HID_REPORT_GET */ - (uint16_t)ReportId + (0x03<<8), /* HID_REPORT_TYPE_FEATURE */ - usb_subdriver.hid_rep_index, - raw_buf, (uint16_t)ReportSize, USB_TIMEOUT); - - /* Ignore "protocol stall" (for unsupported request) on control endpoint */ - if (ret == LIBUSB_ERROR_PIPE) { - return 0; - } - - return nut_libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int nut_libusb_set_report(libusb_device_handle *udev, - * int ReportId, unsigned char *raw_buf, int ReportSize) - */ -static int nut_libusb_set_report( - libusb_device_handle *udev, - usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, - usb_ctrl_charbufsize ReportSize) -{ - int ret; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if (!udev - || ReportId < 0 || (uintmax_t)ReportId > UINT16_MAX - || ReportSize < 0 || (uintmax_t)ReportSize > UINT16_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - return 0; - } - - /* libusb0: USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE */ - ret = libusb_control_transfer(udev, - LIBUSB_ENDPOINT_OUT|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE, - 0x09, /* HID_REPORT_SET = 0x09*/ - (uint16_t)ReportId + (0x03<<8), /* HID_REPORT_TYPE_FEATURE */ - usb_subdriver.hid_rep_index, - raw_buf, (uint16_t)ReportSize, USB_TIMEOUT); - - /* Ignore "protocol stall" (for unsupported request) on control endpoint */ - if (ret == LIBUSB_ERROR_PIPE) { - return 0; - } - - return nut_libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int nut_libusb_get_string(libusb_device_handle *udev, - * int StringIdx, char *buf, int buflen) - */ -static int nut_libusb_get_string( - libusb_device_handle *udev, - usb_ctrl_strindex StringIdx, - char *buf, - usb_ctrl_charbufsize buflen) -{ - int ret; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if (!udev - || StringIdx < 0 || (uintmax_t)StringIdx > UINT8_MAX - || buflen < 0 || (uintmax_t)buflen > (uintmax_t)INT_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - return -1; - } - - ret = libusb_get_string_descriptor_ascii(udev, (uint8_t)StringIdx, - (unsigned char*)buf, (int)buflen); - - return nut_libusb_strerror(ret, __func__); -} - -/* Expected evaluated types for the API: - * static int nut_libusb_get_interrupt(libusb_device_handle *udev, - * unsigned char *buf, int bufsize, int timeout) - */ -static int nut_libusb_get_interrupt( - libusb_device_handle *udev, - usb_ctrl_charbuf buf, - usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout) -{ - int ret, tmpbufsize; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if (!udev - || bufsize < 0 || (uintmax_t)bufsize > (uintmax_t)INT_MAX - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - return -1; - } - - /* NOTE: With all the fuss about word sized arguments, - * the libusb_interrupt_transfer() lengths are about ints: - * int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, - * unsigned char endpoint, unsigned char *data, int length, - * int *actual_length, unsigned int timeout); - */ - tmpbufsize = (int)bufsize; - - /* FIXME: hardcoded interrupt EP => need to get EP descr for IF descr */ - /* ret = libusb_interrupt_transfer(udev, 0x81, buf, bufsize, &bufsize, timeout); */ - /* libusb0: ret = usb_interrupt_read(udev, USB_ENDPOINT_IN + usb_subdriver.hid_ep_in, (char *)buf, bufsize, timeout); */ - /* Interrupt EP is LIBUSB_ENDPOINT_IN with offset defined in hid_ep_in, which is 0 by default, unless overridden in subdriver. */ - ret = libusb_interrupt_transfer(udev, - LIBUSB_ENDPOINT_IN + usb_subdriver.hid_ep_in, - (unsigned char *)buf, tmpbufsize, &tmpbufsize, timeout); - - /* Clear stall condition */ - if (ret == LIBUSB_ERROR_PIPE) { - ret = libusb_clear_halt(udev, 0x81); - } - - /* In case of success, return the operation size, as done with libusb 0.1 */ - if (ret == LIBUSB_SUCCESS) { - if (tmpbufsize < 0 - || (uintmax_t)tmpbufsize > (uintmax_t)USB_CTRL_CHARBUFSIZE_MAX - ) { - return -1; - } - ret = (usb_ctrl_charbufsize)bufsize; - } - - return nut_libusb_strerror(ret, __func__); -} - -static void nut_libusb_close(libusb_device_handle *udev) -{ - if (!udev) { - return; - } - - /* usb_release_interface() sometimes blocks and goes - * into uninterruptible sleep. So don't do it. - */ - /* libusb_release_interface(udev, usb_subdriver.hid_rep_index); */ - libusb_close(udev); - libusb_exit(NULL); -} - -usb_communication_subdriver_t usb_subdriver = { - USB_DRIVER_NAME, - USB_DRIVER_VERSION, - nut_libusb_open, - nut_libusb_close, - nut_libusb_get_report, - nut_libusb_set_report, - nut_libusb_get_string, - nut_libusb_get_interrupt, - LIBUSB_DEFAULT_INTERFACE, - LIBUSB_DEFAULT_DESC_INDEX, - LIBUSB_DEFAULT_HID_EP_IN, - LIBUSB_DEFAULT_HID_EP_OUT -}; diff --git a/drivers/liebert-esp2.c b/drivers/liebert-esp2.c index f8e8e85..fca7c5e 100644 --- a/drivers/liebert-esp2.c +++ b/drivers/liebert-esp2.c @@ -2,7 +2,6 @@ * * Copyright (C) * 2009 Richard Gregory - * 2017 Nash Kaminski * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,53 +27,53 @@ #define IsBitSet(val, bit) ((val) & (1 << (bit))) #define DRIVER_NAME "Liebert ESP-II serial UPS driver" -#define DRIVER_VERSION "0.05" +#define DRIVER_VERSION "0.03" #define UPS_SHUTDOWN_DELAY 12 /* it means UPS will be shutdown 120 sec */ #define SHUTDOWN_CMD_LEN 8 /* values for sending to UPS */ enum mult_enum { - M_10, - M_0_1, - M_VOLTAGE_I, - M_VOLTAGE_O, - M_VOLTAGE_B, - M_CURRENT_I, - M_CURRENT_O, - M_CURRENT_B, - M_LOAD_VA, - M_LOAD_WATT, - M_FREQUENCY, - M_VOLT_DC, - M_TEMPERATURE, - M_CURRENT_DC , - M_BAT_RUNTIME, - M_NOMPOWER, - M_POWER, - M_REALPOWER, - M_LOADPERC + M_10, + M_0_1, + M_VOLTAGE_I, + M_VOLTAGE_O, + M_VOLTAGE_B, + M_CURRENT_I, + M_CURRENT_O, + M_CURRENT_B, + M_LOAD_VA, + M_LOAD_WATT, + M_FREQUENCY, + M_VOLT_DC, + M_TEMPERATURE, + M_CURRENT_DC , + M_BAT_RUNTIME, + M_NOMPOWER, + M_POWER, + M_REALPOWER, + M_LOADPERC }; static float multi[19]={ - 10.0, - 0.1, - 0.1, /* volt */ - 0.1, - 0.1, - 0.1, /* curr */ - 0.1, - 0.1, - 100.0, /* va */ - 100.0, /* W */ - 0.01, /* FREQ */ - 0.1, /* V DC*/ - 0.1, /* TEMP*/ - 0.01, /* CUR DC*/ - 60.0, /* BAT RUNTIME*/ - 100.0, /* NOMPOWER*/ - 100.0, /* POWER*/ - 100.0, /* REAL POWER*/ - 1.0 /* LOADPERC*/ + 10.0, + 0.1, + 0.1, /* volt */ + 0.1, + 0.1, + 0.1, /* curr */ + 0.1, + 0.1, + 100.0, /* va */ + 100.0, /* W */ + 0.01, /* FREQ */ + 0.1, /* V DC*/ + 0.1, /* TEMP*/ + 0.01, /* CUR DC*/ + 60.0, /* BAT RUNTIME*/ + 100.0, /* NOMPOWER*/ + 100.0, /* POWER*/ + 100.0, /* REAL POWER*/ + 1.0 /* LOADPERC*/ }; static int instcmd(const char *cmdname, const char *extra); @@ -85,8 +84,7 @@ upsdrv_info_t upsdrv_info = { DRIVER_NAME, DRIVER_VERSION, "Richard Gregory \n" \ - "Robert Jobbagy ", + "Robert Jobbagy 1){ cmdin_p=vartab3i; } - else if(num_inphases==2){ - cmdin_p=vartab2i; - } else { cmdin_p=vartab1i; } - if (num_outphases==3){ + if (num_outphases>1){ cmdout_p=vartab3o; } - else if(num_outphases==2){ - cmdout_p=vartab2o; - } else { cmdout_p=vartab1o; } for (i = 0; cmdin_p[i].var; i++) { - int16_t intval; + int16_t val; ret = do_command(cmdin_p[i].cmd, reply, 6); if (ret < 8) { continue; } - intval = (unsigned char)reply[5]; - intval <<= 8; - intval += (unsigned char)reply[6]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - dstate_setinfo(cmdin_p[i].var, cmdin_p[i].fmt, multi[cmdin_p[i].multindex] * intval); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + val = (unsigned char)reply[5]; + val <<= 8; + val += (unsigned char)reply[6]; + dstate_setinfo(cmdin_p[i].var, cmdin_p[i].fmt, val * multi[cmdin_p[i].multindex]); } for (i = 0; cmdout_p[i].var; i++) { - int16_t intval; + int16_t val; ret = do_command(cmdout_p[i].cmd, reply, 6); if (ret < 8) { continue; } - intval = (unsigned char)reply[5]; - intval <<= 8; - intval += (unsigned char)reply[6]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - dstate_setinfo(cmdout_p[i].var, cmdout_p[i].fmt, multi[cmdout_p[i].multindex] * intval); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + val = (unsigned char)reply[5]; + val <<= 8; + val += (unsigned char)reply[6]; + dstate_setinfo(cmdout_p[i].var, cmdout_p[i].fmt, val * multi[cmdout_p[i].multindex]); } status_init(); @@ -553,12 +476,12 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { char reply[8]; - + if(!(do_command(cmd_setOutOffMode, reply, 8) != -1) && - (do_command(cmd_setOutOffDelay, reply, 8) != -1) && - (do_command(cmd_sysLoadKey, reply, 6) != -1) && - (do_command(cmd_shutdown, reply, 8) != -1)) - upslogx(LOG_ERR, "Failed to shutdown UPS"); + (do_command(cmd_setOutOffDelay, reply, 8) != -1) && + (do_command(cmd_sysLoadKey, reply, 6) != -1) && + (do_command(cmd_shutdown, reply, 8) != -1)) + upslogx(LOG_ERR, "Failed to shutdown UPS"); } static int instcmd(const char *cmdname, const char *extra) @@ -568,8 +491,8 @@ static int instcmd(const char *cmdname, const char *extra) ser_send_buf(upsfd, ...); return STAT_INSTCMD_HANDLED; } -*/ - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + */ + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -581,8 +504,8 @@ static int setvar(const char *varname, const char *val) ser_send_buf(upsfd, ...); return STAT_SET_HANDLED; } -*/ - upslogx(LOG_NOTICE, "setvar: unknown variable [%s] [%s]", varname, val); + */ + upslogx(LOG_NOTICE, "setvar: unknown variable [%s]", varname); return STAT_SET_UNKNOWN; } @@ -601,9 +524,6 @@ void upsdrv_initups(void) const char *val = getval("baudrate"); speed_t baudrate = B2400; - /* No-op, just made to quiesce the compiler warnings */ - NUT_UNUSED_FUNCTION_dummy_bitfields(); - if (val) { switch (atoi(val)) { diff --git a/drivers/liebert-hid.c b/drivers/liebert-hid.c index 23851d8..cff6f1d 100644 --- a/drivers/liebert-hid.c +++ b/drivers/liebert-hid.c @@ -4,7 +4,6 @@ * 2003 - 2008 Arnaud Quette * 2005 - 2006 Peter Selinger * 2007 Charles Lepple - * 2018 Markus "Links2004" * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,24 +26,19 @@ #include "liebert-hid.h" #include "usb-common.h" -#define LIEBERT_HID_VERSION "Phoenixtec/Liebert HID 0.41" +#define LIEBERT_HID_VERSION "Liebert HID 0.3" /* FIXME: experimental flag to be put in upsdrv_info */ /* Phoenixtec Power Co., Ltd */ #define LIEBERT_VENDORID 0x06da -/*! USB IDs device table. - * - * Note that this subdriver was named before the USB VendorID was determined to - * actually belong to Phoenixtec. The belkin-hid.c file covers the other - * Liebert units which share some of the same incorrect exponents as the - * Belkin HID firmware. */ +/* USB IDs device table */ static usb_device_id_t liebert_usb_device_table[] = { /* various models */ { USB_DEVICE(LIEBERT_VENDORID, 0xffff), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; /* --------------------------------------------------------------- */ @@ -79,28 +73,14 @@ static hid_info_t liebert_hid2nut[] = { { "unmapped.ups.powersummary.imanufacturer", 0, 0, "UPS.PowerSummary.iManufacturer", NULL, "%.0f", 0, NULL }, #endif - { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.2f", 0, NULL }, - { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.2f", HU_FLAG_STATIC, NULL }, + { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.0f", 0, NULL }, + { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", 0, NULL }, { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", 0, stringid_conversion }, { "ups.load", 0, 0, "UPS.PowerSummary.PercentLoad", NULL, "%.0f", 0, NULL }, - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL }, - { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.2f", 0, NULL }, - - { "output.transfer.high", 0, 0, "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, - { "output.transfer.low", 0, 0, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, - - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.[1].Voltage", NULL, "%.1f", 0, NULL }, - { "input.frequency", 0, 0, "UPS.PowerConverter.Input.[1].Frequency", NULL, "%.2f", 0, NULL }, - - { "input.transfer.low", 0, 0, "UPS.PowerConverter.Output.ffff0057", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "input.transfer.high", 0, 0, "UPS.PowerConverter.Output.ffff0058", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL}, - { "input.frequency.transfer.low", 0, 0, "UPS.PowerConverter.Output.ffff00f9", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "input.frequency.transfer.high", 0, 0, "UPS.PowerConverter.Output.ffff00f8", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL}, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, "%.0f", HU_FLAG_QUICK_POLL, online_info }, { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, "%.0f", HU_FLAG_QUICK_POLL, lowbatt_info }, { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, "%.0f", HU_FLAG_QUICK_POLL, charging_info }, @@ -157,5 +137,4 @@ subdriver_t liebert_subdriver = { liebert_format_model, liebert_format_mfr, liebert_format_serial, - fix_report_desc, }; diff --git a/drivers/liebert-hid.h b/drivers/liebert-hid.h index 8f84fc4..5adb5d2 100644 --- a/drivers/liebert-hid.h +++ b/drivers/liebert-hid.h @@ -2,7 +2,7 @@ * * Copyright (C) * 2003 - 2005 Arnaud Quette - * 2005 - 2006 Peter Selinger + * 2005 - 2006 Peter Selinger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/drivers/liebert.c b/drivers/liebert.c index 65bb539..b2faa29 100644 --- a/drivers/liebert.c +++ b/drivers/liebert.c @@ -21,13 +21,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" #include "main.h" #include "serial.h" -#include "attribute.h" #define DRIVER_NAME "Liebert MultiLink UPS driver" -#define DRIVER_VERSION "1.03" +#define DRIVER_VERSION "1.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -41,9 +39,6 @@ upsdrv_info_t upsdrv_info = { #define ML_ONBATTERY 0x55 -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* XXX: replace with a proper shutdown function (raise DTR) */ @@ -97,7 +92,7 @@ void upsdrv_updateinfo(void) if (c == ML_ONBATTERY) ob = 1; } - + if (ser_get_dcd(upsfd)) lb = 1; diff --git a/drivers/macosx-ups.c b/drivers/macosx-ups.c index 94b8b01..11ed475 100644 --- a/drivers/macosx-ups.c +++ b/drivers/macosx-ups.c @@ -1,6 +1,6 @@ /* Bridge driver to read Mac OS X UPS status (as displayed in Energy Saver control panel) * - * Copyright (C) 2011-2012, 2015 Charles Lepple + * Copyright (C) 2011-2012 Charles Lepple * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,9 +18,7 @@ * */ -#include "config.h" #include "main.h" -#include "attribute.h" #include @@ -29,7 +27,7 @@ #include "IOKit/ps/IOPSKeys.h" #define DRIVER_NAME "Mac OS X UPS meta-driver" -#define DRIVER_VERSION "1.3" +#define DRIVER_VERSION "1.0" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -44,63 +42,39 @@ upsdrv_info_t upsdrv_info = { #define CFRelease(ref) do { upsdebugx(3, "%s:%d: CFRelease(%p)", __FILE__, __LINE__, ref); CFRelease(ref); } while(0) #endif -static CFStringRef g_power_source_name = NULL; +static CFStringRef g_power_key = NULL; static double max_capacity_value = 100.0; /*! Copy the current power dictionary. * * Caller must release power dictionary when finished with it. */ -static CFDictionaryRef copy_power_dictionary(CFStringRef power_source_name) +static CFDictionaryRef copy_power_dictionary(CFTypeRef power_key) { - CFTypeRef power_sources_info, power_source; - CFArrayRef sources_list; - CFDictionaryRef this_power_dictionary, power_dictionary = NULL; - CFStringRef this_power_source_name; - CFIndex num_keys, index; + CFTypeRef power_blob; + CFDictionaryRef power_dictionary; - power_sources_info = IOPSCopyPowerSourcesInfo(); + power_blob = IOPSCopyPowerSourcesInfo(); - assert(power_sources_info); - upsdebugx(6, "%s: Got power_sources_info:", __func__); - if(nut_debug_level >= 6) CFShow(power_sources_info); + assert(power_blob); + upsdebugx(6, "%s: Got power_blob:", __func__); + if(nut_debug_level >= 6) CFShow(power_blob); - upsdebugx(5, "power_source_name = "); - if(nut_debug_level >= 5) CFShow(power_source_name); - upsdebugx(6, "end power_source_name"); + upsdebugx(5, "power_key = "); + if(nut_debug_level >= 5) CFShow(power_key); + upsdebugx(6, "end power_key"); - sources_list = IOPSCopyPowerSourcesList(power_sources_info); + power_dictionary = IOPSGetPowerSourceDescription(power_blob, power_key); - num_keys = CFArrayGetCount(sources_list); - for(index=0; index < num_keys; index++) { - upsdebugx(6, "%s: Getting power source %ld/%ld...", __func__, index+1, num_keys); - power_source = CFArrayGetValueAtIndex(sources_list, index); - assert(power_source); + upsdebugx(5, "Asserting 'power_dictionary': %p", power_dictionary); + assert(power_dictionary); + upsdebugx(5, "CFShowing 'power_dictionary'"); + if(nut_debug_level >= 5) CFShow(power_dictionary); - upsdebugx(6, "%s: power source %ld = ", __func__, index+1); - if(nut_debug_level >= 6) CFShow(power_source); + CFRetain(power_dictionary); - this_power_dictionary = IOPSGetPowerSourceDescription(power_sources_info, power_source); - assert(this_power_dictionary); - - this_power_source_name = CFDictionaryGetValue(this_power_dictionary, CFSTR(kIOPSNameKey)); - assert(this_power_source_name); - - if(!CFStringCompare(this_power_source_name, power_source_name, 0)) { - power_dictionary = this_power_dictionary; - CFRetain(power_dictionary); - break; - } - } - - if(power_dictionary) { - upsdebugx(5, "CFShowing 'power_dictionary'"); - if(nut_debug_level >= 5) CFShow(power_dictionary); - } - - /* Get a new power_sources_info next time: */ - CFRelease(power_sources_info); - CFRelease(sources_list); + /* Get a new power_blob next time: */ + CFRelease(power_blob); return power_dictionary; } @@ -117,9 +91,8 @@ void upsdrv_initinfo(void) upsdebugx(1, "upsdrv_initinfo()"); dstate_setinfo("device.mfr", "(unknown)"); - dstate_setinfo("ups.mfr", "(unknown)"); - power_dictionary = copy_power_dictionary(g_power_source_name); + power_dictionary = copy_power_dictionary(g_power_key); device_type_cfstr = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSTypeKey)); if(device_type_cfstr && !CFStringCompare(device_type_cfstr, CFSTR(kIOPSInternalBatteryType), 0)) { @@ -142,7 +115,6 @@ void upsdrv_initinfo(void) CFRelease(device_name_cfstr); dstate_setinfo("device.model", "%s", device_name); - dstate_setinfo("ups.model", "%s", device_name); max_capacity = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSMaxCapacityKey)); if(max_capacity) { @@ -172,11 +144,8 @@ void upsdrv_updateinfo(void) upsdebugx(1, "upsdrv_updateinfo()"); - power_dictionary = copy_power_dictionary( g_power_source_name ); - if(!power_dictionary) { - dstate_datastale(); - return; - } + power_dictionary = copy_power_dictionary( g_power_key ); + assert(power_dictionary); /* TODO: call dstate_datastale()? */ status_init(); @@ -261,9 +230,6 @@ void upsdrv_updateinfo(void) CFRelease(power_dictionary); } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ @@ -348,9 +314,9 @@ void upsdrv_initups(void) CFDictionaryRef power_dictionary; CFTypeRef power_blob; CFStringRef potential_key, potential_model; - char *model_name; /* regex(3) */ - char potential_model_name[256]; - regex_t model_regex; + char *device_name = device_path, *model_name; /* regex(3) */ + char potential_device_name[80], potential_model_name[80]; + regex_t name_regex, model_regex; int ret; upsdebugx(3, "upsdrv_initups(): Power Sources blob:"); @@ -363,8 +329,6 @@ void upsdrv_initups(void) if(nut_debug_level >= 3) CFShow(power_blob); -/* The CFDictionary through 10.9 has changed to a CFArray, so this part is no longer applicable: */ -#if 0 if(!strcmp(device_name, "auto")) { device_name = "/UPS"; } @@ -378,7 +342,6 @@ void upsdrv_initups(void) "Failed to compile regex from 'port' parameter: '%s'.", device_name); } -#endif if((model_name = getval("model"))) { upsdebugx(2, "Matching power supply model names against regex '%s'", model_name); @@ -400,55 +363,61 @@ void upsdrv_initups(void) if(num_keys < 1) { /* bail */ - fatalx(EXIT_FAILURE, "Couldn't find any UPS or battery. Is your UPS shown in the 'Energy Saver' control panel?"); + fatalx(EXIT_FAILURE, "Couldn't find any UPS or battery"); } for(index=0; index < num_keys; index++) { - upsdebugx(2, "Retrieving power source #%ld", index+1); potential_key = CFArrayGetValueAtIndex(power_source_key_list, index); - upsdebugx(3, "Power source key/index:"); - if(nut_debug_level >= 3) CFShow(potential_key); + CFStringGetCString(potential_key, potential_device_name, + sizeof(potential_device_name), kCFStringEncodingUTF8); + upsdebugx(1, " Power supply: %s", potential_device_name); - power_dictionary = IOPSGetPowerSourceDescription(power_blob, potential_key); - assert(power_dictionary); - CFRetain(power_dictionary); + ret = regexec(&name_regex, potential_device_name, 0,0,0); + + power_dictionary = copy_power_dictionary(potential_key); upsdebugx(2, "Getting 'Name' key (UPS model)"); potential_model = CFDictionaryGetValue(power_dictionary, CFSTR(kIOPSNameKey)); - CFRetain(potential_model); - if(CFStringGetCString(potential_model, potential_model_name, sizeof(potential_model_name), kCFStringEncodingUTF8)) { - upsdebugx(1, " model name: %s", potential_model_name); - } else { - upsdebugx(1, " (failed to retrieve 'Name')"); - } + CFStringGetCString(potential_model, potential_model_name, sizeof(potential_model_name), kCFStringEncodingUTF8); + upsdebugx(1, " model name: %s", potential_model_name); CFRelease(power_dictionary); - if(model_name) { - ret = regexec(&model_regex, potential_model_name, 0,0,0); - if(!ret) { - upsdebugx(2, "Matched model name"); + /* Does key match? Check model: */ + if (!ret) { + if(model_name) { + ret = regexec(&model_regex, potential_model_name, 0,0,0); + if(!ret) { + upsdebugx(2, "Matched model name"); + break; + } + } else { + upsdebugx(2, "Matched key name"); break; } } - CFRelease(potential_model); } + regfree(&name_regex); if(model_name) { regfree(&model_regex); } if(ret) { - if(model_name) { - fatalx(EXIT_FAILURE, "Couldn't find UPS or battery matching 'model' (%s)", - model_name); - } else { - fatalx(EXIT_FAILURE, "Couldn't find an UPS or battery."); - } + fatalx(EXIT_FAILURE, "Couldn't find UPS or battery matching both 'port' (%s) and 'model' (%s)", + device_name, model_name); } - g_power_source_name = potential_model; + g_power_key = potential_key; + CFRetain(g_power_key); + upsdebugx(2, "g_power_key = "); + if(nut_debug_level >= 2) CFShow(g_power_key); + upsdebugx(2, "end g_power_key."); + + power_dictionary = copy_power_dictionary(g_power_key); + assert(power_dictionary); + if(nut_debug_level >= 3) CFShow(power_dictionary); /* the upsh handlers can't be done here, as they get initialized * shortly after upsdrv_initups returns to main. @@ -457,12 +426,14 @@ void upsdrv_initups(void) /* don't try to detect the UPS here */ /* do stuff */ + + CFRelease(power_dictionary); } void upsdrv_cleanup(void) { upsdebugx(1, "Cleanup: release references"); - CFRelease(g_power_source_name); + CFRelease(g_power_key); /* free(dynamic_mem); */ /* ser_close(upsfd, device_path); */ diff --git a/drivers/main-hal.c b/drivers/main-hal.c new file mode 100644 index 0000000..8cd3275 --- /dev/null +++ b/drivers/main-hal.c @@ -0,0 +1,571 @@ +/* main-hal.c - Network UPS Tools driver core for HAL + + Copyright (C) 2006 Arnaud Quette + Copyright (C) 1999 Russell Kroll + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* TODO list: + * -more cleanup + * - dstate-hal: expose all data on org.freedesktop.NUT to prepare + * a full HAL/DBus enabled nut (remove the need of {d,s}state layer + * - use HAL logging functions + */ + +#include "main-hal.h" +#include "dstate-hal.h" +#include + +#ifdef HAVE_POLKIT +#include +#endif + + /* HAL specific */ + extern LibHalContext *halctx; + extern char *udi; + + /* data which may be useful to the drivers */ + int upsfd = -1; + char *device_path = NULL; + const char *progname = NULL, *upsname = NULL, + *device_name = NULL; + + /* may be set by the driver to wake up while in dstate_poll_fds */ + int extrafd = -1; + + /* for ser_open */ + int do_lock_port = 1; + + /* set by the drivers */ + int experimental_driver = 0; + int broken_driver = 0; + + static vartab_t *vartab_h = NULL; + + /* variables possibly set by the global part of ups.conf */ + unsigned int poll_interval = 2; + static char *chroot_path = NULL; + + /* signal handling */ + int exit_flag = 0; + + /* everything else */ + static char *pidfn = NULL; + GMainLoop *gmain; + char *dbus_methods_introspection; + +/* retrieve the value of variable if possible */ +char *getval(const char *var) +{ + vartab_t *tmp = vartab_h; + + while (tmp) { + if (!strcasecmp(tmp->var, var)) + return(tmp->val); + tmp = tmp->next; + } + + return NULL; +} + +/* see if has been defined, even if no value has been given to it */ +int testvar(const char *var) +{ + vartab_t *tmp = vartab_h; + + while (tmp) { + if (!strcasecmp(tmp->var, var)) + return tmp->found; + tmp = tmp->next; + } + + return 0; /* not found */ +} + +/* callback from driver - create the table for -x/conf entries */ +void addvar(int vartype, const char *name, const char *desc) +{ + vartab_t *tmp, *last; + + tmp = last = vartab_h; + + while (tmp) { + last = tmp; + tmp = tmp->next; + } + + tmp = xmalloc(sizeof(vartab_t)); + + tmp->vartype = vartype; + tmp->var = xstrdup(name); + tmp->val = NULL; + tmp->desc = xstrdup(desc); + tmp->found = 0; + tmp->next = NULL; + + if (last) + last->next = tmp; + else + vartab_h = tmp; +} + +static void vartab_free(void) +{ + vartab_t *tmp, *next; + + tmp = vartab_h; + + while (tmp) { + next = tmp->next; + + free(tmp->var); + free(tmp->val); + free(tmp->desc); + free(tmp); + + tmp = next; + } +} + +static void exit_cleanup(int sig) +{ + upsdebugx(2, "exit_cleanup(%i", sig); + + exit_flag = sig; + + upsdrv_cleanup(); + + free(chroot_path); + free(device_path); + + if (pidfn) { + unlink(pidfn); + free(pidfn); + } + + dstate_free(); + vartab_free(); + + /* break the main loop */ + g_main_loop_quit(gmain); +} + +static void setup_signals(void) +{ + struct sigaction sa; + + sigemptyset(&sa.sa_mask); + sa.sa_flags = SA_RESTART | SA_NOCLDSTOP; + + sa.sa_handler = exit_cleanup; + sigaction(SIGTERM, &sa, NULL); + sigaction(SIGINT, &sa, NULL); + sigaction(SIGQUIT, &sa, NULL); + +/* sa.sa_handler = SIG_IGN; + sigaction(SIGHUP, &sa, NULL); + sigaction(SIGPIPE, &sa, NULL);*/ +} + +/* (*GSourceFunc) wrapper */ +static gboolean update_data (gpointer data) +{ + upsdrv_updateinfo(); + return (exit_flag == 0); +} + +int main(int argc, char **argv) +{ + DBusError dbus_error; + DBusConnection *dbus_connection; + struct passwd *new_uid = NULL; + char *hal_debug_level; +/* int i, do_forceshutdown = 0; */ + + if (experimental_driver) { + printf("Warning: This is an experimental driver.\n"); + printf("Some features may not function correctly.\n\n"); + } + + progname = xbasename(argv[0]); + open_syslog(progname); + + dbus_methods_introspection = xmalloc(1024); + + /* Register the basic supported method (Shutdown) + * Leave other methods registration to driver core calls to + * dstate_addcmd(), at initinfo() time + */ + snprintf(dbus_methods_introspection, 1024, "%s", + " \n" +/* " \n" */ + " \n" + " \n"); + + /* initialise HAL and DBus interface*/ + halctx = NULL; + udi = getenv ("UDI"); + if (udi == NULL) { + fprintf(stderr, "Error: UDI is null.\n"); + exit(EXIT_FAILURE); + } + + dbus_error_init (&dbus_error); + if ((halctx = libhal_ctx_init_direct (&dbus_error)) == NULL) { + fprintf(stderr, "Error: can't initialise libhal.\n"); + exit(EXIT_FAILURE); + } + if (dbus_error_is_set (&dbus_error)) + { + fatalx(EXIT_FAILURE, "Error in context creation: %s\n", dbus_error.message); + dbus_error_free (&dbus_error); + } + + if ((dbus_connection = libhal_ctx_get_dbus_connection(halctx)) == NULL) { + fprintf(stderr, "Error: can't get DBus connection.\n"); + exit(EXIT_FAILURE); + } + + /* FIXME: rework HAL param interface! or get path/regex from UDI + * Example: + * /org/freedesktop/Hal/devices/usb_device_463_ffff_1H2E300AH + * => linux.device_file = /dev/bus/usb/002/065 + */ + /* FIXME: the naming should be abstracted to os.device_file! */ + device_path = xstrdup("auto"); + + /* FIXME: bridge debug/warning on HAL equivalent (need them + * to externalize these in a lib... */ + hal_debug_level = getenv ("NUT_HAL_DEBUG"); + if (hal_debug_level == NULL) + nut_debug_level = 0; + else + nut_debug_level = atoi(hal_debug_level); + + /* Sleep 2 seconds to be able to view the device through usbfs! */ + sleep(2); + + /* build the driver's extra (-x) variable table */ + upsdrv_makevartable(); + + /* Switch to the HAL user */ + new_uid = get_user_pwent(HAL_USER); + become_user(new_uid); + + /* Only switch to statepath if we're not powering off */ + /* This avoid case where ie /var is umounted */ +/* ?! Not needed for HAL !? + if (!do_forceshutdown) + if (chdir(dflt_statepath())) + fatal_with_errno(EXIT_FAILURE, "Can't chdir to %s", dflt_statepath()); +*/ + setup_signals(); + + /* clear out callback handler data */ + memset(&upsh, '\0', sizeof(upsh)); + + upsdrv_initups(); + +#if 0 + if (do_forceshutdown) + forceshutdown(); +#endif + + /* get the supported data and commands before allowing connections */ + upsdrv_initinfo(); + upsdrv_updateinfo(); + + /* now we can start servicing requests */ + dstate_init(NULL, NULL); + + /* Commit DBus methods */ + if (!libhal_device_claim_interface(halctx, udi, DBUS_INTERFACE, + dbus_methods_introspection, &dbus_error)) { + fprintf(stderr, "Cannot claim interface: %s\n", dbus_error.message); + } + else + fprintf(stdout, "Claimed the following DBus interfaces on %s:\n%s", + DBUS_INTERFACE, dbus_methods_introspection); + + /* Complete DBus binding */ + dbus_connection_setup_with_g_main(dbus_connection, NULL); + dbus_connection_add_filter(dbus_connection, dbus_filter_function, NULL, NULL); + dbus_connection_set_exit_on_disconnect(dbus_connection, 0); + + dbus_init_local(); + /* end of HAL init */ + +#if 0 + /* publish the top-level data: version number, driver name */ + dstate_setinfo("driver.version", "%s", UPS_VERSION); + dstate_setinfo("driver.name", "%s", progname); + + /* The poll_interval may have been changed from the default */ + dstate_setinfo("driver.parameter.pollinterval", "%d", poll_interval); + +/* FIXME: needed? */ + if (nut_debug_level == 0) { + background(); + writepid(pidfn); + } +#endif + /* End HAL init */ + dbus_error_init (&dbus_error); + if (!libhal_device_addon_is_ready (halctx, udi, &dbus_error)) { + fprintf(stderr, "Error (libhal): device addon is not ready\n"); + exit(EXIT_FAILURE); + } + + /* add a timer for data update */ +#ifdef HAVE_G_TIMEOUT_ADD_SECONDS + g_timeout_add_seconds (poll_interval, +#else + g_timeout_add (1000 * poll_interval, /* seconds */ +#endif + (GSourceFunc)update_data, + NULL); + + /* setup and run the main loop */ + gmain = g_main_loop_new(NULL, FALSE); + g_main_loop_run(gmain); + + /* reached upon addon exit */ + upslogx(LOG_INFO, "Signal %d: exiting", exit_flag); + exit(EXIT_SUCCESS); +} + +/******************************************************************** + * DBus interface functions and data + *******************************************************************/ + +static DBusHandlerResult dbus_filter_function_local(DBusConnection *connection, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal(message, DBUS_INTERFACE_LOCAL, "Disconnected")) { + upsdebugx(1, "DBus daemon disconnected. Trying to reconnect..."); + dbus_connection_unref(connection); + g_timeout_add(5000, (GSourceFunc)dbus_init_local, NULL); + } + return DBUS_HANDLER_RESULT_HANDLED; +} + +/* returns FALSE on success because it's used as a callback */ +gboolean dbus_init_local(void) +{ + DBusConnection *dbus_connection; + DBusError dbus_error; + + dbus_error_init(&dbus_error); + + dbus_connection = dbus_bus_get(DBUS_BUS_SYSTEM, &dbus_error); + if (dbus_error_is_set(&dbus_error)) { + upsdebugx(1, "Cannot get D-Bus connection"); +/* dbus_error_free (&dbus_error); */ + return TRUE; + } + + dbus_connection_setup_with_g_main(dbus_connection, NULL); + dbus_connection_add_filter(dbus_connection, dbus_filter_function_local, + NULL, NULL); + dbus_connection_set_exit_on_disconnect(dbus_connection, 0); + return FALSE; +} + +#ifdef HAVE_POLKIT +/** + * dbus_is_privileged: + * @connection: connection to D-Bus + * @message: Message + * @error: the error + * + * Returns: TRUE if the caller is privileged + * + * checks if caller of message possesses the CPUFREQ_POLKIT_PRIVILGE + */ +static gboolean +dbus_is_privileged (DBusConnection *connection, DBusMessage *message, DBusError *error) +{ + gboolean ret; + char *polkit_result; + const char *invoked_by_syscon_name; + + ret = FALSE; + polkit_result = NULL; +/* FIXME: CPUFREQ_POLKIT_PRIVILEGE, CPUFREQ_ERROR_GENERAL */ + invoked_by_syscon_name = dbus_message_get_sender (message); + + polkit_result = libhal_device_is_caller_privileged (halctx, + udi, + CPUFREQ_POLKIT_PRIVILEGE, + invoked_by_syscon_name, + error); + if (polkit_result == NULL) { + dbus_raise_error (connection, message, CPUFREQ_ERROR_GENERAL, + "Cannot determine if caller is privileged"); + } + else { + if (strcmp (polkit_result, "yes") != 0) { + + dbus_raise_error (connection, message, + "org.freedesktop.Hal.Device.PermissionDeniedByPolicy", + "%s %s <-- (action, result)", + CPUFREQ_POLKIT_PRIVILEGE, polkit_result); + } + else + ret = TRUE; + } + + if (polkit_result != NULL) + libhal_free_string (polkit_result); + return ret; +} +#endif + +/** + * dbus_send_reply: + * @connection: connection to D-Bus + * @message: Message + * @type: the type of data param + * @data: data to send + * + * Returns: TRUE/FALSE + * + * sends a reply to message with the given data and its dbus_type + */ +static gboolean dbus_send_reply(DBusConnection *connection, DBusMessage *message, + int dbus_type, void *data) +{ + DBusMessage *reply; + + if ((reply = dbus_message_new_method_return(message)) == NULL) { + upslogx(LOG_WARNING, "Could not allocate memory for the DBus reply"); + return FALSE; + } + + if (data != NULL) + dbus_message_append_args(reply, dbus_type, data, DBUS_TYPE_INVALID); + + if (!dbus_connection_send(connection, reply, NULL)) { + upslogx(LOG_WARNING, "Could not sent reply"); + return FALSE; + } + dbus_connection_flush(connection); + dbus_message_unref(reply); + + return TRUE; +} + +/** + * dbus_get_argument: + * @connection: connection to D-Bus + * @message: Message + * @dbus_error: the D-Bus error + * @type: the type of arg param + * @arg: the value to get from the message + * + * Returns: TRUE/FALSE + * + * gets one argument from message with the given dbus_type and stores it in arg + */ +static gboolean dbus_get_argument(DBusConnection *connection, DBusMessage *message, + DBusError *dbus_error, int dbus_type, void *arg) +{ + dbus_message_get_args(message, dbus_error, dbus_type, arg, + DBUS_TYPE_INVALID); + if (dbus_error_is_set(dbus_error)) { + upslogx(LOG_WARNING, "Could not get argument of DBus message: %s", + dbus_error->message); + dbus_error_free(dbus_error); + return FALSE; + } + return TRUE; +} + +/** + * dbus_filter_function: + * @connection: connection to D-Bus + * @message: message + * @user_data: pointer to the data + * + * Returns: the result + * + * @raises UnknownMethod + * + * D-Bus filter function + */ +DBusHandlerResult dbus_filter_function(DBusConnection *connection, + DBusMessage *message, + void *user_data) +{ + DBusError dbus_error; + int retcode = -1; + const char *member = dbus_message_get_member(message); + const char *path = dbus_message_get_path(message); +/* int ret = DBUS_HANDLER_RESULT_NOT_YET_HANDLED; */ + + /* upsdebugx(2, "Received DBus message with member %s path %s", member, path); */ + fprintf(stdout, "Received DBus message with member %s on path %s\n", member, path); + + dbus_error_init(&dbus_error); + if (dbus_error_is_set (&dbus_error)) + { + fprintf (stderr, "an error occurred: %s\n", dbus_error.message); +/* dbus_error_free (&dbus_error); */ + } + else + { +#ifdef HAVE_POLKIT + if (!dbus_is_privileged(connection, message, &dbus_error)) + return DBUS_HANDLER_RESULT_HANDLED; +#endif + + if (dbus_message_is_method_call(message, DBUS_INTERFACE, "Shutdown")) { + + fprintf(stdout, "executing Shutdown\n"); + upsdrv_shutdown(); + dbus_send_reply(connection, message, DBUS_TYPE_INVALID, NULL); + + } else if (dbus_message_is_method_call(message, + DBUS_INTERFACE, "SetBeeper")) { + fprintf(stdout, "executing SetBeeper\n"); + gboolean b_enable; + if (!dbus_get_argument(connection, message, &dbus_error, + DBUS_TYPE_BOOLEAN, &b_enable)) { + fprintf(stderr, "Error receiving boolean argument\n"); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + fprintf(stdout, "Received argument: %s\n", (b_enable==TRUE)?"true":"false"); + + if (b_enable==TRUE) { + if (upsh.instcmd("beeper.enable", NULL) != STAT_INSTCMD_HANDLED) { + dbus_send_reply(connection, message, DBUS_TYPE_INT32, &retcode); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + } + else { + if (upsh.instcmd("beeper.disable", NULL) != STAT_INSTCMD_HANDLED) { + dbus_send_reply(connection, message, DBUS_TYPE_INT32, &retcode); + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + } + } else { + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; + } + } + dbus_send_reply(connection, message, DBUS_TYPE_INVALID, NULL); + return DBUS_HANDLER_RESULT_HANDLED; +} diff --git a/drivers/main-hal.h b/drivers/main-hal.h new file mode 100644 index 0000000..e612133 --- /dev/null +++ b/drivers/main-hal.h @@ -0,0 +1,51 @@ +#include "common.h" +#include "config.h" +/* #include "upsconf.h" */ +#include "dstate.h" +#include "extstate.h" + +/* public functions & variables from main.c */ +extern const char *progname; +extern char *device_path; +extern const char *device_name; +extern int upsfd, extrafd, broken_driver, experimental_driver, exit_flag; +extern unsigned int poll_interval; + +/* functions & variables required in each driver */ +void upsdrv_initups(void); /* open connection to UPS, fail if not found */ +void upsdrv_initinfo(void); /* prep data, settings for UPS monitoring */ +void upsdrv_updateinfo(void); /* update state data if possible */ +void upsdrv_shutdown(void); /* make the UPS power off the load */ +void upsdrv_help(void); /* tack on anything useful for the -h text */ +void upsdrv_banner(void); /* print your version information */ +void upsdrv_cleanup(void); /* free any resources before shutdown */ + +/* --- details for the variable/value sharing --- */ + +/* main calls this driver function - it needs to call addvar */ +void upsdrv_makevartable(void); + +/* retrieve the value of variable if possible */ +char *getval(const char *var); + +/* see if has been defined, even if no value has been given to it */ +int testvar(const char *var); + +/* extended variable table - used for -x defines/flags */ +typedef struct vartab_s { + int vartype; /* VAR_* value, below */ + char *var; /* left side of =, or whole word if none */ + char *val; /* right side of = */ + char *desc; /* 40 character description for -h text */ + int found; /* set once encountered, for testvar() */ + struct vartab_s *next; +} vartab_t; + +/* flags to define types in the vartab */ + +#define VAR_FLAG 0x0001 /* argument is a flag (no value needed) */ +#define VAR_VALUE 0x0002 /* argument requires a value setting */ +#define VAR_SENSITIVE 0x0004 /* do not publish in driver.parameter */ + +/* callback from driver - create the table for future -x entries */ +void addvar(int vartype, const char *name, const char *desc); diff --git a/drivers/main.c b/drivers/main.c index 63d329b..7c2fc55 100644 --- a/drivers/main.c +++ b/drivers/main.c @@ -1,10 +1,6 @@ /* main.c - Network UPS Tools driver core - Copyright (C) - 1999 Russell Kroll - 2005 - 2017 Arnaud Quette - 2017 Eaton (author: Emilien Kia ) - 2017 - 2022 Jim Klimov + Copyright (C) 1999 Russell Kroll This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,71 +17,34 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "common.h" #include "main.h" -#include "nut_stdint.h" #include "dstate.h" -#include "attribute.h" -#include -#include -#include -#include + /* data which may be useful to the drivers */ + int upsfd = -1; + char *device_path = NULL; + const char *progname = NULL, *upsname = NULL, *device_name = NULL; -/* data which may be useful to the drivers */ -int upsfd = -1; -char *device_path = NULL; -const char *progname = NULL, *upsname = NULL, *device_name = NULL; + /* may be set by the driver to wake up while in dstate_poll_fds */ + int extrafd = -1; -/* may be set by the driver to wake up while in dstate_poll_fds */ -int extrafd = -1; + /* for ser_open */ + int do_lock_port = 1; -/* for ser_open */ -int do_lock_port = 1; + /* for detecting -a values that don't match anything */ + static int upsname_found = 0; -/* for dstate->sock_connect, default to effectively - * asynchronous (0) with fallback to synchronous (1) */ -int do_synchronous = -1; + static vartab_t *vartab_h = NULL; -/* for detecting -a values that don't match anything */ -static int upsname_found = 0; + /* variables possibly set by the global part of ups.conf */ + unsigned int poll_interval = 2; + static char *chroot_path = NULL, *user = NULL; -static vartab_t *vartab_h = NULL; + /* signal handling */ + int exit_flag = 0; -/* variables possibly set by the global part of ups.conf - * user and group may be set globally or per-driver - */ -time_t poll_interval = 2; -static char *chroot_path = NULL, *user = NULL, *group = NULL; -static int user_from_cmdline = 0, group_from_cmdline = 0; - -/* signal handling */ -int exit_flag = 0; - -/* should this driver instance go to background (default) - * or stay foregrounded (default if -D/-d options are set on - * command line)? - * Value is tri-state: - * -1 (default) Background the driver process - * 0 User required to not background explicitly, - * or passed -D (or -d) and current value was -1 - * 1 User required to background even if with -D or dump_mode - */ -static int background_flag = -1; - -/* Users can pass a -D[...] option to enable debugging. - * For the service tracing purposes, also the ups.conf - * can define a debug_min value in the global or device - * section, to set the minimal debug level (CLI provided - * value less than that would not have effect, can only - * have more). - */ -static int nut_debug_level_global = -1; -static int nut_debug_level_driver = -1; - -/* everything else */ -static char *pidfn = NULL; -static int dump_data = 0; /* Store the update_count requested */ + /* everything else */ + static char *pidfn = NULL; /* print the driver banner */ void upsdrv_banner (void) @@ -111,9 +70,6 @@ void upsdrv_banner (void) } /* power down the attached load immediately */ -static void forceshutdown(void) - __attribute__((noreturn)); - static void forceshutdown(void) { upslogx(LOG_NOTICE, "Initiating UPS shutdown"); @@ -128,32 +84,20 @@ static void help_msg(void) { vartab_t *tmp; - printf("\nusage: %s (-a |-s ) [OPTIONS]\n", progname); + printf("\nusage: %s -a [OPTIONS]\n", progname); printf(" -a - autoconfig using ups.conf section \n"); printf(" - note: -x after -a overrides ups.conf settings\n\n"); - printf(" -s - configure directly from cmd line arguments\n"); - printf(" - note: must specify all driver parameters with successive -x\n"); - printf(" - note: at least 'port' variable should be set\n"); - printf(" - note: to explore the current values on a device from an\n"); - printf(" unprivileged user account (with sufficient media access in\n"); - printf(" the OS - e.g. to query networked devices), you can specify\n"); - printf(" '-d 1' argument and `export NUT_STATEPATH=/tmp` beforehand\n\n"); - printf(" -V - print version, then exit\n"); printf(" -L - print parseable list of driver variables\n"); - printf(" -D - raise debugging level (and stay foreground by default)\n"); - printf(" -d - dump data to stdout after 'count' updates loop and exit\n"); - printf(" -F - stay foregrounded even if no debugging is enabled\n"); - printf(" -B - stay backgrounded even if debugging is bumped\n"); + printf(" -D - raise debugging level\n"); printf(" -q - raise log level threshold\n"); printf(" -h - display this help\n"); printf(" -k - force shutdown\n"); printf(" -i - poll interval\n"); printf(" -r - chroot to \n"); printf(" -u - switch to (if started as root)\n"); - printf(" -g - set pipe access to (if started as root)\n"); printf(" -x = - set driver variable to \n"); printf(" - example: -x cable=940-0095B\n\n"); @@ -306,12 +250,7 @@ void addvar(int vartype, const char *name, const char *desc) /* handle -x / ups.conf config details that are for this part of the code */ static int main_arg(char *var, char *val) { - /* flags for main */ - - upsdebugx(3, "%s: var='%s' val='%s'", - __func__, - var ? var : "", /* null should not happen... but... */ - val ? val : ""); + /* flags for main: just 'nolock' for now */ if (!strcmp(var, "nolock")) { do_lock_port = 0; @@ -326,7 +265,7 @@ static int main_arg(char *var, char *val) /* any other flags are for the driver code */ if (!val) - return 0; /* unhandled, pass it through to the driver */ + return 0; /* variables for main: port */ @@ -337,57 +276,11 @@ static int main_arg(char *var, char *val) return 1; /* handled */ } - /* user specified at the driver level overrides that on global level - * or the built-in default - */ - if (!strcmp(var, "user")) { - if (user_from_cmdline) { - upsdebugx(0, "User '%s' specified in driver section " - "was ignored due to '%s' specified on command line", - val, user); - } else { - upsdebugx(1, "Overriding previously specified user '%s' " - "with '%s' specified for driver section", - user, val); - free(user); - user = xstrdup(val); - } - return 1; /* handled */ - } - - if (!strcmp(var, "group")) { - if (group_from_cmdline) { - upsdebugx(0, "Group '%s' specified in driver section " - "was ignored due to '%s' specified on command line", - val, group); - } else { - upsdebugx(1, "Overriding previously specified group '%s' " - "with '%s' specified for driver section", - group, val); - free(group); - group = xstrdup(val); - } - return 1; /* handled */ - } - if (!strcmp(var, "sddelay")) { upslogx(LOG_INFO, "Obsolete value sddelay found in ups.conf"); return 1; /* handled */ } - /* allow per-driver overrides of the global setting */ - if (!strcmp(var, "synchronous")) { - if (!strcmp(val, "yes")) - do_synchronous=1; - else - if (!strcmp(val, "auto")) - do_synchronous=-1; - else - do_synchronous=0; - - return 1; /* handled */ - } - /* only for upsdrvctl - ignored here */ if (!strcmp(var, "sdorder")) return 1; /* handled */ @@ -396,36 +289,13 @@ static int main_arg(char *var, char *val) if (!strcmp(var, "desc")) return 1; /* handled */ - /* Allow each driver to specify its minimal debugging level - - * admins can set more with command-line args, but can't set - * less without changing config. Should help debug of services. */ - if (!strcmp(var, "debug_min")) { - int lvl = -1; // typeof common/common.c: int nut_debug_level - if ( str_to_int (val, &lvl, 10) && lvl >= 0 ) { - nut_debug_level_driver = lvl; - } else { - upslogx(LOG_INFO, "WARNING : Invalid debug_min value found in ups.conf for the driver"); - } - return 1; /* handled */ - } - return 0; /* unhandled, pass it through to the driver */ } static void do_global_args(const char *var, const char *val) { - upsdebugx(3, "%s: var='%s' val='%s'", - __func__, - var ? var : "", /* null should not happen... but... */ - val ? val : ""); - if (!strcmp(var, "pollinterval")) { - int ipv = atoi(val); - if (ipv > 0) { - poll_interval = (time_t)ipv; - } else { - fatalx(EXIT_FAILURE, "Error: invalid pollinterval: %d", ipv); - } + poll_interval = atoi(val); return; } @@ -435,54 +305,10 @@ static void do_global_args(const char *var, const char *val) } if (!strcmp(var, "user")) { - if (user_from_cmdline) { - upsdebugx(0, "User specified in global section '%s' " - "was ignored due to '%s' specified on command line", - val, user); - } else { - upsdebugx(1, "Overriding previously specified user '%s' " - "with '%s' specified in global section", - user, val); - free(user); - user = xstrdup(val); - } + free(user); + user = xstrdup(val); } - if (!strcmp(var, "group")) { - if (group_from_cmdline) { - upsdebugx(0, "Group specified in global section '%s' " - "was ignored due to '%s' specified on command line", - val, group); - } else { - upsdebugx(1, "Overriding previously specified group '%s' " - "with '%s' specified in global section", - group, val); - free(group); - group = xstrdup(val); - } - } - - if (!strcmp(var, "synchronous")) { - if (!strcmp(val, "yes")) - do_synchronous=1; - else - if (!strcmp(val, "auto")) - do_synchronous=-1; - else - do_synchronous=0; - } - - /* Allow to specify its minimal debugging level for all drivers - - * admins can set more with command-line args, but can't set - * less without changing config. Should help debug of services. */ - if (!strcmp(var, "debug_min")) { - int lvl = -1; // typeof common/common.c: int nut_debug_level - if ( str_to_int (val, &lvl, 10) && lvl >= 0 ) { - nut_debug_level_global = lvl; - } else { - upslogx(LOG_INFO, "WARNING : Invalid debug_min value found in ups.conf global settings"); - } - } /* unrecognized */ } @@ -519,38 +345,15 @@ void do_upsconf_args(char *confupsname, char *var, char *val) /* don't let the user shoot themselves in the foot */ if (!strcmp(var, "driver")) { - /* Accomodate for libtool wrapped developer iterations - * running e.g. `drivers/.libs/lt-dummy-ups` filenames - */ - size_t tmplen = strlen("lt-"); - if (strncmp("lt-", progname, tmplen) == 0 - && strcmp(val, progname + tmplen) == 0) { - /* debug level may be not initialized yet, and situation - * should not happen in end-user builds, so ok to yell: */ - upsdebugx(0, "Seems this driver binary %s is a libtool " - "wrapped build for driver %s", progname, val); - /* progname points to xbasename(argv[0]) in-place; - * roll the pointer forward a bit, we know we can: - */ - progname = progname + tmplen; - } - - if (strcmp(val, progname) != 0) { + if (strcmp(val, progname) != 0) fatalx(EXIT_FAILURE, "Error: UPS [%s] is for driver %s, but I'm %s!\n", confupsname, val, progname); - } return; } /* allow per-driver overrides of the global setting */ if (!strcmp(var, "pollinterval")) { - int ipv = atoi(val); - if (ipv > 0) { - poll_interval = (time_t)ipv; - } else { - fatalx(EXIT_FAILURE, "Error: UPS [%s]: invalid pollinterval: %d", - confupsname, ipv); - } + poll_interval = atoi(val); return; } @@ -630,7 +433,6 @@ static void exit_cleanup(void) free(chroot_path); free(device_path); free(user); - free(group); if (pidfn) { unlink(pidfn); @@ -658,14 +460,7 @@ static void setup_signals(void) sigaction(SIGINT, &sa, NULL); sigaction(SIGQUIT, &sa, NULL); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif sa.sa_handler = SIG_IGN; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif sigaction(SIGHUP, &sa, NULL); sigaction(SIGPIPE, &sa, NULL); } @@ -674,16 +469,12 @@ int main(int argc, char **argv) { struct passwd *new_uid = NULL; int i, do_forceshutdown = 0; - int update_count = 0; atexit(exit_cleanup); /* pick up a default from configure --with-user */ user = xstrdup(RUN_AS_USER); /* xstrdup: this gets freed at exit */ - /* pick up a default from configure --with-group */ - group = xstrdup(RUN_AS_GROUP); /* xstrdup: this gets freed at exit */ - progname = xbasename(argv[0]); open_syslog(progname); @@ -697,7 +488,7 @@ int main(int argc, char **argv) /* build the driver's extra (-x) variable table */ upsdrv_makevartable(); - while ((i = getopt(argc, argv, "+a:s:kFBDd:hx:Lqr:u:g:Vi:")) != -1) { + while ((i = getopt(argc, argv, "+a:kDhx:Lqr:u:Vi:")) != -1) { switch (i) { case 'a': upsname = optarg; @@ -708,31 +499,11 @@ int main(int argc, char **argv) fatalx(EXIT_FAILURE, "Error: Section %s not found in ups.conf", optarg); break; - case 's': - upsname = optarg; - upsname_found = 1; - break; - case 'F': - background_flag = 0; - break; - case 'B': - background_flag = 1; - break; case 'D': nut_debug_level++; break; - case 'd': - dump_data = atoi(optarg); - break; - case 'i': { /* scope */ - int ipv = atoi(optarg); - if (ipv > 0) { - poll_interval = (time_t)ipv; - } else { - fatalx(EXIT_FAILURE, "Error: command-line: invalid pollinterval: %d", - ipv); - } - } + case 'i': + poll_interval = atoi(optarg); break; case 'k': do_lock_port = 0; @@ -748,36 +519,7 @@ int main(int argc, char **argv) chroot_path = xstrdup(optarg); break; case 'u': - if (user_from_cmdline) { - upsdebugx(1, "Previously specified user for drivers '%s' " - "was ignored due to '%s' specified on command line" - " (again?)", - user, optarg); - } else { - upsdebugx(1, "Built-in default or configured user " - "for drivers '%s' was ignored due to '%s' " - "specified on command line", - user, optarg); - } - free(user); user = xstrdup(optarg); - user_from_cmdline = 1; - break; - case 'g': - if (group_from_cmdline) { - upsdebugx(1, "Previously specified group for drivers '%s' " - "was ignored due to '%s' specified on command line" - " (again?)", - group, optarg); - } else { - upsdebugx(1, "Built-in default or configured group " - "for drivers '%s' was ignored due to '%s' " - "specified on command line", - group, optarg); - } - free(group); - group = xstrdup(optarg); - group_from_cmdline = 1; break; case 'V': /* already printed the banner, so exit */ @@ -794,21 +536,6 @@ int main(int argc, char **argv) } } - if (nut_debug_level > 0 || dump_data) { - if ( background_flag < 0 ) { - /* Only flop from default - stay foreground with debug on */ - background_flag = 0; - } else { - upsdebugx (0, - "Debug level is %d, dump data count is %s, " - "but backgrounding mode requested as %s", - nut_debug_level, - dump_data ? "on" : "off", - background_flag ? "on" : "off" - ); - } - } /* else: default remains `background_flag==-1` where nonzero is true */ - argc -= optind; argv += optind; @@ -819,32 +546,15 @@ int main(int argc, char **argv) if (!upsname_found) { fatalx(EXIT_FAILURE, - "Error: specifying '-a id' or '-s id' is now mandatory. Try -h for help."); + "Error: specifying '-a id' is now mandatory. Try -h for help."); } /* we need to get the port from somewhere */ if (!device_path) { fatalx(EXIT_FAILURE, - "Error: you must specify a port name in ups.conf or in '-x port=...' argument.\n" - "Try -h for help."); + "Error: you must specify a port name in ups.conf. Try -h for help."); } - /* CLI debug level can not be smaller than debug_min specified - * in ups.conf, and value specified for a driver config section - * overrides the global one. Note that non-zero debug_min does - * not impact foreground running mode. - */ - { - int nut_debug_level_upsconf = -1 ; - if ( nut_debug_level_global >= 0 && nut_debug_level_driver >= 0 ) { - nut_debug_level_upsconf = nut_debug_level_driver; - } else { - if ( nut_debug_level_global >= 0 ) nut_debug_level_upsconf = nut_debug_level_global; - if ( nut_debug_level_driver >= 0 ) nut_debug_level_upsconf = nut_debug_level_driver; - } - if ( nut_debug_level_upsconf > nut_debug_level ) - nut_debug_level = nut_debug_level_upsconf; - } upsdebugx(1, "debug level is '%d'", nut_debug_level); new_uid = get_user_pwent(user); @@ -854,14 +564,13 @@ int main(int argc, char **argv) become_user(new_uid); - /* Only switch to statepath if we're not powering off - * or not just dumping data (for discovery) */ - /* This avoids case where ie /var is unmounted already */ - if ((!do_forceshutdown) && (!dump_data) && (chdir(dflt_statepath()))) + /* Only switch to statepath if we're not powering off */ + /* This avoid case where ie /var is umounted */ + if ((!do_forceshutdown) && (chdir(dflt_statepath()))) fatal_with_errno(EXIT_FAILURE, "Can't chdir to %s", dflt_statepath()); /* Setup signals to communicate with driver once backgrounded. */ - if ((background_flag != 0) && (!do_forceshutdown)) { + if ((nut_debug_level == 0) && (!do_forceshutdown)) { char buffer[SMALLBUF]; setup_signals(); @@ -884,26 +593,19 @@ int main(int argc, char **argv) break; } - upslogx(LOG_WARNING, "Duplicate driver instance detected (PID file %s exists)! Terminating other driver!", buffer); + upslogx(LOG_WARNING, "Duplicate driver instance detected! Terminating other driver!"); /* Allow driver some time to quit */ sleep(5); } - /* Only write pid if we're not just dumping data, for discovery */ - if (!dump_data) { - pidfn = xstrdup(buffer); - writepid(pidfn); /* before backgrounding */ - } + pidfn = xstrdup(buffer); + writepid(pidfn); /* before backgrounding */ } /* clear out callback handler data */ memset(&upsh, '\0', sizeof(upsh)); - /* note: device.type is set early to be overridden by the driver - * when its a pdu! */ - dstate_setinfo("device.type", "ups"); - upsdrv_initups(); /* UPS is detected now, cleanup upon exit */ @@ -917,19 +619,15 @@ int main(int argc, char **argv) if (do_forceshutdown) forceshutdown(); + /* note: device.type is set early to be overriden by the driver + * when its a pdu! */ + dstate_setinfo("device.type", "ups"); + /* publish the top-level data: version numbers, driver name */ dstate_setinfo("driver.version", "%s", UPS_VERSION); dstate_setinfo("driver.version.internal", "%s", upsdrv_info.version); dstate_setinfo("driver.name", "%s", progname); - /* - * If we are not debugging, send the early startup logs generated by - * upsdrv_initinfo() and upsdrv_updateinfo() to syslog, not just stderr. - * Otherwise these logs are lost. - */ - if ((nut_debug_level == 0) && (!dump_data)) - syslogbit_set(); - /* get the base data established before allowing connections */ upsdrv_initinfo(); upsdrv_updateinfo(); @@ -957,87 +655,10 @@ int main(int argc, char **argv) } /* now we can start servicing requests */ - /* Only write pid if we're not just dumping data, for discovery */ - if (!dump_data) { - char * sockname = dstate_init(progname, upsname); - /* Normally we stick to the built-in account info, - * so if they were not over-ridden - no-op here: - */ - if (strcmp(group, RUN_AS_GROUP) - || strcmp(user, RUN_AS_USER) - ) { - int allOk = 1; - /* Tune group access permission to the pipe, - * so that upsd can access it (using the - * specified or retained default group): - */ - struct group *grp = getgrnam(group); - upsdebugx(1, "Group and/or user account for this driver " - "was customized ('%s:%s') compared to built-in " - "defaults. Fixing socket '%s' ownership/access.", - user, group, sockname); - - if (grp == NULL) { - upsdebugx(1, "WARNING: could not resolve " - "group name '%s': %s", - group, strerror(errno) - ); - allOk = 0; - } else { - struct stat statbuf; - mode_t mode; - if (chown(sockname, -1, grp->gr_gid)) { - upsdebugx(1, "WARNING: chown failed: %s", - strerror(errno) - ); - allOk = 0; - } - - if (stat(sockname, &statbuf)) { - /* Logically we'd fail chown above if file - * does not exist or is not accessible, but - * practically we only need stat for chmod - */ - upsdebugx(1, "WARNING: stat failed: %s", - strerror(errno) - ); - allOk = 0; - } else { - /* chmod g+rw sockname */ - mode = statbuf.st_mode; - mode |= S_IWGRP; - mode |= S_IRGRP; - if (chmod(sockname, mode)) { - upsdebugx(1, "WARNING: chmod failed: %s", - strerror(errno) - ); - allOk = 0; - } - } - } - - if (allOk) { - upsdebugx(1, "Group access for this driver successfully fixed"); - } else { - upsdebugx(0, "WARNING: Needed to fix group access " - "to filesystem socket of this driver, but failed; " - "run the driver with more debugging to see how exactly.\n" - "Consumers of the socket, such as upsd data server, " - "can fail to interact with the driver and represent " - "the device: %s", - sockname); - } - - } - free(sockname); - } + dstate_init(progname, upsname); /* The poll_interval may have been changed from the default */ - dstate_setinfo("driver.parameter.pollinterval", "%jd", (intmax_t)poll_interval); - - /* The synchronous option may have been changed from the default */ - dstate_setinfo("driver.parameter.synchronous", "%s", - (do_synchronous==1)?"yes":((do_synchronous==0)?"no":"auto")); + dstate_setinfo("driver.parameter.pollinterval", "%d", poll_interval); /* remap the device.* info from ups.* for the transition period */ if (dstate_getinfo("ups.mfr") != NULL) @@ -1047,7 +668,7 @@ int main(int argc, char **argv) if (dstate_getinfo("ups.serial") != NULL) dstate_setinfo("device.serial", "%s", dstate_getinfo("ups.serial")); - if (background_flag != 0) { + if (nut_debug_level == 0) { background(); writepid(pidfn); /* PID changes when backgrounding */ } @@ -1061,27 +682,13 @@ int main(int argc, char **argv) upsdrv_updateinfo(); - /* Dump the data tree (in upsc-like format) to stdout and exit */ - if (dump_data) { - /* Wait for 'dump_data' update loops to ensure data completion */ - if (update_count == dump_data) { - dstate_dump(); - exit_flag = 1; - } - else - update_count++; - } - else { - while (!dstate_poll_fds(timeout, extrafd) && !exit_flag) { - /* repeat until time is up or extrafd has data */ - } + while (!dstate_poll_fds(timeout, extrafd) && !exit_flag) { + /* repeat until time is up or extrafd has data */ } } /* if we get here, the exit flag was set by a signal handler */ - /* however, avoid to "pollute" data dump output! */ - if (!dump_data) - upslogx(LOG_INFO, "Signal %d: exiting", exit_flag); + upslogx(LOG_INFO, "Signal %d: exiting", exit_flag); exit(EXIT_SUCCESS); } diff --git a/drivers/main.h b/drivers/main.h index 523d908..3e3e84e 100644 --- a/drivers/main.h +++ b/drivers/main.h @@ -1,5 +1,5 @@ -#ifndef NUT_MAIN_H_SEEN -#define NUT_MAIN_H_SEEN +#ifndef MAIN_H +#define MAIN_H #include "common.h" #include "upsconf.h" @@ -10,7 +10,7 @@ extern const char *progname, *upsname, *device_name; extern char *device_path; extern int upsfd, extrafd, broken_driver, experimental_driver, do_lock_port, exit_flag; -extern time_t poll_interval; +extern unsigned int poll_interval; /* functions & variables required in each driver */ void upsdrv_initups(void); /* open connection to UPS, fail if not found */ @@ -53,7 +53,7 @@ void addvar(int vartype, const char *name, const char *desc); /* subdriver description structure */ typedef struct upsdrv_info_s { - const char *name; /* driver full name, for banner printing, ... */ + const char *name; /* driver full name, for banner printing, ... */ const char *version; /* driver version */ const char *authors; /* authors name */ const int status; /* driver development status */ @@ -76,4 +76,4 @@ typedef struct upsdrv_info_s { /* public driver information from the driver file */ extern upsdrv_info_t upsdrv_info; -#endif /* NUT_MAIN_H_SEEN */ +#endif /* MAIN_H */ diff --git a/drivers/masterguard.c b/drivers/masterguard.c index 46364f6..7edc899 100644 --- a/drivers/masterguard.c +++ b/drivers/masterguard.c @@ -4,11 +4,6 @@ masterguard.c created on 15.8.2001 - OBSOLETION WARNING: Please to not base new development on this - codebase, instead create a new subdriver for nutdrv_qx which - generally covers all Megatec/Qx protocol family and aggregates - device support from such legacy drivers over time. - This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -24,11 +19,22 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + +/******************************************************************** + * + * Please if you edit this code convert tabs to spaces and use + * four characters indent. + * If you don't know what this means use the vim editor. + * + * Have fun + * Michael + * + ********************************************************************/ #include "main.h" #include "serial.h" #define DRIVER_NAME "MASTERGUARD UPS driver" -#define DRIVER_VERSION "0.25" +#define DRIVER_VERSION "0.24" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -48,76 +54,76 @@ upsdrv_info_t upsdrv_info = { #define DEBUG 1 -static int type; -static char name[31]; -static char firmware[6]; +int type; +char name[31]; +char firmware[6]; /******************************************************************** * - * Helper function to split a sting into words by splitting at the + * Helper function to split a sting into words by splitting at the * SPACE character. * - * Adds up to maxlen characters to the char word. + * Adds up to maxlen characters to the char word. * Returns NULL on reaching the end of the string. - * + * ********************************************************************/ -static char *StringSplit( char *source, char *word, size_t maxlen ) +static char *StringSplit( char *source, char *word, int maxlen ) { - size_t i; - size_t len; - size_t wc=0; - - word[0] = '\0'; - len = strlen( source ); - for( i = 0; i < len && wc < maxlen; i++ ) - { - if( source[i] == ' ' ) - { - word[wc] = '\0'; - return source + i + 1; - } - word[wc] = source[i]; - wc++; - } - word[wc] = '\0'; - return NULL; + int i; + int len; + int wc=0; + + word[0] = '\0'; + len = strlen( source ); + for( i = 0; i < len; i++ ) + { + if( source[i] == ' ' ) + { + word[wc] = '\0'; + return source + i + 1; + } + word[wc] = source[i]; + wc++; + } + word[wc] = '\0'; + return NULL; } - + /******************************************************************** * * Helper function to drop all whitespaces within a string. - * + * * "word" must be large enought to hold "source", for the worst case * "word" has to be exacly the size of "source". - * + * ********************************************************************/ static void StringStrip( char *source, char *word ) { - size_t wc=0; - size_t i; - size_t len; + int wc=0; + int i; + int len; - word[0] = '\0'; - len = strlen( source ); - for( i = 0; i < len; i++ ) - { - if( source[i] == ' ' ) - continue; - if( source[i] == '\n' ) - continue; - if( source[i] == '\t' ) - continue; - word[wc] = source[i]; - wc++; - } - word[wc] = '\0'; + word[0] = '\0'; + len = strlen( source ); + for( i = 0; i < len; i++ ) + { + if( source[i] == ' ' ) + continue; + if( source[i] == '\n' ) + continue; + if( source[i] == '\t' ) + continue; + word[wc] = source[i]; + wc++; + } + word[wc] = '\0'; } /******************************************************************** * * Function parses the status flags which occure in the Q1 and Q3 * command. Sets the INFO_STATUS value ( OL, OB, ... ) - * + * ********************************************************************/ static void parseFlags( char *flags ) { @@ -137,7 +143,7 @@ static void parseFlags( char *flags ) /* this has no mapping */ #if 0 if( flags[3] == '1' ) - setinfo( INFO_ALRM_GENERAL, "1" ); + setinfo( INFO_ALRM_GENERAL, "1" ); #endif #if 0 @@ -151,195 +157,195 @@ static void parseFlags( char *flags ) status_commit(); - if( DEBUG ) - printf( "Status is %s\n", dstate_getinfo("ups.status")); + if( DEBUG ) + printf( "Status is %s\n", dstate_getinfo("ups.status")); } /******************************************************************** * * Function parses the response of the query1 ( "Q1" ) command. * Also sets various values (IPFreq ... ) - * + * ********************************************************************/ static void query1( char *buf ) { - #define WORDMAXLEN 255 - char value[WORDMAXLEN]; - char word[WORDMAXLEN]; - char *newPOS; - char *oldPOS; - int count = 0; + #define WORDMAXLEN 255 + char value[WORDMAXLEN]; + char word[WORDMAXLEN]; + char *newPOS; + char *oldPOS; + int count = 0; - if( DEBUG ) - printf( "Q1 Buffer is : %s\n" , buf + 1 ); - oldPOS = buf + 1; - newPOS = oldPOS; + if( DEBUG ) + printf( "Q1 Buffer is : %s\n" , buf + 1 ); + oldPOS = buf + 1; + newPOS = oldPOS; + + do + { + newPOS = StringSplit( oldPOS, word, WORDMAXLEN ); + StringStrip( word, value); + oldPOS = newPOS; - do - { - newPOS = StringSplit( oldPOS, word, WORDMAXLEN ); - StringStrip( word, value); - oldPOS = newPOS; - - if( DEBUG ) - { - printf( "value=%s\n", value ); - fflush( stdout ); - } - switch( count ) - { - case 0: - /* IP Voltage */ - dstate_setinfo("input.voltage", "%s", value ); - break; - case 1: - /* IP Fault Voltage */ - break; - case 2: - /* OP Voltage */ - dstate_setinfo("output.voltage", "%s", value); - break; - case 3: - /* OP Load*/ - dstate_setinfo("ups.load", "%s", value ); - break; - case 4: - /* IP Frequency */ - dstate_setinfo("input.frequency", "%s", value); - break; - case 5: - /* Battery Cell Voltage */ - dstate_setinfo("battery.voltage", "%s", value); - break; - case 6: - /* UPS Temperature */ - dstate_setinfo("ups.temperature", "%s", value ); - break; - case 7: - /* Flags */ - parseFlags( value ); - break; - default: - /* Should never be reached */ - break; - } - count ++; - oldPOS = newPOS; - } - while( newPOS != NULL ); + if( DEBUG ) + { + printf( "value=%s\n", value ); + fflush( stdout ); + } + switch( count ) + { + case 0: + /* IP Voltage */ + dstate_setinfo("input.voltage", "%s", value ); + break; + case 1: + /* IP Fault Voltage */ + break; + case 2: + /* OP Voltage */ + dstate_setinfo("output.voltage", "%s", value); + break; + case 3: + /* OP Load*/ + dstate_setinfo("ups.load", "%s", value ); + break; + case 4: + /* IP Frequency */ + dstate_setinfo("input.frequency", "%s", value); + break; + case 5: + /* Battery Cell Voltage */ + dstate_setinfo("battery.voltage", "%s", value); + break; + case 6: + /* UPS Temperature */ + dstate_setinfo("ups.temperature", "%s", value ); + break; + case 7: + /* Flags */ + parseFlags( value ); + break; + default: + /* Should never be reached */ + break; + } + count ++; + oldPOS = newPOS; + } + while( newPOS != NULL ); } /******************************************************************** * * Function parses the response of the query3 ( "Q3" ) command. * Also sets various values (IPFreq ... ) - * + * ********************************************************************/ static void query3( char *buf ) { - #define WORDMAXLEN 255 - char value[WORDMAXLEN]; - char word[WORDMAXLEN]; - char *newPOS; - char *oldPOS; - int count = 0; + #define WORDMAXLEN 255 + char value[WORDMAXLEN]; + char word[WORDMAXLEN]; + char *newPOS; + char *oldPOS; + int count = 0; - if( DEBUG ) - printf( "Q3 Buffer is : %s\n" , buf+1 ); - oldPOS = buf + 1; - newPOS = oldPOS; + if( DEBUG ) + printf( "Q3 Buffer is : %s\n" , buf+1 ); + oldPOS = buf + 1; + newPOS = oldPOS; + + do + { + newPOS = StringSplit( oldPOS, word, WORDMAXLEN ); + StringStrip( word, value); + oldPOS = newPOS; - do - { - newPOS = StringSplit( oldPOS, word, WORDMAXLEN ); - StringStrip( word, value); - oldPOS = newPOS; + /* Shortcut */ + if( newPOS == NULL ) + break; - /* Shortcut */ - if( newPOS == NULL ) - break; - - if( DEBUG ) - { - printf( "value=%s\n", value ); - fflush( stdout ); - } - switch( count ) - { - case 0: - /* UPS ID */ - break; - case 1: - /* Input Voltage */ - dstate_setinfo("input.voltage", "%s", value ); - break; - case 2: - /* Input Fault Voltage */ - break; - case 3: - /* Output Voltage */ - dstate_setinfo("output.voltage", "%s", value); - break; - case 4: - /* Output Current */ - dstate_setinfo("output.current", "%s", value ); - break; - case 5: - /* Input Frequency */ - dstate_setinfo("input.frequency", "%s", value); - break; - case 6: - /* Battery Cell Voltage */ - dstate_setinfo("battery.voltage", "%s", value); - break; - case 7: - /* Temperature */ - dstate_setinfo("ups.temperature", "%s", value ); - break; - case 8: - /* Estimated Runtime */ - dstate_setinfo("battery.runtime", "%s", value); - break; - case 9: - /* Charge Status */ - dstate_setinfo("battery.charge", "%s", value); - break; - case 10: - /* Flags */ - parseFlags( value ); - break; - case 11: - /* Flags2 */ - break; - default: - /* This should never be reached */ - /* printf( "DEFAULT\n" ); */ - break; - } - count ++; - oldPOS = newPOS; - } - while( newPOS != NULL ); + if( DEBUG ) + { + printf( "value=%s\n", value ); + fflush( stdout ); + } + switch( count ) + { + case 0: + /* UPS ID */ + break; + case 1: + /* Input Voltage */ + dstate_setinfo("input.voltage", "%s", value ); + break; + case 2: + /* Input Fault Voltage */ + break; + case 3: + /* Output Voltage */ + dstate_setinfo("output.voltage", "%s", value); + break; + case 4: + /* Output Current */ + dstate_setinfo("output.current", "%s", value ); + break; + case 5: + /* Input Frequency */ + dstate_setinfo("input.frequency", "%s", value); + break; + case 6: + /* Battery Cell Voltage */ + dstate_setinfo("battery.voltage", "%s", value); + break; + case 7: + /* Temperature */ + dstate_setinfo("ups.temperature", "%s", value ); + break; + case 8: + /* Estimated Runtime */ + dstate_setinfo("battery.runtime", "%s", value); + break; + case 9: + /* Charge Status */ + dstate_setinfo("battery.charge", "%s", value); + break; + case 10: + /* Flags */ + parseFlags( value ); + break; + case 11: + /* Flags2 */ + break; + default: + /* This should never be reached */ + /* printf( "DEFAULT\n" ); */ + break; + } + count ++; + oldPOS = newPOS; + } + while( newPOS != NULL ); } /******************************************************************** * * Function to parse the WhoAmI response of the UPS. Also sets the * values of the firmware version and the UPS identification. - * + * ********************************************************************/ static void parseWH( char *buf ) { - strncpy( name, buf + 16, 30 ); - name[30] = '\0'; - strncpy( firmware, buf + 4, 5 ); - firmware[5] = '\0'; - if( DEBUG ) - printf( "Name = %s, Firmware Version = %s\n", name, firmware ); + strncpy( name, buf + 16, 30 ); + name[30] = '\0'; + strncpy( firmware, buf + 4, 5 ); + firmware[5] = '\0'; + if( DEBUG ) + printf( "Name = %s, Firmware Version = %s\n", name, firmware ); } /******************************************************************** - * + * * Function to parse the old and possible broken WhoAmI response * and set the values for the firmware Version and the identification * of the UPS. @@ -347,97 +353,97 @@ static void parseWH( char *buf ) ********************************************************************/ static void parseOldWH( char *buf ) { - strncpy( name, buf + 4, 12 ); - name[12] = '\0'; - strncpy( firmware, buf, 4 ); - firmware[4] = '\0'; - if( DEBUG ) - printf( "Name = %s, Firmware Version = %s\n", name, firmware ); + strncpy( name, buf + 4, 12 ); + name[12] = '\0'; + strncpy( firmware, buf, 4 ); + firmware[4] = '\0'; + if( DEBUG ) + printf( "Name = %s, Firmware Version = %s\n", name, firmware ); } /******************************************************************** * * Function to fake a WhoAmI response of a UPS that returns NAK. - * + * ********************************************************************/ static void fakeWH(void) { - strcpy( name, "GenericUPS" ); - strcpy( firmware, "unkn" ); - if( DEBUG ) - printf( "Name = %s, Firmware Version = %s\n", name, firmware ); + strcpy( name, "GenericUPS" ); + strcpy( firmware, "unkn" ); + if( DEBUG ) + printf( "Name = %s, Firmware Version = %s\n", name, firmware ); } -static ssize_t ups_ident( void ) +static int ups_ident( void ) { - char buf[255]; - ssize_t ret; + char buf[255]; + int ret; - /* Check presence of Q1 */ - ret = ser_send_pace(upsfd, UPS_PACE, "%s", "Q1\x0D" ); - ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); - ret = (ssize_t)strlen( buf ); - if( ret != 46 ) - { - /* No Q1 response found */ - type = 0; - return -1; - } - else - { - if( DEBUG ) - printf( "Found Q1\n" ); - type = Q1; - } + /* Check presence of Q1 */ + ret = ser_send_pace(upsfd, UPS_PACE, "%s", "Q1\x0D" ); + ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); + ret = strlen( buf ); + if( ret != 46 ) + { + /* No Q1 response found */ + type = 0; + return -1; + } + else + { + if( DEBUG ) + printf( "Found Q1\n" ); + type = Q1; + } - /* Check presence of Q3 */ - ret = ser_send_pace(upsfd, UPS_PACE, "%s", "Q3\x0D" ); - ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); - ret = (ssize_t)strlen( buf ); - if( ret == 70 ) - { - if( DEBUG ) - printf( "Found Q3\n" ); - type = Q1 | Q3; - } - - /* Check presence of WH ( Who am I ) */ - ret = ser_send_pace(upsfd, UPS_PACE, "%s", "WH\x0D" ); - ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); - ret = (ssize_t)strlen( buf ); - if( ret == 112 ) - { - if( DEBUG ) - printf( "WH found\n" ); - parseWH( buf ); - } - else if( ret == 53 ) - { - if( DEBUG ) - printf( "Old (broken) WH found\n" ); - parseOldWH( buf ); - } - else if( ret == 3 && strcmp(buf, "NAK") == 0 ) - { - if( DEBUG ) - printf( "WH was NAKed\n" ); - fakeWH( ); - } - else if( ret > 0 ) - { - if( DEBUG ) - printf( "WH says <%s> with length %zi\n", buf, ret ); - upslog_with_errno( LOG_INFO, - "New WH String found. Please report to maintainer\n" ); - } - return 1; -} + /* Check presence of Q3 */ + ret = ser_send_pace(upsfd, UPS_PACE, "%s", "Q3\x0D" ); + ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); + ret = strlen( buf ); + if( ret == 70 ) + { + if( DEBUG ) + printf( "Found Q3\n" ); + type = Q1 | Q3; + } + + /* Check presence of WH ( Who am I ) */ + ret = ser_send_pace(upsfd, UPS_PACE, "%s", "WH\x0D" ); + ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); + ret = strlen( buf ); + if( ret == 112 ) + { + if( DEBUG ) + printf( "WH found\n" ); + parseWH( buf ); + } + else if( ret == 53 ) + { + if( DEBUG ) + printf( "Old (broken) WH found\n" ); + parseOldWH( buf ); + } + else if( ret == 3 && strcmp(buf, "NAK") == 0 ) + { + if( DEBUG ) + printf( "WH was NAKed\n" ); + fakeWH( ); + } + else if( ret > 0 ) + { + if( DEBUG ) + printf( "WH says <%s> with length %i\n", buf, ret ); + upslog_with_errno( LOG_INFO, + "New WH String found. Please report to maintainer\n" ); + } + return 1; +} /******************************************************************** * - * - * - * + * + * + * ********************************************************************/ void upsdrv_help( void ) { @@ -447,92 +453,92 @@ void upsdrv_help( void ) /******************************************************************** * * Function to initialize the fields of the ups driver. - * + * ********************************************************************/ void upsdrv_initinfo(void) { dstate_setinfo("ups.mfr", "MASTERGUARD"); dstate_setinfo("ups.model", "unknown"); - + /* dstate_addcmd("test.battery.stop"); dstate_addcmd("test.battery.start"); */ if( strlen( name ) > 0 ) - dstate_setinfo("ups.model", "%s", name); + dstate_setinfo("ups.model", "%s", name); if( strlen( firmware ) > 0 ) - dstate_setinfo("ups.firmware", "%s", firmware); + dstate_setinfo("ups.firmware", "%s", firmware); } /******************************************************************** * - * This is the main function. It gets called if the driver wants - * to update the ups status and the information. - * + * This is the main function. It gets called if the driver wants + * to update the ups status and the informations. + * ********************************************************************/ void upsdrv_updateinfo(void) { - char buf[255]; - ssize_t ret; - int lenRSP=0; + char buf[255]; + int ret; + int lenRSP=0; - if( DEBUG ) - printf( "update info\n" ); + if( DEBUG ) + printf( "update info\n" ); - /* Q3 found ? */ - if( type & Q3 ) - { - ser_send_pace(upsfd, UPS_PACE, "%s", "Q3\x0D" ); - lenRSP = 70; - } - /* Q1 found ? */ - else if( type & Q1 ) - { - ser_send_pace(upsfd, UPS_PACE, "%s", "Q1\x0D" ); - lenRSP = 46; - } - /* Should never be reached */ - else - { - fatalx(EXIT_FAILURE, "Error, no Query mode defined. Please file bug against driver."); - } + /* Q3 found ? */ + if( type & Q3 ) + { + ser_send_pace(upsfd, UPS_PACE, "%s", "Q3\x0D" ); + lenRSP = 70; + } + /* Q1 found ? */ + else if( type & Q1 ) + { + ser_send_pace(upsfd, UPS_PACE, "%s", "Q1\x0D" ); + lenRSP = 46; + } + /* Should never be reached */ + else + { + fatalx(EXIT_FAILURE, "Error, no Query mode defined. Please file bug against driver."); + } - sleep( UPSDELAY ); + sleep( UPSDELAY ); - buf[0] = '\0'; - ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); - ret = (ssize_t)strlen( buf ); + buf[0] = '\0'; + ret = ser_get_line(upsfd, buf, sizeof(buf), '\r', "", 3, 0); + ret = strlen( buf ); - if( ret != lenRSP ) - { - if( DEBUG ) - printf( "buf = %s len = %zi\n", buf, ret ); - upslog_with_errno( LOG_ERR, "Error in UPS response " ); - dstate_datastale(); - return; - } + if( ret != lenRSP ) + { + if( DEBUG ) + printf( "buf = %s len = %i\n", buf, ret ); + upslog_with_errno( LOG_ERR, "Error in UPS response " ); + dstate_datastale(); + return; + } - /* Parse the response from the UPS */ - if( type & Q3 ) - { - query3( buf ); - dstate_dataok(); - return; - } - if( type & Q1 ) - { - query1( buf ); - dstate_dataok(); - return; - } + /* Parse the response from the UPS */ + if( type & Q3 ) + { + query3( buf ); + dstate_dataok(); + return; + } + if( type & Q1 ) + { + query1( buf ); + dstate_dataok(); + return; + } } /******************************************************************** * * Called if the driver wants to shutdown the UPS. * ( also used by the "-k" command line switch ) - * + * * This cuts the utility from the UPS after 20 seconds and restores * the utility one minute _after_ the utility to the UPS has restored * @@ -540,79 +546,80 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { /* ups will come up within a minute if utility is restored */ - ser_send_pace(upsfd, UPS_PACE, "%s", "S.2R0001\x0D" ); + ser_send_pace(upsfd, UPS_PACE, "%s", "S.2R0001\x0D" ); } /******************************************************************** * * Populate the command line switches. - * + * * CS: Cancel the shutdown process - * + * ********************************************************************/ void upsdrv_makevartable(void) { - addvar( VAR_FLAG, "CS", "Cancel Shutdown" ); + addvar( VAR_FLAG, "CS", "Cancel Shutdown" ); } /******************************************************************** * * This is the first function called by the UPS driver. * Detects the UPS and handles the command line args. - * + * ********************************************************************/ void upsdrv_initups(void) { - int count = 0; - int fail = 0; - int good = 0; - - upsdebugx(0, - "Please note that this driver is deprecated and will not receive\n" - "new development. If it works for managing your devices - fine,\n" - "but if you are running it to try setting up a new device, please\n" - "consider the newer nutdrv_qx instead, which should handle all 'Qx'\n" - "protocol variants for NUT. (Please also report if your device works\n" - "with this driver, but nutdrv_qx would not actually support it with\n" - "any subdriver!)\n"); - + int count = 0; + int fail = 0; + int good = 0; + /* setup serial port */ - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B2400); + upsfd = ser_open(device_path); + ser_set_speed(upsfd, device_path, B2400); - name[0] = '\0'; - firmware[0] = '\0'; + name[0] = '\0'; + firmware[0] = '\0'; /* probe ups type */ - do - { - count++; + do + { + count++; - if( ups_ident( ) != 1 ) - fail++; - /* at least two good identifications */ - if( (count - fail) == 2 ) - { - good = 1; - break; - } - } while( (count=0 per check above */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -/* Note for gating macros above: unsuffixed HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - * means support of contexts both inside and outside function body, so the push - * above and pop below (outside this finction) are not used. - */ -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -/* Note that the individual warning pragmas for use inside function bodies - * are named without a _INSIDEFUNC suffix, for simplicity and legacy reasons - */ -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if (res < 7 || (unsigned long long int)res >= SIZE_MAX) -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - fatal_with_errno(EXIT_FAILURE, "Could not communicate with the ups"); - memcpy(serial, my_answer + 7, (size_t)(res - 7)); + break; + } + + /* Get the serial number */ + memcpy(serial, my_answer + 7, res - 7); /* serial number start from the 8th byte */ - serial[12]='\0'; /* terminate string */ + serial[12]=0; /* terminate string */ dstate_setinfo("ups.serial", "%s", serial); - + /* get the ups firmware. The major number is in the 5th byte, the minor is in the 6th */ dstate_setinfo("ups.firmware", "%u.%u", my_answer[5], my_answer[6]); - printf("Detected %s [%s] v.%s on %s\n", - dstate_getinfo("ups.model"), dstate_getinfo("ups.serial"), - dstate_getinfo("ups.firmware"), device_path); - + printf("Detected %s [%s] v.%s on %s\n", dstate_getinfo("ups.model"), dstate_getinfo("ups.serial"), dstate_getinfo("ups.firmware"), device_path); + /* Add instant commands */ dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); @@ -615,21 +563,17 @@ void upsdrv_initinfo(void) upsh.instcmd = instcmd; return; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif void upsdrv_updateinfo(void) { - int res; - uint16_t int_num; + int res, int_num; #ifdef EXTRADATA int day, hour, minute; #endif float float_num; - uint32_t long_num; + long int long_num; unsigned char my_answer[255]; - + /* GET Output data */ res = command_read_sequence(UPS_OUTPUT_DATA, my_answer); if (res < 0) { @@ -643,36 +587,36 @@ void upsdrv_updateinfo(void) dstate_setinfo("ups.load", "%2.1f", float_num); } else { dstate_setinfo("ups.load", "%s", "not available"); - } + } #ifdef EXTRADATA - dstate_setinfo("output.power", "%u", int_num); + dstate_setinfo("output.power", "%d", int_num); #endif /* voltage */ int_num = get_word(&my_answer[3]); - if ((int16_t)int_num > 0) dstate_setinfo("output.voltage", "%u", int_num); - if ((int16_t)int_num == -1) dstate_setinfo("output.voltage", "%s", "overrange"); - if ((int16_t)int_num == -2) dstate_setinfo("output.voltage", "%s", "not available"); + if (int_num > 0) dstate_setinfo("output.voltage", "%d", int_num); + if (int_num == -1) dstate_setinfo("output.voltage", "%s", "overrange"); + if (int_num == -2) dstate_setinfo("output.voltage", "%s", "not available"); /* current */ - float_num = get_word_float(&my_answer[5]); - if (f_equal(float_num, -1.0)) dstate_setinfo("output.current", "%s", "overrange"); - if (f_equal(float_num, -2.0)) dstate_setinfo("output.current", "%s", "not available"); + float_num = get_word(&my_answer[5]); + if (float_num == -1) dstate_setinfo("output.current", "%s", "overrange"); + if (float_num == -2) dstate_setinfo("output.current", "%s", "not available"); if (float_num > 0) { float_num = (float)(float_num/10); dstate_setinfo("output.current", "%2.2f", float_num); } #ifdef EXTRADATA /* peak current */ - float_num = get_word_float(&my_answer[7]); - if (f_equal(float_num, -1.0)) dstate_setinfo("output.current.peak", "%s", "overrange"); - if (f_equal(float_num, -2.0)) dstate_setinfo("output.current.peak", "%s", "not available"); + float_num = get_word(&my_answer[7]); + if (float_num == -1) dstate_setinfo("output.current.peak", "%s", "overrange"); + if (float_num == -2) dstate_setinfo("output.current.peak", "%s", "not available"); if (float_num > 0) { float_num = (float)(float_num/10); dstate_setinfo("output.current.peak", "%2.2f", float_num); } - + #endif } - + /* GET Input data */ res = command_read_sequence(UPS_INPUT_DATA, my_answer); if (res < 0){ @@ -682,18 +626,18 @@ void upsdrv_updateinfo(void) #ifdef EXTRADATA /* Active power */ int_num = get_word(&my_answer[1]); - if ((int16_t)int_num > 0) dstate_setinfo("input.power", "%u", int_num); - if ((int16_t)int_num == -1) dstate_setinfo("input.power", "%s", "overrange"); - if ((int16_t)int_num == -2) dstate_setinfo("input.power", "%s", "not available"); + if (int_num > 0) dstate_setinfo("input.power", "%d", int_num); + if (int_num == -1) dstate_setinfo("input.power", "%s", "overrange"); + if (int_num == -2) dstate_setinfo("input.power", "%s", "not available"); #endif /* voltage */ int_num = get_word(&my_answer[3]); - if ((int16_t)int_num > 0) dstate_setinfo("input.voltage", "%u", int_num); - if ((int16_t)int_num == -1) dstate_setinfo("input.voltage", "%s", "overrange"); - if ((int16_t)int_num == -2) dstate_setinfo("input.voltage", "%s", "not available"); + if (int_num > 0) dstate_setinfo("input.voltage", "%d", int_num); + if (int_num == -1) dstate_setinfo("input.voltage", "%s", "overrange"); + if (int_num == -2) dstate_setinfo("input.voltage", "%s", "not available"); #ifdef EXTRADATA /* current */ - float_num = get_word_float(&my_answer[5]); + float_num = get_word(&my_answer[5]); if (float_num == -1) dstate_setinfo("input.current", "%s", "overrange"); if (float_num == -2) dstate_setinfo("input.current", "%s", "not available"); if (float_num > 0) { @@ -701,7 +645,7 @@ void upsdrv_updateinfo(void) dstate_setinfo("input.current", "%2.2f", float_num); } /* peak current */ - float_num = get_word_float(&my_answer[7]); + float_num = get_word(&my_answer[7]); if (float_num == -1) dstate_setinfo("input.current.peak", "%s", "overrange"); if (float_num == -2) dstate_setinfo("input.current.peak", "%s", "not available"); if (float_num > 0) { @@ -710,8 +654,8 @@ void upsdrv_updateinfo(void) } #endif } - - + + /* GET Battery data */ res = command_read_sequence(UPS_BATTERY_DATA, my_answer); if (res < 0) { @@ -719,21 +663,21 @@ void upsdrv_updateinfo(void) dstate_datastale(); } else { /* Actual value */ - float_num = get_word_float(&my_answer[1]); + float_num = get_word(&my_answer[1]); float_num = (float)(float_num/10); dstate_setinfo("battery.voltage", "%2.2f", float_num); #ifdef EXTRADATA /* reserve threshold */ - float_num = get_word_float(&my_answer[3]); + float_num = get_word(&my_answer[3]); float_num = (float)(float_num/10); dstate_setinfo("battery.voltage.low", "%2.2f", float_num); /* exhaust threshold */ - float_num = get_word_float(&my_answer[5]); + float_num = get_word(&my_answer[5]); float_num = (float)(float_num/10); dstate_setinfo("battery.voltage.exhaust", "%2.2f", float_num); #endif } - + #ifdef EXTRADATA /* GET history data */ res = command_read_sequence(UPS_HISTORY_DATA, my_answer); @@ -749,8 +693,8 @@ void upsdrv_updateinfo(void) long_num -= (long)(hour*3600); minute = (int)(long_num / 60); long_num -= (minute*60); - dstate_setinfo("ups.total.runtime", "%d days %dh %dm %lus", day, hour, minute, long_num); - + dstate_setinfo("ups.total.runtime", "%d days %dh %dm %lds", day, hour, minute, long_num); + /* ups inverter runtime */ long_num = get_long(&my_answer[5]); day = (int)(long_num / 86400); @@ -759,22 +703,22 @@ void upsdrv_updateinfo(void) long_num -= (long)(hour*3600); minute = (int)(long_num / 60); long_num -= (minute*60); - dstate_setinfo("ups.inverter.runtime", "%d days %dh %dm %lus", day, hour, minute, long_num); + dstate_setinfo("ups.inverter.runtime", "%d days %dh %dm %lds", day, hour, minute, long_num); /* ups inverter interventions */ - dstate_setinfo("ups.inverter.interventions", "%u", get_word(&my_answer[9])); + dstate_setinfo("ups.inverter.interventions", "%d", get_word(&my_answer[9])); /* battery full discharges */ - dstate_setinfo("battery.full.discharges", "%u", get_word(&my_answer[11])); + dstate_setinfo("battery.full.discharges", "%d", get_word(&my_answer[11])); /* ups bypass / stabilizer interventions */ int_num = get_word(&my_answer[13]); - if ((int16_t)int_num == -2) dstate_setinfo("ups.bypass.interventions", "%s", "not avaliable"); - if ((int16_t)int_num >= 0) dstate_setinfo("ups.bypass.interventions", "%u", int_num); + if (int_num == -2) dstate_setinfo("ups.bypass.interventions", "%s", "not avaliable"); + if (int_num >= 0) dstate_setinfo("ups.bypass.interventions", "%d", int_num); /* ups overheatings */ int_num = get_word(&my_answer[15]); - if ((int16_t)int_num == -2) dstate_setinfo("ups.overheatings", "%s", "not avalilable"); - if ((int16_t)int_num >= 0) dstate_setinfo("ups.overheatings", "%u", int_num); + if (int_num == -2) dstate_setinfo("ups.overheatings", "%s", "not avalilable"); + if (int_num >= 0) dstate_setinfo("ups.overheatings", "%d", int_num); } #endif - + /* GET times on battery */ res = command_read_sequence(UPS_GET_TIMES_ON_BATTERY, my_answer); if (res < 0) { @@ -783,8 +727,8 @@ void upsdrv_updateinfo(void) } else { autorestart = my_answer[5]; } - - + + /* GET schedule */ res = command_read_sequence(UPS_GET_SCHEDULING, my_answer); if (res < 0) { @@ -793,21 +737,21 @@ void upsdrv_updateinfo(void) } else { /* time remaining to shutdown */ long_num = get_long(&my_answer[1]); - if ((int32_t)long_num == -1) { - dstate_setinfo("ups.delay.shutdown", "%d", 120); + if (long_num == -1) { + dstate_setinfo("ups.delay.shutdown", "%d", 120); } else { - dstate_setinfo("ups.delay.shutdown", "%lu", (unsigned long)long_num); + dstate_setinfo("ups.delay.shutdown", "%ld", long_num); } /* time remaining to restart */ long_num = get_long(&my_answer[5]); - if ((int32_t)long_num == -1) { - dstate_setinfo("ups.delay.start", "%d", 0); + if (long_num == -1) { + dstate_setinfo("ups.delay.start", "%d", 0); } else { - dstate_setinfo("ups.delay.start", "%lu", (unsigned long)long_num); - } + dstate_setinfo("ups.delay.start", "%ld", long_num); + } } - - + + /* GET ups status */ res = command_read_sequence(UPS_STATUS, my_answer); if (res < 0) { @@ -820,7 +764,7 @@ void upsdrv_updateinfo(void) dstate_setinfo("ups.temperature", "%d", my_answer[3]); } else { dstate_setinfo("ups.temperature", "%s", "not available"); - } + } /* Status */ status_init(); switch (my_answer[1]) { /* byte 1 = STATUS */ @@ -840,7 +784,7 @@ void upsdrv_updateinfo(void) default: printf("status unknown \n"); break; - } + } switch (my_answer[2]) { /* byte 2 = FAULTS */ case 0x00: /* all right */ break; @@ -871,22 +815,22 @@ void upsdrv_shutdown(void) unsigned char command[10], answer[10]; /* Ensure that the ups is configured for automatically - restart after a complete battery discharge + restart after a complete battery discharge and when the power comes back after a shutdown */ if (! autorestart) { command[0]=UPS_SET_TIMES_ON_BATTERY; - command[1]=0x00; /* max time on */ + command[1]=0x00; /* max time on */ command[2]=0x00; /* battery */ - + command[3]=0x00; /* max time after */ command[4]=0x00; /* battery reserve */ - + command[5]=0x01; /* autorestart after battery depleted enabled */ command_write_sequence(command, 6, answer); } /* shedule a shutdown in 120 seconds */ - command[0]=UPS_SET_SCHEDULING; + command[0]=UPS_SET_SCHEDULING; command[1]=0x96; /* remaining */ command[2]=0x00; /* time */ command[3]=0x00; /* to */ @@ -932,7 +876,7 @@ static int instcmd(const char *cmdname, const char *extra) /* Same stuff as upsdrv_shutdown() */ if (! autorestart) { command[0]=UPS_SET_TIMES_ON_BATTERY; - command[1]=0x00; /* max time on */ + command[1]=0x00; /* max time on */ command[2]=0x00; /* battery */ command[3]=0x00; /* max time after */ command[4]=0x00; /* battery reserve */ @@ -940,7 +884,7 @@ static int instcmd(const char *cmdname, const char *extra) command_write_sequence(command, 6, answer); } /* shedule a shutdown in 30 seconds */ - command[0]=UPS_SET_SCHEDULING; + command[0]=UPS_SET_SCHEDULING; command[1]=0x1e; /* remaining */ command[2]=0x00; /* time */ command[3]=0x00; /* to */ @@ -956,12 +900,12 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "shutdown.stayoff")) { /* shedule a shutdown in 30 seconds with no restart (-1) */ - command[0]=UPS_SET_SCHEDULING; + command[0]=UPS_SET_SCHEDULING; command[1]=0x1e; /* remaining */ command[2]=0x00; /* time */ command[3]=0x00; /* to */ command[4]=0x00; /* shutdown 150 secs */ - + command[5]=0xff; /* programmed */ command[6]=0xff; /* time */ command[7]=0xff; /* to */ @@ -972,12 +916,12 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "shutdown.stop")) { /* set shutdown and restart time to -1 (no shutdown, no restart) */ - command[0]=UPS_SET_SCHEDULING; + command[0]=UPS_SET_SCHEDULING; command[1]=0xff; /* remaining */ command[2]=0xff; /* time */ command[3]=0xff; /* to */ command[4]=0xff; /* shutdown -1 (no shutdown) */ - + command[5]=0xff; /* programmed */ command[6]=0xff; /* time */ command[7]=0xff; /* to */ @@ -988,8 +932,8 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "test.failure.start")) { /* force ups on battery power */ - command[0]=UPS_SET_BATTERY_TEST; - command[1]=0x01; + command[0]=UPS_SET_BATTERY_TEST; + command[1]=0x01; /* 0 = perform battery test 1 = force UPS on battery power 2 = restore standard mode (mains power) */ @@ -1000,7 +944,7 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "test.failure.stop")) { /* restore standard mode (mains power) */ command[0]=UPS_SET_BATTERY_TEST; - command[1]=0x02; + command[1]=0x02; /* 0 = perform battery test 1 = force UPS on battery power 2 = restore standard mode (mains power) */ @@ -1010,8 +954,8 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "test.battery.start")) { /* launch battery test */ - command[0]=UPS_SET_BATTERY_TEST; - command[1]=0x00; + command[0]=UPS_SET_BATTERY_TEST; + command[1]=0x00; /* 0 = perform battery test 1 = force UPS on battery power 2 = restore standard mode (mains power) */ @@ -1022,22 +966,22 @@ static int instcmd(const char *cmdname, const char *extra) case 0x00: /* all right */ dstate_setinfo("ups.test.result", "OK"); break; - case 0x01: + case 0x01: dstate_setinfo("ups.test.result", "Battery charge: 20%%"); break; - case 0x02: + case 0x02: dstate_setinfo("ups.test.result", "Battery charge: 40%%"); break; - case 0x03: + case 0x03: dstate_setinfo("ups.test.result", "Battery charge: 60%%"); break; - case 0x04: + case 0x04: dstate_setinfo("ups.test.result", "Battery charge: 80%%"); break; - case 0x05: + case 0x05: dstate_setinfo("ups.test.result", "Battery charge: 100%%"); break; - case 0xfe: + case 0xfe: dstate_setinfo("ups.test.result", "Bad battery pack: replace"); break; default: @@ -1052,8 +996,8 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "beeper.enable")) { /* set buzzer to not muted */ - command[0]=UPS_SET_BUZZER_MUTE; - command[1]=0x00; + command[0]=UPS_SET_BUZZER_MUTE; + command[1]=0x00; /* 0 = not muted 1 = muted 2 = read current status */ @@ -1063,8 +1007,8 @@ static int instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "beeper.mute")) { /* set buzzer to muted */ - command[0]=UPS_SET_BUZZER_MUTE; - command[1]=0x01; + command[0]=UPS_SET_BUZZER_MUTE; + command[1]=0x01; /* 0 = not muted 1 = muted 2 = read current status */ @@ -1072,7 +1016,7 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -1094,12 +1038,12 @@ void upsdrv_makevartable(void) void upsdrv_initups(void) { - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B2400); + upsfd = ser_open(device_path); + ser_set_speed(upsfd, device_path, B2400); send_zeros(); } void upsdrv_cleanup(void) { - ser_close(upsfd, device_path); + ser_close(upsfd, device_path); } diff --git a/drivers/mge-hid.c b/drivers/mge-hid.c index 55d56cf..6383379 100644 --- a/drivers/mge-hid.c +++ b/drivers/mge-hid.c @@ -1,8 +1,7 @@ /* mge-hid.c - data to monitor Eaton / MGE HID (USB and serial) devices * - * Copyright (C) - * 2003 - 2015 Arnaud Quette - * 2015 - 2016 Eaton / Arnaud Quette + * Copyright (C) 2003 - 2012 + * Arnaud Quette * * Sponsored by MGE UPS SYSTEMS * @@ -36,9 +35,8 @@ #include "main.h" /* for getval() */ #include "usbhid-ups.h" #include "mge-hid.h" -#include "nut_float.h" -#define MGE_HID_VERSION "MGE HID 1.46" +#define MGE_HID_VERSION "MGE HID 1.32" /* (prev. MGE Office Protection Systems, prev. MGE UPS SYSTEMS) */ /* Eaton */ @@ -53,17 +51,6 @@ /* Hewlett Packard */ #define HP_VENDORID 0x03f0 -/* AEG */ -#define AEG_VENDORID 0x2b2d - -/* Note that normally this VID is handled by Liebert/Phoenixtec HID mapping, - * here it is just for for AEG PROTECT NAS devices: */ -/* Phoenixtec Power Co., Ltd */ -#define PHOENIXTEC 0x06da - -/* IBM */ -#define IBM_VENDORID 0x04b3 - #ifndef SHUT_MODE #include "usb-common.h" @@ -87,15 +74,8 @@ static usb_device_id_t mge_usb_device_table[] = { { USB_DEVICE(HP_VENDORID, 0x1fe7), NULL }, { USB_DEVICE(HP_VENDORID, 0x1fe8), NULL }, - /* PROTECT B / NAS */ - { USB_DEVICE(AEG_VENDORID, 0xffff), NULL }, - { USB_DEVICE(PHOENIXTEC, 0xffff), NULL }, - - /* 6000 VA LCD 4U Rack UPS; 5396-1Kx */ - { USB_DEVICE(IBM_VENDORID, 0x0001), NULL }, - /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; #endif @@ -118,12 +98,11 @@ typedef enum { MGE_PULSAR_M = 0x400, /* MGE Pulsar M series */ MGE_PULSAR_M_2200, MGE_PULSAR_M_3000, - MGE_PULSAR_M_3000_XL, - EATON_5P = 0x500 /* Eaton 5P / 5PX series */ + MGE_PULSAR_M_3000_XL } models_type_t; /* Default to line-interactive or online (ie, not offline). - * This is then overridden for offline, through mge_model_names */ + * This is then overriden for offline, through mge_model_names */ static models_type_t mge_type = MGE_DEFAULT; /* Countries definition, for region specific settings and features */ @@ -141,232 +120,14 @@ static int country_code = COUNTRY_UNKNOWN; static char mge_scratch_buf[20]; -/* ABM - Advanced Battery Monitoring - *********************************** - * Synthesis table - * HID data | Charger in ABM mode | Charger in Constant mode - * UPS.BatterySystem.Charger.ABMEnable | 1 | 0 - * UPS.PowerSummary.PresentStatus.ACPresent | On utility | On battery | On utility | On battery - * Charger ABM mode | Charging | Floating | Resting | Discharging | Disabled | Disabled - * UPS.BatterySystem.Charger.Mode | 1 | 3 | 4 | 2 | 6 | 6 - * UPS.PowerSummary.PresentStatus.Charging | 1 | 1 | 1 | 0 | 1 | 0 - * UPS.PowerSummary.PresentStatus.Discharging | 0 |  0 |  0 | 1 | 0 | 1 - * - * Notes (from David G. Miller) to understand ABM status: - * When supporting ABM, when a UPS powers up or returns from battery, or - * ends the ABM rest mode, it enters charge mode. - * Some UPSs run a different charger reference voltage during charge mode - * but all the newer models should not be doing that, but basically once - * the battery voltage reaches the charger reference level (should be 2.3 - * volts/cell), the charger is considered in float mode. Some UPSs will not - * annunciate float mode until the charger power starts falling from the maximum - * level indicating the battery is truly at the float voltage or in float mode. - * The %charge level is based on battery voltage and the charge mode timer - * (should be 48 hours) and some UPSs add in a value that's related to charger - * power output. So you can have UPS that enters float mode with anywhere - * from 80% or greater battery capacity. - * float mode is not important from the software's perspective, it's there to - * help determine if the charger is advancing correctly. - * So in float mode, the charger is charging the battery, so by definition you - * can assert the CHRG flag in NUT when in “float” mode or “charge” mode. - * When in “rest” mode the charger is not delivering anything to the battery, - * but it will when the ABM cycle(28 days) ends, or a battery discharge occurs - * and utility returns. This is when the ABM status should be “resting”. - * If a battery failure is detected that disables the charger, it should be - * reporting “off” in the ABM charger status. - * Of course when delivering load power from the battery, the ABM status is - * discharging. - */ - -#define ABM_UNKNOWN -1 -#define ABM_DISABLED 0 -#define ABM_ENABLED 1 - -/* Internal flag to process battery status (CHRG/DISCHRG) and ABM */ -static int advanced_battery_monitoring = ABM_UNKNOWN; - -/* Used to store internally if ABM is enabled or not */ -static const char *eaton_abm_enabled_fun(double value) -{ - advanced_battery_monitoring = value; - - upsdebugx(2, "ABM is %s", (advanced_battery_monitoring==1)?"enabled":"disabled"); - - /* Return NULL, not to get the value published! */ - return NULL; -} - -static info_lkp_t eaton_abm_enabled_info[] = { - { 0, "dummy", eaton_abm_enabled_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Note 1: This point will need more clarification! */ -# if 0 -/* Used to store internally if ABM is enabled or not (for legacy units) */ -static const char *eaton_abm_enabled_legacy_fun(double value) -{ - advanced_battery_monitoring = value; - - upsdebugx(2, "ABM is %s (legacy data)", (advanced_battery_monitoring==1)?"enabled":"disabled"); - - /* Return NULL, not to get the value published! */ - return NULL; -} - -static info_lkp_t eaton_abm_enabled_legacy_info[] = { - { 0, "dummy", eaton_abm_enabled_legacy_fun, NULL }, - { 0, NULL, NULL, NULL } -}; -#endif /* if 0 */ - -/* Used to process ABM flags, for battery.charger.status */ -static const char *eaton_abm_status_fun(double value) -{ - /* Don't process if ABM is disabled */ - if (advanced_battery_monitoring == ABM_DISABLED) { - /* Clear any previously published data, in case - * the user has switched off ABM */ - dstate_delinfo("battery.charger.status"); - return NULL; - } - - upsdebugx(2, "ABM numeric status: %i", (int)value); - - switch ((long)value) - { - case 1: - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "charging"); - break; - case 2: - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "discharging"); - break; - case 3: - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "floating"); - break; - case 4: - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "resting"); - break; - case 6: /* ABM Charger Disabled */ - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "off"); - break; - case 5: /* Undefined - ABM is not activated */ - default: - /* Return NULL, not to get the value published! */ - return NULL; - } - - upsdebugx(2, "ABM string status: %s", mge_scratch_buf); - - return mge_scratch_buf; -} - -static info_lkp_t eaton_abm_status_info[] = { - { 1, "dummy", eaton_abm_status_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Used to process ABM flags, for ups.status (CHRG/DISCHRG/RB) */ -static const char *eaton_abm_chrg_dischrg_fun(double value) -{ - /* Don't process if ABM is disabled */ - if (advanced_battery_monitoring == ABM_DISABLED) - return NULL; - - switch ((long)value) - { - case 1: /* charging status */ - case 3: /* floating status */ - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "chrg"); - break; - case 2: - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "dischrg"); - break; - case 6: /* ABM Charger Disabled */ - case 4: /* resting, nothing to publish! (?) */ - case 5: /* Undefined - ABM is not activated */ - default: - /* Return NULL, not to get the value published! */ - return NULL; - } - - upsdebugx(2, "ABM CHRG/DISCHRG legacy string status (ups.status): %s", mge_scratch_buf); - - return mge_scratch_buf; -} - -static info_lkp_t eaton_abm_chrg_dischrg_info[] = { - { 1, "dummy", eaton_abm_chrg_dischrg_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* ABM also implies that standard CHRG/DISCHRG are processed according - * to weither ABM is enabled or not... - * If ABM is disabled, we publish these legacy status - * Otherwise, we don't publish on ups.status, but only battery.charger.status */ -/* FIXME: we may prefer to publish the CHRG/DISCHRG status - * on battery.charger.status?! */ -static const char *eaton_abm_check_dischrg_fun(double value) -{ - if (advanced_battery_monitoring == ABM_DISABLED) - { - if (d_equal(value, 1)) { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "dischrg"); - } - else { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "!dischrg"); - } - } - else { - /* Else, ABM is enabled, we should return NULL, - * not to get the value published! - * However, clear flags that would persist in case of prior - * publication in ABM-disabled mode */ - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "!dischrg"); - } - return mge_scratch_buf; -} - -static info_lkp_t eaton_discharging_info[] = { - { 1, "dummy", eaton_abm_check_dischrg_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static const char *eaton_abm_check_chrg_fun(double value) -{ - if (advanced_battery_monitoring == ABM_DISABLED) - { - if (d_equal(value, 1)) { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "chrg"); - } - else { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "!chrg"); - } - } - else { - /* Else, ABM is enabled, we should return NULL, - * not to get the value published! - * However, clear flags that would persist in case of prior - * publication in ABM-disabled mode */ - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", "!chrg"); - } - return mge_scratch_buf; -} - -static info_lkp_t eaton_charging_info[] = { - { 1, "dummy", eaton_abm_check_chrg_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - /* The HID path 'UPS.PowerSummary.Time' reports Unix time (ie the number of * seconds since 1970-01-01 00:00:00. This has to be split between ups.date and * ups.time */ static const char *mge_date_conversion_fun(double value) { time_t sec = value; - struct tm tmbuf; - if (strftime(mge_scratch_buf, sizeof(mge_scratch_buf), "%Y/%m/%d", localtime_r(&sec, &tmbuf)) == 10) { + if (strftime(mge_scratch_buf, sizeof(mge_scratch_buf), "%Y/%m/%d", localtime(&sec)) == 10) { return mge_scratch_buf; } @@ -377,9 +138,8 @@ static const char *mge_date_conversion_fun(double value) static const char *mge_time_conversion_fun(double value) { time_t sec = value; - struct tm tmbuf; - if (strftime(mge_scratch_buf, sizeof(mge_scratch_buf), "%H:%M:%S", localtime_r(&sec, &tmbuf)) == 8) { + if (strftime(mge_scratch_buf, sizeof(mge_scratch_buf), "%H:%M:%S", localtime(&sec)) == 8) { return mge_scratch_buf; } @@ -421,23 +181,19 @@ static double mge_time_conversion_nuf(const char *value) } static info_lkp_t mge_date_conversion[] = { - { 0, NULL, mge_date_conversion_fun, mge_date_conversion_nuf }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_date_conversion_fun, mge_date_conversion_nuf } }; static info_lkp_t mge_time_conversion[] = { - { 0, NULL, mge_time_conversion_fun, mge_time_conversion_nuf }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_time_conversion_fun, mge_time_conversion_nuf } }; #else static info_lkp_t mge_date_conversion[] = { - { 0, NULL, mge_date_conversion_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_date_conversion_fun, NULL } }; static info_lkp_t mge_time_conversion[] = { - { 0, NULL, mge_time_conversion_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_time_conversion_fun, NULL } }; #endif /* HAVE_STRPTIME */ @@ -455,7 +211,6 @@ static const char *mge_battery_voltage_nominal_fun(double value) break; case MGE_PULSAR_M: - case EATON_5P: break; default: @@ -467,8 +222,7 @@ static const char *mge_battery_voltage_nominal_fun(double value) } static info_lkp_t mge_battery_voltage_nominal[] = { - { 0, NULL, mge_battery_voltage_nominal_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_battery_voltage_nominal_fun } }; /* The HID path 'UPS.PowerSummary.Voltage' only reports @@ -480,7 +234,6 @@ static const char *mge_battery_voltage_fun(double value) { case MGE_EVOLUTION: case MGE_PULSAR_M: - case EATON_5P: break; default: @@ -492,8 +245,7 @@ static const char *mge_battery_voltage_fun(double value) } static info_lkp_t mge_battery_voltage[] = { - { 0, NULL, mge_battery_voltage_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_battery_voltage_fun } }; static const char *mge_powerfactor_conversion_fun(double value) @@ -503,8 +255,7 @@ static const char *mge_powerfactor_conversion_fun(double value) } static info_lkp_t mge_powerfactor_conversion[] = { - { 0, NULL, mge_powerfactor_conversion_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_powerfactor_conversion_fun } }; static const char *mge_battery_capacity_fun(double value) @@ -514,66 +265,65 @@ static const char *mge_battery_capacity_fun(double value) } static info_lkp_t mge_battery_capacity[] = { - { 0, NULL, mge_battery_capacity_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, NULL, mge_battery_capacity_fun } }; -static info_lkp_t eaton_enable_disable_info[] = { - { 0, "disabled", NULL, NULL }, - { 1, "enabled", NULL, NULL }, - { 0, NULL, NULL, NULL } +info_lkp_t eaton_enable_disable_info[] = { + { 0, "disabled", NULL }, + { 1, "enabled", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_upstype_conversion[] = { - { 1, "offline / line interactive", NULL, NULL }, - { 2, "online", NULL, NULL }, - { 3, "online - unitary/parallel", NULL, NULL }, - { 4, "online - parallel with hot standy", NULL, NULL }, - { 5, "online - hot standby redundancy", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "offline / line interactive", NULL }, + { 2, "online", NULL }, + { 3, "online - unitary/parallel", NULL }, + { 4, "online - parallel with hot standy", NULL }, + { 5, "online - hot standby redundancy", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_sensitivity_info[] = { - { 0, "normal", NULL, NULL }, - { 1, "high", NULL, NULL }, - { 2, "low", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 0, "normal", NULL }, + { 1, "high", NULL }, + { 2, "low", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_emergency_stop[] = { - { 1, "Emergency stop!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Emergency stop!", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_wiring_fault[] = { - { 1, "Wiring fault!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Wiring fault!", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_config_failure[] = { - { 1, "Fatal EEPROM fault!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Fatal EEPROM fault!", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_inverter_volthi[] = { - { 1, "Inverter AC voltage too high!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Inverter AC voltage too high!", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_inverter_voltlo[] = { - { 1, "Inverter AC voltage too low!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Inverter AC voltage too low!", NULL }, + { 0, NULL, NULL } }; static info_lkp_t mge_short_circuit[] = { - { 1, "Output short circuit!", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "Output short circuit!", NULL }, + { 0, NULL, NULL } }; -static info_lkp_t mge_onbatt_info[] = { - { 1, "!online", NULL, NULL }, - { 0, "online", NULL, NULL }, - { 0, NULL, NULL, NULL } +info_lkp_t mge_onbatt_info[] = { + { 1, "!online", NULL }, + { 0, "online", NULL }, + { 0, NULL, NULL } }; /* allow limiting to ups.model = Protection Station, Ellipse Eco @@ -588,7 +338,6 @@ static const char *eaton_check_pegasus_fun(double value) /* Only consider non European models */ if (country_code != COUNTRY_EUROPE) break; - return NULL; default: return NULL; } @@ -598,10 +347,10 @@ static const char *eaton_check_pegasus_fun(double value) } static info_lkp_t pegasus_threshold_info[] = { - { 10, "10", eaton_check_pegasus_fun, NULL }, - { 25, "25", eaton_check_pegasus_fun, NULL }, - { 60, "60", eaton_check_pegasus_fun, NULL }, - { 0, NULL, NULL, NULL } + { 10, "10", eaton_check_pegasus_fun }, + { 25, "25", eaton_check_pegasus_fun }, + { 60, "60", eaton_check_pegasus_fun }, + { 0, NULL, NULL } }; /* allow limiting standard yes/no info (here, to enable ECO mode) to @@ -617,12 +366,11 @@ static const char *pegasus_yes_no_info_fun(double value) /* Only consider non European models */ if (country_code != COUNTRY_EUROPE) break; - return NULL; default: return NULL; } - return (d_equal(value, 0)) ? "no" : "yes"; + return (value == 0) ? "no" : "yes"; } /* Conversion back of yes/no info */ @@ -636,7 +384,6 @@ static double pegasus_yes_no_info_nuf(const char *value) /* Only consider non European models */ if (country_code != COUNTRY_EUROPE) break; - return 0; default: return 0; } @@ -647,10 +394,10 @@ static double pegasus_yes_no_info_nuf(const char *value) return 0; } -static info_lkp_t pegasus_yes_no_info[] = { +info_lkp_t pegasus_yes_no_info[] = { { 0, "no", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, { 1, "yes", pegasus_yes_no_info_fun, pegasus_yes_no_info_nuf }, - { 0, NULL, NULL, NULL } + { 0, NULL, NULL } }; /* Determine country using UPS.PowerSummary.Country. @@ -665,42 +412,8 @@ static const char *eaton_check_country_fun(double value) } static info_lkp_t eaton_check_country_info[] = { - { 0, "dummy", eaton_check_country_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* When UPS.PowerConverter.Output.ActivePower is not present, - * compute a realpower approximation using available data */ -static const char *eaton_compute_realpower_fun(double value) -{ - NUT_UNUSED_VARIABLE(value); - const char *str_ups_load = dstate_getinfo("ups.load"); - const char *str_power_nominal = dstate_getinfo("ups.power.nominal"); - const char *str_powerfactor = dstate_getinfo("output.powerfactor"); - float powerfactor = 0.80; - int power_nominal = 0; - int ups_load = 0; - double realpower = 0; - if (str_power_nominal && str_ups_load) { - /* Extract needed values */ - ups_load = atoi(str_ups_load); - power_nominal = atoi(str_power_nominal); - if (str_powerfactor) - powerfactor = atoi(str_powerfactor); - /* Compute the value */ - realpower = round(ups_load * 0.01 * power_nominal * powerfactor); - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.0f", realpower); - upsdebugx(1, "eaton_compute_realpower_fun(%s)", mge_scratch_buf); - return mge_scratch_buf; - } - /* else can't process */ - /* Return NULL, not to get the value published! */ - return NULL; -} - -static info_lkp_t eaton_compute_realpower_info[] = { - { 0, "dummy", eaton_compute_realpower_fun, NULL }, - { 0, NULL, NULL, NULL } + { 0, "dummy", eaton_check_country_fun }, + { 0, NULL, NULL } }; /* Limit nominal output voltage according to HV or LV models */ @@ -747,7 +460,6 @@ static const char *nominal_output_voltage_fun(double value) case 240: if ((mge_type & 0xFF00) >= MGE_DEFAULT) break; - return NULL; default: return NULL; } @@ -770,15 +482,10 @@ static const char *nominal_output_voltage_fun(double value) * support both HV values */ if (country_code == COUNTRY_EUROPE_208) break; - /* explicit fallthrough: */ - goto fallthrough_value; - case 220: case 230: case 240: - fallthrough_value: break; - default: return NULL; } @@ -796,35 +503,19 @@ static info_lkp_t nominal_output_voltage_info[] = { /* line-interactive, starting with Evolution, support both HV values */ /* HV models */ /* 208V */ - { 200, "200", nominal_output_voltage_fun, NULL }, - { 208, "208", nominal_output_voltage_fun, NULL }, + { 200, "200", nominal_output_voltage_fun }, + { 208, "208", nominal_output_voltage_fun }, /* HV models */ /* 230V */ - { 220, "220", nominal_output_voltage_fun, NULL }, - { 230, "230", nominal_output_voltage_fun, NULL }, - { 240, "240", nominal_output_voltage_fun, NULL }, + { 220, "220", nominal_output_voltage_fun }, + { 230, "230", nominal_output_voltage_fun }, + { 240, "240", nominal_output_voltage_fun }, /* LV models */ - { 100, "100", nominal_output_voltage_fun, NULL }, - { 110, "110", nominal_output_voltage_fun, NULL }, - { 120, "120", nominal_output_voltage_fun, NULL }, - { 127, "127", nominal_output_voltage_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Limit reporting "online / !online" to when "!off" */ -static const char *eaton_converter_online_fun(double value) -{ - unsigned ups_status = ups_status_get(); - - if (ups_status & STATUS(OFF)) - return NULL; - else - return (d_equal(value, 0)) ? "!online" : "online"; -} - -static info_lkp_t eaton_converter_online_info[] = { - { 0, "dummy", eaton_converter_online_fun, NULL }, - { 0, NULL, NULL, NULL } + { 100, "100", nominal_output_voltage_fun }, + { 110, "110", nominal_output_voltage_fun }, + { 120, "120", nominal_output_voltage_fun }, + { 127, "127", nominal_output_voltage_fun }, + { 0, NULL, NULL } }; /* --------------------------------------------------------------- */ @@ -1083,12 +774,6 @@ static models_name_t mge_model_names [] = { "Evolution", "S 2500", MGE_EVOLUTION_S_2500, NULL }, { "Evolution", "S 3000", MGE_EVOLUTION_S_3000, NULL }, - /* Eaton 5P */ - { "Eaton 5P", "650", EATON_5P, "5P 650" }, - { "Eaton 5P", "850", EATON_5P, "5P 850" }, - { "Eaton 5P", "1150", EATON_5P, "5P 1150" }, - { "Eaton 5P", "1550", EATON_5P, "5P 1550" }, - /* Pulsar M models */ { "PULSAR M", "2200", MGE_PULSAR_M_2200, NULL }, { "PULSAR M", "3000", MGE_PULSAR_M_3000, NULL }, @@ -1154,7 +839,7 @@ static models_name_t mge_model_names [] = { "GALAXY", "3000_30", MGE_DEFAULT, "Galaxy 3000 30 kVA" }, /* end of structure. */ - { NULL, NULL, 0, NULL } + { NULL } }; @@ -1186,21 +871,6 @@ static hid_info_t mge_hid2nut[] = { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%s", HU_FLAG_STATIC, mge_battery_voltage_nominal }, { "battery.protection", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.BatterySystem.Battery.DeepDischargeProtection", NULL, "%s", HU_FLAG_SEMI_STATIC, yes_no_info }, { "battery.energysave", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Input.[3].EnergySaving", NULL, "%s", HU_FLAG_SEMI_STATIC, yes_no_info }, - { "battery.energysave.load", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Input.[3].ConfigPercentLoad", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - /* Current implementation */ - { "battery.energysave.delay", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Input.[3].EnergySaving.ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - /* Newer implementation */ - { "battery.energysave.delay", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Input.[3].ShutdownTimer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "battery.energysave.realpower", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Input.[3].ConfigActivePower", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - /* ABM (Advanced Battery Monitoring) processing - * Must be processed before the BOOL status */ - /* Not published, just to store in internal var. advanced_battery_monitoring */ - { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.ABMEnable", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_info }, - /* Same as the one above, but for legacy units */ - /* Refer to Note 1 (This point will need more clarification!) - { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_enabled_legacy_info }, */ - /* This data is the actual ABM status information */ - { "battery.charger.status", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_status_info }, /* UPS page */ { "ups.efficiency", 0, 0, "UPS.PowerConverter.Output.Efficiency", NULL, "%.0f", 0, NULL }, @@ -1214,9 +884,6 @@ static hid_info_t mge_hid2nut[] = { "ups.timer.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "%.0f", HU_FLAG_QUICK_POLL, NULL}, { "ups.test.result", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "%s", 0, test_read_info }, { "ups.test.interval", ST_FLAG_RW | ST_FLAG_STRING, 8, "UPS.BatterySystem.Battery.TestPeriod", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - /* Duplicate data for some units (such as 3S) that use a different path - * Only the first valid one will be used */ - { "ups.beeper.status", 0 ,0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "%s", HU_FLAG_SEMI_STATIC, beeper_info }, { "ups.beeper.status", 0 ,0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", HU_FLAG_SEMI_STATIC, beeper_info }, { "ups.temperature", 0, 0, "UPS.PowerSummary.Temperature", NULL, "%s", 0, kelvin_celsius_conversion }, { "ups.power", 0, 0, "UPS.PowerConverter.Output.ApparentPower", NULL, "%.0f", 0, NULL }, @@ -1225,9 +892,6 @@ static hid_info_t mge_hid2nut[] = { "ups.L3.power", 0, 0, "UPS.PowerConverter.Output.Phase.[3].ApparentPower", NULL, "%.0f", 0, NULL }, { "ups.power.nominal", 0, 0, "UPS.Flow.[4].ConfigApparentPower", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.0f", 0, NULL }, - /* When not available, process an approximation from other data, - * but map to apparent power to be called */ - { "ups.realpower", 0, 0, "UPS.Flow.[4].ConfigApparentPower", NULL, "-1", 0, eaton_compute_realpower_info }, { "ups.L1.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[1].ActivePower", NULL, "%.0f", 0, NULL }, { "ups.L2.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[2].ActivePower", NULL, "%.0f", 0, NULL }, { "ups.L3.realpower", 0, 0, "UPS.PowerConverter.Output.Phase.[3].ActivePower", NULL, "%.0f", 0, NULL }, @@ -1248,11 +912,9 @@ static hid_info_t mge_hid2nut[] = /* Special case: boolean values that are mapped to ups.status and ups.alarm */ { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, { "BOOL", 0, 0, "UPS.PowerConverter.Input.[3].PresentStatus.Used", NULL, NULL, 0, mge_onbatt_info }, - /* These 2 ones are used when ABM is disabled */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, eaton_discharging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, eaton_charging_info }, - /* And this one when ABM is enabled (same as battery.charger.status) */ - { "BOOL", 0, 0, "UPS.BatterySystem.Charger.Mode", NULL, "%.0f", HU_FLAG_QUICK_POLL, eaton_abm_chrg_dischrg_info }, + { "BOOL", 0, 0, "UPS.PowerConverter.Input.[1].PresentStatus.Used", NULL, NULL, 0, online_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, + { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, /* FIXME: on Dell, the above requires an "AND" with "UPS.BatterySystem.Charger.Mode = 1" */ { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, lowbatt_info }, /* Output overload, Level 1 (FIXME: add the level?) */ @@ -1269,9 +931,11 @@ static hid_info_t mge_hid2nut[] = { "BOOL", 0, 0, "UPS.PowerConverter.Input.[1].PresentStatus.VoltageOutOfRange", NULL, NULL, 0, vrange_info }, { "BOOL", 0, 0, "UPS.PowerConverter.Input.[1].PresentStatus.FrequencyOutOfRange", NULL, NULL, 0, frange_info }, { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, NULL, 0, off_info }, - /* NOTE: UPS.PowerConverter.Input.[1].PresentStatus.Used" must only be considered when not "OFF", - * and must hence be after "UPS.PowerSummary.PresentStatus.Good" */ - { "BOOL", 0, 0, "UPS.PowerConverter.Input.[1].PresentStatus.Used", NULL, NULL, 0, eaton_converter_online_info }, +#if 0 + /* TODO: UPS.BatterySystem.Charger.PresentStatus.Used is related to ABM */ + { "BOOL", 0, 0, "UPS.BatterySystem.Charger.PresentStatus.Used", NULL, NULL, 0, off_info }, + /* FIXME: on Dell, the above requires an "AND" with "UPS.BatterySystem.Charger.Mode = 4 (ABM Resting)" */ +#endif { "BOOL", 0, 0, "UPS.PowerConverter.Input.[2].PresentStatus.Used", NULL, NULL, 0, bypass_auto_info }, /* Automatic bypass */ { "BOOL", 0, 0, "UPS.PowerConverter.Input.[4].PresentStatus.Used", NULL, NULL, 0, bypass_manual_info }, /* Manual bypass */ { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FanFailure", NULL, NULL, 0, fanfail_info }, @@ -1418,13 +1082,8 @@ static hid_info_t mge_hid2nut[] = { "shutdown.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL}, { "beeper.off", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL }, { "beeper.on", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - /* Duplicate commands for some units (such as 3S) that use a different path - * Only the first valid one will be used */ - { "beeper.mute", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, { "beeper.mute", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, - { "beeper.disable", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL }, { "beeper.disable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL }, - { "beeper.enable", 0, 0, "UPS.BatterySystem.Battery.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, /* Command for the outlet collection */ @@ -1434,7 +1093,7 @@ static hid_info_t mge_hid2nut[] = { "outlet.2.load.on", 0, 0, "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup", NULL, "0", HU_TYPE_CMD, NULL }, /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } + { NULL } }; /* @@ -1476,31 +1135,7 @@ static char *get_model_name(const char *iProduct, const char *iModel) * model name by concatenation of iProduct and iModel */ char buf[SMALLBUF]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif - /* NOTE: We intentionally limit the amount of bytes reported */ - int len = snprintf(buf, sizeof(buf), "%s %s", iProduct, iModel); - - if (len < 0) { - upsdebugx(1, "%s: got an error while extracting iProduct+iModel value", __func__); - } - - /* NOTE: SMALLBUF here comes from mge_format_model() - * buffer definitions below - */ - if ((intmax_t)len > (intmax_t)sizeof(buf) - || (intmax_t)(strnlen(iProduct, SMALLBUF) + strnlen(iModel, SMALLBUF) + 1 + 1) - > (intmax_t)sizeof(buf) - ) { - upsdebugx(1, "%s: extracted iProduct+iModel value was truncated", __func__); - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif + snprintf(buf, sizeof(buf), "%s %s", iProduct, iModel); return strdup(buf); } @@ -1568,21 +1203,6 @@ static int mge_claim(HIDDevice_t *hd) { * not a UPS, so don't use possibly_supported here */ return 0; - - case PHOENIXTEC: - /* The vendorid 0x06da is primarily handled by - * liebert-hid, except for (maybe) AEG PROTECT NAS - * branded devices */ - if (hd->Vendor && strstr(hd->Vendor, "AEG")) { - return 1; - } - if (hd->Product && strstr(hd->Product, "AEG")) { - return 1; - } - - /* Let liebert-hid grab this */ - return 0; - default: /* Valid for Eaton */ /* by default, reject, unless the productid option is given */ if (getval("productid")) { @@ -1593,21 +1213,6 @@ static int mge_claim(HIDDevice_t *hd) { } case SUPPORTED: - - switch (hd->VendorID) - { - case PHOENIXTEC: /* see comments above */ - if (hd->Vendor && strstr(hd->Vendor, "AEG")) { - return 1; - } - if (hd->Product && strstr(hd->Product, "AEG")) { - return 1; - } - - /* Let liebert-hid grab this */ - return 0; - } - return 1; case NOT_SUPPORTED: @@ -1615,8 +1220,7 @@ static int mge_claim(HIDDevice_t *hd) { return 0; } #else - NUT_UNUSED_VARIABLE(hd); - return 1; + return 1; #endif } @@ -1628,5 +1232,4 @@ subdriver_t mge_subdriver = { mge_format_model, mge_format_mfr, mge_format_serial, - fix_report_desc, }; diff --git a/drivers/mge-mib.c b/drivers/mge-mib.c index d0a844d..e19816b 100644 --- a/drivers/mge-mib.c +++ b/drivers/mge-mib.c @@ -27,7 +27,7 @@ #include "mge-mib.h" -#define MGE_MIB_VERSION "0.55" +#define MGE_MIB_VERSION "0.5" /* TODO: * - MGE PDU MIB and sysOID (".1.3.6.1.4.1.705.2") */ @@ -38,127 +38,117 @@ #define MGE_OID_MODEL_NAME MGE_BASE_OID ".1.1.0" static info_lkp_t mge_lowbatt_info[] = { - { 1, "LB", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "LB" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_onbatt_info[] = { - { 1, "OB", NULL, NULL }, - { 2, "OL", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "OB" }, + { 2, "OL" }, + { 0, "NULL" } }; static info_lkp_t mge_bypass_info[] = { - { 1, "BYPASS", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "BYPASS" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_boost_info[] = { - { 1, "BOOST", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "BOOST" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_trim_info[] = { - { 1, "TRIM", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "TRIM" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_overload_info[] = { - { 1, "OVER", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "OVER" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_replacebatt_info[] = { - { 1, "RB", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "RB" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_output_util_off_info[] = { - { 1, "OFF", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "OFF" }, + { 2, "" }, + { 0, "NULL" } }; static info_lkp_t mge_transfer_reason_info[] = { - { 1, "", NULL, NULL }, - { 2, "input voltage out of range", NULL, NULL }, - { 3, "input frequency out of range", NULL, NULL }, - { 4, "utility off", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" }, + { 2, "input voltage out of range" }, + { 3, "input frequency out of range" }, + { 4, "utility off" }, + { 0, "NULL" } }; -static info_lkp_t mge_test_result_info[] = { - { 1, "done and passed", NULL, NULL }, - { 2, "done and warning", NULL, NULL }, - { 3, "done and error", NULL, NULL }, - { 4, "aborted", NULL, NULL }, - { 5, "in progress", NULL, NULL }, - { 6, "no test initiated", NULL, NULL }, - { 0, NULL, NULL, NULL } +static info_lkp_t ietf_test_result_info[] = { + { 1, "done and passed" }, + { 2, "done and warning" }, + { 3, "done and error" }, + { 4, "aborted" }, + { 5, "in progress" }, + { 6, "no test initiated" }, + { 0, "NULL" } }; -static info_lkp_t mge_beeper_status_info[] = { - { 1, "disabled", NULL, NULL }, - { 2, "enabled", NULL, NULL }, - { 3, "muted", NULL, NULL }, - { 0, NULL, NULL, NULL } +static info_lkp_t ietf_beeper_status_info[] = { + { 1, "disabled" }, + { 2, "enabled" }, + { 3, "muted" }, + { 0, "NULL" } }; -static info_lkp_t mge_yes_no_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "no", NULL, NULL }, - { 0, NULL, NULL, NULL } +static info_lkp_t ietf_yes_no_info[] = { + { 1, "yes" }, + { 2, "no" }, + { 0, "NULL" } }; /* FIXME: the below may introduce status redundancy, that needs to be - * addressed by the driver, as for usbhid-ups! */ -static info_lkp_t mge_power_source_info[] = { - { 1, "" /* other */, NULL, NULL }, - { 2, "OFF" /* none */, NULL, NULL }, + * adressed by the driver, as for usbhid-ups! */ +static info_lkp_t ietf_power_source_info[] = { + { 1, "" /* other */ }, + { 2, "OFF" /* none */ }, #if 0 - { 3, "OL" /* normal */, NULL, NULL }, + { 3, "OL" /* normal */ }, #endif - { 4, "BYPASS" /* bypass */, NULL, NULL }, - { 5, "OB" /* battery */, NULL, NULL }, - { 6, "BOOST" /* booster */, NULL, NULL }, - { 7, "TRIM" /* reducer */, NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t mge_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 1, "closed", NULL, NULL }, - { 2, "opened", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 4, "BYPASS" /* bypass */ }, + { 5, "OB" /* battery */ }, + { 6, "BOOST" /* booster */ }, + { 7, "TRIM" /* reducer */ }, + { 0, "NULL" } }; /* Parameters default values */ -#define DEFAULT_ONDELAY "30" /* Delay between return of utility power */ +#define STR_DEFAULT_ONDELAY "30" /* Delay between return of utility power */ /* and powering up of load, in seconds */ /* CAUTION: ondelay > offdelay */ -#define DEFAULT_OFFDELAY "20" /* Delay before power off, in seconds */ +#define DEFAULT_ONDELAY 30 +#define STR_DEFAULT_OFFDELAY "20" /* Delay before power off, in seconds */ +#define DEFAULT_OFFDELAY 20 -#define MGE_NOTHING_VALUE "1" -#define MGE_START_VALUE "2" -#define MGE_STOP_VALUE "3" +#define MGE_NOTHING_VALUE 1 +#define MGE_START_VALUE 2 +#define MGE_STOP_VALUE 3 /* TODO: PowerShare (per plug .1, .2, .3) and deals with delays */ /* Snmp2NUT lookup table */ static snmp_info_t mge_mib[] = { - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* UPS page */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Eaton", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.1.1.0", "Generic SNMP UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, @@ -166,17 +156,17 @@ static snmp_info_t mge_mib[] = { { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.1.4.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.12.12.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.1", "", SU_OUTPUT_1, NULL }, - { "ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.2.1.33.1.9.8.0", "", 0, mge_beeper_status_info }, + { "ups.beeper.status", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.2.1.33.1.9.8.0", "", 0, ietf_beeper_status_info }, { "ups.L1.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.1", "", SU_OUTPUT_3, NULL }, { "ups.L2.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.2", "", SU_OUTPUT_3, NULL }, { "ups.L3.load", 0, 1, ".1.3.6.1.4.1.705.1.7.2.1.4.3", "", SU_OUTPUT_3, NULL }, - { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, mge_test_result_info }, - { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.2.0", DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.3.0", DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.7.3.0", "", 0, ietf_test_result_info }, + { "ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.2.0", STR_DEFAULT_OFFDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + { "ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW, 6, "1.3.6.1.2.1.33.1.8.3.0", STR_DEFAULT_ONDELAY, SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "ups.timer.shutdown", 0, 1, "1.3.6.1.2.1.33.1.8.2.0", "", SU_FLAG_OK, NULL }, { "ups.timer.start", 0, 1, "1.3.6.1.2.1.33.1.8.3.0", "", SU_FLAG_OK, NULL }, { "ups.timer.reboot", 0, 1, "1.3.6.1.2.1.33.1.8.4.0", "", SU_FLAG_OK, NULL }, - { "ups.start.auto", ST_FLAG_RW, 1, "1.3.6.1.2.1.33.1.8.5.0", "", SU_FLAG_OK, mge_yes_no_info }, + { "ups.start.auto", ST_FLAG_RW, 1, "1.3.6.1.2.1.33.1.8.5.0", "", SU_FLAG_OK, ietf_yes_no_info }, /* status data */ { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.5.11.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_replacebatt_info }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.5.14.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_lowbatt_info }, @@ -187,7 +177,7 @@ static snmp_info_t mge_mib[] = { { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.8.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_boost_info }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.10.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_overload_info }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.12.0", "", SU_FLAG_OK | SU_STATUS_BATT, mge_trim_info }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.4.1.0", "", SU_STATUS_PWR | SU_FLAG_OK, mge_power_source_info }, + { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.2.1.33.1.4.1.0", "", SU_STATUS_PWR | SU_FLAG_OK, ietf_power_source_info }, /* FIXME: Alarms * - upsmgBatteryChargerFault (.1.3.6.1.4.1.705.1.5.15.0), yes (1), no (2) @@ -203,7 +193,7 @@ static snmp_info_t mge_mib[] = { */ /* Input page */ - { "input.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.6.1.0", "", 0, NULL }, + { "input.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.6.1.0", "", SU_FLAG_SETINT, NULL, &input_phases }, { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, { "input.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_3, NULL }, { "input.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.2", "", SU_INPUT_3, NULL }, @@ -227,7 +217,7 @@ static snmp_info_t mge_mib[] = { { "input.transfer.reason", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.6.4.0", "", SU_FLAG_OK, mge_transfer_reason_info }, /* Output page */ - { "output.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.7.1.0", "", 0, NULL }, + { "output.phases", 0, 1.0, ".1.3.6.1.4.1.705.1.7.1.0", "", SU_FLAG_SETINT, NULL, &output_phases }, { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.1", "", SU_OUTPUT_1, NULL }, { "output.L1-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.1", "", SU_OUTPUT_3, NULL }, { "output.L2-N.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.7.2.1.2.2", "", SU_OUTPUT_3, NULL }, @@ -251,17 +241,13 @@ static snmp_info_t mge_mib[] = { /* Ambient page: Environment Sensor (ref 66 846) */ { "ambient.temperature", 0, 0.1, ".1.3.6.1.4.1.705.1.8.1.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, { "ambient.humidity", 0, 0.1, ".1.3.6.1.4.1.705.1.8.2.0", "", SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsmgEnvironmentInput1State.1 */ - { "ambient.contacts.1.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.8.7.1.9.1", "", SU_TYPE_INT | SU_FLAG_OK, mge_ambient_drycontacts_info }, - /* upsmgEnvironmentInput1State.1 */ - { "ambient.contacts.2.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.8.7.1.10.1", "", SU_TYPE_INT | SU_FLAG_OK, mge_ambient_drycontacts_info }, /* Outlet page */ { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "Main Outlet", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, /* instant commands. */ - { "test.battery.start", 0, 1, ".1.3.6.1.4.1.705.1.10.4.0", MGE_START_VALUE, SU_TYPE_CMD | SU_FLAG_OK, NULL }, + { "test.battery.start", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.10.4.0", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, /* Also use IETF OIDs * { "test.battery.stop", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.2", SU_TYPE_CMD, NULL }, * { "test.battery.start", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.3", SU_TYPE_CMD, NULL }, @@ -269,21 +255,20 @@ static snmp_info_t mge_mib[] = { * { "test.battery.start.deep", 0, 0, "1.3.6.1.2.1.33.1.7.1.0", "1.3.6.1.2.1.33.1.7.7.5", SU_TYPE_CMD, NULL }, */ - /* { "load.off", 0, 1, ".1.3.6.1.4.1.705.1.9.1.1.6.1", MGE_START_VALUE, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - * { "load.on", 0, 1, ".1.3.6.1.4.1.705.1.9.1.1.3.1", MGE_START_VALUE, SU_TYPE_CMD | SU_FLAG_OK, NULL }, - * { "shutdown.return", 0, 1, ".1.3.6.1.4.1.705.1.9.1.1.9.1", MGE_START_VALUE, SU_TYPE_CMD | SU_FLAG_OK, NULL }, + /* { "load.off", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.6.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + * { "load.on", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.3.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, + * { "shutdown.return", 0, MGE_START_VALUE, ".1.3.6.1.4.1.705.1.9.1.1.9.1", "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, */ /* IETF MIB fallback */ - { "beeper.disable", 0, 1, "1.3.6.1.2.1.33.1.9.8.0", "1", SU_TYPE_CMD, NULL }, - { "beeper.enable", 0, 1, "1.3.6.1.2.1.33.1.9.8.0", "2", SU_TYPE_CMD, NULL }, - { "beeper.mute", 0, 1, "1.3.6.1.2.1.33.1.9.8.0", "3", SU_TYPE_CMD, NULL }, - /*{ "load.off", 0, 1, "1.3.6.1.2.1.33.1.8.2.0", DEFAULT_OFFDELAY, SU_TYPE_CMD, NULL }, - { "load.on", 0, 1, "1.3.6.1.2.1.33.1.8.3.0", DEFAULT_ONDELAY, SU_TYPE_CMD, NULL },*/ - { "load.off.delay", 0, 1, "1.3.6.1.2.1.33.1.8.2.0", NULL, SU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 1, "1.3.6.1.2.1.33.1.8.3.0", NULL, SU_TYPE_CMD, NULL }, + { "beeper.disable", 0, 1, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.enable", 0, 2, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + { "beeper.mute", 0, 3, "1.3.6.1.2.1.33.1.9.8.0", "", SU_TYPE_CMD, NULL }, + /* Use ST_FLAG_STRING to get default value from ->dfl instead of info_len */ + { "load.off.delay", 0, DEFAULT_OFFDELAY, "1.3.6.1.2.1.33.1.8.2.0", "", SU_TYPE_CMD, NULL }, + { "load.on.delay", 0, DEFAULT_ONDELAY, "1.3.6.1.2.1.33.1.8.3.0", "", SU_TYPE_CMD, NULL }, /* end of structure. */ { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t mge = { "mge", MGE_MIB_VERSION, NULL, MGE_OID_MODEL_NAME, mge_mib, MGE_SYSOID, NULL }; +mib2nut_info_t mge = { "mge", MGE_MIB_VERSION, "", MGE_OID_MODEL_NAME, mge_mib, MGE_SYSOID }; diff --git a/drivers/mge-shut.c b/drivers/mge-shut.c new file mode 100644 index 0000000..06398ed --- /dev/null +++ b/drivers/mge-shut.c @@ -0,0 +1,1455 @@ +/* mge-shut.c - monitor MGE UPS for NUT with SHUT protocol + * + * Copyright (C) 2002 - 2012 + * Arnaud Quette + * + * Sponsored by MGE UPS SYSTEMS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include + +#include "config.h" +#include "main.h" +#include "serial.h" +#include "timehead.h" +#include "mge-shut.h" +#include "hidparser.h" +#include "hidtypes.h" +#include "common.h" /* for upsdebugx() etc */ + +/* --------------------------------------------------------------- */ +/* Define "technical" constants */ +/* --------------------------------------------------------------- */ + +#define DRIVER_NAME "Eaton / SHUT driver" +#define DRIVER_VERSION "0.70" + +/* driver description structure */ +upsdrv_info_t upsdrv_info = { + DRIVER_NAME, + DRIVER_VERSION, + "Arnaud Quette ", + DRV_STABLE, + { NULL } +}; + +#define MAX_TRY 4 + +/* global variables */ +int commstatus = 0; +int lowbatt = -1; +int ondelay = DEFAULT_ONDELAY; +int offdelay = DEFAULT_OFFDELAY; +int notification = DEFAULT_NOTIFICATION; + +#define SD_RETURN 0 +#define SD_STAYOFF 1 + +int sdtype = SD_RETURN; + +#define BYTESWAP(in) (((in & 0xFF) << 8) + ((in & 0xFF00) >> 8)) + +/* realign packet data according to Endianess */ +static void align_request(hid_packet_t *sd) +{ +#if WORDS_BIGENDIAN + /* Sparc/Mips/... are big endian, USB/SHUT little endian */ + (*sd).wValue = BYTESWAP((*sd).wValue); + (*sd).wIndex = BYTESWAP((*sd).wIndex); + (*sd).wLength = BYTESWAP((*sd).wLength); +#endif +} + +/* --------------------------------------------------------------- */ +/* Global structures */ +/* --------------------------------------------------------------- */ + +hid_desc_data_t hid_descriptor; +device_desc_data_t device_descriptor; +static long hValue; +static HIDDesc_t *pDesc = NULL; /* parsed Report Descriptor */ +u_char raw_buf[4096]; + +/* --------------------------------------------------------------- */ +/* Function prototypes */ +/* --------------------------------------------------------------- */ + +float expo(int a, int b); +extern long FormatValue(long Value, u_char Size); +static const char *hu_find_infoval(info_lkp_t *hid2info, long value); + +/* --------------------------------------------------------------- */ +/* UPS Driver Functions */ +/* --------------------------------------------------------------- */ + +void upsdrv_initinfo (void) +{ + mge_info_item_t *item; + + upsdebugx(2, "entering initinfo()\n"); + + /* Get complete Model information */ + shut_identify_ups (); + + printf("Detected %s [%s] on %s\n", dstate_getinfo("ups.model"), + dstate_getinfo("ups.serial"), device_path); + + /* Device capabilities enumeration ----------------------------- */ + for ( item = mge_info ; item->type != NULL ; item++ ) { + + /* Check if we are asked to stop (reactivity++) */ + if (exit_flag != 0) + return; + + /* avoid redundancy when multiple defines (RO/RW) */ + if (dstate_getinfo(item->type) != NULL) + continue; + + /* Special case for handling server side variables */ + if (item->shut_flags & SHUT_FLAG_ABSENT) { + /* Check if exists (if necessary) before creation */ + if (item->item_path != NULL) + { + if (hid_get_value(item->item_path) != 1 ) + continue; + } + else + { + /* Simply set the default value */ + dstate_setinfo(item->type, "%s", item->dfl); + dstate_setflags(item->type, item->flags); + continue; + } + + dstate_setinfo(item->type, "%s", item->dfl); + dstate_setflags(item->type, item->flags); + + /* Set max length for strings, if needed */ + if (item->flags & ST_FLAG_STRING) + dstate_setaux(item->type, item->length); + + /* disable reading now + item->shut_flags &= ~SHUT_FLAG_OK;*/ + } else { + if (hid_get_value(item->item_path) != 0 ) { + + item->shut_flags &= SHUT_FLAG_OK; + dstate_setinfo(item->type, item->fmt, hValue); + dstate_setflags(item->type, item->flags); + /* Set max length for strings */ + if (item->flags & ST_FLAG_STRING) + dstate_setaux(item->type, item->length); + } + else { + item->shut_flags &= ~SHUT_FLAG_OK; + } + } + } + + /* commands ----------------------------------------------- */ + dstate_addcmd("load.off"); + dstate_addcmd("load.on"); + dstate_addcmd("shutdown.return"); + dstate_addcmd("shutdown.stayoff"); + dstate_addcmd("test.battery.start"); + dstate_addcmd("test.battery.stop"); + + /* install handlers */ + upsh.setvar = hid_set_value; /* setvar; */ + upsh.instcmd = instcmd; + + /* check if low battery level has been given to set it */ + if (lowbatt != -1) { + hid_set_value("battery.charge.low", getval ("lowbatt")); + } +} + +/* --------------------------------------------------------------- */ + +void upsdrv_updateinfo (void) +{ + mge_info_item_t *item; + const char *nutvalue; + + upsdebugx(2, "entering upsdrv_updateinfo()"); + + if (commstatus == 0) { + if (shut_ups_start () != 0) { + upsdebugx(2, "No communication with UPS, retrying"); + dstate_datastale(); + return; + } else { + upsdebugx(2, "Communication with UPS established"); + } + } + + shut_ups_status(); + + /* Device data walk ----------------------------- */ + for ( item = mge_info ; item->type != NULL; item++ ) { + + /* Check if we are asked to stop (reactivity++) */ + if (exit_flag != 0) + return; + + if (item->shut_flags & SHUT_FLAG_ABSENT) + continue; + + if (item->shut_flags & SHUT_FLAG_OK) { + + if(hid_get_value(item->item_path) != 0 ) { + upsdebugx(3, "%s: hValue = %ld", item->item_path, hValue); + /* upsdebugx(3, "%s: hValue = %ld (%ld)", + item->item_path, hValue, hData.LogMax); */ + + /* need lookup'ed translation */ + if (item->hid2info != NULL) + { + nutvalue = hu_find_infoval(item->hid2info, (long)hValue); + if (nutvalue != NULL) + dstate_setinfo(item->type, "%s", nutvalue); + else + dstate_setinfo(item->type, item->fmt, hValue); + } + else + dstate_setinfo(item->type, item->fmt, hValue); + + dstate_dataok(); + } else { + if (shut_ups_start () != 0) + dstate_datastale(); + } + } + } +} + +/* --------------------------------------------------------------- */ + +void upsdrv_shutdown (void) +{ + char val[5]; + + if (sdtype == SD_RETURN) { + /* set DelayBeforeStartup */ + snprintf(val, sizeof(val), "%d", ondelay); + hid_set_value("ups.timer.start", val); + } + + /* set DelayBeforeShutdown */ + snprintf(val, sizeof(val), "%d", offdelay); + hid_set_value("ups.timer.shutdown", val); +} + +/* --------------------------------------------------------------- */ + +void upsdrv_help (void) +{ + upsdebugx(2, "entering upsdrv_help"); +} + +/* --------------------------------------------------------------- */ + +/* list flags and values that you want to receive via -x */ +void upsdrv_makevartable (void) +{ + char msg[MAX_STRING]; + + upsdebugx (2, "entering upsdrv_makevartable()"); + + snprintf(msg, sizeof(msg), "Set low battery level, in %% (default=%d).", + DEFAULT_LOWBATT); + addvar (VAR_VALUE, "lowbatt", msg); + + snprintf(msg, sizeof(msg), "Set shutdown delay, in seconds (default=%d).", + DEFAULT_OFFDELAY); + addvar (VAR_VALUE, "offdelay", msg); + + snprintf(msg, sizeof(msg), "Set startup delay, in ten seconds units (default=%d).", + DEFAULT_ONDELAY); + addvar (VAR_VALUE, "ondelay", msg); + + snprintf(msg, sizeof(msg), "Set notification type, 1 = no, 2 = light, 3 = yes (default=%d).", + DEFAULT_NOTIFICATION); + addvar (VAR_VALUE, "notification", msg); +} + +/* --------------------------------------------------------------- */ + +void upsdrv_initups (void) +{ + upsdebugx(2, "entering upsdrv_initups()"); + + /* initialize serial port */ + upsfd = ser_open(device_path); + ser_set_speed(upsfd, device_path, B2400); + setline (1); + + /* get battery lowlevel */ + if (getval ("lowbatt")) + lowbatt = atoi (getval ("lowbatt")); + + /* on delay */ + if (getval ("ondelay")) + ondelay = atoi (getval ("ondelay")); + + /* shutdown delay */ + if (getval ("offdelay")) + offdelay = atoi (getval ("offdelay")); + + /* notification type */ + if (getval ("notification")) + notification = atoi (getval ("notification")); + + /* initialise communication */ + if (shut_ups_start () != 0) + fatalx(EXIT_FAILURE, "No communication with UPS"); + else + upsdebugx(2, "Communication with UPS established"); + + /* initialise HID communication */ + if(hid_init_device() != 0) + fatalx(EXIT_FAILURE, "Can't initialise HID device"); +} + +/* --------------------------------------------------------------- */ + +void upsdrv_cleanup(void) +{ + ser_close(upsfd, device_path); +} + +/* --------------------------------------------------------------- */ + +int instcmd(const char *cmdname, const char *extra) +{ + /* Shutdown UPS and return when power is restored */ + if (!strcasecmp(cmdname, "shutdown.return")) { + sdtype = SD_RETURN; + upsdrv_shutdown(); + return STAT_INSTCMD_HANDLED; + } + + /* Shutdown UPS and stay off when power is restored */ + if (!strcasecmp(cmdname, "shutdown.stayoff")) { + sdtype = SD_STAYOFF; + upsdrv_shutdown(); + return STAT_INSTCMD_HANDLED; + } + + /* Power off the load immediatly */ + if (!strcasecmp(cmdname, "load.off")) { + /* set DelayBeforeShutdown to 0 */ + hid_set_value("ups.timer.shutdown", "0"); + return STAT_INSTCMD_HANDLED; + } + + /* Power on the load immediatly */ + if (!strcasecmp(cmdname, "load.on")) { + /* set DelayBeforeStartup to 0 */ + hid_set_value("ups.timer.start", "0"); + return STAT_INSTCMD_HANDLED; + } + + /* Start battery test */ + if (!strcasecmp(cmdname, "test.battery.start")) { + /* set Test to 1 (Quick test) */ + hid_set_value("ups.test.result", "1"); + return STAT_INSTCMD_HANDLED; + } + + /* Stop battery test */ + if (!strcasecmp(cmdname, "test.battery.stop")) { + /* set Test to 3 (Abort test) */ + hid_set_value("ups.test.result", "3"); + return STAT_INSTCMD_HANDLED; + } + + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); + return STAT_INSTCMD_UNKNOWN; +} + + +/***************************************************************************** + * shut_ups_start () + * + * initiate communication with the UPS + * + * return 0 on success, -1 on failure + * + *****************************************************************************/ +int shut_ups_start () +{ + u_char c = SHUT_SYNC, r[1]; + int try; + + upsdebugx (2, "entering shut_ups_start()\n"); + r[0] = '\0'; + + switch (notification) { + case OFF_NOTIFICATION: + c = SHUT_SYNC_OFF; + break; + case LIGHT_NOTIFICATION: + c = SHUT_SYNC_LIGHT; + break; + default: + case COMPLETE_NOTIFICATION: + c = SHUT_SYNC; + break; + } + + /* Sync with the UPS using Complete, Off or light notification */ + for (try = 0; try < MAX_TRY; try++) { + if ((shut_token_send(c)) == -1) { + upsdebugx (3, "Communication error while writing to port"); + return -1; + } + serial_read (1000, &r[0]); + if (r[0] == c) { + commstatus = 1; + upsdebugx (3, "Syncing and notification setting done"); + return 0; + } + } + commstatus = 0; + return -1; +} + +/********************************************************************** + * shut_identify_ups () + * + * Get SHUT device complete name + * + * return 0 on success, -1 on failure + * + *********************************************************************/ +int shut_identify_ups () +{ + char string[MAX_STRING]; + char model[MAX_STRING]; + const char *finalname = NULL; + int retcode, tries=MAX_TRY; + + if (commstatus == 0) + return -1; + + upsdebugx (2, "entering shut_identify_ups(0x%04x, 0x%04x)\n", + device_descriptor.dev_desc.iManufacturer, + device_descriptor.dev_desc.iProduct); + + /* Get strings iModel and iProduct */ + while (tries > 0) + { + if (shut_get_string(device_descriptor.dev_desc.iProduct, string, 0x25) > 0) + { + strcpy(model, string); + + if(hid_get_value("UPS.PowerSummary.iModel") != 0 ) + { + if((shut_get_string(hValue, string, 0x25)) > 0) + { + finalname = get_model_name(model, string); + upsdebugx (2, "iModel = %s", string); + tries = 0; + } + } + else + { + /* Try with "UPS.Flow.[4].ConfigApparentPower" */ + if(hid_get_value("UPS.Flow.[4].ConfigApparentPower") != 0 ) + { + snprintf(string, sizeof(string), "%i", (int)hValue); + finalname = get_model_name(model, string); + } + else + finalname = get_model_name(model, NULL); + + tries = 0; + } + + dstate_setinfo("ups.model", "%s", finalname); + } + else + tries--; + } + + /* Get strings iSerialNumber */ + if (((retcode = shut_get_string(device_descriptor.dev_desc.iSerialNumber, string, 0x25)) > 0) + && strcmp(string, "") && string[0] != '\t') { + + dstate_setinfo("ups.serial", "%s", string); + } + else + dstate_setinfo("ups.serial", "unknown"); + + /* all went fine */ + return 1; +} + +/********************************************************************** + * shut_wait_ack() + * + * wait for an ACK packet + * + * returns 0 on success, -1 on error, -2 on NACK, -3 on NOTIFICATION + * + *********************************************************************/ +int shut_wait_ack (void) +{ + u_char c[1]; + + c[0] = '\0'; + + serial_read (DEFAULT_TIMEOUT, &c[0]); + if (c[0] == SHUT_OK) { + upsdebugx (2, "shut_wait_ack(): ACK received"); + return 0; + } + else if (c[0] == SHUT_NOK) { + upsdebugx (2, "shut_wait_ack(): NACK received"); + return -2; + } + else if ((c[0] & 0x0f) == SHUT_TYPE_NOTIFY) { + upsdebugx (2, "shut_wait_ack(): NOTIFY received"); + return -3; + } + upsdebugx (2, "shut_wait_ack(): Nothing received"); + return -1; +} + +/********************************************************************** + * char_read (char *bytes, int size, int read_timeout) + * + * reads size bytes from the serial port + * + * bytes - buffer to store the data + * size - size of the data to get + * read_timeout - serial timeout (in milliseconds) + * + * return -1 on error, -2 on timeout, nb_bytes_readen on success + * + *********************************************************************/ +static int char_read (char *bytes, int size, int read_timeout) +{ + struct timeval serial_timeout; + fd_set readfs; + int readen = 0; + int rc = 0; + + FD_ZERO (&readfs); + FD_SET (upsfd, &readfs); + + serial_timeout.tv_usec = (read_timeout % 1000) * 1000; + serial_timeout.tv_sec = (read_timeout / 1000); + + rc = select (upsfd + 1, &readfs, NULL, NULL, &serial_timeout); + if (0 == rc) + return -2; /* timeout */ + + if (FD_ISSET (upsfd, &readfs)) { + int now = read (upsfd, bytes, size - readen); + + if (now < 0) { + return -1; + } + else { + bytes += now; + readen += now; + } + } + else { + return -1; + } + return readen; +} + +/********************************************************************** + * serial_read (int read_timeout) + * + * return data one byte at a time + * + * read_timeout - serial timeout (in milliseconds) + * + * returns 0 on success, -1 on error, -2 on timeout + * + **********************************************************************/ +int serial_read (int read_timeout, u_char *readbuf) +{ + static u_char cache[512]; + static u_char *cachep = cache; + static u_char *cachee = cache; + int recv; + *readbuf = '\0'; + + /* if still data in cache, get it */ + if (cachep < cachee) { + *readbuf = *cachep++; + return 0; + /* return (int) *cachep++; */ + } + recv = char_read ((char *)cache, 1, read_timeout); + + if ((recv == -1) || (recv == -2)) + return recv; + + cachep = cache; + cachee = cache + recv; + cachep = cache; + cachee = cache + recv; + + if (recv) { + upsdebugx(5,"received: %02x", *cachep); + *readbuf = *cachep++; + return 0; + } + return -1; +} + +/********************************************************************** + * serial_send (char *buf, int len) + * + * write the content of buf to the serial port + * + * buf - data to send + * len - lenght of data to send + * + * returns number of bytes written on success, -1 on error + * + **********************************************************************/ +int serial_send (u_char *buf, int len) +{ + tcflush (upsfd, TCIFLUSH); + upsdebug_hex (3, "sent", (u_char *)buf, len); + return write (upsfd, buf, len); +} + +/* + * Serial HID UPS Transfer (SHUT) functions + *********************************************************************/ +/* Get and parse UPS status */ +void shut_ups_status(void) +{ + int try = 0, retcode = 0; + + /* clear status buffer before begining */ + status_init(); + + /* Ensure to have at least basic status */ + while (try < MAX_TRY) { + if((retcode = hid_get_value("UPS.PowerSummary.PresentStatus.ACPresent")) != 0 ) { + try = MAX_TRY; + if(hValue == 1){ + status_set("OL"); + } else { + status_set("OB"); + } + } else { /* retry to get data */ + try++; + } + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.Discharging") != 0 ) { + if(hValue == 1) + status_set("DISCHRG"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.Charging") != 0 ) { + if(hValue == 1) + status_set("CHRG"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.ShutdownImminent") != 0 ) { + if(hValue == 1) + status_set("LB"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit") != 0 ) { + if(hValue == 1) + status_set("LB"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.Overload") != 0 ) { + if(hValue == 1) + status_set("OVER"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.NeedReplacement") != 0 ) { + if(hValue == 1) + status_set("RB"); + } + + if(hid_get_value("UPS.PowerSummary.PresentStatus.Good") != 0 ) { + if(hValue == 0) + status_set("OFF"); + } + + /* FIXME: extend ups.status for BYPASS: */ + /* Manual bypass */ + if(hid_get_value("UPS.PowerConverter.Input.[4].PresentStatus.Used") != 0 ) { + if(hValue == 1) + status_set("BYPASS"); + } + /* Automatic bypass */ + if(hid_get_value("UPS.PowerConverter.Input.[2].PresentStatus.Used") != 0 ) { + if(hValue == 1) + status_set("BYPASS"); + } + + status_commit(); +} + +/* Calculate the SHUT checksum for the packet "buf" */ +u_char shut_checksum(const u_char *buf, int bufsize) +{ + int i; + u_char chk=0; + + for(i=0; i0 && Retry>0) + { + Size=(datalen>=8) ? 8 : datalen; + + /* Packets need only to be sent once + * NACK handling should take care of the rest */ + if (Retry == 1) { + + /* Forge SHUT Frame */ + SHUTRequest.bType = SHUT_TYPE_REQUEST + token; + SHUTRequest.bLength = (Size<<4) + Size; + SHUTRequest.data = *hdata; + /* memcpy(&SHUTRequest.data.raw_pkt, hdata->raw_pkt, Size); */ + + sdata.shut_pkt = SHUTRequest; + sdata.raw_pkt[(Size+3) - 1] = shut_checksum(sdata.shut_pkt.data.raw_pkt, Size); + + upsdebugx (4, "shut_checksum = %2x", sdata.raw_pkt[(Size+3)-1]); + + serial_send (sdata.raw_pkt, Size+3); + } + i = shut_wait_ack (); + if (i == 0) { + datalen-=Size; + Retry=5; + + upsdebugx (4, "received ACK"); + break; + } else if ((i == -1) || (i == -3)) { + /* retry a finite number of times if something wrong happened while + * sending like a notification or a NACK */ + if (Retry >= MAX_TRY) { + upsdebugx(2, "Max tries reached while waiting for ACK, still getting errors"); + return i; + } else { + upsdebugx(4, "Retry = %i", Retry); + /* Send a NACK to get a resend from the UPS */ + shut_token_send(SHUT_NOK); + Retry++; + } + } + } + return (datalen==0); +} + +int shut_packet_recv (u_char *Buf, int datalen) +{ + u_char Start[2]; + u_char Frame[8]; + u_char Chk[1]; + u_short Size=8; + u_short Pos=0; + u_char Retry=0; + int recv; + + upsdebugx (4, "entering shut_packet_recv (%i)", datalen); + + while(datalen>0 && Retry<3) + { + if(serial_read (DEFAULT_TIMEOUT, &Start[0]) >= 0) + { + if(Start[0]==SHUT_SYNC) + { + upsdebugx (4, "received SYNC token"); + memcpy(Buf, Start, 1); + return 1; + } + else + { + /* if(((Start[1] = serial_read (DEFAULT_TIMEOUT)) >= 0) && */ + if((serial_read (DEFAULT_TIMEOUT, &Start[1]) >= 0) && + ((Start[1]>>4)==(Start[1]&0x0F))) + { + upsdebug_hex(3, "Receive", Start, 2); + Size=Start[1]&0x0F; + for(recv=0;recv OK", Chk[0]); + memcpy(Buf, Frame, Size); + datalen-=Size; + Buf+=Size; + Pos+=Size; + Retry=0; + + shut_token_send(SHUT_OK); + + + /* Check if there are more data to receive */ + if((Start[0] & 0xf0) == SHUT_PKT_LAST) { + /* Check if it's a notification */ + if ((Start[0] & 0x0f) == SHUT_TYPE_NOTIFY) { + /* TODO: process notification (dropped for now) */ + upsdebugx (4, "=> notification"); + datalen+=Pos; + Pos=0; + } + else + return Pos; + } + else + upsdebugx (4, "need more data (%i)!", datalen); + } + else + { + upsdebugx (4, "shut_checksum: %02x => NOK", Chk[0]); + shut_token_send(SHUT_NOK); + Retry++; + } + } + else + return 0; + } + } + else + Retry++; + } /* while */ + return 0; +} + +/* + * Human Interface Device (HID) functions + *********************************************************************/ + +/********************************************************************** + * shut_get_descriptor(int desctype, u_char *pkt) + * + * get descriptor specified by DescType and return it in Buf + * + * desctype - from shutdataType + * pkt - where to store the report received + * + * return 0 on success, -1 on failure, -2 on NACK + * + *********************************************************************/ +int shut_get_descriptor(int desctype, u_char *pkt, int reportlen) +{ + hid_packet_t HIDRequest; + hid_data_t data; + int retcode; + + upsdebugx (2, "entering shut_get_descriptor(n %02x, %i)", + desctype, reportlen); + + HIDRequest.bmRequestType = REQUEST_TYPE_USB+(desctype>=HID_DESCRIPTOR?1:0); + HIDRequest.bRequest = 0x06; + HIDRequest.wValue = (desctype<<8); + HIDRequest.wIndex = 0x0000; + HIDRequest.wLength = reportlen; + + align_request(&HIDRequest); + + data.hid_pkt = HIDRequest; + +/* if((retcode = shut_packet_send (&data, sizeof(data), SHUT_PKT_LAST)) > 0) */ + if((retcode = shut_packet_send (&data, 8, SHUT_PKT_LAST)) > 0) + { + if((retcode = shut_packet_recv (pkt, reportlen)) > 0) + { + upsdebug_hex(3, "shut_get_descriptor", pkt, retcode); + return retcode; + } + else + return retcode; + } + return retcode; +} + +/********************************************************************** + * shut_get_string(int index, u_char *pkt, int reportlen) + * + * get descriptor specified by DescType and return it in Buf + * + * index - from shutdataType + * string - where to store the string received + * strlen - length of string + * + * return string size on success, -1 on failure, -2 on NACK + * + *********************************************************************/ +int shut_get_string(int strindex, char *string, int stringlen) +{ + hid_packet_t HIDRequest; + hid_data_t data; + int retcode; + u_char buf[MAX_STRING]; + + upsdebugx (2, "entering shut_get_string(%02x)", strindex); + + HIDRequest.bmRequestType = REQUEST_TYPE_USB; + HIDRequest.bRequest = 0x06; + HIDRequest.wValue = strindex+(STRING_DESCRIPTOR<<8); + HIDRequest.wIndex = 0x0000; + HIDRequest.wLength = (stringlen<<8); /* (reportlen&0xFF)&(reportlen>>8); */ + + align_request(&HIDRequest); + + data.hid_pkt = HIDRequest; + + if((retcode = shut_packet_send (&data, 8, SHUT_PKT_LAST)) >0) + { + upsdebug_hex(3, "shut_get_string", data.raw_pkt, 8); + if((retcode = shut_packet_recv (buf, stringlen)) > 0) + { + upsdebug_hex(3, "shut_get_string", buf, retcode); + make_string(buf, retcode, string); + upsdebugx(2, "string: %s", string); + return strlen(string); + } + else + return retcode; + } + return 0; +} + +/********************************************************************** + * shut_get_report(int id, u_char *pkt, int reportlen) + * + * get report specified by id and return it in pkt + * + * id - from shutdataType + * pkt - where to store the string received + * strlen - length of string + * + * return report size on success, -1 on failure, -2 on NACK + * + *********************************************************************/ +int shut_get_report(int id, u_char *pkt, int reportlen) +{ + hid_packet_t HIDRequest; + hid_data_t data; + int retcode; + + upsdebugx (2, "entering shut_get_report(id: %02x, len: %02x)", id, reportlen); + + HIDRequest.bmRequestType = REQUEST_TYPE_GET_REPORT; + HIDRequest.bRequest = 0x01; + HIDRequest.wValue = id+(HID_REPORT_TYPE_FEATURE<<8); + HIDRequest.wIndex = 0x0000; + HIDRequest.wLength = reportlen; + + align_request(&HIDRequest); + + data.hid_pkt = HIDRequest; + +/* if((retcode = shut_packet_send (&data, sizeof(data), SHUT_PKT_LAST)) > 0) */ + if((retcode = shut_packet_send (&data, 8, SHUT_PKT_LAST)) > 0) + { + if((retcode = shut_packet_recv (pkt, reportlen)) > 0) + { + upsdebug_hex(3, "shut_get_report", pkt, retcode); + return retcode; + } + else + return retcode; + } + return retcode; +} + +/********************************************************************** + * shut_set_report(int id, u_char *pkt, int reportlen) + * + * set report specified by id using pkt as value + * + * id - from shutdataType + * pkt - what to put in report + * strlen - length of report + * + * return string size on success, -1 on failure, -2 on NACK + * + *********************************************************************/ +int shut_set_report(int id, u_char *pkt, int reportlen) +{ + hid_packet_t HIDRequest; + hid_data_t data; + int retcode; + + upsdebugx (2, "entering shut_set_report(id: %02x, len: %02x)", id, reportlen); + + HIDRequest.bmRequestType = REQUEST_TYPE_SET_REPORT; + HIDRequest.bRequest = 0x09; + HIDRequest.wValue = id+(HID_REPORT_TYPE_FEATURE<<8); + HIDRequest.wIndex = 0x0000; + HIDRequest.wLength = reportlen; + + align_request(&HIDRequest); + + data.hid_pkt = HIDRequest; + + /* first packet to instruct a set command */ + if((retcode = shut_packet_send (&data, sizeof(data), 0x0)) > 0) + { + /* second packet to give the actual data */ + memcpy(&data.raw_pkt, pkt, reportlen); + upsdebug_hex(3, "Set2", pkt, reportlen); + + retcode = shut_packet_send (&data, reportlen, SHUT_PKT_LAST); + } + + return retcode; +} + +/********************************************************************** + * hid_init_device() + * + * Get Device/HID/Report descriptors from device and initialise + * HID Parser for further actions + * + * return 0 on success, -1 on failure + * + *********************************************************************/ +int hid_init_device() +{ + int retcode; + + /* Get HID descriptor */ + if((retcode = shut_get_descriptor(HID_DESCRIPTOR, hid_descriptor.raw_desc, 0x09)) > 0) + { + upsdebug_hex(3, "shut_get_descriptor(hid)", hid_descriptor.raw_desc, retcode); + + /* WORKAROUND: need to be fixed */ + hid_descriptor.hid_desc.wDescriptorLength = hid_descriptor.raw_desc[7] + + (hid_descriptor.raw_desc[8]<<8); + + upsdebugx(3, "HID Descriptor: \nbLength: \t\t0x%02x\nbDescriptorType: \t0x%02x\n", + hid_descriptor.hid_desc.bLength, + hid_descriptor.hid_desc.bDescriptorType); + + upsdebugx(3, "bcdHID: \t\t0x%04x\nbCountryCode: \t\t0x%02x\nbNumDescriptors: \t0x%02x\n", + hid_descriptor.hid_desc.bcdHID, + hid_descriptor.hid_desc.bCountryCode, + hid_descriptor.hid_desc.bNumDescriptors); + + upsdebugx(3, "bReportDescriptorType: \t0x%02x\nwDescriptorLength: \t0x%04x", + hid_descriptor.hid_desc.bReportDescriptorType, + hid_descriptor.hid_desc.wDescriptorLength); + + /* Get Device descriptor */ + if((retcode = shut_get_descriptor(DEVICE_DESCRIPTOR, device_descriptor.raw_desc, 0x12)) > 0) + { + upsdebug_hex(3, "shut_get_descriptor(device)", device_descriptor.raw_desc, retcode); + + upsdebugx(2, "Device Descriptor: \nbLength: \t\t0x%02x\nbDescriptorType:\ + \t0x%02x\nbcdUSB: \t\t0x%04x\nbDeviceClass: \t\t0x%02x\nbDeviceSubClass:\ + \t0x%02x\nbDeviceProtocol: \t0x%02x\nbMaxPacketSize0:\ + \t0x%02x\nidVendor: \t\t0x%04x\nidProduct: \t\t0x%04x\nbcdDevice:\ + \t\t0x%04x\niManufacturer: \t\t0x%02x\niProduct:\ + \t\t0x%02x\niSerialNumber: \t\t0x%02x\nbNumConfigurations: \t0x%02x\n", + device_descriptor.dev_desc.bLength, + device_descriptor.dev_desc.bDescriptorType, + device_descriptor.dev_desc.bcdUSB, + device_descriptor.dev_desc.bDeviceClass, + device_descriptor.dev_desc.bDeviceSubClass, + device_descriptor.dev_desc.bDeviceProtocol, + device_descriptor.dev_desc.bMaxPacketSize0, + device_descriptor.dev_desc.idVendor, + device_descriptor.dev_desc.idProduct, + device_descriptor.dev_desc.bcdDevice, + device_descriptor.dev_desc.iManufacturer, + device_descriptor.dev_desc.iProduct, + device_descriptor.dev_desc.iSerialNumber, + device_descriptor.dev_desc.bNumConfigurations); + + /* Get Report descriptor */ + if((retcode = shut_get_descriptor(REPORT_DESCRIPTOR, raw_buf, + hid_descriptor.hid_desc.wDescriptorLength)) > 0) { + + upsdebug_hex(3, "shut_get_descriptor(report)", raw_buf, retcode); + + /* Parse Report Descriptor */ + Free_ReportDesc(pDesc); + pDesc = Parse_ReportDesc(raw_buf, retcode); + if (!pDesc) { + fatalx(EXIT_FAILURE, "Failed to parse report descriptor: %s", strerror(errno)); + } + } + else + fatalx(EXIT_FAILURE, "Unable to get Report Descriptor"); + } + else + fatalx(EXIT_FAILURE, "Unable to get Device Descriptor"); + } + else + fatalx(EXIT_FAILURE, "Unable to get HID Descriptor"); + + return 0; +} + +/* translate HID string path to numeric path and return path depth */ +ushort lookup_path(const char *HIDpath, HIDData_t *data) +{ + ushort i = 0, cond = 1; + int cur_usage; + char buf[MAX_STRING]; + char *start, *end; + + strncpy(buf, HIDpath, strlen(HIDpath)); + buf[strlen(HIDpath)] = '\0'; + start = end = buf; + + upsdebugx(3, "entering lookup_path(%s)", buf); + + while (cond) { + + if ((end = strchr(start, '.')) == NULL) { + cond = 0; + } + else + *end = '\0'; + + upsdebugx(4, "parsing %s", start); + + /* lookup code */ + if ((cur_usage = hid_lookup_usage(start)) == -1) { + upsdebugx(4, "%s wasn't found", start); + return 0; + } + else { + data->Path.Node[i] = cur_usage; + i++; + } + + if(cond) + start = end +1 ; + } + data->Path.Size = i; + return i; +} + +/* Lookup this usage name to find its code (page + index) */ +int hid_lookup_usage(char *name) +{ + int i; + + upsdebugx(4, "Looking up %s", name); + + if (name[0] == '[') /* manage indexed collection */ + return (0x00FF0000 + atoi(&name[1])); + else { + for (i = 0; (usage_lkp[i].usage_code != 0x0); i++) + { + if (!strcmp(usage_lkp[i].usage_name, name)) + { + upsdebugx(4, "hid_lookup_usage: found %04x", + usage_lkp[i].usage_code); + return usage_lkp[i].usage_code; + } + } + } + return -1; +} + +/* Get an item value from a HID path */ +int hid_get_value(const char *item_path) +{ + int i, retcode; + HIDData_t hData; + + upsdebugx(3, "entering hid_get_value(%s)", item_path); + + /* Prepare path of HID object */ + hData.Type = ITEM_FEATURE; + hData.ReportID = 0; + + if((retcode = lookup_path(item_path, &hData)) > 0) { + upsdebugx(3, "Path depth = %i\n", retcode); + + for (i = 0; i 0) { + GetValue((const u_char *) raw_buf, &hData, &hValue); + upsdebug_hex(3, "Object's report", raw_buf, 10); + upsdebugx(3, "Value = %ld", hValue); + return 1; + } + else + shut_ups_start(); + } + else { + upsdebugx(3, "Can't find object"); + return 0; + } + } + else { + upsdebugx(3, "Can't lookup object's path"); + return 0; + } + + return 0; +} + + /* + * Internal functions + ****************************************************************************/ + +/* + * Filter and reformat HID strings (suppress space + * between each letter) + * Note: string format in HID String Descriptor is + * Byte1: Size of descriptor(=>string) + * Byte2: String descriptor type (always 0x03) + * Byte3 to byteN: UNICODE string (in US: xx 00 for a letter) + */ +void make_string(u_char *buf, int datalen, char *string) +{ + int i, /* Skip size and type */ + j=0; + + upsdebugx(4, "String descriptor: size = 0x%02x, type = 0x%02x", buf[0], buf[1]); + + /* TODO: add clean support for UNICODE */ + for(i=2;i0) + return (float) a * expo(a,b-1); + if (b<0) + return (float)((float)(1/(float)a) * (float) expo(a,b+1)); + + /* not reached */ + return -1; +} + +/* Format model names */ +const char *get_model_name(char *iProduct, char *iModel) +{ + models_name_t *model = NULL; + + upsdebugx(2, "get_model_name(%s, %s)\n", iProduct, iModel); + + /* Search for formatting rules */ + for ( model = models_names ; model->iProduct != NULL ; model++ ) + { + upsdebugx(2, "comparing with: %s", model->finalname); + if ( (!strncmp(iProduct, model->iProduct, strlen(model->iProduct))) + && (!strncmp(iModel, model->iModel, strlen(model->iModel))) ) + { + upsdebugx(2, "Found %s\n", model->finalname); + break; + } + } + /* FIXME: if we end up with model->iProduct == NULL + * then process name in a generic way (not yet supported models!) + */ + return model->finalname; +} + +/* set r/w INFO_ element to a value. */ +int hid_set_value(const char *varname, const char *val) +{ + int retcode, i, replen; + mge_info_item_t *shut_info_p; + HIDData_t hData; + + upsdebugx(2, "============== entering hid_set_value(%s, %s) ==============", varname, val); + + /* 1) retrieve and check netvar & item_path */ + shut_info_p = shut_find_info(varname); + + if (shut_info_p == NULL || shut_info_p->type == NULL || + !(shut_info_p->flags & SHUT_FLAG_OK)) + { + upsdebugx(2, "hid_ups_set: info element unavailable %s", varname); + return STAT_SET_UNKNOWN; + } + + /* Checking item writability and HID Path */ + if (!shut_info_p->flags & ST_FLAG_RW) { + upsdebugx(2, "hid_ups_set: not writable %s", varname); + return STAT_SET_UNKNOWN; + } + + /* handle server side variable */ + if (shut_info_p->shut_flags & SHUT_FLAG_ABSENT) { + upsdebugx(2, "hid_ups_set: setting server side variable %s", varname); + dstate_setinfo(shut_info_p->type, "%s", val); + return STAT_SET_HANDLED; + } else { + /* SHUT_FLAG_ABSENT is the only case of HID Path == NULL */ + if (shut_info_p->item_path == NULL) { + upsdebugx(2, "hid_ups_set: ID Path is NULL for %s", varname); + return STAT_SET_UNKNOWN; + } + } + + /* Prepare path of HID object */ + hData.Type = ITEM_FEATURE; + hData.ReportID = 0; + + if((retcode = lookup_path(shut_info_p->item_path, &hData)) > 0) { + upsdebugx(3, "Path depth = %i\n", retcode); + + for (i = 0; i disabled for now + if (shut_get_report(hData.ReportID, raw_buf, MAX_REPORT_SIZE) > 0) { + GetValue((const u_char *) raw_buf, &hData, &hValue); + upsdebugx(3, "Value = %d", hValue); + + if (hValue != atol(val)) + upsdebugx(3, "FAILED"); + else + upsdebugx(3, "SUCCEED"); + } else + upsdebugx(3, "FAILED"); + */ + return STAT_SET_HANDLED; + } + else + upsdebugx(3, "Object is constant"); + } + else + upsdebugx(3, "Can't find object"); + } + else + upsdebugx(3, "Can't lookup object's path"); + + return STAT_SET_UNKNOWN; +} + +/* find info element definition in my info array. */ +mge_info_item_t *shut_find_info(const char *varname) +{ + mge_info_item_t *shut_info_p; + + for (shut_info_p = &mge_info[0]; shut_info_p->type != NULL; shut_info_p++) + if (!strcasecmp(shut_info_p->type, varname)) + return shut_info_p; + + fatalx(EXIT_FAILURE, "shut_find_info: unknown info type: %s", varname); + return NULL; +} + +/* find the NUT value matching that HID Item value */ +static const char *hu_find_infoval(info_lkp_t *hid2info, long value) +{ + info_lkp_t *info_lkp; + + upsdebugx(3, "hu_find_infoval: searching for value = %ld\n", value); + + for (info_lkp = hid2info; (info_lkp != NULL) && + (strcmp(info_lkp->nut_value, "NULL")); info_lkp++) { + + if (info_lkp->hid_value == value) { + upsdebugx(3, "hu_find_infoval: found %s (value: %ld)\n", + info_lkp->nut_value, value); + + return info_lkp->nut_value; + } + } + upsdebugx(3, "hu_find_infoval: no matching INFO_* value for this HID value (%ld)\n", value); + return NULL; +} diff --git a/drivers/mge-shut.h b/drivers/mge-shut.h new file mode 100644 index 0000000..850be4d --- /dev/null +++ b/drivers/mge-shut.h @@ -0,0 +1,523 @@ +/* mge-shut.h - monitor MGE UPS for NUT with SHUT protocol + * + * Copyright (C) 2002 - 2005 + * Arnaud Quette & + * Philippe Marzouk + * + * Sponsored by MGE UPS SYSTEMS + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "hidparser.h" +#include "hidtypes.h" + +#define DEFAULT_TIMEOUT 3000 +#define MAX_STRING 64 + +#define DEFAULT_LOWBATT 30 /* low battery level, in % */ +#define DEFAULT_ONDELAY 3 /* delay between return of utility power + and powering up of load, in 10 seconds units */ +#define DEFAULT_OFFDELAY 20 /* delay befor power off, in seconds */ +#define OFF_NOTIFICATION 1 /* notification off */ + +#define LIGHT_NOTIFICATION 2 /* light notification */ +#define COMPLETE_NOTIFICATION 3 /* complete notification for UPSs which do + * not support disabling it like some early + * Ellipse models */ +#define DEFAULT_NOTIFICATION COMPLETE_NOTIFICATION + +/* HID definitions */ + +#define HID_REPORT_TYPE_INPUT 0x01 +#define HID_REPORT_TYPE_OUTPUT 0x02 +#define HID_REPORT_TYPE_FEATURE 0x03 + +#define REQUEST_TYPE_USB 0x80 +#define REQUEST_TYPE_HID 0x81 +#define REQUEST_TYPE_GET_REPORT 0xa1 +#define REQUEST_TYPE_SET_REPORT 0x21 + +#define DEVICE_DESCRIPTOR 0x0001 +#define CONFIG_DESCRIPTOR 0x0002 +#define STRING_DESCRIPTOR 0x0003 +#define INTERFACE_DESCRIPTOR 0x0004 +#define ENDPOINT_DESCRIPTOR 0x0005 +#define HID_DESCRIPTOR 0x0021 +#define REPORT_DESCRIPTOR 0x0022 + +#define MAX_REPORT_SIZE 0x1800 + +/* SHUT definitions - From Simplified SHUT spec */ + +#define SHUT_TYPE_REQUEST 0x01 +#define SHUT_TYPE_RESPONSE 0x04 +#define SHUT_TYPE_NOTIFY 0x05 +#define SHUT_OK 0x06 +#define SHUT_NOK 0x15 +#define SHUT_SYNC 0x16 /* complete notifications - not yet managed + but needed for some early Ellipse models */ +#define SHUT_SYNC_LIGHT 0x17 /* partial notifications */ +#define SHUT_SYNC_OFF 0x18 /* disable notifications - only do polling */ +#define SHUT_PKT_LAST 0x80 + +/* From SHUT specifications */ + +typedef struct hid_packet { + unsigned char bmRequestType; + unsigned char bRequest; + unsigned short wValue; + unsigned short wIndex; + unsigned short wLength; +/* unsigned char padding[8]; for use with shut_set_report */ +} hid_packet_t; + +typedef union hid_data_u { + hid_packet_t hid_pkt; + unsigned char raw_pkt[8]; /* max report lengh, was 8 */ +} hid_data_t; + +typedef struct shut_packet { + unsigned char bType; + unsigned char bLength; + hid_data_t data; + unsigned char bChecksum; +} shut_packet_t; + +typedef union shut_data_u { + shut_packet_t shut_pkt; + unsigned char raw_pkt[11]; +} shut_data_t; + +/* From USB/HID specifications */ + +typedef struct hid_descriptor { + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdHID; + unsigned char bCountryCode; + unsigned char bNumDescriptors; + unsigned char bReportDescriptorType; + unsigned short wDescriptorLength; +} hid_descriptor_t; + +typedef union hid_desc_data_u { + hid_descriptor_t hid_desc; + unsigned char raw_desc[9]; /* max report lengh, aws 9 */ +} hid_desc_data_t; + +typedef struct device_descriptor { + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdUSB; + unsigned char bDeviceClass; + unsigned char bDeviceSubClass; + unsigned char bDeviceProtocol; + unsigned char bMaxPacketSize0; + unsigned short idVendor; + unsigned short idProduct; + unsigned short bcdDevice; + unsigned char iManufacturer; + unsigned char iProduct; + unsigned char iSerialNumber; + unsigned char bNumConfigurations; +} device_descriptor_t; + +typedef union device_desc_data_u { + device_descriptor_t dev_desc; + unsigned char raw_desc[18]; +} device_desc_data_t; + +/* --------------------------------------------------------------- */ +/* Explicit Booleans */ +/* --------------------------------------------------------------- */ + +#define SHUT_FLAG_OK (1 << 0) /* show element to upsd. */ +#define SHUT_FLAG_STATIC (1 << 1) /* retrieve info only once. */ +#define SHUT_FLAG_ABSENT (1 << 2) /* data is absent in the device, + use default value. */ +#define SHUT_FLAG_STALE (1 << 3) /* data stale, don't try too often. */ +#define SHUT_FLAG_DELAY (1 << 4) /* delay type value: formated differently. */ + +/* --------------------------------------------------------------- */ +/* Model Name formating entries */ +/* --------------------------------------------------------------- */ +typedef struct { + const char *iProduct; + const char *iModel; + const char *finalname; +} models_name_t; + +models_name_t models_names [] = + { + /* Ellipse models */ + { "ELLIPSE", "300", "ellipse 300" }, + { "ELLIPSE", "500", "ellipse 500" }, + { "ELLIPSE", "650", "ellipse 650" }, + { "ELLIPSE", "800", "ellipse 800" }, + { "ELLIPSE", "1200", "ellipse 1200" }, + /* Ellipse Premium models */ + { "ellipse", "PR500", "ellipse premium 500" }, + { "ellipse", "PR650", "ellipse premium 650" }, + { "ellipse", "PR800", "ellipse premium 800" }, + { "ellipse", "PR1200", "ellipse premium 1200" }, + /* Ellipse "Pro" */ + { "ELLIPSE", "600", "Ellipse 600" }, + { "ELLIPSE", "750", "Ellipse 750" }, + { "ELLIPSE", "1000", "Ellipse 1000" }, + { "ELLIPSE", "1500", "Ellipse 1500" }, + /* Ellipse "MAX" */ + { "Ellipse MAX", "600", "Ellipse MAX 600" }, + { "Ellipse MAX", "850", "Ellipse MAX 850" }, + { "Ellipse MAX", "1100", "Ellipse MAX 1100" }, + { "Ellipse MAX", "1500", "Ellipse MAX 1500" }, + /* Protection Center */ + { "PROTECTIONCENTER", "420", "Protection Center 420" }, + { "PROTECTIONCENTER", "500", "Protection Center 500" }, + { "PROTECTIONCENTER", "675", "Protection Center 675" }, + /* Pulsar Evolution models */ + { "Evolution", "500", "Pulsar Evolution 500" }, + { "Evolution", "800", "Pulsar Evolution 800" }, + { "Evolution", "1100", "Pulsar Evolution 1100" }, + { "Evolution", "1500", "Pulsar Evolution 1500" }, + { "Evolution", "2200", "Pulsar Evolution 2200" }, + { "Evolution", "3000", "Pulsar Evolution 3000" }, + { "Evolution", "3000XL", "Pulsar Evolution 3000 XL" }, + /* Newer Evolution models */ + { "Evolution", "650", "Evolution 650" }, + { "Evolution", "850", "Evolution 850" }, + { "Evolution", "1150", "Evolution 1150" }, + { "Evolution", "S 1250", "Evolution S 1250" }, + { "Evolution", "1550", "Evolution 1550" }, + { "Evolution", "S 1750", "Evolution S 1750" }, + { "Evolution", "2000", "Evolution 2000" }, + { "Evolution", "S 2500", "Evolution S 2500" }, + { "Evolution", "S 3000", "Evolution S 3000" }, + /* Pulsar M models */ + { "PULSAR M", "2200", "Pulsar M 2200" }, + { "PULSAR M", "3000", "Pulsar M 3000" }, + { "PULSAR M", "3000 XL", "Pulsar M 3000 XL" }, + /* Eaton'ified names */ + { "EX", "2200", "EX 2200" }, + { "EX", "3000", "EX 3000" }, + { "EX", "3000 XL", "EX 3000 XL" }, + /* Pulsar models */ + { "Pulsar", "700", "Pulsar 700" }, + { "Pulsar", "1000", "Pulsar 1000" }, + { "Pulsar", "1500", "Pulsar 1500" }, + { "Pulsar", "1000 RT2U", "Pulsar 1000 RT2U" }, + { "Pulsar", "1500 RT2U", "Pulsar 1500 RT2U" }, + /* Eaton'ified names */ + { "EX", "700", "EX 700" }, + { "EX", "1000", "EX 1000" }, + { "EX", "1500", "EX 1500" }, + { "EX", "1000 RT2U", "EX 1000 RT2U" }, + { "EX", "1500 RT2U", "EX 1500 RT2U" }, + /* Pulsar MX models */ + { "PULSAR", "MX4000", "Pulsar MX 4000 RT" }, + { "PULSAR", "MX5000", "Pulsar MX 5000 RT" }, + /* NOVA models */ + { "NOVA AVR", "600", "NOVA 600 AVR" }, + { "NOVA AVR", "625", "Nova AVR 625" }, + { "NOVA AVR", "1100", "NOVA 1100 AVR" }, + { "NOVA AVR", "1250", "Nova AVR 1250" }, + /* EXtreme C (EMEA) */ + { "EXtreme", "700C", "Pulsar EXtreme 700C" }, + { "EXtreme", "1000C", "Pulsar EXtreme 1000C" }, + { "EXtreme", "1500C", "Pulsar EXtreme 1500C" }, + { "EXtreme", "1500CCLA", "Pulsar EXtreme 1500C CLA" }, + { "EXtreme", "2200C", "Pulsar EXtreme 2200C" }, + { "EXtreme", "3200C", "Pulsar EXtreme 3200C" }, + /* EXtreme C (USA, aka "EX RT") */ + { "EX", "700RT", "Pulsar EX 700 RT" }, + { "EX", "1000RT", "Pulsar EX 1000 RT" }, + { "EX", "1500RT", "Pulsar EX 1500 RT" }, + { "EX", "2200RT", "Pulsar EX 2200 RT" }, + { "EX", "3200RT", "Pulsar EX 3200 RT" }, + /* Comet EX RT three phased */ + { "EX", "5RT31", "EX 5 RT 3:1" }, + { "EX", "7RT31", "EX 7 RT 3:1" }, + { "EX", "11RT31", "EX 11 RT 3:1" }, + /* Comet EX RT single phased */ + { "EX", "5RT", "EX 5 RT" }, + { "EX", "7RT", "EX 7 RT" }, + { "EX", "11RT", "EX 11 RT" }, + /* Galaxy 3000 */ + { "GALAXY", "3000_10", "Galaxy 3000 10 kVA" }, + { "GALAXY", "3000_15", "Galaxy 3000 15 kVA" }, + { "GALAXY", "3000_20", "Galaxy 3000 20 kVA" }, + { "GALAXY", "3000_30", "Galaxy 3000 30 kVA" }, + + /* FIXME: To be completed (Comet, Galaxy, Esprit, ...) */ + + /* end of structure. */ + { NULL, NULL, "Generic SHUT model" } +}; +/* for lookup between HID values and NUT values*/ +typedef struct { + long hid_value; /* HID value */ + const char *nut_value; /* NUT value */ +} info_lkp_t; + +/* Actual value lookup tables => should be fine for all Mfrs (TODO: validate it!) */ +/* --------------------------------------------------------------- */ +/* Lookup values between NUT and HID */ +/* --------------------------------------------------------------- */ +info_lkp_t onbatt_info[] = { + { 0, "OB" }, + { 1, "OL" }, + { 0, "NULL" } +}; +info_lkp_t discharging_info[] = { + { 1, "DISCHRG" }, + { 0, "NULL" } +}; +info_lkp_t charging_info[] = { + { 1, "CHRG" }, + { 0, "NULL" } +}; +info_lkp_t lowbatt_info[] = { + { 1, "LB" }, + { 0, "NULL" } +}; +info_lkp_t overbatt_info[] = { + { 1, "OVER" }, + { 0, "NULL" } +}; +info_lkp_t replacebatt_info[] = { + { 1, "RB" }, + { 0, "NULL" } +}; +info_lkp_t shutdownimm_info[] = { + { 1, "LB" }, + { 0, "NULL" } +}; +info_lkp_t trim_info[] = { + { 1, "TRIM" }, + { 0, "NULL" } +}; +info_lkp_t boost_info[] = { + { 1, "BOOST" }, + { 0, "NULL" } +}; +/* TODO: add BYPASS, OFF, CAL */ + +info_lkp_t test_write_info[] = { + { 0, "No test" }, + { 1, "Quick test" }, + { 2, "Deep test" }, + { 3, "Abort test" }, + { 0, "NULL" } +}; +info_lkp_t test_read_info[] = { + { 1, "Done and passed" }, + { 2, "Done and warning" }, + { 3, "Done and error" }, + { 4, "Aborted" }, + { 5, "In progress" }, + { 6, "No test initiated" }, + { 0, "NULL" } +}; + +/* --------------------------------------------------------------- */ +/* Query Commands and their Mapping to INFO_ Variables */ +/* --------------------------------------------------------------- */ + +/* Structure defining how to query UPS for a variable and write + information to INFO structure. +*/ +typedef struct { + const char *type; /* INFO_* element */ + int flags; /* INFO-element flags to set in addinfo */ + int length; /* INFO-element length of strings */ + const char *item_path; /* HID object (fully qualified string path) */ + const char *fmt; /* printf format string for INFO entry */ + const char *dfl; /* default value */ + unsigned long shut_flags; /* specific SHUT flags */ + info_lkp_t *hid2info; /* lookup table between HID and NUT values */ +} mge_info_item_t; + +/* Array containing information to translate between UTalk and NUT info + * NOTE: + * - Array is terminated by element with type NULL. + * - Essential INFO items (ups.{mfr, model, firmware, status} are + * handled separately. + * - Array is NOT const, since "shut_flags" can be changed. + */ + +/* FIXME: should be shared with mgehid.h */ +static mge_info_item_t mge_info[] = { + /* Battery page */ + { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimitSetting", + "%ld", NULL, SHUT_FLAG_OK, NULL }, /* RW, to be caught first if exists... */ + { "battery.charge.low", ST_FLAG_STRING, 5, "UPS.PowerSummary.RemainingCapacityLimit", + "%ld", NULL, SHUT_FLAG_OK, NULL }, /* ... or Read only */ + { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", "%.0d", NULL, SHUT_FLAG_OK, NULL }, + /* UPS page */ + { "ups.mfr", ST_FLAG_STRING, 20, NULL, "%s", "MGE UPS SYSTEMS", SHUT_FLAG_ABSENT | SHUT_FLAG_OK, NULL }, + { "ups.load", 0, 0, "UPS.PowerSummary.PercentLoad", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "ups.timer.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.DelayBeforeShutdown", + "%ld", NULL, SHUT_FLAG_OK | SHUT_FLAG_DELAY, NULL }, + { "ups.timer.reboot", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.DelayBeforeReboot", + "%ld", NULL, SHUT_FLAG_OK | SHUT_FLAG_DELAY, NULL }, + { "ups.timer.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerSummary.DelayBeforeStartup", + "%ld", NULL, SHUT_FLAG_OK | SHUT_FLAG_DELAY, NULL }, + /* FIXME: miss ups.power */ + { "ups.power.nominal", ST_FLAG_STRING, 5, "UPS.Flow.[4].ConfigApparentPower", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "ups.test.interval", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.BatterySystem.Battery.TestPeriod", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "ups.test.result", ST_FLAG_STRING, 5, "UPS.BatterySystem.Battery.Test", + "%i", NULL, SHUT_FLAG_OK, &test_read_info[0] }, + + /* Output page */ + { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "output.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "output.current", 0, 0, "UPS.PowerSummary.Output.Current", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", "%i", NULL, SHUT_FLAG_OK, NULL }, + + /* Outlet page (using MGE UPS SYSTEMS - PowerShare technology) */ + /* TODO: add an iterative semantic [%x] to factorise outlets */ + { "outlet.id", 0, 0, "UPS.OutletSystem.Outlet.[1].OutletID", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[1].OutletID", + "%s", "Main Outlet", SHUT_FLAG_ABSENT | SHUT_FLAG_OK, NULL }, + { "outlet.switchable", 0, 0, "UPS.OutletSystem.Outlet.[1].PresentStatus.Switchable", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.id", 0, 0, "UPS.OutletSystem.Outlet.[2].OutletID", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[2].OutletID", + "%s", "PowerShare Outlet 1", SHUT_FLAG_ABSENT | SHUT_FLAG_OK, NULL }, + { "outlet.1.switchable", 0, 0, "UPS.OutletSystem.Outlet.[2].PresentStatus.Switchable", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.switch", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.OutletSystem.Outlet.[2].PresentStatus.SwitchOn/Off", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, + "UPS.OutletSystem.Outlet.[2].RemainingCapacityLimit", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, + "UPS.OutletSystem.Outlet.[2].DelayBeforeShutdown", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.1.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.OutletSystem.Outlet.[2].DelayBeforeStartup", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.id", 0, 0, "UPS.OutletSystem.Outlet.[3].OutletID", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, "UPS.OutletSystem.Outlet.[3].OutletID", + "%s", "PowerShare Outlet 2", SHUT_FLAG_ABSENT | SHUT_FLAG_OK, NULL }, + { "outlet.2.switchable", 0, 0, "UPS.OutletSystem.Outlet.[3].PresentStatus.Switchable", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.switch", ST_FLAG_RW | ST_FLAG_STRING, 2, "UPS.OutletSystem.Outlet.[3].PresentStatus.SwitchOn/Off", + "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.autoswitch.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 3, + "UPS.OutletSystem.Outlet.[3].RemainingCapacityLimit", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 5, + "UPS.OutletSystem.Outlet.[3].DelayBeforeShutdown", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "outlet.2.delay.start", ST_FLAG_RW | ST_FLAG_STRING, 5, + "UPS.OutletSystem.Outlet.[3].DelayBeforeStartup", "%i", NULL, SHUT_FLAG_OK, NULL }, + + /* Input page */ + { "input.voltage", 0, 0, "UPS.PowerConverter.Input.[1].Voltage", "%i", NULL, SHUT_FLAG_OK, NULL }, + { "input.frequency", 0, 0, "UPS.PowerConverter.Input.[1].Frequency", "%i", NULL, SHUT_FLAG_OK, NULL }, + + /* terminating element */ + { NULL, 0, 0, "\0", "\0", NULL, 0, NULL } +}; + +/* temporary usage code lookup */ +typedef struct { + const char *usage_name; + const uint32_t usage_code; +} usage_lkp_t; + +/* FIXME: share this data structure with libhid.c */ +static usage_lkp_t usage_lkp[] = { + /* Power Device Page */ + { "PresentStatus", 0x00840002 }, + { "UPS", 0x00840004 }, + { "BatterySystem", 0x00840010 }, + { "Battery", 0x00840012 }, + { "BatteryID", 0x00840013 }, + { "PowerConverter", 0x00840016 }, + { "OutletSystem", 0x00840018 }, + { "Input", 0x0084001a }, + { "Output", 0x0084001c }, + { "Outlet", 0x00840020 }, + { "OutletID", 0x00840021 }, + { "PowerSummary", 0x00840024 }, + { "Voltage", 0x00840030 }, + { "Current", 0x00840031 }, + { "Frequency", 0x00840032 }, + { "PercentLoad", 0x00840035 }, + { "ConfigVoltage", 0x00840040 }, + { "ConfigCurrent", 0x00840041 }, + { "ConfigFrequency", 0x00840042 }, + { "ConfigApparentPower", 0x00840043 }, + { "LowVoltageTransfer", 0x00840053 }, + { "HighVoltageTransfer", 0x00840054 }, + { "DelayBeforeReboot", 0x00840055 }, + { "DelayBeforeStartup", 0x00840056 }, + { "DelayBeforeShutdown", 0x00840057 }, + { "Test", 0x00840058 }, + { "Good", 0x00840061 }, + { "Overload", 0x00840065 }, /* sic */ + { "SwitchOn/Off", 0x0084006b }, + { "Switchable", 0x0084006c }, + { "Used", 0x0084006d }, + { "Flow", 0x0084001e }, + /* Battery System Page */ + { "RemainingCapacityLimit", 0x00850029 }, + { "BelowRemainingCapacityLimit", 0x00850042 }, + { "RemainingCapacity", 0x00850066 }, + { "RunTimeToEmpty", 0x00850068 }, + { "ACPresent", 0x008500d0 }, + { "Charging", 0x00850044 }, + { "Discharging", 0x00850045 }, + { "NeedReplacement", 0x0085004b }, + /* MGE UPS SYSTEMS Page */ + { "iModel", 0xffff00f0 }, + { "RemainingCapacityLimitSetting", 0xffff004d }, + { "TestPeriod", 0xffff0001 }, + + { "\0", 0x0 } +}; + +/* SHUT / HID functions Prototypes */ + +int shut_ups_start(void); +u_char shut_checksum(const u_char *buf, int bufsize); +int shut_token_send(u_char token); +int shut_packet_send (hid_data_t *hdata, int datalen, u_char token); +int shut_packet_recv (u_char *Buf, int datalen); + +int shut_get_descriptor(int desctype, u_char *pkt, int reportlen); +int shut_get_string(int strindex, char *string, int stringlen); +int shut_get_report(int id, u_char *pkt, int reportlen); +int shut_set_report(int id, u_char *pkt, int reportlen); +int shut_identify_ups (void); +int shut_wait_ack (void); +void shut_ups_status(void); + +int hid_init_device(void); +const char *get_model_name(char *iProduct, char *iModel); +int hid_lookup_usage(char *name); +int hid_get_value(const char *item_path); +int hid_set_value(const char *varname, const char *val); +u_short lookup_path(const char *HIDpath, HIDData_t *data); + +int instcmd(const char *cmdname, const char *extra); +void setline(int set); +int serial_read (int read_timeout, u_char *readbuf); +int serial_send(u_char *buf, int len); + +void make_string(u_char *buf, int datalen, char *string); + + +mge_info_item_t *shut_find_info(const char *varname); diff --git a/drivers/mge-utalk.c b/drivers/mge-utalk.c index 86d272f..2935e91 100644 --- a/drivers/mge-utalk.c +++ b/drivers/mge-utalk.c @@ -30,44 +30,41 @@ /* * IMPLEMENTATION DETAILS - * + * * Not all UTalk models provide all possible information, settings and commands. * mge-utalk checks on startup which variables and commands are available from * the UPS, and re-reads these regularly. Thus, startup is a bit slow, but this * should not matter much. - * + * * mge-utalk.h defines a struct array that tells the driver how to read * variables from the UPS and publish them as NUT data. - * + * * "ups.status" variable is not included in this array, since it contains * information that requires several calls to the UPS and more advanced analysis * of the reponses. The function get_ups_status does this job. - * + * * Note that MGE enumerates the status "bits" from right to left, * i.e., if buf[] contains the reponse to command "Ss" (read system status), * then buf[0] contains "bit" Ss.1.7 (General alarm), while buf[7] contains - * "bit" Ss.1.0 (Load unprotected). - * + * "bit" Ss.1.0 (Load unprotected). + * * enable_ups_comm() is called before each attempt to read/write data * from/to the UPS to re synchronise the communication. */ -#include "config.h" /* must be the first header */ - #include #include #include "timehead.h" #include "main.h" #include "serial.h" #include "mge-utalk.h" -#include "nut_stdint.h" /* --------------------------------------------------------------- */ /* Define "technical" constants */ /* --------------------------------------------------------------- */ #define DRIVER_NAME "MGE UPS SYSTEMS/U-Talk driver" -#define DRIVER_VERSION "0.94" +#define DRIVER_VERSION "0.93" /* driver description structure */ @@ -99,12 +96,12 @@ upsdrv_info_t upsdrv_info = { #define MGE_REPLY_IGNCHAR "\r\n" #define MAXTRIES 10 /* max number of connect tries */ -#define BUFFLEN 256 +#define BUFFLEN 256 #define SD_RETURN 0 #define SD_STAYOFF 1 -static int sdtype = SD_RETURN; +int sdtype = SD_RETURN; static time_t lastpoll; /* Timestamp the last polling */ /* --------------------------------------------------------------- */ @@ -127,12 +124,12 @@ static int instcmd(const char *cmdname, const char *extra); static int setvar(const char *varname, const char *val); static void enable_ups_comm(void); static void disable_ups_comm(void); -static void extract_info(const char *buf, const mge_info_item_t *mge, - char *infostr, size_t infolen); +static void extract_info(const char *buf, const mge_info_item_t *mge, + char *infostr, int infolen); static const char *info_variable_cmd(const char *type); static bool_t info_variable_ok(const char *type); static int get_ups_status(void); -static ssize_t mge_command(char *reply, size_t replylen, const char *fmt, ...); +static int mge_command(char *reply, int replylen, const char *fmt, ...); /* --------------------------------------------------------------- */ /* UPS Driver Functions */ @@ -142,17 +139,17 @@ void upsdrv_makevartable(void) { char temp[BUFFLEN]; - snprintf(temp, sizeof(temp), - "Low battery level, in %% (default = %3d)", + snprintf(temp, sizeof(temp), + "Low battery level, in %% (default = %3d)", DEFAULT_LOWBATT); addvar (VAR_VALUE, "LowBatt", temp); - snprintf(temp, sizeof(temp), + snprintf(temp, sizeof(temp), "Delay before startup, in minutes (default = %3d)", DEFAULT_ONDELAY); addvar (VAR_VALUE, "OnDelay", temp); - snprintf(temp, sizeof(temp), + snprintf(temp, sizeof(temp), "Delay before shutdown, in seconds (default = %3d)", DEFAULT_OFFDELAY); addvar (VAR_VALUE, "OffDelay", temp); @@ -166,14 +163,14 @@ void upsdrv_initups(void) { char buf[BUFFLEN]; int RTS = TIOCM_RTS; - + upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); /* read command line/conf variable that affect comm. */ if (testvar ("oldmac")) RTS = ~TIOCM_RTS; - + /* Init serial line */ ioctl(upsfd, TIOCMBIC, &RTS); enable_ups_comm(); @@ -227,18 +224,18 @@ void upsdrv_initinfo(void) int table; int tries; int status_ok = 0; - ssize_t bytes_rcvd; + int bytes_rcvd; int si_data1 = 0; int si_data2 = 0; mge_info_item_t *item; models_name_t *model_info; mge_model_info_t *legacy_model; char infostr[32]; - ssize_t chars_rcvd; + int chars_rcvd; /* manufacturer -------------------------------------------- */ dstate_setinfo("ups.mfr", "MGE UPS SYSTEMS"); - + /* loop until we have at status */ tries = 0; do { @@ -323,13 +320,13 @@ void upsdrv_initinfo(void) } } - if (firmware && firmware[0] != '\0') + if ( firmware && strcmp(firmware, "")) dstate_setinfo("ups.firmware", "%s", firmware); else dstate_setinfo("ups.firmware", "unknown"); - + /* multiplier table */ - /* */ + /* */ bytes_rcvd = mge_command(buf, sizeof(buf), "Ai"); if (bytes_rcvd > 0 && buf[0] != '?') { @@ -344,7 +341,7 @@ void upsdrv_initinfo(void) /* status --- try only system status, to get the really important * information (OL, OB, LB); all else is added later by updateinfo */ status_ok = get_ups_status(); - + } while ( (!status_ok) && (tries++ < MAXTRIES) && (exit_flag != 1) ); if ( tries == MAXTRIES && !status_ok ) @@ -362,7 +359,7 @@ void upsdrv_initinfo(void) /* send request, read answer */ chars_rcvd = mge_command(buf, sizeof(buf), item->cmd); - + if ( chars_rcvd < 1 || buf[0] == '?' ) { item->ok = FALSE; upsdebugx(1, "initinfo: %s unavailable", item->type); @@ -407,7 +404,7 @@ void upsdrv_updateinfo(void) char buf[BUFFLEN]; char infostr[32]; int status_ok; - ssize_t bytes_rcvd; + int bytes_rcvd; mge_info_item_t *item; /* make sure that communication is enabled */ @@ -428,7 +425,7 @@ void upsdrv_updateinfo(void) } /* Don't overload old units (at startup) */ - if ( time(NULL) <= (lastpoll + poll_interval) ) + if ( (unsigned int)time(NULL) <= (unsigned int)(lastpoll + poll_interval) ) return; /* update all other ok variables */ @@ -440,7 +437,7 @@ void upsdrv_updateinfo(void) if ( item->ok ) { /* send request, read answer */ bytes_rcvd = mge_command(buf, sizeof(buf), item->cmd); - + if ( bytes_rcvd > 0 && buf[0] != '?' ) { extract_info(buf, item, infostr, sizeof(infostr)); dstate_setinfo(item->type, "%s", infostr); @@ -471,10 +468,10 @@ void upsdrv_shutdown(void) if (sdtype == SD_RETURN) { /* enable automatic restart */ mge_command(buf, sizeof(buf), "Sx 5"); - + upslogx(LOG_INFO, "UPS response to Automatic Restart was %s", buf); } - + /* Only call the effective shutoff if restart is ok */ /* or if we need only a stayoff... */ if (!strcmp(buf, "OK") || (sdtype == SD_STAYOFF)) { @@ -509,7 +506,7 @@ int instcmd(const char *cmdname, const char *extra) { mge_command(temp, sizeof(temp), "Bx 1"); upsdebugx(2, "UPS response to %s was %s", cmdname, temp); - + if(strcmp(temp, "OK")) return STAT_INSTCMD_UNKNOWN; else @@ -521,7 +518,7 @@ int instcmd(const char *cmdname, const char *extra) { mge_command(temp, sizeof(temp), "Sx 129"); upsdebugx(2, "UPS response to %s was %s", cmdname, temp); - + if(strcmp(temp, "OK")) return STAT_INSTCMD_UNKNOWN; else @@ -534,13 +531,13 @@ int instcmd(const char *cmdname, const char *extra) sdtype = SD_STAYOFF; upsdrv_shutdown(); } - + if (!strcasecmp(cmdname, "shutdown.return")) { sdtype = SD_RETURN; upsdrv_shutdown(); } - + /* Power Off [all] plugs */ if (!strcasecmp(cmdname, "load.off")) { @@ -553,10 +550,10 @@ int instcmd(const char *cmdname, const char *extra) else { mge_command(temp, sizeof(temp), "Wx 0"); - upsdebugx(2, "UPS response to %s was %s", cmdname, temp); + upsdebugx(2, "UPS response to %s was %s", cmdname, temp); if(strcmp(temp, "OK")) return STAT_INSTCMD_UNKNOWN; - else + else return STAT_INSTCMD_HANDLED; } } @@ -573,16 +570,16 @@ int instcmd(const char *cmdname, const char *extra) else { mge_command(temp, sizeof(temp), "Wx 1"); - upsdebugx(2, "UPS response to %s was %s", cmdname, temp); + upsdebugx(2, "UPS response to %s was %s", cmdname, temp); if(strcmp(temp, "OK")) return STAT_INSTCMD_UNKNOWN; - else + else return STAT_INSTCMD_HANDLED; } } /* Switch on/off Maintenance Bypass */ - if ((!strcasecmp(cmdname, "bypass.start")) + if ((!strcasecmp(cmdname, "bypass.start")) || (!strcasecmp(cmdname, "bypass.stop"))) { /* TODO: add control on bypass value */ @@ -599,17 +596,17 @@ int instcmd(const char *cmdname, const char *extra) /* Enable Maintenance Bypass */ mge_command(temp, sizeof(temp), "Px 3"); } - + upsdebugx(2, "UPS response to %s was %s", cmdname, temp); - + if(strcmp(temp, "OK")) return STAT_INSTCMD_UNKNOWN; else return STAT_INSTCMD_HANDLED; } } - - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -620,9 +617,9 @@ int setvar(const char *varname, const char *val) { char temp[BUFFLEN]; char cmd[15]; - + /* TODO : add some controls */ - + if(info_variable_ok(varname)) { /* format command */ @@ -634,7 +631,7 @@ int setvar(const char *varname, const char *val) upslogx(LOG_INFO, "setvar: UPS response to Set %s to %s was %s", varname, val, temp); } else upsdebugx(1, "setvar: Variable %s not supported by UPS", varname); - + return STAT_SET_UNKNOWN; } @@ -654,7 +651,7 @@ static void disable_ups_comm(void) static void enable_ups_comm(void) { char buf[8]; - + /* send Z twice --- speeds up re-connect */ mge_command(NULL, 0, "Z"); mge_command(NULL, 0, "Z"); @@ -664,7 +661,7 @@ static void enable_ups_comm(void) mge_command(NULL, 0, "Ax 1"); usleep(MGE_CONNECT_DELAY); } - + ser_flush_in(upsfd, "?\r\n", nut_debug_level); } @@ -673,25 +670,16 @@ static void enable_ups_comm(void) /* extract information from buffer in: buf : reply from UPS item : INFO item queried - out: infostr: to be placed in INFO_ variable + out: infostr: to be placed in INFO_ variable NOTE: buf="?" must be handled before calling extract_info buf is changed inspite of const !!!!! */ -static void extract_info(const char *buf, const mge_info_item_t *item, - char *infostr, size_t infolen) +static void extract_info(const char *buf, const mge_info_item_t *item, + char *infostr, int infolen) { /* initialize info string */ infostr[0] = '\0'; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif /* write into infostr with proper formatting */ if ( strpbrk(item->fmt, "feEgG") ) { /* float */ snprintf(infostr, infolen, item->fmt, @@ -702,9 +690,6 @@ static void extract_info(const char *buf, const mge_info_item_t *item, } else { snprintf(infostr, infolen, item->fmt, buf); } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } @@ -714,9 +699,9 @@ static void extract_info(const char *buf, const mge_info_item_t *item, /* get system status, at least: OB, OL, LB calls set_status appropriately tries MAXTRIES times - returns non-nil if successful + returns non-nil if successful - NOTE: MGE counts bytes/chars the opposite way as C, + NOTE: MGE counts bytes/chars the opposite way as C, see mge-utalk manpage. If status commands send two data items, these are separated by a space, so the elements of the second item are in buf[16..9]. @@ -724,13 +709,13 @@ static void extract_info(const char *buf, const mge_info_item_t *item, static int get_ups_status(void) { - char buf[BUFFLEN]; + char buf[BUFFLEN]; int rb_set= FALSE; /* has RB flag been set ? */ int over_set= FALSE; /* has OVER flag been set ? */ int tries = 0; int ok = FALSE; - ssize_t bytes_rcvd = 0; - + int bytes_rcvd = 0; + do { /* Check if we are asked to stop (reactivity++) */ if (exit_flag != 0) @@ -760,7 +745,7 @@ static int get_ups_status(void) if (buf[3] == '1') { rb_set = TRUE; - status_set("RB"); + status_set("RB"); } /* buf[2] not used */ if (buf[1] == '1') @@ -777,10 +762,10 @@ static int get_ups_status(void) if ( strlen(buf) > 7 ) { if ( !rb_set && ( buf[7] == '1' || buf[3] == '1' ) ) status_set("RB"); - + if (buf[1] == '1') status_set("CHRG"); - + if (buf[0] == '1') status_set("DISCHRG"); } /* if strlen */ @@ -810,7 +795,7 @@ static int get_ups_status(void) /* This is not the OFF status! if ( !(buf[8] == '1') ) status_set("OFF"); */ - } /* if strlen */ + } /* if strlen */ /* Bypass status */ mge_command(buf, sizeof(buf), "Ps"); @@ -824,39 +809,39 @@ static int get_ups_status(void) if (buf[6] == '1') status_set("BYPASS"); } /* if strlen */ - + } while ( !ok && tries++ < MAXTRIES ); status_commit(); - + return ok; } /* --------------------------------------------------------------- */ /* return proper variable "ok" given INFO_ type */ - -static bool_t info_variable_ok(const char *type) + +static bool_t info_variable_ok(const char *type) { mge_info_item_t *item = mge_info ; - + while ( strcasecmp(item->type, type )) item++; - + return item->ok; } /* --------------------------------------------------------------- */ /* return proper variable "cmd" given INFO_ type */ - -static const char *info_variable_cmd(const char *type) + +static const char *info_variable_cmd(const char *type) { mge_info_item_t *item = mge_info ; - + while ( strcasecmp(item->type, type )) item++; - + return item->cmd; } @@ -870,69 +855,60 @@ static const char *info_variable_cmd(const char *type) returns : no of chars received, -1 if error */ -static ssize_t mge_command(char *reply, size_t replylen, const char *fmt, ...) +static int mge_command(char *reply, int replylen, const char *fmt, ...) { const char *p; char command[BUFFLEN]; - ssize_t bytes_sent = 0; - ssize_t bytes_rcvd = 0; + int bytes_sent = 0; + int bytes_rcvd = 0; int ret; va_list ap; /* build command string */ va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif + ret = vsnprintf(command, sizeof(command), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif if ((ret < 1) || (ret >= (int) sizeof(command))) upsdebugx(4, "mge_command: command truncated"); - + va_end(ap); /* Delay a bit to avoid overlap of a previous answer (500 ms), as per * http://old.networkupstools.org/protocols/mge/9261zwfa.pdf § 6.1. Timings */ usleep(500000); - + /* flush received, unread data */ tcflush(upsfd, TCIFLUSH); - + /* send command */ for (p = command; *p; p++) { - if ( isprint((unsigned char)*p & 0xFF) ) + if ( isprint(*p & 0xFF) ) upsdebugx(4, "mge_command: sending [%c]", *p); else upsdebugx(4, "mge_command: sending [%02X]", *p); if (write(upsfd, p, 1) != 1) return -1; - + bytes_sent++; usleep(MGE_CHAR_DELAY); } /* send terminating string */ - for (p = MGE_COMMAND_ENDCHAR; *p; p++) { - if ( isprint((unsigned char)*p & 0xFF) ) - upsdebugx(4, "mge_command: sending [%c]", *p); - else - upsdebugx(4, "mge_command: sending [%02X]", *p); + if (MGE_COMMAND_ENDCHAR) { + for (p = MGE_COMMAND_ENDCHAR; *p; p++) { + if ( isprint(*p & 0xFF) ) + upsdebugx(4, "mge_command: sending [%c]", *p); + else + upsdebugx(4, "mge_command: sending [%02X]", *p); - if (write(upsfd, p, 1) != 1) - return -1; + if (write(upsfd, p, 1) != 1) + return -1; - bytes_sent++; - usleep(MGE_CHAR_DELAY); + bytes_sent++; + usleep(MGE_CHAR_DELAY); + } } if ( !reply ) @@ -943,7 +919,7 @@ static ssize_t mge_command(char *reply, size_t replylen, const char *fmt, ...) bytes_rcvd = ser_get_line(upsfd, reply, replylen, MGE_REPLY_ENDCHAR, MGE_REPLY_IGNCHAR, 3, 0); - upsdebugx(4, "mge_command: received %zd byte(s)", bytes_rcvd); + upsdebugx(4, "mge_command: received %d byte(s)", bytes_rcvd); return bytes_rcvd; } diff --git a/drivers/mge-utalk.h b/drivers/mge-utalk.h index 67b1135..4720cd3 100644 --- a/drivers/mge-utalk.h +++ b/drivers/mge-utalk.h @@ -28,9 +28,6 @@ * */ -#ifndef NUT_MGE_UTALK_H_SEEN -#define NUT_MGE_UTALK_H_SEEN 1 - /* --------------------------------------------------------------- */ /* Default Values for UPS Variables */ /* --------------------------------------------------------------- */ @@ -39,7 +36,7 @@ /* delay between return of utility power and powering up of load (in MINUTES) */ #define DEFAULT_ONDELAY 1 -#define DEFAULT_OFFDELAY 20 /* delay before power off, in SECONDS */ +#define DEFAULT_OFFDELAY 20 /* delay before power off, in SECONDS */ #define MIN_CONFIRM_TIME 3 /* shutdown must be confirmed in */ #define MAX_CONFIRM_TIME 15 /* this interval */ @@ -52,7 +49,7 @@ typedef struct { const char *finalname; } models_name_t; -static models_name_t Si1_models_names [] = +models_name_t Si1_models_names [] = { /* Pulsar EX */ { "Pulsar EX7", "Pulsar EX 7" }, @@ -145,10 +142,10 @@ static mge_model_info_t mge_model[] = { /* Multiplier Tables */ /* --------------------------------------------------------------- */ -/* First index : Table number, fetched with "Ai" command - * Second index: unit, as in enum above +/* First index : Table number, fetched with "Ai" command + * Second index: unit, as in enum above * NOTE: - * - to make the table index the same as the MGE table number, + * - to make the table index the same as the MGE table number, * dummy table row multiplier[0][] is inserted * - unit MIN2SEC is used to convert values in minutes sent by * the UPS (WAKEDELAY) to seconds @@ -156,11 +153,11 @@ static mge_model_info_t mge_model[] = { */ /* units in multiplier table */ -typedef enum eunits +typedef enum eunits { VOLT = 0, AMPERE, HERTZ, VOLTAMP, WATT, DEGCELS, MIN2SEC, NONE } units_t; static const double multiplier[4][8] = { -/* V A Hz VA W C MIN2SEC NONE */ +/* V A Hz VA W C MIN2SEC NONE */ { 1 , 1 , 1 , 1, 1, 1, 60, 1 }, { 1 , 1 , 0.1 , 1000, 1000, 1, 60, 1 }, { 0.01, 0.01, 1 , 1, 1, 1, 60, 1 }, @@ -191,7 +188,7 @@ typedef enum ebool { FALSE=0, TRUE } bool_t; typedef struct { const char *type; /* INFO_* element */ int flags; /* INFO-element flags to set in addinfo */ - int length; /* INFO-element length of strings */ + int length; /* INFO-element length of strings */ const char *cmd; /* UPS command string to requets element */ const char *fmt; /* printf format string for INFO entry */ units_t unit; /* unit of measurement, or NONE */ @@ -199,7 +196,7 @@ typedef struct { } mge_info_item_t; /* Array containing information to translate between UTalk and NUT info - * NOTE: + * NOTE: * - Array is terminated by element with type NULL. * - Essential INFO items (_MFR, _MODEL, _FIRMWARE, _STATUS) are * handled separately. @@ -234,7 +231,5 @@ static mge_info_item_t mge_info[] = { { "input.transfer.high", ST_FLAG_RW | ST_FLAG_STRING, 5, "Eu ?", "%05.1f", VOLT, TRUE }, { "input.transfer.trim.high", ST_FLAG_RW | ST_FLAG_STRING, 5, "Eu ?", "%05.1f", VOLT, TRUE }, /* terminating element */ - { NULL, 0, 0, "\0", "\0", NONE, FALSE } + { NULL, 0, 0, "\0", "\0", NONE, FALSE } }; - -#endif /* NUT_MGE_UTALK_H_SEEN */ diff --git a/drivers/mge-xml.c b/drivers/mge-xml.c index 4177b69..adb8262 100644 --- a/drivers/mge-xml.c +++ b/drivers/mge-xml.c @@ -2,8 +2,7 @@ Copyright (C) 2008-2009 Arjen de Korte - 2009-2021 Eaton (author: Arnaud Quette ) - 2017 Eaton (author: Jim Klimov ) + 2009 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,8 +19,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -33,28 +30,17 @@ #include "netxml-ups.h" #include "mge-xml.h" -#include "main.h" /* for testvar() */ - -#define MGE_XML_VERSION "MGEXML/0.36" +#define MGE_XML_VERSION "MGEXML/0.22" #define MGE_XML_INITUPS "/" #define MGE_XML_INITINFO "/mgeups/product.xml /product.xml /ws/product.xml" #define ST_FLAG_RW 0x0001 #define ST_FLAG_STATIC 0x0002 -static int mge_ambient_value = 0; +extern int shutdown_duration; -/* The number of phases is not present in XML data as a separate node, - * but we can infer it from presence of non-zero data on several - * per-line nodes. */ -static int - inited_phaseinfo_in = 0, - inited_phaseinfo_bypass = 0, - inited_phaseinfo_out = 0, - num_inphases = -1, - num_bypassphases = -1, - num_outphases = -1; +static int mge_ambient_value = 0; static char mge_scratch_buf[256]; @@ -63,9 +49,6 @@ static char val[128]; static int mge_shutdown_pending = 0; -/* This flag flips to 0 when/if we post the detailed deprecation message */ -static int mge_report_deprecation__convert_deci = 1; - typedef enum { ROOTPARENT = NE_XML_STATEROOT, @@ -131,9 +114,9 @@ typedef struct { NULL if no further processing is required) */ } xml_info_t; -static const char *online_info(const char *arg_val) +static const char *online_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(ONLINE); } else { STATUS_CLR(ONLINE); @@ -142,9 +125,9 @@ static const char *online_info(const char *arg_val) return NULL; } -static const char *discharging_info(const char *arg_val) +static const char *discharging_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(DISCHRG); /* Workaround NMC bug: both charging and discharging set to 1 */ if(STATUS_BIT(CHRG)) { @@ -157,9 +140,9 @@ static const char *discharging_info(const char *arg_val) return NULL; } -static const char *charging_info(const char *arg_val) +static const char *charging_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(CHRG); } else { STATUS_CLR(CHRG); @@ -168,9 +151,9 @@ static const char *charging_info(const char *arg_val) return NULL; } -static const char *lowbatt_info(const char *arg_val) +static const char *lowbatt_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(LOWBATT); } else { STATUS_CLR(LOWBATT); @@ -179,9 +162,9 @@ static const char *lowbatt_info(const char *arg_val) return NULL; } -static const char *overload_info(const char *arg_val) +static const char *overload_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(OVERLOAD); } else { STATUS_CLR(OVERLOAD); @@ -190,9 +173,9 @@ static const char *overload_info(const char *arg_val) return NULL; } -static const char *replacebatt_info(const char *arg_val) +static const char *replacebatt_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(REPLACEBATT); } else { STATUS_CLR(REPLACEBATT); @@ -201,9 +184,9 @@ static const char *replacebatt_info(const char *arg_val) return NULL; } -static const char *trim_info(const char *arg_val) +static const char *trim_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(TRIM); } else { STATUS_CLR(TRIM); @@ -212,9 +195,9 @@ static const char *trim_info(const char *arg_val) return NULL; } -static const char *boost_info(const char *arg_val) +static const char *boost_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(BOOST); } else { STATUS_CLR(BOOST); @@ -223,9 +206,9 @@ static const char *boost_info(const char *arg_val) return NULL; } -static const char *bypass_aut_info(const char *arg_val) +static const char *bypass_aut_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(BYPASSAUTO); } else { STATUS_CLR(BYPASSAUTO); @@ -234,9 +217,9 @@ static const char *bypass_aut_info(const char *arg_val) return NULL; } -static const char *bypass_man_info(const char *arg_val) +static const char *bypass_man_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(BYPASSMAN); } else { STATUS_CLR(BYPASSMAN); @@ -245,9 +228,9 @@ static const char *bypass_man_info(const char *arg_val) return NULL; } -static const char *off_info(const char *arg_val) +static const char *off_info(const char *val) { - if (arg_val[0] == '0') { + if (val[0] == '0') { STATUS_SET(OFF); } else { STATUS_CLR(OFF); @@ -259,9 +242,9 @@ static const char *off_info(const char *arg_val) /* note: this value is reverted (0=set, 1=not set). We report "battery not installed" rather than "battery installed", so that devices that don't implement this variable have a battery by default */ -static const char *nobattery_info(const char *arg_val) +static const char *nobattery_info(const char *val) { - if (arg_val[0] == '0') { + if (val[0] == '0') { STATUS_SET(NOBATTERY); } else { STATUS_CLR(NOBATTERY); @@ -270,9 +253,9 @@ static const char *nobattery_info(const char *arg_val) return NULL; } -static const char *fanfail_info(const char *arg_val) +static const char *fanfail_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(FANFAIL); } else { STATUS_CLR(FANFAIL); @@ -282,9 +265,9 @@ static const char *fanfail_info(const char *arg_val) } #if 0 -static const char *shutdownimm_info(const char *arg_val) +static const char *shutdownimm_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(SHUTDOWNIMM); } else { STATUS_CLR(SHUTDOWNIMM); @@ -294,9 +277,9 @@ static const char *shutdownimm_info(const char *arg_val) } #endif -static const char *overheat_info(const char *arg_val) +static const char *overheat_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(OVERHEAT); } else { STATUS_CLR(OVERHEAT); @@ -305,9 +288,9 @@ static const char *overheat_info(const char *arg_val) return NULL; } -static const char *commfault_info(const char *arg_val) +static const char *commfault_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(COMMFAULT); } else { STATUS_CLR(COMMFAULT); @@ -316,9 +299,9 @@ static const char *commfault_info(const char *arg_val) return NULL; } -static const char *internalfailure_info(const char *arg_val) +static const char *internalfailure_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(INTERNALFAULT); } else { STATUS_CLR(INTERNALFAULT); @@ -327,9 +310,9 @@ static const char *internalfailure_info(const char *arg_val) return NULL; } -static const char *battvoltlo_info(const char *arg_val) +static const char *battvoltlo_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(BATTVOLTLO); } else { STATUS_CLR(BATTVOLTLO); @@ -338,9 +321,9 @@ static const char *battvoltlo_info(const char *arg_val) return NULL; } -static const char *battvolthi_info(const char *arg_val) +static const char *battvolthi_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(BATTVOLTHI); } else { STATUS_CLR(BATTVOLTHI); @@ -349,9 +332,9 @@ static const char *battvolthi_info(const char *arg_val) return NULL; } -static const char *chargerfail_info(const char *arg_val) +static const char *chargerfail_info(const char *val) { - if ((arg_val[0] == '1') || !strncasecmp(arg_val, "Yes", 3)) { + if ((val[0] == '1') || !strncasecmp(val, "Yes", 3)) { STATUS_SET(CHARGERFAIL); } else { STATUS_CLR(CHARGERFAIL); @@ -360,9 +343,9 @@ static const char *chargerfail_info(const char *arg_val) return NULL; } -static const char *vrange_info(const char *arg_val) +static const char *vrange_info(const char *val) { - if ((arg_val[0] == '1') || !strncasecmp(arg_val, "Yes", 3)) { + if ((val[0] == '1') || !strncasecmp(val, "Yes", 3)) { STATUS_SET(VRANGE); } else { STATUS_CLR(VRANGE); @@ -371,9 +354,9 @@ static const char *vrange_info(const char *arg_val) return NULL; } -static const char *frange_info(const char *arg_val) +static const char *frange_info(const char *val) { - if ((arg_val[0] == '1') || !strncasecmp(arg_val, "Yes", 3)) { + if ((val[0] == '1') || !strncasecmp(val, "Yes", 3)) { STATUS_SET(FRANGE); } else { STATUS_CLR(FRANGE); @@ -382,9 +365,9 @@ static const char *frange_info(const char *arg_val) return NULL; } -static const char *fuse_fault_info(const char *arg_val) +static const char *fuse_fault_info(const char *val) { - if (arg_val[0] == '1') { + if (val[0] == '1') { STATUS_SET(FUSEFAULT); } else { STATUS_CLR(FUSEFAULT); @@ -393,112 +376,88 @@ static const char *fuse_fault_info(const char *arg_val) return NULL; } -static const char *yes_no_info(const char *arg_val) +static const char *yes_no_info(const char *val) { - switch(arg_val[0]) + switch(val[0]) { case '1': return "yes"; case '0': return "no"; default: - upsdebugx(2, "%s: unexpected value [%s]", __func__, arg_val); + upsdebugx(2, "%s: unexpected value [%s]", __func__, val); return ""; } } -static const char *on_off_info(const char *arg_val) +static const char *on_off_info(const char *val) { - switch(arg_val[0]) + switch(val[0]) { case '1': return "on"; case '0': return "off"; default: - upsdebugx(2, "%s: unexpected value [%s]", __func__, arg_val); + upsdebugx(2, "%s: unexpected value [%s]", __func__, val); return ""; } } -static const char *convert_deci(const char *arg_val) +static const char *convert_deci(const char *val) { - /* Note: this routine was needed for original MGE devices, before the company - * was bought out and split in 2007 between Eaton (1ph devices) and Schneider - * (3ph devices). Those firmwares back when the driver was written apparently - * served 10x the measured values. Not sure if any such units are in service - * now (with same FW, and with no upgrade path). Reign of XML/PDC is waning. - * For currently known NetXML servers, the value served is good without more - * conversions. If older devices pop up in the field, we can add an estimation - * by e.g. reported voltage and amps (to be an order of magnitude for power). - * Alternately we can look at model names and/or firmware versions or release - * dates, if we get those and if we know enough to map them to either logic. */ + snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.1f", 0.1 * (float)atoi(val)); - if (testvar("do_convert_deci")) { - /* Old code for old devices: */ - if (mge_report_deprecation__convert_deci) { - upslogx(LOG_NOTICE, "%s() is now deprecated, so values from XML are normally not decimated. This driver instance has however configured do_convert_deci in your ups.conf, so this behavior for old MGE NetXML-capable devices is preserved.", __func__); - mge_report_deprecation__convert_deci = 0; - } - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.1f", 0.1 * (float)(atoi(arg_val))); - return mge_scratch_buf; - } - - if (mge_report_deprecation__convert_deci) { - upslogx(LOG_NOTICE, "%s() is now deprecated, so values from XML are not decimated. If you happen to have an old MGE NetXML-capable device that now shows measurements 10x too big, and a firmware update does not solve this, please inform NUT devs via the issue tracker at %s with details about your hardware and firmware versions. Also try to enable do_convert_deci in your ups.conf", __func__, PACKAGE_BUGREPORT ); - mge_report_deprecation__convert_deci = 0; - } - upsdebugx(5, "%s() is now deprecated, so value '%s' is not decimated. If this change broke your setup, please see details logged above.", __func__, arg_val); - return arg_val; + return mge_scratch_buf; } /* Ignore a zero value if the UPS is not switched off */ -static const char *ignore_if_zero(const char *arg_val) +static const char *ignore_if_zero(const char *val) { - if (atoi(arg_val) == 0) { + if (atoi(val) == 0) { return NULL; } - return convert_deci(arg_val); + return convert_deci(val); } /* Set the 'ups.date' from the combined value * (ex. 2008/03/01 15:23:26) and return the time */ -static const char *split_date_time(const char *arg_val) +static const char *split_date_time(const char *val) { char *last = NULL; - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", arg_val); + snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%s", val); dstate_setinfo("ups.date", "%s", strtok_r(mge_scratch_buf, " -", &last)); return strtok_r(NULL, " ", &last); } -static const char *url_convert(const char *arg_val) +static const char *url_convert(const char *val) { char buf[256], *last = NULL; - snprintf(buf, sizeof(buf), "%s", arg_val); + snprintf(buf, sizeof(buf), "%s", val); snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "/%s", strtok_r(buf, " \r\n\t", &last)); return mge_scratch_buf; } -static const char *mge_battery_capacity(const char *arg_val) +static const char *mge_battery_capacity(const char *val) { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", (float)(atoi(arg_val)) / 3600.0); + snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", (float)atoi(val) / 3600); return mge_scratch_buf; } -static const char *mge_powerfactor_conversion(const char *arg_val) +static const char *mge_powerfactor_conversion(const char *val) { - snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", (float)(atoi(arg_val)) / 100.0); + snprintf(mge_scratch_buf, sizeof(mge_scratch_buf), "%.2f", (float)atoi(val) / 100); return mge_scratch_buf; } -static const char *mge_beeper_info(const char *arg_val) +static const char *mge_beeper_info(const char *val) { - switch (atoi(arg_val)) + switch (atoi(val)) { case 1: return "disabled"; @@ -510,9 +469,9 @@ static const char *mge_beeper_info(const char *arg_val) return NULL; } -static const char *mge_upstype_conversion(const char *arg_val) +static const char *mge_upstype_conversion(const char *val) { - switch (atoi(arg_val)) + switch (atoi(val)) { case 1: return "offline / line interactive"; @@ -528,9 +487,9 @@ static const char *mge_upstype_conversion(const char *arg_val) return NULL; } -static const char *mge_sensitivity_info(const char *arg_val) +static const char *mge_sensitivity_info(const char *val) { - switch (atoi(arg_val)) + switch (atoi(val)) { case 0: return "normal"; @@ -542,10 +501,9 @@ static const char *mge_sensitivity_info(const char *arg_val) return NULL; } -static const char *mge_test_result_info(const char *arg_val) +static const char *mge_test_result_info(const char *val) { - STATUS_CLR(CAL); - switch (atoi(arg_val)) + switch (atoi(val)) { case 1: return "done and passed"; @@ -556,7 +514,6 @@ static const char *mge_test_result_info(const char *arg_val) case 4: return "aborted"; case 5: - STATUS_SET(CAL); return "in progress"; case 6: return "no test initiated"; @@ -566,31 +523,12 @@ static const char *mge_test_result_info(const char *arg_val) return NULL; } -static const char *mge_ambient_info(const char *arg_val) +static const char *mge_ambient_info(const char *val) { switch (mge_ambient_value) { case 1: - return arg_val; - default: - return NULL; - } -} - -static const char *mge_drycontact_info(const char *arg_val) -{ - /* these values should theoretically be obtained through - * Environment.Input[1].State[x].Description - * Examples: - * open - * closed - */ - switch (atoi(arg_val)) - { - case 0: - return "opened"; - case 1: - return "closed"; + return val; default: return NULL; } @@ -614,9 +552,9 @@ static const char *mge_timer_shutdown(const char *delay_before_shutoff) return val; } -static const char *mge_shutdown_imminent(const char *arg_val) +static const char *mge_shutdown_imminent(const char *val) { - const int shutdown_delay = atoi(arg_val); + const int shutdown_delay = atoi(val); /* shutdown is already managed by mge_timer_shutdown, give up */ if(mge_shutdown_pending) { @@ -625,7 +563,7 @@ static const char *mge_shutdown_imminent(const char *arg_val) /* We may have "NONE" or "-1" or ?? as value * We also double check both the string and numeric values to be zero!*/ - if ((arg_val) && (arg_val[0] == '0') && (shutdown_delay == 0)) { + if ((val) && (val[0] == '0') && (shutdown_delay == 0)) { STATUS_SET(SHUTDOWNIMM); } else { STATUS_CLR(SHUTDOWNIMM); @@ -641,7 +579,6 @@ static xml_info_t mge_xml2nut[] = { /* Not used for now; might however be used in future for history & stats collection { "System.History.Log.Interval", ST_FLAG_RW, 0, "System.History.Log.Interval", 0, 0, NULL }, */ -#if (0) /* not interresting for NUT */ { "System.Environment.Log.Interval", ST_FLAG_RW, 0, "System.Environment.Log.Interval", 0, 0, NULL }, { "System.Outlet[1].iName", ST_FLAG_RW, 0, "System.Outlet[1].iName", 0, 0, NULL }, /* Mapped as ups.delay.shutdown @@ -685,6 +622,7 @@ static xml_info_t mge_xml2nut[] = { { "System.Password", ST_FLAG_RW, 0, "System.Password", 0, 0, NULL }, { "System.Security", ST_FLAG_RW, 0, "System.Security", 0, 0, NULL }, { "System.FirmwareUpgrade", ST_FLAG_RW, 0, "System.FirmwareUpgrade", 0, 0, NULL }, +#if (0) /* not interresting for NUT */ { "System.Network.SNMP.ReadCommunity", ST_FLAG_RW, 0, "System.Network.SNMP.ReadCommunity", 0, 0, NULL }, { "System.Network.SNMP.ReadCommunityName", 0, 0, "System.Network.SNMP.ReadCommunityName", 0, 0, NULL }, { "System.Network.SNMP.ReadCommunitySecurityLevel", 0, 0, "System.Network.SNMP.ReadCommunitySecurityLevel", 0, 0, NULL }, @@ -875,14 +813,19 @@ static xml_info_t mge_xml2nut[] = { { "System.ClientCfg.ShutdownDuration", ST_FLAG_RW, 0, "System.ClientCfg.ShutdownDuration", 0, 0, NULL }, { "System.ClientCfg.BroadcastAdmins", ST_FLAG_RW, 0, "System.ClientCfg.BroadcastAdmins", 0, 0, NULL }, { "System.ClientCfg.BroadcastUsers", ST_FLAG_RW, 0, "System.ClientCfg.BroadcastUsers", 0, 0, NULL }, +#endif /* not interresting for NUT */ { "Environment.iName", ST_FLAG_RW, 0, "Environment.iName", 0, 0, NULL }, { "Environment.Temperature.Unit", ST_FLAG_RW, 0, "Environment.Temperature.Unit", 0, 0, NULL }, + { "Environment.Temperature.HighThreshold", ST_FLAG_RW, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL }, + { "Environment.Temperature.LowThreshold", ST_FLAG_RW, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL }, { "Environment.Temperature.Hysteresis", ST_FLAG_RW, 0, "Environment.Temperature.Hysteresis", 0, 0, NULL }, { "Environment.Temperature.Offset", ST_FLAG_RW, 0, "Environment.Temperature.Offset", 0, 0, NULL }, { "Environment.Temperature.HighNotify", ST_FLAG_RW, 0, "Environment.Temperature.HighNotify", 0, 0, NULL }, { "Environment.Temperature.LowNotify", ST_FLAG_RW, 0, "Environment.Temperature.LowNotify", 0, 0, NULL }, { "Environment.Temperature.HighShutdown", ST_FLAG_RW, 0, "Environment.Temperature.HighShutdown", 0, 0, NULL }, { "Environment.Temperature.LowShutdown", ST_FLAG_RW, 0, "Environment.Temperature.LowShutdown", 0, 0, NULL }, + { "Environment.Humidity.HighThreshold", ST_FLAG_RW, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL }, + { "Environment.Humidity.LowThreshold", ST_FLAG_RW, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL }, { "Environment.Humidity.Hysteresis", ST_FLAG_RW, 0, "Environment.Humidity.Hysteresis", 0, 0, NULL }, { "Environment.Humidity.Offset", ST_FLAG_RW, 0, "Environment.Humidity.Offset", 0, 0, NULL }, { "Environment.Humidity.HighNotify", ST_FLAG_RW, 0, "Environment.Humidity.HighNotify", 0, 0, NULL }, @@ -907,7 +850,6 @@ static xml_info_t mge_xml2nut[] = { { "System.TimeNtp", ST_FLAG_RW, 0, "System.TimeNtp", 0, 0, NULL }, { "System.TimeZone", ST_FLAG_RW, 0, "System.TimeZone", 0, 0, NULL }, { "System.TimeDaylight", ST_FLAG_RW, 0, "System.TimeDaylight", 0, 0, NULL }, -#endif /* not interresting for NUT */ /* Special case: boolean values that are mapped to ups.status and ups.alarm */ { NULL, 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", 0, 0, online_info }, @@ -947,10 +889,12 @@ static xml_info_t mge_xml2nut[] = { { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", 0, 0, NULL }, { "battery.runtime.low", ST_FLAG_RW, 0, "System.RunTimeToEmptyLimit", 0, 0, NULL }, { "battery.temperature", 0, 0, "UPS.BatterySystem.Battery.Temperature", 0, 0, NULL }, - { "battery.packs.external", 0, 0, "UPS.BatterySystem.Battery.Count", 0, 0, NULL }, { "battery.type", ST_FLAG_STATIC, 0, "UPS.PowerSummary.iDeviceChemistry", 0, 0, NULL }, { "battery.type", ST_FLAG_STATIC, 0, "UPS.PowerSummary.iDeviceChemistery", 0, 0, NULL }, /* [sic] */ + { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", 0, 0, NULL }, { "battery.voltage.nominal", ST_FLAG_STATIC, 0, "UPS.BatterySystem.ConfigVoltage", 0, 0, NULL }, + { "battery.voltage.nominal", ST_FLAG_STATIC, 0, "UPS.PowerSummary.ConfigVoltage", 0, 0, NULL }, /* mge_battery_voltage_nominal */ + { "battery.current", 0, 0, "UPS.PowerSummary.Current", 0, 0, NULL }, { "battery.protection", 0, 0, "UPS.BatterySystem.Battery.DeepDischargeProtection", 0, 0, yes_no_info }, { "battery.energysave", 0, 0, "UPS.PowerConverter.Input[3].EnergySaving", 0, 0, yes_no_info }, @@ -971,7 +915,7 @@ static xml_info_t mge_xml2nut[] = { { "ups.delay.shutdown", ST_FLAG_RW, 0, "System.ShutdownDuration", 0, 0, NULL }, { "ups.timer.start", ST_FLAG_RW, 0, "UPS.PowerSummary.DelayBeforeStartup", 0, 0, NULL}, { "ups.timer.shutdown", ST_FLAG_RW, 0, "UPS.PowerSummary.DelayBeforeShutdown", 0, 0, mge_timer_shutdown }, - /* Catch shutdown imminent criteria, keep it after + /* Catch shutdown imminent criteria, keep it after UPS.PowerSummary.DelayBeforeShutdown managment */ { NULL, 0, 0, "System.RunTimeToShutdown", 0, 0, mge_shutdown_imminent }, { "ups.timer.reboot", 0, 0, "UPS.PowerSummary.DelayBeforeReboot", 0, 0, NULL }, @@ -980,15 +924,15 @@ static xml_info_t mge_xml2nut[] = { { "ups.beeper.status", 0 ,0, "UPS.BatterySystem.Battery.AudibleAlarmControl", 0, 0, mge_beeper_info }, { "ups.beeper.status", 0 ,0, "UPS.PowerSummary.AudibleAlarmControl", 0, 0, mge_beeper_info }, { "ups.temperature", 0, 0, "UPS.PowerSummary.Temperature", 0, 0, NULL }, - { "ups.power.nominal", ST_FLAG_STATIC, 0, "UPS.Flow[4].ConfigApparentPower", 0, 0, NULL }, { "ups.power", 0, 0, "UPS.PowerConverter.Output.ApparentPower", 0, 0, NULL }, - { "ups.L1.power", 0, 0, "UPS.PowerConverter.Output.Phase[1].ApparentPower", 0, 0, NULL }, - { "ups.L2.power", 0, 0, "UPS.PowerConverter.Output.Phase[2].ApparentPower", 0, 0, NULL }, - { "ups.L3.power", 0, 0, "UPS.PowerConverter.Output.Phase[3].ApparentPower", 0, 0, NULL }, + { "ups.L1.power", 0, 0, "UPS.PowerConverter.Output.Phase[1].ApparentPower", 0, 0, ignore_if_zero }, + { "ups.L2.power", 0, 0, "UPS.PowerConverter.Output.Phase[2].ApparentPower", 0, 0, ignore_if_zero }, + { "ups.L3.power", 0, 0, "UPS.PowerConverter.Output.Phase[3].ApparentPower", 0, 0, ignore_if_zero }, + { "ups.power.nominal", ST_FLAG_STATIC, 0, "UPS.Flow[4].ConfigApparentPower", 0, 0, NULL }, { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", 0, 0, NULL }, - { "ups.L1.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[1].ActivePower", 0, 0, NULL }, - { "ups.L2.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[2].ActivePower", 0, 0, NULL }, - { "ups.L3.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[3].ActivePower", 0, 0, NULL }, + { "ups.L1.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[1].ActivePower", 0, 0, ignore_if_zero }, + { "ups.L2.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[2].ActivePower", 0, 0, ignore_if_zero }, + { "ups.L3.realpower", 0, 0, "UPS.PowerConverter.Output.Phase[3].ActivePower", 0, 0, ignore_if_zero }, { "ups.realpower.nominal", ST_FLAG_STATIC, 0, "UPS.Flow[4].ConfigActivePower", 0, 0, NULL }, { "ups.start.auto", 0, 0, "UPS.PowerConverter.Input[1].AutomaticRestart", 0, 0, yes_no_info }, { "ups.start.battery", 0, 0, "UPS.PowerConverter.Input[3].StartOnBattery", 0, 0, yes_no_info }, @@ -1069,17 +1013,15 @@ static xml_info_t mge_xml2nut[] = { /* Ambient page */ { "ambient.humidity", 0, 0, "Environment.Humidity", 0, 0, NULL }, - { "ambient.humidity.high", ST_FLAG_RW, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL }, - { "ambient.humidity.low", ST_FLAG_RW, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL }, + { "ambient.humidity.high", 0, 0, "Environment.Humidity.HighThreshold", 0, 0, NULL }, + { "ambient.humidity.low", 0, 0, "Environment.Humidity.LowThreshold", 0, 0, NULL }, { "ambient.humidity.maximum", 0, 0, "Environment.PresentStatus.HighHumidity", 0, 0, mge_ambient_info }, { "ambient.humidity.minimum", 0, 0, "Environment.PresentStatus.LowHumidity", 0, 0, mge_ambient_info }, { "ambient.temperature", 0, 0, "Environment.Temperature", 0, 0, NULL }, - { "ambient.temperature.high", ST_FLAG_RW, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL }, - { "ambient.temperature.low", ST_FLAG_RW, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL }, + { "ambient.temperature.high", 0, 0, "Environment.Temperature.HighThreshold", 0, 0, NULL }, + { "ambient.temperature.low", 0, 0, "Environment.Temperature.LowThreshold", 0, 0, NULL }, { "ambient.temperature.maximum", 0, 0, "Environment.PresentStatus.HighTemperature", 0, 0, mge_ambient_info }, { "ambient.temperature.minimum", 0, 0, "Environment.PresentStatus.LowTemperature", 0, 0, mge_ambient_info }, - { "ambient.contacts.1.status", 0, 0, "Environment.Input[1].PresentStatus.State", 0, 0, mge_drycontact_info }, - { "ambient.contacts.2.status", 0, 0, "Environment.Input[2].PresentStatus.State", 0, 0, mge_drycontact_info }, /* Outlet page (using MGE UPS SYSTEMS - PowerShare technology) */ { "outlet.id", 0, 0, "UPS.OutletSystem.Outlet[1].OutletID", 0, 0, NULL }, @@ -1139,8 +1081,6 @@ static xml_info_t mge_xml2nut[] = { static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { int state = _UNEXPECTED; - NUT_UNUSED_VARIABLE(userdata); - NUT_UNUSED_VARIABLE(nspace); switch(parent) { @@ -1149,7 +1089,6 @@ static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, c /* name="Network Management Card" type="Mosaic M" version="BA" */ /* name="Network Management Card" type="Transverse" version="GB (SN 49EH29101)" */ /* name="Monitored ePDU" type="Monitored ePDU" version="Version Upgrade" */ - /* name="PDU Network Management Card" type="SCOB" version="02.00.0036" signature="34008876" protocol="XML.V4" */ int i; for (i = 0; atts[i] && atts[i+1]; i += 2) { if (!strcasecmp(atts[i], "name")) { @@ -1168,18 +1107,11 @@ static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, c snprintfcat(val, sizeof(val), "/%s", atts[i+1]); s = strstr(val, " (SN "); if (s) { - dstate_setinfo("ups.serial", "%s", str_rtrim(s + 5, ')')); + dstate_setinfo("ups.serial", "%s", rtrim(s + 5, ')')); s[0] = '\0'; } dstate_setinfo("ups.firmware.aux", "%s", val); } - /* netxml-ups currently only supports XML version 3 (for UPS), - * and not version 4 (for UPS and PDU)! */ - if (!strcasecmp(atts[i], "protocol")) { - if (!strcasecmp(atts[i+1], "XML.V4")) { - fatalx(EXIT_FAILURE, "XML v4 protocol is not supported!"); - } - } } state = PRODUCT_INFO; break; @@ -1382,12 +1314,8 @@ static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, c state = XC_GENERAL; break; } - /* FIXME? Is the fall-through to handling "GENERAL" intended? - * was so in legacy code before the goto below... */ - goto fallthrough_case_general; case XC_GENERAL: - fallthrough_case_general: if (!strcasecmp(name, "STARTUP")) { /* config="CENTRALIZED" */ state = XC_STARTUP; @@ -1421,8 +1349,6 @@ static int mge_xml_startelm_cb(void *userdata, int parent, const char *nspace, c /* Character data callback; may return non-zero to abort the parse. */ static int mge_xml_cdata_cb(void *userdata, int state, const char *cdata, size_t len) { - NUT_UNUSED_VARIABLE(userdata); - /* skip empty lines */ if ((len == 1) && (cdata[0] == '\n')) { upsdebugx(3, "%s: cdata ignored (state = %d)", __func__, state); @@ -1451,8 +1377,6 @@ static int mge_xml_endelm_cb(void *userdata, int state, const char *nspace, cons { xml_info_t *info; const char *value; - NUT_UNUSED_VARIABLE(userdata); - NUT_UNUSED_VARIABLE(nspace); /* ignore objects for which no value was set */ if (strlen(val) == 0) { @@ -1480,7 +1404,6 @@ static int mge_xml_endelm_cb(void *userdata, int state, const char *nspace, cons if (info->convert) { value = info->convert(val); - upsdebugx(4, "-> XML variable %s [%s] which maps to NUT variable %s was converted to value %s for the NUT driver state", var, val, info->nutname, value); } else { value = val; } @@ -1494,25 +1417,6 @@ static int mge_xml_endelm_cb(void *userdata, int state, const char *nspace, cons upsdebugx(3, "-> XML variable %s [%s] doesn't map to any NUT variable", var, val); break; - - case PI_GET_OBJECT: - case GET_OBJECT: - /* We've just got a snapshot of all runtime data, saved well into - * dstate's already, so can estimate missing values if needed. */ - - /* For phase setup, we assume it does not change during run-time. - * Essentially this means that once we've detected it is N-phase, - * it stays this way for the rest of the driver run/life-time. */ - /* To change this behavior just flip the maychange flag to "1" */ - - dstate_detect_phasecount("input.", 1, - &inited_phaseinfo_in, &num_inphases, 0); - dstate_detect_phasecount("input.bypass.", 1, - &inited_phaseinfo_bypass, &num_bypassphases, 0); - dstate_detect_phasecount("output.", 1, - &inited_phaseinfo_out, &num_outphases, 0); - - break; } return 0; @@ -1585,7 +1489,7 @@ char *vvalue_mge_xml2nut(const char *name, const char *value, size_t len) { /* Convert */ if (NULL != info->convert) { - char *vconv = (char *)info->convert(vcpy); + char *vconv = info->convert(vcpy); free(vcpy); @@ -1606,7 +1510,7 @@ void vname_register_rw(void) { xml_info_t *info = mge_xml2nut + i; if (NULL != info->nutname && info->nutflags & ST_FLAG_RW) { - dstate_setinfo(info->nutname, "%s", ""); + dstate_setinfo(info->nutname, ""); dstate_setflags(info->nutname, ST_FLAG_RW); } } diff --git a/drivers/mge-xml.h b/drivers/mge-xml.h index 97a30d6..27d4d1e 100644 --- a/drivers/mge-xml.h +++ b/drivers/mge-xml.h @@ -1,4 +1,4 @@ -/* mge-xml.h Model specific data for MGE XML protocol UPSes +/* mge-xml.h Model specific data for MGE XML protocol UPSes Copyright (C) 2008 Arjen de Korte diff --git a/drivers/microdowell.c b/drivers/microdowell.c index 846764e..a1d6605 100644 --- a/drivers/microdowell.c +++ b/drivers/microdowell.c @@ -26,14 +26,15 @@ anything else is mandatory */ +#define ENTERPRISE_PROTOCOL + +#include "microdowell.h" + #include "main.h" #include "serial.h" #include #include "timehead.h" -#include "nut_stdint.h" -#define ENTERPRISE_PROTOCOL -#include "microdowell.h" #define MAX_START_DELAY 999999 #define MAX_SHUTDOWN_DELAY 32767 @@ -42,7 +43,7 @@ #define MAX_SHUTDOWN_DELAY_LEN 5 #define DRIVER_NAME "MICRODOWELL UPS driver" -#define DRIVER_VERSION "0.02" +#define DRIVER_VERSION "0.01" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -53,41 +54,39 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static ENT_STRUCT ups ; - -/* common driver routines */ +ENT_STRUCT ups ; int instcmd(const char *cmdname, const char *extra); int setvar(const char *varname, const char *val); /* he knew... macros should evaluate their arguments only once */ #define CLAMP(x, min, max) (((x) < (min)) ? (min) : (((x) > (max)) ? (max) : (x))) -static int CheckDataChecksum(unsigned char *Buff, size_t Len) +static int CheckDataChecksum(unsigned char *Buff, int Len) { - size_t i, Idx ; - unsigned char Xor ; + int i, Idx ; + unsigned char Xor ; - ups.FramePointer = Xor = 0 ; - for (Idx=0 ; Idx < Len ; Idx++) - if (Buff[Idx] == STX_CHAR) - break ; + ups.FramePointer = Xor = 0 ; + for (Idx=0 ; Idx < Len ; Idx++) + if (Buff[Idx] == STX_CHAR) + break ; ups.FramePointer = Idx ; /* Memorise start point. */ - /* Check that the message is not to short... */ - if ( (Idx > (Len-4)) || (Idx+Buff[Idx+1]+2 > Len) ) - return(ERR_MSG_TOO_SHORT) ; /* Too short a message! */ + /* Check that the message is not to short... */ + if ( (Idx > (Len-4)) || (Idx+Buff[Idx+1]+2 > Len) ) + return(ERR_MSG_TOO_SHORT) ; /* To short message! */ - /* Calculate checksum */ - for (i=Idx+1 ; i < Idx+Buff[Idx+1]+2 ; i++) - Xor ^= Buff[i] ; + /* Calculate checksum */ + for (i=Idx+1 ; i < Idx+Buff[Idx+1]+2 ; i++) + Xor ^= Buff[i] ; - /* if Xor != then checksum error */ - if (Xor != Buff[i]) - return(ERR_MSG_CHECKSUM) ; /* error in checksum */ + /* if Xor != then checksum error */ + if (Xor != Buff[i]) + return(ERR_MSG_CHECKSUM) ; /* error in checksum */ - /* If checksum OK: return */ - return(0) ; + /* If checksum OK: return */ + return(0) ; } @@ -116,13 +115,13 @@ static const char *ErrMessages[] = { /* */ "" } ; -static const char *PrintErr(int ErrCode) +const char *PrintErr(int ErrCode) { int msgIndex = 0 ; /* The default 'msgIndex' is 0 (error code not defined) */ switch (ErrCode) { - case ERR_NO_ERROR : msgIndex = 19 ; break ; + case ERR_NO_ERROR : msgIndex = 19 ; break ; case ERR_I2C_BUSY : msgIndex = 1 ; break ; case ERR_CMD_CHECKSUM : msgIndex = 2 ; break ; @@ -143,21 +142,21 @@ static const char *PrintErr(int ErrCode) case ERR_COM_NO_CHARS : msgIndex = 16 ; break ; case ERR_MSG_TOO_SHORT : msgIndex = 17 ; break ; case ERR_MSG_CHECKSUM : msgIndex = 18 ; break ; - - default : msgIndex = 0 ; break ; + default: msgIndex = 0 ; break ; } return(ErrMessages[msgIndex]) ; } -static int CheckErrCode(unsigned char * Buff) -{ - auto int Ret ; - switch (Buff[2]) { - /* I have found an error */ - case CMD_NACK : - Ret = Buff[3] ; - break ; +int CheckErrCode(unsigned char * Buff) +{ + auto int Ret ; + + switch (Buff[2]) { + /* I have found an error */ + case CMD_NACK : + Ret = Buff[3] ; + break ; case CMD_ACK : case CMD_GET_STATUS : @@ -176,19 +175,19 @@ static int CheckErrCode(unsigned char * Buff) case CMD_SET_EEP_BLOCK : case CMD_GET_EEP_SEED : case CMD_INIT : - Ret = 0 ; - break ; + Ret = 0 ; + break ; - /* command not recognized */ - default: - Ret = ERR_CMD_UNRECOG ; - break ; - } - return(Ret) ; + /* command not recognized */ + default: + Ret = ERR_CMD_UNRECOG ; + break ; + } + return(Ret) ; } -static void SendCmdToSerial(unsigned char *Buff, size_t Len) +void SendCmdToSerial(unsigned char *Buff, int Len) { int i; unsigned char Tmp[20], Xor ; @@ -209,19 +208,22 @@ static void SendCmdToSerial(unsigned char *Buff, size_t Len) ser_send_buf(upsfd, Tmp, Len+3) ; /* send data to the UPS */ } -static unsigned char * CmdSerial(unsigned char *OutBuffer, size_t Len, unsigned char *RetBuffer) + + + +unsigned char * CmdSerial(unsigned char *OutBuffer, int Len, unsigned char *RetBuffer) { #define TMP_BUFF_LEN 1024 - unsigned char InpBuff[TMP_BUFF_LEN+1] ; + unsigned char InpBuff[TMP_BUFF_LEN+1] ; unsigned char TmpBuff[3] ; - int i, ErrCode ; - unsigned char *p ; - size_t BuffLen ; + int i, ErrCode ; + unsigned char *p ; + int BuffLen ; /* The default error code (no received character) */ ErrCode = ERR_COM_NO_CHARS ; - SendCmdToSerial(OutBuffer, Len) ; + SendCmdToSerial(OutBuffer, Len) ; usleep(10000) ; /* small delay (1/100 s) */ /* get chars until timeout */ @@ -271,6 +273,8 @@ static unsigned char * CmdSerial(unsigned char *OutBuffer, size_t Len, unsigned return(NULL) ; /* There have been errors in the reading of the data */ } + + static int detect_hardware(void) { unsigned char OutBuff[20] ; @@ -278,7 +282,6 @@ static int detect_hardware(void) unsigned char *p ; int i, retries ; struct tm *Time ; - struct tm tmbuf; time_t lTime ; ups.ge_2kVA = 0 ; @@ -293,7 +296,7 @@ static int detect_hardware(void) { /* got UPS model */ for (i=0 ; i<8 ; i++) - ups.UpsModel[i] = (char)p[i+5] ; + ups.UpsModel[i] = p[i+5] ; ups.UpsModel[8] = '\0' ; upsdebugx(2, "get 'UPS model': %s", PrintErr(ups.ErrCode)); break ; /* UPS identified: exit from ' for' LOOP */ @@ -318,7 +321,7 @@ static int detect_hardware(void) { /* got UPS serial # */ for (i=0 ; i<8 ; i++) - ups.SerialNumber[i] = (char)p[i+5] ; + ups.SerialNumber[i] = p[i+5] ; ups.SerialNumber[8] = '\0' ; upsdebugx(2, "get 'UPS Serial #': %s", PrintErr(ups.ErrCode)); } @@ -376,7 +379,6 @@ static int detect_hardware(void) return -1; } - /* Get working time (battery+normal)) */ OutBuff[0] = CMD_GET_EEP_BLOCK ; /* get EEPROM data */ OutBuff[1] = EEP_MIN_VBATT ; /* working time */ @@ -412,7 +414,6 @@ static int detect_hardware(void) return -1; } - /* Get the THRESHOLD table (1) */ OutBuff[0] = CMD_GET_EEP_BLOCK ; /* get EEPROM data */ OutBuff[1] = EEP_THRESHOLD_1 ; /* Thresholds table 0 */ @@ -430,7 +431,6 @@ static int detect_hardware(void) return -1; } - /* Get the THRESHOLD table (2) */ OutBuff[0] = CMD_GET_EEP_BLOCK ; /* get EEPROM data */ OutBuff[1] = EEP_THRESHOLD_2 ; /* Thresholds table 0 */ @@ -469,6 +469,7 @@ static int detect_hardware(void) } + /* Get UPS sensitivity (fault points) */ OutBuff[0] = CMD_GET_EEP_BLOCK ; /* get EEPROM data */ OutBuff[1] = EEP_FAULT_POINTS ; /* Number of fault points (sensitivity)) */ @@ -492,16 +493,15 @@ static int detect_hardware(void) return -1; } - /* Set internal UPS clock */ time(&lTime) ; - Time = localtime_r(&lTime, &tmbuf); + Time = localtime(&lTime) ; OutBuff[0] = CMD_SET_TIMER ; /* set UPS internal timer */ OutBuff[1] = (Time->tm_wday+6) % 7 ; /* week day (0=monday) */ - OutBuff[2] = (unsigned char)Time->tm_hour ; /* hours */ - OutBuff[3] = (unsigned char)Time->tm_min ; /* minutes */ - OutBuff[4] = (unsigned char)Time->tm_sec ; /* seconds */ + OutBuff[2] = Time->tm_hour ; /* hours */ + OutBuff[3] = Time->tm_min ; /* minutes */ + OutBuff[4] = Time->tm_sec; /* seconds */ if ((p = CmdSerial(OutBuff, LEN_SET_TIMER, InpBuff)) != NULL) { upsdebugx(2, "set 'UPS internal clock': %s", PrintErr(ups.ErrCode)); @@ -535,14 +535,10 @@ void upsdrv_updateinfo(void) status_init(); /* reset status flags */ /* store last UPS status */ - ups.StatusUPS = (uint32_t)p[0] ; - ups.StatusUPS |= ((uint32_t)p[1]<<8) ; - ups.StatusUPS |= ((uint32_t)p[2]<<16) ; - ups.StatusUPS |= ((uint32_t)p[3]<<24) ; - ups.ShortStatus = (uint16_t)p[0]; - ups.ShortStatus |= ((uint16_t)p[1]<<8) ; - upsdebugx(1, "ups.StatusUPS: %08" PRIX32, ups.StatusUPS); - upsdebugx(1, "ups.ShortStatus: %04" PRIX16, ups.ShortStatus); + ups.StatusUPS = (int)p[0] | ((int)p[1]<<8) | ((int)p[2]<<16) | ((int)p[3]<<24) ; + ups.ShortStatus = (int)p[0] | ((int)p[1]<<8) ; + upsdebugx(1, "ups.StatusUPS: %08lX", ups.StatusUPS); + upsdebugx(1, "ups.ShortStatus: %04X", ups.ShortStatus); /* on battery? */ if (p[0] & 0x01) @@ -646,6 +642,8 @@ void upsdrv_updateinfo(void) /* ========================= */ + + int instcmd(const char *cmdname, const char *extra) { unsigned char OutBuff[20] ; @@ -773,115 +771,52 @@ int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_UNKNOWN; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#if (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC) -# pragma GCC diagnostic ignored "-Wtautological-compare" -#endif int setvar(const char *varname, const char *val) { - unsigned int delay; + int delay; - if (sscanf(val, "%u", &delay) != 1) + if (sscanf(val, "%d", &delay) != 1) { return STAT_SET_UNKNOWN; } if (strcasecmp(varname, "ups.delay.start") == 0) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif delay = CLAMP(delay, 0, MAX_START_DELAY); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(1, "set 'WUDELAY': %u/%u", delay, ups.WakeUpDelay); + upsdebugx(1, "set 'WUDELAY': %d/%d", delay, ups.WakeUpDelay); ups.WakeUpDelay = delay ; - dstate_setinfo("ups.delay.start", "%u", ups.WakeUpDelay); + dstate_setinfo("ups.delay.start", "%d", ups.WakeUpDelay); dstate_dataok(); return STAT_SET_HANDLED; } if (strcasecmp(varname, "ups.delay.shutdown") == 0) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-compare" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wtautological-compare" -#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif delay = CLAMP(delay, 0, MAX_SHUTDOWN_DELAY); -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(1, "set 'SDDELAY': %u/%u", delay, ups.ShutdownDelay); + upsdebugx(1, "set 'SDDELAY': %d/%d", delay, ups.ShutdownDelay); ups.ShutdownDelay = delay; - dstate_setinfo("ups.delay.shutdown", "%u", ups.ShutdownDelay); + dstate_setinfo("ups.delay.shutdown", "%d", ups.ShutdownDelay); dstate_dataok(); return STAT_SET_HANDLED; } return STAT_SET_UNKNOWN; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (!defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) || defined (HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif + + void upsdrv_initinfo(void) { /* Get vars from ups.conf */ if (getval("ups.delay.shutdown")) { - int ipv = atoi(getval("ups.delay.shutdown")); - ups.ShutdownDelay = (unsigned int) CLAMP(ipv, 0, MAX_SHUTDOWN_DELAY); + ups.ShutdownDelay = CLAMP(atoi(getval("ups.delay.shutdown")), 0, MAX_SHUTDOWN_DELAY); } else { ups.ShutdownDelay = 120; /* Shutdown delay in seconds */ } if (getval("ups.delay.start")) { - int ipv = atoi(getval("ups.delay.start")); - ups.WakeUpDelay = (unsigned int) CLAMP(ipv, 0, MAX_START_DELAY); + ups.WakeUpDelay = CLAMP(atoi(getval("ups.delay.start")), 0, MAX_START_DELAY); } else { ups.WakeUpDelay = 10; /* WakeUp delay in seconds */ @@ -927,19 +862,23 @@ void upsdrv_initinfo(void) dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); + /* Register the available instant commands. */ -/* - dstate_addcmd("test.battery.start"); +/* dstate_addcmd("test.battery.start"); dstate_addcmd("test.battery.stop"); dstate_addcmd("shutdown.stop"); dstate_addcmd("beeper.toggle"); -*/ + */ /* set handlers */ upsh.instcmd = instcmd ; upsh.setvar = setvar; } + + + + void upsdrv_shutdown(void) { unsigned char OutBuff[20] ; @@ -955,14 +894,10 @@ void upsdrv_shutdown(void) status_init(); /* reset status flags */ /* store last UPS status */ - ups.StatusUPS = (uint32_t)p[0] ; - ups.StatusUPS |= ((uint32_t)p[1]<<8) ; - ups.StatusUPS |= ((uint32_t)p[2]<<16) ; - ups.StatusUPS |= ((uint32_t)p[3]<<24) ; - ups.ShortStatus = (uint16_t)p[0] ; - ups.ShortStatus |= ((uint16_t)p[1]<<8) ; - upsdebugx(1, "ups.StatusUPS: %08" PRIX32, ups.StatusUPS); - upsdebugx(1, "ups.ShortStatus: %04" PRIX16, ups.ShortStatus); + ups.StatusUPS = (int)p[0] | ((int)p[1]<<8) | ((int)p[2]<<16) | ((int)p[3]<<24) ; + ups.ShortStatus = (int)p[0] | ((int)p[1]<<8) ; + upsdebugx(1, "ups.StatusUPS: %08lX", ups.StatusUPS); + upsdebugx(1, "ups.ShortStatus: %04X", ups.ShortStatus); /* on battery? */ if (p[0] & 0x01) diff --git a/drivers/microdowell.h b/drivers/microdowell.h index 1750027..af5185c 100644 --- a/drivers/microdowell.h +++ b/drivers/microdowell.h @@ -4,322 +4,324 @@ #ifdef ENTERPRISE_PROTOCOL #include -#include "nut_stdint.h" - -#define STX_CHAR '[' -#define ERR_COM_NO_CHARS -999 /* nessun carattere dalla porta seriale */ -#define ERR_MSG_TOO_SHORT -998 /* messaggio troppo breve: non arriva sino al Checksum */ -#define ERR_MSG_CHECKSUM -997 /* checksum non valido */ -#define ERR_COM_TIMEOUT -996 /* timeout in lettura */ -#define ERR_CLR_RX_BUFF -900 /* bisogna cancellare il buffer (non è un errore!) */ -#define COMMAND_NOT_VALID -50 /* comando non valido */ -#define PARAMETER_NOT_VALID -51 /* parametro non valido */ -#define ERR_UPS_NOT_FOUND -10 /* non trovo un UPS */ -#define ERR_COM_PORT_OPEN -11 /* impossibile aprire la porta di comunicazione */ -#define ERR_COM_SET_PORT -12 /* impossibile configurare la porta di comunicazione */ -#define ERR_COM_UNDEF_PORT -20 /* porta non valida o non esistente */ -#define ERR_USB_DRIVER -13 /* impossibile aprire il driver USB */ -#define ERR_USB_COMM_KO -14 /* interfaccia USB OK: gruppo spento o guasto */ -#define ERR_UPS_UNKNOWN -30 /* impossibile identificare l'UPS */ -#define ERR_PRG_THREAD -40 /* impossibile creare uno thread */ -#define ERR_PRG_INVALID_DATA -60 /* dati non validi */ - -#define ERR_NO_ERROR 0x00 /* no errors */ -#define ERR_I2C_BUSY 0x01 /* I2C bus busy (e2prom) */ -#define ERR_CMD_CHECKSUM 0x10 /* Checksum not valid */ -#define ERR_CMD_UNRECOG 0x11 /* unrecognized command */ -#define ERR_EEP_NOBLOCK 0x08 /* WRITE: eeprom address not multiple of 8 */ -#define ERR_EEP_OOBOUND 0x09 /* READ: eeprom address out of bound (with size) */ -#define ERR_EEP_WADDR1 0x28 /* error writing e2prom address */ -#define ERR_EEP_WSADDR1 0x29 /* error writing e2prom subaddress */ -#define ERR_EEP_RDATA 0x2A /* error reading e2prom data */ -#define ERR_EEP_WADDR2 0x50 /* error writing e2prom address */ -#define ERR_EEP_WSADDR2 0x51 /* error reading e2prom subaddress */ -#define ERR_EEP_WDATA 0x52 /* error writing e2prom data */ -#define ERR_EEP_WADDRVER 0x53 /* error writing e2prom address during data verification */ -#define ERR_EEP_WDATAVER 0x54 /* error verification e2prom data */ -#define ERR_EEP_VERIFY 0x55 /* e2prom data are different from those in the write buffer */ -#define ERR_EEP_CHECKSUM 0x90 /* e2prom checksum error */ -#define CMD_ACK 0x06 /* ACK */ -#define CMD_NACK 0x15 /* NACK */ +#define STX_CHAR '[' +#define ERR_COM_NO_CHARS -999 // nessun carattere dalla porta seriale +#define ERR_MSG_TOO_SHORT -998 // messaggio troppo breve: non arriva sino al Checksum +#define ERR_MSG_CHECKSUM -997 // checksum non valido +#define ERR_COM_TIMEOUT -996 // timeout in lettura +#define ERR_CLR_RX_BUFF -900 // bisogna cancellare il buffer (non è un errore!) +#define COMMAND_NOT_VALID -50 // comando non valido +#define PARAMETER_NOT_VALID -51 // parametro non valido +#define ERR_UPS_NOT_FOUND -10 // non trovo un UPS +#define ERR_COM_PORT_OPEN -11 // impossibile aprire la porta di comunicazione +#define ERR_COM_SET_PORT -12 // impossibile configurare la porta di comunicazione +#define ERR_COM_UNDEF_PORT -20 // porta non valida o non esistente +#define ERR_USB_DRIVER -13 // impossibile aprire il driver USB +#define ERR_USB_COMM_KO -14 // interfaccia USB OK: gruppo spento o guasto +#define ERR_UPS_UNKNOWN -30 // impossibile identificare l'UPS +#define ERR_PRG_THREAD -40 // impossibile creare uno thread +#define ERR_PRG_INVALID_DATA -60 // dati non validi -#define CMD_GET_STATUS 0x00 /* comando di acquisizione STATUS */ -#define CMD_GET_MEASURES 0x01 /* comando di acquisizione MISURE */ -#define CMD_GET_CONFIG 0x02 /* comando di acquisizione CONFIGURAZIONE */ -#define CMD_GET_BATT_STAT 0x03 /* comando di acquisizione Battery+Load Status */ -#define CMD_GET_BAT_LD 0x03 /* comando di acquisizione Battery+Load Status */ -#define CMD_GET_MASK 0x07 /* comando di acquisizione MASCHERA PUNTI */ -#define CMD_SET_TIMER 0x20 /* comando di CONFIGURAZIONE TIMER */ -#define CMD_BATT_TEST 0x21 /* comando di CONFIGURAZIONE TEST BATTERIA */ -#define CMD_GET_BATT_TEST 0x22 /* comando di LETTURA TEST BATTERIA */ -#define CMD_SD_ONESHOT 0x40 /* comando di SCRITTURA SHUTDOWN ONESHOT */ -#define CMD_GET_SD_ONESHOT 0x41 /* comando di LETTURA SHUTDOWN ONESHOT */ -#define CMD_SET_SCHEDULE 0x42 /* comando di SCRITTURA SCHEDULE */ -#define CMD_GET_SCHEDULE 0x43 /* comando di LETTURA SCHEDULE */ -#define CMD_GET_EEP_BLOCK 0x50 /* comando di LETTURA BLOCCO EEPROM */ -#define CMD_SET_EEP_BLOCK 0x51 /* comando di SCRITTURA BLOCCO EEPROM */ -#define CMD_GET_EEP_SEED 0x52 /* comando di acquisizione SEME PROGR. EEPROM */ -#define CMD_INIT 0xF0 /* comando di REINIZIALIZZAZIONE UPS */ +#define ERR_NO_ERROR 0x00 // no errors +#define ERR_I2C_BUSY 0x01 // I2C bus busy (e2prom) +#define ERR_CMD_CHECKSUM 0x10 // Checksum not valid +#define ERR_CMD_UNRECOG 0x11 // unrecognized command +#define ERR_EEP_NOBLOCK 0x08 // WRITE: eeprom address not multiple of 8 +#define ERR_EEP_OOBOUND 0x09 // READ: eeprom address out of bound (with size) +#define ERR_EEP_WADDR1 0x28 // error writing e2prom address +#define ERR_EEP_WSADDR1 0x29 // error writing e2prom subaddress +#define ERR_EEP_RDATA 0x2A // error reading e2prom data +#define ERR_EEP_WADDR2 0x50 // error writing e2prom address +#define ERR_EEP_WSADDR2 0x51 // error reading e2prom subaddress +#define ERR_EEP_WDATA 0x52 // error writing e2prom data +#define ERR_EEP_WADDRVER 0x53 // error writing e2prom address during data verification +#define ERR_EEP_WDATAVER 0x54 // error verification e2prom data +#define ERR_EEP_VERIFY 0x55 // e2prom data are different from those in the write buffer +#define ERR_EEP_CHECKSUM 0x90 // e2prom checksum error -#define LEN_ACK 1 /* ACK */ -#define LEN_NACK 2 /* NACK */ -#define LEN_GET_STATUS 1 /* comando di acquisizione STATUS */ -#define LEN_GET_MEASURES 1 /* comando di acquisizione MISURE */ -#define LEN_GET_CONFIG 1 /* comando di acquisizione CONFIGURAZIONE */ -#define LEN_GET_BATT_STAT 1 /* comando di acquisizione Battery+Load Status */ -#define LEN_GET_BAT_LD 1 /* comando di acquisizione Battery+Load Status */ -#define LEN_GET_MASK 1 /* comando di acquisizione MASCHERA PUNTI */ -#define LEN_SET_TIMER 5 /* comando di CONFIGURAZIONE TIMER */ -#define LEN_BATT_TEST 4 /* comando di CONFIGURAZIONE TEST BATTERIA */ -#define LEN_GET_BATT_TEST 1 /* comando di LETTURA TEST BATTERIA */ -#define LEN_SD_ONESHOT 8 /* comando di SCRITTURA SHUTDOWN ONESHOT */ -#define LEN_GET_SD_ONESHOT 1 /* comando di LETTURA SHUTDOWN ONESHOT */ -#define LEN_SET_SCHEDULE 8 /* comando di SCRITTURA SCHEDULE */ -#define LEN_GET_SCHEDULE 2 /* comando di LETTURA SCHEDULE */ -#define LEN_GET_EEP_BLOCK 3 /* comando di SCRITTURA BLOCCO EEPROM */ -#define LEN_SET_EEP_BLOCK 12 /* comando di SCRITTURA BLOCCO EEPROM */ -#define LEN_GET_EEP_SEED 1 /* comando di acquisizione SEME PROGR. EEPROM */ -#define LEN_INIT 1 /* comando di REINIZIALIZZAZIONE UPS */ +#define CMD_ACK 0x06 // ACK +#define CMD_NACK 0x15 // NACK + +#define CMD_GET_STATUS 0x00 // comando di acquisizione STATUS +#define CMD_GET_MEASURES 0x01 // comando di acquisizione MISURE +#define CMD_GET_CONFIG 0x02 // comando di acquisizione CONFIGURAZIONE +#define CMD_GET_BATT_STAT 0x03 // comando di acquisizione Battery+Load Status +#define CMD_GET_BAT_LD 0x03 // comando di acquisizione Battery+Load Status +#define CMD_GET_MASK 0x07 // comando di acquisizione MASCHERA PUNTI +#define CMD_SET_TIMER 0x20 // comando di CONFIGURAZIONE TIMER +#define CMD_BATT_TEST 0x21 // comando di CONFIGURAZIONE TEST BATTERIA +#define CMD_GET_BATT_TEST 0x22 // comando di LETTURA TEST BATTERIA +#define CMD_SD_ONESHOT 0x40 // comando di SCRITTURA SHUTDOWN ONESHOT +#define CMD_GET_SD_ONESHOT 0x41 // comando di LETTURA SHUTDOWN ONESHOT +#define CMD_SET_SCHEDULE 0x42 // comando di SCRITTURA SCHEDULE +#define CMD_GET_SCHEDULE 0x43 // comando di LETTURA SCHEDULE +#define CMD_GET_EEP_BLOCK 0x50 // comando di LETTURA BLOCCO EEPROM +#define CMD_SET_EEP_BLOCK 0x51 // comando di SCRITTURA BLOCCO EEPROM +#define CMD_GET_EEP_SEED 0x52 // comando di acquisizione SEME PROGR. EEPROM +#define CMD_INIT 0xF0 // comando di REINIZIALIZZAZIONE UPS -/* non completamente definiti! */ -#define RET_GET_STATUS 10 /* comando di acquisizione STATUS */ -#define RET_GET_MEASURES 15 /* comando di acquisizione MISURE */ -#define RET_GET_CONFIG 11 /* comando di acquisizione CONFIGURAZIONE */ -#define RET_GET_BATT_STAT 10 /* comando di acquisizione Battery+Load Status */ -#define RET_GET_BAT_LD 10 /* comando di acquisizione Battery+Load Status */ -#define RET_GET_MASK 1 /* comando di acquisizione MASCHERA PUNTI */ -#define RET_SET_TIMER 5 /* comando di CONFIGURAZIONE TIMER */ -#define RET_BATT_TEST 4 /* comando di CONFIGURAZIONE TEST BATTERIA */ -#define RET_GET_BATT_TEST 1 /* comando di LETTURA TEST BATTERIA */ -#define RET_SD_ONESHOT 8 /* comando di SCRITTURA SHUTDOWN ONESHOT */ -#define RET_GET_SD_ONESHOT 1 /* comando di LETTURA SHUTDOWN ONESHOT */ -#define RET_SET_SCHEDULE 8 /* comando di SCRITTURA SCHEDULE */ -#define RET_GET_SCHEDULE 8 /* comando di LETTURA SCHEDULE */ -#define RET_GET_EEP_BLOCK 11 /* comando di SCRITTURA BLOCCO EEPROM */ -#define RET_SET_EEP_BLOCK 12 /* comando di SCRITTURA BLOCCO EEPROM */ -#define RET_GET_EEP_SEED 1 /* comando di acquisizione SEME PROGR. EEPROM */ -#define RET_INIT 1 /* comando di REINIZIALIZZAZIONE UPS */ +#define LEN_ACK 1 // ACK +#define LEN_NACK 2 // NACK + +#define LEN_GET_STATUS 1 // comando di acquisizione STATUS +#define LEN_GET_MEASURES 1 // comando di acquisizione MISURE +#define LEN_GET_CONFIG 1 // comando di acquisizione CONFIGURAZIONE +#define LEN_GET_BATT_STAT 1 // comando di acquisizione Battery+Load Status +#define LEN_GET_BAT_LD 1 // comando di acquisizione Battery+Load Status +#define LEN_GET_MASK 1 // comando di acquisizione MASCHERA PUNTI +#define LEN_SET_TIMER 5 // comando di CONFIGURAZIONE TIMER +#define LEN_BATT_TEST 4 // comando di CONFIGURAZIONE TEST BATTERIA +#define LEN_GET_BATT_TEST 1 // comando di LETTURA TEST BATTERIA +#define LEN_SD_ONESHOT 8 // comando di SCRITTURA SHUTDOWN ONESHOT +#define LEN_GET_SD_ONESHOT 1 // comando di LETTURA SHUTDOWN ONESHOT +#define LEN_SET_SCHEDULE 8 // comando di SCRITTURA SCHEDULE +#define LEN_GET_SCHEDULE 2 // comando di LETTURA SCHEDULE +#define LEN_GET_EEP_BLOCK 3 // comando di SCRITTURA BLOCCO EEPROM +#define LEN_SET_EEP_BLOCK 12 // comando di SCRITTURA BLOCCO EEPROM +#define LEN_GET_EEP_SEED 1 // comando di acquisizione SEME PROGR. EEPROM +#define LEN_INIT 1 // comando di REINIZIALIZZAZIONE UPS -/* ======================================================= */ -/* Indirizzi delle variabili memorizzate nella EEPROM: // */ -/* ======================================================= */ -#define EEP_OPT_BYTE_BLK 0x00 /* Option Bytes block */ -#define EEP_MAGIC 0x00 /* magic number: deve essere a 0xAA */ -#define EEP_CHECKSUM 0x01 /* XOR longitudinale da 0x?? a 0x?? */ -#define EEP_OUT_CONFIG 0x02 /* vedi documentazione */ -#define EEP_OPT_BYTE_0 0x02 /* vedi documentazione */ -#define EEP_OPT_BYTE_1 0x03 /* vedi documentazione */ -#define EEP_STATUS 0x04 /* Status UPS */ - -#define EEP_THRESHOLD_0 0x08 /* Blocco 0 con gli threshold */ -#define EEP_MEAN_MIN 0x08 /* UPS minimum AC voltage intervention point */ -#define EEP_MEAN_MAX 0x0A /* UPS maximum AC voltage intervention point */ -#define EEP_AVR_MIN 0x0C /* AVR minimum AC voltage intervention point */ -#define EEP_AVR_MAX 0x0E /* AVR maximum AC voltage intervention point */ - -#define EEP_THRESHOLD_1 0x10 /* Blocco 1 con gli threshold */ -#define EEP_BLOW_VALUE 0x10 /* Battery LOW threshold voltage */ -#define EEP_BEND_VALUE 0x12 /* Battery END threshold voltage */ -#define EEP_VMETER_0 0x14 /* Led 0 Voltage indicator threshold */ -#define EEP_VMETER_1 0x16 /* Led 1 Voltage indicator threshold */ - -#define EEP_THRESHOLD_2 0x18 /* Blocco 2 con gli threshold */ -#define EEP_VMETER_2 0x18 /* Led 2 Voltage indicator threshold */ -#define EEP_VMETER_3 0x1A /* Led 3 Voltage indicator threshold */ -#define EEP_VMETER_4 0x1C /* Led 4 Voltage indicator threshold */ - -#define EEP_FAULT_POINTS 0x20 /* number of fault points (in an half sine wave) after which USP enter battery mode */ -#define EEP_CHARGER_MIN 0x21 /* Threshold voltage for battery charger */ - -#define EEP_TEMP_MAX 0x28 /* Maximum temperature: over this value an alarm will be generated */ -#define EEP_TEMP_FAULT 0x2A /* Fault temperature: over this value, UPS will shut down immediately */ -#define EEP_FANSPEED_0 0x2C /* Temperature for fan activation (low speed) */ -#define EEP_FANSPEED_1 0x2E /* Temperature for fan activation (medium speed) */ - -#define EEP_FANSPEED_2 0x30 /* Temperature for fan activation (high speed) */ - -#define EEP_IOUT 0x38 /* */ -#define EEP_IOUT_OVRLD 0x38 /* Maximum current: over this value an alarm will be generated */ -#define EEP_IOUT_FAULT 0x3A /* Fault current: over this value, UPS will shut down immediately */ -#define EEP_PWRMTR_0 0x3C /* Led 0 Power indicator threshold */ -#define EEP_PWRMTR_1 0x3E /* Led 1 Power indicator threshold */ - -#define EEP_PWRMTR_2 0x40 /* Led 2 Power indicator threshold */ -#define EEP_PWRMTR_3 0x42 /* Led 3 Power indicator threshold */ -#define EEP_PWRMTR_4 0x44 /* Led 4 Power indicator threshold */ -#define EEP_PWRMTR_5 0x46 /* Between "Full power" and "Overload" Power indicator level */ - -#define EEP_INPUT_MASK_0 0x48 /* Half sine input mask (0-7 of 10 points) */ -#define EEP_INPUT_MASK_8 0x50 /* Half sine input mask (8-9 of 10 points) */ - -#define EEP_MIN_VBATT 0x60 /* Minimum battery voltaged reached from the last power-on */ -#define EEP_RUNTIME_H 0x62 /* Working time in minutes (max ~=32 years) (MSB first) */ -#define EEP_BAT_TIME_M 0x65 /* Time in Battery mode: seconds*2 (max ~=390 days). (MSB first) */ +// non completamente definiti! +#define RET_GET_STATUS 10 // comando di acquisizione STATUS +#define RET_GET_MEASURES 15 // comando di acquisizione MISURE +#define RET_GET_CONFIG 11 // comando di acquisizione CONFIGURAZIONE +#define RET_GET_BATT_STAT 10 // comando di acquisizione Battery+Load Status +#define RET_GET_BAT_LD 10 // comando di acquisizione Battery+Load Status +#define RET_GET_MASK 1 // comando di acquisizione MASCHERA PUNTI +#define RET_SET_TIMER 5 // comando di CONFIGURAZIONE TIMER +#define RET_BATT_TEST 4 // comando di CONFIGURAZIONE TEST BATTERIA +#define RET_GET_BATT_TEST 1 // comando di LETTURA TEST BATTERIA +#define RET_SD_ONESHOT 8 // comando di SCRITTURA SHUTDOWN ONESHOT +#define RET_GET_SD_ONESHOT 1 // comando di LETTURA SHUTDOWN ONESHOT +#define RET_SET_SCHEDULE 8 // comando di SCRITTURA SCHEDULE +#define RET_GET_SCHEDULE 8 // comando di LETTURA SCHEDULE +#define RET_GET_EEP_BLOCK 11 // comando di SCRITTURA BLOCCO EEPROM +#define RET_SET_EEP_BLOCK 12 // comando di SCRITTURA BLOCCO EEPROM +#define RET_GET_EEP_SEED 1 // comando di acquisizione SEME PROGR. EEPROM +#define RET_INIT 1 // comando di REINIZIALIZZAZIONE UPS -#define EEP_UPS_MODEL 0x80 /* Model of the UPS in ASCII. For the Enterprise line, the structure is: */ - /* ENTxxyyy */ - /* where: xx = Power rating in watts/100 (zero padded at left) */ - /* yyy = model variants (if not defined, space padded to the right) */ +//======================================================= +// Indirizzi delle variabili memorizzate nella EEPROM: // +//======================================================= +#define EEP_OPT_BYTE_BLK 0x00 // Option Bytes block +#define EEP_MAGIC 0x00 // magic number: deve essere a 0xAA +#define EEP_CHECKSUM 0x01 // XOR longitudinale da 0x?? a 0x?? +#define EEP_OUT_CONFIG 0x02 // vedi documentazione +#define EEP_OPT_BYTE_0 0x02 // vedi documentazione +#define EEP_OPT_BYTE_1 0x03 // vedi documentazione +#define EEP_STATUS 0x04 // Status UPS -#define EEP_NETWRK_ID 0x88 /* Network ID in ASCII (not used) - space padded */ -#define EEP_NETWRK_NAME 0x90 /* Network Name in ASCII (not used) - space padded */ -#define EEP_SERIAL_NUM 0x98 /* Serial Number in ASCII - zero padded (at left) */ +#define EEP_THRESHOLD_0 0x08 // Blocco 0 con gli threshold +#define EEP_MEAN_MIN 0x08 // UPS minimum AC voltage intervention point +#define EEP_MEAN_MAX 0x0A // UPS maximum AC voltage intervention point +#define EEP_AVR_MIN 0x0C // AVR minimum AC voltage intervention point +#define EEP_AVR_MAX 0x0E // AVR maximum AC voltage intervention point -#define EEP_PROD_DATE 0xA0 /* */ -#define EEP_PROD_YEAR 0xA0 /* Year of production (add 2000) */ -#define EEP_PROD_WEEK 0xA1 /* Week of production [0-51] */ -#define EEP_PROD_HW_VER 0xA2 /* Hardware version: 2 nibbles ? Major and Minor number. */ -#define EEP_PROD_BRD_VER 0xA3 /* Board version: 2 nibbles ? Major and Minor number. */ -#define EEP_PROD_FW_VER 0xA4 /* Firmware version: 2 nibbles ? Major and Minor number. */ -#define EEP_PROD_FW_SVER 0xA5 /* Firmware SUBversion: 2 nibbles ? Major and Minor number. */ -#define EEP_PROD_BTTRS 0xA6 /* number of batteries installed in the UPS */ +#define EEP_THRESHOLD_1 0x10 // Blocco 1 con gli threshold +#define EEP_BLOW_VALUE 0x10 // Battery LOW threshold voltage +#define EEP_BEND_VALUE 0x12 // Battery END threshold voltage +#define EEP_VMETER_0 0x14 // Led 0 Voltage indicator threshold +#define EEP_VMETER_1 0x16 // Led 1 Voltage indicator threshold + +#define EEP_THRESHOLD_2 0x18 // Blocco 2 con gli threshold +#define EEP_VMETER_2 0x18 // Led 2 Voltage indicator threshold +#define EEP_VMETER_3 0x1A // Led 3 Voltage indicator threshold +#define EEP_VMETER_4 0x1C // Led 4 Voltage indicator threshold + +#define EEP_FAULT_POINTS 0x20 // number of fault points (in an half sine wave) after which USP enter battery mode +#define EEP_CHARGER_MIN 0x21 // Threshold voltage for battery charger + +#define EEP_TEMP_MAX 0x28 // Maximum temperature: over this value an alarm will be generated +#define EEP_TEMP_FAULT 0x2A // Fault temperature: over this value, UPS will shut down immediately +#define EEP_FANSPEED_0 0x2C // Temperature for fan activation (low speed) +#define EEP_FANSPEED_1 0x2E // Temperature for fan activation (medium speed) + +#define EEP_FANSPEED_2 0x30 // Temperature for fan activation (high speed) + +#define EEP_IOUT 0x38 // +#define EEP_IOUT_OVRLD 0x38 // Maximum current: over this value an alarm will be generated +#define EEP_IOUT_FAULT 0x3A // Fault current: over this value, UPS will shut down immediately +#define EEP_PWRMTR_0 0x3C // Led 0 Power indicator threshold +#define EEP_PWRMTR_1 0x3E // Led 1 Power indicator threshold + +#define EEP_PWRMTR_2 0x40 // Led 2 Power indicator threshold +#define EEP_PWRMTR_3 0x42 // Led 3 Power indicator threshold +#define EEP_PWRMTR_4 0x44 // Led 4 Power indicator threshold +#define EEP_PWRMTR_5 0x46 // Between "Full power" and "Overload" Power indicator level + +#define EEP_INPUT_MASK_0 0x48 // Half sine input mask (0-7 of 10 points) +#define EEP_INPUT_MASK_8 0x50 // Half sine input mask (8-9 of 10 points) + +#define EEP_MIN_VBATT 0x60 // Minimum battery voltaged reached from the last power-on +#define EEP_RUNTIME_H 0x62 // Working time in minutes (max ~=32 years) (MSB first) +#define EEP_BAT_TIME_M 0x65 // Time in Battery mode: seconds*2 (max ~=390 days). (MSB first) -#define EEP_BATT_SUBST 0xA8 /* battery replacement block */ -#define EEP_BATT_YEAR_0 0xA8 /* Year of 1st battery replacement (add 2000) */ -#define EEP_BATT_WEEK_0 0xA9 /* Week of 1st battery replacement */ -#define EEP_BATT_YEAR_1 0xAA /* Year of 2nd battery replacement (add 2000) */ -#define EEP_BATT_WEEK_1 0xAB /* Week of 2nd battery replacement */ -#define EEP_BATT_YEAR_2 0xAC /* Year of 3rd battery replacement (add 2000) */ -#define EEP_BATT_WEEK_2 0xAD /* Week of 3rd battery replacement */ -#define EEP_BATT_YEAR_3 0xAE /* Year of 4th battery replacement (add 2000) */ -#define EEP_BATT_WEEK_3 0xAF /* Week of 4th battery replacement */ +#define EEP_UPS_MODEL 0x80 // Model of the UPS in ASCII. For the Enterprise line, the structure is: + // ENTxxyyy + // where: xx = Power rating in watts/100 (zero padded at left) + // yyy = model variants (if not defined, space padded to the right) + +#define EEP_NETWRK_ID 0x88 // Network ID in ASCII (not used) - space padded +#define EEP_NETWRK_NAME 0x90 // Network Name in ASCII (not used) - space padded +#define EEP_SERIAL_NUM 0x98 // Serial Number in ASCII - zero padded (at left) + +#define EEP_PROD_DATE 0xA0 // +#define EEP_PROD_YEAR 0xA0 // Year of production (add 2000) +#define EEP_PROD_WEEK 0xA1 // Week of production [0-51] +#define EEP_PROD_HW_VER 0xA2 // Hardware version: 2 nibbles ? Major and Minor number. +#define EEP_PROD_BRD_VER 0xA3 // Board version: 2 nibbles ? Major and Minor number. +#define EEP_PROD_FW_VER 0xA4 // Firmware version: 2 nibbles ? Major and Minor number. +#define EEP_PROD_FW_SVER 0xA5 // Firmware SUBversion: 2 nibbles ? Major and Minor number. +#define EEP_PROD_BTTRS 0xA6 // number of batteries installed in the UPS -#define EEP_SCHEDULE 0xC8 /* Start of SCHEDULING table */ -#define EEP_SCHEDULE_0 0xC8 /* 1st Scheduling slot */ -#define EEP_SCHEDULE_1 0xD0 /* 2nd Scheduling slot */ -#define EEP_SCHEDULE_2 0xD8 /* 3rd Scheduling slot */ -#define EEP_SCHEDULE_3 0xE0 /* 4th Scheduling slot */ -#define EEP_SCHEDULE_4 0xE8 /* 5th Scheduling slot */ -#define EEP_SCHEDULE_5 0xF0 /* 6th Scheduling slot */ +#define EEP_BATT_SUBST 0xA8 // battery replacement block +#define EEP_BATT_YEAR_0 0xA8 // Year of 1st battery replacement (add 2000) +#define EEP_BATT_WEEK_0 0xA9 // Week of 1st battery replacement +#define EEP_BATT_YEAR_1 0xAA // Year of 2nd battery replacement (add 2000) +#define EEP_BATT_WEEK_1 0xAB // Week of 2nd battery replacement +#define EEP_BATT_YEAR_2 0xAC // Year of 3rd battery replacement (add 2000) +#define EEP_BATT_WEEK_2 0xAD // Week of 3rd battery replacement +#define EEP_BATT_YEAR_3 0xAE // Year of 4th battery replacement (add 2000) +#define EEP_BATT_WEEK_3 0xAF // Week of 4th battery replacement -#define BIT_NO_COMM_UPS 0x0001 /* Event 2 - communications with the UPS lost */ -#define BIT_COMM_OK 0x0002 /* Event 3 - communications with the UPS reestablished */ -#define BIT_BATTERY_MODE 0x0004 /* Event 5 - the UPS is in Battery mode */ -#define BIT_BATTERY_LOW 0x0008 /* Event 6 - the UPS has a LOW battery level */ -#define BIT_MAINS_OK 0x0010 /* Event 7 - return of the mains */ -#define BIT_OVERLOAD 0x0020 /* Event 8 - the UPS is overloaded */ -#define BIT_HIGH_TEMPERATURE 0x0040 /* Event 9 - the UPS is in overtemperature */ -#define BIT_GENERIC_FAULT 0x0080 /* Event 11 - there is a generic fault */ -#define BIT_SYSTEM_SHUTDOWN 0x0100 /* Event 14 - the UPS will shut down IMMEDIATELY */ -#define BIT_STANDBY 0x0200 /* Event 32 - the UPS went in STANDBY MODE */ -#define BIT_BATTERY_END 0x0400 /* Event 33 - the UPS went in battery END */ -#define BIT_EVENT_0 0x1000 /* evento ?? */ -#define BIT_EVENT_1 0x2000 /* evento ?? */ -#define BIT_FIRST_TIME 0x4000 /* se è la prima volta che chiamo la funzione */ -#define BIT_POLL_RESTART 0x8000 /* se riesco ad identificare l'UPS dopo lo scollegamento, reinvio i dati */ +#define EEP_SCHEDULE 0xC8 // Start of SCHEDULING table +#define EEP_SCHEDULE_0 0xC8 // 1st Scheduling slot +#define EEP_SCHEDULE_1 0xD0 // 2nd Scheduling slot +#define EEP_SCHEDULE_2 0xD8 // 3rd Scheduling slot +#define EEP_SCHEDULE_3 0xE0 // 4th Scheduling slot +#define EEP_SCHEDULE_4 0xE8 // 5th Scheduling slot +#define EEP_SCHEDULE_5 0xF0 // 6th Scheduling slot + + +#define BIT_NO_COMM_UPS 0x0001 // Event 2 - communications with the UPS lost +#define BIT_COMM_OK 0x0002 // Event 3 - communications with the UPS reestablished +#define BIT_BATTERY_MODE 0x0004 // Event 5 - the UPS is in Battery mode +#define BIT_BATTERY_LOW 0x0008 // Event 6 - the UPS has a LOW battery level +#define BIT_MAINS_OK 0x0010 // Event 7 - return of the mains +#define BIT_OVERLOAD 0x0020 // Event 8 - the UPS is overloaded +#define BIT_HIGH_TEMPERATURE 0x0040 // Event 9 - the UPS is in overtemperature +#define BIT_GENERIC_FAULT 0x0080 // Event 11 - there is a generic fault +#define BIT_SYSTEM_SHUTDOWN 0x0100 // Event 14 - the UPS will shut down IMMEDIATELY +#define BIT_STANDBY 0x0200 // Event 32 - the UPS went in STANDBY MODE +#define BIT_BATTERY_END 0x0400 // Event 33 - the UPS went in battery END +#define BIT_EVENT_0 0x1000 // evento ?? +#define BIT_EVENT_1 0x2000 // evento ?? +#define BIT_FIRST_TIME 0x4000 // se è la prima volta che chiamo la funzione +#define BIT_POLL_RESTART 0x8000 // se riesco ad identificare l'UPS dopo lo scollegamento, reinvio i dati typedef struct -{ - int Port ; /* porta a cui è collegato l' UPS: */ - /* 0 = USB */ - /* n = COMn */ - char Opened ; /* BOOL flag che identifica se la porta è aperta */ - int ErrCode ; /* ultimo codice di errore in fase di lettura */ - int ErrCount ; /* conteggio degli errori */ - unsigned char PollFlag ; /* identifica se posso accedere all'UPS */ - /* 0x01: se TRUE, polling abilitato */ - /* 0x02: se TRUE, la routine di polling dati è attiva: devo attendere */ - /* 0x04: se TRUE, bisogna rileggere la configurazione del gruppo */ - /* ------------------------------------------------------------------------ */ - unsigned long Counter ; /* contatore: viene incrementato ad ogni nuovo POLL */ - unsigned char CommStatus ; /* stato delle comunicazioni */ - /* unsigned char FramePointer ; */ - size_t FramePointer ; /* puntatore al carattere di START dei dati ricevuti */ - /* ------------------------------------------------------------------------ */ - char UpsModel[9] ; /* modello UPS (8 caratteri) */ - unsigned char ge_2kVA ; /* if more or equal to 2KVA */ - char SerialNumber[9] ; /* numero di serie dell'UPS */ + { + int Port ; // porta a cui è collegato l' UPS: + // 0 = USB + // n = COMn + char Opened ; // BOOL flag che identifica se la porta è aperta + int ErrCode ; // ultimo codice di errore in fase di lettura + int ErrCount ; // conteggio degli errori + unsigned char PollFlag ; // identifica se posso accedere all'UPS + // 0x01: se TRUE, polling abilitato + // 0x02: se TRUE, la routine di polling dati è attiva: devo attendere + // 0x04: se TRUE, bisogna rileggere la configurazione del gruppo + //------------------------------------------------------------------------ + unsigned long Counter ; // contatore: viene incrementato ad ogni nuovo POLL + unsigned char CommStatus ; // stato delle comunicazioni + unsigned char FramePointer ; // puntatore al carattere di START dei dati ricevuti + //------------------------------------------------------------------------ + char UpsModel[9] ; // modello UPS (8 caratteri) + unsigned char ge_2kVA ; // if more or equal to 2KVA + char SerialNumber[9] ; // numero di serie dell'UPS - unsigned short int YearOfProd ; /* anno di produzione dell'UPS */ - unsigned char MonthOfProd ; /* Mese di produzione dell'UPS */ - unsigned char DayOfProd ; /* Giorno di produzione dell'UPS */ - unsigned char HW_MajorVersion ; /* Hardware: Major version */ - unsigned char HW_MinorVersion ; /* Hardware: Minor version */ - unsigned char BR_MajorVersion ; /* BoardHardware: Major version */ - unsigned char BR_MinorVersion ; /* BoardHardware: Minor version */ - unsigned char FW_MajorVersion ; /* Firmware: Major version */ - unsigned char FW_MinorVersion ; /* Firmware: Minor version */ - unsigned char FW_SubVersion ; /* Firmware: SUBVERSION (special releases */ - /* for particular customers) */ + unsigned short int YearOfProd ; // anno di produzione dell'UPS + unsigned char MonthOfProd ; // Mese di produzione dell'UPS + unsigned char DayOfProd ; // Giorno di produzione dell'UPS + unsigned char HW_MajorVersion ; // Hardware: Major version + unsigned char HW_MinorVersion ; // Hardware: Minor version + unsigned char BR_MajorVersion ; // BoardHardware: Major version + unsigned char BR_MinorVersion ; // BoardHardware: Minor version + unsigned char FW_MajorVersion ; // Firmware: Major version + unsigned char FW_MinorVersion ; // Firmware: Minor version + unsigned char FW_SubVersion ; // Firmware: SUBVERSION (special releases + // for particular customers) - unsigned char BatteryNumber ; /* number of batteries in UPS */ - /* ------------------------------------------------------------------------ */ - uint32_t StatusUPS ; /* flag di stato dell'UPS 4 byte): 1=TRUE */ - /* bit 0 => BATTERY_MODE */ - /* bit 1 => BATTERY_LOW */ - /* bit 2 => BATTERY_END */ - /* bit 3 => ONLINE (funzionamento in rete) */ - /* bit 4 => MAINS_ON (rete di ingresso presente) */ - /* bit 5 => STANDBY (UPS in modo Standby) */ - /* bit 6 => WAIT_MAINS (UPS in fase di INIT + attesa rete) */ - /* bit 7 => INIT (UPS in fase di inizializzazione) */ - /* ------ */ - /* bit 8 => MASK_OK (semionda OK) */ - /* bit 9 => MEAN_OK (media tensione di ingresso OK) */ - /* bit 10 => SYNC_OK (sincronizzazione semionda OK) */ - /* bit 11 => FAULT (generico) */ - /* bit 12 => TEMP_MAX (superato livello critico di temperatura) */ - /* bit 13 => TEMP_FAULT (Fault da temperatura: UPS si spegne) */ - /* bit 14 => LOAD_MAX (soglia overload superata) */ - /* bit 15 => LOAD_FAULT (Fault da carico: UPS si spegne) */ - /* ------ */ - /* bit 16 => INV_FAULT (Fault dell'inverter) */ - /* bit 17 => IINV_MAX (eccessiva corrente sull'inverter) */ - /* bit 18 => IINV_FAULT (Fault sulla corrente inverter: l'UPS si spegne) */ - /* bit 19 => 50_60Hz (1=60Hz) */ - /* bit 20 => EEP_FAULT (problemi con la EEPROM) */ - /* bit 21 => VOUT_FAULT (tensione uscita troppo bassa) */ - /* bit 22 => - non definito - */ - /* bit 23 => - non definito - */ - /* ------ */ - /* bit 24 to 31 => - NON DEFINITI - */ + unsigned char BatteryNumber ; // number of batteries in UPS + //------------------------------------------------------------------------ + unsigned long StatusUPS ; // flag di stato dell'UPS 4 byte): 1=TRUE + // bit 0 => BATTERY_MODE + // bit 1 => BATTERY_LOW + // bit 2 => BATTERY_END + // bit 3 => ONLINE (funzionamento in rete) + // bit 4 => MAINS_ON (rete di ingresso presente) + // bit 5 => STANDBY (UPS in modo Standby) + // bit 6 => WAIT_MAINS (UPS in fase di INIT + attesa rete) + // bit 7 => INIT (UPS in fase di inizializzazione) + // ------ + // bit 8 => MASK_OK (semionda OK) + // bit 9 => MEAN_OK (media tensione di ingresso OK) + // bit 10 => SYNC_OK (sincronizzazione semionda OK) + // bit 11 => FAULT (generico) + // bit 12 => TEMP_MAX (superato livello critico di temperatura) + // bit 13 => TEMP_FAULT (Fault da temperatura: UPS si spegne) + // bit 14 => LOAD_MAX (soglia overload superata) + // bit 15 => LOAD_FAULT (Fault da carico: UPS si spegne) + // ------ + // bit 16 => INV_FAULT (Fault dell'inverter) + // bit 17 => IINV_MAX (eccessiva corrente sull'inverter) + // bit 18 => IINV_FAULT (Fault sulla corrente inverter: l'UPS si spegne) + // bit 19 => 50_60Hz (1=60Hz) + // bit 20 => EEP_FAULT (problemi con la EEPROM) + // bit 21 => VOUT_FAULT (tensione uscita troppo bassa) + // bit 22 => - non definito - + // bit 23 => - non definito - + // ------ + // bit 24 to 31 => - NON DEFINITI - - uint16_t ShortStatus ; /* the LSB 2 bytes of the status */ - unsigned char OutConfig ; /* stato uscite UPS */ - float Vinput ; /* tensione di INPUT in 1/10 di Volt */ - float Voutput ; /* tensione di OUTPUT in 1/10 di Volt */ - float Temp ; /* temperatura in 1/10 di grado */ - float InpFreq ; /* Frequenza di INPUT in 1/10 di Hz */ - float OutFreq ; /* Frequenza di OUTPUT in 1/10 di Hz */ - float OutCurrent ; /* Corrente di Output in 1/10 di A */ - unsigned char LoadPerc ; /* Percentuale di carico */ - unsigned short int LoadVA ; /* Carico in VA */ - float ChgCurrent ; /* corrente carica batterie */ + unsigned short int ShortStatus ; // the LSB 2 bytes of the status + unsigned char OutConfig ; // stato uscite UPS + float Vinput ; // tensione di INPUT in 1/10 di Volt + float Voutput ; // tensione di OUTPUT in 1/10 di Volt + float Temp ; // temperatura in 1/10 di grado + float InpFreq ; // Frequenza di INPUT in 1/10 di Hz + float OutFreq ; // Frequenza di OUTPUT in 1/10 di Hz + float OutCurrent ; // Corrente di Output in 1/10 di A + unsigned char LoadPerc ; // Percentuale di carico + unsigned short int LoadVA ; // Carico in VA + float ChgCurrent ; // corrente carica batterie - float Vbatt ; /* tensione delle batterie in 1/10 di Volt */ - unsigned char PercBatt ; /* percentuale di carica della batteria */ - unsigned short int RtimeEmpty; /* minuti alla scarica della batteria */ - unsigned char PercEmpty ; /* percentuale alla scarica: 0%=scarica, 100%=carica */ - unsigned char OutStatus ; /* stato delle uscite */ + float Vbatt ; // tensione delle batterie in 1/10 di Volt + unsigned char PercBatt ; // percentuale di carica della batteria + unsigned short int RtimeEmpty; // minuti alla scarica della batteria + unsigned char PercEmpty ; // percentuale alla scarica: 0%=scarica, 100%=carica + unsigned char OutStatus ; // stato delle uscite - unsigned char Year ; /* */ - unsigned char Month ; /* */ - unsigned char Day ; /* */ - unsigned char WeekDay ; /* Giorno della settimana */ - unsigned char Hour ; /* Ora */ - unsigned char Min ; /* minuti */ - unsigned char Sec ; /* secondi */ + unsigned char Year ; // + unsigned char Month ; // + unsigned char Day ; // + unsigned char WeekDay ; // Giorno della settimana + unsigned char Hour ; // Ora + unsigned char Min ; // minuti + unsigned char Sec ; // secondi - unsigned char BattLowPerc ; /* percentuale carica batteria quando va in BLOW */ - unsigned long Rtime ; /* numero di minuti di accensione dell'UPS */ - unsigned long RtimeBatt ; /* numero di secondi*2 in modalità batteria dall'accensione */ - /* ------------------------------------------------------------------------ */ - unsigned int ShutdownDelay ; /* Shutdown delay in seconds */ - unsigned int WakeUpDelay ; /* WakeUp delay in seconds */ -} ENT_STRUCT ; + unsigned char BattLowPerc ; // percentuale carica batteria quando va in BLOW + unsigned long Rtime ; // numero di minuti di accensione dell'UPS + unsigned long RtimeBatt ; // numero di secondi*2 in modalità batteria dall'accensione + //------------------------------------------------------------------------ + unsigned int ShutdownDelay ; // Shutdown delay in seconds + unsigned int WakeUpDelay ; // WakeUp delay in seconds + } ENT_STRUCT ; -#endif /* ENTERPRISE_PROTOCOL */ + + +#endif // ENTERPRISE_PROTOCOL #endif diff --git a/drivers/microsol-apc.c b/drivers/microsol-apc.c deleted file mode 100644 index 20e0cd3..0000000 --- a/drivers/microsol-apc.c +++ /dev/null @@ -1,188 +0,0 @@ -/* microsol-apc.c - APC Back-UPS BR series UPS driver - - Copyright (C) 2004 Silvino B. Magalhães - 2019 Roberto Panerai Velloso - 2021 Ygor A. S. Regados - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - 2021/03/19 - Version 0.70 - Initial release, based on solis driver - -*/ - -#include "config.h" /* must be first */ - -#include -#include -#include "main.h" -#include "serial.h" -#include "nut_float.h" -#include "timehead.h" - -#include "microsol-common.h" -#include "microsol-apc.h" - -#define DRIVER_NAME "APC Back-UPS BR series UPS driver" -#define DRIVER_VERSION "0.69" - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Silvino B. Magalhães " - "Roberto Panerai Velloso " - "Ygor A. S. Regados ", - DRV_STABLE, - { NULL } -}; - -#define false 0 -#define true 1 -#define RESP_END 0xFE -#define ENDCHAR 13 /* replies end with CR */ -/* solis commands */ -#define CMD_UPSCONT 0xCC -#define CMD_SHUT 0xDD -#define CMD_SHUTRET 0xDE -#define CMD_EVENT 0xCE -#define CMD_DUMP 0xCD - -/** Check if UPS model is available here. */ -bool_t ups_model_defined(void) -{ - unsigned int model_index; - - for (model_index = 0; MODELS[model_index] != ups_model; model_index++); - if (model_index == MODEL_COUNT) { - return 0; - } else { - return 1; - } -} - -/** Set UPS model name. */ -void set_ups_model(void) -{ - switch (ups_model) { - case 183: - model_name = "BZ2200I-BR"; - break; - case 190: - model_name = "BZ1500-BR"; - break; - case 191: - model_name = "BZ2200BI-BR"; - break; - default: - model_name = "Unknown UPS"; - } -} - -/** - * Parse received packet with UPS instantaneous data. - * This function parses model-specific values, such as voltage and battery times. - */ -void scan_received_pack_model_specific(void) -{ - unsigned int relay_state; - unsigned int model_index; - float real_power_curve_1, real_power_curve_2, real_power_curve_3; - float power_difference_1, power_difference_2, power_difference_3; - bool_t recharging; - - /* Extract unprocessed data from packet */ - input_voltage = received_packet[2]; - output_voltage = received_packet[1]; - output_current = received_packet[5]; - battery_voltage = received_packet[3]; - - relay_state = (received_packet[6] & 0x28) >> 3; - - /* Find array indexes for detected UPS model */ - for (model_index = 0; MODELS[model_index] != ups_model && model_index < MODEL_COUNT - 1; model_index++); - if (MODELS[model_index] != ups_model) { - upslogx(LOG_NOTICE, "UPS model not found, using fallback option."); - } - - /* Start processing according to model */ - nominal_power = NOMINAL_POWER[model_index]; - - input_voltage = INPUT_VOLTAGE_MULTIPLIER_A[model_index][output_220v] * input_voltage + INPUT_VOLTAGE_MULTIPLIER_B[model_index][output_220v]; - - battery_voltage = BATTERY_VOLTAGE_MULTIPLIER_A[model_index] * battery_voltage + BATTERY_VOLTAGE_MULTIPLIER_B[model_index]; - - output_current = OUTPUT_CURRENT_MULTIPLIER_A[model_index][line_unpowered] * output_current + OUTPUT_CURRENT_MULTIPLIER_B[model_index][line_unpowered]; - - if (ups_model == 190 && line_unpowered) { - /* Special calculation for BZ1500 on battery */ - output_voltage = battery_voltage * sqrt(output_voltage / 64.0) * OUTPUT_VOLTAGE_MULTIPLIER_A[model_index][line_unpowered][relay_state] - - output_current * OUTPUT_VOLTAGE_MULTIPLIER_B[model_index][line_unpowered][relay_state]; - output_voltage = 1.5091 * output_voltage + 1.5823; - - if (output_current > 4.0) - output_voltage += output_current * 4.0; - - if (output_current > 3.0) - output_voltage += output_current * 2.0; - else if (output_voltage > 0.9) - output_voltage += output_current / 3.0; - else - output_voltage -= 5.0; - - if (output_voltage < 100.0) - output_voltage = 100; - } else { - output_voltage = OUTPUT_VOLTAGE_MULTIPLIER_A[model_index][line_unpowered][relay_state] * output_voltage + OUTPUT_VOLTAGE_MULTIPLIER_B[model_index][line_unpowered][relay_state]; - } - - if (line_unpowered) { - input_frequency = 0; - output_frequency = 60; - } else { - input_frequency = 0.37 * (257 - ((received_packet[21] + received_packet[22] * 256) >> 8)); - output_frequency = input_frequency; - } - - apparent_power = output_current * output_voltage; - - real_power = received_packet[7] + 256 * received_packet[8]; - real_power_curve_1 = REAL_POWER_CURVE_SELECTOR_A1[model_index][relay_state] * real_power + REAL_POWER_CURVE_SELECTOR_B1[model_index][relay_state]; - real_power_curve_2 = REAL_POWER_CURVE_SELECTOR_A2[model_index][relay_state] * real_power + REAL_POWER_CURVE_SELECTOR_B2[model_index][relay_state]; - real_power_curve_3 = REAL_POWER_CURVE_SELECTOR_A3[model_index][relay_state] * real_power + REAL_POWER_CURVE_SELECTOR_B3[model_index][relay_state]; - - power_difference_1 = fabs(real_power_curve_1 - apparent_power); - power_difference_2 = fabs(real_power_curve_2 - apparent_power); - power_difference_3 = fabs(real_power_curve_3 - apparent_power); - - if (power_difference_1 < power_difference_2 && power_difference_1 < power_difference_3) { - real_power = REAL_POWER_MULTIPLIER_A1[model_index][relay_state] * real_power + REAL_POWER_MULTIPLIER_B1[model_index][relay_state]; - } else if (power_difference_2 < power_difference_3) { - real_power = REAL_POWER_MULTIPLIER_A2[model_index][relay_state] * real_power + REAL_POWER_MULTIPLIER_B2[model_index][relay_state]; - } else { - real_power = REAL_POWER_MULTIPLIER_A3[model_index][relay_state] * real_power + REAL_POWER_MULTIPLIER_B3[model_index][relay_state]; - } - - /* If real power is greater than apparent power, invert values */ - if (apparent_power < real_power) { - apparent_power = apparent_power + real_power; - real_power = apparent_power - real_power; - apparent_power = apparent_power - real_power; - } - - input_current = 1.1 * apparent_power / input_voltage; - - recharging = (0x02 & received_packet[20]) == 0x02; - battery_charge = (100.0 * (battery_voltage - MIN_BATTERY_VOLTAGE[model_index])) / (MAX_BATTERY_VOLTAGE[model_index][recharging] - MIN_BATTERY_VOLTAGE[model_index]); -} diff --git a/drivers/microsol-apc.h b/drivers/microsol-apc.h deleted file mode 100644 index 6f38d28..0000000 --- a/drivers/microsol-apc.h +++ /dev/null @@ -1,230 +0,0 @@ -/* microsol-apc.h - APC Back-UPS BR series UPS driver - - Copyright (C) 2004 Silvino B. Magalhaes - 2019 Roberto Panerai Velloso - 2021 Ygor A. S. Regados - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - 2021/03/19 - Version 0.70 - Initial release, based on solis driver - -*/ - -#ifndef INCLUDED_MICROSOL_APC_H -#define INCLUDED_MICROSOL_APC_H - -#define MODEL_COUNT 3 - -/* Supported UPS models */ -static const unsigned int MODELS[MODEL_COUNT] = { - 183 /* APC Back-UPS BZ2200I-BR */ , - 190 /* APC Back-UPS BZ1500-BR */ , - 191 /* APC Back-UPS BZ2200BI-BR */ -}; - -/* Note: int type here is aligned with the "nominal_power" - * variable in microsol-common.h and many related drivers. - */ -static const int NOMINAL_POWER[MODEL_COUNT] = { - 2200 /* Model 183 */ , - 1500 /* Model 190 */ , - 2200 /* Model 191 */ -}; - -/* Curves for output voltage (depends on relay state and battery state) - * Second index: On-line (0) or On-battery (1) - * Third index: Electric relay state - */ -/* For on-line UPS */ -static const float OUTPUT_VOLTAGE_MULTIPLIER_A[MODEL_COUNT][2][8] = { - { - { 1.831, 1.831, 1.831, 1.831, 1.831, 1.831, 1.831, 1.831}, - { 0.1566, 0.1566, 0.1566, 0.1566, 0.1566, 0.1566, 0.1566, 0.1566} - } /* Model 183 */ , - { - { 0.9266, 0.9266, 0.9266, 0.9266, 0.9266, 0.9266, 0.9266, 0.9266}, - { 5.59, 9.47, 13.7, 0.0, 0.0, 0.0, 0.0, 0.0} - } /* Model 190 */ , - { - { 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00}, - { 1.26, 1.26, 1.26, 1.26, 1.26, 1.26, 1.26, 1.26} - } /* Model 191 */ -}; - -static const float OUTPUT_VOLTAGE_MULTIPLIER_B[MODEL_COUNT][2][8] = { - { - { -2.1374, -2.1374, -2.1374, -2.1374, -2.1374, -2.1374, -2.1374, -2.1374}, - { 204.93, 204.93, 204.93, 204.93, 204.93, 204.93, 204.93, 204.93} - } /* Model 183 */ , - { - { 5.0694, 5.0694, 5.0694, 5.0694, 5.0694, 5.0694, 5.0694, 5.0694}, - { 5.4, 6.5, 17.6, 0.0, 0.0, 0.0, 0.0, 0.0} - } /* Model 190 */ , - { - { 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0, 20.0}, - { -5.91, -5.91, -5.91, -5.91, -5.91, -5.91, -5.91, -5.91} - } /* Model 191 */ -}; - -/* Curves for output current - * Second index: On-line (0) or On-battery (1) - */ -static const float OUTPUT_CURRENT_MULTIPLIER_A[MODEL_COUNT][2] = { - { - 0.0892999991774559, - 0.09070000052452087 } /* Model 183 */ , - { - 0.1264, - 0.1303 } /* Model 190 */ , - { - 0.13819999992847443, - 0.08959999680519104 } /* Model 191 */ , -}; - -static const float OUTPUT_CURRENT_MULTIPLIER_B[MODEL_COUNT][2] = { - { - 0.09350000321865082, - 0.14550000429153442 } /* Model 183 */ , - { - 0.522, - 0.468 } /* Model 190 */ , - { - 0.12999999523162842, - 0.1881999969482422 } /* Model 191 */ -}; - -/* Curves for input voltage (depends on nominal output voltage) - * Second index: Nominal output voltage = 220V (1) or 115V (0). - */ -static const float INPUT_VOLTAGE_MULTIPLIER_A[MODEL_COUNT][2] = { - { 1.7937, 1.7937 } /* Model 183 */ , - { 1.8, 1.8 } /* Model 190 */ , - { 1.4825, 1.4952 } /* Model 191 */ -}; - -static const float INPUT_VOLTAGE_MULTIPLIER_B[MODEL_COUNT][2] = { - { 1.854, 1.854 } /* Model 183 */ , - { 2.224, 2.224 } /* Model 190 */ , - { 0.0853, -2.4241 } /* Model 191 */ -}; - -/* Curves for battery voltage */ -static const float BATTERY_VOLTAGE_MULTIPLIER_A[MODEL_COUNT] = { - 0.1551 /* Model 183 */ , - 0.1513 /* Model 190 */ , - 0.1543 /* Model 191 */ -}; - -static const float BATTERY_VOLTAGE_MULTIPLIER_B[MODEL_COUNT] = { - 0.0654 /* Model 183 */ , - 0.7153 /* Model 190 */ , - 0.1414 /* Model 191 */ -}; - -/* Real power estimation curves (depends on relay state) */ -/* - * Remarks: - * - Model 190 use a direct real power determination (no need for curve selectors) - */ -static const float REAL_POWER_CURVE_SELECTOR_A1[MODEL_COUNT][8] = { - { 0.24, 0.26, 0.0, 0.0, 0.24, 0.26, 0.0, 0.28 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 0.24, 0.26, 0.0, 0.0, 0.24, 0.26, 0.0, 0.28 } /* Model 191 */ -}; - -static const float REAL_POWER_CURVE_SELECTOR_B1[MODEL_COUNT][8] = { - { 83.15, 81.23, 0.0, 0.0, 83.49, 79.05, 0.0, 85.67 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 83.15, 81.23, 0.0, 0.0, 83.49, 79.05, 0.0, 85.67 } /* Model 191 */ -}; - -static const float REAL_POWER_CURVE_SELECTOR_A2[MODEL_COUNT][8] = { - { 0.0763, 0.081, 0.0919, 0.0, 0.0741, 0.0828, 0.0, 0.0938 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 0.0763, 0.081, 0.0919, 0.0, 0.0741, 0.0828, 0.0, 0.0938 } /* Model 191 */ -}; - -static const float REAL_POWER_CURVE_SELECTOR_B2[MODEL_COUNT][8] = { - { 81.732, 94.459, 86.686, 0.0, 84.657, 84.999, 0.0, 78.097 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 81.732, 94.459, 86.686, 0.0, 84.657, 84.999, 0.0, 78.097 } /* Model 191 */ -}; - -static const float REAL_POWER_CURVE_SELECTOR_A3[MODEL_COUNT][8] = { - { 0.0744, 0.0808, 0.0885, 0.0, 0.0732, 0.084, 0.0, 0.0955 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 0.0744, 0.0808, 0.0885, 0.0, 0.0732, 0.084, 0.0, 0.0955 } /* Model 191 */ -}; - -static const float REAL_POWER_CURVE_SELECTOR_B3[MODEL_COUNT][8] = { - { 122.06, 122.9, 125.75, 0.0, 120.39, 108.52, 0.0, 92.239 } /* Model 183 */ , - { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 } /* Model 190 */ , - { 122.06, 122.9, 125.75, 0.0, 120.39, 108.52, 0.0, 92.239 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_A1[MODEL_COUNT][8] = { - { 0.08040007075206226, 0.0894, 0.0999, 0.0, 0.0813, 0.0905, 0.0, 0.1005 } /* Model 183 */ , - { 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127 } /* Model 190 */ , - { 0.08040007075206226, 0.0894, 0.0999, 0.0, 0.0813, 0.0905, 0.0, 0.1005 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_B1[MODEL_COUNT][8] = { - { 45.292, 41.928, 41.727, 0.0, 40.269, 41.81, 0.0, 43.458 } /* Model 183 */ , - { 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031 } /* Model 190 */ , - { 45.292, 41.928, 41.727, 0.0, 40.269, 41.81, 0.0, 43.458 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_A2[MODEL_COUNT][8] = { - { 0.08630063689870031, 0.0946, 0.1068, 0.0, 0.086, 0.0967, 0.0, 0.1088 } /* Model 183 */ , - { 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127 } /* Model 190 */ , - { 0.08630063689870031, 0.0946, 0.1068, 0.0, 0.086, 0.0967, 0.0, 0.1088 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_B2[MODEL_COUNT][8] = { - { 8.3927, 9.2393, 8.2852, 0.0, 8.301, 6.7636, 0.0, 8.2842 } /* Model 183 */ , - { 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031 } /* Model 190 */ , - { 8.3927, 9.2393, 8.2852, 0.0, 8.301, 6.7636, 0.0, 8.2842 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_A3[MODEL_COUNT][8] = { - { 0.0896001146881468, 0.0991, 0.1116, 0.0, 0.0967, 0.1068, 0.0, 0.1169 } /* Model 183 */ , - { 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127, 0.1127 } /* Model 190 */ , - { 0.0896001146881468, 0.0991, 0.1116, 0.0, 0.0967, 0.1068, 0.0, 0.1169 } /* Model 191 */ -}; - -static const float REAL_POWER_MULTIPLIER_B3[MODEL_COUNT][8] = { - { -31.115, -33.777, -33.826, 0.0, -59.513, -57.729, 0.0, -41.333 } /* Model 183 */ , - { 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031, 50.031 } /* Model 190 */ , - { -31.115, -33.777, -33.826, 0.0, -59.513, -57.729, 0.0, -41.333 } /* Model 191 */ -}; - -/** - * Maximum battery voltage, used to estimate battery charge - * Second index: Recharging battery flag: charging (1) or charged/discharging (0) - */ -static const float MAX_BATTERY_VOLTAGE[MODEL_COUNT][2] = { - { 27.0, 29.5 } /* Model 183 */ , - { 27.0, 29.5 } /* Model 190 */ , - { 27.0, 29.5 } /* Model 191 */ -}; - -/** Minimum battery voltage, used to estimate battery charge */ -static const float MIN_BATTERY_VOLTAGE[MODEL_COUNT] = { - 20 /* Model 183 */ , - 20 /* Model 190 */ , - 20 /* Model 191 */ -}; - -#endif /* INCLUDED_MICROSOL_APC_H */ diff --git a/drivers/microsol-common.c b/drivers/microsol-common.c deleted file mode 100644 index 84ed6fe..0000000 --- a/drivers/microsol-common.c +++ /dev/null @@ -1,809 +0,0 @@ -/* microsol-common.c - common framework for Microsol Solis-based UPS hardware - - Copyright (C) 2004 Silvino B. Magalhães - 2019 Roberto Panerai Velloso - 2021 Ygor A. S. Regados - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - 2021/03/19 - Version 0.70 - Initial release, based on solis driver - -*/ - -#include "main.h" /* Includes "config.h", must be first */ - -#include -#include -#include -#include "serial.h" -#include "nut_float.h" -#include "nut_stdint.h" -#include "microsol-common.h" -#include "timehead.h" - -#define false 0 -#define true 1 -#define RESP_END 0xFE -#define ENDCHAR 13 /* replies end with CR */ -/* solis commands */ -#define CMD_UPSCONT 0xCC -#define CMD_SHUT 0xDD -#define CMD_SHUTRET 0xDE -#define CMD_EVENT 0xCE -#define CMD_DUMP 0xCD - -#define M_UNKN "Unknown solis model" -#define NO_SOLIS "Solis not detected! aborting ..." -#define UPS_DATE "UPS Date %4d/%02d/%02d" -#define SYS_DATE "System Date %4d/%02d/%02d day of week %s" -#define ERR_PACK "Wrong package" -#define NO_EVENT "No events" -#define UPS_TIME "UPS internal Time %0d:%02d:%02d" -#define PRG_DAYS "Programming Shutdown Sun Mon Tue Wed Thu Fri Sat" -#define PRG_ONON "External shutdown programming active" -#define PRG_ONOU "Internal shutdown programming active" -#define TIME_OFF "UPS Time power off %02d:%02d" -#define TIME_ON "UPS Time power on %02d:%02d" -#define PRG_ONOF "Shutdown programming not activated" -#define TODAY_DD "Shutdown today at %02d:%02d" -#define SHUT_NOW "Shutdown now!" - -#define FMT_DAYS " %d %d %d %d %d %d %d" - -/* Date, time and programming group */ -static int const BASE_YEAR = 1998; /* Note: code below uses relative "unsigned char" years */ -static int device_day, device_month, device_year; -static int device_hour, device_minute, device_second; -static int power_off_hour, power_off_minute; -static int power_on_hour, power_on_minute; -static uint8_t device_days_on = 0, device_days_off = 0, days_to_shutdown = 0; - -static int isprogram = 0, progshut = 0, prgups = 0; -static int hourshut, minshut; - -static int host_year, host_month, host_day; -static int host_week; -static int host_hour, host_minute, host_second; - -/* buffers */ -unsigned char received_packet[PACKET_SIZE]; - -/* Identification */ -const char *model_name; -unsigned int ups_model; -bool_t input_220v, output_220v; - -/* logical */ -bool_t detected = 0; -bool_t line_unpowered, overheat; -bool_t overload, critical_battery, inverter_working; -static bool_t recharging; -static bool_t packet_parsed = false; - -double input_voltage, input_current, input_frequency; -double output_voltage, output_current, output_frequency; - -double input_low_limit, input_high_limit; - -int battery_extension; -double battery_voltage, battery_charge; -double temperature; - -double apparent_power, real_power, ups_load; -int load_power_factor, nominal_power; - -/** - * Convert standard days string to firmware format - * This is needed because UPS sends binary date rotated - * from current week day (first bit = current day) - */ -static char *convert_days(char *cop) -{ - static char alt[8]; - - int ish, fim; - /* FIXME? Are range-checks needed for values more than 6? wire noise etc? */ - if (host_week == 6) - ish = 0; - else - ish = 1 + host_week; - - fim = 7 - ish; - /* rotate left only 7 bits */ - - if (fim > 0) { - memcpy(alt, &cop[ish], (size_t)fim); - } else { - fatalx(EXIT_FAILURE, "%s: value out of range: %d (%d)", - __func__, fim, ish); - } - - if (ish > 0) - memcpy(&alt[fim], cop, (size_t)ish); - - alt[7] = 0; /* string terminator */ - - return alt; -} - -/** Convert bitstring (e.g. 1100101) to binary */ -static uint8_t bitstring_to_binary(char *binStr) -{ - uint8_t result = 0; - unsigned int i; - - for (i = 0; i < 7; ++i) { - char ch = binStr[i]; - if (ch == '1' || ch == '0') - result += ((ch - '0') << (6 - i)); - else - return 0; - } - - return result; -} - -/** - * Revert firmware format to standard string binary days - * This is needed because UPS sends binary date rotated - * from current week day (first bit = current day) - */ -static uint8_t revert_days(unsigned char firmware_week) -{ - char ordered_week[8]; - int i; - - for (i = 0; i < (6 - host_week); ++i) - ordered_week[i] = (firmware_week >> (5 - host_week - i)) & 0x01; - - for (i = 0; i < host_week + 1; ++i) - ordered_week[i + (6 - host_week)] = (firmware_week >> (6 - i)) & 0x01; - - for (i = 0; i < 7; i++) - ordered_week[i] += '0'; - - ordered_week[7] = 0; /* string terminator */ - - return bitstring_to_binary(ordered_week); -} - -/** Parse time string from parameters and store their values */ -static bool_t set_schedule_time(char *hour, bool_t off_time) -{ - int string_hour, string_minute; - - if ((strlen(hour) != 5) || (sscanf(hour, "%d:%d", &string_hour, &string_minute) != 2)) - return 0; - - if (off_time) { - power_off_hour = string_hour; - power_off_minute = string_minute; - } else { - power_on_hour = string_hour; - power_on_minute = string_minute; - } - return 1; -} - -/** Send immediate shutdown command to UPS */ -static void send_shutdown(void) -{ - unsigned int i; - - for (i = 0; i < 10; i++) - ser_send_char(upsfd, CMD_SHUT); - - upslogx(LOG_NOTICE, "UPS shutdown command sent"); -} - -/** Store clock updates and shutdown schedules to UPS */ -static void save_ups_config(void) -{ - unsigned int i; - int checksum = 0; - unsigned char configuration_packet[12]; - - /* Prepare configuration packet */ - /* FIXME? Check for overflows with int => char truncations? */ - configuration_packet[0] = (unsigned char)0xCF; - configuration_packet[1] = (unsigned char)host_hour; - configuration_packet[2] = (unsigned char)host_minute; - configuration_packet[3] = (unsigned char)host_second; - configuration_packet[4] = (unsigned char)power_on_hour; - configuration_packet[5] = (unsigned char)power_on_minute; - configuration_packet[6] = (unsigned char)power_off_hour; - configuration_packet[7] = (unsigned char)power_off_minute; - configuration_packet[8] = (unsigned char)(host_week << 5); - configuration_packet[8] = (unsigned char)configuration_packet[8] | (unsigned char)host_day; - configuration_packet[9] = (unsigned char)(host_month << 4); - configuration_packet[9] = (unsigned char)configuration_packet[9] | (unsigned char)(host_year - BASE_YEAR); - configuration_packet[10] = (unsigned char)device_days_off; - - /* MSB zero */ - configuration_packet[10] = configuration_packet[10] & (~(0x80)); - - /* Calculate packet content checksum */ - for (i = 0; i < 11; i++) { - checksum += configuration_packet[i]; - } - /* FIXME? Does truncation to char have same effect as %256 ? */ - configuration_packet[11] = (unsigned char)(checksum % 256); - - /* Send final packet and checksum to serial port */ - for (i = 0; i < 12; i++) { - ser_send_char(upsfd, configuration_packet[i]); - } -} - -/** Log shut-down schedule data stored in UPS */ -static void print_info(void) -{ - /* sunday, monday, tuesday, wednesday, thursday, friday, saturday */ - char week_days[7] = { 0, 0, 0, 0, 0, 0, 0 }; - unsigned int i; - - upslogx(LOG_NOTICE, UPS_DATE, device_year, device_month, device_day); - upslogx(LOG_NOTICE, UPS_TIME, device_hour, device_minute, device_second); - - if (prgups > 0) { - /* this is the string to binary standard */ - for (i = 0; i < 7; i++) { - week_days[i] = (days_to_shutdown >> (6 - i)) & 0x01; - } - - if (prgups == 3) - upslogx(LOG_NOTICE, PRG_ONOU); - else - upslogx(LOG_NOTICE, PRG_ONON); - - upslogx(LOG_NOTICE, TIME_ON, power_on_hour, power_on_minute); - upslogx(LOG_NOTICE, TIME_OFF, power_off_hour, power_off_minute); - - upslogx(LOG_NOTICE, PRG_DAYS); - - upslogx(LOG_NOTICE, FMT_DAYS, week_days[0], week_days[1], week_days[2], week_days[3], week_days[4], week_days[5], week_days[6]); - } else { - upslogx(LOG_NOTICE, PRG_ONOF); - } -} - -/** Parses received packet with UPS readings and configuration. */ -static void scan_received_pack(void) -{ - /* UPS internal time */ - device_year = (received_packet[19] & 0x0F) + BASE_YEAR; - device_month = (received_packet[19] & 0xF0) >> 4; - device_day = (received_packet[18] & 0x1F); - - device_hour = received_packet[11]; - device_minute = received_packet[10]; - device_second = received_packet[9]; - - /* UPS power cycle schedule if in programmed shutdown mode */ - if (prgups == 3) { - device_days_on = received_packet[17]; - days_to_shutdown = revert_days(device_days_on); - - /* Automatic UPS power-off time */ - power_off_hour = received_packet[15]; - power_off_minute = received_packet[16]; - - /* Automatic UPS power-on time */ - power_on_hour = received_packet[13]; - power_on_minute = received_packet[14]; - } - - /* These UPS have 110V- or 220V-output models */ - if ((0x01 & received_packet[20]) == 0x01) { - output_220v = 1; - } - - /* UPS state flags */ - critical_battery = (0x04 & received_packet[20]) == 0x04; - inverter_working = (0x08 & received_packet[20]) == 0x08; - overheat = (0x10 & received_packet[20]) == 0x10; - line_unpowered = (0x20 & received_packet[20]) == 0x20; - overload = (0x80 & received_packet[20]) == 0x80; - - recharging = (0x02 & received_packet[20]) == 0x02; - if (line_unpowered) { - recharging = false; - } - - /* Check if input voltage is 110V or 220V */ - if ((0x40 & received_packet[20]) == 0x40) { - input_220v = 1; - } else { - input_220v = 0; - } - - /* Internal battery temperature */ - temperature = 0x7F & received_packet[4]; - if (0x80 & received_packet[4]) { - temperature -= 128; - } - - /* Parse model-specific data (current and voltages). - * Doing it here as these values are used for the next calculations. */ - scan_received_pack_model_specific(); - - ups_load = (apparent_power / nominal_power) * 100.0; - - if (battery_charge > 100.0) { - battery_charge = 100.0; - } else if (battery_charge < 0.0) { - battery_charge = 0.0; - } - - output_frequency = 60; - if (!inverter_working) { - output_voltage = 0; - output_frequency = 0; - } - - if (!line_unpowered && inverter_working) - output_frequency = input_frequency; - - if (apparent_power < 0) - load_power_factor = 0; - else { - if (d_equal(apparent_power, 0)) - load_power_factor = 100; - else - load_power_factor = ((real_power / apparent_power) * 100); - - if (load_power_factor > 100) { - load_power_factor = 100; - } - } - - /* input 110V or 220v */ - if (input_220v == 0) { - input_low_limit = 75; - input_high_limit = 150; - } else { - input_low_limit = 150; - input_high_limit = 300; - } -} - -/** - * Start processing of received packets - * - * Packet format: 25-bytes binary structure - * Byte 1: Packet type/UPS model - * Byte 2: Output voltage data - * Byte 3: Input voltage data - * Byte 4: Battery voltage data - * Byte 5: UPS temperature data - * Byte 6: Output current data - * Byte 7: Electrical relay setup - * Byte 8-9: Real power data - * Byte 10: UPS clock - seconds - * Byte 11: UPS clock - minutes - * Byte 12: UPS clock - hours - * Byte 13: Zero - * Byte 14: UPS scheduler - power-on hour - * Byte 15: UPS scheduler - power-on minute - * Byte 16: UPS scheduler - power-off hour - * Byte 17: UPS scheduler - power-off minute - * Byte 18: UPS scheduler - weekdays - * Byte 19: UPS clock - day of month - * Byte 20: UPS clock - year (since 1998) (left 4 bits) and month (right 4 bits) - * Byte 21: UPS flags (power status, battery status, overload, overheat, nominal input voltage, nominal output voltage) - * Byte 22-23: Input frequency data - * Byte 24: Packet checksum - * Byte 25: Packet delimiter, always 0xFE - */ -static void comm_receive(const unsigned char *bufptr, size_t size) -{ - size_t i; - - if (size == PACKET_SIZE) { - int checksum = 0; - - upsdebug_hex(3, "comm_receive: bufptr", bufptr, size); - - /* Calculate packet checksum */ - for (i = 0; i < PACKET_SIZE - 2; i++) { - checksum += bufptr[i]; - } - checksum = checksum % 256; - upsdebugx(4, "%s: calculated checksum = 0x%02x, bufptr[23] = 0x%02x", __func__, checksum, bufptr[23]); - - /* Only proceed if checksum matches and packet delimiter is found */ - if (checksum == bufptr[23] && bufptr[24] == 254) { - upsdebugx(4, "%s: valid packet received", __func__); - memcpy(received_packet, bufptr, PACKET_SIZE); - - if ((received_packet[0] & 0xF0) == 0xA0 || (received_packet[0] & 0xF0) == 0xB0) { - /* If UPS still not detected, compare with available lists */ - if (!detected) { - ups_model = received_packet[0]; - - detected = true; - } - - if (!ups_model_defined()) { - upslogx(LOG_DEBUG, M_UNKN); - } - - scan_received_pack(); - } - } - } -} - -/** Refresh host time variables */ -static void refresh_host_time(void) -{ - const time_t epoch = time(NULL); - struct tm now; - - localtime_r(&epoch, &now); - host_year = now.tm_year + 1900; - host_month = now.tm_mon + 1; - host_day = now.tm_mday; - host_week = now.tm_wday; - host_hour = now.tm_hour; - host_minute = now.tm_min; - host_second = now.tm_sec; -} - -/** Query shut-down schedule configuration */ -static void setup_poweroff_schedule(void) -{ - bool_t i1 = 0, i2 = 0; - char *daysoff; - - refresh_host_time(); - - if (testvar("prgshut")) { - prgups = atoi(getval("prgshut")); - } - - if (prgups > 0 && prgups < 3) { - if (testvar("daysweek")) { - device_days_on = bitstring_to_binary(convert_days(getval("daysweek"))); - } - - if (testvar("daysoff")) { - daysoff = getval("daysoff"); - days_to_shutdown = bitstring_to_binary(daysoff); - device_days_off = bitstring_to_binary(convert_days(daysoff)); - } - - if (testvar("houron")) { - i1 = set_schedule_time(getval("houron"), 0); - } - - if (testvar("houroff")) { - i2 = set_schedule_time(getval("houroff"), 1); - } - - if (i1 && i2 && (device_days_on > 0)) { - isprogram = 1; - - /* If configured to shut-down UPS, push schedule to internal configuration */ - if (prgups == 2) { - save_ups_config(); - } - } else { - if (i2 == 1 && device_days_off > 0) { - isprogram = 1; - device_days_on = device_days_off; - } - } - } -} - -/** Check shut-down schedule and sets system to shut down if needed */ -static void check_shutdown_schedule(void) -{ - bool_t is_shutdown_day = 0; - - if (isprogram || prgups == 3) { - refresh_host_time(); - - is_shutdown_day = (days_to_shutdown >> (6 - host_week)) & 0x01; - - if (is_shutdown_day) { - upslogx(LOG_NOTICE, TODAY_DD, hourshut, minshut); - - if (host_hour == hourshut && host_minute >= minshut) { - upslogx(LOG_NOTICE, SHUT_NOW); - progshut = 1; - } - } - } -} - -/** Resynchronizes packet boundaries */ -static void resynchronize_packet(void) { - unsigned char sync_received_byte = 0; - unsigned short i; - - /* Flush serial port buffers */ - ser_flush_io(upsfd); - - upsdebugx(3, "%s: Synchronizing packet boundaries...", __func__); - - /* - * - Read until end-of-response character (0xFE): - * read up to 3 packets in size before giving up - * synchronizing with the device. - */ - for (i = 0; i < PACKET_SIZE * 3 && sync_received_byte != RESP_END; i++) { - ser_get_char(upsfd, &sync_received_byte, 3, 0); - } - - /* If no packet boundary was found, terminate communication */ - if (sync_received_byte != RESP_END) { - fatalx(EXIT_FAILURE, NO_SOLIS); - } -} - -/** Synchronize packet receiving and setup basic variables */ -static void get_base_info(void) -{ - unsigned char packet[PACKET_SIZE]; - ssize_t tam; - - if (testvar("battext")) { - battery_extension = atoi(getval("battext")); - } - - setup_poweroff_schedule(); - - /* dummy read attempt to sync - throw it out */ - upsdebugx(3, "%s: sending CMD_UPSCONT and ENDCHAR", __func__); - ser_send(upsfd, "%c%c", CMD_UPSCONT, ENDCHAR); - - resynchronize_packet (); - - upsdebugx(4, "%s: requesting %d bytes from ser_get_buf_len()", __func__, PACKET_SIZE); - tam = ser_get_buf_len(upsfd, packet, PACKET_SIZE, 3, 0); - upsdebugx(2, "%s: received %zd bytes from ser_get_buf_len()", __func__, tam); - if (tam > 0 && nut_debug_level >= 4) { - upsdebug_hex(4, "received from ser_get_buf_len()", packet, (size_t)tam); - } - comm_receive(packet, (size_t)tam); - - if (!detected) { - fatalx(EXIT_FAILURE, NO_SOLIS); - } - - set_ups_model(); - - /* Setup power-off times */ - if (prgups != 0) { - if (prgups == 1) { - /* If only this host is meant to be powered off, use proper time. */ - hourshut = power_off_hour; - minshut = power_off_minute; - } else { - /* If the UPS is to be powered off too, give - * a 5-minute grace time to shutdown hosts */ - if (power_off_minute < 5) { - if (power_off_hour > 1) - hourshut = power_off_hour - 1; - else - hourshut = 23; - - minshut = 60 - (5 - power_off_minute); - } else { - hourshut = power_off_hour; - minshut = power_off_minute - 5; - } - } - } - - /* manufacturer */ - dstate_setinfo("ups.mfr", "%s", "APC"); - - dstate_setinfo("ups.model", "%s", model_name); - dstate_setinfo("input.transfer.low", "%03.1f", input_low_limit); - dstate_setinfo("input.transfer.high", "%03.1f", input_high_limit); - - dstate_addcmd("shutdown.return"); /* CMD_SHUTRET */ - dstate_addcmd("shutdown.stayoff"); /* CMD_SHUT */ - - upslogx(LOG_NOTICE, "Detected %s on %s", dstate_getinfo("ups.model"), device_path); - - print_info(); -} - -/** Retrieves new packet from serial connection and parses it */ -static void get_updated_info(void) -{ - unsigned char temp[256]; - ssize_t tam; - - check_shutdown_schedule(); - - /* get update package */ - temp[0] = 0; /* flush temp buffer */ - - upsdebugx(3, "%s: requesting %d bytes from ser_get_buf_len()", __func__, PACKET_SIZE); - tam = ser_get_buf_len(upsfd, temp, PACKET_SIZE, 3, 0); - - upsdebugx(2, "%s: received %zd bytes from ser_get_buf_len()", __func__, tam); - if (tam > 0 && nut_debug_level >= 4) - upsdebug_hex(4, "received from ser_get_buf_len()", temp, (size_t)tam); - - packet_parsed = false; - if (temp[24] == RESP_END) { - /* Packet boundary found, process packet */ - comm_receive(temp, (size_t)tam); - - packet_parsed = true; - } else { - /* Malformed packet received, possible boundary desynchronization. */ - upsdebugx(3, "%s: Malformed packet received, trying to resynchronize...", __func__); - - resynchronize_packet (); - } -} - -static int instcmd(const char *cmdname, const char *extra) -{ - /* Power-cycle UPS */ - if (!strcasecmp(cmdname, "shutdown.return")) { - ser_send_char(upsfd, CMD_SHUTRET); /* 0xDE */ - return STAT_INSTCMD_HANDLED; - } - - /* Power-off UPS */ - if (!strcasecmp(cmdname, "shutdown.stayoff")) { - ser_send_char(upsfd, CMD_SHUT); /* 0xDD */ - return STAT_INSTCMD_HANDLED; - } - - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); - return STAT_INSTCMD_UNKNOWN; -} - -void upsdrv_initinfo(void) -{ - get_base_info(); - - upsh.instcmd = instcmd; -} - -void upsdrv_updateinfo(void) -{ - get_updated_info(); - - if (packet_parsed) { - dstate_setinfo("battery.charge", "%03.1f", battery_charge); - dstate_setinfo("battery.voltage", "%02.1f", battery_voltage); - - dstate_setinfo("input.frequency", "%2.1f", input_frequency); - dstate_setinfo("input.voltage", "%03.1f", input_voltage); - - dstate_setinfo("output.current", "%03.1f", output_current); - dstate_setinfo("output.power", "%03.1f", apparent_power); - dstate_setinfo("output.powerfactor", "%0.2f", load_power_factor / 100.0); - dstate_setinfo("output.realpower", "%03.1f", real_power); - dstate_setinfo("output.voltage", "%03.1f", output_voltage); - - dstate_setinfo("ups.temperature", "%2.2f", temperature); - dstate_setinfo("ups.load", "%03.1f", ups_load); - - status_init(); - - if (!line_unpowered) { - status_set("OL"); /* On line */ - } else { - status_set("OB"); /* On battery */ - } - - if (overload) { - status_set("OVER"); /* Overload */ - } - - if (overheat) { - status_set("OVERHEAT"); /* Overheat */ - } - - if (recharging) { - status_set("CHRG"); /* Charging battery */ - } - - if (critical_battery) { - status_set("LB"); /* Critically low battery */ - } - - if (progshut) { - /* Software-based shutdown now */ - if (prgups == 2) - send_shutdown(); /* Send command to shutdown UPS in 4-5 minutes */ - - /* Workaround for triggering servers' power-off before UPS power-off */ - status_set("LB"); - } - - status_commit(); - - dstate_dataok(); - } else { - /* - * If no packet was processed, report data as stale. - * Most likely to be fixed on next received packet. - */ - dstate_datastale (); - } -} - -/*! @brief Power down the attached load immediately. - * Basic idea: find out line status and send appropriate command. - * - on battery: send normal shutdown, UPS will return by itself on utility - * - on line: send shutdown+return, UPS will cycle and return soon. - */ -void upsdrv_shutdown(void) -{ - if (!line_unpowered) { /* on line */ - upslogx(LOG_NOTICE, "On line, sending power cycle command..."); - ser_send_char(upsfd, CMD_SHUTRET); - } else { - upslogx(LOG_NOTICE, "On battery, sending power off command..."); - ser_send_char(upsfd, CMD_SHUT); - } -} - -void upsdrv_help(void) -{ - printf("\nAPC/Microsol options\n\n"); - printf(" Battery extension (AH)\n"); - printf(" battext = 80\n\n"); - printf(" Scheduled UPS power on/off\n"); - printf(" prgshut = 0 (default, no scheduled shutdown)\n"); - printf(" prgshut = 1 (software-based shutdown schedule without UPS power-off)\n"); - printf(" prgshut = 2 (software-based shutdown schedule with UPS power-off)\n"); - printf(" prgshut = 3 (internal UPS shutdown schedule)\n\n"); - printf(" Schedule configuration:\n"); - printf(" daysweek = 1010101 (power on days)\n"); - printf(" daysoff = 1010101 (power off days)\n"); - printf(" where each digit is a day from sun...sat with 0 = off and 1 = on\n\n"); - printf(" houron = hh:mm hh = hour 0-23 mm = minute 0-59 separated with :\n"); - printf(" houroff = hh:mm hh = hour 0-23 mm = minute 0-59 separated with :\n"); - printf(" where houron is power-on hour and houroff is shutdown and power-off hour\n\n"); - printf(" Use daysweek and houron to programming and save UPS power on/off\n"); - printf(" These are valid only if prgshut = 2 or 3\n"); -} - -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "battext", "Battery extension (0-80AH)"); - addvar(VAR_VALUE, "prgshut", "Scheduled power-off mode (0-3)"); - addvar(VAR_VALUE, "daysweek", "Days of week for UPS shutdown"); - addvar(VAR_VALUE, "daysoff", "Days of week for driver-induced shutdown"); - addvar(VAR_VALUE, "houron", "Power on hour (hh:mm)"); - addvar(VAR_VALUE, "houroff", "Power off hour (hh:mm)"); -} - -void upsdrv_initups(void) -{ - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B9600); - - ser_set_dtr(upsfd, 1); - ser_set_rts(upsfd, 0); -} - -void upsdrv_cleanup(void) -{ - ser_close(upsfd, device_path); -} diff --git a/drivers/microsol-common.h b/drivers/microsol-common.h deleted file mode 100644 index 8381b13..0000000 --- a/drivers/microsol-common.h +++ /dev/null @@ -1,67 +0,0 @@ -/* microsol-common.h - common framework for Microsol Solis-based UPS hardware - - Copyright (C) 2004 Silvino B. Magalhaes - 2019 Roberto Panerai Velloso - 2021 Ygor A. S. Regados - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - 2021/03/19 - Version 0.70 - Initial release, based on solis driver - -*/ - -#ifndef INCLUDED_MICROSOL_COMMON_H -#define INCLUDED_MICROSOL_COMMON_H - -typedef unsigned int bool_t; - -#define PACKET_SIZE 25 - -/* buffers */ -extern unsigned char received_packet[PACKET_SIZE]; - -/* Identification */ -extern const char *model_name; -extern unsigned int ups_model; -extern bool_t input_220v, output_220v; - -/* logical */ -extern bool_t detected; -extern bool_t line_unpowered, overheat, overload; -extern bool_t critical_battery, inverter_working; -/*extern bool_t recharging;*/ /* microsol-apc.c has its own copy */ - -/* Input group */ -extern double input_voltage, input_current, input_frequency; -extern double input_minimum_voltage, input_maximum_voltage, input_nominal_voltage; -extern double input_low_limit, input_high_limit; - -/* Output group */ -extern double output_voltage, output_current, output_frequency; - -/* Battery group */ -extern int battery_extension; -extern double battery_voltage, battery_charge; -extern double temperature; - -/* Power group */ -extern double apparent_power, real_power, ups_load; -extern int load_power_factor, nominal_power, ups_power_factor; - -extern void scan_received_pack_model_specific(void); -extern void set_ups_model(void); -extern bool_t ups_model_defined(void); - -#endif /* INCLUDED_MICROSOL_COMMON_H */ diff --git a/drivers/netvision-mib.c b/drivers/netvision-mib.c index 51f4073..3b31e32 100644 --- a/drivers/netvision-mib.c +++ b/drivers/netvision-mib.c @@ -4,7 +4,6 @@ * Copyright (C) * 2004 Thanos Chatziathanassiou * 2012 Manuel Bouyer - * 2015 Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,7 +24,7 @@ #include "netvision-mib.h" -#define NETVISION_MIB_VERSION "0.44" +#define NETVISION_MIB_VERSION "0.3" #define NETVISION_SYSOID ".1.3.6.1.4.1.4555.1.1.1" @@ -39,19 +38,12 @@ /* UPS Battery */ #define NETVISION_OID_BATTERYSTATUS ".1.3.6.1.4.1.4555.1.1.1.1.2.1.0" static info_lkp_t netvision_batt_info[] = { - { 2, "", NULL, NULL }, /* battery normal */ - { 3, "LB", NULL, NULL }, /* battery low */ - { 4, "LB", NULL, NULL }, /* battery depleted */ - { 5, "DISCHRG", NULL, NULL }, /* battery discharging */ - { 6, "RB", NULL, NULL }, /* battery failure */ - { 0, NULL, NULL, NULL } -}; - -/* Battery status: upsAlarmOnBattery */ -static info_lkp_t netvision_onbatt_info[] = { - { 0, "OL", NULL, NULL }, /* Online */ - { 1, "OB", NULL, NULL }, /* On battery */ - { 0, NULL, NULL, NULL } + { 2, "" }, /* battery normal */ + { 3, "LB" }, /* battery low */ + { 4, "LB" }, /* battery depleted */ + { 5, "DISCHRG" }, /* battery discharging */ + { 6, "RB" }, /* battery failure */ + { 0, "NULL" } }; #define NETVISION_OID_SECONDSONBATTERY ".1.3.6.1.4.1.4555.1.1.1.1.2.2.0" @@ -101,26 +93,20 @@ static info_lkp_t netvision_onbatt_info[] = { #define NETVISION_OID_CONTROL_SHUTDOWN_DELAY ".1.3.6.1.4.1.4555.1.1.1.1.8.2" static info_lkp_t netvision_output_info[] = { - { 1, "", NULL, NULL }, /* output source other */ - { 2, "", NULL, NULL }, /* output source none */ - { 3, "OL", NULL, NULL }, /* output source normal */ - { 4, "OL BYPASS", NULL, NULL }, /* output source bypass */ - { 5, "OB", NULL, NULL }, /* output source battery */ - { 6, "OL BOOST", NULL, NULL }, /* output source booster */ - { 7, "OL TRIM", NULL, NULL }, /* output source reducer */ - { 8, "OL", NULL, NULL }, /* output source standby */ - { 9, "", NULL, NULL }, /* output source ecomode */ - { 0, NULL, NULL, NULL } + { 1, "" }, /* output source other */ + { 2, "" }, /* output source none */ + { 3, "OL" }, /* output source normal */ + { 4, "OL BYPASS" }, /* output source bypass */ + { 5, "OB" }, /* output source battery */ + { 6, "OL BOOST" }, /* output source booster */ + { 7, "OL TRIM" }, /* output source reducer */ + { 8, "OL" }, /* output source standby */ + { 9, "" }, /* output source ecomode */ + { 0, "NULL" } }; /* Snmp2NUT lookup table */ static snmp_info_t netvision_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_UPSIDENTAGENTSWVERSION, "SOCOMEC SICON UPS", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_UPSIDENTMODEL, @@ -133,50 +119,47 @@ static snmp_info_t netvision_mib[] = { SU_FLAG_OK | SU_STATUS_BATT, &netvision_batt_info[0] }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, NETVISION_OID_OUTPUT_SOURCE, "", SU_FLAG_OK | SU_STATUS_PWR, &netvision_output_info[0] }, - /* upsAlarmOnBattery */ - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.4555.1.1.1.1.6.3.2.0", "", - SU_FLAG_OK | SU_STATUS_PWR, &netvision_onbatt_info[0] }, /* ups load */ { "ups.load", 0, 1, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_INPUT_1, NULL }, /*ups input,output voltage, output frquency phase 1 */ - { "input.phases", 0, 1.0, NETVISION_OID_INPUT_NUM_LINES, NULL, 0, NULL }, - { "input.frequency", 0, 0.1, NETVISION_OID_INPUT_FREQ, NULL, SU_FLAG_OK, NULL }, - { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, NULL, SU_INPUT_1, NULL }, - { "input.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, NULL, SU_INPUT_1, NULL }, - { "input.L1-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, NULL, SU_INPUT_3, NULL }, - { "input.L1.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, NULL, SU_INPUT_3, NULL }, - { "input.L2-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P2, NULL, SU_INPUT_3, NULL }, - { "input.L2.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P2, NULL, SU_INPUT_3, NULL }, - { "input.L3-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P3, NULL, SU_INPUT_3, NULL }, - { "input.L3.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P3, NULL, SU_INPUT_3, NULL }, + { "input.phases", 0, 1.0, NETVISION_OID_INPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &input_phases }, + { "input.frequency", 0, 0.1, NETVISION_OID_INPUT_FREQ, 0, SU_FLAG_OK, NULL }, + { "input.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_1, NULL }, + { "input.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_1, NULL }, + { "input.L1-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P1, 0, SU_INPUT_3, NULL }, + { "input.L1.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P1, 0, SU_INPUT_3, NULL }, + { "input.L2-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P2, 0, SU_INPUT_3, NULL }, + { "input.L2.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P2, 0, SU_INPUT_3, NULL }, + { "input.L3-N.voltage", 0, 0.1, NETVISION_OID_IN_VOLTAGE_P3, 0, SU_INPUT_3, NULL }, + { "input.L3.current", 0, 0.1, NETVISION_OID_IN_CURRENT_P3, 0, SU_INPUT_3, NULL }, - { "output.phases", 0, 1.0, NETVISION_OID_OUTPUT_NUM_LINES, NULL, 0, NULL }, - { "output.frequency", 0, 0.1, NETVISION_OID_OUTPUT_FREQ, NULL, SU_FLAG_OK, NULL }, - { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, NULL, SU_OUTPUT_1, NULL }, - { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, NULL, SU_OUTPUT_1, NULL }, - { "output.load", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, NULL, SU_OUTPUT_1, NULL }, - { "output.L1-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, NULL, SU_OUTPUT_3, NULL }, - { "output.L1.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, NULL, SU_OUTPUT_3, NULL }, - { "output.L1.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, NULL, SU_OUTPUT_3, NULL }, - { "output.L2-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P2, NULL, SU_OUTPUT_3, NULL }, - { "output.L2.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P2, NULL, SU_OUTPUT_3, NULL }, - { "output.L2.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P2, NULL, SU_OUTPUT_3, NULL }, - { "output.L3-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P3, NULL, SU_OUTPUT_3, NULL }, - { "output.L3.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P3, NULL, SU_OUTPUT_3, NULL }, - { "output.L3.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P3, NULL, SU_OUTPUT_3, NULL }, + { "output.phases", 0, 1.0, NETVISION_OID_OUTPUT_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &output_phases }, + { "output.frequency", 0, 0.1, NETVISION_OID_OUTPUT_FREQ, 0, SU_FLAG_OK, NULL }, + { "output.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_1, NULL }, + { "output.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_1, NULL }, + { "output.load", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_1, NULL }, + { "output.L1-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L1.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L1.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P1, 0, SU_OUTPUT_3, NULL }, + { "output.L2-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L2.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L2.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P2, 0, SU_OUTPUT_3, NULL }, + { "output.L3-N.voltage", 0, 0.1, NETVISION_OID_OUT_VOLTAGE_P3, 0, SU_OUTPUT_3, NULL }, + { "output.L3.current", 0, 0.1, NETVISION_OID_OUT_CURRENT_P3, 0, SU_OUTPUT_3, NULL }, + { "output.L3.power.percent", 0, 1.0, NETVISION_OID_OUT_LOAD_PCT_P3, 0, SU_OUTPUT_3, NULL }, - { "input.bypass.phases", 0, 1.0, NETVISION_OID_BYPASS_NUM_LINES, NULL, 0, NULL }, - { "input.bypass.frequency", 0, 0.1, NETVISION_OID_BYPASS_FREQ, NULL, SU_FLAG_OK, NULL }, - { "input.bypass.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, NULL, SU_BYPASS_1, NULL }, - { "input.bypass.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, NULL, SU_BYPASS_1, NULL }, - { "input.bypass.L1-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, NULL, SU_BYPASS_3, NULL }, - { "input.bypass.L1.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, NULL, SU_BYPASS_3, NULL }, - { "input.bypass.L2-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P2, NULL, SU_BYPASS_3, NULL }, - { "input.bypass.L2.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P2, NULL, SU_BYPASS_3, NULL }, - { "input.bypass.L3-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P3, NULL, SU_BYPASS_3, NULL }, - { "input.bypass.L3.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P3, NULL, SU_BYPASS_3, NULL }, + { "input.bypass.phases", 0, 1.0, NETVISION_OID_BYPASS_NUM_LINES, 0, SU_FLAG_SETINT, NULL, &bypass_phases }, + { "input.bypass.frequency", 0, 0.1, NETVISION_OID_BYPASS_FREQ, 0, SU_FLAG_OK, NULL }, + { "input.bypass.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_1, NULL }, + { "input.bypass.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_1, NULL }, + { "input.bypass.L1-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P1, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L1.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P1, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L2-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P2, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L2.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P2, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L3-N.voltage", 0, 0.1, NETVISION_OID_BY_VOLTAGE_P3, 0, SU_BYPASS_3, NULL }, + { "input.bypass.L3.current", 0, 0.1, NETVISION_OID_BY_CURRENT_P3, 0, SU_BYPASS_3, NULL }, /* battery info */ { "battery.charge", 0, 1, NETVISION_OID_BATT_CHARGE, "", SU_FLAG_OK, NULL }, @@ -187,4 +170,4 @@ static snmp_info_t netvision_mib[] = { { NULL, 0, 0, NULL, NULL, 0, NULL } }; -mib2nut_info_t netvision = { "netvision", NETVISION_MIB_VERSION, NULL, NETVISION_OID_UPSIDENTMODEL, netvision_mib, NETVISION_SYSOID, NULL }; +mib2nut_info_t netvision = { "netvision", NETVISION_MIB_VERSION, "", NETVISION_OID_UPSIDENTMODEL, netvision_mib, NETVISION_SYSOID }; diff --git a/drivers/netxml-ups.c b/drivers/netxml-ups.c index 330104a..2568ff0 100644 --- a/drivers/netxml-ups.c +++ b/drivers/netxml-ups.c @@ -1,4 +1,4 @@ -/* netxml-ups.c Driver routines for network XML UPS units +/* netxml-ups.c Driver routines for network XML UPS units Copyright (C) 2008-2009 Arjen de Korte @@ -39,10 +39,8 @@ #include #include -#include "nut_stdint.h" - #define DRIVER_NAME "network XML UPS" -#define DRIVER_VERSION "0.44" +#define DRIVER_VERSION "0.40" /** *_OBJECT query multi-part body boundary */ #define FORM_POST_BOUNDARY "NUT-NETXML-UPS-OBJECTS" @@ -176,7 +174,7 @@ static object_entry_t *set_object_add( /** * \brief SET_OBJECT: RAW POST mode implementation * - * \param req SET_OBJECT request + * \brief req SET_OBJECT request * * \return Response to the request */ @@ -186,7 +184,7 @@ static object_query_t *set_object_raw(object_query_t *req); /** * \brief SET_OBJECT: FORM POST mode implementation * - * \param req SET_OBJECT request + * \brief req SET_OBJECT request * * \return \c NULL (FORM POST mode resp. is ignored by specification) */ @@ -196,7 +194,7 @@ static object_query_t *set_object_form(object_query_t *req); /** * \brief SET_OBJECT: implementation * - * \param req SET_OBJECT request + * \brief req SET_OBJECT request * * \return Response to the request */ @@ -224,20 +222,19 @@ static ne_buffer *set_object_serialise_form(object_query_t *handle); /* FIXME: - * "built with neon library %s" LIBNEON_VERSION + * "built with neon library %s" LIBNEON_VERSION * subdrivers (limited to MGE only ATM) */ /* Global vars */ uint32_t ups_status = 0; static int timeout = 5; -int shutdown_duration = 120; +int shutdown_duration = 120; static int shutdown_timer = 0; static time_t lastheard = 0; static subdriver_t *subdriver = &mge_xml_subdriver; static ne_session *session = NULL; static ne_socket *sock = NULL; static ne_uri uri; -static char *product_page = NULL; /* Support functions */ static void netxml_alarm_set(void); @@ -264,7 +261,7 @@ void upsdrv_initinfo(void) { char *page, *last = NULL; char buf[SMALLBUF]; - + snprintf(buf, sizeof(buf), "%s", subdriver->initinfo); for (page = strtok_r(buf, " ", &last); page != NULL; page = strtok_r(NULL, " ", &last)) { @@ -272,8 +269,6 @@ void upsdrv_initinfo(void) if (netxml_get_page(page) != NE_OK) { continue; } - /* store product page, for later use */ - product_page = xstrdup(page); dstate_setinfo("driver.version.data", "%s", subdriver->version); @@ -297,8 +292,7 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { - ssize_t ret; - int errors = 0; + int ret, errors = 0; /* We really should be dealing with alarms through a separate callback, so that we can keep the * processing of alarms and polling for data separated. Currently, this isn't supported by the @@ -314,7 +308,7 @@ void upsdrv_updateinfo(void) /* alarm message received */ ne_xml_parser *parser = ne_xml_create(); - upsdebugx(2, "%s: ne_sock_read(%zd bytes) => %s", __func__, ret, buf); + upsdebugx(2, "%s: ne_sock_read(%d bytes) => %s", __func__, ret, buf); ne_xml_push_handler(parser, subdriver->startelm_cb, subdriver->cdata_cb, subdriver->endelm_cb, NULL); ne_xml_parse(parser, buf, strlen(buf)); ne_xml_destroy(parser); @@ -330,7 +324,7 @@ void upsdrv_updateinfo(void) upslogx(LOG_ERR, "NSM connection with '%s' lost", uri.host); - upsdebugx(2, "%s: ne_sock_read(%zd) => %s", __func__, ret, ne_sock_error(sock)); + upsdebugx(2, "%s: ne_sock_read(%d) => %s", __func__, ret, ne_sock_error(sock)); ne_sock_close(sock); if (netxml_alarm_subscribe(subdriver->subscribe) == NE_OK) { @@ -356,12 +350,6 @@ void upsdrv_updateinfo(void) errors++; } - /* also refresh the product information, at least for firmware information */ - ret = netxml_get_page(product_page); - if (ret != NE_OK) { - errors++; - } - if (errors > 1) { dstate_datastale(); return; @@ -448,9 +436,9 @@ static int instcmd(const char *cmdname, const char *extra) ser_send_buf(upsfd, ...); return STAT_INSTCMD_HANDLED; } -*/ - upslogx(LOG_NOTICE, "%s: unknown command [%s] [%s]", __func__, cmdname, extra); +*/ + upslogx(LOG_NOTICE, "%s: unknown command [%s]", __func__, cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -525,9 +513,6 @@ void upsdrv_makevartable(void) snprintf(buf, sizeof(buf), "shutdown timer in second (default: none)"); } addvar(VAR_VALUE, "shutdown_timer", buf); - - /* Legacy MGE-XML conversion from 2000's, not needed in modern firmwares */ - addvar(VAR_FLAG, "do_convert_deci", "enable legacy convert_deci() for certain measurements 10x too large"); } void upsdrv_initups(void) @@ -571,7 +556,7 @@ void upsdrv_initups(void) shutdown_timer = atoi(val); if (shutdown_timer < 0) { - fatalx(EXIT_FAILURE, "shutdown timer must be greater than or equal to 0"); + fatalx(EXIT_FAILURE, "shutdwon timer must be greater than or equal to 0"); } } @@ -590,7 +575,7 @@ void upsdrv_initups(void) if (uri.scheme == NULL) { uri.scheme = strdup("http"); } - + if (uri.host == NULL) { uri.host = strdup(device_path); } @@ -602,7 +587,7 @@ void upsdrv_initups(void) upsdebugx(1, "using %s://%s port %d", uri.scheme, uri.host, uri.port); session = ne_session_create(uri.scheme, uri.host, uri.port); - + /* timeout if we can't (re)connect to the UPS */ #ifdef HAVE_NE_SET_CONNECT_TIMEOUT ne_set_connect_timeout(session, timeout); @@ -653,7 +638,6 @@ void upsdrv_cleanup(void) free(subdriver->summary); free(subdriver->getobject); free(subdriver->setobject); - free(product_page); if (sock) { ne_sock_close(sock); @@ -672,36 +656,33 @@ void upsdrv_cleanup(void) static int netxml_get_page(const char *page) { - int ret = NE_ERROR; + int ret; ne_request *request; ne_xml_parser *parser; - upsdebugx(2, "%s: %s", __func__, (page != NULL)?page:"(null)"); + upsdebugx(2, "%s: %s", __func__, page); - if (page != NULL) { - request = ne_request_create(session, "GET", page); + request = ne_request_create(session, "GET", page); - parser = ne_xml_create(); + parser = ne_xml_create(); - ne_xml_push_handler(parser, subdriver->startelm_cb, subdriver->cdata_cb, subdriver->endelm_cb, NULL); + ne_xml_push_handler(parser, subdriver->startelm_cb, subdriver->cdata_cb, subdriver->endelm_cb, NULL); - ret = netxml_dispatch_request(request, parser); + ret = netxml_dispatch_request(request, parser); - if (ret) { - upsdebugx(2, "%s: %s", __func__, ne_get_error(session)); - } - - ne_xml_destroy(parser); - ne_request_destroy(request); + if (ret) { + upsdebugx(2, "%s: %s", __func__, ne_get_error(session)); } + + ne_xml_destroy(parser); + ne_request_destroy(request); + return ret; } static int netxml_alarm_subscribe(const char *page) { - ssize_t ret; - int secret = -1; - unsigned int port = 0; + int ret, port = -1, secret = -1; char buf[LARGEBUF], *s; ne_request *request; ne_sock_addr *addr; @@ -778,37 +759,18 @@ static int netxml_alarm_subscribe(const char *page) /* due to different formats used by the various NMCs, we need to\ break up the reply in lines and parse each one separately */ for (s = strtok(resp_buf, "\r\n"); s != NULL; s = strtok(NULL, "\r\n")) { - long long int tmp_port = -1, tmp_secret = -1; upsdebugx(2, "%s: parsing %s", __func__, s); - if (!strncasecmp(s, "", 6) && (sscanf(s+6, "%lli", &tmp_port) != 1)) { + if (!strncasecmp(s, "", 6) && (sscanf(s+6, "%u", &port) != 1)) { return NE_RETRY; } - /* FIXME? Does a port==0 make sense here? Or should the test below be for port<1? - * Legacy code until a fix here used sscanf() above to get a '%u' value... - */ - if (tmp_port < 0 || tmp_port > UINT_MAX) { - upsdebugx(2, "%s: parsing initial subcription failed, bad port value", __func__); + if (!strncasecmp(s, "", 8) && (sscanf(s+8, "%u", &secret) != 1)) { return NE_RETRY; } - - if (!strncasecmp(s, "", 8) && (sscanf(s+8, "%lli", &tmp_secret) != 1)) { - return NE_RETRY; - } - - if (tmp_secret < 0 || tmp_secret > UINT_MAX) { - upsdebugx(2, "%s: parsing initial subcription failed, bad secret value", __func__); - return NE_RETRY; - } - - /* Range of valid values constrained above */ - port = (unsigned int)tmp_port; - secret = (int)tmp_secret; - } - if ((port < 1) || (secret == -1)) { + if ((port == -1) || (secret == -1)) { upsdebugx(2, "%s: parsing initial subcription failed", __func__); return NE_RETRY; } @@ -912,8 +874,6 @@ static int netxml_dispatch_request(ne_request *request, ne_xml_parser *parser) /* Supply the 'login' and 'password' when authentication is required */ static int netxml_authenticate(void *userdata, const char *realm, int attempt, char *username, char *password) { - NUT_UNUSED_VARIABLE(userdata); - char *val; upsdebugx(2, "%s: realm = [%s], attempt = %d", __func__, realm, attempt); @@ -1020,9 +980,6 @@ static void netxml_status_set(void) if (STATUS_BIT(SHUTDOWNIMM)) { status_set("FSD"); /* shutdown imminent */ } - if (STATUS_BIT(CAL)) { - status_set("CAL"); /* calibrating */ - } } @@ -1073,7 +1030,7 @@ static void set_object_req_destroy(set_object_req_t *req) { /** * \brief SET_OBJECT response list entry destructor * - * \param resp SET_OBJECT response list entry + * \param req SET_OBJECT response list entry */ static void set_object_resp_destroy(set_object_resp_t *resp) { assert(NULL != resp); @@ -1242,8 +1199,8 @@ static object_entry_t *set_object_add( * \param buff Buffer * \param entry SET_OBJECT request entry * - * \return OBJECT_OK on success - * \return OBJECT_ERROR otherwise + * \retval OBJECT_OK on success + * \retval OBJECT_ERROR otherwise */ static object_query_status_t set_object_serialise_entries(ne_buffer *buff, object_entry_t *entry) { object_query_status_t status = OBJECT_OK; @@ -1523,9 +1480,6 @@ static int set_object_raw_resp_end_element( const char *nspace, const char *name) { - NUT_UNUSED_VARIABLE(userdata); - NUT_UNUSED_VARIABLE(nspace); - /* OBJECT (as a SET_OBJECT child) */ if (NE_XML_STATEROOT + 2 == state) { assert(0 == strcasecmp(name, "OBJECT")); @@ -1584,9 +1538,9 @@ static object_query_t *set_object_deserialise_raw(ne_buffer *buff) { * * The function creates HTTP request, sends it and reads-out the response. * - * \param[in] argsession HTTP session + * \param[in] session HTTP session * \param[in] method Request method - * \param[in] arguri Request URI + * \param[in] uri Request URI * \param[in] ct Request content type (optional, \c NULL accepted) * \param[in] req_body Request body (optional, \c NULL is accepted) * \param[out] resp_body Response body (optional, \c NULL is accepted) @@ -1594,9 +1548,9 @@ static object_query_t *set_object_deserialise_raw(ne_buffer *buff) { * \return HTTP status code if response was sent, 0 on send error */ static int send_http_request( - ne_session *argsession, + ne_session *session, const char *method, - const char *arguri, + const char *uri, const char *ct, ne_buffer *req_body, ne_buffer *resp_body) @@ -1606,7 +1560,7 @@ static int send_http_request( ne_request *req = NULL; /* Create request */ - req = ne_request_create(argsession, method, arguri); + req = ne_request_create(session, method, uri); /* Neon claims that request creation is always successful */ assert(NULL != req); @@ -1652,7 +1606,7 @@ static int send_http_request( break; if (NULL != resp_body) - ne_buffer_append(resp_body, buff, (size_t)read); + ne_buffer_append(resp_body, buff, read); } if (NE_OK != status) { diff --git a/drivers/netxml-ups.h b/drivers/netxml-ups.h index 555dc02..4729b7a 100644 --- a/drivers/netxml-ups.h +++ b/drivers/netxml-ups.h @@ -1,4 +1,4 @@ -/* netxml-ups.h Driver data/defines for network XML UPS units +/* netxml-ups.h Driver data/defines for network XML UPS units Copyright (C) 2008-2009 Arjen de Korte @@ -67,11 +67,9 @@ typedef enum { CHARGERFAIL, /* battery charger failure */ VRANGE, /* voltage out of range */ FRANGE, /* frequency out of range */ - FUSEFAULT, /* fuse fault */ - CAL /* calibrating */ + FUSEFAULT /* fuse fault */ } status_bit_t; extern uint32_t ups_status; -extern int shutdown_duration; #endif /* NETXML_UPS_H */ diff --git a/drivers/nut-ipmi.h b/drivers/nut-ipmi.h index 669eb92..0cd0deb 100644 --- a/drivers/nut-ipmi.h +++ b/drivers/nut-ipmi.h @@ -29,14 +29,6 @@ typedef enum { PSU_POWER_FAILURE /* = status OFF */ } psu_status_t; -#ifdef HAVE_FREEIPMI_11X_12X - /* args 8, 9, 10, 11 of ipmi_fru_multirecord_power_supply_information() */ - typedef int input_voltage_range_t; -#else - /* args 8, 9, 10, 11 of ipmi_fru_parse_multirecord_power_supply_information() */ - typedef unsigned int input_voltage_range_t; -#endif - /* Abstract structure to store information */ typedef struct IPMIDevice_s { int ipmi_id; /* FRU ID */ @@ -46,8 +38,8 @@ typedef struct IPMIDevice_s { char* part; /* Part Number */ char* date; /* Manufacturing Date/Time */ int overall_capacity; /* realpower.nominal? */ - input_voltage_range_t input_minvoltage; - input_voltage_range_t input_maxvoltage; + int input_minvoltage; + int input_maxvoltage; int input_minfreq; int input_maxfreq; int voltage; /* psu.voltage or device.voltage */ @@ -64,7 +56,8 @@ typedef struct IPMIDevice_s { /* Generic functions, to implement in the backends */ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev); void nut_ipmi_close(void); -int nut_ipmi_monitoring_init(void); +int nut_ipmi_monitoring_init(); int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev); #endif /* NUT_IPMI_H */ + diff --git a/drivers/nut-ipmipsu.c b/drivers/nut-ipmipsu.c index c0dd658..2991cfc 100644 --- a/drivers/nut-ipmipsu.c +++ b/drivers/nut-ipmipsu.c @@ -27,7 +27,7 @@ #include "nut-ipmi.h" #define DRIVER_NAME "IPMI PSU driver" -#define DRIVER_VERSION "0.31" +#define DRIVER_VERSION "0.30" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -47,11 +47,11 @@ upsdrv_info_t upsdrv_info = { /* Abstract structure to allow different IPMI implementation * We currently use FreeIPMI, but OpenIPMI and others are serious - * candidates! */ -static IPMIDevice_t ipmi_dev; + * candidates! */ +IPMIDevice_t ipmi_dev; /* Currently used to store FRU ID, but will probably evolve... */ -static int ipmi_id = -1; +int ipmi_id = -1; void upsdrv_initinfo(void) { @@ -87,17 +87,10 @@ void upsdrv_initinfo(void) if (ipmi_dev.overall_capacity != -1) dstate_setinfo("ups.realpower.nominal", "%i", ipmi_dev.overall_capacity); - /* FIXME: Did older FreeIPMI with "unsigned int" voltage ranges - * have a way to report invalid readings? - */ -#ifdef HAVE_FREEIPMI_11X_12X if (ipmi_dev.input_minvoltage != -1) -#endif dstate_setinfo("input.voltage.minimum", "%i", ipmi_dev.input_minvoltage); -#ifdef HAVE_FREEIPMI_11X_12X if (ipmi_dev.input_maxvoltage != -1) -#endif dstate_setinfo("input.voltage.maximum", "%i", ipmi_dev.input_maxvoltage); if (ipmi_dev.input_minfreq != -1) @@ -143,9 +136,6 @@ void upsdrv_updateinfo(void) */ } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { fatalx(EXIT_FAILURE, "shutdown not supported"); @@ -191,7 +181,7 @@ void upsdrv_makevartable(void) "Authentication type to use during lan session activation"); addvar(VAR_VALUE, "type", "Type of the device to match ('psu' for \"Power Supply\")"); - + addvar(VAR_VALUE, "serial", "Serial number to match a specific device"); addvar(VAR_VALUE, "fruid", "FRU identifier to match a specific device"); */ } @@ -207,7 +197,7 @@ void upsdrv_initups(void) * - out of band * "id?@host" * "host" => requires serial or ... - */ + */ if (!strncmp( device_path, "id", 2)) { ipmi_id = atoi(device_path+2); diff --git a/drivers/nut-libfreeipmi.c b/drivers/nut-libfreeipmi.c index b37f58f..dd06369 100644 --- a/drivers/nut-libfreeipmi.c +++ b/drivers/nut-libfreeipmi.c @@ -39,8 +39,6 @@ */ -#include "config.h" /* must be first */ - #include #include #include "timehead.h" @@ -51,7 +49,6 @@ #include #endif #include "nut-ipmi.h" -#include "nut_stdint.h" #include "dstate.h" /* FreeIPMI defines */ @@ -61,21 +58,20 @@ #define IPMI_FRU_CUSTOM_FIELDS 64 /* FreeIPMI contexts and configuration*/ -static ipmi_ctx_t ipmi_ctx = NULL; -static ipmi_monitoring_ctx_t mon_ctx = NULL; -/* static struct ipmi_monitoring_ipmi_config ipmi_config; */ +ipmi_ctx_t ipmi_ctx = NULL; +ipmi_monitoring_ctx_t mon_ctx = NULL; +struct ipmi_monitoring_ipmi_config ipmi_config; /* SDR management API has changed with 1.1.X and later */ #ifdef HAVE_FREEIPMI_11X_12X - static ipmi_sdr_ctx_t sdr_ctx = NULL; - static ipmi_fru_ctx_t fru_ctx = NULL; + ipmi_sdr_ctx_t sdr_ctx = NULL; + ipmi_fru_ctx_t fru_ctx = NULL; #define SDR_PARSE_CTX sdr_ctx - #define NUT_IPMI_SDR_CACHE_DEFAULTS IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT #else - static ipmi_sdr_cache_ctx_t sdr_ctx = NULL; - static ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL; + ipmi_sdr_cache_ctx_t sdr_ctx = NULL; + ipmi_sdr_parse_ctx_t sdr_parse_ctx = NULL; #define SDR_PARSE_CTX sdr_parse_ctx - static ipmi_fru_parse_ctx_t fru_ctx = NULL; + ipmi_fru_parse_ctx_t fru_ctx = NULL; /* Functions remapping */ #define ipmi_sdr_ctx_create ipmi_sdr_cache_ctx_create #define ipmi_sdr_ctx_destroy ipmi_sdr_cache_ctx_destroy @@ -103,7 +99,6 @@ static ipmi_monitoring_ctx_t mon_ctx = NULL; #define IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA #define IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION #define IPMI_FRU_AREA_STRING_MAX IPMI_FRU_PARSE_AREA_STRING_MAX - #define NUT_IPMI_SDR_CACHE_DEFAULTS IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT, IPMI_SDR_CACHE_VALIDATION_FLAGS_DEFAULT #endif /* HAVE_FREEIPMI_11X_12X */ /* FIXME: freeipmi auto selects a cache based on the hostname you are @@ -115,7 +110,7 @@ static ipmi_monitoring_ctx_t mon_ctx = NULL; static const char* libfreeipmi_getfield (uint8_t language_code, ipmi_fru_field_t *field); -static void libfreeipmi_cleanup(void); +static void libfreeipmi_cleanup(); static int libfreeipmi_get_psu_info (const void *areabuf, uint8_t area_length, IPMIDevice_t *ipmi_dev); @@ -138,16 +133,6 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) upsdebugx(1, "nut-libfreeipmi: nutipmi_open()..."); - /* FIXME? Check arg types for ipmi_fru_open_device_id() in configure? - * At this time it is uint8_t for libfreeipmi implementation of IPMI. - */ - if (ipmi_id > (int)UINT8_MAX) { - libfreeipmi_cleanup(); - fatal_with_errno(EXIT_FAILURE, - "nut_ipmi_open: ipmi_id %d is too large for libfreeipmi", - ipmi_id); - } - /* Initialize the FreeIPMI library. */ if (!(ipmi_ctx = ipmi_ctx_create ())) { @@ -184,7 +169,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) libfreeipmi_cleanup(); fatal_with_errno(EXIT_FAILURE, "ipmi_fru_ctx_create()"); } - + /* lots of motherboards calculate checksums incorrectly */ if (ipmi_fru_ctx_set_flags (fru_ctx, IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS) < 0) { @@ -194,7 +179,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) } /* Now open the requested (local) PSU */ - if (ipmi_fru_open_device_id (fru_ctx, (uint8_t)ipmi_id) < 0) + if (ipmi_fru_open_device_id (fru_ctx, ipmi_id) < 0) { libfreeipmi_cleanup(); fatalx(EXIT_FAILURE, "ipmi_fru_open_device_id: %s\n", @@ -219,27 +204,19 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) IPMI_FRU_AREA_SIZE_MAX) < 0) { libfreeipmi_cleanup(); - fatal_with_errno(EXIT_FAILURE, + fatal_with_errno(EXIT_FAILURE, "ipmi_fru_read_data_area: %s\n", ipmi_fru_ctx_errormsg (fru_ctx)); } if (area_length) { - - if (area_length > (int)UINT8_MAX) { - libfreeipmi_cleanup(); - fatal_with_errno(EXIT_FAILURE, - "nut_ipmi_open: got area_length %d is too large for libfreeipmi", - area_length); - } - switch (area_type) { /* get generic board information */ case IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA: - if(libfreeipmi_get_board_info (areabuf, (uint8_t)area_length, + if(libfreeipmi_get_board_info (areabuf, area_length, ipmi_dev) < 0) { upsdebugx(1, "Can't retrieve board information"); @@ -248,7 +225,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) /* get specific PSU information */ case IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION: - if(libfreeipmi_get_psu_info (areabuf, (uint8_t)area_length, ipmi_dev) < 0) + if(libfreeipmi_get_psu_info (areabuf, area_length, ipmi_dev) < 0) { upsdebugx(1, "Can't retrieve PSU information"); } @@ -365,18 +342,18 @@ static int libfreeipmi_get_psu_info (const void *areabuf, { /* FIXME: directly use ipmi_dev fields */ unsigned int overall_capacity; - input_voltage_range_t low_end_input_voltage_range_1; - input_voltage_range_t high_end_input_voltage_range_1; + unsigned int low_end_input_voltage_range_1; + unsigned int high_end_input_voltage_range_1; unsigned int low_end_input_frequency_range; unsigned int high_end_input_frequency_range; - unsigned int voltage_1; /* code for conversion into a float */ + unsigned int voltage_1; /* FIXME: check for the interest and capability to use these data */ unsigned int peak_va; unsigned int inrush_current; unsigned int inrush_interval; - input_voltage_range_t low_end_input_voltage_range_2; - input_voltage_range_t high_end_input_voltage_range_2; + unsigned int low_end_input_voltage_range_2; + unsigned int high_end_input_voltage_range_2; unsigned int ac_dropout_tolerance; unsigned int predictive_fail_support; unsigned int power_factor_correction; @@ -421,36 +398,16 @@ static int libfreeipmi_get_psu_info (const void *areabuf, ipmi_fru_ctx_errormsg (fru_ctx)); } - if (overall_capacity > (int)INT_MAX) - { - fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: overall_capacity exceeds expected range: %u", - overall_capacity); - } - ipmi_dev->overall_capacity = (int)overall_capacity; + ipmi_dev->overall_capacity = overall_capacity; /* Voltages are in mV! */ ipmi_dev->input_minvoltage = low_end_input_voltage_range_1 / 1000; ipmi_dev->input_maxvoltage = high_end_input_voltage_range_1 / 1000; - if (low_end_input_frequency_range > (int)INT_MAX) - { - fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: low_end_input_frequency_range exceeds expected range: %u", - low_end_input_frequency_range); - } - if (high_end_input_frequency_range > (int)INT_MAX) - { - fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: high_end_input_frequency_range exceeds expected range: %u", - high_end_input_frequency_range); - } - ipmi_dev->input_minfreq = (int)low_end_input_frequency_range; - ipmi_dev->input_maxfreq = (int)high_end_input_frequency_range; + ipmi_dev->input_minfreq = low_end_input_frequency_range; + ipmi_dev->input_maxfreq = high_end_input_frequency_range; - if (voltage_1 > (int)UINT8_MAX) - { - fatalx(EXIT_FAILURE, "ipmi_fru_multirecord_power_supply_information: voltage_1 code exceeds expected range: %u", - voltage_1); - } - ipmi_dev->voltage = libfreeipmi_get_voltage((uint8_t)voltage_1); + ipmi_dev->voltage = libfreeipmi_get_voltage(voltage_1); upsdebugx(1, "libfreeipmi_get_psu_info() retrieved successfully"); @@ -503,6 +460,7 @@ static int libfreeipmi_get_board_info (const void *areabuf, ipmi_fru_ctx_errormsg (fru_ctx)); } + if (IPMI_FRU_LANGUAGE_CODE_VALID (language_code)) { upsdebugx (5, "FRU Board Language: %s", ipmi_fru_language_codes[language_code]); } @@ -514,39 +472,7 @@ static int libfreeipmi_get_board_info (const void *areabuf, * 'struct tm', thus passing 'struct tm' between functions could * have issues. So we need to memset */ memset (&mfg_date_time_tm, '\0', sizeof (struct tm)); - - /* Without a standard TIME_MAX, signedness may suffer; - * but we can at least check the number should fit */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Stay ahead of possible redefinitions... */ - if (sizeof(mfg_date_time) > sizeof(timetmp)) - { - libfreeipmi_cleanup(); - fatalx(EXIT_FAILURE, "libfreeipmi_get_board_info: mfg_date_time type too large to process into a time_t"); - } - /* NOTE: Code until the end of method would also be "unreachable" - * for compilers or static analyzers that care about this, if the - * sizeof() check above fails on some architecture; build warnings - * should expose that so we look for a fix - so do not just blindly - * move the closing pragmas to end of method ;) - */ -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - - timetmp = (time_t)mfg_date_time; + timetmp = mfg_date_time; localtime_r (&timetmp, &mfg_date_time_tm); memset (mfg_date_time_buf, '\0', IPMI_FRU_STR_BUFLEN + 1); strftime (mfg_date_time_buf, IPMI_FRU_STR_BUFLEN, "%D - %T", &mfg_date_time_tm); @@ -590,7 +516,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) uint16_t record_count; int found_device_id = 0; uint16_t record_id; - uint8_t entity_id = 0, entity_instance = 0; + uint8_t entity_id, entity_instance; int i; if (ipmi_ctx == NULL) @@ -628,7 +554,10 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) { if (ipmi_sdr_cache_create (sdr_ctx, ipmi_ctx, CACHE_LOCATION, - NUT_IPMI_SDR_CACHE_DEFAULTS, + IPMI_SDR_CACHE_CREATE_FLAGS_DEFAULT, +#ifndef HAVE_FREEIPMI_11X_12X + IPMI_SDR_CACHE_VALIDATION_FLAGS_DEFAULT, +#endif NULL, NULL) < 0) { libfreeipmi_cleanup(); @@ -669,7 +598,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) } if (ipmi_sdr_parse_record_id_and_type (SDR_PARSE_CTX, sdr_record, - (unsigned int)sdr_record_len, + sdr_record_len, NULL, &record_type) < 0) { @@ -687,7 +616,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (ipmi_sdr_parse_fru_device_locator_parameters (SDR_PARSE_CTX, sdr_record, - (unsigned int)sdr_record_len, + sdr_record_len, NULL, &logical_fru_device_device_slave_address, NULL, @@ -710,7 +639,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (ipmi_sdr_parse_fru_entity_id_and_instance (SDR_PARSE_CTX, sdr_record, - (unsigned int)sdr_record_len, + sdr_record_len, &entity_id, &entity_instance) < 0) { @@ -733,7 +662,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (ipmi_sdr_cache_first (sdr_ctx) < 0) { - fprintf (stderr, "ipmi_sdr_cache_first: %s\n", + fprintf (stderr, "ipmi_sdr_cache_first: %s\n", ipmi_sdr_ctx_errormsg (sdr_ctx)); goto cleanup; } @@ -756,7 +685,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (ipmi_sdr_parse_record_id_and_type (SDR_PARSE_CTX, sdr_record, - (unsigned int)sdr_record_len, + sdr_record_len, &record_id, &record_type) < 0) { @@ -775,7 +704,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (ipmi_sdr_parse_entity_id_instance_type (SDR_PARSE_CTX, sdr_record, - (unsigned int)sdr_record_len, + sdr_record_len, &tmp_entity_id, &tmp_entity_instance, NULL) < 0) @@ -810,11 +739,7 @@ cleanup: } #endif /* HAVE_FREEIPMI_11X_12X */ - if (ipmi_dev->sensors_count > INT_MAX) { - upsdebugx(1, "%s: Found %i sensors which is too many", - __func__, ipmi_dev->sensors_count); - } - return (int)ipmi_dev->sensors_count; + return ipmi_dev->sensors_count; } @@ -937,7 +862,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev) * if ((sensor_state = ipmi_monitoring_sensor_read_sensor_state (mon_ctx)) < 0) * ... */ - if ((sensor_reading = ipmi_monitoring_sensor_read_sensor_reading (mon_ctx)) == NULL) + if ((sensor_reading = ipmi_monitoring_sensor_read_sensor_reading (mon_ctx)) < 0) { upsdebugx (1, "ipmi_monitoring_sensor_read_sensor_reading() error: %s", ipmi_monitoring_ctx_errormsg (mon_ctx)); @@ -957,7 +882,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev) continue; } - if ((sensor_bitmask_strings = ipmi_monitoring_sensor_read_sensor_bitmask_strings (mon_ctx)) == NULL) + if ((sensor_bitmask_strings = ipmi_monitoring_sensor_read_sensor_bitmask_strings (mon_ctx)) < 0) { upsdebugx (1, "ipmi_monitoring_sensor_read_sensor_bitmask_strings() error: %s", ipmi_monitoring_ctx_errormsg (mon_ctx)); @@ -1065,7 +990,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev) break; } } - + /* Process status if needed */ if (psu_status != PSU_STATUS_UNKNOWN) { @@ -1087,7 +1012,7 @@ int nut_ipmi_get_sensors_status(IPMIDevice_t *ipmi_dev) retval = 0; break; } - + status_commit(); } #endif /* HAVE_FREEIPMI_MONITORING */ diff --git a/drivers/nut_libusb.h b/drivers/nut_libusb.h deleted file mode 100644 index 20473d3..0000000 --- a/drivers/nut_libusb.h +++ /dev/null @@ -1,111 +0,0 @@ -/*! - * @file nut_libusb.h - * @brief HID Library - Generic USB backend for Generic HID Access (using MGE HIDParser) - * - * @author Copyright (C) - * 2003 - 2016 Arnaud Quette - * 2005 Peter Selinger - * 2021 Jim Klimov - * - * This program is sponsored by MGE UPS SYSTEMS - opensource.mgeups.com - * - * The logic of this file is ripped from mge-shut driver (also from - * Arnaud Quette), which is a "HID over serial link" UPS driver for - * Network UPS Tools - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * -------------------------------------------------------------------------- */ - -#ifndef NUT_LIBUSB_H_SEEN -#define NUT_LIBUSB_H_SEEN 1 - -#include "main.h" /* for subdrv_info_t */ -#include "usb-common.h" /* for USBDevice_t and USBDeviceMatcher_t, - * and for libusb headers and 0.1/1.0 mapping */ - -/* Used in drivers/libusb*.c sources: */ -#define LIBUSB_DEFAULT_INTERFACE 0 -#define LIBUSB_DEFAULT_DESC_INDEX 0 -#define LIBUSB_DEFAULT_HID_EP_IN 1 -#define LIBUSB_DEFAULT_HID_EP_OUT 1 - -extern upsdrv_info_t comm_upsdrv_info; - -/*! - * usb_communication_subdriver_s: structure to describe the communication routines - * @name: can be either "shut" for Serial HID UPS Transfer (from MGE) or "usb" - */ -typedef struct usb_communication_subdriver_s { - const char *name; /* name of this subdriver */ - const char *version; /* version of this subdriver */ - - int (*open)(usb_dev_handle **sdevp, /* try to open the next available */ - USBDevice_t *curDevice, /* device matching USBDeviceMatcher_t */ - USBDeviceMatcher_t *matcher, - int (*callback)(usb_dev_handle *udev, USBDevice_t *hd, - usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen)); - - void (*close)(usb_dev_handle *sdev); - - int (*get_report)(usb_dev_handle *sdev, usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, usb_ctrl_charbufsize ReportSize); - - int (*set_report)(usb_dev_handle *sdev, usb_ctrl_repindex ReportId, - usb_ctrl_charbuf raw_buf, usb_ctrl_charbufsize ReportSize); - - int (*get_string)(usb_dev_handle *sdev, - usb_ctrl_strindex StringIdx, char *buf, usb_ctrl_charbufsize buflen); - - int (*get_interrupt)(usb_dev_handle *sdev, - usb_ctrl_charbuf buf, usb_ctrl_charbufsize bufsize, - usb_ctrl_timeout_msec timeout); - - /* Used for Powervar UPS or similar cases to make sure - * we use the right interface in the Composite device. - * In a few cases our libusb*.c sets the value for specific - * VID/PID combinations, in others the subdrivers do so. - * FIXME: The numeric value here seems to fit and - * gets used in several contexts, it may be cleaner - * to separate them eventually. Usages in NUT were - * seen as following libusb API (1.0 and 0.1) args, - * along with some hints from libusb sources/headers: - * libusb-1.0: - * libusb_claim_interface - "int interface_number" - * libusb_detach_kernel_driver - "int interface_number" - * libusb_get_config_descriptor - "uint8_t config_index" ("the index of the configuration you wish to retrieve") - * libusb_control_transfer - "uint16_t wIndex" ("the index field for the setup packet"; "should be given in host-endian byte order") - * libusb-0.1: // The parameters mirror the types of the same name in the USB specification - * usb_claim_interface - "int interface" - * usb_control_msg - "int index" - * (_np = non-portable => only on some systems, like FreeBSD) - * usb_detach_kernel_driver_np - "int interface" - */ - usb_ctrl_repindex hid_rep_index; /* number of the interface we use in a composite USB device; see comments above */ - - /* All devices use HID descriptor at index 0. - * However, some UPS like newer Eaton units have - * a light HID descriptor at index 0, and - * the full version is at index 1 (in which - * case, bcdDevice == 0x0202) - */ - usb_ctrl_descindex hid_desc_index; /* HID descriptor is at this index (non-trivial for composite USB devices); see comments above */ - usb_ctrl_endpoint hid_ep_in; /* Input interrupt endpoint. Default is 1 */ - usb_ctrl_endpoint hid_ep_out; /* Output interrupt endpoint. Default is 1 */ -} usb_communication_subdriver_t; - -extern usb_communication_subdriver_t usb_subdriver; - -#endif /* NUT_LIBUSB_H_SEEN */ diff --git a/drivers/nutdrv_atcl_usb.c b/drivers/nutdrv_atcl_usb.c deleted file mode 100644 index 4d51a4b..0000000 --- a/drivers/nutdrv_atcl_usb.c +++ /dev/null @@ -1,675 +0,0 @@ -/* - * nutdrv_atcl_usb.c - driver for generic-brand "ATCL FOR UPS" - * - * Copyright (C) 2013-2014 Charles Lepple - * Copyright (C) 2016 Eaton - * - * Loosely based on richcomm_usb.c, - * Copyright (C) 2007 Peter van Valderen - * Dirk Teurlings - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "main.h" -#include "usb-common.h" - -/* driver version */ -#define DRIVER_NAME "'ATCL FOR UPS' USB driver" -#define DRIVER_VERSION "1.16" - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Charles Lepple ", - DRV_EXPERIMENTAL, - { NULL } -}; - -#define STATUS_ENDPOINT (USB_ENDPOINT_IN | 1) -#define SHUTDOWN_ENDPOINT (USB_ENDPOINT_OUT | 2) -#define STATUS_PACKETSIZE 8 -#define SHUTDOWN_PACKETSIZE 8 - -/* Probably can reduce this, since the pcap file shows mostly 1050-ish ms response times */ -#define ATCL_USB_TIMEOUT USB_TIMEOUT - -/* limit the amount of spew that goes in the syslog when we lose the UPS (from nut_usb.h) */ -#define USB_ERR_LIMIT 10 /* start limiting after 10 in a row */ -#define USB_ERR_RATE 10 /* then only print every 10th error */ - -#define USB_VENDOR_STRING "ATCL FOR UPS" - -static usb_device_id_t atcl_usb_id[] = { - /* ATCL FOR UPS */ - { USB_DEVICE(0x0001, 0x0000), NULL }, - - /* Terminating entry */ - { 0, 0, NULL } -}; - -static usb_dev_handle *udev = NULL; -static USBDevice_t usbdevice; -static unsigned int comm_failures = 0; - -static int device_match_func(USBDevice_t *device, void *privdata) -{ - char *requested_vendor; - NUT_UNUSED_VARIABLE(privdata); - - switch (is_usb_device_supported(atcl_usb_id, device)) - { - case SUPPORTED: - if(!device->Vendor) { - upsdebugx(1, "Couldn't retrieve USB string descriptor for vendor. Check permissions?"); - requested_vendor = getval("vendor"); - if(requested_vendor) { - if(!strcmp("NULL", requested_vendor)) { - upsdebugx(3, "Matched device with NULL vendor string."); - return 1; - } - } - upsdebugx(1, "To keep trying (in case your device does not have a vendor string), use vendor=NULL"); - return 0; - } - - if(!strcmp(device->Vendor, USB_VENDOR_STRING)) { - upsdebugx(4, "Matched expected vendor='%s'.", USB_VENDOR_STRING); - return 1; - } - /* Didn't match, but the user provided an alternate vendor ID: */ - requested_vendor = getval("vendor"); - if(requested_vendor) { - if(!strcmp(device->Vendor, requested_vendor)) { - upsdebugx(3, "Matched device with vendor='%s'.", requested_vendor); - return 1; - } else { - upsdebugx(2, "idVendor=%04x and idProduct=%04x, " - "but provided vendor '%s' does not match device: '%s'.", - device->VendorID, device->ProductID, requested_vendor, device->Vendor); - return 0; - } - } - - /* TODO: automatic way of suggesting other drivers? */ - upsdebugx(2, "idVendor=%04x and idProduct=%04x, " - "but device vendor string '%s' does not match expected string '%s'. " - "Have you tried the nutdrv_qx driver?", - device->VendorID, device->ProductID, device->Vendor, USB_VENDOR_STRING); - return 0; - - case POSSIBLY_SUPPORTED: - case NOT_SUPPORTED: - default: - return 0; - } -} - -static USBDeviceMatcher_t device_matcher = { - &device_match_func, - NULL, - NULL -}; - -static int query_ups(char *reply) -{ - int ret; - - ret = usb_interrupt_read(udev, STATUS_ENDPOINT, (usb_ctrl_charbuf)reply, STATUS_PACKETSIZE, ATCL_USB_TIMEOUT); - - if (ret <= 0) { - upsdebugx(2, "status interrupt read: %s", ret ? nut_usb_strerror(ret) : "timeout"); - return ret; - } - - assert ((uintmax_t)ret < (uintmax_t)SIZE_MAX); - upsdebug_hex(3, "read", reply, (size_t)ret); - return ret; -} - -static void usb_comm_fail(const char *fmt, ...) -{ - int ret; - char why[SMALLBUF]; - va_list ap; - - /* this means we're probably here because select was interrupted */ - if (exit_flag != 0) { - return; /* ignored, since we're about to exit anyway */ - } - - comm_failures++; - - if ((comm_failures == USB_ERR_LIMIT) || ((comm_failures % USB_ERR_RATE) == 0)) { - upslogx(LOG_WARNING, "Warning: excessive comm failures, limiting error reporting"); - } - - /* once it's past the limit, only log once every USB_ERR_LIMIT calls */ - if ((comm_failures > USB_ERR_LIMIT) && ((comm_failures % USB_ERR_LIMIT) != 0)) { - return; - } - - /* generic message if the caller hasn't elaborated */ - if (!fmt) { - upslogx(LOG_WARNING, "Communications with UPS lost - check cabling"); - return; - } - - va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - ret = vsnprintf(why, sizeof(why), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - va_end(ap); - - if ((ret < 1) || (ret >= (int) sizeof(why))) { - upslogx(LOG_WARNING, "usb_comm_fail: vsnprintf needed more than %d bytes", (int)sizeof(why)); - } - - upslogx(LOG_WARNING, "Communications with UPS lost: %s", why); -} - -static void usb_comm_good(void) -{ - if (comm_failures == 0) { - return; - } - - upslogx(LOG_NOTICE, "Communications with UPS re-established"); - comm_failures = 0; -} - -/* - * Callback that is called by usb_device_open() that handles USB device - * settings prior to accepting the devide. At the very least claim the - * device here. Detaching the kernel driver will be handled by the - * caller, don't do this here. Return < 0 on error, 0 or higher on - * success. - */ -static int driver_callback(usb_dev_handle *handle, USBDevice_t *device) -{ - int ret; - NUT_UNUSED_VARIABLE(device); - - if ((ret = usb_set_configuration(handle, 1)) < 0) { - upslogx(LOG_WARNING, "Can't set USB configuration: %s", nut_usb_strerror(ret)); - return -1; - } - - if ((ret = usb_claim_interface(handle, 0)) < 0) { - upslogx(LOG_WARNING, "Can't claim USB interface: %s", nut_usb_strerror(ret)); - return -1; - } - - /* TODO: HID SET_IDLE to 0 (not necessary?) */ - - return 1; -} - -static int usb_device_close(usb_dev_handle *handle) -{ - int ret = 0; - - if (!handle) { - return 0; - } - - /* usb_release_interface() sometimes blocks and goes - * into uninterruptible sleep. So don't do it. - */ - /* usb_release_interface(handle, 0); */ - -#if WITH_LIBUSB_1_0 - libusb_close(handle); - libusb_exit(NULL); -#else - ret = usb_close(handle); -#endif - - return ret; -} - -static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDeviceMatcher_t *matcher, - int (*callback)(usb_dev_handle *handle, USBDevice_t *device)) -{ - int ret = 0; - uint8_t iManufacturer = 0, iProduct = 0, iSerialNumber = 0; - - /* libusb base init */ -#if WITH_LIBUSB_1_0 - if (libusb_init(NULL) < 0) { - libusb_exit(NULL); - fatal_with_errno(EXIT_FAILURE, "Failed to init libusb 1.0"); - } -#else /* => WITH_LIBUSB_0_1 */ - usb_init(); - usb_find_busses(); - usb_find_devices(); -#endif /* WITH_LIBUSB_1_0 */ - -#ifndef __linux__ /* SUN_LIBUSB (confirmed to work on Solaris and FreeBSD) */ - /* Causes a double free corruption in linux if device is detached! */ - /* usb_device_close(*handlep); */ - if (*handlep) - usb_close(*handlep); -#endif - -#if WITH_LIBUSB_1_0 - libusb_device **devlist; - ssize_t devcount = 0; - libusb_device_handle *handle; - struct libusb_device_descriptor dev_desc; - uint8_t bus; - int i; - - devcount = libusb_get_device_list(NULL, &devlist); - if (devcount <= 0) - fatal_with_errno(EXIT_FAILURE, "No USB device found"); - - for (i = 0; i < devcount; i++) { - - USBDeviceMatcher_t *m; - libusb_device *dev = devlist[i]; - libusb_get_device_descriptor(dev, &dev_desc); - ret = libusb_open(dev, &handle); - *handlep = handle; -#else /* => WITH_LIBUSB_0_1 */ - struct usb_bus *bus; - for (bus = usb_busses; bus; bus = bus->next) { - - struct usb_device *dev; - usb_dev_handle *handle; - - for (dev = bus->devices; dev; dev = dev->next) { - - int i; - USBDeviceMatcher_t *m; - - upsdebugx(3, "Checking USB device [%04x:%04x] (%s/%s)", - dev->descriptor.idVendor, - dev->descriptor.idProduct, - bus->dirname, dev->filename); - - /* supported vendors are now checked by the supplied matcher */ - - /* open the device */ - *handlep = handle = usb_open(dev); -#endif /* WITH_LIBUSB_1_0 */ - - if (!handle) { - upsdebugx(4, "Failed to open USB device, skipping: %s", nut_usb_strerror(ret)); - continue; - } - - /* collect the identifying information of this - device. Note that this is safe, because - there's no need to claim an interface for - this (and therefore we do not yet need to - detach any kernel drivers). */ - - free(device->Vendor); - free(device->Product); - free(device->Serial); - free(device->Bus); - - memset(device, 0, sizeof(*device)); - -#if WITH_LIBUSB_1_0 - device->VendorID = dev_desc.idVendor; - device->ProductID = dev_desc.idProduct; - bus = libusb_get_bus_number(dev); - device->Bus = (char *)malloc(4); - if (device->Bus == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - sprintf(device->Bus, "%03d", bus); - iManufacturer = dev_desc.iManufacturer; - iProduct = dev_desc.iProduct; - iSerialNumber = dev_desc.iSerialNumber; -#else /* => WITH_LIBUSB_0_1 */ - device->VendorID = dev->descriptor.idVendor; - device->ProductID = dev->descriptor.idProduct; - device->Bus = xstrdup(bus->dirname); - iManufacturer = dev->descriptor.iManufacturer; - iProduct = dev->descriptor.iProduct; - iSerialNumber = dev->descriptor.iSerialNumber; -#endif /* WITH_LIBUSB_1_0 */ - - if (iManufacturer) { - char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iManufacturer, - (usb_ctrl_charbuf)buf, sizeof(buf)); - if (ret > 0) { - device->Vendor = strdup(buf); - if (device->Vendor == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - } - } - - if (iProduct) { - char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iProduct, - (usb_ctrl_charbuf)buf, sizeof(buf)); - if (ret > 0) { - device->Product = strdup(buf); - if (device->Product == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - } - } - - if (iSerialNumber) { - char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iSerialNumber, - (usb_ctrl_charbuf)buf, sizeof(buf)); - if (ret > 0) { - device->Serial = strdup(buf); - if (device->Serial == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - } - } - - upsdebugx(4, "- VendorID : %04x", device->VendorID); - upsdebugx(4, "- ProductID : %04x", device->ProductID); - upsdebugx(4, "- Manufacturer : %s", device->Vendor ? device->Vendor : "unknown"); - upsdebugx(4, "- Product : %s", device->Product ? device->Product : "unknown"); - upsdebugx(4, "- Serial Number: %s", device->Serial ? device->Serial : "unknown"); - upsdebugx(4, "- Bus : %s", device->Bus ? device->Bus : "unknown"); - - for (m = matcher; m; m = m->next) { - - switch (m->match_function(device, m->privdata)) - { - case 0: - upsdebugx(4, "Device does not match - skipping"); - goto next_device; - case -1: -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "matcher"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif - goto next_device; -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif - case -2: - upsdebugx(4, "matcher: unspecified error"); - goto next_device; - } - } -#ifdef HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER - /* First, try the auto-detach kernel driver method - * This function is not available on FreeBSD 10.1-10.3 */ - if ((ret = libusb_set_auto_detach_kernel_driver (udev, 1)) < 0) - upsdebugx(2, "failed to auto detach kernel driver from USB device: %s", - nut_usb_strerror((enum libusb_error)ret)); - else - upsdebugx(2, "auto detached kernel driver from USB device"); -#endif /* HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER */ - - for (i = 0; i < 3; i++) { - - ret = callback(handle, device); - if (ret >= 0) { - upsdebugx(3, "USB device [%04x:%04x] opened", device->VendorID, device->ProductID); -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - return ret; - } - -#if WITH_LIBUSB_0_1 && (defined HAVE_USB_DETACH_KERNEL_DRIVER_NP) - /* this method requires at least libusb 0.1.8: - * it forces device claiming by unbinding - * attached driver... From libhid */ - if ((ret = usb_detach_kernel_driver_np(handle, 0)) < 0) { - upsdebugx(1, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); - } else { - upsdebugx(4, "detached kernel driver from USB device..."); - } -#else -# ifdef HAVE_LIBUSB_DETACH_KERNEL_DRIVER - if ((ret = libusb_detach_kernel_driver(udev, 0)) < 0) { - upsdebugx(4, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); - } else { - upsdebugx(4, "detached kernel driver from USB device..."); - } -# else -# ifdef HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP - if ((ret = libusb_detach_kernel_driver_np(udev, 0)) < 0) { - upsdebugx(4, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); - } else { - upsdebugx(4, "detached kernel driver from USB device..."); - } -# endif /* HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP */ -# endif /* HAVE_LIBUSB_DETACH_KERNEL_DRIVER */ -#endif /* HAVE_USB_DETACH_KERNEL_DRIVER_NP or HAVE_LIBUSB_DETACH_KERNEL_DRIVER or HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP */ - } - -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatalx(EXIT_FAILURE, - "USB device [%04x:%04x] matches, but driver callback failed: %s", - device->VendorID, device->ProductID, - nut_usb_strerror(ret)); - - next_device: - usb_close(handle); -#if (!WITH_LIBUSB_1_0) /* => WITH_LIBUSB_0_1 */ - } -#endif /* WITH_LIBUSB_1_0 */ - } - - *handlep = NULL; -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - upsdebugx(3, "No matching USB device found"); - - return -1; -} - -/* - * Initialise the UPS - */ -void upsdrv_initups(void) -{ - int i; - - upsdebugx(1, "Searching for USB device..."); - - for (i = 0; usb_device_open(&udev, &usbdevice, &device_matcher, &driver_callback) < 0; i++) { - - if ((i < 3) && (sleep(5) == 0)) { - usb_comm_fail("Can't open USB device, retrying ..."); - continue; - } - - fatalx(EXIT_FAILURE, - "Unable to find ATCL FOR UPS\n\n" - - "Things to try:\n" - " - Connect UPS device to USB bus\n" - " - Run this driver as another user (upsdrvctl -u or 'user=...' in ups.conf).\n" - " See upsdrvctl(8) and ups.conf(5).\n\n" - - "Fatal error: unusable configuration"); - } - -} - -void upsdrv_cleanup(void) -{ - usb_device_close(udev); - - free(usbdevice.Vendor); - free(usbdevice.Product); - free(usbdevice.Serial); - free(usbdevice.Bus); -} - -void upsdrv_initinfo(void) -{ - dstate_setinfo("ups.mfr", "%s", usbdevice.Vendor ? usbdevice.Vendor : "unknown"); - dstate_setinfo("ups.model", "%s", usbdevice.Product ? usbdevice.Product : "unknown"); - if(usbdevice.Serial && usbdevice.Product && strcmp(usbdevice.Serial, usbdevice.Product)) { - /* Only set "ups.serial" if it isn't the same as "ups.model": */ - dstate_setinfo("ups.serial", "%s", usbdevice.Serial); - } - - dstate_setinfo("ups.vendorid", "%04x", usbdevice.VendorID); - dstate_setinfo("ups.productid", "%04x", usbdevice.ProductID); -} - -void upsdrv_updateinfo(void) -{ - char reply[STATUS_PACKETSIZE]; - int ret; - - if (!udev) { - ret = usb_device_open(&udev, &usbdevice, &device_matcher, &driver_callback); - - if (ret < 0) { - return; - } - } - - ret = query_ups(reply); - - if (ret != STATUS_PACKETSIZE) { - usb_comm_fail("Query to UPS failed"); - dstate_datastale(); - - usb_device_close(udev); - udev = NULL; - - return; - } - - usb_comm_good(); - dstate_dataok(); - - status_init(); - - switch(reply[0]) { - case 3: - upsdebugx(2, "reply[0] = 0x%02x -> OL", reply[0]); - status_set("OL"); - break; - case 2: - upsdebugx(2, "reply[0] = 0x%02x -> LB", reply[0]); - status_set("LB"); - goto fallthrough_LB_means_OB; - /* Note: the comment below existed for years, so wondering - * if this device CAN set independently LB and OB? */ - /* fall through */ - case 1: - fallthrough_LB_means_OB: - upsdebugx(2, "reply[0] = 0x%02x -> OB", reply[0]); - status_set("OB"); - break; - default: - upslogx(LOG_ERR, "Unknown status: 0x%02x", reply[0]); - } - if(strnlen(reply + 1, 7) != 0) { - upslogx(LOG_NOTICE, "Status bytes 1-7 are not all zero"); - } - - status_commit(); -} - -/* If the UPS is on battery, it should shut down about 30 seconds after - * receiving this packet. - */ -void upsdrv_shutdown(void) -{ - /* Not "const" because this mismatches arg type of usb_interrupt_write() */ - char shutdown_packet[SHUTDOWN_PACKETSIZE] = { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - int ret; - - upslogx(LOG_DEBUG, - "%s: attempting to call usb_interrupt_write(01 00 00 00 00 00 00 00)", - __func__); - - ret = usb_interrupt_write(udev, - SHUTDOWN_ENDPOINT, (usb_ctrl_charbuf)shutdown_packet, - SHUTDOWN_PACKETSIZE, ATCL_USB_TIMEOUT); - - if (ret <= 0) { - upslogx(LOG_NOTICE, - "%s: first usb_interrupt_write() failed: %s", - __func__, - ret ? nut_usb_strerror(ret) : "timeout"); - } - - /* Totally guessing from the .pcap file here. TODO: configurable delay? */ - usleep(170*1000); - - ret = usb_interrupt_write(udev, - SHUTDOWN_ENDPOINT, (usb_ctrl_charbuf)shutdown_packet, - SHUTDOWN_PACKETSIZE, ATCL_USB_TIMEOUT); - - if (ret <= 0) { - upslogx(LOG_ERR, - "%s: second usb_interrupt_write() failed: %s", - __func__, - ret ? nut_usb_strerror(ret) : "timeout"); - } - -} - -void upsdrv_help(void) -{ -} - -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "vendor", "USB vendor string (or NULL if none)"); -} diff --git a/drivers/nutdrv_qx.c b/drivers/nutdrv_qx.c index 337b42a..efde86e 100644 --- a/drivers/nutdrv_qx.c +++ b/drivers/nutdrv_qx.c @@ -2,7 +2,6 @@ * * Copyright (C) * 2013 Daniele Pezzini - * 2016 Eaton * Based on: * usbhid-ups.c - Copyright (C) * 2003-2012 Arnaud Quette @@ -17,10 +16,6 @@ * blazer_usb.c - Copyright (C) * 2003-2009 Arjen de Korte * 2011-2012 Arnaud Quette - * Masterguard additions - * 2020-2021 Edgar Fuß, Mathematisches Institut der Universität Bonn - * Armac (Richcomm-variant) additions - * 2021 Tomasz Fortuna * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,17 +33,16 @@ * */ -#define DRIVER_VERSION "0.32" +#define DRIVER_VERSION "0.01" -#include "config.h" #include "main.h" -#include "attribute.h" -#include "nut_float.h" -#include "nut_stdint.h" + +#include /* note: QX_USB/QX_SERIAL set through Makefile */ #ifdef QX_USB - #include "nut_libusb.h" /* also includes "usb-common.h" */ + #include "libusb.h" + #include "usb-common.h" #ifdef QX_SERIAL #define DRIVER_NAME "Generic Q* USB/Serial driver" @@ -68,36 +62,21 @@ /* == Subdrivers == */ /* Include all known subdrivers */ -#include "nutdrv_qx_bestups.h" -#include "nutdrv_qx_hunnox.h" #include "nutdrv_qx_mecer.h" #include "nutdrv_qx_megatec.h" #include "nutdrv_qx_megatec-old.h" #include "nutdrv_qx_mustek.h" -#include "nutdrv_qx_q1.h" #include "nutdrv_qx_voltronic.h" -#include "nutdrv_qx_voltronic-qs.h" -#include "nutdrv_qx_voltronic-qs-hex.h" #include "nutdrv_qx_zinto.h" -#include "nutdrv_qx_masterguard.h" -#include "nutdrv_qx_ablerex.h" -/* Reference list of available non-USB subdrivers */ +/* Master list of avaiable subdrivers */ static subdriver_t *subdriver_list[] = { &voltronic_subdriver, - &voltronic_qs_subdriver, - &voltronic_qs_hex_subdriver, &mustek_subdriver, &megatec_old_subdriver, - &bestups_subdriver, - &mecer_subdriver, &megatec_subdriver, + &mecer_subdriver, &zinto_subdriver, - &masterguard_subdriver, - &hunnox_subdriver, - &ablerex_subdriver, - /* Fallback Q1 subdriver */ - &q1_subdriver, NULL }; @@ -110,8 +89,7 @@ upsdrv_info_t upsdrv_info = { "Arnaud Quette " \ "John Stamp " \ "Peter Selinger " \ - "Arjen de Korte " \ - "Edgar Fuß ", + "Arjen de Korte ", DRV_BETA, #ifdef QX_USB { &comm_upsdrv_info, NULL } @@ -120,6 +98,7 @@ upsdrv_info_t upsdrv_info = { #endif /* QX_USB */ }; + /* == Data walk modes == */ typedef enum { QX_WALKMODE_INIT = 0, @@ -132,16 +111,12 @@ typedef enum { /* Pointer to the active subdriver object (changed in subdriver_matcher() function) */ static subdriver_t *subdriver = NULL; -static long pollfreq = DEFAULT_POLLFREQ; -static unsigned int ups_status = 0; +static int pollfreq = DEFAULT_POLLFREQ; +static int ups_status = 0; static bool_t data_has_changed = FALSE; /* for SEMI_STATIC data polling */ static time_t lastpoll; /* Timestamp the last polling */ -#if defined(QX_USB) && !defined(TESTING) -static int hunnox_step = 0; -#endif /* QX_USB && !TESTING */ - #if defined(QX_USB) && defined(QX_SERIAL) static int is_usb = 0; /* Whether the device is connected through USB (1) or serial (0) */ #endif /* QX_USB && QX_SERIAL */ @@ -154,8 +129,8 @@ static struct { /* == Support functions == */ static int subdriver_matcher(void); -static ssize_t qx_command(const char *cmd, char *buf, size_t buflen); -static int qx_process_answer(item_t *item, const size_t len); /* returns just 0 or -1 */ +static int qx_command(const char *cmd, char *buf, size_t buflen); +static int qx_process_answer(item_t *item, const int len); static bool_t qx_ups_walk(walkmode_t mode); static void ups_status_set(void); static void ups_alarm_set(void); @@ -164,8 +139,8 @@ static void qx_set_var(item_t *item); /* == Struct & data for status processing == */ typedef struct { - const char *status_str; /* UPS status string */ - const unsigned int status_mask; /* UPS status mask */ + const char *status_str; /* UPS status string */ + const int status_mask; /* UPS status mask */ } status_lkp_t; static status_lkp_t status_info[] = { @@ -222,8 +197,7 @@ static struct { static time_t battery_lastpoll = 0; -/* Fill batt.volt.act and guesstimate the battery charge - * if it isn't already available. */ +/* Fill batt.volt.act and guesstimate the battery charge if it isn't already available. */ static int qx_battery(void) { const char *val = dstate_getinfo("battery.voltage"); @@ -235,7 +209,7 @@ static int qx_battery(void) batt.volt.act = batt.packs * strtod(val, NULL); - if (d_equal(batt.chrg.act, -1) && batt.volt.low > 0 && batt.volt.high > batt.volt.low) { + if (batt.chrg.act == -1 && batt.volt.low > 0 && batt.volt.high > batt.volt.low) { batt.chrg.act = 100 * (batt.volt.act - batt.volt.low) / (batt.volt.high - batt.volt.low); @@ -297,10 +271,8 @@ static void qx_initbattery(void) batt.volt.nom = strtod(val, NULL); } - /* If no values are available for both battery.voltage.{low,high} - * either from the UPS or provided by the user in ups.conf, - * try to guesstimate them, but announce it! */ - if ( (!d_equal(batt.volt.nom, -1)) && (d_equal(batt.volt.low, -1) || d_equal(batt.volt.high, -1))) { + /* If no values are available for both battery.voltage.{low,high} either from the UPS or provided by the user in ups.conf, try to guesstimate them, but announce it! */ + if (batt.volt.nom != -1 && (batt.volt.low == -1 || batt.volt.high == -1)) { upslogx(LOG_INFO, "No values for battery high/low voltages"); @@ -312,8 +284,7 @@ static void qx_initbattery(void) dstate_setinfo("battery.voltage.low", "%.2f", batt.volt.low); dstate_setinfo("battery.voltage.high", "%.2f", batt.volt.high); - upslogx(LOG_INFO, "Using 'guesstimation' (low: %f, high: %f)!", - batt.volt.low, batt.volt.high); + upslogx(LOG_INFO, "Using 'guesstimation' (low: %f, high: %f)!", batt.volt.low, batt.volt.high); } @@ -323,15 +294,13 @@ static void qx_initbattery(void) } else { /* qx_battery -> batt.volt.act */ - if (!qx_battery() && (!d_equal(batt.volt.nom, -1))) { + if (!qx_battery() && batt.volt.nom != -1) { const double packs[] = { 120, 100, 80, 60, 48, 36, 30, 24, 18, 12, 8, 6, 4, 3, 2, 1, 0.5, -1 }; int i; - /* The battery voltage will quickly return to - * at least the nominal value after discharging them. - * For overlapping battery.voltage.low/high ranges - * therefore choose the one with the highest multiplier. */ + /* The battery voltage will quickly return to at least the nominal value after discharging them. + * For overlapping battery.voltage.low/high ranges therefor choose the one with the highest multiplier. */ for (i = 0; packs[i] > 0; i++) { if (packs[i] * batt.volt.act > 1.2 * batt.volt.nom) { @@ -339,9 +308,7 @@ static void qx_initbattery(void) } if (packs[i] * batt.volt.act < 0.8 * batt.volt.nom) { - upslogx(LOG_INFO, - "Can't autodetect number of battery packs [%.0f/%.2f]", - batt.volt.nom, batt.volt.act); + upslogx(LOG_INFO, "Can't autodetect number of battery packs [%.0f/%.2f]", batt.volt.nom, batt.volt.act); break; } @@ -351,9 +318,7 @@ static void qx_initbattery(void) } } else { - upslogx(LOG_INFO, - "Can't autodetect number of battery packs [%.0f/%.2f]", - batt.volt.nom, batt.volt.act); + upslogx(LOG_INFO, "Can't autodetect number of battery packs [%.0f/%.2f]", batt.volt.nom, batt.volt.act); } } @@ -381,23 +346,20 @@ static void qx_initbattery(void) } batt.runt.exp = log(rl / rh) / log(lh / ll); - upsdebugx(2, "%s: battery runtime exponent: %.3f", - __func__, batt.runt.exp); + upsdebugx(2, "%s: battery runtime exponent: %.3f", __func__, batt.runt.exp); batt.runt.nom = rh * pow(lh / 100, batt.runt.exp); - upsdebugx(2, "%s: battery runtime nominal: %.1f", - __func__, batt.runt.nom); + upsdebugx(2, "%s: battery runtime nominal: %.1f", __func__, batt.runt.nom); } else { - upslogx(LOG_INFO, "Battery runtime will not be calculated " - "(runtimecal not set)"); + upslogx(LOG_INFO, "Battery runtime will not be calculated (runtimecal not set)"); return; } val = dstate_getinfo("battery.charge"); - if (!val && (!d_equal(batt.volt.nom, -1))) { + if (!val && batt.volt.nom != -1) { batt.volt.low = batt.volt.nom; batt.volt.high = 1.15 * batt.volt.nom; @@ -409,8 +371,7 @@ static void qx_initbattery(void) if (val) { batt.runt.est = batt.runt.nom * strtod(val, NULL) / 100; - upsdebugx(2, "%s: battery runtime estimate: %.1f", - __func__, batt.runt.est); + upsdebugx(2, "%s: battery runtime estimate: %.1f", __func__, batt.runt.est); } else { fatalx(EXIT_FAILURE, "Initial battery charge undetermined"); } @@ -423,13 +384,9 @@ static void qx_initbattery(void) fatalx(EXIT_FAILURE, "Charge time out of range [1..s]"); } - upsdebugx(2, "%s: battery charge time: %ld", - __func__, batt.chrg.time); + upsdebugx(2, "%s: battery charge time: %ld", __func__, batt.chrg.time); } else { - upslogx(LOG_INFO, - "No charge time specified, " - "using built in default [%ld seconds]", - batt.chrg.time); + upslogx(LOG_INFO, "No charge time specified, using built in default [%ld seconds]", batt.chrg.time); } val = getval("idleload"); @@ -440,13 +397,9 @@ static void qx_initbattery(void) fatalx(EXIT_FAILURE, "Idle load out of range [0..100]"); } - upsdebugx(2, - "%s: minimum load used (idle): %.3f", - __func__, load.low); + upsdebugx(2, "%s: minimum load used (idle): %.3f", __func__, load.low); } else { - upslogx(LOG_INFO, - "No idle load specified, using built in default [%.1f %%]", - 100 * load.low); + upslogx(LOG_INFO, "No idle load specified, using built in default [%.1f %%]", 100 * load.low); } } } @@ -467,36 +420,23 @@ static int (*subdriver_command)(const char *cmd, char *buf, size_t buflen) = NUL static int cypress_command(const char *cmd, char *buf, size_t buflen) { char tmp[SMALLBUF]; - int ret = 0; + int ret; size_t i; - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - /* Send command */ memset(tmp, 0, sizeof(tmp)); snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ /* ret = usb->set_report(udev, 0, (unsigned char *)&tmp[i], 8); */ - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, - (usb_ctrl_charbuf)&tmp[i], 8, 5000); + ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x09, 0x200, 0, &tmp[i], 8, 5000); if (ret <= 0) { - upsdebugx(3, "send: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } - } upsdebugx(3, "send: %.*s", (int)strcspn(tmp, "\r"), tmp); @@ -504,141 +444,21 @@ static int cypress_command(const char *cmd, char *buf, size_t buflen) /* Read reply */ memset(buf, 0, buflen); - for (i = 0; (i <= buflen-8) && (memchr(buf, '\r', buflen) == NULL); i += (size_t)ret) { + for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += ret) { /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)&buf[i], 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&buf[i], 8, 1000); + ret = usb_interrupt_read(udev, 0x81, &buf[i], 8, 1000); - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ + /* Any errors here mean that we are unable to read a reply (which will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } - - snprintf(tmp, sizeof(tmp), "read [% 3d]", (int)i); - upsdebug_hex(5, tmp, &buf[i], (size_t)ret); - - } - - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - if (i > INT_MAX) { - upsdebugx(3, "%s: read too much (%zu)", __func__, i); - return -1; - } - return (int)i; -} - -/* SGS communication subdriver */ -static int sgs_command(const char *cmd, char *buf, size_t buflen) -{ - char tmp[SMALLBUF]; - int ret = 0; - size_t cmdlen, i; - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - /* Send command */ - cmdlen = strlen(cmd); - - for (i = 0; i < cmdlen; i += (size_t)ret) { - - memset(tmp, 0, sizeof(tmp)); - - /* i and cmdlen are size_t nominally, but diff is not large */ - ret = (int)((cmdlen - i) < 7 ? (cmdlen - i) : 7); - - /* ret is between 0 and 7 */ - tmp[0] = (char)ret; - memcpy(&tmp[1], &cmd[i], (unsigned char)ret); - - /* Write data in 8-byte chunks */ - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, - 0x09, 0x200, 0, - (usb_ctrl_charbuf)tmp, 8, 5000); - - if (ret <= 0) { - upsdebugx(3, "send: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - - ret--; - - } - - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - - /* Read reply */ - memset(buf, 0, buflen); - - for (i = 0; i <= buflen - 8; i += (size_t)ret) { - - memset(tmp, 0, sizeof(tmp)); - - /* Read data in 8-byte chunks */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)tmp, 8, 1000); - - /* No error!!! */ - /* if (ret == -110) */ - if (ret == ERROR_TIMEOUT) - break; - - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ - if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - - /* Every call to read returns 8 bytes - * -> actually returned bytes: */ - ret = tmp[0] <= 7 ? tmp[0] : 7; - - if (ret > 0) - memcpy(&buf[i], &tmp[1], (unsigned char)ret); - - snprintf(tmp, sizeof(tmp), "read [% 3d]", (int)i); - upsdebug_hex(5, tmp, &buf[i], (size_t)ret); - - } - - /* If the reply lacks the expected terminating CR, add it (if there's enough space) */ - if (i && memchr(buf, '\r', i) == NULL) { - upsdebugx(4, "%s: the reply lacks the expected terminating CR.", __func__); - if (i < buflen - 1) { - upsdebugx(4, "%s: adding missing terminating CR.", __func__); - buf[i++] = '\r'; - buf[i] = 0; - } } upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - if (i > INT_MAX) { - upsdebugx(3, "%s: read too much (%zu)", __func__, i); - return -1; - } - return (int)i; + return i; } /* Phoenix communication subdriver */ @@ -648,63 +468,44 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen) int ret; size_t i; - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - for (i = 0; i < 8; i++) { /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)tmp, 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)tmp, 8, 1000); + ret = usb_interrupt_read(udev, 0x81, tmp, 8, 1000); /* This USB to serial implementation is crappy. - * In order to read correct replies we need to flush the - * output buffers of the converter until we get no more - * data (e.g. it times out). */ + * In order to read correct replies we need to flush the output buffers of the converter until we get no more data (ie, it times out). */ switch (ret) { - case ERROR_PIPE: /* Broken pipe */ + case -EPIPE: /* Broken pipe */ usb_clear_halt(udev, 0x81); - break; - - case ERROR_TIMEOUT: /* Connection timed out */ + case -ETIMEDOUT: /* Connection timed out */ break; } if (ret < 0) { - upsdebugx(3, "flush: %s (%d)", - nut_usb_strerror(ret), ret); + upsdebugx(3, "flush: %s", usb_strerror()); break; } - upsdebug_hex(4, "dump", tmp, (size_t)ret); - + upsdebug_hex(4, "dump", tmp, ret); } /* Send command */ memset(tmp, 0, sizeof(tmp)); snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ /* ret = usb->set_report(udev, 0, (unsigned char *)&tmp[i], 8); */ - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, (usb_ctrl_charbuf)&tmp[i], 8, 1000); + ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x09, 0x200, 0, &tmp[i], 8, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } - } upsdebugx(3, "send: %.*s", (int)strcspn(tmp, "\r"), tmp); @@ -712,35 +513,21 @@ static int phoenix_command(const char *cmd, char *buf, size_t buflen) /* Read reply */ memset(buf, 0, buflen); - for (i = 0; (i <= buflen-8) && (memchr(buf, '\r', buflen) == NULL); i += (size_t)ret) { + for (i = 0; (i <= buflen-8) && (strchr(buf, '\r') == NULL); i += ret) { /* Read data in 8-byte chunks */ /* ret = usb->get_interrupt(udev, (unsigned char *)&buf[i], 8, 1000); */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)&buf[i], 8, 1000); + ret = usb_interrupt_read(udev, 0x81, &buf[i], 8, 1000); - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ + /* Any errors here mean that we are unable to read a reply (which will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } - - snprintf(tmp, sizeof(tmp), "read [% 3d]", (int)i); - upsdebug_hex(5, tmp, &buf[i], (size_t)ret); - } upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - if (i > INT_MAX) { - upsdebugx(3, "%s: read too much (%zu)", __func__, i); - return -1; - } - return (int)i; + return i; } /* Ippon communication subdriver */ @@ -748,147 +535,37 @@ static int ippon_command(const char *cmd, char *buf, size_t buflen) { char tmp[64]; int ret; - size_t i, len; - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } + size_t i; /* Send command */ snprintf(tmp, sizeof(tmp), "%s", cmd); - for (i = 0; i < strlen(tmp); i += (size_t)ret) { + for (i = 0; i < strlen(tmp); i += ret) { /* Write data in 8-byte chunks */ - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x2, 0, (usb_ctrl_charbuf)&tmp[i], 8, 1000); + ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, 0x09, 0x2, 0, &tmp[i], 8, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s (%d)", - (ret != ERROR_TIMEOUT) ? nut_usb_strerror(ret) : "Connection timed out", - ret); + upsdebugx(3, "send: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out"); return ret; } - } upsdebugx(3, "send: %.*s", (int)strcspn(tmp, "\r"), tmp); /* Read all 64 bytes of the reply in one large chunk */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)tmp, sizeof(tmp), 1000); + ret = usb_interrupt_read(udev, 0x81, tmp, sizeof(tmp), 1000); - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ + /* Any errors here mean that we are unable to read a reply (which will happen after successfully writing a command to the UPS) */ if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - (ret != ERROR_TIMEOUT) ? nut_usb_strerror(ret) : "Connection timed out", - ret); + upsdebugx(3, "read: %s", (ret != -ETIMEDOUT) ? usb_strerror() : "Connection timed out"); return ret; } - /* As Ippon will always return 64 bytes in response, - * we have to calculate and return length of actual - * response data here. - * Empty response will look like 0x00 0x0D, otherwise - * it will be data string terminated by 0x0D. */ + snprintf(buf, buflen, "%.*s", ret, tmp); - for (i = 0, len = 0; i < (size_t)ret; i++) { - - if (tmp[i] != '\r') - continue; - - len = ++i; - break; - - } - - /* Just in case there wasn't any '\r', fallback to string length, if any */ - if (!len) - len = strlen(tmp); - - upsdebug_hex(5, "read", tmp, (size_t)len); - upsdebugx(3, "read: %.*s", (int)strcspn(tmp, "\r"), tmp); - - len = len < buflen ? len : buflen - 1; - - memset(buf, 0, buflen); - memcpy(buf, tmp, len); - - /* If the reply lacks the expected terminating CR, add it (if there's enough space) */ - if (len && memchr(buf, '\r', len) == NULL) { - upsdebugx(4, "%s: the reply lacks the expected terminating CR.", __func__); - if (len < buflen - 1) { - upsdebugx(4, "%s: adding missing terminating CR.", __func__); - buf[len++] = '\r'; - buf[len] = 0; - } - } - - if (len > INT_MAX) { - upsdebugx(3, "%s: read too much (%zu)", __func__, len); - return -1; - } - return (int)len; -} - -static int hunnox_protocol(int asking_for) -{ - char buf[1030]; - - int langid_fix_local = 0x0409; - - if (langid_fix != -1) { - langid_fix_local = langid_fix; - } - - switch (hunnox_step) { - case 0: - upsdebugx(3, "asking for: %02X", 0x00); - usb_get_string(udev, 0x00, - langid_fix_local, (usb_ctrl_charbuf)buf, 1026); - usb_get_string(udev, 0x00, - langid_fix_local, (usb_ctrl_charbuf)buf, 1026); - usb_get_string(udev, 0x01, - langid_fix_local, (usb_ctrl_charbuf)buf, 1026); - usleep(10000); - break; - case 1: - if (asking_for != 0x0d) { - upsdebugx(3, "asking for: %02X", 0x0d); - usb_get_string(udev, 0x0d, - langid_fix_local, (usb_ctrl_charbuf)buf, 102); - } - break; - case 2: - if (asking_for != 0x03) { - upsdebugx(3, "asking for: %02X", 0x03); - usb_get_string(udev, 0x03, - langid_fix_local, (usb_ctrl_charbuf)buf, 102); - } - break; - case 3: - if (asking_for != 0x0c) { - upsdebugx(3, "asking for: %02X", 0x0c); - usb_get_string(udev, 0x0c, - langid_fix_local, (usb_ctrl_charbuf)buf, 102); - } - break; - default: - hunnox_step = 0; - } - hunnox_step++; - if (hunnox_step > 3) { - hunnox_step = 1; - } - - return 0; + upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); + return ret; } /* Krauler communication subdriver */ @@ -910,20 +587,13 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) { "Q\r", 0x07, '\r' }, { "C\r", 0x0b, '\r' }, { "CT\r", 0x0b, '\r' }, - { NULL, 0, '\0' } + { NULL } }; int i; upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - for (i = 0; command[i].str; i++) { int retry; @@ -938,18 +608,14 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) if (langid_fix != -1) { /* Apply langid_fix value */ - ret = usb_get_string(udev, - command[i].index, langid_fix, - (usb_ctrl_charbuf)buf, buflen); - } else { - ret = usb_get_string_simple(udev, - command[i].index, - (usb_ctrl_charbuf)buf, buflen); + ret = usb_get_string(udev, command[i].index, langid_fix, buf, buflen); + } + else { + ret = usb_get_string_simple(udev, command[i].index, buf, buflen); } if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } @@ -967,7 +633,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) /* Simple unicode -> ASCII inplace conversion * FIXME: this code is at least shared with mge-shut/libshut * Create a common function? */ - unsigned int di, si, size = (unsigned int)buf[0]; + unsigned int di, si, size = buf[0]; for (di = 0, si = 2; si < size; si += 2) { if (di >= (buflen - 1)) @@ -980,26 +646,12 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) } - /* Note: effective range of di should be unsigned char */ buf[di] = 0; - ret = (int)di; - } - - /* If the reply lacks the expected terminating CR, add it (if there's enough space) */ - if (ret && memchr(buf, '\r', ret) == NULL) { - upsdebugx(4, "%s: the reply lacks the expected terminating CR.", __func__); - if ((size_t)ret < buflen - 1) { - upsdebugx(4, "%s: adding missing terminating CR.", __func__); - buf[ret++] = '\r'; - buf[ret] = 0; - } + ret = di; } /* "UPS No Ack" has a special meaning */ - if ( - strcspn(buf, "\r") == 10 && - !strncasecmp(buf, "UPS No Ack", 10) - ) { + if (!strcasecmp(buf, "UPS No Ack")) { upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); continue; } @@ -1007,9 +659,7 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) /* Replace the first byte of what we received with the correct one */ buf[0] = command[i].prefix; - upsdebug_hex(5, "read", buf, (size_t)ret); upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - return ret; } @@ -1023,1022 +673,55 @@ static int krauler_command(const char *cmd, char *buf, size_t buflen) return snprintf(buf, buflen, "%s", cmd); } -/* Fabula communication subdriver */ -static int fabula_command(const char *cmd, char *buf, size_t buflen) -{ - const struct { - const char *str; /* Megatec command */ - const int index; /* Fabula string index for this command */ - } commands[] = { - { "Q1\r", 0x03, }, /* Status */ - { "F\r", 0x0d, }, /* Ratings */ - { "I\r", 0x0c, }, /* Vendor infos */ - { "Q\r", 0x07, }, /* Beeper toggle */ - { "C\r", 0x0a, }, /* Cancel shutdown/Load on [0x(0..F)A]*/ - { NULL, 0 } - }; - int i, ret, index = 0; - - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - for (i = 0; commands[i].str; i++) { - - if (strcmp(cmd, commands[i].str)) - continue; - - index = commands[i].index; - break; - - } - - if (!index) { - - int val2 = -1; - double val1 = -1; - - /* Shutdowns */ - if ( - sscanf(cmd, "S%lfR%d\r", &val1, &val2) == 2 || - sscanf(cmd, "S%lf\r", &val1) == 1 - ) { - - double delay; - - /* 0x(1+)0 -> shutdown.stayoff (SnR0000) - * 0x(1+)8 -> shutdown.return (Sn[Rm], m != 0) - * [delay before restart is always 10 seconds] - * +0x10 (16dec) = next megatec delay - * (min .5 = hex 0x1*; max 10 = hex 0xF*) -> n < 1 ? -> n += .1; n >= 1 ? -> n += 1 */ - - /* delay: [.5..10] (-> seconds: [30..600]) */ - delay = val1 < .5 ? .5 : val1 > 10 ? 10 : val1; - - if (delay < 1) - index = 16 + round((delay - .5) * 10) * 16; - else - index = 96 + (delay - 1) * 16; - - /* shutdown.return (Sn[Rm], m != 0) */ - if (val2) - index += 8; - - /* Unknown commands */ - } else { - - /* Echo the unknown command back */ - upsdebugx(3, "read: %.*s", (int)strcspn(cmd, "\r"), cmd); - return snprintf(buf, buflen, "%s", cmd); - - } - - } - - upsdebugx(4, "command index: 0x%02x", index); - - /* Send command/Read reply */ - ret = usb_get_string_simple(udev, index, (usb_ctrl_charbuf)buf, buflen); - - if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); - return ret; - } - - /* If the reply lacks the expected terminating CR, add it (if there's enough space) */ - if (memchr(buf, '\r', ret) == NULL) { - upsdebugx(4, "%s: the reply lacks the expected terminating CR.", __func__); - if ((size_t)ret < buflen - 1) { - upsdebugx(4, "%s: adding missing terminating CR.", __func__); - buf[ret++] = '\r'; - buf[ret] = 0; - } - } - - upsdebug_hex(5, "read", buf, (size_t)ret); - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - /* The UPS always replies "UPS No Ack" when a supported command - * is issued (either if it fails or if it succeeds).. */ - if ( - strcspn(buf, "\r") == 10 && - !strncasecmp(buf, "UPS No Ack", 10) - ) { - /* ..because of that, always return 0 (with buf empty, - * as if it was a timeout): queries will see it as a failure, - * instant commands ('megatec' protocol) as a success */ - memset(buf, 0, buflen); - return 0; - } - - return ret; -} - -/* Hunnox communication subdriver, based on Fabula code above so repeats - * much of it currently. Possible future optimization is to refactor shared - * code into new routines to be called from both (or more) methods.*/ -static int hunnox_command(const char *cmd, char *buf, size_t buflen) -{ - /* The hunnox_patch was an argument in initial implementation of PR #638 - * which added "hunnox" support; keeping it fixed here helps to visibly - * track the modifications compared to original fabula_command() e.g. to - * facilitate refactoring commented above, in the future. - */ -/* char hunnox_patch = 1; */ - const struct { - const char *str; /* Megatec command */ - const int index; /* Fabula string index for this command */ - } commands[] = { - { "Q1\r", 0x03, }, /* Status */ - { "F\r", 0x0d, }, /* Ratings */ - { "I\r", 0x0c, }, /* Vendor infos */ - { "Q\r", 0x07, }, /* Beeper toggle */ - { "C\r", 0x0a, }, /* Cancel shutdown/Load on [0x(0..F)A]*/ - { NULL, 0 } - }; - int i, ret, index = 0; - - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - for (i = 0; commands[i].str; i++) { - - if (strcmp(cmd, commands[i].str)) - continue; - - index = commands[i].index; - break; - - } - - if (!index) { - - int val2 = -1; - double val1 = -1; - - /* Shutdowns */ - if ( - sscanf(cmd, "S%lfR%d\r", &val1, &val2) == 2 || - sscanf(cmd, "S%lf\r", &val1) == 1 - ) { - - double delay; - - /* 0x(1+)0 -> shutdown.stayoff (SnR0000) - * 0x(1+)8 -> shutdown.return (Sn[Rm], m != 0) - * [delay before restart is always 10 seconds] - * +0x10 (16dec) = next megatec delay - * (min .5 = hex 0x1*; max 10 = hex 0xF*) -> n < 1 ? -> n += .1; n >= 1 ? -> n += 1 */ - - /* delay: [.5..10] (-> seconds: [30..600]) */ - delay = val1 < .5 ? .5 : val1 > 10 ? 10 : val1; - - if (delay < 1) - index = 16 + round((delay - .5) * 10) * 16; - else - index = 96 + (delay - 1) * 16; - - /* shutdown.return (Sn[Rm], m != 0) */ - if (val2) - index += 8; - - /* Unknown commands */ - } else { - - /* Echo the unknown command back */ - upsdebugx(3, "read: %.*s", (int)strcspn(cmd, "\r"), cmd); - return snprintf(buf, buflen, "%s", cmd); - - } - - } - - upsdebugx(4, "command index: 0x%02x", index); - -/* if (hunnox_patch) { */ - /* Enable lock-step protocol for Hunnox */ - if (hunnox_protocol(index) != 0) { - return 0; - } - - /* Seems that if we inform a large buffer, the USB locks. - * This value was captured from the Windows "official" client. - * Note this should not be a problem programmatically: it just - * means that the caller reserved a longer buffer that we need - * in practice to write a response into. - */ - if (buflen > 102) { - buflen = 102; - } -/* } */ - - /* Send command/Read reply */ - if (langid_fix != -1) { - ret = usb_get_string(udev, - index, langid_fix, (usb_ctrl_charbuf)buf, buflen); - } else { - ret = usb_get_string_simple(udev, - index, (usb_ctrl_charbuf)buf, buflen); - } - - if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - -/* if (hunnox_patch) { */ - if (langid_fix != -1) { - /* Limit this check, at least for now */ - /* Invalid receive size - message corrupted */ - if (ret != buf[0]) { - upsdebugx(1, "size mismatch: %d / %d", ret, buf[0]); - return 0; - } - - /* Simple unicode -> ASCII inplace conversion - * FIXME: this code is at least shared with mge-shut/libshut - * Create a common function? */ - unsigned int di, si, size = (unsigned int)buf[0]; - for (di = 0, si = 2; si < size; si += 2) { - if (di >= (buflen - 1)) - break; - - if (buf[si + 1]) /* high byte */ - buf[di++] = '?'; - else - buf[di++] = buf[si]; - } - - /* Note: effective range of di should be unsigned char */ - buf[di] = 0; - ret = (int)di; - } -/* } */ - - upsdebug_hex(5, "read", buf, (size_t)ret); - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - /* The UPS always replies "UPS No Ack" when a supported command - * is issued (either if it fails or if it succeeds).. */ - if ( - strcspn(buf, "\r") == 10 && - !strncasecmp(buf, "UPS No Ack", 10) - ) { - /* ..because of that, always return 0 (with buf empty, - * as if it was a timeout): queries will see it as a failure, - * instant commands ('megatec' protocol) as a success */ - memset(buf, 0, buflen); - return 0; - } - - return ret; -} - -/* Fuji communication subdriver */ -static int fuji_command(const char *cmd, char *buf, size_t buflen) -{ - unsigned char tmp[8]; - char command[SMALLBUF] = "", - read[SMALLBUF] = ""; - int ret, val2; - unsigned char answer_len; - double val1; - size_t i; - const struct { - const char *command; /* Megatec command */ - const unsigned char answer_len; /* Expected length of the answer - * to the ongoing query */ - } query[] = { - { "Q1", 47 }, - { "F", 22 }, - { "I", 39 }, - { NULL, 0 } - }; - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - /* - * Queries (b1..b8) sent (as a 8-bytes interrupt) to the UPS - * adopt the following scheme: - * - * b1: 0x80 - * b2: 0x06 - * b3: - * b4: 0x03 - * b5..bn: - * bn+1..b7: [] - * b8: - * - * Where: - * Length (in Hex) of the command (without the trailing CR) + 1 - * Command/query (without the trailing CR) - * [] 0x00 padding to the 7th byte - * Expected length (in Hex) of the answer to the ongoing - * query (0 when no reply is expected, i.e. commands) - * - * Replies to queries (commands are followed by action without - * any reply) are sent from the UPS (in 8-byte chunks) with - * 0x00 padding after the trailing CR to full 8 bytes. - * - */ - - /* Send command */ - - /* Remove the CR */ - snprintf(command, sizeof(command), "%.*s", (int)strcspn(cmd, "\r"), cmd); - - /* Length of the command that will be sent to the UPS can be - * at most: 8 - 5 (0x80, 0x06, , 0x03, ) = 3. - * As a consequence also 'SnRm' commands (shutdown.{return,stayoff} - * and load.off) are not supported. - * So, map all the 'SnRm' shutdown.returns (m != 0) as the - * corresponding 'Sn' commands, meanwhile ignoring ups.delay.start - * and making the UPS turn on the load as soon as power is back. */ - if (sscanf(cmd, "S%lfR%d\r", &val1, &val2) == 2 && val2) { - upsdebugx(4, "%s: trimming '%s' to '%.*s'", __func__, command, 3, command); - command[3] = 0; - } - /* Too long command */ - if (strlen(command) > 3) { - /* Be 'megatec-y': echo the unsupported command back */ - upsdebugx(3, "%s: unsupported command %s", __func__, command); - return snprintf(buf, buflen, "%s", cmd); - } - - /* Expected length of the answer to the ongoing query - * (0 when no reply is expected, i.e. commands) */ - answer_len = 0; - for (i = 0; query[i].command; i++) { - - if (strcmp(command, query[i].command)) - continue; - - answer_len = query[i].answer_len; - break; - - } - - memset(tmp, 0, sizeof(tmp)); - - /* 0x80 */ - tmp[0] = 0x80; - /* 0x06 */ - tmp[1] = 0x06; - /* ; per above under 3 */ - tmp[2] = (unsigned char)strlen(command) + 1; - /* 0x03 */ - tmp[3] = 0x03; - /* */ - memcpy(&tmp[4], command, strlen(command)); - /* */ - tmp[7] = answer_len; - - upsdebug_hex(4, "command", (char *)tmp, 8); - - /* Write data */ - ret = usb_interrupt_write(udev, - USB_ENDPOINT_OUT | 2, - (const usb_ctrl_charbuf)tmp, - 8, USB_TIMEOUT); - - if (ret <= 0) { - upsdebugx(3, "send: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); - return ret; - } - - upsdebugx(3, "send: %s", command); - - /* Read reply */ - - memset(buf, 0, buflen); - - for (i = 0; (i <= buflen - 8) && (memchr(buf, '\r', buflen) == NULL); i += (size_t)ret) { - - /* Read data in 8-byte chunks */ - ret = usb_interrupt_read(udev, - USB_ENDPOINT_IN | 1, - (usb_ctrl_charbuf)&buf[i], 8, 1000); - - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ - if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", ret); - return ret; - } - - snprintf(read, sizeof(read), "read [%3d]", (int)i); - upsdebug_hex(5, read, &buf[i], (size_t)ret); - - } - - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - /* As Fuji units return the reply in 8-byte chunks always padded to the 8th byte with 0x00, we need to calculate and return the length of the actual response here. */ - return (int)strlen(buf); -} - -/* Phoenixtec (Masterguard) communication subdriver */ -static int phoenixtec_command(const char *cmd, char *buf, size_t buflen) -{ - int ret; - char *p, *e = NULL; - char *l[] = { "T", "TL", "S", "C", "CT", "M", "N", "O", "SRC", "FCLR", "SS", "TUD", "SSN", NULL }; /* commands that don't return an answer */ - char **lp; - size_t cmdlen = strlen(cmd); - - if (cmdlen > INT_MAX) { - upsdebugx(3, "%s: requested command is too long (%zu)", - __func__, cmdlen); - return 0; - } - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - if ((ret = usb_control_msg(udev, - USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, - 0x0d, 0, 0, (usb_ctrl_charbuf)cmd, (int)cmdlen, 1000)) <= 0 - ) { - upsdebugx(3, "send: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - *buf = '\0'; - return ret; - } - - for (lp = l; *lp != NULL; lp++) { - const char *q; - int b; - - p = *lp; q = cmd; b = 1; - while (*p != '\0') { - if (*p++ != *q++) { - b = 0; - break; - } - } - if (b && *q >= 'A' && *q <= 'Z') b = 0; /* "M" not to match "MSO" */ - if (b) { - upsdebugx(4, "command %s returns no answer", *lp); - *buf = '\0'; - return 0; - } - } - - for (p = buf; p < buf + buflen; p += ret) { - /* buflen constrained to INT_MAX above, so we can cast: */ - if ((ret = usb_interrupt_read(udev, - USB_ENDPOINT_IN | 1, - (usb_ctrl_charbuf)p, (int)(buf + buflen - p), 1000)) <= 0 - ) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - *buf = '\0'; - return ret; - } - if ((e = memchr(p, '\r', (size_t)ret)) != NULL) break; - } - if (e != NULL && ++e < buf + buflen) { - *e = '\0'; - /* buflen constrained to INT_MAX above, so we can cast: */ - return (int)(e - buf); - } else { - upsdebugx(3, "read: buflen %zu too small", buflen); - *buf = '\0'; - return 0; - } -} - -/* SNR communication subdriver */ -static int snr_command(const char *cmd, char *buf, size_t buflen) -{ - /*ATTENTION: This subdriver uses short buffer with length 102 byte*/ - const struct { - const char *str; /* Megatec command */ - const int index; /* String index for this command */ - const char prefix; /* Character to replace the first byte in reply */ - } command[] = { - { "Q1\r", 0x03, '(' }, - { "F\r", 0x0d, '#' }, - { "I\r", 0x0c, '#' }, - { NULL, 0, '\0' } - }; - - int i; - - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), " - "reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - if (buflen < 102) { - upsdebugx(4, "size of buf less than 102 byte!"); - return 0; - } - - /* Prepare SNR-UPS for communication. - * Without the interrupt UPS returns zeros for some time, - * and afterwards NUT returns a communications error. - */ - usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)buf, 102, 1000); - - for (i = 0; command[i].str; i++) { - - int retry; - - if (strcmp(cmd, command[i].str)) { - continue; - } - - for (retry = 0; retry < 10; retry++) { - - int ret; - - ret = usb_get_string(udev, - command[i].index, langid_fix, - (usb_ctrl_charbuf)buf, 102); - - if (ret <= 0) { - upsdebugx(3, "read: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - - /* This may serve in the future */ - upsdebugx(1, "received %d (%d)", ret, buf[0]); - - - if (ret != buf[0]) { - upsdebugx(1, "size mismatch: %d / %d", ret, buf[0]); - continue; - } - - /* Simple unicode -> ASCII inplace conversion - * FIXME: this code is at least shared with mge-shut/libshut - * Create a common function? */ - unsigned int di, si, size = (unsigned int)buf[0]; - for (di = 0, si = 2; si < size; si += 2) { - - if (di >= (buflen - 1)) - break; - - if (buf[si + 1]) /* high byte */ - buf[di++] = '?'; - else - buf[di++] = buf[si]; - - } - - /* Note: effective range of di should be unsigned char */ - buf[di] = 0; - ret = (int)di; - - /* "UPS No Ack" has a special meaning */ - if ( - strcspn(buf, "\r") == 10 && - !strncasecmp(buf, "UPS No Ack", 10) - ) { - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - continue; - } - - /* Replace the first byte of what we received with the correct one */ - buf[0] = command[i].prefix; - - upsdebug_hex(5, "read", buf, (size_t)ret); - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - - return ret; - - } - - return 0; - - } - - /* Echo the unknown command back */ - upsdebugx(3, "read: %.*s", (int)strcspn(cmd, "\r"), cmd); - return snprintf(buf, buflen, "%s", cmd); -} - -static int ablerex_command(const char *cmd, char *buf, size_t buflen) -{ - int iii; - int len; - int idx; - char tmp[64]; - char tmpryy[64]; - - upsdebugx(3, "send: %.*s", (int)strcspn(cmd, "\r"), cmd); - - if (buflen > INT_MAX) { - upsdebugx(3, "%s: requested to read too much (%zu), reducing buflen to (INT_MAX-1)", - __func__, buflen); - buflen = (INT_MAX - 1); - } - - int retry; - - for (retry = 0; retry < 3; retry++) { - int ret; - - memset(buf, 0, buflen); - tmp[0] = 0x05; - tmp[1] = 0; - tmp[2] = 1 + (char)strcspn(cmd, "\r"); - - for (iii = 0 ; iii < tmp[2] ; iii++) - { - tmp[3+iii] = cmd[iii]; - } - - ret = usb_control_msg(udev, - 0x21, - 0x09, 0x305, 0, - (usb_ctrl_charbuf)tmp, 47, 1000); - - upsdebugx(3, "R11 read: %s", ret ? nut_usb_strerror(ret) : "timeout"); - - usleep(500000); - tmpryy[0] = 0x05; - ret = usb_control_msg(udev, - 0xA1, - 0x01, 0x305, 0, - (usb_ctrl_charbuf)tmpryy, 47, 1000); - upsdebugx(3, "R2 read%d: %.*s", ret, ret, tmpryy); - - len = 0; - for (idx = 0 ; idx < 47 ; idx++) - { - buf[idx] = tmpryy[idx]; - if (tmpryy[idx] == '\r') - { - len = idx; - break; - } - } - upsdebugx(3, "R3 read%d: %.*s", len, len, tmpryy); - - if (len > 0) { - len ++; - } - if (ret <= 0) { - upsdebugx(3, "read: %s", ret ? nut_usb_strerror(ret) : "timeout"); - return ret; - } - - upsdebugx(1, "received %d (%d)", ret, buf[0]); - - if ((!strcasecmp(cmd, "Q1\r")) && len != 47) continue; - if ((!strcasecmp(cmd, "I\r")) && len != 39) continue; - if ((!strcasecmp(cmd, "F\r")) && len != 22) continue; - if ((!strcasecmp(cmd, "Q5\r")) && len != 22) - { - buf[0] = '('; - for (idx = 1 ; idx < 47 ; idx++) - { - buf[idx] = 0; - } - upsdebugx(3, "read Q5 Fail..."); - return 22; - } - - upsdebugx(3, "read: %.*s", (int)strcspn(buf, "\r"), buf); - return len; - } - - return 0; -} - -static void *ablerex_subdriver_fun(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &ablerex_command; - return NULL; -} - -/* Armac communication subdriver - * - * This reproduces a communication protocol used by an old PowerManagerII - * software, which doesn't seem to be Armac specific. The banner is: "2004 - * Richcomm Technologies, Inc. Dec 27 2005 ver 1.1." Maybe other Richcomm UPSes - * would work with this - better than with the richcomm_usb driver. - */ -static int armac_command(const char *cmd, char *buf, size_t buflen) -{ - char tmpbuf[6]; - int ret = 0; - size_t i, bufpos; - const size_t cmdlen = strlen(cmd); - - /* UPS ignores (doesn't echo back) unsupported commands which makes - * the initialization long. List commands tested to be unsupported: - */ - const char *unsupported[] = { - "QGS\r", - "QS\r", - "QPI\r", - "M\r", - "D\r", - NULL - }; - - for (i = 0; unsupported[i] != NULL; i++) { - if (strcmp(cmd, unsupported[i]) == 0) { - upsdebugx(2, - "armac: unsupported cmd: %.*s", - (int)strcspn(cmd, "\r"), cmd); - return snprintf(buf, buflen, "%s", cmd); - } - } - upsdebugx(4, "armac command %.*s", (int)strcspn(cmd, "\r"), cmd); - - /* Send command to the UPS in 3-byte chunks. Most fit 1 chunk, except for eg. - * parameterized tests. */ - for (i = 0; i < cmdlen;) { - const size_t bytes_to_send = (cmdlen <= (i + 3)) ? (cmdlen - i) : 3; - memset(tmpbuf, 0, sizeof(tmpbuf)); - tmpbuf[0] = 0xa0 + bytes_to_send; - memcpy(tmpbuf + 1, cmd + i, bytes_to_send); - ret = usb_control_msg(udev, - USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, 0x200, 0, - (usb_ctrl_charbuf)tmpbuf, 4, 5000); - i += bytes_to_send; - } - - if (ret <= 0) { - upsdebugx(1, - "send control: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - - memset(buf, 0, buflen); - - bufpos = 0; - while (bufpos + 6 < buflen) { - size_t bytes_available; - - /* Read data in 6-byte chunks */ - ret = usb_interrupt_read(udev, - 0x81, - (usb_ctrl_charbuf)tmpbuf, 6, 1000); - - /* Any errors here mean that we are unable to read a reply - * (which will happen after successfully writing a command - * to the UPS) */ - if (ret != 6) { - upsdebugx(1, - "interrupt read error: %s (%d)", - ret ? nut_usb_strerror(ret) : "timeout", - ret); - return ret; - } - - upsdebugx(4, - "read: ret %d buf %02hhx: %02hhx %02hhx %02hhx %02hhx %02hhx >%c%c%c%c%c<", - ret, - tmpbuf[0], tmpbuf[1], tmpbuf[2], tmpbuf[3], tmpbuf[4], tmpbuf[5], - tmpbuf[1], tmpbuf[2], tmpbuf[3], tmpbuf[4], tmpbuf[5]); - - bytes_available = (unsigned char)tmpbuf[0] & 0x0f; - if (bytes_available == 0) { - /* End of transfer */ - break; - } - - memcpy(buf + bufpos, tmpbuf + 1, bytes_available); - bufpos += bytes_available; - - if (bytes_available <= 2) { - /* Slow down, let the UPS buffer more bytes */ - usleep(15000); - } - } - - if (bufpos + 6 >= buflen) { - upsdebugx(2, "Protocol error, too much data read."); - return -1; - } - - upsdebugx(3, "armac command %.*s response read: '%.*s'", - (int)strcspn(cmd, "\r"), cmd, - (int)strcspn(buf, "\r"), buf - ); - - return (int)bufpos; -} - - static void *cypress_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &cypress_command; return NULL; } -static void *sgs_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &sgs_command; - return NULL; -} - static void *ippon_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &ippon_command; return NULL; } static void *krauler_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &krauler_command; return NULL; } static void *phoenix_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &phoenix_command; return NULL; } -static void *fabula_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &fabula_command; - return NULL; -} - -static void *phoenixtec_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &phoenixtec_command; - return NULL; -} - -/* Note: the "hunnox_subdriver" name is taken by the subdriver_t structure */ -static void *fabula_hunnox_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &hunnox_command; - return NULL; -} - -static void *fuji_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &fuji_command; - return NULL; -} - -static void *snr_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &snr_command; - return NULL; -} - -static void *armac_subdriver(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - - subdriver_command = &armac_command; - return NULL; -} - -/* USB device match structure */ -typedef struct { - const int vendorID; /* USB device's VendorID */ - const int productID; /* USB device's ProductID */ - const char *vendor; /* USB device's iManufacturer string */ - const char *product; /* USB device's iProduct string */ - void *(*fun)(USBDevice_t *); /* Handler for specific processing */ -} qx_usb_device_id_t; - -/* USB VendorID/ProductID/iManufacturer/iProduct match - note: rightmost comment is used for naming rules by tools/nut-usbinfo.pl */ -static qx_usb_device_id_t qx_usb_id[] = { - { USB_DEVICE(0x05b8, 0x0000), NULL, NULL, &cypress_subdriver }, /* Agiler UPS */ - { USB_DEVICE(0xffff, 0x0000), NULL, NULL, &ablerex_subdriver_fun }, /* Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) */ - { USB_DEVICE(0x1cb0, 0x0035), NULL, NULL, &krauler_subdriver }, /* Legrand Daker DK / DK Plus */ - { USB_DEVICE(0x0665, 0x5161), NULL, NULL, &cypress_subdriver }, /* Belkin F6C1200-UNV/Voltronic Power UPSes */ - { USB_DEVICE(0x06da, 0x0002), "Phoenixtec Power","USB Cable (V2.00)", &phoenixtec_subdriver },/* Masterguard A Series */ - { USB_DEVICE(0x06da, 0x0002), NULL, NULL, &cypress_subdriver }, /* Online Yunto YQ450 */ - { USB_DEVICE(0x06da, 0x0003), NULL, NULL, &ippon_subdriver }, /* Mustek Powermust */ - { USB_DEVICE(0x06da, 0x0004), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ - { USB_DEVICE(0x06da, 0x0005), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova RT */ - { USB_DEVICE(0x06da, 0x0201), NULL, NULL, &cypress_subdriver }, /* Phoenixtec Innova T */ - { USB_DEVICE(0x06da, 0x0601), NULL, NULL, &phoenix_subdriver }, /* Online Zinto A */ - { USB_DEVICE(0x0f03, 0x0001), NULL, NULL, &cypress_subdriver }, /* Unitek Alpha 1200Sx */ - { USB_DEVICE(0x14f0, 0x00c9), NULL, NULL, &phoenix_subdriver }, /* GE EP series */ - { USB_DEVICE(0x0483, 0x0035), NULL, NULL, &sgs_subdriver }, /* TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs */ - { USB_DEVICE(0x0001, 0x0000), "MEC", "MEC0003", &fabula_subdriver }, /* Fideltronik/MEC LUPUS 500 USB */ - { USB_DEVICE(0x0001, 0x0000), NULL, "MEC0003", &fabula_hunnox_subdriver }, /* Hunnox HNX 850, reported to also help support Powercool and some other devices; closely related to fabula with tweaks */ - { USB_DEVICE(0x0001, 0x0000), "ATCL FOR UPS", "ATCL FOR UPS", &fuji_subdriver }, /* Fuji UPSes */ - { USB_DEVICE(0x0001, 0x0000), NULL, NULL, &krauler_subdriver }, /* Krauler UP-M500VA */ - { USB_DEVICE(0x0001, 0x0000), NULL, "MEC0003", &snr_subdriver }, /* SNR-UPS-LID-XXXX UPSes */ - { USB_DEVICE(0x0925, 0x1234), NULL, NULL, &armac_subdriver }, /* Armac UPS and maybe other richcomm-like or using old PowerManagerII software */ +/* USB VendorID/ProductID match - note: rightmost comment is used for naming rules by tools/nut-usbinfo.pl */ +static usb_device_id_t qx_usb_id[] = { + { USB_DEVICE(0x05b8, 0x0000), &cypress_subdriver }, /* Agiler UPS */ + { USB_DEVICE(0x0001, 0x0000), &krauler_subdriver }, /* Krauler UP-M500VA */ + { USB_DEVICE(0xffff, 0x0000), &krauler_subdriver }, /* Ablerex 625L USB */ + { USB_DEVICE(0x0665, 0x5161), &cypress_subdriver }, /* Belkin F6C1200-UNV/Voltronic Power UPSes */ + { USB_DEVICE(0x06da, 0x0002), &cypress_subdriver }, /* Online Yunto YQ450 */ + { USB_DEVICE(0x06da, 0x0003), &ippon_subdriver }, /* Mustek Powermust */ + { USB_DEVICE(0x06da, 0x0004), &cypress_subdriver }, /* Phoenixtec Innova 3/1 T */ + { USB_DEVICE(0x06da, 0x0005), &cypress_subdriver }, /* Phoenixtec Innova RT */ + { USB_DEVICE(0x06da, 0x0201), &cypress_subdriver }, /* Phoenixtec Innova T */ + { USB_DEVICE(0x06da, 0x0601), &phoenix_subdriver }, /* Online Zinto A */ + { USB_DEVICE(0x0f03, 0x0001), &cypress_subdriver }, /* Unitek Alpha 1200Sx */ + { USB_DEVICE(0x14f0, 0x00c9), &phoenix_subdriver }, /* GE EP series */ /* End of list */ - { -1, -1, NULL, NULL, NULL } + { -1, -1, NULL } }; -static int qx_is_usb_device_supported(qx_usb_device_id_t *usb_device_id_list, USBDevice_t *device) -{ - int retval = NOT_SUPPORTED; - qx_usb_device_id_t *usbdev; - - for (usbdev = usb_device_id_list; usbdev->vendorID != -1; usbdev++) { - - if (usbdev->vendorID != device->VendorID) - continue; - - /* Flag as possibly supported if we see a known vendor */ - retval = POSSIBLY_SUPPORTED; - - if (usbdev->productID != device->ProductID) - continue; - - if (usbdev->vendor - && (!device->Vendor || strcasecmp(usbdev->vendor, device->Vendor)) - ) { - continue; - } - - if (usbdev->product - && (!device->Product || strcasecmp(usbdev->product, device->Product)) - ) { - continue; - } - - /* Call the specific handler, if it exists */ - if (usbdev->fun != NULL) - (*usbdev->fun)(device); - - return SUPPORTED; - - } - - return retval; -} - static int device_match_func(USBDevice_t *hd, void *privdata) { - NUT_UNUSED_VARIABLE(privdata); - if (subdriver_command) { return 1; } - switch (qx_is_usb_device_supported(qx_usb_id, hd)) + switch (is_usb_device_supported(qx_usb_id, hd)) { case SUPPORTED: return 1; @@ -2060,7 +743,7 @@ static USBDeviceMatcher_t device_matcher = { /* == Driver functions implementations == */ -/* See header file for details. */ +/* Process instant command and take action. */ int instcmd(const char *cmdname, const char *extradata) { item_t *item; @@ -2068,21 +751,17 @@ int instcmd(const char *cmdname, const char *extradata) if (!strcasecmp(cmdname, "beeper.off")) { /* Compatibility mode for old command */ - upslogx(LOG_WARNING, - "The 'beeper.off' command has been renamed to 'beeper.disable'"); + upslogx(LOG_WARNING, "The 'beeper.off' command has been renamed to 'beeper.disable'"); return instcmd("beeper.disable", NULL); } if (!strcasecmp(cmdname, "beeper.on")) { /* Compatibility mode for old command */ - upslogx(LOG_WARNING, - "The 'beeper.on' command has been renamed to 'beeper.enable'"); + upslogx(LOG_WARNING, "The 'beeper.on' command has been renamed to 'beeper.enable'"); return instcmd("beeper.enable", NULL); } - upslogx(LOG_INFO, "%s(%s, %s)", - __func__, cmdname, - extradata ? extradata : "[NULL]"); + upslogx(LOG_INFO, "%s(%s, %s)", __func__, cmdname, extradata ? extradata : "[NULL]"); /* Retrieve item by command name */ item = find_nut_info(cmdname, QX_FLAG_CMD, QX_FLAG_SKIP); @@ -2115,8 +794,7 @@ int instcmd(const char *cmdname, const char *extradata) return ret; } - return instcmd("load.off.delay", - dstate_getinfo("ups.delay.shutdown")); + return instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); } @@ -2137,8 +815,7 @@ int instcmd(const char *cmdname, const char *extradata) return ret; } - return instcmd("load.off.delay", - dstate_getinfo("ups.delay.shutdown")); + return instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); } @@ -2146,15 +823,12 @@ int instcmd(const char *cmdname, const char *extradata) return STAT_INSTCMD_INVALID; } - /* If extradata is empty, use the default value - * from the QX to NUT table, if any */ + /* If extradata is empty, use the default value from the blazer to NUT table */ extradata = extradata ? extradata : item->dfl; snprintf(value, sizeof(value), "%s", extradata ? extradata : ""); /* Preprocess command */ - if (item->preprocess != NULL - && item->preprocess(item, value, sizeof(value)) - ) { + if (item->preprocess != NULL && item->preprocess(item, value, sizeof(value))) { /* Something went wrong */ upslogx(LOG_ERR, "%s: FAILED", __func__); return STAT_INSTCMD_FAILED; @@ -2171,15 +845,10 @@ int instcmd(const char *cmdname, const char *extradata) return STAT_INSTCMD_FAILED; } - /* We got a reply from the UPS: - * either subdriver->accepted (-> command handled) - * or the command itself echoed back (-> command failed) - */ + /* We got a reply from the UPS: either subdriver->accepted (-> command handled) or the command itself echoed back (-> command failed) */ if (strlen(item->value) > 0) { - if (subdriver->accepted != NULL - && !strcasecmp(item->value, subdriver->accepted) - ) { + if (subdriver->accepted != NULL && !strcasecmp(item->value, subdriver->accepted)) { upslogx(LOG_INFO, "%s: SUCCEED", __func__); /* Set the status so that SEMI_STATIC vars are polled */ data_has_changed = TRUE; @@ -2198,7 +867,7 @@ int instcmd(const char *cmdname, const char *extradata) return STAT_INSTCMD_HANDLED; } -/* See header file for details. */ +/* Set r/w variable to a value. */ int setvar(const char *varname, const char *val) { item_t *item; @@ -2214,37 +883,30 @@ int setvar(const char *varname, const char *val) return STAT_SET_UNKNOWN; } - /* No NUT variable is available for this item, so we're handling - * a one-time setvar from ups.conf */ + /* No NUT variable is available for this item, so we're handling a one-time setvar from ups.conf */ if (item->qxflags & QX_FLAG_NONUT) { const char *userval; /* Nothing to do */ if (!testvar(item->info_type)) { - upsdebugx(2, "%s: nothing to do... [%s]", - __func__, item->info_type); + upsdebugx(2, "%s: nothing to do.. [%s]", __func__, item->info_type); return STAT_SET_HANDLED; } userval = getval(item->info_type); - upslogx(LOG_INFO, "%s(%s, %s)", - __func__, varname, - userval ? userval : "[NULL]"); + upslogx(LOG_INFO, "%s(%s, %s)", __func__, varname, userval ? userval : "[NULL]"); snprintf(value, sizeof(value), "%s", userval ? userval : ""); /* This item is available in NUT */ } else { - upslogx(LOG_INFO, "%s(%s, %s)", - __func__, varname, - strlen(val) ? val : "[NULL]"); + upslogx(LOG_INFO, "%s(%s, %s)", __func__, varname, strlen(val) ? val : "[NULL]"); if (!strlen(val)) { - upslogx(LOG_ERR, "%s: value not given for %s", - __func__, item->info_type); + upslogx(LOG_ERR, "%s: value not given for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } @@ -2252,8 +914,7 @@ int setvar(const char *varname, const char *val) /* Nothing to do */ if (!strcasecmp(dstate_getinfo(item->info_type), value)) { - upslogx(LOG_INFO, "%s: nothing to do... [%s]", - __func__, item->info_type); + upslogx(LOG_INFO, "%s: nothing to do.. [%s]", __func__, item->info_type); return STAT_SET_HANDLED; } @@ -2262,25 +923,22 @@ int setvar(const char *varname, const char *val) /* Check if given value is in the range of accepted values (range) */ if (item->qxflags & QX_FLAG_RANGE) { - long valuetoset, min, max; + int valuetoset, min, max; if (strspn(value, "0123456789 .") != strlen(value)) { - upslogx(LOG_ERR, "%s: non numerical value [%s: %s]", - __func__, item->info_type, value); + upslogx(LOG_ERR, "%s: non numerical value [%s: %s]", __func__, item->info_type, value); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } valuetoset = strtol(value, NULL, 10); - /* No NUT var is available for this item, so - * take its range from qx2nut table */ + /* No NUT var is available for this item, so take its range from qx2nut table */ if (item->qxflags & QX_FLAG_NONUT) { info_rw_t *rvalue; if (!strlen(value)) { - upslogx(LOG_ERR, "%s: value not given for %s", - __func__, item->info_type); + upslogx(LOG_ERR, "%s: value not given for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } @@ -2289,11 +947,8 @@ int setvar(const char *varname, const char *val) /* Loop on all existing values */ for (rvalue = item->info_rw; rvalue != NULL && strlen(rvalue->value) > 0; rvalue++) { - if (rvalue->preprocess - && rvalue->preprocess(rvalue->value, sizeof(rvalue->value)) - ) { + if (rvalue->preprocess && rvalue->preprocess(rvalue->value, sizeof(rvalue->value))) continue; - } if (min < 0) { min = strtol(rvalue->value, NULL, 10); @@ -2313,16 +968,14 @@ int setvar(const char *varname, const char *val) } - /* We have a NUT var for this item, so check given value - * against the already set range */ + /* We have a NUT var for this item, so check given value against the already set range */ } else { const range_t *range = state_getrangelist(root, item->info_type); /* Unable to find tree node for var */ if (!range) { - upsdebugx(2, "%s: unable to find tree node for %s", - __func__, item->info_type); + upsdebugx(2, "%s: unable to find tree node for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; } @@ -2342,34 +995,28 @@ int setvar(const char *varname, const char *val) } if (!ok) { - upslogx(LOG_ERR, "%s: value out of range [%s: %s]", - __func__, item->info_type, value); + upslogx(LOG_ERR, "%s: value out of range [%s: %s]", __func__, item->info_type, value); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } /* Check if given value is in the range of accepted values (enum) */ } else if (item->qxflags & QX_FLAG_ENUM) { - /* No NUT var is available for this item, so - * take its range from qx2nut table */ + /* No NUT var is available for this item, so take its range from qx2nut table */ if (item->qxflags & QX_FLAG_NONUT) { info_rw_t *envalue; if (!strlen(value)) { - upslogx(LOG_ERR, "%s: value not given for %s", - __func__, item->info_type); + upslogx(LOG_ERR, "%s: value not given for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } /* Loop on all existing values */ for (envalue = item->info_rw; envalue != NULL && strlen(envalue->value) > 0; envalue++) { - if (envalue->preprocess - && envalue->preprocess(envalue->value, sizeof(envalue->value)) - ) { + if (envalue->preprocess && envalue->preprocess(envalue->value, sizeof(envalue->value))) continue; - } if (strcasecmp(envalue->value, value)) continue; @@ -2380,16 +1027,14 @@ int setvar(const char *varname, const char *val) } - /* We have a NUT var for this item, so check given value - * against the already set range */ + /* We have a NUT var for this item, so check given value against the already set range */ } else { const enum_t *enumlist = state_getenumlist(root, item->info_type); /* Unable to find tree node for var */ if (!enumlist) { - upsdebugx(2, "%s: unable to find tree node for %s", - __func__, item->info_type); + upsdebugx(2, "%s: unable to find tree node for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; } @@ -2409,39 +1054,30 @@ int setvar(const char *varname, const char *val) } if (!ok) { - upslogx(LOG_ERR, "%s: value out of range [%s: %s]", - __func__, item->info_type, value); + upslogx(LOG_ERR, "%s: value out of range [%s: %s]", __func__, item->info_type, value); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } /* Check if given value is not too long (string) */ } else if (item->info_flags & ST_FLAG_STRING) { - const long aux = state_getaux(root, item->info_type); + const int aux = state_getaux(root, item->info_type); /* Unable to find tree node for var */ if (aux < 0) { - upsdebugx(2, "%s: unable to find tree node for %s", - __func__, item->info_type); + upsdebugx(2, "%s: unable to find tree node for %s", __func__, item->info_type); return STAT_SET_UNKNOWN; } - /* FIXME? Should this cast to "long"? - * An int-size string is quite a lot already, - * even on architectures with a moderate INTMAX - */ if (aux < (int)strlen(value)) { - upslogx(LOG_ERR, "%s: value is too long [%s: %s]", - __func__, item->info_type, value); + upslogx(LOG_ERR, "%s: value is too long [%s: %s]", __func__, item->info_type, value); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } } /* Preprocess value: from NUT-compliant to UPS-compliant */ - if (item->preprocess != NULL - && item->preprocess(item, value, sizeof(value)) - ) { + if (item->preprocess != NULL && item->preprocess(item, value, sizeof(value))) { /* Something went wrong */ upslogx(LOG_ERR, "%s: FAILED", __func__); return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ @@ -2449,8 +1085,7 @@ int setvar(const char *varname, const char *val) /* Handle server side variable */ if (item->qxflags & QX_FLAG_ABSENT) { - upsdebugx(2, "%s: setting server side variable %s", - __func__, item->info_type); + upsdebugx(2, "%s: setting server side variable %s", __func__, item->info_type); dstate_setinfo(item->info_type, "%s", value); upslogx(LOG_INFO, "%s: SUCCEED", __func__); return STAT_SET_HANDLED; @@ -2467,14 +1102,10 @@ int setvar(const char *varname, const char *val) return STAT_SET_UNKNOWN; /* TODO: HANDLED but FAILED, not UNKNOWN! */ } - /* We got a reply from the UPS: - * either subdriver->accepted (-> command handled) - * or the command itself echoed back (-> command failed) */ + /* We got a reply from the UPS: either subdriver->accepted (-> command handled) or the command itself echoed back (-> command failed) */ if (strlen(item->value) > 0) { - if (subdriver->accepted != NULL - && !strcasecmp(item->value, subdriver->accepted) - ) { + if (subdriver->accepted != NULL && !strcasecmp(item->value, subdriver->accepted)) { upslogx(LOG_INFO, "%s: SUCCEED", __func__); /* Set the status so that SEMI_STATIC vars are polled */ data_has_changed = TRUE; @@ -2494,9 +1125,6 @@ int setvar(const char *varname, const char *val) } /* Try to shutdown the UPS */ -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { int retry; @@ -2583,53 +1211,14 @@ void upsdrv_shutdown(void) } - fatalx(EXIT_SUCCESS, "Shutting down in %s seconds", - dstate_getinfo("ups.delay.shutdown")); + fatalx(EXIT_SUCCESS, "Shutting down in %s seconds", dstate_getinfo("ups.delay.shutdown")); } fatalx(EXIT_FAILURE, "Shutdown failed!"); } -#ifdef QX_USB - #ifndef TESTING - static const struct { - const char *name; - int (*command)(const char *cmd, char *buf, size_t buflen); - } usbsubdriver[] = { - { "cypress", &cypress_command }, - { "phoenixtec", &phoenixtec_command }, - { "phoenix", &phoenix_command }, - { "ippon", &ippon_command }, - { "krauler", &krauler_command }, - { "fabula", &fabula_command }, - { "hunnox", &hunnox_command }, - { "fuji", &fuji_command }, - { "sgs", &sgs_command }, - { "snr", &snr_command }, - { "ablerex", &ablerex_command }, - { "armac", &armac_command }, - { NULL, NULL } - }; - #endif -#endif - - void upsdrv_help(void) { -#ifdef QX_USB - #ifndef TESTING - printf("\nAcceptable values for 'subdriver' via -x or ups.conf in this driver: "); - size_t i; - - for (i = 0; usbsubdriver[i].name != NULL; i++) { - if (i>0) - printf(", "); - printf("%s", usbsubdriver[i].name); - } - printf("\n\n"); - #endif -#endif - printf("Read The Fine Manual ('man 8 nutdrv_qx')\n"); } @@ -2641,42 +1230,36 @@ void upsdrv_makevartable(void) upsdebugx(1, "%s...", __func__); - snprintf(temp, sizeof(temp), - "Set shutdown delay, in seconds (default=%s)", DEFAULT_OFFDELAY); + snprintf(temp, sizeof(temp), "Set shutdown delay, in seconds (default=%s)", DEFAULT_OFFDELAY); addvar(VAR_VALUE, QX_VAR_OFFDELAY, temp); - snprintf(temp, sizeof(temp), - "Set startup delay, in seconds (default=%s)", DEFAULT_ONDELAY); + snprintf(temp, sizeof(temp), "Set startup delay, in seconds (default=%s)", DEFAULT_ONDELAY); addvar(VAR_VALUE, QX_VAR_ONDELAY, temp); - addvar(VAR_FLAG, "stayoff", - "If invoked the UPS won't return after a shutdown when FSD arises"); + addvar(VAR_FLAG, "stayoff", "If invoked the UPS won't return after a shutdown when FSD arises"); - snprintf(temp, sizeof(temp), - "Set polling frequency, in seconds, to reduce data flow (default=%d)", - DEFAULT_POLLFREQ); + snprintf(temp, sizeof(temp), "Set polling frequency, in seconds, to reduce data flow (default=%d)", DEFAULT_POLLFREQ); addvar(VAR_VALUE, QX_VAR_POLLFREQ, temp); - addvar(VAR_VALUE, "protocol", - "Preselect communication protocol (skip autodetection)"); + addvar(VAR_VALUE, "protocol", "Preselect communication protocol (skip autodetection)"); /* battery.{charge,runtime} guesstimation */ - addvar(VAR_VALUE, "runtimecal", - "Parameters used for runtime calculation"); - addvar(VAR_VALUE, "chargetime", - "Nominal charge time for UPS battery"); - addvar(VAR_VALUE, "idleload", - "Minimum load to be used for runtime calculation"); + addvar(VAR_VALUE, "runtimecal", "Parameters used for runtime calculation"); + addvar(VAR_VALUE, "chargetime", "Nominal charge time for UPS battery"); + addvar(VAR_VALUE, "idleload", "Minimum load to be used for runtime calculation"); #ifdef QX_USB addvar(VAR_VALUE, "subdriver", "Serial-over-USB subdriver selection"); - /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ - nut_usb_addvars(); + addvar(VAR_VALUE, "vendorid", "Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal)"); + addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); - addvar(VAR_VALUE, "langid_fix", - "Apply the language ID workaround to the krauler subdriver " - "(0x409 or 0x4095)"); - addvar(VAR_FLAG, "noscanlangid", "Don't autoscan valid range for langid"); + addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); + addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); + addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); + + addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); + + addvar(VAR_VALUE, "langid_fix", "Apply the language ID workaround to the krauler subdriver (0x409 or 0x4095)"); #endif /* QX_USB */ #ifdef QX_SERIAL @@ -2705,8 +1288,7 @@ void upsdrv_updateinfo(void) /* Clear status buffer before beginning */ status_init(); - /* Do a full update (polling) every pollfreq or upon data change - * (i.e. setvar/instcmd) */ + /* Do a full update (polling) every pollfreq or upon data change (i.e. setvar/instcmd) */ if ((now > (lastpoll + pollfreq)) || (data_has_changed == TRUE)) { upsdebugx(1, "Full update..."); @@ -2719,8 +1301,7 @@ void upsdrv_updateinfo(void) if (qx_ups_walk(QX_WALKMODE_FULL_UPDATE) == FALSE) { if (retry < MAXTRIES || retry == MAXTRIES) { - upsdebugx(1, - "Communications with the UPS lost: status read failed!"); + upsdebugx(1, "Communications with the UPS lost: status read failed!"); retry++; } else { dstate_datastale(); @@ -2743,8 +1324,7 @@ void upsdrv_updateinfo(void) if (qx_ups_walk(QX_WALKMODE_QUICK_UPDATE) == FALSE) { if (retry < MAXTRIES || retry == MAXTRIES) { - upsdebugx(1, - "Communications with the UPS lost: status read failed!"); + upsdebugx(1, "Communications with the UPS lost: status read failed!"); retry++; } else { dstate_datastale(); @@ -2806,16 +1386,12 @@ void upsdrv_initinfo(void) } - if (!find_nut_info("load.off", QX_FLAG_CMD, QX_FLAG_SKIP) - && find_nut_info("load.off.delay", QX_FLAG_CMD, QX_FLAG_SKIP) - ) { + if (!find_nut_info("load.off", QX_FLAG_CMD, QX_FLAG_SKIP) && find_nut_info("load.off.delay", QX_FLAG_CMD, QX_FLAG_SKIP)) { /* Adds default with a delay value of '0' (= immediate) */ dstate_addcmd("load.off"); } - if (!find_nut_info("load.on", QX_FLAG_CMD, QX_FLAG_SKIP) - && find_nut_info("load.on.delay", QX_FLAG_CMD, QX_FLAG_SKIP) - ) { + if (!find_nut_info("load.on", QX_FLAG_CMD, QX_FLAG_SKIP) && find_nut_info("load.on.delay", QX_FLAG_CMD, QX_FLAG_SKIP)) { /* Adds default with a delay value of '0' (= immediate) */ dstate_addcmd("load.on"); } @@ -2825,7 +1401,7 @@ void upsdrv_initinfo(void) if (val) pollfreq = strtol(val, NULL, 10); - dstate_setinfo("driver.parameter.pollfreq", "%ld", pollfreq); + dstate_setinfo("driver.parameter.pollfreq", "%d", pollfreq); time(&lastpoll); @@ -2884,7 +1460,7 @@ void upsdrv_initups(void) { "reverse", 0, 1 }, { "both", 1, 1 }, { "none", 0, 0 }, - { NULL, 0, 0 } + { NULL } }; int i; @@ -2945,12 +1521,22 @@ void upsdrv_initups(void) /* USB */ #ifdef QX_USB - warn_if_bad_usb_port_filename(device_path); - #ifndef TESTING + + const struct { + const char *name; + int (*command)(const char *cmd, char *buf, size_t buflen); + } usbsubdriver[] = { + { "cypress", &cypress_command }, + { "phoenix", &phoenix_command }, + { "ippon", &ippon_command }, + { "krauler", &krauler_command }, + { NULL } + }; + int ret, langid; char tbuf[255]; /* Some devices choke on size > 255 */ - char *regex_array[7]; + char *regex_array[6]; char *subdrv = getval("subdriver"); @@ -2960,21 +1546,14 @@ void upsdrv_initups(void) regex_array[3] = getval("product"); regex_array[4] = getval("serial"); regex_array[5] = getval("bus"); - regex_array[6] = getval("device"); /* Check for language ID workaround (#1) */ if (getval("langid_fix")) { /* Skip "0x" prefix and set back to hexadecimal */ - unsigned int u_langid_fix; - if ( (sscanf(getval("langid_fix") + 2, "%x", &u_langid_fix) != 1) - || (u_langid_fix > INT_MAX) - ) { + if (sscanf(getval("langid_fix") + 2, "%x", &langid_fix) != 1) { upslogx(LOG_NOTICE, "Error enabling language ID workaround"); } else { - langid_fix = (int)u_langid_fix; - upsdebugx(2, - "Language ID workaround enabled (using '0x%x')", - langid_fix); + upsdebugx(2, "Language ID workaround enabled (using '0x%x')", langid_fix); } } @@ -2984,9 +1563,7 @@ void upsdrv_initups(void) int i; if (!regex_array[0] || !regex_array[1]) { - fatalx(EXIT_FAILURE, - "When specifying a subdriver, " - "'vendorid' and 'productid' are mandatory."); + fatalx(EXIT_FAILURE, "When specifying a subdriver, 'vendorid' and 'productid' are mandatory."); } for (i = 0; usbsubdriver[i].name; i++) { @@ -3005,9 +1582,7 @@ void upsdrv_initups(void) } - ret = USBNewRegexMatcher(®ex_matcher, - regex_array, - REG_ICASE | REG_EXTENDED); + ret = USBNewRegexMatcher(®ex_matcher, regex_array, REG_ICASE | REG_EXTENDED); switch (ret) { case -1: @@ -3015,9 +1590,7 @@ void upsdrv_initups(void) case 0: break; /* All is well */ default: - fatalx(EXIT_FAILURE, - "Invalid regular expression: %s", - regex_array[ret]); + fatalx(EXIT_FAILURE, "Invalid regular expression: %s", regex_array[ret]); } /* Link the matchers */ @@ -3026,14 +1599,10 @@ void upsdrv_initups(void) ret = usb->open(&udev, &usbdevice, regex_matcher, NULL); if (ret < 0) { fatalx(EXIT_FAILURE, - "No supported devices found. " - "Please check your device availability with 'lsusb'\n" - "and make sure you have an up-to-date version of NUT. " - "If this does not help,\n" - "try running the driver with at least 'subdriver', " - "'vendorid' and 'productid'\n" - "options specified. Please refer to the man page " - "for details about these options\n" + "No supported devices found. Please check your device availability with 'lsusb'\n" + "and make sure you have an up-to-date version of NUT. If this does not help,\n" + "try running the driver with at least 'subdriver', 'vendorid' and 'productid'\n" + "options specified. Please refer to the man page for details about these options\n" "(man 8 nutdrv_qx).\n"); } @@ -3054,25 +1623,17 @@ void upsdrv_initups(void) dstate_setinfo("ups.productid", "%04x", usbdevice.ProductID); /* Check for language ID workaround (#2) */ - if ((langid_fix != -1) && (!getval("noscanlangid"))) { + if (langid_fix != -1) { /* Future improvement: - * Asking for the zero'th index is special - it returns - * a string descriptor that contains all the language - * IDs supported by the device. + * Asking for the zero'th index is special - it returns a string descriptor that contains all the language IDs supported by the device. * Typically there aren't many - often only one. - * The language IDs are 16 bit numbers, and they start at - * the third byte in the descriptor. - * See USB 2.0 specification, section 9.6.7, for more - * information on this. + * The language IDs are 16 bit numbers, and they start at the third byte in the descriptor. + * See USB 2.0 specification, section 9.6.7, for more information on this. * This should allow automatic application of the workaround */ - ret = usb_get_string(udev, 0, 0, - (usb_ctrl_charbuf)tbuf, sizeof(tbuf)); + ret = usb_get_string(udev, 0, 0, tbuf, sizeof(tbuf)); if (ret >= 4) { - langid = ((uint8_t)tbuf[2]) | (((uint8_t)tbuf[3]) << 8); - upsdebugx(1, - "First supported language ID: 0x%x " - "(please report to the NUT maintainer!)", - langid); + langid = tbuf[2] | (tbuf[3] << 8); + upsdebugx(1, "First supported language ID: 0x%x (please report to the NUT maintainer!)", langid); } } @@ -3124,7 +1685,6 @@ void upsdrv_cleanup(void) free(usbdevice.Product); free(usbdevice.Serial); free(usbdevice.Bus); - free(usbdevice.Device); #ifdef QX_SERIAL } /* is_usb */ @@ -3141,25 +1701,18 @@ void upsdrv_cleanup(void) /* Generic command processing function: send a command and read a reply. * Returns < 0 on error, 0 on timeout and the number of bytes read on success. */ -static ssize_t qx_command(const char *cmd, char *buf, size_t buflen) +static int qx_command(const char *cmd, char *buf, size_t buflen) { -/* NOTE: Could not find in which ifdef-ed codepath, but clang complained - * about unused parameters here. Reference them just in case... - */ - NUT_UNUSED_VARIABLE(cmd); - NUT_UNUSED_VARIABLE(buf); - NUT_UNUSED_VARIABLE(buflen); - #ifndef TESTING - ssize_t ret = -1; + int ret = -1; -# ifdef QX_USB +#ifdef QX_USB -# ifdef QX_SERIAL + #ifdef QX_SERIAL /* Communication: USB */ if (is_usb) { -# endif /* QX_SERIAL (&& QX_USB)*/ + #endif /* QX_SERIAL */ if (udev == NULL) { ret = usb->open(&udev, &usbdevice, reopen_matcher, NULL); @@ -3177,108 +1730,74 @@ static ssize_t qx_command(const char *cmd, char *buf, size_t buflen) switch (ret) { - case ERROR_BUSY: /* Device or resource busy */ + case -EBUSY: /* Device or resource busy */ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif - #if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ case -EPERM: /* Operation not permitted */ fatal_with_errno(EXIT_FAILURE, "Permissions problem"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif - #endif /* WITH_LIBUSB_0_1 */ - case ERROR_PIPE: /* Broken pipe */ + case -EPIPE: /* Broken pipe */ if (usb_clear_halt(udev, 0x81) == 0) { upsdebugx(1, "Stall condition cleared"); break; } -#if (defined ETIME) && ETIME && WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ - goto fallthrough_case_ETIME; + #ifdef ETIME case -ETIME: /* Timer expired */ - fallthrough_case_ETIME: -#endif /* ETIME && WITH_LIBUSB_0_1 */ + #endif /* ETIME */ if (usb_reset(udev) == 0) { upsdebugx(1, "Device reset handled"); } - goto fallthrough_case_reconnect; - case ERROR_NO_DEVICE: /* No such device */ - case ERROR_ACCESS: /* Permission denied */ - case ERROR_IO: /* I/O error */ -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ + case -ENODEV: /* No such device */ + case -EACCES: /* Permission denied */ + case -EIO: /* I/O error */ case -ENXIO: /* No such device or address */ -#endif /* WITH_LIBUSB_0_1 */ - case ERROR_NOT_FOUND: /* No such file or directory */ - fallthrough_case_reconnect: + case -ENOENT: /* No such file or directory */ /* Uh oh, got to reconnect! */ usb->close(udev); udev = NULL; break; - case ERROR_TIMEOUT: /* Connection timed out */ - case ERROR_OVERFLOW: /* Value too large for defined data type */ -#if EPROTO && WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ + case -ETIMEDOUT: /* Connection timed out */ + case -EOVERFLOW: /* Value too large for defined data type */ case -EPROTO: /* Protocol error */ -#endif default: break; } -# ifdef QX_SERIAL + #ifdef QX_SERIAL /* Communication: serial */ } else { /* !is_usb */ -# endif /* QX_SERIAL (&& QX_USB) */ + #endif /* QX_SERIAL */ -# endif /* QX_USB (&& TESTING) */ +#endif /* QX_USB */ -# ifdef QX_SERIAL +#ifdef QX_SERIAL ser_flush_io(upsfd); ret = ser_send(upsfd, "%s", cmd); if (ret <= 0) { - upsdebugx(3, "send: %s (%zd)", - ret ? strerror(errno) : "timeout", ret); + upsdebugx(3, "send: %s", ret ? strerror(errno) : "timeout"); return ret; } - upsdebugx(3, "send: '%.*s'", - (int)strcspn(cmd, "\r"), cmd); + upsdebugx(3, "send: '%.*s'", (int)strcspn(cmd, "\r"), cmd); ret = ser_get_buf(upsfd, buf, buflen, SER_WAIT_SEC, 0); if (ret <= 0) { - upsdebugx(3, "read: %s (%zd)", - ret ? strerror(errno) : "timeout", ret); + upsdebugx(3, "read: %s", ret ? strerror(errno) : "timeout"); return ret; } - upsdebug_hex(5, "read", buf, (size_t)ret); upsdebugx(3, "read: '%.*s'", (int)strcspn(buf, "\r"), buf); -# ifdef QX_USB + #ifdef QX_USB } /* !is_usb */ -# endif /* QX_USB (&& QX_SERIAL) */ + #endif /* QX_USB */ -# endif /* QX_SERIAL (&& TESTING) */ +#endif /* QX_SERIAL */ return ret; @@ -3297,25 +1816,7 @@ static ssize_t qx_command(const char *cmd, char *buf, size_t buflen) continue; } - upsdebugx(3, "read: '%.*s'", - (int)strcspn(testing[i].answer, "\r"), - testing[i].answer); - - /* If requested to do so and this is the case, try to preserve inner '\0's (treat answer as a sequence of bytes) */ - if (testing[i].answer_len > 0 && strlen(testing[i].answer) < (size_t)testing[i].answer_len) { - - size_t len; - - len = buflen <= (size_t)testing[i].answer_len ? buflen - 1 : (size_t)testing[i].answer_len; - len = len <= sizeof(testing[i].answer) ? len : sizeof(testing[i].answer); - - memcpy(buf, testing[i].answer, len); - upsdebug_hex(4, "read", buf, (int)len); - - return len; - - } - + upsdebugx(3, "read: '%.*s'", (int)strcspn(testing[i].answer, "\r"), testing[i].answer); return snprintf(buf, buflen, "%s", testing[i].answer); } @@ -3324,9 +1825,7 @@ static ssize_t qx_command(const char *cmd, char *buf, size_t buflen) if (subdriver->rejected != NULL) { /* ..fulfill its expectations.. */ - upsdebugx(3, "read: '%.*s'", - (int)strcspn(subdriver->rejected, "\r"), - subdriver->rejected); + upsdebugx(3, "read: '%.*s'", (int)strcspn(subdriver->rejected, "\r"), subdriver->rejected); return snprintf(buf, buflen, "%s", subdriver->rejected); /* ..otherwise.. */ @@ -3341,7 +1840,7 @@ static ssize_t qx_command(const char *cmd, char *buf, size_t buflen) #endif /* TESTING */ } -/* See header file for details. +/* Update ups_status to remember this status item. * Interpretation is done in ups_status_set(). */ void update_status(const char *value) { @@ -3369,8 +1868,7 @@ void update_status(const char *value) return; } - upsdebugx(5, "%s: Warning! %s not in list of known values", - __func__, value); + upsdebugx(5, "%s: Warning! %s not in list of known values", __func__, value); } /* Choose subdriver */ @@ -3390,13 +1888,10 @@ static int subdriver_matcher(void) char subdrv_name[SMALLBUF]; /* Get rid of subdriver version */ - snprintf(subdrv_name, sizeof(subdrv_name), "%.*s", - (int)strcspn(subdriver_list[i]->name, " "), - subdriver_list[i]->name); + snprintf(subdrv_name, sizeof(subdrv_name), "%.*s", (int)strcspn(subdriver_list[i]->name, " "), subdriver_list[i]->name); if (strcasecmp(subdrv_name, protocol)) { - upsdebugx(2, "Skipping protocol %s", - subdriver_list[i]->name); + upsdebugx(2, "Skipping protocol %s", subdriver_list[i]->name); continue; } @@ -3449,11 +1944,8 @@ static void qx_set_var(item_t *item) /* Loop on all existing values */ for (envalue = item->info_rw; envalue != NULL && strlen(envalue->value) > 0; envalue++) { - if (envalue->preprocess - && envalue->preprocess(envalue->value, sizeof(envalue->value)) - ) { + if (envalue->preprocess && envalue->preprocess(envalue->value, sizeof(envalue->value))) continue; - } /* This item is not available yet in NUT, so publish these data in the logs */ if (item->qxflags & QX_FLAG_NONUT) { @@ -3470,9 +1962,7 @@ static void qx_set_var(item_t *item) } if (item->qxflags & QX_FLAG_NONUT) - upslogx(LOG_INFO, "%s, settable values:%s", - item->info_type, - strlen(buf) > 0 ? buf : " none"); + upslogx(LOG_INFO, "%s, settable values:%s", item->info_type, strlen(buf) > 0 ? buf : " none"); } @@ -3485,11 +1975,8 @@ static void qx_set_var(item_t *item) /* Loop on all existing values */ for (rvalue = item->info_rw; rvalue != NULL && strlen(rvalue->value) > 0; rvalue++) { - if (rvalue->preprocess - && rvalue->preprocess(rvalue->value, sizeof(rvalue->value)) - ) { + if (rvalue->preprocess && rvalue->preprocess(rvalue->value, sizeof(rvalue->value))) continue; - } if (!from) { from = rvalue; @@ -3498,26 +1985,17 @@ static void qx_set_var(item_t *item) to = rvalue; - /* This item is not available yet in NUT, so - * publish these data in the logs */ + /* This item is not available yet in NUT, so publish these data in the logs */ if (item->qxflags & QX_FLAG_NONUT) { - upslogx(LOG_INFO, "%s, settable range: %s..%s", - item->info_type, from->value, to->value); + upslogx(LOG_INFO, "%s, settable range: %s..%s", item->info_type, from->value, to->value); ok++; /* This item is available in NUT, add its range to the variable */ } else { - long lFrom = strtol(from->value, NULL, 10), - lTo = strtol(to->value, NULL, 10); - if (lFrom > INT_MAX || lTo > INT_MAX) { - upslogx(LOG_INFO, - "%s, settable range exceeds INT_MAX: %ld..%ld", - item->info_type, lFrom, lTo); - } else { - dstate_addrange(item->info_type, (int)lFrom, (int)lTo); - } + dstate_addrange(item->info_type, strtol(from->value, NULL, 10), strtol(to->value, NULL, 10)); + } from = NULL; @@ -3525,8 +2003,7 @@ static void qx_set_var(item_t *item) } - /* This item is not available yet in NUT and we weren't able to - * get its range; let people know it */ + /* This item is not available yet in NUT and we weren't able to get its range; let people know it */ if ((item->qxflags & QX_FLAG_NONUT) && !ok) upslogx(LOG_INFO, "%s, settable range: none", item->info_type); @@ -3545,12 +2022,7 @@ static bool_t qx_ups_walk(walkmode_t mode) batt.chrg.act = -1; } - /* Clear data from previous_item */ - memset(previous_item.command, 0, sizeof(previous_item.command)); - memset(previous_item.answer, 0, sizeof(previous_item.answer)); - - /* 3 modes: QX_WALKMODE_INIT, QX_WALKMODE_QUICK_UPDATE - * and QX_WALKMODE_FULL_UPDATE */ + /* 3 modes: QX_WALKMODE_INIT, QX_WALKMODE_QUICK_UPDATE and QX_WALKMODE_FULL_UPDATE */ /* Device data walk */ for (item = subdriver->qx2nut; item->info_type != NULL; item++) { @@ -3583,11 +2055,8 @@ static bool_t qx_ups_walk(walkmode_t mode) } /* Allow duplicates for these NUT variables */ - if (!strncmp(item->info_type, "ups.alarm", 9) - || !strncmp(item->info_type, "ups.status", 10) - ) { + if (!strncmp(item->info_type, "ups.alarm", 9) || !strncmp(item->info_type, "ups.status", 10)) break; - } /* This one doesn't exist yet */ if (dstate_getinfo(item->info_type) == NULL) @@ -3610,41 +2079,14 @@ static bool_t qx_ups_walk(walkmode_t mode) continue; /* These need to be polled after user changes (setvar / instcmd) */ - if ((item->qxflags & QX_FLAG_SEMI_STATIC) - && (data_has_changed == FALSE) - ) { + if ((item->qxflags & QX_FLAG_SEMI_STATIC) && (data_has_changed == FALSE)) continue; - } break; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: + fatalx(EXIT_FAILURE, "%s: unknown update mode!", __func__); -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif } @@ -3666,38 +2108,24 @@ static bool_t qx_ups_walk(walkmode_t mode) } - /* Check whether the previous item uses the same command - * and then use its answer, if available.. */ - if (strlen(previous_item.command) > 0 - && strlen(previous_item.answer) > 0 - && !strcasecmp(previous_item.command, item->command) - ) { + /* Check whether the previous item uses the same command and then use its answer, if available.. */ + if (strlen(previous_item.command) > 0 && strlen(previous_item.answer) > 0 && !strcasecmp(previous_item.command, item->command)) { - snprintf(item->answer, sizeof(item->answer), "%s", - previous_item.answer); + snprintf(item->answer, sizeof(item->answer), "%s", previous_item.answer); /* Process the answer */ retcode = qx_process_answer(item, strlen(item->answer)); /* ..otherwise: execute command to get answer from the UPS */ - } else { - + } else retcode = qx_process(item, NULL); - } - /* Record item as previous_item */ - snprintf(previous_item.command, sizeof(previous_item.command), "%s", - item->command); - snprintf(previous_item.answer, sizeof(previous_item.answer), "%s", - item->answer); + snprintf(previous_item.command, sizeof(previous_item.command), "%s", item->command); + snprintf(previous_item.answer, sizeof(previous_item.answer), "%s", item->answer); if (retcode) { - /* Clear data from the item */ - memset(item->answer, 0, sizeof(item->answer)); - memset(item->value, 0, sizeof(item->value)); - if (item->qxflags & QX_FLAG_QUICK_POLL) return FALSE; @@ -3705,41 +2133,39 @@ static bool_t qx_ups_walk(walkmode_t mode) /* Skip this item from now on */ item->qxflags |= QX_FLAG_SKIP; + /* Clear data from the item */ + snprintf(item->answer, sizeof(item->answer), "%s", ""); + snprintf(item->value, sizeof(item->value), "%s", ""); + /* Don't know what happened, try again later... */ continue; } - /* Process the value we got back (set status bits - * and set the value of other parameters) */ + /* Process the value we got back (set status bits and set the value of other parameters) */ retcode = ups_infoval_set(item); /* Clear data from the item */ - memset(item->answer, 0, sizeof(item->answer)); - memset(item->value, 0, sizeof(item->value)); + snprintf(item->answer, sizeof(item->answer), "%s", ""); + snprintf(item->value, sizeof(item->value), "%s", ""); /* Uh-oh! Some error! */ - if (retcode == -1) { - - if (item->qxflags & QX_FLAG_QUICK_POLL) - return FALSE; - + if (retcode == -1) continue; - } - - /* Set var flags/range/enum (not for ups.{alarm.status}, - * hence the retcode check) */ + /* Set var flags/range/enum (not for ups.{alarm.status}, hence the retcode check) */ if (retcode && mode == QX_WALKMODE_INIT) { qx_set_var(item); } } + /* Clear data from previous_item */ + snprintf(previous_item.command, sizeof(previous_item.command), "%s", ""); + snprintf(previous_item.answer, sizeof(previous_item.answer), "%s", ""); + /* Update battery guesstimation */ - if (mode == QX_WALKMODE_FULL_UPDATE - && (d_equal(batt.runt.act, -1) || d_equal(batt.chrg.act, -1)) - ) { + if (mode == QX_WALKMODE_FULL_UPDATE && (batt.runt.act == -1 || batt.chrg.act == -1)) { if (getval("runtimecal")) { @@ -3765,53 +2191,11 @@ static bool_t qx_ups_walk(walkmode_t mode) } - const char *val = dstate_getinfo("battery.voltage"); + if (batt.chrg.act == -1) + dstate_setinfo("battery.charge", "%.0f", 100 * batt.runt.est / batt.runt.nom); - if (!val) { - upsdebugx(2, "%s: unable to get battery.voltage", __func__); - } else { - /* For age-corrected estimates below, - * see theory and experimental graphs at - * https://github.com/networkupstools/nut/pull/1027 - */ - - batt.volt.act = batt.packs * strtod(val, NULL); - - if (batt.volt.act > 0 && batt.volt.low > 0 && batt.volt.high > batt.volt.low) { - - double voltage_battery_charge = (batt.volt.act - batt.volt.low) / (batt.volt.high - batt.volt.low); - - if (voltage_battery_charge < 0) { - voltage_battery_charge = 0; - } - - if (voltage_battery_charge > 1) { - voltage_battery_charge = 1; - } - - /* Correct estimated runtime remaining for old batteries: - * this value replacement only happens if the actual - * voltage_battery_charge is smaller than expected by - * previous (load-based) estimation, thus adapting to a - * battery too old and otherwise behaving non-linearly - */ - if (voltage_battery_charge < (batt.runt.est / batt.runt.nom)) { - double estPrev = batt.runt.est; - batt.runt.est = voltage_battery_charge * batt.runt.nom; - upsdebugx(3, "%s: updating batt.runt.est from '%g' to '%g'", - __func__, estPrev, batt.runt.est); - } - - } - } - - if (d_equal(batt.chrg.act, -1)) - dstate_setinfo("battery.charge", "%.0f", - 100 * batt.runt.est / batt.runt.nom); - - if (d_equal(batt.runt.act, -1) && !qx_load()) - dstate_setinfo("battery.runtime", "%.0f", - batt.runt.est / load.eff); + if (batt.runt.act == -1 && !qx_load()) + dstate_setinfo("battery.runtime", "%.0f", batt.runt.est / load.eff); battery_lastpoll = battery_now; @@ -3879,7 +2263,9 @@ static void ups_status_set(void) } } -/* See header file for details. */ +/* Find element definition in qx2nut array by NUT varname optionally filtered by its qxflags: + * - 'flag': flags that have to be set in the item, i.e. if one of the flags is absent in the item it won't be returned + * - 'noflag': flags that have to be absent in the item, i.e. if at least one of the flags is set in the item it won't be returned */ item_t *find_nut_info(const char *varname, const unsigned long flag, const unsigned long noflag) { item_t *item; @@ -3904,44 +2290,29 @@ item_t *find_nut_info(const char *varname, const unsigned long flag, const unsig /* Process the answer we got back from the UPS * Return -1 on errors, 0 on success */ -static int qx_process_answer(item_t *item, const size_t len) +static int qx_process_answer(item_t *item, const int len) { /* Query rejected by the UPS */ if (subdriver->rejected && !strcasecmp(item->answer, subdriver->rejected)) { - upsdebugx(2, "%s: query rejected by the UPS (%s)", - __func__, item->info_type); + upsdebugx(2, "%s: query rejected by the UPS (%s)", __func__, item->info_type); return -1; } /* Short reply */ if (item->answer_len && len < item->answer_len) { - upsdebugx(2, "%s: short reply (%s)", - __func__, item->info_type); + upsdebugx(2, "%s: short reply (%s)", __func__, item->info_type); return -1; } /* Wrong leading character */ if (item->leading && item->answer[0] != item->leading) { - upsdebugx(2, - "%s: %s - invalid start character [%02x], expected [%02x]", - __func__, item->info_type, item->answer[0], item->leading); - return -1; - } - - /* Check boundaries */ - if (item->to && item->to < item->from) { - upsdebugx(1, - "%s: in %s, starting char's position (%d) " - "follows ending char's one (%d)", - __func__, item->info_type, item->from, item->to); + upsdebugx(2, "%s: %s - invalid start character [%02x], expected [%02x]", __func__, item->info_type, item->answer[0], item->leading); return -1; } /* Get value */ if (strlen(item->answer)) { - snprintf(item->value, sizeof(item->value), "%.*s", - item->to ? 1 + item->to - item->from : (int)strcspn(item->answer, "\r") - item->from, - item->answer + item->from); + snprintf(item->value, sizeof(item->value), "%.*s", item->to ? 1 + item->to - item->from : (int)strcspn(item->answer, "\r") - item->from, item->answer + item->from); } else { snprintf(item->value, sizeof(item->value), "%s", ""); } @@ -3949,71 +2320,23 @@ static int qx_process_answer(item_t *item, const size_t len) return 0; } -/* See header file for details. */ +/* Send the command to the UPS and process the reply. + * Return -1 on errors, 0 on success */ int qx_process(item_t *item, const char *command) { - char buf[sizeof(item->answer) - 1] = "", *cmd; - ssize_t len; - size_t cmdlen = command ? - (strlen(command) >= SMALLBUF ? strlen(command) + 1 : SMALLBUF) : - (item->command && strlen(item->command) >= SMALLBUF ? strlen(item->command) + 1 : SMALLBUF); - size_t cmdsz = (sizeof(char) * cmdlen); /* in bytes, to be pedantic */ - - if ( !(cmd = xmalloc(cmdsz)) ) { - upslogx(LOG_ERR, "qx_process() failed to allocate buffer"); - return -1; - } - - /* Prepare the command to be used */ - memset(cmd, 0, cmdsz); - snprintf(cmd, cmdsz, "%s", command ? command : item->command); - - /* Preprocess the command */ - if ( - item->preprocess_command != NULL && - item->preprocess_command(item, cmd, cmdsz) == -1 - ) { - upsdebugx(4, "%s: failed to preprocess command [%s]", - __func__, item->info_type); - free (cmd); - return -1; - } + char buf[SMALLBUF] = ""; /* Send the command */ - len = qx_command(cmd, buf, sizeof(buf)); + int len = qx_command(command ? command : item->command, buf, sizeof(buf)); - memset(item->answer, 0, sizeof(item->answer)); - - if (len < 0 || len > INT_MAX) { - upsdebugx(4, "%s: failed to preprocess answer [%s]", - __func__, item->info_type); - free (cmd); - return -1; - } - - memcpy(item->answer, buf, sizeof(buf)); - - /* Preprocess the answer */ - if (item->preprocess_answer != NULL) { - len = item->preprocess_answer(item, (int)len); - if (len < 0 || len > INT_MAX) { - upsdebugx(4, "%s: failed to preprocess answer [%s]", - __func__, item->info_type); - /* Clear the failed answer, preventing it from - * being reused by next items with same command */ - memset(item->answer, 0, sizeof(item->answer)); - free (cmd); - return -1; - } - } - - free (cmd); + snprintf(item->answer, sizeof(item->answer), "%s", buf); /* Process the answer to get the value */ - return qx_process_answer(item, (size_t)len); + return qx_process_answer(item, len); } -/* See header file for details. */ +/* Process the value we got back (set status bits and set the value of other parameters). */ +/* Return -1 on failure, 0 for a status update and 1 in all other cases */ int ups_infoval_set(item_t *item) { char value[SMALLBUF] = ""; @@ -4023,8 +2346,7 @@ int ups_infoval_set(item_t *item) /* Process the value returned by the UPS to NUT standards */ if (item->preprocess(item, value, sizeof(value))) { - upsdebugx(4, "%s: failed to preprocess value [%s: %s]", - __func__, item->info_type, item->value); + upsdebugx(4, "%s: failed to preprocess value [%s: %s]", __func__, item->info_type, item->value); return -1; } @@ -4046,32 +2368,45 @@ int ups_infoval_set(item_t *item) snprintf(value, sizeof(value), "%s", item->value); - /* Cover most of the cases: either left/right filled with hashes, - * spaces or a mix of both */ - if (item->qxflags & QX_FLAG_TRIM) - str_trim_m(value, "# "); + /* Cover most of the cases: either left/right filled with hashes, spaces or a mix of both */ + if (item->qxflags & QX_FLAG_TRIM) { + + char buf[SMALLBUF]; + + snprintf(buf, sizeof(buf), "%s", ltrim(value, ' ')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", rtrim(value, ' ')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", ltrim(value, '#')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", rtrim(value, '#')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", ltrim(value, ' ')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", rtrim(value, ' ')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", ltrim(value, '#')); + snprintf(value, sizeof(value), "%s", buf); + + snprintf(buf, sizeof(buf), "%s", rtrim(value, '#')); + snprintf(value, sizeof(value), "%s", buf); + + } if (strcasecmp(item->dfl, "%s")) { if (strspn(value, "0123456789 .") != strlen(value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", - __func__, item->info_type, value); + upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, value); return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, sizeof(value), item->dfl, strtod(value, NULL)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } } @@ -4082,8 +2417,7 @@ int ups_infoval_set(item_t *item) } if (!strlen(value)) { - upsdebugx(1, "%s: non significant value [%s]", - __func__, item->info_type); + upsdebugx(1, "%s: non significant value [%s]", __func__, item->info_type); return -1; } @@ -4098,8 +2432,8 @@ int ups_infoval_set(item_t *item) return 1; } -/* See header file for details. */ -unsigned int qx_status(void) +/* Return actual status */ +int qx_status(void) { return ups_status; } diff --git a/drivers/nutdrv_qx.h b/drivers/nutdrv_qx.h index 3cc3ebd..e42e9a0 100644 --- a/drivers/nutdrv_qx.h +++ b/drivers/nutdrv_qx.h @@ -45,17 +45,13 @@ #define DEFAULT_OFFDELAY "30" /* Delay before power off, in seconds */ #define DEFAULT_POLLFREQ 30 /* Polling interval between full updates, in seconds; the driver will do quick polls in the meantime */ -#ifndef TRUE typedef enum { FALSE, TRUE } bool_t; -#else -typedef int bool_t; -#endif /* Structure for rw vars */ typedef struct { - char value[SMALLBUF]; /* Value for enum/range, or length for ST_FLAG_STRING */ - int (*preprocess)(char *value, const size_t len); /* Optional function to preprocess range/enum value. - * This function will be given value and its size_t and must return either 0 if value is supported or -1 if not supported. */ + char value[SMALLBUF]; /* Value for enum/range, or length for ST_FLAG_STRING */ + int (*preprocess)(char *value, size_t len); /* Optional function to preprocess range/enum value. + * This function will be given value and its size_t and must return either 0 if value is supported or -1 if not supported. */ } info_rw_t; /* Structure containing information about how to get/set data from/to the UPS and convert these to/from NUT standard */ @@ -71,9 +67,8 @@ typedef struct item_t { * If QX_FLAG_SETVAR is set the value given by the user will be checked against these infos. */ const char *command; /* Command sent to the UPS to get answer/to execute an instant command/to set a variable */ - char answer[SMALLBUF]; /* Answer from the UPS, filled at runtime. - * If you expect a nonvalid C string (e.g.: inner '\0's) or need to perform actions before the answer is used (and treated as a null-terminated string), you should set a preprocess_answer() function */ - const size_t answer_len; /* Expected min length of the answer. Set it to 0 if there's no minimum length to look after. */ + char answer[SMALLBUF]; /* Answer from the UPS, filled at runtime */ + const int answer_len; /* Expected min length of the answer. Set it to 0 if there’s no minimum length to look after. */ const char leading; /* Expected leading character of the answer (optional) */ char value[SMALLBUF]; /* Value from the answer, filled at runtime (i.e. answer between from and to) */ @@ -88,19 +83,7 @@ typedef struct item_t { unsigned long qxflags; /* Driver's own flags */ - int (*preprocess_command)(struct item_t *item, char *command, const size_t commandlen); - /* Last chance to preprocess the command to be sent to the UPS (e.g. to add CRC, ...). - * This function is given the currently processed item (item), the command to be sent to the UPS (command) and its size_t (commandlen). - * Return -1 in case of errors, else 0. - * command must be filled with the actual command to be sent to the UPS. */ - - int (*preprocess_answer)(struct item_t *item, const int len); - /* Function to preprocess the answer we got from the UPS before we do anything else (e.g. for CRC, decoding, ...). - * This function is given the currently processed item (item) with the answer we got from the UPS unmolested and already stored in item->answer and the length of that answer (len). - * Return -1 in case of errors, else the length of the newly allocated item->answer (from now on, treated as a null-terminated string). */ - - int (*preprocess)(struct item_t *item, char *value, const size_t valuelen); - /* Function to preprocess the data from/to the UPS + int (*preprocess)(struct item_t *item, char *value, size_t valuelen); /* Function to preprocess the data from/to the UPS * This function is given the currently processed item (item), a char array (value) and its size_t (valuelen). * Return -1 in case of errors, else 0. * If QX_FLAG_SETVAR/QX_FLAG_CMD -> process command before it is sent: value must be filled with the command to be sent to the UPS. @@ -108,33 +91,27 @@ typedef struct item_t { } item_t; /* Driver's own flags */ -#define QX_FLAG_STATIC 2UL /* Retrieve info only once. */ -#define QX_FLAG_SEMI_STATIC 4UL /* Retrieve info smartly, i.e. only when a command/setvar is executed and we expect that data could have been changed. */ -#define QX_FLAG_ABSENT 8UL /* Data is absent in the device, use default value. */ -#define QX_FLAG_QUICK_POLL 16UL /* Mandatory vars, polled also in QX_WALKMODE_QUICK_UPDATE. - * If there's a problem with a var not flagged as QX_FLAG_QUICK_POLL in QX_WALKMODE_INIT, the driver will automagically set QX_FLAG_SKIP on it and then it'll skip that item in QX_WALKMODE_{QUICK,FULL}_UPDATE. +#define QX_FLAG_STATIC 2 /* Retrieve info only once. */ +#define QX_FLAG_SEMI_STATIC 4 /* Retrieve info smartly, i.e. only when a command/setvar is executed and we expect that data could have been changed. */ +#define QX_FLAG_ABSENT 8 /* Data is absent in the device, use default value. */ +#define QX_FLAG_QUICK_POLL 16 /* Mandatory vars, polled also in QX_WALKMODE_QUICK_UPDATE. + * If there’s a problem with a var not flagged as QX_FLAG_QUICK_POLL in QX_WALKMODE_INIT, the driver will automagically set QX_FLAG_SKIP on it and then it’ll skip that item in QX_WALKMODE_{QUICK,FULL}_UPDATE. * Otherwise, if the item has the flag QX_FLAG_QUICK_POLL set, in case of errors in QX_WALKMODE_INIT the driver will set datastale. */ -#define QX_FLAG_CMD 32UL /* Instant command. */ -#define QX_FLAG_SETVAR 64UL /* The var is settable and the actual item stores info on how to set it. */ -#define QX_FLAG_TRIM 128UL /* This var's value need to be trimmed of leading/trailing spaces/hashes. */ -#define QX_FLAG_ENUM 256UL /* Enum values exist and are stored in info_rw. */ -#define QX_FLAG_RANGE 512UL /* Ranges for this var available and are stored in info_rw. */ -#define QX_FLAG_NONUT 1024UL /* This var doesn't have a corresponding var in NUT. */ -#define QX_FLAG_SKIP 2048UL /* Skip this var: this item won't be processed. */ +#define QX_FLAG_CMD 32 /* Instant command. */ +#define QX_FLAG_SETVAR 64 /* The var is settable and the actual item stores info on how to set it. */ +#define QX_FLAG_TRIM 128 /* This var's value need to be trimmed of leading/trailing spaces/hashes. */ +#define QX_FLAG_ENUM 256 /* Enum values exist and are stored in info_rw. */ +#define QX_FLAG_RANGE 512 /* Ranges for this var available and are stored in info_rw. */ +#define QX_FLAG_NONUT 1024 /* This var doesn't have a corresponding var in NUT. */ +#define QX_FLAG_SKIP 2048 /* Skip this var: this item won’t be processed. */ #define MAXTRIES 3 /* Max number of retries */ -#ifdef TESTING /* Testing struct */ typedef struct { - const char *cmd; /* Command to match */ - const char answer[SMALLBUF]; /* Answer for that command. - * Note: if 'answer' contains inner '\0's, in order to preserve them, 'answer_len' as well as an item_t->preprocess_answer() function must be set */ - const int answer_len; /* Answer length: - * - if set to -1 -> auto calculate answer length (treat 'answer' as a null-terminated string) - * - otherwise -> use the provided length (if reasonable) and preserve inner '\0's (treat 'answer' as a sequence of bytes till the item_t->preprocess_answer() function gets called) */ + const char *cmd; /* Command to match */ + const char *answer; /* Answer for that command */ } testing_t; -#endif /* TESTING */ /* Subdriver interface */ typedef struct { @@ -146,7 +123,7 @@ typedef struct { void (*makevartable)(void); /* Subdriver specific ups.conf flags/vars */ const char *accepted; /* String to match if the driver is expecting a reply from the UPS on instcmd/setvar. * This comparison is done after the answer we got back from the UPS has been processed to get the value we are searching: - * - you don't have to include the trailing carriage return (\r) + * - you don’t have to include the trailing carriage return (\r) * - you can decide at which index of the answer the value should start or end setting the appropriate from and to in the item_t */ const char *rejected; /* String to match if the driver is expecting a reply from the UPS in case of error. * This comparison is done on the answer we got back from the UPS before it has been processed: @@ -157,11 +134,7 @@ typedef struct { } subdriver_t; /* The following functions are exported for the benefit of subdrivers */ - /* Execute an instant command. In detail: - * - look up the given 'cmdname' in the qx2nut data structure (if not found, try to fallback to commonly known commands); - * - if 'cmdname' is found, call its preprocess function, passing to it 'extradata', if any, otherwise its dfl value, if any; - * - send the command to the device and check the reply. - * Return STAT_INSTCMD_INVALID if the command is invalid, STAT_INSTCMD_FAILED if it failed, STAT_INSTCMD_HANDLED on success. */ + /* Execute an instant command. Return STAT_INSTCMD_INVALID if the command is invalid, STAT_INSTCMD_FAILED if it failed, STAT_INSTCMD_HANDLED on success. */ int instcmd(const char *cmdname, const char *extradata); /* Set r/w variable to a value after it has been checked against its info_rw structure. Return STAT_SET_HANDLED on success, otherwise STAT_SET_UNKNOWN. */ int setvar(const char *varname, const char *val); @@ -169,18 +142,17 @@ int setvar(const char *varname, const char *val); * - 'flag': flags that have to be set in the item, i.e. if one of the flags is absent in the item it won't be returned * - 'noflag': flags that have to be absent in the item, i.e. if at least one of the flags is set in the item it won't be returned */ item_t *find_nut_info(const char *varname, const unsigned long flag, const unsigned long noflag); - /* Send 'command' (a null-terminated byte string) or, if it is NULL, send the command stored in the item to the UPS and process the reply, saving it in item->answer. Return -1 on errors, 0 on success. */ + /* Send 'command' or, if it is NULL, send the command stored in the item to the UPS and process the reply. Return -1 on errors, 0 on success. */ int qx_process(item_t *item, const char *command); - /* Process the value we got back from the UPS (set status bits and set the value of other parameters), calling the item-specific preprocess function, if any, otherwise executing the standard preprocessing (including trimming if QX_FLAG_TRIM is set). - * Return -1 on failure, 0 for a status update and 1 in all other cases. */ + /* Process the value we got back from the UPS (set status bits and set the value of other parameters), calling its preprocess function, if any. Return -1 on failure, 0 for a status update and 1 in all other cases. */ int ups_infoval_set(item_t *item); /* Return the currently processed status so that it can be checked with one of the status_bit_t passed to the STATUS() macro. */ -unsigned int qx_status(void); +int qx_status(void); /* Edit the current status: it takes one of the NUT status (all but OB are supported, simply set it as not OL), eventually preceded with an exclamation mark to clear it from the status (e.g. !OL). */ void update_status(const char *nutvalue); /* Data for processing status values */ -#define STATUS(x) ((unsigned int)1U< - * 2021 Ablerex Software - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" - -#include "nutdrv_qx_ablerex.h" - -#define ABLEREX_VERSION "Ablerex 0.01" - -static int Q5_Vbc = -1; -static int ablerexQ5Vb = -1; - -static int ablerex_Q5(item_t *item, char *value, const size_t valuelen) { -/* - int RawValue = 0; - - RawValue = (unsigned char)item->value[0] * 256 + (unsigned char)item->value[1]; -*/ - - //ablerexQ5Vb = (unsigned char)buf[7] * 256 + (unsigned char)buf[8]; - //Q5_Vbc = (unsigned char)buf[9] * 256 + (unsigned char)buf[10]; - upsdebugx(2, "Q51: %d %d %d %d %d %d", item->answer[0], item->answer[1], item->answer[2], item->answer[3], item->answer[4], item->answer[5]); - upsdebugx(2, "Q52: %d %d %d %d %d %d", item->answer[6], item->answer[7], item->answer[8], item->answer[9], item->answer[10], item->answer[11]); - upsdebugx(2, "Q53: %d %d %d %d", item->answer[12], item->answer[13], item->answer[14], item->answer[15]); - - int Q5_Fout = (unsigned char)item->answer[1] * 256 + (unsigned char)item->answer[2]; - int Q5_Vb = (unsigned char)item->answer[7] * 256 + (unsigned char)item->answer[8]; - Q5_Vbc = (unsigned char)item->answer[9] * 256 + (unsigned char)item->answer[10]; - //int Q5_InvW = (unsigned char)item->answer[11] * 256 + (unsigned char)item->answer[12]; - int Q5_Err = (unsigned char)item->answer[13] * 256 + (unsigned char)item->answer[14]; - int Q5_O_Cur = (unsigned char)item->answer[15] * 256 + (unsigned char)item->answer[16]; - - ablerexQ5Vb = Q5_Vb; - upsdebugx(2, "Q5: %.1f %d %.1f", 0.1 * Q5_Fout, Q5_Err, 0.1 * Q5_O_Cur); - upsdebugx(2, "Q5Vb: %d Vbc %d", Q5_Vb, Q5_Vbc); - dstate_setinfo("output.frequency", "%.1f", 0.1 * Q5_Fout); - dstate_setinfo("ups.alarm", "%d", Q5_Err); - dstate_setinfo("output.current", "%.1f", 0.1 * Q5_O_Cur); - - snprintf(value, valuelen, "%.1f", Q5_Fout * 0.1); - -/* - switch (item->from) - { - case 1: - snprintf(value, valuelen, "%.1f", RawValue * 0.1); - upsdebugx(2, "Q51: %.1f", 0.1*RawValue); - break; - case 13: - snprintf(value, valuelen, "%.0f", RawValue); - upsdebugx(2, "Q52: %.0f", 0.1*RawValue); - break; - case 15: - snprintf(value, valuelen, "%.1f", RawValue * 0.1); - upsdebugx(2, "Q53: %.1f", 0.1*RawValue); - break; - - default: - //Don't know what happened - return -1; - } -*/ - - return 0; -} - -static int ablerex_battery(item_t *item, char *value, const size_t valuelen) { - double BattV = 0.0; - BattV = strtod(item->value, NULL); - upsdebugx(2, "battvoltact2: %.2f", BattV); - if (!dstate_getinfo("battery.voltage.nominal")) - { - snprintf(value, valuelen, "%.2f", BattV); - return 0; - } - - double nomBattV = 0.0; - nomBattV = strtod(dstate_getinfo("battery.voltage.nominal"), NULL); - upsdebugx(2, "battvoltact1: %.2f", nomBattV); - //return 0; - - double battvoltact = 0.0; - - if (ablerexQ5Vb > 0) { - battvoltact = ablerexQ5Vb * nomBattV / 1200; - } else { - if (BattV > 3.0) { - battvoltact = BattV; - } else { - battvoltact = BattV * 6 * nomBattV / 12; - } - } - - snprintf(value, valuelen, "%.2f", battvoltact); - upsdebugx(2, "battvoltact: %.2f / %.2f", battvoltact, BattV); - - return 0; -} - -static int ablerex_battery_charge(double BattIn) -{ - const double onlineP[] = { - 2.22, 2.21, 2.20, 2.19, 2.18, 2.17, 2.16, 2.15, 2.14, 2.13, - 2.12, 2.11, 2.10, 2.09, 2.08, 2.07, 2.06, 2.05, 2.04, 2.03, - 2.02, 2.01, 2.00, 1.99, 1.98, 1.97, 1.96, 1.95, 1.94, 1.93, - 1.92, 1.91, 1.90, 1.89, 1.88, 1.87, 1.86, 1.85, 1.84, 1.83, - 1.82, 1.81, 1.80, 1.79, 1.78, 1.77, 1.76, 1.75, 1.74, 1.73, - 1.72, 1.71, 1.70, 1.69, 1.68, 1.67 - }; - const int onlineC[] = { - 100, 90, 88, 87, 85, 83, 82, 80, 78, 77, - 75, 73, 72, 70, 68, 65, 65, 62, 62, 58, - 58, 55, 55, 53, 52, 50, 48, 47, 45, 43, - 42, 40, 38, 37, 35, 33, 32, 30, 28, 27, - 25, 23, 22, 20, 18, 17, 15, 13, 12, 10, - 8, 7, 5, 3, 2, 0, -1 - }; - const double offlineP[] = { - 13.5, 13.3, 13.2, 13.1, 13, 12.9, 12.8, 12.7, 12.6, 12.5, - 12.4, 12.3, 12.2, 12.1, 12, 11.9, 11.8, 11.7, 11.6, 11.5, - 11.4, 11.3, 11.2, 11.1, 11, 10.9, 10.8, 10.7, 10.6, 10.5, - 10.4, 10.3, 10.2, 10.1, 10 - }; - const int offlineC[] = { - 100, 90, 88, 86, 83, 80, 77, 74, 72, 69, - 66, 63, 61, 58, 55, 52, 49, 47, 44, 41, - 38, 36, 33, 30, 27, 24, 22, 19, 16, 13, - 11, 8, 5, 2, 0, -1 - }; - - int charge = 0; - int i; - - if (BattIn < 3.0) { - for (i = 0; onlineC[i] > 0; i++) { - if (BattIn >= onlineP[i]) { - charge = onlineC[i]; - break; - } - } - } else { - //double nomBattV = strtod(dstate_getinfo("battery.voltage.nominal"), NULL); - //double battV = BattIn / (nomBattV / 12); - - for (i = 0; offlineC[i] > 0; i++) { - if (BattIn >= offlineP[i]) { - charge = offlineC[i]; - break; - } - } - } - return charge; -} - -static int ablerex_batterycharge(item_t *item, char *value, const size_t valuelen) { - double BattV = 0.0; - BattV = strtod(item->value, NULL); - upsdebugx(2, "battvoltc2: %.2f", BattV); - if (!dstate_getinfo("battery.voltage.nominal")) - { - snprintf(value, valuelen, "%d", 100); - return 0; - } - - double nomBattV = 0.0; - nomBattV = strtod(dstate_getinfo("battery.voltage.nominal"), NULL); - upsdebugx(2, "battvv1: %.2f", nomBattV); - //return 0; - - if (BattV > 3.0) { - BattV = BattV / (nomBattV / 12); - } - int BattP = ablerex_battery_charge(BattV); - //dstate_setinfo("battery.charge", "%.0f", BattP); - - snprintf(value, valuelen, "%d", BattP); - upsdebugx(2, "battcharge: %d", BattP); - - return 0; -} - -static int ablerex_initbattery(item_t *item, char *value, const size_t valuelen) { - - double nomBattV = strtod(dstate_getinfo("battery.voltage.nominal"), NULL); - double batthigh = 0.0; - double battlow = 0.0; - - if (Q5_Vbc > 0) { - battlow = Q5_Vbc * nomBattV / 1200; - } else { - battlow = 960 * nomBattV / 1200; - } - batthigh = 1365 * nomBattV / 1200; - - switch (item->from) - { - case 1: - snprintf(value, valuelen, "%.2f", battlow); - upsdebugx(2, "BattLow: %.2f", battlow); - break; - case 2: - snprintf(value, valuelen, "%.2f", batthigh); - upsdebugx(2, "BattHigh: %.2f", batthigh); - break; - - default: - /* Don't know what happened */ - return -1; - } - - return 0; -} - -static int ablerex_At(item_t *item, char *value, const size_t valuelen) { - int RawValue = 0; - - RawValue = (unsigned char)item->answer[1] * 65536 * 256 + (unsigned char)item->answer[2] * 65536 - + (unsigned char)item->answer[3] * 256 + (unsigned char)item->answer[4]; - - snprintf(value, valuelen, "%d", RawValue); - upsdebugx(2, "At: %d", RawValue); - - return 0; -} - -static int ablerex_TR(item_t *item, char *value, const size_t valuelen) { - char TR[8]; - - TR[0] = item->answer[1]; - TR[1] = item->answer[2]; - TR[2] = item->answer[3]; - TR[3] = item->answer[4]; - TR[4] = 0; - - snprintf(value, valuelen, "%s", TR); - upsdebugx(2, "At: %s", TR); - - return 0; -} - -static int ablerex_process_status_bits(item_t *item, char *value, const size_t valuelen) -{ - char *val = ""; - - switch (item->from) - { - case 40: /* Bypass/Boost or Buck Active */ - - if (item->value[0] == '1') { - - double vi, vo; - - vi = strtod(dstate_getinfo("input.voltage"), NULL); - vo = strtod(dstate_getinfo("output.voltage"), NULL); - - if (item->value[2] == '1') {/* UPS Type is Standby (0 is On_line) */ - if (vo < 0.5 * vi) { - upsdebugx(2, "%s: output voltage too low", __func__); - return -1; - } else if (vo < 0.95 * vi) { - status_set("TRIM"); - } else if (vo < 1.05 * vi) { - status_set("BYPASS"); - } else if (vo < 1.5 * vi) { - status_set("BOOST"); - } else { - upsdebugx(2, "%s: output voltage too high", __func__); - return -1; - } - } else { - status_set("BYPASS"); - } - } - - break; - - case 41: /* UPS Failed - ups.alarm */ - - if (item->value[0] == '1') { /* Battery abnormal */ - status_set("RB"); - } - - double vout = strtod(dstate_getinfo("output.voltage"), NULL); - - if (vout < 50.0) { - status_set("OFF"); - } - break; - - default: - /* Don't know what happened */ - return -1; - } - - snprintf(value, valuelen, "%s", val); - - return 0; -} - -/* qx2nut lookup table */ -static item_t ablerex_qx2nut[] = { - - /* - * > [Q1\r] - * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] - * 01234567890123456789012345678901234567890123456 - * 0 1 2 3 4 - */ - - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, ablerex_battery }, - { "battery.charge", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, ablerex_batterycharge }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, - /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 42, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, ablerex_process_status_bits }, /* Ablerex Bypass/Boost or Buck Active */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, ablerex_process_status_bits }, /* Ablerex UPS Failed */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ - - /* - * > [F\r] - * < [#220.0 000 024.0 50.0\r] - * 0123456789012345678901 - * 0 1 2 - */ - - { "output.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "output.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "output.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "battery.voltage.low", 0, NULL, "F\r", "", 22, '#', "", 1, 2, "%.2f", QX_FLAG_QUICK_POLL, NULL, NULL, ablerex_initbattery }, - { "battery.voltage.high", 0, NULL, "F\r", "", 22, '#', "", 2, 3, "%.2f", QX_FLAG_QUICK_POLL, NULL, NULL, ablerex_initbattery }, - - /* Ablerex */ - { "output.frequency", 0, NULL, "Q5\r", "", 22, '(', "", 1, 18, "%.1f", 0, NULL, NULL, ablerex_Q5 }, - { "battery.runtime", 0, NULL, "At\r", "", 0, '(', "", 0, 0, "%d", 0, NULL, NULL, ablerex_At }, - //{ "ups.alarm", 0, NULL, "Q5\r", "", 22, '(', "", 1, 14, "%.0f", 0, QX_FLAG_QUICK_POLL, NULL, ablerex_Q5 }, - { "ups.test.result", 0, NULL, "TR\r", "", 0, '#', "", 0, 0, "%s", 0, NULL, NULL, ablerex_TR }, - //{ "output.current", 0, NULL, "Q5\r", "", 22, '(', "", 1, 16, "%.1f", 0, QX_FLAG_QUICK_POLL, NULL, ablerex_Q5 }, - - /* - * > [I\r] - * < [#------------- ------ VT12046Q \r] - * 012345678901234567890123456789012345678 - * 0 1 2 3 - */ - - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - - /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S.2\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - -/* Testing table */ -#ifdef TESTING -static testing_t ablerex_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - -/* Subdriver-specific initups */ -static void ablerex_initups(void) -{ - blazer_initups(ablerex_qx2nut); -} - -/* Subdriver interface */ -subdriver_t ablerex_subdriver = { - ABLEREX_VERSION, - blazer_claim, - ablerex_qx2nut, - ablerex_initups, - NULL, - blazer_makevartable, - "ACK", - NULL, -#ifdef TESTING - ablerex_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_ablerex.h b/drivers/nutdrv_qx_ablerex.h deleted file mode 100755 index 33c79c2..0000000 --- a/drivers/nutdrv_qx_ablerex.h +++ /dev/null @@ -1,30 +0,0 @@ -/* nutdrv_qx_ablerex.h - Subdriver for Ablerex Qx protocol based UPSes - * - * Copyright (C) - * 2013 Daniele Pezzini - * 2021 Ablerex Software - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_ABLEREX_H -#define NUTDRV_QX_ABLEREX_H - -#include "nutdrv_qx.h" - -extern subdriver_t ablerex_subdriver; - -#endif /* NUTDRV_QX_ABLEREX_H */ diff --git a/drivers/nutdrv_qx_bestups.c b/drivers/nutdrv_qx_bestups.c deleted file mode 100644 index adc102f..0000000 --- a/drivers/nutdrv_qx_bestups.c +++ /dev/null @@ -1,803 +0,0 @@ -/* nutdrv_qx_bestups.c - Subdriver for Best Power/Sola Australia UPSes - * - * Copyright (C) - * 2014 Daniele Pezzini - * Based on: - * bestups.c - Copyright (C) - * 1999 Russell Kroll - * Jason White - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nut_float.h" -#include "nut_stdint.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" -#include "nutdrv_qx_bestups.h" - -#define BESTUPS_VERSION "BestUPS 0.06" - -/* Support functions */ -static int bestups_claim(void); -static void bestups_initups(void); -static void bestups_makevartable(void); - -/* Answer preprocess functions */ -static int bestups_preprocess_id_answer(item_t *item, const int len); - -/* Preprocess functions */ -static int bestups_process_setvar(item_t *item, char *value, const size_t valuelen); -static int bestups_process_bbb_status_bit(item_t *item, char *value, const size_t valuelen); -static int bestups_manufacturer(item_t *item, char *value, const size_t valuelen); -static int bestups_model(item_t *item, char *value, const size_t valuelen); -static int bestups_batt_runtime(item_t *item, char *value, const size_t valuelen); -static int bestups_batt_packs(item_t *item, char *value, const size_t valuelen); -static int bestups_get_pins_shutdown_mode(item_t *item, char *value, const size_t valuelen); -static int bestups_voltage_settings(item_t *item, char *value, const size_t valuelen); - -/* ups.conf settings */ -static int pins_shutdown_mode; - -/* General settings */ -static int inverted_bbb_bit = 0; - - -/* == Ranges/enums == */ - -/* Range for ups.delay.start */ -static info_rw_t bestups_r_ondelay[] = { - { "60", 0 }, - { "599940", 0 }, - { "", 0 } -}; - -/* Range for ups.delay.shutdown */ -static info_rw_t bestups_r_offdelay[] = { - { "12", 0 }, - { "5940", 0 }, - { "", 0 } -}; - -/* Range for number of battery packs */ -static info_rw_t bestups_r_batt_packs[] = { - { "0", 0 }, - { "5", 0 }, - { "", 0 } -}; - -/* Range for pin shutdown mode */ -static info_rw_t bestups_r_pins_shutdown_mode[] = { - { "0", 0 }, - { "6", 0 }, - { "", 0 } -}; - - -/* == qx2nut lookup table == */ -static item_t bestups_qx2nut[] = { - - /* Query UPS for status - * > [Q1\r] - * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] - * 01234567890123456789012345678901234567890123456 - * 0 1 2 3 4 - */ - - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, - /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ -/* { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, *//* Beeper status: not supported; always 0 */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, bestups_process_bbb_status_bit }, /* Bypass/Boost or Buck Active - keep this one at the end as it needs the processed data from the previous items */ - - /* Query UPS for ratings and model infos - * > [ID\r] - * < [FOR,750,120,120,20.0,27.6\r] case #1: length = 26 - * < [FOR,1500,120,120,20.0,27.6\r] case #2: length = 27 - * < [FOR,3000,120,120,20.0,100.6\r] case #3: length = 28 - * < [FOR, 750,120,120,20.0, 27.6\r] after being preprocessed: length = 28 - * 0123456789012345678901234567 - * 0 1 2 - */ - - { "device.mfr", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, bestups_manufacturer }, - { "device.model", 0, NULL, "ID\r", "", 28, 0, "", 0, 2, "%s", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, bestups_model }, - { "ups.power.nominal", 0, NULL, "ID\r", "", 28, 0, "", 4, 7, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL }, - { "input.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 9, 11, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL }, - { "output.voltage.nominal", 0, NULL, "ID\r", "", 28, 0, "", 13, 15, "%.0f", QX_FLAG_STATIC, NULL, bestups_preprocess_id_answer, NULL }, - { "battery.voltage.low", 0, NULL, "ID\r", "", 28, 0, "", 17, 20, "%.1f", QX_FLAG_SEMI_STATIC, NULL, bestups_preprocess_id_answer, NULL }, - { "battery.voltage.high", 0, NULL, "ID\r", "", 28, 0, "", 22, 26, "%.1f", QX_FLAG_SEMI_STATIC, NULL, bestups_preprocess_id_answer, NULL }, - - /* Query UPS for battery runtime (not available on the Patriot Pro/Sola 320 model series) - * > [RT\r] - * < [025\r] - * 0123 - * 0 - */ - - { "battery.runtime", 0, NULL, "RT\r", "", 4, 0, "", 0, 2, "%.0f", QX_FLAG_SKIP, NULL, NULL, bestups_batt_runtime }, - - /* Query UPS for number of battery packs (available only on the Axxium/Sola 620 model series) - * > [BP?\r] - * < [02\r] - * 012 - * 0 - */ - - { "battery.packs", ST_FLAG_RW, bestups_r_batt_packs, "BP?\r", "", 3, 0, "", 0, 1, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, bestups_batt_packs }, - - /* Set number of battery packs to n (integer, 0-5) (available only on the Axxium/Sola 620 model series) - * > [BPn\r] - * < [] - */ - - { "battery.packs", 0, bestups_r_batt_packs, "BP%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, bestups_process_setvar }, - - /* Query UPS for shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power's EPS-0059) - * > [SS?\r] - * < [0\r] - * 01 - * 0 - */ - - { "pins_shutdown_mode", ST_FLAG_RW, bestups_r_pins_shutdown_mode, "SS?\r", "", 2, 0, "", 0, 0, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, NULL, bestups_get_pins_shutdown_mode }, - - /* Set shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power's EPS-0059) to n (integer, 0-6) - * > [SSn\r] - * < [] - */ - - { "pins_shutdown_mode", 0, bestups_r_pins_shutdown_mode, "SS%.0f\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, bestups_process_setvar }, - - /* Query UPS for voltage settings - * > [M\r] - * < [0\r] - * 01 - * 0 - */ - - { "input.transfer.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.transfer.boost.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.transfer.boost.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "output.voltage.nominal", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.transfer.trim.low", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.transfer.trim.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - { "input.transfer.high", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "%d", 0, NULL, NULL, bestups_voltage_settings }, - - /* Instant commands */ - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, bestups_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, bestups_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - - -/* == Testing table == */ -#ifdef TESTING -static testing_t bestups_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00100000\r", -1 }, - { "ID\r", "FOR,750,120,120,20.0,27.6\r", -1 }, - { "RT\r", "015\r", -1 }, - { "BP?\r", "02\r", -1 }, - { "BP1\r", "", -1 }, - { "SS?\r", "0\r", -1 }, - { "SS2\r", "", -1 }, - { "M\r", "0\r", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0001\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - - -/* == Support functions == */ - -/* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -static int bestups_claim(void) -{ - /* We need at least Q1 and ID to run this subdriver */ - - item_t *item = find_nut_info("input.voltage", 0, 0); - - /* Don't know what happened */ - if (!item) - return 0; - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) - return 0; - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) - return 0; - - /* UPS Model */ - item = find_nut_info("device.model", 0, 0); - - /* Don't know what happened */ - if (!item) { - dstate_delinfo("input.voltage"); - return 0; - } - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) { - dstate_delinfo("input.voltage"); - return 0; - } - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) { - dstate_delinfo("input.voltage"); - return 0; - } - - return 1; -} - -/* Subdriver-specific initups */ -static void bestups_initups(void) -{ - blazer_initups_light(bestups_qx2nut); -} - -/* Subdriver-specific flags/vars */ -static void bestups_makevartable(void) -{ - addvar(VAR_VALUE, "pins_shutdown_mode", "Set shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power's EPS-0059) to n (integer, 0-6)"); - - blazer_makevartable_light(); -} - - -/* == Answer preprocess functions == */ - -/* Preprocess the answer we got back from the UPS when queried with 'ID\r': make data begin always at the same indexes */ -static int bestups_preprocess_id_answer(item_t *item, const int len) -{ - int i; - char refined[SMALLBUF] = "", - rawval[SMALLBUF] = "", - *token, - *saveptr = NULL; - - if (len <= 0) - return len; - - if (len < 25 || len > 27) { - upsdebugx(4, "%s: wrong length [%s: %d]", __func__, item->info_type, len); - return -1; - } - - /* e.g.: - * 1. item->answer = "FOR,750,120,120,20.0,27.6\r"; len = 26 - * 2. item->answer = "FOR,1500,120,120,20.0,27.6\r"; len = 27 - * 3. item->answer = "FOR,3000,120,120,20.0,100.6\r"; len = 28 */ - upsdebugx(4, "read: '%.*s'", (int)strcspn(item->answer, "\r"), item->answer); - - snprintf(rawval, sizeof(rawval), "%s", item->answer); - - for (i = 1, token = strtok_r(rawval, ",", &saveptr); token != NULL; i++, token = strtok_r(NULL, ",", &saveptr)) { - - switch (i) - { - case 1: - snprintf(refined, sizeof(refined), "%s", token); - continue; - case 2: /* Output power */ - snprintfcat(refined, sizeof(refined), ",%4s", token); - continue; - case 6: /* Battery voltage at full charge (+ trailing CR) */ - snprintfcat(refined, sizeof(refined), ",%6s", token); - continue; - default: - snprintfcat(refined, sizeof(refined), ",%s", token); - } - - } - - if (i != 7 || strlen(refined) != 28) { - upsdebugx(2, "noncompliant reply: '%.*s'", (int)strcspn(refined, "\r"), refined); - return -1; - } - - upsdebugx(4, "read: '%.*s'", (int)strcspn(refined, "\r"), refined); - - /* e.g.: item->answer = "FOR, 750,120,120,20.0, 27.6\r"; len = 28 */ - return snprintf(item->answer, sizeof(item->answer), "%s", refined); -} - - -/* == Preprocess functions == */ - -/* *SETVAR(/NONUT)* Preprocess setvars */ -static int bestups_process_setvar(item_t *item, char *value, const size_t valuelen) -{ - if (!strlen(value)) { - upsdebugx(2, "%s: value not given for %s", __func__, item->info_type); - return -1; - } - - double val = strtod(value, NULL); - - if (!strcasecmp(item->info_type, "pins_shutdown_mode")) { - - if (d_equal(val, pins_shutdown_mode)) { - upslogx(LOG_INFO, "%s is already set to %.0f", item->info_type, val); - return -1; - } - - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->command, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Bypass/Boost or Buck status */ -static int bestups_process_bbb_status_bit(item_t *item, char *value, const size_t valuelen) -{ - /* Bypass/Boost/Buck bit is not reliable when a battery test, shutdown or on battery condition occurs: always ignore it in these cases */ - if (!((unsigned int)(qx_status()) & STATUS(OL)) || ((unsigned int)(qx_status()) & (STATUS(CAL) | STATUS(FSD)))) { - - if (item->value[0] == '1') - item->value[0] = '0'; - - return blazer_process_status_bits(item, value, valuelen); - - } - - /* UPSes with inverted bypass/boost/buck bit */ - if (inverted_bbb_bit) { - - if (item->value[0] == '1') - item->value[0] = '0'; - - else if (item->value[0] == '0') - item->value[0] = '1'; - - } - - return blazer_process_status_bits(item, value, valuelen); -} - -/* Identify UPS manufacturer */ -static int bestups_manufacturer(item_t *item, char *value, const size_t valuelen) -{ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - - /* Best Power devices */ - if ( - !strcmp(item->value, "AX1") || - !strcmp(item->value, "FOR") || - !strcmp(item->value, "FTC") || - !strcmp(item->value, "PR2") || - !strcmp(item->value, "PRO") - ) { - snprintf(value, valuelen, item->dfl, "Best Power"); - return 0; - } - - /* Sola Australia devices */ - if ( - !strcmp(item->value, "325") || - !strcmp(item->value, "520") || - !strcmp(item->value, "620") - ) { - snprintf(value, valuelen, item->dfl, "Sola Australia"); - return 0; - } - - /* Unknown devices */ - snprintf(value, valuelen, item->dfl, "Unknown"); - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Identify UPS model and unskip qx2nut table's items accordingly */ -static int bestups_model(item_t *item, char *value, const size_t valuelen) -{ - item_t *unskip; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - - /* Best Power devices */ - - if (!strcmp(item->value, "AX1")) { - - snprintf(value, valuelen, item->dfl, "Axxium Rackmount"); - - } else if (!strcmp(item->value, "FOR")) { - - snprintf(value, valuelen, item->dfl, "Fortress"); - - } else if (!strcmp(item->value, "FTC")) { - - snprintf(value, valuelen, item->dfl, "Fortress Telecom"); - - } else if (!strcmp(item->value, "PR2")) { - - snprintf(value, valuelen, item->dfl, "Patriot Pro II"); - inverted_bbb_bit = 1; - - } else if (!strcmp(item->value, "PRO")) { - - snprintf(value, valuelen, item->dfl, "Patriot Pro"); - inverted_bbb_bit = 1; - - /* Sola Australia devices */ - } else if ( - !strcmp(item->value, "320") || - !strcmp(item->value, "325") || - !strcmp(item->value, "520") || - !strcmp(item->value, "525") || - !strcmp(item->value, "620") - ) { - - snprintf(value, valuelen, "Sola %s", item->value); - - /* Unknown devices */ - } else { - - snprintf(value, valuelen, item->dfl, "Unknown (%s)", item->value); - upslogx(LOG_INFO, "Unknown model detected - please report this ID: '%s'", item->value); - - } - - /* Unskip qx2nut table's items according to the UPS model */ - - /* battery.runtime var is not available on the Patriot Pro/Sola 320 model series: leave it skipped in these cases, otherwise unskip it */ - if (strcmp(item->value, "PRO") && strcmp(item->value, "320")) { - - unskip = find_nut_info("battery.runtime", 0, 0); - - /* Don't know what happened */ - if (!unskip) - return -1; - - unskip->qxflags &= ~QX_FLAG_SKIP; - - } - - /* battery.packs var is available only on the Axxium/Sola 620 model series: unskip it in these cases */ - if (!strcmp(item->value, "AX1") || !strcmp(item->value, "620")) { - - unskip = find_nut_info("battery.packs", 0, QX_FLAG_SETVAR); - - /* Don't know what happened */ - if (!unskip) - return -1; - - unskip->qxflags &= ~QX_FLAG_SKIP; - - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Battery runtime */ -static int bestups_batt_runtime(item_t *item, char *value, const size_t valuelen) -{ - double runtime; - - if (strspn(item->value, "0123456789 .") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - /* Battery runtime is reported by the UPS in minutes, NUT expects seconds */ - runtime = strtod(item->value, NULL) * 60; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, runtime); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Battery packs */ -static int bestups_batt_packs(item_t *item, char *value, const size_t valuelen) -{ - item_t *unskip; - - if (strspn(item->value, "0123456789 ") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, strtol(item->value, NULL, 10)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - /* Unskip battery.packs setvar */ - unskip = find_nut_info("battery.packs", QX_FLAG_SETVAR, 0); - - /* Don't know what happened */ - if (!unskip) - return -1; - - unskip->qxflags &= ~QX_FLAG_SKIP; - - return 0; -} - -/* *NONUT* Get shutdown mode functionality of Pin 1 and Pin 7 on the UPS DB9 communication port (Per Best Power's EPS-0059) as set in the UPS */ -static int bestups_get_pins_shutdown_mode(item_t *item, char *value, const size_t valuelen) -{ - item_t *unskip; - long l; - - if (strspn(item->value, "0123456789") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - l = strtol(item->value, NULL, 10); - if (l > INT_MAX) { - upsdebugx(2, "%s: pins_shutdown_mode out of range [%s: %s]", - __func__, item->info_type, item->value); - return -1; - } - pins_shutdown_mode = (int)l; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, pins_shutdown_mode); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - /* We were not asked by the user to change the value */ - if ((item->qxflags & QX_FLAG_NONUT) && !getval(item->info_type)) - return 0; - - /* Unskip setvar */ - unskip = find_nut_info(item->info_type, QX_FLAG_SETVAR, 0); - - /* Don't know what happened */ - if (!unskip) - return -1; - - unskip->qxflags &= ~QX_FLAG_SKIP; - - return 0; -} - -/* Voltage settings */ -static int bestups_voltage_settings(item_t *item, char *value, const size_t valuelen) -{ - long index; - int val; - const char *nominal_voltage; - const struct { - const int low; /* Low voltage -> input.transfer.low / input.transfer.boost.low */ - const int boost; /* Boost voltage -> input.transfer.boost.high */ - const int nominal; /* Nominal voltage -> input.voltage.nominal / output.voltage.nominal */ - const int buck; /* Buck voltage -> input.transfer.trim.low */ - const int high; /* High voltage -> input.transfer.high / input.transfer.trim.high */ - } voltage_settings[] = { - /* U models voltage limits, for: - * - Fortress (750U, 1050U, 1425U, 1800U and 2250U) - * - Fortress Rackmount (750, 1050, 1425, 1800, and 2250 VA) - * - Patriot Pro II (400U, 750U, and 1000U) */ - /* M low boost nominal buck high */ - /* 0 */ { 96, 109, 120, 130, 146 }, /* LEDs lit: 2,3,4 (Default) */ - /* 1 */ { 96, 109, 120, 138, 156 }, /* LEDs lit: 1,3,4 */ - /* 2 */ { 90, 104, 120, 130, 146 }, /* LEDs lit: 2,3,5 */ - /* 3 */ { 90, 104, 120, 138, 156 }, /* LEDs lit: 1,3,5 */ - /* 4 */ { 90, 104, 110, 120, 130 }, /* LEDs lit: 3,4,5 */ - /* 5 */ { 90, 104, 110, 130, 146 }, /* LEDs lit: 2,4,5 */ - /* 6 */ { 90, 96, 110, 120, 130 }, /* LEDs lit: 3,4,6 */ - /* 7 */ { 90, 96, 110, 130, 146 }, /* LEDs lit: 2,4,6 */ - /* 8 */ { 96, 109, 128, 146, 156 }, /* LEDs lit: 1,2,4 */ - /* 9 */ { 90, 104, 128, 146, 156 }, /* LEDs lit: 1,2,5 */ - - /* E models voltage limits, for: - * - Fortress (750E, 1050E, 1425E, and 2250E) - * - Fortress Rackmount (750, 1050, 1425, and 2250 VA) - * - Patriot Pro II (400E, 750E, and 1000E) */ - /* M low boost nominal buck high */ - /* 0 */ { 200, 222, 240, 250, 284 }, /* LEDs lit: 2,3,4 */ - /* 1 */ { 200, 222, 240, 264, 290 }, /* LEDs lit: 1,3,4 */ - /* 2 */ { 188, 210, 240, 250, 284 }, /* LEDs lit: 2,3,5 */ - /* 3 */ { 188, 210, 240, 264, 290 }, /* LEDs lit: 1,3,5 */ - /* 4 */ { 188, 210, 230, 244, 270 }, /* LEDs lit: 3,4,5 (Default) */ - /* 5 */ { 188, 210, 230, 250, 284 }, /* LEDs lit: 2,4,5 */ - /* 6 */ { 180, 200, 230, 244, 270 }, /* LEDs lit: 3,4,6 */ - /* 7 */ { 180, 200, 230, 250, 284 }, /* LEDs lit: 2,4,6 */ - /* 8 */ { 165, 188, 208, 222, 244 }, /* LEDs lit: 4,5,6 */ - /* 9 */ { 165, 188, 208, 244, 270 } /* LEDs lit: 3,5,6 */ - }; - - if (strspn(item->value, "0123456789") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - index = strtol(item->value, NULL, 10); - - if (index < 0 || index > 9) { - upsdebugx(2, "%s: value '%ld' out of range [0..9]", __func__, index); - return -1; - } - - nominal_voltage = dstate_getinfo("input.voltage.nominal"); - - if (!nominal_voltage) - nominal_voltage = dstate_getinfo("output.voltage.nominal"); - - if (!nominal_voltage) { - upsdebugx(2, "%s: unable to get nominal voltage", __func__); - return -1; - } - - /* E models */ - if (strtol(nominal_voltage, NULL, 10) > 160) - index += 10; - - if (!strcasecmp(item->info_type, "input.transfer.low") || !strcasecmp(item->info_type, "input.transfer.boost.low")) { - - val = voltage_settings[index].low; - - } else if (!strcasecmp(item->info_type, "input.transfer.boost.high")) { - - val = voltage_settings[index].boost; - - } else if (!strcasecmp(item->info_type, "input.voltage.nominal") || !strcasecmp(item->info_type, "output.voltage.nominal")) { - - val = voltage_settings[index].nominal; - - } else if (!strcasecmp(item->info_type, "input.transfer.trim.low")) { - - val = voltage_settings[index].buck; - - } else if (!strcasecmp(item->info_type, "input.transfer.trim.high") || !strcasecmp(item->info_type, "input.transfer.high")) { - - val = voltage_settings[index].high; - - } else { - - /* Don't know what happened */ - return -1; - - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - - -/* == Subdriver interface == */ -subdriver_t bestups_subdriver = { - BESTUPS_VERSION, - bestups_claim, - bestups_qx2nut, - bestups_initups, - NULL, - bestups_makevartable, - NULL, - NULL, -#ifdef TESTING - bestups_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_bestups.h b/drivers/nutdrv_qx_bestups.h deleted file mode 100644 index 4f1e560..0000000 --- a/drivers/nutdrv_qx_bestups.h +++ /dev/null @@ -1,29 +0,0 @@ -/* nutdrv_qx_bestups.h - Subdriver for Best Power/Sola Australia UPSes - * - * Copyright (C) - * 2014 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_BESTUPS_H -#define NUTDRV_QX_BESTUPS_H - -#include "nutdrv_qx.h" - -extern subdriver_t bestups_subdriver; - -#endif /* NUTDRV_QX_BESTUPS_H */ diff --git a/drivers/nutdrv_qx_blazer-common.c b/drivers/nutdrv_qx_blazer-common.c index 2ff16bc..950dfc8 100644 --- a/drivers/nutdrv_qx_blazer-common.c +++ b/drivers/nutdrv_qx_blazer-common.c @@ -1,4 +1,4 @@ -/* nutdrv_qx_blazer-common.c - Common functions/settings for nutdrv_qx_{mecer,megatec,megatec-old,mustek,q1,voltronic-qs,zinto}.{c,h} +/* nutdrv_qx_blazer-common.c - Common functions/settings for nutdrv_qx_{mecer,megatec,megatec-old,mustek,zinto}.{c,h} * * Copyright (C) * 2013 Daniele Pezzini @@ -42,8 +42,8 @@ info_rw_t blazer_r_offdelay[] = { /* == Support functions == */ /* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -int blazer_claim(void) -{ +int blazer_claim(void) { + /* To tell whether the UPS is supported or not, we'll check both status (Q1/QS/D) and vendor (I/FW?) - provided that we were not told not to do it with the ups.conf flag 'novendor'. */ item_t *item = find_nut_info("input.voltage", 0, 0); @@ -85,29 +85,7 @@ int blazer_claim(void) } return 1; -} -/* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. - * NOTE: this 'light' version only checks for status (Q1/QS/D/..) */ -int blazer_claim_light(void) -{ - /* To tell whether the UPS is supported or not, we'll check just status (Q1/QS/D/..). */ - - item_t *item = find_nut_info("input.voltage", 0, 0); - - /* Don't know what happened */ - if (!item) - return 0; - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) - return 0; - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) - return 0; - - return 1; } /* Subdriver-specific flags/vars */ @@ -115,28 +93,18 @@ void blazer_makevartable(void) { addvar(VAR_FLAG, "norating", "Skip reading rating information from UPS"); addvar(VAR_FLAG, "novendor", "Skip reading vendor information from UPS"); - - blazer_makevartable_light(); -} - -/* Subdriver-specific flags/vars - * NOTE: this 'light' version only handles vars/flags related to UPS status query (Q1/QS/D/...) */ -void blazer_makevartable_light(void) -{ - addvar(VAR_FLAG, "ignoresab", "Ignore 'Shutdown Active' bit in UPS status"); } /* Subdriver-specific initups */ void blazer_initups(item_t *qx2nut) { - int nr, nv, isb; + int nr, nv; item_t *item; nr = testvar("norating"); nv = testvar("novendor"); - isb = testvar("ignoresab"); - if (!nr && !nv && !isb) + if (!nr && !nv) return; for (item = qx2nut; item->info_type != NULL; item++) { @@ -156,40 +124,13 @@ void blazer_initups(item_t *qx2nut) item->qxflags |= QX_FLAG_SKIP; } - /* ignoresab */ - if (isb && !strcasecmp(item->info_type, "ups.status") && item->from == 44 && item->to == 44) { - upsdebugx(2, "%s: skipping %s ('Shutdown Active' bit)", __func__, item->info_type); - item->qxflags |= QX_FLAG_SKIP; - } - - } -} - -/* Subdriver-specific initups - * NOTE: this 'light' version only checks for status (Q1/QS/D/..) related items */ -void blazer_initups_light(item_t *qx2nut) -{ - item_t *item; - - if (!testvar("ignoresab")) - return; - - for (item = qx2nut; item->info_type != NULL; item++) { - - if (strcasecmp(item->info_type, "ups.status") || item->from != 44 || item->to != 44) - continue; - - upsdebugx(2, "%s: skipping %s ('Shutdown Active' bit)", __func__, item->info_type); - item->qxflags |= QX_FLAG_SKIP; - break; - } } /* == Preprocess functions == */ /* Preprocess setvars */ -int blazer_process_setvar(item_t *item, char *value, const size_t valuelen) +int blazer_process_setvar(item_t *item, char *value, size_t valuelen) { if (!strlen(value)) { upsdebugx(2, "%s: value not given for %s", __func__, item->info_type); @@ -198,27 +139,16 @@ int blazer_process_setvar(item_t *item, char *value, const size_t valuelen) if (!strcasecmp(item->info_type, "ups.delay.start")) { - long ondelay = strtol(value, NULL, 10); - - if (ondelay < 0) { - upslogx(LOG_ERR, "%s: ondelay '%ld' should not be negative", - item->info_type, ondelay); - return -1; - } + int ondelay = strtol(value, NULL, 10); /* Truncate to minute */ ondelay -= (ondelay % 60); - snprintf(value, valuelen, "%ld", ondelay); + + snprintf(value, valuelen, "%d", ondelay); } else if (!strcasecmp(item->info_type, "ups.delay.shutdown")) { - long offdelay = strtol(value, NULL, 10); - - if (offdelay < 0) { - upslogx(LOG_ERR, "%s: offdelay '%ld' should not be negative", - item->info_type, offdelay); - return -1; - } + int offdelay = strtol(value, NULL, 10); /* Truncate to nearest settable value */ if (offdelay < 60) { @@ -227,7 +157,7 @@ int blazer_process_setvar(item_t *item, char *value, const size_t valuelen) offdelay -= (offdelay % 60); } - snprintf(value, valuelen, "%ld", offdelay); + snprintf(value, valuelen, "%d", offdelay); } else { @@ -240,18 +170,8 @@ int blazer_process_setvar(item_t *item, char *value, const size_t valuelen) } /* Preprocess instant commands */ -int blazer_process_command(item_t *item, char *value, const size_t valuelen) +int blazer_process_command(item_t *item, char *value, size_t valuelen) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - if (!strcasecmp(item->info_type, "shutdown.return")) { /* Sn: Shutdown after n minutes and then turn on when mains is back @@ -263,43 +183,25 @@ int blazer_process_command(item_t *item, char *value, const size_t valuelen) * The fix is to push the return value up by 2, i.e. S01R0003, and it will return online properly. * (thus the default of ondelay=3 mins) */ - long offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10), - ondelay = strtol(dstate_getinfo("ups.delay.start"), NULL, 10) / 60; + int offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10), + ondelay = strtol(dstate_getinfo("ups.delay.start"), NULL, 10) / 60; char buf[SMALLBUF] = ""; - if (ondelay <= 0) { - - if (offdelay < 0) { - upslogx(LOG_ERR, "%s: offdelay '%ld' should not be negative", - item->info_type, offdelay); - return -1; - } + if (ondelay == 0) { if (offdelay < 60) { - snprintf(buf, sizeof(buf), ".%ld", offdelay / 6); + snprintf(buf, sizeof(buf), ".%d", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "%02ld", offdelay / 60); + snprintf(buf, sizeof(buf), "%02d", offdelay / 60); } } else if (offdelay < 60) { - if (offdelay < 0) { - upslogx(LOG_ERR, "%s: offdelay '%ld' should not be negative", - item->info_type, offdelay); - return -1; - } - - snprintf(buf, sizeof(buf), ".%ldR%04ld", offdelay / 6, ondelay); + snprintf(buf, sizeof(buf), ".%dR%04d", offdelay / 6, ondelay); } else { - if (offdelay < 0) { - upslogx(LOG_ERR, "%s: offdelay '%ld' should not be negative", - item->info_type, offdelay); - return -1; - } - - snprintf(buf, sizeof(buf), "%02ldR%04ld", offdelay / 60, ondelay); + snprintf(buf, sizeof(buf), "%02dR%04d", offdelay / 60, ondelay); } @@ -311,29 +213,23 @@ int blazer_process_command(item_t *item, char *value, const size_t valuelen) * Shutdown after n minutes and stay off * Accepted values for n: .2 -> .9 , 01 -> 10 */ - long offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10); + int offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10); char buf[SMALLBUF] = ""; - if (offdelay < 0) { - upslogx(LOG_ERR, "%s: offdelay '%ld' should not be negative", - item->info_type, offdelay); - return -1; - } - if (offdelay < 60) { - snprintf(buf, sizeof(buf), ".%ld", offdelay / 6); + snprintf(buf, sizeof(buf), ".%d", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "%02ld", offdelay / 60); + snprintf(buf, sizeof(buf), "%02d", offdelay / 60); } snprintf(value, valuelen, item->command, buf); } else if (!strcasecmp(item->info_type, "test.battery.start")) { - long delay = strlen(value) > 0 ? strtol(value, NULL, 10) : 600; + int delay = strlen(value) > 0 ? strtol(value, NULL, 10) : 600; if ((delay < 60) || (delay > 5940)) { - upslogx(LOG_ERR, "%s: battery test time '%ld' out of range [60..5940] seconds", item->info_type, delay); + upslogx(LOG_ERR, "%s: battery test time '%d' out of range [60..5940] seconds", item->info_type, delay); return -1; } @@ -348,15 +244,11 @@ int blazer_process_command(item_t *item, char *value, const size_t valuelen) } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - return 0; } /* Process status bits */ -int blazer_process_status_bits(item_t *item, char *value, const size_t valuelen) +int blazer_process_status_bits(item_t *item, char *value, size_t valuelen) { char *val = ""; @@ -434,10 +326,14 @@ int blazer_process_status_bits(item_t *item, char *value, const size_t valuelen) case 44: /* Shutdown Active */ - if (item->value[0] == '1') - val = "FSD"; - else + if (item->value[0] == '1') { + if (!strcasecmp(item->info_type, "ups.status")) + val = "FSD"; + else /* ups.alarm */ + val = "Shutdown imminent!"; + } else if (!strcasecmp(item->info_type, "ups.status")) { val = "!FSD"; + } break; case 45: /* Beeper status - ups.beeper.status */ diff --git a/drivers/nutdrv_qx_blazer-common.h b/drivers/nutdrv_qx_blazer-common.h index c331599..ec5fb5c 100644 --- a/drivers/nutdrv_qx_blazer-common.h +++ b/drivers/nutdrv_qx_blazer-common.h @@ -1,4 +1,4 @@ -/* nutdrv_qx_blazer-common.h - Common functions/settings for nutdrv_qx_{mecer,megatec,megatec-old,mustek,q1,voltronic-qs,zinto}.{c,h} +/* nutdrv_qx_blazer-common.h - Common functions/settings for nutdrv_qx_{mecer,megatec,megatec-old,mustek,zinto}.{c,h} * * Copyright (C) * 2013 Daniele Pezzini @@ -26,16 +26,13 @@ /* Support functions */ void blazer_makevartable(void); -void blazer_makevartable_light(void); void blazer_initups(item_t *qx2nut); -void blazer_initups_light(item_t *qx2nut); int blazer_claim(void); -int blazer_claim_light(void); /* Preprocess functions */ -int blazer_process_command(item_t *item, char *value, const size_t valuelen); -int blazer_process_setvar(item_t *item, char *value, const size_t valuelen); -int blazer_process_status_bits(item_t *item, char *value, const size_t valuelen); +int blazer_process_command(item_t *item, char *value, size_t valuelen); +int blazer_process_setvar(item_t *item, char *value, size_t valuelen); +int blazer_process_status_bits(item_t *item, char *value, size_t valuelen); /* Ranges */ extern info_rw_t blazer_r_ondelay[]; diff --git a/drivers/nutdrv_qx_hunnox.c b/drivers/nutdrv_qx_hunnox.c deleted file mode 100644 index f104479..0000000 --- a/drivers/nutdrv_qx_hunnox.c +++ /dev/null @@ -1,138 +0,0 @@ -/* nutdrv_qx_hunnox.c - Subdriver for Hunnox protocol based UPSes - * - * Copyright (C) - * 2013 Daniele Pezzini - * 2020 Mariano Jan https://marianojan.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" - -#include "nutdrv_qx_hunnox.h" - -#define HUNNOX_VERSION "Hunnox 0.01" - -/* qx2nut lookup table */ -static item_t hunnox_qx2nut[] = { - - /* - * > [Q1\r] - * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] - * 01234567890123456789012345678901234567890123456 - * 0 1 2 3 4 - */ - - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", QX_FLAG_QUICK_POLL, NULL, NULL, NULL }, - /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ - - /* - * > [F\r] - * < [#220.0 000 024.0 50.0\r] - * 0123456789012345678901 - * 0 1 2 - */ - - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - /* - * > [FW?\r] - * < [#------------- ------ VT12046Q \r] - * 012345678901234567890123456789012345678 - * 0 1 2 3 - */ - - { "device.mfr", 0, NULL, "FW?\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "FW?\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "FW?\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - - /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, "0", QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, "60", QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - -/* Testing table */ -#ifdef TESTING -static testing_t hunnox_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "FW?\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - -/* Subdriver-specific initups */ -static void hunnox_initups(void) -{ - blazer_initups(hunnox_qx2nut); -} - -/* Subdriver interface */ -subdriver_t hunnox_subdriver = { - HUNNOX_VERSION, - blazer_claim, - hunnox_qx2nut, - hunnox_initups, - NULL, - blazer_makevartable, - "UPS No Ack", - NULL, -#ifdef TESTING - hunnox_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_hunnox.h b/drivers/nutdrv_qx_hunnox.h deleted file mode 100644 index ca96465..0000000 --- a/drivers/nutdrv_qx_hunnox.h +++ /dev/null @@ -1,30 +0,0 @@ -/* nutdrv_qx_hunnox.h - Subdriver for Hunnox protocol based UPSes - * - * Copyright (C) - * 2013 Daniele Pezzini - * 2020 Mariano Jan https://marianojan.com - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_HUNNOX_H -#define NUTDRV_QX_HUNNOX_H - -#include "nutdrv_qx.h" - -extern subdriver_t hunnox_subdriver; - -#endif /* NUTDRV_QX_HUNNOX_H */ diff --git a/drivers/nutdrv_qx_masterguard.c b/drivers/nutdrv_qx_masterguard.c deleted file mode 100644 index 08168f6..0000000 --- a/drivers/nutdrv_qx_masterguard.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* nutdrv_qx_masterguard.c - Subdriver for Masterguard A/E Series - * - * Copyright (C) - * 2020-2021 Edgar Fuß , Mathematisches Institut der Universität Bonn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, or a 2-clause BSD License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nutdrv_qx.h" - -#include "nutdrv_qx_masterguard.h" -#include - -#define MASTERGUARD_VERSION "Masterguard 0.02" - -/* series (for un-SKIP) */ -static char masterguard_my_series = '?'; -/* slave address for commands that require it */ -static char masterguard_my_slaveaddr[3] = "??"; /* null-terminated for strtol() in claim() */ -/* next slaveaddr to use after the SS command (which needs the old one) has been run */ -static long masterguard_next_slaveaddr; -/* output current/power computation */ -static long masterguard_my_power = 0; -/* battery voltage computation */ -static long masterguard_my_numcells = 0; - - -/* ranges */ - -static info_rw_t masterguard_r_slaveaddr[] = { - { "0", NULL }, - { "99", NULL }, - { "" , NULL } -}; - -static info_rw_t masterguard_r_batpacks[] = { - { "0", NULL }, /* actually 1 for most models, see masterguard_model() */ - { "9", NULL }, /* varies across models, see masterguard_model() */ - { "" , NULL } -}; - -static info_rw_t masterguard_r_offdelay[] = { - { "0", NULL }, - { "5940", NULL }, /* 99*60 */ - { "" , NULL } -}; - -static info_rw_t masterguard_r_ondelay[] = { - { "0", NULL }, - { "599940", NULL }, /* 9999*60 */ - { "" , NULL } -}; - - -/* enums */ - -static info_rw_t *masterguard_e_outvolts = NULL; /* set in masterguard_output_voltages() */ - - -/* preprocess functions */ - -/* set masterguard_my_slaveaddr (for masterguard_add_slaveaddr) */ -static int masterguard_slaveaddr(item_t *item, char *value, const size_t valuelen) { - if (strlen(item->value) != 2) { - upsdebugx(2, "slaveaddr length not 2"); - return -1; - } - memcpy(masterguard_my_slaveaddr, item->value, 2); - if (valuelen >= 3) memcpy(value, item->value, 3); - return 0; -} - -/* set masterguard_my_series (for activating supported commands in masterguard_claim() */ -static int masterguard_series(item_t *item, char *value, const size_t valuelen) { - NUT_UNUSED_VARIABLE(valuelen); - - switch (item->value[0]) { - case 'A': - break; - case 'E': - break; - default: - upsdebugx(2, "unknown series %s", item->value); - return -1; - } - masterguard_my_series = item->value[0]; - memcpy(value, item->value, 2); - return 0; -} - -/* Convert strangely formatted model name in WH output - * (spaces, -19 only after battery packs) to something readable - * Also set min/max battery packs according to model */ -static int masterguard_model(item_t *item, char *value, const size_t valuelen) { - char *model; - int rack; - char min_bp, max_bp; - - rack = (strstr(item->value, "-19") != NULL); - if (strncmp(item->value, "A 700", 6) == 0) { - model = "A700"; - min_bp = 0; max_bp = 0; - } else if (strncmp(item->value, "A 1000", 6) == 0) { - model = "A1000"; - min_bp = 0; max_bp = 2; - } else if (strncmp(item->value, "A 2000", 6) == 0) { - model = "A2000"; - min_bp = rack ? 1 : 0; max_bp = rack ? 5 : 2; - } else if (strncmp(item->value, "A 3000", 6) == 0) { - model = "A3000"; - min_bp = rack ? 1 : 0; max_bp = rack ? 5 : 2; - } else if (strncmp(item->value, "E 60", 4) == 0) { - model = "E60"; - min_bp = 1; max_bp = 1; /* ??? */ - } else if (strncmp(item->value, "E100", 4) == 0) { - model = "E100"; - min_bp = 1; max_bp = 1; /* ??? */ - } else if (strncmp(item->value, "E200", 4) == 0) { - model = "E200"; - min_bp = 1; max_bp = 1; /* ??? */ - } else { - upsdebugx(2, "unknown T %s", item->value); - return -1; - } - masterguard_r_batpacks[0].value[0] = '0' + min_bp; - masterguard_r_batpacks[1].value[0] = '0' + max_bp; - snprintf(value, valuelen, "%s%s", model, rack ? "-19" : ""); - return 0; -} - -/* set masterguard_my_power (for power/current calculations) according to model */ -static int masterguard_power(item_t *item, char *value, const size_t valuelen) { - int p; - - if (strncmp(item->value, "A 700", 6) == 0) { - p = 700; - } else if (strncmp(item->value, "A 1000", 6) == 0) { - p = 1000; - } else if (strncmp(item->value, "A 2000", 6) == 0) { - p = 2000; - } else if (strncmp(item->value, "A 3000", 6) == 0) { - p = 3000; - } else if (strncmp(item->value, "E 60", 4) == 0) { - p = 6000; - } else if (strncmp(item->value, "E100", 4) == 0) { - p = 10000; - } else if (strncmp(item->value, "E200", 4) == 0) { - p = 20000; - } else { - upsdebugx(2, "unknown T %s", item->value); - return -1; - } - masterguard_my_power = p; - snprintf(value, valuelen, "%d", p); - return 0; -} - -/* convert mmm.ss to seconds */ -static int masterguard_mmm_ss(item_t *item, char *value, const size_t valuelen) { - int m, s; - - if (sscanf(item->value, "%d.%d", &m, &s) != 2) { - upsdebugx(2, "unparsable mmm.ss %s", item->value); - return -1; - } - snprintf(value, valuelen, "%d", 60*m + s); - return 0; -} - -/* convert hhh to seconds */ -static int masterguard_hhh(item_t *item, char *value, const size_t valuelen) { - int h; - if (sscanf(item->value, "%d", &h) != 1) { - upsdebugx(2, "unparsable hhh %s", item->value); - return -1; - } - snprintf(value, valuelen, "%d", 60*60*h); - return 0; -} - -/* convert TTTT:hh:mm:dd to seconds */ -static int masterguard_tttt_hh_mm_ss(item_t *item, char *value, const size_t valuelen) { - int t, h, m, s; - - if (sscanf(item->value, "%d:%d:%d:%d", &t, &h, &m, &s) != 4) { - upsdebugx(2, "unparsable TTTT:hh:mm:ss %s", item->value); - return -1; - } - snprintf(value, valuelen, "%d", 86400*t + 3600*h + 60*m + s); - return 0; -} - -/* set masterguard_my_numcells (for nominal battery voltage computation) */ -static int masterguard_numcells(item_t *item, char *value, const size_t valuelen) { - int v; - if (sscanf(item->value, "%d", &v) != 1) { - upsdebugx(2, "unparsable vvv %s", item->value); - return -1; - } - masterguard_my_numcells = v; - snprintf(value, valuelen, "%d", v); - return 0; -} - -/* compute nominal battery voltage */ -static int masterguard_battvolt(item_t *item, char *value, const size_t valuelen) { - float s; - if (sscanf(item->value, "%f", &s) != 1) { - upsdebugx(2, "unparsable ss.ss %s", item->value); - return -1; - } - snprintf(value, valuelen, "%.2f", masterguard_my_numcells * s); - return 0; -} - -/* compute output power from load percentage */ -static int masterguard_ups_power(item_t *item, char *value, const size_t valuelen) { - int q; - - if (sscanf(item->value, "%d", &q) != 1) { - upsdebugx(2, "unparsable qqq %s", item->value); - return -1; - } - snprintf(value, valuelen, "%.0f", q / 100.0 * masterguard_my_power + 0.5); - return 0; -} - -/* helper routine, not to be called from table */ -static int masterguard_output_current_fraction(item_t *item, char *value, const size_t valuelen, double fraction) { - NUT_UNUSED_VARIABLE(item); - - snprintf(value, valuelen, "%.2f", - fraction * masterguard_my_power / strtod(dstate_getinfo("output.voltage") , NULL) + 0.005); - return 0; -} - -/* compute output current from load percentage and output voltage */ -static int masterguard_output_current(item_t *item, char *value, const size_t valuelen) { - int q; - - if (sscanf(item->value, "%d", &q) != 1) { - upsdebugx(2, "unparsable qqq %s", item->value); - return -1; - } - return masterguard_output_current_fraction(item, value, valuelen, q/100.0); -} - -/* compute nominal output current from output voltage */ -static int masterguard_output_current_nominal(item_t *item, char *value, const size_t valuelen) { - return masterguard_output_current_fraction(item, value, valuelen, 1.0); -} - -/* digest status bits */ -static int masterguard_status(item_t *item, char *value, const size_t valuelen) { - int neg; - char *s; - - switch (item->value[0]) { - case '0': neg = 1; break; - case '1': neg = 0; break; - default: - upsdebugx(2, "unknown flag value %c", item->value[0]); - return -1; - } - switch (item->from) { - case 53: /* B7 */ s = "OL"; neg = !neg; break; - case 54: /* B6 */ s = "LB"; break; - case 55: /* B5 */ s = "BYPASS"; break; - case 56: /* B4 */ s = neg ? "" : "UPS Failed"; neg = 0; break; - case 57: /* B3 */ s = neg ? "online" : "offline"; neg = 0; break; - case 58: /* B2 */ s = "CAL"; break; - case 59: /* B1 */ s = "FSD"; break; - /* 60: blank */ - /* 61: B0 reserved */ - /* 62: T7 reserved */ - case 63: /* T6 */ s = neg ? "" : "problems in parallel operation mode"; neg = 0; break; - /* 64: T5 part of a parallel set */ - case 65: /* T4 */ s = "RB"; break; - case 66: /* T3 */ s = neg ? "" : "no battery connected"; neg = 0; break; - case 67: /* T210 */ - neg = 0; - if (strncmp(item->value, "000", 3) == 0) { - s = "no test in progress"; - } else if (strncmp(item->value, "001", 3) == 0) { - s = "in progress"; - } else if (strncmp(item->value, "010", 3) == 0) { - s = "OK"; - } else if (strncmp(item->value, "011", 3) == 0) { - s = "failed"; - } else if (strncmp(item->value, "100", 3) == 0) { - s = "not possible"; - } else if (strncmp(item->value, "101", 3) == 0) { - s = "aborted"; - } else if (strncmp(item->value, "110", 3) == 0) { - s = "autonomy time calibration in progress"; - } else if (strncmp(item->value, "111", 3) == 0) { - s = "unknown"; - } else { - upsdebugx(2, "unknown test result %s", item->value); - return -1; - } - break; - default: - upsdebugx(2, "unknown flag position %d", item->from); - return -1; - } - snprintf(value, valuelen, "%s%s", neg ? "!" : "", s); - return 0; -} - -/* convert beeper status bit to string required by NUT */ -static int masterguard_beeper_status(item_t *item, char *value, const size_t valuelen) { - switch (item->value[0]) { - case '0': - if (valuelen >= 9) - strcpy(value, "disabled"); - else - *value = '\0'; - break; - case '1': - if (valuelen >= 8) - strcpy(value, "enabled"); - else - *value = '\0'; - break; - default: - upsdebugx(2, "unknown beeper status %c", item->value[0]); - return -1; - } - return 0; -} - -/* parse list of available (nominal) output voltages into masterguard_w_outvolts enum */ -static int masterguard_output_voltages(item_t *item, char *value, const size_t valuelen) { - char sep[] = " "; - char *w; - size_t n = 0; - - strncpy(value, item->value, valuelen); /* save before strtok mangles it */ - for (w = strtok(item->value, sep); w; w = strtok(NULL, sep)) { - n++; - upsdebugx(4, "output voltage #%zu: %s", n, w); - if ((masterguard_e_outvolts = realloc(masterguard_e_outvolts, n * sizeof(info_rw_t))) == NULL) { - upsdebugx(1, "output voltages: allocating #%zu failed", n); - return -1; - } - strncpy(masterguard_e_outvolts[n - 1].value, w, SMALLBUF - 1); - masterguard_e_outvolts[n - 1].preprocess = NULL; - } - /* need to do this seperately in case the loop is run zero times */ - if ((masterguard_e_outvolts = realloc(masterguard_e_outvolts, (n + 1) * sizeof(info_rw_t))) == NULL) { - upsdebugx(1, "output voltages: allocating terminator after #%zu failed", n); - return -1; - } - masterguard_e_outvolts[n].value[0] = '\0'; - masterguard_e_outvolts[n].preprocess = NULL; - return 0; -} - -/* parse fault record string into readable form */ -static int masterguard_fault(item_t *item, char *value, const size_t valuelen) { - char c; - float f; - int t, h, m, s; - long l; - - if (sscanf(item->value, "%c %f %d:%d:%d:%d", &c, &f, &t, &h, &m, &s) != 6) { - upsdebugx(1, "unparsable fault record %s", item->value); - return -1; - } - l = 86400*t + 3600*h + 60*m + s; - snprintf(value, valuelen, "%ld: ", l); - switch (c) { - case '0': - snprintfcat(value, valuelen, "none"); - break; - case '1': - snprintfcat(value, valuelen, "bus fault (%.0fV)", f); - break; - case '2': - snprintfcat(value, valuelen, "inverter fault (%.0fV)", f); - break; - case '3': - snprintfcat(value, valuelen, "overheat fault (%.0fC)", f); - break; - case '4': - snprintfcat(value, valuelen, "battery overvoltage fault (%.2fV)", f); - break; - case '5': - snprintfcat(value, valuelen, "battery mode overload fault (%.0f%%)", f); - break; - case '6': - snprintfcat(value, valuelen, "bypass mode overload fault (%.0f%%)", f); - break; - case '7': - snprintfcat(value, valuelen, "inverter mode outpt short-circuit fault (%.0fV)", f); - break; - case '8': - snprintfcat(value, valuelen, "fan lock fault"); - break; - case '9': - snprintfcat(value, valuelen, "battery fault (%.0fV)", f); - break; - case 'A': - snprintfcat(value, valuelen, "charger fault"); - break; - case 'B': - snprintfcat(value, valuelen, "EPO activated"); - break; - case 'C': - snprintfcat(value, valuelen, "parallel error"); - break; - case 'D': - snprintfcat(value, valuelen, "MCU communication error"); - break; - case 'E': - case 'F': - upsdebugx(1, "reserved fault id %c", c); - return -1; - default: - upsdebugx(1, "unknown fault id %c", c); - return -1; - } - return 0; -} - - -/* pre-command preprocessing functions */ - -/* add slave address (from masterguard_my_slaveaddr) to commands that require it */ -static int masterguard_add_slaveaddr(item_t *item, char *command, const size_t commandlen) { - NUT_UNUSED_VARIABLE(item); - NUT_UNUSED_VARIABLE(commandlen); - - size_t l; - - l = strlen(command); - if (strncmp(command + l - 4, ",XX\r", 4) != 0) { - upsdebugx(1, "add slaveaddr: no ,XX\\r at end of command %s", command); - return -1; - } - upsdebugx(4, "add slaveaddr %s to command %s", masterguard_my_slaveaddr, command); - memcpy(command + l - 3, masterguard_my_slaveaddr, 2); - return 0; -} - - -/* instant command preprocessing functions */ - -/* helper, not to be called directly from table */ -/*!! use parameter from the value field instead of ups.delay.{shutdown,return}?? */ -static int masterguard_shutdown(item_t *item, char *value, const size_t valuelen, const int stayoff) { - NUT_UNUSED_VARIABLE(item); - - long offdelay; - char *p; - const char *val, *name; - char offstr[3]; - - offdelay = strtol((val = dstate_getinfo(name = "ups.delay.shutdown")), &p, 10); - if (*p != '\0') goto ill; - if (offdelay < 0) { - goto ill; - } else if (offdelay < 60) { - offstr[0] = '.'; - offstr[1] = '0' + (char)offdelay / 6; - } else if (offdelay <= 99*60) { - int m = (int)(offdelay / 60); - offstr[0] = '0' + (char)(m / 10); - offstr[1] = '0' + (char)(m % 10); - } else goto ill; - offstr[2] = '\0'; - if (stayoff) { - snprintf(value, valuelen, "S%s\r", offstr); - } else { - long ondelay; - - ondelay = strtol((val = dstate_getinfo(name = "ups.delay.start")), &p, 10); - if (*p != '\0') goto ill; - if (ondelay < 0 || ondelay > 9999*60) goto ill; - snprintf(value, valuelen, "S%sR%04ld\r", offstr, ondelay); - } - return 0; - -ill: - upsdebugx(2, "shutdown: illegal %s %s", name, val); - return -1; -} - -static int masterguard_shutdown_return(item_t *item, char *value, const size_t valuelen) { - return masterguard_shutdown(item, value, valuelen, 0); -} - -static int masterguard_shutdown_stayoff(item_t *item, char *value, const size_t valuelen) { - return masterguard_shutdown(item, value, valuelen, 1); -} - -static int masterguard_test_battery(item_t *item, char *value, const size_t valuelen) { - NUT_UNUSED_VARIABLE(item); - - long duration; - char *p; - - if (value[0] == '\0') { - upsdebugx(2, "battery test: no duration"); - return -1; - } - duration = strtol(value, &p, 10); - if (*p != '\0') goto ill; - if (duration == 10) { - strncpy(value, "T\r", valuelen); - return 0; - } - if (duration < 60 || duration > 99*60) goto ill; - snprintf(value, valuelen, "T%02ld\r", duration / 60); - return 0; - -ill: upsdebugx(2, "battery test: illegal duration %s", value); - return -1; -} - - -/* variable setting preprocessing functions */ - -/* set variable, input format specifier (d/f/s, thms) in item->dfl */ -static int masterguard_setvar(item_t *item, char *value, const size_t valuelen) { - char *p; - char t = 's'; - long i = 0; - double f = 0.0; - char s[80]; - - if (value[0] == '\0') { - upsdebugx(2, "setvar: no value"); - return -1; - } - if (!item->dfl || item->dfl[0] == '\0') { - upsdebugx(2, "setvar: no dfl"); - return -1; - } - if (item->dfl[1] == '\0') { - t = item->dfl[0]; - switch (t) { - case 'd': - i = strtol(value, &p, 10); - if (*p != '\0') goto ill; - break; - case 'f': - f = strtod(value, &p); - if (*p != '\0') { - goto ill; - } else if (errno) { - upsdebug_with_errno(2, "setvar: f value %s", value); - return -1; - } - break; - case 's': - /* copy to s to avoid snprintf()ing value to itself */ - if (strlen(value) >= sizeof s) goto ill; - strcpy(s, value); - break; - default: - upsdebugx(2, "setvar: unknown dfl %c", item->dfl[0]); - return -1; - } - } else if (strncmp(item->dfl, "thms", 4) == 0) { - int tt, h, m, sec; - if (sscanf(item->value, "%d:%d:%d:%d", &tt, &h, &m, &sec) == 4) { - if (tt < 0 || tt > 9999 || h < 0 || h > 23 || m < 0 || m > 59 || sec < 0 || sec > 59) goto ill; - } else { - long l; - char *pl; - - l = strtol(value, &pl, 10); - if (*pl != '\0') goto ill; - sec = l % 60; l /= 60; - m = l % 60; l /= 60; - h = l % 24; l /= 24; - if (l > 9999) goto ill; - tt = (int)l; - } - snprintf(s, sizeof s, "%04d:%02d:%02d:%02d", tt, h, m, sec); - } else { - upsdebugx(2, "setvar: unknown dfl %s", item->dfl); - return -1; - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - switch (t) { - case 'd': - snprintf(value, valuelen, item->command, i); - break; - case 'f': - snprintf(value, valuelen, item->command, f); - break; - case 's': - snprintf(value, valuelen, item->command, s); - break; - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - return 0; -ill: - upsdebugx(2, "setvar: illegal %s value %s", item->dfl, value); - return -1; -} - -/* record new slave address in masterguard_next_slaveaddr; moved to masterguard_my_slaveaddr in masterguard_new_slaveaddr() after the slaveaddr-changing command finished */ -static int masterguard_set_slaveaddr(item_t *item, char *value, const size_t valuelen) { - char *p; - - masterguard_next_slaveaddr = strtol(value, &p, 10); - if (*p != '\0') { - upsdebugx(2, "set_slaveaddr: illegal value %s", value); - return -1; - } - upsdebugx(3, "next slaveaddr %ld", masterguard_next_slaveaddr); - return masterguard_setvar(item, value, valuelen); -} - - -/* variable setting answer preprocessing functions */ - -/* set my_slaveaddr to next_slaveaddr /after/ issuing the SS command (which, itself, needs the /old/ slaveaddr) */ -static int masterguard_new_slaveaddr(item_t *item, const int len) { - NUT_UNUSED_VARIABLE(item); - - upsdebugx(3, "saved slaveaddr %ld", masterguard_next_slaveaddr); - if (masterguard_next_slaveaddr < 0 || masterguard_next_slaveaddr > 99) { - upsdebugx(2, "%s: illegal value %ld", __func__, masterguard_next_slaveaddr); - return -1; - } - masterguard_my_slaveaddr[0] = '0' + (char)(masterguard_next_slaveaddr / 10); - masterguard_my_slaveaddr[1] = '0' + (char)(masterguard_next_slaveaddr % 10); - upsdebugx(3, "new slaveaddr %s", masterguard_my_slaveaddr); - return len; -} - - -/* qx2nut lookup table */ -static item_t masterguard_qx2nut[] = { - /* static values */ - - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "device.mfr", 0, NULL, "", "", 0, '\0', "", 0, 0, "Masterguard", QX_FLAG_STATIC | QX_FLAG_ABSENT,NULL, NULL, NULL }, - { "load.high", 0, NULL, "", "", 0, '\0', "", 0, 0, "140", QX_FLAG_STATIC | QX_FLAG_ABSENT,NULL, NULL, NULL }, - /* battery.charge.low */ - /* battery.charge.warning */ - { "battery.type", 0, NULL, "", "", 0, '\0', "", 0, 0, "PbAc", QX_FLAG_STATIC | QX_FLAG_ABSENT,NULL, NULL, NULL }, - - - /* variables */ - - /* - * > [WH\r] - * < [(XX VV.VV PP.PP TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT B MMM FF.FF VVV SS.SS HHH.hh GGG.gg RRR mm nn MMM NNN FF.FF FF.FF\r] - * 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012 - * 0 1 2 3 4 5 6 7 8 9 0 1 - * (00 10.06 03.09 A 700 + 0 Bat Pack-19 0 230 50.00 012 02.30 006.00 012.00 018 10 40 160 276 47.00 53.00 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "ups.id", ST_FLAG_RW, masterguard_r_slaveaddr,"WH\r", "", 113, '(', "", 1, 2, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, NULL, NULL, masterguard_slaveaddr }, - { "ups.firmware", 0, NULL, "WH\r", "", 113, '(', "", 4, 8, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "ups.firmware.aux", 0, NULL, "WH\r", "", 113, '(', "", 10, 14, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, - /* several values are deduced from the T field */ - { "experimental.series", 0, NULL, "WH\r", "", 113, '(', "", 16, 16, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_series }, - { "device.model", 0, NULL, "WH\r", "", 113, '(', "", 16, 45, "%s", QX_FLAG_STATIC, NULL, NULL, masterguard_model }, - { "ups.power.nominal", 0, NULL, "WH\r", "", 113, '(', "", 16, 45, "%s", QX_FLAG_STATIC, NULL, NULL, masterguard_power }, -/* not used, use GS instead because the value is settable - { "battery.packs", 0, NULL, "WH\r", "", 113, '(', "", 47, 47, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, -*/ - { "input.voltage.nominal", 0, NULL, "WH\r", "", 113, '(', "", 49, 51, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "WH\r", "", 113, '(', "", 53, 57, "%.2f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "experimental.number_of_battery_cells", 0, NULL, "WH\r", "", 113, '(', "", 59, 61, "%.0f", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_numcells }, - { "experimental.nominal_cell_voltage", 0, NULL, "WH\r", "", 113, '(', "", 63, 67, "%.2f", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "WH\r", "", 113, '(', "", 63, 67, "%.2f", QX_FLAG_STATIC, NULL, NULL, masterguard_battvolt}, - { "experimental.runtime_half", 0, NULL, "WH\r", "", 113, '(', "", 69, 74, "%.0f", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_mmm_ss }, - { "experimental.runtime_full", 0, NULL, "WH\r", "", 113, '(', "", 76, 81, "%.0f", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_mmm_ss }, - { "experimental.recharge_time", 0, NULL, "WH\r", "", 113, '(', "", 83, 85, "%.0f", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_hhh }, -/*!! what's the difference between low/high and low.critical/high.critical?? */ - { "ambient.0.temperature.low", 0, NULL, "WH\r", "", 113, '(', "", 87, 88, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "ambient.0.temperature.high", 0, NULL, "WH\r", "", 113, '(', "", 90, 91, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.voltage.low.critical", 0, NULL, "WH\r", "", 113, '(', "", 93, 95, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.voltage.high.critical",0, NULL, "WH\r", "", 113, '(', "", 97, 99, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.low", 0, NULL, "WH\r", "", 113, '(', "", 101, 105, "%.2f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.high", 0, NULL, "WH\r", "", 113, '(', "", 107, 111, "%.2f", QX_FLAG_STATIC, NULL, NULL, NULL }, - - /* - * > [Q3\r] - * 76543210 76543210 - * < [(XX MMM.M NNN.N PPP.P QQQ RR.R SS.SS TT.T ttt.tt CCC BBBBBBBB TTTTTTTT\r] - * 01234567890123456789012345678901234567890123456789012345678901234567890 - * 0 1 2 3 4 5 6 7 - * (00 225.9 225.9 229.3 043 50.0 02.27 23.4 017.03 100 00000000 00000000 - * (01 226.9 226.9 226.9 039 50.0 02.30 21.8 000.00 000 01100000 00011000 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "input.voltage", 0, NULL, "Q3\r", "", 71, '(', "", 4, 8, "%.1f", 0, NULL, NULL, NULL }, - { "experimental.input_fault_voltage", 0, NULL, "Q3\r", "", 71, '(', "", 10, 14, "%.1f", QX_FLAG_NONUT, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q3\r", "", 71, '(', "", 16, 20, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q3\r", "", 71, '(', "", 22, 24, "%.0f", 0, NULL, NULL, NULL }, - { "ups.power", 0, NULL, "Q3\r", "", 71, '(', "", 22, 24, "%.0f", 0, NULL, NULL, masterguard_ups_power }, - { "output.current", 0, NULL, "Q3\r", "", 71, '(', "", 22, 24, "%f", 0, NULL, NULL, masterguard_output_current }, - { "input.frequency", 0, NULL, "Q3\r", "", 71, '(', "", 26, 29, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q3\r", "", 71, '(', "", 31, 35, "%.1f", 0, NULL, NULL, masterguard_battvolt }, - { "ups.temperature", 0, NULL, "Q3\r", "", 71, '(', "", 37, 40, "%.1f", 0, NULL, NULL, NULL }, -/*!! report both ups.temperature and ambient.0.temperature?? */ - { "ambient.0.temperature", 0, NULL, "Q3\r", "", 71, '(', "", 37, 40, "%.1f", 0, NULL, NULL, NULL }, - { "battery.runtime", 0, NULL, "Q3\r", "", 71, '(', "", 42, 47, "%.0f", 0, NULL, NULL, masterguard_mmm_ss }, - { "battery.charge", 0, NULL, "Q3\r", "", 71, '(', "", 49, 51, "%.0f", 0, NULL, NULL, NULL }, - /* Status bits, first half (B) */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 53, 53, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B7: Utility Fail */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 54, 54, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B6: Battery Low */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 55, 55, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B5: Bypass/Boost Active */ - { "ups.alarm", 0, NULL, "Q3\r", "", 71, '(', "", 56, 56, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B4: UPS Failed */ - { "ups.type", 0, NULL, "Q3\r", "", 71, '(', "", 57, 57, NULL, QX_FLAG_STATIC, NULL, NULL, masterguard_status }, /* B3: UPS Type */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 58, 58, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B2: Test in Progress */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 59, 59, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* B1: Shutdown Active */ - /* unused */ /* B0: unused */ - /* Status bits, second half (T) */ - /* unused */ /* T7: unused */ - { "ups.alarm", 0, NULL, "Q3\r", "", 69, '(', "", 63, 63, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* T6: problems in parallel operation mode */ - /* part of a parallel set */ /* T5: is part of a parallel set */ - { "ups.status", 0, NULL, "Q3\r", "", 71, '(', "", 65, 65, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* T4: Battery: end of service life */ - { "ups.alarm", 0, NULL, "Q3\r", "", 71, '(', "", 66, 66, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* T3: battery connected */ - { "ups.test.result", 0, NULL, "Q3\r", "", 71, '(', "", 67, 69, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, masterguard_status }, /* T210: Test Status */ - - /* - * > [GS,XX\r] - * < [(XX,ii p a\r] - * 01234567890 - * 0 1 - * (00,00 0 1 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - /* ups.id obtained via WH */ - { "ups.id", 0, NULL, "SS%02d--,XX\r","", 0, '\0', "", 0, 0, "d", QX_FLAG_SETVAR | QX_FLAG_RANGE, masterguard_add_slaveaddr, masterguard_new_slaveaddr, masterguard_set_slaveaddr }, - { "battery.packs", ST_FLAG_RW, masterguard_r_batpacks, "GS,XX\r", "", 0, '(', "", 7, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, masterguard_add_slaveaddr, NULL, NULL }, - { "battery.packs", 0, NULL, "SS--%1d-,XX\r","", 0, '\0', "", 0, 0, "d", QX_FLAG_SETVAR | QX_FLAG_RANGE, masterguard_add_slaveaddr, NULL, masterguard_setvar }, -/*!! which QX_FLAGs to use?? (changed by instcmd) */ - { "ups.beeper.status", 0, NULL, "GS,XX\r", "", 11, '(', "", 9, 9, NULL, QX_FLAG_SEMI_STATIC, masterguard_add_slaveaddr, NULL, masterguard_beeper_status }, - /* set with beeper.{en,dis}able */ - - /* - * > [GBS,XX\r] - * < [(XX,CCC hhhh HHHH AAAA BBBB DDDD EEE SS.SS\r] - * 0123456789012345678901234567890123456789012 - * 0 1 2 3 4 - * (00,100 0017 0000 0708 0712 0994 115 02.28 - * (01,000 0000 0360 0708 0712 0994 076 02.30 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "battery.charge", 0, NULL, "GBS,XX\r", "", 43, '(', "", 4, 6, "%.0f", 0, masterguard_add_slaveaddr, NULL, NULL }, - /* - * hhhh: hold time (minutes) - * HHHH: recharge time to 90% (minutes) - * AAAA: Ageing factor (promilles) - * BBBB: Ageing factor time dependant (promilles) - * DDDD: Ageing factor cyclic use (promilles) - * EEE: Calibration factor (percent) - * SS.SS: Actual battery cell voltage - */ - - /* - * > [GSN,XX\r] - * < [(XX,SSN=SSSSSSSSSSSnnnnn\r] - * 0123456789012345678901234 - * 0 1 2 - * (00,SSN=6A1212 2782 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "device.part", 0, NULL, "GSN,XX\r", "", 25, '(', "", 8, 18, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, masterguard_add_slaveaddr, NULL, NULL }, - { "device.serial", 0, NULL, "GSN,XX\r", "", 25, '(', "", 20, 23, "%s", QX_FLAG_STATIC, masterguard_add_slaveaddr, NULL, NULL }, - - /* - * > [DRC,XX\r] - * < [(XX,TTTT:hh:mm:ss\r] - * 012345678901234567 - * 0 1 - * (00,1869:19:06:37 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - /* this is not really the uptime, but the running time since last maintenance */ - { "device.uptime", ST_FLAG_RW, NULL, "DRC,XX\r", "", 17, '(', "", 4, 16, "%.0f", QX_FLAG_SEMI_STATIC, masterguard_add_slaveaddr, NULL, masterguard_tttt_hh_mm_ss }, - { "device.uptime", 0, NULL, "SRC%s,XX\r", "", 0, '\0', "", 0, 0, "thms", QX_FLAG_SETVAR, masterguard_add_slaveaddr, NULL, masterguard_setvar }, - - /* - * > [MSO\r] - * < [(220 230 240\r] - * 0123456789012 - * 0 1 - * (220 230 240 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "experimental.output_voltages", 0, NULL, "MSO\r", "", 5, '(', "", 1, 0, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, masterguard_output_voltages }, - - /* - * > [PNV\r] - * < [(PNV=nnn\r] - * 012345678 - * 0 - * (PNV=230 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "output.voltage.nominal", ST_FLAG_RW, NULL /* see claim */, "PNV\r", "", 8, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, NULL }, - { "output.voltage.nominal", 0, NULL, "PNV=%03d\r", "", 0, '\0', "", 0, 0, "d", QX_FLAG_SETVAR, NULL, NULL, masterguard_setvar }, - { "output.current.nominal", 0, NULL, "PNV\r", "", 8, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC, NULL, NULL, masterguard_output_current_nominal }, - - /* - * > [FLT,XX\r] - * < [(XX,A aaaa TTTT:hh:mm:ss B bbbb TTTT:hh:mm:ss C cccc TTTT:hh:mm:ss D dddd TTTT:hh:mm:ss E eeee TTTT:hh:mm:ss\r - * 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 - * 0 1 2 3 4 5 6 7 8 9 0 - * (00,7 0043 0000:16:48:06 0 0000 0000:00:00:00 0 0000 0000:00:00:00 0 0000 0000:00:00:00 0 0000 0000:00:00:00 - * (01,9 0010 1780:14:57:19 7 0046 0000:21:14:41 0 0000 0000:00:00:00 0 0000 0000:00:00:00 0 0000 0000:00:00:00 - */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "experimental.fault_1", 0, NULL, "FLT,XX\r", "", 108, '(', "", 4, 23, "%s", QX_FLAG_NONUT, masterguard_add_slaveaddr, NULL, masterguard_fault }, - { "experimental.fault_2", 0, NULL, "FLT,XX\r", "", 108, '(', "", 25, 44, "%s", QX_FLAG_NONUT, masterguard_add_slaveaddr, NULL, masterguard_fault }, - { "experimental.fault_3", 0, NULL, "FLT,XX\r", "", 108, '(', "", 46, 65, "%s", QX_FLAG_NONUT, masterguard_add_slaveaddr, NULL, masterguard_fault }, - { "experimental.fault_4", 0, NULL, "FLT,XX\r", "", 108, '(', "", 67, 86, "%s", QX_FLAG_NONUT, masterguard_add_slaveaddr, NULL, masterguard_fault }, - { "experimental.fault_5", 0, NULL, "FLT,XX\r", "", 108, '(', "", 88, 107, "%s", QX_FLAG_NONUT, masterguard_add_slaveaddr, NULL, masterguard_fault }, - - - /* instant commands */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ -/*!! what's the difference between load.off.delay and shutdown.stayoff?? */ -#if 0 - { "load.off", 0, NULL, "S.0\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - /* load.off.delay */ - /* load.on.delay */ -#endif - { "shutdown.return", 0, NULL, NULL, "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, masterguard_shutdown_return }, - { "shutdown.stayoff", 0, NULL, NULL, "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, masterguard_shutdown_stayoff }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - /* shutdown.reboot */ - /* shutdown.reboot.graceful */ - /* test.panel.start */ - /* test.panel.stop */ - /* test.failure.start */ - /* test.failure.stop */ - { "test.battery.start", 0, NULL, NULL, "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, masterguard_test_battery }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.deep", 0, NULL, "TUD\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - /* test.system.start */ - /* calibrate.start */ - /* calibrate.stop */ - { "bypass.start", 0, NULL, "FOFF\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "bypass.stop", 0, NULL, "FON\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - /* reset.input.minmax */ - /* reset.watchdog */ - { "beeper.enable", 0, NULL, "SS---1,XX\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, masterguard_add_slaveaddr, NULL, NULL }, - { "beeper.disable", 0, NULL, "SS---0,XX\r", "", 0, '\0', "", 0, 0, NULL, QX_FLAG_CMD, masterguard_add_slaveaddr, NULL, NULL }, - /* beeper.mute */ - /* beeper.toggle */ - /* outlet.* */ - - - /* server variables */ - /* type flags rw command answer len leading value from to dfl qxflags precmd preans preproc */ - { "ups.delay.shutdown", ST_FLAG_RW, masterguard_r_offdelay, NULL, "", 0, '\0', "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, NULL }, - { "ups.delay.start", ST_FLAG_RW, masterguard_r_ondelay, NULL, "", 0, '\0', "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, NULL }, - - - /* end marker */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - - -/*!! todo - -untested: -Sxx (.n/nn) -C after S.0 - -unused: ->G01,00 -(00,00000 - -additional E series commands: -PSR -BUS* -V -INVDC - -use ups.{delay,timer}.{start,reboot,shutdown}? -report ups.contacts? -how to report battery.charger.status? -set battery.packs.bad? - -how to report battery aeging/run time? -how to report nominal hold time at half/full load? - -*/ - - -/* commands supported by A series */ -static char *masterguard_commands_a[] = { - "Q", "Q1", "Q3", "T", "TL", "S", "C", "CT", "WH", "M", "N", "O", "DECO", "DRC", "SRC", "FLT", "FCLR", "G", "SS", "GS", "MSO", "PNV", "FOFF", "FON", "TUD", "GBS", "SSN", "GSN", NULL -}; - -/* commands supported by E series */ -static char *masterguard_commands_e[] = { - "Q", "Q1", "Q3", "PSR", "T", "TL", "S", "C", "CT", "WH", "DRC", "SRC", "FLT", "FCLR", "SS", "GS", "MSO", "PNV", "FOFF", "FON", "TUD", "GBS", "SSN", "GSN", "BUS", "V", "INVDC", "BUSP", "BUSN", NULL -}; - -/* claim function. fetch some mandatory values, - * disable unsupported commands, - * set enum for supported output voltages */ -static int masterguard_claim(void) { - item_t *item; - /* mandatory values */ - char *mandatory[] = { - "series", /* SKIP */ - "device.model", /* minimal number of battery packs */ - "ups.power.nominal", /* load computation */ - "ups.id", /* slave address */ - "output_voltages", /* output voltages enum */ -#if 0 - "battery.packs", /* battery voltage computation */ -#endif - NULL - }; - char **sp; - long config_slaveaddr; - char *sa; - char **commands; - - if ((sa = getval("slave_address")) != NULL) { - char *p; - - if (*sa == '\0') { - upsdebugx(2, "claim: empty slave_address"); - return 0; - } - config_slaveaddr = strtol(sa, &p, 10); - if (*p != '\0' || config_slaveaddr < 0 || config_slaveaddr > 99) { - upsdebugx(2, "claim: illegal slave_address %s", sa); - return 0; - } - } else { - config_slaveaddr = -1; - } - for (sp = mandatory; *sp != NULL; sp++) { - char value[SMALLBUF] = ""; - - if ((item = find_nut_info(*sp, 0, QX_FLAG_SETVAR)) == NULL) { - upsdebugx(2, "claim: cannot find %s", *sp); - return 0; - } - /* since qx_process_answer() is not exported, there's no way - * to avoid sending the same command to the UPS again */ - if (qx_process(item, NULL) < 0) { - upsdebugx(2, "claim: cannot process %s", *sp); - return 0; - } - /* only call the preprocess function; don't call ups_infoval_set() - * because that does a dstate_setinfo() before dstate_setflags() - * is called (via qx_set_var() in qx_ups_walk() with QX_WALKMODE_INIT); - * that leads to r/w vars ending up r/o. */ - if (item->preprocess == NULL ) { - upsdebugx(2, "claim: no preprocess function for %s", *sp); - return 0; - } - if (item->preprocess(item, value, sizeof value)) { - upsdebugx(2, "claim: failed to preprocess %s", *sp); - return 0; - } - } - - if (config_slaveaddr >= 0 && config_slaveaddr != strtol(masterguard_my_slaveaddr, NULL, 10)) { - upsdebugx(2, "claim: slave address mismatch: want %02ld, have %s", config_slaveaddr, masterguard_my_slaveaddr); - return 0; - } - - switch (masterguard_my_series) { - case 'A': - commands = masterguard_commands_a; - break; - case 'E': - commands = masterguard_commands_e; - break; - default: - return 0; - } - - /* set SKIP flag for unimplemented commands */ - for (item = masterguard_qx2nut; item->info_type != NULL; item++) { - int match = 0; - if (item->command == NULL || item->command[0] == '\0') continue; - for (sp = commands; sp != NULL; sp++) { - const char *p = *sp, *q = item->command; - - while (1) { - if (*p == '\0' && (*q < 'A' || *q > 'Z')) { - match = 1; break; - } else if (*p == '\0' || *q < 'A' || *q > 'Z' || *p != *q) { - match = 0; break; - } - p++; q++; - } - if (match) break; - } - if (nut_debug_level >= 3) { - char cmd[10]; - char *p = cmd; const char *q = item->command; - while (*q >= 'A' && *q <= 'Z') { - *p++ = *q++; - if (p - cmd >= (ptrdiff_t)sizeof cmd - 1) break; - } - *p++ = '\0'; - upsdebugx(3, "command %s %simplemented", cmd, match ? "" : "NOT "); - - } - if (!match) - item->qxflags |= QX_FLAG_SKIP; - } - - /* set enum for output.voltage.nominal */ - if ((item = find_nut_info("output.voltage.nominal", QX_FLAG_ENUM, QX_FLAG_SETVAR)) == NULL) { - upsdebugx(2, "claim: cannot find output.voltage.nominal"); - return 0; - } - item->info_rw = masterguard_e_outvolts; - - return 1; -} - - -static void masterguard_makevartable(void) { - addvar(VAR_VALUE, "series", "Series (A/E)"); - addvar(VAR_VALUE, "slave_address", "Slave address (UPS id) to match"); - addvar(VAR_VALUE, "input_fault_voltage", "Input fault voltage (whatever that means)"); - addvar(VAR_VALUE, "number_of_battery_cells", "Number of battery cells in series"); - addvar(VAR_VALUE, "nominal_cell_voltage", "Nominal battery cell voltage"); - addvar(VAR_VALUE, "runtime_half", "Nominal battery run time at 50% load (seconds)"); - addvar(VAR_VALUE, "runtime_full", "Nominal battery run time at 100% load (seconds)"); - addvar(VAR_VALUE, "recharge_time", "Nominal battery recharge time to 95% capacity (seconds)"); - addvar(VAR_VALUE, "output_voltages", "Possible output voltages (volts)"); - addvar(VAR_VALUE, "fault_1", "Fault record 1 (newest)"); - addvar(VAR_VALUE, "fault_2", "Fault record 2"); - addvar(VAR_VALUE, "fault_3", "Fault record 3"); - addvar(VAR_VALUE, "fault_4", "Fault record 4"); - addvar(VAR_VALUE, "fault_5", "Fault record 5 (oldest)"); -} - - -#ifdef TESTING -static testing_t masterguard_testing[] = { - { NULL } -}; -#endif /* TESTING */ - -subdriver_t masterguard_subdriver = { - MASTERGUARD_VERSION, - masterguard_claim, - masterguard_qx2nut, - NULL, /* initups */ - NULL, /* intinfo */ - masterguard_makevartable, - NULL, /* accepted */ - NULL, /* rejected */ -#ifdef TESTING - masterguard_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_masterguard.h b/drivers/nutdrv_qx_masterguard.h deleted file mode 100644 index 71b7f95..0000000 --- a/drivers/nutdrv_qx_masterguard.h +++ /dev/null @@ -1,29 +0,0 @@ -/* nutdrv_qx_masterguard.h - Subdriver for Masterguard A/E Series - * - * Copyright (C) - * 2020-2021 Edgar Fuß - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version, or a 2-clause BSD License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_MASTERGUARD_H -#define NUTDRV_QX_MASTERGUARD_H - -#include "nutdrv_qx.h" - -extern subdriver_t masterguard_subdriver; - -#endif /* NUTDRV_QX_MASTERGUARD_H */ diff --git a/drivers/nutdrv_qx_mecer.c b/drivers/nutdrv_qx_mecer.c index d044f33..a8299db 100644 --- a/drivers/nutdrv_qx_mecer.c +++ b/drivers/nutdrv_qx_mecer.c @@ -1,4 +1,4 @@ -/* nutdrv_qx_mecer.c - Subdriver for Mecer/Voltronic Power P98 UPSes +/* nutdrv_qx_mecer.c - Subdriver for Mecer UPSes * * Copyright (C) * 2013 Daniele Pezzini @@ -25,29 +25,11 @@ #include "nutdrv_qx_mecer.h" -#define MECER_VERSION "Mecer 0.07" +#define MECER_VERSION "Mecer 0.01" -/* Support functions */ -static int mecer_claim(void); -static void mecer_initups(void); - -/* Preprocess functions */ -static int voltronic_p98_protocol(item_t *item, char *value, const size_t valuelen); -static int mecer_process_test_battery(item_t *item, char *value, const size_t valuelen); - - -/* == qx2nut lookup table == */ +/* qx2nut lookup table */ static item_t mecer_qx2nut[] = { - /* Query UPS for protocol (Voltronic Power UPSes) - * > [QPI\r] - * < [(PI98\r] - * 012345 - * 0 - */ - - { "ups.firmware.aux", 0, NULL, "QPI\r", "", 6, '(', "", 1, 4, "%s", QX_FLAG_STATIC, NULL, NULL, voltronic_p98_protocol }, - /* * > [Q1\r] * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] @@ -55,22 +37,23 @@ static item_t mecer_qx2nut[] = { * 0 1 2 3 4 */ - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL }, + { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL }, + { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL }, + { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL }, /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, 0, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, blazer_process_status_bits }, /* Beeper status */ /* * > [F\r] @@ -79,10 +62,10 @@ static item_t mecer_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL }, /* * > [I\r] @@ -91,211 +74,63 @@ static item_t mecer_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Instant commands * The UPS will reply '(ACK\r' in case of success, '(NAK\r' if the command is rejected or invalid */ - { "beeper.toggle", 0, NULL, "Q\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, mecer_process_test_battery }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "beeper.toggle", 0, NULL, "Q\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; - -/* == Testing table == */ +/* Testing table */ #ifdef TESTING static testing_t mecer_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "QPI\r", "(PI98\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "(ACK\r", -1 }, - { "S03\r", "(NAK\r", -1 }, - { "C\r", "(NAK\r", -1 }, - { "S02R0005\r", "(ACK\r", -1 }, - { "S.5R0000\r", "(ACK\r", -1 }, - { "T04\r", "(NAK\r", -1 }, - { "TL\r", "(ACK\r", -1 }, - { "T\r", "(NAK\r", -1 }, - { "CT\r", "(ACK\r", -1 }, + { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r" }, + { "F\r", "#230.0 000 024.0 50.0\r" }, + { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r" }, + { "Q\r", "(ACK\r" }, + { "S03\r", "(NAK\r" }, + { "C\r", "(NAK\r" }, + { "S02R0005\r", "(ACK\r" }, + { "S.5R0000\r", "(ACK\r" }, + { "T04\r", "(NAK\r" }, + { "TL\r", "(ACK\r" }, + { "T\r", "(NAK\r" }, + { "CT\r", "(ACK\r" }, { NULL } }; #endif /* TESTING */ - -/* == Support functions == */ - -/* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -static int mecer_claim(void) -{ - /* Apart from status (Q1), try to identify protocol (QPI, for Voltronic Power P98 units) or whether the UPS uses '(ACK\r'/'(NAK\r' replies */ - - item_t *item = find_nut_info("input.voltage", 0, 0); - - /* Don't know what happened */ - if (!item) - return 0; - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) - return 0; - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) - return 0; - - /* UPS Protocol */ - item = find_nut_info("ups.firmware.aux", 0, 0); - - /* Don't know what happened */ - if (!item) { - dstate_delinfo("input.voltage"); - return 0; - } - - /* No reply/Unable to get value/Command rejected */ - if (qx_process(item, NULL)) { - - /* No reply/Command echoed back or rejected with something other than '(NAK\r' -> Not a '(ACK/(NAK' unit */ - if (!strlen(item->answer) || strcasecmp(item->answer, "(NAK\r")) { - dstate_delinfo("input.voltage"); - return 0; - } - - /* Command rejected with '(NAK\r' -> '(ACK/(NAK' unit */ - - /* Skip protocol query from now on */ - item->qxflags |= QX_FLAG_SKIP; - - } else { - - /* Unable to process value/Command echoed back or rejected with something other than '(NAK\r'/Protocol not supported */ - if (ups_infoval_set(item) != 1) { - dstate_delinfo("input.voltage"); - return 0; - } - - /* Voltronic Power P98 unit */ - - } - - return 1; -} - /* Subdriver-specific initups */ static void mecer_initups(void) { + blazer_initups(mecer_qx2nut); + } - -/* == Preprocess functions == */ - -/* Protocol used by the UPS */ -static int voltronic_p98_protocol(item_t *item, char *value, const size_t valuelen) -{ - if (strcasecmp(item->value, "PI98")) { - upslogx(LOG_ERR, "Protocol [%s] is not supported by this driver", item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, "Voltronic Power P98"); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* *CMD* Preprocess 'test.battery.start' instant command */ -static int mecer_process_test_battery(item_t *item, char *value, const size_t valuelen) -{ - const char *protocol = dstate_getinfo("ups.firmware.aux"); - char buf[SMALLBUF] = ""; - long min, test_time; - - /* Voltronic P98 units -> Accepted values for test time: .2 -> .9 (.2=12sec ..), 01 -> 99 (minutes) -> range = [12..5940] */ - if (protocol && !strcasecmp(protocol, "Voltronic Power P98")) - min = 12; - /* Other units: 01 -> 99 (minutes) -> [60..5940] */ - else - min = 60; - - if (strlen(value) != strspn(value, "0123456789")) { - upslogx(LOG_ERR, "%s: non numerical value [%s]", item->info_type, value); - return -1; - } - - test_time = (strlen(value) > 0) ? strtol(value, NULL, 10) : 600; - - if ((test_time < min) || (test_time > 5940)) { - upslogx(LOG_ERR, - "%s: battery test time '%ld' out of range [%ld..5940] seconds", - item->info_type, test_time, min); - return -1; - } - - /* test time < 1 minute */ - if (test_time < 60) { - - test_time = test_time / 6; - snprintf(buf, sizeof(buf), ".%ld", test_time); - - /* test time > 1 minute */ - } else { - - test_time = test_time / 60; - snprintf(buf, sizeof(buf), "%02ld", test_time); - - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->command, buf); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - - -/* == Subdriver interface == */ +/* Subdriver interface */ subdriver_t mecer_subdriver = { MECER_VERSION, - mecer_claim, + blazer_claim, mecer_qx2nut, mecer_initups, NULL, diff --git a/drivers/nutdrv_qx_mecer.h b/drivers/nutdrv_qx_mecer.h index 7ad2914..43cae1f 100644 --- a/drivers/nutdrv_qx_mecer.h +++ b/drivers/nutdrv_qx_mecer.h @@ -1,4 +1,4 @@ -/* nutdrv_qx_mecer.h - Subdriver for Mecer/Voltronic Power P98 UPSes +/* nutdrv_qx_mecer.h - Subdriver for Mecer UPSes * * Copyright (C) * 2013 Daniele Pezzini diff --git a/drivers/nutdrv_qx_megatec-old.c b/drivers/nutdrv_qx_megatec-old.c index 4b6fdde..37372b2 100644 --- a/drivers/nutdrv_qx_megatec-old.c +++ b/drivers/nutdrv_qx_megatec-old.c @@ -25,7 +25,7 @@ #include "nutdrv_qx_megatec-old.h" -#define MEGATEC_OLD_VERSION "Megatec/old 0.07" +#define MEGATEC_OLD_VERSION "Megatec/old 0.01" /* qx2nut lookup table */ static item_t megatec_old_qx2nut[] = { @@ -37,22 +37,23 @@ static item_t megatec_old_qx2nut[] = { * 0 1 2 3 4 */ - { "input.voltage", 0, NULL, "D\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "D\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "D\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "D\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "D\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "D\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "D\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage", 0, NULL, "D\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.voltage.fault", 0, NULL, "D\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "D\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "D\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL }, + { "input.frequency", 0, NULL, "D\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL }, + { "battery.voltage", 0, NULL, "D\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL }, + { "ups.temperature", 0, NULL, "D\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL }, /* Status bits */ - { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "D\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "D\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "D\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "D\r", "", 47, '(', "", 41, 41, NULL, 0, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "D\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.alarm", 0, NULL, "D\r", "", 47, '(', "", 44, 44, NULL, 0, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.status", 0, NULL, "D\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "D\r", "", 47, '(', "", 45, 45, "%s", 0, blazer_process_status_bits }, /* Beeper status */ /* * > [F\r] @@ -61,10 +62,10 @@ static item_t megatec_old_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL }, /* * > [I\r] @@ -73,45 +74,45 @@ static item_t megatec_old_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; /* Testing table */ #ifdef TESTING static testing_t megatec_old_testing[] = { - { "D\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, + { "D\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r" }, + { "F\r", "#230.0 000 024.0 50.0\r" }, + { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r" }, + { "Q\r", "" }, + { "S03\r", "" }, + { "C\r", "" }, + { "S02R0005\r", "" }, + { "S.5R0000\r", "" }, + { "T04\r", "" }, + { "TL\r", "" }, + { "T\r", "" }, + { "CT\r", "" }, { NULL } }; #endif /* TESTING */ @@ -119,13 +120,15 @@ static testing_t megatec_old_testing[] = { /* Subdriver-specific initups */ static void megatec_old_initups(void) { + blazer_initups(megatec_old_qx2nut); + } /* Subdriver interface */ subdriver_t megatec_old_subdriver = { MEGATEC_OLD_VERSION, - blazer_claim_light, + blazer_claim, megatec_old_qx2nut, megatec_old_initups, NULL, diff --git a/drivers/nutdrv_qx_megatec.c b/drivers/nutdrv_qx_megatec.c index e22979a..c43a24e 100644 --- a/drivers/nutdrv_qx_megatec.c +++ b/drivers/nutdrv_qx_megatec.c @@ -25,7 +25,7 @@ #include "nutdrv_qx_megatec.h" -#define MEGATEC_VERSION "Megatec 0.06" +#define MEGATEC_VERSION "Megatec 0.01" /* qx2nut lookup table */ static item_t megatec_qx2nut[] = { @@ -37,22 +37,23 @@ static item_t megatec_qx2nut[] = { * 0 1 2 3 4 */ - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL }, + { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL }, + { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL }, + { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL }, /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, 0, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, blazer_process_status_bits }, /* Beeper status */ /* * > [F\r] @@ -61,10 +62,10 @@ static item_t megatec_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL }, /* * > [I\r] @@ -73,45 +74,45 @@ static item_t megatec_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; /* Testing table */ #ifdef TESTING static testing_t megatec_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, + { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r" }, + { "F\r", "#230.0 000 024.0 50.0\r" }, + { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r" }, + { "Q\r", "" }, + { "S03\r", "" }, + { "C\r", "" }, + { "S02R0005\r", "" }, + { "S.5R0000\r", "" }, + { "T04\r", "" }, + { "TL\r", "" }, + { "T\r", "" }, + { "CT\r", "" }, { NULL } }; #endif /* TESTING */ @@ -119,7 +120,9 @@ static testing_t megatec_testing[] = { /* Subdriver-specific initups */ static void megatec_initups(void) { + blazer_initups(megatec_qx2nut); + } /* Subdriver interface */ diff --git a/drivers/nutdrv_qx_mustek.c b/drivers/nutdrv_qx_mustek.c index 7990b41..ce85ccc 100644 --- a/drivers/nutdrv_qx_mustek.c +++ b/drivers/nutdrv_qx_mustek.c @@ -25,7 +25,7 @@ #include "nutdrv_qx_mustek.h" -#define MUSTEK_VERSION "Mustek 0.07" +#define MUSTEK_VERSION "Mustek 0.01" /* qx2nut lookup table */ static item_t mustek_qx2nut[] = { @@ -37,22 +37,23 @@ static item_t mustek_qx2nut[] = { * 0 1 2 3 4 */ - { "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL }, + { "input.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL }, + { "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL }, + { "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL }, /* Status bits */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, 0, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, blazer_process_status_bits }, /* Beeper status */ /* * > [F\r] @@ -61,10 +62,10 @@ static item_t mustek_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL }, /* * > [I\r] @@ -73,45 +74,45 @@ static item_t mustek_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; /* Testing table */ #ifdef TESTING static testing_t mustek_testing[] = { - { "QS\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, + { "QS\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r" }, + { "F\r", "#230.0 000 024.0 50.0\r" }, + { "I\r", "#NOT_A_LIVE_UPS TESTING TESTING \r" }, + { "Q\r", "" }, + { "S03\r", "" }, + { "C\r", "" }, + { "S02R0005\r", "" }, + { "S.5R0000\r", "" }, + { "T04\r", "" }, + { "TL\r", "" }, + { "T\r", "" }, + { "CT\r", "" }, { NULL } }; #endif /* TESTING */ @@ -119,13 +120,15 @@ static testing_t mustek_testing[] = { /* Subdriver-specific initups */ static void mustek_initups(void) { + blazer_initups(mustek_qx2nut); + } /* Subdriver interface */ subdriver_t mustek_subdriver = { MUSTEK_VERSION, - blazer_claim_light, + blazer_claim, mustek_qx2nut, mustek_initups, NULL, diff --git a/drivers/nutdrv_qx_q1.c b/drivers/nutdrv_qx_q1.c deleted file mode 100644 index 08073bc..0000000 --- a/drivers/nutdrv_qx_q1.c +++ /dev/null @@ -1,123 +0,0 @@ -/* nutdrv_qx_q1.c - Subdriver for Q1 protocol based UPSes - * - * Copyright (C) - * 2013 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * NOTE: - * This subdriver implements the same protocol as the one used by the 'megatec' subdriver minus the vendor (I) and ratings (F) queries. - * In the claim function: - * - it doesn't even try to get 'vendor' information (I) - * - it checks only status (Q1), through 'input.voltage' variable - * Therefore it should be able to work even if the UPS doesn't support vendor/ratings *and* the user doesn't use the 'novendor'/'norating' flags, as long as: - * - the UPS replies a Q1-compliant answer (i.e. not necessary filled with all of the Q1-required data, but at least of the right length and with not available data filled with some replacement character) - * - the UPS reports a valid input.voltage (used in the claim function) - * - the UPS reports valid status bits (1st, 2nd, 3rd, 6th, 7th are the mandatory ones) - * - */ - -#include "main.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" - -#include "nutdrv_qx_q1.h" - -#define Q1_VERSION "Q1 0.07" - -/* qx2nut lookup table */ -static item_t q1_qx2nut[] = { - - /* - * > [Q1\r] - * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] - * 01234567890123456789012345678901234567890123456 - * 0 1 2 3 4 - */ - - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, - /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ - - /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - -/* Testing table */ -#ifdef TESTING -static testing_t q1_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - -/* Subdriver-specific initups */ -static void q1_initups(void) -{ - blazer_initups_light(q1_qx2nut); -} - -/* Subdriver interface */ -subdriver_t q1_subdriver = { - Q1_VERSION, - blazer_claim_light, - q1_qx2nut, - q1_initups, - NULL, - blazer_makevartable_light, - "ACK", - NULL, -#ifdef TESTING - q1_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_q1.h b/drivers/nutdrv_qx_q1.h deleted file mode 100644 index d990ef7..0000000 --- a/drivers/nutdrv_qx_q1.h +++ /dev/null @@ -1,39 +0,0 @@ -/* nutdrv_qx_q1.h - Subdriver for Q1 protocol based UPSes - * - * Copyright (C) - * 2013 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * NOTE: - * This subdriver implements the same protocol as the one used by the 'megatec' subdriver minus the vendor (I) and ratings (F) queries. - * In the claim function: - * - it doesn't even try to get 'vendor' information (I) - * - it checks only status (Q1), through 'input.voltage' variable - * Therefore it should be able to work even if the UPS doesn't support vendor/ratings *and* the user doesn't use the 'novendor'/'norating' flags, as long as: - * - the UPS replies a Q1-compliant answer (i.e. not necessary filled with all of the Q1-required data, but at least of the right length and with not available data filled with some replacement character) - * - the UPS reports a valid input.voltage (used in the claim function) - * - the UPS reports valid status bits (1st, 2nd, 3rd, 6th, 7th are the mandatory ones) - * - */ - -#ifndef NUTDRV_QX_Q1_H -#define NUTDRV_QX_Q1_H - -#include "nutdrv_qx.h" - -extern subdriver_t q1_subdriver; - -#endif /* NUTDRV_QX_Q1_H */ diff --git a/drivers/nutdrv_qx_voltronic-qs-hex.c b/drivers/nutdrv_qx_voltronic-qs-hex.c deleted file mode 100644 index 9485fe0..0000000 --- a/drivers/nutdrv_qx_voltronic-qs-hex.c +++ /dev/null @@ -1,572 +0,0 @@ -/* nutdrv_qx_voltronic-qs-hex.c - Subdriver for Voltronic Power UPSes with QS-Hex protocol - * - * Copyright (C) - * 2014 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" - -#include "nutdrv_qx_voltronic-qs-hex.h" - -#define VOLTRONIC_QS_HEX_VERSION "Voltronic-QS-Hex 0.10" - -/* Support functions */ -static int voltronic_qs_hex_claim(void); -static void voltronic_qs_hex_initups(void); - -/* Answer preprocess functions */ -static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len); -static int voltronic_qs_hex_char_to_binary(const unsigned char value); - -/* Preprocess functions */ -static int voltronic_qs_hex_protocol(item_t *item, char *value, const size_t valuelen); -static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, const size_t valuelen); -static int voltronic_qs_hex_load(item_t *item, char *value, const size_t valuelen); -static int voltronic_qs_hex_frequency(item_t *item, char *value, const size_t valuelen); -static int voltronic_qs_hex_battery_voltage(item_t *item, char *value, const size_t valuelen); -static int voltronic_qs_hex_process_ratings_bits(item_t *item, char *value, const size_t valuelen); - - -/* == Ranges == */ - -/* Range for ups.delay.start */ -static info_rw_t voltronic_qs_hex_r_ondelay[] = { - { "60", 0 }, - { "599940", 0 }, - { "", 0 } -}; - -/* Range for ups.delay.shutdown */ -static info_rw_t voltronic_qs_hex_r_offdelay[] = { - { "12", 0 }, - { "540", 0 }, - { "", 0 } -}; - - -/* == qx2nut lookup table == */ -static item_t voltronic_qs_hex_qx2nut[] = { - - /* Query UPS for protocol - * > [M\r] - * < [P\r] - * 01 - * 0 - */ - - { "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "PM-%s", QX_FLAG_STATIC, NULL, NULL, voltronic_qs_hex_protocol }, - - /* Query UPS for status - * > [QS\r] - * < [#6C01 35 6C01 35 03 519A 1312D0 E6 1E 00001001\r] ('P' protocol, after being preprocessed) - * < [#6901 6C 6802 6C 00 5FD7 12C000 E4 1E 00001001 00000010\r] ('T' protocol, after being preprocessed) - * 01234567890123456789012345678901234567890123456789012345 - * 0 1 2 3 4 5 - */ - - { "input.voltage", 0, NULL, "QS\r", "", 47, '#', "", 1, 7, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage }, - { "output.voltage", 0, NULL, "QS\r", "", 47, '#', "", 9, 15, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_input_output_voltage }, - { "ups.load", 0, NULL, "QS\r", "", 47, '#', "", 17, 18, "%d", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_load }, - { "output.frequency", 0, NULL, "QS\r", "", 47, '#', "", 20, 30, "%.1f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_frequency }, - { "battery.voltage", 0, NULL, "QS\r", "", 47, '#', "", 32, 36, "%.2f", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_battery_voltage }, - /* Status bits */ - { "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "QS\r", "", 47, '#', "", 41, 41, NULL, 0, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "QS\r", "", 47, '#', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "QS\r", "", 47, '#', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "QS\r", "", 47, '#', "", 45, 45, "%s", 0, NULL, voltronic_qs_hex_preprocess_qs_answer, blazer_process_status_bits }, /* Beeper status */ - /* Ratings bits */ - { "output.frequency.nominal", 0, NULL, "QS\r", "", 56, '#', "", 47, 47, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, - { "battery.voltage.nominal", 0, NULL, "QS\r", "", 56, '#', "", 48, 49, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, -/* { "reserved.1", 0, NULL, "QS\r", "", 56, '#', "", 50, 50, "%s", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, *//* Reserved */ -/* { "reserved.2", 0, NULL, "QS\r", "", 56, '#', "", 51, 51, "%s", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, *//* Reserved */ - { "output.voltage.nominal", 0, NULL, "QS\r", "", 56, '#', "", 52, 54, "%.1f", QX_FLAG_SKIP, NULL, voltronic_qs_hex_preprocess_qs_answer, voltronic_qs_hex_process_ratings_bits }, - - /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, voltronic_qs_hex_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_hex_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - - -/* == Testing table == */ -#ifdef TESTING -static testing_t voltronic_qs_hex_testing[] = { - { "QS\r", "#\x6C\x01 \x35 \x6C\x01 \x35 \x03 \x51\x9A \x28\x02\x12\xD0 \xE6 \x1E \x09\r", 27 }, - { "M\r", "P\r", -1 }, - { "Q\r", "", -1 }, - { "S00R0000\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "N\r", -1 }, - { "T\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - - -/* == Support functions == */ - -/* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -static int voltronic_qs_hex_claim(void) -{ - /* We need at least M and QS to run this subdriver */ - - /* UPS Protocol */ - item_t *item = find_nut_info("ups.firmware.aux", 0, 0); - - /* Don't know what happened */ - if (!item) - return 0; - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) - return 0; - - /* Unable to process value/Protocol not supported */ - if (ups_infoval_set(item) != 1) - return 0; - - item = find_nut_info("input.voltage", 0, 0); - - /* Don't know what happened */ - if (!item) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - return 1; -} - -/* Subdriver-specific initups */ -static void voltronic_qs_hex_initups(void) -{ - blazer_initups_light(voltronic_qs_hex_qx2nut); -} - - -/* == Answer preprocess functions == */ - -/* Preprocess the answer we got back from the UPS when queried with 'QS\r' */ -static int voltronic_qs_hex_preprocess_qs_answer(item_t *item, const int len) -{ - int i, token; - char refined[SMALLBUF] = ""; - - if (len <= 0) - return len; - - if (item->answer[0] != '#') { - upsdebugx(4, "%s: wrong leading character [%s: 0x%0x]", __func__, item->info_type, item->answer[0]); - return -1; - } - - snprintf(refined, sizeof(refined), "%s", "#"); - - /* e.g.: item->answer = "#\x6C\x01 \x35 \x6C\x01 \x35 \x03 \x51\x9A \x28\x02\x12\xD0 \xE6 \x1E \x09\r" */ - upsdebug_hex(4, "read", item->answer, (size_t)len); - - for (i = 1, token = 1; i < len; i++) { - - /* New token */ - if (item->answer[i] == 0x20) { - snprintfcat(refined, sizeof(refined), "%s", " "); - token++; - continue; - } - - /* 'Unescape' raw data */ - if (i < len && item->answer[i] == 0x28) { - - switch (item->answer[i + 1]) - { - case 0x00: /* Escaped because: CR */ - snprintfcat(refined, sizeof(refined), "%02x", 0x0D); - break; - case 0x01: /* Escaped because: XON */ - snprintfcat(refined, sizeof(refined), "%02x", 0x11); - break; - case 0x02: /* Escaped because: XOFF */ - snprintfcat(refined, sizeof(refined), "%02x", 0x13); - break; - case 0x03: /* Escaped because: LF */ - snprintfcat(refined, sizeof(refined), "%02x", 0x0A); - break; - case 0x04: /* Escaped because: space */ - snprintfcat(refined, sizeof(refined), "%02x", 0x20); - break; - default: - if (token != 10 && token != 11) - snprintfcat(refined, sizeof(refined), "%02x", ((unsigned char *)item->answer)[i]); - else - snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_char_to_binary(((unsigned char *)item->answer)[i])); - continue; - } - - i++; - continue; - - } - - /* Trailing CR */ - if (item->answer[i] == 0x0D) - break; - - if (token != 10 && token != 11) - snprintfcat(refined, sizeof(refined), "%02x", ((unsigned char *)item->answer)[i]); - else - snprintfcat(refined, sizeof(refined), "%08d", voltronic_qs_hex_char_to_binary(((unsigned char *)item->answer)[i])); - - } - - if ( - token < 10 || - token > 11 || - (token == 10 && strlen(refined) != 46) || - (token == 11 && strlen(refined) != 55) - ) { - upsdebugx(2, "noncompliant reply: %s", refined); - return -1; - } - - upsdebugx(4, "read: %s", refined); - - /* e.g.: item->answer = "#6C01 35 6C01 35 03 519A 1312D0 E6 1E 00001001" */ - return snprintf(item->answer, sizeof(item->answer), "%s\r", refined); -} - -/* Transform a char into its binary form (as an int) */ -static int voltronic_qs_hex_char_to_binary(const unsigned char value) -{ - unsigned char remainder = value; - int ret = 0, - power = 1; - - while (remainder) { - - if (remainder & 1) - ret += power; - - power *= 10; - remainder >>= 1; - - } - - return ret; -} - - -/* == Preprocess functions == */ - -/* Protocol used by the UPS */ -static int voltronic_qs_hex_protocol(item_t *item, char *value, const size_t valuelen) -{ - item_t *unskip; - int i; - const struct { - const char *info_type; /* info_type of the item to be unskipped */ - const unsigned long flags; /* qxflags that have to be set in the item */ - const unsigned long noflags; /* qxflags that have to be absent in the item */ - } items_to_be_unskipped[] = { - { "test.battery.start.quick", QX_FLAG_CMD, 0 }, - { "output.frequency.nominal", 0, 0 }, - { "battery.voltage.nominal", 0, 0 }, - { "output.voltage.nominal", 0, 0 }, - { NULL, 0, 0 } - }; - - if (strcasecmp(item->value, "P") && strcasecmp(item->value, "T")) { - upsdebugx(2, "%s: invalid protocol [%s]", __func__, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, item->value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - /* Unskip items supported only by devices that implement 'T' protocol */ - - if (!strcasecmp(item->value, "P")) - return 0; - - for (i = 0; items_to_be_unskipped[i].info_type; i++) { - unskip = find_nut_info(items_to_be_unskipped[i].info_type, items_to_be_unskipped[i].flags, items_to_be_unskipped[i].noflags); - /* Don't know what happened */ - if (!unskip) - return -1; - unskip->qxflags &= ~QX_FLAG_SKIP; - } - - return 0; -} - -/* Input/Output voltage */ -static int voltronic_qs_hex_input_output_voltage(item_t *item, char *value, const size_t valuelen) -{ - long val; - double ret; - char *str_end; - - if (strspn(item->value, "0123456789ABCDEFabcdef ") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - val = strtol(item->value, &str_end, 16) * strtol(str_end, NULL, 16) / 51; - ret = val / 256.0; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, ret); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Device load */ -static int voltronic_qs_hex_load(item_t *item, char *value, const size_t valuelen) -{ - if (strspn(item->value, "0123456789ABCDEFabcdef") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, strtol(item->value, NULL, 16)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Output frequency */ -static int voltronic_qs_hex_frequency(item_t *item, char *value, const size_t valuelen) -{ - double val1, val2, ret; - char *str_end; - - if (strspn(item->value, "0123456789ABCDEFabcdef ") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - val1 = strtol(item->value, &str_end, 16); - val2 = strtol(str_end, NULL, 16); - - ret = val2 / val1; - ret = ret > 99.9 ? 99.9 : ret; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, ret); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Battery voltage */ -static int voltronic_qs_hex_battery_voltage(item_t *item, char *value, const size_t valuelen) -{ - long val1, val2; - char *str_end; - - if (strspn(item->value, "0123456789ABCDEFabcdef ") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); - return -1; - } - - val1 = strtol(item->value, &str_end, 16); - val2 = strtol(str_end, NULL, 16); - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, (val1 * val2) / 510.0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - -/* Ratings bits */ -static int voltronic_qs_hex_process_ratings_bits(item_t *item, char *value, const size_t valuelen) -{ - long val; - double ret; - - if (strspn(item->value, "01") != strlen(item->value)) { - upsdebugx(3, "%s: unexpected value %s@%d->%s", __func__, item->info_type, item->from, item->value); - return -1; - } - - val = strtol(item->value, NULL, 10); - - switch (item->from) - { - case 47: /* Nominal output frequency */ - if (val == 0) /* 0 -> 50 Hz */ - ret = 50; - else /* 1 -> 60 Hz */ - ret = 60; - break; - case 48: /* Nominal battery voltage */ - if (val == 0) /* 0 -> 12 V */ - ret = 12; - else if (val == 1) /* 1 -> 24 V */ - ret = 24; - else if (val == 10) /* 10 -> 36 V */ - ret = 36; - else /* 11 -> 48 V */ - ret = 48; - break; -/* case 50: *//* Reserved */ -/* break;*/ -/* case 51: *//* Reserved */ -/* break;*/ - case 52: /* Nominal output voltage */ - switch (val) - { - case 0: - ret = 110; - break; - case 1: - ret = 120; - break; - case 10: - ret = 220; - break; - case 11: - ret = 230; - break; - case 100: - ret = 240; - break; - default: - /* Unknown */ - return -1; - } - break; - default: - /* Don't know what happened */ - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, ret); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - - -/* == Subdriver interface == */ -subdriver_t voltronic_qs_hex_subdriver = { - VOLTRONIC_QS_HEX_VERSION, - voltronic_qs_hex_claim, - voltronic_qs_hex_qx2nut, - voltronic_qs_hex_initups, - NULL, - blazer_makevartable_light, - NULL, - "N\r", -#ifdef TESTING - voltronic_qs_hex_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_voltronic-qs-hex.h b/drivers/nutdrv_qx_voltronic-qs-hex.h deleted file mode 100644 index e4735df..0000000 --- a/drivers/nutdrv_qx_voltronic-qs-hex.h +++ /dev/null @@ -1,29 +0,0 @@ -/* nutdrv_qx_voltronic-qs-hex.h - Subdriver for Voltronic Power UPSes with QS-Hex protocol - * - * Copyright (C) - * 2014 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_VOLTRONIC_QS_HEX_H -#define NUTDRV_QX_VOLTRONIC_QS_HEX_H - -#include "nutdrv_qx.h" - -extern subdriver_t voltronic_qs_hex_subdriver; - -#endif /* NUTDRV_QX_VOLTRONIC_QS_HEX_H */ diff --git a/drivers/nutdrv_qx_voltronic-qs.c b/drivers/nutdrv_qx_voltronic-qs.c deleted file mode 100644 index 43df438..0000000 --- a/drivers/nutdrv_qx_voltronic-qs.c +++ /dev/null @@ -1,230 +0,0 @@ -/* nutdrv_qx_voltronic-qs.c - Subdriver for Voltronic Power UPSes with QS protocol - * - * Copyright (C) - * 2013 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include "nutdrv_qx.h" -#include "nutdrv_qx_blazer-common.h" - -#include "nutdrv_qx_voltronic-qs.h" - -#define VOLTRONIC_QS_VERSION "Voltronic-QS 0.07" - -/* Support functions */ -static int voltronic_qs_claim(void); -static void voltronic_qs_initups(void); - -/* Preprocess functions */ -static int voltronic_qs_protocol(item_t *item, char *value, const size_t valuelen); - - -/* == Ranges == */ - -/* Range for ups.delay.start */ -static info_rw_t voltronic_qs_r_ondelay[] = { - { "60", 0 }, - { "599940", 0 }, - { "", 0 } -}; - -/* Range for ups.delay.shutdown */ -static info_rw_t voltronic_qs_r_offdelay[] = { - { "12", 0 }, - { "540", 0 }, - { "", 0 } -}; - - -/* == qx2nut lookup table == */ -static item_t voltronic_qs_qx2nut[] = { - - /* Query UPS for protocol - * > [M\r] - * < [V\r] - * 01 - * 0 - */ - - { "ups.firmware.aux", 0, NULL, "M\r", "", 2, 0, "", 0, 0, "PM-%s", QX_FLAG_STATIC, NULL, NULL, voltronic_qs_protocol }, - - /* Query UPS for status - * > [QS\r] - * < [(226.0 195.0 226.0 014 49.0 27.5 30.0 00001000\r] - * 01234567890123456789012345678901234567890123456 - * 0 1 2 3 4 - */ - - { "input.voltage", 0, NULL, "QS\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "QS\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "QS\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "QS\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "output.frequency", 0, NULL, "QS\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "QS\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "QS\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, - /* Status bits */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "QS\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "QS\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "QS\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "QS\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ - - /* Query UPS for ratings - * > [F\r] - * < [#220.0 003 12.00 50.0\r] - * 0123456789012345678901 - * 0 1 2 - */ - - { "output.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "output.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "output.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - - /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - - /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, voltronic_qs_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, voltronic_qs_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - - /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } -}; - - -/* == Testing table == */ -#ifdef TESTING -static testing_t voltronic_qs_testing[] = { - { "QS\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#220.0 003 12.00 50.0\r", -1 }, - { "M\r", "V\r", -1 }, - { "Q\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T\r", "", -1 }, - { NULL } -}; -#endif /* TESTING */ - - -/* == Support functions == */ - -/* This function allows the subdriver to "claim" a device: return 1 if the device is supported by this subdriver, else 0. */ -static int voltronic_qs_claim(void) -{ - /* We need at least M and QS to run this subdriver */ - - /* UPS Protocol */ - item_t *item = find_nut_info("ups.firmware.aux", 0, 0); - - /* Don't know what happened */ - if (!item) - return 0; - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) - return 0; - - /* Unable to process value/Protocol not supported */ - if (ups_infoval_set(item) != 1) - return 0; - - item = find_nut_info("input.voltage", 0, 0); - - /* Don't know what happened */ - if (!item) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - /* No reply/Unable to get value */ - if (qx_process(item, NULL)) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - /* Unable to process value */ - if (ups_infoval_set(item) != 1) { - dstate_delinfo("ups.firmware.aux"); - return 0; - } - - return 1; -} - -/* Subdriver-specific initups */ -static void voltronic_qs_initups(void) -{ - blazer_initups_light(voltronic_qs_qx2nut); -} - - -/* == Preprocess functions == */ - -/* Protocol used by the UPS */ -static int voltronic_qs_protocol(item_t *item, char *value, const size_t valuelen) -{ - if (strcasecmp(item->value, "V")) { - upsdebugx(2, "%s: invalid protocol [%s]", __func__, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, item->value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - return 0; -} - - -/* == Subdriver interface == */ -subdriver_t voltronic_qs_subdriver = { - VOLTRONIC_QS_VERSION, - voltronic_qs_claim, - voltronic_qs_qx2nut, - voltronic_qs_initups, - NULL, - blazer_makevartable_light, - NULL, - NULL, -#ifdef TESTING - voltronic_qs_testing, -#endif /* TESTING */ -}; diff --git a/drivers/nutdrv_qx_voltronic-qs.h b/drivers/nutdrv_qx_voltronic-qs.h deleted file mode 100644 index ac9f39b..0000000 --- a/drivers/nutdrv_qx_voltronic-qs.h +++ /dev/null @@ -1,29 +0,0 @@ -/* nutdrv_qx_voltronic-qs.h - Subdriver for Voltronic Power UPSes with QS protocol - * - * Copyright (C) - * 2013 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUTDRV_QX_VOLTRONIC_QS_H -#define NUTDRV_QX_VOLTRONIC_QS_H - -#include "nutdrv_qx.h" - -extern subdriver_t voltronic_qs_subdriver; - -#endif /* NUTDRV_QX_VOLTRONIC_QS_H */ diff --git a/drivers/nutdrv_qx_voltronic.c b/drivers/nutdrv_qx_voltronic.c index 8e2f2ad..c6e44cf 100644 --- a/drivers/nutdrv_qx_voltronic.c +++ b/drivers/nutdrv_qx_voltronic.c @@ -20,57 +20,56 @@ */ #include "main.h" -#include "nut_float.h" -#include "nut_stdint.h" #include "nutdrv_qx.h" + #include "nutdrv_qx_voltronic.h" -#define VOLTRONIC_VERSION "Voltronic 0.06" +#define VOLTRONIC_VERSION "Voltronic 0.01" /* Support functions */ static int voltronic_claim(void); static void voltronic_makevartable(void); -static void voltronic_massive_unskip(const long protocol); +static void voltronic_massive_unskip(const int protocol); /* Range/enum functions */ -static int voltronic_batt_low(char *value, const size_t len); -static int voltronic_bypass_volt_max(char *value, const size_t len); -static int voltronic_bypass_volt_min(char *value, const size_t len); -static int voltronic_bypass_freq_max(char *value, const size_t len); -static int voltronic_bypass_freq_min(char *value, const size_t len); -static int voltronic_eco_freq_min(char *value, const size_t len); -static int voltronic_eco_freq_max(char *value, const size_t len); +static int voltronic_batt_low(char *value, size_t len); +static int voltronic_bypass_volt_max(char *value, size_t len); +static int voltronic_bypass_volt_min(char *value, size_t len); +static int voltronic_bypass_freq_max(char *value, size_t len); +static int voltronic_bypass_freq_min(char *value, size_t len); +static int voltronic_eco_freq_min(char *value, size_t len); +static int voltronic_eco_freq_max(char *value, size_t len); /* Preprocess functions */ -static int voltronic_process_setvar(item_t *item, char *value, const size_t valuelen); -static int voltronic_process_command(item_t *item, char *value, const size_t valuelen); -static int voltronic_capability(item_t *item, char *value, const size_t valuelen); -static int voltronic_capability_set(item_t *item, char *value, const size_t valuelen); -static int voltronic_capability_set_nonut(item_t *item, char *value, const size_t valuelen); -static int voltronic_capability_reset(item_t *item, char *value, const size_t valuelen); -static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen); -static int voltronic_eco_volt_range(item_t *item, char *value, const size_t valuelen); -static int voltronic_eco_freq(item_t *item, char *value, const size_t valuelen); -static int voltronic_bypass(item_t *item, char *value, const size_t valuelen); -static int voltronic_batt_numb(item_t *item, char *value, const size_t valuelen); -static int voltronic_batt_runtime(item_t *item, char *value, const size_t valuelen); -static int voltronic_protocol(item_t *item, char *value, const size_t valuelen); -static int voltronic_fault(item_t *item, char *value, const size_t valuelen); -static int voltronic_warning(item_t *item, char *value, const size_t valuelen); -static int voltronic_mode(item_t *item, char *value, const size_t valuelen); -static int voltronic_status(item_t *item, char *value, const size_t valuelen); -static int voltronic_output_powerfactor(item_t *item, char *value, const size_t valuelen); -static int voltronic_serial_numb(item_t *item, char *value, const size_t valuelen); -static int voltronic_outlet(item_t *item, char *value, const size_t valuelen); -static int voltronic_outlet_delay(item_t *item, char *value, const size_t valuelen); -static int voltronic_outlet_delay_set(item_t *item, char *value, const size_t valuelen); -static int voltronic_p31b(item_t *item, char *value, const size_t valuelen); -static int voltronic_p31b_set(item_t *item, char *value, const size_t valuelen); -static int voltronic_p31g(item_t *item, char *value, const size_t valuelen); -static int voltronic_p31g_set(item_t *item, char *value, const size_t valuelen); -static int voltronic_phase(item_t *item, char *value, const size_t valuelen); -static int voltronic_phase_set(item_t *item, char *value, const size_t valuelen); -static int voltronic_parallel(item_t *item, char *value, const size_t valuelen); +static int voltronic_process_setvar(item_t *item, char *value, size_t valuelen); +static int voltronic_process_command(item_t *item, char *value, size_t valuelen); +static int voltronic_capability(item_t *item, char *value, size_t valuelen); +static int voltronic_capability_set(item_t *item, char *value, size_t valuelen); +static int voltronic_capability_set_nonut(item_t *item, char *value, size_t valuelen); +static int voltronic_capability_reset(item_t *item, char *value, size_t valuelen); +static int voltronic_eco_volt(item_t *item, char *value, size_t valuelen); +static int voltronic_eco_volt_range(item_t *item, char *value, size_t valuelen); +static int voltronic_eco_freq(item_t *item, char *value, size_t valuelen); +static int voltronic_bypass(item_t *item, char *value, size_t valuelen); +static int voltronic_batt_numb(item_t *item, char *value, size_t valuelen); +static int voltronic_batt_runtime(item_t *item, char *value, size_t valuelen); +static int voltronic_protocol(item_t *item, char *value, size_t valuelen); +static int voltronic_fault(item_t *item, char *value, size_t valuelen); +static int voltronic_warning(item_t *item, char *value, size_t valuelen); +static int voltronic_mode(item_t *item, char *value, size_t valuelen); +static int voltronic_status(item_t *item, char *value, size_t valuelen); +static int voltronic_output_powerfactor(item_t *item, char *value, size_t valuelen); +static int voltronic_serial_numb(item_t *item, char *value, size_t valuelen); +static int voltronic_outlet(item_t *item, char *value, size_t valuelen); +static int voltronic_outlet_delay(item_t *item, char *value, size_t valuelen); +static int voltronic_outlet_delay_set(item_t *item, char *value, size_t valuelen); +static int voltronic_p31b(item_t *item, char *value, size_t valuelen); +static int voltronic_p31b_set(item_t *item, char *value, size_t valuelen); +static int voltronic_p31g(item_t *item, char *value, size_t valuelen); +static int voltronic_p31g_set(item_t *item, char *value, size_t valuelen); +static int voltronic_phase(item_t *item, char *value, size_t valuelen); +static int voltronic_phase_set(item_t *item, char *value, size_t valuelen); +static int voltronic_parallel(item_t *item, char *value, size_t valuelen); /* Capability vars */ static char *bypass_alarm, @@ -87,7 +86,7 @@ static char *bypass_alarm, *limited_runtime_on_battery; /* ups.conf settings */ -static long max_bypass_volt, +static int max_bypass_volt, min_bypass_volt, battery_number, output_phase_angle, @@ -130,12 +129,11 @@ static info_rw_t voltronic_r_batt_low[] = { }; /* Preprocess range value for battery low voltage */ -static int voltronic_batt_low(char *value, const size_t len) +static int voltronic_batt_low(char *value, size_t len) { - long val = strtol(value, NULL, 10); + int val = strtol(value, NULL, 10); const char *ovn = dstate_getinfo("output.voltage.nominal"), *ocn = dstate_getinfo("output.current.nominal"); - NUT_UNUSED_VARIABLE(len); if (!ovn || !ocn) { upsdebugx(2, "%s: unable to get the value of output voltage nominal/output current nominal", __func__); @@ -197,27 +195,26 @@ static info_rw_t voltronic_r_batt_numb[] = { /* Range for Bypass Mode maximum voltage */ static info_rw_t voltronic_r_bypass_volt_max[] = { { "60", voltronic_bypass_volt_max }, /* P09 */ - { "115", voltronic_bypass_volt_max }, /* P02/P03/P10/P13/P14/P99 ivn<200 */ + { "115", voltronic_bypass_volt_max }, /* P02/P03/P10/P14/P99 ivn<200 */ { "120", voltronic_bypass_volt_max }, /* P01 ivn<200 */ { "132", voltronic_bypass_volt_max }, /* P99 ivn<200 */ - { "138", voltronic_bypass_volt_max }, /* P02/P03/P10/P13/P14 ivn<200 */ + { "138", voltronic_bypass_volt_max }, /* P02/P03/P10/P14 ivn<200 */ { "140", voltronic_bypass_volt_max }, /* P01 ivn<200, P09 */ { "230", voltronic_bypass_volt_max }, /* P01 ivn>=200 */ - { "231", voltronic_bypass_volt_max }, /* P02/P03/P10/P13/P14/P99 ivn>=200 */ + { "231", voltronic_bypass_volt_max }, /* P02/P03/P10/P14/P99 ivn>=200 */ { "261", voltronic_bypass_volt_max }, /* P99 ivn>=200 */ { "264", voltronic_bypass_volt_max }, /* P01 ivn>=200 */ - { "276", voltronic_bypass_volt_max }, /* P02/P03/P10/P13/P14 ivn>=200 */ + { "276", voltronic_bypass_volt_max }, /* P02/P03/P10/P14 ivn>=200 */ { "", 0 } }; /* Preprocess range value for Bypass Mode maximum voltage */ -static int voltronic_bypass_volt_max(char *value, const size_t len) +static int voltronic_bypass_volt_max(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10), ivn; const char *involtnom = dstate_getinfo("input.voltage.nominal"); - NUT_UNUSED_VARIABLE(len); if (!involtnom) { upsdebugx(2, "%s: unable to get input.voltage.nominal", __func__); @@ -235,12 +232,12 @@ static int voltronic_bypass_volt_max(char *value, const size_t len) break; - case 115: /* P02/P03/P10/P13/P14/P99 ivn<200 */ + case 115: /* P02/P03/P10/P14/P99 ivn<200 */ if (ivn >= 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -265,12 +262,12 @@ static int voltronic_bypass_volt_max(char *value, const size_t len) break; - case 138: /* P02/P03/P10/P13/P14 ivn<200 */ + case 138: /* P02/P03/P10/P14 ivn<200 */ if (ivn >= 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14) + if (protocol == 2 || protocol == 2 || protocol == 10 || protocol == 14) return 0; break; @@ -298,12 +295,12 @@ static int voltronic_bypass_volt_max(char *value, const size_t len) break; - case 231: /* P02/P03/P10/P13/P14/P99 ivn>=200 */ + case 231: /* P02/P03/P10/P14/P99 ivn>=200 */ if (ivn < 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 2 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -328,12 +325,12 @@ static int voltronic_bypass_volt_max(char *value, const size_t len) break; - case 276: /* P02/P03/P10/P13/P14 ivn>=200 */ + case 276: /* P02/P03/P10/P14 ivn>=200 */ if (ivn < 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14) return 0; break; @@ -351,28 +348,27 @@ static int voltronic_bypass_volt_max(char *value, const size_t len) /* Range for Bypass Mode minimum voltage */ static info_rw_t voltronic_r_bypass_volt_min[] = { { "50", voltronic_bypass_volt_min }, /* P99 ivn<200 */ - { "55", voltronic_bypass_volt_min }, /* P02/P03/P10/P13/P14 ivn<200 */ + { "55", voltronic_bypass_volt_min }, /* P02/P03/P10/P14 ivn<200 */ { "60", voltronic_bypass_volt_min }, /* P09 */ { "85", voltronic_bypass_volt_min }, /* P01/P99 ivn<200 */ - { "104", voltronic_bypass_volt_min }, /* P02/P03/P10/P13/P14 ivn<200 */ - { "110", voltronic_bypass_volt_min }, /* P02/P03/P10/P13/P14 ivn>=200 */ + { "104", voltronic_bypass_volt_min }, /* P02/P03/P10/P14 ivn<200 */ + { "110", voltronic_bypass_volt_min }, /* P02/P03/P10/P14 ivn>=200 */ { "115", voltronic_bypass_volt_min }, /* P01 ivn<200 */ { "140", voltronic_bypass_volt_min }, /* P09 */ { "149", voltronic_bypass_volt_min }, /* P99 ivn>=200 */ { "170", voltronic_bypass_volt_min }, /* P01 ivn>=200 */ - { "209", voltronic_bypass_volt_min }, /* P02/P03/P10/P13/P14/P99 ivn>=200 */ + { "209", voltronic_bypass_volt_min }, /* P02/P03/P10/P14/P99 ivn>=200 */ { "220", voltronic_bypass_volt_min }, /* P01 ivn>=200 */ { "", 0 } }; /* Preprocess range value for Bypass Mode minimum voltage */ -static int voltronic_bypass_volt_min(char *value, const size_t len) +static int voltronic_bypass_volt_min(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10), ivn; const char *involtnom = dstate_getinfo("input.voltage.nominal"); - NUT_UNUSED_VARIABLE(len); if (!involtnom) { upsdebugx(2, "%s: unable to get input.voltage.nominal", __func__); @@ -393,12 +389,12 @@ static int voltronic_bypass_volt_min(char *value, const size_t len) break; - case 55: /* P02/P03/P10/P13/P14 ivn<200 */ + case 55: /* P02/P03/P10/P14 ivn<200 */ if (ivn >= 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 10 || protocol == 14) return 0; break; @@ -421,22 +417,22 @@ static int voltronic_bypass_volt_min(char *value, const size_t len) break; - case 104: /* P02/P03/P10/P13/P14 ivn<200 */ + case 104: /* P02/P03/P10/P14 ivn<200 */ if (ivn >= 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14) return 0; break; - case 110: /* P02/P03/P10/P13/P14 ivn>=200 */ + case 110: /* P02/P03/P10/P14 ivn>=200 */ if (ivn < 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14) return 0; break; @@ -471,12 +467,12 @@ static int voltronic_bypass_volt_min(char *value, const size_t len) break; - case 209: /* P02/P03/P10/P13/P14/P99 ivn>=200 */ + case 209: /* P02/P03/P10/P14/P99 ivn>=200 */ if (ivn < 200) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -503,23 +499,22 @@ static int voltronic_bypass_volt_min(char *value, const size_t len) /* Range for Bypass Mode maximum frequency */ static info_rw_t voltronic_r_bypass_freq_max[] = { - { "51.0", voltronic_bypass_freq_max }, /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==50.0 */ - { "54.0", voltronic_bypass_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "51.0", voltronic_bypass_freq_max }, /* P01/P09/P02/P03/P10/P14/P99 ofn==50.0 */ + { "54.0", voltronic_bypass_freq_max }, /* P02/P03/P10/P14/P99 ofn==50.0 */ { "60.0", voltronic_bypass_freq_max }, /* P01/P09 ofn==50.0 */ - { "61.0", voltronic_bypass_freq_max }, /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==60.0 */ - { "64.0", voltronic_bypass_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "61.0", voltronic_bypass_freq_max }, /* P01/P09/P02/P03/P10/P14/P99 ofn==60.0 */ + { "64.0", voltronic_bypass_freq_max }, /* P02/P03/P10/P14/P99 ofn==60.0 */ { "70.0", voltronic_bypass_freq_max }, /* P01/P09 ofn==60.0 */ { "", 0 } }; /* Preprocess range value for Bypass Mode maximum frequency */ -static int voltronic_bypass_freq_max(char *value, const size_t len) +static int voltronic_bypass_freq_max(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10); double ofn; const char *outfreqnom = dstate_getinfo("output.frequency.nominal"); - NUT_UNUSED_VARIABLE(len); if (!outfreqnom) { upsdebugx(2, "%s: unable to get output.frequency.nominal", __func__); @@ -530,22 +525,22 @@ static int voltronic_bypass_freq_max(char *value, const size_t len) switch (val) { - case 51: /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 51: /* P01/P09/P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; - case 54: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 54: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -560,22 +555,22 @@ static int voltronic_bypass_freq_max(char *value, const size_t len) break; - case 61: /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 61: /* P01/P09/P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; - case 64: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 64: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -603,22 +598,21 @@ static int voltronic_bypass_freq_max(char *value, const size_t len) /* Range for Bypass Mode minimum frequency */ static info_rw_t voltronic_r_bypass_freq_min[] = { { "40.0", voltronic_bypass_freq_min }, /* P01/P09 ofn==50.0 */ - { "46.0", voltronic_bypass_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ - { "49.0", voltronic_bypass_freq_min }, /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "46.0", voltronic_bypass_freq_min }, /* P02/P03/P10/P14/P99 ofn==50.0 */ + { "49.0", voltronic_bypass_freq_min }, /* P01/P09/P02/P03/P10/P14/P99 ofn==50.0 */ { "50.0", voltronic_bypass_freq_min }, /* P01/P09 ofn==60.0 */ - { "56.0", voltronic_bypass_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ - { "59.0", voltronic_bypass_freq_min }, /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "56.0", voltronic_bypass_freq_min }, /* P02/P03/P10/P14/P99 ofn==60.0 */ + { "59.0", voltronic_bypass_freq_min }, /* P01/P09/P02/P03/P10/P14/P99 ofn==60.0 */ { "", 0 } }; /* Preprocess range value for Bypass Mode minimum frequency */ -static int voltronic_bypass_freq_min(char *value, const size_t len) +static int voltronic_bypass_freq_min(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10); double ofn; const char *outfreqnom = dstate_getinfo("output.frequency.nominal"); - NUT_UNUSED_VARIABLE(len); if (!outfreqnom) { upsdebugx(2, "%s: unable to get output.frequency.nominal", __func__); @@ -639,22 +633,22 @@ static int voltronic_bypass_freq_min(char *value, const size_t len) break; - case 46: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 46: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; - case 49: /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 49: /* P01/P09/P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -669,22 +663,22 @@ static int voltronic_bypass_freq_min(char *value, const size_t len) break; - case 56: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 56: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; - case 59: /* P01/P09/P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 59: /* P01/P09/P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 1 || protocol == 2 || protocol == 3 || protocol == 9 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -716,24 +710,23 @@ static info_rw_t voltronic_r_eco_volt_min[] = { /* Range for ECO Mode minimum frequency */ static info_rw_t voltronic_r_eco_freq_min[] = { { "40.0", voltronic_eco_freq_min }, /* P01/P09 ofn==50.0 */ - { "46.0", voltronic_eco_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "46.0", voltronic_eco_freq_min }, /* P02/P03/P10/P14/P99 ofn==50.0 */ { "47.0", voltronic_eco_freq_min }, /* P01/P09 ofn==50.0 */ - { "48.0", voltronic_eco_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "48.0", voltronic_eco_freq_min }, /* P02/P03/P10/P14/P99 ofn==50.0 */ { "50.0", voltronic_eco_freq_min }, /* P01/P09 ofn==60.0 */ - { "56.0", voltronic_eco_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "56.0", voltronic_eco_freq_min }, /* P02/P03/P10/P14/P99 ofn==60.0 */ { "57.0", voltronic_eco_freq_min }, /* P01/P09 ofn==60.0 */ - { "58.0", voltronic_eco_freq_min }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "58.0", voltronic_eco_freq_min }, /* P02/P03/P10/P14/P99 ofn==60.0 */ { "", 0 } }; /* Preprocess range value for ECO Mode minimum frequency */ -static int voltronic_eco_freq_min(char *value, const size_t len) +static int voltronic_eco_freq_min(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10); double ofn; const char *outfreqnom = dstate_getinfo("output.frequency.nominal"); - NUT_UNUSED_VARIABLE(len); if (!outfreqnom) { upsdebugx(2, "%s: unable to get output.frequency.nominal", __func__); @@ -754,12 +747,12 @@ static int voltronic_eco_freq_min(char *value, const size_t len) break; - case 46: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 46: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -774,12 +767,12 @@ static int voltronic_eco_freq_min(char *value, const size_t len) break; - case 48: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 48: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -794,12 +787,12 @@ static int voltronic_eco_freq_min(char *value, const size_t len) break; - case 56: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 56: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -814,12 +807,12 @@ static int voltronic_eco_freq_min(char *value, const size_t len) break; - case 58: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 58: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -836,25 +829,24 @@ static int voltronic_eco_freq_min(char *value, const size_t len) /* Range for ECO Mode maximum frequency */ static info_rw_t voltronic_r_eco_freq_max[] = { - { "52.0", voltronic_eco_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "52.0", voltronic_eco_freq_max }, /* P02/P03/P10/P14/P99 ofn==50.0 */ { "53.0", voltronic_eco_freq_max }, /* P01/P09 ofn==50.0 */ - { "54.0", voltronic_eco_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + { "54.0", voltronic_eco_freq_max }, /* P02/P03/P10/P14/P99 ofn==50.0 */ { "60.0", voltronic_eco_freq_max }, /* P01/P09 ofn==50.0 */ - { "62.0", voltronic_eco_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "62.0", voltronic_eco_freq_max }, /* P02/P03/P10/P14/P99 ofn==60.0 */ { "63.0", voltronic_eco_freq_max }, /* P01/P09 ofn==60.0 */ - { "64.0", voltronic_eco_freq_max }, /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + { "64.0", voltronic_eco_freq_max }, /* P02/P03/P10/P14/P99 ofn==60.0 */ { "70.0", voltronic_eco_freq_max }, /* P01/P09 ofn==60.0 */ { "", 0 } }; /* Preprocess range value for ECO Mode maximum frequency */ -static int voltronic_eco_freq_max(char *value, const size_t len) +static int voltronic_eco_freq_max(char *value, size_t len) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10), val = strtol(value, NULL, 10); double ofn; const char *outfreqnom = dstate_getinfo("output.frequency.nominal"); - NUT_UNUSED_VARIABLE(len); if (!outfreqnom) { upsdebugx(2, "%s: unable to get output.frequency.nominal", __func__); @@ -865,12 +857,12 @@ static int voltronic_eco_freq_max(char *value, const size_t len) switch (val) { - case 52: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 52: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -885,12 +877,12 @@ static int voltronic_eco_freq_max(char *value, const size_t len) break; - case 54: /* P02/P03/P10/P13/P14/P99 ofn==50.0 */ + case 54: /* P02/P03/P10/P14/P99 ofn==50.0 */ if (ofn != 50.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -905,12 +897,12 @@ static int voltronic_eco_freq_max(char *value, const size_t len) break; - case 62: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 62: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -925,12 +917,12 @@ static int voltronic_eco_freq_max(char *value, const size_t len) break; - case 64: /* P02/P03/P10/P13/P14/P99 ofn==60.0 */ + case 64: /* P02/P03/P10/P14/P99 ofn==60.0 */ if (ofn != 60.0) return -1; - if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) + if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) return 0; break; @@ -980,7 +972,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "ups.firmware.aux", 0, NULL, "QPI\r", "", 6, '(', "", 1, 4, "%s", QX_FLAG_STATIC, NULL, NULL, voltronic_protocol }, + { "ups.firmware.aux", 0, NULL, "QPI\r", "", 6, '(', "", 1, 4, "%s", QX_FLAG_STATIC, voltronic_protocol }, /* Query UPS for ratings * > [QRI\r] @@ -989,10 +981,10 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 */ - { "output.voltage.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 1, 5, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "output.current.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 7, 9, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 11, 15, "%.1f", QX_FLAG_SEMI_STATIC, NULL, NULL, NULL }, /* as *per battery pack*: the value will change when the number of batteries is changed (battery_number through BATNn) */ - { "output.frequency.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 17, 20, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "output.voltage.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 1, 5, "%.1f", QX_FLAG_STATIC, NULL }, + { "output.current.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 7, 9, "%.0f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 11, 15, "%.1f", QX_FLAG_SEMI_STATIC, NULL }, /* as *per battery pack*: the value will change when the number of batteries is changed (battery_number through BATNn) */ + { "output.frequency.nominal", 0, NULL, "QRI\r", "", 22, '(', "", 17, 20, "%.1f", QX_FLAG_STATIC, NULL }, /* Query UPS for ratings * > [QMD\r] @@ -1001,15 +993,15 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 3 4 */ - { "device.model", 0, NULL, "QMD\r", "", 48, '(', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.power.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 17, 23, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "output.powerfactor", 0, NULL, "QMD\r", "", 48, '(', "", 25, 26, "%.1f", QX_FLAG_STATIC, NULL, NULL, voltronic_output_powerfactor }, - { "input.phases", 0, NULL, "QMD\r", "", 48, '(', "", 28, 28, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "output.phases", 0, NULL, "QMD\r", "", 48, '(', "", 30, 30, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 32, 34, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "output.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 36, 38, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, /* redundant with value from QRI */ -/* { "battery_number", ST_FLAG_RW, voltronic_r_batt_numb, "QMD\r", "", 48, '(', "", 40, 41, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, NULL, voltronic_batt_numb }, *//* redundant with value from QBV */ -/* { "battery.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 43, 46, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, *//* as *per battery* vs *per pack* reported by QRI */ + { "device.model", 0, NULL, "QMD\r", "", 48, '(', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.power.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 17, 23, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "output.powerfactor", 0, NULL, "QMD\r", "", 48, '(', "", 25, 26, "%.1f", QX_FLAG_STATIC, voltronic_output_powerfactor }, + { "input.phases", 0, NULL, "QMD\r", "", 48, '(', "", 28, 28, "%.0f", QX_FLAG_STATIC, NULL }, + { "output.phases", 0, NULL, "QMD\r", "", 48, '(', "", 30, 30, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 32, 34, "%.1f", QX_FLAG_STATIC, NULL }, + { "output.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 36, 38, "%.1f", QX_FLAG_STATIC, NULL }, /* redundant with value from QRI */ +/* { "battery_number", ST_FLAG_RW, voltronic_r_batt_numb, "QMD\r", "", 48, '(', "", 40, 41, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, voltronic_batt_numb }, *//* redundant with value from QBV */ +/* { "battery.voltage.nominal", 0, NULL, "QMD\r", "", 48, '(', "", 43, 46, "%.1f", QX_FLAG_STATIC, NULL }, *//* as *per battery* vs *per pack* reported by QRI */ /* Query UPS for ratings * > [F\r] @@ -1018,10 +1010,10 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.1f", QX_FLAG_STATIC, NULL }, /* Query UPS for manufacturer * > [QMF\r] @@ -1030,7 +1022,7 @@ static item_t voltronic_qx2nut[] = { * 0 1 */ - { "device.mfr", 0, NULL, "QMF\r", "", 2, '(', "", 1, 0, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "QMF\r", "", 2, '(', "", 1, 0, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Query UPS for firmware version * > [QVFW\r] @@ -1039,7 +1031,7 @@ static item_t voltronic_qx2nut[] = { * 0 1 */ - { "ups.firmware", 0, NULL, "QVFW\r", "", 16, '(', "", 7, 14, "%s", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "ups.firmware", 0, NULL, "QVFW\r", "", 16, '(', "", 7, 14, "%s", QX_FLAG_STATIC, NULL }, /* Query UPS for serial number * > [QID\r] @@ -1048,7 +1040,7 @@ static item_t voltronic_qx2nut[] = { * 0 1 */ - { "device.serial", 0, NULL, "QID\r", "", 2, '(', "", 1, 0, "%s", QX_FLAG_STATIC, NULL, NULL, voltronic_serial_numb }, + { "device.serial", 0, NULL, "QID\r", "", 2, '(', "", 1, 0, "%s", QX_FLAG_STATIC, voltronic_serial_numb }, /* Query UPS for vendor infos * > [I\r] @@ -1057,9 +1049,9 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "I\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "I\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "I\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Query UPS for status * > [QGS\r] @@ -1068,29 +1060,29 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 3 4 5 6 7 */ - { "input.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "QGS\r", "", 76, '(', "", 7, 10, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 12, 16, "%.1f", 0, NULL, NULL, NULL }, - { "output.frequency", 0, NULL, "QGS\r", "", 76, '(', "", 18, 21, "%.1f", 0, NULL, NULL, NULL }, - { "output.current", 0, NULL, "QGS\r", "", 76, '(', "", 23, 27, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "QGS\r", "", 76, '(', "", 29, 31, "%.0f", 0, NULL, NULL, NULL }, -/* { "unknown.1", 0, NULL, "QGS\r", "", 76, '(', "", 33, 37, "%.1f", 0, NULL, NULL, NULL }, *//* Unknown */ -/* { "unknown.2", 0, NULL, "QGS\r", "", 76, '(', "", 39, 43, "%.1f", 0, NULL, NULL, NULL }, *//* Unknown */ - { "battery.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 45, 49, "%.2f", 0, NULL, NULL, NULL }, -/* { "unknown.3", 0, NULL, "QGS\r", "", 76, '(', "", 51, 55, "%.1f", 0, NULL, NULL, NULL }, *//* Unknown */ - { "ups.temperature", 0, NULL, "QGS\r", "", 76, '(', "", 57, 61, "%.1f", 0, NULL, NULL, NULL }, - { "ups.type", 0, NULL, "QGS\r", "", 76, '(', "", 63, 64, "%s", QX_FLAG_SEMI_STATIC, NULL, NULL, voltronic_status }, - { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 65, 65, "%s", QX_FLAG_QUICK_POLL, NULL, NULL, voltronic_status }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 66, 66, "%s", QX_FLAG_QUICK_POLL, NULL, NULL, voltronic_status }, /* Battery Low */ - { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 67, 67, "%s", QX_FLAG_QUICK_POLL, NULL, NULL, voltronic_status }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "QGS\r", "", 76, '(', "", 67, 67, "%s", 0, NULL, NULL, voltronic_status }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "QGS\r", "", 76, '(', "", 68, 68, "%s", 0, NULL, NULL, voltronic_status }, /* UPS Fault */ -/* { "unknown.4", 0, NULL, "QGS\r", "", 76, '(', "", 69, 69, "%s", 0, NULL, NULL, voltronic_status }, *//* Unknown */ - { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 70, 70, "%s", QX_FLAG_QUICK_POLL, NULL, NULL, voltronic_status }, /* Test in Progress */ - { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 71, 71, "%s", QX_FLAG_QUICK_POLL, NULL, NULL, voltronic_status }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "QGS\r", "", 76, '(', "", 72, 72, "%s", 0, NULL, NULL, voltronic_status }, /* Beeper status - ups.beeper.status */ -/* { "unknown.5", 0, NULL, "QGS\r", "", 76, '(', "", 73, 73, "%s", 0, NULL, NULL, voltronic_status }, *//* Unknown */ -/* { "unknown.6", 0, NULL, "QGS\r", "", 76, '(', "", 74, 74, "%s", 0, NULL, NULL, voltronic_status }, *//* Unknown */ + { "input.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.frequency", 0, NULL, "QGS\r", "", 76, '(', "", 7, 10, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 12, 16, "%.1f", 0, NULL }, + { "output.frequency", 0, NULL, "QGS\r", "", 76, '(', "", 18, 21, "%.1f", 0, NULL }, + { "output.current", 0, NULL, "QGS\r", "", 76, '(', "", 23, 27, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "QGS\r", "", 76, '(', "", 29, 31, "%.0f", 0, NULL }, +/* { "unknown.1", 0, NULL, "QGS\r", "", 76, '(', "", 33, 37, "%.1f", 0, NULL }, *//* Unknown */ +/* { "unknown.2", 0, NULL, "QGS\r", "", 76, '(', "", 39, 43, "%.1f", 0, NULL }, *//* Unknown */ + { "battery.voltage", 0, NULL, "QGS\r", "", 76, '(', "", 45, 49, "%.2f", 0, NULL }, +/* { "unknown.3", 0, NULL, "QGS\r", "", 76, '(', "", 51, 55, "%.1f", 0, NULL }, *//* Unknown */ + { "ups.temperature", 0, NULL, "QGS\r", "", 76, '(', "", 57, 61, "%.1f", 0, NULL }, + { "ups.type", 0, NULL, "QGS\r", "", 76, '(', "", 63, 64, "%s", QX_FLAG_SEMI_STATIC, voltronic_status }, + { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 65, 65, "%s", QX_FLAG_QUICK_POLL, voltronic_status }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 66, 66, "%s", QX_FLAG_QUICK_POLL, voltronic_status }, /* Battery Low */ + { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 67, 67, "%s", QX_FLAG_QUICK_POLL, voltronic_status }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "QGS\r", "", 76, '(', "", 67, 67, "%s", 0, voltronic_status }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "QGS\r", "", 76, '(', "", 68, 68, "%s", 0, voltronic_status }, /* UPS Fault */ +/* { "unknown.4", 0, NULL, "QGS\r", "", 76, '(', "", 69, 69, "%s", 0, voltronic_status }, *//* Unknown */ + { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 70, 70, "%s", QX_FLAG_QUICK_POLL, voltronic_status }, /* Test in Progress */ + { "ups.status", 0, NULL, "QGS\r", "", 76, '(', "", 71, 71, "%s", QX_FLAG_QUICK_POLL, voltronic_status }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "QGS\r", "", 76, '(', "", 72, 72, "%s", 0, voltronic_status }, /* Beeper status - ups.beeper.status */ +/* { "unknown.5", 0, NULL, "QGS\r", "", 76, '(', "", 73, 73, "%s", 0, voltronic_status }, *//* Unknown */ +/* { "unknown.6", 0, NULL, "QGS\r", "", 76, '(', "", 74, 74, "%s", 0, voltronic_status }, *//* Unknown */ /* Query UPS for actual working mode * > [QMOD\r] @@ -1099,8 +1091,8 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "ups.alarm", 0, NULL, "QMOD\r", "", 3, '(', "", 1, 1, "%s", 0, NULL, NULL, voltronic_mode }, - { "ups.status", 0, NULL, "QMOD\r", "", 3, '(', "", 1, 1, "%s", 0, NULL, NULL, voltronic_mode }, + { "ups.alarm", 0, NULL, "QMOD\r", "", 3, '(', "", 1, 1, "%s", 0, voltronic_mode }, + { "ups.status", 0, NULL, "QMOD\r", "", 3, '(', "", 1, 1, "%s", 0, voltronic_mode }, /* Query UPS for faults and their type. Unskipped when a fault is found in 12bit flag of QGS, otherwise you'll get a fake reply. * > [QFS\r] @@ -1112,7 +1104,7 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 3 4 5 6 */ - { "ups.alarm", 0, NULL, "QFS\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SKIP, NULL, NULL, voltronic_fault }, + { "ups.alarm", 0, NULL, "QFS\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SKIP, voltronic_fault }, /* Query UPS for warnings and their type * > [QWS\r] @@ -1121,7 +1113,7 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 3 4 5 6 */ - { "ups.alarm", 0, NULL, "QWS\r", "", 66, '(', "", 1, 64, "%s", 0, NULL, NULL, voltronic_warning }, + { "ups.alarm", 0, NULL, "QWS\r", "", 66, '(', "", 1, 64, "%s", 0, voltronic_warning }, /* Query UPS for actual infos about battery * > [QBV\r] @@ -1130,11 +1122,11 @@ static item_t voltronic_qx2nut[] = { * 0 1 2 */ - { "battery.voltage", 0, NULL, "QBV\r", "", 21, '(', "", 1, 5, "%.2f", 0, NULL, NULL, NULL }, - { "battery_number", ST_FLAG_RW, voltronic_r_batt_numb, "QBV\r", "", 21, '(', "", 7, 9, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, NULL, voltronic_batt_numb }, /* Number of batteries that make a pack */ - { "battery.packs", ST_FLAG_RW, voltronic_r_batt_packs, "QBV\r", "", 21, '(', "", 10, 11, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, NULL, NULL, NULL }, /* Number of battery packs in parallel */ - { "battery.charge", 0, NULL, "QBV\r", "", 21, '(', "", 13, 15, "%.0f", 0, NULL, NULL, NULL }, - { "battery.runtime", 0, NULL, "QBV\r", "", 21, '(', "", 17, 19, "%.0f", 0, NULL, NULL, voltronic_batt_runtime }, + { "battery.voltage", 0, NULL, "QBV\r", "", 21, '(', "", 1, 5, "%.2f", 0, NULL }, + { "battery_number", ST_FLAG_RW, voltronic_r_batt_numb, "QBV\r", "", 21, '(', "", 7, 9, "%d", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT, voltronic_batt_numb }, /* Number of batteries that make a pack */ + { "battery.packs", ST_FLAG_RW, voltronic_r_batt_packs, "QBV\r", "", 21, '(', "", 10, 11, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, NULL }, /* Number of battery packs in parallel */ + { "battery.charge", 0, NULL, "QBV\r", "", 21, '(', "", 13, 15, "%.0f", 0, NULL }, + { "battery.runtime", 0, NULL, "QBV\r", "", 21, '(', "", 17, 19, "%.0f", 0, voltronic_batt_runtime }, /* Query UPS for last seen min/max load level * > [QLDL\r] @@ -1143,8 +1135,8 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "output.power.minimum.percent", 0, NULL, "QLDL\r", "", 9, '(', "", 1, 3, "%.0f", 0, NULL, NULL, NULL }, - { "output.power.maximum.percent", 0, NULL, "QLDL\r", "", 9, '(', "", 5, 7, "%.0f", 0, NULL, NULL, NULL }, + { "output.power.minimum.percent", 0, NULL, "QLDL\r", "", 9, '(', "", 1, 3, "%.0f", 0, NULL }, + { "output.power.maximum.percent", 0, NULL, "QLDL\r", "", 9, '(', "", 5, 7, "%.0f", 0, NULL }, /* Query UPS for multi-phase voltages/frequencies * > [Q3**\r] @@ -1177,50 +1169,50 @@ static item_t voltronic_qx2nut[] = { */ /* From Q3PV */ - { "input.L1-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L2-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L3-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L1-L2.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L2-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L1-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, -/* { "input.L1-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ -/* { "input.L2-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ + { "input.L1-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL }, + { "input.L2-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL }, + { "input.L3-N.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL }, + { "input.L1-L2.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL }, + { "input.L2-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL }, + { "input.L1-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL }, +/* { "input.L1-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ +/* { "input.L2-L3.voltage", 0, NULL, "Q3PV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ /* From Q3PC */ - { "input.L1.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L2.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "input.L3.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, + { "input.L1.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL }, + { "input.L2.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL }, + { "input.L3.current", 0, NULL, "Q3PC\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL }, /* From Q3OV */ - { "output.L1-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L2-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L3-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L1-L2.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L2-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L1-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, -/* { "output.L1-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ -/* { "output.L2-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ + { "output.L1-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.L2-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.L3-N.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.L1-L2.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.L2-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.L1-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL }, +/* { "output.L1-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ +/* { "output.L2-L3.voltage", 0, NULL, "Q3OV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ /* From Q3OC */ - { "output.L1.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L2.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L3.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, + { "output.L1.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL }, + { "output.L2.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL }, + { "output.L3.current", 0, NULL, "Q3OC\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL }, /* From Q3LD */ - { "output.L1.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L2.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.L3.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL, NULL, NULL }, + { "output.L1.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 1, 3, "%.0f", QX_FLAG_SKIP, NULL }, + { "output.L2.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 5, 7, "%.0f", QX_FLAG_SKIP, NULL }, + { "output.L3.power.percent", 0, NULL, "Q3LD\r", "", 13, '(', "", 9, 11, "%.0f", QX_FLAG_SKIP, NULL }, /* From Q3YV */ - { "output.bypass.L1-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.bypass.L2-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.bypass.L3-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.bypass.L1-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, /* P09 */ - { "output.bypass.L2-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, /* P09 */ -/* { "output.bypass.L3-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ - { "output.bypass.L1-L2.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.bypass.L2-L3.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, - { "output.bypass.L1-L3.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL, NULL, NULL }, + { "output.bypass.L1-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.bypass.L2-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.bypass.L3-N.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.bypass.L1-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 1, 5, "%.1f", QX_FLAG_SKIP, NULL }, /* P09 */ + { "output.bypass.L2-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 7, 11, "%.1f", QX_FLAG_SKIP, NULL }, /* P09 */ +/* { "output.bypass.L3-N.voltage", 0, NULL, "Q3YV\r", "", 19, '(', "", 13, 17, "%.1f", QX_FLAG_SKIP, NULL }, *//* P09 *//* Commented out because P09 should be two-phase input/output UPSes */ + { "output.bypass.L1-L2.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 19, 23, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.bypass.L2-L3.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 25, 29, "%.1f", QX_FLAG_SKIP, NULL }, + { "output.bypass.L1-L3.voltage", 0, NULL, "Q3YV\r", "", 37, '(', "", 31, 35, "%.1f", QX_FLAG_SKIP, NULL }, /* Query UPS for capability - total options available: 23; only those whom the UPS is capable of are reported as Enabled or Disabled * > [QFLAG\r] @@ -1229,24 +1221,24 @@ static item_t voltronic_qx2nut[] = { * 0 1 * min length = ( + E + D + \r = 4 */ - { "ups.start.auto", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, voltronic_capability }, - { "battery.protection", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, voltronic_capability }, - { "battery.energysave", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, voltronic_capability }, - { "ups.start.battery", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, voltronic_capability }, - { "outlet.0.switchable", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, NULL, NULL, voltronic_capability }, + { "ups.start.auto", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, voltronic_capability }, + { "battery.protection", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, voltronic_capability }, + { "battery.energysave", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, voltronic_capability }, + { "ups.start.battery", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, voltronic_capability }, + { "outlet.0.switchable", ST_FLAG_RW, voltronic_e_cap, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM, voltronic_capability }, /* Not available in NUT */ - { "bypass_alarm", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "battery_alarm", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "bypass_when_off", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "alarm_control", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "converter_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "eco_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "battery_open_status_check", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "bypass_forbidding", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "site_fault_detection", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "advanced_eco_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "constant_phase_angle", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, - { "limited_runtime_on_battery", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_capability }, + { "bypass_alarm", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "battery_alarm", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "bypass_when_off", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "alarm_control", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "converter_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "eco_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "battery_open_status_check", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "bypass_forbidding", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "site_fault_detection", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "advanced_eco_mode", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "constant_phase_angle", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, + { "limited_runtime_on_battery", 0, NULL, "QFLAG\r", "", 4, '(', "", 1, 0, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_capability }, /* Enable or Disable or Reset to safe default values capability options * > [PEX\r] > [PDX\r] > [PF\r] @@ -1255,25 +1247,25 @@ static item_t voltronic_qx2nut[] = { * 0 0 0 */ - { "ups.start.auto", 0, voltronic_e_cap, "P%sR\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set }, - { "battery.protection", 0, voltronic_e_cap, "P%sS\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set }, - { "battery.energysave", 0, voltronic_e_cap, "P%sG\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set }, - { "ups.start.battery", 0, voltronic_e_cap, "P%sC\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set }, - { "outlet.0.switchable", 0, voltronic_e_cap, "P%sJ\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set }, + { "ups.start.auto", 0, voltronic_e_cap, "P%sR\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_capability_set }, + { "battery.protection", 0, voltronic_e_cap, "P%sS\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_capability_set }, + { "battery.energysave", 0, voltronic_e_cap, "P%sG\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_capability_set }, + { "ups.start.battery", 0, voltronic_e_cap, "P%sC\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_capability_set }, + { "outlet.0.switchable", 0, voltronic_e_cap, "P%sJ\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_capability_set }, /* Not available in NUT */ - { "reset_to_default", 0, NULL, "PF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_reset }, - { "bypass_alarm", 0, voltronic_e_cap_nonut, "P%sP\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "battery_alarm", 0, voltronic_e_cap_nonut, "P%sB\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "bypass_when_off", 0, voltronic_e_cap_nonut, "P%sO\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "alarm_control", 0, voltronic_e_cap_nonut, "P%sA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "converter_mode", 0, voltronic_e_cap_nonut, "P%sV\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "eco_mode", 0, voltronic_e_cap_nonut, "P%sE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "battery_open_status_check", 0, voltronic_e_cap_nonut, "P%sD\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "bypass_forbidding", 0, voltronic_e_cap_nonut, "P%sF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "site_fault_detection", 0, voltronic_e_cap_nonut, "P%sL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "advanced_eco_mode", 0, voltronic_e_cap_nonut, "P%sN\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "constant_phase_angle", 0, voltronic_e_cap_nonut, "P%sQ\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, - { "limited_runtime_on_battery", 0, voltronic_e_cap_nonut, "P%sW\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_capability_set_nonut }, + { "reset_to_default", 0, NULL, "PF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_reset }, + { "bypass_alarm", 0, voltronic_e_cap_nonut, "P%sP\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "battery_alarm", 0, voltronic_e_cap_nonut, "P%sB\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "bypass_when_off", 0, voltronic_e_cap_nonut, "P%sO\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "alarm_control", 0, voltronic_e_cap_nonut, "P%sA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "converter_mode", 0, voltronic_e_cap_nonut, "P%sV\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "eco_mode", 0, voltronic_e_cap_nonut, "P%sE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "battery_open_status_check", 0, voltronic_e_cap_nonut, "P%sD\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "bypass_forbidding", 0, voltronic_e_cap_nonut, "P%sF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "site_fault_detection", 0, voltronic_e_cap_nonut, "P%sL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "advanced_eco_mode", 0, voltronic_e_cap_nonut, "P%sN\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "constant_phase_angle", 0, voltronic_e_cap_nonut, "P%sQ\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, + { "limited_runtime_on_battery", 0, voltronic_e_cap_nonut, "P%sW\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_capability_set_nonut }, /* Query UPS for programmable outlet (1-4) status * > [QSK1\r] @@ -1282,14 +1274,14 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "outlet.1.switchable", 0, NULL, "QSK1\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.1.status", 0, NULL, "QSK1\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.2.switchable", 0, NULL, "QSK2\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.2.status", 0, NULL, "QSK2\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.3.switchable", 0, NULL, "QSK3\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.3.status", 0, NULL, "QSK3\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.4.switchable", 0, NULL, "QSK4\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, - { "outlet.4.status", 0, NULL, "QSK4\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet }, + { "outlet.1.switchable", 0, NULL, "QSK1\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.1.status", 0, NULL, "QSK1\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.2.switchable", 0, NULL, "QSK2\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.2.status", 0, NULL, "QSK2\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.3.switchable", 0, NULL, "QSK3\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.3.status", 0, NULL, "QSK3\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.4.switchable", 0, NULL, "QSK4\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, + { "outlet.4.status", 0, NULL, "QSK4\r", "", 3, '(', "", 1, 1, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_outlet }, /* Query UPS for programmable outlet n (1-4) delay time before it shuts down the load when on battery mode * > [QSKT1\r] @@ -1298,10 +1290,10 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "outlet.1.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT1\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay }, - { "outlet.2.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT2\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay }, - { "outlet.3.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT3\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay }, - { "outlet.4.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT4\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay }, + { "outlet.1.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT1\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay }, + { "outlet.2.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT2\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay }, + { "outlet.3.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT3\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay }, + { "outlet.4.delay.shutdown", ST_FLAG_RW, voltronic_r_outlet_delay, "QSKT4\r", "", 5, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay }, /* Set delay time for programmable outlets * > [PSK1nnn\r] n = 0..9 @@ -1310,10 +1302,10 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "outlet.1.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK1%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay_set }, - { "outlet.2.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK2%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay_set }, - { "outlet.3.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK3%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay_set }, - { "outlet.4.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK4%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_outlet_delay_set }, + { "outlet.1.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK1%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay_set }, + { "outlet.2.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK2%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay_set }, + { "outlet.3.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK3%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay_set }, + { "outlet.4.delay.shutdown", 0, voltronic_r_outlet_delay, "PSK4%03d\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_outlet_delay_set }, /* Query UPS for ECO Mode voltage limits * > [QHE\r] @@ -1322,12 +1314,12 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "input.transfer.high", ST_FLAG_RW, voltronic_r_eco_volt_max, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt }, - { "input.transfer.low", ST_FLAG_RW, voltronic_r_eco_volt_min, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt }, - { "input.transfer.low.min", 0, NULL, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt_range }, - { "input.transfer.low.max", 0, NULL, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt_range }, - { "input.transfer.high.min", 0, NULL, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt_range }, - { "input.transfer.high.max", 0, NULL, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_volt_range }, + { "input.transfer.high", ST_FLAG_RW, voltronic_r_eco_volt_max, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_eco_volt }, + { "input.transfer.low", ST_FLAG_RW, voltronic_r_eco_volt_min, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_eco_volt }, + { "input.transfer.low.min", 0, NULL, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_eco_volt_range }, + { "input.transfer.low.max", 0, NULL, "QHE\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_eco_volt_range }, + { "input.transfer.high.min", 0, NULL, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_eco_volt_range }, + { "input.transfer.high.max", 0, NULL, "QHE\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_SKIP, voltronic_eco_volt_range }, /* Set ECO Mode voltage limits * > [HEHnnn\r] > [HELnnn\r] n = 0..9 @@ -1336,8 +1328,8 @@ static item_t voltronic_qx2nut[] = { * 0 0 */ - { "input.transfer.high", 0, voltronic_r_eco_volt_max, "HEH%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, - { "input.transfer.low", 0, voltronic_r_eco_volt_min, "HEL%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, + { "input.transfer.high", 0, voltronic_r_eco_volt_max, "HEH%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_process_setvar }, + { "input.transfer.low", 0, voltronic_r_eco_volt_min, "HEL%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_process_setvar }, /* Query UPS for ECO Mode frequency limits * > [QFRE\r] @@ -1346,8 +1338,8 @@ static item_t voltronic_qx2nut[] = { * 0 1 */ - { "input.frequency.high", ST_FLAG_RW, voltronic_r_eco_freq_max, "QFRE\r", "", 11, '(', "", 1, 4, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_freq }, - { "input.frequency.low", ST_FLAG_RW, voltronic_r_eco_freq_min, "QFRE\r", "", 11, '(', "", 6, 9, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_eco_freq }, + { "input.frequency.high", ST_FLAG_RW, voltronic_r_eco_freq_max, "QFRE\r", "", 11, '(', "", 1, 4, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_eco_freq }, + { "input.frequency.low", ST_FLAG_RW, voltronic_r_eco_freq_min, "QFRE\r", "", 11, '(', "", 6, 9, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_eco_freq }, /* Set ECO Mode frequency limits * > [FREHnn.n\r] > [FRELnn.n\r] n = 0..9 @@ -1356,8 +1348,8 @@ static item_t voltronic_qx2nut[] = { * 0 0 */ - { "input.frequency.high", 0, voltronic_r_eco_freq_max, "FREH%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, - { "input.frequency.low", 0, voltronic_r_eco_freq_min, "FREL%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, + { "input.frequency.high", 0, voltronic_r_eco_freq_max, "FREH%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_process_setvar }, + { "input.frequency.low", 0, voltronic_r_eco_freq_min, "FREL%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_SKIP, voltronic_process_setvar }, /* Query UPS for Bypass Mode voltage limits * > [QBYV\r] @@ -1366,8 +1358,8 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "max_bypass_volt", ST_FLAG_RW, voltronic_r_bypass_volt_max, "QBYV\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_bypass }, - { "min_bypass_volt", ST_FLAG_RW, voltronic_r_bypass_volt_min, "QBYV\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_bypass }, + { "max_bypass_volt", ST_FLAG_RW, voltronic_r_bypass_volt_max, "QBYV\r", "", 9, '(', "", 1, 3, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_bypass }, + { "min_bypass_volt", ST_FLAG_RW, voltronic_r_bypass_volt_min, "QBYV\r", "", 9, '(', "", 5, 7, "%.0f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_bypass }, /* Set Bypass Mode voltage limits * > [PHVnnn\r] > [PLVnnn\r] n = 0..9 @@ -1376,8 +1368,8 @@ static item_t voltronic_qx2nut[] = { * 0 0 */ - { "max_bypass_volt", 0, voltronic_r_bypass_volt_max, "PHV%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, - { "min_bypass_volt", 0, voltronic_r_bypass_volt_min, "PLV%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, + { "max_bypass_volt", 0, voltronic_r_bypass_volt_max, "PHV%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_process_setvar }, + { "min_bypass_volt", 0, voltronic_r_bypass_volt_min, "PLV%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_process_setvar }, /* Query UPS for Bypass Mode frequency limits * > [QBYF\r] @@ -1386,8 +1378,8 @@ static item_t voltronic_qx2nut[] = { * 0 1 */ - { "max_bypass_freq", ST_FLAG_RW, voltronic_r_bypass_freq_max, "QBYF\r", "", 11, '(', "", 1, 4, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_bypass }, - { "min_bypass_freq", ST_FLAG_RW, voltronic_r_bypass_freq_min, "QBYF\r", "", 11, '(', "", 6, 9, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_bypass }, + { "max_bypass_freq", ST_FLAG_RW, voltronic_r_bypass_freq_max, "QBYF\r", "", 11, '(', "", 1, 4, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_bypass }, + { "min_bypass_freq", ST_FLAG_RW, voltronic_r_bypass_freq_min, "QBYF\r", "", 11, '(', "", 6, 9, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_bypass }, /* Set Bypass Mode frequency limits * > [PGFnn.n\r] > [PSFnn.n\r] n = 0..9 @@ -1396,8 +1388,8 @@ static item_t voltronic_qx2nut[] = { * 0 0 */ - { "max_bypass_freq", 0, voltronic_r_bypass_freq_max, "PGF%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, - { "min_bypass_freq", 0, voltronic_r_bypass_freq_min, "PSF%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_process_setvar }, + { "max_bypass_freq", 0, voltronic_r_bypass_freq_max, "PGF%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_process_setvar }, + { "min_bypass_freq", 0, voltronic_r_bypass_freq_min, "PSF%04.1f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_process_setvar }, /* Set number of batteries that make a pack to n (integer, 1-9). NOTE: changing the number of batteries will change the UPS's estimation on battery charge/runtime * > [BATNn\r] @@ -1406,7 +1398,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery_number", 0, voltronic_r_batt_numb, "BATN%1.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT, NULL, NULL, voltronic_process_setvar }, + { "battery_number", 0, voltronic_r_batt_numb, "BATN%1.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE | QX_FLAG_NONUT, voltronic_process_setvar }, /* Set number of battery packs in parallel to n (integer, 01-99). NOTE: changing the number of battery packs will change the UPS's estimation on battery charge/runtime * > [BATGNn\r] @@ -1415,7 +1407,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery.packs", 0, voltronic_r_batt_packs, "BATGN%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, voltronic_process_setvar }, + { "battery.packs", 0, voltronic_r_batt_packs, "BATGN%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE, voltronic_process_setvar }, /* Query UPS for battery type (Only P31) * > [QBT\r] @@ -1424,7 +1416,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery.type", ST_FLAG_RW, voltronic_e_batt_type, "QBT\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_p31b }, + { "battery.type", ST_FLAG_RW, voltronic_e_batt_type, "QBT\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_p31b }, /* Set battery type (Only P31) * > [PBTnn\r] nn = 00/01/02 @@ -1433,7 +1425,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery.type", 0, voltronic_e_batt_type, "PBT%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, NULL, NULL, voltronic_p31b_set }, + { "battery.type", 0, voltronic_e_batt_type, "PBT%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_SKIP, voltronic_p31b_set }, /* Query UPS for device grid working range (Only P31) * > [QGR\r] @@ -1442,7 +1434,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "work_range_type", ST_FLAG_RW, voltronic_e_work_range, "QGR\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_p31g }, + { "work_range_type", ST_FLAG_RW, voltronic_e_work_range, "QGR\r", "", 4, '(', "", 1, 2, "%s", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_p31g }, /* Set device grid working range type (Only P31) * > [PBTnn\r] nn = 00/01 @@ -1451,7 +1443,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "work_range_type", 0, voltronic_e_work_range, "PGR%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_p31g_set }, + { "work_range_type", 0, voltronic_e_work_range, "PGR%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_p31g_set }, /* Query UPS for battery low voltage * > [RE0\r] @@ -1460,7 +1452,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery.voltage.low", ST_FLAG_RW, voltronic_r_batt_low, "RE0\r", "", 3, '#', "", 1, 2, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, NULL, NULL, NULL }, + { "battery.voltage.low", ST_FLAG_RW, voltronic_r_batt_low, "RE0\r", "", 3, '#', "", 1, 2, "%.1f", QX_FLAG_SEMI_STATIC | QX_FLAG_RANGE, NULL }, /* Set voltage for battery low to n (integer, 20..24/20..28). NOTE: changing the battery low voltage will change the UPS's estimation on battery charge/runtime * > [W0En\r] @@ -1469,7 +1461,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "battery.voltage.low", 0, voltronic_r_batt_low, "W0E%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, voltronic_process_setvar }, + { "battery.voltage.low", 0, voltronic_r_batt_low, "W0E%02.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_RANGE, voltronic_process_setvar }, /* Query UPS for Phase Angle * > [QPD\r] @@ -1478,8 +1470,8 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "input_phase_angle", 0, NULL, "QPD\r", "", 9, '(', "", 1, 3, "%03d", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_phase }, - { "output_phase_angle", ST_FLAG_RW, voltronic_e_phase, "QPD\r", "", 9, '(', "", 5, 7, "%03d", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_NONUT, NULL, NULL, voltronic_phase }, + { "input_phase_angle", 0, NULL, "QPD\r", "", 9, '(', "", 1, 3, "%03d", QX_FLAG_SEMI_STATIC | QX_FLAG_NONUT, voltronic_phase }, + { "output_phase_angle", ST_FLAG_RW, voltronic_e_phase, "QPD\r", "", 9, '(', "", 5, 7, "%03d", QX_FLAG_SEMI_STATIC | QX_FLAG_ENUM | QX_FLAG_NONUT, voltronic_phase }, /* Set output phase angle * > [PPDn\r] n = (000, 120, 180 or 240) @@ -1488,7 +1480,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "output_phase_angle", 0, voltronic_e_phase, "PPD%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, voltronic_phase_set }, + { "output_phase_angle", 0, voltronic_e_phase, "PPD%03.0f\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_SETVAR | QX_FLAG_ENUM | QX_FLAG_NONUT | QX_FLAG_SKIP, voltronic_phase_set }, /* Query UPS for master/slave for a system of UPSes in parallel * > [QPAR\r] @@ -1497,7 +1489,7 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "voltronic_parallel", 0, NULL, "QPAR\r", "", 5, '(', "", 1, 3, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT, NULL, NULL, voltronic_parallel }, + { "voltronic_parallel", 0, NULL, "QPAR\r", "", 5, '(', "", 1, 3, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT, voltronic_parallel }, /* Query UPS for ?? * > [QBDR\r] @@ -1506,167 +1498,167 @@ static item_t voltronic_qx2nut[] = { * 0 */ - { "unknown.7", 0, NULL, "QBDR\r", "", 5, '(', "", 1, 0, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL, NULL, NULL }, + { "unknown.7", 0, NULL, "QBDR\r", "", 5, '(', "", 1, 0, "%s", QX_FLAG_STATIC | QX_FLAG_NONUT | QX_FLAG_SKIP, NULL }, /* Instant commands */ - { "load.off", 0, NULL, "SOFF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "SON\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "load.off", 0, NULL, "SOFF\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "SON\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, voltronic_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, voltronic_process_command }, - { "shutdown.stop", 0, NULL, "CS\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, voltronic_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, voltronic_process_command }, + { "shutdown.stop", 0, NULL, "CS\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, - { "test.battery.start", 0, NULL, "T%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, voltronic_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "test.battery.start", 0, NULL, "T%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, voltronic_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL }, - { "beeper.toggle", 0, NULL, "BZ%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, NULL, NULL, voltronic_process_command }, + { "beeper.toggle", 0, NULL, "BZ%s\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD, voltronic_process_command }, /* Enable/disable beeper: unskipped if the UPS can control alarm (capability) */ - { "beeper.enable", 0, NULL, "PEA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "beeper.disable", 0, NULL, "PDA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, + { "beeper.enable", 0, NULL, "PEA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "beeper.disable", 0, NULL, "PDA\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, /* Outlet control: unskipped if the outlets are manageable */ - { "outlet.1.load.off", 0, NULL, "SKOFF1\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.1.load.on", 0, NULL, "SKON1\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.2.load.off", 0, NULL, "SKOFF2\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.2.load.on", 0, NULL, "SKON2\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.3.load.off", 0, NULL, "SKOFF3\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.3.load.on", 0, NULL, "SKON3\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.4.load.off", 0, NULL, "SKOFF4\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "outlet.4.load.on", 0, NULL, "SKON4\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, + { "outlet.1.load.off", 0, NULL, "SKOFF1\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.1.load.on", 0, NULL, "SKON1\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.2.load.off", 0, NULL, "SKOFF2\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.2.load.on", 0, NULL, "SKON2\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.3.load.off", 0, NULL, "SKOFF3\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.3.load.on", 0, NULL, "SKON3\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.4.load.off", 0, NULL, "SKOFF4\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "outlet.4.load.on", 0, NULL, "SKON4\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, /* Bypass: unskipped if the UPS is capable of ECO Mode */ - { "bypass.start", 0, NULL, "PEE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, - { "bypass.stop", 0, NULL, "PDE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL, NULL, NULL }, + { "bypass.start", 0, NULL, "PEE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, + { "bypass.stop", 0, NULL, "PDE\r", "", 5, '(', "", 1, 3, NULL, QX_FLAG_CMD | QX_FLAG_SKIP, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, voltronic_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, voltronic_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, voltronic_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, voltronic_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, voltronic_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, voltronic_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, voltronic_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, voltronic_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; /* == Testing table == */ #ifdef TESTING static testing_t voltronic_testing[] = { - { "QGS\r", "(234.9 50.0 229.8 50.0 000.0 00A 369.1 ---.- 026.5 ---.- 018.8 100000000001\r", -1 }, - { "QPI\r", "(PI01\r", -1 }, - { "QRI\r", "(230.0 004 024.0 50.0\r", -1 }, - { "QMF\r", "(#####VOLTRONIC\r", -1 }, - { "I\r", "#------------- ------ VT12046Q \r", -1 }, - { "F\r", "#220.0 000 024.0 50.0\r", -1 }, - { "QMD\r", "(#######OLHVT1K0 ###1000 80 2/2 230 230 02 12.0\r", -1 }, - { "QFS\r", "(14 212.1 50.0 005.6 49.9 006 010.6 343.8 ---.- 026.2 021.8 01101100\r", -1 }, - { "QMOD\r", "(S\r", -1 }, - { "QVFW\r", "(VERFW:00322.02\r", -1 }, - { "QID\r", "(685653211455\r", -1 }, - { "QBV\r", "(026.5 02 01 068 255\r", -1 }, - { "QFLAG\r", "(EpashcjDbroegfl\r", -1 }, - { "QWS\r", "(0000000000000000000000000000000000000000000000000000000001000001\r", -1 }, - { "QHE\r", "(242 218\r", -1 }, - { "QBYV\r", "(264 170\r", -1 }, - { "QBYF\r", "(53.0 47.0\r", -1 }, - { "QSK1\r", "(1\r", -1 }, - { "QSK2\r", "(0\r", -1 }, - { "QSK3\r", "(1\r", -1 }, - { "QSK4\r", "(NAK\r", -1 }, - { "QSKT1\r", "(008\r", -1 }, - { "QSKT2\r", "(012\r", -1 }, - { "QSKT3\r", "(NAK\r", -1 }, - { "QSKT4\r", "(007\r", -1 }, - { "RE0\r", "#20\r", -1 }, - { "W0E24\r", "(ACK\r", -1 }, - { "PF\r", "(ACK\r", -1 }, - { "PEA\r", "(ACK\r", -1 }, - { "PDR\r", "(NAK\r", -1 }, - { "HEH250\r", "(ACK\r", -1 }, - { "HEL210\r", "(ACK\r", -1 }, - { "PHV260\r", "(NAK\r", -1 }, - { "PLV190\r", "(ACK\r", -1 }, - { "PGF51.0\r", "(NAK\r", -1 }, - { "PSF47.5\r", "(ACK\r", -1 }, - { "BATN2\r", "(ACK\r", -1 }, - { "BATGN04\r", "(ACK\r", -1 }, - { "QBT\r", "(01\r", -1 }, - { "PBT02\r", "(ACK\r", -1 }, - { "QGR\r", "(00\r", -1 }, - { "PGR01\r", "(ACK\r", -1 }, - { "PSK1008\r", "(ACK\r", -1 }, - { "PSK3987\r", "(ACK\r", -1 }, - { "PSK2009\r", "(ACK\r", -1 }, - { "PSK4012\r", "(ACK\r", -1 }, - { "Q3PV\r", "(123.4 456.4 789.4 012.4 323.4 223.4\r", -1 }, - { "Q3OV\r", "(253.4 163.4 023.4 143.4 103.4 523.4\r", -1 }, - { "Q3OC\r", "(109 069 023\r", -1 }, - { "Q3LD\r", "(005 033 089\r", -1 }, - { "Q3YV\r", "(303.4 245.4 126.4 222.4 293.4 321.4\r", -1 }, - { "Q3PC\r", "(002 023 051\r", -1 }, - { "SOFF\r", "(NAK\r", -1 }, - { "SON\r", "(ACK\r", -1 }, - { "T\r", "(NAK\r", -1 }, - { "TL\r", "(ACK\r", -1 }, - { "CS\r", "(ACK\r", -1 }, - { "CT\r", "(NAK\r", -1 }, - { "BZOFF\r", "(ACK\r", -1 }, - { "BZON\r", "(ACK\r", -1 }, - { "S.3R0002\r", "(ACK\r", -1 }, - { "S02R0024\r", "(NAK\r", -1 }, - { "S.5\r", "(ACK\r", -1 }, - { "T.3\r", "(ACK\r", -1 }, - { "T02\r", "(NAK\r", -1 }, - { "SKON1\r", "(ACK\r", -1 }, - { "SKOFF1\r", "(NAK\r", -1 }, - { "SKON2\r", "(ACK\r", -1 }, - { "SKOFF2\r", "(ACK\r", -1 }, - { "SKON3\r", "(NAK\r", -1 }, - { "SKOFF3\r", "(ACK\r", -1 }, - { "SKON4\r", "(NAK\r", -1 }, - { "SKOFF4\r", "(NAK\r", -1 }, - { "QPAR\r", "(003\r", -1 }, - { "QPD\r", "(000 240\r", -1 }, - { "PPD120\r", "(ACK\r", -1 }, - { "QLDL\r", "(005 080\r", -1 }, - { "QBDR\r", "(1234\r", -1 }, - { "QFRE\r", "(50.0 00.0\r", -1 }, - { "FREH54.0\r", "(ACK\r", -1 }, - { "FREL47.0\r", "(ACK\r", -1 }, - { "PEP\r", "(ACK\r", -1 }, - { "PDP\r", "(ACK\r", -1 }, - { "PEB\r", "(ACK\r", -1 }, - { "PDB\r", "(ACK\r", -1 }, - { "PER\r", "(NAK\r", -1 }, - { "PDR\r", "(NAK\r", -1 }, - { "PEO\r", "(ACK\r", -1 }, - { "PDO\r", "(ACK\r", -1 }, - { "PEA\r", "(ACK\r", -1 }, - { "PDA\r", "(ACK\r", -1 }, - { "PES\r", "(ACK\r", -1 }, - { "PDS\r", "(ACK\r", -1 }, - { "PEV\r", "(ACK\r", -1 }, - { "PDV\r", "(ACK\r", -1 }, - { "PEE\r", "(ACK\r", -1 }, - { "PDE\r", "(ACK\r", -1 }, - { "PEG\r", "(ACK\r", -1 }, - { "PDG\r", "(NAK\r", -1 }, - { "PED\r", "(ACK\r", -1 }, - { "PDD\r", "(ACK\r", -1 }, - { "PEC\r", "(ACK\r", -1 }, - { "PDC\r", "(NAK\r", -1 }, - { "PEF\r", "(NAK\r", -1 }, - { "PDF\r", "(ACK\r", -1 }, - { "PEJ\r", "(NAK\r", -1 }, - { "PDJ\r", "(ACK\r", -1 }, - { "PEL\r", "(ACK\r", -1 }, - { "PDL\r", "(ACK\r", -1 }, - { "PEN\r", "(ACK\r", -1 }, - { "PDN\r", "(ACK\r", -1 }, - { "PEQ\r", "(ACK\r", -1 }, - { "PDQ\r", "(ACK\r", -1 }, - { "PEW\r", "(NAK\r", -1 }, - { "PDW\r", "(ACK\r", -1 }, + { "QGS\r", "(234.9 50.0 229.8 50.0 000.0 00A 369.1 ---.- 026.5 ---.- 018.8 100000000001\r" }, + { "QPI\r", "(PI01\r" }, + { "QRI\r", "(230.0 004 024.0 50.0\r" }, + { "QMF\r", "(#####VOLTRONIC\r" }, + { "I\r", "#------------- ------ VT12046Q \r" }, + { "F\r", "#220.0 000 024.0 50.0\r" }, + { "QMD\r", "(#######OLHVT1K0 ###1000 80 2/2 230 230 02 12.0\r" }, + { "QFS\r", "(14 212.1 50.0 005.6 49.9 006 010.6 343.8 ---.- 026.2 021.8 01101100\r" }, + { "QMOD\r", "(S\r" }, + { "QVFW\r", "(VERFW:00322.02\r" }, + { "QID\r", "(685653211455\r" }, + { "QBV\r", "(026.5 02 01 068 255\r" }, + { "QFLAG\r", "(EpashcjDbroegfl\r" }, + { "QWS\r", "(0000000000000000000000000000000000000000000000000000000001000001\r" }, + { "QHE\r", "(242 218\r" }, + { "QBYV\r", "(264 170\r" }, + { "QBYF\r", "(53.0 47.0\r" }, + { "QSK1\r", "(1\r" }, + { "QSK2\r", "(0\r" }, + { "QSK3\r", "(1\r" }, + { "QSK4\r", "(NAK\r" }, + { "QSKT1\r", "(008\r" }, + { "QSKT2\r", "(012\r" }, + { "QSKT3\r", "(NAK\r" }, + { "QSKT4\r", "(007\r" }, + { "RE0\r", "#20\r" }, + { "W0E24\r", "(ACK\r" }, + { "PF\r", "(ACK\r" }, + { "PEA\r", "(ACK\r" }, + { "PDR\r", "(NAK\r" }, + { "HEH250\r", "(ACK\r" }, + { "HEL210\r", "(ACK\r" }, + { "PHV260\r", "(NAK\r" }, + { "PLV190\r", "(ACK\r" }, + { "PGF51.0\r", "(NAK\r" }, + { "PSF47.5\r", "(ACK\r" }, + { "BATN2\r", "(ACK\r" }, + { "BATGN04\r", "(ACK\r" }, + { "QBT\r", "(01\r" }, + { "PBT02\r", "(ACK\r" }, + { "QGR\r", "(00\r" }, + { "PGR01\r", "(ACK\r" }, + { "PSK1008\r", "(ACK\r" }, + { "PSK3987\r", "(ACK\r" }, + { "PSK2009\r", "(ACK\r" }, + { "PSK4012\r", "(ACK\r" }, + { "Q3PV\r", "(123.4 456.4 789.4 012.4 323.4 223.4\r" }, + { "Q3OV\r", "(253.4 163.4 023.4 143.4 103.4 523.4\r" }, + { "Q3OC\r", "(109 069 023\r" }, + { "Q3LD\r", "(005 033 089\r" }, + { "Q3YV\r", "(303.4 245.4 126.4 222.4 293.4 321.4\r" }, + { "Q3PC\r", "(002 023 051\r" }, + { "SOFF\r", "(NAK\r" }, + { "SON\r", "(ACK\r" }, + { "T\r", "(NAK\r" }, + { "TL\r", "(ACK\r" }, + { "CS\r", "(ACK\r" }, + { "CT\r", "(NAK\r" }, + { "BZOFF\r", "(ACK\r" }, + { "BZON\r", "(ACK\r" }, + { "S.3R0002\r", "(ACK\r" }, + { "S02R0024\r", "(NAK\r" }, + { "S.5\r", "(ACK\r" }, + { "T.3\r", "(ACK\r" }, + { "T02\r", "(NAK\r" }, + { "SKON1\r", "(ACK\r" }, + { "SKOFF1\r", "(NAK\r" }, + { "SKON2\r", "(ACK\r" }, + { "SKOFF2\r", "(ACK\r" }, + { "SKON3\r", "(NAK\r" }, + { "SKOFF3\r", "(ACK\r" }, + { "SKON4\r", "(NAK\r" }, + { "SKOFF4\r", "(NAK\r" }, + { "QPAR\r", "(003\r" }, + { "QPD\r", "(000 240\r" }, + { "PPD120\r", "(ACK\r" }, + { "QLDL\r", "(005 080\r" }, + { "QBDR\r", "(1234\r" }, + { "QFRE\r", "(50.0 00.0\r" }, + { "FREH54.0\r", "(ACK\r" }, + { "FREL47.0\r", "(ACK\r" }, + { "PEP\r", "(ACK\r" }, + { "PDP\r", "(ACK\r" }, + { "PEB\r", "(ACK\r" }, + { "PDB\r", "(ACK\r" }, + { "PER\r", "(NAK\r" }, + { "PDR\r", "(NAK\r" }, + { "PEO\r", "(ACK\r" }, + { "PDO\r", "(ACK\r" }, + { "PEA\r", "(ACK\r" }, + { "PDA\r", "(ACK\r" }, + { "PES\r", "(ACK\r" }, + { "PDS\r", "(ACK\r" }, + { "PEV\r", "(ACK\r" }, + { "PDV\r", "(ACK\r" }, + { "PEE\r", "(ACK\r" }, + { "PDE\r", "(ACK\r" }, + { "PEG\r", "(ACK\r" }, + { "PDG\r", "(NAK\r" }, + { "PED\r", "(ACK\r" }, + { "PDD\r", "(ACK\r" }, + { "PEC\r", "(ACK\r" }, + { "PDC\r", "(NAK\r" }, + { "PEF\r", "(NAK\r" }, + { "PDF\r", "(ACK\r" }, + { "PEJ\r", "(NAK\r" }, + { "PDJ\r", "(ACK\r" }, + { "PEL\r", "(ACK\r" }, + { "PDL\r", "(ACK\r" }, + { "PEN\r", "(ACK\r" }, + { "PDN\r", "(ACK\r" }, + { "PEQ\r", "(ACK\r" }, + { "PDQ\r", "(ACK\r" }, + { "PEW\r", "(NAK\r" }, + { "PDW\r", "(ACK\r" }, { NULL } }; #endif /* TESTING */ @@ -1757,7 +1749,7 @@ static void voltronic_makevartable(void) } /* Unskip vars according to protocol used by the UPS */ -static void voltronic_massive_unskip(const long protocol) +static void voltronic_massive_unskip(const int protocol) { item_t *item; @@ -1851,16 +1843,14 @@ static void voltronic_massive_unskip(const long protocol) /* == Preprocess functions == */ /* *SETVAR(/NONUT)* Preprocess setvars */ -static int voltronic_process_setvar(item_t *item, char *value, const size_t valuelen) +static int voltronic_process_setvar(item_t *item, char *value, size_t valuelen) { - double val; - if (!strlen(value)) { upsdebugx(2, "%s: value not given for %s", __func__, item->info_type); return -1; } - val = strtod(value, NULL); + double val = strtod(value, NULL); if (!strcasecmp(item->info_type, "ups.delay.start")) { @@ -1886,60 +1876,48 @@ static int voltronic_process_setvar(item_t *item, char *value, const size_t valu } else if (!strcasecmp(item->info_type, "max_bypass_freq")) { - if (d_equal(val, max_bypass_freq)) { + if (val == max_bypass_freq) { upslogx(LOG_INFO, "%s is already set to %.1f", item->info_type, val); return -1; } } else if (!strcasecmp(item->info_type, "min_bypass_freq")) { - if (d_equal(val, min_bypass_freq)) { + if (val == min_bypass_freq) { upslogx(LOG_INFO, "%s is already set to %.1f", item->info_type, val); return -1; } } else if (!strcasecmp(item->info_type, "max_bypass_volt")) { - if (d_equal(val, max_bypass_volt)) { + if (val == max_bypass_volt) { upslogx(LOG_INFO, "%s is already set to %.0f", item->info_type, val); return -1; } } else if (!strcasecmp(item->info_type, "min_bypass_volt")) { - if (d_equal(val, min_bypass_volt)) { + if (val == min_bypass_volt) { upslogx(LOG_INFO, "%s is already set to %.0f", item->info_type, val); return -1; } } else if (!strcasecmp(item->info_type, "battery_number")) { - if (d_equal(val, battery_number)) { + if (val == battery_number) { upslogx(LOG_INFO, "%s is already set to %.0f", item->info_type, val); return -1; } } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->command, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* *CMD* Preprocess instant commands */ -static int voltronic_process_command(item_t *item, char *value, const size_t valuelen) +static int voltronic_process_command(item_t *item, char *value, size_t valuelen) { char buf[SMALLBUF] = ""; @@ -1950,24 +1928,24 @@ static int voltronic_process_command(item_t *item, char *value, const size_t val * Accepted values for n: .2 -> .9 , 01 -> 99 * Accepted values for m: 0001 -> 9999 */ - long offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10), - ondelay = strtol(dstate_getinfo("ups.delay.start"), NULL, 10) / 60; + int offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10), + ondelay = strtol(dstate_getinfo("ups.delay.start"), NULL, 10) / 60; if (ondelay == 0) { if (offdelay < 60) { - snprintf(buf, sizeof(buf), ".%ld", offdelay / 6); + snprintf(buf, sizeof(buf), ".%d", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "%02ld", offdelay / 60); + snprintf(buf, sizeof(buf), "%02d", offdelay / 60); } } else if (offdelay < 60) { - snprintf(buf, sizeof(buf), ".%ldR%04ld", offdelay / 6, ondelay); + snprintf(buf, sizeof(buf), ".%dR%04d", offdelay / 6, ondelay); } else { - snprintf(buf, sizeof(buf), "%02ldR%04ld", offdelay / 60, ondelay); + snprintf(buf, sizeof(buf), "%02dR%04d", offdelay / 60, ondelay); } @@ -1977,12 +1955,12 @@ static int voltronic_process_command(item_t *item, char *value, const size_t val * Shutdown after n minutes and stay off * Accepted values for n: .2 -> .9 , 01 -> 99 */ - long offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10); + int offdelay = strtol(dstate_getinfo("ups.delay.shutdown"), NULL, 10); if (offdelay < 60) { - snprintf(buf, sizeof(buf), ".%ld", offdelay / 6); + snprintf(buf, sizeof(buf), ".%d", offdelay / 6); } else { - snprintf(buf, sizeof(buf), "%02ld", offdelay / 60); + snprintf(buf, sizeof(buf), "%02d", offdelay / 60); } } else if (!strcasecmp(item->info_type, "test.battery.start")) { @@ -1990,21 +1968,17 @@ static int voltronic_process_command(item_t *item, char *value, const size_t val /* Accepted values for test time: .2 -> .9 (.2=12sec ..), 01 -> 99 (minutes) * -> you have to invoke test.battery.start + number of seconds [12..5940] */ - long delay; + int delay; if (strlen(value) != strspn(value, "0123456789")) { - upslogx(LOG_ERR, - "%s: non numerical value [%s]", - item->info_type, value); + upslogx(LOG_ERR, "%s: non numerical value [%s]", item->info_type, value); return -1; } - delay = (strlen(value) > 0) ? strtol(value, NULL, 10) : 600; + delay = strlen(value) > 0 ? strtol(value, NULL, 10) : 600; if ((delay < 12) || (delay > 5940)) { - upslogx(LOG_ERR, - "%s: battery test time '%ld' out of range [12..5940] seconds", - item->info_type, delay); + upslogx(LOG_ERR, "%s: battery test time '%d' out of range [12..5940] seconds", item->info_type, delay); return -1; } @@ -2012,13 +1986,13 @@ static int voltronic_process_command(item_t *item, char *value, const size_t val if (delay < 60) { delay = delay / 6; - snprintf(buf, sizeof(buf), ".%ld", delay); + snprintf(buf, sizeof(buf), ".%d", delay); /* test time > 1 minute */ } else { delay = delay / 60; - snprintf(buf, sizeof(buf), "%02ld", delay); + snprintf(buf, sizeof(buf), "%02d", delay); } @@ -2069,25 +2043,13 @@ static int voltronic_process_command(item_t *item, char *value, const size_t val } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->command, buf); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* UPS capabilities */ -static int voltronic_capability(item_t *item, char *value, const size_t valuelen) +static int voltronic_capability(item_t *item, char *value, size_t valuelen) { char rawval[SMALLBUF], *enabled, *disabled, *val = NULL, *saveptr = NULL; item_t *unskip; @@ -2396,19 +2358,7 @@ static int voltronic_capability(item_t *item, char *value, const size_t valuelen if (!val) return -1; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* This item doesn't have a NUT var and we were not asked by the user to change its value */ if ((item->qxflags & QX_FLAG_NONUT) && !getval(item->info_type)) @@ -2427,17 +2377,8 @@ static int voltronic_capability(item_t *item, char *value, const size_t valuelen } /* *SETVAR* Set UPS capability options */ -static int voltronic_capability_set(item_t *item, char *value, const size_t valuelen) +static int voltronic_capability_set(item_t *item, char *value, size_t valuelen) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif if (!strcasecmp(value, "yes")) { snprintf(value, valuelen, item->command, "E"); return 0; @@ -2447,9 +2388,6 @@ static int voltronic_capability_set(item_t *item, char *value, const size_t valu snprintf(value, valuelen, item->command, "D"); return 0; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* At this point value should have been already checked against enum so this shouldn't happen.. however.. */ upslogx(LOG_ERR, "%s: given value [%s] is not acceptable. Enter either 'yes' or 'no'.", item->info_type, value); @@ -2458,7 +2396,7 @@ static int voltronic_capability_set(item_t *item, char *value, const size_t valu } /* *SETVAR/NONUT* Change UPS capability according to user configuration in ups.conf */ -static int voltronic_capability_set_nonut(item_t *item, char *value, const size_t valuelen) +static int voltronic_capability_set_nonut(item_t *item, char *value, size_t valuelen) { const char *match = NULL; int i; @@ -2478,7 +2416,7 @@ static int voltronic_capability_set_nonut(item_t *item, char *value, const size_ { "advanced_eco_mode", advanced_eco_mode }, { "constant_phase_angle", constant_phase_angle }, { "limited_runtime_on_battery", limited_runtime_on_battery }, - { NULL, NULL } + { NULL } }; for (i = 0; capability[i].type; i++) { @@ -2502,15 +2440,6 @@ static int voltronic_capability_set_nonut(item_t *item, char *value, const size_ return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif if (!strcasecmp(value, "disabled")) { snprintf(value, valuelen, item->command, "D"); } else if (!strcasecmp(value, "enabled")) { @@ -2520,26 +2449,20 @@ static int voltronic_capability_set_nonut(item_t *item, char *value, const size_ upslogx(LOG_ERR, "%s: [%s] is not within acceptable values [enabled/disabled]", item->info_type, value); return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* *SETVAR/NONUT* Reset capability options and their limits to safe default values */ -static int voltronic_capability_reset(item_t *item, char *value, const size_t valuelen) +static int voltronic_capability_reset(item_t *item, char *value, size_t valuelen) { /* Nothing to do */ if (!testvar("reset_to_default")) return -1; /* UPS capability options can be reset only when the UPS is in 'Standby Mode' (=OFF) (from QMOD) */ - if (!((unsigned int)(qx_status()) & STATUS(OFF))) { - upslogx(LOG_ERR, - "%s: UPS capability options can be reset only when the " - "UPS is in Standby Mode (i.e. ups.status = 'OFF').", - item->info_type); + if (!(qx_status() & STATUS(OFF))) { + upslogx(LOG_ERR, "%s: UPS capability options can be reset only when the UPS is in Standby Mode (i.e. ups.status = 'OFF').", item->info_type); return -1; } @@ -2549,10 +2472,10 @@ static int voltronic_capability_reset(item_t *item, char *value, const size_t va } /* Voltage limits for ECO Mode */ -static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen) +static int voltronic_eco_volt(item_t *item, char *value, size_t valuelen) { - const long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); - int ovn; + const int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); + int ovn; const char *outvoltnom; char buf[SMALLBUF]; item_t *unskip; @@ -2568,25 +2491,11 @@ static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen) } min; if (strspn(item->value, "0123456789 .") != strlen(item->value)) { - upsdebugx(2, - "%s: non numerical value [%s: %s]", - __func__, item->info_type, item->value); + upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, strtod(item->value, NULL)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif outvoltnom = dstate_getinfo("output.voltage.nominal"); @@ -2597,15 +2506,7 @@ static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen) return 0; } - { /* scoping */ - long l = strtol(outvoltnom, NULL, 10); - if (l > INT_MAX || l < 0) { - /* See comments above */ - upsdebugx(2, "%s: unable to get output voltage nominal: %ld", __func__, l); - return 0; - } - ovn = (int)l; - } + ovn = strtol(outvoltnom, NULL, 10); /* For P01/P09 */ if (protocol == 1 || protocol == 9) { @@ -2623,8 +2524,8 @@ static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen) } - /* For P02/P03/P10/P13/P14/P99 */ - } else if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 13 || protocol == 14 || protocol == 99) { + /* For P02/P03/P10/P14/P99 */ + } else if (protocol == 2 || protocol == 3 || protocol == 10 || protocol == 14 || protocol == 99) { if (ovn >= 200) { min.lower = ovn - 24; @@ -2694,7 +2595,7 @@ static int voltronic_eco_volt(item_t *item, char *value, const size_t valuelen) } /* Voltage limits for ECO Mode (max, min) */ -static int voltronic_eco_volt_range(item_t *item, char *value, const size_t valuelen) +static int voltronic_eco_volt_range(item_t *item, char *value, size_t valuelen) { char *buf; int i; @@ -2743,7 +2644,7 @@ static int voltronic_eco_volt_range(item_t *item, char *value, const size_t valu } /* Frequency limits for ECO Mode */ -static int voltronic_eco_freq(item_t *item, char *value, const size_t valuelen) +static int voltronic_eco_freq(item_t *item, char *value, size_t valuelen) { item_t *unskip; @@ -2752,19 +2653,7 @@ static int voltronic_eco_freq(item_t *item, char *value, const size_t valuelen) return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, strtod(item->value, NULL)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* Unskip input.transfer.{high,low} setvar */ unskip = find_nut_info(item->info_type, QX_FLAG_SETVAR, 0); @@ -2779,7 +2668,7 @@ static int voltronic_eco_freq(item_t *item, char *value, const size_t valuelen) } /* *NONUT* Voltage/frequency limits for Bypass Mode */ -static int voltronic_bypass(item_t *item, char *value, const size_t valuelen) +static int voltronic_bypass(item_t *item, char *value, size_t valuelen) { item_t *unskip; double val; @@ -2812,19 +2701,7 @@ static int voltronic_bypass(item_t *item, char *value, const size_t valuelen) } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* No user-provided value to change.. */ if (!getval(item->info_type)) @@ -2843,37 +2720,18 @@ static int voltronic_bypass(item_t *item, char *value, const size_t valuelen) } /* *NONUT* Number of batteries */ -static int voltronic_batt_numb(item_t *item, char *value, const size_t valuelen) +static int voltronic_batt_numb(item_t *item, char *value, size_t valuelen) { item_t *unskip; if (strspn(item->value, "0123456789 .") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", - __func__, item->info_type, item->value); + upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); return -1; } battery_number = strtol(item->value, NULL, 10); - if (battery_number > INT_MAX) { - upsdebugx(2, "%s: battery number out of range [%s: %s]", - __func__, item->info_type, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, (int)battery_number); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + snprintf(value, valuelen, item->dfl, battery_number); /* No user-provided value to change.. */ if (!getval(item->info_type)) @@ -2892,7 +2750,7 @@ static int voltronic_batt_numb(item_t *item, char *value, const size_t valuelen) } /* Battery runtime */ -static int voltronic_batt_runtime(item_t *item, char *value, const size_t valuelen) +static int voltronic_batt_runtime(item_t *item, char *value, size_t valuelen) { double runtime; @@ -2904,27 +2762,15 @@ static int voltronic_batt_runtime(item_t *item, char *value, const size_t valuel /* Battery runtime is reported by the UPS in minutes, NUT expects seconds */ runtime = strtod(item->value, NULL) * 60; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, runtime); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* Protocol used by the UPS */ -static int voltronic_protocol(item_t *item, char *value, const size_t valuelen) +static int voltronic_protocol(item_t *item, char *value, size_t valuelen) { - long protocol; + int protocol; if (strncasecmp(item->value, "PI", 2)) { upsdebugx(2, "%s: invalid start characters [%.2s]", __func__, item->value); @@ -2948,7 +2794,6 @@ static int voltronic_protocol(item_t *item, char *value, const size_t valuelen) case 8: case 9: case 10: - case 13: case 14: case 31: case 99: @@ -2957,12 +2802,12 @@ static int voltronic_protocol(item_t *item, char *value, const size_t valuelen) default: - upslogx(LOG_ERR, "Protocol [PI%02ld] is not supported by this driver", protocol); + upslogx(LOG_ERR, "Protocol [PI%02d] is not supported by this driver", protocol); return -1; } - snprintf(value, valuelen, "P%02ld", protocol); + snprintf(value, valuelen, "P%02d", protocol); /* Unskip vars according to protocol */ voltronic_massive_unskip(protocol); @@ -2972,28 +2817,16 @@ static int voltronic_protocol(item_t *item, char *value, const size_t valuelen) /* Fault reported by the UPS: * When the UPS is queried for status (QGS), if it reports a fault (6th bit of 12bit flag of the reply to QGS set to 1), the driver unskips the QFS item in qx2nut array: this function processes the reply to QFS query */ -static int voltronic_fault(item_t *item, char *value, const size_t valuelen) +static int voltronic_fault(item_t *item, char *value, size_t valuelen) { - long protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); + int protocol = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); - char alarm[LARGEBUF]; /* can sprintf() SMALLBUF plus markup into here */ + char alarm[SMALLBUF]; upslogx(LOG_INFO, "Checking for faults.."); if (!strcasecmp(item->value, "OK")) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, "No fault found"); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif upslogx(LOG_INFO, "%s", value); item->qxflags |= QX_FLAG_SKIP; return 0; @@ -3342,19 +3175,7 @@ static int voltronic_fault(item_t *item, char *value, const size_t valuelen) } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, alarm); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif upslogx(LOG_INFO, "Fault found: %s", alarm); item->qxflags |= QX_FLAG_SKIP; @@ -3363,7 +3184,7 @@ static int voltronic_fault(item_t *item, char *value, const size_t valuelen) } /* Warnings reported by the UPS */ -static int voltronic_warning(item_t *item, char *value, const size_t valuelen) +static int voltronic_warning(item_t *item, char *value, size_t valuelen) { char warn[SMALLBUF] = "", unk[SMALLBUF] = "", bitwarns[SMALLBUF] = "", warns[4096] = ""; int i; @@ -3769,7 +3590,7 @@ static int voltronic_warning(item_t *item, char *value, const size_t valuelen) } /* Working mode reported by the UPS */ -static int voltronic_mode(item_t *item, char *value, const size_t valuelen) +static int voltronic_mode(item_t *item, char *value, size_t valuelen) { char *status = NULL, *alarm = NULL; @@ -3833,35 +3654,26 @@ static int voltronic_mode(item_t *item, char *value, const size_t valuelen) } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif if (alarm && !strcasecmp(item->info_type, "ups.alarm")) { + snprintf(value, valuelen, item->dfl, alarm); + } else if (status && !strcasecmp(item->info_type, "ups.status")) { + snprintf(value, valuelen, item->dfl, status); + } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* Process status bits */ -static int voltronic_status(item_t *item, char *value, const size_t valuelen) +static int voltronic_status(item_t *item, char *value, size_t valuelen) { char *val = ""; if (strspn(item->value, "01") != strlen(item->value)) { - upsdebugx(3, "%s: unexpected value %s@%d->%s", - __func__, item->value, item->from, item->value); + upsdebugx(3, "%s: unexpected value %s@%d->%s", __func__, item->value, item->from, item->value); return -1; } @@ -3870,7 +3682,7 @@ static int voltronic_status(item_t *item, char *value, const size_t valuelen) case 63: /* UPS Type - ups.type */ { - long type = strtol(item->value, NULL, 10); + int type = strtol(item->value, NULL, 10); if (!type) /* 00 -> Offline */ val = "offline"; @@ -3879,8 +3691,7 @@ static int voltronic_status(item_t *item, char *value, const size_t valuelen) else if (type == 10) /* 10 -> Online */ val = "online"; else { - upsdebugx(2, "%s: invalid type [%s: %s]", - __func__, item->info_type, item->value); + upsdebugx(2, "%s: invalid type [%s: %s]", __func__, item->info_type, item->value); return -1; } } @@ -3921,7 +3732,7 @@ static int voltronic_status(item_t *item, char *value, const size_t valuelen) val = "TRIM"; } else if (vo < 1.05 * vi) { - long prot = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); + int prot = strtol(dstate_getinfo("ups.firmware.aux")+1, NULL, 10); if (!prot || prot == 8) { /* ups.alarm */ @@ -4033,7 +3844,7 @@ static int voltronic_status(item_t *item, char *value, const size_t valuelen) } /* Output power factor */ -static int voltronic_output_powerfactor(item_t *item, char *value, const size_t valuelen) +static int voltronic_output_powerfactor(item_t *item, char *value, size_t valuelen) { double opf; @@ -4045,25 +3856,13 @@ static int voltronic_output_powerfactor(item_t *item, char *value, const size_t /* UPS report a value expressed in % so -> output.powerfactor*100 e.g. opf = 0,8 -> ups = 80 */ opf = strtod(item->value, NULL) * 0.01; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, opf); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif return 0; } /* UPS serial number */ -static int voltronic_serial_numb(item_t *item, char *value, const size_t valuelen) +static int voltronic_serial_numb(item_t *item, char *value, size_t valuelen) { /* If the UPS report a 00..0 serial we'll log it but we won't store it in device.serial */ if (strspn(item->value, "0") == strlen(item->value)) { @@ -4071,25 +3870,12 @@ static int voltronic_serial_numb(item_t *item, char *value, const size_t valuele return -1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, item->value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - return 0; } /* Outlet status */ -static int voltronic_outlet(item_t *item, char *value, const size_t valuelen) +static int voltronic_outlet(item_t *item, char *value, size_t valuelen) { const char *status, *switchable; char number = item->info_type[7], @@ -4117,26 +3903,20 @@ static int voltronic_outlet(item_t *item, char *value, const size_t valuelen) } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif if (strstr(item->info_type, "switchable")) { + snprintf(value, valuelen, item->dfl, switchable); + } else if (strstr(item->info_type, "status")) { + snprintf(value, valuelen, item->dfl, status); + } else { + /* Don't know what happened */ return -1; + } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* Unskip outlet.n.delay.shutdown */ snprintf(buf, sizeof(buf), "outlet.%c.delay.shutdown", number); @@ -4175,7 +3955,7 @@ static int voltronic_outlet(item_t *item, char *value, const size_t valuelen) } /* Outlet delay time */ -static int voltronic_outlet_delay(item_t *item, char *value, const size_t valuelen) +static int voltronic_outlet_delay(item_t *item, char *value, size_t valuelen) { char number = item->info_type[7], buf[SMALLBUF]; @@ -4190,19 +3970,7 @@ static int voltronic_outlet_delay(item_t *item, char *value, const size_t valuel /* UPS reports minutes, NUT expects seconds */ val = strtod(item->value, NULL) * 60; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(value, valuelen, item->dfl, val); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif /* Unskip outlet.n.delay.shutdown setvar */ snprintf(buf, sizeof(buf), "outlet.%c.delay.shutdown", number); @@ -4219,80 +3987,42 @@ static int voltronic_outlet_delay(item_t *item, char *value, const size_t valuel } /* *SETVAR* Outlet delay time */ -static int voltronic_outlet_delay_set(item_t *item, char *value, const size_t valuelen) +static int voltronic_outlet_delay_set(item_t *item, char *value, size_t valuelen) { - long delay = strtol(value, NULL, 10); - - if ((delay/60) > INT_MAX) { - upsdebugx(2, "%s: invalid delay %ld sec set for UPS [%s]", - __func__, delay, item->value); - return -1; - } + int delay = strtol(value, NULL, 10); /* From seconds to minute */ delay = delay / 60; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->command, (int)delay); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + snprintf(value, valuelen, item->command, delay); return 0; } /* Type of battery */ -static int voltronic_p31b(item_t *item, char *value, const size_t valuelen) +static int voltronic_p31b(item_t *item, char *value, size_t valuelen) { - long val; + int val; if ((item->value[0] != '0') || (strspn(item->value+1, "012") != 1)) { - upsdebugx(2, "%s: invalid battery type reported by the UPS [%s]", - __func__, item->value); + + upsdebugx(2, "%s: invalid battery type reported by the UPS [%s]", __func__, item->value); return -1; + } val = strtol(item->value, NULL, 10); - if (val < 0 || (uintmax_t)val > SIZE_MAX) { - upsdebugx(2, "%s: invalid battery type reported by the UPS [%s]", - __func__, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, item->info_rw[(size_t)val].value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + snprintf(value, valuelen, item->dfl, item->info_rw[val].value); return 0; } /* *SETVAR* Type of battery */ -static int voltronic_p31b_set(item_t *item, char *value, const size_t valuelen) +static int voltronic_p31b_set(item_t *item, char *value, size_t valuelen) { int i; - if (!item->info_rw) - return -1; - for (i = 0; strlen(item->info_rw[i].value) > 0; i++) { if (!strcasecmp(item->info_rw[i].value, value)) @@ -4301,7 +4031,7 @@ static int voltronic_p31b_set(item_t *item, char *value, const size_t valuelen) } /* At this point value should already be checked against enum so this shouldn't happen.. however.. */ - if (!strlen(item->info_rw[i].value)) { + if (i >= (int)(sizeof(item->info_rw) / sizeof(item->info_rw[0]))) { upslogx(LOG_ERR, "%s: value [%s] out of range", item->info_type, value); return -1; } @@ -4312,51 +4042,30 @@ static int voltronic_p31b_set(item_t *item, char *value, const size_t valuelen) } /* *NONUT* Actual device grid working range type for P31 UPSes */ -static int voltronic_p31g(item_t *item, char *value, const size_t valuelen) +static int voltronic_p31g(item_t *item, char *value, size_t valuelen) { - long val; + int val; if ((item->value[0] != '0') || (strspn(item->value+1, "01") != 1)) { - upsdebugx(2, "%s: invalid device grid working range reported by the UPS [%s]", - __func__, item->value); + + upsdebugx(2, "%s: invalid device grid working range reported by the UPS [%s]", __func__, item->value); return -1; + } val = strtol(item->value, NULL, 10); - if (val < 0 || (uintmax_t)val > SIZE_MAX) { - upsdebugx(2, "%s: invalid device grid working range reported by the UPS [%s]", - __func__, item->value); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, item->info_rw[(size_t)val].value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - + snprintf(value, valuelen, item->dfl, item->info_rw[val].value); work_range_type = val; return 0; } /* *SETVAR/NONUT* Device grid working range type for P31 UPSes */ -static int voltronic_p31g_set(item_t *item, char *value, const size_t valuelen) +static int voltronic_p31g_set(item_t *item, char *value, size_t valuelen) { int i; - if (!item->info_rw) - return -1; - for (i = 0; strlen(item->info_rw[i].value) > 0; i++) { if (!strcasecmp(item->info_rw[i].value, value)) @@ -4365,7 +4074,7 @@ static int voltronic_p31g_set(item_t *item, char *value, const size_t valuelen) } /* At this point value should have been already checked against enum so this shouldn't happen.. however.. */ - if (!strlen(item->info_rw[i].value)) { + if (i >= (int)(sizeof(item->info_rw) / sizeof(item->info_rw[0]))) { upslogx(LOG_ERR, "%s: value [%s] out of range", item->info_type, value); return -1; } @@ -4381,13 +4090,12 @@ static int voltronic_p31g_set(item_t *item, char *value, const size_t valuelen) } /* *NONUT* UPS actual input/output phase angles */ -static int voltronic_phase(item_t *item, char *value, const size_t valuelen) +static int voltronic_phase(item_t *item, char *value, size_t valuelen) { - long angle; + int angle; if (strspn(item->value, "0123456789 .") != strlen(item->value)) { - upsdebugx(2, "%s: non numerical value [%s: %s]", - __func__, item->info_type, item->value); + upsdebugx(2, "%s: non numerical value [%s: %s]", __func__, item->info_type, item->value); return -1; } @@ -4415,37 +4123,16 @@ static int voltronic_phase(item_t *item, char *value, const size_t valuelen) } - if (angle < 0 || angle > INT_MAX) { - upsdebugx(2, "%s: phase angle out of range [%s: %ld]", - __func__, item->value, angle); - return -1; - } - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(value, valuelen, item->dfl, (int)angle); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + snprintf(value, valuelen, item->dfl, angle); return 0; } /* *SETVAR/NONUT* Output phase angle */ -static int voltronic_phase_set(item_t *item, char *value, const size_t valuelen) +static int voltronic_phase_set(item_t *item, char *value, size_t valuelen) { int i; - if (!item->info_rw) - return -1; - for (i = 0; strlen(item->info_rw[i].value) > 0; i++) { if (!strcasecmp(item->info_rw[i].value, value)) @@ -4454,7 +4141,7 @@ static int voltronic_phase_set(item_t *item, char *value, const size_t valuelen) } /* At this point value should have been already checked against enum so this shouldn't happen.. however.. */ - if (!strlen(item->info_rw[i].value)) { + if (i >= (int)(sizeof(item->info_rw) / sizeof(item->info_rw[0]))) { upslogx(LOG_ERR, "%s: value [%s] out of range", item->info_type, value); return -1; } @@ -4470,7 +4157,7 @@ static int voltronic_phase_set(item_t *item, char *value, const size_t valuelen) } /* *NONUT* UPS is master/slave in a system of UPSes in parallel */ -static int voltronic_parallel(item_t *item, char *value, const size_t valuelen) +static int voltronic_parallel(item_t *item, char *value, size_t valuelen) { char *type; diff --git a/drivers/nutdrv_qx_zinto.c b/drivers/nutdrv_qx_zinto.c index d039ccd..afc50fc 100644 --- a/drivers/nutdrv_qx_zinto.c +++ b/drivers/nutdrv_qx_zinto.c @@ -25,7 +25,7 @@ #include "nutdrv_qx_zinto.h" -#define ZINTO_VERSION "Zinto 0.06" +#define ZINTO_VERSION "Zinto 0.01" /* qx2nut lookup table */ static item_t zinto_qx2nut[] = { @@ -37,22 +37,23 @@ static item_t zinto_qx2nut[] = { * 0 1 2 3 4 */ - { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL, NULL, NULL }, - { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL, NULL, NULL }, - { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL, NULL, NULL }, - { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL, NULL, NULL }, - { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL, NULL, NULL }, - { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL, NULL, NULL }, - { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL, NULL, NULL }, + { "input.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 1, 5, "%.1f", 0, NULL }, + { "input.voltage.fault", 0, NULL, "Q1\r", "", 47, '(', "", 7, 11, "%.1f", 0, NULL }, + { "output.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 13, 17, "%.1f", 0, NULL }, + { "ups.load", 0, NULL, "Q1\r", "", 47, '(', "", 19, 21, "%.0f", 0, NULL }, + { "input.frequency", 0, NULL, "Q1\r", "", 47, '(', "", 23, 26, "%.1f", 0, NULL }, + { "battery.voltage", 0, NULL, "Q1\r", "", 47, '(', "", 28, 31, "%.2f", 0, NULL }, + { "ups.temperature", 0, NULL, "Q1\r", "", 47, '(', "", 33, 36, "%.1f", 0, NULL }, /* Status bits */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Battery Low */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ - { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, NULL, NULL, blazer_process_status_bits }, /* UPS Failed */ - { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, NULL, NULL, blazer_process_status_bits }, /* UPS Type */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Test in Progress */ - { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, NULL, NULL, blazer_process_status_bits }, /* Shutdown Active */ - { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, NULL, NULL, blazer_process_status_bits }, /* Beeper status */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 38, 38, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Utility Fail (Immediate) */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 39, 39, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Battery Low */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 40, 40, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Bypass/Boost or Buck Active */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 41, 41, NULL, 0, blazer_process_status_bits }, /* UPS Failed */ + { "ups.type", 0, NULL, "Q1\r", "", 47, '(', "", 42, 42, "%s", QX_FLAG_STATIC, blazer_process_status_bits }, /* UPS Type */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 43, 43, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Test in Progress */ + { "ups.alarm", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, 0, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.status", 0, NULL, "Q1\r", "", 47, '(', "", 44, 44, NULL, QX_FLAG_QUICK_POLL, blazer_process_status_bits }, /* Shutdown Active */ + { "ups.beeper.status", 0, NULL, "Q1\r", "", 47, '(', "", 45, 45, "%s", 0, blazer_process_status_bits }, /* Beeper status */ /* * > [F\r] @@ -61,10 +62,10 @@ static item_t zinto_qx2nut[] = { * 0 1 2 */ - { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL, NULL, NULL }, - { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL, NULL, NULL }, + { "input.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 1, 5, "%.0f", QX_FLAG_STATIC, NULL }, + { "input.current.nominal", 0, NULL, "F\r", "", 22, '#', "", 7, 9, "%.1f", QX_FLAG_STATIC, NULL }, + { "battery.voltage.nominal", 0, NULL, "F\r", "", 22, '#', "", 11, 15, "%.1f", QX_FLAG_STATIC, NULL }, + { "input.frequency.nominal", 0, NULL, "F\r", "", 22, '#', "", 17, 20, "%.0f", QX_FLAG_STATIC, NULL }, /* * > [FW?\r] @@ -73,45 +74,45 @@ static item_t zinto_qx2nut[] = { * 0 1 2 3 */ - { "device.mfr", 0, NULL, "FW?\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "device.model", 0, NULL, "FW?\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, - { "ups.firmware", 0, NULL, "FW?\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL, NULL, NULL }, + { "device.mfr", 0, NULL, "FW?\r", "", 39, '#', "", 1, 15, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "device.model", 0, NULL, "FW?\r", "", 39, '#', "", 17, 26, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, + { "ups.firmware", 0, NULL, "FW?\r", "", 39, '#', "", 28, 37, "%s", QX_FLAG_STATIC | QX_FLAG_TRIM, NULL }, /* Instant commands */ - { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, blazer_process_command }, - { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, - { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL, NULL, NULL }, + { "beeper.toggle", 0, NULL, "Q\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.off", 0, NULL, "S00R0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "load.on", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "shutdown.return", 0, NULL, "S%s\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stayoff", 0, NULL, "S%sR0000\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "shutdown.stop", 0, NULL, "C\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start", 0, NULL, "T%02d\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, blazer_process_command }, + { "test.battery.start.deep", 0, NULL, "TL\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.start.quick", 0, NULL, "T\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, + { "test.battery.stop", 0, NULL, "CT\r", "", 0, 0, "", 0, 0, NULL, QX_FLAG_CMD, NULL }, /* Server-side settable vars */ - { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, - { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, NULL, NULL, blazer_process_setvar }, + { "ups.delay.start", ST_FLAG_RW, blazer_r_ondelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_ONDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, + { "ups.delay.shutdown", ST_FLAG_RW, blazer_r_offdelay, NULL, "", 0, 0, "", 0, 0, DEFAULT_OFFDELAY, QX_FLAG_ABSENT | QX_FLAG_SETVAR | QX_FLAG_RANGE, blazer_process_setvar }, /* End of structure. */ - { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL, NULL, NULL } + { NULL, 0, NULL, NULL, "", 0, 0, "", 0, 0, NULL, 0, NULL } }; /* Testing table */ #ifdef TESTING static testing_t zinto_testing[] = { - { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r", -1 }, - { "F\r", "#230.0 000 024.0 50.0\r", -1 }, - { "FW?\r", "#NOT_A_LIVE_UPS TESTING TESTING \r", -1 }, - { "Q\r", "", -1 }, - { "S03\r", "", -1 }, - { "C\r", "", -1 }, - { "S02R0005\r", "", -1 }, - { "S.5R0000\r", "", -1 }, - { "T04\r", "", -1 }, - { "TL\r", "", -1 }, - { "T\r", "", -1 }, - { "CT\r", "", -1 }, + { "Q1\r", "(215.0 195.0 230.0 014 49.0 22.7 30.0 00000000\r" }, + { "F\r", "#230.0 000 024.0 50.0\r" }, + { "FW?\r", "#NOT_A_LIVE_UPS TESTING TESTING \r" }, + { "Q\r", "" }, + { "S03\r", "" }, + { "C\r", "" }, + { "S02R0005\r", "" }, + { "S.5R0000\r", "" }, + { "T04\r", "" }, + { "TL\r", "" }, + { "T\r", "" }, + { "CT\r", "" }, { NULL } }; #endif /* TESTING */ @@ -119,7 +120,9 @@ static testing_t zinto_testing[] = { /* Subdriver-specific initups */ static void zinto_initups(void) { + blazer_initups(zinto_qx2nut); + } /* Subdriver interface */ diff --git a/drivers/nutdrv_siemens_sitop.c b/drivers/nutdrv_siemens_sitop.c deleted file mode 100644 index 1c1e9ef..0000000 --- a/drivers/nutdrv_siemens_sitop.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * nutdrv_siemens_sitop.c - model specific routines for the Siemens SITOP UPS500 series - * - * - * Copyright (C) 2018 Matthijs H. ten Berge - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -/* - * Notes: - * These UPSes operate at 24V DC (both input and output), instead of 110V/230V AC. - * Therefore, the line input is also referred to by Siemens as 'DC'. - * - * The device is configured via DIP-switches. - * For correct functioning in combination with NUT, set the DIP-switches to the following: - * switch 1-4: choose whatever suits your situation. Any combination will work with NUT. - * switch 5 ('=>' / 't'): set to OFF ('t') - * switch 6-10 (delay): set to OFF (no additional delay) - * switch 11 (INTERR.): set to ON - * switch 12 (ON/OFF): set to ON - * - * These UPSes are available with serial or USB port. - * Both are supported by this driver. The version with USB port simply contains - * a serial-over-USB chip, so as far as this driver is concerned, all models are - * actually serial models. - * - * The FTDI USB-to-serial converters in the USB-models are programmed with a non-standard - * Product ID (mine had 0403:e0e3), but can be used with the normal ftdi_sio driver: - * # modprobe ftdi_sio - * # echo 0403 e0e3 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id - * - * This can also be automated via a udev rule: - * ACTION=="add", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3", \ - * RUN+="/sbin/modprobe ftdi_sio", \ - * RUN+="/bin/sh -c 'echo 0403 e0e3 > /sys/bus/usb-serial/drivers/ftdi_sio/new_id'" - * - * Use the following udev rule to create a persistent device name, for example /dev/ttyUPS: - * SUBSYSTEM=="tty" ATTRS{idVendor}=="0403", ATTRS{idProduct}=="e0e3" SYMLINK+="ttyUPS" - */ - -#include "main.h" -#include "serial.h" -#include "nut_stdint.h" - -#define DRIVER_NAME "Siemens SITOP UPS500 series driver" -#define DRIVER_VERSION "0.03" - -#define RX_BUFFER_SIZE 100 - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Matthijs H. ten Berge ", - DRV_EXPERIMENTAL, - { NULL } -}; - -/* The maximum number of consecutive polls in which the UPS does not provide any data: */ -static unsigned int max_polls_without_data; -/* The current number: */ -static unsigned int nr_polls_without_data; -/* receive buffer */ -static char rx_buffer[RX_BUFFER_SIZE]; -static size_t rx_count; - -static struct { - int battery_alarm; - int dc_input_low; - int on_battery; - int battery_above_85_percent; -} current_ups_status; - -/* remove n bytes from the head of rx_buffer, shift the remaining bytes to the start */ -static void rm_buffer_head(unsigned int n) { - if (rx_count <= n) { - /* nothing left */ - rx_count = 0; - return; - } - rx_count -= n; - memmove(rx_buffer, rx_buffer + n, rx_count); -} - -/* parse incoming data from the UPS. - * return true if something new was received. - */ -static int check_for_new_data() { - int new_data_received = 0; - int done = 0; - ssize_t num_received; - - while (!done) { - /* Get new data from the serial port. - * No extra delay, just get the chars that were already buffered. - */ - num_received = ser_get_buf(upsfd, rx_buffer + rx_count, RX_BUFFER_SIZE - rx_count, 0, 0); - if (num_received < 0) { - /* comm error */ - ser_comm_fail("error %zd while reading", num_received); - /* discard any remaining old data from the receive buffer: */ - rx_count = 0; - /* try to re-open the serial port: */ - if (upsfd) { - ser_close(upsfd, device_path); - upsfd = 0; - } - upsfd = ser_open_nf(device_path); - ser_set_speed_nf(upsfd, device_path, B9600); - done = 1; - } else if (num_received == 0) { - /* no (more) new data */ - done = 1; - } else { - rx_count += (unsigned int)num_received; - - /* parse received input data: */ - while (rx_count >= 5) { /* all valid input messages are strings of 5 characters */ - if (strncmp(rx_buffer, "BUFRD", 5) == 0) { - current_ups_status.battery_alarm = 0; - } else if (strncmp(rx_buffer, "ALARM", 5) == 0) { - current_ups_status.battery_alarm = 1; - } else if (strncmp(rx_buffer, "DC_OK", 5) == 0) { - current_ups_status.dc_input_low = 0; - } else if (strncmp(rx_buffer, "DC_LO", 5) == 0) { - current_ups_status.dc_input_low = 1; - } else if (strncmp(rx_buffer, "*****", 5) == 0) { - current_ups_status.on_battery = 0; - } else if (strncmp(rx_buffer, "*BAT*", 5) == 0) { - current_ups_status.on_battery = 1; - } else if (strncmp(rx_buffer, "BA>85", 5) == 0) { - current_ups_status.battery_above_85_percent = 1; - } else if (strncmp(rx_buffer, "BA<85", 5) == 0) { - current_ups_status.battery_above_85_percent = 0; - } else { - /* nothing sensible found at the start of the rx_buffer. */ - rm_buffer_head(1); - continue; /* skip the code below */ - } - rm_buffer_head(5); - new_data_received = 1; - } - } - } - return new_data_received; -} - - -static int instcmd(const char *cmdname, const char *extra) { - /* Note: the UPS does not really like to receive data. - * For example, sending an "R" without \n hangs the serial port. - * In that situation, the UPS will no longer send any status updates. - * For this reason, an additional \n is appended here. - * The commands are sent twice, because the first command is sometimes - * lost as well. - */ - if (!strcasecmp(cmdname, "shutdown.return")) { - upslogx(LOG_NOTICE, "instcmd: sending command R"); - ser_send_pace(upsfd, 200000, "\n\nR\n\n"); - ser_send_pace(upsfd, 200000, "R\n\n"); - return STAT_INSTCMD_HANDLED; - } - if (!strcasecmp(cmdname, "shutdown.stayoff")) { - upslogx(LOG_NOTICE, "instcmd: sending command S"); - ser_send_pace(upsfd, 200000, "\n\nS\n\n"); - ser_send_pace(upsfd, 200000, "S\n\n"); - return STAT_INSTCMD_HANDLED; - } - - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); - return STAT_INSTCMD_UNKNOWN; -} - - -void upsdrv_initinfo(void) { - int max_attempts = 5; - int found = 0; - while (!found && max_attempts > 0) { - if (check_for_new_data()) { - found = 1; - } else { - sleep(1); /* Sleep a while, then try again */ - } - max_attempts--; - } - if (!found) { - fatalx(EXIT_FAILURE, "No data received from the UPS"); - } - - dstate_setinfo("device.mfr", "Siemens"); - dstate_setinfo("device.model", "SITOP UPS500 series"); - - /* supported commands: */ - dstate_addcmd("shutdown.stayoff"); - dstate_addcmd("shutdown.return"); - - upsh.instcmd = instcmd; -} - - -void upsdrv_updateinfo(void) { - if (check_for_new_data()) { - nr_polls_without_data = 0; - } else { - nr_polls_without_data++; - /* With unsigned int type, we can limit half-way like this: */ - if (nr_polls_without_data > INT_MAX) - nr_polls_without_data = INT_MAX; - } - - if (nr_polls_without_data > max_polls_without_data) { - /* data is stale */ - dstate_datastale(); - return; - } - - /* This is all we know about the charge level... */ - dstate_setinfo("battery.charge.approx", - (current_ups_status.battery_above_85_percent) ? ">85" : "<85"); - - status_init(); - - if (current_ups_status.dc_input_low || current_ups_status.on_battery) { - status_set("OB"); - } else { - status_set("OL"); - } - if (current_ups_status.battery_alarm) { - status_set("LB"); - } - - status_commit(); - dstate_dataok(); - ser_comm_good(); -} - -void upsdrv_shutdown(void) { - /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ - instcmd("shutdown.return", NULL); -} - - -void upsdrv_help(void) { -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) { - /* allow '-x max_polls_without_data=' */ - addvar(VAR_VALUE, "max_polls_without_data", "The maximum number of consecutive polls in which the UPS does not provide any data."); -} - -void upsdrv_initups(void) { - char * maxPollsString; - unsigned int parsed; - - upsfd = ser_open(device_path); - ser_set_speed(upsfd, device_path, B9600); - - /* - * Fast polling is preferred, because - * A) the UPS spits out new data every 75 msec, - * B) some models in this SITOP series have a _very_ small capacity - * (< 10sec runtime), so every second might count. - */ - if (poll_interval > 5) { - upslogx(LOG_NOTICE, - "Option poll_interval is recommended to be lower than 5 (found: %jd)", - (intmax_t)poll_interval); - } - - /* option max_polls_without_data: */ - max_polls_without_data = 2; - maxPollsString = getval("max_polls_without_data"); - if (maxPollsString) { - if (str_to_uint(maxPollsString, &parsed, 10) == 1) { - max_polls_without_data = parsed; - } else { - upslog_with_errno(LOG_ERR, "Cannot parse option max_polls_without_data"); - } - } -} - -void upsdrv_cleanup(void) { - ser_close(upsfd, device_path); -} diff --git a/drivers/oneac.c b/drivers/oneac.c index 916fc72..55035f7 100644 --- a/drivers/oneac.c +++ b/drivers/oneac.c @@ -32,10 +32,10 @@ * Enhancing the driver for additional capabilities and later units. * * - 28 November 2003. Eric Lawson - * More or less complete re-write for NUT 1.5.9 - * This was somewhat easier than trying to beat the old driver code + * More or less complete re-write for NUT 1.5.9 + * This was somewhat easier than trying to beat the old driver code * into submission - * + * */ #include "main.h" @@ -47,7 +47,7 @@ int setcmd(const char* varname, const char* setvalue); int instcmd(const char *cmdname, const char *extra); #define DRIVER_NAME "Oneac EG/ON/OZ/OB UPS driver" -#define DRIVER_VERSION "0.81" +#define DRIVER_VERSION "0.80" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -74,24 +74,22 @@ static char UpsFamily [3]; * allow for a repeat of the get request. Also confirm that * the correct number of characters are returned. */ - -static ssize_t OneacGetResponse (char* chBuff, const size_t BuffSize, int ExpectedCount) + +int OneacGetResponse (char* chBuff, const int BuffSize, int ExpectedCount) { int Retries = 10; /* x/2 seconds max with 500000 USEC */ - ssize_t return_val; + int return_val; do { - return_val = ser_get_line(upsfd, - chBuff, BuffSize, ENDCHAR, IGNCHARS, SECS, USEC); + return_val = ser_get_line(upsfd, chBuff, BuffSize, ENDCHAR, IGNCHARS, + SECS, USEC); if (return_val == ExpectedCount) break; - upsdebugx (3, - "!OneacGetResponse retry (%zd, %d)...", - return_val, Retries); - + upsdebugx (3,"!OneacGetResponse retry (%d, %d)...", return_val,Retries); + } while (--Retries > 0); upsdebugx (4,"OneacGetResponse buffer: %s",chBuff); @@ -105,14 +103,14 @@ static ssize_t OneacGetResponse (char* chBuff, const size_t BuffSize, int Expect { if (Retries < 10) upsdebugx (2,"OneacGetResponse recovered (%d)...", Retries); - + return_val = 0; /* Good comms */ } - - return return_val; + + return return_val; } -static void do_battery_test(void) +void do_battery_test(void) { char buffer[32]; @@ -132,7 +130,7 @@ static void do_battery_test(void) ser_send(upsfd,"%s%s%s",BAT_TEST_PREFIX,buffer,COMMAND_END); } -static int SetOutputAllow(const char* lowval, const char* highval) +int SetOutputAllow(const char* lowval, const char* highval) { char buffer[32]; @@ -148,38 +146,38 @@ static int SetOutputAllow(const char* lowval, const char* highval) buffer[1] = buffer[0]; buffer[0] = '0'; } - - upsdebugx (2,"SetOutputAllow sending %s%.3s,%.3s...", + + upsdebugx (2,"SetOutputAllow sending %s%.3s,%.3s...", SETX_OUT_ALLOW, buffer, highval); - - ser_send(upsfd,"%s%.3s,%.3s%s", SETX_OUT_ALLOW, buffer, highval, + + ser_send(upsfd,"%s%.3s,%.3s%s", SETX_OUT_ALLOW, buffer, highval, COMMAND_END); ser_get_line(upsfd,buffer,sizeof(buffer), ENDCHAR, IGNCHARS,SECS,USEC); - + if(buffer[0] == DONT_UNDERSTAND) { upsdebugx (2,"SetOutputAllow got asterisk back..."); return 1; /* Invalid command */ } - + return 0; /* Valid command */ } -static void EliminateLeadingZeroes (const char* buff1, int StringSize, char* buff2, - const size_t buff2size) +void EliminateLeadingZeroes (const char* buff1, int StringSize, char* buff2, + const int buff2size) { int i = 0; int j = 0; memset(buff2, '\0', buff2size); /* Fill with nulls */ - + /* Find first non-'0' */ - while ((i < (StringSize - 1) && (buff1[i] == '0'))) + while ((buff1[i] == '0') && (i < (StringSize - 1))) { i++; } - + while (i < StringSize) /* Move rest of string */ { buff2[j++] = buff1[i++]; @@ -207,7 +205,7 @@ void upsdrv_initinfo(void) int i,j, k; int VRange=0; int timevalue; - ssize_t RetValue; + int RetValue; char buffer[256], buffer2[32]; /* All families should reply to this request so we can confirm that it is @@ -224,13 +222,13 @@ void upsdrv_initinfo(void) } else { - if (strncmp(buffer,FAMILY_ON,FAMILY_SIZE) != 0 && + if (strncmp(buffer,FAMILY_ON,FAMILY_SIZE) != 0 && strncmp(buffer,FAMILY_OZ,FAMILY_SIZE) != 0 && - strncmp(buffer,FAMILY_OB,FAMILY_SIZE) != 0 && + strncmp(buffer,FAMILY_OB,FAMILY_SIZE) != 0 && strncmp(buffer,FAMILY_EG,FAMILY_SIZE) != 0) { fatalx(EXIT_FAILURE, "Did not find an ONEAC UPS on %s\n", - device_path); + device_path); } } @@ -241,7 +239,7 @@ void upsdrv_initinfo(void) printf("Found %s family of Oneac UPS\n", UpsFamily); dstate_setinfo("ups.type", "%s", "Line Interactive"); - + dstate_addcmd("test.battery.start.quick"); dstate_addcmd("test.battery.stop"); dstate_addcmd("test.failure.start"); @@ -259,7 +257,7 @@ void upsdrv_initinfo(void) if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) == 0) { - RetValue = OneacGetResponse (buffer, sizeof(buffer), + RetValue = OneacGetResponse (buffer, sizeof(buffer), GETALL_EG_RESP_SIZE); } else @@ -291,7 +289,7 @@ void upsdrv_initinfo(void) dstate_setflags("ups.delay.shutdown", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("ups.delay.shutdown", GET_SHUTDOWN_RESP_SIZE); - + /* Setup some ON/OZ/OB only stuff ... i.e. not EG */ if (strncmp(UpsFamily, FAMILY_EG, FAMILY_SIZE) != 0) @@ -301,7 +299,7 @@ void upsdrv_initinfo(void) /*nominal input voltage*/ VRange = buffer[26]; /* Keep for later use also */ - + switch (VRange) /* Will be '1' or '2' */ { case V120AC: @@ -319,9 +317,9 @@ void upsdrv_initinfo(void) "Invalid nom voltage parameter from UPS [%c]", VRange); } } - + /* Setup some OZ/OB only stuff */ - + if ((strncmp (UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || (strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) { @@ -330,7 +328,7 @@ void upsdrv_initinfo(void) dstate_addcmd("beeper.enable"); dstate_addcmd("beeper.disable"); dstate_addcmd("beeper.mute"); - + dstate_setaux("ups.delay.shutdown", GETX_SHUTDOWN_RESP_SIZE); ser_flush_in(upsfd,"",0); @@ -357,7 +355,7 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.delay.start", "%s", buffer2); dstate_setflags("ups.delay.start", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("ups.delay.start", 4); - + /* Low Batt at time */ strncpy(buffer2, buffer+82, 2); buffer2[2]='\0'; @@ -365,36 +363,24 @@ void upsdrv_initinfo(void) dstate_setinfo("battery.runtime.low", "%d",timevalue); dstate_setflags("battery.runtime.low", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("battery.runtime.low", 2); - + /*Get the actual model string for ON UPS reported as OZ/OB family*/ /*UPS Model (full string)*/ memset(buffer2, '\0', 32); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION -#pragma GCC diagnostic ignored "-Wstringop-truncation" -#endif - strncpy(buffer2, buffer + 5, 10); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif - for (i = 9; i >= 0 && buffer2[i] == ' '; --i) + strncpy(buffer2, buffer+5, 10); + for (i = 9; i >= 0 && buffer2[i] == ' '; --i) { buffer2[i] = '\0'; } dstate_setinfo("device.model", "%s", buffer2); - + /* Serial number */ dstate_setinfo("device.serial", "%.4s-%.4s", buffer+18, buffer+22); - printf("Found %.10s UPS with serial number %.4s-%.4s\n", + printf("Found %.10s UPS with serial number %.4s-%.4s\n", buffer2, buffer+18, buffer+22); - + /* Manufacture Date */ dstate_setinfo("ups.mfr.date", "%.6s (yymmdd)", buffer+38); @@ -402,7 +388,7 @@ void upsdrv_initinfo(void) dstate_setinfo("battery.date", "%.6s (yymmdd)", buffer+44); dstate_setflags("battery.date", ST_FLAG_STRING | ST_FLAG_RW); dstate_setaux("battery.date", 6); - + /* Real power nominal */ EliminateLeadingZeroes (buffer+55, 5, buffer2, sizeof(buffer2)); dstate_setinfo("ups.realpower.nominal", "%s", buffer2); @@ -416,39 +402,27 @@ void upsdrv_initinfo(void) if ((strncmp (UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0) || (strcmp (dstate_getinfo("ups.firmware"), MIN_ALLOW_FW) >= 0 )) { - upsdebugx (2,"Can get output window min/max! (%s)", + upsdebugx (2,"Can get output window min/max! (%s)", dstate_getinfo("ups.firmware")); ser_send(upsfd,"%s%s",GETX_ALLOW_RANGE,COMMAND_END); if(OneacGetResponse (buffer, sizeof(buffer), GETX_RANGE_RESP_SIZE)) { - fatalx(EXIT_FAILURE, + fatalx(EXIT_FAILURE, "Serial timeout(4) with ONEAC UPS on %s\n",device_path); } strncpy(buffer2, buffer, 3); buffer2[3]='\0'; i = atoi(buffer2); /* Minimum voltage */ - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic ignored "-Wformat-truncation" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION -#pragma GCC diagnostic ignored "-Wstringop-truncation" -#endif - strncpy(buffer2, buffer + 4, 3); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION -#pragma GCC diagnostic pop -#endif + + strncpy(buffer2, buffer+4, 3); j = atoi(buffer2); /* Maximum voltage */ strncpy(buffer2, buffer+8, 2); buffer2[2]='\0'; k = atoi(buffer2); /* Spread between */ - + dstate_setinfo("input.transfer.low.min", "%3d", i); dstate_setinfo("input.transfer.low.max", "%3d", j-k); dstate_setinfo("input.transfer.high.min", "%3d", i+k); @@ -458,7 +432,7 @@ void upsdrv_initinfo(void) else { /* Use default values from firmware */ - upsdebugx (2,"Using trip defaults (%s)...", + upsdebugx (2,"Using trip defaults (%s)...", dstate_getinfo("ups.firmware")); switch (VRange) /* Held from initial use */ @@ -491,7 +465,7 @@ void upsdrv_updateinfo(void) char buffer[256]; /* Main response buffer */ char buffer2[32]; /* Conversion buffer */ char s; - ssize_t RetValue; + int RetValue; int timevalue; /* Start with EG/ON information */ @@ -511,7 +485,7 @@ void upsdrv_updateinfo(void) { ser_comm_fail("Oneac UPS Comm failure continues on port %s", device_path); - } + } else if (RetValue != 0) { if (--CommTry == 0) @@ -547,10 +521,10 @@ void upsdrv_updateinfo(void) { status_set("OL"); } - + if (s & 0x02) /* Low Battery */ status_set("LB"); - + if (s & 0x04) /* General fault */ { dstate_setinfo("ups.test.result","UPS Internal Failure"); @@ -583,7 +557,7 @@ void upsdrv_updateinfo(void) "High Input Voltage"); break; case NO_VALUE_YET : - dstate_setinfo("input.transfer.reason", + dstate_setinfo("input.transfer.reason", "No transfer yet."); break; default : @@ -604,7 +578,7 @@ void upsdrv_updateinfo(void) /*battery charge*/ if(buffer[10] == YES) dstate_setinfo("battery.charge", "0%.2s",buffer+33); - else + else dstate_setinfo("battery.charge", "100"); EliminateLeadingZeroes (buffer+35, 3, buffer2, sizeof(buffer2)); @@ -627,10 +601,10 @@ void upsdrv_updateinfo(void) { /* A shutdown is underway! */ status_set("FSD"); - + if(buffer[15] != HIGH_COUNT) { - EliminateLeadingZeroes (buffer+15, 3, buffer2, + EliminateLeadingZeroes (buffer+15, 3, buffer2, sizeof(buffer2)); dstate_setinfo("ups.timer.shutdown", "%s", buffer2); } @@ -640,18 +614,18 @@ void upsdrv_updateinfo(void) } } - if (buffer[47] == YES) + if (buffer[47] == YES) status_set("BOOST"); } /* Now update info for only the OZ/OB families of UPS */ if ((strncmp(UpsFamily, FAMILY_OZ, FAMILY_SIZE) == 0) || - (strncmp(UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) + (strncmp(UpsFamily, FAMILY_OB, FAMILY_SIZE) == 0)) { ser_flush_in(upsfd,"",0); /*just in case*/ ser_send (upsfd,"%c%s",GETX_ALL_1,COMMAND_END); - RetValue = OneacGetResponse (buffer, sizeof(buffer), + RetValue = OneacGetResponse (buffer, sizeof(buffer), GETX_ALL1_RESP_SIZE); if(RetValue) @@ -693,13 +667,13 @@ void upsdrv_updateinfo(void) /* Battery replace date */ ser_send (upsfd,"%c%s",GETX_BATT_REPLACED,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_DATE_RESP_SIZE)) dstate_setinfo("battery.date", "%.6s (yymmdd)", buffer); /* Low and high output trip points */ ser_send (upsfd,"%c%s",GETX_LOW_OUT_ALLOW,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_ALLOW_RESP_SIZE)) { EliminateLeadingZeroes (buffer, 3, buffer2,sizeof(buffer2)); @@ -707,16 +681,16 @@ void upsdrv_updateinfo(void) } ser_send (upsfd,"%c%s",GETX_HI_OUT_ALLOW,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_ALLOW_RESP_SIZE)) dstate_setinfo("input.transfer.high", "%s", buffer); /* Restart delay */ ser_send (upsfd,"%c%s",GETX_RESTART_DLY,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_RSTRT_RESP_SIZE)) { - EliminateLeadingZeroes (buffer, 4, buffer2, + EliminateLeadingZeroes (buffer, 4, buffer2, sizeof(buffer2)); dstate_setinfo("ups.delay.start", "%s", buffer2); } @@ -725,7 +699,7 @@ void upsdrv_updateinfo(void) ser_send (upsfd,"%s%s",GETX_BUZZER_WHAT,COMMAND_END); if(!OneacGetResponse (buffer, sizeof(buffer), 1)) { - switch (buffer[0]) + switch (buffer[0]) { case BUZZER_ENABLED : dstate_setinfo("ups.beeper.status", "enabled"); @@ -763,15 +737,15 @@ void upsdrv_updateinfo(void) /* Shutdown timer */ ser_send (upsfd,"%c%s",GETX_SHUTDOWN,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_SHUTDOWN_RESP_SIZE)) { - /* ON would have handled NO_VALUE_YET and setting FSD + /* ON would have handled NO_VALUE_YET and setting FSD * above so only deal with counter value here. */ if (buffer[0] != NO_VALUE_YET) { - EliminateLeadingZeroes (buffer, 5, buffer2, + EliminateLeadingZeroes (buffer, 5, buffer2, sizeof(buffer2)); dstate_setinfo("ups.timer.shutdown", "%s", buffer2); } @@ -779,7 +753,7 @@ void upsdrv_updateinfo(void) /* Restart timer */ ser_send (upsfd,"%s%s",GETX_RESTART_COUNT,COMMAND_END); - if(!OneacGetResponse (buffer, sizeof(buffer), + if(!OneacGetResponse (buffer, sizeof(buffer), GETX_RSTRT_RESP_SIZE)) { if (atoi(buffer) == 0) @@ -788,7 +762,7 @@ void upsdrv_updateinfo(void) } else { - EliminateLeadingZeroes (buffer, 4, buffer2, + EliminateLeadingZeroes (buffer, 4, buffer2, sizeof(buffer2)); dstate_setinfo("ups.timer.start", "%s", buffer2); } @@ -865,7 +839,7 @@ int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - + if(!strcasecmp(cmdname, "shutdown.reboot")) { ser_send(upsfd, "%s", SHUTDOWN); return STAT_INSTCMD_HANDLED; @@ -886,7 +860,7 @@ int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - if (!strcasecmp(cmdname, "test.battery.stop")) + if (!strcasecmp(cmdname, "test.battery.stop")) { if ((strncmp (UpsFamily, FAMILY_EG, FAMILY_SIZE) == 0) || (strncmp (UpsFamily, FAMILY_ON, FAMILY_SIZE) == 0)) @@ -896,7 +870,7 @@ int instcmd(const char *cmdname, const char *extra) else { ser_send(upsfd,"%c%s",TEST_ABORT,COMMAND_END); - } + } return STAT_INSTCMD_HANDLED; } @@ -1018,7 +992,7 @@ int setcmd(const char* varname, const char* setvalue) if (atoi(setvalue) <= 99) { ser_send(upsfd,"%s%s%s",SETX_LOWBATT_AT, setvalue, COMMAND_END); - + dstate_setinfo("battery.runtime.low", "%s", setvalue); return STAT_SET_HANDLED; } @@ -1042,7 +1016,7 @@ int setcmd(const char* varname, const char* setvalue) dstate_setinfo("ups.start.auto", "no"); return STAT_SET_HANDLED; } - + return STAT_SET_UNKNOWN; } diff --git a/drivers/oneac.h b/drivers/oneac.h index 7be4b02..a85a505 100644 --- a/drivers/oneac.h +++ b/drivers/oneac.h @@ -22,9 +22,6 @@ * */ -#ifndef NUT_ONEAC_H_SEEN -#define NUT_ONEAC_H_SEEN 1 - /*misc stuff*/ #define ENDCHAR '\r' #define IGNCHARS "\n" @@ -170,7 +167,7 @@ #define V120AC '1' #define XFER_BLACKOUT 'B' #define XFER_LOW_VOLT 'L' -#define XFER_HI_VOLT 'H' +#define XFER_HI_VOLT 'H' #define BUZZER_ENABLED '1' #define BUZZER_DISABLED '0' #define BUZZER_MUTED '2' @@ -184,5 +181,3 @@ #define CODE_OVERLOAD "c8" /*"slight" overload*/ #define CODE_GROSS_OVLE "c9" /*gross overload 1 minute to power off*/ #define CODE_CHRGR_FUSE_OPEN "u1" /*battery charger fuse probably open*/ - -#endif /* NUT_ONEAC_H_SEEN */ diff --git a/drivers/openups-hid.c b/drivers/openups-hid.c index d8be70d..69a4a61 100644 --- a/drivers/openups-hid.c +++ b/drivers/openups-hid.c @@ -21,70 +21,32 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be first */ - #include "usbhid-ups.h" #include "openups-hid.h" #include "main.h" /* for getval() */ #include "usb-common.h" -#define OPENUPS_HID_VERSION "openUPS HID 0.5" +#define OPENUPS_HID_VERSION "openUPS HID 0.1" /* Minibox */ #define OPENUPS_VENDORID 0x04d8 -/* constants for converting HID read values to real values */ -static const double vin_scale_d004 = 0.03545 * 100; -static const double vout_scale_d004 = 0.02571 * 100; -/* static const double vbat_scale = 0.00857 * 100; */ -static const double ccharge_scale_d004 = 0.8274 / 10; -static const double cdischarge_scale_d004 = 16.113 / 10; - -static double vin_scale = 1; -static double vout_scale= 1; -static double ccharge_scale = 1; -static double cdischarge_scale = 1; - static char openups_scratch_buf[20]; -static void *get_voltage_multiplier(USBDevice_t *device) -{ - - switch(device->ProductID) { - case 0xd004: - vin_scale = vin_scale_d004; - vout_scale= vout_scale_d004; - ccharge_scale= ccharge_scale_d004; - cdischarge_scale= cdischarge_scale_d004; - break; - case 0xd005: - vin_scale = 0.1; - vout_scale = 0.1; - ccharge_scale = 0.1; /* unverified */ - cdischarge_scale = 0.1; /* unverified */ - break; - } - - upsdebugx(1, "vin_scale = %g; vout_scale = %g\n", vin_scale, vout_scale); - return NULL; -} - - /* USB IDs device table */ -static /* const */ usb_device_id_t openups_usb_device_table[] = { +static usb_device_id_t openups_usb_device_table[] = { /* openUPS Intelligent UPS (minimum required firmware 1.4) */ - {USB_DEVICE(OPENUPS_VENDORID, 0xd004), get_voltage_multiplier}, - {USB_DEVICE(OPENUPS_VENDORID, 0xd005), get_voltage_multiplier}, + {USB_DEVICE(OPENUPS_VENDORID, 0xd004), NULL}, /* Terminating entry */ - { 0, 0, NULL } + {-1, -1, NULL} }; -/* Thermistor table used for temperature lookups +/* Thermistor table used for temperature lookups * taken from the windows monitoring application */ -static const unsigned int therm_tbl[] = -{ +static unsigned int therm_tbl[] = +{ (unsigned int)0x31, (unsigned int)0x40, (unsigned int)0x53, @@ -121,7 +83,7 @@ static const unsigned int therm_tbl[] = (unsigned int)0x3CC }; -static const unsigned int therm_tbl_size = sizeof(therm_tbl)/sizeof(therm_tbl[0]); +static unsigned int therm_tbl_size = sizeof(therm_tbl)/sizeof(therm_tbl[0]); static const char *openups_charging_fun(double value); static const char *openups_discharging_fun(double value); @@ -137,47 +99,47 @@ static const char *openups_scale_cdischarge_fun(double value); static const char *openups_temperature_fun(double value); static info_lkp_t openups_charging_info[] = { - {0, NULL, openups_charging_fun, NULL } + {0, NULL, openups_charging_fun} }; static info_lkp_t openups_discharging_info[] = { - {0, NULL, openups_discharging_fun, NULL } + {0, NULL, openups_discharging_fun} }; static info_lkp_t openups_online_info[] = { - {0, NULL, openups_online_fun, NULL } + {0, NULL, openups_online_fun} }; static info_lkp_t openups_nobattery_info[] = { - {0, NULL, openups_nobattery_fun, NULL } + {0, NULL, openups_nobattery_fun} }; static info_lkp_t openups_off_info[] = { - {0, NULL, openups_off_fun, NULL } + {0, NULL, openups_off_fun} }; static info_lkp_t openups_vin_info[] = { - {0, NULL, openups_scale_vin_fun, NULL } + {0, NULL, openups_scale_vin_fun} }; static info_lkp_t openups_vout_info[] = { - {0, NULL, openups_scale_vout_fun, NULL } + {0, NULL, openups_scale_vout_fun} }; /* static info_lkp_t openups_vbat_info[] = { - {0, NULL, openups_scale_vbat_fun, NULL } + {0, NULL, openups_scale_vbat_fun} };*/ static info_lkp_t openups_ccharge_info[] = { - {0, NULL, openups_scale_ccharge_fun, NULL } + {0, NULL, openups_scale_ccharge_fun} }; static info_lkp_t openups_cdischarge_info[] = { - {0, NULL, openups_scale_cdischarge_fun, NULL } + {0, NULL, openups_scale_cdischarge_fun} }; static info_lkp_t openups_temperature_info[] = { - {0, NULL, openups_temperature_fun, NULL } + {0, NULL, openups_temperature_fun} }; static const char *openups_charging_fun(double value) @@ -238,7 +200,7 @@ static const char *openups_scale_cdischarge_fun(double value) static const char *openups_temperature_fun(double value) { int i; - int pos = 0; + int pos = -1; unsigned int thermistor = value * 100; if (thermistor <= therm_tbl[0]) { @@ -263,7 +225,7 @@ static const char *openups_temperature_fun(double value) unsigned int d1 = therm_tbl[pos]; unsigned int d2 = therm_tbl[pos + 1]; - double temp = (double) (thermistor - d1) * (t2 - t1) / (d2 - d1) + t1; + float temp = (float) (thermistor - d1) * (t2 - t1) / (d2 - d1) + t1; snprintf(openups_scratch_buf, sizeof(openups_scratch_buf), "%.2f", temp); } } @@ -284,7 +246,7 @@ static usage_lkp_t openups_usage_lkp[] = { {"Cell4", 0x00000004}, /* Battery cell 4 on J6 pin 4 */ {"Cell5", 0x00000005}, /* Battery cell 5 on J6 pin 5 */ {"Cell6", 0x00000006}, /* Battery cell 6 on J4 pin 1 */ - /* Usage table for windows monitoring app only updates when + /* Usage table for windows monitoring app only updates when * certain request codes are written to USB endpoint */ /*{ "OpenUPSExtra", 0xff000001 }, */ {NULL, 0} @@ -305,7 +267,7 @@ static hid_info_t openups_hid2nut[] = { /* Battery */ {"battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", HU_FLAG_STATIC, stringid_conversion}, - {"battery.mfr.date", 0, 0, "UPS.PowerSummary.iOEMInformation", NULL, "%s", HU_FLAG_STATIC, stringid_conversion}, + {"battery.mfr.date", 0, 0, "UPS.PowerSummary.iOEMInformation", NULL, "%s", 0, stringid_conversion}, {"battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.2f", HU_FLAG_QUICK_POLL, NULL}, /* { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, NULL, HU_FLAG_QUICK_POLL, openups_vbat_info }, */ {"battery.current", 0, 0, "UPS.PowerSummary.Current", NULL, "%.3f", HU_FLAG_QUICK_POLL, NULL}, @@ -395,5 +357,4 @@ subdriver_t openups_subdriver = { openups_format_model, openups_format_mfr, openups_format_serial, - fix_report_desc, }; diff --git a/drivers/openups-hid.h b/drivers/openups-hid.h index ee8e06e..c87b3d1 100644 --- a/drivers/openups-hid.h +++ b/drivers/openups-hid.h @@ -26,7 +26,12 @@ #include "usbhid-ups.h" -/* Don't put non-extern definitions here - this file gets included by usbhid-ups.c */ +/* constants for converting HID read values to real values */ +static const float vin_scale = 0.03545 * 100; +static const float vout_scale = 0.02571 * 100; +static const float vbat_scale = 0.00857 * 100; +static const float ccharge_scale = 0.8274 / 10; +static const float cdischarge_scale = 16.113 / 10; extern subdriver_t openups_subdriver; diff --git a/drivers/optiups.c b/drivers/optiups.c index 13eedd5..26b7f47 100644 --- a/drivers/optiups.c +++ b/drivers/optiups.c @@ -27,7 +27,7 @@ #include "serial.h" #define DRIVER_NAME "Opti-UPS driver" -#define DRIVER_VERSION "1.02" +#define DRIVER_VERSION "1.01" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -82,36 +82,34 @@ static char _buf[256]; static int optimodel = 0; enum { OPTIMODEL_DEFAULT = 0, - OPTIMODEL_ZINTO = 1 + OPTIMODEL_ZINTO =1 }; /* Status bits returned by the "AG" command */ enum { - OPTISBIT_NOOUTPUT = 2L, - OPTISBIT_OVERLOAD = 8L, - OPTISBIT_REPLACE_BATTERY = 16L, - OPTISBIT_ON_BATTERY_POWER = 32L, - OPTISBIT_LOW_BATTERY = 64L + OPTISBIT_NOOUTPUT = 2, + OPTISBIT_OVERLOAD = 8, + OPTISBIT_REPLACE_BATTERY = 16, + OPTISBIT_ON_BATTERY_POWER = 32, + OPTISBIT_LOW_BATTERY = 64 }; /* Helper struct for the optifill() function */ typedef struct ezfill_s { const char *cmd; const char *var; - const float scale; /* if 0, no conversion is done and the string - is passed to dstate as is, otherwise a float - conversion with single decimal is applied */ + const float scale; } ezfill_t; /* These can be polled right into a string usable by NUT. * Others such as "AG" and "BV" require some transformation of the return value */ static ezfill_t _pollv[] = { - { "NV", "input.voltage", 0 }, + { "NV", "input.voltage" }, { "OL", "ups.load", 1.0 }, - { "OV", "output.voltage", 0 }, + { "OV", "output.voltage" }, { "FF", "input.frequency", 0.1 }, - { "BT", "ups.temperature", 0 }, + { "BT", "ups.temperature" }, }; static ezfill_t _pollv_zinto[] = { { "NV", "input.voltage", 2.0 }, @@ -119,22 +117,22 @@ static ezfill_t _pollv_zinto[] = { { "OV", "output.voltage", 2.0 }, { "OF", "output.frequency", 0.1 }, { "NF", "input.frequency", 0.1 }, - { "BT", "ups.temperature", 0 }, + { "BT", "ups.temperature" }, }; /* model "IO" is parsed differently in upsdrv_initinfo() */ static ezfill_t _initv[] = { - { "IM", "ups.mfr", 0 }, - { "IZ", "ups.serial", 0 }, - { "IS", "ups.firmware", 0 }, + { "IM", "ups.mfr" }, + { "IZ", "ups.serial" }, + { "IS", "ups.firmware" }, }; /* All serial reads of the OPTI-UPS go through here. We always expect a CR/LF terminated * response. Unknown/Unimplemented commands return ^U (0x15). Actions that complete * successfully return ^F (0x06). */ -static inline ssize_t optireadline(void) +static inline int optireadline(void) { - ssize_t r; + int r; usleep(150000); r = ser_get_line(upsfd, _buf, sizeof(_buf), ENDCHAR, IGNCHARS, 0, 500000 ); _buf[sizeof(_buf)-1] = 0; @@ -157,7 +155,7 @@ static inline ssize_t optireadline(void) } } else - upsdebugx(1, "READ ERROR: %zd", r ); + upsdebugx(1, "READ ERROR: %d", r ); return r; } @@ -167,7 +165,7 @@ static inline ssize_t optireadline(void) * -1 serial timeout * -2 unknown/unimplemented command */ -static inline ssize_t optiquery( const char *cmd ) +static inline int optiquery( const char *cmd ) { upsdebugx(2, "SEND: \"%s\"", cmd ); ser_send( upsfd, "%s", cmd ); @@ -177,10 +175,9 @@ static inline ssize_t optiquery( const char *cmd ) } /* Uses the ezfill_t structure to map UPS commands to the NUT variable destinations */ -static void optifill( ezfill_t *a, size_t len ) +static void optifill( ezfill_t *a, int len ) { - size_t i; - ssize_t r; + int i, r; /* Some things are easy to poll and store */ for ( i=0; i * OV - output stage voltage <118> * OL - output stage load <027> - * + * * FV - Input voltage <120> * FF - Input Frequency (0.1Hz) <600> * FO - Output volts <120> @@ -594,7 +590,7 @@ void upsdrv_cleanup(void) * bit 3: 1 = overload * bit 4: 1 = replace battery * bit 5: 1 = on battery, 0 = on line - * bit 6: 1 = low battery + * bit 6: 1 = low battery * TR - Test results <00> * 00 = Unknown * 01 = Passed @@ -602,7 +598,7 @@ void upsdrv_cleanup(void) * 03 = Error * 04 = Aborted * 05 = In Progress - * 06 = No test init + * 06 = No test init * ******************************************* * ACTIONS diff --git a/drivers/phoenixcontact_modbus.c b/drivers/phoenixcontact_modbus.c deleted file mode 100644 index fb4b24e..0000000 --- a/drivers/phoenixcontact_modbus.c +++ /dev/null @@ -1,192 +0,0 @@ -/* phoenixcontact_modbus.c - Driver for PhoenixContact-QUINT UPS - * - * Copyright (C) - * 2017 Spiros Ioannou - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include - -#define DRIVER_NAME "NUT PhoenixContact Modbus driver" -#define DRIVER_VERSION "0.02" - -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) -#define MODBUS_SLAVE_ID 192 - -/* Variables */ -static modbus_t *modbus_ctx = NULL; -static int errcount = 0; - -static int mrir(modbus_t * arg_ctx, int addr, int nb, uint16_t * dest); - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Spiros Ioannou \n", - DRV_BETA, - {NULL} -}; - -void upsdrv_initinfo(void) -{ - upsdebugx(2, "upsdrv_initinfo"); - - dstate_setinfo("device.mfr", "Phoenix Contact"); - dstate_setinfo("device.model", "QUINT-UPS/24DC"); - - /* upsh.instcmd = instcmd; */ - /* upsh.setvar = setvar; */ -} - -void upsdrv_updateinfo(void) -{ - errcount = 0; - - upsdebugx(2, "upsdrv_updateinfo"); - - uint16_t tab_reg[64]; - - mrir(modbus_ctx, 29697, 3, tab_reg); - - status_init(); - - if (tab_reg[0]) - status_set("OB"); - else - status_set("OL"); - - if (tab_reg[2]) { - status_set("CHRG"); - } - - if (tab_reg[1]) { - status_set("LB"); /* LB is actually called "shutdown event" on this ups */ - } - - mrir(modbus_ctx, 29745, 1, tab_reg); - dstate_setinfo("output.voltage", "%d", (int) (tab_reg[0] / 1000)); - - mrir(modbus_ctx, 29749, 5, tab_reg); - dstate_setinfo("battery.charge", "%d", tab_reg[0]); - /* dstate_setinfo("battery.runtime",tab_reg[1]*60); */ /* also reported on this address, but less accurately */ - - mrir(modbus_ctx, 29792, 10, tab_reg); - dstate_setinfo("battery.voltage", "%f", (double) (tab_reg[0]) / 1000.0); - dstate_setinfo("battery.temperature", "%d", tab_reg[1] - 273); - dstate_setinfo("battery.runtime", "%d", tab_reg[3]); - dstate_setinfo("battery.capacity", "%d", tab_reg[8] * 10); - dstate_setinfo("output.current", "%f", (double) (tab_reg[6]) / 1000.0); - - /* ALARMS */ - mrir(modbus_ctx, 29840, 1, tab_reg); - alarm_init(); - if (CHECK_BIT(tab_reg[0], 4) && CHECK_BIT(tab_reg[0], 5)) - alarm_set("End of life (Resistance)"); - if (CHECK_BIT(tab_reg[0], 6)) - alarm_set("End of life (Time)"); - if (CHECK_BIT(tab_reg[0], 7)) - alarm_set("End of life (Voltage)"); - if (CHECK_BIT(tab_reg[0], 9)) - alarm_set("No Battery"); - if (CHECK_BIT(tab_reg[0], 10)) - alarm_set("Inconsistent technology"); - if (CHECK_BIT(tab_reg[0], 11)) - alarm_set("Overload Cutoff"); - /* We don't use those low-battery indicators below. - * No info or configuration exists for those alarm low-bat - */ - if (CHECK_BIT(tab_reg[0], 12)) - alarm_set("Low Battery (Voltage)"); - if (CHECK_BIT(tab_reg[0], 13)) - alarm_set("Low Battery (Charge)"); - if (CHECK_BIT(tab_reg[0], 14)) - alarm_set("Low Battery (Time)"); - if (CHECK_BIT(tab_reg[0], 16)) - alarm_set("Low Battery (Service)"); - - if (errcount == 0) { - alarm_commit(); - status_commit(); - dstate_dataok(); - } - else - dstate_datastale(); - -} - -void upsdrv_shutdown(void) - __attribute__((noreturn)); - -void upsdrv_shutdown(void) -{ - fatalx(EXIT_FAILURE, "shutdown not supported"); -} - -void upsdrv_help(void) -{ -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ -} - -void upsdrv_initups(void) -{ - int r; - upsdebugx(2, "upsdrv_initups"); - - modbus_ctx = modbus_new_rtu(device_path, 115200, 'E', 8, 1); - if (modbus_ctx == NULL) - fatalx(EXIT_FAILURE, "Unable to create the libmodbus context"); - - r = modbus_set_slave(modbus_ctx, MODBUS_SLAVE_ID); /* slave ID */ - if (r < 0) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "Invalid modbus slave ID %d",MODBUS_SLAVE_ID); - } - - if (modbus_connect(modbus_ctx) == -1) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: %s", modbus_strerror(errno)); - } - -} - - -void upsdrv_cleanup(void) -{ - if (modbus_ctx != NULL) { - modbus_close(modbus_ctx); - modbus_free(modbus_ctx); - } -} - -/* Modbus Read Input Registers */ -static int mrir(modbus_t * arg_ctx, int addr, int nb, uint16_t * dest) -{ - int r; - r = modbus_read_input_registers(arg_ctx, addr, nb, dest); - if (r == -1) { - upslogx(LOG_ERR, "mrir: modbus_read_input_registers(addr:%d, count:%d): %s (%s)", addr, nb, modbus_strerror(errno), device_path); - errcount++; - } - return r; -} diff --git a/drivers/pijuice.c b/drivers/pijuice.c deleted file mode 100644 index a1b1db1..0000000 --- a/drivers/pijuice.c +++ /dev/null @@ -1,853 +0,0 @@ -/* pijuice.c Driver for the PiJuice HAT (www.pijuice.com), addressed via i2c. - - Copyright (C) 2019 Andrew Anderson - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "main.h" - -#include -#include - -/* - * Linux I2C userland is a bit of a mess until distros refresh to - * the i2c-tools 4.x release that profides i2c/smbus.h for userspace - * instead of (re)using linux/i2c-dev.h, which conflicts with a - * kernel header of the same name. - * - * See: - * https://i2c.wiki.kernel.org/index.php/Plans_for_I2C_Tools_4 - */ -#if HAVE_LINUX_SMBUS_H -# include -#endif -#if HAVE_LINUX_I2C_DEV_H -# include /* for I2C_SLAVE */ -# if !HAVE_LINUX_SMBUS_H -# ifndef I2C_FUNC_I2C -# include -# endif -# endif -#endif - -/* - * i2c-tools pre-4.0 has a userspace header with a name that conflicts - * with a kernel header, so it may be ignored/removed by distributions - * when packaging i2c-tools. - * - * This will cause the driver to be un-buildable on certain - * configurations, so include the necessary bits here to handle this - * situation. - */ -#if WITH_LINUX_I2C -#if !HAVE_DECL_I2C_SMBUS_ACCESS -static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, - int size, union i2c_smbus_data *data) -{ - struct i2c_smbus_ioctl_data args; - __s32 err; - - args.read_write = read_write; - args.command = command; - args.size = size; - args.data = data; - - err = ioctl(file, I2C_SMBUS, &args); - if (err == -1) - err = -errno; - return err; -} -#endif - -#if !HAVE_DECL_I2C_SMBUS_READ_BYTE_DATA -static inline __s32 i2c_smbus_read_byte_data(int file, __u8 command) -{ - union i2c_smbus_data data; - int err; - - if ((err = i2c_smbus_access(file, I2C_SMBUS_READ, command, - I2C_SMBUS_BYTE_DATA, &data)) < 0) - return err; - else - return 0x0FF & data.byte; -} -#endif - -#if !HAVE_DECL_I2C_SMBUS_WRITE_BYTE_DATA -static inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, __u8 value) -{ - union i2c_smbus_data data; - int err; - - data.byte = value; - if ((err = i2c_smbus_access(file, I2C_SMBUS_WRITE, command, - I2C_SMBUS_BYTE_DATA, &data)) < 0) - return err; - else - return 0x0FF & data.byte; -} -#endif - -#if !HAVE_DECL_I2C_SMBUS_READ_WORD_DATA -static inline __s32 i2c_smbus_read_word_data(int file, __u8 command) -{ - union i2c_smbus_data data; - int err; - - if ((err = i2c_smbus_access(file, I2C_SMBUS_READ, command, - I2C_SMBUS_WORD_DATA, &data)) < 0) - return err; - else - return 0x0FFFF & data.word; -} -#endif - -#if !HAVE_DECL_I2C_SMBUS_WRITE_WORD_DATA -static inline __s32 i2c_smbus_write_word_data(int file, __u8 command, __u16 value) -{ - union i2c_smbus_data data; - int err; - - data.word = value; - if ((err = i2c_smbus_access(file, I2C_SMBUS_WRITE, command, - I2C_SMBUS_WORD_DATA, &data)) < 0) - return err; - else - return 0x0FFFF & data.word; -} -#endif - -#if !HAVE_DECL_I2C_SMBUS_READ_BLOCK_DATA -static inline __u8* i2c_smbus_read_i2c_block_data(int file, __u8 command, __u8 length, __u8 *values) -{ - union i2c_smbus_data data; - int err; - - if ( length > I2C_SMBUS_BLOCK_MAX) - { - length = I2C_SMBUS_BLOCK_MAX; - } - - data.block[0] = length; - memcpy(data.block + 1, values, length); - - if ((err = i2c_smbus_access(file, I2C_SMBUS_READ, command, - I2C_SMBUS_I2C_BLOCK_DATA, &data)) < 0) - return NULL; - else - memcpy(values, &data.block[1], data.block[0]); - - return values; -} -#endif -#endif // if WITH_LINUX_I2C - -#define STATUS_CMD 0x40 -#define CHARGE_LEVEL_CMD 0x41 -#define CHARGE_LEVEL_HI_RES_CMD 0x42 -#define FAULT_EVENT_CMD 0x44 -#define BUTTON_EVENT_CMD 0x45 -#define BATTERY_TEMPERATURE_CMD 0x47 -#define BATTERY_VOLTAGE_CMD 0x49 -#define BATTERY_CURRENT_CMD 0x4b -#define IO_VOLTAGE_CMD 0x4d -#define IO_CURRENT_CMD 0x4f - -#define CHARGING_CONFIG_CMD 0x51 -#define BATTERY_PROFILE_ID_CMD 0x52 -#define BATTERY_PROFILE_CMD 0x53 -#define BATTERY_EXT_PROFILE_CMD 0x54 -#define BATTERY_TEMP_SENSE_CONFIG_CMD 0x5D - -#define POWER_INPUTS_CONFIG_CMD 0x5E -#define RUN_PIN_CONFIG_CMD 0x5F -#define POWER_REGULATOR_CONFIG_CMD 0x60 -#define WATCHDOG_ACTIVATION_CMD 0x61 -#define POWER_OFF_CMD 0x62 -#define WAKEUP_ON_CHARGE_CMD 0x63 -#define SYSTEM_POWER_SWITCH_CTRL_CMD 0x64 - -#define LED_STATE_CMD 0x66 -#define LED_BLINK_CMD 0x68 -#define LED_CONFIGURATION_CMD 0x6A -#define BUTTON_CONFIGURATION_CMD 0x6E - -#define IO1_CONFIGURATION_CMD 0x72 -#define IO1_PIN_ACCESS_CMD 0x75 - -#define IO2_CONFIGURATION_CMD 0x77 -#define IO2_PIN_ACCESS_CMD 0x7A - -#define I2C_ADDRESS_CMD 0x7C - -#define ID_EEPROM_WRITE_PROTECT_CTRL_CMD 0x7E -#define ID_EEPROM_ADDRESS_CMD 0x7F - -#define RTC_TIME_CMD 0xB0 -#define RTC_ALARM_CMD 0xB9 -#define RTC_CTRL_STATUS_CMD 0xC2 - -#define RESET_TO_DEFAULT_CMD 0xF0 -#define FIRMWARE_VERSION_CMD 0xFD - -#define BATT_NORMAL 0 -#define BATT_CHARGING_FROM_IN 1 -#define BATT_CHARGING_FROM_5V 2 -#define BATT_NOT_PRESENT 3 - -#define POWER_NOT_PRESENT 0 -#define POWER_BAD 1 -#define POWER_WEAK 2 -#define POWER_PRESENT 3 - -#define LOW_BATTERY_THRESHOLD 25.0 -#define HIGH_BATTERY_THRESHOLD 75.0 -#define NOMINAL_BATTERY_VOLTAGE 4.18 - -#define DRIVER_NAME "PiJuice UPS driver" -#define DRIVER_VERSION "0.10" - -static uint8_t i2c_address = 0x14; -static uint8_t shutdown_delay = 30; - -/* - * Flags used to indicate a change in power status - */ -static uint8_t usb_power = 0; -static uint8_t gpio_power = 0; -static uint8_t battery_power = 0; - -/* - * Smooth out i2c read errors by holding the most recent - * battery charge level reading - */ -static float battery_charge_level = 0; - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Andrew Anderson ", - DRV_EXPERIMENTAL, - { NULL } -}; - -/* The macros below all write into a "data" variable defined by the routine - * scope which calls them, with respective type of uint8_t for "byte" and - * uint16_t for "word" macros. Native i2c functions operate with __s32 type - * (currently, signed 32-bit ints?) with negative values for error returns. - * Note: some manpages refer to "s32" while headers on my and CI systems use - * a "__s32" type. Maybe this is something to determine in configure script? - * Code below was fixed to convert the valid values and avoid compiler - * warnings about comparing whether unsigned ints happened to be negative. - */ -#define I2C_READ_BYTE(fd, cmd, label) \ - { \ - __s32 sData; \ - if ((sData = i2c_smbus_read_byte_data(upsfd, cmd)) < 0 ) { \ - upsdebugx(2, "Failure reading the i2c bus [%s]", label); \ - return; \ - } ; \ - data = (uint8_t) sData; \ - } - -#define I2C_WRITE_BYTE(fd, cmd, value, label) \ - { \ - if ( i2c_smbus_write_byte_data(upsfd, cmd, value) < 0 ) { \ - upsdebugx(2, "Failure writing to the i2c bus [%s]", label); \ - return; \ - } ; \ - } - -#define I2C_READ_WORD(fd, cmd, label) \ - { \ - __s32 sData; \ - if ((sData = i2c_smbus_read_word_data(upsfd, cmd)) < 0 ) { \ - upsdebugx(2, "Failure reading the i2c bus [%s]", label); \ - return; \ - } ; \ - data = (uint16_t) sData; \ - } - -#define I2C_READ_BLOCK(fd, cmd, size, block, label) \ - if ((i2c_smbus_read_i2c_block_data(upsfd, cmd, size, block)) < 0 ) { \ - upsdebugx(2, "Failure reading the i2c bus [%s]", label); \ - return; \ - } - -static inline int open_i2c_bus(char *path, uint8_t addr) -{ - int file; - - if ((file = open(path, O_RDWR)) < 0) - { - fatal_with_errno(EXIT_FAILURE, "Failed to open the i2c bus on %s", path); - } - - if (ioctl(file, I2C_SLAVE, addr) < 0) - { - fatal_with_errno(EXIT_FAILURE, "Failed to acquire the i2c bus and/or talk to the UPS"); - } - - return file; -} - -static void get_charge_level_hi_res() -{ - uint8_t cmd = CHARGE_LEVEL_HI_RES_CMD; - uint16_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_WORD( upsfd, cmd, __func__ ) - - /* - * Use an external variable to allow for missed i2c bus - * reads; the charge level data may be slightly stale, - * but no other options seem reasonable: - * - * 1) store 0 - * Leads to a false report of a depleted battery, possibly - * triggering an immediate shutdown if on battery power only - * 2) store -1 - * Adds a lot of logic to "skip" over negative charge levels, - * which effectively accomplishes the same thing - * 3) retry the read immediately - * Could tie up the i2c bus and make matters exponentially worse - */ - battery_charge_level = data / 10.0; - - upsdebugx( 1, "Battery Charge Level: %02.1f%%", battery_charge_level ); - dstate_setinfo( "battery.charge", "%02.1f", battery_charge_level ); -} - -static void get_status() -{ - uint8_t cmd = STATUS_CMD; - uint8_t data; - char status_buf[ST_MAX_VALUE_LEN]; - - upsdebugx( 3, __func__ ); - - memset( status_buf, 0, ST_MAX_VALUE_LEN ); - - I2C_READ_BYTE( upsfd, cmd, __func__ ) - - uint8_t batteryStatus = data >> 2 & 0x03; - switch( batteryStatus ) - { - case BATT_NORMAL: - upsdebugx( 1, "Battery Status: Normal" ); - dstate_setinfo( "battery.packs", "%d", 1 ); - dstate_setinfo( "battery.packs.bad", "%d", 0 ); - break; - case BATT_CHARGING_FROM_IN: - upsdebugx( 1, "Battery Status: Charging from IN" ); - dstate_setinfo( "battery.packs", "%d", 1 ); - dstate_setinfo( "battery.packs.bad", "%d", 0 ); - break; - case BATT_CHARGING_FROM_5V: - upsdebugx( 1, "Battery Status: Charging from 5V" ); - dstate_setinfo( "battery.packs", "%d", 1 ); - dstate_setinfo( "battery.packs.bad", "%d", 0 ); - break; - case BATT_NOT_PRESENT: - upsdebugx( 1, "Battery Status: Not Present" ); - dstate_setinfo( "battery.packs", "%d", 0 ); - dstate_setinfo( "battery.packs.bad", "%d", 1 ); - break; - default: - upsdebugx( 1, "battery.status: UNKNOWN" ); - } - - uint8_t powerInput = data >> 4 & 0x03; - switch( powerInput ) - { - case POWER_NOT_PRESENT: - upsdebugx( 1, "Power Input: Not Present" ); - break; - case POWER_BAD: - upsdebugx( 1, "Power Input: Bad" ); - break; - case POWER_WEAK: - upsdebugx( 1, "Power Input: Weak" ); - break; - case POWER_PRESENT: - upsdebugx( 1, "Power Input: Present" ); - break; - default: - upsdebugx( 1, "Power Input: UNKNOWN" ); - } - - uint8_t powerInput5vIo = data >> 6 & 0x03; - switch( powerInput5vIo ) - { - case POWER_NOT_PRESENT : - upsdebugx(1, "Power Input 5v: Not Present"); - break; - case POWER_BAD: - upsdebugx(1, "Power Input 5v: Bad"); - break; - case POWER_WEAK: - upsdebugx(1, "Power Input 5v: Weak"); - break; - case POWER_PRESENT: - upsdebugx(1, "Power Input 5v: Present"); - break; - default: - upsdebugx(1, "Power Input 5v: UNKNOWN"); - } - - if ( batteryStatus == BATT_NORMAL || - batteryStatus == BATT_CHARGING_FROM_IN || - batteryStatus == BATT_CHARGING_FROM_5V ) - { - get_charge_level_hi_res(); - - if ( battery_charge_level <= LOW_BATTERY_THRESHOLD ) - { - upsdebugx( 1, "Battery Charge Status: LOW" ); - snprintfcat( status_buf, ST_MAX_VALUE_LEN, "LB " ); - } - else if ( battery_charge_level > HIGH_BATTERY_THRESHOLD ) - { - upsdebugx( 1, "Battery Charge Status: HIGH" ); - snprintfcat( status_buf, ST_MAX_VALUE_LEN, "HB " ); - } - } - else if ( batteryStatus == BATT_NOT_PRESENT ) - { - snprintfcat( status_buf, ST_MAX_VALUE_LEN, "RB " ); - } - - if ( batteryStatus <= BATT_NOT_PRESENT && - powerInput <= POWER_PRESENT && - powerInput5vIo <= POWER_PRESENT ) - { - if ( powerInput == POWER_NOT_PRESENT && - ( powerInput5vIo != POWER_NOT_PRESENT )) - { - if ( usb_power != 1 || gpio_power != 0 ) - { - upslogx( LOG_NOTICE, "On USB power" ); - } - usb_power = 1; - gpio_power = 0; - battery_power = 0; - upsdebugx( 1, "On USB power [%d:%d:%d]", usb_power, gpio_power, battery_power ); - - snprintfcat( status_buf, sizeof(status_buf), "OL" ); - if ( batteryStatus == BATT_CHARGING_FROM_5V ) - { - snprintfcat( status_buf, sizeof( status_buf ), " CHRG" ); - upsdebugx( 1, "Battery Charger Status: charging" ); - dstate_setinfo( "battery.charger.status", "%s", "charging" ); - } - else if ( batteryStatus == BATT_NORMAL ) - { - upsdebugx( 1, "Battery Charger Status: resting" ); - dstate_setinfo( "battery.charger.status", "%s", "resting" ); - } - status_set( status_buf ); - } - else if ( powerInput5vIo == POWER_NOT_PRESENT && - ( powerInput != POWER_NOT_PRESENT && - powerInput <= POWER_PRESENT )) - { - if ( gpio_power != 1 || usb_power != 0 ) - { - upslogx( LOG_NOTICE, "On 5V_GPIO power" ); - } - usb_power = 0; - gpio_power = 1; - battery_power = 0; - upsdebugx( 1, "On 5V_GPIO power [%d:%d:%d]", usb_power, gpio_power, battery_power ); - - snprintfcat( status_buf, sizeof(status_buf), "OL" ); - if ( batteryStatus == BATT_CHARGING_FROM_IN ) - { - snprintfcat( status_buf, sizeof(status_buf), " CHRG" ); - status_set( status_buf ); - upsdebugx( 1, "Battery Charger Status: charging" ); - dstate_setinfo( "battery.charger.status", "%s", "charging" ); - } - else if ( batteryStatus == BATT_NORMAL ) - { - status_set( status_buf ); - upsdebugx( 1, "Battery Charger Status: resting" ); - dstate_setinfo( "battery.charger.status", "%s", "resting" ); - } - } - else if ( ( powerInput != POWER_NOT_PRESENT && powerInput <= POWER_PRESENT ) && - ( powerInput5vIo != POWER_NOT_PRESENT && powerInput5vIo <= POWER_PRESENT )) - { - if ( usb_power != 1 || gpio_power != 1 ) - { - upslogx( LOG_NOTICE, "On USB and 5V_GPIO power" ); - } - usb_power = 1; - gpio_power = 1; - battery_power = 0; - upsdebugx( 1, "On USB and 5V_GPIO power [%d:%d:%d]", usb_power, gpio_power, battery_power ); - - snprintfcat( status_buf, sizeof( status_buf ), "OL" ); - if ( batteryStatus == BATT_CHARGING_FROM_IN ) - { - snprintfcat( status_buf, sizeof(status_buf), " CHRG"); - status_set( status_buf ); - upsdebugx( 1, "Battery Charger Status: charging" ); - dstate_setinfo("battery.charger.status", "%s", "charging"); - } - else if ( batteryStatus == BATT_NORMAL ) - { - status_set( status_buf ); - upsdebugx( 1, "Battery Charger Status: resting" ); - dstate_setinfo( "battery.charger.status", "%s", "resting" ); - } - } - else if ( powerInput == POWER_NOT_PRESENT && powerInput5vIo == POWER_NOT_PRESENT ) - { - if ( usb_power != 0 || gpio_power != 0 ) - { - upslogx( LOG_NOTICE, "On Battery power" ); - } - usb_power = 0; - gpio_power = 0; - battery_power = 1; - upsdebugx( 1, "On Battery power [%d:%d:%d]", usb_power, gpio_power, battery_power ); - - snprintfcat( status_buf, sizeof(status_buf), "OB DISCHRG" ); - status_set( status_buf ); - } - } -} - -static void get_battery_temperature() -{ - uint8_t cmd = BATTERY_TEMPERATURE_CMD; - int16_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_WORD( upsfd, cmd, __func__ ) - - upsdebugx( 1, "Battery Temperature: %d°C", data ); - dstate_setinfo( "battery.temperature", "%d", data ); -} - -static void get_battery_voltage() -{ - uint8_t cmd = BATTERY_VOLTAGE_CMD; - int16_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_WORD( upsfd, cmd, __func__ ) - - upsdebugx( 1, "Battery Voltage: %0.3fV", data / 1000.0 ); - dstate_setinfo( "battery.voltage", "%0.3f", data / 1000.0 ); -} - -static void get_battery_current() -{ - uint8_t cmd = BATTERY_CURRENT_CMD; - int16_t data; - - upsdebugx( 3, __func__ ); - - /* - * The reported current can actually be negative, so we cannot - * check for I2C failure by looking for negative values - */ - data = i2c_smbus_read_word_data(upsfd, cmd); - - if ( data & ( 1 << 15 ) ) - { - data = data - ( 1 << 16 ); - } - - upsdebugx( 1, "Battery Current: %0.3fA", data / 1000.0 ); - dstate_setinfo( "battery.current", "%0.3f", data / 1000.0 ); -} - -static void get_io_voltage() -{ - uint8_t cmd = IO_VOLTAGE_CMD; - int16_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_WORD( upsfd, cmd, __func__ ) - - upsdebugx( 1, "Input Voltage: %.3fV", data / 1000.0 ); - dstate_setinfo( "input.voltage", "%.3f", data / 1000.0 ); -} - -static void get_io_current() -{ - uint8_t cmd = IO_CURRENT_CMD; - int16_t data; - - upsdebugx( 3, __func__ ); - - /* - * The reported current can actually be negative, so we cannot - * check for I2C failure by looking for negative values - */ - data = i2c_smbus_read_word_data(upsfd, cmd); - - if ( data & ( 1 << 15 ) ) - { - data = data - ( 1 << 16 ); - } - - upsdebugx( 1, "Input Current: %.3fA", data / 1000.0 ); - dstate_setinfo( "input.current", "%.3f", data / 1000.0 ); -} - -static void get_firmware_version() -{ - uint8_t cmd = FIRMWARE_VERSION_CMD; - uint16_t data; - uint8_t major, minor; - - upsdebugx( 3, __func__ ); - - I2C_READ_WORD( upsfd, cmd, __func__ ) - - major = data >> 4; - minor = ( data << 4 & 0xf0 ) >> 4; - - if (( major != 1 ) || ( minor > 3 )) - { - upslogx( LOG_WARNING, "Unknown Firmware release: %d.%d", major, minor ); - } - - upsdebugx( 1, "UPS Firmware Version: %d.%d", major, minor ); - dstate_setinfo( "ups.firmware", "%d.%d", major, minor ); -} - -static void get_battery_profile() -{ - uint8_t cmd = BATTERY_PROFILE_CMD; - __u8 block[I2C_SMBUS_BLOCK_MAX]; - - upsdebugx( 3, __func__ ); - - I2C_READ_BLOCK( upsfd, cmd, 14, block, __func__ ) - - upsdebugx( 1, "Battery Capacity: %0.3fAh", ( block[1] << 8 | block[0] ) / 1000.0 ); - dstate_setinfo( "battery.capacity", "%0.3f", ( block[1] << 8 | block[0] ) / 1000.0 ); -} - -static void get_battery_profile_ext() -{ - uint8_t cmd = BATTERY_EXT_PROFILE_CMD; - __u8 block[I2C_SMBUS_BLOCK_MAX]; - - upsdebugx( 3, __func__ ); - - I2C_READ_BLOCK( upsfd, cmd, 17, block, __func__ ) - - switch( block[0] & 0xFF00 ) - { - case 0: - upsdebugx( 1, "Battery Chemistry: LiPO" ); - dstate_setinfo( "battery.type", "%s", "LiPO" ); - break; - case 1: - upsdebugx( 1, "Battery Chemistry: LiFePO4" ); - dstate_setinfo( "battery.type", "%s", "LiFePO4" ); - break; - default: - upsdebugx( 1, "Battery Chemistry: UNKNOWN" ); - dstate_setinfo( "battery.type", "%s", "UNKNOWN" ); - } -} - -static void get_power_off() -{ - uint8_t cmd = POWER_OFF_CMD; - uint8_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_BYTE( upsfd, cmd, __func__ ) - - if ( data == 255 ) - { - upsdebugx( 1, "Power Off: DISABLED" ); - } - else if ( data <= 250 ) - { - upsdebugx( 1, "Power Off: %d Seconds", data ); - } -} - -static void set_power_off() -{ - uint8_t cmd = POWER_OFF_CMD; - - upsdebugx( 3, __func__ ); - - /* - * Acceptable values for shutdown_delay are 1-250, - * use 0/255 to clear a scheduled power off command - */ - - if ( shutdown_delay > 250 ) - { - upslogx( - LOG_WARNING, - "shutdown delay of >250 seconds requested, shortening to 250 seconds" - ); - shutdown_delay = 250; - } - - if ( shutdown_delay == 0 ) - { - upslogx( - LOG_WARNING, - "shutdown delay of 0 seconds requested, using 1 second instead" - ); - shutdown_delay = 1; - } - - I2C_WRITE_BYTE( upsfd, cmd, shutdown_delay, __func__ ) -} - -static void get_time() -{ - uint8_t cmd = RTC_TIME_CMD; - __u8 block[I2C_SMBUS_BLOCK_MAX]; - uint8_t second, minute, hour, day, month, subsecond; - uint16_t year; - - upsdebugx( 3, __func__ ); - - I2C_READ_BLOCK( upsfd, cmd, 9, block, __func__ ) - - second = (( (block[0] >> 4 ) & 0x07) * 10 ) + ( block[0] & 0x0F ); - minute = (( (block[1] >> 4 ) & 0x07) * 10 ) + ( block[1] & 0x0F ); - hour = (( (block[2] >> 4 ) & 0x03) * 10 ) + ( block[2] & 0x0F ); - day = (( (block[4] >> 4 ) & 0x03) * 10 ) + ( block[4] & 0x0F ); - month = (( (block[5] >> 4 ) & 0x01) * 10 ) + ( block[5] & 0x0F ); - year = (( (block[6] >> 4 ) & 0x0F) * 10 ) + ( block[6] & 0x0F ) + 2000; - subsecond = block[7] * 100 / 256; - - upsdebugx( 1, "UPS Time: %02d:%02d:%02d.%02d", hour, minute, second, subsecond ); - dstate_setinfo( "ups.time", "%02d:%02d:%02d.%02d", hour, minute, second, subsecond ); - - upsdebugx( 1, "UPS Date: %04d-%02d-%02d", year, month, day ); - dstate_setinfo( "ups.date", "%04d-%02d-%02d", year, month, day ); -} - -static void get_i2c_address() -{ - uint8_t cmd = I2C_ADDRESS_CMD; - uint8_t data; - - upsdebugx( 3, __func__ ); - - I2C_READ_BYTE( upsfd, cmd, __func__ ) - - upsdebugx( 1, "I2C Address: 0x%0x", data ); - - if ( data == i2c_address ) - { - upsdebugx( 1, "Found device '0x%0x' on port '%s'", - (unsigned int) i2c_address, device_path ); - } - else - { - fatalx( EXIT_FAILURE, - "Could not find PiJuice HAT at I2C address 0x%0x", - i2c_address ); - } -} - -void upsdrv_initinfo(void) -{ - - dstate_setinfo( "ups.mfr", "%s", "PiJuice" ); - dstate_setinfo( "ups.type", "%s", "HAT" ); - - /* note: for a transition period, these data are redundant */ - - dstate_setinfo( "device.mfr", "%s", "PiJuice" ); - dstate_setinfo( "device.type", "%s", "HAT" ); - - upsdebugx( 1, "Low Battery Threshold: %0.0f%%", LOW_BATTERY_THRESHOLD ); - dstate_setinfo( "battery.charge.low", "%0.0f", LOW_BATTERY_THRESHOLD ); - - upsdebugx( 1, "Nominal Battery Voltage: %0.3fV", NOMINAL_BATTERY_VOLTAGE ); - dstate_setinfo( "battery.voltage.nominal", "%0.3f", NOMINAL_BATTERY_VOLTAGE ); - - get_i2c_address(); - get_battery_profile(); - get_battery_profile_ext(); -} - -void upsdrv_updateinfo(void) -{ - status_init(); - - get_status(); - get_battery_temperature(); - get_battery_voltage(); - get_battery_current(); - get_io_voltage(); - get_io_current(); - get_time(); - get_power_off(); - - status_commit(); - dstate_dataok(); -} - -void upsdrv_shutdown(void) -{ - set_power_off(); -} - -void upsdrv_help(void) -{ - printf("\nThe default I2C address is 20 [0x14]\n"); - printf("\n"); -} - -void upsdrv_makevartable(void) -{ - addvar(VAR_VALUE, "i2c_address", "Override i2c address setting"); -} - -void upsdrv_initups(void) -{ - upsfd = open_i2c_bus( device_path, i2c_address ); - - /* probe ups type */ - get_firmware_version(); - - /* get variables and flags from the command line */ - - if (getval("i2c_address")) - i2c_address = atoi(getval("i2c_address")); -} - -void upsdrv_cleanup(void) -{ - close(upsfd); -} diff --git a/drivers/powercom-hid.c b/drivers/powercom-hid.c index a3973ff..3f76057 100644 --- a/drivers/powercom-hid.c +++ b/drivers/powercom-hid.c @@ -25,7 +25,7 @@ #include "powercom-hid.h" #include "usb-common.h" -#define POWERCOM_HID_VERSION "PowerCOM HID 0.6" +#define POWERCOM_HID_VERSION "PowerCOM HID 0.4" /* FIXME: experimental flag to be put in upsdrv_info */ /* PowerCOM */ @@ -45,10 +45,9 @@ static usb_device_id_t powercom_usb_device_table[] = { { USB_DEVICE(POWERCOM_VENDORID, 0x00a6), NULL }, /* PowerCOM Vanguard and BNT-xxxAP */ { USB_DEVICE(POWERCOM_VENDORID, 0x0004), NULL }, - { USB_DEVICE(POWERCOM_VENDORID, 0x0001), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; static char powercom_scratch_buf[32]; @@ -67,18 +66,9 @@ static double powercom_startup_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.start"); uint16_t val, command; - int iv; - iv = atoi(value ? value : s) / 60; - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { - upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); - return 0; - } - - /* COMMENTME: What are we doing here, a byte-swap in the word? */ - val = (uint16_t)iv; - command = (uint16_t)(val << 8); - command += (uint16_t)(val >> 8); + val = atoi(value ? value : s) / 60; + command = ((val << 8) + (val >> 8)); upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); return command; @@ -102,17 +92,10 @@ static double powercom_shutdown_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.shutdown"); uint16_t val, command; - int iv; - iv = atoi(value ? value : s); - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { - upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); - return 0; - } - - val = (uint16_t)iv; + val = atoi(value ? value : s); val = val ? val : 1; /* 0 sets the maximum delay */ - command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); + command = ((val % 60) << 8) + (val / 60); command |= 0x4000; /* AC RESTART NORMAL ENABLE */ upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); @@ -127,17 +110,10 @@ static double powercom_stayoff_nuf(const char *value) { const char *s = dstate_getinfo("ups.delay.shutdown"); uint16_t val, command; - int iv; - iv = atoi(value ? value : s); - if (iv < 0 || (intmax_t)iv > (intmax_t)UINT16_MAX) { - upsdebugx(0, "%s: value = %d is not in uint16_t range", __func__, iv); - return 0; - } - - val = (uint16_t)iv; + val = atoi(value ? value : s); val = val ? val : 1; /* 0 sets the maximum delay */ - command = ((uint16_t)((val % 60) << 8)) + (uint16_t)(val / 60); + command = ((val % 60) << 8) + (val / 60); command |= 0x8000; /* AC RESTART NORMAL DISABLE */ upsdebugx(3, "%s: value = %s, command = %04X", __func__, value, command); @@ -149,137 +125,9 @@ static info_lkp_t powercom_stayoff_info[] = { }; static info_lkp_t powercom_beeper_info[] = { - { 1, "enabled", NULL, NULL }, - { 2, "disabled", NULL, NULL }, /* muted? */ - { 0, NULL, NULL, NULL } -}; - -static const char *powercom_voltage_conversion_fun(double value) -{ - static char buf[20]; - snprintf(buf, sizeof(buf), "%0.0f", value * 4); - return buf; -} - -static info_lkp_t powercom_voltage_conversion[] = { - { 0, NULL, powercom_voltage_conversion_fun, NULL } -}; - -static const char *powercom_upsfail_conversion_fun(double value) -{ - if ((long)value & 0x0001) { - return "fanfail"; - } else { - return "!fanfail"; - } -} - -static info_lkp_t powercom_upsfail_conversion[] = { - { 0, NULL, powercom_upsfail_conversion_fun, NULL } -}; - -static const char *powercom_replacebatt_conversion_fun(double value) -{ - if ((long)value & 0x0002) { - return "replacebatt"; - } else { - return "!replacebatt"; - } -} - -static info_lkp_t powercom_replacebatt_conversion[] = { - { 0, NULL, powercom_replacebatt_conversion_fun, NULL } -}; - -static const char *powercom_test_conversion_fun(double value) -{ - if ((long)value & 0x0004) { - return "cal"; - } else { - return "!cal"; - } -} - -static info_lkp_t powercom_test_conversion[] = { - { 0, NULL, powercom_test_conversion_fun, NULL } -}; - -static const char *powercom_shutdownimm_conversion_fun(double value) -{ - if ((long)value & 0x0010) { - return "shutdownimm"; - } else { - return "!shutdownimm"; - } -} - -static info_lkp_t powercom_shutdownimm_conversion[] = { - { 0, NULL, powercom_shutdownimm_conversion_fun, NULL } -}; - -static const char *powercom_online_conversion_fun(double value) -{ - if ((long)value & 0x0001) { - return "!online"; - } else { - return "online"; - } -} - -static info_lkp_t powercom_online_conversion[] = { - { 0, NULL, powercom_online_conversion_fun, NULL } -}; - -static const char *powercom_lowbatt_conversion_fun(double value) -{ - if ((long)value & 0x0002) { - return "lowbatt"; - } else { - return "!lowbatt"; - } -} - -static info_lkp_t powercom_lowbatt_conversion[] = { - { 0, NULL, powercom_lowbatt_conversion_fun, NULL } -}; - -static const char *powercom_trim_conversion_fun(double value) -{ - if (((long)value & 0x0018) == 0x0008) { - return "trim"; - } else { - return "!trim"; - } -} - -static info_lkp_t powercom_trim_conversion[] = { - { 0, NULL, powercom_trim_conversion_fun, NULL } -}; - -static const char *powercom_boost_conversion_fun(double value) -{ - if (((long)value & 0x0018) == 0x0018) { - return "boost"; - } else { - return "!boost"; - } -} - -static info_lkp_t powercom_boost_conversion[] = { - { 0, NULL, powercom_boost_conversion_fun, NULL } -}; - -static const char *powercom_overload_conversion_fun(double value) -{ - if ((long)value & 0x0020) { - return "overload"; - } else { - return "!overload"; - } -} - -static info_lkp_t powercom_overload_conversion[] = { - { 0, NULL, powercom_overload_conversion_fun, NULL } + { 1, "enabled", NULL }, + { 2, "disabled", NULL }, /* muted? */ + { 0, NULL, NULL } }; /* --------------------------------------------------------------- */ @@ -288,26 +136,6 @@ static info_lkp_t powercom_overload_conversion[] = { /* POWERCOM usage table */ static usage_lkp_t powercom_usage_lkp[] = { - { "PowercomUPS", 0x00020004 }, - { "PowercomBatterySystem", 0x00020010 }, - { "PowercomPowerConverter", 0x00020016 }, - { "PowercomInput", 0x0002001a }, - { "PowercomOutput", 0x0002001c }, - { "PowercomVoltage", 0x00020030 }, - { "PowercomFrequency", 0x00020032 }, - { "PowercomPercentLoad", 0x00020035 }, - { "PowercomTemperature", 0x00020036 }, - { "PowercomDelayBeforeStartup", 0x00020056 }, - { "PowercomDelayBeforeShutdown", 0x00020057 }, - { "PowercomTest", 0x00020058 }, - { "PowercomShutdownRequested", 0x00020068 }, - { "PowercomInternalChargeController", 0x00020081 }, - { "PowercomPrimaryBatterySupport", 0x00020082 }, - { "PowercomDesignCapacity", 0x00020083 }, - { "PowercomSpecificationInfo", 0x00020084 }, - { "PowercomManufacturerDate", 0x00020085 }, - { "PowercomSerialNumber", 0x00020086 }, - { "PowercomManufacturerName", 0x00020087 }, { "POWERCOM1", 0x0084002f }, { "POWERCOM2", 0xff860060 }, { "POWERCOM3", 0xff860080 }, @@ -440,57 +268,6 @@ static hid_info_t powercom_hid2nut[] = { { "shutdown.return", 0, 0, "UPS.PowerSummary.PCMDelayBeforeShutdown", NULL, NULL, HU_TYPE_CMD, powercom_shutdown_info }, { "shutdown.stayoff", 0, 0, "UPS.PowerSummary.PCMDelayBeforeShutdown", NULL, NULL, HU_TYPE_CMD, powercom_stayoff_info }, - { "ups.serial", 0, 0, "PowercomUPS.PowercomSerialNumber", NULL, "%s", 0, stringid_conversion }, - { "ups.mfr", 0, 0, "PowercomUPS.PowercomManufacturerName", NULL, "%s", 0, stringid_conversion }, -/* { "UPS.DesignCapacity", 0, 0, "PowercomUPS.PowercomDesignCapacity", NULL, "%.0f", 0, NULL }, is always 255 */ - { "ups.mfr.date", 0, 0, "PowercomUPS.PowercomManufacturerDate", NULL, "%s", 0, date_conversion }, - { "battery.temperature", 0, 0, "PowercomUPS.PowercomBatterySystem.PowercomTemperature", NULL, "%.0f", 0, NULL }, - { "battery.temperature", 0, 0, "UPS.Battery.Temperature", NULL, "%.1f", 0, NULL }, - { "battery.charge", 0, 0, "PowercomUPS.PowercomBatterySystem.PowercomVoltage", NULL, "%.0f", 0, NULL }, -/* { "UPS.BatterySystem.SpecificationInfo", 0, 0, "PowercomUPS.PowercomBatterySystem.PowercomSpecificationInfo", NULL, "%.0f", 0, NULL }, */ - { "input.frequency", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomInput.PowercomFrequency", NULL, "%.0f", 0, NULL }, - { "input.voltage", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomInput.PowercomVoltage", NULL, "%.0f", 0, powercom_voltage_conversion }, - { "output.voltage", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomVoltage", NULL, "%.0f", 0, powercom_voltage_conversion }, - { "ups.load", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPercentLoad", NULL, "%.0f", 0, NULL }, - /* flags: 4 - Testing, 8 - Probably mute (it's set on battery with muted beeper and sometimes during ups test) - * bit 0 UPS fault (1 = FAILT) - * bit 1 Battery status (1 = BAD, 0 = NORMAL) - * bit 2 Test mode (1 = TEST, 0 = NORMAL) - * bit 3 X - * bit 4 Pre-SD count mode (1 = ACTIVE) - * bit 5 Schedule count mode (1 = ACTIVE) - * bit 6 Disable NO LOAD SHUTDOWN (1 = ACTIVE) - * bit 7 0 - */ -/* { "UPS.PowerConverter.Output.InternalChargeController", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomInternalChargeController", NULL, "%.0f", 0, NULL }, */ - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomInternalChargeController", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_upsfail_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomInternalChargeController", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_replacebatt_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomInternalChargeController", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_test_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomInternalChargeController", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_shutdownimm_conversion }, - /* flags: 1 - On battery, 2 - Low Battery, 8 - Trim, 8+16 - Boost - * bit 0 is line fail (1 = INV, 0 = LINE) - * bit 1 is low battery (1 = BAT_ LOW, 0 = NORMAL) - * bit 2 X - * bit 3 AVR status (1 = AVR, 0 = NO_AVR) - * bit 4 AVR mode (1 = BOOST, 0 = BUCK) - * bit 5 Load status (1 = OVER LOAD, 0 = NORMAL) - * bit 6 X - * bit 7 SD mode display - */ -/* { "UPS.PowerConverter.Output.PrimaryBatterySupport", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, "%.0f", 0, NULL }, */ - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_online_conversion }, - /* Low battery status may not work */ - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_lowbatt_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_trim_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_boost_conversion }, - { "BOOL", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomPrimaryBatterySupport", NULL, NULL, HU_FLAG_QUICK_POLL, powercom_overload_conversion }, - { "output.frequency", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomOutput.PowercomFrequency", NULL, "%.0f", 0, NULL }, - { "ups.test.result", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomTest", NULL, "%s", 0, test_read_info }, -/* { "UPS.PowerConverter.ShutdownRequested", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomShutdownRequested", NULL, "%.0f", 0, NULL }, */ - { "ups.delay.shutdown", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomDelayBeforeShutdown", NULL, "%.0f", 0, NULL }, - { "ups.delay.start", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomDelayBeforeStartup", NULL, "%.0f", 0, NULL }, - { "load.off", 0, 0, "PowercomUPS.PowercomPowerConverter.PowercomDelayBeforeShutdown", NULL, "0", HU_TYPE_CMD, NULL }, - /* end of structure. */ { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } }; @@ -530,10 +307,6 @@ static int powercom_claim(HIDDevice_t *hd) return 0; case SUPPORTED: - if (hd->ProductID == 0x0001) { - interrupt_only = 1; - interrupt_size = 8; - } return 1; case NOT_SUPPORTED: @@ -550,5 +323,4 @@ subdriver_t powercom_subdriver = { powercom_format_model, powercom_format_mfr, powercom_format_serial, - fix_report_desc, }; diff --git a/drivers/powercom.c b/drivers/powercom.c index 6e58a3b..82e4898 100644 --- a/drivers/powercom.c +++ b/drivers/powercom.c @@ -6,28 +6,25 @@ * See http://www.advice.co.il/product/inter/ups.html for its specifications. * This model is based on PowerCom (www.powercom.com) models. * -Socomec Sicon Egys 420 - * -OptiUPS VS 575C * * Copyrights: - * (C) 2015 Arnaud Quette - * (C) 2013 Florian Bruhin * (C) 2002 Simon Rozman * (C) 1999 Peter Bieringer - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * rev 0.7: Alexey Sidorov * - add Powercom's Black Knight Pro model support ( BNT-400/500/600/800/801/1000/1200/1500/2000AP 220-240V ) * @@ -61,24 +58,7 @@ * * Tested on: BNT-1500A * - * rev 0.14: Florian Bruhin (The Compiler) - * - Added support for OptiUPS VS 575C - * This probably also works with others, but I don't have their model numbers. - * - * rev 0.15: VSE NN - * - Fixed UPS type assignment for Powercom Imperial USB series manufactured since 2009. - * - * Tested on: IMP-625AP - * - * rev 0.16: Arnaud Quette - * - Fixed the processing of input/output voltages for KIN models - * (https://github.com/networkupstools/nut/issues/187) - * - * rev 0.18: Rouben Tchakhmakhtchian - * - Added nobt flag to config that skips UPS battery check on startup/init - * (https://github.com/networkupstools/nut/issues/546) - * - */ + */ #include "main.h" #include "serial.h" @@ -86,7 +66,7 @@ #include "math.h" #define DRIVER_NAME "PowerCom protocol UPS driver" -#define DRIVER_VERSION "0.19" +#define DRIVER_VERSION "0.13" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -94,10 +74,7 @@ upsdrv_info_t upsdrv_info = { DRIVER_VERSION, "Simon Rozman \n" \ "Peter Bieringer \n" \ - "Alexey Sidorov \n" \ - "Florian Bruhin \n" \ - "Arnaud Quette \n" \ - "Rouben Tchakhmakhtchian ", + "Alexey Sidorov ", DRV_STABLE, { NULL } }; @@ -145,94 +122,83 @@ static void no_flow_control (void); * 120VoltageFactor, 120VoltageConstant }, */ static struct type types[] = { - { - "Trust", - 11, - { "dtr0rts1", dtr0rts1 }, - { { 5U, 0U }, { 7U, 0U }, { 8U, 0U } }, - { { 0U, 10U }, 'n' }, - { 0.00020997, 0.00020928 }, - { 6.1343, -0.3808, 4.3110, 0.1811 }, - { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, - { 1.9216, -0.0977, 0.9545, 0.0000 }, - }, - { - "Egys", - 16, - { "no_flow_control", no_flow_control }, - { { 5U, 0x80U }, { 7U, 0U }, { 8U, 0U } }, - { { 0U, 10U }, 'n' }, - { 0.00020997, 0.00020928 }, - { 6.1343, -0.3808, 1.3333, 0.6667 }, - { 5.0000, 0.3268, -825.00, 2.2105, -355.37 }, - { 1.9216, -0.0977, 0.9545, 0.0000 }, - }, - { - "KP625AP", - 16, - { "dtr0rts1", dtr0rts1 }, - { { 5U, 0x80U }, { 7U, 0U }, { 8U, 0U } }, - { { 0U, 10U }, 'n' }, - { 0.00020997, 0.00020928 }, - { 6.1343, -0.3808, 4.3110, 0.1811 }, - { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, - { 1.9216, -0.0977, 0.9545, 0.0000 }, - }, - { - "IMP", - 16, - { "no_flow_control", no_flow_control }, - { { 5U, 0xFFU }, { 7U, 0U }, { 8U, 0U } }, - { { 1U, 30U }, 'y' }, - { 0.00020997, 0.00020928 }, - { 6.1343, -0.3808, 4.3110, 0.1811 }, - { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, - { 1.9216, -0.0977, 0.9545, 0.0000 }, - }, - { - "KIN", - 16, - { "no_flow_control", no_flow_control }, - { { 11U, 0x4bU }, { 8U, 0U }, { 8U, 0U } }, - { { 1U, 30U }, 'y' }, - { 0.00020997, 0.0 }, - { 6.1343, -0.3808, 1.075, 0.1811 }, - { 5.0000, 0.3268, -825.00, 0.46511, 0 }, - { 1.9216, -0.0977, 0.82857, 0.0000 }, - }, - { - "BNT", - 16, - { "no_flow_control", no_flow_control }, - { { 11U, 0x42U }, { 8U, 0U }, { 8U, 0U } }, - { { 1U, 30U }, 'y' }, - { 0.00020803, 0.0 }, - { 1.4474, 0.0, 0.8594, 0.0 }, - { 5.0000, 0.3268, -825.00, 0.46511, 0 }, - { 1.9216, -0.0977, 0.82857, 0.0000 }, - }, - { - "BNT-other", - 16, - { "no_flow_control", no_flow_control }, - { { 8U, 0U }, { 8U, 0U }, { 8U, 0U } }, - { { 1U, 30U }, 'y' }, - { 0.00027778, 0.0000 }, - { 1.0000, 0.0000, 1.0000, 0.0000 }, - { 1.0000, 0.0000, 0.0000, 1.0000, 0.0000 }, - { 2.0000, 0.0000, 2.0000, 0.0000 }, - }, - { - "OPTI", - 16, - { "no_flow_control", no_flow_control }, - { { 5U, 0xFFU }, { 7U, 0U }, { 8U, 0U } }, - { { 1U, 30U }, 'y' }, - { 0.0000, 0.0000 }, - { 1.0000, 0.0000, 1.0000, 0.0000 }, - { 1.0000, 0.0000, 0.0000, 1.0000, 0.0000 }, - { 2.0000, 0.0000, 2.0000, 0.0000 }, - }, + { + "Trust", + 11, + { "dtr0rts1", dtr0rts1 }, + { { 5U, 0U }, { 7U, 0U }, { 8U, 0U } }, + { { 0U, 10U }, 'n' }, + { 0.00020997, 0.00020928 }, + { 6.1343, -0.3808, 4.3110, 0.1811 }, + { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, + { 1.9216, -0.0977, 0.9545, 0.0000 }, + }, + { + "Egys", + 16, + { "no_flow_control", no_flow_control }, + { { 5U, 0x80U }, { 7U, 0U }, { 8U, 0U } }, + { { 0U, 10U }, 'n' }, + { 0.00020997, 0.00020928 }, + { 6.1343, -0.3808, 1.3333, 0.6667 }, + { 5.0000, 0.3268, -825.00, 2.2105, -355.37 }, + { 1.9216, -0.0977, 0.9545, 0.0000 }, + }, + { + "KP625AP", + 16, + { "dtr0rts1", dtr0rts1 }, + { { 5U, 0x80U }, { 7U, 0U }, { 8U, 0U } }, + { { 0U, 10U }, 'n' }, + { 0.00020997, 0.00020928 }, + { 6.1343, -0.3808, 4.3110, 0.1811 }, + { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, + { 1.9216, -0.0977, 0.9545, 0.0000 }, + }, + { + "IMP", + 16, + { "no_flow_control", no_flow_control }, + { { 5U, 0xFFU }, { 7U, 0U }, { 8U, 0U } }, + { { 1U, 30U }, 'y' }, + { 0.00020997, 0.00020928 }, + { 6.1343, -0.3808, 4.3110, 0.1811 }, + { 5.0000, 0.3268, -825.00, 4.5639, -835.82 }, + { 1.9216, -0.0977, 0.9545, 0.0000 }, + }, + { + "KIN", + 16, + { "no_flow_control", no_flow_control }, + { { 11U, 0x4bU }, { 8U, 0U }, { 8U, 0U } }, + { { 1U, 30U }, 'y' }, + { 0.00020997, 0.0 }, + { 6.1343, -0.3808, 1.075, 0.1811 }, + { 5.0000, 0.3268, -825.00, 0.46511, 0 }, + { 1.9216, -0.0977, 0.82857, 0.0000 }, + }, + { + "BNT", + 16, + { "no_flow_control", no_flow_control }, + { { 11U, 0x42U }, { 8U, 0U }, { 8U, 0U } }, + { { 1U, 30U }, 'y' }, + { 0.00020803, 0.0 }, + { 1.4474, 0.0, 0.8594, 0.0 }, + { 5.0000, 0.3268, -825.00, 0.46511, 0 }, + { 1.9216, -0.0977, 0.82857, 0.0000 }, + }, + { + "BNT-other", + 16, + { "no_flow_control", no_flow_control }, + { { 8U, 0U }, { 8U, 0U }, { 8U, 0U } }, + { { 1U, 30U }, 'y' }, + { 0.00027778, 0.0000 }, + { 1.0000, 0.0000, 1.0000, 0.0000 }, + { 1.0000, 0.0000, 0.0000, 1.0000, 0.0000 }, + { 2.0000, 0.0000, 2.0000, 0.0000 }, + }, }; /* values for sending to UPS */ @@ -240,7 +206,7 @@ enum commands { SEND_DATA = '\x01', BATTERY_TEST = '\x03', WAKEUP_TIME = '\x04', - RESTART = '\xb9', + RESTART = '\xb9', SHUTDOWN = '\xba', COUNTER = '\xbc' }; @@ -279,69 +245,55 @@ enum status { OFF = 128U }; -static unsigned int voltages[] = {100,110,115,120,0,0,0,200,220,230,240,0,0,0,0,0}; -static unsigned int BNTmodels[] = {0,400,500,600,800,801,1000,1200,1500,2000,0,0,0,0,0,0}; -static unsigned int KINmodels[] = {0,425,500,525,625,800,1000,1200,1500,1600,2200,2200,2500,3000,5000,0}; -static unsigned int IMPmodels[] = {0,425,525,625,825,1025,1200,1500,2000,0,0,0,0,0,0,0}; -static unsigned int OPTImodels[] = {0,0,0,575,0,0,0,0,0,0,0,0,0,0,0,0}; +unsigned int voltages[]={100,110,115,120,0,0,0,200,220,230,240,0,0,0,0,0}; +unsigned int BNTmodels[]={0,400,500,600,800,801,1000,1200,1500,2000,0,0,0,0,0,0}; +unsigned int KINmodels[]={0,425,500,525,625,800,1000,1200,1500,1600,2200,2200,2500,3000,5000,0}; +unsigned int IMPmodels[]={0,425,525,625,825,1025,1200,1500,2000,0,0,0,0,0,0,0}; /* * local used functions */ -static void shutdown_halt(void) - __attribute__((noreturn)); - static void shutdown_halt(void) { - ser_send_char (upsfd, (unsigned char)SHUTDOWN); - if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') + ser_send_char (upsfd, SHUTDOWN); + if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') ser_send_char (upsfd, types[type].shutdown_arguments.delay[0]); ser_send_char (upsfd, types[type].shutdown_arguments.delay[1]); upslogx(LOG_INFO, "Shutdown (stayoff) initiated."); exit (0); } -static void shutdown_ret(void) - __attribute__((noreturn)); - static void shutdown_ret(void) { - ser_send_char (upsfd, (unsigned char)RESTART); - ser_send_char (upsfd, (unsigned char)COUNTER); - if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') + ser_send_char (upsfd, RESTART); + ser_send_char (upsfd, COUNTER); + if (types[type].shutdown_arguments.minutesShouldBeUsed != 'n') ser_send_char (upsfd, types[type].shutdown_arguments.delay[0]); ser_send_char (upsfd, types[type].shutdown_arguments.delay[1]); upslogx(LOG_INFO, "Shutdown (return) initiated."); - + exit (0); } /* registered instant commands */ static int instcmd (const char *cmdname, const char *extra) { - if (!strcasecmp(cmdname, "test.battery.start")) { + if (!strcasecmp(cmdname, "test.battery.start")) { ser_send_char (upsfd, BATTERY_TEST); return STAT_INSTCMD_HANDLED; - } - if (!strcasecmp(cmdname, "shutdown.return")) { - /* NOTE: In this context, "return" is UPS behavior after the - * wall-power gets restored. The routine exits the driver anyway. - */ + } + if (!strcasecmp(cmdname, "shutdown.return")) { shutdown_ret(); -#ifndef HAVE___ATTRIBUTE__NORETURN return STAT_INSTCMD_HANDLED; -#endif } if (!strcasecmp(cmdname, "shutdown.stayoff")) { - shutdown_halt(); -#ifndef HAVE___ATTRIBUTE__NORETURN + shutdown_halt(); return STAT_INSTCMD_HANDLED; -#endif } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); - return STAT_INSTCMD_UNKNOWN; + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); + return STAT_INSTCMD_UNKNOWN; } /* set DTR and RTS lines on a serial port to supply a passive @@ -349,8 +301,8 @@ static int instcmd (const char *cmdname, const char *extra) */ static void dtr0rts1 (void) { - ser_set_dtr(upsfd, 0); - ser_set_rts(upsfd, 1); + ser_set_dtr(upsfd, 0); + ser_set_rts(upsfd, 1); upsdebugx(2, "DTR => 0, RTS => 1"); } @@ -358,13 +310,13 @@ static void dtr0rts1 (void) static void no_flow_control (void) { struct termios tio; - + tcgetattr (upsfd, &tio); - - tio.c_iflag &= ~ ((tcflag_t)IXON | (tcflag_t)IXOFF); + + tio.c_iflag &= ~ (IXON | IXOFF); tio.c_cc[VSTART] = _POSIX_VDISABLE; tio.c_cc[VSTOP] = _POSIX_VDISABLE; - + upsdebugx(2, "Flow control disable"); /* disable any flow control */ @@ -374,15 +326,15 @@ static void no_flow_control (void) /* sane check for returned buffer */ static int validate_raw_data (void) { - int i = 0, - num_of_tests = + int i = 0, + num_of_tests = sizeof types[0].validation / sizeof types[0].validation[0]; - + for (i = 0; - i < num_of_tests && + i < num_of_tests && raw_data[ types[type].validation[i].index_of_byte] == - types[type].validation[i].required_value; + types[type].validation[i].required_value; i++) ; return (i < num_of_tests) ? 1 : 0; } @@ -390,9 +342,8 @@ static int validate_raw_data (void) /* get info from ups */ static int ups_getinfo(void) { - size_t i; - ssize_t c; - + int i, c; + /* send trigger char to UPS */ if (ser_send_char (upsfd, SEND_DATA) != 1) { upslogx(LOG_NOTICE, "writing error"); @@ -401,34 +352,33 @@ static int ups_getinfo(void) } else { upsdebugx(5, "Num of bytes requested for reading from UPS: %d", types[type].num_of_bytes_from_ups); - /* Note: num_of_bytes_from_ups is (unsigned char) so comparable - * to ssize_t without more range checks */ c = ser_get_buf_len(upsfd, raw_data, types[type].num_of_bytes_from_ups, 3, 0); - - if (c != (ssize_t)types[type].num_of_bytes_from_ups) { - upslogx(LOG_NOTICE, "data receiving error (%zd instead of %d bytes)", c, types[type].num_of_bytes_from_ups); + + if (c != types[type].num_of_bytes_from_ups) { + upslogx(LOG_NOTICE, "data receiving error (%d instead of %d bytes)", c, types[type].num_of_bytes_from_ups); dstate_datastale(); return 0; } else - upsdebugx(5, "Num of bytes received from UPS: %zd", c); - } + upsdebugx(5, "Num of bytes received from UPS: %d", c); + + }; /* optional dump of raw data */ if (nut_debug_level > 4) { /* FIXME: use upsdebug_hex() ? */ printf("Raw data from UPS:\n"); for (i = 0; i < types[type].num_of_bytes_from_ups; i++) { - printf("%2zu 0x%02x (%c)\n", i, raw_data[i], raw_data[i]>=0x20 ? raw_data[i] : ' '); - } - } + printf("%2d 0x%02x (%c)\n", i, raw_data[i], raw_data[i]>=0x20 ? raw_data[i] : ' '); + }; + }; /* validate raw data for correctness */ if (validate_raw_data() != 0) { upslogx(LOG_NOTICE, "data receiving error (validation check)"); dstate_datastale(); return 0; - } + }; return 1; } @@ -436,34 +386,22 @@ static float input_voltage(void) { unsigned int model; float tmp=0.0; - + if ( !strcmp(types[type].name, "BNT") && raw_data[MODELNUMBER]%16 > 7 ) { tmp=2.2*raw_data[INPUT_VOLTAGE]-24; } else if ( !strcmp(types[type].name, "KIN")) { model=KINmodels[raw_data[MODELNUMBER]/16]; - /* Process input voltage, according to line voltage and model rating */ - if (linevoltage < 200) { - if (model <= 625) { - tmp = 0.89 * raw_data[INPUT_VOLTAGE] + 6.18; - } else if ((model >= 800) && (model < 2000)) { - tmp = 1.61 * raw_data[INPUT_VOLTAGE] / 2.0; - } else { - tmp = 1.625 * raw_data[INPUT_VOLTAGE] / 2.0; - } + if (model<=625){ + tmp=1.79*raw_data[INPUT_VOLTAGE]+3.35; + } else if (model<2000){ + tmp=1.61*raw_data[INPUT_VOLTAGE]; + } else { + tmp=1.625*raw_data[INPUT_VOLTAGE]; } - if (linevoltage >= 200) { - if (model <= 625) { - tmp = 1.79 * raw_data[INPUT_VOLTAGE] + 3.35; - } else if ((model >= 800) && (model < 2000)) { - tmp = 1.61 * raw_data[INPUT_VOLTAGE]; - } else { - tmp = 1.625 * raw_data[INPUT_VOLTAGE]; - } - } - } else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) { + } else if ( !strcmp(types[type].name, "IMP")) { tmp=raw_data[INPUT_VOLTAGE]*2.0; } else { - tmp=linevoltage >= 220 ? + tmp=linevoltage >= 220 ? types[type].voltage[0] * raw_data[INPUT_VOLTAGE] + types[type].voltage[1] : types[type].voltage[2] * raw_data[INPUT_VOLTAGE] + types[type].voltage[3]; } @@ -475,13 +413,10 @@ static float output_voltage(void) { float tmp,rdatax,rdatay,rdataz,boostdata; unsigned int statINV = 0,statAVR = 0,statAVRMode = 0,model,t; - static float datax1[]={0,1.0,1.0,1.0,1.0,0.945,0.945,0.945,0.127,0.127,0.945,0.945,0.945,0.256}; - static float datay1[]={0,0.85,0.85,0.85,0.88,0.9,0.9,0.9,6.6,6.6,0.87,0.87,0.87,3.29}; - static float dataz1[]={0,1.03,0.78,0.78,0.72,0.55,0.55,0.55,0.5,0.5,0.43,0.43,0.43,0.3}; - static float datax2[]={0,1.0,1.0,1.0,1.0,1.89,1.89,1.89,0.127,0.127,1.89,1.89,1.89,0.256}; - static float datay2[]={0,1.73,1.74,1.74,1.77,0.9,0.9,0.9,13.204,13.204,0.88,0.88,0.88,6.645}; - static float dataz2[]={0,1.15,0.9,0.9,0.75,1.1,1.1,1.1,0.8,0.8,0.86,0.86,0.86,0.7}; - + static float datax[]={0,1.0,1.0,1.0,1.0,1.89,1.89,1.89,0.127,0.127,1.89,1.89,1.89,0.256}; + static float datay[]={0,1.73,1.74,1.74,1.77,0.9,0.9,0.9,13.204,13.204,0.88,0.88,0.88,6.645}; + static float dataz[]={0,1.15,0.9,0.9,0.75,1.1,1.1,1.1,0.8,0.8,0.86,0.86,0.86,0.7}; + if ( !strcmp(types[type].name, "BNT") || !strcmp(types[type].name, "KIN")) { statINV=raw_data[STATUS_A] & ONLINE; statAVR=raw_data[STATUS_A] & AVR_ON; @@ -507,84 +442,45 @@ static float output_voltage(void) } } else if ( !strcmp(types[type].name, "KIN")) { model=KINmodels[raw_data[MODELNUMBER]/16]; - if (statINV == 0) { - if (statAVR == 0) { - /* FIXME: miss test "if (iUPS == 1) {" */ - if (linevoltage >= 200) { - if (model <= 625) - tmp = 1.79*raw_data[OUTPUT_VOLTAGE] + 3.35; - else if (model<2000) - tmp = 1.61*raw_data[OUTPUT_VOLTAGE]; - else - tmp = 1.625*raw_data[OUTPUT_VOLTAGE]; - } else { - if (model <= 625) - tmp = 0.89 * raw_data[OUTPUT_VOLTAGE] + 6.18; - else if (model<2000) - tmp = 1.61 * raw_data[OUTPUT_VOLTAGE] / 2.0; - else - tmp = 1.625 * raw_data[OUTPUT_VOLTAGE] / 2.0; - } - } - else if (statAVR == 1) { - /* FIXME: miss test "if ((iUPS == 1) || (iUPS == 13)) {" */ - if (linevoltage >= 200) { - if (model <= 525) - tmp = 2.07 * raw_data[OUTPUT_VOLTAGE]; - else if (model == 625) - tmp = 2.07 * raw_data[OUTPUT_VOLTAGE]+5; - else if (model < 2000) - tmp = 1.87 * raw_data[OUTPUT_VOLTAGE]; - else - tmp = 1.87 * raw_data[OUTPUT_VOLTAGE]; - } else { - if (model <= 625) - tmp = 2.158 * raw_data[OUTPUT_VOLTAGE] / 2.0; - else if (model < 2000) - tmp = 1.842 * raw_data[OUTPUT_VOLTAGE] / 2.0; - else - tmp = 1.875 * raw_data[OUTPUT_VOLTAGE] / 2.0; - } + if (statINV==0) { + if (statAVR==0) { + if (model<=625) + tmp=1.79*raw_data[OUTPUT_VOLTAGE]+3.35; + else if (model<2000) + tmp=1.61*raw_data[OUTPUT_VOLTAGE]; + else + tmp=1.625*raw_data[OUTPUT_VOLTAGE]; } else { - /* FIXME: miss test "if ((iUPS == 1) || (iUPS == 13)) {" */ - if (linevoltage >= 200) { - if (model == 625) - tmp = 1.571 * raw_data[OUTPUT_VOLTAGE]; - else if (model < 2000) - tmp = 1.37 * raw_data[OUTPUT_VOLTAGE]; + if (statAVRMode > 0){ + if (model<=525) + tmp=2.07*raw_data[OUTPUT_VOLTAGE]; + else if (model==625) + tmp=2.07*raw_data[OUTPUT_VOLTAGE]+5; + else if (model<2000) + tmp=1.87*raw_data[OUTPUT_VOLTAGE]; else - tmp = 1.4 * raw_data[OUTPUT_VOLTAGE]; + tmp=1.87*raw_data[OUTPUT_VOLTAGE]; } else { - if (model <= 625) - tmp = 1.635 * raw_data[OUTPUT_VOLTAGE] / 2.0; - else if (model < 2000) - tmp = 1.392 * raw_data[OUTPUT_VOLTAGE] / 2.0; + if (model<=625) + tmp=1.571*raw_data[OUTPUT_VOLTAGE]; + else if (model<2000) + tmp=1.37*raw_data[OUTPUT_VOLTAGE]; else - tmp = 1.392 * raw_data[OUTPUT_VOLTAGE] / 2.0; + tmp=1.4*raw_data[OUTPUT_VOLTAGE]; } } } else { - /* FIXME: miss test "if ((iUPS == 1) && (T != 0))" */ - if (linevoltage < 200) { - rdatax = datax1[raw_data[MODELNUMBER]/16]; - rdatay = datay1[raw_data[MODELNUMBER]/16]; - rdataz = dataz1[raw_data[MODELNUMBER]/16]; - } else { - rdatax = datax2[raw_data[MODELNUMBER]/16]; - rdatay = datay2[raw_data[MODELNUMBER]/16]; - rdataz = dataz2[raw_data[MODELNUMBER]/16+1]; - } - - boostdata = 1.0 + statAVR * 20.0 / 135.0; - t = raw_data[OUTPUT_FREQUENCY]/2; - tmp = 0; - if (model > 625){ + rdatax=datax[raw_data[MODELNUMBER]/16]; + rdatay=datay[raw_data[MODELNUMBER]/16]; + rdataz=dataz[raw_data[MODELNUMBER]/16]; + boostdata=1.0+statAVR*20.0/135.0; + t=raw_data[OUTPUT_FREQUENCY]/2; + tmp=0; + if (model>625){ tmp=(raw_data[BATTERY_CHARGE]*rdatax)*(raw_data[BATTERY_CHARGE]*rdatax)* (t-raw_data[OUTPUT_VOLTAGE])/t; if (tmp>0) - /* Casts below try to avoid potential multiplication overflow */ - tmp=(float)( (double)sqrt(tmp)*rdatay*boostdata - - (double)raw_data[UPS_LOAD]*rdataz*boostdata ); + tmp=sqrt(tmp)*rdatay*boostdata-raw_data[UPS_LOAD]*rdataz*boostdata; } else { tmp=(raw_data[BATTERY_CHARGE]*rdatax-raw_data[UPS_LOAD]*rdataz)* (raw_data[BATTERY_CHARGE]*rdatax-raw_data[UPS_LOAD]*rdataz)* @@ -592,9 +488,8 @@ static float output_voltage(void) if (tmp>0) tmp=sqrt(tmp)*rdatay; } - /* FIXME: may miss a last processing with ErrorVal = 5 | 10 */ } - } else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) { + } else if ( !strcmp(types[type].name, "IMP")) { tmp=raw_data[OUTPUT_VOLTAGE]*2.0; } else { tmp= linevoltage >= 220 ? @@ -611,24 +506,24 @@ static float input_freq(void) { if ( !strcmp(types[type].name, "BNT") || !strcmp(types[type].name, "KIN")) return 4807.0/raw_data[INPUT_FREQUENCY]; - else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) + else if ( !strcmp(types[type].name, "IMP")) return raw_data[INPUT_FREQUENCY]; - return raw_data[INPUT_FREQUENCY] ? + return raw_data[INPUT_FREQUENCY] ? 1.0 / (types[type].freq[0] * - raw_data[INPUT_FREQUENCY] + - types[type].freq[1]) : 0; + raw_data[INPUT_FREQUENCY] + + types[type].freq[1]) : 0; } static float output_freq(void) { if ( !strcmp(types[type].name, "BNT") || !strcmp(types[type].name, "KIN")) return 4807.0/raw_data[OUTPUT_FREQUENCY]; - else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) + else if ( !strcmp(types[type].name, "IMP")) return raw_data[OUTPUT_FREQUENCY]; - return raw_data[OUTPUT_FREQUENCY] ? + return raw_data[OUTPUT_FREQUENCY] ? 1.0 / (types[type].freq[0] * - raw_data[OUTPUT_FREQUENCY] + - types[type].freq[1]) : 0; + raw_data[OUTPUT_FREQUENCY] + + types[type].freq[1]) : 0; } static float load_level(void) @@ -651,7 +546,7 @@ static float load_level(void) int load801i[]={1,1,1,1,1,1,1,1,44,42,40}; int load1000i[]={1,1,1,1,1,1,1,1,56,54,52}; int load1200i[]={1,1,1,1,1,1,1,1,76,74,72}; - + if ( !strcmp(types[type].name, "BNT") && raw_data[MODELNUMBER]%16 > 7 ) { statINV=raw_data[STATUS_A] & ONLINE; voltage=raw_data[MODELNUMBER]%16; @@ -685,18 +580,18 @@ static float load_level(void) if (model==525) return raw_data[UPS_LOAD]*110.0/load525[voltage]; if (model==625) return raw_data[UPS_LOAD]*110.0/load625[voltage]; if (model<2000) return raw_data[UPS_LOAD]*1.13; - return raw_data[UPS_LOAD]*110.0/load2k[voltage]; + if (model>=2000) return raw_data[UPS_LOAD]*110.0/load2k[voltage]; } else { if (model==425) return raw_data[UPS_LOAD]*110.0/load425i[voltage]; if (model==525) return raw_data[UPS_LOAD]*110.0/load525i[voltage]; if (model==625) return raw_data[UPS_LOAD]*110.0/load625i[voltage]; if (model<2000) return raw_data[UPS_LOAD]*1.66; - return raw_data[UPS_LOAD]*110.0/load2ki[voltage]; + if (model>=2000) return raw_data[UPS_LOAD]*110.0/load2ki[voltage]; } - } else if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) { + } else if ( !strcmp(types[type].name, "IMP")) { return raw_data[UPS_LOAD]; } - return (raw_data[STATUS_A] & MAINS_FAILURE) ? + return raw_data[STATUS_A] & MAINS_FAILURE ? types[type].loadpct[0] * raw_data[UPS_LOAD] + types[type].loadpct[1] : types[type].loadpct[2] * raw_data[UPS_LOAD] + @@ -705,10 +600,9 @@ static float load_level(void) static float batt_level(void) { - int bat0,bat29,bat100; - unsigned int model; + int bat0,bat29,bat100,model; float battval; - + if ( !strcmp(types[type].name, "BNT") ) { bat0=157; bat29=165; @@ -716,9 +610,9 @@ static float batt_level(void) battval=(raw_data[UPS_LOAD])/4+raw_data[BATTERY_CHARGE]; if (battval<=bat0) return 0.0; - if (battval<=bat29) + if (battval>bat0 && battval<=bat29) return (battval-bat0)*30.0/(bat29-bat0); - if (battval<=bat100) + if (battval>bat29 && battval<=bat100) return 30.0+(battval-bat29)*70.0/(bat100-bat29); return 100.0; } @@ -750,9 +644,9 @@ static float batt_level(void) return 30.0+(battval-bat29)*70.0/(bat100-bat29); return 100; } - if ( !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) + if ( !strcmp(types[type].name, "IMP")) return raw_data[BATTERY_CHARGE]; - return (raw_data[STATUS_A] & ONLINE) ? /* Are we on battery power? */ + return raw_data[STATUS_A] & ONLINE ? /* Are we on battery power? */ /* Yes */ types[type].battpct[0] * raw_data[BATTERY_CHARGE] + types[type].battpct[1] * load_level() + types[type].battpct[2] : @@ -769,11 +663,11 @@ static float batt_level(void) void upsdrv_updateinfo(void) { char val[32]; - + if (!ups_getinfo()){ return; } - + /* input.frequency */ upsdebugx(3, "input.frequency (raw data): [raw: %u]", raw_data[INPUT_FREQUENCY]); @@ -786,7 +680,7 @@ void upsdrv_updateinfo(void) dstate_setinfo("output.frequency", "%02.2f", output_freq()); upsdebugx(2, "output.frequency: %s", dstate_getinfo("output.frequency")); - /* ups.load */ + /* ups.load */ upsdebugx(3, "ups.load (raw data): [raw: %u]", raw_data[UPS_LOAD]); dstate_setinfo("ups.load", "%03.1f", load_level()); @@ -798,23 +692,23 @@ void upsdrv_updateinfo(void) dstate_setinfo("battery.charge", "%03.1f", batt_level()); upsdebugx(2, "battery.charge: %s", dstate_getinfo("battery.charge")); - /* input.voltage */ + /* input.voltage */ upsdebugx(3, "input.voltage (raw data): [raw: %u]", raw_data[INPUT_VOLTAGE]); dstate_setinfo("input.voltage", "%03.1f",input_voltage()); upsdebugx(2, "input.voltage: %s", dstate_getinfo("input.voltage")); - - /* output.voltage */ + + /* output.voltage */ upsdebugx(3, "output.voltage (raw data): [raw: %u]", raw_data[OUTPUT_VOLTAGE]); dstate_setinfo("output.voltage", "%03.1f",output_voltage()); upsdebugx(2, "output.voltage: %s", dstate_getinfo("output.voltage")); status_init(); - + *val = 0; if (!(raw_data[STATUS_A] & MAINS_FAILURE)) { - !(raw_data[STATUS_A] & OFF) ? + !(raw_data[STATUS_A] & OFF) ? status_set("OL") : status_set("OFF"); } else { status_set("OB"); @@ -823,7 +717,7 @@ void upsdrv_updateinfo(void) if (raw_data[STATUS_A] & LOW_BAT) status_set("LB"); if (raw_data[STATUS_A] & AVR_ON) { - input_voltage() < linevoltage ? + input_voltage() < linevoltage ? status_set("BOOST") : status_set("TRIM"); } @@ -840,9 +734,6 @@ void upsdrv_updateinfo(void) } /* shutdown UPS */ -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* power down the attached load immediately */ @@ -853,72 +744,71 @@ void upsdrv_shutdown(void) /* initialize UPS */ void upsdrv_initups(void) { - int tmp; - unsigned int model = 0; + int tmp,model = 0; unsigned int i; static char buf[20]; /* check manufacturer name from arguments */ - if (testvar("manufacturer")) + if (getval("manufacturer") != NULL) manufacturer = getval("manufacturer"); - + /* check model name from arguments */ - if (testvar("modelname")) + if (getval("modelname") != NULL) modelname = getval("modelname"); - + /* check serial number from arguments */ - if (testvar("serialnumber")) + if (getval("serialnumber") != NULL) serialnumber = getval("serialnumber"); - + /* get and check type */ - if (testvar("type")) { - for (i = 0; + if (getval("type") != NULL) { + for (i = 0; i < NUM_OF_SUBTYPES && strcmp(types[i].name, getval("type")); i++) ; if (i >= NUM_OF_SUBTYPES) { printf("Given UPS type '%s' isn't valid!\n", getval("type")); exit (1); } - type = i; - } - + type = i; + }; + /* check line voltage from arguments */ - if (testvar("linevoltage")) { + if (getval("linevoltage") != NULL) { tmp = atoi(getval("linevoltage")); if (! ( (tmp >= 200 && tmp <= 240) || (tmp >= 100 && tmp <= 120) ) ) { printf("Given line voltage '%d' is out of range (100-120 or 200-240 V)\n", tmp); exit (1); - } + }; linevoltage = (unsigned int) tmp; - } + }; - if (testvar("numOfBytesFromUPS")) { + if (getval("numOfBytesFromUPS") != NULL) { tmp = atoi(getval("numOfBytesFromUPS")); if (! (tmp > 0 && tmp <= MAX_NUM_OF_BYTES_FROM_UPS) ) { printf("Given numOfBytesFromUPS '%d' is out of range (1 to %d)\n", - tmp, MAX_NUM_OF_BYTES_FROM_UPS); + tmp, MAX_NUM_OF_BYTES_FROM_UPS); exit (1); - } + }; types[type].num_of_bytes_from_ups = (unsigned char) tmp; } - if (testvar("methodOfFlowControl")) { - for (i = 0; - i < NUM_OF_SUBTYPES && + if (getval("methodOfFlowControl") != NULL) { + for (i = 0; + i < NUM_OF_SUBTYPES && strcmp(types[i].flowControl.name, getval("methodOfFlowControl")); i++) ; if (i >= NUM_OF_SUBTYPES) { - printf("Given methodOfFlowControl '%s' isn't valid!\n", + printf("Given methodOfFlowControl '%s' isn't valid!\n", getval("methodOfFlowControl")); exit (1); - } - types[type].flowControl = types[i].flowControl; + }; + types[type].flowControl = types[i].flowControl; } - if (testvar("validationSequence") && - sscanf(getval("validationSequence"), - "{{%u,%x},{%u,%x},{%u,%x}}", + if (getval("validationSequence") && + sscanf(getval("validationSequence"), + "{{%u,%x},{%u,%x},{%u,%x}}", &types[type].validation[0].index_of_byte, &types[type].validation[0].required_value, &types[type].validation[1].index_of_byte, @@ -927,60 +817,58 @@ void upsdrv_initups(void) &types[type].validation[2].required_value ) < 6 ) { - printf("Given validationSequence '%s' isn't valid!\n", + printf("Given validationSequence '%s' isn't valid!\n", getval("validationSequence")); exit (1); } - /* NOTE: %hhu is not supported before C99; that would need reading - * arguments into an uint as %u, checking range and casting */ - if (testvar("shutdownArguments") && - sscanf(getval("shutdownArguments"), "{{%hhu,%hhu},%c}", + if (getval("shutdownArguments") && + sscanf(getval("shutdownArguments"), "{{%u,%u},%c}", &types[type].shutdown_arguments.delay[0], &types[type].shutdown_arguments.delay[1], - &types[type].shutdown_arguments.minutesShouldBeUsed + &types[type].shutdown_arguments.minutesShouldBeUsed ) < 3 ) { - printf("Given shutdownArguments '%s' isn't valid!\n", + printf("Given shutdownArguments '%s' isn't valid!\n", getval("shutdownArguments")); exit (1); - } + } - if (testvar("frequency") && - sscanf(getval("frequency"), "{%f,%f}", - &types[type].freq[0], &types[type].freq[1] + if (getval("frequency") && + sscanf(getval("frequency"), "{%f,%f}", + &types[type].freq[0], &types[type].freq[1] ) < 2 ) { - printf("Given frequency '%s' isn't valid!\n", + printf("Given frequency '%s' isn't valid!\n", getval("frequency")); exit (1); } - if (testvar("loadPercentage") && - sscanf(getval("loadPercentage"), "{%f,%f,%f,%f}", + if (getval("loadPercentage") && + sscanf(getval("loadPercentage"), "{%f,%f,%f,%f}", &types[type].loadpct[0], &types[type].loadpct[1], &types[type].loadpct[2], &types[type].loadpct[3] ) < 4 ) { - printf("Given loadPercentage '%s' isn't valid!\n", + printf("Given loadPercentage '%s' isn't valid!\n", getval("loadPercentage")); exit (1); } - if (testvar("batteryPercentage") && - sscanf(getval("batteryPercentage"), "{%f,%f,%f,%f,%f}", + if (getval("batteryPercentage") && + sscanf(getval("batteryPercentage"), "{%f,%f,%f,%f,%f}", &types[type].battpct[0], &types[type].battpct[1], &types[type].battpct[2], &types[type].battpct[3], &types[type].battpct[4] ) < 5 ) { - printf("Given batteryPercentage '%s' isn't valid!\n", + printf("Given batteryPercentage '%s' isn't valid!\n", getval("batteryPercentage")); exit (1); } - if (testvar("voltage") && - sscanf(getval("voltage"), "{%f,%f,%f,%f}", + if (getval("voltage") && + sscanf(getval("voltage"), "{%f,%f,%f,%f}", &types[type].voltage[0], &types[type].voltage[1], &types[type].voltage[2], &types[type].voltage[3] ) < 4 @@ -992,33 +880,23 @@ void upsdrv_initups(void) /* open serial port */ upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B1200); - + /* setup flow control */ types[type].flowControl.setup_flow_control(); /* Setup Model and LineVoltage */ - if (!strncmp(types[type].name, "BNT",3) || !strcmp(types[type].name, "KIN") || !strcmp(types[type].name, "IMP") || !strcmp(types[type].name, "OPTI")) { + if (!strncmp(types[type].name, "BNT",3) || !strcmp(types[type].name, "KIN") || !strcmp(types[type].name, "IMP")){ if (!ups_getinfo()) return; /* Give "BNT-other" a chance! */ - if (raw_data[MODELNAME]==0x42 || raw_data[MODELNAME]==0x4B || raw_data[MODELNAME]==0x4F){ - /* Give "IMP" a chance also! */ - if (raw_data[UPSVERSION]==0xFF){ - types[type].name="IMP"; - model=IMPmodels[raw_data[MODELNUMBER]/16]; - } - else { - model=BNTmodels[raw_data[MODELNUMBER]/16]; - if (!strcmp(types[type].name, "BNT-other")) - types[type].name="BNT-other"; - else if (raw_data[MODELNAME]==0x42) - types[type].name="BNT"; - else if (raw_data[MODELNAME]==0x4B){ - types[type].name="KIN"; - model=KINmodels[raw_data[MODELNUMBER]/16]; - } else if (raw_data[MODELNAME]==0x4F){ - types[type].name="OPTI"; - model=OPTImodels[raw_data[MODELNUMBER]/16]; - } + if (raw_data[MODELNAME]==0x42 || raw_data[MODELNAME]==0x4B){ + model=BNTmodels[raw_data[MODELNUMBER]/16]; + if (!strcmp(types[type].name, "BNT-other")) + types[type].name="BNT-other"; + else if (raw_data[MODELNAME]==0x42) + types[type].name="BNT"; + else if (raw_data[MODELNAME]==0x4B){ + types[type].name="KIN"; + model=KINmodels[raw_data[MODELNUMBER]/16]; } } else if (raw_data[UPSVERSION]==0xFF){ @@ -1026,62 +904,52 @@ void upsdrv_initups(void) model=IMPmodels[raw_data[MODELNUMBER]/16]; } linevoltage=voltages[raw_data[MODELNUMBER]%16]; - if (!strcmp(types[type].name, "OPTI")) { - snprintf(buf,sizeof(buf),"%s-%u",types[type].name, model); - } else { - snprintf(buf,sizeof(buf),"%s-%uAP",types[type].name, model); - } + snprintf(buf,sizeof(buf),"%s-%dAP",types[type].name,model); if (!strcmp(modelname, "Unknown")) modelname=buf; upsdebugx(1,"Detected: %s , %dV",buf,linevoltage); - if (testvar("nobt") || dstate_getinfo("driver.flag.nobt")) { - upslogx(LOG_NOTICE, "nobt flag set, skipping battery test as requested"); - } - else { - upslogx(LOG_NOTICE, "nobt flag not set, performing battery test as requested"); - if (ser_send_char (upsfd, BATTERY_TEST) != 1) { - upslogx(LOG_NOTICE, "Write error: failed to send battery test command to UPS!"); - dstate_datastale(); - return; - } + if (ser_send_char (upsfd, BATTERY_TEST) != 1) { + upslogx(LOG_NOTICE, "writing error"); + dstate_datastale(); + return; } } - + upsdebugx(1, "Values of arguments:"); upsdebugx(1, " manufacturer : '%s'", manufacturer); upsdebugx(1, " model name : '%s'", modelname); upsdebugx(1, " serial number : '%s'", serialnumber); upsdebugx(1, " line voltage : '%u'", linevoltage); upsdebugx(1, " type : '%s'", types[type].name); - upsdebugx(1, " number of bytes from UPS: '%u'", - types[type].num_of_bytes_from_ups); - upsdebugx(1, " method of flow control : '%s'", - types[type].flowControl.name); + upsdebugx(1, " number of bytes from UPS: '%u'", + types[type].num_of_bytes_from_ups); + upsdebugx(1, " method of flow control : '%s'", + types[type].flowControl.name); upsdebugx(1, " validation sequence: '{{%u,%#x},{%u,%#x},{%u,%#x}}'", - types[type].validation[0].index_of_byte, - types[type].validation[0].required_value, - types[type].validation[1].index_of_byte, - types[type].validation[1].required_value, - types[type].validation[2].index_of_byte, - types[type].validation[2].required_value); + types[type].validation[0].index_of_byte, + types[type].validation[0].required_value, + types[type].validation[1].index_of_byte, + types[type].validation[1].required_value, + types[type].validation[2].index_of_byte, + types[type].validation[2].required_value); upsdebugx(1, " shutdown arguments: '{{%u,%u},%c}'", - types[type].shutdown_arguments.delay[0], - types[type].shutdown_arguments.delay[1], - types[type].shutdown_arguments.minutesShouldBeUsed); + types[type].shutdown_arguments.delay[0], + types[type].shutdown_arguments.delay[1], + types[type].shutdown_arguments.minutesShouldBeUsed); if ( strcmp(types[type].name, "KIN") && strcmp(types[type].name, "BNT") && strcmp(types[type].name, "IMP")) { upsdebugx(1, " frequency calculation coefficients: '{%f,%f}'", - types[type].freq[0], types[type].freq[1]); + types[type].freq[0], types[type].freq[1]); upsdebugx(1, " load percentage calculation coefficients: " - "'{%f,%f,%f,%f}'", - types[type].loadpct[0], types[type].loadpct[1], - types[type].loadpct[2], types[type].loadpct[3]); - upsdebugx(1, " battery percentage calculation coefficients: " - "'{%f,%f,%f,%f,%f}'", - types[type].battpct[0], types[type].battpct[1], - types[type].battpct[2], types[type].battpct[3], - types[type].battpct[4]); + "'{%f,%f,%f,%f}'", + types[type].loadpct[0], types[type].loadpct[1], + types[type].loadpct[2], types[type].loadpct[3]); + upsdebugx(1, " battery percentage calculation coefficients: " + "'{%f,%f,%f,%f,%f}'", + types[type].battpct[0], types[type].battpct[1], + types[type].battpct[2], types[type].battpct[3], + types[type].battpct[4]); upsdebugx(1, " voltage calculation coefficients: '{%f,%f}'", - types[type].voltage[2], types[type].voltage[3]); + types[type].voltage[2], types[type].voltage[3]); } } @@ -1089,12 +957,12 @@ void upsdrv_initups(void) /* display help */ void upsdrv_help(void) { - /* 1 2 3 4 5 6 7 8 */ - /* 12345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX */ + // 1 2 3 4 5 6 7 8 + // 12345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX printf("\n"); printf("Specify UPS information in the ups.conf file.\n"); printf(" type: Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT',\n"); - printf(" 'BNT-other', 'OPTI' (default: 'Trust')\n"); + printf(" 'BNT-other' (default: 'Trust')\n"); printf(" 'BNT-other' is a special type intended for BNT 100-120V models,\n"); printf(" but can be used to override ALL models.\n"); printf("You can additional specify these variables:\n"); @@ -1128,8 +996,7 @@ void upsdrv_help(void) printf(" voltage: Voltage conversion values for 240 and 120 voltage:\n"); printf(" {240A,240B,120A,120B}\n"); printf(" used in function: A*x+B\n"); - printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n"); - printf(" nobt: Flag to skip battery check on init/startup.\n\n"); + printf(" If the raw value x IS HALF the Voltage, then A=2, B=0\n\n"); printf("Example for BNT1500AP in ups.conf:\n"); printf("[BNT1500AP]\n"); @@ -1149,7 +1016,6 @@ void upsdrv_help(void) printf("# loadPercentage = {1.0000,0.0,1.0000,0.0}\n"); printf("# batteryPercentage = {1.0000,0.0000,0.0000,1.0000,0.0000}\n"); printf("# voltage = {2.0000,0.0000,2.0000,0.0000}\n"); - printf(" nobt\n"); return; } @@ -1164,19 +1030,19 @@ void upsdrv_initinfo(void) dstate_setinfo ("input.voltage.nominal", "%u", linevoltage); /* now add the instant commands */ - dstate_addcmd ("test.battery.start"); - dstate_addcmd ("shutdown.return"); - dstate_addcmd ("shutdown.stayoff"); + dstate_addcmd ("test.battery.start"); + dstate_addcmd ("shutdown.return"); + dstate_addcmd ("shutdown.stayoff"); upsh.instcmd = instcmd; } /* define possible arguments */ void upsdrv_makevartable(void) { - /* 1 2 3 4 5 6 7 8 */ - /*2345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX */ + // 1 2 3 4 5 6 7 8 + //2345678901234567890123456789012345678901234567890123456789012345678901234567890 MAX addvar(VAR_VALUE, "type", - "Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other','OPTI'\n" + "Type of UPS: 'Trust','Egys','KP625AP','IMP','KIN','BNT','BNT-other'\n" " (default: 'Trust')"); addvar(VAR_VALUE, "manufacturer", "Manufacturer name (default: 'PowerCom')"); @@ -1203,8 +1069,6 @@ void upsdrv_makevartable(void) "Battery conversion values: OffFactor, LoadFactor, OffConst, OnFactor, OnConst"); addvar(VAR_VALUE, "voltage", "Voltage conversion values: 240VFactor, 240VConst, 120VFactor, 120VConst"); - addvar(VAR_FLAG, "nobt", - "Disable battery test at driver init/startup"); } } diff --git a/drivers/powercom.h b/drivers/powercom.h index 4ac2f63..8d0dab6 100644 --- a/drivers/powercom.h +++ b/drivers/powercom.h @@ -21,18 +21,15 @@ * */ -#ifndef NUT_POWERCOM_H_SEEN -#define NUT_POWERCOM_H_SEEN 1 - /* C-libary includes */ #include #include #include #include +#include "serial.h" +#include /* nut includes */ -#include "serial.h" -#include "nut_stdint.h" #include "timehead.h" @@ -40,51 +37,51 @@ struct type { const char *name; unsigned char num_of_bytes_from_ups; - + struct method_of_flow_control { - const char *name; - void (*setup_flow_control)(void); + const char *name; + void (*setup_flow_control)(void); } flowControl; - + struct validation_byte { - unsigned int index_of_byte, required_value; - /* An example might explain the intention better then prose. - * Suppose we want to validate the data with: - * powercom_raw_data[5] == 0x80 - * then we will set index_of_byte to 5U and required_value to - * 0x80U: { 5U, 0x80U }. - */ + unsigned int index_of_byte, required_value; + /* An example might explain the intention better then prose. + * Suppose we want to validate the data with: + * powercom_raw_data[5] == 0x80 + * then we will set index_of_byte to 5U and required_value to + * 0x80U: { 5U, 0x80U }. + */ } validation[3]; - /* The validation array is of length 3 because 3 is longest + /* The validation array is of length 3 because 3 is longest * validation sequence for any type. */ - - /* Some UPSs must have a minutes and a seconds arguments for + + /* Some UPSs must have a minutes and a seconds arguments for * the COUNTER commands while others are known to work with the * seconds argument alone. */ struct delay_for_power_kill { - unsigned char delay[2]; /* { minutes, seconds } */ - unsigned char minutesShouldBeUsed; - /* 'n' in case the minutes value, which is delay[0], should - * be skipped and not sent to the UPS. + unsigned int delay[2]; /* { minutes, seconds } */ + unsigned char minutesShouldBeUsed; + /* 'n' in case the minutes value, which is delay[0], should + * be skipped and not sent to the UPS. */ } shutdown_arguments; - + /* parameters to calculate input and output freq., one pair used for * both input and output functions: * The pair [0],[1] defines parameters for 1/(A*x+B) to calculate freq. * from raw data 'x'. */ float freq[2]; - + /* parameters to calculate load %, two pairs for each type: * First pair [0],[1] defines the parameters for A*x+B to calculate load * from raw data when offline and the second pair [2],[3] is used when * online */ float loadpct[4]; - + /* parameters to calculate battery %, five parameters for each type: * First three params [0],[1],[2] defines the parameters for A*x+B*y+C to calculate * battery % (x is raw data, y is load %) when offline. @@ -100,5 +97,3 @@ struct type { */ float voltage[4]; }; - -#endif /* NUT_POWERCOM_H_SEEN */ diff --git a/drivers/powerman-pdu.c b/drivers/powerman-pdu.c index df4e91f..b7bcf3d 100644 --- a/drivers/powerman-pdu.c +++ b/drivers/powerman-pdu.c @@ -20,10 +20,10 @@ #include "main.h" -#include /* pm_err_t and other beasts */ +#include #define DRIVER_NAME "Powerman PDU client driver" -#define DRIVER_VERSION "0.12" +#define DRIVER_VERSION "0.11" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -35,11 +35,11 @@ upsdrv_info_t upsdrv_info = { }; /* Powerman functions and variables */ -static pm_err_t query_one(pm_handle_t arg_pm, char *s, int mode); -static pm_err_t query_all(pm_handle_t arg_pm, int mode); +static pm_err_t query_one(pm_handle_t pm, char *s, int mode); +static pm_err_t query_all(pm_handle_t pm, int mode); -static pm_handle_t pm; -static char ebuf[64]; +pm_handle_t pm; +char ebuf[64]; /* modes to snmp_ups_walk. */ #define WALKMODE_INIT 0 @@ -49,7 +49,7 @@ static int reconnect_ups(void); static int instcmd(const char *cmdname, const char *extra) { - pm_err_t rv = PM_EBADARG; + pm_err_t rv = -1; char *cmdsuffix = NULL; char *cmdindex = NULL; char outletname[SMALLBUF]; @@ -90,7 +90,7 @@ static int instcmd(const char *cmdname, const char *extra) return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_SET_INVALID; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -133,9 +133,6 @@ void upsdrv_initinfo(void) /* FIXME: no need for setvar (ex for outlet.n.delay.*)!? */ } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* FIXME: shutdown all outlets? */ @@ -211,7 +208,7 @@ static int reconnect_ups(void) * powerman support functions ****************************/ -static pm_err_t query_one(pm_handle_t arg_pm, char *s, int outletnum) +static pm_err_t query_one(pm_handle_t pm, char *s, int outletnum) { pm_err_t rv; pm_node_state_t ns; @@ -219,7 +216,7 @@ static pm_err_t query_one(pm_handle_t arg_pm, char *s, int outletnum) upsdebugx(1, "entering query_one (%s)", s); - rv = pm_node_status(arg_pm, s, &ns); + rv = pm_node_status(pm, s, &ns); if (rv == PM_ESUCCESS) { upsdebugx(3, "updating status"); @@ -232,7 +229,7 @@ static pm_err_t query_one(pm_handle_t arg_pm, char *s, int outletnum) return rv; } -static pm_err_t query_all(pm_handle_t arg_pm, int mode) +static pm_err_t query_all(pm_handle_t pm, int mode) { pm_err_t rv; pm_node_iterator_t itr; @@ -242,7 +239,7 @@ static pm_err_t query_all(pm_handle_t arg_pm, int mode) upsdebugx(1, "entering query_all ()"); - rv = pm_node_iterator_create(arg_pm, &itr); + rv = pm_node_iterator_create(pm, &itr); if (rv != PM_ESUCCESS) return rv; @@ -250,7 +247,7 @@ static pm_err_t query_all(pm_handle_t arg_pm, int mode) /* in WALKMODE_UPDATE, we always call this one for the * status update... */ - if ((rv = query_one(arg_pm, s, outletnum)) != PM_ESUCCESS) + if ((rv = query_one(pm, s, outletnum)) != PM_ESUCCESS) break; else { /* set the initial generic properties (ie except status) diff --git a/drivers/powerp-bin.c b/drivers/powerp-bin.c index 89b0687..b128369 100644 --- a/drivers/powerp-bin.c +++ b/drivers/powerp-bin.c @@ -1,6 +1,6 @@ /* * powerp-bin.c - Model specific routines for CyberPower binary - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds @@ -31,12 +31,9 @@ #include "serial.h" #include "powerp-bin.h" -#include "nut_stdint.h" #include -#define POWERPANEL_BIN_VERSION "Powerpanel-Binary 0.5" - typedef struct { unsigned char start; unsigned char i_volt; @@ -67,34 +64,34 @@ static unsigned char powpan_answer[SMALLBUF]; static const valtab_t tran_high_pr[] = { { "138", -9 }, { "139", -8 }, { "140", -7 }, { "141", -6 }, { "142", -5 }, { "143", -4 }, { "144", -3 }, { "145", -2 }, { "146", -1 }, { "147", 0 }, - { NULL, 0 } + { NULL } }; /* OP series */ static const valtab_t tran_high_op[] = { { "140", -5 }, { "141", -4 }, { "142", -3 }, { "143", -2 }, { "144", -1 }, { "145", 0 }, { "146", +1 }, { "147", +2 }, { "148", +3 }, { "149", +4 }, - { "150", +5 }, { NULL, 0 } + { "150", +5 }, { NULL } }; /* PR series */ static const valtab_t tran_low_pr[] = { { "88", 0 }, { "89", +1 }, { "90", +2 }, { "91", +3 }, { "92", +4 }, { "93", +5 }, { "94", +6 }, { "95", +7 }, { "96", +8 }, { "97", +9 }, - { NULL, 0 } + { NULL } }; /* OP series */ static const valtab_t tran_low_op[] = { { "85", -5 }, { "86", -4 }, { "87", -3 }, { "88", -2 }, { "89", -1 }, { "90", 0 }, { "91", +1 }, { "92", +2 }, { "93", +3 }, { "94", +4 }, - { "95", +5 }, { NULL, 0 } + { "95", +5 }, { NULL } }; /* PR series */ static const valtab_t batt_low_pr[] = { { "25", -6 }, { "30", -5 }, { "35", -3 }, { "40", -1 }, { "45", 0 }, - { "50", +2 }, { "55", +4 }, { "60", +6 }, { NULL, 0 } + { "50", +2 }, { "55", +4 }, { "60", +6 }, { NULL } }; /* OP series */ @@ -102,23 +99,23 @@ static const valtab_t batt_low_op[] = { { "15", -8 }, { "18", -7 }, { "19", -6 }, { "20", -5 }, { "22", -4 }, { "24", -3 }, { "25", -2 }, { "26", -1 }, { "28", 0 }, { "30", +1 }, { "32", +2 }, { "34", +3 }, { "35", +4 }, { "36", +5 }, { "38", +6 }, - { "40", +7 }, { NULL, 0 } + { "40", +7 }, { NULL } }; /* PR series */ static const valtab_t out_volt_pr[] = { - { "110", -10 }, { "120", 0 }, { "130", +10 }, { NULL, 0 } + { "110", -10 }, { "120", 0 }, { "130", +10 }, { NULL } }; /* OP series */ static const valtab_t out_volt_op[] = { { "110", -2 }, { "115", -1 }, { "120", 0 }, { "124", +1 }, { "128", +2 }, - { "130", +3 }, { NULL, 0 } + { "130", +3 }, { NULL } }; static const valtab_t yes_no_info[] = { { "yes", 2 }, { "no", 0 }, - { NULL, 0 } + { NULL } }; /* Older models report the model in a numeric format 'rOnn' */ @@ -136,7 +133,7 @@ static const struct { { "rO41", "OP700AVR" }, { "rO43", "OP1250AVR" }, { "rO45", "OP1500AVR" }, - { NULL, NULL } + { NULL } }; static const struct { @@ -150,13 +147,13 @@ static const struct { { "battery.charge.low", "R\x08\r", "Q\x08%c\r", { batt_low_pr, batt_low_op } }, { "ups.start.battery", "R\x0F\r", "Q\x0F%c\r", { yes_no_info, yes_no_info } }, { "output.voltage.nominal", "R\x18\r", "Q\x18%c\r", { out_volt_pr, out_volt_op } }, - { NULL, NULL, NULL, { NULL, 0 } } + { NULL } }; static const struct { const char *cmd; const char *command; - const size_t len; + const int len; } cmdtab[] = { { "test.battery.start.quick", "T\230\r", 3 }, /* 20 seconds test */ { "test.battery.stop", "CT\r", 3 }, @@ -166,7 +163,7 @@ static const struct { * as shutdown.return when on battery */ { "shutdown.stayoff", "S\0\0W\r", 5 }, { "shutdown.stop", "C\r", 2 }, - { NULL, NULL, 0 } + { NULL } }; /* map UPS data to (approximated) input/output voltage */ @@ -215,9 +212,9 @@ static float op_freq(unsigned char in) return (12600.0 / (in + 32)); } -static ssize_t powpan_command(const char *buf, size_t bufsize) +static int powpan_command(const char *buf, size_t bufsize) { - ssize_t ret; + int ret; ser_flush_io(upsfd); @@ -251,7 +248,7 @@ static ssize_t powpan_command(const char *buf, size_t bufsize) return -1; } - upsdebug_hex(3, "read", powpan_answer, (size_t)ret); + upsdebug_hex(3, "read", powpan_answer, ret); return ret; } @@ -260,22 +257,18 @@ static int powpan_instcmd(const char *cmdname, const char *extra) int i; for (i = 0; cmdtab[i].cmd != NULL; i++) { - ssize_t ret; if (strcasecmp(cmdname, cmdtab[i].cmd)) { continue; } - ret = powpan_command(cmdtab[i].command, cmdtab[i].len); - assert(cmdtab[i].len < SSIZE_MAX); - if (ret >= 0 && - (ret == (ssize_t)(cmdtab[i].len - 1)) && - (!memcmp(powpan_answer, cmdtab[i].command, cmdtab[i].len - 1)) - ) { + if ((powpan_command(cmdtab[i].command, cmdtab[i].len) == + cmdtab[i].len - 1) && + (!memcmp(powpan_answer, cmdtab[i].command, cmdtab[i].len - 1))) { return STAT_INSTCMD_HANDLED; } - upslogx(LOG_ERR, "%s: command [%s] [%s] failed", __func__, cmdname, extra); + upslogx(LOG_ERR, "%s: command [%s] failed", __func__, cmdname); return STAT_INSTCMD_FAILED; } @@ -305,20 +298,8 @@ static int powpan_setvar(const char *varname, const char *val) continue; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(command, sizeof(command), vartab[i].set, vartab[i].map[type][j].command); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif if ((powpan_command(command, 4) == 3) && (!memcmp(powpan_answer, command, 3))) { dstate_setinfo(varname, "%s", val); @@ -360,7 +341,7 @@ static void powpan_initinfo(void) dstate_setinfo("ups.model", "%s", modeltab[i].model); } else { /* report model value as is */ - dstate_setinfo("ups.model", "%s", str_rtrim(s, ' ')); + dstate_setinfo("ups.model", "%s", rtrim(s, ' ')); } } if ((s = strtok(NULL, ".")) != NULL) { @@ -378,7 +359,7 @@ static void powpan_initinfo(void) } for (i = 0; vartab[i].var != NULL; i++) { - + if (powpan_command(vartab[i].get, 3) < 2) { continue; } @@ -392,7 +373,7 @@ static void powpan_initinfo(void) dstate_setinfo(vartab[i].var, "%s", vartab[i].map[type][j].val); break; } - + if (dstate_getinfo(vartab[i].var) == NULL) { upslogx(LOG_WARNING, "warning: [%d] unknown value for [%s]!", powpan_answer[1], vartab[i].var); @@ -416,14 +397,14 @@ static void powpan_initinfo(void) powpan_command("R\x2B\r", 3); powpan_command("R\x3D\r", 3); } - + dstate_addcmd("shutdown.stayoff"); dstate_addcmd("shutdown.reboot"); } -static ssize_t powpan_status(status_t *status) +static int powpan_status(status_t *status) { - ssize_t ret; + int ret; ser_flush_io(upsfd); @@ -462,7 +443,7 @@ static ssize_t powpan_status(status_t *status) return -1; } - upsdebug_hex(3, "read", status, (size_t)ret); + upsdebug_hex(3, "read", status, ret); if ((status->flags[0] + status->flags[1]) != 255) { upsdebugx(4, " \\_ : checksum flags[0..1] failed"); @@ -500,19 +481,7 @@ static int powpan_updateinfo(void) dstate_setinfo("input.frequency", "%.1f", op_freq(status.i_freq)); break; - case PR: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif dstate_setinfo("input.voltage", "%d", status.i_volt); if (status.flags[0] & 0x84) { dstate_setinfo("output.voltage", "%s", dstate_getinfo("output.voltage.nominal")); @@ -554,7 +523,7 @@ static int powpan_updateinfo(void) } else if (status.o_volt < 1.05 * status.i_volt) { upsdebugx(2, "%s: appears to be in BYPASS state", __func__); } else if (status.o_volt < 1.5 * status.i_volt) { - status_set("BOOST"); + status_set("BOOST"); } else { upsdebugx(2, "%s: output voltage too high", __func__); } @@ -573,10 +542,9 @@ static int powpan_updateinfo(void) return (status.flags[0] & 0x80) ? 1 : 0; } -static ssize_t powpan_initups(void) +static int powpan_initups(void) { - ssize_t ret; - int i; + int ret, i; upsdebugx(1, "Trying %s protocol...", powpan_binary.version); @@ -625,10 +593,10 @@ static ssize_t powpan_initups(void) continue; } - upsdebug_hex(3, "read", powpan_answer, (size_t)ret); + upsdebug_hex(3, "read", powpan_answer, ret); if (ret < 20) { - upsdebugx(2, "Expected 20 bytes but only got %zd", ret); + upsdebugx(2, "Expected 20 bytes but only got %d", ret); continue; } @@ -663,7 +631,6 @@ static ssize_t powpan_initups(void) subdriver_t powpan_binary = { "binary", - POWERPANEL_BIN_VERSION, powpan_instcmd, powpan_setvar, powpan_initups, diff --git a/drivers/powerp-bin.h b/drivers/powerp-bin.h index 0bb1c63..4346597 100644 --- a/drivers/powerp-bin.h +++ b/drivers/powerp-bin.h @@ -1,6 +1,6 @@ /* * powerp-bin.h - Model specific data/definitions for CyberPower text/binary - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds diff --git a/drivers/powerp-txt.c b/drivers/powerp-txt.c index 6f22a60..366514c 100644 --- a/drivers/powerp-txt.c +++ b/drivers/powerp-txt.c @@ -1,11 +1,11 @@ /* * powerp-txt.c - Model specific routines for CyberPower text - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds * 2007-2008 Arjen de Korte - * 2012-2016 Timothy Pearson + * 2012 Timothy Pearson * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,8 +33,6 @@ #include "powerp-txt.h" -#define POWERPANEL_TEXT_VERSION "Powerpanel-Text 0.5" - typedef struct { float i_volt; float o_volt; @@ -53,8 +51,8 @@ typedef struct { float q_unknwn; } status_t; -static long ondelay = 1; /* minutes */ -static long offdelay = 60; /* seconds */ +static int ondelay = 1; /* minutes */ +static int offdelay = 60; /* seconds */ static char powpan_answer[SMALLBUF]; @@ -66,7 +64,7 @@ static struct { { "input.transfer.high", "P6\r", "C2:%03d\r" }, { "input.transfer.low", "P7\r", "C3:%03d\r" }, { "battery.charge.low", "P8\r", "C4:%02d\r" }, - { NULL, NULL, NULL } + { NULL } }; static struct { @@ -74,19 +72,18 @@ static struct { const char *command; } cmdtab[] = { { "test.battery.start.quick", "T\r" }, - { "test.battery.start.deep", "TL\r" }, { "test.battery.stop", "CT\r" }, { "beeper.enable", "C7:1\r" }, { "beeper.disable", "C7:0\r" }, { "beeper.on", NULL }, { "beeper.off", NULL }, { "shutdown.stop", "C\r" }, - { NULL, NULL } + { NULL } }; -static ssize_t powpan_command(const char *command) +static int powpan_command(const char *command) { - ssize_t ret; + int ret; ser_flush_io(upsfd); @@ -121,7 +118,7 @@ static ssize_t powpan_command(const char *command) return -1; } - upsdebug_hex(3, "read", powpan_answer, (size_t)ret); + upsdebug_hex(3, "read", powpan_answer, ret); return ret; } @@ -150,34 +147,34 @@ static int powpan_instcmd(const char *cmdname, const char *extra) continue; } - if ((powpan_command(cmdtab[i].command) == 2) && (!strcasecmp(powpan_answer, "#0"))) { + if ((powpan_command(cmdtab[i].command) == 2) && (!strcasecmp(powpan_answer, "#0"))) { return STAT_INSTCMD_HANDLED; } - upslogx(LOG_ERR, "%s: command [%s] [%s] failed", __func__, cmdname, extra); + upslogx(LOG_ERR, "%s: command [%s] failed", __func__, cmdname); return STAT_INSTCMD_FAILED; } if (!strcasecmp(cmdname, "shutdown.return")) { if (offdelay < 60) { - snprintf(command, sizeof(command), "Z.%ld\r", offdelay / 6); + snprintf(command, sizeof(command), "Z.%d\r", offdelay / 6); } else { - snprintf(command, sizeof(command), "Z%02ld\r", offdelay / 60); + snprintf(command, sizeof(command), "Z%02d\r", offdelay / 60); } } else if (!strcasecmp(cmdname, "shutdown.stayoff")) { if (offdelay < 60) { - snprintf(command, sizeof(command), "S.%ld\r", offdelay / 6); + snprintf(command, sizeof(command), "S.%d\r", offdelay / 6); } else { - snprintf(command, sizeof(command), "S%02ld\r", offdelay / 60); + snprintf(command, sizeof(command), "S%02d\r", offdelay / 60); } } else if (!strcasecmp(cmdname, "shutdown.reboot")) { if (offdelay < 60) { - snprintf(command, sizeof(command), "S.%ldR%04ld\r", offdelay / 6, ondelay); + snprintf(command, sizeof(command), "S.%dR%04d\r", offdelay / 6, ondelay); } else { - snprintf(command, sizeof(command), "S%02ldR%04ld\r", offdelay / 60, ondelay); + snprintf(command, sizeof(command), "S%02dR%04d\r", offdelay / 60, ondelay); } } else { - upslogx(LOG_NOTICE, "%s: command [%s] [%s] unknown", __func__, cmdname, extra); + upslogx(LOG_NOTICE, "%s: command [%s] unknown", __func__, cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -185,7 +182,7 @@ static int powpan_instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_ERR, "%s: command [%s] [%s] failed", __func__, cmdname, extra); + upslogx(LOG_ERR, "%s: command [%s] failed", __func__, cmdname); return STAT_INSTCMD_FAILED; } @@ -205,19 +202,7 @@ static int powpan_setvar(const char *varname, const char *val) return STAT_SET_HANDLED; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif snprintf(command, sizeof(command), vartab[i].set, atoi(val)); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif if ((powpan_command(command) == 2) && (!strcasecmp(powpan_answer, "#0"))) { dstate_setinfo(varname, "%s", val); @@ -237,15 +222,15 @@ static void powpan_initinfo(void) int i; char *s; - dstate_setinfo("ups.delay.start", "%ld", 60 * ondelay); - dstate_setinfo("ups.delay.shutdown", "%ld", offdelay); + dstate_setinfo("ups.delay.start", "%d", 60 * ondelay); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); /* * NOTE: The reply is already in the buffer, since the P4\r command * was used for autodetection of the UPS. No need to do it again. */ if ((s = strtok(&powpan_answer[1], ",")) != NULL) { - dstate_setinfo("ups.model", "%s", str_rtrim(s, ' ')); + dstate_setinfo("ups.model", "%s", rtrim(s, ' ')); } if ((s = strtok(NULL, ",")) != NULL) { dstate_setinfo("ups.firmware", "%s", s); @@ -254,7 +239,7 @@ static void powpan_initinfo(void) dstate_setinfo("ups.serial", "%s", s); } if ((s = strtok(NULL, ",")) != NULL) { - dstate_setinfo("ups.mfr", "%s", str_rtrim(s, ' ')); + dstate_setinfo("ups.mfr", "%s", rtrim(s, ' ')); } /* @@ -377,16 +362,15 @@ static void powpan_initinfo(void) dstate_addcmd("shutdown.reboot"); } -static ssize_t powpan_status(status_t *status) +static int powpan_status(status_t *status) { - ssize_t ret; + int ret; ser_flush_io(upsfd); /* * WRITE D\r * READ #I119.0O119.0L000B100T027F060.0S..\r - * #I118.0O118.0L029B100F060.0R0218S..\r * 01234567890123456789012345678901234 * 0 1 2 3 */ @@ -420,7 +404,7 @@ static ssize_t powpan_status(status_t *status) return -1; } - upsdebug_hex(3, "read", powpan_answer, (size_t)ret); + upsdebug_hex(3, "read", powpan_answer, ret); ret = sscanf(powpan_answer, "#I%fO%fL%dB%dT%dF%fS%2c\r", &status->i_volt, &status->o_volt, &status->o_load, @@ -431,21 +415,8 @@ static ssize_t powpan_status(status_t *status) status->has_b_volt = 0; status->has_o_freq = 0; status->has_runtime = 0; - } else { - - ret = sscanf(powpan_answer, "#I%fO%fL%dB%dF%fR%dS%2c\r", - &status->i_volt, &status->o_volt, &status->o_load, - &status->b_chrg, &status->i_freq, &status->runtime, - status->flags); - - if (ret >= 7) { - status->has_b_volt = 0; - status->has_o_freq = 0; - status->has_runtime = 1; - } - } - if (ret < 7) { + else { ret = ser_get_buf_len(upsfd, powpan_answer+35, 23, SER_WAIT_SEC, SER_WAIT_USEC); if (ret < 0) { @@ -453,14 +424,14 @@ static ssize_t powpan_status(status_t *status) upsdebug_hex(4, " \\_", powpan_answer+35, 23); return -1; } - + if (ret == 0) { upsdebugx(3, "read: timeout"); upsdebug_hex(4, " \\_", powpan_answer+35, 23); return -1; } - - upsdebug_hex(3, "read", powpan_answer, (size_t)ret); + + upsdebug_hex(3, "read", powpan_answer, ret); ret = sscanf(powpan_answer, "#I%fO%fL%dB%dV%fT%dF%fH%fR%dC%dQ%fS%2c\r", &status->i_volt, &status->o_volt, &status->o_load, @@ -528,7 +499,7 @@ static int powpan_updateinfo(void) } else if (status.o_volt < 1.05 * status.i_volt) { /* ignore */ } else if (status.o_volt < 1.5 * status.i_volt) { - status_set("BOOST"); + status_set("BOOST"); } else { upsdebugx(2, "%s: output voltage too high", __func__); } @@ -547,10 +518,9 @@ static int powpan_updateinfo(void) return (status.flags[0] & 0x40) ? 1 : 0; } -static ssize_t powpan_initups(void) +static int powpan_initups(void) { - ssize_t ret; - int i; + int ret, i; upsdebugx(1, "Trying text protocol..."); @@ -565,7 +535,7 @@ static ssize_t powpan_initups(void) /* * WRITE P4\r - * READ #BC1200 ,1.600,000000000000,CYBER POWER + * READ #BC1200 ,1.600,000000000000,CYBER POWER * 01234567890123456789012345678901234567890123456 * 0 1 2 3 4 */ @@ -574,9 +544,9 @@ static ssize_t powpan_initups(void) if (ret < 1) { continue; } - + if (ret < 46) { - upsdebugx(2, "Expected 46 bytes, but only got %zd", ret); + upsdebugx(2, "Expected 46 bytes, but only got %d", ret); continue; } @@ -591,7 +561,7 @@ static ssize_t powpan_initups(void) } if ((ondelay < 0) || (ondelay > 9999)) { - fatalx(EXIT_FAILURE, "Start delay '%ld' out of range [0..9999]", ondelay); + fatalx(EXIT_FAILURE, "Start delay '%d' out of range [0..9999]", ondelay); } val = getval("offdelay"); @@ -600,7 +570,7 @@ static ssize_t powpan_initups(void) } if ((offdelay < 6) || (offdelay > 600)) { - fatalx(EXIT_FAILURE, "Shutdown delay '%ld' out of range [6..600]", offdelay); + fatalx(EXIT_FAILURE, "Shutdown delay '%d' out of range [6..600]", offdelay); } /* Truncate to nearest setable value */ @@ -618,7 +588,6 @@ static ssize_t powpan_initups(void) subdriver_t powpan_text = { "text", - POWERPANEL_TEXT_VERSION, powpan_instcmd, powpan_setvar, powpan_initups, diff --git a/drivers/powerp-txt.h b/drivers/powerp-txt.h index a830d03..790fd4c 100644 --- a/drivers/powerp-txt.h +++ b/drivers/powerp-txt.h @@ -1,6 +1,6 @@ /* * powerp-txt.h - Model specific data/definitions for CyberPower text - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds diff --git a/drivers/powerpanel.c b/drivers/powerpanel.c index 6c677b8..c683c3f 100644 --- a/drivers/powerpanel.c +++ b/drivers/powerpanel.c @@ -1,6 +1,6 @@ /* * powerpanel.c - Model specific routines for CyberPower text/binary - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds @@ -36,7 +36,7 @@ static subdriver_t *subdriver[] = { }; #define DRIVER_NAME "CyberPower text/binary protocol UPS driver" -#define DRIVER_VERSION "0.28" +#define DRIVER_VERSION "0.26" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -102,7 +102,7 @@ void upsdrv_updateinfo(void) void upsdrv_shutdown(void) { - int i, ret = -1; + int i, ret; /* * Try to shutdown with delay and automatic reboot if the power @@ -125,7 +125,7 @@ void upsdrv_shutdown(void) } } - if (ret > 0) { + if (ret) { /* * When on battery, the 'shutdown.stayoff' command will make * the UPS switch back on when the power returns. @@ -134,7 +134,7 @@ void upsdrv_shutdown(void) upslogx(LOG_INFO, "Waiting for power to return..."); return; } - } else if (ret == 0) { + } else { /* * Apparently, the power came back already, so we just need to reboot. */ diff --git a/drivers/powerpanel.h b/drivers/powerpanel.h index b2b34be..8e441ba 100644 --- a/drivers/powerpanel.h +++ b/drivers/powerpanel.h @@ -1,6 +1,6 @@ /* * powerpanel.h - Model specific data/definitions for CyberPower text/binary - * protocol UPSes + * protocol UPSes * * Copyright (C) * 2007 Doug Reynolds @@ -33,11 +33,10 @@ #define SER_WAIT_USEC 250000 typedef struct { - const char *version; /* TODO: Rename: this is a subdriver type: "text" or "binary" */ - const char *versionString; /* TODO: Rename: this is the actual subdriver version */ + const char *version; int (*instcmd)(const char *cmdname, const char *extra); int (*setvar)(const char *varname, const char *val); - ssize_t (*initups)(void); + int (*initups)(void); void (*initinfo)(void); int (*updateinfo)(void); } subdriver_t; diff --git a/drivers/powervar-hid.c b/drivers/powervar-hid.c deleted file mode 100755 index a37978a..0000000 --- a/drivers/powervar-hid.c +++ /dev/null @@ -1,147 +0,0 @@ -/* powervar-hid.c - subdriver to monitor Powervar USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2019 AMETEK Powervar - Andrew McCartney - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-usbhid-subdriver script. It must be customized. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be first */ - -#include "usbhid-ups.h" -#include "powervar-hid.h" -#include "main.h" /* for getval() */ -#include "usb-common.h" - -#define POWERVAR_HID_VERSION "Powervar HID 0.20" -/* FIXME: experimental flag to be put in upsdrv_info */ - -/* Powervar */ -#define POWERVAR_VENDORID 0x4234 - -/* USB IDs device table */ -static usb_device_id_t powervar_usb_device_table[] = { - /* Powervar */ - { USB_DEVICE(POWERVAR_VENDORID, 0x0002), NULL }, - - /* Terminating entry */ - { 0, 0, NULL } -}; - -static usb_communication_subdriver_t *usb = &usb_subdriver; - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -/* POWERVAR usage table */ -static usage_lkp_t powervar_usage_lkp[] = { - { "POWERVAR1", 0xff000001 }, - { NULL, 0 } -}; - -static usage_tables_t powervar_utab[] = { - powervar_usage_lkp, - hid_usage_lkp, - NULL, -}; - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t powervar_hid2nut[] = { - - /* Battery page */ - { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", 0, stringid_conversion }, - { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, - { "battery.capacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, - { "battery.runtime", 0, 0, "UPS.PowerSummary.RuntimeToEmpty", NULL, "%.0f", 0, NULL }, - -/* Special case: ups.status & ups.alarm */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ShutdownImminent", NULL, NULL, 0, shutdownimm_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, 0, lowbatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Overload", NULL, NULL, 0, overload_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", NULL, NULL, 0, replacebatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL, NULL, 0, timelimitexpired_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.InternalFailure", NULL, NULL, 0, yes_no_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Good", NULL, NULL, 0, yes_no_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.OverTemperature", NULL, NULL, 0, overheat_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FullyCharged", NULL, NULL, 0, fullycharged_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FullyDischarged", NULL, NULL, 0, depleted_info }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *powervar_format_model(HIDDevice_t *hd) { - return hd->Product; -} - -static const char *powervar_format_mfr(HIDDevice_t *hd) { - return hd->Vendor ? hd->Vendor : "Powervar"; -} - -static const char *powervar_format_serial(HIDDevice_t *hd) { - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if - * the device is supported by this subdriver, else 0. */ -static int powervar_claim(HIDDevice_t *hd) -{ - int status = is_usb_device_supported(powervar_usb_device_table, hd); - - switch (status) - { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - usb->hid_rep_index = 1; - return 1; - } - possibly_supported("Powervar", hd); - return 0; - - case SUPPORTED: - usb->hid_rep_index = 1; - return 1; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t powervar_subdriver = { - POWERVAR_HID_VERSION, - powervar_claim, - powervar_utab, - powervar_hid2nut, - powervar_format_model, - powervar_format_mfr, - powervar_format_serial, - fix_report_desc, -}; diff --git a/drivers/powervar-hid.h b/drivers/powervar-hid.h deleted file mode 100755 index f86d5b8..0000000 --- a/drivers/powervar-hid.h +++ /dev/null @@ -1,30 +0,0 @@ -/* powervar-hid.h - subdriver to monitor Powervar USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef POWERVAR_HID_H -#define POWERVAR_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t powervar_subdriver; - -#endif /* POWERVAR_HID_H */ diff --git a/drivers/powerware-mib.c b/drivers/powerware-mib.c index e4b0296..33a5eb2 100644 --- a/drivers/powerware-mib.c +++ b/drivers/powerware-mib.c @@ -1,10 +1,9 @@ /* powerware-mib.c - data to monitor Powerware UPS with NUT * (using MIBs described in stdupsv1.mib and Xups.mib) * - * Copyright (C) - * 2005-2006 Olli Savia - * 2005-2006 Niels Baggesen - * 2015-2019 Eaton (author: Arnaud Quette ) + * Copyright (C) 2005-2006 + * Olli Savia + * Niels Baggesen * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,26 +23,19 @@ */ #include "powerware-mib.h" -#if WITH_SNMP_LKP_FUN -/* FIXME: shared helper code, need to be put in common */ -#include "eaton-pdu-marlin-helpers.h" -#endif -#define PW_MIB_VERSION "0.104" +#define PW_MIB_VERSION "0.6.2" /* TODO: more sysOID and MIBs support: - * + * * Powerware UPS (Ingrasys X-SLOT and BD-SLOT): ".1.3.6.1.4.1.534.1" * Powerware PXGX cards: ".1.3.6.1.4.1.534.2.12" * PXGX 2000 cards (UPS): Get xupsIdentModel (".1.3.6.1.4.1.534.1.1.2.0") * PXGX 1000 cards (PDU/RPP/RPM): Get pduNumPanels ".1.3.6.1.4.1.534.6.6.4.1.1.1.4.0" */ -/* Powerware UPS (Ingrasys X-SLOT and BD-SLOT) - * Eaton Gigabit Network Card (Genepi) */ +/* Powerware UPS (Ingrasys X-SLOT and BD-SLOT) */ #define POWERWARE_SYSOID ".1.3.6.1.4.1.534.1" -/* Powerware UPS newer PXGX UPS cards (BladeUPS, ...) */ -#define EATON_PXGX_SYSOID ".1.3.6.1.4.1.534.2.12" /* SNMP OIDs set */ #define PW_OID_MFR_NAME "1.3.6.1.4.1.534.1.1.1.0" /* XUPS-MIB::xupsIdentManufacturer.0 */ @@ -75,13 +67,17 @@ #define PW_OID_BY_LINES "1.3.6.1.4.1.534.1.5.2.0" /* XUPS-MIB::xupsBypassNumPhases.0 */ #define PW_OID_BY_VOLTAGE "1.3.6.1.4.1.534.1.5.3.1.2" /* XUPS-MIB::xupsBypassVoltage */ -#define PW_OID_BATTEST_START "1.3.6.1.4.1.534.1.8.1" /* XUPS-MIB::xupsTestBattery set to startTest(1) to initiate test*/ +#define PW_OID_AMBIENT_TEMP "1.3.6.1.4.1.534.1.6.1.0" /* XUPS-MIB::xupsEnvAmbientTemp.0 */ +#define PW_OID_AMBIENT_LOW "1.3.6.1.4.1.534.1.6.2.0" /* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */ +#define PW_OID_AMBIENT_HIGH "1.3.6.1.4.1.534.1.6.3.0" /* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */ -#define PW_OID_CONT_OFFDELAY "1.3.6.1.4.1.534.1.9.1.0" /* XUPS-MIB::xupsControlOutputOffDelay */ -#define PW_OID_CONT_ONDELAY "1.3.6.1.4.1.534.1.9.2.0" /* XUPS-MIB::xupsControlOutputOnDelay */ +#define PW_OID_BATTEST_START "1.3.6.1.4.1.534.1.8.1" /* XUPS-MIB::xupsTestBattery set to startTest(1) to initiate test*/ +#define PW_OID_BATTEST_RES "1.3.6.1.4.1.534.1.8.2" /* XUPS-MIB::xupsTestBatteryStatus */ + +#define PW_OID_CONT_OFFDELAY "1.3.6.1.4.1.534.1.9.1" /* XUPS-MIB::xupsControlOutputOffDelay */ +#define PW_OID_CONT_ONDELAY "1.3.6.1.4.1.534.1.9.2" /* XUPS-MIB::xupsControlOutputOnDelay */ #define PW_OID_CONT_OFFT_DEL "1.3.6.1.4.1.534.1.9.3" /* XUPS-MIB::xupsControlOutputOffTrapDelay */ #define PW_OID_CONT_ONT_DEL "1.3.6.1.4.1.534.1.9.4" /* XUPS-MIB::xupsControlOutputOnTrapDelay */ -#define PW_OID_CONT_LOAD_SHED_AND_RESTART "1.3.6.1.4.1.534.1.9.6" /* XUPS-MIB::xupsLoadShedSecsWithRestart */ #define PW_OID_CONF_OVOLTAGE "1.3.6.1.4.1.534.1.10.1.0" /* XUPS-MIB::xupsConfigOutputVoltage.0 */ #define PW_OID_CONF_IVOLTAGE "1.3.6.1.4.1.534.1.10.2.0" /* XUPS-MIB::xupsConfigInputVoltage.0 */ @@ -97,298 +93,97 @@ #define IETF_OID_CONF_OUT_VA "1.3.6.1.2.1.33.1.9.5.0" /* UPS-MIB::upsConfigOutputVA.0 */ #define IETF_OID_CONF_RUNTIME_LOW "1.3.6.1.2.1.33.1.9.7.0" /* UPS-MIB::upsConfigLowBattTime.0 */ #define IETF_OID_LOAD_LEVEL "1.3.6.1.2.1.33.1.4.4.1.5" /* UPS-MIB::upsOutputPercentLoad */ -#define IETF_OID_AUTO_RESTART "1.3.6.1.2.1.33.1.8.5.0" /* UPS-MIB::upsAutoRestart */ - -/* Delay before powering off in seconds */ -#define DEFAULT_OFFDELAY 30 -/* Delay before powering on in seconds */ -#define DEFAULT_ONDELAY 20 -/* Default shutdown.return delay in seconds */ -#define DEFAULT_SHUTDOWNDELAY 0 static info_lkp_t pw_alarm_ob[] = { - { 1, "OB", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; + { 1, "OB" }, + { 2, "" }, + { 0, "NULL" } +} ; static info_lkp_t pw_alarm_lb[] = { - { 1, "LB", NULL, NULL }, - { 2, "", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; + { 1, "LB" }, + { 2, "" }, + { 0, "NULL" } +} ; static info_lkp_t pw_pwr_info[] = { - { 1, "" /* other */, NULL, NULL }, - { 2, "OFF" /* none */, NULL, NULL }, - { 3, "OL" /* normal */, NULL, NULL }, - { 4, "BYPASS" /* bypass */, NULL, NULL }, - { 5, "OB" /* battery */, NULL, NULL }, - { 6, "OL BOOST" /* booster */, NULL, NULL }, - { 7, "OL TRIM" /* reducer */, NULL, NULL }, - { 8, "OL" /* parallel capacity */, NULL, NULL }, - { 9, "OL" /* parallel redundancy */, NULL, NULL }, - { 10, "OL" /* high efficiency */, NULL, NULL }, - /* Extended status values */ - { 240, "OB" /* battery (0xF0) */, NULL, NULL }, - { 100, "BYPASS" /* maintenanceBypass (0x64) */, NULL, NULL }, - { 96, "BYPASS" /* Bypass (0x60) */, NULL, NULL }, - { 81, "OL" /* high efficiency (0x51) */, NULL, NULL }, - { 80, "OL" /* normal (0x50) */, NULL, NULL }, - { 64, "OL" /* UPS supporting load, normal degraded mode (0x40) */, NULL, NULL }, - { 16, "OFF" /* none (0x10) */, NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" /* other */ }, + { 2, "OFF" /* none */ }, + { 3, "OL" /* normal */ }, + { 4, "BYPASS" /* bypass */ }, + { 5, "OB" /* battery */ }, + { 6, "OL BOOST" /* booster */ }, + { 7, "OL TRIM" /* reducer */ }, + { 8, "OL" /* parallel capacity */ }, + { 9, "OL" /* parallel redundancy */ }, + {10, "OL" /* high efficiancy */ }, + { 0, "NULL" } }; -/* FIXME: mapped to (experimental.)ups.type, but - * should be output.source or ups.mode (need RFC) - * to complement the above ups.status - * along with having ups.type as described hereafter*/ -/* FIXME: should be used by ups.mode or output.source (need RFC); - * Note: this define is not set via project options; code was hidden with - * original commit to "snmp-ups: support newer Genepi management cards"; - * un-hidden to make it "experimental.*" namespace during backporting - */ -#ifndef USE_PW_MODE_INFO -# define USE_PW_MODE_INFO 1 -#endif - -#if USE_PW_MODE_INFO static info_lkp_t pw_mode_info[] = { - { 1, "", NULL, NULL }, - { 2, "", NULL, NULL }, - { 3, "normal", NULL, NULL }, - { 4, "", NULL, NULL }, - { 5, "", NULL, NULL }, - { 6, "", NULL, NULL }, - { 7, "", NULL, NULL }, - { 8, "parallel capacity", NULL, NULL }, - { 9, "parallel redundancy", NULL, NULL }, - { 10, "high efficiency", NULL, NULL }, - /* Extended status values, - * FIXME: check for source and completion */ - { 240, "" /* battery (0xF0) */, NULL, NULL }, - { 100, "" /* maintenanceBypass (0x64) */, NULL, NULL }, - { 96, "" /* Bypass (0x60) */, NULL, NULL }, - { 81, "high efficiency" /* high efficiency (0x51) */, NULL, NULL }, - { 80, "normal" /* normal (0x50) */, NULL, NULL }, - { 64, "" /* UPS supporting load, normal degraded mode (0x40) */, NULL, NULL }, - { 16, "" /* none (0x10) */, NULL, NULL }, - { 0, NULL, NULL, NULL } -}; -#endif /* USE_PW_MODE_INFO */ - -/* FIXME: may be standardized - * extracted from bcmxcp.c->BCMXCP_TOPOLOGY_*, Make some common definitions */ -static info_lkp_t pw_topology_info[] = { - { 0x0000, "", NULL, NULL }, /* None; use the Table of Elements */ - { 0x0010, "Off-line switcher, Single Phase", NULL, NULL }, - { 0x0020, "Line-Interactive UPS, Single Phase", NULL, NULL }, - { 0x0021, "Line-Interactive UPS, Two Phase", NULL, NULL }, - { 0x0022, "Line-Interactive UPS, Three Phase", NULL, NULL }, - { 0x0030, "Dual AC Input, On-Line UPS, Single Phase", NULL, NULL }, - { 0x0031, "Dual AC Input, On-Line UPS, Two Phase", NULL, NULL }, - { 0x0032, "Dual AC Input, On-Line UPS, Three Phase", NULL, NULL }, - { 0x0040, "On-Line UPS, Single Phase", NULL, NULL }, - { 0x0041, "On-Line UPS, Two Phase", NULL, NULL }, - { 0x0042, "On-Line UPS, Three Phase", NULL, NULL }, - { 0x0050, "Parallel Redundant On-Line UPS, Single Phase", NULL, NULL }, - { 0x0051, "Parallel Redundant On-Line UPS, Two Phase", NULL, NULL }, - { 0x0052, "Parallel Redundant On-Line UPS, Three Phase", NULL, NULL }, - { 0x0060, "Parallel for Capacity On-Line UPS, Single Phase", NULL, NULL }, - { 0x0061, "Parallel for Capacity On-Line UPS, Two Phase", NULL, NULL }, - { 0x0062, "Parallel for Capacity On-Line UPS, Three Phase", NULL, NULL }, - { 0x0102, "System Bypass Module, Three Phase", NULL, NULL }, - { 0x0122, "Hot-Tie Cabinet, Three Phase", NULL, NULL }, - { 0x0200, "Outlet Controller, Single Phase", NULL, NULL }, - { 0x0222, "Dual AC Input Static Switch Module, 3 Phase", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" }, + { 2, "" }, + { 3, "normal" }, + { 4, "" }, + { 5, "" }, + { 6, "" }, + { 7, "" }, + { 8, "parallel capacity" }, + { 9, "parallel redundancy" }, + {10, "high efficiency" }, + { 0, "NULL" } }; -/* Legacy implementation */ static info_lkp_t pw_battery_abm_status[] = { - { 1, "CHRG", NULL, NULL }, - { 2, "DISCHRG", NULL, NULL }, -/* { 3, "Floating", NULL, NULL }, */ -/* { 4, "Resting", NULL, NULL }, */ -/* { 5, "Unknown", NULL, NULL }, */ - { 0, NULL, NULL, NULL } -}; + { 1, "CHRG" }, + { 2, "DISCHRG" }, +/* { 3, "Floating" }, */ +/* { 4, "Resting" }, */ +/* { 5, "Unknown" }, */ + { 0, "NULL" } +} ; -static info_lkp_t pw_abm_status_info[] = { - { 1, "charging", NULL, NULL }, - { 2, "discharging", NULL, NULL }, - { 3, "floating", NULL, NULL }, - { 4, "resting", NULL, NULL }, - { 5, "unknown", NULL, NULL }, /* Undefined - ABM is not activated */ - { 6, "disabled", NULL, NULL }, /* ABM Charger Disabled */ - { 0, NULL, NULL, NULL } +static info_lkp_t pw_batt_info[] = { + { 1, "" }, + { 2, "" }, + { 3, "Battery Floating" }, /* battery floating - can we put that stuff somewhere so one actually access that information? */ + { 4, "Battery Resting" }, /* battery resting - could come handy if support asks what + state the batteries are in... pw_batt_info doesn't get used */ + { 5, "unknown" }, /* unknown */ + { 0, "NULL" } }; static info_lkp_t pw_batt_test_info[] = { - { 1, "Unknown", NULL, NULL }, - { 2, "Done and passed", NULL, NULL }, - { 3, "Done and error", NULL, NULL }, - { 4, "In progress", NULL, NULL }, - { 5, "Not supported", NULL, NULL }, - { 6, "Inhibited", NULL, NULL }, - { 7, "Scheduled", NULL, NULL }, - { 0, NULL, NULL, NULL } + { 1, "" }, /* unknown */ + { 2, "Done and passed" }, + { 3, "Done and error" }, + { 4, "In progress" }, + { 5, "Not supported" }, + { 6, "Inhibited" }, + { 7, "Scheduled" }, + { 0, "NULL" } }; -static info_lkp_t pw_yes_no_info[] = { - { 1, "yes", NULL, NULL }, - { 2, "no", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_outlet_status_info[] = { - { 1, "on", NULL, NULL }, - { 2, "off", NULL, NULL }, - { 3, "on", NULL, NULL }, /* pendingOff, transitional status */ - { 4, "off", NULL, NULL }, /* pendingOn, transitional status */ - /* { 5, "", NULL, NULL }, unknown */ - /* { 6, "", NULL, NULL }, reserved */ - { 7, "off", NULL, NULL }, /* Failed in Closed position */ - { 8, "on", NULL, NULL }, /* Failed in Open position */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_ambient_drycontacts_info[] = { - { -1, "unknown", NULL, NULL }, - { 1, "opened", NULL, NULL }, - { 2, "closed", NULL, NULL }, - { 3, "opened", NULL, NULL }, /* openWithNotice */ - { 4, "closed", NULL, NULL }, /* closedWithNotice */ - { 0, NULL, NULL, NULL } -}; - -#if WITH_SNMP_LKP_FUN -/* Note: eaton_sensor_temperature_unit_fun() is defined in eaton-pdu-marlin-helpers.c - * and su_temperature_read_fun() is in snmp-ups.c - * Future work for DMF might provide same-named routines via LUA-C gateway. - */ - -# if WITH_SNMP_LKP_FUN_DUMMY -/* Temperature unit consideration */ -const char *eaton_sensor_temperature_unit_fun(void *raw_snmp_value) { - /* snmp_value here would be a (long*) */ - NUT_UNUSED_VARIABLE(raw_snmp_value); - return "unknown"; -} -/* FIXME: please DMF, though this should be in snmp-ups.c or equiv. */ -const char *su_temperature_read_fun(void *raw_snmp_value) { - /* snmp_value here would be a (long*) */ - NUT_UNUSED_VARIABLE(raw_snmp_value); - return "dummy"; -}; -# endif /* WITH_SNMP_LKP_FUN_DUMMY */ - -static info_lkp_t pw_sensor_temperature_unit_info[] = { - { 0, "dummy", eaton_sensor_temperature_unit_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_sensor_temperature_read_info[] = { - { 0, "dummy", su_temperature_read_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -#else /* if not WITH_SNMP_LKP_FUN: */ - -/* FIXME: For now, DMF codebase falls back to old implementation with static - * lookup/mapping tables for this, which can easily go into the DMF XML file. - */ -static info_lkp_t pw_sensor_temperature_unit_info[] = { - { 0, "kelvin", NULL, NULL }, - { 1, "celsius", NULL, NULL }, - { 2, "fahrenheit", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -#endif /* WITH_SNMP_LKP_FUN */ - -static info_lkp_t pw_ambient_drycontacts_polarity_info[] = { - { 0, "normal-opened", NULL, NULL }, - { 1, "normal-closed", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_ambient_drycontacts_state_info[] = { - { 0, "inactive", NULL, NULL }, - { 1, "active", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_emp002_ambient_presence_info[] = { - { 0, "unknown", NULL, NULL }, - { 2, "yes", NULL, NULL }, /* communicationOK */ - { 3, "no", NULL, NULL }, /* communicationLost */ - { 0, NULL, NULL, NULL } -}; - -/* extracted from drivers/eaton-pdu-marlin-mib.c -> marlin_threshold_status_info */ -static info_lkp_t pw_threshold_status_info[] = { - { 0, "good", NULL, NULL }, /* No threshold triggered */ - { 1, "warning-low", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "critical-low", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "warning-high", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "critical-high", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -/* extracted from drivers/eaton-pdu-marlin-mib.c -> marlin_threshold_xxx_alarms_info */ -static info_lkp_t pw_threshold_temperature_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low temperature warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low temperature critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high temperature warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high temperature critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; - -static info_lkp_t pw_threshold_humidity_alarms_info[] = { - { 0, "", NULL, NULL }, /* No threshold triggered */ - { 1, "low humidity warning!", NULL, NULL }, /* Warning low threshold triggered */ - { 2, "low humidity critical!", NULL, NULL }, /* Critical low threshold triggered */ - { 3, "high humidity warning!", NULL, NULL }, /* Warning high threshold triggered */ - { 4, "high humidity critical!", NULL, NULL }, /* Critical high threshold triggered */ - { 0, NULL, NULL, NULL } -}; /* Snmp2NUT lookup table */ static snmp_info_t pw_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* FIXME: miss device page! */ /* UPS page */ /* info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_MFR_NAME, "", SU_FLAG_STATIC, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_MODEL_NAME, "", SU_FLAG_STATIC, NULL }, - /* FIXME: the 2 "firmware" entries below should be SU_FLAG_SEMI_STATIC */ { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_FIRMREV, "", - 0, NULL }, + SU_FLAG_STATIC, NULL }, { "ups.firmware.aux", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_AGENTREV, "", - 0, NULL }, + SU_FLAG_STATIC, NULL }, { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, IETF_OID_IDENT, "", SU_FLAG_STATIC, NULL }, { "ups.load", 0, 1.0, PW_OID_OUT_LOAD, "", - 0, NULL }, - /* FIXME: should be removed in favor of output.power */ + SU_OUTPUT_1, NULL }, { "ups.power", 0, 1.0, PW_OID_OUT_POWER ".1", "", 0, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* xupsOutputWatts.1.0; Value (Integer): 300 */ - { "ups.power", 0, 1.0, "1.3.6.1.4.1.534.1.4.4.1.4.1.0", "", - 0, NULL }, - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_POWER_STATUS, "OFF", SU_STATUS_PWR, &pw_pwr_info[0] }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_ALARM_OB, "", @@ -397,35 +192,16 @@ static snmp_info_t pw_mib[] = { SU_STATUS_BATT, &pw_alarm_lb[0] }, { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATT_STATUS, "", SU_STATUS_BATT, &pw_battery_abm_status[0] }, -#if USE_PW_MODE_INFO - /* FIXME: should be ups.mode or output.source (need RFC) */ - /* Note: this define is not set via project options; code hidden with - * commit to "snmp-ups: support newer Genepi management cards" */ - { "experimental.ups.type", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_POWER_STATUS, "", + { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_POWER_STATUS, "", SU_FLAG_STATIC | SU_FLAG_OK, &pw_mode_info[0] }, -#endif /* USE_PW_MODE_INFO */ - /* xupsTopologyType.0; Value (Integer): 32 */ - { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.4.1.534.1.13.1.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, &pw_topology_info[0] }, - /* FIXME: should be removed in favor of their output. equivalent! */ { "ups.realpower.nominal", 0, 1.0, PW_OID_CONF_POWER, "", 0, NULL }, - /* FIXME: should be removed in favor of output.power.nominal */ { "ups.power.nominal", 0, 1.0, IETF_OID_CONF_OUT_VA, "", 0, NULL }, - /* XUPS-MIB::xupsEnvAmbientTemp.0 */ - { "ups.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.1.0", "", 0, NULL }, - /* FIXME: These 2 data needs RFC! */ - /* XUPS-MIB::xupsEnvAmbientLowerLimit.0 */ - { "ups.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.2.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvAmbientUpperLimit.0 */ - { "ups.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.3.0", "", 0, NULL }, - /* XUPS-MIB::xupsTestBatteryStatus */ - { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.4.1.534.1.8.2.0", "", 0, &pw_batt_test_info[0] }, - /* UPS-MIB::upsAutoRestart */ - { "ups.start.auto", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.2.1.33.1.8.5.0", "", SU_FLAG_OK, &pw_yes_no_info[0] }, - /* XUPS-MIB::xupsBatteryAbmStatus.0 */ - { "battery.charger.status", ST_FLAG_STRING, SU_INFOSIZE, "1.3.6.1.4.1.534.1.2.5.0", "", SU_STATUS_BATT, &pw_abm_status_info[0] }, + { "ups.test.result", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATTEST_RES, "", + 0, &pw_batt_test_info[0] }, + { "vendor.specific.abmstatus", ST_FLAG_STRING, SU_INFOSIZE, PW_OID_BATT_STATUS, "", + SU_STATUS_BATT, &pw_batt_info[0] }, /* Battery page */ { "battery.charge", 0, 1.0, PW_OID_BATT_CHARGE, "", @@ -438,41 +214,18 @@ static snmp_info_t pw_mib[] = { 0, NULL }, { "battery.runtime.low", 0, 60.0, IETF_OID_CONF_RUNTIME_LOW, "", 0, NULL }, - { "battery.date", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.1.2.6.0", NULL, SU_FLAG_OK, &su_convert_to_iso_date_info[FUNMAP_USDATE_TO_ISODATE] }, /* Output page */ - { "output.phases", 0, 1.0, PW_OID_OUT_LINES, "", 0, NULL }, - /* XUPS-MIB::xupsOutputFrequency.0 */ - { "output.frequency", 0, 0.1, "1.3.6.1.4.1.534.1.4.2.0", "", 0, NULL }, - /* XUPS-MIB::xupsConfigOutputFreq.0 */ - { "output.frequency.nominal", 0, 0.1, "1.3.6.1.4.1.534.1.10.4.0", "", 0, NULL }, - /* XUPS-MIB::xupsOutputVoltage.1 */ - { "output.voltage", 0, 1.0, "1.3.6.1.4.1.534.1.4.4.1.2.1", "", SU_OUTPUT_1, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* xupsOutputVoltage.1.0; Value (Integer): 230 */ - { "output.voltage", 0, 1.0, "1.3.6.1.4.1.534.1.4.4.1.2.1.0", "", SU_OUTPUT_1, NULL }, - /* XUPS-MIB::xupsConfigOutputVoltage.0 */ - { "output.voltage.nominal", 0, 1.0, "1.3.6.1.4.1.534.1.10.1.0", "", 0, NULL }, - /* XUPS-MIB::xupsConfigLowOutputVoltageLimit.0 */ - { "output.voltage.low", 0, 1.0, ".1.3.6.1.4.1.534.1.10.6.0", "", 0, NULL }, - /* XUPS-MIB::xupsConfigHighOutputVoltageLimit.0 */ - { "output.voltage.high", 0, 1.0, ".1.3.6.1.4.1.534.1.10.7.0", "", 0, NULL }, - { "output.current", 0, 1.0, PW_OID_OUT_CURRENT ".1", "", + { "output.phases", 0, 1.0, PW_OID_OUT_LINES, "", + SU_FLAG_SETINT, NULL, &output_phases }, + { "output.frequency", 0, 0.1, PW_OID_OUT_FREQUENCY, "", + 0, NULL }, + { "output.voltage", 0, 1.0, PW_OID_OUT_VOLTAGE ".1", "", SU_OUTPUT_1, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* xupsOutputCurrent.1.0; Value (Integer): 0 */ - { "output.current", 0, 1.0, "1.3.6.1.4.1.534.1.4.4.1.3.1.0", "", + { "output.current", 0, 1.0, PW_OID_OUT_CURRENT ".1", "", SU_OUTPUT_1, NULL }, { "output.realpower", 0, 1.0, PW_OID_OUT_POWER ".1", "", SU_OUTPUT_1, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* Name/OID: xupsOutputWatts.1.0; Value (Integer): 1200 */ - { "output.realpower", 0, 1.0, "1.3.6.1.4.1.534.1.4.4.1.4.1.0", "", - 0, NULL }, - /* Duplicate of "ups.realpower.nominal" - * FIXME: map either ups or output, but not both (or have an auto-remap) */ - { "output.realpower.nominal", 0, 1.0, PW_OID_CONF_POWER, "", - 0, NULL }, { "output.L1-N.voltage", 0, 1.0, PW_OID_OUT_VOLTAGE ".1", "", SU_OUTPUT_3, NULL }, { "output.L2-N.voltage", 0, 1.0, PW_OID_OUT_VOLTAGE ".2", "", @@ -491,7 +244,6 @@ static snmp_info_t pw_mib[] = { SU_OUTPUT_3, NULL }, { "output.L3.realpower", 0, 1.0, PW_OID_OUT_POWER ".3", "", SU_OUTPUT_3, NULL }, - /* FIXME: should better be output.Lx.load */ { "output.L1.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".1", "", SU_OUTPUT_3, NULL }, { "output.L2.power.percent", 0, 1.0, IETF_OID_LOAD_LEVEL ".2", "", @@ -500,21 +252,16 @@ static snmp_info_t pw_mib[] = { SU_OUTPUT_3, NULL }, { "output.voltage.nominal", 0, 1.0, PW_OID_CONF_OVOLTAGE, "", 0, NULL }, + { "output.frequency.nominal", 0, 0.1, PW_OID_CONF_FREQ, "", + 0, NULL }, /* Input page */ { "input.phases", 0, 1.0, PW_OID_IN_LINES, "", - 0, NULL }, + SU_FLAG_SETINT, NULL, &input_phases }, { "input.frequency", 0, 0.1, PW_OID_IN_FREQUENCY, "", 0, NULL }, { "input.voltage", 0, 1.0, PW_OID_IN_VOLTAGE ".0", "", SU_INPUT_1, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* xupsInputVoltage.1[.0]; Value (Integer): 245 */ - { "input.voltage", 0, 1.0, "1.3.6.1.4.1.534.1.3.4.1.2.1", "", - SU_INPUT_1, NULL }, - - /* XUPS-MIB::xupsConfigInputVoltage.0 */ - { "input.voltage.nominal", 0, 1.0, "1.3.6.1.4.1.534.1.10.2.0", "", 0, NULL }, { "input.current", 0, 0.1, PW_OID_IN_CURRENT ".0", "", SU_INPUT_1, NULL }, { "input.L1-N.voltage", 0, 1.0, PW_OID_IN_VOLTAGE ".1", "", @@ -537,16 +284,14 @@ static snmp_info_t pw_mib[] = { SU_INPUT_3, NULL }, { "input.quality", 0, 1.0, PW_OID_IN_LINE_BADS, "", 0, NULL }, + { "input.voltage.nominal", 0, 1.0, PW_OID_CONF_IVOLTAGE, "", + 0, NULL }, - /* FIXME: this segfaults! do we assume the same number of bypass phases as input phases? - { "input.bypass.phases", 0, 1.0, PW_OID_BY_LINES, "", 0, NULL }, */ - { "input.bypass.frequency", 0, 0.1, PW_OID_BY_FREQUENCY, "", 0, NULL }, + /* this segfaults? do we assume the same number of bypass phases as input phases? + { "input.bypass.phases", 0, 1.0, PW_OID_BY_LINES, "", + SU_FLAG_SETINT, NULL }, */ { "input.bypass.voltage", 0, 1.0, PW_OID_BY_VOLTAGE ".0", "", SU_INPUT_1, NULL }, - /* Duplicate of the above entry, but pointing at the first index */ - /* xupsBypassVoltage.1.0; Value (Integer): 244 */ - { "input.bypass.voltage", 0, 1.0, "1.3.6.1.4.1.534.1.5.3.1.2.1.0", "", - SU_INPUT_1, NULL }, { "input.bypass.L1-N.voltage", 0, 1.0, PW_OID_BY_VOLTAGE ".1", "", SU_INPUT_3, NULL }, { "input.bypass.L2-N.voltage", 0, 1.0, PW_OID_BY_VOLTAGE ".2", "", @@ -554,155 +299,26 @@ static snmp_info_t pw_mib[] = { { "input.bypass.L3-N.voltage", 0, 1.0, PW_OID_BY_VOLTAGE ".3", "", SU_INPUT_3, NULL }, - /* Outlet page */ - /* Master outlet id always equal to 0 */ - { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC , NULL }, - /* XUPS-MIB:: xupsSwitchable.0 */ - { "outlet.switchable", 0, 1, ".1.3.6.1.4.1.534.1.9.7.0", NULL, SU_FLAG_STATIC , &pw_yes_no_info[0] }, - /* XUPS-MIB::xupsNumReceptacles; Value (Integer): 2 */ - { "outlet.count", 0, 1, ".1.3.6.1.4.1.534.1.12.1.0", NULL, SU_FLAG_STATIC, NULL }, - /* XUPS-MIB::xupsRecepIndex.X; Value (Integer): X */ - { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.1.%i", NULL, SU_FLAG_STATIC | SU_OUTLET, NULL }, - /* This MIB does not provide outlets switchability info. So map to a nearby - OID, for data activation, and map all values to "yes" */ - { "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.1.%i", NULL, SU_FLAG_STATIC | SU_OUTLET, NULL }, - /* XUPS-MIB::xupsRecepStatus.X; Value (Integer): 1 */ - { "outlet.%i.status", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.2.%i", NULL, SU_OUTLET, &pw_outlet_status_info[0] }, - - /* Ambient collection */ - /* EMP001 (legacy) mapping */ - /* XUPS-MIB::xupsEnvRemoteTemp.0 */ - { "ambient.temperature", 0, 1.0, "1.3.6.1.4.1.534.1.6.5.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvRemoteTempLowerLimit.0 */ - { "ambient.temperature.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.9.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvRemoteTempUpperLimit.0 */ - { "ambient.temperature.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.10.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvRemoteHumidity.0 */ - { "ambient.humidity", 0, 1.0, "1.3.6.1.4.1.534.1.6.6.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvRemoteHumidityLowerLimit.0 */ - { "ambient.humidity.low", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.11.0", "", 0, NULL }, - /* XUPS-MIB::xupsEnvRemoteHumidityUpperLimit.0 */ - { "ambient.humidity.high", ST_FLAG_RW, 1.0, "1.3.6.1.4.1.534.1.6.12.0", "", 0, NULL }, - /* XUPS-MIB::xupsContactDescr.n */ - { "ambient.contacts.1.name", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.1.6.8.1.4.1", "", 0, NULL }, - { "ambient.contacts.2.name", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.1.6.8.1.4.2", "", 0, NULL }, - /* XUPS-MIB::xupsContactState.n */ - { "ambient.contacts.1.status", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.1.6.8.1.3.1", "", 0, &pw_ambient_drycontacts_info[0] }, - { "ambient.contacts.2.status", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.1.6.8.1.3.2", "", 0, &pw_ambient_drycontacts_info[0] }, - - /* EMP002 (EATON EMP MIB) mapping, including daisychain support */ - /* Warning: indexes start at '1' not '0'! */ - /* sensorCount.0 */ - { "ambient.count", ST_FLAG_RW, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.1.0", "", 0, NULL }, - /* CommunicationStatus.n */ - { "ambient.%i.present", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.8.1.1.4.1.1.%i", - NULL, SU_AMBIENT_TEMPLATE, &pw_emp002_ambient_presence_info[0] }, - /* sensorName.n: OctetString EMPDT1H1C2 @1 */ - { "ambient.%i.name", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.3.1.1.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorManufacturer.n */ - { "ambient.%i.mfr", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.2.1.6.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorModel.n */ - { "ambient.%i.model", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.2.1.7.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorSerialNumber.n */ - { "ambient.%i.serial", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.2.1.9.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorUuid.n */ - { "ambient.%i.id", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.2.1.2.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorAddress.n */ - { "ambient.%i.address", 0, 1, ".1.3.6.1.4.1.534.6.8.1.1.2.1.4.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* sensorFirmwareVersion.n */ - { "ambient.%i.firmware", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.1.2.1.10.%i", "", SU_AMBIENT_TEMPLATE, NULL }, - /* temperatureUnit.1 - * MUST be before the temperature data reading! */ - { "ambient.%i.temperature.unit", 0, 1.0, ".1.3.6.1.4.1.534.6.8.1.2.5.0", "", SU_AMBIENT_TEMPLATE, &pw_sensor_temperature_unit_info[0] }, - /* temperatureValue.n.1 */ - { "ambient.%i.temperature", 0, 0.1, ".1.3.6.1.4.1.534.6.8.1.2.3.1.3.%i.1", "", SU_AMBIENT_TEMPLATE, -#if WITH_SNMP_LKP_FUN - &pw_sensor_temperature_read_info[0] -#else - NULL -#endif - }, - { "ambient.%i.temperature.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.2.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE, &pw_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.2.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE, &pw_threshold_temperature_alarms_info[0] }, - /* FIXME: ambient.n.temperature.{minimum,maximum} */ - /* temperatureThresholdLowCritical.n.1 */ - { "ambient.%i.temperature.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.2.2.1.6.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* temperatureThresholdLowWarning.n.1 */ - { "ambient.%i.temperature.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.2.2.1.5.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* temperatureThresholdHighWarning.n.1 */ - { "ambient.%i.temperature.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.2.2.1.7.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* temperatureThresholdHighCritical.n.1 */ - { "ambient.%i.temperature.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.2.2.1.8.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* humidityValue.n.1 */ - { "ambient.%i.humidity", 0, 0.1, ".1.3.6.1.4.1.534.6.8.1.3.3.1.3.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - { "ambient.%i.humidity.status", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.3.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE, &pw_threshold_status_info[0] }, - { "ups.alarm", ST_FLAG_STRING, SU_INFOSIZE, - ".1.3.6.1.4.1.534.6.8.1.3.3.1.1.%i.1", - NULL, SU_AMBIENT_TEMPLATE, &pw_threshold_humidity_alarms_info[0] }, - /* FIXME: consider ambient.n.humidity.{minimum,maximum} */ - /* humidityThresholdLowCritical.n.1 */ - { "ambient.%i.humidity.low.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.3.2.1.6.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* humidityThresholdLowWarning.n.1 */ - { "ambient.%i.humidity.low.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.3.2.1.5.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* humidityThresholdHighWarning.n.1 */ - { "ambient.%i.humidity.high.warning", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.3.2.1.7.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* humidityThresholdHighCritical.n.1 */ - { "ambient.%i.humidity.high.critical", ST_FLAG_RW, 0.1, ".1.3.6.1.4.1.534.6.8.1.3.2.1.8.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - /* digitalInputName.n.{1,2} */ - { "ambient.%i.contacts.1.name", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.4.2.1.1.%i.1", "", SU_AMBIENT_TEMPLATE, NULL }, - { "ambient.%i.contacts.2.name", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.4.2.1.1.%i.2", "", SU_AMBIENT_TEMPLATE, NULL }, - /* digitalInputPolarity.n */ - { "ambient.%i.contacts.1.config", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.8.1.4.2.1.3.%i.1", "", SU_AMBIENT_TEMPLATE, &pw_ambient_drycontacts_polarity_info[0] }, - { "ambient.%i.contacts.2.config", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.8.1.4.2.1.3.%i.2", "", SU_AMBIENT_TEMPLATE, &pw_ambient_drycontacts_polarity_info[0] }, - /* XUPS-MIB::xupsContactState.n */ - { "ambient.%i.contacts.1.status", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.4.3.1.3.%i.1", "", SU_AMBIENT_TEMPLATE, &pw_ambient_drycontacts_state_info[0] }, - { "ambient.%i.contacts.2.status", ST_FLAG_STRING, 1.0, ".1.3.6.1.4.1.534.6.8.1.4.3.1.3.%i.2", "", SU_AMBIENT_TEMPLATE, &pw_ambient_drycontacts_state_info[0] }, + /* Ambient page */ + { "ambient.temperature", 0, 1.0, PW_OID_AMBIENT_TEMP, "", + 0, NULL }, + { "ambient.temperature.low", 0, 1.0, PW_OID_AMBIENT_LOW, "", + 0, NULL }, + { "ambient.temperature.high", 0, 1.0, PW_OID_AMBIENT_HIGH, "", + 0, NULL }, /* instant commands */ { "test.battery.start.quick", 0, 1, PW_OID_BATTEST_START, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* Shed load and restart when line power back on; cannot be canceled */ - { "shutdown.return", 0, DEFAULT_SHUTDOWNDELAY, PW_OID_CONT_LOAD_SHED_AND_RESTART, "", - SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* Cancel output off, by writing 0 to xupsControlOutputOffDelay */ + /* Cancel output off, by writing 0 to xupsControlOutputOffDelay */ { "shutdown.stop", 0, 0, PW_OID_CONT_OFFDELAY, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* XUPS-MIB::xupsControlOutputOffDelay */ - /* load off after 1 sec, shortest possible delay; 0 cancels */ - { "load.off", 0, 1, PW_OID_CONT_OFFDELAY, "1", + /* load off after 1 sec, shortest possible delay */ + { "load.off", 0, 1, PW_OID_CONT_OFFDELAY, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - { "load.off.delay", 0, 1, PW_OID_CONT_OFFDELAY, NULL, + /* load on after 1 sec, shortest possible delay */ + { "load.on", 0, 1, PW_OID_CONT_ONDELAY, "", SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* XUPS-MIB::xupsControlOutputOnDelay */ - /* load on after 1 sec, shortest possible delay; 0 cancels */ - { "load.on", 0, 1, PW_OID_CONT_ONDELAY, "1", - SU_TYPE_CMD | SU_FLAG_OK, NULL }, - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - { "load.on.delay", 0, 1, PW_OID_CONT_ONDELAY, NULL, - SU_TYPE_CMD | SU_FLAG_OK, NULL }, - - /* Delays handling: - * 0-n :Time in seconds until the command is issued - * -1:Cancel a pending Off/On command */ - /* XUPS-MIB::xupsRecepOffDelaySecs.n */ - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.3.%i", - "0", SU_TYPE_CMD | SU_OUTLET, NULL }, - /* XUPS-MIB::xupsRecepOnDelaySecs.n */ - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.4.%i", - "0", SU_TYPE_CMD | SU_OUTLET, NULL }, - /* Delayed version, parameter is mandatory (so dfl is NULL)! */ - { "outlet.%i.load.off.delay", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.3.%i", - NULL, SU_TYPE_CMD | SU_OUTLET, NULL }, - /* XUPS-MIB::xupsRecepOnDelaySecs.n */ - { "outlet.%i.load.on.delay", 0, 1, ".1.3.6.1.4.1.534.1.12.2.1.4.%i", - NULL, SU_TYPE_CMD | SU_OUTLET, NULL }, { "ups.alarms", 0, 1.0, PW_OID_ALARMS, "", 0, NULL }, @@ -712,107 +328,10 @@ static snmp_info_t pw_mib[] = { } ; static alarms_info_t pw_alarms[] = { - /* xupsLowBattery */ - { PW_OID_ALARM_LB, "LB", NULL }, - /* xupsOutputOverload */ - { ".1.3.6.1.4.1.534.1.7.7", "OVER", "Output overload!" }, - /* xupsInternalFailure */ - { ".1.3.6.1.4.1.534.1.7.8", NULL, "Internal failure!" }, - /* xupsBatteryDischarged */ - { ".1.3.6.1.4.1.534.1.7.9", NULL, "Battery discharged!" }, - /* xupsInverterFailure */ - { ".1.3.6.1.4.1.534.1.7.10", NULL, "Inverter failure!" }, - /* xupsOnBypass - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.11", "BYPASS", "On bypass!" }, - /* xupsBypassNotAvailable - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.12", NULL, "Bypass not available!" }, - /* xupsOutputOff - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.13", "OFF", "Output off!" }, - /* xupsInputFailure - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.14", NULL, "Input failure!" }, - /* xupsBuildingAlarm - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.15", NULL, "Building alarm!" }, - /* xupsShutdownImminent */ - { ".1.3.6.1.4.1.534.1.7.16", NULL, "Shutdown imminent!" }, - /* xupsOnInverter - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.17", NULL, "On inverter!" }, - /* xupsBreakerOpen - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.20", NULL, "Breaker open!" }, - /* xupsAlarmBatteryBad */ - { ".1.3.6.1.4.1.534.1.7.23", "RB", "Battery bad!" }, - /* xupsOutputOffAsRequested - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.24", "OFF", "Output off as requested!" }, - /* xupsDiagnosticTestFailed - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.25", NULL, "Diagnostic test failure!" }, - /* xupsCommunicationsLost */ - { ".1.3.6.1.4.1.534.1.7.26", NULL, "Communication with UPS lost!" }, - /* xupsUpsShutdownPending */ - { ".1.3.6.1.4.1.534.1.7.27", NULL, "Shutdown pending!" }, - /* xupsAmbientTempBad */ - { ".1.3.6.1.4.1.534.1.7.29", NULL, "Bad ambient temperature!" }, - /* xupsLossOfRedundancy */ - { ".1.3.6.1.4.1.534.1.7.30", NULL, "Redundancy lost!" }, - /* xupsAlarmTempBad */ - { ".1.3.6.1.4.1.534.1.7.31", NULL, "Bad temperature!" }, - /* xupsAlarmChargerFailed */ - { ".1.3.6.1.4.1.534.1.7.32", NULL, "Charger failure!" }, - /* xupsAlarmFanFailure */ - { ".1.3.6.1.4.1.534.1.7.33", NULL, "Fan failure!" }, - /* xupsAlarmFuseFailure */ - { ".1.3.6.1.4.1.534.1.7.34", NULL, "Fuse failure!" }, - /* xupsPowerSwitchBad */ - { ".1.3.6.1.4.1.534.1.7.35", NULL, "Powerswitch failure!" }, - /* xupsModuleFailure */ - { ".1.3.6.1.4.1.534.1.7.36", NULL, "Parallel or composite module failure!" }, - /* xupsOnAlternatePowerSource - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.37", NULL, "Using alternative power source!" }, - /* xupsAltPowerNotAvailable - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.38", NULL, "Alternative power source unavailable!" }, - /* xupsRemoteTempBad */ - { ".1.3.6.1.4.1.534.1.7.40", NULL, "Bad remote temperature!" }, - /* xupsRemoteHumidityBad */ - { ".1.3.6.1.4.1.534.1.7.41", NULL, "Bad remote humidity!" }, - /* xupsAlarmOutputBad */ - { ".1.3.6.1.4.1.534.1.7.42", NULL, "Bad output condition!" }, - /* xupsAlarmAwaitingPower - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? */ - { ".1.3.6.1.4.1.534.1.7.43", NULL, "Awaiting power!" }, - /* xupsOnMaintenanceBypass - * FIXME: informational (not an alarm), - * to RFC'ed for device.event? - * FIXME: NUT currently doesn't distinguish between Maintenance and - * Automatic Bypass (both published as "ups.alarm: BYPASS) - * Should we make the distinction? */ - { ".1.3.6.1.4.1.534.1.7.44", "BYPASS", "On maintenance bypass!" }, - - + { PW_OID_ALARM_LB, "LB" }, /* end of structure. */ - { NULL, NULL, NULL } + { NULL, NULL } } ; -mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms }; -mib2nut_info_t pxgx_ups = { "pxgx_ups", PW_MIB_VERSION, NULL, PW_OID_MODEL_NAME, pw_mib, EATON_PXGX_SYSOID , pw_alarms }; +mib2nut_info_t powerware = { "pw", PW_MIB_VERSION, "", PW_OID_MODEL_NAME, pw_mib, POWERWARE_SYSOID , pw_alarms }; diff --git a/drivers/powerware-mib.h b/drivers/powerware-mib.h index 7189a24..2bd9d28 100644 --- a/drivers/powerware-mib.h +++ b/drivers/powerware-mib.h @@ -5,6 +5,5 @@ #include "snmp-ups.h" extern mib2nut_info_t powerware; -extern mib2nut_info_t pxgx_ups; #endif /* POWERWARE_MIB_H */ diff --git a/drivers/raritan-pdu-mib.c b/drivers/raritan-pdu-mib.c index f4e52ac..fd832c1 100644 --- a/drivers/raritan-pdu-mib.c +++ b/drivers/raritan-pdu-mib.c @@ -1,6 +1,6 @@ /* raritan-mib.c - data to monitor Raritan PDUs (Basic and Complex) * - * Copyright (C) 2008-2019 + * Copyright (C) 2008 * Arnaud Quette * * Sponsored by Eaton @@ -25,7 +25,7 @@ #include "raritan-pdu-mib.h" -#define RARITAN_MIB_VERSION "0.8" +#define RARITAN_MIB_VERSION "0.4" /* Raritan MIB * this one uses the same MIB as Eaton Revelation, @@ -34,76 +34,70 @@ #define RARITAN_SYSOID RARITAN_BASE_OID #define RARITAN_OID_MODEL_NAME ".1.3.6.1.4.1.13742.1.1.12.0" -#define DO_OFF "0" -#define DO_ON "1" -#define DO_CYCLE "2" +#define DO_OFF 0 +#define DO_ON 1 +#define DO_CYCLE 2 -static info_lkp_t raritan_pdu_outlet_status_info[] = { - { -1, "error", NULL, NULL }, - { 0, "off", NULL, NULL }, - { 1, "on", NULL, NULL }, - { 2, "cycling", NULL, NULL }, /* transitional status */ - { 0, NULL, NULL, NULL } +static info_lkp_t outlet_status_info[] = { + { -1, "error" }, + { 0, "off" }, + { 1, "on" }, + { 2, "cycling" }, /* transitional status */ + { 0, NULL } }; /* Snmp2NUT lookup table for Raritan MIB */ static snmp_info_t raritan_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - /* Device page */ { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Raritan", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.12.0", - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.2.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.6.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, /* UPS page */ { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Raritan", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.12.0", - "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "Generic SNMP PDU", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.13.0", - "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + "unknown", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.2.0", "", - SU_FLAG_STATIC | SU_FLAG_OK, NULL }, + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.1.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, { "ups.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - { "ups.temperature", 0, 1, ".1.3.6.1.4.1.13742.1.3.1.5.0", NULL, 0, NULL }, + SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, + { "ups.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.1.6.0", "", + SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, + { "ups.temperature", 0, 1, ".1.3.6.1.4.1.13742.1.3.1.5.0", NULL, 0, NULL, NULL }, /* Outlet page */ { "outlet.id", 0, 1, NULL, "0", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.desc", ST_FLAG_RW | ST_FLAG_STRING, 20, NULL, "All outlets", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, { "outlet.count", 0, 1, ".1.3.6.1.4.1.13742.1.2.1.0", "0", 0, NULL }, - { "outlet.current", 0, 0.001, ".1.3.6.1.4.1.13742.1.3.1.1" ".0", NULL, 0, NULL }, - { "outlet.voltage", 0, 0.001, ".1.3.6.1.4.1.13742.1.3.1.2" ".0", NULL, 0, NULL }, - { "outlet.realpower", 0, 1.0, ".1.3.6.1.4.1.13742.1.3.1.3" ".0", NULL, 0, NULL }, - { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.13742.1.3.1.4" ".0", NULL, 0, NULL }, + { "outlet.current", 0, 0.001, ".1.3.6.1.4.1.13742.1.3.1.1" ".0", NULL, 0, NULL, NULL }, + { "outlet.voltage", 0, 0.001, ".1.3.6.1.4.1.13742.1.3.1.2" ".0", NULL, 0, NULL, NULL }, + { "outlet.realpower", 0, 1.0, ".1.3.6.1.4.1.13742.1.3.1.3" ".0", NULL, 0, NULL, NULL }, + { "outlet.power", 0, 1.0, ".1.3.6.1.4.1.13742.1.3.1.4" ".0", NULL, 0, NULL, NULL }, /* outlet template definition * Caution: the index of the data start at 0, while the name is +1 * ie outlet.1 => .0 */ - { "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL }, - { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL }, - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.2.2.1.2.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", NULL, SU_FLAG_OK | SU_OUTLET, &raritan_pdu_outlet_status_info[0] }, - { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.13742.1.2.2.1.4.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.current.maximum", 0, 0.001, ".1.3.6.1.4.1.13742.1.2.2.1.5.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.7.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.voltage", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.6.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.powerfactor", 0, 0.01, ".1.3.6.1.4.1.13742.1.2.2.1.9.%i", NULL, SU_OUTLET, NULL }, - { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.8.%i", NULL, SU_OUTLET, NULL }, + { "outlet.%i.switchable", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.1.%i", "yes", SU_FLAG_STATIC | SU_OUTLET, NULL, NULL }, + { "outlet.%i.id", 0, 1, NULL, "%i", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK | SU_OUTLET, NULL, NULL }, + { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.2.2.1.2.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", NULL, SU_FLAG_OK | SU_OUTLET, &outlet_status_info[0], NULL }, + { "outlet.%i.current", 0, 0.001, ".1.3.6.1.4.1.13742.1.2.2.1.4.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.current.maximum", 0, 0.001, ".1.3.6.1.4.1.13742.1.2.2.1.5.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.realpower", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.7.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.voltage", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.6.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.powerfactor", 0, 0.01, ".1.3.6.1.4.1.13742.1.2.2.1.9.%i", NULL, SU_OUTLET, NULL, NULL }, + { "outlet.%i.power", 0, 1.0, ".1.3.6.1.4.1.13742.1.2.2.1.8.%i", NULL, SU_OUTLET, NULL, NULL }, /* FIXME: * - delay for startup/shutdown sequence @@ -116,15 +110,15 @@ static snmp_info_t raritan_mib[] = { /* instant commands. */ /* Note that load.cycle might be replaced by / mapped on shutdown.reboot */ /* no counterpart found! - { "outlet.load.off", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", DO_OFF, SU_TYPE_CMD, NULL }, - { "outlet.load.on", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", DO_ON, SU_TYPE_CMD, NULL }, - { "outlet.load.cycle", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", DO_CYCLE, SU_TYPE_CMD, NULL }, */ - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", DO_OFF, SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", DO_ON, SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.cycle", 0, 1, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", DO_CYCLE, SU_TYPE_CMD | SU_OUTLET, NULL }, + { "outlet.load.off", 0, DO_OFF, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.on", 0, DO_ON, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", NULL, SU_TYPE_CMD, NULL, NULL }, + { "outlet.load.cycle", 0, DO_CYCLE, ".1.3.6.1.4.1.13742.1.2.2.1.3.0", NULL, SU_TYPE_CMD, NULL, NULL }, */ + { "outlet.%i.load.off", 0, DO_OFF, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.on", 0, DO_ON, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, + { "outlet.%i.load.cycle", 0, DO_CYCLE, ".1.3.6.1.4.1.13742.1.2.2.1.3.%i", NULL, SU_TYPE_CMD | SU_OUTLET, NULL, NULL }, /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } + { NULL, 0, 0, NULL, NULL, 0, NULL, NULL } }; -mib2nut_info_t raritan = { "raritan", RARITAN_MIB_VERSION, NULL, RARITAN_OID_MODEL_NAME, raritan_mib, RARITAN_SYSOID, NULL }; +mib2nut_info_t raritan = { "raritan", RARITAN_MIB_VERSION, "", RARITAN_OID_MODEL_NAME, raritan_mib, RARITAN_SYSOID }; diff --git a/drivers/raritan-px2-mib.c b/drivers/raritan-px2-mib.c deleted file mode 100644 index 5f7ca2d..0000000 --- a/drivers/raritan-px2-mib.c +++ /dev/null @@ -1,586 +0,0 @@ -/* raritan-px2-mib.c - subdriver to monitor RARITAN PX2 SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * 2016 Arnaud Quette - * - * Based on initial work and data from Opengear - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "raritan-px2-mib.h" - -#define RARITAN_PX2_MIB_VERSION "0.4" - -#define RARITAN_PX2_MIB_SYSOID ".1.3.6.1.4.1.13742.6" -#define RARITAN_PX2_OID_MODEL_NAME ".1.3.6.1.4.1.13742.6.3.2.1.1.3.1" - -/* info elements */ -/* FIXME: triage between status and alarms, and make it compliant! */ -static info_lkp_t raritanpx2_outlet_status_info[] = { - { -1, "unavailable", NULL, NULL }, - { 0, "open", NULL, NULL }, - { 1, "closed", NULL, NULL }, - { 2, "belowLowerCritical", NULL, NULL }, - { 3, "belowLowerWarning", NULL, NULL }, - { 4, "normal", NULL, NULL }, - { 5, "aboveUpperWarning", NULL, NULL }, - { 6, "aboveUpperCritical", NULL, NULL }, - { 7, "on", NULL, NULL }, - { 8, "off", NULL, NULL }, - { 9, "detected", NULL, NULL }, - { 10, "notDetected", NULL, NULL }, - { 11, "alarmed", NULL, NULL }, - { 12, "ok", NULL, NULL }, - { 13, "marginal", NULL, NULL }, - { 14, "fail", NULL, NULL }, - { 15, "yes", NULL, NULL }, - { 16, "no", NULL, NULL }, - { 17, "standby", NULL, NULL }, - { 18, "one", NULL, NULL }, - { 19, "two", NULL, NULL }, - { 20, "inSync", NULL, NULL }, - { 21, "outOfSync", NULL, NULL }, - { 0, "NULL", NULL, NULL } -}; - -static info_lkp_t raritanpx2_outlet_switchability_info[] = { - { -1, "yes", NULL, NULL }, - { 1, "yes", NULL, NULL }, - { 2, "no", NULL, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* PDU2-MIB Snmp2NUT lookup table */ -static snmp_info_t raritan_px2_mib[] = { - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - /* pduManufacturer.1 = STRING: Raritan */ - { "device.mfr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.2.1", - "Raritan", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* pduModel.1 = STRING: PX2-5475 */ - { "device.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.3.1", - "Raritan PX2 SNMP PDU device", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* pduSerialNumber.1 = STRING: QFC3950619 */ - { "device.serial", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.4.1", - NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "device.type", ST_FLAG_STRING, SU_INFOSIZE, NULL, "pdu", SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - /* pxMACAddress.1 = STRING: 0:d:5d:b:49:0 */ - { "device.macaddr", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.11.1", - NULL, SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* boardVersion.1.mainController.1 = STRING: 0x01 */ - /* FIXME: not compliant! to be RFC'ed */ - { "device.revision", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.3.1.4.1.1.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* FIXME: move to device collection! */ - /* Wrong OID! - * { "ups.mfr.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.3.1.6.1.1.1", "", SU_FLAG_OK | SU_FLAG_STATIC, NULL },*/ - /* boardFirmwareVersion.1.mainController.1 = STRING: 2.4.3.5-40298 */ - { "ups.firmware", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.3.1.6.1.1.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - /* pduName.1 = STRING: my PX */ - { "ups.id", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.13.1", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.3.1", - "Raritan PX2 SNMP PDU device", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* Input data: - * Units are given in inletSensorUnits.1.1.%i - * Value should be scaled by inletSensorDecimalDigits.1.1.%i - * For example, if the value is 1 and inletSensorDecimalDigits is 2, then actual value is 0.01. */ - /* measurementsInletSensorValue.1.1.rmsCurrent = Gauge32: 10 (A) */ - { "input.load", 0, 0.1, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* measurementsInletSensorValue.1.1.rmsVoltage = Gauge32: 119 (V) */ - { "input.voltage", 0, 1, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* measurementsInletSensorValue.1.1.activePower = Gauge32: 10 (W) */ - { "input.realpower", 0, 1, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* measurementsInletSensorValue.1.1.apparentPower = Gauge32: 122 (VA) */ - { "input.power", 0, 1, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* measurementsInletSensorValue.1.1.powerFactor = Gauge32: 8 (none) */ - /* FIXME: need RFC! */ - { "input.powerfactor", 0, 0.01, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* measurementsInletSensorValue.1.1.activeEnergy = Gauge32: 193359 (wattHour) */ - /* { "unmapped.measurementsInletSensorValue", 0, 1, ".1.3.6.1.4.1.13742.6.5.2.3.1.4.1.1.8", NULL, SU_FLAG_OK, NULL }, */ - - /* inletPlug.1.1 = INTEGER: plugIEC320C20(6) */ - /* FIXME: need RFC (input.type | [input.]inlet.type...) and standardization - * { "unmapped.inletPlug", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.3.1.4.1.1", NULL, SU_FLAG_OK, NULL },*/ - - /* outletCount.1 = INTEGER: 24 */ - { "outlet.count", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.4.1", "0", SU_FLAG_STATIC | SU_FLAG_OK, NULL }, - - /* outlet template definition - * Indexes start from 1, ie outlet.1 => .1 */ - /* Note: the first definition is used to determine the base index (ie 0 or 1) */ - /* outletName.1.%i = STRING: */ - { "outlet.%i.desc", ST_FLAG_RW | ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.5.3.1.3.1.%i", NULL, SU_OUTLET, NULL }, - /* outletSwitchingState.1.%i = INTEGER: on(7) */ - { "outlet.%i.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.4.1.2.1.3.1.%i", NULL, SU_OUTLET, &raritanpx2_outlet_status_info[0] }, - /* outletLabel.1.%i = STRING: 1 */ - { "outlet.%i.id", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.2.1.%i", "%i", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK, NULL }, - - /* outletReceptacle.1.1 = INTEGER: receptacleNEMA520R(37) */ - /* FIXME: need RFC and standardization - * { "outlet.%i.type", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.4.1.%i", NULL, SU_OUTLET | SU_FLAG_OK, NULL }, */ - - /* RMS Current (divide by 10). e.g. 5 == 0.5A */ - /* measurementsOutletSensorValue.1.%i.rmsCurrent = Gauge32: 10 */ - { "outlet.%i.current", 0, 0.1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.%i.1", NULL, SU_OUTLET | SU_FLAG_OK, NULL }, - /* measurementsOutletSensorValue.1.%i.rmsVoltage = Gauge32: 119 */ - { "outlet.%i.voltage", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.%i.4", "%i", SU_OUTLET | SU_FLAG_OK, NULL }, - /* measurementsOutletSensorValue.1.%i.activePower = Gauge32: 10 */ - { "outlet.%i.power", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.%i.5", "%i", SU_OUTLET | SU_FLAG_OK, NULL }, - /* measurementsOutletSensorValue.1.%i.apparentPower = Gauge32: 122 */ - { "outlet.%i.realpower", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.%i.6", "%i", SU_OUTLET | SU_FLAG_OK, NULL }, - /* measurementsOutletSensorValue.1.%i.powerFactor = Gauge32: 8 */ - { "outlet.%i.powerfactor", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.%i.7", "%i", SU_OUTLET | SU_FLAG_OK, NULL }, - /* measurementsOutletSensorValue.1.1.activeEnergy = Gauge32: 89890 */ - /* FIXME: - * { "unmapped.measurementsOutletSensorValue", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.1.8", NULL, SU_FLAG_OK, NULL }, */ - /* measurementsOutletSensorValue.1.1.onOff = Gauge32: 0 */ - /* FIXME: - * { "unmapped.measurementsOutletSensorValue", 0, 1, ".1.3.6.1.4.1.13742.6.5.4.3.1.4.1.1.14", NULL, SU_FLAG_OK, NULL }, */ - - /* outletSwitchable.1.%i = INTEGER: true(1) */ - { "outlet.%i.switchable", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.5.3.1.28.1.%i", "no", SU_FLAG_STATIC | SU_OUTLET | SU_FLAG_OK, &raritanpx2_outlet_switchability_info[0] }, - - /* instant commands. */ - /* switchingOperation.1.1 = INTEGER: on(1) */ - { "outlet.%i.load.off", 0, 1, ".1.3.6.1.4.1.13742.6.4.1.2.1.2.1.%i", "0", SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.on", 0, 1, ".1.3.6.1.4.1.13742.6.4.1.2.1.2.1.%i", "1", SU_TYPE_CMD | SU_OUTLET, NULL }, - { "outlet.%i.load.cycle", 0, 1, ".1.3.6.1.4.1.13742.6.4.1.2.1.2.1.%i", "2", SU_TYPE_CMD | SU_OUTLET, NULL }, - -#ifdef DEBUG - /* pduCount.0 = INTEGER: 1 */ - /* FIXME: part of daisychain support, RFC device.count */ - { "device.count", 0, 1, ".1.3.6.1.4.1.13742.6.3.1.0", NULL, SU_FLAG_OK, NULL }, - - /* pduRatedVoltage.1 = STRING: 100-120V */ - { "unmapped.pduRatedVoltage", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* pduRatedCurrent.1 = STRING: 16A */ - { "unmapped.pduRatedCurrent", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* pduRatedFrequency.1 = STRING: 50/60Hz */ - { "unmapped.pduRatedFrequency", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* pduRatedVA.1 = STRING: 1.6-1.9kVA */ - { "unmapped.pduRatedVA", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.8.1", NULL, SU_FLAG_OK, NULL }, - /* pduImage.1 = STRING: */ - { "unmapped.pduImage", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.1.1.9.1", NULL, SU_FLAG_OK, NULL }, - /* inletCount.1 = INTEGER: 1 */ - { "unmapped.inletCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* overCurrentProtectorCount.1 = INTEGER: 0 */ - { "unmapped.overCurrentProtectorCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.3.1", NULL, SU_FLAG_OK, NULL }, - - /* inletControllerCount.1 = INTEGER: 0 */ - { "unmapped.inletControllerCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* outletControllerCount.1 = INTEGER: 6 */ - { "unmapped.outletControllerCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.6.1", NULL, SU_FLAG_OK, NULL }, - /* externalSensorCount.1 = INTEGER: 16 */ - { "unmapped.externalSensorCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.7.1", NULL, SU_FLAG_OK, NULL }, - /* pxIPAddress.1 = IpAddress: 192.168.20.188 */ - { "unmapped.pxIPAddress", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.8.1", NULL, SU_FLAG_OK, NULL }, - /* netmask.1 = IpAddress: 255.255.255.0 */ - { "unmapped.netmask", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.9.1", NULL, SU_FLAG_OK, NULL }, - /* gateway.1 = IpAddress: 192.168.20.254 */ - { "unmapped.gateway", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.10.1", NULL, SU_FLAG_OK, NULL }, - /* utcOffset.1 = STRING: -5:00 */ - { "unmapped.utcOffset", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.12.1", NULL, SU_FLAG_OK, NULL }, - /* externalSensorsZCoordinateUnits.1 = INTEGER: rackUnits(0) */ - { "unmapped.externalSensorsZCoordinateUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.34.1", NULL, SU_FLAG_OK, NULL }, - /* unitDeviceCapabilities.1 = BITS: 00 00 00 00 00 00 */ - { "unmapped.unitDeviceCapabilities", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.35.1", NULL, SU_FLAG_OK, NULL }, - /* outletSequencingDelay.1 = Gauge32: 200 */ - { "unmapped.outletSequencingDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.36.1", NULL, SU_FLAG_OK, NULL }, - /* globalOutletPowerCyclingPowerOffPeriod.1 = Gauge32: 10 */ - { "unmapped.globalOutletPowerCyclingPowerOffPeriod", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.37.1", NULL, SU_FLAG_OK, NULL }, - /* globalOutletStateOnStartup.1 = INTEGER: lastKnownState(2) */ - { "unmapped.globalOutletStateOnStartup", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.38.1", NULL, SU_FLAG_OK, NULL }, - /* outletPowerupSequence.1 = STRING: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24 */ - { "unmapped.outletPowerupSequence", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.39.1", NULL, SU_FLAG_OK, NULL }, - /* pduPowerCyclingPowerOffPeriod.1 = Gauge32: 3 */ - { "unmapped.pduPowerCyclingPowerOffPeriod", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.40.1", NULL, SU_FLAG_OK, NULL }, - /* pduDaisychainMemberType.1 = INTEGER: standalone(0) */ - { "unmapped.pduDaisychainMemberType", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.41.1", NULL, SU_FLAG_OK, NULL }, - /* managedExternalSensorCount.1 = INTEGER: 0 */ - { "unmapped.managedExternalSensorCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.42.1", NULL, SU_FLAG_OK, NULL }, - /* pxInetAddressType.1 = INTEGER: ipv4(1) */ - { "unmapped.pxInetAddressType", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.50.1", NULL, SU_FLAG_OK, NULL }, - /* pxInetIPAddress.1 = Hex-STRING: C0 A8 14 BC */ - { "unmapped.pxInetIPAddress", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.51.1", NULL, SU_FLAG_OK, NULL }, - /* pxInetNetmask.1 = Hex-STRING: FF FF FF 00 */ - { "unmapped.pxInetNetmask", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.52.1", NULL, SU_FLAG_OK, NULL }, - /* pxInetGateway.1 = Hex-STRING: C0 A8 14 FE */ - { "unmapped.pxInetGateway", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.2.1.53.1", NULL, SU_FLAG_OK, NULL }, - /* loadShedding.1 = INTEGER: false(2) */ - { "unmapped.loadShedding", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.55.1", NULL, SU_FLAG_OK, NULL }, - /* serverCount.1 = INTEGER: 8 */ - { "unmapped.serverCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.56.1", NULL, SU_FLAG_OK, NULL }, - /* inrushGuardDelay.1 = Gauge32: 200 */ - { "unmapped.inrushGuardDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.57.1", NULL, SU_FLAG_OK, NULL }, - /* cascadedDeviceConnected.1 = INTEGER: false(2) */ - { "unmapped.cascadedDeviceConnected", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.58.1", NULL, SU_FLAG_OK, NULL }, - /* synchronizeWithNTPServer.1 = INTEGER: false(2) */ - { "unmapped.synchronizeWithNTPServer", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.59.1", NULL, SU_FLAG_OK, NULL }, - /* useDHCPProvidedNTPServer.1 = INTEGER: true(1) */ - { "unmapped.useDHCPProvidedNTPServer", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.60.1", NULL, SU_FLAG_OK, NULL }, - /* firstNTPServerAddressType.1 = INTEGER: unknown(0) */ - { "unmapped.firstNTPServerAddressType", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.61.1", NULL, SU_FLAG_OK, NULL }, - /* firstNTPServerAddress.1 = "" */ - { "unmapped.firstNTPServerAddress", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.62.1", NULL, SU_FLAG_OK, NULL }, - /* secondNTPServerAddressType.1 = INTEGER: unknown(0) */ - { "unmapped.secondNTPServerAddressType", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.63.1", NULL, SU_FLAG_OK, NULL }, - /* secondNTPServerAddress.1 = "" */ - { "unmapped.secondNTPServerAddress", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.64.1", NULL, SU_FLAG_OK, NULL }, - /* wireCount.1 = INTEGER: 0 */ - { "unmapped.wireCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.65.1", NULL, SU_FLAG_OK, NULL }, - /* transferSwitchCount.1 = INTEGER: 0 */ - { "unmapped.transferSwitchCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.2.1.66.1", NULL, SU_FLAG_OK, NULL }, - - /* boardVersion.1.outletController.{1-6} = STRING: 60 */ - { "unmapped.boardVersion", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.3.1.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - - /* boardFirmwareVersion.1.outletController.{1-6} = STRING: 1F */ - { "unmapped.boardFirmwareVersion", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.2.3.1.6.1.3.1", NULL, SU_FLAG_OK, NULL }, - - /* boardFirmwareTimeStamp.1.mainController.1 = Gauge32: 0 */ - { "unmapped.boardFirmwareTimeStamp", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.3.1.8.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* dataLogging.1 = INTEGER: true(1) */ - { "unmapped.dataLogging", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* measurementPeriod.1 = INTEGER: 1 */ - { "unmapped.measurementPeriod", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.4.1.2.1", NULL, SU_FLAG_OK, NULL }, - /* measurementsPerLogEntry.1 = INTEGER: 60 */ - { "unmapped.measurementsPerLogEntry", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.4.1.3.1", NULL, SU_FLAG_OK, NULL }, - /* logSize.1 = INTEGER: 120 */ - { "unmapped.logSize", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.4.1.4.1", NULL, SU_FLAG_OK, NULL }, - /* dataLoggingEnableForAllSensors.1 = INTEGER: false(2) */ - { "unmapped.dataLoggingEnableForAllSensors", 0, 1, ".1.3.6.1.4.1.13742.6.3.2.4.1.5.1", NULL, SU_FLAG_OK, NULL }, - /* inletLabel.1.1 = STRING: I1 */ - { "unmapped.inletLabel", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.3.3.1.2.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletName.1.1 = STRING: */ - { "unmapped.inletName", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.3.3.1.3.1.1", NULL, SU_FLAG_OK, NULL }, - - /* inletPoleCount.1.1 = INTEGER: 2 */ - { "unmapped.inletPoleCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.3.1.5.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletRatedVoltage.1.1 = STRING: 100-120V */ - { "unmapped.inletRatedVoltage", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.3.3.1.6.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletRatedCurrent.1.1 = STRING: 16A */ - { "unmapped.inletRatedCurrent", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.3.3.1.7.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletDeviceCapabilities.1.1 = BITS: 9F 00 00 00 00 00 rmsCurrent(0) rmsVoltage(3) activePower(4) apparentPower(5) powerFactor(6) activeEnergy(7) */ - { "unmapped.inletDeviceCapabilities", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.3.1.10.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletPoleCapabilities.1.1 = BITS: 00 00 00 00 00 00 */ - { "unmapped.inletPoleCapabilities", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.3.1.11.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletPlugDescriptor.1.1 = STRING: IEC 60320 C20 */ - { "unmapped.inletPlugDescriptor", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.3.3.1.12.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.rmsCurrent = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.rmsVoltage = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.activePower = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.apparentPower = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.powerFactor = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLogAvailable.1.1.activeEnergy = INTEGER: true(1) */ - { "unmapped.inletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.4.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.rmsCurrent = INTEGER: amp(2) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.rmsVoltage = INTEGER: volt(1) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.activePower = INTEGER: watt(3) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.apparentPower = INTEGER: voltamp(4) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.powerFactor = INTEGER: none(-1) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUnits.1.1.activeEnergy = INTEGER: wattHour(5) */ - { "unmapped.inletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.6.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.rmsCurrent = Gauge32: 1 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.rmsVoltage = Gauge32: 0 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.powerFactor = Gauge32: 2 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorDecimalDigits.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.7.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.rmsCurrent = Gauge32: 100 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.rmsVoltage = Gauge32: 100 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.activePower = Gauge32: 300 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.apparentPower = Gauge32: 200 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.powerFactor = Gauge32: 500 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorAccuracy.1.1.activeEnergy = Gauge32: 100 */ - { "unmapped.inletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.8.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.rmsCurrent = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.rmsVoltage = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.activePower = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.apparentPower = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.powerFactor = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorResolution.1.1.activeEnergy = Gauge32: 1 */ - { "unmapped.inletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.9.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.rmsCurrent = Gauge32: 120 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.rmsVoltage = Gauge32: 5 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.activePower = Gauge32: 120 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.apparentPower = Gauge32: 120 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.powerFactor = Gauge32: 50 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorTolerance.1.1.activeEnergy = Gauge32: 120 */ - { "unmapped.inletSensorTolerance", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.10.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.rmsCurrent = Gauge32: 7680 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.rmsVoltage = Gauge32: 264 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.activePower = Gauge32: 202752 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.apparentPower = Gauge32: 202752 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.powerFactor = Gauge32: 100 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMaximum.1.1.activeEnergy = Gauge32: 4294967295 */ - { "unmapped.inletSensorMaximum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.11.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.rmsCurrent = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.rmsVoltage = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorMinimum.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorMinimum", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.12.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.rmsCurrent = Gauge32: 10 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.rmsVoltage = Gauge32: 2 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorHysteresis.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorHysteresis", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.13.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.rmsCurrent = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.rmsVoltage = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorStateChangeDelay.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorStateChangeDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.14.1.1.8", NULL, SU_FLAG_OK, NULL }, - -/* Inlet thresholds */ - /* inletSensorLowerCriticalThreshold.1.1.rmsCurrent = Gauge32: 0 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerCriticalThreshold.1.1.rmsVoltage = Gauge32: 94 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerCriticalThreshold.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerCriticalThreshold.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerCriticalThreshold.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerCriticalThreshold.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorLowerCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.21.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.rmsCurrent = Gauge32: 0 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.rmsVoltage = Gauge32: 97 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorLowerWarningThreshold.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorLowerWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.22.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.rmsCurrent = Gauge32: 128 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.rmsVoltage = Gauge32: 127 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperCriticalThreshold.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorUpperCriticalThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.23.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.rmsCurrent = Gauge32: 104 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.rmsVoltage = Gauge32: 124 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.activePower = Gauge32: 0 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.apparentPower = Gauge32: 0 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.powerFactor = Gauge32: 0 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorUpperWarningThreshold.1.1.activeEnergy = Gauge32: 0 */ - { "unmapped.inletSensorUpperWarningThreshold", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.24.1.1.8", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.rmsCurrent = BITS: 30 upperWarning(2) upperCritical(3) */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.1", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.rmsVoltage = BITS: F0 lowerCritical(0) lowerWarning(1) upperWarning(2) upperCritical(3) */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.4", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.activePower = BITS: 00 */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.5", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.apparentPower = BITS: 00 */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.6", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.powerFactor = BITS: 00 */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.7", NULL, SU_FLAG_OK, NULL }, - /* inletSensorEnabledThresholds.1.1.activeEnergy = BITS: 00 */ - { "unmapped.inletSensorEnabledThresholds", 0, 1, ".1.3.6.1.4.1.13742.6.3.3.4.1.25.1.1.8", NULL, SU_FLAG_OK, NULL }, - - /* outletPoleCount.1.{1-24} = INTEGER: 2 */ - { "unmapped.outletPoleCount", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.5.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletRatedVoltage.1.{1-24} = STRING: 100-120V */ - { "unmapped.outletRatedVoltage", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.5.3.1.6.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletRatedCurrent.1.{1-24} = STRING: 16A */ - { "unmapped.outletRatedCurrent", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.5.3.1.7.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletDeviceCapabilities.1.{1-24} = BITS: 9F 04 00 00 00 00 rmsCurrent(0) rmsVoltage(3) activePower(4) apparentPower(5) powerFactor(6) activeEnergy(7) onOff(13) */ - { "unmapped.outletDeviceCapabilities", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.10.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletPowerCyclingPowerOffPeriod.1.{1-24} = Gauge32: 10 */ - { "unmapped.outletPowerCyclingPowerOffPeriod", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.12.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletStateOnStartup.1.{1-24} = INTEGER: globalOutletStateOnStartup(3) */ - { "unmapped.outletStateOnStartup", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.13.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletUseGlobalPowerCyclingPowerOffPeriod.1.{1-24} = INTEGER: true(1) */ - { "unmapped.outletUseGlobalPowerCyclingPowerOffPeriod", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.14.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletReceptacleDescriptor.1.{1-24} = STRING: NEMA 5-20R */ - { "unmapped.outletReceptacleDescriptor", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.13742.6.3.5.3.1.29.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletNonCritical.1.{1-24} = INTEGER: false(2) */ - { "unmapped.outletNonCritical", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.30.1.1", NULL, SU_FLAG_OK, NULL }, - - /* outletSequenceDelay.1.{1-24} = Gauge32: 0 */ - { "unmapped.outletSequenceDelay", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.3.1.32.1.%i", NULL, SU_FLAG_OK, NULL }, - - /* outletSensorLogAvailable.1.{1-24}.rmsCurrent = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.1", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.rmsVoltage = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.4", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.activePower = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.5", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.apparentPower = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.6", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.powerFactor = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.7", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.activeEnergy = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.8", NULL, SU_FLAG_OK, NULL }, - /* outletSensorLogAvailable.1.{1-24}.onOff = INTEGER: true(1) */ - { "unmapped.outletSensorLogAvailable", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.4.1.%i.14", NULL, SU_FLAG_OK, NULL }, - - /* outletSensorUnits.1.{1-24}.rmsCurrent = INTEGER: amp(2) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.1", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.rmsVoltage = INTEGER: volt(1) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.4", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.activePower = INTEGER: watt(3) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.5", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.apparentPower = INTEGER: voltamp(4) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.6", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.powerFactor = INTEGER: none(-1) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.7", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.activeEnergy = INTEGER: wattHour(5) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.8", NULL, SU_FLAG_OK, NULL }, - /* outletSensorUnits.1.{1-24}.onOff = INTEGER: none(-1) */ - { "unmapped.outletSensorUnits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.6.1.%i.14", NULL, SU_FLAG_OK, NULL }, - - /* outletSensorDecimalDigits.1.{1-24}.rmsCurrent = Gauge32: 1 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.1", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.rmsVoltage = Gauge32: 0 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.4", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.activePower = Gauge32: 0 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.5", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.apparentPower = Gauge32: 0 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.6", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.powerFactor = Gauge32: 2 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.7", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.activeEnergy = Gauge32: 0 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.8", NULL, SU_FLAG_OK, NULL }, - /* outletSensorDecimalDigits.1.{1-24}.onOff = Gauge32: 0 */ - { "unmapped.outletSensorDecimalDigits", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.7.1.%i.14", NULL, SU_FLAG_OK, NULL }, - - /* outletSensorAccuracy.1.{1-24}.rmsCurrent = Gauge32: 100 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.1", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.rmsVoltage = Gauge32: 100 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.4", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.activePower = Gauge32: 300 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.5", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.apparentPower = Gauge32: 200 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.6", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.powerFactor = Gauge32: 100 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.7", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.activeEnergy = Gauge32: 100 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.8", NULL, SU_FLAG_OK, NULL }, - /* outletSensorAccuracy.1.{1-24}.onOff = Gauge32: 0 */ - { "unmapped.outletSensorAccuracy", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.8.1.%i.14", NULL, SU_FLAG_OK, NULL }, - - /* outletSensorResolution.1.{1-24}.rmsCurrent = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.1", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.rmsVoltage = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.4", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.activePower = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.5", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.apparentPower = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.6", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.powerFactor = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.7", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.activeEnergy = Gauge32: 1 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.8", NULL, SU_FLAG_OK, NULL }, - /* outletSensorResolution.1.{1-24}.onOff = Gauge32: 0 */ - { "unmapped.outletSensorResolution", 0, 1, ".1.3.6.1.4.1.13742.6.3.5.4.1.9.1.%i.14", NULL, SU_FLAG_OK, NULL }, - - /* end of interesting data - * the rest is 18MB of verbose log and satellite data */ - - /* Note: All reliabilityXXX data were removed */ -#endif /* DEBUG */ - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t raritan_px2 = { "raritan-px2", RARITAN_PX2_MIB_VERSION, NULL, RARITAN_PX2_OID_MODEL_NAME, raritan_px2_mib, RARITAN_PX2_MIB_SYSOID, NULL }; diff --git a/drivers/raritan-px2-mib.h b/drivers/raritan-px2-mib.h deleted file mode 100644 index 5402bd8..0000000 --- a/drivers/raritan-px2-mib.h +++ /dev/null @@ -1,30 +0,0 @@ -/* raritan-px2-mib.h - subdriver to monitor RARITAN PX2 SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * 2016 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef RARITAN_PX2_MIB_H -#define RARITAN_PX2_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t raritan_px2; - -#endif /* RARITAN_PX2_MIB_H */ diff --git a/drivers/rhino.c b/drivers/rhino.c index c99770d..c43c411 100644 --- a/drivers/rhino.c +++ b/drivers/rhino.c @@ -22,22 +22,20 @@ 2005/10/26 - Version 0.40 - Operational-2 release 2005/11/29 - Version 0.50 - rhino commands release - + http://www.microsol.com.br */ -#include "config.h" /* must be the first header */ - #include +#include #include "main.h" #include "serial.h" -#include "nut_float.h" #include "timehead.h" #define DRIVER_NAME "Microsol Rhino UPS driver" -#define DRIVER_VERSION "0.52" +#define DRIVER_VERSION "0.51" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -131,10 +129,10 @@ static unsigned char EventosRede, EventosSaida, EventosBateria; /* Methods */ static void ScanReceivePack(void); static int AutonomyCalc( int ); -static void CommReceive(const unsigned char*, ssize_t); +static void CommReceive(const unsigned char*, int ); static void getbaseinfo(void); static void getupdateinfo(void); - + static unsigned char RecPack[37]; /* comment on english language */ @@ -162,327 +160,327 @@ static unsigned char RecPack[37]; static int AutonomyCalc( int ia ) /* all models */ { - int result = 0; - double auton, calc, currin; - if( ia ) + int result = 0; + double auton, calc, currin; + + if( ia ) + { + if( ( BattVoltage == 0 ) ) + result = 0; + else { - if( d_equal(BattVoltage, 0) ) - result = 0; - else - { - calc = ( OutVoltage * OutCurrent )* 1.0 / ( 0.08 * BattVoltage ); - auton = pow( calc, 1.18 ); - if( d_equal(auton, 0) ) - result = 0; - else - { - auton = 1.0 / auton; - auton = auton * 11.07; - calc = ( BattVoltage * 1.0 / 10 ) - 168; - result = (int) ( auton * calc * 2.5 ); - } - } - } - else - { - currin = ( UtilPowerOut + ConstInt ) *1.0 / Vin; - auton = ( ( ( AmpH *1.0 / currin ) * 60 * ( ( BattVoltage - VbatMin ) * 1.0 /( VbatNom - VbatMin ) ) * FM ) + FA ); - if( ( BattVoltage > 129 ) && ( BattVoltage < 144 ) ) - result = 133; - else - result = (int) auton; - } + calc = ( OutVoltage * OutCurrent )* 1.0 / ( 0.08 * BattVoltage ); + auton = pow( calc, 1.18 ); + if( ( auton == 0 ) ) + result = 0; + else + { + auton = 1.0 / auton; + auton = auton * 11.07; + calc = ( BattVoltage * 1.0 / 10 ) - 168; + result = (int) ( auton * calc * 2.5 ); + } + } + } + else + { + currin = ( UtilPowerOut + ConstInt ) *1.0 / Vin; + auton = ( ( ( AmpH *1.0 / currin ) * 60 * ( ( BattVoltage - VbatMin ) * 1.0 /( VbatNom - VbatMin ) ) * FM ) + FA ); + if( ( BattVoltage > 129 ) || ( BattVoltage < 144 ) ) + result = 133; + else + result = (int) auton; + } + + return result; - return result; } /* Treat received package */ static void ScanReceivePack( void ) { - /* model independent data */ - Year = RecPack[31] + ( RecPack[32] * 100 ); - Month = RecPack[30]; - Day = RecPack[29]; + /* model independent data */ - /* UPS internal time */ - ihour = RecPack[26]; - imin = RecPack[27]; - isec = RecPack[28]; + Year = RecPack[31] + ( RecPack[32] * 100 ); + Month = RecPack[30]; + Day = RecPack[29]; - /* Flag1 */ - /* SobreTemp = ( ( 0x01 & RecPack[33]) = 0x01 ); */ - /* OutputOn = ( ( 0x02 & RecPack[33]) = 0x02 ); OutputOn */ - /* InputOn = ( ( 0x04 & RecPack[33]) = 0x04 ); InputOn */ - /* ByPassOn = ( ( 0x08 & RecPack[33]) = 0x08 ); BypassOn */ - /* Auto_HAB = ( ( 0x10 & RecPack[33]) = 0x10 ); */ - /* Timer_HAB = ( ( 0x20 & RecPack[33]) = 0x20 ); */ - /* Boost_Ligado = ( ( 0x40 & RecPack[33]) = 0x40 ); */ - /* Bateria_Desc = ( ( 0x80 & RecPack[33]) = 0x80 ); */ + /* UPS internal time */ + ihour = RecPack[26]; + imin = RecPack[27]; + isec = RecPack[28]; - /* Flag2 */ - /* Quad_Ant_Ent = ( ( 0x01 & RecPack[34]) = 0x01 ); */ - /* Quadratura = ( ( 0x02 & RecPack[34]) = 0x02 ); */ - /* Termino_XMODEM = ( ( 0x04 & RecPack[34]) = 0x04 ); */ - /* Em_Sincronismo = ( ( 0x08 & RecPack[34]) = 0x08 ); */ - /* Out110 = ( ( 0x10 & RecPack[34]) = 0x10 ); Out110 */ - /* Exec_Beep = ( ( 0x20 & RecPack[34]) = 0x20 ); */ - /* LowBatt = ( ( 0x40 & RecPack[34]) = 0x40 ); LowBatt */ - /* Boost_Sobre = ( ( 0x80 & RecPack[34]) = 0x80 ); */ + /* Flag1 */ + /* SobreTemp = ( ( 0x01 & RecPack[33]) = 0x01 ); */ + /* OutputOn = ( ( 0x02 & RecPack[33]) = 0x02 ); OutputOn */ + /* InputOn = ( ( 0x04 & RecPack[33]) = 0x04 ); InputOn */ + /* ByPassOn = ( ( 0x08 & RecPack[33]) = 0x08 ); BypassOn */ + /* Auto_HAB = ( ( 0x10 & RecPack[33]) = 0x10 ); */ + /* Timer_HAB = ( ( 0x20 & RecPack[33]) = 0x20 ); */ + /* Boost_Ligado = ( ( 0x40 & RecPack[33]) = 0x40 ); */ + /* Bateria_Desc = ( ( 0x80 & RecPack[33]) = 0x80 ); */ - /* Flag3 */ - /* OverCharge = ( ( 0x01 & RecPack[35]) = 0x01 ); OverCharge */ - /* SourceFail = ( ( 0x02 & RecPack[35]) = 0x02 ); SourceFail */ - /* RedeAnterior = ( ( 0x04 & RecPack[35]) = 0x04 ); */ - /* Cmd_Executado = ( ( 0x08 & RecPack[35]) = 0x08 ); */ - /* Exec_Autoteste = ( ( 0x10 & RecPack[35]) = 0x10 ); */ - /* Quad_Ant_Sai = ( ( 0x20 & RecPack[35]) = 0x20 ); */ - /* ComandoSerial = ( ( 0x40 & RecPack[35]) = 0x40 ); */ - /* SobreTensao = ( ( 0x80 & RecPack[35]) = 0x80 ); */ + /* Flag2 */ + /* Quad_Ant_Ent = ( ( 0x01 & RecPack[34]) = 0x01 ); */ + /* Quadratura = ( ( 0x02 & RecPack[34]) = 0x02 ); */ + /* Termino_XMODEM = ( ( 0x04 & RecPack[34]) = 0x04 ); */ + /* Em_Sincronismo = ( ( 0x08 & RecPack[34]) = 0x08 ); */ + /* Out110 = ( ( 0x10 & RecPack[34]) = 0x10 ); Out110 */ + /* Exec_Beep = ( ( 0x20 & RecPack[34]) = 0x20 ); */ + /* LowBatt = ( ( 0x40 & RecPack[34]) = 0x40 ); LowBatt */ + /* Boost_Sobre = ( ( 0x80 & RecPack[34]) = 0x80 ); */ - OutputOn = ( ( 0x02 & RecPack[33] ) == 0x02 ); - InputOn = ( ( 0x04 & RecPack[33] ) == 0x04 ); - BypassOn = ( ( 0x08 & RecPack[33] ) == 0x08 ); + /* Flag3 */ + /* OverCharge = ( ( 0x01 & RecPack[35]) = 0x01 ); OverCharge */ + /* SourceFail = ( ( 0x02 & RecPack[35]) = 0x02 ); SourceFail */ + /* RedeAnterior = ( ( 0x04 & RecPack[35]) = 0x04 ); */ + /* Cmd_Executado = ( ( 0x08 & RecPack[35]) = 0x08 ); */ + /* Exec_Autoteste = ( ( 0x10 & RecPack[35]) = 0x10 ); */ + /* Quad_Ant_Sai = ( ( 0x20 & RecPack[35]) = 0x20 ); */ + /* ComandoSerial = ( ( 0x40 & RecPack[35]) = 0x40 ); */ + /* SobreTensao = ( ( 0x80 & RecPack[35]) = 0x80 ); */ - Out110 = ( ( 0x10 & RecPack[34] ) == 0x10 ); - LowBatt = ( ( 0x40 & RecPack[34] ) == 0x40 ); + OutputOn = ( ( 0x02 & RecPack[33] ) == 0x02 ); + InputOn = ( ( 0x04 & RecPack[33] ) == 0x04 ); + BypassOn = ( ( 0x08 & RecPack[33] ) == 0x08 ); - OverCharge = ( ( 0x01 & RecPack[35] ) == 0x01 ); - SourceFail = ( ( 0x02 & RecPack[35] ) == 0x02 ); + Out110 = ( ( 0x10 & RecPack[34] ) == 0x10 ); + LowBatt = ( ( 0x40 & RecPack[34] ) == 0x40 ); - /* model dependent data read */ + OverCharge = ( ( 0x01 & RecPack[35] ) == 0x01 ); + SourceFail = ( ( 0x02 & RecPack[35] ) == 0x02 ); - PowerFactor = 800; + /* model dependent data read */ + + PowerFactor = 800; + + if( RecPack[0] ==0xC2 ) + { + LimInfBattSrc = 174; + LimSupBattSrc = 192;/* 180????? carregador eh 180 (SCOPOS) */ + LimInfBattInv = 174; + LimSupBattInv = 192;/* 170????? (SCOPOS) */ + } + else + { + LimInfBattSrc = 138; + LimSupBattSrc = 162;/* 180????? carregador eh 180 (SCOPOS) */ + LimInfBattInv = 126; + LimSupBattInv = 156;/* 170????? (SCOPOS) */ + } + + BattNonValue = 144; + /* VersaoInterna = "R10" + IntToStr( RecPack[1] ); */ + InVoltage = RecPack[2]; + InCurrent = RecPack[3]; + UtilPowerIn = RecPack[4] + RecPack[5] * 256; + AppPowerIn = RecPack[6] + RecPack[7] * 256; + FatorPotEntrada = RecPack[8]; + InFreq = ( RecPack[9] + RecPack[10] * 256 ) * 1.0 / 10; + OutVoltage = RecPack[11]; + OutCurrent = RecPack[12]; + UtilPowerOut = RecPack[13] + RecPack[14] * 256; + AppPowerOut = RecPack[15] + RecPack[16] * 256; + FatorPotSaida = RecPack[17]; + OutFreq = ( RecPack[18] + RecPack[19] * 256 ) * 1.0 / 10; + BattVoltage = RecPack[20]; + BoostVolt = RecPack[21] + RecPack[22] * 256; + Temperature = ( 0x7F & RecPack[23] ); + Rendimento = RecPack[24]; - if( RecPack[0] == 0xC2 ) - { - LimInfBattSrc = 174; - LimSupBattSrc = 192;/* 180????? carregador eh 180 (SCOPOS) */ - LimInfBattInv = 174; - LimSupBattInv = 192;/* 170????? (SCOPOS) */ - } - else - { - LimInfBattSrc = 138; - LimSupBattSrc = 162;/* 180????? carregador eh 180 (SCOPOS) */ - LimInfBattInv = 126; - LimSupBattInv = 156;/* 170????? (SCOPOS) */ - } + /* model independent data */ + + if( ( BattVoltage < LimInfBattInv ) ) + CriticBatt = true; + + if( BypassOn ) + OutVoltage = ( InVoltage * 1.0 / 2 ) + 5; + + if( SourceFail && RedeAnterior ) /* falha pela primeira vez */ + OcorrenciaDeFalha = true; + + if( !( SourceFail ) && !( RedeAnterior ) ) /* retorno da rede */ + RetornoDaRede = true; + + if( !( SourceFail ) == RedeAnterior ) + { + RetornoDaRede = false; + OcorrenciaDeFalha = false; + } + + RedeAnterior = !( SourceFail ); + + LimInfSaida = 75; + LimSupSaida = 150; + ValorNominalSaida = 110; + + LimInfEntrada = 190; + LimSupEntrada = 250; + ValorNominalEntrada = 220; + + if( SourceFail ) + { + StatusEntrada = 2; + RecPack[8] = 200; /* ?????????????????????????????????? */ + } + else + { + StatusEntrada = 1; + RecPack[8] = 99; /* ??????????????????????????????????? */ + } + + if( OutputOn ) /* Output Status */ + StatusSaida = 2; + else + StatusSaida = 1; + + if( OverCharge ) + StatusSaida = 3; + + if( CriticBatt ) /* Battery Status */ + StatusBateria = 4; + else + StatusBateria = 1; + + EventosRede = 0; + + if( OcorrenciaDeFalha ) + EventosRede = 1; + + if( RetornoDaRede ) + EventosRede = 2; + + /* verify InversorOn */ + if( Flag_inversor ) + { + oldInversorOn = InputOn; + Flag_inversor = false; + } - BattNonValue = 144; - /* VersaoInterna = "R10" + IntToStr( RecPack[1] ); */ - InVoltage = RecPack[2]; - InCurrent = RecPack[3]; - UtilPowerIn = RecPack[4] + RecPack[5] * 256; - AppPowerIn = RecPack[6] + RecPack[7] * 256; - FatorPotEntrada = RecPack[8]; - InFreq = ( RecPack[9] + RecPack[10] * 256 ) * 1.0 / 10; - OutVoltage = RecPack[11]; - OutCurrent = RecPack[12]; - UtilPowerOut = RecPack[13] + RecPack[14] * 256; - AppPowerOut = RecPack[15] + RecPack[16] * 256; - FatorPotSaida = RecPack[17]; - OutFreq = ( RecPack[18] + RecPack[19] * 256 ) * 1.0 / 10; - BattVoltage = RecPack[20]; - BoostVolt = RecPack[21] + RecPack[22] * 256; - Temperature = ( 0x7F & RecPack[23] ); - Rendimento = RecPack[24]; + EventosSaida = 0; + if( InputOn && !( oldInversorOn ) ) + EventosSaida = 26; + if( oldInversorOn && !( InputOn ) ) + EventosSaida = 27; + oldInversorOn = InputOn; + if( SuperAquecimento && !( SuperAquecimentoAnterior ) ) + EventosSaida = 12; + if( SuperAquecimentoAnterior && !( SuperAquecimento ) ) + EventosSaida = 13; + SuperAquecimentoAnterior = SuperAquecimento; + EventosBateria = 0; + OldCritBatt = CriticBatt; - /* model independent data */ + if( OverCharge && !( OldOverCharge ) ) + EventosSaida = 10; + if( OldOverCharge && !( OverCharge ) ) + EventosSaida = 11; + OldOverCharge = OverCharge; - if( ( BattVoltage < LimInfBattInv ) ) - CriticBatt = true; + /* autonomy calc. */ + if( RecPack[ 0 ] ==0xC2 ) + Autonomy = AutonomyCalc( 1 ); + else + Autonomy = AutonomyCalc( 0 ); - if( BypassOn ) - OutVoltage = ( InVoltage * 1.0 / 2 ) + 5; - - if( SourceFail && RedeAnterior ) /* falha pela primeira vez */ - OcorrenciaDeFalha = true; - - if( !( SourceFail ) && !( RedeAnterior ) ) /* retorno da rede */ - RetornoDaRede = true; - - if( RedeAnterior == !( SourceFail ) ) - { - RetornoDaRede = false; - OcorrenciaDeFalha = false; - } - - RedeAnterior = !( SourceFail ); - - LimInfSaida = 75; - LimSupSaida = 150; - ValorNominalSaida = 110; - - LimInfEntrada = 190; - LimSupEntrada = 250; - ValorNominalEntrada = 220; - - if( SourceFail ) - { - StatusEntrada = 2; - RecPack[8] = 200; /* ?????????????????????????????????? */ - } - else - { - StatusEntrada = 1; - RecPack[8] = 99; /* ??????????????????????????????????? */ - } - - if( OutputOn ) /* Output Status */ - StatusSaida = 2; - else - StatusSaida = 1; - - if( OverCharge ) - StatusSaida = 3; - - if( CriticBatt ) /* Battery Status */ - StatusBateria = 4; - else - StatusBateria = 1; - - EventosRede = 0; - - if( OcorrenciaDeFalha ) - EventosRede = 1; - - if( RetornoDaRede ) - EventosRede = 2; - - /* verify InversorOn */ - if( Flag_inversor ) - { - oldInversorOn = InputOn; - Flag_inversor = false; - } - - EventosSaida = 0; - if( InputOn && !( oldInversorOn ) ) - EventosSaida = 26; - if( oldInversorOn && !( InputOn ) ) - EventosSaida = 27; - oldInversorOn = InputOn; - if( SuperAquecimento && !( SuperAquecimentoAnterior ) ) - EventosSaida = 12; - if( SuperAquecimentoAnterior && !( SuperAquecimento ) ) - EventosSaida = 13; - SuperAquecimentoAnterior = SuperAquecimento; - EventosBateria = 0; - OldCritBatt = CriticBatt; - - if( OverCharge && !( OldOverCharge ) ) - EventosSaida = 10; - if( OldOverCharge && !( OverCharge ) ) - EventosSaida = 11; - OldOverCharge = OverCharge; - - /* autonomy calc. */ - if( RecPack[ 0 ] == 0xC2 ) - Autonomy = AutonomyCalc( 1 ); - else - Autonomy = AutonomyCalc( 0 ); } static void -CommReceive(const unsigned char *bufptr, ssize_t size) +CommReceive(const unsigned char *bufptr, int size) { - int i, i_end, CheckSum, chk; - if( size == 37 ) - Waiting = 0; + int i, i_end, CheckSum, chk; + + if( ( size==37 ) ) + Waiting = 0; + + printf("CommReceive size = %d waiting = %d\n", size, Waiting ); - printf("CommReceive size = %zd waiting = %d\n", size, Waiting ); + switch( Waiting ) + { + /* normal package */ + case 0: + { + if( size == 37 ) + { + i_end = 37; + for( i = 0 ; i < i_end ; ++i ) + { + RecPack[i] = *bufptr; + bufptr++; + } + + /* CheckSum verify */ + CheckSum = 0; + i_end = 36; + for( i = 0 ; i < i_end ; ++i ) + { + chk = RecPack[ i ]; + CheckSum = CheckSum + chk; + } - switch( Waiting ) - { - /* normal package */ - case 0: - { - if( size == 37 ) - { - i_end = 37; - for( i = 0 ; i < i_end ; ++i ) - { - RecPack[i] = *bufptr; - bufptr++; - } + CheckSum = CheckSum % 256; - /* CheckSum verify */ - CheckSum = 0; - i_end = 36; - for( i = 0 ; i < i_end ; ++i ) - { - chk = RecPack[ i ]; - CheckSum = CheckSum + chk; - } + ser_flush_in(upsfd,"",0); /* clean port */ - CheckSum = CheckSum % 256; + /* correct package */ + if( ( RecPack[0] == 0xC0 || RecPack[0] == 0xC1 || RecPack[0] == 0xC2 || RecPack[0] == 0xC3 ) + && ( RecPack[ 36 ] == CheckSum ) ) + { - ser_flush_in(upsfd,"",0); /* clean port */ + if(!(detected)) + { + RhinoModel = RecPack[0]; + detected = true; + } - /* correct package */ - if( ( RecPack[0] == 0xC0 || RecPack[0] == 0xC1 || RecPack[0] == 0xC2 || RecPack[0] == 0xC3 ) - && ( RecPack[ 36 ] == CheckSum ) ) - { + switch( RhinoModel ) + { + case 0xC0: + case 0xC1: + case 0xC2: + case 0xC3: + { + ScanReceivePack(); + break; + } + default: + { + printf( M_UNKN ); + break; + } + } + } - if(!(detected)) - { - RhinoModel = RecPack[0]; - detected = true; - } + } + + break; + } + + case 1: + { + /* dumping package, nothing to do yet */ + Waiting = 0; + break; + } - switch( RhinoModel ) - { - case 0xC0: - case 0xC1: - case 0xC2: - case 0xC3: - { - ScanReceivePack(); - break; - } - default: - { - printf( M_UNKN ); - break; - } - } - } - } + } - break; - } + Waiting =0; - case 1: - { - /* dumping package, nothing to do yet */ - Waiting = 0; - break; - } - - } - - Waiting = 0; } -static ssize_t -send_command( unsigned char cmd ) +static int +send_command( int cmd ) { - static const size_t sizes = 19, iend = 18; - size_t i, kount; /*, j, uc; */ - unsigned char chk, checksum = 0; - ssize_t ret = -1; - unsigned char ch, *psend = NULL; - if ( !(psend = xmalloc(sizeof(char) * sizes)) ) { - upslogx(LOG_ERR, "send_command() failed to allocate buffer"); - return -1; - } - - /* mounting buffer to send */ + int i, chk, checksum = 0, iend = 18, sizes = 19, ret, kount; /*, j, uc; */ + unsigned char ch, psend[sizes]; + + /* mounting buffer to send */ for(i = 0; i < iend; i++ ) { @@ -490,7 +488,7 @@ send_command( unsigned char cmd ) chk = 0x01; else { - if( i == 1 ) + if( i == 1) chk = cmd; else chk = 0x00; /* 0x20; */ @@ -498,12 +496,12 @@ send_command( unsigned char cmd ) ch = chk; psend[i] = ch; /* psend[0 - 17] */ - if( i > 0 ) /* psend[0] not computed */ + if( i > 0 ) /* psend[0] not computed */ checksum = checksum + chk; } ch = checksum; - ch = (~( ch) ); /* not ch */ + ch = (~( ch) ); /* not ch */ psend[iend] = ch; /* send five times the command */ @@ -520,101 +518,98 @@ send_command( unsigned char cmd ) usleep( UPSDELAY ); /* delay between sent command */ kount++; } - - free (psend); return ret; } static void sendshut( void ) { + int i; for(i=0; i < 30000; i++) - usleep( UPSDELAY ); /* 15 seconds delay */ + usleep( UPSDELAY ); /* 15 seconds delay */ - if ( send_command( CMD_SHUT ) < 1 ) - upslogx(LOG_ERR, "Ups shutdown command sending failed"); - else - upslogx(LOG_NOTICE, "Ups shutdown command sent"); + send_command( CMD_SHUT ); + upslogx(LOG_NOTICE, "Ups shutdown command sent"); printf("Ups shutdown command sent\n"); + } static void getbaseinfo(void) { - unsigned char temp[256]; + unsigned char temp[256]; unsigned char Pacote[37]; - ssize_t tam, i, j=0; + int tam, i, j=0; time_t tmt; struct tm *now; - struct tm tmbuf; const char *Model; time( &tmt ); - now = localtime_r( &tmt, &tmbuf ); + now = localtime( &tmt ); dian = now->tm_mday; mesn = now->tm_mon+1; anon = now->tm_year+1900; - weekn = now->tm_wday; + weekn = now->tm_wday; /* trying detect rhino model */ while ( ( !detected ) && ( j < 10 ) ) - { + { - temp[0] = 0; /* flush temp buffer */ - tam = ser_get_buf_len(upsfd, temp, pacsize, 3, 0); - if( tam == 37 ) - { - for( i = 0 ; i < tam ; i++ ) - { - Pacote[i] = temp[i]; - } - } + temp[0] = 0; /* flush temp buffer */ + tam = ser_get_buf_len(upsfd, temp, pacsize, 3, 0); + if( tam == 37 ) + { + for( i = 0 ; i < tam ; i++ ) + { + Pacote[i] = temp[i]; + } + } - j++; - if( tam == 37) - CommReceive(Pacote, tam); - else - CommReceive(temp, tam); - } + j++; + if( tam == 37) + CommReceive(Pacote, tam); + else + CommReceive(temp, tam); + } if( (!detected) ) - { - fatalx(EXIT_FAILURE, NO_RHINO ); - } + { + fatalx(EXIT_FAILURE, NO_RHINO ); + } switch( RhinoModel ) - { - case 0xC0: - { - Model = "Rhino 20.0 kVA"; - PotenciaNominal = 20000; - break; - } - case 0xC1: - { - Model = "Rhino 10.0 kVA"; - PotenciaNominal = 10000; - break; - } - case 0xC2: - { - Model = "Rhino 6.0 kVA"; - PotenciaNominal = 6000; - break; - } - case 0xC3: - { - Model = "Rhino 7.5 kVA"; - PotenciaNominal = 7500; - break; - } - default: - { - Model = "Rhino unknown model"; - PotenciaNominal = 0; - break; - } - } + { + case 0xC0: + { + Model = "Rhino 20.0 kVA"; + PotenciaNominal = 20000; + break; + } + case 0xC1: + { + Model = "Rhino 10.0 kVA"; + PotenciaNominal = 10000; + break; + } + case 0xC2: + { + Model = "Rhino 6.0 kVA"; + PotenciaNominal = 6000; + break; + } + case 0xC3: + { + Model = "Rhino 7.5 kVA"; + PotenciaNominal = 7500; + break; + } + default: + { + Model = "Rhino unknown model"; + PotenciaNominal = 0; + break; + } + } /* manufacturer and model */ dstate_setinfo("ups.mfr", "%s", "Microsol"); @@ -634,12 +629,13 @@ static void getbaseinfo(void) dstate_addcmd("bypass.stop"); /* CMD_PASSOFF = 6 */ printf("Detected %s on %s\n", dstate_getinfo("ups.model"), device_path); + } static void getupdateinfo(void) { - unsigned char temp[256]; - ssize_t tam; + unsigned char temp[256]; + int tam; temp[0] = 0; /* flush temp buffer */ tam = ser_get_buf_len(upsfd, temp, pacsize, 3, 0); @@ -650,54 +646,57 @@ static void getupdateinfo(void) static int instcmd(const char *cmdname, const char *extra) { - ssize_t ret = 0; + int ret = 0; + if (!strcasecmp(cmdname, "shutdown.stayoff")) - { - /* shutdown now (one way) */ - /* send_command( CMD_SHUT ); */ - sendshut(); - return STAT_INSTCMD_HANDLED; - } + { + /* shutdown now (one way) */ + /* send_command( CMD_SHUT ); */ + sendshut(); + return STAT_INSTCMD_HANDLED; + } if (!strcasecmp(cmdname, "load.on")) - { - /* liga Saida */ - ret = send_command( 3 ); - if ( ret < 1 ) - upslogx(LOG_ERR, "send_command 3 failed"); - return STAT_INSTCMD_HANDLED; - } + { + /* liga Saida */ + ret = send_command( 3 ); + if ( ret < 1 ) + upslogx(LOG_ERR, "send_command 3 failed"); + return STAT_INSTCMD_HANDLED; + } if (!strcasecmp(cmdname, "load.off")) - { - /* desliga Saida */ - ret = send_command( 4 ); - if ( ret < 1 ) - upslogx(LOG_ERR, "send_command 4 failed"); - return STAT_INSTCMD_HANDLED; - } + { + /* desliga Saida */ + ret = send_command( 4 ); + if ( ret < 1 ) + upslogx(LOG_ERR, "send_command 4 failed"); + return STAT_INSTCMD_HANDLED; + } if (!strcasecmp(cmdname, "bypass.start")) - { - /* liga Bypass */ - ret = send_command( 5 ); - if ( ret < 1 ) - upslogx(LOG_ERR, "send_command 5 failed"); - return STAT_INSTCMD_HANDLED; - } + { + /* liga Bypass */ + ret = send_command( 5 ); + if ( ret < 1 ) + upslogx(LOG_ERR, "send_command 5 failed"); + return STAT_INSTCMD_HANDLED; + } if (!strcasecmp(cmdname, "bypass.stop")) - { - /* desliga Bypass */ - ret = send_command( 6 ); - if ( ret < 1 ) - upslogx(LOG_ERR, "send_command 6 failed"); - return STAT_INSTCMD_HANDLED; - } + { + /* desliga Bypass */ + ret = send_command( 6 ); + if ( ret < 1 ) + upslogx(LOG_ERR, "send_command 6 failed"); + return STAT_INSTCMD_HANDLED; + } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; + } void upsdrv_initinfo(void) @@ -709,7 +708,8 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { - getupdateinfo(); /* new package for updates */ + + getupdateinfo(); /* new package for updates */ dstate_setinfo("output.voltage", "%03.1f", OutVoltage); dstate_setinfo("input.voltage", "%03.1f", InVoltage); @@ -717,51 +717,51 @@ void upsdrv_updateinfo(void) /* output and bypass tests */ if( OutputOn ) - dstate_setinfo("outlet.switchable", "%s", "yes"); + dstate_setinfo("outlet.switchable", "%s", "yes"); else - dstate_setinfo("outlet.switchable", "%s", "no"); + dstate_setinfo("outlet.switchable", "%s", "no"); if( BypassOn ) - dstate_setinfo("outlet.1.switchable", "%s", "yes"); + dstate_setinfo("outlet.1.switchable", "%s", "yes"); else - dstate_setinfo("outlet.1.switchable", "%s", "no"); + dstate_setinfo("outlet.1.switchable", "%s", "no"); status_init(); if (!SourceFail ) - status_set("OL"); /* on line */ + status_set("OL"); /* on line */ else - status_set("OB"); /* on battery */ - + status_set("OB"); /* on battery */ + if (Autonomy < 5 ) - status_set("LB"); /* low battery */ - + status_set("LB"); /* low battery */ + status_commit(); dstate_setinfo("ups.temperature", "%2.2f", Temperature); dstate_setinfo("input.frequency", "%2.1f", InFreq); dstate_dataok(); + } /* power down the attached load immediately */ void upsdrv_shutdown(void) { + /* basic idea: find out line status and send appropriate command */ /* on line: send normal shutdown, ups will return by itself on utility */ /* on battery: send shutdown+return, ups will cycle and return soon */ if (!SourceFail) /* on line */ - { - /* FIXME: Both legs of the if-clause send CMD_SHUT, where is the "forcing"? */ - printf("On line, forcing shutdown command...\n"); - /* send_command( CMD_SHUT ); */ - sendshut(); - } + { + printf("On line, forcing shutdown command...\n"); + send_command( CMD_SHUT ); + } else - { - printf("On battery, sending normal shutdown command...\n"); - /* send_command( CMD_SHUT ); */ - sendshut(); - } + { + printf("On battery, sending normal shutdown command...\n"); + send_command( CMD_SHUT ); + } + } void upsdrv_help(void) @@ -770,7 +770,9 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { + addvar(VAR_VALUE, "battext", "Battery Extension (0-80)min"); + } void upsdrv_initups(void) @@ -781,6 +783,7 @@ void upsdrv_initups(void) /* dtr and rts setting */ ser_set_dtr(upsfd, 1); ser_set_rts(upsfd, 0); + } void upsdrv_cleanup(void) diff --git a/drivers/richcomm_usb.c b/drivers/richcomm_usb.c index f8da32e..0b9b8f2 100644 --- a/drivers/richcomm_usb.c +++ b/drivers/richcomm_usb.c @@ -6,7 +6,6 @@ * * Copyright (C) 2007 Peter van Valderen * Dirk Teurlings - * Copyright (C) 2016 Eaton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,11 +24,10 @@ #include "main.h" #include "usb-common.h" -#include "nut_stdint.h" /* driver version */ #define DRIVER_NAME "Richcomm dry-contact to USB driver" -#define DRIVER_VERSION "0.10" +#define DRIVER_VERSION "0.04" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -57,8 +55,8 @@ static usb_device_id_t richcomm_usb_id[] = { /* Sweex 1000VA */ { USB_DEVICE(0x0925, 0x1234), NULL }, - /* Terminating entry */ - { 0, 0, NULL } + /* end of list */ + {-1, -1, NULL} }; static usb_dev_handle *udev = NULL; @@ -67,8 +65,6 @@ static unsigned int comm_failures = 0; static int device_match_func(USBDevice_t *device, void *privdata) { - NUT_UNUSED_VARIABLE(privdata); - switch (is_usb_device_supported(richcomm_usb_id, device)) { case SUPPORTED: @@ -87,79 +83,30 @@ static USBDeviceMatcher_t device_matcher = { NULL }; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif static int execute_and_retrieve_query(char *query, char *reply) { int ret; ret = usb_control_msg(udev, STATUS_REQUESTTYPE, REQUEST_VALUE, - MESSAGE_VALUE, INDEX_VALUE, - (usb_ctrl_charbuf)query, QUERY_PACKETSIZE, 1000); + MESSAGE_VALUE, INDEX_VALUE, query, QUERY_PACKETSIZE, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s", - ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* Cast up within the signed/unsigned same type */ - if ((unsigned int)ret >= SIZE_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(3, "send: ret=%d exceeds SIZE_MAX", ret); - } - upsdebug_hex(3, "send", query, (size_t)ret); + upsdebug_hex(3, "send", query, ret); - ret = usb_interrupt_read(udev, - REPLY_REQUESTTYPE, - (usb_ctrl_charbuf)reply, REPLY_PACKETSIZE, 1000); + ret = usb_interrupt_read(udev, REPLY_REQUESTTYPE, reply, REPLY_PACKETSIZE, 1000); if (ret <= 0) { - upsdebugx(3, "read: %s", - ret ? nut_usb_strerror(ret) : "timeout"); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* Cast up within the signed/unsigned same type */ - if ((unsigned int)ret >= SIZE_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - upsdebugx(3, "read: ret=%d exceeds SIZE_MAX", ret); - } - upsdebug_hex(3, "read", reply, (size_t)ret); + upsdebug_hex(3, "read", reply, ret); return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif static int query_ups(char *reply) { @@ -200,19 +147,7 @@ static void usb_comm_fail(const char *fmt, ...) } va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(why, sizeof(why), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); if ((ret < 1) || (ret >= (int) sizeof(why))) { @@ -228,7 +163,7 @@ static void usb_comm_good(void) return; } - upslogx(LOG_NOTICE, "Communications with UPS re-established"); + upslogx(LOG_NOTICE, "Communications with UPS re-established"); comm_failures = 0; } @@ -241,8 +176,6 @@ static void usb_comm_good(void) */ static int driver_callback(usb_dev_handle *handle, USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - if (usb_set_configuration(handle, 1) < 0) { upsdebugx(5, "Can't set USB configuration"); return -1; @@ -253,19 +186,10 @@ static int driver_callback(usb_dev_handle *handle, USBDevice_t *device) return -1; } -#if WITH_LIBUSB_0_1 if (usb_set_altinterface(handle, 0) < 0) { upsdebugx(5, "Can't set USB alternate interface"); return -1; } -#elif WITH_LIBUSB_1_0 - int ret = 0; - - if ((ret = libusb_set_interface_alt_setting(handle, 0, 0)) < 0) { - upsdebugx(5, "Can't set USB alternate interface: %s", nut_usb_strerror(ret)); - return -1; - } -#endif /* WITH_LIBUSB_1_0 */ if (usb_clear_halt(handle, 0x81) < 0) { upsdebugx(5, "Can't reset USB endpoint"); @@ -277,73 +201,31 @@ static int driver_callback(usb_dev_handle *handle, USBDevice_t *device) static int usb_device_close(usb_dev_handle *handle) { - int ret = 0; - if (!handle) { return 0; } /* usb_release_interface() sometimes blocks and goes - * into uninterruptible sleep. So don't do it. - */ + into uninterruptible sleep. So don't do it. */ /* usb_release_interface(handle, 0); */ - -#if WITH_LIBUSB_1_0 - libusb_close(handle); - libusb_exit(NULL); -#else - ret = usb_close(handle); -#endif - - return ret; + return usb_close(handle); } static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDeviceMatcher_t *matcher, int (*callback)(usb_dev_handle *handle, USBDevice_t *device)) { - int ret = 0; - uint8_t iManufacturer = 0, iProduct = 0, iSerialNumber = 0; + struct usb_bus *bus; /* libusb base init */ -#if WITH_LIBUSB_1_0 - if (libusb_init(NULL) < 0) { - libusb_exit(NULL); - fatal_with_errno(EXIT_FAILURE, "Failed to init libusb 1.0"); - } -#else /* => WITH_LIBUSB_0_1 */ usb_init(); usb_find_busses(); usb_find_devices(); -#endif /* WITH_LIBUSB_1_0 */ #ifndef __linux__ /* SUN_LIBUSB (confirmed to work on Solaris and FreeBSD) */ /* Causes a double free corruption in linux if device is detached! */ - /* usb_device_close(*handlep); */ - if (*handlep) - usb_close(*handlep); + usb_device_close(*handlep); #endif -#if WITH_LIBUSB_1_0 - libusb_device **devlist; - ssize_t devcount = 0; - libusb_device_handle *handle; - struct libusb_device_descriptor dev_desc; - uint8_t bus; - int i; - - devcount = libusb_get_device_list(NULL, &devlist); - if (devcount <= 0) - fatal_with_errno(EXIT_FAILURE, "No USB device found"); - - for (i = 0; i < devcount; i++) { - - USBDeviceMatcher_t *m; - libusb_device *dev = devlist[i]; - libusb_get_device_descriptor(dev, &dev_desc); - ret = libusb_open(dev, &handle); - *handlep = handle; -#else /* => WITH_LIBUSB_0_1 */ - struct usb_bus *bus; for (bus = usb_busses; bus; bus = bus->next) { struct usb_device *dev; @@ -351,22 +233,18 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev for (dev = bus->devices; dev; dev = dev->next) { - int i; + int i, ret; USBDeviceMatcher_t *m; - upsdebugx(3, "Checking USB device [%04x:%04x] (%s/%s)", - dev->descriptor.idVendor, - dev->descriptor.idProduct, - bus->dirname, dev->filename); - + upsdebugx(4, "Checking USB device [%04x:%04x] (%s/%s)", dev->descriptor.idVendor, + dev->descriptor.idProduct, bus->dirname, dev->filename); + /* supported vendors are now checked by the supplied matcher */ /* open the device */ *handlep = handle = usb_open(dev); -#endif /* WITH_LIBUSB_1_0 */ - if (!handle) { - upsdebugx(4, "Failed to open USB device, skipping: %s", nut_usb_strerror(ret)); + upsdebugx(4, "Failed to open USB device, skipping: %s", usb_strerror()); continue; } @@ -383,70 +261,34 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev memset(device, 0, sizeof(*device)); -#if WITH_LIBUSB_1_0 - device->VendorID = dev_desc.idVendor; - device->ProductID = dev_desc.idProduct; - bus = libusb_get_bus_number(dev); - device->Bus = (char *)malloc(4); - if (device->Bus == NULL) { - libusb_free_device_list(devlist, 1); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - sprintf(device->Bus, "%03d", bus); - iManufacturer = dev_desc.iManufacturer; - iProduct = dev_desc.iProduct; - iSerialNumber = dev_desc.iSerialNumber; -#else /* => WITH_LIBUSB_0_1 */ device->VendorID = dev->descriptor.idVendor; device->ProductID = dev->descriptor.idProduct; - device->Bus = xstrdup(bus->dirname); - iManufacturer = dev->descriptor.iManufacturer; - iProduct = dev->descriptor.iProduct; - iSerialNumber = dev->descriptor.iSerialNumber; -#endif /* WITH_LIBUSB_1_0 */ - - if (iManufacturer) { + device->Bus = strdup(bus->dirname); + + if (dev->descriptor.iManufacturer) { char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iManufacturer, - (usb_ctrl_charbuf)buf, sizeof(buf)); + ret = usb_get_string_simple(handle, dev->descriptor.iManufacturer, + buf, sizeof(buf)); if (ret > 0) { device->Vendor = strdup(buf); - if (device->Vendor == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } } } - if (iProduct) { + if (dev->descriptor.iProduct) { char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iProduct, - (usb_ctrl_charbuf)buf, sizeof(buf)); + ret = usb_get_string_simple(handle, dev->descriptor.iProduct, + buf, sizeof(buf)); if (ret > 0) { device->Product = strdup(buf); - if (device->Product == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } } } - if (iSerialNumber) { + if (dev->descriptor.iSerialNumber) { char buf[SMALLBUF]; - ret = usb_get_string_simple(handle, iSerialNumber, - (usb_ctrl_charbuf)buf, sizeof(buf)); + ret = usb_get_string_simple(handle, dev->descriptor.iSerialNumber, + buf, sizeof(buf)); if (ret > 0) { device->Serial = strdup(buf); - if (device->Serial == NULL) { -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } } } @@ -458,106 +300,49 @@ static int usb_device_open(usb_dev_handle **handlep, USBDevice_t *device, USBDev upsdebugx(4, "- Bus : %s", device->Bus ? device->Bus : "unknown"); for (m = matcher; m; m = m->next) { - + switch (m->match_function(device, m->privdata)) { case 0: upsdebugx(4, "Device does not match - skipping"); goto next_device; case -1: -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ fatal_with_errno(EXIT_FAILURE, "matcher"); -#ifndef HAVE___ATTRIBUTE__NORETURN -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wunreachable-code" -# endif goto next_device; -# if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) -# pragma GCC diagnostic pop -# endif -#endif case -2: upsdebugx(4, "matcher: unspecified error"); goto next_device; } } -#ifdef HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER - /* First, try the auto-detach kernel driver method - * This function is not available on FreeBSD 10.1-10.3 */ - if ((ret = libusb_set_auto_detach_kernel_driver(handle, 1)) < 0) - upsdebugx(2, - "failed to auto detach kernel driver from USB device: %s", - nut_usb_strerror((enum libusb_error)ret)); - else - upsdebugx(2, "auto detached kernel driver from USB device"); -#endif /* HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER */ for (i = 0; i < 3; i++) { ret = callback(handle, device); if (ret >= 0) { - upsdebugx(4, "USB device [%04x:%04x] opened", - device->VendorID, device->ProductID); -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ + upsdebugx(4, "USB device [%04x:%04x] opened", device->VendorID, device->ProductID); return ret; } -#if WITH_LIBUSB_0_1 && (defined HAVE_USB_DETACH_KERNEL_DRIVER_NP) +#ifdef HAVE_USB_DETACH_KERNEL_DRIVER_NP /* this method requires at least libusb 0.1.8: * it force device claiming by unbinding * attached driver... From libhid */ - if ((ret = usb_detach_kernel_driver_np(handle, 0)) < 0) { - upsdebugx(4, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); + if (usb_detach_kernel_driver_np(handle, 0) < 0) { + upsdebugx(4, "failed to detach kernel driver from USB device: %s", usb_strerror()); } else { upsdebugx(4, "detached kernel driver from USB device..."); } -#else -# ifdef HAVE_LIBUSB_DETACH_KERNEL_DRIVER - if ((ret = libusb_detach_kernel_driver(handle, 0)) < 0) { - upsdebugx(4, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); - } else { - upsdebugx(4, "detached kernel driver from USB device..."); - } -# else -# ifdef HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP - if ((ret = libusb_detach_kernel_driver_np(udev, 0)) < 0) { - upsdebugx(4, - "failed to detach kernel driver from USB device: %s", - nut_usb_strerror(ret)); - } else { - upsdebugx(4, "detached kernel driver from USB device..."); - } -# endif /* HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP */ -# endif /* HAVE_LIBUSB_DETACH_KERNEL_DRIVER */ -#endif /* HAVE_USB_DETACH_KERNEL_DRIVER_NP or HAVE_LIBUSB_DETACH_KERNEL_DRIVER or HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP */ +#endif } -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ - fatalx(EXIT_FAILURE, - "USB device [%04x:%04x] matches, but driver callback failed: %s", - device->VendorID, device->ProductID, nut_usb_strerror(ret)); + fatalx(EXIT_FAILURE, "USB device [%04x:%04x] matches, but driver callback failed: %s", + device->VendorID, device->ProductID, usb_strerror()); next_device: usb_close(handle); -#if (!WITH_LIBUSB_1_0) /* => WITH_LIBUSB_0_1 */ } -#endif /* WITH_LIBUSB_1_0 */ } *handlep = NULL; -#if WITH_LIBUSB_1_0 - libusb_free_device_list(devlist, 1); -#endif /* WITH_LIBUSB_1_0 */ upsdebugx(4, "No matching USB device found"); return -1; @@ -571,8 +356,6 @@ void upsdrv_initups(void) char reply[REPLY_PACKETSIZE]; int i; - warn_if_bad_usb_port_filename(device_path); - for (i = 0; usb_device_open(&udev, &usbdevice, &device_matcher, &driver_callback) < 0; i++) { if ((i < 32) && (sleep(5) == 0)) { diff --git a/drivers/riello.c b/drivers/riello.c index 8671225..0725453 100644 --- a/drivers/riello.c +++ b/drivers/riello.c @@ -22,8 +22,8 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Reference of the derivative work: blazer driver + * + * Reference of the derivative work: blazer driver */ #include @@ -32,7 +32,7 @@ #include "main.h" #include "riello.h" -static uint8_t foundheader = 0; +uint8_t foundheader=0; uint16_t buf_ptr_length; uint8_t wait_packet = 0; @@ -42,11 +42,11 @@ uint8_t foundbadcrc = 0; uint8_t commbyte; uint8_t requestSENTR; -static unsigned char LAST_DATA[6]; +unsigned char LAST_DATA[6]; uint16_t riello_calc_CRC(uint8_t type, uint8_t *buff, uint16_t size, uint8_t checksum) { - uint16_t i; + uint8_t i; uint16_t pom, CRC_Word; CRC_Word = 0; @@ -58,7 +58,7 @@ uint16_t riello_calc_CRC(uint8_t type, uint8_t *buff, uint16_t size, uint8_t che CRC_Word += buff[i]; } else { - for (i=0; i> 4); + pom = (CRC_Word ^ *buff) & 0xff; + pom = (pom ^ (pom << 4)) & 0xff; + pom = (pom << 8) ^ (pom << 3) ^ (pom >> 4); CRC_Word = (CRC_Word >> 8) ^ pom; buff++; } - } + } else { CRC_Word = 0; - for (i=1; iIdentif_bytes[0] != '1') pom_long/=100; - assert (pom_long < UINT16_MAX); - data->NomPowerKVA = (uint16_t)pom_long; + data->NomPowerKVA = pom_long; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; @@ -468,8 +462,7 @@ void riello_parse_gn(uint8_t* buffer, TRielloData* data) if (data->Identif_bytes[0] != '1') pom_long/=100; - assert (pom_long < UINT16_MAX); - data->NomPowerKW = (uint16_t)pom_long; + data->NomPowerKW = pom_long; pom_word = (buffer[j++]-0x30)*256; pom_word += (buffer[j++]-0x30)*16; @@ -571,7 +564,7 @@ void riello_parse_rs(uint8_t* buffer, TRielloData* data, uint8_t numread) pom_word += (buffer[j++]-0x30)*16; pom_word += (buffer[j++]-0x30); data->Uinp3 = pom_word; - } + } else { data->Uinp2 = 0; data->Uinp3 = 0; @@ -600,7 +593,7 @@ void riello_parse_rs(uint8_t* buffer, TRielloData* data, uint8_t numread) pom_word += (buffer[j++]-0x30)*16; pom_word += (buffer[j++]-0x30); data->Ubypass3 = pom_word; - } + } else { data->Uout2 = 0; data->Pout2 = 0; @@ -645,42 +638,42 @@ void riello_parse_re(uint8_t* buffer, TRielloData* data) pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout1W = pom_long; + data->Pout1W = pom_word; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout2W = pom_long; + data->Pout2W = pom_word; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout3W = pom_long; + data->Pout3W = pom_word; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout1VA = pom_long; + data->Pout1VA = pom_word; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout2VA = pom_long; + data->Pout2VA = pom_word; pom_long = (buffer[j++]-0x30)*65536; pom_long += (buffer[j++]-0x30)*4096; pom_long += (buffer[j++]-0x30)*256; pom_long += (buffer[j++]-0x30)*16; pom_long += (buffer[j++]-0x30); - data->Pout3VA = pom_long; + data->Pout3VA = pom_word; } void riello_parse_rc(uint8_t* buffer, TRielloData* data) @@ -689,7 +682,7 @@ void riello_parse_rc(uint8_t* buffer, TRielloData* data) j = 7; for (i = 0; i < 22; i++, j+=2) { - data->StatusCodeT[i] = (char)(buffer[j+1]-0x30); + data->StatusCodeT[i] = (buffer[j+1]-0x30); data->StatusCodeT[i] |= ((buffer[j]-0x30) << 4); } data->StatusCodeT[23] = 0; @@ -711,7 +704,7 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) else requestSENTR = SENTR_ONLY192; data->NomPowerKVA = data->Model/10; - } + } else { if (((data->Model-3000) % 10) >= 4) { if (buffer[100] & 0x01) @@ -740,11 +733,11 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->SWversion = buffer[4]+256*buffer[5]; - data->Version[0] = (char)(uint8_t)(48 + ((data->SWversion / 1000) % 10)); - data->Version[1] = (char)(uint8_t)(48 + ((data->SWversion / 100) % 10)); + data->Version[0] = (uint8_t)(48 + ((data->SWversion / 1000) % 10)); + data->Version[1] = (uint8_t)(48 + ((data->SWversion / 100) % 10)); data->Version[2] = '.'; - data->Version[3] = (char)(uint8_t)(48 + ((data->SWversion / 10) % 10)); - data->Version[4] = (char)(uint8_t)(48 + (data->SWversion % 10)); + data->Version[3] = (uint8_t)(48 + ((data->SWversion / 10) % 10)); + data->Version[4] = (uint8_t)(48 + (data->SWversion % 10)); if (data->Model < 3000) pom = data->Model*100; @@ -763,7 +756,7 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->Uout1 = (buffer[135]+buffer[136]*256)/10; data->Uout2 = (buffer[137]+buffer[138]*256)/10; data->Uout3 = (buffer[139]+buffer[140]*256)/10; - data->Iout1 = (buffer[141]+buffer[142]*256)/10; + data->Iout1 = (buffer[141]+buffer[142]*256)/10; data->Iout2 = (buffer[143]+buffer[144]*256)/10; data->Iout3 = (buffer[145]+buffer[146]*256)/10; @@ -776,10 +769,9 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->Uinp1 = buffer[35]*230/100; data->Uinp2 = buffer[36]*230/100; data->Uinp3 = buffer[37]*230/100; - /* TODO: Range-check the casts to uint16_t? */ - data->Iinp1 = (uint16_t)(((pom/690)*buffer[38])/100); - data->Iinp2 = (uint16_t)(((pom/690)*buffer[39])/100); - data->Iinp3 = (uint16_t)(((pom/690)*buffer[40])/100); + data->Iinp1 = ((pom/690)*buffer[38])/100;; + data->Iinp2 = ((pom/690)*buffer[39])/100;; + data->Iinp3 = ((pom/690)*buffer[40])/100;; data->Finp = buffer[41]+256*buffer[42]; if (buffer[79] & 0x80) { @@ -794,16 +786,14 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) } if (buffer[73]) { - /* FIXME: Wondering how the addition below works for uint8_t[] buffer... */ - /* TODO: Range-check the casts to uint16_t? */ if (buffer[73] < 100) buffer[73]+=256; if (data->Model < 3000) /* singlephase */ - data->Iout1 = (uint16_t)(((pom/buffer[73])*buffer[62])/100); + data->Iout1 = ((pom/buffer[73])*buffer[62])/100; else - data->Iout1 = (uint16_t)(((pom/buffer[73])*buffer[62])/100/3); - data->Iout2 = (uint16_t)(((pom/buffer[73])*buffer[63])/100/3); - data->Iout3 = (uint16_t)(((pom/buffer[73])*buffer[64])/100/3); + data->Iout1 = ((pom/buffer[73])*buffer[62])/100/3; + data->Iout2 = ((pom/buffer[73])*buffer[63])/100/3; + data->Iout3 = ((pom/buffer[73])*buffer[64])/100/3; } else { data->Iout1 = 0; @@ -827,7 +817,7 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->Ipout2 = 0; data->Ipout3 = 0; } - else { + else { data->Ipout2 = buffer[66]*3; data->Ipout3 = buffer[67]*3; } @@ -853,7 +843,7 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->Ubat *= 10; data->Ibat = buffer[45]+256*buffer[46]; if (!buffer[47]) - data->Ibat = data->Ibat*10; + data->Ibat = data->Ibat*10; data->Tsystem = buffer[48]; data->NomBatCap = buffer[74]+256*buffer[75]; @@ -886,32 +876,32 @@ void riello_parse_sentr(uint8_t* buffer, TRielloData* data) data->StatusCode[4] = 0x00; /* Overload if (riello_test_bit(&DevData.StatusCode[4], 2)) */ - if (buffer[31] & 128) + if (buffer[31] & 128) data->StatusCode[4] |= 0x04; /* Bypass if (riello_test_bit(&DevData.StatusCode[1], 3)) */ - if (((buffer[31] & 2) || (riello_test_bit(&buffer[32], 0)) || (riello_test_bit(&buffer[32], 12)) || + if (((buffer[31] & 2) || (riello_test_bit(&buffer[32], 0)) || (riello_test_bit(&buffer[32], 12)) || (riello_test_bit(&buffer[32], 13)) || (riello_test_bit(&buffer[32], 14))) && (!(buffer[34] & 8))) data->StatusCode[1] |= 0x08; /* AC Fail if (riello_test_bit(&DevData.StatusCode[0], 1)) */ - if (buffer[31] & 8) + if (buffer[31] & 8) data->StatusCode[0] |= 0x02; /* LowBatt if ((riello_test_bit(&DevData.StatusCode[0], 1)) && (riello_test_bit(&DevData.StatusCode[0], 0))) */ if (buffer[31] & 16) { - if (buffer[31] & 8) { + if (buffer[31] & 8) { data->StatusCode[0] |= 0x02; data->StatusCode[0] |= 0x01; } } /* Standby if (!riello_test_bit(&DevData.StatusCode[0], 3)) */ - if ((buffer[22] & 2) || (buffer[34] & 4) || (buffer[34] & 8)) + if ((buffer[22] & 2) || (buffer[34] & 4) || (buffer[34] & 8)) data->StatusCode[0] &= 0xF7; /* Battery bad (Replace battery) if (riello_test_bit(&DevData.StatusCode[2], 0)) */ - if (buffer[31] & 0x40) + if (buffer[31] & 0x40) data->StatusCode[2] |= 0x01; } @@ -923,7 +913,7 @@ void riello_init_serial() foundnak = 0; } -uint8_t riello_header(uint8_t type, uint8_t a, uint8_t* length) +uint8_t riello_header(uint8_t type, uint8_t a, uint8_t* length) { LAST_DATA[0] = LAST_DATA[1]; LAST_DATA[1] = LAST_DATA[2]; @@ -954,7 +944,7 @@ uint8_t riello_tail(uint8_t type, uint8_t length) switch (type) { case DEV_RIELLOSENTRY: - number = length; + number = length; if (buf_ptr_length >= number) return(1); @@ -983,15 +973,15 @@ void riello_parse_serialport(uint8_t typedev, uint8_t* buffer, uint8_t checksum) static uint8_t actual_char, int_i; static uint8_t length; - actual_char = commbyte; + actual_char = commbyte; - if ((riello_header(typedev, actual_char, &length)) && (!foundheader)) { + if ((riello_header(typedev, actual_char, &length)) && (!foundheader)) { upsdebugx(5,"Header detected: LAST_DATA:%X,%X,%X,%X,%X,%X buf_ptr:%i \n\r", LAST_DATA[0], LAST_DATA[1], LAST_DATA[2], LAST_DATA[3], LAST_DATA[4], LAST_DATA[5], buf_ptr_length); foundheader = 1; - buf_ptr_length = 1; + buf_ptr_length = 1; memset(buffer, 0, BUFFER_SIZE); buffer[0] = LAST_DATA[4]; } @@ -1011,13 +1001,13 @@ void riello_parse_serialport(uint8_t typedev, uint8_t* buffer, uint8_t checksum) if (riello_test_nak(typedev, buffer)) { wait_packet = 0; - foundnak = 1; + foundnak = 1; } if (riello_test_crc(typedev, buffer, buf_ptr_length, checksum)) { wait_packet = 0; foundbadcrc = 1; - } + } else { wait_packet = 0; foundbadcrc = 0; diff --git a/drivers/riello.h b/drivers/riello.h index 2f3c6a7..64453e5 100644 --- a/drivers/riello.h +++ b/drivers/riello.h @@ -26,14 +26,17 @@ * Reference of the derivative work: blazer driver */ -#ifndef NUT_RIELLO_H_SEEN -#define NUT_RIELLO_H_SEEN 1 +#ifndef dev_dataH +#define dev_dataH #include #define CTRL_RETRIES 50 #define CTRL_TIMEOUT 100 +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 + #define MAX_READ_WRITE (16 * 1024) #define USB_WRITE_DELAY 200 @@ -166,22 +169,11 @@ void riello_parse_rc(uint8_t* buffer, TRielloData* data); void riello_parse_sentr(uint8_t* buffer, TRielloData* data); /* communication functions */ -void riello_init_serial(void); +void riello_init_serial(); uint8_t riello_header(uint8_t type, uint8_t a, uint8_t* length); uint8_t riello_tail(uint8_t type, uint8_t length); uint8_t riello_test_nak(uint8_t type, uint8_t* buffer); void riello_parse_serialport(uint8_t typedev, uint8_t* buffer, uint8_t checksum); void riello_comm_setup(const char *port); -int get_ups_statuscode(void); - -/* Shared global variables for driver subtypes */ -/* extern uint8_t foundheader; */ -extern uint16_t buf_ptr_length; -extern uint8_t wait_packet; -extern uint8_t foundnak; -extern uint8_t foundbadcrc; -extern uint8_t commbyte; -extern uint8_t requestSENTR; - -#endif /* NUT_RIELLO_H_SEEN */ +#endif diff --git a/drivers/riello_ser.c b/drivers/riello_ser.c index 8c2714f..b76be96 100644 --- a/drivers/riello_ser.c +++ b/drivers/riello_ser.c @@ -24,29 +24,20 @@ * Reference of the derivative work: blazer driver */ -#include "config.h" /* must be the first header */ - #include #include +#include "config.h" #include "main.h" #include "serial.h" #include "timehead.h" -/* -// The serial driver has no need for HID structures/code currently -// (maybe there is/was a plan for sharing something between siblings). -// Note that HID is tied to libusb or libshut definitions at the moment. #include "hidparser.h" #include "hidtypes.h" -*/ #include "common.h" /* for upsdebugx() etc */ #include "riello.h" #define DRIVER_NAME "Riello serial driver" -#define DRIVER_VERSION "0.07" - -#define DEFAULT_OFFDELAY 5 -#define DEFAULT_BOOTDELAY 5 +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -57,37 +48,41 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static uint8_t bufOut[BUFFER_SIZE]; -static uint8_t bufIn[BUFFER_SIZE]; +uint8_t bufOut[BUFFER_SIZE]; +uint8_t bufIn[BUFFER_SIZE]; -static uint8_t gpser_error_control; -static uint8_t typeRielloProtocol; +uint8_t gpser_error_control; +uint8_t typeRielloProtocol; -static uint8_t input_monophase; -static uint8_t output_monophase; +uint8_t input_monophase; +uint8_t output_monophase; -static unsigned int offdelay = DEFAULT_OFFDELAY; -static unsigned int bootdelay = DEFAULT_BOOTDELAY; +extern uint8_t commbyte; +extern uint8_t wait_packet; +extern uint8_t foundnak; +extern uint8_t foundbadcrc; +extern uint8_t buf_ptr_length; +extern uint8_t requestSENTR; -static TRielloData DevData; +TRielloData DevData; /********************************************************************** - * char_read (char *bytes, size_t size, int read_timeout) + * char_read (char *bytes, int size, int read_timeout) * * reads size bytes from the serial port * - * bytes - buffer to store the data + * bytes - buffer to store the data * size - size of the data to get * read_timeout - serial timeout (in milliseconds) * * return -1 on error, -2 on timeout, nb_bytes_readen on success * *********************************************************************/ -static ssize_t char_read (char *bytes, size_t size, int read_timeout) +static int char_read (char *bytes, int size, int read_timeout) { struct timeval serial_timeout; fd_set readfs; - ssize_t readen = 0; + int readen = 0; int rc = 0; FD_ZERO (&readfs); @@ -101,12 +96,13 @@ static ssize_t char_read (char *bytes, size_t size, int read_timeout) return -2; /* timeout */ if (FD_ISSET (upsfd, &readfs)) { - ssize_t now = read (upsfd, bytes, size - (size_t)readen); + int now = read (upsfd, bytes, size - readen); if (now < 0) { return -1; } else { + bytes += now; readen += now; } } @@ -126,12 +122,12 @@ static ssize_t char_read (char *bytes, size_t size, int read_timeout) * returns 0 on success, -1 on error, -2 on timeout * **********************************************************************/ -static ssize_t serial_read (int read_timeout, unsigned char *readbuf) +int serial_read (int read_timeout, u_char *readbuf) { - static unsigned char cache[512]; - static unsigned char *cachep = cache; - static unsigned char *cachee = cache; - ssize_t recv; + static u_char cache[512]; + static u_char *cachep = cache; + static u_char *cachee = cache; + int recv; *readbuf = '\0'; /* if still data in cache, get it */ @@ -158,7 +154,7 @@ static ssize_t serial_read (int read_timeout, unsigned char *readbuf) return -1; } -static void riello_serialcomm(uint8_t* arg_bufIn, uint8_t typedev) +void riello_serialcomm(uint8_t* bufIn, uint8_t typedev) { time_t realt, nowt; uint8_t commb = 0; @@ -168,14 +164,14 @@ static void riello_serialcomm(uint8_t* arg_bufIn, uint8_t typedev) serial_read(1000, &commb); nowt = time(NULL); commbyte = commb; - riello_parse_serialport(typedev, arg_bufIn, gpser_error_control); + riello_parse_serialport(typedev, bufIn, gpser_error_control); if ((nowt - realt) > 4) break; } } -static int get_ups_nominal() +int get_ups_nominal() { uint8_t length; @@ -192,13 +188,12 @@ static int get_ups_nominal() if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get nominal Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* mandatory */ if (!wait_packet && foundnak) { upsdebugx (3, "Get nominal Ko: command not supported"); - return -1; + return 1; } upsdebugx (3, "Get nominal Ok: received byte %u", buf_ptr_length); @@ -208,7 +203,7 @@ static int get_ups_nominal() return 0; } -static int get_ups_status() +int get_ups_status() { uint8_t numread, length; @@ -232,13 +227,12 @@ static int get_ups_status() if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get status Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* mandatory */ if (!wait_packet && foundnak) { upsdebugx (3, "Get status Ko: command not supported"); - return -1; + return 1; } upsdebugx (3, "Get status Ok: received byte %u", buf_ptr_length); @@ -248,7 +242,7 @@ static int get_ups_status() return 0; } -static int get_ups_extended() +int get_ups_extended() { uint8_t length; @@ -265,13 +259,12 @@ static int get_ups_extended() if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get extended Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* optonal */ if (!wait_packet && foundnak) { upsdebugx (3, "Get extended Ko: command not supported"); - return 0; + return 1; } upsdebugx (3, "Get extended Ok: received byte %u", buf_ptr_length); @@ -281,7 +274,6 @@ static int get_ups_extended() return 0; } -/* Not static, exposed via header. Not used though, currently... */ int get_ups_statuscode() { uint8_t length; @@ -299,13 +291,12 @@ int get_ups_statuscode() if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get statuscode Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* optional */ if (!wait_packet && foundnak) { upsdebugx (3, "Get statuscode Ko: command not supported"); - return 0; + return 1; } upsdebugx (3, "Get statuscode Ok: received byte %u", buf_ptr_length); @@ -315,7 +306,7 @@ int get_ups_statuscode() return 0; } -static int get_ups_sentr() +int get_ups_sentr() { uint8_t length; @@ -342,13 +333,12 @@ static int get_ups_sentr() if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get sentry Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* mandatory */ if (!wait_packet && foundnak) { upsdebugx (3, "Get sentry Ko: command not supported"); - return -1; + return 1; } upsdebugx (3, "Get sentry Ok: received byte %u", buf_ptr_length); @@ -358,7 +348,7 @@ static int get_ups_sentr() return 0; } -static int riello_instcmd(const char *cmdname, const char *extra) +int riello_instcmd(const char *cmdname, const char *extra) { uint8_t length; uint16_t delay; @@ -369,77 +359,68 @@ static int riello_instcmd(const char *cmdname, const char *extra) delay = 0; riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_cs(bufOut, gpser_error_control, delay); else length = riello_prepare_shutsentr(bufOut, delay); - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.off communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.off Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.off Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.off Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.off Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command load.off Ok"); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "load.off.delay")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.shutdown"); - ipv = atoi(delay_char); - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; + delay_char = dstate_getinfo("ups.delay.shutdown"); + delay = atoi(delay_char); riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_cs(bufOut, gpser_error_control, delay); else length = riello_prepare_shutsentr(bufOut, delay); - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.off delay communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.off.delay Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.off.delay Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.off.delay Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.off.delay Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command load.off delay Ok"); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "load.on")) { delay = 0; riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_cr(bufOut, gpser_error_control, delay); else { length = riello_prepare_setrebsentr(bufOut, delay); - - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.on communication error"); + + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } riello_serialcomm(&bufIn[0], typeRielloProtocol); if (!wait_packet && foundbadcrc) { @@ -455,199 +436,176 @@ static int riello_instcmd(const char *cmdname, const char *extra) length = riello_prepare_rebsentr(bufOut, delay); } - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.on communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } - - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.on Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.on Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command load.on Ok"); - return STAT_INSTCMD_HANDLED; - } - - if (!strcasecmp(cmdname, "load.on.delay")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.reboot"); - ipv = atoi(delay_char); - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; - - riello_init_serial(); - - if (typeRielloProtocol == DEV_RIELLOGPSER) - length = riello_prepare_cr(bufOut, gpser_error_control, delay); else { - length = riello_prepare_setrebsentr(bufOut, delay); - - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.on delay communication error"); - return STAT_INSTCMD_FAILED; - } - riello_serialcomm(&bufIn[0], typeRielloProtocol); if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.on delay Ko: bad CRC or Checksum"); + upsdebugx (3, "Command load.on Ko: bad CRC or Checksum"); return STAT_INSTCMD_FAILED; } if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.on delay Ko: command not supported"); + upsdebugx (3, "Command load.on Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; + } + } + + if (!strcasecmp(cmdname, "load.on.delay")) { + delay_char = dstate_getinfo("ups.delay.reboot"); + delay = atoi(delay_char); + riello_init_serial(); + + if (typeRielloProtocol == DEV_RIELLOGPSER) + length = riello_prepare_cr(bufOut, gpser_error_control, delay); + else { + length = riello_prepare_setrebsentr(bufOut, delay); + if (ser_send_buf(upsfd, bufOut, length) == 0) + return STAT_INSTCMD_FAILED; + + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.on Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } + + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.on Ko: command not supported"); return STAT_INSTCMD_FAILED; } length = riello_prepare_rebsentr(bufOut, delay); } - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command load.on delay communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.on.delay Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.on.delay Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.on.delay Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.on.delay Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command load.on delay Ok"); - return STAT_INSTCMD_HANDLED; } } else { if (!strcasecmp(cmdname, "shutdown.return")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.shutdown"); - ipv = atoi(delay_char); - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; - + delay_char = dstate_getinfo("ups.delay.shutdown"); + delay = atoi(delay_char); riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_cs(bufOut, gpser_error_control, delay); else length = riello_prepare_shutsentr(bufOut, delay); - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command shutdown.return communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command shutdown.return Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command shutdown.return Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command shutdown.return Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command shutdown.return Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command shutdown.return Ok"); - return STAT_INSTCMD_HANDLED; } } if (!strcasecmp(cmdname, "shutdown.stop")) { riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_cd(bufOut, gpser_error_control); else length = riello_prepare_cancelsentr(bufOut); - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command shutdown.stop communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command shutdown.stop Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command shutdown.stop Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command shutdown.stop Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command shutdown.stop Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command shutdown.stop Ok"); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "test.panel.start")) { riello_init_serial(); length = riello_prepare_tp(bufOut, gpser_error_control); - - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command test.panel.start communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], DEV_RIELLOGPSER); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command panel.start Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], DEV_RIELLOGPSER); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command test.panel.start Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command panel.start Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command test.panel.start Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command test.panel.start Ok"); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "test.battery.start")) { riello_init_serial(); - if (typeRielloProtocol == DEV_RIELLOGPSER) + + if (typeRielloProtocol == DEV_RIELLOGPSER) length = riello_prepare_tb(bufOut, gpser_error_control); else length = riello_prepare_tbsentr(bufOut); - if (ser_send_buf(upsfd, bufOut, length) == 0) { - upsdebugx (3, "Command test.battery.start communication error"); + if (ser_send_buf(upsfd, bufOut, length) == 0) return STAT_INSTCMD_FAILED; - } + else { + riello_serialcomm(&bufIn[0], typeRielloProtocol); + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command battery.start Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - riello_serialcomm(&bufIn[0], typeRielloProtocol); - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command battery.start Ko: bad CRC or Checksum"); - return STAT_INSTCMD_FAILED; - } + if (!wait_packet && foundnak) { + upsdebugx (3, "Command battery.start Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } - if (!wait_packet && foundnak) { - upsdebugx (3, "Command battery.start Ko: command not supported"); - return STAT_INSTCMD_FAILED; + return STAT_INSTCMD_HANDLED; } - - upsdebugx (3, "Command test.battery.start Ok"); - return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } -static int start_ups_comm() +int start_ups_comm() { uint8_t length; @@ -695,7 +653,7 @@ static int start_ups_comm() void upsdrv_initinfo(void) { int ret; - + ret = start_ups_comm(); if (ret < 0) @@ -767,14 +725,6 @@ void upsdrv_initinfo(void) dstate_addcmd("shutdown.stop"); dstate_addcmd("test.battery.start"); - dstate_setinfo("ups.delay.shutdown", "%u", offdelay); - dstate_setflags("ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("ups.delay.shutdown", 3); - dstate_setinfo("ups.delay.reboot", "%u", bootdelay); - dstate_setflags("ups.delay.reboot", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("ups.delay.reboot", 3); - - if (typeRielloProtocol == DEV_RIELLOGPSER) dstate_addcmd("test.panel.start"); @@ -787,54 +737,46 @@ void upsdrv_updateinfo(void) { uint8_t getextendedOK; static int countlost = 0; - int stat; - upsdebugx(1, "countlost %d",countlost); - - if (countlost > 0){ + if (countlost < COUNTLOST) upsdebugx(1, "Communication with UPS is lost: status read failed!"); - - if (countlost == COUNTLOST) { - dstate_datastale(); - upslogx(LOG_WARNING, "Communication with UPS is lost: status read failed!"); - } - } - - if (typeRielloProtocol == DEV_RIELLOGPSER) - stat = get_ups_status(); + else if (countlost == COUNTLOST) + upslogx(LOG_WARNING, "Communication with UPS is lost: status read failed!"); else - stat = get_ups_sentr(); - - if (stat < 0) { - if (countlost < COUNTLOST) - countlost++; - return; - } - + dstate_datastale(); + if (typeRielloProtocol == DEV_RIELLOGPSER) { + if (get_ups_status() != 0) { + if (countlost <= COUNTLOST) + countlost++; + return; + } + if (get_ups_extended() == 0) getextendedOK = 1; else getextendedOK = 0; } - else - getextendedOK = 1; + else { + if (get_ups_sentr() != 0) { + if (countlost <= COUNTLOST) + countlost++; + return; + } + else + getextendedOK = 1; + } - if (countlost == COUNTLOST) + if (countlost > COUNTLOST) upslogx(LOG_NOTICE, "Communication with UPS is re-established!"); dstate_setinfo("input.frequency", "%.2f", DevData.Finp/10.0); dstate_setinfo("input.bypass.frequency", "%.2f", DevData.Fbypass/10.0); dstate_setinfo("output.frequency", "%.2f", DevData.Fout/10.0); dstate_setinfo("battery.voltage", "%.1f", DevData.Ubat/10.0); - - if ((DevData.BatCap < 0xFFFF) && (DevData.BatTime < 0xFFFF)) { - dstate_setinfo("battery.charge", "%u", DevData.BatCap); - dstate_setinfo("battery.runtime", "%u", DevData.BatTime*60); - } - - if (DevData.Tsystem < 0xFF) - dstate_setinfo("ups.temperature", "%u", DevData.Tsystem); + dstate_setinfo("battery.charge", "%u", DevData.BatCap); + dstate_setinfo("battery.runtime", "%u", DevData.BatTime*60); + dstate_setinfo("ups.temperature", "%u", DevData.Tsystem); if (input_monophase) { dstate_setinfo("input.voltage", "%u", DevData.Uinp1); @@ -865,7 +807,7 @@ void upsdrv_updateinfo(void) } status_init(); - + /* AC Fail */ if (riello_test_bit(&DevData.StatusCode[0], 1)) status_set("OB"); @@ -934,9 +876,6 @@ void upsdrv_updateinfo(void) */ } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ diff --git a/drivers/riello_usb.c b/drivers/riello_usb.c index 417ab89..799fb44 100644 --- a/drivers/riello_usb.c +++ b/drivers/riello_usb.c @@ -7,7 +7,6 @@ * http://www.networkupstools.org/ups-protocols/riello/PSGPSER-0104.pdf * * Copyright (C) 2012 - Elio Parisi - * Copyright (C) 2016 Eaton * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,20 +25,15 @@ * Reference of the derivative work: blazer driver */ -#include "config.h" /* must be the first header */ - #include #include "main.h" -#include "nut_libusb.h" +#include "libusb.h" #include "usb-common.h" #include "riello.h" #define DRIVER_NAME "Riello USB driver" -#define DRIVER_VERSION "0.07" - -#define DEFAULT_OFFDELAY 5 /*!< seconds (max 0xFF) */ -#define DEFAULT_BOOTDELAY 5 /*!< seconds (max 0xFF) */ +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -50,19 +44,22 @@ upsdrv_info_t upsdrv_info = { { NULL } }; -static uint8_t bufOut[BUFFER_SIZE]; -static uint8_t bufIn[BUFFER_SIZE]; +uint8_t bufOut[BUFFER_SIZE]; +uint8_t bufIn[BUFFER_SIZE]; -static uint8_t gpser_error_control; +uint8_t gpser_error_control; -static uint8_t input_monophase; -static uint8_t output_monophase; +uint8_t input_monophase; +uint8_t output_monophase; -/*! Time in seconds to delay before shutting down. */ -static unsigned int offdelay = DEFAULT_OFFDELAY; -static unsigned int bootdelay = DEFAULT_BOOTDELAY; +extern uint8_t commbyte; +extern uint8_t wait_packet; +extern uint8_t foundnak; +extern uint8_t foundbadcrc; +extern uint8_t buf_ptr_length; +extern uint8_t requestSENTR; -static TRielloData DevData; +TRielloData DevData; static usb_communication_subdriver_t *usb = &usb_subdriver; static usb_dev_handle *udev = NULL; @@ -72,7 +69,7 @@ static USBDeviceMatcher_t *regex_matcher = NULL; static int (*subdriver_command)(uint8_t *cmd, uint8_t *buf, uint16_t length, uint16_t buflen) = NULL; -static void ussleep(useconds_t usec) +void ussleep(long usec) { if (usec == 1) @@ -95,12 +92,12 @@ static int cypress_setfeatures() /* Write features report */ ret = usb_control_msg(udev, USB_ENDPOINT_OUT + USB_TYPE_CLASS + USB_RECIP_INTERFACE, - 0x09, /* HID_REPORT_SET = 0x09 */ - 0 + (0x03 << 8), /* HID_REPORT_TYPE_FEATURE */ - 0, (usb_ctrl_charbuf) bufOut, 0x5, 1000); + 0x09, /* HID_REPORT_SET = 0x09 */ + 0 + (0x03 << 8), /* HID_REPORT_TYPE_FEATURE */ + 0, (char*) bufOut, 0x5, 1000); if (ret <= 0) { - upsdebugx(3, "send: %s", ret ? nut_usb_strerror(ret) : "error"); + upsdebugx(3, "send: %s", ret ? usb_strerror() : "error"); return ret; } @@ -108,15 +105,14 @@ static int cypress_setfeatures() return ret; } -static int Send_USB_Packet(uint8_t *send_str, uint16_t numbytes) +uint8_t Send_USB_Packet(uint8_t *send_str, uint16_t numbytes) { uint8_t USB_buff_pom[10]; - int i, err, size; - /*int errno;*/ + int i, err, size, errno; /* is input correct ? */ if ((!send_str) || (!numbytes)) - return -1; + return 1; size = 7; @@ -131,11 +127,14 @@ static int Send_USB_Packet(uint8_t *send_str, uint16_t numbytes) USB_buff_pom[6] = send_str[(i*7)+5]; USB_buff_pom[7] = send_str[(i*7)+6]; - err = usb_bulk_write(udev, 0x2, (usb_ctrl_charbuf) USB_buff_pom, 8, 1000); + err = usb_bulk_write(udev, 0x2, (char*) USB_buff_pom, 8, 1000); if (err < 0) { - upsdebugx(3, "USB: Send_USB_Packet: send_usb_packet, err = %d %s ", err, strerror(errno)); - return err; + if (err==-13 || errno==19) + upsdebugx(3, "USB device disconnected !"); + else + upsdebugx(3, "USB: Send_USB_Packet: send_usb_packet, err = %08x %s ", err, strerror(errno)); + return 2; } ussleep(USB_WRITE_DELAY); } @@ -161,66 +160,72 @@ static int Send_USB_Packet(uint8_t *send_str, uint16_t numbytes) if (((i*7)+6) 0) - upsdebugx(3, "read: %02X %02X %02X %02X %02X %02X %02X %02X", inBuf[0], inBuf[1], inBuf[2], inBuf[3], inBuf[4], inBuf[5], inBuf[6], inBuf[7]); + upsdebugx(3, "read: %02X %02X %02X %02X %02X %02X %02X %02X", inBuf[0], inBuf[1], inBuf[2], inBuf[3], inBuf[4], inBuf[5], inBuf[6], inBuf[7]); - if (err < 0){ - upsdebugx(3, "USB: Get_USB_Packet: send_usb_packet, err = %d %s ", err, strerror(errno)); - return err; + if (err == 0) { + if (err==-13 || err==-19 || errno==19) + upsdebugx(3, "USB device disconnected !"); + else { + switch (errno) { + case 11: /* resource temp. not available */ + case 16: /* device busy */ + /* ignore it */ + break; + default: + upsdebugx(3, "USB: Get_USB_Packet: send_usb_packet, err = %08x %s ", err, strerror(errno)); + break; + } + } + return (0); } /* copy to buffer */ - size = (unsigned char)(inBuf[0]) & 0x07; + size = inBuf[0] & 0x07; if (size) memcpy(buffer, &inBuf[1], size); - if (size > INT_MAX) - return -1; - - return (int)size; + return(size); } static int cypress_command(uint8_t *buffer, uint8_t *buf, uint16_t length, uint16_t buflen) { - int loop = 0; int ret, i = 0; uint8_t USB_buff[BUFFER_SIZE]; /* read to flush buffer */ +/* ret = Get_USB_Packet(buf+i);*/ riello_init_serial(); /* send packet */ ret = Send_USB_Packet(buffer, length); - if (ret < 0) { - upsdebugx(3, "Cypress_command send: err %d", ret ); + if (ret > 0) { + upsdebugx(3, "send: %s", ret ? usb_strerror() : "timeout"); return ret; } @@ -238,7 +243,7 @@ static int cypress_command(uint8_t *buffer, uint8_t *buf, uint16_t length, uint1 * will happen after successfully writing a command to the UPS) */ if (ret < 0) { - upsdebugx(3, "Cypress_command read: err %d", ret ); + upsdebugx(3, "read: %s", ret ? usb_strerror() : "timeout"); return ret; } @@ -246,14 +251,6 @@ static int cypress_command(uint8_t *buffer, uint8_t *buf, uint16_t length, uint1 commbyte = USB_buff[i]; riello_parse_serialport(DEV_RIELLOGPSER, buf, gpser_error_control); } - - loop++; - if (loop>300){ - wait_packet=0; - upsdebugx(1, "wait_packet reset"); - } - - ussleep(10); } upsdebugx(3, "in read: %u", buf_ptr_length); @@ -263,8 +260,6 @@ static int cypress_command(uint8_t *buffer, uint8_t *buf, uint16_t length, uint1 static void *cypress_subdriver(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); - subdriver_command = &cypress_command; return NULL; } @@ -276,15 +271,13 @@ static usb_device_id_t riello_usb_id[] = { /* various models */ { USB_DEVICE(RIELLO_VENDORID, 0x5500), &cypress_subdriver }, - /* Terminating entry */ - { 0, 0, NULL } + /* end of list */ + {-1, -1, NULL} }; static int device_match_func(USBDevice_t *hd, void *privdata) { - NUT_UNUSED_VARIABLE(privdata); - if (subdriver_command) { return 1; } @@ -309,116 +302,60 @@ static USBDeviceMatcher_t device_matcher = { }; -/* - * Callback that is called by usb_device_open() that handles USB device - * settings prior to accepting the devide. At the very least claim the - * device here. Detaching the kernel driver will be handled by the - * caller, don't do this here. Return < 0 on error, 0 or higher on - * success. - */ -static int driver_callback(usb_dev_handle *handle, USBDevice_t *device, usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen) -{ - int ret = 0; - NUT_UNUSED_VARIABLE(device); - NUT_UNUSED_VARIABLE(rdbuf); - NUT_UNUSED_VARIABLE(rdlen); - -/* - if ((ret = usb_set_configuration(handle, 1)) < 0) { - upslogx(LOG_WARNING, "Can't set USB configuration: %s", nut_usb_strerror(ret)); - return -1; - } -*/ - - if ((ret = usb_claim_interface(handle, 0)) < 0) { - upslogx(LOG_WARNING, "Can't claim USB interface: %s", nut_usb_strerror(ret)); - return -1; - } - - /* TODO: HID SET_IDLE to 0 (not necessary?) */ - - return 1; -} - /* * Generic command processing function. Send a command and read a reply. * Returns < 0 on error, 0 on timeout and the number of bytes read on * success. */ -static int riello_command(uint8_t *cmd, uint8_t *buf, uint16_t length, uint16_t buflen) +int riello_command(uint8_t *cmd, uint8_t *buf, uint16_t length, uint16_t buflen) { int ret; if (udev == NULL) { - ret = usb->open(&udev, &usbdevice, reopen_matcher, &driver_callback); + ret = usb->open(&udev, &usbdevice, reopen_matcher, NULL); - upsdebugx (3, "riello_command err udev NULL : %d ", ret); - if (ret < 0) + if (ret < 1) { return ret; - - upsdrv_initinfo(); /* reconnect usb cable */ + } } ret = (*subdriver_command)(cmd, buf, length, buflen); if (ret >= 0) { - upsdebugx (3, "riello_command ok: %u", ret); return ret; } - upsdebugx (3, "riello_command err: %d", ret); - switch (ret) { - case ERROR_BUSY: /* Device or resource busy */ + case -EBUSY: /* Device or resource busy */ fatal_with_errno(EXIT_FAILURE, "Got disconnected by another driver"); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ - case -EPERM: /* Operation not permitted */ + case -EPERM: /* Operation not permitted */ fatal_with_errno(EXIT_FAILURE, "Permissions problem"); -# ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -# endif -#endif - case ERROR_PIPE: /* Broken pipe */ + case -EPIPE: /* Broken pipe */ if (usb_clear_halt(udev, 0x81) == 0) { upsdebugx(1, "Stall condition cleared"); break; } -#if (defined ETIME) && ETIME && WITH_LIBUSB_0_1 - goto fallthrough_case_etime; - case -ETIME: /* Timer expired */ - fallthrough_case_etime: +#ifdef ETIME + case -ETIME: /* Timer expired */ #endif if (usb_reset(udev) == 0) { upsdebugx(1, "Device reset handled"); } - goto fallthrough_case_reconnect; - case ERROR_NO_DEVICE: /* No such device */ - case ERROR_ACCESS: /* Permission denied */ - case ERROR_IO: /* I/O error */ -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ - case -ENXIO: /* No such device or address */ -#endif - case ERROR_NOT_FOUND: /* No such file or directory */ - fallthrough_case_reconnect: + case -ENODEV: /* No such device */ + case -EACCES: /* Permission denied */ + case -EIO: /* I/O error */ + case -ENXIO: /* No such device or address */ + case -ENOENT: /* No such file or directory */ /* Uh oh, got to reconnect! */ usb->close(udev); udev = NULL; break; - case ERROR_TIMEOUT: /* Connection timed out */ - upsdebugx (3, "riello_command err: Resource temporarily unavailable"); - break; - - case ERROR_OVERFLOW: /* Value too large for defined data type */ -#if EPROTO && WITH_LIBUSB_0_1 + case -ETIMEDOUT: /* Connection timed out */ + case -EOVERFLOW: /* Value too large for defined data type */ case -EPROTO: /* Protocol error */ -#endif - break; default: break; } @@ -426,43 +363,35 @@ static int riello_command(uint8_t *cmd, uint8_t *buf, uint16_t length, uint16_t return ret; } -static int get_ups_nominal() +int get_ups_nominal() { - uint8_t length; - int recv; + uint8_t recv, length; length = riello_prepare_gn(&bufOut[0], gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_GN); - if (recv < 0){ - upsdebugx (3, "Get nominal err: read byte: %d", recv); - return recv; - } - if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get nominal Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* mandatory */ if (!wait_packet && foundnak) { upsdebugx (3, "Get nominal Ko: command not supported"); - return -1; + return 1; } - upsdebugx (3, "Get nominal Ok: read byte: %d", recv); + upsdebugx (3, "Get nominal Ok: read byte: %u", recv); riello_parse_gn(&bufIn[0], &DevData); return 0; } -static int get_ups_status() +int get_ups_status() { - uint8_t numread, length; - int recv; + uint8_t recv, numread, length; length = riello_prepare_rs(&bufOut[0], gpser_error_control); @@ -475,98 +404,76 @@ static int get_ups_status() recv = riello_command(&bufOut[0], &bufIn[0], length, numread); - if (recv < 0){ - upsdebugx (3, "Get status err: read byte: %d", recv); - return recv; - } - if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get status Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* mandatory */ if (!wait_packet && foundnak) { upsdebugx (3, "Get status Ko: command not supported"); - return -1; + return 1; } - upsdebugx (3, "Get status Ok: read byte: %d", recv); + upsdebugx (3, "Get status Ok: read byte: %u", recv); riello_parse_rs(&bufIn[0], &DevData, numread); return 0; } -static int get_ups_extended() +int get_ups_extended() { - uint8_t length; - int recv; + uint8_t recv, length; length = riello_prepare_re(&bufOut[0], gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_RE); - if (recv < 0){ - upsdebugx (3, "Get extended err: read byte: %d", recv); - return recv; - } - if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get extended Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* optional */ if (!wait_packet && foundnak) { upsdebugx (3, "Get extended Ko: command not supported"); - return 0; + return 1; } - upsdebugx (3, "Get extended Ok: read byte: %d", recv); + upsdebugx (3, "Get extended Ok: read byte: %u", recv); riello_parse_re(&bufIn[0], &DevData); return 0; } -/* Not static, exposed via header. Not used though, currently... */ int get_ups_statuscode() { - uint8_t length; - int recv; + uint8_t recv, length; length = riello_prepare_rc(&bufOut[0], gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_RC); - if (recv < 0){ - upsdebugx (3, "Get statuscode err: read byte: %d", recv); - return recv; - } - if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get statuscode Ko: bad CRC or Checksum"); - return -1; + return 1; } - /* optional */ if (!wait_packet && foundnak) { upsdebugx (3, "Get statuscode Ko: command not supported"); - return 0; + return 1; } - upsdebugx (3, "Get statuscode Ok: read byte: %d", recv); + upsdebugx (3, "Get statuscode Ok: read byte: %u", recv); riello_parse_rc(&bufIn[0], &DevData); return 0; } -static int riello_instcmd(const char *cmdname, const char *extra) +int riello_instcmd(const char *cmdname, const char *extra) { - uint8_t length; - int recv; + uint8_t length, recv; uint16_t delay; const char *delay_char; @@ -574,220 +481,182 @@ static int riello_instcmd(const char *cmdname, const char *extra) if (!strcasecmp(cmdname, "load.off")) { delay = 0; - length = riello_prepare_cs(bufOut, gpser_error_control, delay); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.off Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command load.off err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.off Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.off Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.off Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command load.off Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "load.off.delay")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.shutdown"); - ipv = atoi(delay_char); - /* With a "char" in the name, might assume we fit... but :) */ - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; + delay_char = dstate_getinfo("ups.delay.shutdown"); + delay = atoi(delay_char); length = riello_prepare_cs(bufOut, gpser_error_control, delay); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.off.delay Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command load.off.delay err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.off.delay Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.off.delay Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.off.delay Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command load.off.delay Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "load.on")) { delay = 0; - length = riello_prepare_cr(bufOut, gpser_error_control, delay); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.on Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command load.on err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.on Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.on Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.on Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command load.on Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "load.on.delay")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.reboot"); - ipv = atoi(delay_char); - /* With a "char" in the name, might assume we fit... but :) */ - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; + delay_char = dstate_getinfo("ups.delay.reboot"); + delay = atoi(delay_char); length = riello_prepare_cr(bufOut, gpser_error_control, delay); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command load.on.delay Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command load.on.delay err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command load.on.delay Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command load.on.delay Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command load.on.delay Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command load.on.delay Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } } else { if (!strcasecmp(cmdname, "shutdown.return")) { - int ipv; - delay_char = dstate_getinfo("ups.delay.shutdown"); - ipv = atoi(delay_char); - /* With a "char" in the name, might assume we fit... but :) */ - if (ipv < 0 || (intmax_t)ipv > (intmax_t)UINT16_MAX) return STAT_INSTCMD_FAILED; - delay = (uint16_t)ipv; + delay_char = dstate_getinfo("ups.delay.shutdown"); + delay = atoi(delay_char); length = riello_prepare_cs(bufOut, gpser_error_control, delay); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command shutdown.return Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command shutdown.return err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command shutdown.return Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command shutdown.return Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command shutdown.return Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command shutdown.return Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } } if (!strcasecmp(cmdname, "shutdown.stop")) { length = riello_prepare_cd(bufOut, gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command shutdown.stop Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command shutdown.stop err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command shutdown.stop Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command shutdown.stop Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command shutdown.stop Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command shutdown.stop Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "test.panel.start")) { length = riello_prepare_tp(bufOut, gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command test.panel.start Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command test.panel.start err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command test.panel.start Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command test.panel.start Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command test.panel.start Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command test.panel.start Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } if (!strcasecmp(cmdname, "test.battery.start")) { length = riello_prepare_tb(bufOut, gpser_error_control); recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_DEF); + if (recv > 0) { + if (!wait_packet && foundbadcrc) { + upsdebugx (3, "Command test.battery.start Ko: bad CRC or Checksum"); + return STAT_INSTCMD_FAILED; + } - if (recv < 0) { - upsdebugx (3, "Command test.battery.start err: read byte: %d", recv); - return STAT_INSTCMD_FAILED; + if (!wait_packet && foundnak) { + upsdebugx (3, "Command test.battery.start Ko: command not supported"); + return STAT_INSTCMD_FAILED; + } + + return STAT_INSTCMD_HANDLED; } - - if (!wait_packet && foundbadcrc) { - upsdebugx (3, "Command test.battery.start Ko: bad CRC or Checksum"); + else return STAT_INSTCMD_FAILED; - } - - if (!wait_packet && foundnak) { - upsdebugx (3, "Command test.battery.start Ko: command not supported"); - return STAT_INSTCMD_FAILED; - } - - upsdebugx (3, "Command test.battery.start Ok: read byte: %d", recv); - return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } -static int start_ups_comm() +int start_ups_comm() { uint16_t length; int recv; @@ -800,11 +669,6 @@ static int start_ups_comm() recv = riello_command(&bufOut[0], &bufIn[0], length, LENGTH_GI); - if (recv < 0) { - upsdebugx (3, "Get identif err: read byte: %d", recv); - return recv; - } - if (!wait_packet && foundbadcrc) { upsdebugx (3, "Get identif Ko: bad CRC or Checksum"); return 1; @@ -815,9 +679,10 @@ static int start_ups_comm() return 1; } + upsdebugx (3, "Get identif Ok: read byte: %u", recv); - return 0; + return 0; } void upsdrv_help(void) @@ -838,23 +703,20 @@ void upsdrv_initups(void) int (*command)(uint8_t *cmd, uint8_t *buf, uint16_t length, uint16_t buflen); } subdriver[] = { { "cypress", &cypress_command }, - { NULL, NULL } + { NULL } }; int ret; - char *regex_array[7]; + char *regex_array[6]; char *subdrv = getval("subdriver"); - warn_if_bad_usb_port_filename(device_path); - regex_array[0] = getval("vendorid"); regex_array[1] = getval("productid"); regex_array[2] = getval("vendor"); regex_array[3] = getval("product"); regex_array[4] = getval("serial"); regex_array[5] = getval("bus"); - regex_array[6] = getval("device"); /* pick up the subdriver name if set explicitly */ if (subdrv) { @@ -891,10 +753,11 @@ void upsdrv_initups(void) fatalx(EXIT_FAILURE, "invalid regular expression: %s", regex_array[ret]); } + /* link the matchers */ regex_matcher->next = &device_matcher; - ret = usb->open(&udev, &usbdevice, regex_matcher, &driver_callback); + ret = usb->open(&udev, &usbdevice, regex_matcher, NULL); if (ret < 0) { fatalx(EXIT_FAILURE, "No supported devices found. Please check your device availability with 'lsusb'\n" @@ -981,13 +844,6 @@ void upsdrv_initinfo(void) dstate_addcmd("test.battery.start"); dstate_addcmd("test.panel.start"); - dstate_setinfo("ups.delay.shutdown", "%u", offdelay); - dstate_setflags("ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("ups.delay.shutdown", 3); - dstate_setinfo("ups.delay.reboot", "%u", bootdelay); - dstate_setflags("ups.delay.reboot", ST_FLAG_RW | ST_FLAG_STRING); - dstate_setaux("ups.delay.reboot", 3); - /* install handlers */ /* upsh.setvar = hid_set_value; setvar; */ @@ -998,9 +854,6 @@ void upsdrv_initinfo(void) upsh.instcmd = riello_instcmd; } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ @@ -1039,25 +892,16 @@ void upsdrv_updateinfo(void) { uint8_t getextendedOK; static int countlost = 0; - int stat; - upsdebugx(1, "countlost %d",countlost); - - if (countlost > 0){ + if (countlost < COUNTLOST) upsdebugx(1, "Communication with UPS is lost: status read failed!"); + else if (countlost == COUNTLOST) + upslogx(LOG_WARNING, "Communication with UPS is lost: status read failed!"); + else + dstate_datastale(); - if (countlost == COUNTLOST) { - dstate_datastale(); - upslogx(LOG_WARNING, "Communication with UPS is lost: status read failed!"); - } - } - - stat = get_ups_status(); - - upsdebugx(1, "get_ups_status() %d",stat ); - - if (stat < 0) { - if (countlost < COUNTLOST) + if (get_ups_status() != 0) { + if (countlost <= COUNTLOST) countlost++; return; } @@ -1067,21 +911,16 @@ void upsdrv_updateinfo(void) else getextendedOK = 0; - if (countlost == COUNTLOST) + if (countlost > COUNTLOST) upslogx(LOG_NOTICE, "Communication with UPS is re-established!"); dstate_setinfo("input.frequency", "%.2f", DevData.Finp/10.0); dstate_setinfo("input.bypass.frequency", "%.2f", DevData.Fbypass/10.0); dstate_setinfo("output.frequency", "%.2f", DevData.Fout/10.0); dstate_setinfo("battery.voltage", "%.1f", DevData.Ubat/10.0); - if ((DevData.BatCap < 0xFFFF) && (DevData.BatTime < 0xFFFF)) { - dstate_setinfo("battery.charge", "%u", DevData.BatCap); - dstate_setinfo("battery.runtime", "%u", DevData.BatTime*60); - } - - if (DevData.Tsystem < 0xFF) - dstate_setinfo("ups.temperature", "%u", DevData.Tsystem); - + dstate_setinfo("battery.charge", "%u", DevData.BatCap); + dstate_setinfo("battery.runtime", "%u", DevData.BatTime*60); + dstate_setinfo("ups.temperature", "%u", DevData.Tsystem); if (input_monophase) { dstate_setinfo("input.voltage", "%u", DevData.Uinp1); @@ -1122,35 +961,35 @@ void upsdrv_updateinfo(void) /* LowBatt */ if ((riello_test_bit(&DevData.StatusCode[0], 1)) && (riello_test_bit(&DevData.StatusCode[0], 0))) - status_set("LB"); + status_set("LB"); /* Standby */ if (!riello_test_bit(&DevData.StatusCode[0], 3)) - status_set("OFF"); + status_set("OFF"); /* On Bypass */ if (riello_test_bit(&DevData.StatusCode[1], 3)) - status_set("BYPASS"); + status_set("BYPASS"); /* Overload */ if (riello_test_bit(&DevData.StatusCode[4], 2)) - status_set("OVER"); + status_set("OVER"); /* Buck */ if (riello_test_bit(&DevData.StatusCode[1], 0)) - status_set("TRIM"); + status_set("TRIM"); /* Boost */ if (riello_test_bit(&DevData.StatusCode[1], 1)) - status_set("BOOST"); + status_set("BOOST"); /* Replace battery */ if (riello_test_bit(&DevData.StatusCode[2], 0)) - status_set("RB"); + status_set("RB"); /* Charging battery */ if (riello_test_bit(&DevData.StatusCode[2], 2)) - status_set("CHRG"); + status_set("CHRG"); status_commit(); @@ -1170,8 +1009,7 @@ void upsdrv_updateinfo(void) poll_interval = 2; - countlost = 0; - + countlost = 0; /* if (get_ups_statuscode() != 0) upsdebugx(2, "Communication is lost"); else { @@ -1223,5 +1061,4 @@ void upsdrv_cleanup(void) free(usbdevice.Product); free(usbdevice.Serial); free(usbdevice.Bus); - free(usbdevice.Device); } diff --git a/drivers/safenet.c b/drivers/safenet.c index 2715db8..77170fb 100644 --- a/drivers/safenet.c +++ b/drivers/safenet.c @@ -41,7 +41,7 @@ #include "safenet.h" #define DRIVER_NAME "Generic SafeNet UPS driver" -#define DRIVER_VERSION "1.7" +#define DRIVER_VERSION "1.6" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -60,14 +60,13 @@ static union { struct safenet status; } ups; -static long ondelay = 1; /* minutes */ -static long offdelay = 30; /* seconds */ +static int ondelay = 1; /* minutes */ +static int offdelay = 30; /* seconds */ static int safenet_command(const char *command) { char reply[32]; - size_t i; - ssize_t ret; + int i, ret; /* * Get rid of whatever is in the in- and output buffers. @@ -261,7 +260,7 @@ static int instcmd(const char *cmdname, const char *extra) */ if (!strcasecmp(cmdname, "shutdown.return")) { char command[] = SHUTDOWN_RETURN; - + command[4] += ((offdelay % 1000) / 100); command[5] += ((offdelay % 100) / 10); command[6] += (offdelay % 10); @@ -289,7 +288,7 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -329,8 +328,8 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.model", "%s", ((v = getval("modelname")) != NULL) ? v : "unknown"); dstate_setinfo("ups.serial", "%s", ((v = getval("serialnumber")) != NULL) ? v : "unknown"); - dstate_setinfo("ups.delay.start", "%ld", 60 * ondelay); - dstate_setinfo("ups.delay.shutdown", "%ld", offdelay); + dstate_setinfo("ups.delay.start", "%d", 60 * ondelay); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); /* * These are the instant commands we support. @@ -509,7 +508,7 @@ void upsdrv_initups(void) } if ((ondelay < 0) || (ondelay > 9999)) { - fatalx(EXIT_FAILURE, "Start delay '%ld' out of range [0..9999]", ondelay); + fatalx(EXIT_FAILURE, "Start delay '%d' out of range [0..9999]", ondelay); } val = getval("offdelay"); @@ -518,7 +517,7 @@ void upsdrv_initups(void) } if ((offdelay < 0) || (offdelay > 999)) { - fatalx(EXIT_FAILURE, "Shutdown delay '%ld' out of range [0..999]", offdelay); + fatalx(EXIT_FAILURE, "Shutdown delay '%d' out of range [0..999]", offdelay); } } diff --git a/drivers/safenet.h b/drivers/safenet.h index 25d4976..12f2040 100644 --- a/drivers/safenet.h +++ b/drivers/safenet.h @@ -18,9 +18,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_SAFENET_H_SEEN -#define NUT_SAFENET_H_SEEN 1 - /* * The following commands where traced on the serial port. From these, the * COM_POLL_STAT command is just an example of how this command looks. @@ -61,5 +58,3 @@ struct safenet { char systemtest; char dunno_10; }; - -#endif /* NUT_SAFENET_H_SEEN */ diff --git a/drivers/salicru-hid.c b/drivers/salicru-hid.c deleted file mode 100644 index b49b099..0000000 --- a/drivers/salicru-hid.c +++ /dev/null @@ -1,276 +0,0 @@ -/* salicru-hid.c - subdriver to monitor Salicru USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2012 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * 2021 Francois Lacroix - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-usbhid-subdriver script. It must be customized. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" /* must be first */ - -#include "usbhid-ups.h" -#include "salicru-hid.h" -#include "main.h" /* for getval() */ -#include "usb-common.h" - -#define SALICRU_HID_VERSION "Salicru HID 0.3" -/* FIXME: experimental flag to be put in upsdrv_info */ - -/* Salicru */ -#define SALICRU_VENDORID 0x2e66 - -/* USB IDs device table */ -static usb_device_id_t salicru_usb_device_table[] = { - /* TWINPRO3/TWINRT3 (SLC-1500-TWIN PRO3) per https://github.com/networkupstools/nut/issues/1142 */ - /* SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 */ - { USB_DEVICE(SALICRU_VENDORID, 0x0201), NULL }, - { USB_DEVICE(SALICRU_VENDORID, 0x0202), NULL }, - { USB_DEVICE(SALICRU_VENDORID, 0x0203), NULL }, - - /* Salicru SPS 850 HOME per https://github.com/networkupstools/nut/pull/1199 */ - /* https://www.salicru.com/sps-home.html */ - { USB_DEVICE(SALICRU_VENDORID, 0x0300), NULL }, - - /* Terminating entry */ - { 0, 0, NULL } -}; - - -/* --------------------------------------------------------------- */ -/* Vendor-specific usage table */ -/* --------------------------------------------------------------- */ - -/* SALICRU usage table */ -static usage_lkp_t salicru_usage_lkp[] = { - { NULL, 0 } -}; - -static usage_tables_t salicru_utab[] = { - salicru_usage_lkp, - hid_usage_lkp, - NULL, -}; - -/* --------------------------------------------------------------- */ -/* HID2NUT lookup table */ -/* --------------------------------------------------------------- */ - -static hid_info_t salicru_hid2nut[] = { - -#ifdef DEBUG - { "experimental.ups.powersummary.imanufacturer", 0, 0, "UPS.PowerSummary.iManufacturer", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.iproduct", 0, 0, "UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.iserialnumber", 0, 0, "UPS.PowerSummary.iSerialNumber", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.capacitymode", 0, 0, "UPS.PowerSummary.CapacityMode", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.rechargeable", 0, 0, "UPS.PowerSummary.Rechargeable", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.designcapacity", 0, 0, "UPS.PowerSummary.DesignCapacity", NULL, "%.0f", 0, NULL }, - { "experimental.ups.powersummary.fullchargecapacity", 0, 0, "UPS.PowerSummary.FullChargeCapacity", NULL, "%.0f", 0, NULL }, -#endif /* DEBUG */ - -/* A few more unknown fields - 0.043266 [D1] Path: UPS.ff010004.ff010024.ff0100d0, Type: Feature, ReportID: 0x19, Offset: 0, Size: 8, Value: 0.1 - 0.043766 [D1] Path: UPS.ff010004.ff010024.ff0100d1, Type: Feature, ReportID: 0x1a, Offset: 0, Size: 8, Value: 0 - 0.044308 [D1] Path: UPS.ff01001d.ff010019.ff010020, Type: Feature, ReportID: 0x25, Offset: 0, Size: 1, Value: 0 - 0.044762 [D1] Path: UPS.ff01001d.ff010019.ff010021, Type: Feature, ReportID: 0x2c, Offset: 0, Size: 1, Value: 0 - 0.044891 [D1] Path: UPS.ff01001d.ff010019.ff010021, Type: Input, ReportID: 0x2c, Offset: 0, Size: 1, Value: 0 - 0.045386 [D1] Path: UPS.ff01001d.ff01001a.ff010001, Type: Feature, ReportID: 0x26, Offset: 0, Size: 1, Value: 0 - 0.045888 [D1] Path: UPS.ff01001d.ff01001a.ff010002, Type: Feature, ReportID: 0x27, Offset: 0, Size: 8, Value: 1 - 0.047553 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.047659 [D1] Can't retrieve Report 28: Value too large for defined data type - 0.047796 [D1] Path: UPS.ff01001d.ff01001b.ff010040, Type: Feature, ReportID: 0x28, Offset: 0, Size: 8 - 0.048272 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.048403 [D1] Can't retrieve Report 28: Value too large for defined data type - 0.048537 [D1] Path: UPS.ff01001d.ff01001b.ff010016, Type: Input, ReportID: 0x28, Offset: 0, Size: 8 - 0.049017 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.049147 [D1] Can't retrieve Report 28: Value too large for defined data type - 0.049280 [D1] Path: UPS.ff01001d.ff01001b.ff010018, Type: Feature, ReportID: 0x28, Offset: 8, Size: 8 - 0.050944 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.051124 [D1] Can't retrieve Report 28: Value too large for defined data type - 0.051264 [D1] Path: UPS.ff01001d.ff01001b.ff010018, Type: Input, ReportID: 0x28, Offset: 8, Size: 8 - 0.052965 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.053137 [D1] Can't retrieve Report 29: Value too large for defined data type - 0.053277 [D1] Path: UPS.ff01001d.ff01001b.ff010015, Type: Feature, ReportID: 0x29, Offset: 0, Size: 8 - 0.053804 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.053954 [D1] Can't retrieve Report 29: Value too large for defined data type - 0.054091 [D1] Path: UPS.ff01001d.ff01001b.ff010015, Type: Output, ReportID: 0x29, Offset: 0, Size: 8 - 0.054530 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.054664 [D1] Can't retrieve Report 29: Value too large for defined data type - 0.054799 [D1] Path: UPS.ff01001d.ff01001b.ff010017, Type: Feature, ReportID: 0x29, Offset: 8, Size: 8 - 0.055285 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.055421 [D1] Can't retrieve Report 29: Value too large for defined data type - 0.055557 [D1] Path: UPS.ff01001d.ff01001b.ff010017, Type: Output, ReportID: 0x29, Offset: 8, Size: 8 - 0.056130 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.056273 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.056409 [D1] Path: UPS.ff01001d.ff01001b.ff010010, Type: Feature, ReportID: 0x2d, Offset: 0, Size: 1 - 0.056927 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.057074 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.057211 [D1] Path: UPS.ff01001d.ff01001b.ff01001e, Type: Feature, ReportID: 0x2d, Offset: 1, Size: 1 - 0.057676 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.057825 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.057962 [D1] Path: UPS.ff01001d.ff01001b.ff01001f, Type: Feature, ReportID: 0x2d, Offset: 2, Size: 1 - 0.058416 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.058551 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.058685 [D1] Path: UPS.ff01001d.ff01001b.ff010010, Type: Input, ReportID: 0x2d, Offset: 0, Size: 1 - 0.059156 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.059291 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.059426 [D1] Path: UPS.ff01001d.ff01001b.ff01001e, Type: Input, ReportID: 0x2d, Offset: 1, Size: 1 - 0.059957 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.060112 [D1] Can't retrieve Report 2d: Value too large for defined data type - 0.060248 [D1] Path: UPS.ff01001d.ff01001b.ff01001f, Type: Input, ReportID: 0x2d, Offset: 2, Size: 1 - 0.061944 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.062117 [D1] Can't retrieve Report 2a: Value too large for defined data type - 0.062256 [D1] Path: UPS.ff01001d.ff01001b.ff010013, Type: Feature, ReportID: 0x2a, Offset: 0, Size: 1 - 0.063941 [D2] libusb_get_report: error sending control message: Value too large for defined data type - 0.064104 [D1] Can't retrieve Report 2b: Value too large for defined data type - 0.064242 [D1] Path: UPS.ff01001d.ff01001b.ff010014, Type: Feature, ReportID: 0x2b, Offset: 0, Size: 1 -*/ - - /* Battery page */ - { "battery.type", 0, 0, "UPS.PowerSummary.iDeviceChemistry", NULL, "%s", 0, stringid_conversion }, - { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, - { "battery.charge.warning", 0, 0, "UPS.PowerSummary.WarningCapacityLimit", NULL, "%.0f", 0, NULL }, - { "battery.charge.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "battery.runtime", 0, 0, "UPS.PowerSummary.RunTimeToEmpty", NULL, "%.0f", 0, NULL }, - { "battery.runtime.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.PowerSummary.RemainingTimeLimit", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", 0, NULL }, - { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.2f", 0, NULL }, - - /* UPS page */ - { "ups.load", 0, 0, "UPS.Output.PercentLoad", NULL, "%.0f", 0, NULL }, - { "ups.beeper.status", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "%s", 0, beeper_info }, - { "ups.test.result", 0, 0, "UPS.Output.Test", NULL, "%s", 0, test_read_info }, - { "ups.realpower.nominal", 0, 0, "UPS.Output.ConfigActivePower", NULL, "%.0f", 0, NULL }, - - /* Boolean value */ - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, NULL, HU_FLAG_QUICK_POLL, online_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, NULL, HU_FLAG_QUICK_POLL, charging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, NULL, HU_FLAG_QUICK_POLL, discharging_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.BelowRemainingCapacityLimit", NULL, NULL, HU_FLAG_QUICK_POLL, lowbatt_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.FullyCharged", NULL, NULL, 0, fullycharged_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.RemainingTimeLimitExpired", NULL, NULL, 0, timelimitexpired_info }, - { "BOOL", 0, 0, "UPS.Output.CommunicationLost", NULL, NULL, 0, commfault_info }, - { "BOOL", 0, 0, "UPS.Output.Boost", NULL, NULL, 0, boost_info }, - { "BOOL", 0, 0, "UPS.Output.Overload", NULL, NULL, 0, overload_info }, - - /* Input page */ - { "input.frequency", 0, 0, "UPS.Input.Frequency", NULL, "%.1f", 0, NULL }, - { "input.voltage.nominal", 0, 0, "UPS.Input.ConfigVoltage", NULL, "%.0f", 0, NULL }, - { "input.voltage", 0, 0, "UPS.Input.Voltage", NULL, "%.1f", 0, NULL }, - /* read-only on this model but probably R/W in other models */ -/* - { "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, - { "input.transfer.high", ST_FLAG_RW | ST_FLAG_STRING, 10, "UPS.Input.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_SEMI_STATIC, NULL }, -*/ - { "input.transfer.high", 0, 0, "UPS.PowerConverter.Output.HighVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.transfer.low", 0, 0, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - - /* Output page */ - { "output.frequency", 0, 0, "UPS.Output.Frequency", NULL, "%.1f", 0, NULL }, - { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.1f", 0, NULL }, - { "output.voltage.nominal", 0, 0, "UPS.Output.ConfigVoltage", NULL, "%.0f", 0, NULL }, - - /* instant commands. */ -/* Need testing - { "test.battery.start.quick", 0, 0, "UPS.Output.Test", NULL, "1", HU_TYPE_CMD, NULL }, - { "test.battery.start.deep", 0, 0, "UPS.Output.Test", NULL, "2", HU_TYPE_CMD, NULL }, - { "test.battery.stop", 0, 0, "UPS.Output.Test", NULL, "3", HU_TYPE_CMD, NULL }, - { "load.off.delay", 0, 0, "UPS.Output.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL }, - { "load.on.delay", 0, 0, "UPS.Output.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL }, - { "shutdown.stop", 0, 0, "UPS.Output.DelayBeforeShutdown", NULL, "-1", HU_TYPE_CMD, NULL }, - { "shutdown.reboot", 0, 0, "UPS.Output.DelayBeforeReboot", NULL, "10", HU_TYPE_CMD, NULL }, - { "beeper.on", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - { "beeper.off", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, - { "beeper.enable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "2", HU_TYPE_CMD, NULL }, - { "beeper.disable", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "1", HU_TYPE_CMD, NULL }, - { "beeper.mute", 0, 0, "UPS.PowerSummary.AudibleAlarmControl", NULL, "3", HU_TYPE_CMD, NULL }, -*/ - - /* Salicru Twin Pro 2 Descriptors: Sensors */ - { "ups.load", 0, 0, "UPS.PowerSummary.PercentLoad", NULL, "%.0f", 0, NULL }, - { "ups.test.result", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "%s", 0, test_read_info }, - { "ups.realpower.nominal", 0, 0, "UPS.Flow.[4].ConfigActivePower", NULL, "%.0f", 0, NULL }, - { "ups.realpower", 0, 0, "UPS.PowerConverter.Output.ActivePower", NULL, "%.0f", 0, NULL }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Overload", NULL, NULL, 0, overload_info }, - { "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.OverTemperature", NULL, NULL, 0, overheat_info }, - { "input.frequency", 0, 0, "UPS.PowerConverter.Input.[1].Frequency", NULL, "%.1f", 0, NULL }, - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.[1].Voltage", NULL, "%.1f", 0, NULL }, - { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.1f", 0, NULL }, - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL }, - { "output.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", 0, NULL }, - { "ups.test.result", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "%s", 0, test_read_info }, - - /* Salicru Twin Pro 2 Descriptors: Instant commands */ - { "test.battery.start.quick", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "1", HU_TYPE_CMD, NULL }, - { "test.battery.start.deep", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "2", HU_TYPE_CMD, NULL }, - { "test.battery.stop", 0, 0, "UPS.BatterySystem.Battery.Test", NULL, "3", HU_TYPE_CMD, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, NULL, 0, NULL } -}; - -static const char *salicru_format_model(HIDDevice_t *hd) { - return hd->Product; -} - -static const char *salicru_format_mfr(HIDDevice_t *hd) { - return hd->Vendor ? hd->Vendor : "Salicru"; -} - -static const char *salicru_format_serial(HIDDevice_t *hd) { - return hd->Serial; -} - -/* this function allows the subdriver to "claim" a device: return 1 if - * the device is supported by this subdriver, else 0. */ -static int salicru_claim(HIDDevice_t *hd) -{ - int status = is_usb_device_supported(salicru_usb_device_table, hd); - - switch (status) - { - case POSSIBLY_SUPPORTED: - /* by default, reject, unless the productid option is given */ - if (getval("productid")) { - return 1; - } - possibly_supported("Salicru", hd); - return 0; - - case SUPPORTED: - return 1; - - case NOT_SUPPORTED: - default: - return 0; - } -} - -subdriver_t salicru_subdriver = { - SALICRU_HID_VERSION, - salicru_claim, - salicru_utab, - salicru_hid2nut, - salicru_format_model, - salicru_format_mfr, - salicru_format_serial, - fix_report_desc, -}; diff --git a/drivers/salicru-hid.h b/drivers/salicru-hid.h deleted file mode 100644 index e0e6b9c..0000000 --- a/drivers/salicru-hid.h +++ /dev/null @@ -1,30 +0,0 @@ -/* salicru-hid.h - subdriver to monitor Salicru USB/HID devices with NUT - * - * Copyright (C) - * 2003 - 2009 Arnaud Quette - * 2005 - 2006 Peter Selinger - * 2008 - 2009 Arjen de Korte - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef SALICRU_HID_H -#define SALICRU_HID_H - -#include "usbhid-ups.h" - -extern subdriver_t salicru_subdriver; - -#endif /* SALICRU_HID_H */ diff --git a/drivers/serial.c b/drivers/serial.c index 60af06f..9c6129d 100644 --- a/drivers/serial.c +++ b/drivers/serial.c @@ -21,7 +21,6 @@ #include "timehead.h" #include "serial.h" #include "main.h" -#include "attribute.h" #include #include @@ -35,13 +34,8 @@ #include #endif -#include "nut_stdint.h" - static unsigned int comm_failures = 0; -static void ser_open_error(const char *port) - __attribute__((noreturn)); - static void ser_open_error(const char *port) { struct stat fs; @@ -63,7 +57,7 @@ static void ser_open_error(const char *port) user = getpwuid(getuid()); if (user) - printf(" Current user id: %s (%d)\n", + printf(" Current user id: %s (%d)\n", user->pw_name, (int) user->pw_uid); user = getpwuid(fs.st_uid); @@ -103,7 +97,7 @@ static void lock_set(int fd, const char *port) ret = uu_lock(xbasename(port)); if (ret != 0) - fatalx(EXIT_FAILURE, "Can't uu_lock %s: %s", xbasename(port), + fatalx(EXIT_FAILURE, "Can't uu_lock %s: %s", xbasename(port), uu_lockerr(ret)); #elif defined(HAVE_FLOCK) @@ -131,6 +125,7 @@ static void lock_set(int fd, const char *port) /* Non fatal version of ser_open */ int ser_open_nf(const char *port) + { int fd; @@ -160,7 +155,6 @@ int ser_open(const char *port) int ser_set_speed_nf(int fd, const char *port, speed_t speed) { struct termios tio; - NUT_UNUSED_VARIABLE(port); if (tcgetattr(fd, &tio) != 0) { return -1; @@ -262,29 +256,17 @@ int ser_close(int fd, const char *port) return 0; } -ssize_t ser_send_char(int fd, unsigned char ch) +int ser_send_char(int fd, unsigned char ch) { return ser_send_buf_pace(fd, 0, &ch, 1); } -static ssize_t send_formatted(int fd, const char *fmt, va_list va, useconds_t d_usec) +static int send_formatted(int fd, const char *fmt, va_list va, unsigned long d_usec) { int ret; char buf[LARGEBUF]; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(buf, sizeof(buf), fmt, va); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif if (ret >= (int)sizeof(buf)) { upslogx(LOG_WARNING, "vsnprintf needed more than %d bytes", (int)sizeof(buf)); @@ -294,26 +276,14 @@ static ssize_t send_formatted(int fd, const char *fmt, va_list va, useconds_t d_ } /* send the results of the format string with d_usec delay after each char */ -ssize_t ser_send_pace(int fd, useconds_t d_usec, const char *fmt, ...) +int ser_send_pace(int fd, unsigned long d_usec, const char *fmt, ...) { - ssize_t ret; + int ret; va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = send_formatted(fd, fmt, ap, d_usec); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); @@ -321,26 +291,14 @@ ssize_t ser_send_pace(int fd, useconds_t d_usec, const char *fmt, ...) } /* send the results of the format string with no delay */ -ssize_t ser_send(int fd, const char *fmt, ...) +int ser_send(int fd, const char *fmt, ...) { - ssize_t ret; + int ret; va_list ap; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = send_formatted(fd, fmt, ap, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); @@ -348,23 +306,22 @@ ssize_t ser_send(int fd, const char *fmt, ...) } /* send buflen bytes from buf with no delay */ -ssize_t ser_send_buf(int fd, const void *buf, size_t buflen) +int ser_send_buf(int fd, const void *buf, size_t buflen) { return ser_send_buf_pace(fd, 0, buf, buflen); } /* send buflen bytes from buf with d_usec delay after each char */ -ssize_t ser_send_buf_pace(int fd, useconds_t d_usec, const void *buf, +int ser_send_buf_pace(int fd, unsigned long d_usec, const void *buf, size_t buflen) { - ssize_t ret = 0; - ssize_t sent; + int ret; + size_t sent; const char *data = buf; - assert(buflen < SSIZE_MAX); - for (sent = 0; sent < (ssize_t)buflen; sent += ret) { - /* Conditions above ensure that (buflen - sent) > 0 below */ - ret = write(fd, &data[sent], (d_usec == 0) ? (size_t)((ssize_t)buflen - sent) : 1); + for (sent = 0; sent < buflen; sent += ret) { + + ret = write(fd, &data[sent], (d_usec == 0) ? (buflen - sent) : 1); if (ret < 1) { return ret; @@ -376,37 +333,30 @@ ssize_t ser_send_buf_pace(int fd, useconds_t d_usec, const void *buf, return sent; } -ssize_t ser_get_char(int fd, void *ch, time_t d_sec, useconds_t d_usec) +int ser_get_char(int fd, void *ch, long d_sec, long d_usec) { - /* Per standard below, we can cast here, because required ranges are - * effectively the same (and signed -1 for suseconds_t), and at most long: - * https://pubs.opengroup.org/onlinepubs/009604599/basedefs/sys/types.h.html - */ - return select_read(fd, ch, 1, d_sec, (suseconds_t)d_usec); + return select_read(fd, ch, 1, d_sec, d_usec); } -ssize_t ser_get_buf(int fd, void *buf, size_t buflen, time_t d_sec, useconds_t d_usec) +int ser_get_buf(int fd, void *buf, size_t buflen, long d_sec, long d_usec) { memset(buf, '\0', buflen); - return select_read(fd, buf, buflen, d_sec, (suseconds_t)d_usec); + return select_read(fd, buf, buflen, d_sec, d_usec); } /* keep reading until buflen bytes are received or a timeout occurs */ -ssize_t ser_get_buf_len(int fd, void *buf, size_t buflen, time_t d_sec, useconds_t d_usec) +int ser_get_buf_len(int fd, void *buf, size_t buflen, long d_sec, long d_usec) { - ssize_t ret; - ssize_t recv; + int ret; + size_t recv; char *data = buf; - assert(buflen < SSIZE_MAX); memset(buf, '\0', buflen); - for (recv = 0; recv < (ssize_t)buflen; recv += ret) { + for (recv = 0; recv < buflen; recv += ret) { - ret = select_read(fd, &data[recv], - (size_t)((ssize_t)buflen - recv), - d_sec, (suseconds_t)d_usec); + ret = select_read(fd, &data[recv], buflen - recv, d_sec, d_usec); if (ret < 1) { return ret; @@ -418,22 +368,21 @@ ssize_t ser_get_buf_len(int fd, void *buf, size_t buflen, time_t d_sec, useconds /* reads a line up to , discarding anything else that may follow, with callouts to the handler if anything matches the alertset */ -ssize_t ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, - const char *ignset, const char *alertset, void handler(char ch), - time_t d_sec, useconds_t d_usec) +int ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, + const char *ignset, const char *alertset, void handler(char ch), + long d_sec, long d_usec) { - ssize_t i, ret; + int i, ret; char tmp[64]; char *data = buf; - ssize_t count = 0, maxcount; + size_t count = 0, maxcount; - assert(buflen < SSIZE_MAX && buflen > 0); memset(buf, '\0', buflen); - maxcount = (ssize_t)buflen - 1; /* for trailing \0 */ + maxcount = buflen - 1; /* for trailing \0 */ while (count < maxcount) { - ret = select_read(fd, tmp, sizeof(tmp), d_sec, (suseconds_t)d_usec); + ret = select_read(fd, tmp, sizeof(tmp), d_sec, d_usec); if (ret < 1) { return ret; @@ -463,16 +412,16 @@ ssize_t ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, } /* as above, only with no alertset handling (just a wrapper) */ -ssize_t ser_get_line(int fd, void *buf, size_t buflen, char endchar, - const char *ignset, time_t d_sec, useconds_t d_usec) +int ser_get_line(int fd, void *buf, size_t buflen, char endchar, + const char *ignset, long d_sec, long d_usec) { return ser_get_line_alert(fd, buf, buflen, endchar, ignset, "", NULL, d_sec, d_usec); } -ssize_t ser_flush_in(int fd, const char *ignset, int verbose) +int ser_flush_in(int fd, const char *ignset, int verbose) { - ssize_t ret, extra = 0; + int ret, extra = 0; char ch; while ((ret = ser_get_char(fd, &ch, 0, 0)) > 0) { @@ -485,7 +434,7 @@ ssize_t ser_flush_in(int fd, const char *ignset, int verbose) if (verbose == 0) continue; - if (isprint((unsigned char)ch & 0xFF)) + if (isprint(ch & 0xFF)) upslogx(LOG_INFO, "ser_flush_in: read char %c", ch); else upslogx(LOG_INFO, "ser_flush_in: read char 0x%02x", ch); @@ -518,19 +467,7 @@ void ser_comm_fail(const char *fmt, ...) return; va_start(ap, fmt); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif ret = vsnprintf(why, sizeof(why), fmt, ap); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif va_end(ap); if ((ret < 1) || (ret >= (int) sizeof(why))) diff --git a/drivers/serial.h b/drivers/serial.h index c2f5a2c..5fb3a45 100644 --- a/drivers/serial.h +++ b/drivers/serial.h @@ -11,10 +11,6 @@ # include #endif /* HAVE_SYS_TERMIOS_H */ -#include /* for usleep() and useconds_t, latter also might be via */ -#include -#include /* for suseconds_t */ - /* limit the amount of spew that goes in the syslog when we lose the UPS */ #define SER_ERR_LIMIT 10 /* start limiting after 10 in a row */ #define SER_ERR_RATE 100 /* then only print every 100th error */ @@ -38,41 +34,41 @@ int ser_flush_io(int fd); int ser_close(int fd, const char *port); -ssize_t ser_send_char(int fd, unsigned char ch); +int ser_send_char(int fd, unsigned char ch); /* send the results of the format string with d_usec delay after each char */ -ssize_t ser_send_pace(int fd, useconds_t d_usec, const char *fmt, ...) +int ser_send_pace(int fd, unsigned long d_usec, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); /* send the results of the format string with no delay */ -ssize_t ser_send(int fd, const char *fmt, ...) +int ser_send(int fd, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); /* send buflen bytes from buf with no delay */ -ssize_t ser_send_buf(int fd, const void *buf, size_t buflen); +int ser_send_buf(int fd, const void *buf, size_t buflen); /* send buflen bytes from buf with d_usec delay after each char */ -ssize_t ser_send_buf_pace(int fd, useconds_t d_usec, const void *buf, +int ser_send_buf_pace(int fd, unsigned long d_usec, const void *buf, size_t buflen); -ssize_t ser_get_char(int fd, void *ch, time_t d_sec, useconds_t d_usec); +int ser_get_char(int fd, void *ch, long d_sec, long d_usec); -ssize_t ser_get_buf(int fd, void *buf, size_t buflen, time_t d_sec, useconds_t d_usec); +int ser_get_buf(int fd, void *buf, size_t buflen, long d_sec, long d_usec); /* keep reading until buflen bytes are received or a timeout occurs */ -ssize_t ser_get_buf_len(int fd, void *buf, size_t buflen, time_t d_sec, useconds_t d_usec); +int ser_get_buf_len(int fd, void *buf, size_t buflen, long d_sec, long d_usec); /* reads a line up to , discarding anything else that may follow, with callouts to the handler if anything matches the alertset */ -ssize_t ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, +int ser_get_line_alert(int fd, void *buf, size_t buflen, char endchar, const char *ignset, const char *alertset, void handler (char ch), - time_t d_sec, useconds_t d_usec); + long d_sec, long d_usec); /* as above, only with no alertset handling (just a wrapper) */ -ssize_t ser_get_line(int fd, void *buf, size_t buflen, char endchar, - const char *ignset, time_t d_sec, useconds_t d_usec); +int ser_get_line(int fd, void *buf, size_t buflen, char endchar, + const char *ignset, long d_sec, long d_usec); -ssize_t ser_flush_in(int fd, const char *ignset, int verbose); +int ser_flush_in(int fd, const char *ignset, int verbose); /* unified failure reporting: call these often */ void ser_comm_fail(const char *fmt, ...) diff --git a/drivers/skel.c b/drivers/skel.c index f6d4cb3..5d4b930 100644 --- a/drivers/skel.c +++ b/drivers/skel.c @@ -1,20 +1,18 @@ /* anything commented is optional anything else is mandatory - + for more information, refer to: * docs/developers.txt * docs/new-drivers.txt * docs/new-names.txt - + and possibly also to: * docs/hid-subdrivers.txt for USB/HID devices * or docs/snmp-subdrivers.txt for SNMP devices */ -#include "config.h" #include "main.h" -#include "attribute.h" /* #include "serial.h" */ @@ -22,7 +20,7 @@ /* #define IGNCHARS "" */ #define DRIVER_NAME "Skeleton UPS driver" -#define DRIVER_VERSION "0.03" +#define DRIVER_VERSION "0.02" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -57,7 +55,7 @@ void upsdrv_updateinfo(void) /* ser_send(upsfd, "foo%d", 1234); */ /* ser_send_buf(upsfd, bincmd, 12); */ - /* + /* * ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR, IGNCHARS); * * if (ret < STATUS_LEN) { @@ -94,9 +92,6 @@ void upsdrv_updateinfo(void) */ } -void upsdrv_shutdown(void) - __attribute__((noreturn)); - void upsdrv_shutdown(void) { /* tell the UPS to shut down, then return - DO NOT SLEEP HERE */ diff --git a/drivers/snmp-ups-helpers.c b/drivers/snmp-ups-helpers.c deleted file mode 100644 index b4116ff..0000000 --- a/drivers/snmp-ups-helpers.c +++ /dev/null @@ -1,106 +0,0 @@ -/* snmp-ups-helpers.c - Shared helper functions and data mapping tables - * for NUT Generic SNMP driver core - * - * Copyright (C) - * 2015 - 2021 Eaton (author: Arnaud Quette ) - * 2016 - 2021 Eaton (author: Jim Klimov ) - * - * Sponsored by Eaton - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -/* NUT SNMP common functions */ -#include "common.h" /* includes "config.h" which must be the first header */ -/* -#include "config.h" -#include "main.h" -#include "nut_float.h" -#include "nut_stdint.h" -*/ -#include "snmp-ups.h" -#include "timehead.h" /* time.h => strptime() */ - -#include /* for isprint() */ - -/*********************************************************************** - * Subdrivers shared helpers functions - * Code below is primarily used in snmp-ups driver, but may be part - * of other compilation units, so separated into a stand-alone file - **********************************************************************/ - -static char su_scratch_buf[255]; - -/* Temperature handling, to convert back to Celsius */ -int temperature_unit = TEMPERATURE_UNKNOWN; - -/* Convert a US formated date (mm/dd/yyyy) to an ISO 8601 Calendar date (yyyy-mm-dd) */ -const char *su_usdate_to_isodate_info_fun(void *raw_date) -{ - const char *usdate = (char *)raw_date; - struct tm tm; - memset(&tm, 0, sizeof(struct tm)); - memset(&su_scratch_buf, 0, sizeof(su_scratch_buf)); - - upsdebugx(3, "%s: US date = %s", __func__, usdate); - - /* Try to convert from US date string to time */ - /* Note strptime returns NULL upon failure, and a ptr to the last - null char of the string upon success. Just try blindly the conversion! */ - strptime(usdate, "%m/%d/%Y", &tm); - if (strftime(su_scratch_buf, 254, "%F", &tm) != 0) { - upsdebugx(3, "%s: successfully reformated: %s", __func__, su_scratch_buf); - return su_scratch_buf; - } - - return NULL; -} - -info_lkp_t su_convert_to_iso_date_info[] = { - /* array index = FUNMAP_USDATE_TO_ISODATE: */ - { 1, "dummy", su_usdate_to_isodate_info_fun, NULL }, - { 0, NULL, NULL, NULL } -}; - -/* Process temperature value according to 'temperature_unit' */ -const char *su_temperature_read_fun(void *raw_snmp_value) -{ - const long snmp_value = *((long*)raw_snmp_value); - long celsius_value = snmp_value; - - memset(su_scratch_buf, 0, sizeof(su_scratch_buf)); - - switch (temperature_unit) { - case TEMPERATURE_KELVIN: - celsius_value = (snmp_value / 10) - 273.15; - snprintf(su_scratch_buf, sizeof(su_scratch_buf), "%.1ld", celsius_value); - break; - case TEMPERATURE_CELSIUS: - snprintf(su_scratch_buf, sizeof(su_scratch_buf), "%.1ld", (snmp_value / 10)); - break; - case TEMPERATURE_FAHRENHEIT: - celsius_value = (((snmp_value / 10) - 32) * 5) / 9; - snprintf(su_scratch_buf, sizeof(su_scratch_buf), "%.1ld", celsius_value); - break; - case TEMPERATURE_UNKNOWN: - default: - upsdebugx(1, "%s: not a known temperature unit for conversion!", __func__); - break; - } - upsdebugx(2, "%s: %.1ld => %s", __func__, (snmp_value / 10), su_scratch_buf); - return su_scratch_buf; -} diff --git a/drivers/snmp-ups.c b/drivers/snmp-ups.c index fad0997..514c699 100644 --- a/drivers/snmp-ups.c +++ b/drivers/snmp-ups.c @@ -1,11 +1,9 @@ -/* snmp-ups.c - NUT Generic SNMP driver core (supports different MIBs) +/* snmp-ups.c - NUT Meta SNMP driver (support different MIBS) * - * Based on NetSNMP API (Simple Network Management Protocol v1-2c-3) + * Based on NetSNMP API (Simple Network Management Protocol V1-2) * * Copyright (C) - * 2002 - 2014 Arnaud Quette - * 2015 - 2021 Eaton (author: Arnaud Quette ) - * 2016 - 2022 Eaton (author: Jim Klimov ) + * 2002 - 2012 Arnaud Quette * 2002 - 2006 Dmitry Frolov * J.W. Hoogervorst * Niels Baggesen @@ -31,100 +29,54 @@ * */ +#include + /* NUT SNMP common functions */ -#include "main.h" /* includes "config.h" which must be the first header */ -#include "nut_float.h" -#include "nut_stdint.h" +#include "main.h" #include "snmp-ups.h" #include "parseconf.h" -#include /* for isprint() */ - /* include all known mib2nut lookup tables */ #include "apc-mib.h" #include "mge-mib.h" #include "netvision-mib.h" #include "powerware-mib.h" -#include "eaton-pdu-genesis2-mib.h" -#include "eaton-pdu-marlin-mib.h" -#include "eaton-pdu-pulizzi-mib.h" -#include "eaton-pdu-revelation-mib.h" +#include "eaton-mib.h" #include "raritan-pdu-mib.h" -#include "raritan-px2-mib.h" #include "baytech-mib.h" #include "compaq-mib.h" #include "bestpower-mib.h" #include "cyberpower-mib.h" #include "delta_ups-mib.h" -#include "huawei-mib.h" #include "ietf-mib.h" -#include "xppc-mib.h" -#include "eaton-ats16-nmc-mib.h" -#include "eaton-ats16-nm2-mib.h" -#include "apc-ats-mib.h" -#include "apc-pdu-mib.h" -#include "eaton-ats30-mib.h" -#include "emerson-avocent-pdu-mib.h" -#include "hpe-pdu-mib.h" /* Address API change */ -#if ( ! NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol ) && ( ! defined usmAESPrivProtocol ) +#ifndef usmAESPrivProtocol #define usmAESPrivProtocol usmAES128PrivProtocol #endif -#ifdef USM_PRIV_PROTO_AES_LEN -# define NUT_securityPrivProtoLen USM_PRIV_PROTO_AES_LEN -#else -# ifdef USM_PRIV_PROTO_AES128_LEN -# define NUT_securityPrivProtoLen USM_PRIV_PROTO_AES128_LEN -# else -/* FIXME: Find another way to get the size of array(?) to avoid: - * error: division 'sizeof (oid * {aka long unsigned int *}) / sizeof (oid {aka long unsigned int})' does not compute the number of array elements [-Werror=sizeof-pointer-div] - * See also https://bugs.php.net/bug.php?id=37564 for context - * which is due to most values in /usr/include/net-snmp/librarytransform_oids.h - * being defined as "oid[10]" or similar arrays, and "backwards compatibility" - * usmAESPrivProtocol name is an "oid *" pointer. - */ -# define NUT_securityPrivProtoLen (sizeof(usmAESPrivProtocol)/sizeof(oid)) -# endif -#endif - static mib2nut_info_t *mib2nut[] = { - &apc_ats, /* This struct comes from : apc-ats-mib.c */ - &apc_pdu_rpdu, /* This struct comes from : apc-pdu-mib.c */ - &apc_pdu_rpdu2, /* This struct comes from : apc-pdu-mib.c */ - &apc_pdu_msp, /* This struct comes from : apc-pdu-mib.c */ - &apc, /* This struct comes from : apc-mib.c */ - &baytech, /* This struct comes from : baytech-mib.c */ - &bestpower, /* This struct comes from : bestpower-mib.c */ - &compaq, /* This struct comes from : compaq-mib.c */ - &cyberpower, /* This struct comes from : cyberpower-mib.c */ - &delta_ups, /* This struct comes from : delta_ups-mib.c */ - &eaton_ats16_nmc, /* This struct comes from : eaton-ats16-nmc-mib.c */ - &eaton_ats16_nm2, /* This struct comes from : eaton-ats16-nm2-mib.c */ - &eaton_ats30, /* This struct comes from : eaton-ats30-mib.c */ - &eaton_marlin, /* This struct comes from : eaton-mib.c */ - &emerson_avocent_pdu, /* This struct comes from : emerson-avocent-pdu-mib.c */ - &aphel_revelation, /* This struct comes from : eaton-mib.c */ - &aphel_genesisII, /* This struct comes from : eaton-mib.c */ - &pulizzi_switched1, /* This struct comes from : eaton-mib.c */ - &pulizzi_switched2, /* This struct comes from : eaton-mib.c */ - &hpe_pdu, /* This struct comes from : hpe-pdu-mib.c */ - &huawei, /* This struct comes from : huawei-mib.c */ - &mge, /* This struct comes from : mge-mib.c */ - &netvision, /* This struct comes from : netvision-mib.c */ - &powerware, /* This struct comes from : powerware-mib.c */ - &pxgx_ups, /* This struct comes from : powerware-mib.c */ - &raritan, /* This struct comes from : raritan-pdu-mib.c */ - &raritan_px2, /* This struct comes from : raritan-px2-mib.c */ - &xppc, /* This struct comes from : xppc-mib.c */ + &apc, + &mge, + &netvision, + &powerware, + &aphel_genesisII, + &aphel_revelation, + &eaton_marlin, + &pulizzi_switched1, + &pulizzi_switched2, + &raritan, + &baytech, + &compaq, + &bestpower, + &cyberpower, + &delta_ups, /* * Prepend vendor specific MIB mappings before IETF, so that * if a device supports both IETF and vendor specific MIB, - * the vendor specific one takes precedence (when mibs=auto) + * the vendor specific one takes precedence (when mib=auto) */ - &tripplite_ietf, /* This struct comes from : ietf-mib.c */ - &ietf, /* This struct comes from : ietf-mib.c */ + &ietf, /* end of structure. */ NULL }; @@ -133,84 +85,44 @@ struct snmp_session g_snmp_sess, *g_snmp_sess_p; const char *OID_pwr_status; int g_pwr_battery; int pollfreq; /* polling frequency */ -int semistaticfreq; /* semistatic entry update frequency */ -static int semistatic_countdown = 0; - -static int quirk_symmetra_threephase = 0; - -/* Number of device(s): standard is "1", but talking - * to a daisychain (master device) means more than 1 - * (a directly addressable member of a daisy chain - * would be seen as a single-device chain though) - */ -static long devices_count = 1; -/* global var to handle daisychain iterations - - * changed by loops in snmp_ups_walk() and su_addcmd(); - * may be 0 for addressing certain values/commands - * across all chain devices via master (1); - * also may be 0 for non-daisychained devices - */ -static int current_device_number = 0; -/* global var to handle daisychain iterations - - * made TRUE if we resolved a "device.count" value - */ -static bool_t daisychain_enabled = FALSE; -static daisychain_info_t **daisychain_info = NULL; +int input_phases, output_phases, bypass_phases; /* pointer to the Snmp2Nut lookup table */ mib2nut_info_t *mib2nut_info; /* FIXME: to be trashed */ snmp_info_t *snmp_info; alarms_info_t *alarms_info; -static const char *mibname; -static const char *mibvers; +const char *mibname; +const char *mibvers; + +static void disable_transfer_oids(void); #define DRIVER_NAME "Generic SNMP UPS driver" -#define DRIVER_VERSION "1.21" +#define DRIVER_VERSION "0.70" /* driver description structure */ upsdrv_info_t upsdrv_info = { DRIVER_NAME, DRIVER_VERSION, "Arnaud Quette \n" \ - "Arnaud Quette \n" \ "Dmitry Frolov \n" \ "J.W. Hoogervorst \n" \ "Niels Baggesen \n" \ - "Jim Klimov \n" \ "Arjen de Korte ", DRV_STABLE, { NULL } }; /* FIXME: integrate MIBs info? do the same as for usbhid-ups! */ -static time_t lastpoll = 0; +time_t lastpoll = 0; -/* Communication status handling */ -#define COMM_UNKNOWN 0 -#define COMM_OK 1 -#define COMM_LOST 2 -static int comm_status = COMM_UNKNOWN; - -/* template OIDs index start with 0 or 1 (estimated stable for a MIB), +/* outlet OID index start with 0 or 1, * automatically guessed at the first pass */ -static int template_index_base = -1; -/* Not that stable in the end... */ -static int device_template_index_base = -1; /* OID index of the 1rst daisychained device */ -static int outlet_template_index_base = -1; -static int outletgroup_template_index_base = -1; -static int ambient_template_index_base = -1; -static int device_template_offset = -1; +int outlet_index_base = -1; /* sysOID location */ #define SYSOID_OID ".1.3.6.1.2.1.1.2.0" -/* Forward functions declarations */ -static void disable_transfer_oids(void); -bool_t get_and_process_data(int mode, snmp_info_t *su_info_p); -int extract_template_number(snmp_info_flags_t template_type, const char* varname); -snmp_info_flags_t get_template_type(const char* varname); - /* --------------------------------------------- * driver functions implementations * --------------------------------------------- */ @@ -218,67 +130,33 @@ void upsdrv_initinfo(void) { snmp_info_t *su_info_p; - upsdebugx(1, "SNMP UPS driver: entering %s()", __func__); + upsdebugx(1, "SNMP UPS driver : entering upsdrv_initinfo()"); dstate_setinfo("driver.version.data", "%s MIB %s", mibname, mibvers); - if (snmp_info == NULL) { - fatalx(EXIT_FAILURE, "%s: snmp_info is not initialized", __func__); - } - - if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty", __func__); - } - /* add instant commands to the info database. - * outlet (and groups) commands are processed later, during initial walk */ - for (su_info_p = &snmp_info[0]; (su_info_p != NULL && su_info_p->info_type != NULL) ; su_info_p++) + * outlet commands are processed later, during initial walk */ + for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++) { - if (su_info_p->flags == 0UL) { - upsdebugx(4, - "SNMP UPS driver: %s: MIB2NUT mapping '%s' (OID '%s') did not define flags bits. " - "Entry would be treated as SU_FLAG_OK if available in returned data.", - __func__, - (su_info_p->info_type ? su_info_p->info_type : ""), - (su_info_p->OID ? su_info_p->OID : "") - ); - /* Treat as OK if avail, otherwise discarded */ - } - su_info_p->flags |= SU_FLAG_OK; if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) - && !(su_info_p->flags & SU_OUTLET) - && !(su_info_p->flags & SU_OUTLET_GROUP)) - { + && !(su_info_p->flags & SU_OUTLET)) { /* first check that this OID actually exists */ - /* FIXME: daisychain commands support! */ - su_addcmd(su_info_p); -/* if (nut_snmp_get(su_info_p->OID) != NULL) { dstate_addcmd(su_info_p->info_type); upsdebugx(1, "upsdrv_initinfo(): adding command '%s'", su_info_p->info_type); } -*/ } } if (testvar("notransferoids")) disable_transfer_oids(); - if (testvar("symmetrathreephase")) - quirk_symmetra_threephase = 1; - else - quirk_symmetra_threephase = 0; - /* initialize all other INFO_ fields from list */ - if (snmp_ups_walk(SU_WALKMODE_INIT) == TRUE) { + if (snmp_ups_walk(SU_WALKMODE_INIT)) dstate_dataok(); - comm_status = COMM_OK; - } - else { + else dstate_datastale(); - comm_status = COMM_LOST; - } /* setup handlers for instcmd and setvar functions */ upsh.setvar = su_setvar; @@ -287,45 +165,24 @@ void upsdrv_initinfo(void) void upsdrv_updateinfo(void) { - upsdebugx(1,"SNMP UPS driver: entering %s()", __func__); + upsdebugx(1,"SNMP UPS driver : entering upsdrv_updateinfo()"); /* only update every pollfreq */ /* FIXME: only update status (SU_STATUS_*), à la usbhid-ups, in between */ if (time(NULL) > (lastpoll + pollfreq)) { - alarm_init(); status_init(); /* update all dynamic info fields */ - if (snmp_ups_walk(SU_WALKMODE_UPDATE)) { - upsdebugx(1, "%s: pollfreq: Data OK", __func__); - dstate_dataok(); - comm_status = COMM_OK; - } - else { - upsdebugx(1, "%s: pollfreq: Data STALE", __func__); - dstate_datastale(); - comm_status = COMM_LOST; - } - - /* Commit status first, otherwise in daisychain mode, "device.0" may - * clear the alarm count since it has an empty alarm buffer and if there - * is only one device that has alarms! */ - if (daisychain_enabled == FALSE) - alarm_commit(); - status_commit(); - if (daisychain_enabled == TRUE) - alarm_commit(); - - /* store timestamp */ - lastpoll = time(NULL); - } - else { - /* Just tell the same status to upsd */ - if (comm_status == COMM_OK) + if (snmp_ups_walk(SU_WALKMODE_UPDATE)) dstate_dataok(); else dstate_datastale(); + + status_commit(); + + /* store timestamp */ + lastpoll = time(NULL); } } @@ -340,11 +197,8 @@ void upsdrv_shutdown(void) but a limitation of the interface used. */ - upsdebugx(1, "%s...", __func__); + upsdebugx(1, "upsdrv_shutdown..."); - /* set shutdown and autostart delay */ - set_delays(); - /* Try to shutdown with delay */ if (su_instcmd("shutdown.return", NULL) == STAT_INSTCMD_HANDLED) { /* Shutdown successful */ @@ -368,33 +222,24 @@ void upsdrv_shutdown(void) void upsdrv_help(void) { - upsdebugx(1, "entering %s", __func__); + upsdebugx(1, "entering upsdrv_help"); } /* list flags and values that you want to receive via -x */ void upsdrv_makevartable(void) { - upsdebugx(1, "entering %s()", __func__); + upsdebugx(1, "entering upsdrv_makevartable()"); addvar(VAR_VALUE, SU_VAR_MIBS, - "NOTE: You can run the driver binary with '-x mibs=--list' for an up to date listing)\n" "Set MIB compliance (default=ietf, allowed: mge,apcc,netvision,pw,cpqpower,...)"); addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_COMMUNITY, "Set community name (default=public)"); addvar(VAR_VALUE, SU_VAR_VERSION, - "Set SNMP version (default=v1, allowed: v2c,v3)"); + "Set SNMP version (default=v1, allowed v2c)"); addvar(VAR_VALUE, SU_VAR_POLLFREQ, "Set polling frequency in seconds, to reduce network flow (default=30)"); - addvar(VAR_VALUE, SU_VAR_SEMISTATICFREQ, - "Set semistatic value update frequency in update cycles, to reduce network flow (default=10)"); - addvar(VAR_VALUE, SU_VAR_RETRIES, - "Specifies the number of Net-SNMP retries to be used in the requests (default=5)"); - addvar(VAR_VALUE, SU_VAR_TIMEOUT, - "Specifies the Net-SNMP timeout in seconds between retries (default=1)"); addvar(VAR_FLAG, "notransferoids", "Disable transfer OIDs (use on APCC Symmetras)"); - addvar(VAR_FLAG, "symmetrathreephase", - "Enable APCC three phase Symmetra quirks (use on APCC three phase Symmetras)"); addvar(VAR_VALUE, SU_VAR_SECLEVEL, "Set the securityLevel used for SNMPv3 messages (default=noAuthNoPriv, allowed: authNoPriv,authPriv)"); addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_SECNAME, @@ -402,205 +247,24 @@ void upsdrv_makevartable(void) addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_AUTHPASSWD, "Set the authentication pass phrase used for authenticated SNMPv3 messages (no default)"); addvar(VAR_VALUE | VAR_SENSITIVE, SU_VAR_PRIVPASSWD, - "Set the privacy pass phrase used for encrypted SNMPv3 messages (no default)"); - - /* Construct addvar() for SU_VAR_AUTHPROT: */ - { int comma = 0; - char tmp_buf[SU_LARGEBUF]; - char *p = tmp_buf; - char *pn; /* proto name to add */ - size_t remain = sizeof(tmp_buf) - 1; - int ret; - NUT_UNUSED_VARIABLE(comma); /* potentially, if no protocols are available */ - - tmp_buf[0] = '\0'; - - ret = snprintf(p, remain, "%s", - "Set the authentication protocol ("); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar()"); - } - p += ret; - remain -= (size_t)ret; - -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol - pn = "MD5"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol - pn = "SHA"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - pn = "SHA256"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - pn = "SHA384"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - pn = "SHA512"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif - - pn = "none supported"; - ret = snprintf(p, remain, "%s", (comma++ ? "" : pn) ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; - - ret = snprintf(p, remain, "%s", - ") used for authenticated SNMPv3 messages (default=MD5 if available)"); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar()"); - } - p += ret; - remain -= (size_t)ret; - - addvar(VAR_VALUE, SU_VAR_AUTHPROT, tmp_buf); - } /* Construct addvar() for AUTHPROTO */ - - /* Construct addvar() for SU_VAR_PRIVPROT: */ - { int comma = 0; - char tmp_buf[SU_LARGEBUF]; - char *p = tmp_buf; - char *pn; /* proto name to add */ - size_t remain = sizeof(tmp_buf) - 1; - int ret; - NUT_UNUSED_VARIABLE(comma); /* potentially, if no protocols are available */ - - tmp_buf[0] = '\0'; - - ret = snprintf(p, remain, "%s", - "Set the privacy protocol ("); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar()"); - } - p += ret; - remain -= (size_t)ret; - -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol - pn = "DES"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol - pn = "AES"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -#endif -#if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - pn = "AES192"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -# endif -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - pn = "AES256"; - ret = snprintf(p, remain, "%s%s", (comma++ ? ", " : ""), pn ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; -# endif -#endif /* NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 */ - - pn = "none supported"; - ret = snprintf(p, remain, "%s", (comma++ ? "" : pn) ); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar(%s)", pn); - } - p += ret; - remain -= (size_t)ret; - - ret = snprintf(p, remain, "%s", - ") used for encrypted SNMPv3 messages (default=DES if available)"); - if (ret < 0 || (uintmax_t)ret > (uintmax_t)remain || (uintmax_t)ret > SIZE_MAX) { - fatalx(EXIT_FAILURE, "Could not addvar()"); - } - p += ret; - remain -= (size_t)ret; - - addvar(VAR_VALUE, SU_VAR_PRIVPROT, tmp_buf); - } /* Construct addvar() for PRIVPROTO */ - - addvar(VAR_VALUE, SU_VAR_ONDELAY, - "Set start delay time after shutdown"); - addvar(VAR_VALUE, SU_VAR_OFFDELAY, - "Set delay time before shutdown "); + "Set the privacy pass phrase used for encrypted SNMPv3 messages (no default)"); + addvar(VAR_VALUE, SU_VAR_AUTHPROT, + "Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages (default=MD5)"); + addvar(VAR_VALUE, SU_VAR_PRIVPROT, + "Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages (default=DES)"); } void upsdrv_initups(void) { - snmp_info_t *su_info_p, *cur_info_p; + snmp_info_t *su_info_p; char model[SU_INFOSIZE]; - bool_t status= FALSE; + bool_t status; const char *mibs; - int curdev = 0; - upsdebugx(1, "SNMP UPS driver: entering %s()", __func__); + upsdebugx(1, "SNMP UPS driver : entering upsdrv_initups()"); /* Retrieve user's parameters */ mibs = testvar(SU_VAR_MIBS) ? getval(SU_VAR_MIBS) : "auto"; - if (!strcmp(mibs, "--list")) { - printf("The 'mibs' argument is '%s', so just listing the mappings this driver knows,\n" - "and for 'mibs=auto' these mappings will be tried in the following order until\n" - "the first one matches your device\n\n", mibs); - int i; - printf("%7s\t%-23s\t%-7s\t%-31s\t%-s\n", - "NUMBER", "MAPPING NAME", "VERSION", - "ENTRY POINT OID", "AUTO CHECK OID"); - for (i=0; mib2nut[i] != NULL; i++) { - printf(" %4d \t%-23s\t%7s\t%-31s\t%-s\n", (i+1), - mib2nut[i]->mib_name ? mib2nut[i]->mib_name : "" , - mib2nut[i]->mib_version ? mib2nut[i]->mib_version : "" , - mib2nut[i]->sysOID ? mib2nut[i]->sysOID : "" , - mib2nut[i]->oid_auto_check ? mib2nut[i]->oid_auto_check : "" ); - } - printf("\nOverall this driver has loaded %d MIB-to-NUT mapping tables\n", i); - exit(EXIT_SUCCESS); - } /* init SNMP library, etc... */ nut_snmp_init(progname, device_path); @@ -616,68 +280,9 @@ void upsdrv_initups(void) else pollfreq = DEFAULT_POLLFREQ; - /* init semistatic update frequency */ - if (getval(SU_VAR_SEMISTATICFREQ)) - semistaticfreq = atoi(getval(SU_VAR_SEMISTATICFREQ)); - else - semistaticfreq = DEFAULT_SEMISTATICFREQ; - if (semistaticfreq < 1) { - upsdebugx(1, "Bad %s value provided, setting to default", SU_VAR_SEMISTATICFREQ); - semistaticfreq = DEFAULT_SEMISTATICFREQ; - } - semistatic_countdown = semistaticfreq; - /* Get UPS Model node to see if there's a MIB */ -/* FIXME: extend and use match_model_OID(char *model) */ su_info_p = su_find_info("ups.model"); - /* Try to get device.model if ups.model is not available */ - if (su_info_p == NULL) - su_info_p = su_find_info("device.model"); - - if (su_info_p != NULL) { - /* Daisychain specific: we may have a template (including formatting - * string) that needs to be adapted! */ - if (strchr(su_info_p->OID, '%') != NULL) - { - upsdebugx(2, "Found template, need to be adapted"); - cur_info_p = (snmp_info_t *)malloc(sizeof(snmp_info_t)); - cur_info_p->info_type = (char *)xmalloc(SU_INFOSIZE); - cur_info_p->OID = (char *)xmalloc(SU_INFOSIZE); - snprintf((char*)cur_info_p->info_type, SU_INFOSIZE, "%s", su_info_p->info_type); - /* Use the daisychain master (0) / 1rst device index */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char*)cur_info_p->OID, SU_INFOSIZE, su_info_p->OID, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } - else { - upsdebugx(2, "Found entry, not a template %s", su_info_p->OID); - /* Otherwise, just point at what we found */ - cur_info_p = su_info_p; - } - - /* Actually get the data */ - status = nut_snmp_get_str(cur_info_p->OID, model, sizeof(model), NULL); - - /* Free our malloc, if it was dynamic */ - if (strchr(su_info_p->OID, '%') != NULL) { - if (cur_info_p->info_type != NULL) - free((char*)cur_info_p->info_type); - if (cur_info_p->OID != NULL) - free((char*)cur_info_p->OID); - if (cur_info_p != NULL) - free((char*)cur_info_p); - } - } + status = nut_snmp_get_str(su_info_p->OID, model, sizeof(model), NULL); if (status == TRUE) upslogx(0, "Detected %s on host %s (mib: %s %s)", @@ -686,24 +291,6 @@ void upsdrv_initups(void) fatalx(EXIT_FAILURE, "%s MIB wasn't found on %s", mibs, g_snmp_sess.peername); /* FIXME: "No supported device detected" */ - /* Init daisychain and check if support is required */ - daisychain_init(); - - /* Allocate / init the daisychain info structure (for phases only for now) - * daisychain_info[0] is the whole chain! (added +1) */ - daisychain_info = (daisychain_info_t**)malloc( - sizeof(daisychain_info_t) * (size_t)(devices_count + 1) - ); - for (curdev = 0 ; curdev <= devices_count ; curdev++) { - daisychain_info[curdev] = (daisychain_info_t*)malloc(sizeof(daisychain_info_t)); - daisychain_info[curdev]->input_phases = (long)-1; - daisychain_info[curdev]->output_phases = (long)-1; - daisychain_info[curdev]->bypass_phases = (long)-1; - } - - /* FIXME: also need daisychain awareness (so init)! - * i.e load.off.delay+load.off + device.1.load.off.delay+device.1.load.off + ... */ -/* FIXME: daisychain commands support! */ if (su_find_info("load.off.delay")) { /* Adds default with a delay value of '0' (= immediate) */ dstate_addcmd("load.off"); @@ -719,59 +306,10 @@ void upsdrv_initups(void) dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); } - - /* Publish sysDescr, sysContact and sysLocation (from IETF standard paths) - * for all subdrivers that do not have one defined in their mapping - * tables (note: for lack of better knowledge, defined as read-only - * entries here, and also read-once - not updated during driver uptime) */ - - if (NULL == dstate_getinfo("device.description") - && NULL == dstate_getinfo("device.1.description") - ) { - /* sysDescr.0 */ - if (nut_snmp_get_str(".1.3.6.1.2.1.1.1.0", model, sizeof(model), NULL) == TRUE) { - upsdebugx(2, "Using IETF-MIB default to get and publish sysDescr for device.description (once)"); - dstate_setinfo("device.description", "%s", model); - } else { - upsdebugx(2, "Can't get and publish sysDescr for device.description"); - } - } - - if (NULL == dstate_getinfo("device.contact") - && NULL == dstate_getinfo("device.1.contact") - ) { - /* sysContact.0 */ - if (nut_snmp_get_str(".1.3.6.1.2.1.1.4.0", model, sizeof(model), NULL) == TRUE) { - upsdebugx(2, "Using IETF-MIB default to get and publish sysContact for device.contact (once)"); - dstate_setinfo("device.contact", "%s", model); - } else { - upsdebugx(2, "Can't get and publish sysContact for device.contact"); - } - } - - if (NULL == dstate_getinfo("device.location") - && NULL == dstate_getinfo("device.1.location") - ) { - /* sysLocation.0 */ - if (nut_snmp_get_str(".1.3.6.1.2.1.1.6.0", model, sizeof(model), NULL) == TRUE) { - upsdebugx(2, "Using IETF-MIB default to get and publish sysLocation for device.location (once)"); - dstate_setinfo("device.location", "%s", model); - } else { - upsdebugx(2, "Can't get and publish sysLocation for device.location"); - } - } - - /* set shutdown and autostart delay */ - set_delays(); } void upsdrv_cleanup(void) { - /* General cleanup */ - if (daisychain_info) - free(daisychain_info); - - /* Net-SNMP specific cleanup */ nut_snmp_cleanup(); } @@ -785,10 +323,8 @@ void nut_snmp_init(const char *type, const char *hostname) const char *community, *version; const char *secLevel = NULL, *authPassword, *privPassword; const char *authProtocol, *privProtocol; - int snmp_retries = DEFAULT_NETSNMP_RETRIES; - long snmp_timeout = DEFAULT_NETSNMP_TIMEOUT; - upsdebugx(2, "SNMP UPS driver: entering %s(%s)", __func__, type); + upsdebugx(2, "SNMP UPS driver : entering nut_snmp_init(%s)", type); /* Force numeric OIDs resolution (ie, do not resolve to textual names) * This is mostly for the convenience of debug output */ @@ -805,34 +341,9 @@ void nut_snmp_init(const char *type, const char *hostname) g_snmp_sess.peername = xstrdup(hostname); - /* Net-SNMP timeout and retries */ - if (testvar(SU_VAR_RETRIES)) { - snmp_retries = atoi(getval(SU_VAR_RETRIES)); - } - g_snmp_sess.retries = snmp_retries; - upsdebugx(2, "Setting SNMP retries to %i", snmp_retries); - - if (testvar(SU_VAR_TIMEOUT)) { - snmp_timeout = atol(getval(SU_VAR_TIMEOUT)); - } - /* We have to convert from seconds to microseconds */ - g_snmp_sess.timeout = snmp_timeout * ONE_SEC; - upsdebugx(2, "Setting SNMP timeout to %ld second(s)", snmp_timeout); - /* Retrieve user parameters */ version = testvar(SU_VAR_VERSION) ? getval(SU_VAR_VERSION) : "v1"; - -/* Older CLANG (e.g. clang-3.4) sees short strings in str{n}cmp() - * arguments as arrays and claims out-of-bounds accesses - */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Warray-bounds" -#endif -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Warray-bounds" -#endif + if ((strcmp(version, "v1") == 0) || (strcmp(version, "v2c") == 0)) { g_snmp_sess.version = (strcmp(version, "v1") == 0) ? SNMP_VERSION_1 : SNMP_VERSION_2c; community = testvar(SU_VAR_COMMUNITY) ? getval(SU_VAR_COMMUNITY) : "public"; @@ -840,12 +351,6 @@ void nut_snmp_init(const char *type, const char *hostname) g_snmp_sess.community_len = strlen(community); } else if (strcmp(version, "v3") == 0) { -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS) -# pragma GCC diagnostic pop -#endif /* SNMP v3 related init */ g_snmp_sess.version = SNMP_VERSION_3; @@ -896,74 +401,23 @@ void nut_snmp_init(const char *type, const char *hostname) g_snmp_sess.securityAuthKeyLen = USM_AUTH_KU_LEN; authProtocol = testvar(SU_VAR_AUTHPROT) ? getval(SU_VAR_AUTHPROT) : "MD5"; -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol if (strcmp(authProtocol, "MD5") == 0) { g_snmp_sess.securityAuthProto = usmHMACMD5AuthProtocol; g_snmp_sess.securityAuthProtoLen = sizeof(usmHMACMD5AuthProtocol)/sizeof(oid); } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol - if (strcmp(authProtocol, "SHA") == 0) { + else if (strcmp(authProtocol, "SHA") == 0) { g_snmp_sess.securityAuthProto = usmHMACSHA1AuthProtocol; g_snmp_sess.securityAuthProtoLen = sizeof(usmHMACSHA1AuthProtocol)/sizeof(oid); } else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - if (strcmp(authProtocol, "SHA256") == 0) { - g_snmp_sess.securityAuthProto = usmHMAC192SHA256AuthProtocol; - g_snmp_sess.securityAuthProtoLen = sizeof(usmHMAC192SHA256AuthProtocol)/sizeof(oid); - } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - if (strcmp(authProtocol, "SHA384") == 0) { - g_snmp_sess.securityAuthProto = usmHMAC256SHA384AuthProtocol; - g_snmp_sess.securityAuthProtoLen = sizeof(usmHMAC256SHA384AuthProtocol)/sizeof(oid); - } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - if (strcmp(authProtocol, "SHA512") == 0) { - g_snmp_sess.securityAuthProto = usmHMAC384SHA512AuthProtocol; - g_snmp_sess.securityAuthProtoLen = sizeof(usmHMAC384SHA512AuthProtocol)/sizeof(oid); - } - else -#endif fatalx(EXIT_FAILURE, "Bad SNMPv3 authProtocol: %s", authProtocol); /* set the authentication key to a MD5/SHA1 hashed version of our * passphrase (must be at least 8 characters long) */ - if (g_snmp_sess.securityLevel != SNMP_SEC_LEVEL_NOAUTH) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - -/* NOTE: Net-SNMP headers just are weird like that, in the same release: -net-snmp/types.h: size_t securityAuthProtoLen; -net-snmp/library/keytools.h: int generate_Ku(const oid * hashtype, u_int hashtype_len, ... - * Should we match in configure like for "getnameinfo()" arg types? - * Currently we cast one to another, below (detecting target type could help). - */ - if ((uintmax_t)g_snmp_sess.securityAuthProtoLen > UINT_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - fatalx(EXIT_FAILURE, - "Bad SNMPv3 securityAuthProtoLen: %zu", - g_snmp_sess.securityAuthProtoLen); - } - + if(g_snmp_sess.securityLevel != SNMP_SEC_LEVEL_NOAUTH) { if (generate_Ku(g_snmp_sess.securityAuthProto, - (u_int)g_snmp_sess.securityAuthProtoLen, - (const unsigned char *) authPassword, strlen(authPassword), + g_snmp_sess.securityAuthProtoLen, + (u_char *) authPassword, strlen(authPassword), g_snmp_sess.securityAuthKey, &g_snmp_sess.securityAuthKeyLen) != SNMPERR_SUCCESS) { @@ -973,65 +427,24 @@ net-snmp/library/keytools.h: int generate_Ku(const oid * hashtype, u_int ha privProtocol = testvar(SU_VAR_PRIVPROT) ? getval(SU_VAR_PRIVPROT) : "DES"; -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol if (strcmp(privProtocol, "DES") == 0) { g_snmp_sess.securityPrivProto = usmDESPrivProtocol; g_snmp_sess.securityPrivProtoLen = sizeof(usmDESPrivProtocol)/sizeof(oid); } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol - if (strcmp(privProtocol, "AES") == 0) { + else if (strcmp(privProtocol, "AES") == 0) { g_snmp_sess.securityPrivProto = usmAESPrivProtocol; - g_snmp_sess.securityPrivProtoLen = NUT_securityPrivProtoLen; + g_snmp_sess.securityPrivProtoLen = sizeof(usmAESPrivProtocol)/sizeof(oid); } else -#endif -#if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - if (strcmp(privProtocol, "AES192") == 0) { - g_snmp_sess.securityPrivProto = usmAES192PrivProtocol; - g_snmp_sess.securityPrivProtoLen = (sizeof(usmAES192PrivProtocol)/sizeof(oid)); - } - else -# endif -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - if (strcmp(privProtocol, "AES256") == 0) { - g_snmp_sess.securityPrivProto = usmAES256PrivProtocol; - g_snmp_sess.securityPrivProtoLen = (sizeof(usmAES256PrivProtocol)/sizeof(oid)); - } - else -# endif -#endif /* NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 */ - fatalx(EXIT_FAILURE, "Bad SNMPv3 privProtocol: %s", privProtocol); + fatalx(EXIT_FAILURE, "Bad SNMPv3 authProtocol: %s", authProtocol); /* set the privacy key to a MD5/SHA1 hashed version of our * passphrase (must be at least 8 characters long) */ - if (g_snmp_sess.securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) { + if(g_snmp_sess.securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) { g_snmp_sess.securityPrivKeyLen = USM_PRIV_KU_LEN; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* See comment on generate_Ku() a few dozen lines above */ - if ((uintmax_t)g_snmp_sess.securityAuthProtoLen > UINT_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - fatalx(EXIT_FAILURE, - "Bad SNMPv3 securityAuthProtoLen: %zu", - g_snmp_sess.securityAuthProtoLen); - } - if (generate_Ku(g_snmp_sess.securityAuthProto, - (u_int)g_snmp_sess.securityAuthProtoLen, - (const unsigned char *) privPassword, strlen(privPassword), + g_snmp_sess.securityAuthProtoLen, + (u_char *) privPassword, strlen(privPassword), g_snmp_sess.securityPrivKey, &g_snmp_sess.securityPrivKeyLen) != SNMPERR_SUCCESS) { @@ -1062,24 +475,22 @@ void nut_snmp_cleanup(void) } /* Free a struct snmp_pdu * returned by nut_snmp_walk */ -static void nut_snmp_free(struct snmp_pdu ** array_to_free) +void nut_snmp_free(struct snmp_pdu ** array_to_free) { struct snmp_pdu ** current_element; - if (array_to_free != NULL) { - current_element = array_to_free; + current_element = array_to_free; - while (*current_element != NULL) { - snmp_free_pdu(*current_element); - current_element++; - } - - free( array_to_free ); + while (*current_element != NULL) { + snmp_free_pdu(*current_element); + current_element++; } + + free( array_to_free ); } /* Return a NULL terminated array of snmp_pdu * */ -static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) +struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) { int status; struct snmp_pdu *pdu, *response = NULL; @@ -1092,13 +503,12 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) struct snmp_pdu ** ret_array = NULL; int type = SNMP_MSG_GET; - upsdebugx(3, "%s(%s)", __func__, OID); - upsdebugx(4, "%s: max. iteration = %i", __func__, max_iteration); + upsdebugx(3, "nut_snmp_walk(%s)", OID); /* create and send request. */ if (!snmp_parse_oid(OID, name, &name_len)) { - upsdebugx(2, "[%s] %s: %s: %s", - upsname?upsname:device_name, __func__, OID, snmp_api_errstring(snmp_errno)); + upsdebugx(2, "[%s] nut_snmp_walk: %s: %s", + upsname?upsname:device_name, OID, snmp_api_errstring(snmp_errno)); return NULL; } @@ -1129,7 +539,6 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) if (mibname == NULL) { /* We are probing for proper mib - ignore errors */ snmp_free_pdu(response); - nut_snmp_free(ret_array); return NULL; } @@ -1137,8 +546,8 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) if ((numerr == SU_ERR_LIMIT) || ((numerr % SU_ERR_RATE) == 0)) { upslogx(LOG_WARNING, "[%s] Warning: excessive poll " - "failures, limiting error reporting (OID = %s)", - upsname?upsname:device_name, OID); + "failures, limiting error reporting", + upsname?upsname:device_name); } if ((numerr < SU_ERR_LIMIT) || ((numerr % SU_ERR_RATE) == 0)) { @@ -1147,7 +556,7 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) } else { nut_snmp_perror(g_snmp_sess_p, status, response, - "%s: %s", __func__, OID); + "nut_snmp_walk: %s", OID); } } @@ -1159,17 +568,7 @@ static struct snmp_pdu **nut_snmp_walk(const char *OID, int max_iteration) nb_iteration++; /* +1 is for the terminating NULL */ - struct snmp_pdu ** new_ret_array = realloc( - ret_array, - sizeof(struct snmp_pdu*) * ((size_t)nb_iteration+1) - ); - if (new_ret_array == NULL) { - upsdebugx(1, "%s: Failed to realloc thread", __func__); - break; - } - else { - ret_array = new_ret_array; - } + ret_array = realloc(ret_array,sizeof(struct snmp_pdu*)*(nb_iteration+1)); ret_array[nb_iteration-1] = response; ret_array[nb_iteration]=NULL; @@ -1187,10 +586,7 @@ struct snmp_pdu *nut_snmp_get(const char *OID) struct snmp_pdu ** pdu_array; struct snmp_pdu * ret_pdu; - if (OID == NULL) - return NULL; - - upsdebugx(3, "%s(%s)", __func__, OID); + upsdebugx(3, "nut_snmp_get(%s)", OID); pdu_array = nut_snmp_walk(OID,1); @@ -1205,10 +601,8 @@ struct snmp_pdu *nut_snmp_get(const char *OID) return ret_pdu; } -static bool_t decode_str(struct snmp_pdu *pdu, char *buf, size_t buf_len, info_lkp_t *oid2info) -{ +static bool_t decode_str(struct snmp_pdu *pdu, char *buf, size_t buf_len, info_lkp_t *oid2info) { size_t len = 0; - char tmp_buf[SU_LARGEBUF]; /* zero out buffer. */ memset(buf, 0, buf_len); @@ -1218,69 +612,32 @@ static bool_t decode_str(struct snmp_pdu *pdu, char *buf, size_t buf_len, info_l case ASN_OPAQUE: len = pdu->variables->val_len > buf_len - 1 ? buf_len - 1 : pdu->variables->val_len; - /* Test for hexadecimal values */ - int hex = 0, x; - unsigned char *cp; - for(cp = pdu->variables->val.string, x = 0; x < (int)pdu->variables->val_len; x++, cp++) { - if (!(isprint((size_t)*cp) || isspace((size_t)*cp))) { - hex = 1; - } - } - if (hex) - snprint_hexstring(buf, buf_len, pdu->variables->val.string, pdu->variables->val_len); - else { - memcpy(buf, pdu->variables->val.string, len); - buf[len] = '\0'; - } + memcpy(buf, pdu->variables->val.string, len); + buf[len] = '\0'; break; case ASN_INTEGER: case ASN_COUNTER: case ASN_GAUGE: if(oid2info) { const char *str; - /* See union netsnmp_vardata in net-snmp/types.h: "integer" is a "long*" */ - assert(sizeof(pdu->variables->val.integer) == sizeof(long*)); - /* If in future net-snmp headers val becomes not-a-pointer, - * compiler should complain about (void*) arg casting here */ - if((str = su_find_infoval(oid2info, pdu->variables->val.integer))) { + if((str=su_find_infoval(oid2info, *pdu->variables->val.integer))) { strncpy(buf, str, buf_len-1); } - /* when oid2info returns NULL, don't publish the variable! */ else { - /* strncpy(buf, "UNKNOWN", buf_len-1); */ - return FALSE; + strncpy(buf, "UNKNOWN", buf_len-1); } buf[buf_len-1]='\0'; } else { - int ret = snprintf(buf, buf_len, "%ld", *pdu->variables->val.integer); - if (ret < 0) - upsdebugx(3, "Failed to retrieve ASN_GAUGE"); - else - len = (size_t)ret; + len = snprintf(buf, buf_len, "%ld", *pdu->variables->val.integer); } break; case ASN_TIMETICKS: /* convert timeticks to seconds */ - { - int ret = snprintf(buf, buf_len, "%ld", *pdu->variables->val.integer / 100); - if (ret < 0) - upsdebugx(3, "Failed to retrieve ASN_TIMETICKS"); - else - len = (size_t)ret; - } + len = snprintf(buf, buf_len, "%ld", *pdu->variables->val.integer / 100); break; case ASN_OBJECT_ID: - snprint_objid (tmp_buf, sizeof(tmp_buf), pdu->variables->val.objid, pdu->variables->val_len / sizeof(oid)); - upsdebugx(2, "Received an OID value: %s", tmp_buf); - /* Try to get the value of the pointed OID */ - if (nut_snmp_get_str(tmp_buf, buf, buf_len, oid2info) == FALSE) { - upsdebugx(3, "Failed to retrieve OID value, using fallback"); - /* Otherwise return the last part of the returned OID (ex: 1.2.3 => 3) */ - char *oid_leaf = strrchr(tmp_buf, '.'); - snprintf(buf, buf_len, "%s", oid_leaf+1); - upsdebugx(3, "Fallback value: %s", buf); - } + len = snprint_objid (buf, buf_len, pdu->variables->val.objid, pdu->variables->val_len / sizeof(oid)); break; default: return FALSE; @@ -1294,7 +651,7 @@ bool_t nut_snmp_get_str(const char *OID, char *buf, size_t buf_len, info_lkp_t * struct snmp_pdu *pdu; bool_t ret; - upsdebugx(3, "Entering %s()", __func__); + upsdebugx(3, "Entering nut_snmp_get_str()"); pdu = nut_snmp_get(OID); if (pdu == NULL) @@ -1312,63 +669,12 @@ bool_t nut_snmp_get_str(const char *OID, char *buf, size_t buf_len, info_lkp_t * return ret; } - -static bool_t decode_oid(struct snmp_pdu *pdu, char *buf, size_t buf_len) -{ - /* zero out buffer. */ - memset(buf, 0, buf_len); - - switch (pdu->variables->type) { - case ASN_OBJECT_ID: - snprint_objid (buf, buf_len, pdu->variables->val.objid, - pdu->variables->val_len / sizeof(oid)); - upsdebugx(2, "OID value: %s", buf); - break; - default: - return FALSE; - } - - return TRUE; -} - -/* Return the value stored in OID, which is an OID (sysOID for example) - * and don't try to get the value pointed by this OID (no follow). - * To achieve the latter behavior, use standard nut_snmp_get_{str,int}() */ -bool_t nut_snmp_get_oid(const char *OID, char *buf, size_t buf_len) -{ - struct snmp_pdu *pdu; - bool_t ret = FALSE; - - /* zero out buffer. */ - memset(buf, 0, buf_len); - - upsdebugx(3, "Entering %s()", __func__); - - pdu = nut_snmp_get(OID); - if (pdu == NULL) - return FALSE; - - ret = decode_oid(pdu, buf, buf_len); - - if(ret == FALSE) { - upsdebugx(2, "[%s] unhandled ASN 0x%x received from %s", - upsname?upsname:device_name, pdu->variables->type, OID); - } - - snmp_free_pdu(pdu); - - return ret; -} - bool_t nut_snmp_get_int(const char *OID, long *pval) { - char tmp_buf[SU_LARGEBUF]; struct snmp_pdu *pdu; long value; char *buf; - upsdebugx(3, "Entering %s()", __func__); - pdu = nut_snmp_get(OID); if (pdu == NULL) return FALSE; @@ -1391,22 +697,11 @@ bool_t nut_snmp_get_int(const char *OID, long *pval) /* convert timeticks to seconds */ value = *pdu->variables->val.integer / 100; break; - case ASN_OBJECT_ID: - snprint_objid (tmp_buf, sizeof(tmp_buf), pdu->variables->val.objid, pdu->variables->val_len / sizeof(oid)); - upsdebugx(2, "Received an OID value: %s", tmp_buf); - /* Try to get the value of the pointed OID */ - if (nut_snmp_get_int(tmp_buf, &value) == FALSE) { - upsdebugx(3, "Failed to retrieve OID value, using fallback"); - /* Otherwise return the last part of the returned OID (ex: 1.2.3 => 3) */ - char *oid_leaf = strrchr(tmp_buf, '.'); - value = strtol(oid_leaf+1, NULL, 0); - upsdebugx(3, "Fallback value: %ld", value); - } - break; default: upslogx(LOG_ERR, "[%s] unhandled ASN 0x%x received from %s", upsname?upsname:device_name, pdu->variables->type, OID); return FALSE; + break; } snmp_free_pdu(pdu); @@ -1425,11 +720,11 @@ bool_t nut_snmp_set(const char *OID, char type, const char *value) oid name[MAX_OID_LEN]; size_t name_len = MAX_OID_LEN; - upsdebugx(1, "entering %s(%s, %c, %s)", __func__, OID, type, value); + upsdebugx(1, "entering nut_snmp_set (%s, %c, %s)", OID, type, value); if (!snmp_parse_oid(OID, name, &name_len)) { - upslogx(LOG_ERR, "[%s] %s: %s: %s", - upsname?upsname:device_name, __func__, OID, snmp_api_errstring(snmp_errno)); + upslogx(LOG_ERR, "[%s] nut_snmp_set: %s: %s", + upsname?upsname:device_name, OID, snmp_api_errstring(snmp_errno)); return FALSE; } @@ -1438,8 +733,8 @@ bool_t nut_snmp_set(const char *OID, char type, const char *value) fatalx(EXIT_FAILURE, "Not enough memory"); if (snmp_add_var(pdu, name, name_len, type, value)) { - upslogx(LOG_ERR, "[%s] %s: %s: %s", - upsname?upsname:device_name, __func__, OID, snmp_api_errstring(snmp_errno)); + upslogx(LOG_ERR, "[%s] nut_snmp_set: %s: %s", + upsname?upsname:device_name, OID, snmp_api_errstring(snmp_errno)); return FALSE; } @@ -1450,7 +745,7 @@ bool_t nut_snmp_set(const char *OID, char type, const char *value) ret = TRUE; else nut_snmp_perror(g_snmp_sess_p, status, response, - "%s: can't set %s", __func__, OID); + "nut_snmp_set: can't set %s", OID); snmp_free_pdu(response); return ret; @@ -1496,33 +791,17 @@ void nut_snmp_perror(struct snmp_session *sess, int status, upsname?upsname:device_name, buf, snmperrstr); free(snmperrstr); } else if (status == STAT_SUCCESS) { -/* Net-SNMP headers provide and consume errstat with different types: -net-snmp/output_api.h: const char *snmp_errstring(int snmp_errorno); -net-snmp/types.h: long errstat; - * Should we match in configure like for "getnameinfo()" arg types? - * Currently we cast one to another, below (detecting target type could help). - */ switch (response->errstat) { case SNMP_ERR_NOERROR: break; case SNMP_ERR_NOSUCHNAME: /* harmless */ upsdebugx(2, "[%s] %s: %s", - upsname?upsname:device_name, - buf, - (response->errstat > INT_MAX - ? "(Net-SNMP errstat value is out of range)" - : snmp_errstring((int)response->errstat) - )); + upsname?upsname:device_name, buf, snmp_errstring(response->errstat)); break; default: upslogx(LOG_ERR, "[%s] %s: Error in packet: %s", - upsname?upsname:device_name, - buf, - (response->errstat > INT_MAX - ? "(Net-SNMP errstat value is out of range)" - : snmp_errstring((int)response->errstat) - )); + upsname?upsname:device_name, buf, snmp_errstring(response->errstat)); break; } } else if (status == STAT_TIMEOUT) { @@ -1547,15 +826,7 @@ static void disable_transfer_oids(void) upslogx(LOG_INFO, "Disabling transfer OIDs"); - if (snmp_info == NULL) { - fatalx(EXIT_FAILURE, "%s: snmp_info is not initialized", __func__); - } - - if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty", __func__); - } - - for (su_info_p = &snmp_info[0]; (su_info_p != NULL && su_info_p->info_type != NULL) ; su_info_p++) { + for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++) { if (!strcasecmp(su_info_p->info_type, "input.transfer.low")) { su_info_p->flags &= ~SU_FLAG_OK; continue; @@ -1568,121 +839,23 @@ static void disable_transfer_oids(void) } } -/* Universal function to add or update info element. - * If value is NULL, use the default one (su_info_p->dfl) if provided */ +/* universal function to add or update info element. */ void su_setinfo(snmp_info_t *su_info_p, const char *value) { - info_lkp_t *info_lkp; - char info_type[128]; /* We tweak incoming "su_info_p->info_type" value in some cases */ - -/* FIXME: Replace hardcoded 128 with a macro above (use {SU_}LARGEBUF?), - * and same macro or sizeof(info_type) below (also more 128 cases below)? - */ - - upsdebugx(1, "entering %s(%s, %s)", __func__, su_info_p->info_type, (value)?value:""); - -/* FIXME: This 20 seems very wrong (should be "128", macro or sizeof? see above) */ - memset(info_type, 0, 20); - /* pre-fill with the device name for checking */ - snprintf(info_type, 128, "device.%i", current_device_number); - - /* Daisy-chain template magic should only apply to defaulted - * entries (oid==null) or templated entries (contains .%i); - * however at this point we see exact OIDs handed down from - * su_ups_get() which instantiates a template (if needed - - * and knows it was a template) and calls su_setinfo(). - * NOTE: For setting the values (or commands) from clients - * like `upsrw`, see su_setOID() method. Here we change our - * device state records based on readings from a device. - */ - if ((daisychain_enabled == TRUE) && (devices_count > 1)) { - if (su_info_p->OID != NULL - && strstr(su_info_p->OID, ".%i") != NULL - ) { - /* Only inform, do not react so far, - * need more understanding if and when - * such situation might happen at all: - */ - upsdebugx(5, "%s: in a daisy-chained device, " - "got a templated OID %s for type %s", - __func__, su_info_p->OID, - su_info_p->info_type); - } - - /* Only append "device.X" for master and slaves, if not already done! */ - if ((current_device_number > 0) && (strstr(su_info_p->info_type, info_type) == NULL)) { - /* Special case: we remove "device" from the device collection not to - * get "device.X.device.", but "device.X." */ - if (!strncmp(su_info_p->info_type, "device.", 7)) { - upsdebugx(6, "%s: in a daisy-chained device, " - "OID %s: TRIM 'device.' from type %s (value %s)", - __func__, su_info_p->OID, - su_info_p->info_type, (value)?value:""); - snprintf(info_type, 128, "device.%i.%s", - current_device_number, su_info_p->info_type + 7); - } - else { - upsdebugx(6, "%s: in a daisy-chained device, " - "OID %s is templated: for type %s (value %s)", - __func__, su_info_p->OID, - su_info_p->info_type, (value)?value:""); - snprintf(info_type, 128, "device.%i.%s", - current_device_number, su_info_p->info_type); - } - } - else { - upsdebugx(6, "%s: in a daisy-chained device, " - "OID %s: for type %s (value %s) " - "device %d is not positive or type already " - "contains the prepared expectation: %s", - __func__, su_info_p->OID, - su_info_p->info_type, (value)?value:"", - current_device_number, - info_type - ); - snprintf(info_type, 128, "%s", su_info_p->info_type); - } - } - else { - upsdebugx(6, "%s: NOT in a daisy-chained device", __func__); - snprintf(info_type, 128, "%s", su_info_p->info_type); - } - - upsdebugx(1, "%s: using info_type '%s'", __func__, info_type); + upsdebugx(1, "entering su_setinfo(%s)", su_info_p->info_type); if (SU_TYPE(su_info_p) == SU_TYPE_CMD) return; - /* ups.status and {ups, Lx, outlet, outlet.group}.alarm have special - * handling, not here! */ - if ((strcasecmp(su_info_p->info_type, "ups.status")) - && (strcasecmp(strrchr(su_info_p->info_type, '.'), ".alarm"))) + if (strcasecmp(su_info_p->info_type, "ups.status")) { if (value != NULL) - dstate_setinfo(info_type, "%s", value); - else if (su_info_p->dfl != NULL) - dstate_setinfo(info_type, "%s", su_info_p->dfl); - else { - upsdebugx(3, "%s: no value nor default provided, aborting...", __func__); - return; - } + dstate_setinfo(su_info_p->info_type, "%s", value); + else + dstate_setinfo(su_info_p->info_type, "%s", su_info_p->dfl); - dstate_setflags(info_type, su_info_p->info_flags); - dstate_setaux(info_type, su_info_p->info_len); - - /* Set enumerated values, only if the data has ST_FLAG_RW and there - * are lookup values */ -/* FIXME: daisychain settings support: check if applicable */ - if ((su_info_p->info_flags & ST_FLAG_RW) && su_info_p->oid2info) { - - upsdebugx(3, "%s: adding enumerated values", __func__); - - /* Loop on all existing values */ - for (info_lkp = su_info_p->oid2info; info_lkp != NULL - && info_lkp->info_value != NULL; info_lkp++) { - dstate_addenum(info_type, "%s", info_lkp->info_value); - } - } + dstate_setflags(su_info_p->info_type, su_info_p->info_flags); + dstate_setaux(su_info_p->info_type, su_info_p->info_len); /* Commit the current value, to avoid staleness with huge * data collections on slow devices */ @@ -1694,167 +867,35 @@ void su_status_set(snmp_info_t *su_info_p, long value) { const char *info_value = NULL; - upsdebugx(2, "SNMP UPS driver: entering %s()", __func__); + upsdebugx(2, "SNMP UPS driver : entering su_status_set()"); - if ((info_value = su_find_infoval(su_info_p->oid2info, &value)) != NULL) + if ((info_value = su_find_infoval(su_info_p->oid2info, value)) != NULL) { - if (info_value[0] != '\0') { + if (strcmp(info_value, "")) { status_set(info_value); } } /* TODO: else */ } -void su_alarm_set(snmp_info_t *su_info_p, long value) -{ - const char *info_value = NULL; - const char *info_type = NULL; - char alarm_info_value[SU_LARGEBUF]; - /* number of the outlet or phase */ - int item_number = -1; - - upsdebugx(2, "SNMP UPS driver: entering %s(%s)", __func__, su_info_p->info_type); - - /* daisychain handling - * extract the template part to get the relevant 'info_type' part - * ex: device.6.L1.alarm => L1.alarm - * ex: device.6.outlet.1.alarm => outlet.1.alarm */ - if (!strncmp(su_info_p->info_type, "device.", 7)) { - info_type = strchr(su_info_p->info_type + 7, '.') + 1; - } - else - info_type = su_info_p->info_type; - - upsdebugx(2, "%s: using definition %s", __func__, info_type); - - if ((info_value = su_find_infoval(su_info_p->oid2info, &value)) != NULL - && info_value[0] != 0) - { - /* Special handling for outlet & outlet groups alarms */ - if ((su_info_p->flags & SU_OUTLET) - || (su_info_p->flags & SU_OUTLET_GROUP)) { - /* Extract template number */ - item_number = extract_template_number(su_info_p->flags, info_type); - - upsdebugx(2, "%s: appending %s %i", __func__, - (su_info_p->flags & SU_OUTLET_GROUP) ? "outlet group" : "outlet", item_number); - - /* Inject in the alarm string */ - snprintf(alarm_info_value, sizeof(alarm_info_value), - "outlet%s %i %s", (su_info_p->flags & SU_OUTLET_GROUP) ? " group" : "", - item_number, info_value); - info_value = &alarm_info_value[0]; - } - /* Special handling for phase alarms - * Note that SU_*PHASE flags are cleared, so match the 'Lx' - * start of path */ - if (info_type[0] == 'L') { - /* Extract phase number */ - item_number = atoi(info_type+1); - char alarm_info_value_more[SU_LARGEBUF + 32]; /* can sprintf() SU_LARGEBUF plus markup into here */ - - upsdebugx(2, "%s: appending phase L%i", __func__, item_number); - - /* Inject in the alarm string */ - snprintf(alarm_info_value_more, sizeof(alarm_info_value_more), - "phase L%i %s", item_number, info_value); - info_value = &alarm_info_value_more[0]; - } - - /* Set the alarm value */ - alarm_set(info_value); - } - /* TODO: else */ -} - /* find info element definition in my info array. */ snmp_info_t *su_find_info(const char *type) { snmp_info_t *su_info_p; - if (snmp_info == NULL) { - fatalx(EXIT_FAILURE, "%s: snmp_info is not initialized", __func__); - } - - if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty", __func__); - } - - for (su_info_p = &snmp_info[0]; (su_info_p != NULL && su_info_p->info_type != NULL) ; su_info_p++) + for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++) if (!strcasecmp(su_info_p->info_type, type)) { - upsdebugx(3, "%s: \"%s\" found", __func__, type); + upsdebugx(3, "su_find_info: \"%s\" found", type); return su_info_p; } - upsdebugx(3, "%s: unknown info type (%s)", __func__, type); + upsdebugx(3, "su_find_info: unknown info type (%s)", type); return NULL; } -/* Counter match the sysOID using {device,ups}.model OID - * Return TRUE if this OID can be retrieved, FALSE otherwise */ -static bool_t match_model_OID() -{ - bool_t retCode = FALSE; - snmp_info_t *su_info_p, *cur_info_p; - char testOID_buf[LARGEBUF]; - - /* Try to get device.model first */ - su_info_p = su_find_info("device.model"); - /* Otherwise, try to get ups.model */ - if (su_info_p == NULL) - su_info_p = su_find_info("ups.model"); - - if (su_info_p != NULL) { - /* Daisychain specific: we may have a template (including formatting - * string) that needs to be adapted! */ - if (strchr(su_info_p->OID, '%') != NULL) - { - upsdebugx(2, "Found template, need to be adapted"); - cur_info_p = (snmp_info_t *)malloc(sizeof(snmp_info_t)); - cur_info_p->info_type = (char *)xmalloc(SU_INFOSIZE); - cur_info_p->OID = (char *)xmalloc(SU_INFOSIZE); - snprintf((char*)cur_info_p->info_type, SU_INFOSIZE, "%s", su_info_p->info_type); - /* Use the daisychain master (0) / 1rst device index */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char*)cur_info_p->OID, SU_INFOSIZE, su_info_p->OID, 0); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } - else { - upsdebugx(2, "Found entry, not a template %s", su_info_p->OID); - /* Otherwise, just point at what we found */ - cur_info_p = su_info_p; - } - - upsdebugx(2, "Testing %s using OID %s", cur_info_p->info_type, cur_info_p->OID); - retCode = nut_snmp_get_str(cur_info_p->OID, testOID_buf, LARGEBUF, NULL); - - /* Free our malloc, if it was dynamic */ - if (strchr(su_info_p->OID, '%') != NULL) { - if (cur_info_p->info_type != NULL) - free((char*)cur_info_p->info_type); - if (cur_info_p->OID != NULL) - free((char*)cur_info_p->OID); - if (cur_info_p != NULL) - free((char*)cur_info_p); - } - } - - return retCode; -} - /* Try to find the MIB using sysOID matching. * Return a pointer to a mib2nut definition if found, NULL otherwise */ -static mib2nut_info_t *match_sysoid() +mib2nut_info_t *match_sysoid() { char sysOID_buf[LARGEBUF]; oid device_sysOID[MAX_OID_LEN]; @@ -1864,74 +905,47 @@ static mib2nut_info_t *match_sysoid() int i; /* Retrieve sysOID value of this device */ - if (nut_snmp_get_oid(SYSOID_OID, sysOID_buf, sizeof(sysOID_buf)) == TRUE) + if (nut_snmp_get_str(SYSOID_OID, sysOID_buf, sizeof(sysOID_buf), NULL)) { - upsdebugx(1, "%s: device sysOID value = %s", __func__, sysOID_buf); + upsdebugx(1, "match_sysoid: device sysOID value = %s", sysOID_buf); /* Build OIDs for comparison */ if (!read_objid(sysOID_buf, device_sysOID, &device_sysOID_len)) { - upsdebugx(2, "%s: can't build device_sysOID %s: %s", - __func__, sysOID_buf, snmp_api_errstring(snmp_errno)); + upsdebugx(2, "match_sysoid: can't build device_sysOID %s: %s", + sysOID_buf, snmp_api_errstring(snmp_errno)); - return NULL; + return FALSE; } /* Now, iterate on mib2nut definitions */ for (i = 0; mib2nut[i] != NULL; i++) { - upsdebugx(1, "%s: checking MIB %s", __func__, mib2nut[i]->mib_name); + upsdebugx(1, "match_sysoid: checking MIB %s", mib2nut[i]->mib_name); if (mib2nut[i]->sysOID == NULL) continue; /* Clear variables */ - memset(mib2nut_sysOID, 0, sizeof(mib2nut_sysOID)); + memset(mib2nut_sysOID, 0, MAX_OID_LEN); mib2nut_sysOID_len = MAX_OID_LEN; if (!read_objid(mib2nut[i]->sysOID, mib2nut_sysOID, &mib2nut_sysOID_len)) { - upsdebugx(2, "%s: can't build OID %s: %s", - __func__, sysOID_buf, snmp_api_errstring(snmp_errno)); + upsdebugx(2, "match_sysoid: can't build OID %s: %s", + sysOID_buf, snmp_api_errstring(snmp_errno)); /* Try to continue anyway! */ continue; } - /* Now compare these */ - upsdebugx(1, "%s: comparing %s with %s", __func__, sysOID_buf, mib2nut[i]->sysOID); + upsdebugx(1, "match_sysoid: comparing %s with %s", sysOID_buf, mib2nut[i]->sysOID); if (!netsnmp_oid_equals(device_sysOID, device_sysOID_len, mib2nut_sysOID, mib2nut_sysOID_len)) { - upsdebugx(2, "%s: sysOID matches MIB '%s'!", __func__, mib2nut[i]->mib_name); - /* Counter verify, using {ups,device}.model */ - snmp_info = mib2nut[i]->snmp_info; - - if (snmp_info == NULL) { - upsdebugx(0, "%s: WARNING: snmp_info is not initialized " - "for mapping table entry #%d \"%s\"", - __func__, i, mib2nut[i]->mib_name - ); - continue; - } - else if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty " - "for mapping table entry #%d \"%s\"", - __func__, i, mib2nut[i]->mib_name); - } - - if (match_model_OID() != TRUE) - { - upsdebugx(2, "%s: testOID provided and doesn't match MIB '%s'!", __func__, mib2nut[i]->mib_name); - snmp_info = NULL; - continue; - } - else - upsdebugx(2, "%s: testOID provided and matches MIB '%s'!", __func__, mib2nut[i]->mib_name); - + upsdebugx(2, "match_sysoid: sysOID matches MIB '%s'!", mib2nut[i]->mib_name); return mib2nut[i]; } } - /* Yell all to call for user report */ upslogx(LOG_ERR, "No matching MIB found for sysOID '%s'!\n" \ "Please report it to NUT developers, with an 'upsc' output for your device.\n" \ @@ -1948,39 +962,18 @@ static mib2nut_info_t *match_sysoid() bool_t load_mib2nut(const char *mib) { int i; + char buf[LARGEBUF]; mib2nut_info_t *m2n = NULL; - /* Below we have many checks for "auto"; avoid redundant string walks: */ - bool_t mibIsAuto = (0 == strcmp(mib, "auto")); - bool_t mibSeen = FALSE; /* Did we see the MIB name while walking mib2nut[]? */ - upsdebugx(1, "SNMP UPS driver: entering %s(%s) to detect " - "proper MIB for device [%s] (host %s)", - __func__, mib, - upsname ? upsname : device_name, - device_path /* the "port" from config section is hostname/IP for networked drivers */ - ); + upsdebugx(2, "SNMP UPS driver : entering load_mib2nut(%s)", mib); /* First, try to match against sysOID, if no MIB was provided. * This should speed up init stage * (Note: sysOID points the device main MIB entry point) */ - if (mibIsAuto) + if (!strcmp(mib, "auto")) { - upsdebugx(2, "%s: trying the new match_sysoid() method with %s", - __func__, mib); - /* Retry at most 3 times, to maximise chances */ - for (i = 0; i < 3 ; i++) { - upsdebugx(3, "%s: trying the new match_sysoid() method: attempt #%d", - __func__, (i+1)); - if ((m2n = match_sysoid()) != NULL) - break; - - if (m2n == NULL) - upsdebugx(3, "%s: failed with new match_sysoid() method", - __func__); - else - upsdebugx(3, "%s: found something with new match_sysoid() method", - __func__); - } + upsdebugx(1, "trying the new match_sysoid() method"); + m2n = match_sysoid(); } /* Otherwise, revert to the classic method */ @@ -1988,52 +981,15 @@ bool_t load_mib2nut(const char *mib) { for (i = 0; mib2nut[i] != NULL; i++) { /* Is there already a MIB name provided? */ - upsdebugx(4, "%s: checking against mapping table entry #%d \"%s\"", - __func__, i, mib2nut[i]->mib_name); - if (!mibIsAuto && strcmp(mib, mib2nut[i]->mib_name)) { - /* "mib" is neither "auto" nor the name in mapping table */ - upsdebugx(2, "%s: skip the \"%s\" entry which " - "is neither \"auto\" nor a valid name in the mapping table", - __func__, mib); + if (strcmp(mib, "auto") && strcmp(mib, mib2nut[i]->mib_name)) { continue; } - upsdebugx(2, "%s: trying classic sysOID matching method with '%s' mib", - __func__, mib2nut[i]->mib_name); + upsdebugx(1, "load_mib2nut: trying classic method with '%s' mib", mib2nut[i]->mib_name); /* Classic method: test an OID specific to this MIB */ - snmp_info = mib2nut[i]->snmp_info; - - if (snmp_info == NULL) { - upsdebugx(0, "%s: WARNING: snmp_info is not initialized " - "for mapping table entry #%d \"%s\"", - __func__, i, mib2nut[i]->mib_name - ); + if (!nut_snmp_get_str(mib2nut[i]->oid_auto_check, buf, sizeof(buf), NULL)) { continue; } - else if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty " - "for mapping table entry #%d \"%s\"", - __func__, i, mib2nut[i]->mib_name); - } - - /* Device might not support this MIB, but we want to - * track that the name string is valid for diags below - */ - if (!mibIsAuto) { - mibSeen = TRUE; - } - - if (match_model_OID() != TRUE) - { - upsdebugx(3, "%s: testOID provided and doesn't match MIB '%s'!", - __func__, mib2nut[i]->mib_name); - snmp_info = NULL; - continue; - } - else - upsdebugx(3, "%s: testOID provided and matches MIB '%s'!", - __func__, mib2nut[i]->mib_name); - /* MIB found */ m2n = mib2nut[i]; break; @@ -2048,31 +1004,16 @@ bool_t load_mib2nut(const char *mib) mibname = m2n->mib_name; mibvers = m2n->mib_version; alarms_info = m2n->alarms_info; - upsdebugx(1, "%s: using %s MIB for device [%s] (host %s)", - __func__, mibname, - upsname ? upsname : device_name, device_path); + upsdebugx(1, "load_mib2nut: using %s mib", mibname); return TRUE; } /* Did we find something or is it really an unknown mib */ - if (!mibIsAuto) { - if (mibSeen) { - fatalx(EXIT_FAILURE, "Requested 'mibs' value '%s' " - "did not match this device [%s] (host %s)", - mib, upsname ? upsname : device_name, device_path); - } else { - /* String not seen during mib2nut[] walk - - * and if we had no hits, we walked it all - */ - fatalx(EXIT_FAILURE, "Unknown 'mibs' value: %s", mib); - } + if (strcmp(mib, "auto") != 0) { + fatalx(EXIT_FAILURE, "Unknown mibs value: %s", mib); } else { - fatalx(EXIT_FAILURE, "No supported device detected at [%s] (host %s)", - upsname ? upsname : device_name, device_path); + fatalx(EXIT_FAILURE, "No supported device detected"); } - - /* Should not get here thanks to fatalx() above, but need to silence a warning */ - return FALSE; } /* find the OID value matching that INFO_* value */ @@ -2084,189 +1025,79 @@ long su_find_valinfo(info_lkp_t *oid2info, const char* value) (strcmp(info_lkp->info_value, "NULL")); info_lkp++) { if (!(strcmp(info_lkp->info_value, value))) { - upsdebugx(1, "%s: found %s (value: %s)", - __func__, info_lkp->info_value, value); + upsdebugx(1, "su_find_valinfo: found %s (value: %s)", + info_lkp->info_value, value); return info_lkp->oid_value; } } - upsdebugx(1, "%s: no matching INFO_* value for this OID value (%s)", __func__, value); + upsdebugx(1, "su_find_valinfo: no matching INFO_* value for this OID value (%s)", value); return -1; } -/* String reformating function */ -const char *su_find_strval(info_lkp_t *oid2info, void *value) -{ -#if WITH_SNMP_LKP_FUN - /* First test if we have a generic lookup function */ - if ( (oid2info != NULL) && (oid2info->fun_vp2s != NULL) ) { - upsdebugx(2, "%s: using generic lookup function (string reformatting)", __func__); - const char * retvalue = oid2info->fun_vp2s(value); - upsdebugx(2, "%s: got value '%s'", __func__, retvalue); - return retvalue; - } - upsdebugx(1, "%s: no result value for this OID string value (%s)", __func__, (char*)value); -#else - NUT_UNUSED_VARIABLE(oid2info); - upsdebugx(1, "%s: no mapping function for this OID string value (%s)", __func__, (char*)value); -#endif // WITH_SNMP_LKP_FUN - return NULL; -} - -/* find the INFO_* value matching that OID numeric (long) value */ -const char *su_find_infoval(info_lkp_t *oid2info, void *raw_value) +/* find the INFO_* value matching that OID value */ +const char *su_find_infoval(info_lkp_t *oid2info, long value) { info_lkp_t *info_lkp; - long value = *((long *)raw_value); -#if WITH_SNMP_LKP_FUN - /* First test if we have a generic lookup function */ - if ( (oid2info != NULL) && (oid2info->fun_vp2s != NULL) ) { - upsdebugx(2, "%s: using generic lookup function", __func__); - const char * retvalue = oid2info->fun_vp2s(raw_value); - upsdebugx(2, "%s: got value '%s'", __func__, retvalue); - return retvalue; - } -#endif // WITH_SNMP_LKP_FUN - - /* Otherwise, use the simple values mapping */ for (info_lkp = oid2info; (info_lkp != NULL) && - (info_lkp->info_value != NULL) && (strcmp(info_lkp->info_value, "NULL")); info_lkp++) { + (strcmp(info_lkp->info_value, "NULL")) && (info_lkp->info_value != NULL); info_lkp++) { if (info_lkp->oid_value == value) { - upsdebugx(1, "%s: found %s (value: %ld)", - __func__, info_lkp->info_value, value); + upsdebugx(1, "su_find_infoval: found %s (value: %ld)", + info_lkp->info_value, value); return info_lkp->info_value; } } - upsdebugx(1, "%s: no matching INFO_* value for this OID value (%ld)", __func__, value); + upsdebugx(1, "su_find_infoval: no matching INFO_* value for this OID value (%ld)", value); return NULL; } -/* FIXME: doesn't work with templates! */ static void disable_competition(snmp_info_t *entry) { snmp_info_t *p; - if (snmp_info == NULL) { - fatalx(EXIT_FAILURE, "%s: snmp_info is not initialized", __func__); - } - - if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty", __func__); - } - - for(p = snmp_info; (p != NULL && p->info_type != NULL) ; p++) { + for(p=snmp_info; p->info_type!=NULL; p++) { if(p!=entry && !strcmp(p->info_type, entry->info_type)) { - upsdebugx(2, "%s: disabling %s %s", - __func__, p->info_type, p->OID); + upsdebugx(2, "disable_competition: disabling %s %s", + p->info_type, p->OID); p->flags &= ~SU_FLAG_OK; } } } -/* set shutdown and/or start delays */ -void set_delays(void) -{ - int ondelay, offdelay; - char su_scratch_buf[255]; - - if (getval(SU_VAR_ONDELAY)) - ondelay = atoi(getval(SU_VAR_ONDELAY)); - else - ondelay = -1; - - if (getval(SU_VAR_OFFDELAY)) - offdelay = atoi(getval(SU_VAR_OFFDELAY)); - else - offdelay = -1; - - if (ondelay >= 0) { - sprintf(su_scratch_buf, "%d", ondelay); - su_setvar("ups.delay.start", su_scratch_buf); - } - - if (offdelay >= 0) { - sprintf(su_scratch_buf, "%d", offdelay); - su_setvar("ups.delay.shutdown", su_scratch_buf); - } -} - -/*********************************************************************** - * Template handling functions - **********************************************************************/ - -/* Test if the template is a multiple one, i.e. with a formatting string that - * contains multiple "%i". - * Return TRUE if yes (multiple "%i" found), FALSE otherwise */ -static bool_t is_multiple_template(const char *OID_template) -{ - bool_t retCode = FALSE; - char *format_char = NULL; - - if (OID_template) { - format_char = strchr(OID_template, '%'); - upsdebugx(4, "%s(%s)", __func__, OID_template); - } - else - upsdebugx(4, "%s(NULL)", __func__); - - if (format_char != NULL) { - if (strchr(format_char + 1, '%') != NULL) { - retCode = TRUE; - } - } - - upsdebugx(4, "%s: has %smultiple template definition", - __func__, (retCode == FALSE)?"not ":""); - - return retCode; -} - -/* Instantiate an snmp_info_t from a template. - * Useful for device, outlet, outlet.group and ambient templates. +/* instantiate an snmp_info_t from a template. + * mostly (only?) useful for outlet templates. * Note: remember to adapt info_type, OID and optionaly dfl */ -static snmp_info_t *instantiate_info(snmp_info_t *info_template, snmp_info_t *new_instance) +snmp_info_t *instantiate_info(snmp_info_t *info_template, snmp_info_t *new_instance) { - upsdebugx(1, "%s(%s)", __func__, - info_template ? info_template->info_type : "n/a"); - /* sanity check */ if (info_template == NULL) return NULL; if (new_instance == NULL) new_instance = (snmp_info_t *)xmalloc(sizeof(snmp_info_t)); - /* TOTHINK: Should there be an "else" to free() - * the fields which we (re-)allocate below? */ new_instance->info_type = (char *)xmalloc(SU_INFOSIZE); - if (new_instance->info_type) - memset((char *)new_instance->info_type, 0, SU_INFOSIZE); - if (info_template->OID != NULL) { + if (info_template->OID != NULL) new_instance->OID = (char *)xmalloc(SU_INFOSIZE); - if (new_instance->OID) - memset((char *)new_instance->OID, 0, SU_INFOSIZE); - } - else { + else new_instance->OID = NULL; - } - new_instance->info_flags = info_template->info_flags; new_instance->info_len = info_template->info_len; /* FIXME: check if we need to adapt this one... */ new_instance->dfl = info_template->dfl; new_instance->flags = info_template->flags; new_instance->oid2info = info_template->oid2info; + new_instance->setvar = info_template->setvar; - upsdebugx(2, "instantiate_info: template instantiated"); return new_instance; } -/* Free a dynamically allocated snmp_info_t. - * Useful for outlet and outlet.group templates */ -static void free_info(snmp_info_t *su_info_p) +/* free a dynamically allocated snmp_info_t. + * mostly (only?) useful for outlet templates */ +void free_info(snmp_info_t *su_info_p) { /* sanity check */ if (su_info_p == NULL) @@ -2281,495 +1112,80 @@ static void free_info(snmp_info_t *su_info_p) free (su_info_p); } -/* return the base SNMP index (0 or 1) to start template iteration on - * the MIB, based on a test using a template OID */ -static int base_snmp_template_index(const snmp_info_t *su_info_p) +/* return the base SNMP index (0 or 1) to start outlet iteration on the MIB, + * based on a test using a template OID */ +int base_snmp_outlet_index(const char *OID_template) { - if (!su_info_p) - return -1; - - int base_index = -1; + int base_index = outlet_index_base; char test_OID[SU_INFOSIZE]; - snmp_info_flags_t template_type = get_template_type(su_info_p->info_type); - if (!su_info_p->OID) - return base_index; - - upsdebugx(3, "%s: OID template = %s", __func__, su_info_p->OID); - - /* Try to differentiate between template types which may have - * different indexes ; and store it to not redo it again */ - switch (template_type) { - case SU_OUTLET: - template_index_base = outlet_template_index_base; - break; - case SU_OUTLET_GROUP: - template_index_base = outletgroup_template_index_base; - break; - case SU_DAISY: - template_index_base = device_template_index_base; - break; - case SU_AMBIENT_TEMPLATE: - template_index_base = ambient_template_index_base; - break; - default: - /* we should never fall here! */ - upsdebugx(3, "%s: unknown template type '%" PRI_SU_FLAGS "' for %s", - __func__, template_type, su_info_p->info_type); - } - base_index = template_index_base; - - if (template_index_base == -1) + if (outlet_index_base == -1) { /* not initialised yet */ for (base_index = 0 ; base_index < 2 ; base_index++) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - /* Test if this template also includes daisychain, in which case - * we just use the current device index */ - if (is_multiple_template(su_info_p->OID) == TRUE) { - if (su_info_p->flags & SU_TYPE_DAISY_1) { - snprintf(test_OID, sizeof(test_OID), su_info_p->OID, - current_device_number + device_template_offset, base_index); - } - else { - snprintf(test_OID, sizeof(test_OID), su_info_p->OID, - base_index, current_device_number + device_template_offset); - } - } - else { - snprintf(test_OID, sizeof(test_OID), su_info_p->OID, base_index); - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - if (nut_snmp_get(test_OID) != NULL) { - if (su_info_p->flags & SU_FLAG_ZEROINVALID) { - long value; - if ((nut_snmp_get_int(test_OID, &value)) && (value!=0)) { - break; - } - } - else if (su_info_p->flags & SU_FLAG_NAINVALID) { - char value[SU_BUFSIZE]; - if ((nut_snmp_get_str(test_OID, value, SU_BUFSIZE, NULL)) - && (strncmp(value, "N/A", 3))) { - break; - } - } - else { - break; - } - } + sprintf(test_OID, OID_template, base_index); + if (nut_snmp_get(test_OID) != NULL) + break; } - /* Only store if it's a template for outlets or outlets groups, - * not for daisychain (which has different index) */ - if (su_info_p->flags & SU_OUTLET) - outlet_template_index_base = base_index; - else if (su_info_p->flags & SU_OUTLET_GROUP) - outletgroup_template_index_base = base_index; - else if (su_info_p->flags & SU_AMBIENT_TEMPLATE) - ambient_template_index_base = base_index; - else - device_template_index_base = base_index; + outlet_index_base = base_index; } - upsdebugx(3, "%s: template_index_base = %i", __func__, base_index); + upsdebugx(3, "base_snmp_outlet_index: %i", outlet_index_base); return base_index; } -/* Try to determine the number of items (outlets, outlet groups, ...), - * using a template definition. Walk through the template until we can't - * get anymore values. I.e., if we can iterate up to 8 item, return 8 */ -static int guestimate_template_count(snmp_info_t *su_info_p) +/* return the NUT offset (increment) based on outlet_index_base + * ie (outlet_index_base == 0) => increment +1 + * (outlet_index_base == 1) => increment +0 */ +int base_nut_outlet_offset(void) +{ + return (outlet_index_base==0)?1:0; +} + +/* try to determine the number of outlets, using a template definition, + * that we walk, until we can't get anymore values */ +static int guestimate_outlet_count(const char *OID_template) { int base_index = 0; char test_OID[SU_INFOSIZE]; int base_count; - const char *OID_template = su_info_p->OID; - upsdebugx(1, "%s(%s)", __func__, OID_template); + upsdebugx(1, "guestimate_outlet_count(%s)", OID_template); /* Determine if OID index starts from 0 or 1? */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(test_OID, sizeof(test_OID), OID_template, base_index); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - if (nut_snmp_get(test_OID) == NULL) { + sprintf(test_OID, OID_template, base_index); + if (nut_snmp_get(test_OID) == NULL) base_index++; - } - else { - if (su_info_p->flags & SU_FLAG_ZEROINVALID) { - long value; - if ((nut_snmp_get_int(test_OID, &value)) && (value==0)) { - base_index++; - } - } - } /* Now, actually iterate */ for (base_count = 0 ; ; base_count++) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf(test_OID, sizeof(test_OID), OID_template, base_index + base_count); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + sprintf(test_OID, OID_template, base_index + base_count); if (nut_snmp_get(test_OID) == NULL) break; } - upsdebugx(3, "%s: %i", __func__, base_count); + upsdebugx(3, "guestimate_outlet_count: %i", base_count); return base_count; } -/* Process template definition, instantiate and get data or register - * command - * type: outlet, outlet.group, device */ -static bool_t process_template(int mode, const char* type, snmp_info_t *su_info_p) -{ - /* Default to TRUE, and leave to get_and_process_data() to set - * to FALSE when actually getting data from devices, to avoid false - * negative with server side data */ - bool_t status = TRUE; - int cur_template_number = 1; - int cur_nut_index = 0; - int template_count = 0; - int base_snmp_index = 0; - snmp_info_t cur_info_p; - char template_count_var[SU_BUFSIZE * 2]; - /* Needed *2 to fit a max size_t in snprintf() below, - * even if that should never happen */ - char tmp_buf[SU_INFOSIZE]; - - upsdebugx(1, "%s template definition found (%s)...", type, su_info_p->info_type); - - if ((strncmp(type, "device", 6)) && (devices_count > 1) && (current_device_number > 0)) { - snprintf(template_count_var, sizeof(template_count_var), "device.%i.%s.count", current_device_number, type); - } else { - snprintf(template_count_var, sizeof(template_count_var), "%s.count", type); - } - - if(dstate_getinfo(template_count_var) == NULL) { - /* FIXME: should we disable it? - * su_info_p->flags &= ~SU_FLAG_OK; - * or rely on guestimation? */ - template_count = guestimate_template_count(su_info_p); - /* Publish the count estimation */ - if (template_count > 0) { - dstate_setinfo(template_count_var, "%i", template_count); - } - } - else { - template_count = atoi(dstate_getinfo(template_count_var)); - } - upsdebugx(1, "%i instances found...", template_count); - - /* Only instantiate templates if needed! */ - if (template_count > 0) { - /* general init of data using the template */ - instantiate_info(su_info_p, &cur_info_p); - - base_snmp_index = base_snmp_template_index(su_info_p); - - for (cur_template_number = base_snmp_index ; - cur_template_number < (template_count + base_snmp_index) ; - cur_template_number++) - { - upsdebugx(1, "Processing instance %i/%i...", cur_template_number, template_count); - /* Special processing for daisychain: - * append 'device.x' to the NUT variable name, except for the - * whole daisychain ("device.0") */ - if (!strncmp(type, "device", 6)) - { - /* Device(s) 1-N (master + slave(s)) need to append 'device.x' */ - if (current_device_number > 0) { - char *ptr = NULL; - /* Another special processing for daisychain - * device collection needs special appending */ - if (!strncmp(su_info_p->info_type, "device.", 7)) - ptr = (char*)&su_info_p->info_type[7]; - else - ptr = (char*)su_info_p->info_type; - - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - "device.%i.%s", current_device_number, ptr); - } - else - { - /* Device 1 ("device.0", whole daisychain) needs no - * special processing */ - cur_nut_index = cur_template_number; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - su_info_p->info_type, cur_nut_index); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } - } - else if (!strncmp(type, "outlet", 6)) /* Outlet and outlet groups templates */ - { - /* Get the index of the current template instance */ - cur_nut_index = cur_template_number; - -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - /* Special processing for daisychain */ - if (daisychain_enabled == TRUE) { - /* Device(s) 1-N (master + slave(s)) need to append 'device.x' */ - if ((devices_count > 1) && (current_device_number > 0)) { - memset(&tmp_buf[0], 0, SU_INFOSIZE); - strcat(&tmp_buf[0], "device.%i."); - strcat(&tmp_buf[0], su_info_p->info_type); - - upsdebugx(4, "FORMATTING STRING = %s", &tmp_buf[0]); - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - &tmp_buf[0], current_device_number, cur_nut_index); - } - else { - /* FIXME: daisychain-whole, what to do? */ - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - su_info_p->info_type, cur_nut_index); - } - } - else { - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - su_info_p->info_type, cur_nut_index); - } - } - else if (!strncmp(type, "ambient", 7)) - { - /* FIXME: can be grouped with outlet* above */ - /* Get the index of the current template instance */ - cur_nut_index = cur_template_number; - - /* Special processing for daisychain */ - if (daisychain_enabled == TRUE) { - /* Only publish on the daisychain host */ - if ( (su_info_p->flags & SU_TYPE_DAISY_MASTER_ONLY) - && (current_device_number != 1) ) { - upsdebugx(2, "discarding variable due to daisychain master flag"); - continue; - } - - /* Device(s) 1-N (master + slave(s)) need to append 'device.x' */ - if ((devices_count > 1) && (current_device_number > 0)) { - memset(&tmp_buf[0], 0, SU_INFOSIZE); - strcat(&tmp_buf[0], "device.%i."); - strcat(&tmp_buf[0], su_info_p->info_type); - - upsdebugx(4, "FORMATTING STRING = %s", &tmp_buf[0]); - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - &tmp_buf[0], current_device_number, cur_nut_index); - } - else { - /* FIXME: daisychain-whole, what to do? */ - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - su_info_p->info_type, cur_nut_index); - } - } - else { - snprintf((char*)cur_info_p.info_type, SU_INFOSIZE, - su_info_p->info_type, cur_nut_index); - } - } - else - upsdebugx(4, "Error: unknown template type '%s", type); - - /* check if default value is also a template */ - if ((cur_info_p.dfl != NULL) && - (strstr(su_info_p->dfl, "%i") != NULL)) { - cur_info_p.dfl = (char *)xmalloc(SU_INFOSIZE); - snprintf((char *)cur_info_p.dfl, SU_INFOSIZE, su_info_p->dfl, cur_nut_index); - } - - if (cur_info_p.OID != NULL) { - /* Special processing for daisychain */ - if (!strncmp(type, "device", 6)) { - if (current_device_number > 0) { - snprintf((char *)cur_info_p.OID, SU_INFOSIZE, su_info_p->OID, current_device_number + device_template_offset); - } - /*else - * FIXME: daisychain-whole, what to do? - */ - } - else { - /* Special processing for daisychain: - * these outlet | outlet groups also include formatting info, - * so we have to check if the daisychain is enabled, and if - * the formatting info for it are in 1rst or 2nd position */ - if (daisychain_enabled == TRUE) { - if (su_info_p->flags & SU_TYPE_DAISY_1) { - snprintf((char *)cur_info_p.OID, SU_INFOSIZE, - su_info_p->OID, current_device_number + device_template_offset, cur_template_number); - } - else if (su_info_p->flags & SU_TYPE_DAISY_2) { - snprintf((char *)cur_info_p.OID, SU_INFOSIZE, - su_info_p->OID, cur_template_number + device_template_offset, - current_device_number - device_template_offset); - } - else { - /* Note: no device daisychain templating (SU_TYPE_DAISY_MASTER_ONLY)! */ - snprintf((char *)cur_info_p.OID, SU_INFOSIZE, su_info_p->OID, cur_template_number); - } - } - else { - snprintf((char *)cur_info_p.OID, SU_INFOSIZE, su_info_p->OID, cur_template_number); - } - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - /* add instant commands to the info database. */ - if (SU_TYPE(su_info_p) == SU_TYPE_CMD) { - upsdebugx(1, "Adding template command %s", cur_info_p.info_type); - /* FIXME: only add if "su_ups_get(cur_info_p) == TRUE" */ - if (mode == SU_WALKMODE_INIT) - dstate_addcmd(cur_info_p.info_type); - } - else /* get and process this data */ - status = get_and_process_data(mode, &cur_info_p); - } else { - /* server side (ABSENT) data */ - su_setinfo(&cur_info_p, NULL); - } - /* set back the flag */ - su_info_p->flags = cur_info_p.flags; - } - free((char*)cur_info_p.info_type); - if (cur_info_p.OID != NULL) - free((char*)cur_info_p.OID); - if ((cur_info_p.dfl != NULL) && - (strstr(su_info_p->dfl, "%i") != NULL)) - free((char*)cur_info_p.dfl); - } - else { - upsdebugx(1, "No %s present, discarding template definition...", type); - } - return status; -} - -/* Return the type of template, according to a variable name. - * Return: SU_OUTLET_GROUP, SU_OUTLET or 0 if not a template */ -snmp_info_flags_t get_template_type(const char* varname) -{ - if (!strncmp(varname, "outlet.group", 12)) { - upsdebugx(4, "outlet.group template"); - return SU_OUTLET_GROUP; - } - else if (!strncmp(varname, "outlet", 6)) { - upsdebugx(4, "outlet template"); - return SU_OUTLET; - } - else if (!strncmp(varname, "device", 6)) { - upsdebugx(4, "device template"); - return SU_DAISY; - } - else if (!strncmp(varname, "ambient", 7)) { - upsdebugx(4, "ambient template"); - return SU_AMBIENT_TEMPLATE; - } - else { - upsdebugx(2, "Unknown template type: %s", varname); - return 0; - } -} - -/* Extract the id number of an instantiated template. - * Example: return '1' for type = 'outlet.1.desc', -1 if unknown */ -int extract_template_number(snmp_info_flags_t template_type, const char* varname) -{ - const char* item_number_ptr = NULL; - int item_number = -1; - - if (template_type & SU_OUTLET_GROUP) - item_number_ptr = &varname[12]; - else if (template_type & SU_OUTLET) - item_number_ptr = &varname[6]; - else if (template_type & SU_DAISY) - item_number_ptr = &varname[6]; - else if (template_type & SU_AMBIENT_TEMPLATE) - item_number_ptr = &varname[7]; - else - return -1; - - item_number = atoi(++item_number_ptr); - upsdebugx(3, "%s: item %i", __func__, item_number); - return item_number; -} - -/* Extract the id number of a template from a variable name. - * Example: return '1' for type = 'outlet.1.desc' */ -static int extract_template_number_from_snmp_info_t(const char* varname) -{ - return extract_template_number(get_template_type(varname), varname); -} - -/* end of template functions */ - - /* process a single data from a walk */ bool_t get_and_process_data(int mode, snmp_info_t *su_info_p) { bool_t status = FALSE; - upsdebugx(1, "%s: %s (%s)", __func__, - su_info_p->info_type, su_info_p->OID); + upsdebugx(1, "getting data: %s (%s)", su_info_p->info_type, su_info_p->OID); /* ok, update this element. */ status = su_ups_get(su_info_p); - upsdebugx(4, "%s: su_ups_get returned %d", __func__, status); /* set stale flag if data is stale, clear if not. */ if (status == TRUE) { if (su_info_p->flags & SU_FLAG_STALE) { - upslogx(LOG_INFO, "[%s] %s: data resumed for %s", - upsname?upsname:device_name, __func__, su_info_p->info_type); + upslogx(LOG_INFO, "[%s] snmp_ups_walk: data resumed for %s", + upsname?upsname:device_name, su_info_p->info_type); su_info_p->flags &= ~SU_FLAG_STALE; } if(su_info_p->flags & SU_FLAG_UNIQUE) { /* We should be the only provider of this */ - upsdebugx(4, "%s: unique flag", __func__); disable_competition(su_info_p); su_info_p->flags &= ~SU_FLAG_UNIQUE; } @@ -2790,519 +1206,220 @@ bool_t get_and_process_data(int mode, snmp_info_t *su_info_p) return status; } -/*********************************************************************** - * Daisychain handling functions - **********************************************************************/ - -/*! - * Daisychained devices support init: - * Determine the number of device(s) and if daisychain support has to be enabled - * Set the values of devices_count (internal) and "device.count" (public) - * Return TRUE if daisychain support is enabled, FALSE otherwise */ -bool_t daisychain_init() -{ - snmp_info_t *su_info_p = NULL; - - upsdebugx(1, "Checking if daisychain support has to be enabled"); - - su_info_p = su_find_info("device.count"); - - if (su_info_p != NULL) - { - upsdebugx(1, "Found device.count entry..."); - - /* Enable daisychain if there is a device.count entry. - * This means that will have templates for entries */ - daisychain_enabled = TRUE; - - /* Try to get the OID value, if it's not a template */ - upsdebugx(3, "OID for device.count is %s", - su_info_p->OID ? su_info_p->OID : ""); - if ((su_info_p->OID != NULL) && - (strstr(su_info_p->OID, "%i") == NULL)) - { -#if WITH_SNMP_LKP_FUN - devices_count = -1; - /* First test if we have a generic lookup function - * FIXME: Check if the field type is a string? - */ - /* TODO: backport the 2x2 mapping function support - * and this would be "fun_s2l" in resulting codebase - */ - if ( (su_info_p->oid2info != NULL) && (su_info_p->oid2info->nuf_s2l != NULL) ) { - char buf[1024]; - upsdebugx(2, "%s: using generic string-to-long lookup function", __func__); - if (TRUE == nut_snmp_get_str(su_info_p->OID, buf, sizeof(buf), su_info_p->oid2info)) { - devices_count = su_info_p->oid2info->nuf_s2l(buf); - upsdebugx(2, "%s: got value '%ld'", __func__, devices_count); - } - } - - if (devices_count == -1) { -#endif /* WITH_SNMP_LKP_FUN */ - - if (nut_snmp_get_int(su_info_p->OID, &devices_count) == TRUE) - upsdebugx(1, "There are %ld device(s) present", devices_count); - else - { - upsdebugx(1, "Error: can't get the number of device(s) present!"); - upsdebugx(1, "Falling back to 1 device!"); - devices_count = 1; - } - -#if WITH_SNMP_LKP_FUN - } -#endif /* WITH_SNMP_LKP_FUN */ - } - /* Otherwise (template), use the guesstimation function to get - * the number of devices present */ - else - { - devices_count = guestimate_template_count(su_info_p); - upsdebugx(1, "Guesstimation: there are %ld device(s) present", devices_count); - } - - /* Sanity check before data publication */ - if (devices_count < 1) { - devices_count = 1; - daisychain_enabled = FALSE; - upsdebugx(1, "Devices count is less than 1!"); - upsdebugx(1, "Falling back to 1 device and disabling daisychain support!"); - } else { - /* Publish the device(s) count - even if just one - * device was recognized at this moment */ - dstate_setinfo("device.count", "%ld", devices_count); - - /* Also publish the default value for mfr and a forged model - * for device.0 (whole daisychain) */ - su_info_p = su_find_info("device.mfr"); - if (su_info_p != NULL) { - su_info_p = su_find_info("ups.mfr"); - if (su_info_p != NULL) { - su_setinfo(su_info_p, NULL); - } - } - /* Forge model using device.type and number */ - su_info_p = su_find_info("device.type"); - if ((su_info_p != NULL) && (su_info_p->dfl != NULL)) { - dstate_setinfo("device.model", "daisychain %s (1+%ld)", - su_info_p->dfl, devices_count - 1); - dstate_setinfo("device.type", "%s", su_info_p->dfl); - } - else { - dstate_setinfo("device.model", "daisychain (1+%ld)", devices_count - 1); - } - } - } - else { - daisychain_enabled = FALSE; - upsdebugx(1, "No device.count entry found, daisychain support not needed"); - } - - /* Finally, compute and store the base OID index and NUT offset */ - su_info_p = su_find_info("device.model"); - if (su_info_p != NULL) { - device_template_index_base = base_snmp_template_index(su_info_p); - upsdebugx(1, "%s: device_template_index_base = %i", __func__, device_template_index_base); - device_template_offset = device_template_index_base - 1; - upsdebugx(1, "%s: device_template_offset = %i", __func__, device_template_offset); - } - else { - upsdebugx(1, "%s: No device.model entry found.", __func__); - } - - upsdebugx(1, "%s: daisychain support is %s", __func__, - (daisychain_enabled==TRUE)?"enabled":"disabled"); - - return daisychain_enabled; -} - -/*********************************************************************** - * SNMP handling functions - **********************************************************************/ - -/* Process a data with regard to SU_OUTPHASES, SU_INPHASES and SU_BYPPHASES. - * 3phases related data are disabled if the unit is 1ph, and conversely. - * If the related phases data (input, output, bypass) is not yet valued, - * retrieve it first. - * - * type: input, output, bypass - * su_info_p: variable to process flags on - * Return 0 if OK, 1 if the caller needs to "continue" the walk loop (i.e. - * skip the present data) - */ -static int process_phase_data(const char* type, long *nb_phases, snmp_info_t *su_info_p) -{ - snmp_info_t *tmp_info_p; - char tmpOID[SU_INFOSIZE]; - char tmpInfo[SU_INFOSIZE]; - long tmpValue; - snmp_info_flags_t phases_flag = 0, single_phase_flag = 0, three_phase_flag = 0; - - /* Phase specific data */ - if (!strncmp(type, "input", 5)) { - phases_flag = SU_INPHASES; - single_phase_flag = SU_INPUT_1; - three_phase_flag = SU_INPUT_3; - } - else if (!strncmp(type, "output", 6)) { - phases_flag = SU_OUTPHASES; - single_phase_flag = SU_OUTPUT_1; - three_phase_flag = SU_OUTPUT_3; - } - else if (!strncmp(type, "input.bypass", 12)) { - phases_flag = SU_BYPPHASES; - single_phase_flag = SU_BYPASS_1; - three_phase_flag = SU_BYPASS_3; - } - else { - upsdebugx(2, "%s: unknown type '%s'", __func__, type); - return 1; - } - - /* Init the phase(s) info for this device, if not already done */ - if (*nb_phases == -1) { - upsdebugx(2, "%s phases information not initialized for device %i", - type, current_device_number); - - memset(tmpInfo, 0, SU_INFOSIZE); - - /* daisychain specifics... */ - if ( (daisychain_enabled == TRUE) && (current_device_number > 0) ) { - /* Device(s) 2-N (slave(s)) need to append 'device.x' */ - snprintf(tmpInfo, SU_INFOSIZE, - "device.%i.%s.phases", current_device_number, type); - } - else { - snprintf(tmpInfo, SU_INFOSIZE, "%s.phases", type); - } - - if (dstate_getinfo(tmpInfo) == NULL) { - /* {input,output,bypass}.phases is not yet published, - * try to get the template for it */ - snprintf(tmpInfo, SU_INFOSIZE, "%s.phases", type); - tmp_info_p = su_find_info(tmpInfo); - if (tmp_info_p != NULL) { - memset(tmpOID, 0, SU_INFOSIZE); - - /* Daisychain specific: we may have a template (including - * formatting string) that needs to be adapted! */ - if (strchr(tmp_info_p->OID, '%') != NULL) { - upsdebugx(2, "Found template, need to be adapted"); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char*)tmpOID, SU_INFOSIZE, tmp_info_p->OID, current_device_number + device_template_offset); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - } - else { - /* Otherwise, just point at what we found */ - upsdebugx(2, "Found entry, not a template %s", tmp_info_p->OID); - snprintf((char*)tmpOID, SU_INFOSIZE, "%s", tmp_info_p->OID); - } - /* Actually get the data */ - if (nut_snmp_get_int(tmpOID, &tmpValue) == TRUE) { - *nb_phases = tmpValue; - } - else { - upsdebugx(2, "Can't get %s value. Defaulting to 1 %s.phase", tmpInfo, type); - *nb_phases = 1; - /* FIXME: return something or process using default?! */ - } - } - else { - upsdebugx(2, "No %s entry. Defaulting to 1 %s.phase", tmpInfo, type); - *nb_phases = 1; - /* FIXME: return something or process using default?! */ - } - } - else { - *nb_phases = atoi(dstate_getinfo(tmpInfo)); - } - /* Publish the number of phase(s) */ - dstate_setinfo(tmpInfo, "%ld", *nb_phases); - upsdebugx(2, "device %i has %ld %s.phases", current_device_number, *nb_phases, type); - } - /* FIXME: what to do here? - else if (*nb_phases == 0) { - return 1; - } */ - - - /* Actual processing of phases related data */ -/* FIXME: don't clear SU_INPHASES in daisychain mode!!! ??? */ - if (su_info_p->flags & single_phase_flag) { - if (*nb_phases == 1) { - upsdebugx(1, "%s_phases is 1", type); - su_info_p->flags &= ~phases_flag; - } else { - upsdebugx(1, "%s_phases is not 1", type); - su_info_p->flags &= ~SU_FLAG_OK; - return 1; - } - } else if (su_info_p->flags & three_phase_flag) { - if (*nb_phases == 3) { - upsdebugx(1, "%s_phases is 3", type); - su_info_p->flags &= ~phases_flag; - } else { - upsdebugx(1, "%s_phases is not 3", type); - su_info_p->flags &= ~SU_FLAG_OK; - return 1; - } - } else { - upsdebugx(1, "%s_phases is %ld", type, *nb_phases); - } - return 0; /* FIXME: remap EXIT_SUCCESS to RETURN_SUCCESS */ -} - - /* walk ups variables and set elements of the info array. */ bool_t snmp_ups_walk(int mode) { - long *walked_input_phases, *walked_output_phases, *walked_bypass_phases; static unsigned long iterations = 0; snmp_info_t *su_info_p; bool_t status = FALSE; - if (mode == SU_WALKMODE_UPDATE) { - semistatic_countdown--; - if (semistatic_countdown < 0) - semistatic_countdown = semistaticfreq; - } + for (su_info_p = &snmp_info[0]; su_info_p->info_type != NULL ; su_info_p++) { - /* Loop through all device(s) */ - /* Note: considering "unitary" and "daisy-chained" devices, we have - * several variables (and their values) that can come into play: - * devices_count == 1 (default) AND daisychain_enabled == FALSE => unitary - * devices_count > 1 (AND/OR?) daisychain_enabled == TRUE => a daisy-chain - * The current_device_number == 0 in context of daisy-chain means the - * "whole device" with composite or summary values that refer to the - * chain as a virtual power device (e.g. might be a sum of outlet counts). - * If daisychain_enabled == TRUE and current_device_number == 1 then we - * are looking at the "master" device (one that we have direct/networked - * connectivity to; the current_device_number > 1 is a slave (chained by - * some proprietary link not visible from the outside) and represented - * through the master - the slaves are not addressable directly. If the - * master dies/reboots, connection to the whole chain is interrupted. - * The dstate string names for daisychained sub-devices have the prefix - * "device." and number embedded (e.g. "device.3.input.phases") except - * for the whole (#0) virtual device, so it *seems* similar to unitary. - */ + /* Check if we are asked to stop (reactivity++) */ + if (exit_flag != 0) + return TRUE; - for (current_device_number = (daisychain_enabled == FALSE && devices_count == 1 ? 1 : 0) ; - current_device_number <= devices_count; current_device_number++) - { - - upsdebugx(1, "%s: walking device %d", - __func__, current_device_number); - - /* reinit the alarm buffer, before */ - if (devices_count > 1) - device_alarm_init(); - - /* better safe than sorry, check sanity on every loop cycle */ - if (snmp_info == NULL) { - fatalx(EXIT_FAILURE, "%s: snmp_info is not initialized", __func__); + /* skip instcmd, not linked to outlets */ + if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) + && !(su_info_p->flags & SU_OUTLET)) { + upsdebugx(1, "SU_CMD_MASK => %s", su_info_p->OID); + continue; } + /* skip elements we shouldn't show */ + if (!(su_info_p->flags & SU_FLAG_OK)) + continue; - if (snmp_info[0].info_type == NULL) { - upsdebugx(1, "%s: WARNING: snmp_info is empty", __func__); - } + /* skip static elements in update mode */ + if (mode == SU_WALKMODE_UPDATE && + su_info_p->flags & SU_FLAG_STATIC) + continue; - /* Loop through all mapping entries for the current_device_number */ - for (su_info_p = &snmp_info[0]; (su_info_p != NULL && su_info_p->info_type != NULL) ; su_info_p++) { - - /* NOTE: Effectively below we do this: - * switch(current_device_number) { - * case 0: devtype = "daisychain whole" - * case 1: devtype = "daisychain master" - * default: devtype = "daisychain slave" - * } - * with a consideration for directly-addressable - * slave devices (can be seen in chain via master, - * but also queryable alone with an IP connection) - * NOTE: until proven otherwise, "single" may mean - * both (either) a daisy-chain enabled master device - * without further connected "slave" devices, and - * a directly addressable (IP-connected) "slave". - * Possibly also an ePDU etc. that serves a MIB - * which resolves "device.count" with the selected - * subdriver. - */ - if (daisychain_enabled == TRUE) { - upsdebugx(1, "%s: processing daisy-chain device %i (%s)", - __func__, current_device_number, - (current_device_number == 1) - ? (devices_count > 1 ? "master" : "single") - : (current_device_number > 1 ? "slave" : "whole") - ); - } else { - upsdebugx(1, "%s: processing unitary device (%i)", - __func__, current_device_number); - } - - /* Check if we are asked to stop (reactivity++) */ - if (exit_flag != 0) { - upsdebugx(1, "%s: aborting because exit_flag was set", __func__); - return TRUE; - } - - /* Skip daisychain data count */ - if (mode == SU_WALKMODE_INIT && - (!strncmp(su_info_p->info_type, "device.count", 12))) - { - su_info_p->flags &= ~SU_FLAG_OK; - continue; - } - -/* FIXME: daisychain-whole, what to do? */ -/* Note that when addressing the FIXME above, - * if (current_device_number == 0 && daisychain_enabled == FALSE) - * then we'd skip it still (unitary device is at current_device_number == 1)... - */ - /* skip the whole-daisychain for now */ - if (current_device_number == 0 && daisychain_enabled == TRUE) { - upsdebugx(1, "Skipping daisychain device.0 for now..."); - continue; - } - - /* skip instcmd, not linked to outlets */ - if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) - && !(su_info_p->flags & SU_OUTLET) - && !(su_info_p->flags & SU_OUTLET_GROUP)) { - upsdebugx(1, "SU_CMD_MASK => %s", su_info_p->OID); - continue; - } - /* skip elements we shouldn't show in update mode */ - if ((mode == SU_WALKMODE_UPDATE) && !(su_info_p->flags & SU_FLAG_OK)) - continue; - - /* skip semi-static elements in update mode: only parse when countdown reaches 0 */ - if ((mode == SU_WALKMODE_UPDATE) && (su_info_p->flags & SU_FLAG_SEMI_STATIC)) { - if (semistatic_countdown != 0) - continue; - upsdebugx(1, "Refreshing semi-static entry %s", su_info_p->OID); - } - - /* skip static elements in update mode */ - if ((mode == SU_WALKMODE_UPDATE) && (su_info_p->flags & SU_FLAG_STATIC)) - continue; - - /* Set default value if we cannot fetch it */ - /* and set static flag on this element. - * Not applicable to outlets (need SU_FLAG_STATIC tagging) */ - if ((su_info_p->flags & SU_FLAG_ABSENT) - && !(su_info_p->flags & SU_OUTLET) - && !(su_info_p->flags & SU_OUTLET_GROUP) - && !(su_info_p->flags & SU_AMBIENT_TEMPLATE)) - { - if (mode == SU_WALKMODE_INIT) - { - if (su_info_p->dfl) - { - if ((daisychain_enabled == TRUE) && (devices_count > 1)) - { - if (current_device_number == 0) - { - su_setinfo(su_info_p, NULL); /* FIXME: daisychain-whole, what to do? */ - } else { - status = process_template(mode, "device", su_info_p); - } - } - else { - /* Set default value if we cannot fetch it from ups. */ - su_setinfo(su_info_p, NULL); - } - } - su_info_p->flags |= SU_FLAG_STATIC; + /* set default value if we cannot fetch it */ + /* and set static flag on this element. + * not applicable to outlets (need SU_FLAG_STATIC tagging) */ + if ((su_info_p->flags & SU_FLAG_ABSENT) + && !(su_info_p->flags & SU_OUTLET)) { + if (mode == SU_WALKMODE_INIT) { + if (su_info_p->dfl) { + /* Set default value if we cannot fetch it from ups. */ + su_setinfo(su_info_p, NULL); } + su_info_p->flags |= SU_FLAG_STATIC; + } + continue; + } + + /* check stale elements only on each PN_STALE_RETRY iteration. */ + if ((su_info_p->flags & SU_FLAG_STALE) && + (iterations % SU_STALE_RETRY) != 0) + continue; + + if (su_info_p->flags & SU_INPHASES) { + upsdebugx(1, "Check input_phases"); + if (input_phases == 0) { continue; } + if (su_info_p->flags & SU_INPUT_1) { + if (input_phases == 1) { + upsdebugx(1, "input_phases is 1"); + su_info_p->flags &= ~SU_INPHASES; + } else { + upsdebugx(1, "input_phases is not 1"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else if (su_info_p->flags & SU_INPUT_3) { + if (input_phases == 3) { + upsdebugx(1, "input_phases is 3"); + su_info_p->flags &= ~SU_INPHASES; + } else { + upsdebugx(1, "input_phases is not 3"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else { + upsdebugx(1, "input_phases is %d", input_phases); + } + } - /* check stale elements only on each PN_STALE_RETRY iteration. */ - /* if ((su_info_p->flags & SU_FLAG_STALE) && - (iterations % SU_STALE_RETRY) != 0) + if (su_info_p->flags & SU_OUTPHASES) { + upsdebugx(1, "Check output_phases"); + if (output_phases == 0) { continue; - */ - /* Filter 1-phase Vs 3-phase according to {input,output,bypass}.phase. - * Non matching items are disabled, and flags are cleared at init - * time */ - /* Process input phases information */ - walked_input_phases = &daisychain_info[current_device_number]->input_phases; - if (su_info_p->flags & SU_INPHASES) { - upsdebugx(1, "Check input_phases (%ld)", *walked_input_phases); - if (process_phase_data("input", walked_input_phases, su_info_p) == 1) - continue; } + if (su_info_p->flags & SU_OUTPUT_1) { + if (output_phases == 1) { + upsdebugx(1, "output_phases is 1"); + su_info_p->flags &= ~SU_OUTPHASES; + } else { + upsdebugx(1, "output_phases is not 1"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else if (su_info_p->flags & SU_OUTPUT_3) { + if (output_phases == 3) { + upsdebugx(1, "output_phases is 3"); + su_info_p->flags &= ~SU_OUTPHASES; + } else { + upsdebugx(1, "output_phases is not 3"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else { + upsdebugx(1, "output_phases is %d", output_phases); + } + } - /* Process output phases information */ - walked_output_phases = &daisychain_info[current_device_number]->output_phases; - if (su_info_p->flags & SU_OUTPHASES) { - upsdebugx(1, "Check output_phases (%ld)", *walked_output_phases); - if (process_phase_data("output", walked_output_phases, su_info_p) == 1) - continue; + if (su_info_p->flags & SU_BYPPHASES) { + upsdebugx(1, "Check bypass_phases"); + if (bypass_phases == 0) { + continue; } + if (su_info_p->flags & SU_BYPASS_1) { + if (bypass_phases == 1) { + upsdebugx(1, "bypass_phases is 1"); + su_info_p->flags &= ~SU_BYPPHASES; + } else { + upsdebugx(1, "bypass_phases is not 1"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else if (su_info_p->flags & SU_BYPASS_3) { + if (input_phases == 3) { + upsdebugx(1, "bypass_phases is 3"); + su_info_p->flags &= ~SU_BYPPHASES; + } else { + upsdebugx(1, "bypass_phases is not 3"); + su_info_p->flags &= ~SU_FLAG_OK; + continue; + } + } else { + upsdebugx(1, "bypass_phases is %d", bypass_phases); + } + } - /* Process bypass phases information */ - walked_bypass_phases = &daisychain_info[current_device_number]->bypass_phases; - if (su_info_p->flags & SU_BYPPHASES) { - upsdebugx(1, "Check bypass_phases (%ld)", *walked_bypass_phases); - if (process_phase_data("input.bypass", walked_bypass_phases, su_info_p) == 1) - continue; - } + /* process outlet template definition */ + if (su_info_p->flags & SU_OUTLET) { + upsdebugx(1, "outlet template definition found (%s)...", su_info_p->info_type); + int cur_outlet_number = 1; + int cur_nut_index = 0; + int outlet_count = 0; + snmp_info_t cur_info_p; - /* process template (outlet, outlet group, inc. daisychain) definition */ - if (su_info_p->flags & SU_OUTLET) { - /* Skip commands after init */ - if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) && (mode == SU_WALKMODE_UPDATE)) + if(dstate_getinfo("outlet.count") == NULL) { + /* FIXME: should we disable it? + * su_info_p->flags &= ~SU_FLAG_OK; + * or rely on guestimation? */ + if ((outlet_count = guestimate_outlet_count(su_info_p->OID)) == -1) { + /* Failed */ continue; - else - status = process_template(mode, "outlet", su_info_p); - } - else if (su_info_p->flags & SU_OUTLET_GROUP) { - /* Skip commands after init */ - if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) && (mode == SU_WALKMODE_UPDATE)) - continue; - else - status = process_template(mode, "outlet.group", su_info_p); - } - else if (su_info_p->flags & SU_AMBIENT_TEMPLATE) { - /* Skip commands after init */ - if ((SU_TYPE(su_info_p) == SU_TYPE_CMD) && (mode == SU_WALKMODE_UPDATE)) - continue; - else - status = process_template(mode, "ambient", su_info_p); - } - else { -/* if (daisychain_enabled == TRUE) { - status = process_template(mode, "device", su_info_p); } else { -*/ /* get and process this data, including daisychain adaptation */ - status = get_and_process_data(mode, su_info_p); -/* + /* Publish the count estimation */ + dstate_setinfo("outlet.count", "%i", outlet_count); } -*/ } - } /* for (su_info_p... */ + else { + outlet_count = atoi(dstate_getinfo("outlet.count")); + } - if (devices_count > 1) { - /* commit the device alarm buffer */ - device_alarm_commit(current_device_number); + /* Only instantiate outlets if needed! */ + if (outlet_count > 0) { + /* general init of data using the template */ + instantiate_info(su_info_p, &cur_info_p); - /* reinit the alarm buffer, after, not to pollute "device.0" */ - device_alarm_init(); + for (cur_outlet_number = base_snmp_outlet_index(su_info_p->OID) ; + cur_outlet_number < (outlet_count + base_snmp_outlet_index(su_info_p->OID)) ; + cur_outlet_number++) + { + cur_nut_index = cur_outlet_number + base_nut_outlet_offset(); + sprintf((char*)cur_info_p.info_type, su_info_p->info_type, + cur_nut_index); + + /* check if default value is also a template */ + if ((cur_info_p.dfl != NULL) && + (strstr(su_info_p->dfl, "%i") != NULL)) { + cur_info_p.dfl = (char *)xmalloc(SU_INFOSIZE); + sprintf((char *)cur_info_p.dfl, su_info_p->dfl, cur_nut_index); + } + + if (cur_info_p.OID != NULL) { + sprintf((char *)cur_info_p.OID, su_info_p->OID, cur_outlet_number); + + /* add outlet instant commands to the info database. */ + if (SU_TYPE(su_info_p) == SU_TYPE_CMD) { + /* FIXME: only add if "su_ups_get(cur_info_p) == TRUE" */ + if (mode == SU_WALKMODE_INIT) + dstate_addcmd(cur_info_p.info_type); + } + else /* get and process this data */ + status = get_and_process_data(mode, &cur_info_p); + } else { + /* server side (ABSENT) data */ + su_setinfo(&cur_info_p, NULL); + } + /* set back the flag */ + su_info_p->flags = cur_info_p.flags; + } + free((char*)cur_info_p.info_type); + if (cur_info_p.OID != NULL) + free((char*)cur_info_p.OID); + if ((cur_info_p.dfl != NULL) && + (strstr(su_info_p->dfl, "%i") != NULL)) + free((char*)cur_info_p.dfl); + } + else { + upsdebugx(1, "No outlet present, discarding template definition..."); + } } - } + else { + /* get and process this data */ + status = get_and_process_data(mode, su_info_p); + } + } /* for (su_info_p... */ + iterations++; + return status; } @@ -3311,161 +1428,32 @@ bool_t su_ups_get(snmp_info_t *su_info_p) static char buf[SU_INFOSIZE]; bool_t status; long value; - double dvalue; - const char *strValue = NULL; struct snmp_pdu ** pdu_array; struct snmp_pdu * current_pdu; alarms_info_t * alarms; int index = 0; - char *format_char = NULL; - int saved_current_device_number = -1; - snmp_info_t *tmp_info_p = NULL; - upsdebugx(2, "%s: %s %s", __func__, su_info_p->info_type, su_info_p->OID); - - /* Check if this is a daisychain template */ - if (su_info_p->OID != NULL - && (format_char = strchr(su_info_p->OID, '%')) != NULL - ) { - upsdebugx(3, "%s: calling instantiate_info() for " - "daisy-chain template", __func__); - tmp_info_p = instantiate_info(su_info_p, tmp_info_p); - if (tmp_info_p != NULL) { - upsdebugx(3, "%s: instantiate_info() returned " - "non-null OID: %s", - __func__, tmp_info_p->OID); - /* adapt the OID */ - if (su_info_p->OID != NULL) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char *)tmp_info_p->OID, SU_INFOSIZE, su_info_p->OID, - current_device_number + device_template_offset); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - upsdebugx(3, "%s: OID %s adapted into %s", - __func__, su_info_p->OID, - tmp_info_p->OID); - } - else { - free_info(tmp_info_p); - return FALSE; - } - - /* adapt info_type */ - if (su_info_p->info_type != NULL) { - snprintf((char *)tmp_info_p->info_type, - SU_INFOSIZE, "%s", - su_info_p->info_type); - } - else { - free_info(tmp_info_p); - return FALSE; - } - - su_info_p = tmp_info_p; - } - else { - upsdebugx(2, "%s: can't instantiate template", __func__); - return FALSE; - } - } - else { - /* Non-templated OID, still may be aimed at a - * daisy-chained device (master of the chain - * makes sense for IETF device.contact etc.). - * BUT: It could be a direct request for earlier - * resolved OID. So check for "device.N." too. - */ - if (daisychain_enabled == TRUE - && devices_count > 1 - && current_device_number > 0 - ) { - /* So we had a literal OID string, originally - * Check for "device.N." in the string: */ - char * varname = su_info_p->info_type; - if (!strncmp(varname, "device.", 7) - && (varname[7] >= '0' && varname[7] <= '9') - ) { - upsdebugx(2, "%s: keeping original " - "current device == %d for " - "non-templated daisy value", - __func__, current_device_number); - } else { - upsdebugx(2, "%s: would fake " - "current device == 1 for " - "non-templated daisy value " - "instead of %d", - __func__, current_device_number); - saved_current_device_number = current_device_number; - } - /* At this point we applied no hacks yet, - * just stashed a non-negative value into - * saved_current_device_number - */ - } - } + upsdebugx(2, "su_ups_get: %s %s", su_info_p->info_type, su_info_p->OID); if (!strcasecmp(su_info_p->info_type, "ups.status")) { -/* FIXME: daisychain status support! */ - upsdebugx(2, "%s: requesting nut_snmp_get_int() for " - "ups.status, with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); + status = nut_snmp_get_int(su_info_p->OID, &value); if (status == TRUE) { su_status_set(su_info_p, value); upsdebugx(2, "=> value: %ld", value); } - else - upsdebugx(2, "=> Failed"); - - free_info(tmp_info_p); - return status; - } - - /* Handle 'ups.alarm', 'outlet.n.alarm' and 3phase 'Lx.alarm', - * nothing else! */ - if (!strcmp(strrchr(su_info_p->info_type, '.'), ".alarm")) { - - upsdebugx(2, "Processing alarm: %s", su_info_p->info_type); - -/* FIXME: daisychain alarms support! */ - upsdebugx(2, "%s: requesting nut_snmp_get_int() for " - "some alarm, with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); - status = nut_snmp_get_int(su_info_p->OID, &value); - if (status == TRUE) - { - su_alarm_set(su_info_p, value); - upsdebugx(2, "=> value: %ld", value); - } else upsdebugx(2, "=> Failed"); - free_info(tmp_info_p); return status; } - /* Walk a subtree (array) of alarms, composed of OID references. - * The object referenced should not be accessible, but rather when - * present, this means that the alarm condition is TRUE. - * Only present in powerware-mib.c for now */ if (!strcasecmp(su_info_p->info_type, "ups.alarms")) { - upsdebugx(2, "%s: requesting nut_snmp_get_int() for " - "ups.alarms, with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); status = nut_snmp_get_int(su_info_p->OID, &value); if (status == TRUE) { - upsdebugx(2, "=> %ld alarms present", value); + upsdebugx(2, "=> value: %ld", value); if( value > 0 ) { - pdu_array = nut_snmp_walk(su_info_p->OID, INT_MAX); + pdu_array = nut_snmp_walk(su_info_p->OID,INT_MAX); if(pdu_array == NULL) { upsdebugx(2, "=> Walk failed"); return FALSE; @@ -3473,26 +1461,15 @@ bool_t su_ups_get(snmp_info_t *su_info_p) current_pdu = pdu_array[index]; while(current_pdu) { - /* Retrieve the OID name, for comparison */ - if (decode_oid(current_pdu, buf, sizeof(buf)) == TRUE) { - alarms = alarms_info; - while( alarms->OID ) { - if(!strcmp(buf, alarms->OID)) { - upsdebugx(3, "Alarm OID found => %s", alarms->OID); - /* Check for ups.status value */ - if (alarms->status_value) { - upsdebugx(3, "Alarm value (status) found => %s", alarms->status_value); - status_set(alarms->status_value); - } - /* Check for ups.alarm value */ - if (alarms->alarm_value) { - upsdebugx(3, "Alarm value (alarm) found => %s", alarms->alarm_value); - alarm_set(alarms->alarm_value); - } - break; - } - alarms++; + decode_str(current_pdu,buf,sizeof(buf),NULL); + alarms = alarms_info; + while( alarms->OID ) { + if(!strcmp(buf+1,alarms_info->OID)) { + upsdebugx(3, "Alarm OID %s found => %s", alarms->OID, alarms->info_value); + status_set(alarms->info_value); + break; } + alarms++; } index++; current_pdu = pdu_array[index]; @@ -3500,11 +1477,11 @@ bool_t su_ups_get(snmp_info_t *su_info_p) nut_snmp_free(pdu_array); } } + else { upsdebugx(2, "=> Failed"); } - free_info(tmp_info_p); return status; } @@ -3512,13 +1489,9 @@ bool_t su_ups_get(snmp_info_t *su_info_p) if (!strcasecmp(su_info_p->info_type, "ambient.temperature")) { float temp=0; - upsdebugx(2, "%s: requesting nut_snmp_get_int() for " - "ambient.temperature, with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); status = nut_snmp_get_int(su_info_p->OID, &value); if(status != TRUE) { - free_info(tmp_info_p); return status; } @@ -3542,490 +1515,293 @@ bool_t su_ups_get(snmp_info_t *su_info_p) snprintf(buf, sizeof(buf), "%.1f", temp); su_setinfo(su_info_p, buf); - free_info(tmp_info_p); return TRUE; } - /* special treatment for element without oid but with default value */ - if (su_info_p->OID == NULL && su_info_p->dfl != NULL) { - status = TRUE; - /* FIXME: strlcpy() would fit here safer; not used in NUT yet */ - strncpy(buf, su_info_p->dfl, sizeof(buf) - 1); - buf[sizeof(buf) - 1] = '\0'; - } - else if (su_info_p->info_flags & ST_FLAG_STRING) { - upsdebugx(2, "%s: requesting nut_snmp_get_str(), " - "with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); - status = nut_snmp_get_str(su_info_p->OID, buf, - sizeof(buf), su_info_p->oid2info); - if (status == TRUE) { - if (quirk_symmetra_threephase) { - if (!strcasecmp(su_info_p->info_type, "input.transfer.low") - || !strcasecmp(su_info_p->info_type, "input.transfer.high")) { - /* Convert from three phase line-to-line voltage to line-to-neutral voltage */ - double tmp_dvalue = atof(buf); - tmp_dvalue = tmp_dvalue * 0.707; - snprintf(buf, sizeof(buf), "%.2f", tmp_dvalue); - } - } - /* Check if there is a string reformating function */ - const char *fmt_buf = NULL; - if ((fmt_buf = su_find_strval(su_info_p->oid2info, buf)) != NULL) { - snprintf(buf, sizeof(buf), "%s", fmt_buf); - } - } - } else { - upsdebugx(2, "%s: requesting nut_snmp_get_int(), " - "with%s daisy template originally", - __func__, (format_char!=NULL ? "" : "out")); + if (su_info_p->info_flags == 0) { status = nut_snmp_get_int(su_info_p->OID, &value); if (status == TRUE) { - if ((su_info_p->flags&SU_FLAG_NEGINVALID && value<0) - || (su_info_p->flags&SU_FLAG_ZEROINVALID && value==0)) { + if (su_info_p->flags&SU_FLAG_NEGINVALID && value<0) { su_info_p->flags &= ~SU_FLAG_OK; if(su_info_p->flags&SU_FLAG_UNIQUE) { disable_competition(su_info_p); su_info_p->flags &= ~SU_FLAG_UNIQUE; } - free_info(tmp_info_p); return FALSE; } - /* Check if there is a value to be looked up */ - if ((strValue = su_find_infoval(su_info_p->oid2info, &value)) != NULL) - snprintf(buf, sizeof(buf), "%s", strValue); - else { - /* Check if there is a need to publish decimal too, - * i.e. if switching to integer does not cause a - * loss of precision. - * FIXME: Use remainder? is (dvalue%1.0)>0 cleaner? - */ - dvalue = value * su_info_p->info_len; - if (f_equal((int)dvalue, dvalue)) - snprintf(buf, sizeof(buf), "%i", (int)dvalue); - else - snprintf(buf, sizeof(buf), "%.2f", (float)dvalue); + if (su_info_p->flags & SU_FLAG_SETINT) { + upsdebugx(1, "setvar %s", su_info_p->OID); + *su_info_p->setvar = value; } + snprintf(buf, sizeof(buf), "%.2f", value * su_info_p->info_len); } + } else { + status = nut_snmp_get_str(su_info_p->OID, buf, sizeof(buf), su_info_p->oid2info); } if (status == TRUE) { - if (saved_current_device_number >= 0) { - current_device_number = 1; - } su_setinfo(su_info_p, buf); - if (saved_current_device_number >= 0) { - current_device_number = saved_current_device_number; - } upsdebugx(2, "=> value: %s", buf); } - else { + else upsdebugx(2, "=> Failed"); - } - free_info(tmp_info_p); return status; } -/* Common function for setting OIDs, from a NUT variable name, - * used by su_setvar() and su_instcmd() - * Params: - * @mode: SU_MODE_INSTCMD for instant commands, SU_MODE_SETVAR for settings - * @varname: name of variable or command to set the OID from - * @val: value for settings, NULL for commands - - * Returns - * STAT_SET_HANDLED if OK, - * STAT_SET_INVALID or STAT_SET_UNKNOWN if the command / setting is not supported - * STAT_SET_FAILED otherwise - */ -static int su_setOID(int mode, const char *varname, const char *val) +/* set r/w INFO_ element to a value. */ +int su_setvar(const char *varname, const char *val) { snmp_info_t *su_info_p = NULL; bool_t status; int retval = STAT_SET_FAILED; - int cmd_offset = 0; - long value = -1; - /* normal (default), outlet, or outlet group variable */ - snmp_info_flags_t vartype = 0; - int daisychain_device_number = -1; - /* variable without the potential "device.X" prefix, to find the template */ - char *tmp_varname = NULL; - char setOID[SU_INFOSIZE]; - /* Used for potentially appending "device.X." to {outlet,outlet.group}.count */ - char template_count_var[SU_BUFSIZE]; + int value = -1; - upsdebugx(2, "entering %s(%s, %s, %s)", __func__, - (mode==SU_MODE_INSTCMD)?"instcmd":"setvar", varname, val); + upsdebugx(2, "entering su_setvar(%s, %s)", varname, val); - memset(setOID, 0, SU_INFOSIZE); - memset(template_count_var, 0, SU_BUFSIZE); - - /* Check if it's a daisychain setting (device.x.varname), - * or a non-daisy setting/value/cmd for the "master" unit - * (as un-numbered device.varname), or something else? - */ - if (!strncmp(varname, "device", 6)) { - if (varname[7] >= '0' && varname[7] <= '9') { - /* Extract the (single-digit) device number - * TODO: use strtol() or similar to support multi-digit - * chains and offset tmp_varname inside varname properly - */ - daisychain_device_number = atoi(&varname[7]); - /* Point at the command, without the "device.x" prefix */ - tmp_varname = strdup(&varname[9]); - snprintf(template_count_var, 10, "%s", varname); - - upsdebugx(2, "%s: got a daisychain %s (%s) for device %i", - __func__, (mode==SU_MODE_INSTCMD)?"command":"setting", - tmp_varname, daisychain_device_number); - - if (daisychain_device_number > devices_count) - upsdebugx(2, "%s: item is out of bound (%i / %ld)", - __func__, daisychain_device_number, devices_count); - } - else { - /* Note: below we check if "OID" contains ".%i" template text - * like we do in su_setinfo(); eventually we might get vendor - * MIBs that do expose device.contact/location/description - * for each link in the chain... - */ - if (daisychain_enabled == TRUE) { - /* Is the original "device.varname" backed by a templated - * OID string, so we can commonly set e.g. device.contact - * for everything in the chain? - */ - su_info_p = su_find_info(varname); - if (su_info_p - && (su_info_p->OID == NULL || strstr(su_info_p->OID, ".%i") != NULL) - ) { - /* is templated or defaulted */ - daisychain_device_number = 0; - } else { - daisychain_device_number = 1; - } - - upsdebugx(2, "%s: got an un-numbered daisychain %s (%s), " - "directing it to %s", - __func__, (mode==SU_MODE_INSTCMD)?"command":"setting", - varname, - (daisychain_device_number==1)?"'master' device":"all devices" - ); - } else { - /* No daisy, no poppy */ - daisychain_device_number = 0; - } - tmp_varname = strdup(varname); - } - } + if (strncmp(varname, "outlet", 6)) + su_info_p = su_find_info(varname); else { - daisychain_device_number = 0; - tmp_varname = strdup(varname); - } - - /* skip the whole-daisychain for now: - * will send the settings to all devices in the daisychain */ - if ((daisychain_enabled == TRUE) && (devices_count > 1) && (daisychain_device_number == 0)) { - upsdebugx(2, "daisychain %s for device.0 are not yet supported!", - (mode==SU_MODE_INSTCMD)?"command":"setting"); - free(tmp_varname); - return STAT_SET_INVALID; - } - - /* Check if it is outlet / outlet.group, or standard variable */ - if (strncmp(tmp_varname, "outlet", 6)) { - su_info_p = su_find_info(tmp_varname); - /* what if e.g. "device.x.contact" is not found as a "contact"? */ - if (!su_info_p && strcmp(tmp_varname, varname)) { - upsdebugx(2, - "%s: did not find info for daisychained entry %s, " - "retrying with original varname %s", - __func__, tmp_varname, varname); - su_info_p = su_find_info(varname); - - /* Still nothing? Try to revert from "device.1." - * as a daisychain master? */ - if (!su_info_p - && daisychain_enabled == TRUE - && devices_count > 1 - && daisychain_device_number == 1 - && !strncmp(varname, "device.1.", 9) - ) { - char tmp_buf[SU_INFOSIZE]; - snprintf(tmp_buf, sizeof(tmp_buf), - "device.%s", (varname + 9)); - su_info_p = su_find_info(tmp_buf); - if (su_info_p) { - upsdebugx(2, "%s: finally found " - "as daisy master revert %s", - __func__, tmp_buf); - free(tmp_varname); - tmp_varname = strdup(tmp_buf); - } - } - } - } else { - /* is indeed an outlet.* or device.x.outlet.* */ snmp_info_t *tmp_info_p; - /* Point the outlet or outlet group number in the string */ - const char *item_number_ptr = NULL; - /* Store the target outlet or group number */ - int item_number = extract_template_number_from_snmp_info_t(tmp_varname); - /* Store the total number of outlets or outlet groups */ - int total_items = -1; - - /* Check if it is outlet / outlet.group */ - vartype = get_template_type(tmp_varname); - if (vartype == SU_OUTLET_GROUP) { - snprintfcat(template_count_var, SU_BUFSIZE, "outlet.group.count"); - total_items = atoi(dstate_getinfo(template_count_var)); - item_number_ptr = &tmp_varname[12]; - } - else { - snprintfcat(template_count_var, SU_BUFSIZE, "outlet.count"); - total_items = atoi(dstate_getinfo(template_count_var)); - item_number_ptr = &tmp_varname[6]; - } - upsdebugx(3, "Using count variable '%s'", template_count_var); - item_number = atoi(++item_number_ptr); - upsdebugx(3, "%s: item %i / %i", __func__, item_number, total_items); - - /* ensure the item number is supported (filtered upstream though)! */ - if (item_number > total_items) { - /* out of bound item number */ - upsdebugx(2, "%s: item is out of bound (%i / %i)", - __func__, item_number, total_items); + char *outlet_number_ptr = strchr(varname, '.'); + int outlet_number = atoi(++outlet_number_ptr); + if (dstate_getinfo("outlet.count") == NULL) { + upsdebugx(2, "su_setvar: can't get outlet.count..."); return STAT_SET_INVALID; } - /* find back the item template */ - char *item_varname = (char *)xmalloc(SU_INFOSIZE); - snprintf(item_varname, SU_INFOSIZE, "%s.%s%s", - (vartype == SU_OUTLET)?"outlet":"outlet.group", - "%i", strchr(item_number_ptr++, '.')); - upsdebugx(3, "%s: searching for template\"%s\"", __func__, item_varname); - tmp_info_p = su_find_info(item_varname); - free(item_varname); + upsdebugx(3, "su_setvar: outlet %i / %i", outlet_number, + atoi(dstate_getinfo("outlet.count"))); + + /* ensure the outlet number is supported (filtered upstream though)! */ + if (outlet_number > atoi(dstate_getinfo("outlet.count"))) { + /* out of bound outlet number */ + upsdebugx(2, "su_setvar: outlet is out of bound (%i / %s)", + outlet_number, dstate_getinfo("outlet.count")); + return STAT_SET_INVALID; + } + /* find back the outlet template */ + char *outlet_varname = (char *)xmalloc(SU_INFOSIZE); + sprintf(outlet_varname, "outlet.%s%s", "%i", strchr(outlet_number_ptr++, '.')); + upsdebugx(3, "su_setvar: searching for template\"%s\"", outlet_varname); + tmp_info_p = su_find_info(outlet_varname); + free(outlet_varname); /* for an snmp_info_t instance */ su_info_p = instantiate_info(tmp_info_p, su_info_p); /* check if default value is also a template */ if ((su_info_p->dfl != NULL) && - (strstr(tmp_info_p->dfl, "%i") != NULL)) - { + (strstr(tmp_info_p->dfl, "%i") != NULL)) { su_info_p->dfl = (char *)xmalloc(SU_INFOSIZE); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - snprintf((char *)su_info_p->dfl, SU_INFOSIZE, tmp_info_p->dfl, - item_number); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + sprintf((char *)su_info_p->dfl, tmp_info_p->dfl, + outlet_number - base_nut_outlet_offset()); } /* adapt the OID */ if (su_info_p->OID != NULL) { - if (mode==SU_MODE_INSTCMD) { - /* Workaround buggy Eaton Pulizzi implementation - * which have different offsets index for data & commands! */ - if (su_info_p->flags & SU_CMD_OFFSET) { - upsdebugx(3, "Adding command offset"); - cmd_offset++; - } - } - - /* Special processing for daisychain: - * these outlet | outlet groups also include formatting info, - * so we have to check if the daisychain is enabled, and if - * the formatting info for it are in 1rst or 2nd position */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - if (daisychain_enabled == TRUE) { - /* Note: daisychain_enabled == TRUE means that we have - * daisychain template. However: - * * when there are multiple devices, offset "-1" applies - * since device.0 is a fake and actual devices start at - * index 1 - * * when there is only 1 device, offset doesn't apply since - * the device index is "0" - */ - int daisychain_offset = 0; - if (devices_count > 1) - daisychain_offset = 1; - - if (su_info_p->flags & SU_TYPE_DAISY_1) { - snprintf((char *)su_info_p->OID, SU_INFOSIZE, tmp_info_p->OID, - daisychain_device_number - daisychain_offset, item_number); - } - else { - snprintf((char *)su_info_p->OID, SU_INFOSIZE, tmp_info_p->OID, - item_number, daisychain_device_number - daisychain_offset); - } - } - else { - snprintf((char *)su_info_p->OID, SU_INFOSIZE, tmp_info_p->OID, item_number); - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif + sprintf((char *)su_info_p->OID, tmp_info_p->OID, + outlet_number - base_nut_outlet_offset()); + } + /* else, don't return STAT_SET_INVALID since we can be setting + * a server side variable! */ + + /* adapt info_type */ + if (su_info_p->info_type != NULL) + sprintf((char *)su_info_p->info_type, "%s", varname); + } + + if (!su_info_p || !su_info_p->info_type || !(su_info_p->flags & SU_FLAG_OK)) { + upsdebugx(2, "su_setvar: info element unavailable %s", varname); + + if (!strncmp(varname, "outlet", 6)) + free_info(su_info_p); + + return STAT_SET_UNKNOWN; + } + + if (!(su_info_p->info_flags & ST_FLAG_RW) || su_info_p->OID == NULL) { + upsdebugx(2, "su_setvar: not writable %s", varname); + + if (!strncmp(varname, "outlet", 6)) + free_info(su_info_p); + + return STAT_SET_INVALID; + } + + /* set value into the device */ + if (su_info_p->info_flags & ST_FLAG_STRING) { + status = nut_snmp_set_str(su_info_p->OID, val); + } else { + /* non string data may imply a value lookup */ + if (su_info_p->oid2info) { + value = su_find_valinfo(su_info_p->oid2info, val); } - /* else, don't return STAT_SET_INVALID for mode==SU_MODE_SETVAR since we - * can be setting a server side variable! */ else { - if (mode==SU_MODE_INSTCMD) { - free_info(su_info_p); - return STAT_INSTCMD_UNKNOWN; - } - else { - /* adapt info_type */ - if (su_info_p->info_type != NULL) - snprintf((char *)su_info_p->info_type, SU_INFOSIZE, "%s", tmp_varname); + value = strtol(val, NULL, 0); + } + /* Actually apply the new value */ + status = nut_snmp_set_int(su_info_p->OID, value); + } + + if (status == FALSE) + upsdebugx(1, "su_setvar: cannot set value %s for %s", val, su_info_p->OID); + else { + retval = STAT_SET_HANDLED; + upsdebugx(1, "su_setvar: successfully set %s to \"%s\"", varname, val); + + /* update info array */ + su_setinfo(su_info_p, val); + } + if (!strncmp(varname, "outlet", 6)) + free_info(su_info_p); + + return retval; +} + +/* process instant command and take action. */ +int su_instcmd(const char *cmdname, const char *extradata) +{ + snmp_info_t *su_info_p = NULL; + int status; + int retval = STAT_INSTCMD_FAILED; + int cmd_offset = 0; + + upsdebugx(2, "entering su_instcmd(%s, %s)", cmdname, extradata); + + /* FIXME: this should only apply if strchr(%)! */ + if (strncmp(cmdname, "outlet", 6)) { + su_info_p = su_find_info(cmdname); + } + else { + snmp_info_t *tmp_info_p; + char *outlet_number_ptr = strchr(cmdname, '.'); + int outlet_number = atoi(++outlet_number_ptr); + if (dstate_getinfo("outlet.count") == NULL) { + upsdebugx(2, "su_instcmd: can't get outlet.count..."); + return STAT_INSTCMD_UNKNOWN; + } + + upsdebugx(3, "su_instcmd: outlet %i / %i", outlet_number, + atoi(dstate_getinfo("outlet.count"))); + + /* ensure the outlet number is supported! */ + if (outlet_number > atoi(dstate_getinfo("outlet.count"))) { + /* out of bound outlet number */ + upsdebugx(2, "su_instcmd: outlet is out of bound (%i / %s)", + outlet_number, dstate_getinfo("outlet.count")); + return STAT_INSTCMD_INVALID; + } + + /* find back the outlet template */ + char *outlet_cmdname = (char *)xmalloc(SU_INFOSIZE); + sprintf(outlet_cmdname, "outlet.%s%s", "%i", strchr(outlet_number_ptr++, '.')); + upsdebugx(3, "su_instcmd: searching for template\"%s\"", outlet_cmdname); + tmp_info_p = su_find_info(outlet_cmdname); + free(outlet_cmdname); + + /* for an snmp_info_t instance */ + su_info_p = instantiate_info(tmp_info_p, su_info_p); + + /* check if default value is also a template */ + if ((su_info_p->dfl != NULL) && + (strstr(tmp_info_p->dfl, "%i") != NULL)) { + su_info_p->dfl = (char *)xmalloc(SU_INFOSIZE); + sprintf((char *)su_info_p->dfl, tmp_info_p->dfl, + outlet_number - base_nut_outlet_offset()); + } + /* adapt the OID */ + if (su_info_p->OID != NULL) { + /* Workaround buggy Eaton Pulizzi implementation + * which have different offsets index for data & commands! */ + if (su_info_p->flags & SU_CMD_OFFSET) { + upsdebugx(3, "Adding command offset"); + cmd_offset++; } + + sprintf((char *)su_info_p->OID, tmp_info_p->OID, + outlet_number - base_nut_outlet_offset() + cmd_offset); + } else { + free_info(su_info_p); + return STAT_INSTCMD_UNKNOWN; } } /* Sanity check */ if (!su_info_p || !su_info_p->info_type || !(su_info_p->flags & SU_FLAG_OK)) { - upsdebugx(2, "%s: info element unavailable %s", __func__, varname); - - /* Free template (outlet and outlet.group) */ - free_info(su_info_p); - - if (tmp_varname != NULL) - free(tmp_varname); - - return STAT_SET_UNKNOWN; - } - - /* set value into the device, using the provided one, or the default one otherwise */ - if (mode==SU_MODE_INSTCMD) { - /* Sanity check: commands should either have a value or a default */ - if ( (val == NULL) && (su_info_p->dfl == NULL) ) { - upsdebugx(1, "%s: cannot execute command '%s': a provided or default value is needed!", __func__, varname); - return STAT_SET_INVALID; + /* Check for composite commands */ + if (!strcasecmp(cmdname, "load.on")) { + return su_instcmd("load.on.delay", "0"); } + + if (!strcasecmp(cmdname, "load.off")) { + return su_instcmd("load.off.delay", "0"); + } + + if (!strcasecmp(cmdname, "shutdown.return")) { + int ret; + + /* Ensure "ups.start.auto" is set to "yes", if supported */ + if (dstate_getinfo("ups.start.auto")) { + su_setvar("ups.start.auto", "yes"); + } + + ret = su_instcmd("load.on.delay", dstate_getinfo("ups.delay.start")); + if (ret != STAT_INSTCMD_HANDLED) { + return ret; + } + + return su_instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); + } + + if (!strcasecmp(cmdname, "shutdown.stayoff")) { + int ret; + + /* Ensure "ups.start.auto" is set to "no", if supported */ + if (dstate_getinfo("ups.start.auto")) { + su_setvar("ups.start.auto", "no"); + } + + ret = su_instcmd("load.on.delay", "-1"); + if (ret != STAT_INSTCMD_HANDLED) { + return ret; + } + + return su_instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); + } + + upsdebugx(2, "su_instcmd: %s unavailable", cmdname); + + if (!strncmp(cmdname, "outlet", 6)) + free_info(su_info_p); + + return STAT_INSTCMD_UNKNOWN; } + /* set value, using the provided one, or the default one otherwise */ if (su_info_p->info_flags & ST_FLAG_STRING) { - status = nut_snmp_set_str(su_info_p->OID, val ? val : su_info_p->dfl); + status = nut_snmp_set_str(su_info_p->OID, extradata ? extradata : su_info_p->dfl); + } else { + status = nut_snmp_set_int(su_info_p->OID, extradata ? atoi(extradata) : su_info_p->info_len); } + + if (status == FALSE) + upsdebugx(1, "su_instcmd: cannot set value for %s", cmdname); else { - if (mode==SU_MODE_INSTCMD) { - if ( !str_to_long(val ? val : su_info_p->dfl, &value, 10) ) { - upsdebugx(1, "%s: cannot execute command '%s': value is not a number!", __func__, varname); - return STAT_SET_INVALID; - } - } - else { - /* non string data may imply a value lookup */ - if (su_info_p->oid2info) { - value = su_find_valinfo(su_info_p->oid2info, val ? val : su_info_p->dfl); - } - else { - /* Convert value and apply multiplier */ - if ( !str_to_long(val, &value, 10) ) { - upsdebugx(1, "%s: cannot set '%s': value is not a number!", __func__, varname); - return STAT_SET_INVALID; - } - value = (long)((double)value / su_info_p->info_len); - } - } - /* Actually apply the new value */ - if (SU_TYPE(su_info_p) == SU_TYPE_TIME) { - status = nut_snmp_set_time(su_info_p->OID, value); - } - else { - status = nut_snmp_set_int(su_info_p->OID, value); - } + retval = STAT_INSTCMD_HANDLED; + upsdebugx(1, "su_instcmd: successfully sent command %s", cmdname); } - /* Process result */ - if (status == FALSE) { - if (mode==SU_MODE_INSTCMD) - upsdebugx(1, "%s: cannot execute command '%s'", __func__, varname); - else - upsdebugx(1, "%s: cannot set value %s on OID %s", __func__, val, su_info_p->OID); - - retval = STAT_SET_FAILED; - } - else { - retval = STAT_SET_HANDLED; - if (mode==SU_MODE_INSTCMD) - upsdebugx(1, "%s: successfully sent command %s", __func__, varname); - else { - upsdebugx(1, "%s: successfully set %s to \"%s\"", __func__, varname, val); - - /* update info array: call dstate_setinfo, since flags and aux are - * already published, and this saves us some processing */ - dstate_setinfo(varname, "%s", val); - } - } - - /* Free template (outlet and outlet.group) */ - if (!strncmp(tmp_varname, "outlet", 6)) + if (!strncmp(cmdname, "outlet", 6)) free_info(su_info_p); - free(tmp_varname); return retval; } -/* set r/w INFO_ element to a value. - * FIXME: make a common function with su_instcmd! */ -int su_setvar(const char *varname, const char *val) -{ - return su_setOID(SU_MODE_SETVAR, varname, val); -} - -/* Daisychain-aware function to add instant commands: - * Every command that is valid for a device has to be added for device.0 - * This then allows to composite commands, called on device.0 and executed - * on all devices of the daisychain */ -int su_addcmd(snmp_info_t *su_info_p) -{ - upsdebugx(2, "entering %s(%s)", __func__, su_info_p->info_type); - - if (daisychain_enabled == TRUE) { -/* FIXME?: daisychain */ - for (current_device_number = 1 ; current_device_number <= devices_count ; - current_device_number++) - { - process_template(SU_WALKMODE_INIT, "device", su_info_p); - } - } - else { - if (nut_snmp_get(su_info_p->OID) != NULL) { - dstate_addcmd(su_info_p->info_type); - upsdebugx(1, "%s: adding command '%s'", __func__, su_info_p->info_type); - } - } - return 0; -} - -/* process instant command and take action. */ -int su_instcmd(const char *cmdname, const char *extradata) -{ - return su_setOID(SU_MODE_INSTCMD, cmdname, extradata); -} - /* FIXME: the below functions can be removed since these were for loading * the mib2nut information from a file instead of the .h definitions... */ /* return 1 if usable, 0 if not */ -static int parse_mibconf_args(size_t numargs, char **arg) +static int parse_mibconf_args(int numargs, char **arg) { bool_t ret; @@ -4045,9 +1821,9 @@ static int parse_mibconf_args(size_t numargs, char **arg) } if (ret == FALSE) - upslogx(LOG_ERR, "%s: cannot set value %s for %s", __func__, arg[4], arg[3]); + upslogx(LOG_ERR, "su_setvar: cannot set value %s for %s", arg[4], arg[3]); else - upsdebugx(1, "%s: successfully set %s to \"%s\"", __func__, arg[0], arg[4]); + upsdebugx(1, "su_setvar: successfully set %s to \"%s\"", arg[0], arg[4]); return 1; } @@ -4057,20 +1833,18 @@ static int parse_mibconf_args(size_t numargs, char **arg) return 1; } - /* called for fatal errors in parseconf like malloc failures */ static void mibconf_err(const char *errmsg) { upslogx(LOG_ERR, "Fatal error in parseconf (*mib.conf): %s", errmsg); } - /* load *mib.conf into an snmp_info_t structure */ void read_mibconf(char *mib) { char fn[SMALLBUF]; PCONF_CTX_t ctx; - upsdebugx(2, "SNMP UPS driver: entering %s(%s)", __func__, mib); + upsdebugx(2, "SNMP UPS driver : entering read_mibconf(%s)", mib); snprintf(fn, sizeof(fn), "%s/snmp/%s.conf", CONFPATH, mib); diff --git a/drivers/snmp-ups.h b/drivers/snmp-ups.h index 6ac670a..8b281df 100644 --- a/drivers/snmp-ups.h +++ b/drivers/snmp-ups.h @@ -4,14 +4,11 @@ * * Copyright (C) * 2002-2010 Arnaud Quette - * 2015-2021 Eaton (author: Arnaud Quette ) - * 2016-2021 Eaton (author: Jim Klimov ) * 2002-2006 Dmitry Frolov - * J.W. Hoogervorst + * J.W. Hoogervorst * Niels Baggesen * - * Sponsored by Eaton - * and originally by MGE UPS SYSTEMS + * Sponsored by MGE UPS SYSTEMS * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,14 +27,12 @@ */ /* TODO list: +- add syscontact/location (to all mib.h or centralized?) - complete shutdown - add enum values to OIDs. -- optimize network flow by: - 1) caching OID values (as in usbhid-ups) with timestamping and lifetime - 2) constructing one big packet (calling snmp_add_null_var - for each OID request we made), instead of sending many small packets -- add support for registration and traps (manager mode) - => Issue: 1 trap listener for N snmp-ups drivers! +- optimize network flow by constructing one big packet (calling snmp_add_null_var +for each OID request we made), instead of sending many small packets +- add support for registration and traps (manager mode), - complete mib2nut data (add all OID translation to NUT) - externalize mib2nut data in .m2n files and load at driver startup using parseconf()... - adjust information logging. @@ -80,23 +75,11 @@ #include #include -#ifndef ONE_SEC -/* This macro name disappeared from net-snmp sources and headers - * after v5.9 tag, and was replaced by explicit expression below: */ -# define ONE_SEC (1000L * 1000L) -#endif - /* Force numeric OIDs by disabling MIB loading */ -#ifdef DISABLE_MIB_LOADING -# undef DISABLE_MIB_LOADING -#endif #define DISABLE_MIB_LOADING 1 /* Parameters default values */ -#define DEFAULT_POLLFREQ 30 /* in seconds */ -#define DEFAULT_NETSNMP_RETRIES 5 -#define DEFAULT_NETSNMP_TIMEOUT 1 /* in seconds */ -#define DEFAULT_SEMISTATICFREQ 10 /* in snmpwalk update cycles */ +#define DEFAULT_POLLFREQ 30 /* in seconds */ /* use explicit booleans */ #ifndef FALSE @@ -115,46 +98,10 @@ typedef int bool_t; /* typedef void (*interpreter)(char *, char *, int); */ -#ifndef WITH_SNMP_LKP_FUN -/* Recent addition of fun/nuf hooks in info_lkp_t is not well handled by - * all corners of the codebase, e.g. not by DMF. So at least until that - * is fixed, (TODO) we enable those bits of code only optionally during - * a build for particular usage. Conversely, experimenters can define - * this macro to a specific value while building the codebase and see - * what happens under different conditions ;) - */ -# if (defined WITH_DMFMIB) && (WITH_DMFMIB != 0) -# define WITH_SNMP_LKP_FUN 0 -# else -# define WITH_SNMP_LKP_FUN 1 -# endif -#endif - -#ifndef WITH_SNMP_LKP_FUN_DUMMY -# define WITH_SNMP_LKP_FUN_DUMMY 0 -#endif - /* for lookup between OID values and INFO_ value */ typedef struct { - int oid_value; /* SNMP OID value */ - const char *info_value; /* NUT INFO_* value */ -#if WITH_SNMP_LKP_FUN -/* FIXME: Currently we do not have a way to provide custom C code - * via DMF - keep old approach until we get the ability, e.g. by - * requiring a LUA implementation to be passed alongside C lookups. - */ -/* - * Currently there are a few cases using a "fun_vp2s" type of lookup - * function, while the "nuf_s2l" type was added for completeness but - * is not really handled and does not have real consumers in the - * existing NUT codebase (static mib2nut tables in *-mib.c files). - * Related to su_find_infoval() (long* => string), su_find_valinfo() - * (string => long) and su_find_strval() (char* => string) routines - * defined below. - */ - const char *(*fun_vp2s)(void *snmp_value); /* optional SNMP to NUT mapping function, converting a pointer to SNMP data (e.g. numeric or string) into a NUT string */ - long (*nuf_s2l)(const char *nut_value); /* optional NUT to SNMP mapping function, converting a NUT string into SNMP numeric data */ -#endif /* WITH_SNMP_LKP_FUN */ + int oid_value; /* OID value */ + const char *info_value; /* INFO_* value */ } info_lkp_t; /* Structure containing info about one item that can be requested @@ -162,55 +109,30 @@ typedef struct { use sprintf with given format string. If unit is not NONE, values are converted according to the multiplier table */ -typedef uint32_t snmp_info_flags_t; /* To extend when 32 bits become too congested */ -#define PRI_SU_FLAGS PRIu32 - typedef struct { - char *info_type; /* INFO_ or CMD_ element */ - int info_flags; /* flags to set in addinfo: see ST_FLAG_* - * defined in include/extstate.h */ - double info_len; /* length of strings if ST_FLAG_STRING, - * multiplier otherwise. */ - char *OID; /* SNMP OID or NULL */ - char *dfl; /* default value */ - snmp_info_flags_t flags; /* snmp-ups internal flags: see SU_* bit-shifts - * defined below (SU_FLAG*, SU_TYPE*, SU_STATUS* - * and others for outlets, phases, daisy-chains, - * etc.) - * NOTE that some *-mib.c mappings can specify - * a zero in this field... better fix that in - * favor of explicit values with a meaning! - * Current code treats such zero values as - * "OK if avail, otherwise discarded". - * NOTE: With C99+ a "long" is guaranteed to be - * at least 4 bytes; consider "unsigned long long" - * when/if we get more than 32 flag values. - */ - info_lkp_t *oid2info; /* lookup table between OID and NUT values */ + const char *info_type; /* INFO_ or CMD_ element */ + int info_flags; /* flags to set in addinfo */ + float info_len; /* length of strings if STR, + * cmd value if CMD, multiplier otherwise. */ + const char *OID; /* SNMP OID or NULL */ + const char *dfl; /* default value */ + unsigned long flags; /* my flags */ + info_lkp_t *oid2info; /* lookup table between OID and NUT values */ + int *setvar; /* variable to set for SU_FLAG_SETINT */ } snmp_info_t; -/* "flags" bits 0..9 */ -#define SU_FLAG_OK (1UL << 0) /* show element to upsd - - * internal to snmp driver */ -#define SU_FLAG_STATIC (1UL << 1) /* retrieve info only once. */ -#define SU_FLAG_ABSENT (1UL << 2) /* data is absent in the device, +#define SU_FLAG_OK (1 << 0) /* show element to upsd. */ +#define SU_FLAG_STATIC (1 << 1) /* retrieve info only once. */ +#define SU_FLAG_ABSENT (1 << 2) /* data is absent in the device, * use default value. */ -#define SU_FLAG_STALE (1UL << 3) /* data stale, don't try too often - - * internal to snmp driver */ -#define SU_FLAG_NEGINVALID (1UL << 4) /* Invalid if negative value */ -#define SU_FLAG_UNIQUE (1UL << 5) /* There can be only be one +#define SU_FLAG_STALE (1 << 3) /* data stale, don't try too often. */ +#define SU_FLAG_NEGINVALID (1 << 4) /* Invalid if negative value */ +#define SU_FLAG_UNIQUE (1 << 5) /* There can be only be one * provider of this info, * disable the other providers */ -/* Note: older releases defined the following flag, but removed it by 2.7.5: - * #define SU_FLAG_SETINT (1UL << 6)*/ /* save value */ -#define SU_FLAG_ZEROINVALID (1UL << 6) /* Invalid if "0" value */ -#define SU_FLAG_NAINVALID (1UL << 7) /* Invalid if "N/A" value */ -#define SU_CMD_OFFSET (1UL << 8) /* Add +1 to the OID index */ - -#define SU_FLAG_SEMI_STATIC (1UL << 9) /* Refresh this entry once in several walks - * (for R/W values user can set on device, - * like descriptions or contacts) */ - +#define SU_FLAG_SETINT (1 << 6) /* save value */ +#define SU_OUTLET (1 << 7) /* outlet template definition */ +#define SU_CMD_OFFSET (1 << 8) /* Add +1 to the OID index */ /* Notes on outlet templates usage: * - outlet.count MUST exist and MUST be declared before any outlet template * Otherwise, the driver will try to determine it by itself... @@ -218,73 +140,40 @@ typedef struct { * a valid OID) in order to detect the base SNMP index (0 or 1) */ -/* "flags" bit 10 */ -#define SU_OUTLET_GROUP (1UL << 10) /* outlet group template definition */ -#define SU_OUTLET (1UL << 11) /* outlet template definition */ - -/* Phase specific data */ -/* "flags" bits 12..17 */ -#define SU_PHASES (0x0000003F << 12) -#define SU_INPHASES (0x00000003 << 12) -#define SU_INPUT_1 (1UL << 12) /* only if 1 input phase */ -#define SU_INPUT_3 (1UL << 13) /* only if 3 input phases */ -#define SU_OUTPHASES (0x00000003 << 14) -#define SU_OUTPUT_1 (1UL << 14) /* only if 1 output phase */ -#define SU_OUTPUT_3 (1UL << 15) /* only if 3 output phases */ -#define SU_BYPPHASES (0x00000003 << 16) -#define SU_BYPASS_1 (1UL << 16) /* only if 1 bypass phase */ -#define SU_BYPASS_3 (1UL << 17) /* only if 3 bypass phases */ -/* FIXME: use input.phases and output.phases to replace this */ - -/* hints for su_ups_set, applicable only to rw vars */ -/* "flags" bits 18..20 */ -#define SU_TYPE_INT (1UL << 18) /* cast to int when setting value */ -#define SU_TYPE_TIME (1UL << 19) /* cast to int */ -#define SU_TYPE_CMD (1UL << 20) /* instant command */ -/* The following helper macro is used like: - * if (SU_TYPE(su_info_p) == SU_TYPE_CMD) { ... } - */ -#define SU_TYPE(t) ((t)->flags & (7UL << 18)) - -/* Daisychain template definition */ -/* the following 2 flags specify the position of the daisychain device index - * in the formatting string. This is useful when considering daisychain with - * templates, such as outlets / outlets groups, which already have a format - * string specifier */ -/* "flags" bits 21..23 (and 24 reserved for DMF) */ -#define SU_TYPE_DAISY_1 (1UL << 21) /* Daisychain index is the 1st %i specifier in a template with more than one */ -#define SU_TYPE_DAISY_2 (1UL << 22) /* Daisychain index is the 2nd %i specifier in a template with more than one */ -#define SU_TYPE_DAISY(t) ((t)->flags & (11UL << 21)) /* Mask the SU_TYPE_DAISY_{1,2,MASTER_ONLY} but not SU_DAISY */ -#define SU_DAISY (1UL << 23) /* Daisychain template definition - set at run-time for devices with detected "device.count" over 1 */ -/* NOTE: Previously SU_DAISY had same bit-flag value as SU_TYPE_DAISY_2 */ -#define SU_TYPE_DAISY_MASTER_ONLY (1UL << 24) /* Only valid for daisychain master (device.1) */ - -/* Free slot: (1UL << 25) */ - -#define SU_AMBIENT_TEMPLATE (1UL << 26) /* ambient template definition */ - -/* Reserved slot -- to import from DMF branch codebase: -//#define SU_FLAG_FUNCTION (1UL << 27) -*/ - /* status string components * FIXME: these should be removed, since there is no added value. * Ie, this can be guessed from info->type! */ + +#define SU_STATUS_PWR (0 << 8) /* indicates power status element */ +#define SU_STATUS_BATT (1 << 8) /* indicates battery status element */ +#define SU_STATUS_CAL (2 << 8) /* indicates calibration status element */ +#define SU_STATUS_RB (3 << 8) /* indicates replace battery status element */ +#define SU_STATUS_NUM_ELEM 4 +#define SU_STATUS_INDEX(t) (((t) >> 8) & 7) -/* "flags" bits 28..31 */ -#define SU_STATUS_PWR (1UL << 28) /* indicates power status element */ -#define SU_STATUS_BATT (1UL << 29) /* indicates battery status element */ -#define SU_STATUS_CAL (1UL << 30) /* indicates calibration status element */ -#define SU_STATUS_RB (1UL << 31) /* indicates replace battery status element */ -#define SU_STATUS_NUM_ELEM 4 /* Obsolete? No references found in codebase */ -#define SU_STATUS_INDEX(t) (((unsigned long)(t) >> 28) & 15UL) +/* Phase specific data */ +#define SU_PHASES (0x3F << 12) +#define SU_INPHASES (0x3 << 12) +#define SU_INPUT_1 (1 << 12) /* only if 1 input phase */ +#define SU_INPUT_3 (1 << 13) /* only if 3 input phases */ +#define SU_OUTPHASES (0x3 << 14) +#define SU_OUTPUT_1 (1 << 14) /* only if 1 output phase */ +#define SU_OUTPUT_3 (1 << 15) /* only if 3 output phases */ +#define SU_BYPPHASES (0x3 << 16) +#define SU_BYPASS_1 (1 << 16) /* only if 1 bypass phase */ +#define SU_BYPASS_3 (1 << 17) /* only if 3 bypass phases */ +/* FIXME: use input.phases and output.phases to replace this */ + + +/* hints for su_ups_set, applicable only to rw vars */ +#define SU_TYPE_INT (0 << 18) /* cast to int when setting value */ +#define SU_TYPE_STRING (1 << 18) /* cast to string. FIXME: redundant with ST_FLAG_STRING */ +#define SU_TYPE_TIME (2 << 18) /* cast to int */ +#define SU_TYPE_CMD (3 << 18) /* instant command */ +#define SU_TYPE(t) ((t)->flags & (7 << 18)) -/* Despite similar names, definitons below are not among the bit-flags ;) */ #define SU_VAR_COMMUNITY "community" #define SU_VAR_VERSION "snmp_version" -#define SU_VAR_RETRIES "snmp_retries" -#define SU_VAR_TIMEOUT "snmp_timeout" -#define SU_VAR_SEMISTATICFREQ "semistaticfreq" #define SU_VAR_MIBS "mibs" #define SU_VAR_POLLFREQ "pollfreq" /* SNMP v3 related parameters */ @@ -295,8 +184,6 @@ typedef struct { #define SU_VAR_AUTHPROT "authProtocol" #define SU_VAR_PRIVPROT "privProtocol" -#define SU_VAR_ONDELAY "ondelay" -#define SU_VAR_OFFDELAY "offdelay" #define SU_INFOSIZE 128 #define SU_BUFSIZE 32 @@ -309,18 +196,13 @@ typedef struct { #define SU_WALKMODE_INIT 0 #define SU_WALKMODE_UPDATE 1 -/* modes for su_setOID */ -#define SU_MODE_INSTCMD 1 -#define SU_MODE_SETVAR 2 - /* log spew limiters */ #define SU_ERR_LIMIT 10 /* start limiting after this many errors in a row */ #define SU_ERR_RATE 100 /* only print every nth error once limiting starts */ typedef struct { const char * OID; - const char *status_value; /* when not NULL, set ups.status to this */ - const char *alarm_value; /* when not NULL, set ups.alarm to this */ + const char *info_value; } alarms_info_t; typedef struct { @@ -340,12 +222,10 @@ void nut_snmp_cleanup(void); struct snmp_pdu *nut_snmp_get(const char *OID); bool_t nut_snmp_get_str(const char *OID, char *buf, size_t buf_len, info_lkp_t *oid2info); -bool_t nut_snmp_get_oid(const char *OID, char *buf, size_t buf_len); bool_t nut_snmp_get_int(const char *OID, long *pval); bool_t nut_snmp_set(const char *OID, char type, const char *value); bool_t nut_snmp_set_str(const char *OID, const char *value); bool_t nut_snmp_set_int(const char *OID, long value); -bool_t nut_snmp_set_time(const char *OID, long value); void nut_snmp_perror(struct snmp_session *sess, int status, struct snmp_pdu *response, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 4, 5))); @@ -356,50 +236,19 @@ void su_init_instcmds(void); void su_setuphandlers(void); /* need to deal with external function ptr */ void su_setinfo(snmp_info_t *su_info_p, const char *value); void su_status_set(snmp_info_t *, long value); -void su_alarm_set(snmp_info_t *, long value); snmp_info_t *su_find_info(const char *type); bool_t snmp_ups_walk(int mode); bool_t su_ups_get(snmp_info_t *su_info_p); bool_t load_mib2nut(const char *mib); -/* Practical logic around lookup functions, see fun_vp2s and nuf_s2l - * fields in struct info_lkp_t */ -const char *su_find_infoval(info_lkp_t *oid2info, void *value); +const char *su_find_infoval(info_lkp_t *oid2info, long value); long su_find_valinfo(info_lkp_t *oid2info, const char* value); -const char *su_find_strval(info_lkp_t *oid2info, void *value); - -/***************************************************** - * Common conversion structs and functions provided by snmp-ups-helpers.c - * so they can be used and so "shared" by different subdrivers - *****************************************************/ - -const char *su_usdate_to_isodate_info_fun(void *raw_date); -extern info_lkp_t su_convert_to_iso_date_info[]; -/* Name the mapping location in that array for consumers to reference */ -#define FUNMAP_USDATE_TO_ISODATE 0 - -/* Process temperature value according to 'temperature_unit' */ -const char *su_temperature_read_fun(void *raw_snmp_value); - -/* Temperature handling, to convert back to Celsius (NUT standard) */ -extern int temperature_unit; - -#define TEMPERATURE_UNKNOWN 0 -#define TEMPERATURE_CELSIUS 1 -#define TEMPERATURE_KELVIN 2 -#define TEMPERATURE_FAHRENHEIT 3 - -/***************************************************** - * End of Subdrivers shared helpers functions - *****************************************************/ int su_setvar(const char *varname, const char *val); int su_instcmd(const char *cmdname, const char *extradata); void su_shutdown_ups(void); -void set_delays(void); - void read_mibconf(char *mib); extern struct snmp_session g_snmp_sess, *g_snmp_sess_p; @@ -407,25 +256,6 @@ extern const char *OID_pwr_status; extern int g_pwr_battery; extern int pollfreq; /* polling frequency */ extern int input_phases, output_phases, bypass_phases; -extern int semistaticfreq; /* semistatic entry update frequency */ - -/* pointer to the Snmp2Nut lookup table */ -extern mib2nut_info_t *mib2nut_info; -/* FIXME: to be trashed */ -extern snmp_info_t *snmp_info; -extern alarms_info_t *alarms_info; - -/* Common daisychain structure and functions */ - -bool_t daisychain_init(void); -int su_addcmd(snmp_info_t *su_info_p); - -/* Structure containing info about each daisychain device, including phases - * for input, output and bypass */ -typedef struct { - long input_phases; - long output_phases; - long bypass_phases; -} daisychain_info_t; #endif /* SNMP_UPS_H */ + diff --git a/drivers/socomec_jbus.c b/drivers/socomec_jbus.c deleted file mode 100644 index fd1f865..0000000 --- a/drivers/socomec_jbus.c +++ /dev/null @@ -1,492 +0,0 @@ -/* socomec_jbus.c - Driver for Socomec JBUS UPS - * - * Copyright (C) - * 2021 Thanos Chatziathanassiou - * - * Based on documentation found freely on - * https://www.socomec.com/files/live/sites/systemsite/files/GB-JBUS-MODBUS-for-Delphys-MP-and-Delphys-MX-operating-manual.pdf - * but with dubious legal license. The document itself states: - * ``CAUTION : “This is a product for restricted sales distribution to informed partners. - * Installation restrictions or additional measures may be needed to prevent disturbances'' - * YMMV - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "main.h" -#include - -#define DRIVER_NAME "Socomec jbus driver" -#define DRIVER_VERSION "0.06" - -#define CHECK_BIT(var,pos) ((var) & (1<<(pos))) -#define MODBUS_SLAVE_ID 1 -#define BATTERY_RUNTIME_CRITICAL 15 - -/* Variables */ -static modbus_t *modbus_ctx = NULL; - -static int mrir(modbus_t * arg_ctx, int addr, int nb, uint16_t * dest); - -/* driver description structure */ -upsdrv_info_t upsdrv_info = { - DRIVER_NAME, - DRIVER_VERSION, - "Thanos Chatziathanassiou \n", - DRV_BETA, - {NULL} -}; - -void upsdrv_initinfo(void) -{ - upsdebugx(2, "upsdrv_initinfo"); - - uint16_t tab_reg[12]; - int r; - - dstate_setinfo("device.mfr", "socomec jbus"); - dstate_setinfo("device.model", "Socomec Generic"); - - upsdebugx(2, "initial read"); - - /* - this is a neat trick, but not really helpful right now - https://stackoverflow.com/questions/25811662/spliting-an-hex-into-2-hex-values/41733170#41733170 - uint8_t *lowbyte; - uint8_t *hibyte; - */ - - r = mrir(modbus_ctx, 0x1000, 12, tab_reg); - - if (r == -1) { - fatalx(EXIT_FAILURE, "failed to read UPS code from JBUS. r is %d error %s", r, modbus_strerror(errno)); - } - - upsdebugx(2, "read UPS Code %d", tab_reg[0]); - - if (tab_reg[1]) { - upsdebugx(2, "read UPS Power %d (kVA * 10)", tab_reg[1]); - dstate_setinfo("ups.power", "%u", tab_reg[1]*100 ); - } - - /* known Socomec Models */ - switch (tab_reg[0]) { - case 130: - dstate_setinfo("ups.model", "%s", "DIGYS"); - break; - - case 515: - dstate_setinfo("ups.model", "%s", "DELPHYS MX"); - break; - - case 516: - dstate_setinfo("ups.model", "%s", "DELPHYS MX elite"); - break; - - default: - dstate_setinfo("ups.model", "Unknown Socomec JBUS. Send id %u and specify the model", tab_reg[0]); - } - - if (tab_reg[3] && tab_reg[4] && tab_reg[5] && tab_reg[6] && tab_reg[7]) { - dstate_setinfo("ups.serial", "%c%c%c%c%c%c%c%c%c%c", - (tab_reg[3]&0xFF), (tab_reg[3]>>8), - (tab_reg[4]&0xFF), (tab_reg[4]>>8), - (tab_reg[5]&0xFF), (tab_reg[5]>>8), - (tab_reg[6]&0xFF), (tab_reg[6]>>8), - (tab_reg[7]&0xFF), (tab_reg[7]>>8) - ); - } - - /* upsh.instcmd = instcmd; */ - /* upsh.setvar = setvar; */ -} - -void upsdrv_updateinfo(void) -{ - upsdebugx(2, "upsdrv_updateinfo"); - - uint16_t tab_reg[64]; - int r; - - status_init(); - - /* ups configuration */ - r = mrir(modbus_ctx, 0x10E0, 32, tab_reg); - - if (r == -1 || !tab_reg[0]) { - upsdebugx(2, "Did not receive any data from the UPS at 0x10E0 ! Going stale r is %d error %s", r, modbus_strerror(errno)); - dstate_datastale(); - return; - } - - dstate_setinfo("input.voltage", "%u", tab_reg[0]); - dstate_setinfo("output.voltage", "%u", tab_reg[1]); - dstate_setinfo("input.frequency", "%u", tab_reg[2]); - dstate_setinfo("output.frequency", "%u", tab_reg[3]); - - upsdebugx(2, "battery capacity (Ah * 10) %u", tab_reg[8]); - upsdebugx(2, "battery elements %u", tab_reg[9]); - - /* time and date */ - r = mrir(modbus_ctx, 0x1360, 4, tab_reg); - if (r == -1) { - upsdebugx(2, "Did not receive any data from the UPS at 0x1360 ! Ignoring ? r is %d error %s", r, modbus_strerror(errno)); - } - - dstate_setinfo("ups.time", "%02d:%02d:%02d", (tab_reg[1]&0xFF), (tab_reg[0]>>8), (tab_reg[0]&0xFF) ); - dstate_setinfo("ups.date", "%04d/%02d/%02d", (tab_reg[3]+2000), (tab_reg[2]>>8), (tab_reg[1]>>8) ); - - /* ups status */ - r = mrir(modbus_ctx, 0x1020, 6, tab_reg); - - if (r == -1) { - upsdebugx(2, "Did not receive any data from the UPS at 0x1020 ! Ignoring ? r is %d error %s", r, modbus_strerror(errno)); - /* - dstate_datastale(); - return; - */ - } - - if (CHECK_BIT(tab_reg[0], 0)) - upsdebugx(2, "Rectifier Input supply present"); - if (CHECK_BIT(tab_reg[0], 1)) - upsdebugx(2, "Inverter ON "); - if (CHECK_BIT(tab_reg[0], 2)) - upsdebugx(2, "Rectifier ON"); - if (CHECK_BIT(tab_reg[0], 3)) - upsdebugx(2, "Load protected by inverter"); - if (CHECK_BIT(tab_reg[0], 4)) - upsdebugx(2, "Load on automatic bypass"); - if (CHECK_BIT(tab_reg[0], 5)) - upsdebugx(2, "Load on battery"); - if (CHECK_BIT(tab_reg[0], 6)) - upsdebugx(2, "Remote controls disable"); - if (CHECK_BIT(tab_reg[0], 7)) - upsdebugx(2, "Eco-mode ON"); - - if (CHECK_BIT(tab_reg[0], 14)) - upsdebugx(2, "Battery Test failed"); - if (CHECK_BIT(tab_reg[0], 15)) - upsdebugx(2, "Battery near end of backup time"); - if (CHECK_BIT(tab_reg[0], 16)) - upsdebugx(2, "Battery disacharged"); - - if (CHECK_BIT(tab_reg[1], 0)) - upsdebugx(2, "Battery OK"); - if (CHECK_BIT(tab_reg[1], 10)) - upsdebugx(2, "Bypass input supply present"); - if (CHECK_BIT(tab_reg[1], 11)) - upsdebugx(2, "Battery charging"); - if (CHECK_BIT(tab_reg[1], 12)) - upsdebugx(2, "Bypass input frequency out of tolerance"); - - if (CHECK_BIT(tab_reg[2], 0)) - upsdebugx(2, "Unit operating"); - - if (CHECK_BIT(tab_reg[3], 0)) - upsdebugx(2, "Maintenance mode active"); - - if (CHECK_BIT(tab_reg[4], 0)) - upsdebugx(2, "Boost charge ON"); - if (CHECK_BIT(tab_reg[4], 2)) - upsdebugx(2, "Inverter switch closed"); - if (CHECK_BIT(tab_reg[4], 3)) - upsdebugx(2, "Bypass breaker closed"); - if (CHECK_BIT(tab_reg[4], 4)) - upsdebugx(2, "Maintenance bypass breaker closed"); - if (CHECK_BIT(tab_reg[4], 5)) - upsdebugx(2, "Remote maintenance bypass breaker closed"); - if (CHECK_BIT(tab_reg[4], 6)) - upsdebugx(2, "Output breaker closed (Q3)"); - if (CHECK_BIT(tab_reg[4], 9)) - upsdebugx(2, "Unit working"); - if (CHECK_BIT(tab_reg[4], 12)) - upsdebugx(2, "normal mode active"); - - /* alarms */ - r = mrir(modbus_ctx, 0x1040, 4, tab_reg); - - alarm_init(); - - if (r == -1) { - upsdebugx(2, "Did not receive any data from the UPS at 0x1040 ! Ignoring ? r is %d error %s", r, modbus_strerror(errno)); - /* - dstate_datastale(); - return; - */ - } - - if (CHECK_BIT(tab_reg[0], 0)) { - upsdebugx(2, "General Alarm"); - alarm_set("General Alarm present."); - } - if (CHECK_BIT(tab_reg[0], 1)) { - upsdebugx(2, "Battery failure"); - alarm_set("Battery failure."); - } - if (CHECK_BIT(tab_reg[0], 2)) { - upsdebugx(2, "UPS overload"); - alarm_set("Overload fault."); - } - if (CHECK_BIT(tab_reg[0], 4)) { - upsdebugx(2, "Control failure (com, internal supply...)"); - alarm_set("Control failure (com, internal supply...)"); - } - if (CHECK_BIT(tab_reg[0], 5)) { - upsdebugx(2, "Rectifier input supply out of tolerance "); - alarm_set("Rectifier input supply out of tolerance."); - } - if (CHECK_BIT(tab_reg[0], 6)) { - upsdebugx(2, "Bypass input supply out of tolerance "); - alarm_set("Bypass input supply out of tolerance."); - } - if (CHECK_BIT(tab_reg[0], 7)) { - upsdebugx(2, "Over temperature alarm "); - alarm_set("Over temperature fault."); - } - if (CHECK_BIT(tab_reg[0], 8)) { - upsdebugx(2, "Maintenance bypass closed"); - alarm_set("Maintenance bypass closed."); - } - if (CHECK_BIT(tab_reg[0], 10)) { - upsdebugx(2, "Battery charger fault"); - alarm_set("Battery charger fault."); - } - - if (CHECK_BIT(tab_reg[1], 1)) - upsdebugx(2, "Improper condition of use"); - if (CHECK_BIT(tab_reg[1], 2)) - upsdebugx(2, "Inverter stopped for overload (or bypass transfer)"); - if (CHECK_BIT(tab_reg[1], 3)) - upsdebugx(2, "Microprocessor control system"); - if (CHECK_BIT(tab_reg[1], 5)) - upsdebugx(2, "Synchronisation fault (PLL fault)"); - if (CHECK_BIT(tab_reg[1], 6)) - upsdebugx(2, "Rectifier input supply fault"); - if (CHECK_BIT(tab_reg[1], 7)) - upsdebugx(2, "Rectifier preventive alarm"); - if (CHECK_BIT(tab_reg[1], 9)) - upsdebugx(2, "Inverter preventive alarm"); - if (CHECK_BIT(tab_reg[1], 10)) - upsdebugx(2, "Charger general alarm"); - if (CHECK_BIT(tab_reg[1], 13)) - upsdebugx(2, "Bypass preventive alarm"); - if (CHECK_BIT(tab_reg[1], 15)) { - upsdebugx(2, "Imminent STOP"); - alarm_set("Imminent STOP."); - } - - if (CHECK_BIT(tab_reg[2], 12)) { - upsdebugx(2, "Servicing alarm"); - alarm_set("Servicing alarm."); - } - if (CHECK_BIT(tab_reg[2], 15)) - upsdebugx(2, "Battery room alarm"); - - if (CHECK_BIT(tab_reg[3], 0)) { - upsdebugx(2, "Maintenance bypass alarm"); - alarm_set("Maintenance bypass."); - } - if (CHECK_BIT(tab_reg[3], 1)) { - upsdebugx(2, "Battery discharged"); - alarm_set("Battery discharged."); - } - if (CHECK_BIT(tab_reg[3], 3)) - upsdebugx(2, "Synoptic alarm"); - if (CHECK_BIT(tab_reg[3], 4)) { - upsdebugx(2, "Critical Rectifier fault"); - alarm_set("Critical Rectifier fault."); - } - if (CHECK_BIT(tab_reg[3], 6)) { - upsdebugx(2, "Critical Inverter fault"); - alarm_set("Critical Inverter fault."); - } - if (CHECK_BIT(tab_reg[3], 10)) - upsdebugx(2, "ESD activated"); - if (CHECK_BIT(tab_reg[3], 11)) { - upsdebugx(2, "Battery circuit open"); - alarm_set("Battery circuit open."); - } - if (CHECK_BIT(tab_reg[3], 14)) { - upsdebugx(2, "Bypass critical alarm"); - alarm_set("Bypass critical alarm."); - } - - /* measurements */ - r = mrir(modbus_ctx, 0x1060, 48, tab_reg); - - if (r == -1) { - upsdebugx(2, "Did not receive any data from the UPS at 0x1060 ! Ignoring ? r is %d error %s", r, modbus_strerror(errno)); - /* - dstate_datastale(); - return; - */ - } - - if (tab_reg[1] == 0xFFFF && tab_reg[2] == 0xFFFF) { - /* this a 1-phase model */ - dstate_setinfo("input.phases", "1" ); - dstate_setinfo("ups.load", "%u", tab_reg[0] ); - - dstate_setinfo("input.bypass.voltage", "%u", tab_reg[6] ); - - dstate_setinfo("output.voltage", "%u", tab_reg[9] ); - - if (tab_reg[15] != 0xFFFF) - dstate_setinfo("output.current", "%u", tab_reg[15] ); - } - else { - /* this a 3-phase model */ - dstate_setinfo("input.phases", "3" ); - - dstate_setinfo("ups.load", "%u", tab_reg[3] ); - - dstate_setinfo("ups.L1.load", "%u", tab_reg[0] ); - dstate_setinfo("ups.L2.load", "%u", tab_reg[1] ); - dstate_setinfo("ups.L3.load", "%u", tab_reg[2] ); - - dstate_setinfo("input.bypass.L1-N.voltage", "%u", tab_reg[6] ); - dstate_setinfo("input.bypass.L2-N.voltage", "%u", tab_reg[7] ); - dstate_setinfo("input.bypass.L3-N.voltage", "%u", tab_reg[8] ); - - dstate_setinfo("output.L1-N.voltage", "%u", tab_reg[9] ); - dstate_setinfo("output.L2-N.voltage", "%u", tab_reg[10] ); - dstate_setinfo("output.L3-N.voltage", "%u", tab_reg[11] ); - - if (tab_reg[15] != 0xFFFF) - dstate_setinfo("output.L1.current", "%u", tab_reg[15] ); - - if (tab_reg[16] != 0xFFFF) - dstate_setinfo("output.L2.current", "%u", tab_reg[16] ); - - if (tab_reg[17] != 0xFFFF) - dstate_setinfo("output.L3.current", "%u", tab_reg[17] ); - } - - dstate_setinfo("battery.charge", "%u", tab_reg[4] ); - dstate_setinfo("battery.capacity", "%u", (tab_reg[5]/10) ); - dstate_setinfo("battery.voltage", "%.2f", (double) (tab_reg[20]) / 10); - dstate_setinfo("battery.current", "%.2f", (double) (tab_reg[24]) / 10 ); - dstate_setinfo("battery.runtime", "%u", tab_reg[23] ); - - dstate_setinfo("input.bypass.frequency", "%u", (tab_reg[18]/10) ); - dstate_setinfo("output.frequency", "%u", (tab_reg[19]/10) ); - - if (tab_reg[22] != 0xFFFF) { - dstate_setinfo("ambient.1.present", "yes"); - dstate_setinfo("ambient.1.temperature", "%u", tab_reg[22] ); - } - - if (tab_reg[23] == 0xFFFF) { - /* battery.runtime == 0xFFFF means we're on mains */ - status_set("OL"); - } - else if (tab_reg[23] > BATTERY_RUNTIME_CRITICAL) { - /* we still have mora than BATTERY_RUNTIME_CRITICAL min left ? */ - status_set("OB"); - } - else { - status_set("LB"); - } - - /*TODO: - --essential - ups.status TRIM/BOOST/OVER - ups.alarm - - --dangerous - ups.shutdown - shutdown.return - shutdown.stop - shutdown.reboot - shutdown.reboot.graceful - bypass.start - beeper.enable - beeper.disable - */ - - alarm_commit(); - status_commit(); - dstate_dataok(); - - return; -} - -void upsdrv_shutdown(void) - __attribute__((noreturn)); - -void upsdrv_shutdown(void) -{ - fatalx(EXIT_FAILURE, "shutdown not supported"); -} - -void upsdrv_help(void) -{ -} - -/* list flags and values that you want to receive via -x */ -void upsdrv_makevartable(void) -{ -} - -void upsdrv_initups(void) -{ - int r; - upsdebugx(2, "upsdrv_initups"); - - modbus_ctx = modbus_new_rtu(device_path, 9600, 'N', 8, 1); - if (modbus_ctx == NULL) - fatalx(EXIT_FAILURE, "Unable to create the libmodbus context"); - - r = modbus_set_slave(modbus_ctx, MODBUS_SLAVE_ID); /* slave ID */ - if (r < 0) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "Invalid modbus slave ID %d",MODBUS_SLAVE_ID); - } - - if (modbus_connect(modbus_ctx) == -1) { - modbus_free(modbus_ctx); - fatalx(EXIT_FAILURE, "modbus_connect: unable to connect: %s", modbus_strerror(errno)); - } - -} - -void upsdrv_cleanup(void) -{ - if (modbus_ctx != NULL) { - modbus_close(modbus_ctx); - modbus_free(modbus_ctx); - } -} - -/* Modbus Read Input Registers */ -static int mrir(modbus_t * arg_ctx, int addr, int nb, uint16_t * dest) -{ - int r, i; - - /* zero out the thing, because we might have reused it */ - for (i=0; i - 2019 Roberto Panerai Velloso + Copyright (C) 2004 Silvino B. Magalhães This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,12 +23,7 @@ 2005/06/30 - Version 0.41 - patch for solaris compability 2005/07/01 - Version 0.50 - add internal e external shutdown programming 2005/08/18 - Version 0.60 - save external shutdown programming to ups, - and support new cables for solis 3 - 2015/09/19 - Version 0.65 - patch for correct reading for Microsol Back-Ups BZ1200-BR - 2017/12/21 - Version 0.66 - remove memory leaks (unfreed strdup()s); - remove ser_flush_in calls that were causing desync issues; - other minor improvements in source code. - (see the version control logs for more recent updates) + and support new cables for solis 3 Microsol contributed with UPS Solis 1.5 HS 1.5 KVA for my tests. @@ -37,33 +31,29 @@ */ -#include "main.h" /* Includes "config.h", must be first */ - #include #include -#include "nut_stdint.h" + +#include "main.h" #include "serial.h" -#include "nut_float.h" #include "solis.h" #include "timehead.h" #define DRIVER_NAME "Microsol Solis UPS driver" -#define DRIVER_VERSION "0.68" +#define DRIVER_VERSION "0.61" /* driver description structure */ upsdrv_info_t upsdrv_info = { DRIVER_NAME, DRIVER_VERSION, - "Silvino B. Magalhães " \ - "Roberto Panerai Velloso ", + "Silvino B. Magalhães ", DRV_STABLE, { NULL } }; #define false 0 #define true 1 -#define RESP_END 0xFE -#define ENDCHAR 13 /* replies end with CR */ +#define ENDCHAR 13 /* replies end with CR */ /* solis commands */ #define CMD_UPSCONT 0xCC #define CMD_SHUT 0xDD @@ -100,11 +90,11 @@ upsdrv_info_t upsdrv_info = { #define NO_EVENT "No events\n" #define UPS_TIME "UPS internal Time %0d:%02d:%02d\n" #define PRG_DAYS "Programming Shutdown Sun Mon Tue Wed Thu Fri Sat\n" -#define PRG_ONON "External shutdown programming active\n" -#define PRG_ONOU "Internal shutdown programming atcive\n" +#define PRG_ONON "External shutdown programming ative\n" +#define PRG_ONOU "Internal shutdown programming ative\n" #define TIME_OFF "UPS Time power off %02d:%02d\n" #define TIME_ON "UPS Time power on %02d:%02d\n" -#define PRG_ONOF "Shutdown programming not activated\n" +#define PRG_ONOF "Shutdown programming not atived\n" #define TODAY_DD "Shutdown today at %02d:%02d\n" #define SHUT_NOW "Shutdown now!\n" #endif @@ -112,173 +102,327 @@ upsdrv_info_t upsdrv_info = { #define FMT_DAYS " %d %d %d %d %d %d %d\n" /* convert standard days string to firmware format */ -static char* convert_days(char *cop) { - static char alt[8]; +static char* convdays( char *cop ) +{ - int ish, fim; - if (weekn >= 6 || weekn < 0) + char *stra; + char alt[8]; + int i, ish, fim, iw; + iw = weekn; + if ( iw == 6) ish = 0; else - ish = 1 + weekn; + ish = 1 + iw; fim = 7 - ish; /* rotate left only 7 bits */ - memcpy(alt, &cop[ish], (size_t)fim); + for(i=0; i < fim; i++) { + alt[i] = cop[i+ish]; + } - if (ish > 0) - memcpy(&alt[fim], cop, (size_t)ish); + if ( ish > 0 ) { + + for(i=0; i < ish; i++) { + alt[i+fim] = cop[i]; + } + } alt[7] = 0; /* string terminator */ - - return alt; + + stra = strdup( alt ); + return stra; } -inline static int is_binary(char ch ) { - return ( ch == '1' || ch == '0' ); +static int IsBinary(char ch ) +{ + if( ch == '1' || ch == '0' ) + return 1; + else + return 0; } /* convert string to binary */ -static uint8_t str2bin( char *binStr ) { - uint8_t result = 0; - int i; +static int Binary( char *nome ) +{ - for (i = 0; i < 7; ++i) { - char ch = binStr[i]; - if (is_binary(ch)) - result += ( (ch - '0') << (6 - i) ); + char ch, cc; + int cont=0, nint = 1, tobin=0; + int ex, nbin; + + while( *nome && ( cont < 7 ) ) { + ch = *nome; + if( !(IsBinary( ch ) ) ) + nint = 0; else - return 0; + { + if( ch == '1') { + cc = 1; + ex = (6 - cont); + nbin = cc<> (5 - weekn - i)) & 0x01; + /* it uses only 7 bits */ - for (i = 0; i < weekn+1; ++i) - alt[i+(6-weekn)] = (dweek >> (6 - i)) & 0x01; + switch ( iw ) + { + case 0: /* sunday */ + { + alt[0] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[1] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[2] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[3] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[4] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[5] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[6] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + break; + } + case 1: + { + alt[0] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[1] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[2] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[3] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[4] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[5] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[6] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + break; + } + case 2: + { + alt[0] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[1] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[2] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[3] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[4] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[5] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[6] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + break; + } + case 3: + { + alt[0] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[1] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[2] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[3] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[4] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[5] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[6] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + break; + } + case 4: + { + alt[0] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[1] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[2] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[3] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[4] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[5] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[6] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + break; + } + case 5: + { + alt[0] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + alt[1] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[2] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[3] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[4] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[5] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[6] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + break; + } + case 6: /* saturday */ + { + alt[0] = ( ( ( dweek & 0x40 ) == 0x40 ) ); + alt[1] = ( ( ( dweek & 0x20 ) == 0x20 ) ); + alt[2] = ( ( ( dweek & 0x10 ) == 0x10 ) ); + alt[3] = ( ( ( dweek & 0x08 ) == 0x08 ) ); + alt[4] = ( ( ( dweek & 0x04 ) == 0x04 ) ); + alt[5] = ( ( ( dweek & 0x02 ) == 0x02 ) ); + alt[6] = ( ( ( dweek & 0x01 ) == 0x01 ) ); + } - for (i=0; i < 7; i++) - alt[i] += '0'; + } + + for(i=0; i < 7; i++) { + if( alt[i] == 0 ) + alt[i] = '0'; + if( alt[i] == 1 ) + alt[i] = '1'; + } alt[7] = 0; /* string terminator */ + keewd = Binary ( alt ); + + return keewd; - return str2bin(alt); } -static int is_hour(char *hour, int qual) { - int hora, min; +static int IsHour( char *strx, int qual ) +{ - if ((strlen(hour) != 5) || - (sscanf(hour, "%d:%d", &hora, &min) != 2)) + int hora=0, min = 0; + + if ((strlen(strx) != 5) || (sscanf(strx, "%d:%d", &hora, &min) != 2)) { return -1; + } - if (qual) { + if( qual ) { dhour = hora; dmin = min; - } else { + } + else + { lhour = hora; lmin = min; } return 1; + } -static void send_shutdown( void ) { + +static void sendshut( void ) +{ + int i; - for (i = 0; i < 10; i++) + for(i=0; i < 10; i++) ser_send_char(upsfd, CMD_SHUT ); upslogx(LOG_NOTICE, "Ups shutdown command sent"); printf("Ups shutdown command sent\n"); + } /* save config ups */ -static void save_ups_config( void ) { +static void confups( void ) +{ + int i, chks = 0; - /* FIXME? Check for overflows with int => char truncations? - * See also microsol-common.c for very similar code - */ - ConfigPack[0] = (unsigned char)0xCF; - ConfigPack[1] = (unsigned char)ihour; - ConfigPack[2] = (unsigned char)imin; - ConfigPack[3] = (unsigned char)isec; - ConfigPack[4] = (unsigned char)lhour; - ConfigPack[5] = (unsigned char)lmin; - ConfigPack[6] = (unsigned char)dhour; - ConfigPack[7] = (unsigned char)dmin; - ConfigPack[8] = (unsigned char)(weekn << 5); - ConfigPack[8] = (unsigned char)ConfigPack[8] | (unsigned char)dian; - ConfigPack[9] = (unsigned char)(mesn << 4); - ConfigPack[9] = (unsigned char)ConfigPack[9] | (unsigned char)( anon - BASE_YEAR ); - ConfigPack[10] = (unsigned char)DaysOffWeek; + ConfigPack[0] = 0xCF; + ConfigPack[1] = ihour; + ConfigPack[2] = imin; + ConfigPack[3] = isec; + ConfigPack[4] = lhour; + ConfigPack[5] = lmin; + ConfigPack[6] = dhour; + ConfigPack[7] = dmin; + ConfigPack[8] = weekn << 5; + ConfigPack[8] = ConfigPack[8] | dian; + ConfigPack[9] = mesn << 4; + ConfigPack[9] = ConfigPack[9] | ( anon - BASE_YEAR ); + ConfigPack[10] = DaysOffWeek; /* MSB zero */ ConfigPack[10] = ConfigPack[10] & (~(0x80)); - for (i=0; i < 11; i++) - chks += ConfigPack[i]; + for(i=0; i < 11; i++) + chks = chks + ConfigPack[i]; - /* FIXME? Does truncation to char have same effect as %256 ? */ - ConfigPack[11] = (unsigned char)(chks % 256); + ConfigPack[11] = chks % 256; - for (i=0; i < 12; i++) - ser_send_char(upsfd, ConfigPack[i]); + for(i=0; i < 12; i++) + ser_send_char(upsfd, ConfigPack[i] ); + } /* print UPS internal variables */ -static void print_info( void ) { - printf(UPS_DATE, Year, Month, Day); - printf(SYS_DATE, anon, mesn, dian, seman); - printf(UPS_TIME, ihour, imin, isec); +static void prnInfo( void ) +{ - if (prgups > 0) { - /*sunday, monday, tuesday, wednesday, thursday, friday, saturday*/ - int week_days[7] = {0, 0, 0, 0, 0, 0, 0}; - int i; + int sunday=0, monday=0, tuesday=0, wednesday=0, thursday=0, friday=0, saturday=0; + unsigned char dweek; + printf( UPS_DATE, Year, Month, Day ); + printf( SYS_DATE, anon, mesn, dian, seman ); + + printf( UPS_TIME, ihour, imin, isec); + + dweek = DaysStd; + + if( prgups > 0 ) { + /* this is the string to binary standard */ - for (i = 0; i < 7; ++i) - week_days[i] = (DaysStd >> (6 - i)) & 0x01; + sunday = ( ( dweek & 0x40 ) == 0x40 ); + monday = ( ( dweek & 0x20 ) == 0x20 ); + tuesday = ( ( dweek & 0x10 ) == 0x10 ); + wednesday = ( ( dweek & 0x08 ) == 0x08 ); + thursday = ( ( dweek & 0x04 ) == 0x04 ); + friday = ( ( dweek & 0x02 ) == 0x02 ); + saturday = ( ( dweek & 0x01 ) == 0x01 ); - if (prgups == 3) - printf(PRG_ONOU); + if( prgups == 3) + printf( PRG_ONOU ); else - printf(PRG_ONON); + printf( PRG_ONON ); + printf( TIME_ON, lhour, lmin); + printf( TIME_OFF, dhour, dmin); + printf( PRG_DAYS ); + printf( FMT_DAYS, sunday, monday, tuesday, wednesday, thursday, friday, saturday); + } + else + printf( PRG_ONOF ); - printf(TIME_ON, lhour, lmin); - printf(TIME_OFF, dhour, dmin); - printf(PRG_DAYS); - printf(FMT_DAYS, - week_days[0], week_days[1], week_days[2], - week_days[3], week_days[4], week_days[5], - week_days[6]); - } else - printf(PRG_ONOF); } /* is today shutdown day ? */ -inline static int is_today( unsigned char dweek, int nweek) { - return (dweek >> (6 - nweek)) & 0x01; +static int IsToday( unsigned char dweek, int nweek) +{ + + switch ( nweek ) + { + case 0: /* sunday */ + return ( ( ( dweek & 0x40 ) == 0x40 ) ); + case 1: + return ( ( ( dweek & 0x20 ) == 0x20 ) ); + case 2: + return ( ( ( dweek & 0x10 ) == 0x10 ) ); + case 3: + return ( ( ( dweek & 0x08 ) == 0x08 ) ); + case 4: + return ( ( ( dweek & 0x04 ) == 0x04 ) ); + case 5: + return ( ( ( dweek & 0x02 ) == 0x02 ) ); + case 6: /* saturday */ + return ( ( ( dweek & 0x01 ) == 0x01 ) ); + } + + return 0; + } -/* all models */ -static void autonomy_calc( int iauto ) { - int indice, indd, lim, min, max, inf, sup, indc, bx, ipo = 0; +static void AutonomyCalc( int iauto ) /* all models */ +{ + + int indice, indd, lim, min, max, inf, sup, indc, bx, ipo =0; bx = bext[iauto]; indice = RecPack[3]; indd = indice - 139; - if (UtilPower > 20) - ipo = (UtilPower - 51) / 100; + if( UtilPower > 20 ) + ipo = ( UtilPower - 51 ) / 100; indc = auton[iauto].maxi; @@ -291,39 +435,44 @@ static void autonomy_calc( int iauto ) { lim = max - 139; sup = max + 1; - if (UtilPower <= 20) { + if( UtilPower <= 20 ) { Autonomy = 170; - maxauto = 170; - } else { + maxauto = 170; + } + else + { maxauto = auton[iauto].mm[ipo][lim]; - if( indice > inf && indice < sup ) + if( indice > inf && indice < sup ) { Autonomy = auton[iauto].mm[ipo][indd]; - else { - if (indice > max) - Autonomy = maxauto; - if (indice < min) - Autonomy = 0; + } + else + { + if( indice > max ) Autonomy = maxauto; + if( indice < min ) Autonomy = 0; } } - - if (BattExtension > 0 && iauto < 4) + + if( BattExtension > 0 && iauto < 4 ) Autonomy = ( Autonomy * ( BattExtension + bx ) * 1.0 / bx ); + } -static void scan_received_pack(void) { - int aux, im, ov; +static void ScanReceivePack( void ) +{ + + int aux, im, ov = 0; /* model independent data */ - Year = (RecPack[ 19 ] & 0x0F) + BASE_YEAR; - Month = (RecPack[ 19 ] & 0xF0) >> 4; - Day = (RecPack[ 18 ] & 0x1F); + Year = ( RecPack[ 19 ] & 0x0F ) + BASE_YEAR; + Month = ( RecPack[ 19 ] & 0xF0 ) >> 4; + Day = ( RecPack[ 18 ] & 0x1F ); DaysOnWeek = RecPack[17]; /* Days of week if in UPS shutdown programming mode */ - if (prgups == 3) { - DaysStd = revert_days( DaysOnWeek ); - + if( prgups == 3 ) { + DaysStd = revertdays( DaysOnWeek ); + /* time for programming UPS off */ dhour = RecPack[15]; dmin = RecPack[16]; @@ -331,59 +480,50 @@ static void scan_received_pack(void) { lhour = RecPack[13]; lmin = RecPack[14]; } - + /* UPS internal time */ ihour = RecPack[11]; imin = RecPack[10]; isec = RecPack[9]; - - if ((0x01 & RecPack[20]) == 0x01) + + if( ( ( 0x01 & RecPack[ 20 ] ) == 0x01 ) ) Out220 = 1; + CriticBatt = ( ( 0x04 & RecPack[ 20 ] ) == 0x04 ); + InversorOn = ( ( 0x08 & RecPack[ 20 ] ) == 0x08 ); + SuperHeat = ( ( 0x10 & RecPack[ 20 ] ) == 0x10 ); + SourceFail = ( ( 0x20 & RecPack[ 20 ] ) == 0x20 ); + OverCharge = ( ( 0x80 & RecPack[ 20 ] ) == 0x80 ); - CriticBatt = (0x04 & RecPack[20]) == 0x04; - InversorOn = (0x08 & RecPack[20]) == 0x08; - SuperHeat = (0x10 & RecPack[20]) == 0x10; - SourceFail = (0x20 & RecPack[20]) == 0x20; - OverCharge = (0x80 & RecPack[20]) == 0x80; - - if ((0x40 & RecPack[20]) == 0x40) + if( ( ( 0x40 & RecPack[ 20 ] ) == 0x40 ) ) InputValue = 1; else InputValue = 0; - - Temperature = 0x7F & RecPack[4]; - if (0x80 & RecPack[4]) - Temperature -= 128; + Temperature = ( 0x7F & RecPack[ 4 ]); + if( ( ( 0x80 & RecPack[ 4 ] ) == 0x80 ) ) + Temperature = Temperature - 128; /* model dependent data */ im = inds[imodel]; ov = Out220; - if (SolisModel != 16) { - if (RecPack[6] >= 194) - InVoltage = RecPack[6] * ctab[imodel].m_involt194[0] + ctab[imodel].m_involt194[1]; - else - InVoltage = RecPack[6] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1]; - } else { - /* Code InVoltage for STAY1200_USB */ - if ((RecPack[20] & 0x1) == 0) /* IsOutVoltage 220 */ - InVoltage = RecPack[2] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1]; - else - InVoltage = RecPack[2] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1] - 3.0; - } - + if( RecPack[ 6 ] >= 194 ) + InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt194[0] + ctab[imodel].m_involt194[1]; + else + InVoltage = RecPack[ 6 ] * ctab[imodel].m_involt193[0] + ctab[imodel].m_involt193[1]; + BattVoltage = RecPack[ 3 ] * ctab[imodel].m_battvolt[0] + ctab[imodel].m_battvolt[1]; - + NominalPower = nompow[im]; - - if (SourceFail) { + if( SourceFail ) { OutVoltage = RecPack[ 1 ] * ctab[imodel].m_outvolt_i[ov][0] + ctab[imodel].m_outvolt_i[ov][1]; OutCurrent = RecPack[ 5 ] * ctab[imodel].m_outcurr_i[ov][0] + ctab[imodel].m_outcurr_i[ov][1]; AppPower = ( RecPack[ 5 ] * RecPack[ 1 ] ) * ctab[imodel].m_appp_i[ov][0] + ctab[imodel].m_appp_i[ov][1]; UtilPower = ( RecPack[ 7 ] + RecPack[ 8 ] * 256 ) * ctab[imodel].m_utilp_i[ov][0] + ctab[imodel].m_utilp_i[ov][1]; InCurrent = 0; - } else { + } + else + { OutVoltage = RecPack[ 1 ] * ctab[imodel].m_outvolt_s[ov][0] + ctab[imodel].m_outvolt_s[ov][1]; OutCurrent = RecPack[ 5 ] * ctab[imodel].m_outcurr_s[ov][0] + ctab[imodel].m_outcurr_s[ov][1]; AppPower = ( RecPack[ 5 ] * RecPack[ 1 ] ) * ctab[imodel].m_appp_s[ov][0] + ctab[imodel].m_appp_s[ov][1]; @@ -392,88 +532,39 @@ static void scan_received_pack(void) { + OutCurrent *( OutVoltage * 1.0 / InVoltage ); } - if (SolisModel == 16) { - int configRelay = (RecPack[6] & 0x38) >> 3; - double TENSAO_SAIDA_F1_MR[8] = { 1.1549, 1.0925, 0.0, 0.0, 1.0929, 1.0885, 0.0, 0.8654262224145391 }; - double TENSAO_SAIDA_F2_MR[8] = { -6.9157, 11.026, 10.43, 0.0, -0.6109, 12.18, 0.0, 13.677}; - - const double TENSAO_SAIDA_F2_MI[8] ={ 5.59, 9.47, 13.7, 0.0, 0.0, 0.0, 0.0, 0.0 }; - const double TENSAO_SAIDA_F1_MI[8] = { 7.9, 9.1, 17.6, 0.0, 0.0, 0.0, 0.0, 0.0 }; - - const double corrente_saida_F1_MR = 0.12970000389100012; - const double corrente_saida_F2_MR = 0.5387060281204546; - /* double corrente_saida_F1_MI = 0.1372; - double corrente_saida_F2_MI = 0.3456; */ - - if (SourceFail) { - if (RecPack[20] == 0) { - double a = RecPack[1] * 2; - a /= 128.0; - /* a = double sqrt(a); */ - OutVoltage = RecPack[1] * a * TENSAO_SAIDA_F1_MI[configRelay] + TENSAO_SAIDA_F2_MI[configRelay]; - } - } else { - OutCurrent = (float)(corrente_saida_F1_MR * RecPack[5] + corrente_saida_F2_MR); - OutVoltage = RecPack[1] * TENSAO_SAIDA_F1_MR[configRelay] + TENSAO_SAIDA_F2_MR[configRelay]; - AppPower = OutCurrent * OutVoltage; - - double RealPower = (RecPack[7] + RecPack[8] * 256); - - double potVA1 = 5.968 * AppPower - 284.36; - double potVA2 = 7.149 * AppPower - 567.18; - double potLin = 0.1664 * RealPower + 49.182; - double potRe = 0.1519 * RealPower + 32.644; - if (fabs(potVA1 - RealPower) < fabs(potVA2 - RealPower)) - RealPower = potLin; - else - RealPower = potRe; - - if (OutCurrent < 0.7) - RealPower = AppPower; - - if (AppPower < RealPower) { - double f = AppPower; - AppPower = RealPower; - RealPower = f; - } - } - } - - aux = (RecPack[ 21 ] + RecPack[ 22 ] * 256); - if (aux > 0) + aux = ( RecPack[ 21 ] + RecPack[ 22 ] * 256 ); + if( aux > 0 ) InFreq = ctab[imodel].m_infreq * 1.0 / aux; - - /* Specific for STAY1200_USB */ - if (SolisModel == 16) { - InFreq = ((float)(0.37 * (257 - (aux >> 8)))); - } else + else InFreq = 0; - + /* input voltage offset */ - if (InVoltage < InVolt_offset) { /* all is equal 30 */ + if( InVoltage < InVolt_offset ) { /* all is equal 30 */ InFreq = 0; InVoltage = 0; InCurrent = 0; } /* app power offset */ - if (AppPower < ctab[imodel].m_appp_offset) { + if( AppPower < ctab[imodel].m_appp_offset ) { AppPower = 0; UtilPower = 0; ChargePowerFactor = 0; OutCurrent = 0; } - - if (im < 3) - autonomy_calc(im); - else { - if (BattExtension == 80 && im == 3) - autonomy_calc(im + 1); + + if( im < 3 ) + AutonomyCalc( im ); + else + { + if( BattExtension == 80 ) + AutonomyCalc( im + 1 ); else - autonomy_calc(im); + AutonomyCalc( im ); } /* model independent data */ + batcharge = ( Autonomy / maxauto ) * 100.0; upscharge = ( AppPower / NominalPower ) * 100.0; @@ -481,46 +572,45 @@ static void scan_received_pack(void) { batcharge = 100.0; OutFreq = 60; - if (!InversorOn) { + if( !( InversorOn ) ) { OutVoltage = 0; OutFreq = 0; } - if (!SourceFail && InversorOn) + if( ( !( SourceFail ) && InversorOn ) ) OutFreq = InFreq; - if (AppPower < 0) /* charge pf */ + if( AppPower <= 0 ) /* charge pf */ ChargePowerFactor = 0; - else { - if( d_equal(AppPower, 0) ) + else + { + if( AppPower == 0 ) ChargePowerFactor = 100; else - ChargePowerFactor = (( UtilPower / AppPower) * 100); - - if(ChargePowerFactor > 100) + ChargePowerFactor = (( UtilPower / AppPower) * 100 ); + if( ChargePowerFactor > 100 ) ChargePowerFactor = 100; } - if (SourceFail && SourceLast) /* first time failure */ + if( SourceFail && SourceLast ) /* first time failure */ FailureFlag = true; /* source return */ - if (!SourceFail && !SourceLast) { + if( !( SourceFail ) && !( SourceLast ) ) { SourceReturn = true; - /* clean port: */ - /* ser_flush_in(upsfd,"",0); */ + ser_flush_in(upsfd,"",0); /* clean port */ } - - if((!SourceFail) == SourceLast) { + + if( !( SourceFail ) == SourceLast ) { SourceReturn = false; FailureFlag = false; } - SourceLast = !SourceFail; + SourceLast = !( SourceFail ); /* Autonomy */ - if (Autonomy < 5) + if( ( Autonomy < 5 ) ) LowBatt = true; else LowBatt = false; @@ -528,299 +618,320 @@ static void scan_received_pack(void) { UpsPowerFactor = 700; /* input 110V or 220v */ - if (InputValue == 0) { + if( ( InputValue == 0 ) ) { InDownLim = 75; InUpLim = 150; NomInVolt = 110; - } else { + } + else + { InDownLim = 150; InUpLim = 300; NomInVolt = 220; } /* output volage 220V or 110V */ - if (Out220) { + if( Out220 ) { OutDownLim = 190; OutUpLim = 250; NomOutVolt = 220; - } else { + } + else + { OutDownLim = 100; OutUpLim = 140; NomOutVolt = 110; } - if (SourceFail) /* source status */ + if( SourceFail ) /* source status */ InputStatus = 2; else InputStatus = 1; - if (InversorOn) /* output status */ + if( InversorOn ) /* output status */ OutputStatus = 1; else OutputStatus = 2; - if (OverCharge) + if( OverCharge ) OutputStatus = 3; - if (CriticBatt) /* battery status */ + if( CriticBatt ) /* battery status */ BattStatus = 4; else BattStatus = 1; SourceEvents = 0; - if (FailureFlag) + if( FailureFlag ) SourceEvents = 1; - if (SourceReturn) + if( SourceReturn ) SourceEvents = 2; /* verify Inversor */ - if (Flag_inversor) { + if( Flag_inversor ) { InversorOnLast = InversorOn; Flag_inversor = false; } OutputEvents = 0; - if (InversorOn && !InversorOnLast) + if( InversorOn && !( InversorOnLast ) ) OutputEvents = 26; - if (InversorOnLast && !InversorOn) + if( InversorOnLast && !( InversorOn ) ) OutputEvents = 27; InversorOnLast = InversorOn; - - if (SuperHeat && !SuperHeatLast) + if( SuperHeat && !( SuperHeatLast ) ) OutputEvents = 12; - if (SuperHeatLast && !SuperHeat) + if( SuperHeatLast && !( SuperHeat ) ) OutputEvents = 13; SuperHeatLast = SuperHeat; - - if (OverCharge && !OverChargeLast) + if( OverCharge && !( OverChargeLast ) ) OutputEvents = 10; - if (OverChargeLast && !OverCharge) + if( OverChargeLast && !( OverCharge ) ) OutputEvents = 11; OverChargeLast = OverCharge; BattEvents = 0; CriticBattLast = CriticBatt; + } -static void comm_receive(const unsigned char *bufptr, size_t size) { - if (size == packet_size) { - int CheckSum = 0; - size_t i; +static void +CommReceive(const char *bufptr, int size) +{ - memcpy(RecPack, bufptr, packet_size); - - if (nut_debug_level >= 3) - upsdebug_hex(3, "comm_receive: RecPack", RecPack, size); + int i, CheckSum, i_end; + if( ( size==25 ) ) + Waiting = 0; + + switch( Waiting ) + { + /* normal package */ + case 0: + { + if( size == 25 ) { + i_end = 25; + for( i = 0 ; i < i_end ; ++i ) { + RecPack[i] = *bufptr; + bufptr++; + } + /* CheckSum verify */ - for (i = 0 ; i < packet_size-2 ; ++i ) - CheckSum += RecPack[i]; + CheckSum = 0; + i_end = 23; + for( i = 0 ; i < i_end ; ++i ) + CheckSum = RecPack[ i ] + CheckSum; CheckSum = CheckSum % 256; - upsdebugx(4, "%s: calculated checksum = 0x%02x, RecPack[23] = 0x%02x", __func__, CheckSum, RecPack[23]); + + ser_flush_in(upsfd,"",0); /* clean port */ + + /* correct package */ + if( ( (RecPack[0] & 0xF0) == 0xA0 ) + && ( RecPack[ 24 ] == 254 ) + && ( RecPack[ 23 ] == CheckSum ) ) { - /* clean port: */ - /* ser_flush_in(upsfd,"",0); */ - - /* RecPack[0] == model number below: - * SOLIS = 1; - * RHINO = 2; - * STAY = 3; - * SOLIS_LI_700 = 169; - * SOLIS_M11 = 171; - * SOLIS_M15 = 175; - * SOLIS_M14 = 174; - * SOLIS_M13 = 173; - * SOLISDC_M14 = 201; - * SOLISDC_M13 = 206; - * SOLISDC_M15 = 207; - * CABECALHO_RHINO = 194; - * PS800 = 185; - * STAY1200_USB = 186; - * PS350_CII = 184; - * PS2200 = 187; - * PS2200_22 = 188; - * STAY700_USB = 189; - * BZ1500 = 190; - */ - - if ((((RecPack[0] & 0xF0) == 0xA0 ) || (RecPack[0] & 0xF0) == 0xB0) && - (RecPack[24] == 254) && - (RecPack[23] == CheckSum)) { - - if (!detected) { - if (RecPack[0] == 186) - SolisModel = 16; - else - SolisModel = (int) (RecPack[0] & 0x0F); - - if (SolisModel < 13) + if(!(detected)) { + SolisModel = (int) (RecPack[0] & 0x0F); + if( SolisModel < 13 ) imodel = SolisModel - 10; /* 10 = 0, 11 = 1 */ else imodel = SolisModel - 11; /* 13 = 2, 14 = 3, 15 = 4 */ - detected = true; } - switch (SolisModel) { + switch( SolisModel ) + { case 10: case 11: case 12: case 13: case 14: case 15: - scan_received_pack(); - break; - case 16: /* STAY1200_USB model */ - scan_received_pack(); + { + ScanReceivePack(); break; + } default: - printf(M_UNKN); - scan_received_pack(); /* Scan anyway. */ + { + printf( M_UNKN ); break; } } + } + } + + break; + } + + case 1: + { + /* dumping package nothing to do yet */ + Waiting = 0; + break; + } + + } + + Waiting =0; + } -static void get_base_info(void) { +static void getbaseinfo(void) +{ + + unsigned char temp[256]; #ifdef PORTUGUESE - const char DaysOfWeek[7][4]={"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"}; + char diassemana[7][4]={"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"}; #else - const char DaysOfWeek[7][4]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; + char DaysOfWeek[7][4]={"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; #endif - unsigned char packet[PACKET_SIZE], syncEOR = '\0', syncEOR_was_read = 0; - int i1=0, i2=0; - size_t i; - ssize_t tam; + char mycmd[8]; + char *str1, *str2, *str3, *str4, *strx; + unsigned char Pacote[25]; + int i, i1=0, i2=0, j=0, tam, tpac=25; time_t tmt; struct tm *now; - struct tm tmbuf; - - time(&tmt); - now = localtime_r(&tmt, &tmbuf); + time( &tmt ); + now = localtime( &tmt ); dian = now->tm_mday; mesn = now->tm_mon+1; anon = now->tm_year+1900; ihour = now->tm_hour; imin = now->tm_min; isec = now->tm_sec; - weekn = now->tm_wday; + weekn = now->tm_wday; - strcpy(seman, DaysOfWeek[weekn]); +#ifdef PORTUGUESE + strcpy( seman, diassemana[weekn] ); +#else + strcpy( seman, DaysOfWeek[weekn] ); +#endif - if (testvar("battext")) + if( testvar("battext")) BattExtension = atoi(getval("battext")); - if (testvar("prgshut")) + if( testvar("prgshut")) prgups = atoi(getval("prgshut")); - if (prgups > 0 && prgups < 3) { - if (testvar("daysweek")) - DaysOnWeek = str2bin(convert_days(getval("daysweek"))); - - if (testvar("daysoff")) { - char *doff = getval("daysoff"); - DaysStd = str2bin(doff); - DaysOffWeek = str2bin( convert_days(doff)); + if( prgups > 0 && prgups < 3 ) { + if( testvar("daysweek") ) { + strx = getval("daysweek"); + str1 = convdays( strx ); + DaysOnWeek = Binary( str1 ); } - if (testvar("houron")) - i1 = is_hour(getval("houron"), 0); + if( testvar("daysoff") ) { + strx = getval("daysoff"); + str2 = convdays( strx ); + DaysStd = Binary ( strx ); + DaysOffWeek = Binary( str2 ); + } - if (testvar("houroff")) - i2 = is_hour(getval("houroff"), 1); + if( testvar("houron") ) { + str3 = getval("houron"); + i1 = IsHour( str3, 0 ); + } - if (i1 == 1 && i2 == 1 && (DaysOnWeek > 0)) { + if( testvar("houroff") ) { + str4 = getval("houroff"); + i2 = IsHour( str4, 1 ); + } + + if( i1 == 1 && i2 == 1 && ( DaysOnWeek > 0 ) ) { isprogram = 1; /* prgups == 1 ou 2 */ - if (prgups == 2) - save_ups_config(); /* save ups config */ - } else { - if (i2 == 1 && DaysOffWeek > 0) { - isprogram = 1; - DaysOnWeek = DaysOffWeek; - } + if( prgups == 2 ) + confups(); /* save ups config */ } + else + { + if( (i2 == 1) && ( DaysOffWeek > 0 ) ) { + isprogram = 1; + if( DaysOnWeek != DaysOffWeek ) + DaysOnWeek = DaysOffWeek; + } + } + } /* end prgups 1 - 2 */ /* dummy read attempt to sync - throw it out */ - upsdebugx(3, "%s: sending CMD_UPSCONT and ENDCHAR to sync", __func__); - ser_send(upsfd, "%c%c", CMD_UPSCONT, ENDCHAR); + snprintf(mycmd, sizeof(mycmd), "%c%c",CMD_UPSCONT, ENDCHAR); + ser_send(upsfd, "%s", mycmd); - /* - * - Read until end-of-response character (0xFE): - * read up to 3 packets in size before giving up - * synchronizing with the device. - */ - for (i = 0; i < packet_size*3; i++) { - ser_get_char(upsfd, &syncEOR, 3, 0); - syncEOR_was_read = 1; - if(syncEOR == RESP_END) - break; - } - - if (!syncEOR_was_read || syncEOR != RESP_END) { - /* synchronization failed */ - fatalx(EXIT_FAILURE, NO_SOLIS); - } else { - upsdebugx(4, "%s: requesting %zu bytes from ser_get_buf_len()", __func__, packet_size); - tam = ser_get_buf_len(upsfd, packet, packet_size, 3, 0); - if (tam < 0) { - upsdebugx(0, "%s: Error (%zd) reading from ser_get_buf_len()", __func__, tam); - fatalx(EXIT_FAILURE, NO_SOLIS); + /* trying detect solis model */ + while ( ( !detected ) && ( j < 20 ) ) { + temp[0] = 0; /* flush temp buffer */ + tam = ser_get_buf_len(upsfd, temp, tpac, 3, 0); + if( tam == 25 ) { + for( i = 0 ; i < tam ; i++ ) { + Pacote[i] = temp[i]; + } } - upsdebugx(2, "%s: received %zd bytes from ser_get_buf_len()", __func__, tam); - if (tam > 0 && nut_debug_level >= 4) { - upsdebug_hex(4, "received from ser_get_buf_len()", packet, (size_t)tam); - } - comm_receive(packet, (size_t)tam); - } - if (!detected) + j++; + if( tam == 25) + CommReceive((char *)Pacote, tam); + else + CommReceive((char *)temp, tam); + } /* while end */ + + if( (!detected) ) { fatalx(EXIT_FAILURE, NO_SOLIS ); + } - switch (SolisModel) { + switch( SolisModel ) + { case 10: case 11: case 12: - Model = "Solis 1.0"; + { + strcpy(Model, "Solis 1.0"); break; + } case 13: - Model = "Solis 1.5"; + { + strcpy(Model, "Solis 1.5"); break; + } case 14: - Model = "Solis 2.0"; + { + strcpy(Model, "Solis 2.0"); break; + } case 15: - Model = "Solis 3.0"; + { + strcpy(Model, "Solis 3.0"); break; - case 16: - Model = "Microsol Back-Ups BZ1200-BR"; - break; + } } /* if( isprogram ) */ - if (prgups == 1) { + if( prgups == 1 ) { hourshut = dhour; minshut = dmin; - } else { - if (prgups == 2 || prgups == 3) { /* broadcast before firmware shutdown */ - if (dmin < 5) { - if (dhour > 1) + } + else + { + if( prgups == 2 || prgups == 3 ) { /* broadcast before firmware shutdown */ + if( dmin < 5 ) { + if( dhour > 1 ) hourshut = dhour - 1; else hourshut = 23; - minshut = 60 - ( 5 - dmin ); - } else { - hourshut = dhour; - minshut = dmin - 5; } + else + { + hourshut = dhour; + minshut = dmin - 5; } + } } + /* manufacturer */ dstate_setinfo("ups.mfr", "%s", "Microsol"); @@ -833,110 +944,105 @@ static void get_base_info(void) { printf("Detected %s on %s\n", dstate_getinfo("ups.model"), device_path); - print_info(); + prnInfo(); + + } -static void get_update_info(void) { - unsigned char temp[256]; - int isday, hourn, minn; - ssize_t tam; +static void getupdateinfo(void) +{ + unsigned char temp[256]; + int tam, isday, hourn, minn; /* time update and programable shutdown block */ time_t tmt; struct tm *now; - struct tm tmbuf; - - time(&tmt); - now = localtime_r(&tmt, &tmbuf); + time( &tmt ); + now = localtime( &tmt ); hourn = now->tm_hour; minn = now->tm_min; - weekn = now->tm_wday; + weekn = now->tm_wday; - if (isprogram || prgups == 3) { - if (isprogram) - isday = is_today(DaysStd, weekn); + if( isprogram || prgups == 3 ) { + if( isprogram ) + isday = IsToday( DaysStd, weekn ); else - isday = is_today( DaysStd, weekn); - - if (isday) - printf(TODAY_DD, hourshut, minshut); - - if ( - (hourn == hourshut) && - (minn >= minshut) && - isday) { + isday = IsToday( DaysStd, weekn ); + + if( isday ) + printf( TODAY_DD, hourshut, minshut ); + if( ( hourn == hourshut ) && ( minn >= minshut ) && isday ) { printf( SHUT_NOW ); progshut = 1; } - } + } + /* programable shutdown end block */ + pacsize = 25; + /* get update package */ temp[0] = 0; /* flush temp buffer */ + tam = ser_get_buf_len(upsfd, temp, pacsize, 3, 0); - upsdebugx(3, "%s: requesting %zu bytes from ser_get_buf_len()", __func__, packet_size); - tam = ser_get_buf_len(upsfd, temp, packet_size, 3, 0); + CommReceive((char *)temp, tam); - if (tam < 0) { - upsdebugx(0, "%s: Error (%zd) reading from ser_get_buf_len()", __func__, tam); - fatalx(EXIT_FAILURE, NO_SOLIS); - } - - upsdebugx(2, "%s: received %zd bytes from ser_get_buf_len()", __func__, tam); - if(tam > 0 && nut_debug_level >= 4) - upsdebug_hex(4, "received from ser_get_buf_len()", temp, (size_t)tam); - - comm_receive(temp, (size_t)tam); } -static int instcmd(const char *cmdname, const char *extra) { - if (!strcasecmp(cmdname, "shutdown.return")) { +static int instcmd(const char *cmdname, const char *extra) +{ + + if (!strcasecmp(cmdname, "shutdown.return")) { /* shutdown and restart */ ser_send_char(upsfd, CMD_SHUTRET); /* 0xDE */ /* ser_send_char(upsfd, ENDCHAR); */ return STAT_INSTCMD_HANDLED; } - if (!strcasecmp(cmdname, "shutdown.stayoff")) { - /* shutdown now (one way) */ - ser_send_char(upsfd, CMD_SHUT); /* 0xDD */ - /* ser_send_char(upsfd, ENDCHAR); */ - return STAT_INSTCMD_HANDLED; - } + if (!strcasecmp(cmdname, "shutdown.stayoff")) + { + /* shutdown now (one way) */ + ser_send_char(upsfd, CMD_SHUT); /* 0xDD */ + /* ser_send_char(upsfd, ENDCHAR); */ + return STAT_INSTCMD_HANDLED; + } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } -void upsdrv_initinfo(void) { - get_base_info(); +void upsdrv_initinfo(void) +{ + getbaseinfo(); upsh.instcmd = instcmd; } -void upsdrv_updateinfo(void) { - get_update_info(); /* new package for updates */ +void upsdrv_updateinfo(void) +{ + + getupdateinfo(); /* new package for updates */ dstate_setinfo("output.voltage", "%03.1f", OutVoltage); dstate_setinfo("input.voltage", "%03.1f", InVoltage); dstate_setinfo("battery.voltage", "%02.1f", BattVoltage); dstate_setinfo("battery.charge", "%03.1f", batcharge); - dstate_setinfo("output.current", "%03.1f", OutCurrent); + status_init(); - if (!SourceFail) + if (!SourceFail ) status_set("OL"); /* on line */ else status_set("OB"); /* on battery */ - if (Autonomy < 5) + if (Autonomy < 5 ) status_set("LB"); /* low battery */ - if (progshut) { /* software programable shutdown immediately */ + if( progshut ) { /* software programable shutdown immediately */ if( prgups == 2 ) - send_shutdown(); /* Ups shutdown in 4-5 minutes -- redundant Ups shutdown */ + sendshut(); /* Ups shutdown in 4-5 minutes -- redundant Ups shutdown */ status_set("LB"); /* no low battery but is a force shutdown */ } @@ -948,24 +1054,33 @@ void upsdrv_updateinfo(void) { dstate_setinfo("ups.load", "%03.1f", upscharge); dstate_dataok(); + } -/*! @brief Power down the attached load immediately. - * Basic idea: find out line status and send appropriate command. - * - on battery: send normal shutdown, UPS will return by itself on utility - * - on line: send shutdown+return, UPS will cycle and return soon. - */ -void upsdrv_shutdown(void) { +/* power down the attached load immediately */ +void upsdrv_shutdown(void) +{ + + /* basic idea: find out line status and send appropriate command */ + /* on battery: send normal shutdown, ups will return by itself on utility */ + /* on line: send shutdown+return, ups will cycle and return soon */ + if (!SourceFail) { /* on line */ - upslogx(LOG_NOTICE, "On line, sending shutdown+return command...\n"); + + printf("On line, sending shutdown+return command...\n"); ser_send_char(upsfd, CMD_SHUTRET ); - } else { - upslogx(LOG_NOTICE, "On battery, sending normal shutdown command...\n"); + } + else + { + printf("On battery, sending normal shutdown command...\n"); ser_send_char(upsfd, CMD_SHUT); } + } -void upsdrv_help(void) { +void upsdrv_help(void) +{ + printf("\nSolis options\n"); printf(" Battery Extension in AH\n"); printf(" battext = 80\n"); @@ -981,20 +1096,25 @@ void upsdrv_help(void) { printf(" houron = hh:mm hh = hour 0-23 mm = minute 0-59 separated with :\n"); printf(" houroff = hh:mm hh = hour 0-23 mm = minute 0-59 separated with :\n"); printf(" where houron is power-on hour and houroff is shutdown and power-off hour\n"); - printf(" Uses daysweek and houron to programming and save UPS power on/off\n"); + printf(" Uses daysweek and houron to programing and save UPS power on/off\n"); printf(" These are valid only if prgshut = 2 or 3\n"); + } -void upsdrv_makevartable(void) { +void upsdrv_makevartable(void) +{ + addvar(VAR_VALUE, "battext", "Battery Extension (0-80)min"); addvar(VAR_VALUE, "prgshut", "Programable power off (0-3)"); addvar(VAR_VALUE, "daysweek", "Days of week UPS power of/off"); addvar(VAR_VALUE, "daysoff", "Days of week Driver shutdown"); addvar(VAR_VALUE, "houron", "Power on hour (hh:mm)"); addvar(VAR_VALUE, "houroff", "Power off hour (hh:mm)"); + } -void upsdrv_initups(void) { +void upsdrv_initups(void) +{ upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B9600); @@ -1002,6 +1122,7 @@ void upsdrv_initups(void) { ser_set_rts(upsfd, 0); } -void upsdrv_cleanup(void) { +void upsdrv_cleanup(void) +{ ser_close(upsfd, device_path); } diff --git a/drivers/solis.h b/drivers/solis.h index 54c9471..521d080 100644 --- a/drivers/solis.h +++ b/drivers/solis.h @@ -1,8 +1,6 @@ /* solis.h - Microsol Solis UPS hardware - Copyright (C) 2004 Silvino B. Magalhaes - 2019 Roberto Panerai Velloso - + Copyright (C) 2004 Silvino B. Magalhaes This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,34 +22,23 @@ 2004/10/30 - Version 0.40 - add model data structs 2004/11/22 - Version 0.50 - add internal e external shutdown programming 2005/06/16 - Version 0.60 - save external shutdown programming to ups, - support new cables and Solaris compilation - 2015/09/19 - Version 0.63 - patch for correct reading for Microsol Back-Ups BZ1200-BR + support new cables and Solaris compilation */ #ifndef INCLUDED_SOLIS_H #define INCLUDED_SOLIS_H -#include "nut_stdint.h" - -/* General FIXMEs: - * * "static" declarations belong in some one single C source; - * headers should use "extern" to refer linker to look for - * vars in other object files - * * use a common definition of bool_t - */ typedef int bool_t; /* autonomy constants */ -static const int bext[5] = {14,18,28,18,1}; -static const int nompow[5] = { 1000,1500,2000,3000,1200 }; -static const int inds[6] = { 0,0,1,2,3,4 }; -static const double InVolt_offset = 30.; -#define PACKET_SIZE 25 -static const size_t packet_size = PACKET_SIZE; +int bext[5] = {14,18,28,18,1}; +int nompow[4] = { 1000,1500,2000,3000 }; +int inds[5] = { 0,0,1,2,3 }; +double InVolt_offset = 30.; -static const struct { +struct { int maxi; /* power internals */ int minc[21]; /* power minimal index */ int maxc[21]; /* power maximus index */ @@ -214,7 +201,7 @@ static const struct { * Solis constants for data ajustment * ----------------------------------------------------------- */ -static const struct { +struct { double m_infreq; double m_appp_offset; double m_involt193[2]; @@ -229,7 +216,7 @@ static const struct { double m_utilp_i[2][2]; double m_appp_s[2][2]; double m_appp_i[2][2]; -} ctab[6] = +} ctab[5] = { { 101620.0, 25.0, { 1.141, 13.0 }, @@ -300,56 +287,21 @@ static const struct { { { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } }, { { 1.0/5.15, 29.0 }, { 1.0/4.8, 26.0 } }, { { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } } - }, - - /*STAY1200_USB - - double m_infreq; - double m_appp_offset; - double m_involt193[2]; - double m_involt194[2]; - double m_incurr[2]; - double m_battvolt[2]; - double m_outvolt_s[2][2]; - double m_outvolt_i[2][2]; - double m_outcurr_s[2][2]; - double m_outcurr_i[2][2]; - double m_utilp_s[2][2]; - double m_utilp_i[2][2]; - double m_appp_s[2][2]; - double m_appp_i[2][2]; - - - */ - { 101800.0, /* m_infreq */ - 56.0, /* m_appp_offset */ - { 1.64, 9.34 }, /* m_involt193 - ok */ - { 2.5, -250.0 }, /* m_involt194 */ - { 35.0, 1000.0 }, /* m_incurr */ - { 0.1551, 0.2525 }, /* m_battvolt */ - { { 1.41, 13.0 }, { 1.4, 17.0 } }, /* m_outvolt_s */ - { { 2.73, 25.0 }, { 2.73, 30.0 } }, /* m_outvolt_i */ - { { 1.0/8.15, 0.25 }, { 1.0/8.15, 0.25 } }, /* m_outcurr_s */ - { { 1.0/16.0, 0.4 }, { 1.0/15.0, 0.4 } }, /* m_outcurr_i */ - { { 1.0/4.87, 19.0 }, { 1.0/4.55, 17.0 } }, /* m_utilp_s */ - { { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } }, /* m_utilp_i */ - { { 1.0/5.15, 29.0 }, { 1.0/4.8, 26.0 } }, /* m__app_s */ - { { 1.0/4.78, 52.0 }, { 1.0/4.55, 55.0 } } /* m_app_i */ } }; /* Date, time and programming group */ -static int const BASE_YEAR = 1998; /* Note: code below uses relative "unsigned char" years */ -static int Day, Month, Year; -static int isprogram = 0, progshut = 0, prgups = 0; -static int dian=0, mesn=0, anon=0, weekn=0; -static int dhour, dmin, lhour, lmin, ihour,imin, isec, hourshut, minshut; -static uint8_t DaysOnWeek=0, DaysOffWeek=0, DaysStd = 0; -static char seman[4]; +static int const BASE_YEAR = 1998; +int Day, Month, Year; +int isprogram = 0, progshut = 0, prgups = 0; +int dian=0, mesn=0, anon=0, weekn=0; +int dhour, dmin, lhour, lmin, ihour,imin, isec, hourshut, minshut; +unsigned char DaysOnWeek=0, DaysOffWeek=0, DaysStd = 0; +char seman[4]; /* buffers */ -static unsigned char RecPack[PACKET_SIZE]; -static unsigned char ConfigPack[12]; +unsigned char RecPack[25]; +unsigned char ConfigPack[12]; /* unsigned char MibData[161]; @@ -357,39 +309,48 @@ unsigned char DumpPack[242]; */ /* Identification */ -static const char *Model; -static int SolisModel, imodel; -static int InputValue, Out220; +char Model[12]; +int SolisModel, imodel; +int InputValue, Out220; + +/* protocol */ +int Waiting, NumByteRec = 0; +int pacsize; /* Status group */ -static unsigned char InputStatus,OutputStatus, BattStatus; +unsigned char InputStatus,OutputStatus, BattStatus, StatusGeral; /* Events group */ -static unsigned char SourceEvents, OutputEvents, BattEvents; +unsigned char SourceEvents, OutputEvents, BattEvents, GeneralEvents; /* logical */ -static bool_t detected = 0; -static bool_t SourceFail, SourceLast, FailureFlag, SourceReturn, SuperHeat; -static bool_t SuperHeatLast, OverCharge, OverChargeLast, LowBatt; -static bool_t CriticBatt, CriticBattLast, Flag_inversor, InversorOn, InversorOnLast; +bool_t detected = 0; +bool_t SourceFail, SourceLast, FailureFlag, SourceReturn, SuperHeat; +bool_t SuperHeatLast, OverCharge, OverChargeLast, LowBatt; +bool_t CriticBatt, CriticBattLast, Flag_inversor, InversorOn, InversorOnLast; /* Input group */ -static double InVoltage, InCurrent, InFreq; -static double InDownLim, InUpLim, NomInVolt; +double InVoltage, InCurrent, InFreq; +double InDownLim, InUpLim, NomInVolt; /* Output group */ -static double OutVoltage, OutCurrent, OutFreq, OutDownLim, OutUpLim, NomOutVolt; +double OutVoltage, OutCurrent, OutFreq, OutDownLim, OutUpLim, NomOutVolt; /* Battery group */ -static int Autonomy, BattExtension, maxauto; -static double BattVoltage, Temperature, batcharge; +int Autonomy, BattExtension, maxauto; +double BattVoltage, BattCurrent, Temperature, batcharge; +double Bat_LimInfRede, Bat_LimSupRede, Bat_LimInfInv, Bat_LimSupInv, Bat_VoltNom; /* Power group */ -static double AppPower, UtilPower, upscharge; -static int ChargePowerFactor, NominalPower, UpsPowerFactor; +double AppPower, UtilPower, upscharge; +int ChargePowerFactor, NominalPower, UpsPowerFactor; -static void print_info(void); -static int is_today( unsigned char, int ); -static void autonomy_calc( int ); -static void scan_received_pack(void); -static void comm_receive(const unsigned char*, size_t); -static void get_base_info(void); -static void get_update_info(void); +static void prnInfo(void); +static int IsToday( unsigned char, int ); +static void AutonomyCalc( int ); +static void ScanReceivePack(void); +static void CommReceive(const char*, int ); +static void getbaseinfo(void); +static void getupdateinfo(void); #endif /* INCLUDED_SOLIS_H */ + + + + diff --git a/drivers/tripplite-hid.c b/drivers/tripplite-hid.c index 20d5152..5409dda 100644 --- a/drivers/tripplite-hid.c +++ b/drivers/tripplite-hid.c @@ -29,7 +29,7 @@ #include "tripplite-hid.h" #include "usb-common.h" -#define TRIPPLITE_HID_VERSION "TrippLite HID 0.84" +#define TRIPPLITE_HID_VERSION "TrippLite HID 0.81" /* FIXME: experimental flag to be put in upsdrv_info */ @@ -40,33 +40,18 @@ */ static double battery_scale = 1.0; -static double io_voltage_scale = 1.0; -static double io_frequency_scale = 1.0; -static double io_current_scale = 1.0; - /* Specific handlers for USB device matching */ static void *battery_scale_1dot0(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); /* FIXME: we could remove this one since it's the default! */ battery_scale = 1.0; return NULL; } static void *battery_scale_0dot1(USBDevice_t *device) { - NUT_UNUSED_VARIABLE(device); battery_scale = 0.1; return NULL; } -static void *smart1500lcdt_scale(USBDevice_t *device) -{ - NUT_UNUSED_VARIABLE(device); - battery_scale = 100000.0; - io_voltage_scale = 100000.0; - io_frequency_scale = 0.01; - io_current_scale = 0.01; - return NULL; -} /* TrippLite */ #define TRIPPLITE_VENDORID 0x09ae @@ -74,9 +59,6 @@ static void *smart1500lcdt_scale(USBDevice_t *device) /* Hewlett Packard */ #define HP_VENDORID 0x03f0 -/* Delta/Minuteman */ -#define DELTA_VENDORID 0x05dd - /* USB IDs device table */ static usb_device_id_t tripplite_usb_device_table[] = { /* e.g. TrippLite AVR550U */ @@ -87,8 +69,6 @@ static usb_device_id_t tripplite_usb_device_table[] = { { USB_DEVICE(TRIPPLITE_VENDORID, 0x1008), battery_scale_0dot1 }, { USB_DEVICE(TRIPPLITE_VENDORID, 0x1009), battery_scale_0dot1 }, { USB_DEVICE(TRIPPLITE_VENDORID, 0x1010), battery_scale_0dot1 }, - /* e.g. TrippLite SU3000LCD2UHV */ - { USB_DEVICE(TRIPPLITE_VENDORID, 0x1330), battery_scale_1dot0 }, /* e.g. TrippLite OMNI1000LCD */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x2005), battery_scale_0dot1 }, /* e.g. TrippLite OMNI900LCD */ @@ -116,9 +96,7 @@ static usb_device_id_t tripplite_usb_device_table[] = { /* e.g. ? */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x3015), battery_scale_1dot0 }, /* e.g. TrippLite Smart1500LCD (newer unit) */ - { USB_DEVICE(TRIPPLITE_VENDORID, 0x3016), smart1500lcdt_scale }, - /* e.g. TrippLite AVR750U (newer unit) */ - { USB_DEVICE(TRIPPLITE_VENDORID, 0x3024), smart1500lcdt_scale }, + { USB_DEVICE(TRIPPLITE_VENDORID, 0x3016), battery_scale_1dot0 }, /* e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x4001), battery_scale_1dot0 }, /* e.g. TrippLite SmartOnline SU6000RT4U? */ @@ -152,11 +130,8 @@ static usb_device_id_t tripplite_usb_device_table[] = { /* HP R/T 2200 INTL (like SMART2200RMXL2U) */ { USB_DEVICE(HP_VENDORID, 0x1f0a), battery_scale_1dot0 }, - /* Delta/Minuteman Enterprise Plus E1500RM2U */ - { USB_DEVICE(DELTA_VENDORID, 0xa011), battery_scale_1dot0 }, - /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; /* returns statically allocated string - must not use it again before @@ -182,7 +157,7 @@ static const char *tripplite_chemistry_fun(double value) } static info_lkp_t tripplite_chemistry[] = { - { 0, NULL, tripplite_chemistry_fun, NULL } + { 0, NULL, tripplite_chemistry_fun } }; /* returns statically allocated string - must not use it again before @@ -197,46 +172,7 @@ static const char *tripplite_battvolt_fun(double value) } static info_lkp_t tripplite_battvolt[] = { - { 0, NULL, tripplite_battvolt_fun, NULL } -}; - -static const char *tripplite_iovolt_fun(double value) -{ - static char buf[8]; - - snprintf(buf, sizeof(buf), "%.1f", io_voltage_scale * value); - - return buf; -} - -static info_lkp_t tripplite_iovolt[] = { - { 0, NULL, tripplite_iovolt_fun, NULL } -}; - -static const char *tripplite_iofreq_fun(double value) -{ - static char buf[8]; - - snprintf(buf, sizeof(buf), "%.1f", io_frequency_scale * value); - - return buf; -} - -static info_lkp_t tripplite_iofreq[] = { - { 0, NULL, tripplite_iofreq_fun, NULL } -}; - -static const char *tripplite_ioamp_fun(double value) -{ - static char buf[8]; - - snprintf(buf, sizeof(buf), "%.1f", io_current_scale * value); - - return buf; -} - -static info_lkp_t tripplite_ioamp[] = { - { 0, NULL, tripplite_ioamp_fun, NULL } + { 0, NULL, tripplite_battvolt_fun } }; /* --------------------------------------------------------------- */ @@ -343,7 +279,7 @@ static hid_info_t tripplite_hid2nut[] = { #endif /* USBHID_UPS_TRIPPLITE_DEBUG */ /* Device page */ - { "device.part", 0, 0, "UPS.TLCustom.[1].iUPSPartNumber", NULL, "%s", HU_FLAG_STATIC, stringid_conversion }, + { "device.part", 0, 0, "UPS.TLCustom.[1].iUPSPartNumber", NULL, "%.0f", 0, stringid_conversion }, /* Battery page */ { "battery.charge", 0, 0, "UPS.PowerSummary.RemainingCapacity", NULL, "%.0f", 0, NULL }, @@ -427,9 +363,9 @@ static hid_info_t tripplite_hid2nut[] = { /* Input page */ { "input.voltage.nominal", 0, 0, "UPS.PowerSummary.Input.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, "%s", 0, tripplite_iovolt }, - { "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%s", 0, tripplite_iovolt }, - { "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%s", 0, tripplite_iofreq }, + { "input.voltage", 0, 0, "UPS.PowerSummary.Input.Voltage", NULL, "%.1f", 0, NULL }, + { "input.voltage", 0, 0, "UPS.PowerConverter.Input.Voltage", NULL, "%.1f", 0, NULL }, + { "input.frequency", 0, 0, "UPS.PowerConverter.Input.Frequency", NULL, "%.1f", 0, NULL }, { "input.transfer.low", ST_FLAG_RW | ST_FLAG_STRING, 5, "UPS.PowerConverter.Output.LowVoltageTransfer", NULL, "%.1f", HU_FLAG_SEMI_STATIC, NULL }, { "input.transfer.low.max", 0, 0, "UPS.PowerConverter.Output.TLLowVoltageTransferMax", NULL, "%.0f", HU_FLAG_STATIC, NULL }, { "input.transfer.low.min", 0, 0, "UPS.PowerConverter.Output.TLLowVoltageTransferMin", NULL, "%.0f", HU_FLAG_STATIC, NULL }, @@ -439,11 +375,11 @@ static hid_info_t tripplite_hid2nut[] = { /* Output page */ { "output.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%s", 0, tripplite_iovolt }, - { "output.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%s", 0, tripplite_iovolt }, - { "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%s", 0, tripplite_ioamp }, + { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.1f", 0, NULL }, + { "output.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.1f", 0, NULL }, + { "output.current", 0, 0, "UPS.PowerConverter.Output.Current", NULL, "%.2f", 0, NULL }, { "output.frequency.nominal", 0, 0, "UPS.Flow.ConfigFrequency", NULL, "%.0f", HU_FLAG_STATIC, NULL }, - { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%s", 0, tripplite_iofreq }, + { "output.frequency", 0, 0, "UPS.PowerConverter.Output.Frequency", NULL, "%.1f", 0, NULL }, /* instant commands. */ { "test.battery.start.quick", 0, 0, "UPS.BatterySystem.Test", NULL, "1", HU_TYPE_CMD, NULL }, /* reported to work on OMNI1000 */ @@ -562,5 +498,4 @@ subdriver_t tripplite_subdriver = { tripplite_format_model, tripplite_format_mfr, tripplite_format_serial, - fix_report_desc, }; diff --git a/drivers/tripplite-hid.h b/drivers/tripplite-hid.h index 5a09c08..b444c4d 100644 --- a/drivers/tripplite-hid.h +++ b/drivers/tripplite-hid.h @@ -1,6 +1,6 @@ /* tripplite-hid.h - data to monitor Tripp Lite USB/HID devices with NUT * - * Copyright (C) + * Copyright (C) * 2003 - 2005 Arnaud Quette * 2005 Peter Selinger * diff --git a/drivers/tripplite.c b/drivers/tripplite.c index 672c734..78ef253 100644 --- a/drivers/tripplite.c +++ b/drivers/tripplite.c @@ -65,17 +65,13 @@ * :C -- fetches result of a self-test * :K1 -- turns on power receptacles * :K0 -- turns off power receptacles - * :K3 -- turns on bank 1 receptacle(s) - * :K2 -- turns off bank 1 receptacle(s) - * :K5 -- turns on bank 2 receptacle(s) - * :K4 -- turns off bank 2 receptacle(s) * :G -- unconfirmed: shuts down UPS until power returns * :Q1 -- enable "Remote Reboot" * :Q0 -- disable "Remote Reboot" * :W -- returns 'W' data * :L -- returns 'L' data * :V -- returns 'V' data (firmware revision) - * :X -- returns 'X' data (firmware checksum) + * :X -- returns 'X' data (firmware revision) * :D -- returns general status data * :B -- returns battery voltage (hexadecimal decivolts) * :I -- returns minimum input voltage (hexadecimal hertz) @@ -112,12 +108,11 @@ #include "main.h" #include "serial.h" #include "tripplite.h" -#include "nut_stdint.h" #include #include #define DRIVER_NAME "Tripp-Lite SmartUPS driver" -#define DRIVER_VERSION "0.93" +#define DRIVER_VERSION "0.91" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -135,7 +130,7 @@ static unsigned int offdelay = DEFAULT_OFFDELAY; static unsigned int startdelay = DEFAULT_STARTDELAY; static unsigned int bootdelay = DEFAULT_BOOTDELAY; -static long hex2d(char *start, unsigned int len) +static int hex2d(char *start, unsigned int len) { char buf[32]; @@ -151,16 +146,16 @@ static long hex2d(char *start, unsigned int len) * very clean. * * return: # of chars in buf, excluding terminating \0 */ -static ssize_t send_cmd(const char *str, char *buf, size_t len) +static int send_cmd(const char *str, char *buf, size_t len) { - char c; - ssize_t ret = 0; - ssize_t i = 0; + unsigned char c; + int ret = 0; + size_t i = 0; ser_flush_io(upsfd); ser_send(upsfd, "%s", str); - if (!len || !buf || len > SSIZE_MAX) + if (!len || !buf) return -1; for (;;) { @@ -178,15 +173,14 @@ static ssize_t send_cmd(const char *str, char *buf, size_t len) if (c == IGNCHAR || c == ENDCHAR) continue; buf[i++] = c; - } while (c != ENDCHAR && i < (int)len); + } while (c != ENDCHAR && i < len); buf[i] = '\0'; return i; } static void get_letter_cmd(const char *str, char *buf, size_t len) { - int tries; - ssize_t ret; + int tries, ret; for (tries = 0; tries < MAXTRIES; ++tries) { ret = send_cmd(str, buf, len); @@ -196,7 +190,7 @@ static void get_letter_cmd(const char *str, char *buf, size_t len) fatalx(EXIT_FAILURE, "\nFailed to find UPS - giving up..."); } -static ssize_t do_reboot_now(void) +static int do_reboot_now(void) { char buf[256], cmd[16]; @@ -213,7 +207,7 @@ static void do_reboot(void) do_reboot_now(); } -static ssize_t soft_shutdown(void) +static int soft_shutdown(void) { char buf[256], cmd[16]; @@ -222,7 +216,7 @@ static ssize_t soft_shutdown(void) return send_cmd(":G\r", buf, sizeof buf); } -static ssize_t hard_shutdown(void) +static int hard_shutdown(void) { char buf[256], cmd[16]; @@ -247,22 +241,6 @@ static int instcmd(const char *cmdname, const char *extra) send_cmd(":K1\r", buf, sizeof buf); return STAT_INSTCMD_HANDLED; } - if (!strcasecmp(cmdname, "outlet.1.load.off")) { - send_cmd(":K2\r", buf, sizeof buf); - return STAT_INSTCMD_HANDLED; - } - if (!strcasecmp(cmdname, "outlet.1.load.on")) { - send_cmd(":K3\r", buf, sizeof buf); - return STAT_INSTCMD_HANDLED; - } - if (!strcasecmp(cmdname, "outlet.2.load.off")) { - send_cmd(":K4\r", buf, sizeof buf); - return STAT_INSTCMD_HANDLED; - } - if (!strcasecmp(cmdname, "outlet.2.load.on")) { - send_cmd(":K5\r", buf, sizeof buf); - return STAT_INSTCMD_HANDLED; - } if (!strcasecmp(cmdname, "shutdown.reboot")) { do_reboot_now(); return STAT_INSTCMD_HANDLED; @@ -280,31 +258,25 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } static int setvar(const char *varname, const char *val) { if (!strcasecmp(varname, "ups.delay.shutdown")) { - int ipv = atoi(val); - if (ipv >= 0) - offdelay = (unsigned int)ipv; - dstate_setinfo("ups.delay.shutdown", "%u", offdelay); + offdelay = atoi(val); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); return STAT_SET_HANDLED; } if (!strcasecmp(varname, "ups.delay.start")) { - int ipv = atoi(val); - if (ipv >= 0) - startdelay = (unsigned int)ipv; - dstate_setinfo("ups.delay.start", "%u", startdelay); + startdelay = atoi(val); + dstate_setinfo("ups.delay.start", "%d", startdelay); return STAT_SET_HANDLED; } if (!strcasecmp(varname, "ups.delay.reboot")) { - int ipv = atoi(val); - if (ipv >= 0) - bootdelay = (unsigned int)ipv; - dstate_setinfo("ups.delay.reboot", "%u", bootdelay); + bootdelay = atoi(val); + dstate_setinfo("ups.delay.reboot", "%d", bootdelay); return STAT_SET_HANDLED; } return STAT_SET_UNKNOWN; @@ -314,8 +286,8 @@ void upsdrv_initinfo(void) { const char *model; char w_value[16], l_value[16], v_value[16], x_value[16]; - int gen, plugs; - long w, l, va; + int va; + long w, l; get_letter_cmd(":W\r", w_value, sizeof w_value); get_letter_cmd(":L\r", l_value, sizeof l_value); @@ -327,20 +299,17 @@ void upsdrv_initinfo(void) w = hex2d(w_value, 2); l = hex2d(l_value, 2); - model = "Smart"; + model = "Smart %d"; if (w & 0x40) - model = "Unison"; + model = "Unison %d"; va = ((w & 0x3f) * 32 + (l >> 3)) * 5; /* New formula */ if (!(w & 0x80)) va = l / 2; /* Old formula */ - gen = 1 + (!(x_value[0] & 0x07) * !(x_value[1] & 0x07)); - plugs = x_value[0] - !!(x_value[1] >> 3) * 8; - - dstate_setinfo("ups.model", "%s %ld", model, va); - dstate_setinfo("ups.firmware", "%c%c (Gen %d)", - 'A'+v_value[0]-'0', 'A'+v_value[1]-'0', gen); + dstate_setinfo("ups.model", model, va); + dstate_setinfo("ups.firmware", "%c%c", + 'A'+v_value[0]-'0', 'A'+v_value[1]-'0'); dstate_setinfo("ups.delay.shutdown", "%d", offdelay); dstate_setflags("ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING); @@ -360,15 +329,6 @@ void upsdrv_initinfo(void) dstate_addcmd("shutdown.return"); dstate_addcmd("shutdown.stayoff"); - if (plugs > 1) { - dstate_addcmd("outlet.1.load.off"); - dstate_addcmd("outlet.1.load.on"); - if (plugs > 2) { - dstate_addcmd("outlet.2.load.off"); - dstate_addcmd("outlet.2.load.on"); - } - } - upsh.instcmd = instcmd; upsh.setvar = setvar; @@ -385,9 +345,7 @@ void upsdrv_updateinfo(void) { static int numfails; char buf[256]; - int bp, temp; - ssize_t len; - long volt, load, vmax, vmin, stest; + int bp, volt, temp, load, vmax, vmin, stest, len; int bcond, lstate, tstate, mode; float bv, freq; @@ -395,7 +353,7 @@ void upsdrv_updateinfo(void) if (len != 21) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("Data command failed: [%zd] bytes != 21 bytes.", len); + ser_comm_fail("Data command failed: [%d] bytes != 21 bytes.", len); dstate_datastale(); } return; @@ -415,7 +373,7 @@ void upsdrv_updateinfo(void) freq > FREQ_MAX || freq < FREQ_MIN) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("Data out of bounds: [%0ld,%3d,%3ld,%02.2f]", + ser_comm_fail("Data out of bounds: [%0d,%3d,%3d,%02.2f]", volt, temp, load, freq); dstate_datastale(); } @@ -423,7 +381,7 @@ void upsdrv_updateinfo(void) } send_cmd(":B\r", buf, sizeof buf); - bv = (float)(hex2d(buf, 2)) / 10.0; + bv = (float)hex2d(buf, 2) / 10.0; if (bv > 50.0 || bv < 0.0) { ++numfails; if (numfails > MAXTRIES) { @@ -438,7 +396,7 @@ void upsdrv_updateinfo(void) if (vmax > INVOLT_MAX || vmax < INVOLT_MIN) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("InVoltMax out of bounds: [%ld]", vmax); + ser_comm_fail("InVoltMax out of bounds: [%d]", vmax); dstate_datastale(); } return; @@ -449,7 +407,7 @@ void upsdrv_updateinfo(void) if (vmin > INVOLT_MAX || vmin < INVOLT_MIN) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("InVoltMin out of bounds: [%ld]", vmin); + ser_comm_fail("InVoltMin out of bounds: [%d]", vmin); dstate_datastale(); } return; @@ -461,7 +419,7 @@ void upsdrv_updateinfo(void) if (errno == ERANGE) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("Self test is out of range: [%ld]", stest); + ser_comm_fail("Self test is out of range: [%d]", stest); dstate_datastale(); } return; @@ -477,7 +435,7 @@ void upsdrv_updateinfo(void) if (stest > 3 || stest < 0) { ++numfails; if (numfails > MAXTRIES) { - ser_comm_fail("Self test out of bounds: [%ld]", stest); + ser_comm_fail("Self test out of bounds: [%d]", stest); dstate_datastale(); } return; @@ -486,9 +444,9 @@ void upsdrv_updateinfo(void) /* We've successfully gathered all the data for an update. */ numfails = 0; - dstate_setinfo("input.voltage", "%0ld", volt); + dstate_setinfo("input.voltage", "%0d", volt); dstate_setinfo("ups.temperature", "%3d", temp); - dstate_setinfo("ups.load", "%3ld", load); + dstate_setinfo("ups.load", "%3d", load); dstate_setinfo("input.frequency", "%02.2f", freq); status_init(); @@ -566,8 +524,8 @@ void upsdrv_updateinfo(void) dstate_setinfo("battery.voltage", "%.1f", bv); dstate_setinfo("battery.charge", "%3d", bp); - dstate_setinfo("input.voltage.maximum", "%ld", vmax); - dstate_setinfo("input.voltage.minimum", "%ld", vmin); + dstate_setinfo("input.voltage.maximum", "%d", vmax); + dstate_setinfo("input.voltage.minimum", "%d", vmin); switch (stest) { case 0: @@ -614,23 +572,13 @@ void upsdrv_initups(void) { upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); - char *val; - if ((val = getval("offdelay"))) { - int ipv = atoi(val); - if (ipv >= 0) - offdelay = (unsigned int)ipv; - } - if ((val = getval("startdelay"))) { - int ipv = atoi(val); - if (ipv >= 0) - startdelay = (unsigned int)ipv; - } - if ((val = getval("rebootdelay"))) { - int ipv = atoi(val); - if (ipv >= 0) - bootdelay = (unsigned int)ipv; - } + if (getval("offdelay")) + offdelay = atoi(getval("offdelay")); + if (getval("startdelay")) + startdelay = atoi(getval("startdelay")); + if (getval("rebootdelay")) + bootdelay = atoi(getval("rebootdelay")); } void upsdrv_cleanup(void) diff --git a/drivers/tripplite.h b/drivers/tripplite.h index 498f69c..931d62d 100644 --- a/drivers/tripplite.h +++ b/drivers/tripplite.h @@ -23,9 +23,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_TRIPPLITE_H_SEEN -#define NUT_TRIPPLITE_H_SEEN 1 - #define ENDCHAR '\n' /* replies end with CR LF -- use LF to end */ #define IGNCHAR '\r' /* ignore CR */ #define MAXTRIES 3 /* max number of times we try to detect ups */ @@ -59,4 +56,3 @@ #define MAX_VOLT 13.4 /* Max battery voltage (100%) */ #define MIN_VOLT 11.0 /* Min battery voltage (10%) */ -#endif /* NUT_TRIPPLITE_H_SEEN */ diff --git a/drivers/tripplite_usb.c b/drivers/tripplite_usb.c index cbaf73b..e907c12 100644 --- a/drivers/tripplite_usb.c +++ b/drivers/tripplite_usb.c @@ -1,4 +1,4 @@ -/*!@file tripplite_usb.c +/*!@file tripplite_usb.c * @brief Driver for Tripp Lite non-PDC/HID USB models. */ /* @@ -8,8 +8,7 @@ Copyright (C) 1999 Russell Kroll Copyright (C) 2001 Rickard E. (Rik) Faith Copyright (C) 2004 Nicholas J. Kain - Copyright (C) 2005-2008, 2014 Charles Lepple - Copyright (C) 2016 Eaton + Copyright (C) 2005-2008 Charles Lepple This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +26,7 @@ */ -/* % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % +/* % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % * * Protocol 1001 * @@ -38,12 +37,12 @@ * :P -> P01000X (1000VA unit) * :S -> Sbb_XXX (bb = 10: on-line, 11: on battery) * :V -> V102XXX (firmware/protocol version?) - * :Wt -> Wt (watchdog; t = time in seconds (binary, not hex), + * :Wt -> Wt (watchdog; t = time in seconds (binary, not hex), * 0 = disable; if UPS is not pinged in this interval, it * will power off the load, and then power it back on after * a delay.) * - * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % * * The outgoing commands are sent with HID Set_Report commands over EP0 * (control message), and incoming commands are received on EP1IN (interrupt @@ -54,14 +53,14 @@ * The descriptors say that bInterval is 10 ms. You generally need to wait at * least 80-90 ms to get some characters back from the device. If it takes * more than 250 ms, you probably need to resend the command. - * + * * All outgoing commands are followed by a checksum, which is 255 - (sum of * characters after ':'), and then by '\r'. All responses should start with * the command letter that was sent (no colon), and should be followed by * '\r'. If the command is not supported (or apparently if there is a serial * timeout internally), the previous response will be echoed back. * - * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % * * SMARTPRO commands (3003): * @@ -86,14 +85,14 @@ * individually switchable.) * :W_ -> W_ (watchdog) * :Z -> Z (reset for max/min; takes a moment to complete) - * - * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + * + * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % * * The SMARTPRO unit seems to be slightly saner with regard to message * polling. It specifies an interrupt in interval of 100 ms, but I just - * started at a 2 second timeout to obtain the above table. + * started at a 2 second timeout to obtain the above table. * - * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + * % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % * * Commands from serial tripplite.c: * @@ -126,17 +125,15 @@ * :S -- enables remote reboot/remote power on */ -/* Watchdog for 3005 is 15 - 255 seconds. - */ - #include "main.h" -#include "nut_libusb.h" +#include "libusb.h" #include #include +#include #include "usb-common.h" #define DRIVER_NAME "Tripp Lite OMNIVS / SMARTPRO driver" -#define DRIVER_VERSION "0.33" +#define DRIVER_VERSION "0.20" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -151,27 +148,20 @@ upsdrv_info_t upsdrv_info = { }; /* TrippLite */ -#define TRIPPLITE_VENDORID 0x09ae +#define TRIPPLITE_VENDORID 0x09ae /* USB IDs device table */ static usb_device_id_t tripplite_usb_device_table[] = { /* e.g. OMNIVS1000, SMART550USB, ... */ { USB_DEVICE(TRIPPLITE_VENDORID, 0x0001), NULL }, - + /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; -static int subdriver_match_func(USBDevice_t *arghd, void *privdata) +static int subdriver_match_func(USBDevice_t *hd, void *privdata) { - NUT_UNUSED_VARIABLE(privdata); - - /* FIXME? Should we save "arghd" into global "hd" variable? - * This was previously shadowed by function argument named "hd"... - */ - /* hd = arghd; */ - - switch (is_usb_device_supported(tripplite_usb_device_table, arghd)) + switch (is_usb_device_supported(tripplite_usb_device_table, hd)) { case SUPPORTED: return 1; @@ -181,8 +171,6 @@ static int subdriver_match_func(USBDevice_t *arghd, void *privdata) if (getval("productid")) { return 1; } - return 0; - case NOT_SUPPORTED: default: return 0; @@ -200,70 +188,11 @@ static enum tl_model_t { TRIPP_LITE_OMNIVS, TRIPP_LITE_OMNIVS_2001, TRIPP_LITE_SMARTPRO, - TRIPP_LITE_SMART_0004, - TRIPP_LITE_SMART_3005 + TRIPP_LITE_SMART_0004 } tl_model = TRIPP_LITE_UNKNOWN; -/*! Are the values encoded in ASCII or binary? - * TODO: Add 3004? - */ -static int is_binary_protocol() -{ - switch(tl_model) { - case TRIPP_LITE_SMART_3005: - return 1; - case TRIPP_LITE_SMARTPRO: - case TRIPP_LITE_SMART_0004: - case TRIPP_LITE_OMNIVS: - case TRIPP_LITE_OMNIVS_2001: - case TRIPP_LITE_UNKNOWN: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - return 0; - } -} - -/*! Is this the "SMART" family of protocols? - * TODO: Add 3004? - */ -static int is_smart_protocol() -{ - switch(tl_model) { - case TRIPP_LITE_SMARTPRO: - case TRIPP_LITE_SMART_0004: - case TRIPP_LITE_SMART_3005: - return 1; - case TRIPP_LITE_OMNIVS: - case TRIPP_LITE_OMNIVS_2001: - case TRIPP_LITE_UNKNOWN: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ - default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - return 0; - } -} - /*!@brief If a character is not printable, return a dot. */ -#define toprint(x) (isalnum((int)x) ? (char)(x) : (char)'.') +#define toprint(x) (isalnum((unsigned)x) ? (x) : '.') #define ENDCHAR 13 @@ -272,7 +201,7 @@ static int is_smart_protocol() #define SEND_WAIT_NSEC (1000*1000*100) #define MAX_RECV_TRIES 10 -#define RECV_WAIT_MSEC 1000 /*!< was 100 for OMNIVS; SMARTPRO units need longer */ +#define RECV_WAIT_MSEC 1000 /*! was 100 for OMNIVS; SMARTPRO units need longer */ #define MAX_RECONNECT_TRIES 10 @@ -302,13 +231,13 @@ static usb_communication_subdriver_t *comm_driver = &usb_subdriver; /* Interval notation for Q% = 10% <= [minV, maxV] <= 100% */ static double V_interval[2] = {MIN_VOLT, MAX_VOLT}; -static long battery_voltage_nominal = 12, +static int battery_voltage_nominal = 12, input_voltage_nominal = 120, input_voltage_scaled = 120, /* input_voltage_maximum = -1, input_voltage_minimum = -1, */ switchable_load_banks = 0, - unit_id = -1; /*!< range: 1-65535, most likely */ + unit_id = -1; /*!< range: 1-65535, most likely */ /*! Time in seconds to delay before shutting down. */ static unsigned int offdelay = DEFAULT_OFFDELAY; @@ -345,17 +274,16 @@ static int reconnect_ups(void) /*!@brief Convert a string to printable characters (in-place) * * @param[in,out] str String to convert - * @param[in] len Maximum number of characters to convert, or == 0 to + * @param[in] len Maximum number of characters to convert, or <= 0 to * convert all. * * Uses toprint() macro defined above. */ -static void toprint_str(char *str, size_t len) +void toprint_str(char *str, int len) { - size_t i; - if (len == 0) len = strlen(str); - /* FIXME? Should we check for '\0' along the way? */ - for (i = 0; i < len; i++) + int i; + if(len <= 0) len = strlen(str); + for(i=0; i < len; i++) str[i] = toprint(str[i]); } @@ -369,7 +297,7 @@ static void toprint_str(char *str, size_t len) * * @return See strtol(3) */ -static long hex2d(const unsigned char *start, unsigned int len) +static int hex2d(const unsigned char *start, unsigned int len) { unsigned char buf[32]; buf[31] = '\0'; @@ -379,36 +307,6 @@ static long hex2d(const unsigned char *start, unsigned int len) return strtol((char *)buf, NULL, 16); } -/*!@brief Convert N characters from big-endian binary to decimal - * - * @param start Beginning of string to convert - * @param len Maximum number of characters to consider (max 32) - * - * @a len characters of @a start are shifted into an accumulator. - * - * We assume len < sizeof(int), and that value > 0. - * - * @return the value - */ -static unsigned int bin2d(const unsigned char *start, unsigned int len) -{ - unsigned int value = 0, index = 0; - for(index = 0; index < len; index++) { - value <<= 8; - value |= start[index]; - } - - return value; -} - -static long hex_or_bin2d(const unsigned char *start, unsigned int len) -{ - if(is_binary_protocol()) { - return bin2d(start, len); - } - return hex2d(start, len); -} - /*!@brief Dump message in both hex and ASCII * * @param[in] msg Buffer to dump @@ -435,7 +333,7 @@ static const char *hexascdump(unsigned char *msg, size_t len) if (end-bufp > 0) *bufp++ = '\''; for(i=0; i0; i++) { - *bufp++ = (unsigned char)toprint(msg[i]); + *bufp++ = toprint(msg[i]); } if (end-bufp > 0) *bufp++ = '\''; @@ -447,11 +345,11 @@ static const char *hexascdump(unsigned char *msg, size_t len) return (char *)buf; } -static enum tl_model_t decode_protocol(unsigned int proto) +enum tl_model_t decode_protocol(unsigned int proto) { switch(proto) { case 0x0004: - upslogx(3, "Using older SMART protocol (%04x)", proto); + upslogx(3, "Using older SMART protocol (%x)", proto); return TRIPP_LITE_SMART_0004; case 0x1001: upslogx(3, "Using OMNIVS protocol (%x)", proto); @@ -462,44 +360,32 @@ static enum tl_model_t decode_protocol(unsigned int proto) case 0x3003: upslogx(3, "Using SMARTPRO protocol (%x)", proto); return TRIPP_LITE_SMARTPRO; - case 0x3005: - upslogx(3, "Using binary SMART protocol (%x)", proto); - return TRIPP_LITE_SMART_3005; default: - printf("Unknown protocol (%04x)", proto); + printf("Unknown protocol (%x)", proto); break; } return TRIPP_LITE_UNKNOWN; } -static void decode_v(const unsigned char *value) +void decode_v(const unsigned char *value) { unsigned char ivn, lb; - long bv; - - if(is_binary_protocol()) { - /* 0x00 0x0c -> 12V ? */ - battery_voltage_nominal = (value[2] << 8) | value[3]; - } else { - bv = hex2d(value+2, 2); - battery_voltage_nominal = bv * 6; - } + int bv = hex2d(value+2, 2); ivn = value[1]; lb = value[4]; switch(ivn) { - case '0': input_voltage_nominal = + case '0': input_voltage_nominal = input_voltage_scaled = 100; break; - case 2: /* protocol 3005 */ - case '1': input_voltage_nominal = + case '1': input_voltage_nominal = input_voltage_scaled = 120; break; - case '2': input_voltage_nominal = + case '2': input_voltage_nominal = input_voltage_scaled = 230; break; @@ -507,54 +393,42 @@ static void decode_v(const unsigned char *value) input_voltage_scaled = 230; break; - case 6: input_voltage_nominal = - input_voltage_scaled = 230; - break; - default: upslogx(2, "Unknown input voltage range: 0x%02x", (unsigned int)ivn); break; } + battery_voltage_nominal = bv * 6; + if( (lb >= '0') && (lb <= '9') ) { switchable_load_banks = lb - '0'; } else { - if(is_binary_protocol()) { - switchable_load_banks = lb; - } else { - if( lb != 'X' ) { - upslogx(2, "Unknown number of switchable load banks: 0x%02x", + if( lb != 'X' ) { + upslogx(2, "Unknown number of switchable load banks: 0x%02x", (unsigned int)lb); - } } } - upsdebugx(2, "Switchable load banks: %ld", switchable_load_banks); } void upsdrv_initinfo(void); /*!@brief Report a USB comm failure, and reconnect if necessary - * + * * @param[in] res Result code from libusb/libhid call * @param[in] msg Error message to display */ -static void usb_comm_fail(int res, const char *msg) +void usb_comm_fail(int res, const char *msg) { static int try = 0; switch(res) { - case ERROR_BUSY: - upslogx(LOG_WARNING, - "%s: Device claimed by another process", msg); + case -EBUSY: + upslogx(LOG_WARNING, "%s: Device claimed by another process", msg); fatalx(EXIT_FAILURE, "Terminating: EBUSY"); -#ifndef HAVE___ATTRIBUTE__NORETURN break; -#endif default: - upslogx(LOG_WARNING, - "%s: Device detached? (error %d: %s)", - msg, res, nut_usb_strerror(res)); + upslogx(LOG_WARNING, "%s: Device detached? (error %d: %s)", msg, res, usb_strerror()); upslogx(LOG_NOTICE, "Reconnect attempt #%d", ++try); hd = NULL; @@ -589,7 +463,6 @@ static void usb_comm_fail(int res, const char *msg) */ static int send_cmd(const unsigned char *msg, size_t msg_len, unsigned char *reply, size_t reply_len) { - NUT_UNUSED_VARIABLE(reply_len); unsigned char buffer_out[8]; unsigned char csum = 0; int ret = 0, send_try, recv_try=0, done = 0; @@ -617,26 +490,21 @@ static int send_cmd(const unsigned char *msg, size_t msg_len, unsigned char *rep for(send_try=0; !done && send_try < MAX_SEND_TRIES; send_try++) { upsdebugx(6, "send_cmd send_try %d", send_try+1); - ret = comm_driver->set_report(udev, 0, - (usb_ctrl_charbuf)buffer_out, - (usb_ctrl_charbufsize)sizeof(buffer_out)); + ret = comm_driver->set_report(udev, 0, buffer_out, sizeof(buffer_out)); if(ret != sizeof(buffer_out)) { - upslogx(1, "libusb_set_report() returned %d instead of %zu", - ret, sizeof(buffer_out)); + upslogx(1, "libusb_set_report() returned %d instead of %u", + ret, (unsigned)(sizeof(buffer_out))); return ret; } #if ! defined(__FreeBSD__) - usleep(1000*100); /* TODO: nanosleep */ + if(!done) { usleep(1000*100); /* TODO: nanosleep */ } #endif for(recv_try=0; !done && recv_try < MAX_RECV_TRIES; recv_try++) { upsdebugx(7, "send_cmd recv_try %d", recv_try+1); - ret = comm_driver->get_interrupt(udev, - (usb_ctrl_charbuf)reply, - (usb_ctrl_charbufsize)sizeof(buffer_out), - RECV_WAIT_MSEC); + ret = comm_driver->get_interrupt(udev, reply, sizeof(buffer_out), RECV_WAIT_MSEC); if(ret != sizeof(buffer_out)) { upslogx(1, "libusb_get_interrupt() returned %d instead of %u while sending %s", ret, (unsigned)(sizeof(buffer_out)), @@ -650,8 +518,8 @@ static int send_cmd(const unsigned char *msg, size_t msg_len, unsigned char *rep upsdebugx(5, "send_cmd: received %s (%s)", hexascdump(reply, sizeof(buffer_out)), done ? "OK" : "bad"); } - - upsdebugx(((send_try > 2) || (recv_try > 2)) ? 3 : 6, + + upsdebugx(((send_try > 2) || (recv_try > 2)) ? 3 : 6, "send_cmd: send_try = %d, recv_try = %d\n", send_try, recv_try); return done ? sizeof(buffer_out) : 0; @@ -665,7 +533,7 @@ static int send_cmd(const unsigned char *msg, size_t msg_len, unsigned char *rep * The variables are of the form "ups.debug.X" where "X" is the command * character. */ -static void debug_message(const char *msg, size_t len) +void debug_message(const char *msg, int len) { int ret; unsigned char tmp_value[9]; @@ -687,7 +555,7 @@ static void debug_message(const char *msg, size_t len) static void do_reboot_wait(unsigned dly) { int ret; - char buf[256], cmd_W[]="Wx"; + char buf[256], cmd_W[]="Wx"; cmd_W[1] = dly; upsdebugx(3, "do_reboot_wait(wait=%d): N", dly); @@ -713,10 +581,8 @@ static int soft_shutdown(void) int ret; unsigned char buf[256], cmd_N[]="N\0x", cmd_G[] = "G"; - /* Already binary: */ - /* FIXME: Assumes memory layout / endianness? */ - cmd_N[2] = (unsigned char)(offdelay & 0x00FF); - cmd_N[1] = (unsigned char)(offdelay >> 8); + cmd_N[2] = offdelay; + cmd_N[1] = offdelay >> 8; upsdebugx(3, "soft_shutdown(offdelay=%d): N", offdelay); ret = send_cmd(cmd_N, sizeof(cmd_N), buf, sizeof(buf)); @@ -727,8 +593,8 @@ static int soft_shutdown(void) } sleep(2); - - /*! The unit must be on battery for this to work. + + /*! The unit must be on battery for this to work. * * @todo check for on-battery condition, and print error if not. * @todo Find an equivalent command for non-OMNIVS models. @@ -747,18 +613,17 @@ static int soft_shutdown(void) static int hard_shutdown(void) { int ret; - unsigned char buf[256], cmd_N[]="N\0x", cmd_K[] = "K\0"; + char buf[256], cmd_N[]="N\0x", cmd_K[] = "K\0"; - /* FIXME: Assumes memory layout / endianness? */ - cmd_N[2] = (unsigned char)(offdelay & 0x00FF); - cmd_N[1] = (unsigned char)(offdelay >> 8); + cmd_N[2] = offdelay; + cmd_N[1] = offdelay >> 8; upsdebugx(3, "hard_shutdown(offdelay=%d): N", offdelay); ret = send_cmd(cmd_N, sizeof(cmd_N), buf, sizeof(buf)); if(ret != 8) return ret; sleep(2); - + ret = send_cmd(cmd_K, sizeof(cmd_K), buf, sizeof(buf)); return (ret == 8); } @@ -787,62 +652,8 @@ static int control_outlet(int outlet_id, int state) } else { return 1; } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif - break; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - - case TRIPP_LITE_SMART_3005: - snprintf(k_cmd, sizeof(k_cmd)-1, "N%c", 5); - ret = send_cmd((unsigned char *)k_cmd, strlen(k_cmd) + 1, (unsigned char *)buf, sizeof buf); - snprintf(k_cmd, sizeof(k_cmd)-1, "K%c%c", outlet_id, state & 1); - ret = send_cmd((unsigned char *)k_cmd, strlen(k_cmd) + 1, (unsigned char *)buf, sizeof buf); - - if(ret != 8) { - upslogx(LOG_ERR, "Could not set outlet %d to state %d, ret = %d", outlet_id, state, ret); - return 0; - } else { - return 1; - } -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif - break; -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - - case TRIPP_LITE_OMNIVS: - case TRIPP_LITE_OMNIVS_2001: - case TRIPP_LITE_UNKNOWN: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif - upslogx(LOG_ERR, "control_outlet unimplemented for protocol %04x", tl_model); + upslogx(LOG_ERR, "control_outlet unimplemented for this UPS model"); } return 0; } @@ -853,7 +664,7 @@ static int instcmd(const char *cmdname, const char *extra) { unsigned char buf[10]; - if(is_smart_protocol()) { + if(tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004) { if (!strcasecmp(cmdname, "test.battery.start")) { send_cmd((const unsigned char *)"A", 2, buf, sizeof buf); return STAT_INSTCMD_HANDLED; @@ -890,33 +701,26 @@ static int instcmd(const char *cmdname, const char *extra) return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } static int setvar(const char *varname, const char *val) { if (!strcasecmp(varname, "ups.delay.shutdown")) { - int ival = atoi(val); - if (ival >= 0) { - offdelay = (unsigned int)ival; - dstate_setinfo("ups.delay.shutdown", "%d", offdelay); - return STAT_SET_HANDLED; - } else { - upslogx(LOG_NOTICE, "FAILED to set '%s' to %d", varname, ival); - return STAT_SET_UNKNOWN; - } + offdelay = atoi(val); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); + return STAT_SET_HANDLED; } if (unit_id >= 0 && !strcasecmp(varname, "ups.id")) { - int new_unit_id, ret; + int new_unit_id, ret; unsigned char J_msg[] = "J__", buf[9]; new_unit_id = atoi(val); - /* FIXME: Assumes memory layout / endianness? */ - J_msg[1] = (unsigned char)(new_unit_id >> 8); - J_msg[2] = (unsigned char)(new_unit_id & 0xff); - ret = send_cmd(J_msg, sizeof(J_msg), buf, sizeof(buf)); + J_msg[1] = new_unit_id >> 8; + J_msg[2] = new_unit_id & 0xff; + ret = send_cmd(J_msg, sizeof(J_msg), buf, sizeof(buf)); if(ret <= 0) { upslogx(LOG_NOTICE, "Could not set Unit ID (return code: %d).", ret); @@ -930,21 +734,16 @@ static int setvar(const char *varname, const char *val) if(!strncmp(varname, "outlet.", strlen("outlet."))) { char outlet_name[80]; char index_str[10], *first_dot, *next_dot; - long index_chars; - int index, state, ret; + int index_chars, index, state, ret; first_dot = strstr(varname, "."); next_dot = strstr(first_dot + 1, "."); - if (!next_dot) { - upslogx(LOG_NOTICE, "FAILED to get outlet index from '%s' (no second dot)", varname); - return STAT_SET_UNKNOWN; - } index_chars = next_dot - (first_dot + 1); - if(index_chars > 9 || index_chars < 0) return STAT_SET_UNKNOWN; + if(index_chars > 9) return STAT_SET_UNKNOWN; if(strcmp(next_dot, ".switch")) return STAT_SET_UNKNOWN; - strncpy(index_str, first_dot + 1, (size_t)index_chars); + strncpy(index_str, first_dot + 1, index_chars); index_str[index_chars] = 0; index = atoi(index_str); @@ -991,8 +790,7 @@ void upsdrv_initinfo(void) char *model, *model_end; unsigned char proto_value[9], f_value[9], p_value[9], s_value[9], u_value[9], v_value[9], w_value[9]; - long va; - ssize_t ret; + int va, ret; unsigned int proto_number = 0; /* Read protocol: */ @@ -1001,8 +799,8 @@ void upsdrv_initinfo(void) fatalx(EXIT_FAILURE, "Error reading protocol"); } - proto_number = ((unsigned)(proto_value[1]) << 8) - | (unsigned)(proto_value[2]); + proto_number = ((unsigned)(proto_value[1]) << 8) + | (unsigned)(proto_value[2]); tl_model = decode_protocol(proto_number); if(tl_model == TRIPP_LITE_UNKNOWN) @@ -1017,7 +815,7 @@ void upsdrv_initinfo(void) if(tl_model != TRIPP_LITE_SMARTPRO ) { ret = send_cmd(w_msg, sizeof(w_msg), w_value, sizeof(w_value)-1); if(ret <= 0) { - if(ret == ERROR_PIPE) { + if(ret == -EPIPE) { fatalx(EXIT_FAILURE, "Could not reset watchdog. Please check and" "see if usbhid-ups(8) works with this UPS."); } else { @@ -1067,11 +865,11 @@ void upsdrv_initinfo(void) dstate_setinfo("ups.model", "%s", model); - dstate_setinfo("ups.power.nominal", "%ld", va); + dstate_setinfo("ups.power.nominal", "%d", va); /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - /* Fetch firmware version: */ + /* Fetch firmware version: */ ret = send_cmd(f_msg, sizeof(f_msg), f_value, sizeof(f_value)-1); toprint_str((char *)(f_value+1), 6); @@ -1130,8 +928,8 @@ void upsdrv_initinfo(void) if(ret <= 0) { upslogx(LOG_INFO, "Unit ID not retrieved (not available on all models)"); } else { - unit_id = (long)((unsigned)(u_value[1]) << 8) - | (unsigned)(u_value[2]); + unit_id = (int)((unsigned)(u_value[1]) << 8) + | (unsigned)(u_value[2]); } if(tl_model == TRIPP_LITE_SMART_0004) { @@ -1140,33 +938,33 @@ void upsdrv_initinfo(void) } if(unit_id >= 0) { - dstate_setinfo("ups.id", "%ld", unit_id); + dstate_setinfo("ups.id", "%d", unit_id); dstate_setflags("ups.id", ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux("ups.id", 5); - upslogx(LOG_DEBUG,"Unit ID: %ld", unit_id); + upslogx(LOG_DEBUG,"Unit ID: %d", unit_id); } /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - dstate_setinfo("input.voltage.nominal", "%ld", input_voltage_nominal); - dstate_setinfo("battery.voltage.nominal", "%ld", battery_voltage_nominal); - dstate_setinfo("ups.debug.load_banks", "%ld", switchable_load_banks); + dstate_setinfo("input.voltage.nominal", "%d", input_voltage_nominal); + dstate_setinfo("battery.voltage.nominal", "%d", battery_voltage_nominal); + dstate_setinfo("ups.debug.load_banks", "%d", switchable_load_banks); - dstate_setinfo("ups.delay.shutdown", "%u", offdelay); + dstate_setinfo("ups.delay.shutdown", "%d", offdelay); dstate_setflags("ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux("ups.delay.shutdown", 3); #if 0 - dstate_setinfo("ups.delay.start", "%u", startdelay); + dstate_setinfo("ups.delay.start", "%d", startdelay); dstate_setflags("ups.delay.start", ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux("ups.delay.start", 8); - dstate_setinfo("ups.delay.reboot", "%u", bootdelay); + dstate_setinfo("ups.delay.reboot", "%d", bootdelay); dstate_setflags("ups.delay.reboot", ST_FLAG_RW | ST_FLAG_STRING); dstate_setaux("ups.delay.reboot", 3); #endif - if(is_smart_protocol()) { + if(tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004) { dstate_addcmd("test.battery.start"); dstate_addcmd("reset.input.minmax"); } @@ -1203,14 +1001,11 @@ void upsdrv_updateinfo(void) s_msg[] = "S", m_msg[] = "M", t_msg[] = "T"; unsigned char b_value[9], d_value[9], l_value[9], s_value[9], m_value[9], t_value[9]; - int bp; - long freq; - double bv_12V = 0.0; /*!< battery voltage, relative to a 12V battery */ - double battery_voltage; /*!< the total battery voltage */ - - unsigned int s_value_1; + int bp, freq; + double bv; int ret; + unsigned battery_charge; status_init(); @@ -1260,14 +1055,8 @@ void upsdrv_updateinfo(void) /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - if(is_smart_protocol() || tl_model == TRIPP_LITE_OMNIVS_2001) { - - unsigned int s_value_2 = s_value[2]; - - if(is_binary_protocol()) { - s_value_2 += '0'; - } - switch(s_value_2) { + if(tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_OMNIVS_2001 || tl_model == TRIPP_LITE_SMART_0004) { + switch(s_value[2]) { case '0': dstate_setinfo("battery.test.status", "Battery OK"); break; @@ -1307,27 +1096,16 @@ void upsdrv_updateinfo(void) } } -#if 0 - /* Apparently, this value changes more frequently when the - * battery is discharged, but it does not track the actual - * state-of-charge. See battery.charge calculation below. - */ + /* This may not be right... */ if(tl_model == TRIPP_LITE_SMARTPRO) { - unsigned battery_charge; battery_charge = (unsigned)(s_value[5]); dstate_setinfo("battery.charge", "%u", battery_charge); } -#endif } /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - s_value_1 = s_value[1]; - if(is_binary_protocol()) { - s_value_1 += '0'; - } - - switch(s_value_1) { + switch(s_value[1]) { case '0': status_set("LB"); break; @@ -1338,9 +1116,7 @@ void upsdrv_updateinfo(void) status_set("RB"); break; } /* else fall through: */ - goto fallthrough_case_default; default: - fallthrough_case_default: upslogx(LOG_ERR, "Unknown value for s[1]: 0x%02x", s_value[1]); dstate_datastale(); break; @@ -1358,18 +1134,28 @@ void upsdrv_updateinfo(void) return; } - dstate_setinfo("input.voltage", "%.2f", hex2d(b_value+1, 4)/3600.0*input_voltage_scaled); + dstate_setinfo("input.voltage", "%.2f", hex2d(b_value+1, 4)/30.0); - bv_12V = hex2d(b_value+5, 2)/16.0; + bv = hex2d(b_value+5, 2)/16.0; - /* TODO: use battery_voltage_nominal, even though it is most likely 12V */ - dstate_setinfo("battery.voltage", "%.2f", bv_12V); + /* dq ~= sqrt(dV) is a reasonable approximation + * Results fit well against the discrete function used in the Tripp Lite + * source, but give a continuous result. */ + if (bv >= V_interval[1]) + bp = 100; + else if (bv <= V_interval[0]) + bp = 10; + else + bp = (int)(100*sqrt((bv - V_interval[0]) + / (V_interval[1] - V_interval[0]))); + + dstate_setinfo("battery.voltage", "%.2f", bv); + dstate_setinfo("battery.charge", "%3d", bp); } /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - if( is_smart_protocol() ) { - + if( tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004 ) { ret = send_cmd(d_msg, sizeof(d_msg), d_value, sizeof(d_value)); if(ret <= 0) { dstate_datastale(); @@ -1377,20 +1163,18 @@ void upsdrv_updateinfo(void) return; } - dstate_setinfo("input.voltage", "%ld", - hex_or_bin2d(d_value+1, 2) * input_voltage_scaled / 120); + dstate_setinfo("input.voltage", "%d", + hex2d(d_value+1, 2) * input_voltage_scaled / 120); - /* TODO: factor out the two constants */ - bv_12V = hex_or_bin2d(d_value+3, 2) / 10.0 ; - battery_voltage = bv_12V * battery_voltage_nominal / 12.0; + bv = hex2d(d_value+3, 2) * battery_voltage_nominal / 120.0 ; - dstate_setinfo("battery.voltage", "%.2f", battery_voltage); + dstate_setinfo("battery.voltage", "%.2f", bv); /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ ret = send_cmd(m_msg, sizeof(m_msg), m_value, sizeof(m_value)); - if(m_value[5] != 0x0d) { /* we only expect 4 hex/binary digits */ + if(m_value[5] != 0x0d) { /* we only expect 4 hex digits */ dstate_setinfo("ups.debug.M", "%s", hexascdump(m_value+1, 7)); } @@ -1400,10 +1184,8 @@ void upsdrv_updateinfo(void) return; } - dstate_setinfo("input.voltage.minimum", "%3ld", - hex_or_bin2d(m_value+1, 2) * input_voltage_scaled / 120); - dstate_setinfo("input.voltage.maximum", "%3ld", - hex_or_bin2d(m_value+3, 2) * input_voltage_scaled / 120); + dstate_setinfo("input.voltage.minimum", "%3d", hex2d(m_value+1, 2)); + dstate_setinfo("input.voltage.maximum", "%3d", hex2d(m_value+3, 2)); /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ @@ -1427,39 +1209,15 @@ void upsdrv_updateinfo(void) dstate_setinfo("input.frequency.nominal", "%d", 50); break; } - } + } if( tl_model == TRIPP_LITE_SMART_0004 ) { freq = hex2d(t_value + 3, 4); dstate_setinfo("input.frequency", "%.1f", freq / 10.0); } - if( tl_model == TRIPP_LITE_SMART_3005 ) { - dstate_setinfo("ups.temperature", "%d", - (unsigned)(hex2d(t_value+1, 1))); - } else { - /* I'm guessing this is a calibration constant of some sort. */ - dstate_setinfo("ups.temperature", "%.1f", - (unsigned)(hex2d(t_value+1, 2)) * 0.3636 - 21); - } - } - - /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ - - if( tl_model == TRIPP_LITE_OMNIVS || tl_model == TRIPP_LITE_OMNIVS_2001 || - tl_model == TRIPP_LITE_SMARTPRO || tl_model == TRIPP_LITE_SMART_0004 || tl_model == TRIPP_LITE_SMART_3005) { - /* dq ~= sqrt(dV) is a reasonable approximation - * Results fit well against the discrete function used in the Tripp Lite - * source, but give a continuous result. */ - if (bv_12V >= V_interval[1]) - bp = 100; - else if (bv_12V <= V_interval[0]) - bp = 10; - else - bp = (int)(100*sqrt((bv_12V - V_interval[0]) - / (V_interval[1] - V_interval[0]))); - - dstate_setinfo("battery.charge", "%3d", bp); + /* I'm guessing this is a calibration constant of some sort. */ + dstate_setinfo("ups.temperature", "%.1f", (unsigned)(hex2d(t_value+1, 2)) * 0.3636 - 21); } /* - * - * - * - * - * - * - * - * - * - * - * - * - * - * - */ @@ -1474,32 +1232,16 @@ void upsdrv_updateinfo(void) switch(tl_model) { case TRIPP_LITE_OMNIVS: case TRIPP_LITE_OMNIVS_2001: - dstate_setinfo("output.voltage", "%.1f", - hex2d(l_value+1, 4)/240.0*input_voltage_scaled); + dstate_setinfo("output.voltage", "%.1f", hex2d(l_value+1, 4)/2.0); break; case TRIPP_LITE_SMARTPRO: - dstate_setinfo("ups.load", "%ld", hex2d(l_value+1, 2)); - break; - case TRIPP_LITE_SMART_3005: - dstate_setinfo("ups.load", "%ld", hex_or_bin2d(l_value+1, 1)); + dstate_setinfo("ups.load", "%d", hex2d(l_value+1, 2)); break; case TRIPP_LITE_SMART_0004: - dstate_setinfo("ups.load", "%ld", hex2d(l_value+1, 2)); + dstate_setinfo("ups.load", "%d", hex2d(l_value+1, 2)); dstate_setinfo("ups.debug.L","%s", hexascdump(l_value+1, 7)); break; - case TRIPP_LITE_UNKNOWN: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) -# pragma GCC diagnostic pop -#endif dstate_setinfo("ups.debug.L","%s", hexascdump(l_value+1, 7)); break; } @@ -1530,20 +1272,16 @@ void upsdrv_makevartable(void) { char msg[256]; - snprintf(msg, sizeof msg, "Set shutdown delay, in seconds (default=%d)", + snprintf(msg, sizeof msg, "Set shutdown delay, in seconds (default=%d).", DEFAULT_OFFDELAY); addvar(VAR_VALUE, "offdelay", msg); - /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ - nut_usb_addvars(); - - snprintf(msg, sizeof msg, "Minimum battery voltage, corresponding to 10%% charge (default=%.1f)", - MIN_VOLT); - addvar(VAR_VALUE, "battery_min", msg); - - snprintf(msg, sizeof msg, "Maximum battery voltage, corresponding to 100%% charge (default=%.1f)", - MAX_VOLT); - addvar(VAR_VALUE, "battery_max", msg); + /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ + addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); + addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); + addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); + addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); + addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); #if 0 snprintf(msg, sizeof msg, "Set start delay, in seconds (default=%d).", @@ -1562,12 +1300,9 @@ void upsdrv_makevartable(void) */ void upsdrv_initups(void) { - char *regex_array[7]; - char *value; + char *regex_array[6]; int r; - warn_if_bad_usb_port_filename(device_path); - /* process the UPS selection options */ regex_array[0] = NULL; /* handled by USB IDs device table */ regex_array[1] = getval("productid"); @@ -1575,7 +1310,6 @@ void upsdrv_initups(void) regex_array[3] = getval("product"); /* product string */ regex_array[4] = getval("serial"); /* probably won't see this */ regex_array[5] = getval("bus"); - regex_array[6] = getval("device"); r = USBNewRegexMatcher(®ex_matcher, regex_array, REG_ICASE | REG_EXTENDED); if (r==-1) { @@ -1588,14 +1322,14 @@ void upsdrv_initups(void) regex_matcher->next = &subdriver_matcher; /* Search for the first supported UPS matching the regular - * expression */ + * expression */ r = comm_driver->open(&udev, &curDevice, regex_matcher, NULL); if (r < 1) { fatalx(EXIT_FAILURE, "No matching USB/HID UPS found"); } hd = &curDevice; - + upslogx(1, "Detected a UPS: %s/%s", hd->Vendor ? hd->Vendor : "unknown", hd->Product ? hd->Product : "unknown"); dstate_setinfo("ups.vendorid", "%04x", hd->VendorID); @@ -1609,29 +1343,8 @@ void upsdrv_initups(void) /* link the two matchers */ reopen_matcher->next = regex_matcher; - value = getval("offdelay"); - if (value) { - int ival = atoi(value); - if (ival >= 0) { - offdelay = (unsigned int)ival; - upsdebugx(2, "Setting 'offdelay' to %u", offdelay); - } else { - upsdebugx(2, "FAILED to set 'offdelay' to %d", ival); - } - } - - value = getval("battery_min"); - if (value) { - V_interval[0] = atof(value); - upsdebugx(2, "Setting 'battery_min' to %.g", V_interval[0]); - } - - value = getval("battery_max"); - if (value) { - V_interval[1] = atof(value); - upsdebugx(2, "Setting 'battery_max' to %.g", V_interval[1]); - } - + if (getval("offdelay")) + offdelay = atoi(getval("offdelay")); #if 0 if (getval("startdelay")) startdelay = atoi(getval("startdelay")); @@ -1645,9 +1358,4 @@ void upsdrv_cleanup(void) comm_driver->close(udev); USBFreeExactMatcher(reopen_matcher); USBFreeRegexMatcher(regex_matcher); - free(curDevice.Vendor); - free(curDevice.Product); - free(curDevice.Serial); - free(curDevice.Bus); - free(curDevice.Device); } diff --git a/drivers/tripplitesu.c b/drivers/tripplitesu.c index 05e8972..d0d0563 100644 --- a/drivers/tripplitesu.c +++ b/drivers/tripplitesu.c @@ -125,7 +125,7 @@ #include "serial.h" #define DRIVER_NAME "Tripp Lite SmartOnline driver" -#define DRIVER_VERSION "0.06" +#define DRIVER_VERSION "0.03" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -215,11 +215,10 @@ static struct { #define WATCHDOG "WDG" /* poll/set */ -static ssize_t do_command(char type, const char *command, const char *parameters, char *response) +static int do_command(char type, const char *command, const char *parameters, char *response) { char buffer[SMALLBUF]; - size_t count; - ssize_t ret; + int count, ret; ser_flush_io(upsfd); @@ -235,7 +234,7 @@ static ssize_t do_command(char type, const char *command, const char *parameters return -1; } - upsdebugx(3, "do_command: %zd bytes sent [%s] -> OK", ret, buffer); + upsdebugx(3, "do_command: %d bytes sent [%s] -> OK", ret, buffer); ret = ser_get_buf_len(upsfd, (unsigned char *)buffer, 4, 3, 0); if (ret < 0) { @@ -248,7 +247,7 @@ static ssize_t do_command(char type, const char *command, const char *parameters } buffer[ret] = '\0'; - upsdebugx(3, "do_command: %zd byted read [%s]", ret, buffer); + upsdebugx(3, "do_command: %d byted read [%s]", ret, buffer); if (!strcmp(buffer, "~00D")) { @@ -263,15 +262,9 @@ static ssize_t do_command(char type, const char *command, const char *parameters } buffer[ret] = '\0'; - upsdebugx(3, "do_command: %zd bytes read [%s]", ret, buffer); + upsdebugx(3, "do_command: %d bytes read [%s]", ret, buffer); - int c = atoi(buffer); - if (c < 0) { - upsdebugx(3, "do_command: response not expected to be a negative count!"); - return -1; - } - - count = (size_t)c; + count = atoi(buffer); if (count >= MAX_RESPONSE_LENGTH) { upsdebugx(3, "do_command: response exceeds expected size!"); return -1; @@ -297,13 +290,13 @@ static ssize_t do_command(char type, const char *command, const char *parameters } response[ret] = '\0'; - upsdebugx(3, "do_command: %zd bytes read [%s]", ret, response); + upsdebugx(3, "do_command: %d bytes read [%s]", ret, response); /* Tripp Lite pads their string responses with spaces. I don't like that, so I remove them. This is safe to do with all responses for this protocol, so I just do that here. */ - str_rtrim(response, ' '); + rtrim(response, ' '); return ret; } @@ -439,7 +432,7 @@ static void set_sensitivity(const char *val) { for (i = 0; i < sizeof(sensitivity) / sizeof(sensitivity[0]); i++) { if (!strcasecmp(val, sensitivity[i].name)) { - snprintf(parm, sizeof(parm), "%u", i); + snprintf(parm, sizeof(parm), "%d", i); do_command(SET, VOLTAGE_SENSITIVITY, parm, NULL); break; } @@ -521,7 +514,7 @@ static int instcmd(const char *cmdname, const char *extra) do_command(SET, TEST, "0", NULL); return STAT_INSTCMD_HANDLED; } - upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); + upslogx(LOG_NOTICE, "instcmd: unknown command [%s]", cmdname); return STAT_INSTCMD_UNKNOWN; } @@ -555,15 +548,10 @@ static int setvar(const char *varname, const char *val) static int init_comm(void) { - size_t i, bit; + int i, bit; char response[MAX_RESPONSE_LENGTH]; ups.commands_available = 0; - /* Repeat enumerate command 2x, firmware bug on some units garbles 1st response */ - if (do_command(POLL, AVAILABLE, "", response) <= 0){ - upslogx(LOG_NOTICE, "init_comm: Initial response malformed, retrying in 300ms"); - usleep(3E5); - } if (do_command(POLL, AVAILABLE, "", response) <= 0) return 0; i = strlen(response); @@ -615,29 +603,17 @@ void upsdrv_initinfo(void) dstate_setinfo("battery.voltage.nominal", "%d", atoi(ptr)); ptr = field(response, 10); - if (ptr) { - int ipv = atoi(ptr); - if (ipv >= 0) - min_low_transfer = (unsigned int)ipv; - } + if (ptr) + min_low_transfer = atoi(ptr); ptr = field(response, 9); - if (ptr) { - int ipv = atoi(ptr); - if (ipv >= 0) - max_low_transfer = (unsigned int)ipv; - } + if (ptr) + max_low_transfer = atoi(ptr); ptr = field(response, 12); - if (ptr) { - int ipv = atoi(ptr); - if (ipv >= 0) - min_high_transfer = (unsigned int)ipv; - } + if (ptr) + min_high_transfer = atoi(ptr); ptr = field(response, 11); - if (ptr) { - int ipv = atoi(ptr); - if (ipv >= 0) - max_high_transfer = (unsigned int)ipv; - } + if (ptr) + max_high_transfer = atoi(ptr); } if (do_command(POLL, OUTLET_RELAYS, "", response) > 0) ups.outlet_banks = atoi(response); @@ -742,15 +718,15 @@ void upsdrv_updateinfo(void) ptr = field(response, 3); if (ptr) dstate_setinfo("output.voltage", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); ptr = field(response, 1); if (ptr) dstate_setinfo("output.frequency", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); ptr = field(response, 4); if (ptr) dstate_setinfo("output.current", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); low_battery = 0; if (do_command(POLL, STATUS_BATTERY, "", response) <= 0) { @@ -777,11 +753,11 @@ void upsdrv_updateinfo(void) ptr = field(response, 6); if (ptr) dstate_setinfo("battery.voltage", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); ptr = field(response, 7); if (ptr) dstate_setinfo("battery.current", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); if (low_battery) status_set("LB"); @@ -797,11 +773,11 @@ void upsdrv_updateinfo(void) ptr = field(response, 2); if (ptr) dstate_setinfo("input.voltage", "%03.1f", - (double) (atoi(ptr)) / 10.0); + (double) atoi(ptr) / 10.0); ptr = field(response, 1); if (ptr) - dstate_setinfo("input.frequency", "%03.1f", - (double) (atoi(ptr)) / 10.0); + dstate_setinfo("input.frequency", + "%03.1f", (double) atoi(ptr) / 10.0); } if (do_command(POLL, TEST_RESULT, "", response) > 0) { @@ -809,7 +785,7 @@ void upsdrv_updateinfo(void) size_t trsize; r = atoi(response); - trsize = sizeof(test_result_names) / + trsize = sizeof(test_result_names) / sizeof(test_result_names[0]); if ((r < 0) || (r >= (int) trsize)) diff --git a/drivers/upscode2.c b/drivers/upscode2.c index 50a4764..1a5a6a2 100644 --- a/drivers/upscode2.c +++ b/drivers/upscode2.c @@ -40,10 +40,11 @@ #include "serial.h" #include "timehead.h" #include "nut_stdint.h" -#include "nut_float.h" + +#include #define DRIVER_NAME "UPScode II UPS driver" -#define DRIVER_VERSION "0.90" +#define DRIVER_VERSION "0.88" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -82,7 +83,7 @@ upsdrv_info_t upsdrv_info = { typedef enum { t_ignore, /* Ignore this response */ t_value, /* Sets a NUT variable */ - t_final, /* Marks the end of UPS data for this command */ + t_final, /* Marks the end of UPS data for this command */ t_string, /* Set a NUT string variable */ t_finstr, /* Set a NUT string variable, and marks end of data */ t_setval, /* Sets a variable in the driver and possibly in NUT */ @@ -99,7 +100,7 @@ typedef struct simple_s { const char *code; type_t type; const char *desc; - uint32_t status; + int status; float *aux; struct simple_s *stats; } simple_t; @@ -126,14 +127,12 @@ static char has_uppm_p[100]; static int input_timeout_sec = INP_TIMO_SEC, + output_pace_usec = OUT_PACE_USEC, full_update_timer = FULL_UPDATE_TIMER, use_crlf = 0, use_pre_lf = 0, buffer_empty = 0; -static useconds_t - output_pace_usec = OUT_PACE_USEC; - static uint32_t status = UPSC_STAT_NOTINIT; @@ -169,287 +168,287 @@ static int /* Status codes for the STAT and STMF status responses */ static simple_t att[] = { - { "00", t_ignore, NULL, 0, NULL, NULL }, - { "AC", t_alarm, "Aux contact failure", 0, NULL, NULL }, - { "BA", t_alarm, "Batteries disconnected", 0, NULL, NULL }, - { "BC", t_alarm, "Backfeed contact failure", 0, NULL, NULL }, - { "BD", t_alarm, "Abnormal battery discharge", 0, NULL, NULL }, - { "BF", t_alarm, "Battery fuse failure", 0, NULL, NULL }, - { "BL", t_status, "Battery low limit", UPSC_STAT_LOBATT, NULL, NULL }, - { "BO", t_alarm, "Battery over voltage", 0, NULL, NULL }, - { "BP", t_alarm, "Bypass fuse failure", 0, NULL, NULL }, - { "BR", t_alarm, "Abnormal battery recharge", 0, NULL, NULL }, - { "BT", t_alarm, "Battery over temperature", 0, NULL, NULL }, - { "BX", t_alarm, "Bypass unavailable", 0, NULL, NULL }, - { "BY", t_alarm, "Battery failure", 0, NULL, NULL }, - { "CE", t_alarm, "Configuration error", 0, NULL, NULL }, - { "CM", t_alarm, "Battery converter failure", 0, NULL, NULL }, - { "CT", t_alarm, "Cabinet over temperature", 0, NULL, NULL }, - { "DO", t_alarm, "DC over voltage", 0, NULL, NULL }, - { "DU", t_alarm, "DC under voltage", 0, NULL, NULL }, - { "EP", t_alarm, "Emergency power off", 0, NULL, NULL }, - { "FF", t_alarm, "Fan failure", 0, NULL, NULL }, - { "FH", t_alarm, "Line frequency high", 0, NULL, NULL }, - { "FL", t_alarm, "Line frequency low", 0, NULL, NULL }, - { "FT", t_alarm, "Filter over temperature", 0, NULL, NULL }, - { "GF", t_alarm, "Ground failure", 0, NULL, NULL }, - { "HT", t_alarm, "Charger over temperature", 0, NULL, NULL }, - { "IB", t_alarm, "Internal data bus failure", 0, NULL, NULL }, - { "IF", t_alarm, "Inverter fuse failure", 0, NULL, NULL }, - { "IM", t_alarm, "Inverter failure", 0, NULL, NULL }, - { "IO", t_alarm, "Inverter over voltage", 0, NULL, NULL }, - { "IP", t_alarm, "Internal power supply failure", 0, NULL, NULL }, - { "IT", t_alarm, "Inverter over temperature", 0, NULL, NULL }, - { "IU", t_alarm, "Inverter under voltage", 0, NULL, NULL }, - { "IV", t_alarm, "Inverter off", 0, NULL, NULL }, - { "LR", t_alarm, "Loss of redundancy", 0, NULL, NULL }, - { "NF", t_alarm, "Neutral fault", 0, NULL, NULL }, - { "OD", t_status, "UPS not supplying load", UPSC_STAT_OFF, NULL, NULL }, - { "OF", t_alarm, "Oscillator failure", 0, NULL, NULL }, - { "OL", t_status, "Overload", UPSC_STAT_OVERLOAD, NULL, NULL }, - { "OR", t_alarm, "Redundancy overload", 0, NULL, NULL }, - { "OV", t_alarm, "Abnormal output voltage", 0, NULL, NULL }, - { "OW", t_alarm, "Output failure", 0, NULL, NULL }, - { "PB", t_alarm, "Parallel bus failure", 0, NULL, NULL }, - { "PE", t_alarm, "Phase rotation error", 0, NULL, NULL }, - { "RE", t_alarm, "Rectifier off", 0, NULL, NULL }, - { "RF", t_alarm, "Rectifier fuse failure", 0, NULL, NULL }, - { "RM", t_alarm, "Rectifier failure", 0, NULL, NULL }, - { "RT", t_alarm, "Rectifier over temperature", 0, NULL, NULL }, - { "SM", t_alarm, "Static switch failure", 0, NULL, NULL }, - { "ST", t_alarm, "Static switch over temperature", 0, NULL, NULL }, - { "TT", t_alarm, "Trafo over temperature", 0, NULL, NULL }, - { "UD", t_alarm, "UPS disabled", 0, NULL, NULL }, - { "UO", t_alarm, "Utility over voltage", 0, NULL, NULL }, - { "US", t_alarm, "Unsynchronized", 0, NULL, NULL }, - { "UU", t_alarm, "Utility under voltage", 0, NULL, NULL }, - { "VE", t_alarm, "internal voltage error", 0, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "00", t_ignore }, + { "AC", t_alarm, "Aux contact failure", 0 }, + { "BA", t_alarm, "Batteries disconnected", 0 }, + { "BC", t_alarm, "Backfeed contact failure", 0 }, + { "BD", t_alarm, "Abnormal battery discharge", 0 }, + { "BF", t_alarm, "Battery fuse failure", 0 }, + { "BL", t_status, "Battery low limit", UPSC_STAT_LOBATT }, + { "BO", t_alarm, "Battery over voltage", 0 }, + { "BP", t_alarm, "Bypass fuse failure", 0 }, + { "BR", t_alarm, "Abnormal battery recharge", 0 }, + { "BT", t_alarm, "Battery over temperature", 0 }, + { "BX", t_alarm, "Bypass unavailable", 0 }, + { "BY", t_alarm, "Battery failure", 0 }, + { "CE", t_alarm, "Configuration error", 0 }, + { "CM", t_alarm, "Battery converter failure", 0 }, + { "CT", t_alarm, "Cabinet over temperature", 0 }, + { "DO", t_alarm, "DC over voltage", 0 }, + { "DU", t_alarm, "DC under voltage", 0 }, + { "EP", t_alarm, "Emergency power off", 0 }, + { "FF", t_alarm, "Fan failure", 0 }, + { "FH", t_alarm, "Line frequency high", 0 }, + { "FL", t_alarm, "Line frequency low", 0 }, + { "FT", t_alarm, "Filter over temperature", 0 }, + { "GF", t_alarm, "Ground failure", 0 }, + { "HT", t_alarm, "Charger over temperature", 0 }, + { "IB", t_alarm, "Internal data bus failure", 0 }, + { "IF", t_alarm, "Inverter fuse failure", 0 }, + { "IM", t_alarm, "Inverter failure", 0 }, + { "IO", t_alarm, "Inverter over voltage", 0 }, + { "IP", t_alarm, "Internal power supply failure", 0 }, + { "IT", t_alarm, "Inverter over temperature", 0 }, + { "IU", t_alarm, "Inverter under voltage", 0 }, + { "IV", t_alarm, "Inverter off", 0 }, + { "LR", t_alarm, "Loss of redundancy", 0 }, + { "NF", t_alarm, "Neutral fault", 0 }, + { "OD", t_status, "UPS not supplying load", UPSC_STAT_OFF }, + { "OF", t_alarm, "Oscillator failure", 0 }, + { "OL", t_status, "Overload", UPSC_STAT_OVERLOAD }, + { "OR", t_alarm, "Redundancy overload", 0 }, + { "OV", t_alarm, "Abnormal output voltage", 0 }, + { "OW", t_alarm, "Output failure", 0 }, + { "PB", t_alarm, "Parallel bus failure", 0 }, + { "PE", t_alarm, "Phase rotation error", 0 }, + { "RE", t_alarm, "Rectifier off", 0 }, + { "RF", t_alarm, "Rectifier fuse failure", 0 }, + { "RM", t_alarm, "Rectifier failure", 0 }, + { "RT", t_alarm, "Rectifier over temperature", 0 }, + { "SM", t_alarm, "Static switch failure", 0 }, + { "ST", t_alarm, "Static switch over temperature", 0 }, + { "TT", t_alarm, "Trafo over temperature", 0 }, + { "UD", t_alarm, "UPS disabled", 0 }, + { "UO", t_alarm, "Utility over voltage", 0 }, + { "US", t_alarm, "Unsynchronized", 0 }, + { "UU", t_alarm, "Utility under voltage", 0 }, + { "VE", t_alarm, "internal voltage error", 0 }, + { NULL } }; /* Status code for the STLR response */ static simple_t stlr[] = { - { "NO", t_ignore, NULL, 0, NULL, NULL }, - { "SD", t_status, NULL, UPSC_STAT_TRIM, NULL, NULL }, - { "SU", t_status, NULL, UPSC_STAT_BOOST, NULL, NULL }, - { "DU", t_status, NULL, UPSC_STAT_BOOST, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "NO", t_ignore }, + { "SD", t_status, NULL, UPSC_STAT_TRIM }, + { "SU", t_status, NULL, UPSC_STAT_BOOST }, + { "DU", t_status, NULL, UPSC_STAT_BOOST }, + { NULL } }; /* Status code for the STEA and STEM responses */ static simple_t env[] = { - { "HH", t_ignore, "Humidity high", 0, NULL, NULL }, - { "HL", t_ignore, "Humidity low", 0, NULL, NULL }, - { "TH", t_ignore, "Temperature high", 0, NULL, NULL }, - { "TL", t_ignore, "Temperature low", 0, NULL, NULL }, - { "01", t_ignore, "Environment alarm 1", 0, NULL, NULL }, - { "02", t_ignore, "Environment alarm 2", 0, NULL, NULL }, - { "03", t_ignore, "Environment alarm 3", 0, NULL, NULL }, - { "04", t_ignore, "Environment alarm 4", 0, NULL, NULL }, - { "05", t_ignore, "Environment alarm 5", 0, NULL, NULL }, - { "06", t_ignore, "Environment alarm 6", 0, NULL, NULL }, - { "07", t_ignore, "Environment alarm 7", 0, NULL, NULL }, - { "08", t_ignore, "Environment alarm 8", 0, NULL, NULL }, - { "09", t_ignore, "Environment alarm 9", 0, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "HH", t_ignore, "Humidity high", 0 }, + { "HL", t_ignore, "Humidity low", 0 }, + { "TH", t_ignore, "Temperature high", 0 }, + { "TL", t_ignore, "Temperature low", 0 }, + { "01", t_ignore, "Environment alarm 1", 0 }, + { "02", t_ignore, "Environment alarm 2", 0 }, + { "03", t_ignore, "Environment alarm 3", 0 }, + { "04", t_ignore, "Environment alarm 4", 0 }, + { "05", t_ignore, "Environment alarm 5", 0 }, + { "06", t_ignore, "Environment alarm 6", 0 }, + { "07", t_ignore, "Environment alarm 7", 0 }, + { "08", t_ignore, "Environment alarm 8", 0 }, + { "09", t_ignore, "Environment alarm 9", 0 }, + { NULL } }; /* Responses for UPSS and UPDS */ static simple_t simple[] = { - { "STAT", t_list, NULL, 0, NULL, att }, - { "STBO", t_status, NULL, UPSC_STAT_ONBATT, NULL, NULL }, - { "STBL", t_status, NULL, UPSC_STAT_LOBATT, NULL, NULL }, - { "STBM", t_ignore, NULL, 0, NULL, NULL }, - { "STBP", t_status, NULL, UPSC_STAT_BYPASS, NULL, NULL }, - { "STEA", t_list, NULL, 0, NULL, env }, - { "STEM", t_list, NULL, 0, NULL, env }, - { "STLR", t_list, NULL, 0, NULL, stlr }, - { "STMF", t_list, NULL, 0, NULL, att }, - { "STOK", t_ignore, NULL, 0, NULL, NULL }, - { "STUF", t_status, NULL, UPSC_STAT_ONBATT, NULL, NULL }, + { "STAT", t_list, NULL, 0, 0, att }, + { "STBO", t_status, NULL, UPSC_STAT_ONBATT }, + { "STBL", t_status, NULL, UPSC_STAT_LOBATT }, + { "STBM", t_ignore }, + { "STBP", t_status, NULL, UPSC_STAT_BYPASS }, + { "STEA", t_list, NULL, 0, 0, env }, + { "STEM", t_list, NULL, 0, 0, env }, + { "STLR", t_list, NULL, 0, 0, stlr }, + { "STMF", t_list, NULL, 0, 0, att }, + { "STOK", t_ignore }, + { "STUF", t_status, NULL, UPSC_STAT_ONBATT }, - { "BTIME", t_setval, NULL, 0, &batt_runtime, NULL }, + { "BTIME", t_setval, NULL, 0, &batt_runtime }, - { "METE1", t_value, "ambient.temperature", 0, NULL, NULL }, - { "MERH1", t_value, "ambient.humidity", 0, NULL, NULL }, + { "METE1", t_value, "ambient.temperature" }, + { "MERH1", t_value, "ambient.humidity" }, - { "MIFFF", t_value, "input.frequency", 0, NULL, NULL }, - { "MIIL1", t_value, "input.current", 0, NULL, NULL }, - { "MIIL2", t_value, "input.L2.current", 0, NULL, NULL }, - { "MIIL3", t_value, "input.L3.current", 0, NULL, NULL }, - { "MIPL1", t_value, "input.realpower", 0, NULL, NULL }, - { "MIPL2", t_value, "input.L2.realpower", 0, NULL, NULL }, - { "MIPL3", t_value, "input.L3.realpower", 0, NULL, NULL }, - { "MISL1", t_value, "input.power", 0, NULL, NULL }, - { "MISL2", t_value, "input.L2.power", 0, NULL, NULL }, - { "MISL3", t_value, "input.L3.power", 0, NULL, NULL }, - { "MIUL1", t_value, "input.voltage", 0, NULL, NULL }, - { "MIUL2", t_value, "input.L2-N.voltage", 0, NULL, NULL }, - { "MIUL3", t_value, "input.L3-N.voltage", 0, NULL, NULL }, - { "MIU12", t_value, "input.L1-L2.voltage", 0, NULL, NULL }, - { "MIU23", t_value, "input.L2-L3.voltage", 0, NULL, NULL }, - { "MIU31", t_value, "input.L3-L1.voltage", 0, NULL, NULL }, + { "MIFFF", t_value, "input.frequency" }, + { "MIIL1", t_value, "input.current" }, + { "MIIL2", t_value, "input.L2.current" }, + { "MIIL3", t_value, "input.L3.current" }, + { "MIPL1", t_value, "input.realpower" }, + { "MIPL2", t_value, "input.L2.realpower" }, + { "MIPL3", t_value, "input.L3.realpower" }, + { "MISL1", t_value, "input.power" }, + { "MISL2", t_value, "input.L2.power" }, + { "MISL3", t_value, "input.L3.power" }, + { "MIUL1", t_value, "input.voltage" }, + { "MIUL2", t_value, "input.L2-N.voltage" }, + { "MIUL3", t_value, "input.L3-N.voltage" }, + { "MIU12", t_value, "input.L1-L2.voltage" }, + { "MIU23", t_value, "input.L2-L3.voltage" }, + { "MIU31", t_value, "input.L3-L1.voltage" }, - { "MBCH1", t_setval, NULL, 0, &batt_charge, NULL }, /* battery.charge */ - { "MBIII", t_setval, "battery.current", 0, &batt_current, NULL }, - { "MBINE", t_ignore, /* "battery.current.negative" */ NULL, 0, NULL, NULL }, - { "MBIPO", t_ignore, /* "battery.current.positive" */ NULL, 0, NULL, NULL }, - { "MBUNE", t_ignore, /* "battery.voltage.negative" */ NULL, 0, NULL, NULL }, - { "MBUPO", t_ignore, /* "battery.voltage.positive" */ NULL, 0, NULL, NULL }, - { "MBUUU", t_setval, "battery.voltage", 0, &batt_volt, NULL }, + { "MBCH1", t_setval, NULL, 0, &batt_charge }, /* battery.charge */ + { "MBIII", t_setval, "battery.current", 0, &batt_current }, + { "MBINE", t_ignore, /* "battery.current.negative" */ }, + { "MBIPO", t_ignore, /* "battery.current.positive" */ }, + { "MBUNE", t_ignore, /* "battery.voltage.negative" */ }, + { "MBUPO", t_ignore, /* "battery.voltage.positive" */}, + { "MBUUU", t_setval, "battery.voltage", 0, &batt_volt }, - { "MLUNE", t_ignore, /* "dc.voltage.negative" */ NULL, 0, NULL, NULL }, - { "MLUPO", t_ignore, /* "dc.voltage.positive" */ NULL, 0, NULL, NULL }, - { "MLUUU", t_ignore, /* "dc.voltage" */ NULL, 0, NULL, NULL }, + { "MLUNE", t_ignore, /* "dc.voltage.negative" */ }, + { "MLUPO", t_ignore, /* "dc.voltage.positive" */ }, + { "MLUUU", t_ignore, /* "dc.voltage" */ }, - { "MOFFF", t_final, "output.frequency", 0, NULL, NULL }, - { "MOIL1", t_value, "output.current", 0, NULL, NULL }, - { "MOIL2", t_value, "output.L2.current", 0, NULL, NULL }, - { "MOIL3", t_value, "output.L3.current", 0, NULL, NULL }, - { "MOIP1", t_value, "output.current.peak", 0, NULL, NULL }, - { "MOIP2", t_value, "output.L2.current.peak", 0, NULL, NULL }, - { "MOIP3", t_value, "output.L3.current.peak", 0, NULL, NULL }, - { "MOPL1", t_value, "output.realpower", 0, &kilo_to_unity, NULL }, - { "MOPL2", t_value, "output.L2.realpower", 0, &kilo_to_unity, NULL }, - { "MOPL3", t_value, "output.L3.realpower", 0, &kilo_to_unity, NULL }, - { "MOSL1", t_value, "output.power", 0, NULL, NULL }, - { "MOSL2", t_value, "output.L2.power", 0, NULL, NULL }, - { "MOSL3", t_value, "output.L3.power", 0, NULL, NULL }, - { "MOUL1", t_value, "output.voltage", 0, NULL, NULL }, - { "MOUL2", t_value, "output.L2-N.voltage", 0, NULL, NULL }, - { "MOUL3", t_value, "output.L3-N.voltage", 0, NULL, NULL }, - { "MOU12", t_value, "output.L1-L2.voltage", 0, NULL, NULL }, - { "MOU23", t_value, "output.L2-L3.voltage", 0, NULL, NULL }, - { "MOU31", t_value, "output.L3-L1.voltage", 0, NULL, NULL }, + { "MOFFF", t_final, "output.frequency" }, + { "MOIL1", t_value, "output.current" }, + { "MOIL2", t_value, "output.L2.current" }, + { "MOIL3", t_value, "output.L3.current" }, + { "MOIP1", t_value, "output.current.peak" }, + { "MOIP2", t_value, "output.L2.current.peak" }, + { "MOIP3", t_value, "output.L3.current.peak" }, + { "MOPL1", t_value, "output.realpower", 0, &kilo_to_unity }, + { "MOPL2", t_value, "output.L2.realpower", 0, &kilo_to_unity }, + { "MOPL3", t_value, "output.L3.realpower", 0, &kilo_to_unity }, + { "MOSL1", t_value, "output.power" }, + { "MOSL2", t_value, "output.L2.power" }, + { "MOSL3", t_value, "output.L3.power" }, + { "MOUL1", t_value, "output.voltage" }, + { "MOUL2", t_value, "output.L2-N.voltage" }, + { "MOUL3", t_value, "output.L3-N.voltage" }, + { "MOU12", t_value, "output.L1-L2.voltage" }, + { "MOU23", t_value, "output.L2-L3.voltage" }, + { "MOU31", t_value, "output.L3-L1.voltage" }, - { "MPUL1", t_value, "input.bypass.L1-N.voltage", 0, NULL, NULL }, - { "MPUL2", t_value, "input.bypass.L2-N.voltage", 0, NULL, NULL }, - { "MPUL3", t_value, "input.bypass.L3-N.voltage", 0, NULL, NULL }, + { "MPUL1", t_value, "input.bypass.L1-N.voltage" }, + { "MPUL2", t_value, "input.bypass.L2-N.voltage" }, + { "MPUL3", t_value, "input.bypass.L3-N.voltage" }, - { "MUTE1", t_value, "ups.temperature", 0, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "MUTE1", t_value, "ups.temperature" }, + { NULL } }; /* Responses for UPDV */ static simple_t nominal[] = { - { "NIUHH", t_value, "input.voltage.maximum", 0, NULL, NULL }, - { "NIULL", t_value, "input.voltage.minimum", 0, NULL, NULL }, - { "NIUNN", t_value, "input.voltage.nominal", 0, NULL, NULL }, + { "NIUHH", t_value, "input.voltage.maximum" }, + { "NIULL", t_value, "input.voltage.minimum" }, + { "NIUNN", t_value, "input.voltage.nominal" }, - { "NIIHH", t_value, "input.current.maximum", 0, NULL, NULL }, - { "NIILL", t_value, "input.current.minimum", 0, NULL, NULL }, - { "NIINN", t_value, "input.current.nominal", 0, NULL, NULL }, + { "NIIHH", t_value, "input.current.maximum" }, + { "NIILL", t_value, "input.current.minimum" }, + { "NIINN", t_value, "input.current.nominal" }, - { "NIPHH", t_value, "input.realpower.maximum", 0, NULL, NULL }, - { "NIPNN", t_value, "input.realpower.nominal", 0, NULL, NULL }, + { "NIPHH", t_value, "input.realpower.maximum" }, + { "NIPNN", t_value, "input.realpower.nominal" }, - { "NISHH", t_value, "input.power.maximum", 0, NULL, NULL }, - { "NISNN", t_value, "input.power.nominal", 0, NULL, NULL }, + { "NISHH", t_value, "input.power.maximum" }, + { "NISNN", t_value, "input.power.nominal" }, - { "NBAHN", t_setval, "battery.capacity.nominal", 0, &batt_cap_nom, NULL }, - { "NBIHH", t_ignore, "battery charge current maximum", 0, NULL, NULL }, - { "NBILL", t_setval, NULL, 0, &batt_disch_curr_max, NULL }, - { "NBINN", t_value, "battery.current.nominal", 0, NULL, NULL }, - { "NBTHH", t_setval, NULL, 0, &batt_runtime_max, NULL }, - { "NBUHH", t_setval, "battery.voltage.maximum", 0, &batt_volt_high, NULL }, - { "NBULL", t_setval, "battery.voltage.minimum", 0, &batt_volt_low, NULL }, - { "NBUNN", t_setval, "battery.voltage.nominal", 0, &batt_volt_nom, NULL }, + { "NBAHN", t_setval, "battery.capacity.nominal", 0, &batt_cap_nom }, + { "NBIHH", t_ignore, "battery charge current maximum" }, + { "NBILL", t_setval, NULL, 0, &batt_disch_curr_max}, + { "NBINN", t_value, "battery.current.nominal" }, + { "NBTHH", t_setval, NULL, 0, &batt_runtime_max}, + { "NBUHH", t_setval, "battery.voltage.maximum", 0, &batt_volt_high }, + { "NBULL", t_setval, "battery.voltage.minimum", 0, &batt_volt_low }, + { "NBUNN", t_setval, "battery.voltage.nominal", 0, &batt_volt_nom }, - { "NOFHH", t_value, "output.frequency.maximum", 0, NULL, NULL }, - { "NOFLL", t_final, "output.frequency.minimum", 0, NULL, NULL }, - { "NOIHH", t_setval, "output.current.maximum", 0, &max_out_current, NULL }, - { "NOINN", t_setval, "output.current.nominal", 0, &nom_out_current, NULL }, - { "NOPNN", t_value, "output.realpower.nominal", 0, &outpwr_factor, NULL }, - { "NOSNN", t_value, "ups.power.nominal", 0, &outpwr_factor, NULL }, - { "NOUHH", t_value, "output.voltage.maximum", 0, NULL, NULL }, - { "NOULL", t_value, "output.voltage.minimum", 0, NULL, NULL }, - { "NOUNN", t_value, "output.voltage.nominal", 0, NULL, NULL }, + { "NOFHH", t_value, "output.frequency.maximum" }, + { "NOFLL", t_final, "output.frequency.minimum" }, + { "NOIHH", t_setval, "output.current.maximum", 0, &max_out_current }, + { "NOINN", t_setval, "output.current.nominal", 0, &nom_out_current }, + { "NOPNN", t_value, "output.realpower.nominal", 0, &outpwr_factor }, + { "NOSNN", t_value, "ups.power.nominal", 0, &outpwr_factor }, + { "NOUHH", t_value, "output.voltage.maximum" }, + { "NOULL", t_value, "output.voltage.minimum" }, + { "NOUNN", t_value, "output.voltage.nominal" }, - { "NUTEH", t_value, "ups.temperature.maximum", 0, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "NUTEH", t_value, "ups.temperature.maximum" }, + { NULL } }; /* Status responses for UPBS command */ static simple_t battery[] = { - { "MBTE1", t_value, "battery.1.temperature", 0, NULL, NULL }, - { "MBIN1", t_ignore, NULL /* aging index */, 0, NULL, NULL }, - { "BDAT1", t_string, "battery.1.date", 0, NULL, NULL }, - { "MBTE2", t_value, "battery.2.temperature.2", 0, NULL, NULL }, - { "MBIN2", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT2", t_string, "battery.2.date", 0, NULL, NULL }, - { "MBTE3", t_value, "battery.3.temperature", 0, NULL, NULL }, - { "MBIN3", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT3", t_string, "battery.3.date", 0, NULL, NULL }, - { "MBTE4", t_value, "battery.4.temperature", 0, NULL, NULL }, - { "MBIN4", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT4", t_string, "battery.4.date", 0, NULL, NULL }, - { "MBTE5", t_value, "battery.5.temperature", 0, NULL, NULL }, - { "MBIN5", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT5", t_string, "battery.5.date", 0, NULL, NULL }, - { "MBTE6", t_value, "battery.6.temperature", 0, NULL, NULL }, - { "MBIN6", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT6", t_string, "battery.6.date", 0, NULL, NULL }, - { "MBTE7", t_value, "battery.7.temperature", 0, NULL, NULL }, - { "MBIN7", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT7", t_string, "battery.7.date", 0, NULL, NULL }, - { "MBTE8", t_value, "battery.8.temperature", 0, NULL, NULL }, - { "MBIN8", t_ignore, NULL, 0, NULL, NULL }, - { "BDAT8", t_finstr, "battery.8.date", 0, NULL, NULL }, - { NULL, t_ignore, NULL, 0, NULL, NULL } + { "MBTE1", t_value, "battery.1.temperature" }, + { "MBIN1", t_ignore, NULL /* aging index */ }, + { "BDAT1", t_string, "battery.1.date" }, + { "MBTE2", t_value, "battery.2.temperature.2" }, + { "MBIN2", t_ignore, NULL }, + { "BDAT2", t_string, "battery.2.date" }, + { "MBTE3", t_value, "battery.3.temperature" }, + { "MBIN3", t_ignore, NULL }, + { "BDAT3", t_string, "battery.3.date" }, + { "MBTE4", t_value, "battery.4.temperature" }, + { "MBIN4", t_ignore, NULL }, + { "BDAT4", t_string, "battery.4.date" }, + { "MBTE5", t_value, "battery.5.temperature" }, + { "MBIN5", t_ignore, NULL }, + { "BDAT5", t_string, "battery.5.date" }, + { "MBTE6", t_value, "battery.6.temperature" }, + { "MBIN6", t_ignore, NULL }, + { "BDAT6", t_string, "battery.6.date" }, + { "MBTE7", t_value, "battery.7.temperature" }, + { "MBIN7", t_ignore, NULL }, + { "BDAT7", t_string, "battery.7.date" }, + { "MBTE8", t_value, "battery.8.temperature" }, + { "MBIN8", t_ignore, NULL }, + { "BDAT8", t_finstr, "battery.8.date" }, + { NULL } }; static cmd_t commands[] = { - { "load.off", NULL, NULL, 0 }, - { "load.on", NULL, NULL, 0 }, - { "shutdown.return", "UPPF", "IJHLDMGCIU", 0 }, - { "shutdown.stayoff", "UPPD", "LGGNLMDPGV", 0 }, - { "shutdown.stop", "UPPU", NULL, 0 }, - { "shutdown.reboot", "UPPC", "IJHLDMGCIU", 0 }, - { "shutdown.reboot.graceful", NULL, NULL, 0 }, - { "test.panel.start", "UPIS", NULL, 0 }, - { "test.panel.stop", NULL, NULL, 0 }, - { "test.failure.start", NULL, NULL, 0 }, - { "test.failure.stop", NULL, NULL, 0 }, - { "test.battery.start", "UPBT", "1", 0 }, - { "test.battery.stop", NULL, NULL, 0 }, - { "calibrate.start", NULL, NULL, 0 }, - { "calibrate.stop", NULL, NULL, 0 }, - { "bypass.start", NULL, NULL, 0 }, - { "bypass.stop", NULL, NULL, 0 }, - { "reset.input.minmax", NULL, NULL, 0 }, - { "reset.watchdog", NULL, NULL, 0 }, - { "beeper.enable", NULL, NULL, 0 }, - { "beeper.disable", NULL, NULL, 0 }, - { "beeper.on", NULL, NULL, 0 }, - { "beeper.off", NULL, NULL, 0 }, - { NULL, NULL, NULL, 0 } + { "load.off", NULL, NULL }, + { "load.on", NULL, NULL }, + { "shutdown.return", "UPPF", "IJHLDMGCIU" }, + { "shutdown.stayoff", "UPPD", "LGGNLMDPGV" }, + { "shutdown.stop", "UPPU", NULL }, + { "shutdown.reboot", "UPPC", "IJHLDMGCIU" }, + { "shutdown.reboot.graceful", NULL, NULL }, + { "test.panel.start", "UPIS", NULL }, + { "test.panel.stop", NULL, NULL }, + { "test.failure.start", NULL, NULL }, + { "test.failure.stop", NULL, NULL }, + { "test.battery.start", "UPBT", "1" }, + { "test.battery.stop", NULL, NULL }, + { "calibrate.start", NULL, NULL }, + { "calibrate.stop", NULL, NULL }, + { "bypass.start", NULL, NULL }, + { "bypass.stop", NULL, NULL }, + { "reset.input.minmax", NULL, NULL }, + { "reset.watchdog", NULL, NULL }, + { "beeper.enable", NULL, NULL }, + { "beeper.disable", NULL, NULL }, + { "beeper.on", NULL, NULL }, + { "beeper.off", NULL, NULL }, + { NULL } }; static cmd_t variables[] = { - { "ups.delay.reboot", "UPCD", "ACCD", 0 }, - { "ups.delay.shutdown", "UPSD", "ACSD", 0 }, - { NULL, NULL, NULL, 0 } + { "ups.delay.reboot", "UPCD", "ACCD" }, + { "ups.delay.shutdown", "UPSD", "ACSD" }, + { NULL } }; static int instcmd (const char *auxcmd, const char *data); static int setvar (const char *var, const char *data); -static void upsc_setstatus(unsigned int upsc_status); +static void upsc_setstatus(unsigned int status); static void upsc_flush_input(void); static void upsc_getbaseinfo(void); static int upsc_commandlist(void); static int upsc_getparams(const char *cmd, const simple_t *table); static int upsc_getvalue(const char *cmd, const char *param, const char *resp, const char *var, char *ret); -static ssize_t upscsend(const char *cmd); -static ssize_t upscrecv(char *buf); +static int upscsend(const char *cmd); +static int upscrecv(char *buf); static int upsc_simple(const simple_t *sp, const char *var, const char *val); static void check_uppm(void); static float batt_charge_pct(void); @@ -464,7 +463,7 @@ void upsdrv_help(void) void upsdrv_initups(void) { struct termios tio; - speed_t baud = B1200; + int baud = B1200; char *str; if ((str = getval("baudrate")) != NULL) { @@ -511,13 +510,12 @@ void upsdrv_initups(void) upsdebugx(1, "input_timeout = %d Sec", input_timeout_sec); if ((str = getval("output_pace")) != NULL) { - /* Range should be at least up to 1000000; a C99+ long guarantees that */ - long temp = atol(str); + int temp = atoi(str); if (temp <= 0) fatalx(EXIT_FAILURE, "Bad output_pace parameter: %s", str); - output_pace_usec = (useconds_t)temp; + output_pace_usec = temp; } - upsdebugx(1, "output_pace = %ju uSec", (uintmax_t)output_pace_usec); + upsdebugx(1, "output_pace = %d uSec", output_pace_usec); if ((str = getval("full_update_timer")) != NULL) { int temp = atoi(str); @@ -839,8 +837,8 @@ void upsdrv_updateinfo(void) if (batt_runtime >= 0 && batt_runtime < 9999) { dstate_setinfo("battery.runtime", "%.0f", batt_runtime*60); } - else if (load > 0 && ! f_equal(batt_disch_curr_max, 0)) { - float est_battcurr = load * fabs(batt_disch_curr_max); + else if (load > 0 && batt_disch_curr_max != 0) { + float est_battcurr = load * abs(batt_disch_curr_max); /* Peukert equation */ float runtime = (batt_cap_nom*3600)/pow(est_battcurr, 1.35); @@ -965,10 +963,8 @@ void upsdrv_cleanup(void) /* * Generate status string from bitfield */ -static void upsc_setstatus(unsigned int upsc_status) +static void upsc_setstatus(unsigned int status) { - /* Save into global state variable for the driver instance */ - status = upsc_status; /* * I'll look for all available statuses, even though they might not be @@ -1004,9 +1000,9 @@ static void upsc_setstatus(unsigned int upsc_status) /* Add \r to end of command and send to UPS */ /* returns < 0 on errors, 0 on timeout and > 0 on success. */ -static ssize_t upscsend(const char *cmd) +static int upscsend(const char *cmd) { - ssize_t res; + int res; res = ser_send_pace(upsfd, output_pace_usec, "%s%s%s", use_pre_lf ? "\n" : "", @@ -1027,9 +1023,9 @@ static ssize_t upscsend(const char *cmd) /* Return a string read from UPS */ /* returns < 0 on errors, 0 on timeout and > 0 on success. */ -static ssize_t upscrecv(char *buf) +static int upscrecv(char *buf) { - ssize_t res; + int res; /* NOTE: the serial port is set to use Canonical Mode Input Processing, which means ser_get_buf() either returns one line terminated with @@ -1050,7 +1046,7 @@ static ssize_t upscrecv(char *buf) } else if (res == 0) { upsdebugx(3, "upscrecv: Timeout"); } else { - upsdebugx(3, "upscrecv: %zd bytes:\t'%s'", res-1, str_rtrim(buf, ENDCHAR)); + upsdebugx(3, "upscrecv: %u bytes:\t'%s'", res-1, rtrim(buf, ENDCHAR)); } return res; @@ -1189,19 +1185,19 @@ static void check_uppm(void) if (strcmp(var, "ACPM")) upslogx(LOG_ERR, "Bad response to UPPM: %s", var); while (1) { - int intval, stat; + int val, stat; upscrecv(var); if (strlen(var) == 0) break; upsdebugx(2, "UPPM available: %s", var); - stat = sscanf(var, "P%2d", &intval); + stat = sscanf(var, "P%2d", &val); if (stat != 1) { upslogx(LOG_ERR, "Bad response to UPPM: %s", var); return; } - has_uppm_p[intval] = 1; - if (intval > last) - last = intval; + has_uppm_p[val] = 1; + if (val > last) + last = val; } for (i = 0; i <= last; i++) { @@ -1304,10 +1300,7 @@ static int upsc_simple(const simple_t *sp, const char *var, const char *val) break; case t_final: buffer_empty = 1; - /* FIXME? Should this really fall through, or should break? */ - goto fallthrough_bufempty_processing_1; case t_value: - fallthrough_bufempty_processing_1: if (!sp->desc) { break; } @@ -1324,10 +1317,7 @@ static int upsc_simple(const simple_t *sp, const char *var, const char *val) break; case t_finstr: buffer_empty = 1; - /* FIXME? Should this really fall through, or should break? */ - goto fallthrough_bufempty_processing_2; case t_string: - fallthrough_bufempty_processing_2: if (!sp->desc) { break; } @@ -1357,36 +1347,9 @@ static int upsc_simple(const simple_t *sp, const char *var, const char *val) upslogx(LOG_ERR, "Unknown value: %s %s", var, val); break; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#pragma clang diagnostic ignored "-Wcovered-switch-default" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: upslogx(LOG_ERR, "Unknown type for %s", var); break; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } return 1; } diff --git a/drivers/upsdrvctl.c b/drivers/upsdrvctl.c index a33fcd1..623f753 100644 --- a/drivers/upsdrvctl.c +++ b/drivers/upsdrvctl.c @@ -17,8 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -26,11 +24,10 @@ #include #include +#include "config.h" #include "proto.h" #include "common.h" #include "upsconf.h" -#include "attribute.h" -#include "nut_stdint.h" typedef struct { char *upsname; @@ -45,27 +42,15 @@ static ups_t *upstable = NULL; static int maxsdorder = 0, testmode = 0, exec_error = 0; - /* Should we wait for driver (1) or "parallelize" drivers start (0) */ -static int waitfordrivers = 1; - /* timer - keeps us from getting stuck if a driver hangs */ static int maxstartdelay = 45; - /* counter - retry that many time(s) to start the driver if it fails to */ -static int maxretry = 1; - - /* timer - delay between each restart attempt of the driver(s) */ -static int retrydelay = 5; - /* Directory where driver executables live */ static char *driverpath = NULL; /* passthrough to the drivers: chroot path and new user name */ static char *pt_root = NULL, *pt_user = NULL; - /* flag to pass nut_debug_level to launched drivers (as their -D... args) */ -static int nut_debug_level_passthrough = 0; - void do_upsconf_args(char *upsname, char *var, char *val) { ups_t *tmp, *last; @@ -80,15 +65,6 @@ void do_upsconf_args(char *upsname, char *var, char *val) driverpath = xstrdup(val); } - if (!strcmp(var, "maxretry")) - maxretry = atoi(val); - - if (!strcmp(var, "retrydelay")) - retrydelay = atoi(val); - - if (!strcmp(var, "nowait")) - waitfordrivers = 0; - /* ignore anything else - it's probably for main */ return; @@ -156,14 +132,13 @@ static void stop_driver(const ups_t *ups) ret = stat(pidfn, &fs); if ((ret != 0) && (ups->port != NULL)) { - upslog_with_errno(LOG_ERR, "Can't open %s", pidfn); snprintf(pidfn, sizeof(pidfn), "%s/%s-%s.pid", altpidpath(), ups->driver, xbasename(ups->port)); ret = stat(pidfn, &fs); } if (ret != 0) { - upslog_with_errno(LOG_ERR, "Can't open %s either", pidfn); + upslog_with_errno(LOG_ERR, "Can't open %s", pidfn); exec_error++; return; } @@ -184,8 +159,6 @@ static void stop_driver(const ups_t *ups) static void waitpid_timeout(const int sig) { - NUT_UNUSED_VARIABLE(sig); - /* do nothing */ return; } @@ -218,25 +191,15 @@ static void forkexec(char *const argv[], const ups_t *ups) int wstat; struct sigaction sa; - /* Handle "parallel" drivers startup */ - if (waitfordrivers == 0) { - upsdebugx(2, "'nowait' set, continuing..."); - return; - } - sigemptyset(&sa.sa_mask); sa.sa_flags = 0; sa.sa_handler = waitpid_timeout; sigaction(SIGALRM, &sa, NULL); - /* Use the local maxstartdelay, if available */ - if (ups->maxstartdelay != -1) { - if (ups->maxstartdelay >= 0) - alarm((unsigned int)ups->maxstartdelay); - } else { /* Otherwise, use the global (or default) value */ - if (maxstartdelay >= 0) - alarm((unsigned int)maxstartdelay); - } + if (ups->maxstartdelay != -1) + alarm(ups->maxstartdelay); + else + alarm(maxstartdelay); ret = waitpid(pid, &wstat, 0); @@ -282,10 +245,9 @@ static void forkexec(char *const argv[], const ups_t *ups) static void start_driver(const ups_t *ups) { - char *argv[9]; - char dfn[SMALLBUF], dbg[SMALLBUF]; + char *argv[8]; + char dfn[SMALLBUF]; int ret, arg = 0; - int initial_exec_error = exec_error, drv_maxretry = maxretry; struct stat fs; upsdebugx(1, "Starting UPS: %s", ups->upsname); @@ -297,63 +259,6 @@ static void start_driver(const ups_t *ups) fatal_with_errno(EXIT_FAILURE, "Can't start %s", dfn); argv[arg++] = dfn; - - if (nut_debug_level_passthrough > 0 - && nut_debug_level > 0 - && sizeof(dbg) > 3 - ) { - size_t d, m; - - /* cut-off point: buffer size or requested debug level */ - m = sizeof(dbg) - 1; /* leave a place for '\0' */ - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wunreachable-code" -# pragma clang diagnostic ignored "-Wtautological-compare" -# pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - /* Different platforms, different sizes, none fits all... */ - /* can we fit this many 'D's? */ - if ((uintmax_t)SIZE_MAX > (uintmax_t)nut_debug_level /* else can't assign, requested debug level is huge */ - && (size_t)nut_debug_level + 1 < m - ) { -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - /* need even fewer (leave a place for '-'): */ - m = (size_t)nut_debug_level + 1; - } else { - upsdebugx(1, "Requested debugging level %d is too " - "high for pass-through args, truncated to %zu", - nut_debug_level, - (m - 1) /* count off '-' (and '\0' already) chars */ - ); - } - - dbg[0] = '-'; - for (d = 1; d < m ; d++) { - dbg[d] = 'D'; - } - dbg[d] = '\0'; - argv[arg++] = dbg; - } - argv[arg++] = (char *)"-a"; /* FIXME: cast away const */ argv[arg++] = ups->upsname; @@ -371,35 +276,13 @@ static void start_driver(const ups_t *ups) /* tie it off */ argv[arg++] = NULL; + debugcmdline(2, "exec: ", argv); - while (drv_maxretry > 0) { - int cur_exec_error = exec_error; - - upsdebugx(2, "%i remaining attempts", drv_maxretry); - debugcmdline(2, "exec: ", argv); - drv_maxretry--; - - if (!testmode) { - forkexec(argv, ups); - } - - /* driver command succeeded */ - if (cur_exec_error == exec_error) { - drv_maxretry = 0; - exec_error = initial_exec_error; - } - else { - /* otherwise, retry if still needed */ - if (drv_maxretry > 0) - if (retrydelay >= 0) - sleep ((unsigned int)retrydelay); - } + if (!testmode) { + forkexec(argv, ups); } } -static void help(const char *progname) - __attribute__((noreturn)); - static void help(const char *progname) { printf("Starts and stops UPS drivers via ups.conf.\n\n"); @@ -410,7 +293,6 @@ static void help(const char *progname) printf(" -t testing mode - prints actions without doing them\n"); printf(" -u drivers started will switch from root to \n"); printf(" -D raise debugging level\n"); - printf(" -d pass debugging level from upsdrvctl to driver\n"); printf(" start start all UPS drivers in ups.conf\n"); printf(" start only start driver for UPS \n"); printf(" stop stop all UPS drivers in ups.conf\n"); @@ -502,7 +384,7 @@ static void send_all_drivers(void (*command)(const ups_t *)) while (ups) { if (ups->sdorder == i) command(ups); - + ups = ups->next; } } @@ -538,7 +420,7 @@ int main(int argc, char **argv) UPS_VERSION); prog = argv[0]; - while ((i = getopt(argc, argv, "+htu:r:DdV")) != -1) { + while ((i = getopt(argc, argv, "+htu:r:DV")) != -1) { switch(i) { case 'r': pt_root = optarg; @@ -559,13 +441,10 @@ int main(int argc, char **argv) nut_debug_level++; break; - case 'd': - nut_debug_level_passthrough = 1; - break; - case 'h': default: help(prog); + break; } } @@ -582,18 +461,14 @@ int main(int argc, char **argv) nut_debug_level = 2; } - if (nut_debug_level_passthrough == 0) { - upsdebugx(2, "\n" - "If you're not a NUT core developer, chances are that you're told to enable debugging\n" - "to see why a driver isn't working for you. We're sorry for the confusion, but this is\n" - "the 'upsdrvctl' wrapper, not the driver you're interested in.\n\n" - "Below you'll find one or more lines starting with 'exec:' followed by an absolute\n" - "path to the driver binary and some command line option. This is what the driver\n" - "starts and you need to copy and paste that line and append the debug flags to that\n" - "line (less the 'exec:' prefix).\n\n" - "Alternately, provide an additional '-d' (lower-case) parameter to 'upsdrvctl' to\n" - "pass its current debug level to the launched driver.\n"); - } + upsdebugx(2, "\n" + "If you're not a NUT core developer, chances are that you're told to enable debugging\n" + "to see why a driver isn't working for you. We're sorry for the confusion, but this is\n" + "the 'upsdrvctl' wrapper, not the driver you're interested in.\n\n" + "Below you'll find one or more lines starting with 'exec:' followed by an absolute\n" + "path to the driver binary and some command line option. This is what the driver\n" + "starts and you need to copy and paste that line and append the debug flags to that\n" + "line (less the 'exec:' prefix).\n"); if (!strcmp(argv[0], "start")) command = &start_driver; diff --git a/drivers/upshandler.h b/drivers/upshandler.h index fea10bc..ca9a349 100644 --- a/drivers/upshandler.h +++ b/drivers/upshandler.h @@ -25,15 +25,15 @@ enum { STAT_INSTCMD_HANDLED = 0, /* completed successfully */ STAT_INSTCMD_UNKNOWN, /* unspecified error */ STAT_INSTCMD_INVALID, /* invalid command */ - STAT_INSTCMD_FAILED /* command failed */ + STAT_INSTCMD_FAILED /* command failed */ }; /* return values for setvar */ enum { STAT_SET_HANDLED = 0, /* completed successfully */ - STAT_SET_UNKNOWN, /* unspecified error */ - STAT_SET_INVALID, /* not writeable */ - STAT_SET_FAILED /* writing failed */ + STAT_SET_UNKNOWN, /* unspecified error */ + STAT_SET_INVALID, /* not writeable */ + STAT_SET_FAILED /* writing failed */ }; /* structure for funcs that get called by msg parse routine */ diff --git a/drivers/usb-common.c b/drivers/usb-common.c index 5f2dc16..4fc88b6 100644 --- a/drivers/usb-common.c +++ b/drivers/usb-common.c @@ -25,10 +25,8 @@ int is_usb_device_supported(usb_device_id_t *usb_device_id_list, USBDevice_t *de int retval = NOT_SUPPORTED; usb_device_id_t *usbdev; - for (usbdev = usb_device_id_list; - (usbdev->vendorID != 0 || usbdev->productID != 0 || usbdev->fun != NULL); - usbdev++ - ) { + for (usbdev = usb_device_id_list; usbdev->vendorID != -1; usbdev++) { + if (usbdev->vendorID != device->VendorID) { continue; } @@ -80,49 +78,28 @@ static int strcmp_null(char *s1, char *s2) static int match_function_exact(USBDevice_t *hd, void *privdata) { USBDevice_t *data = (USBDevice_t *)privdata; - - upsdebugx(3, "%s: matching a device...", __func__); - + if (hd->VendorID != data->VendorID) { - upsdebugx(2, "%s: failed match of %s: %4x != %4x", - __func__, "VendorID", hd->VendorID, data->VendorID); return 0; } if (hd->ProductID != data->ProductID) { - upsdebugx(2, "%s: failed match of %s: %4x != %4x", - __func__, "ProductID", hd->ProductID, data->ProductID); return 0; } if (strcmp_null(hd->Vendor, data->Vendor) != 0) { - upsdebugx(2, "%s: failed match of %s: %s != %s", - __func__, "Vendor", hd->Vendor, data->Vendor); return 0; } if (strcmp_null(hd->Product, data->Product) != 0) { - upsdebugx(2, "%s: failed match of %s: %s != %s", - __func__, "Product", hd->Product, data->Product); return 0; } if (strcmp_null(hd->Serial, data->Serial) != 0) { - upsdebugx(2, "%s: failed match of %s: %s != %s", - __func__, "Serial", hd->Serial, data->Serial); return 0; } #ifdef DEBUG_EXACT_MATCH_BUS if (strcmp_null(hd->Bus, data->Bus) != 0) { - upsdebugx(2, "%s: failed match of %s: %s != %s", - __func__, "Bus", hd->Bus, data->Bus); - return 0; - } -#endif -#ifdef DEBUG_EXACT_MATCH_DEVICE - if (strcmp_null(hd->Device, data->Device) != 0) { - upsdebugx(2, "%s: failed match of %s: %s != %s", - __func__, "Device", hd->Device, data->Device); return 0; } #endif @@ -160,9 +137,6 @@ int USBNewExactMatcher(USBDeviceMatcher_t **matcher, USBDevice_t *hd) data->Serial = hd->Serial ? strdup(hd->Serial) : NULL; #ifdef DEBUG_EXACT_MATCH_BUS data->Bus = hd->Bus ? strdup(hd->Bus) : NULL; -#endif -#ifdef DEBUG_EXACT_MATCH_DEVICE - data->Device = hd->Device ? strdup(hd->Device) : NULL; #endif *matcher = m; @@ -185,9 +159,6 @@ void USBFreeExactMatcher(USBDeviceMatcher_t *matcher) free(data->Serial); #ifdef DEBUG_EXACT_MATCH_BUS free(data->Bus); -#endif -#ifdef DEBUG_EXACT_MATCH_DEVICE - free(data->Device); #endif free(data); free(matcher); @@ -300,7 +271,7 @@ static int match_regex_hex(regex_t *preg, int n) /* private data type: hold a set of compiled regular expressions. */ typedef struct regex_matcher_data_s { - regex_t *regex[7]; + regex_t *regex[6]; } regex_matcher_data_t; /* private callback function for regex matches */ @@ -308,97 +279,48 @@ static int match_function_regex(USBDevice_t *hd, void *privdata) { regex_matcher_data_t *data = (regex_matcher_data_t *)privdata; int r; - - upsdebugx(3, "%s: matching a device...", __func__); - + r = match_regex_hex(data->regex[0], hd->VendorID); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %4x !~ %s", - __func__, "VendorID", hd->VendorID, data->regex[0]); -*/ - upsdebugx(2, "%s: failed match of %s: %4x", - __func__, "VendorID", hd->VendorID); return r; } r = match_regex_hex(data->regex[1], hd->ProductID); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %4x !~ %s", - __func__, "ProductID", hd->ProductID, data->regex[1]); -*/ - upsdebugx(2, "%s: failed match of %s: %4x", - __func__, "ProductID", hd->ProductID); return r; } r = match_regex(data->regex[2], hd->Vendor); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %s !~ %s", - __func__, "Vendor", hd->Vendor, data->regex[2]); -*/ - upsdebugx(2, "%s: failed match of %s: %s", - __func__, "Vendor", hd->Vendor); return r; } r = match_regex(data->regex[3], hd->Product); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %s !~ %s", - __func__, "Product", hd->Product, data->regex[3]); -*/ - upsdebugx(2, "%s: failed match of %s: %s", - __func__, "Product", hd->Product); return r; } r = match_regex(data->regex[4], hd->Serial); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %s !~ %s", - __func__, "Serial", hd->Serial, data->regex[4]); -*/ - upsdebugx(2, "%s: failed match of %s: %s", - __func__, "Serial", hd->Serial); return r; } r = match_regex(data->regex[5], hd->Bus); if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %s !~ %s", - __func__, "Bus", hd->Bus, data->regex[5]); -*/ - upsdebugx(2, "%s: failed match of %s: %s", - __func__, "Bus", hd->Bus); - return r; - } - - r = match_regex(data->regex[6], hd->Device); - if (r != 1) { -/* - upsdebugx(2, "%s: failed match of %s: %s !~ %s", - __func__, "Device", hd->Device, data->regex[6]); -*/ - upsdebugx(2, "%s: failed match of %s: %s", - __func__, "Device", hd->Device); return r; } return 1; } /* constructor: create a regular expression matcher. This matcher is - * based on seven regular expression strings in regex_array[0..6], + * based on six regular expression strings in regex_array[0..5], * corresponding to: vendorid, productid, vendor, product, serial, - * bus, device. Any of these strings can be NULL, which matches + * bus. Any of these strings can be NULL, which matches * everything. Cflags are as in regcomp(3). Typical values for cflags * are REG_ICASE (case insensitive matching) and REG_EXTENDED (use * extended regular expressions). On success, return 0 and store the * matcher in *matcher. On error, return -1 with errno set, or return - * i=1--7 to indicate that the regular expression regex_array[i-1] was + * i=1--6 to indicate that the regular expression regex_array[i-1] was * ill-formed (an error message can then be retrieved with * regerror(3)). */ @@ -423,7 +345,7 @@ int USBNewRegexMatcher(USBDeviceMatcher_t **matcher, char **regex, int cflags) m->privdata = (void *)data; m->next = NULL; - for (i=0; i<7; i++) { + for (i=0; i<6; i++) { r = compile_regex(&data->regex[i], regex[i], cflags); if (r == -2) { r = i+1; @@ -443,14 +365,14 @@ void USBFreeRegexMatcher(USBDeviceMatcher_t *matcher) { int i; regex_matcher_data_t *data; - + if (!matcher) { return; } data = (regex_matcher_data_t *)matcher->privdata; - for (i = 0; i < 7; i++) { + for (i = 0; i < 6; i++) { if (!data->regex[i]) { continue; } @@ -462,38 +384,3 @@ void USBFreeRegexMatcher(USBDeviceMatcher_t *matcher) free(data); free(matcher); } - -void warn_if_bad_usb_port_filename(const char *fn) { - /* USB drivers ignore the 'port' setting - log a notice - * if it is not "auto". Note: per se, ignoring the port - * (or internally the device_path variable from main.c) - * is currently not a bug and is actually documented at - * docs/config-notes.txt; however it is not something - * evident to users during troubleshooting a device. - * Documentation and common practice recommend port=auto - * so here we warn during driver start if it has some - * other value and users might think it is honoured. - */ - - if (!fn) { - upslogx(LOG_WARNING, - "WARNING: %s(): port argument was not " - "specified to the driver", - __func__); - return; - } - - if (!strcmp(fn, "auto")) - return; - - upslogx(LOG_WARNING, - "WARNING: %s(): port argument specified to\n" - " the driver is \"%s\" but USB drivers do " - "not use it and rely on\n" - " libusb walking all devices and matching " - "their identification metadata.\n" - " NUT documentation recommends port=\"auto\" " - "for USB devices to avoid confusion.", - __func__, fn); - return; -} diff --git a/drivers/usb-common.h b/drivers/usb-common.h index cc9e8ce..e160e76 100644 --- a/drivers/usb-common.h +++ b/drivers/usb-common.h @@ -1,43 +1,6 @@ /* usb-common.h - prototypes for the common useful USB functions - * NOTE that it aims to consolidate use of different USB-related APIs - * such as libusb-0.1 and libusb-1.0 in a way that minimizes the coding - * difference for majority of NUT - so typedef'ing or converting various - * data types and method signatures. - * - * Beside your system headers (content varies between distros) you can - * find some documentation online: - * - libusb-1.0: - * https://github.com/libusb/libusb/blob/master/libusb/libusb.h - * https://libusb.sourceforge.io/api-1.0/ - * https://libusb.sourceforge.io/api-1.0/libusb_api.html - * https://github.com/libusb/libusb/wiki - * https://nxmnpg.lemoda.net/3/libusb (one page, easy to search) - * - libusb-0.1 is nowadays hard to find, original web-site and - * sourceforge project were discontinued over the past years. - * A rendered copy of the libusb-0.1 Developers Guide was noted at: - * http://transit.iut2.upmf-grenoble.fr/doc/libusb-dev/html/index.html - * http://transit.iut2.upmf-grenoble.fr/doc/libusb-dev/html/functions.html - * Original SGML for that seems to be in source tarball such as - * http://deb.debian.org/debian/pool/main/libu/libusb/libusb_0.1.12.orig.tar.gz - * - * Related (but currently not directly used) projects include: - * - libusb-win32 port based on libusb-0.1 API (bug-fix-only mode, - * new projects should use libusb Windows backend): - * https://sourceforge.net/p/libusb-win32/wiki/Documentation/ - * - (Currently not in NUT codebase scope, but might help...) - * > A compatibility layer allowing applications written for - * > libusb-0.1 to work with libusb-1.0. libusb-compat-0.1 - * > attempts to look, feel, smell and walk like libusb-0.1. - * Mostly. Details (and known differences) documented at: - * https://github.com/libusb/libusb-compat-0.1 - * - * Also note that at least currently this does not deal with non-libusb - * APIs (important when looking for method signatures in documentation, - * since e.g. Linux Kernel USB subsystem uses some of libusb-0.1 method - * names, but with different set, type and order of arguments!) - Copyright (C) 2008 - 2016 Arnaud Quette - Copyright (C) 2021 Jim Klimov + Copyright (C) 2008 Arnaud Quette This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,389 +20,10 @@ #ifndef NUT_USB_COMMON_H #define NUT_USB_COMMON_H -#include "config.h" /* be sure to know all about the system config */ - -/* Note: usb-common.h (this file) is included by nut_libusb.h, - * so not looping the includes ;) - */ -#include "nut_stdint.h" /* for uint16_t, UINT16_MAX, PRIsize, etc. */ -#include "common.h" /* for fatalx() etc. */ - -#if defined HAVE_LIMITS_H -# include /* PATH_MAX for usb.h, among other stuff */ -#endif - -#if defined HAVE_SYS_PARAM_H -# include -#endif +#include "nut_stdint.h" /* for uint16_t */ #include - -#if (!WITH_LIBUSB_1_0) && (!WITH_LIBUSB_0_1) -#error "configure script error: Neither WITH_LIBUSB_1_0 nor WITH_LIBUSB_0_1 is set" -#endif - -#if (WITH_LIBUSB_1_0) && (WITH_LIBUSB_0_1) -#error "configure script error: Both WITH_LIBUSB_1_0 and WITH_LIBUSB_0_1 are set" -#endif - -/* Select version-specific libusb header file and define a sort of - * "Compatibility layer" between libusb 0.1 and 1.0 - */ -#if WITH_LIBUSB_1_0 -# include - - /* Simply remap libusb functions/structures from 0.1 to 1.0 */ - - /* Structures */ - /* #define usb_dev_handle libusb_device_handle */ - typedef libusb_device_handle usb_dev_handle; -/* These typedefs are also named in libshut.h, so we can consistenly - * handle the "ifdef SHUT_MODE" handling in libhid.c and some drivers. - * These symbolic names are used in all the headers and are expected to - * match binary code of object files at (monolithic) driver build time. - * - * The MIN/MAX definitions here are primarily to generalize range-check - * code (especially if anything is done outside the libraries). - * FIXME: It may make sense to constrain the limits to lowest common - * denominator that should fit alll of libusb-0.1, libusb-1.0 and libshut, - * so that any build of the practical (driver) code knows to not exceed - * any use-case. - */ - typedef uint8_t usb_ctrl_requesttype; - #define USB_CTRL_REQUESTTYPE_MIN 0 - #define USB_CTRL_REQUESTTYPE_MAX UINT8_MAX - - typedef uint8_t usb_ctrl_request; - #define USB_CTRL_REQUEST_MIN 0 - #define USB_CTRL_REQUEST_MAX UINT8_MAX - - typedef unsigned char usb_ctrl_endpoint; - #define USB_CTRL_ENDPOINT_MIN 0 - #define USB_CTRL_ENDPOINT_MAX UCHAR_MAX - - typedef uint16_t usb_ctrl_msgvalue; - #define USB_CTRL_MSGVALUE_MIN 0 - #define USB_CTRL_MSGVALUE_MAX UINT16_MAX - - typedef uint16_t usb_ctrl_repindex; - #define USB_CTRL_REPINDEX_MIN 0 - #define USB_CTRL_REPINDEX_MAX UINT16_MAX - - typedef uint8_t usb_ctrl_strindex; - #define USB_CTRL_STRINDEX_MIN 0 - #define USB_CTRL_STRINDEX_MAX UINT8_MAX - - typedef uint8_t usb_ctrl_descindex; - #define USB_CTRL_DESCINDEX_MIN 0 - #define USB_CTRL_DESCINDEX_MAX UINT8_MAX - - typedef unsigned char* usb_ctrl_charbuf; - typedef unsigned char usb_ctrl_char; - #define USB_CTRL_CHAR_MIN 0 - #define USB_CTRL_CHAR_MAX UCHAR_MAX - - /* Here MIN/MAX should not matter much, type mostly used for casting */ - typedef uint16_t usb_ctrl_charbufsize; - #define USB_CTRL_CHARBUFSIZE_MIN 0 - #define USB_CTRL_CHARBUFSIZE_MAX UINT16_MAX - #define PRI_NUT_USB_CTRL_CHARBUFSIZE PRIu16 - - typedef unsigned int usb_ctrl_timeout_msec; /* in milliseconds */ - /* Note: there does not seem to be a standard type - * for milliseconds, like there is an useconds_t */ - #define USB_CTRL_TIMEOUTMSEC_MIN 0 - #define USB_CTRL_TIMEOUTMSEC_MAX UINT_MAX - - /* defines */ - #define USB_CLASS_PER_INTERFACE LIBUSB_CLASS_PER_INTERFACE - #define USB_DT_STRING LIBUSB_DT_STRING - #define USB_ENDPOINT_IN LIBUSB_ENDPOINT_IN - #define USB_ENDPOINT_OUT LIBUSB_ENDPOINT_OUT - #define USB_RECIP_ENDPOINT LIBUSB_RECIPIENT_ENDPOINT - #define USB_RECIP_INTERFACE LIBUSB_RECIPIENT_INTERFACE - #define USB_REQ_SET_DESCRIPTOR LIBUSB_REQUEST_SET_DESCRIPTOR - #define USB_TYPE_CLASS LIBUSB_REQUEST_TYPE_CLASS - #define USB_TYPE_VENDOR LIBUSB_REQUEST_TYPE_VENDOR - - #define ERROR_ACCESS LIBUSB_ERROR_ACCESS - #define ERROR_BUSY LIBUSB_ERROR_BUSY - #define ERROR_IO LIBUSB_ERROR_IO - #define ERROR_NO_DEVICE LIBUSB_ERROR_NO_DEVICE - #define ERROR_NOT_FOUND LIBUSB_ERROR_NOT_FOUND - #define ERROR_OVERFLOW LIBUSB_ERROR_OVERFLOW - #define ERROR_PIPE LIBUSB_ERROR_PIPE - #define ERROR_TIMEOUT LIBUSB_ERROR_TIMEOUT - - /* Functions, including range-checks to convert data types of the two APIs. - * Follows an example from libusb-1.0 headers that liberally cast int args - * of one method to uint16_t to call another; at least we do so with checks: */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION -# pragma GCC diagnostic ignored "-Wunused-function" -#endif - /* #define usb_control_msg libusb_control_transfer */ - static inline int usb_control_msg(usb_dev_handle *dev, int requesttype, - int request, int value, int index, - usb_ctrl_charbuf bytes, int size, int timeout) - { - /* - Map from libusb-0.1 API => libusb-1.0 API: - int LIBUSB_CALL libusb_control_transfer( - libusb_device_handle *dev_handle, uint8_t request_type, - uint8_t bRequest, uint16_t wValue, uint16_t wIndex, - unsigned char *data, uint16_t wLength, unsigned int timeout); - Note: In libusb-0.1 bytes was a (char*) but our consumer code - was already fixed to use "usb_ctrl_charbuf" to match other methods. - */ - - if (requesttype < 0 || (uintmax_t)requesttype > UINT8_MAX - || request < 0 || (uintmax_t)request > UINT8_MAX - || value < 0 || (uintmax_t)value > UINT16_MAX - || index < 0 || (uintmax_t)index > UINT16_MAX - || size < 0 || (uintmax_t)size > UINT16_MAX - || timeout < 0 - ) { - fatalx(EXIT_FAILURE, - "usb_control_msg() args out of range for libusb_control_transfer() implementation"); - } - - return libusb_control_transfer( - dev, - (uint8_t)requesttype, - (uint8_t)request, - (uint16_t)value, - (uint16_t)index, - (unsigned char *)bytes, - (uint16_t)size, - (unsigned int) timeout - ); - } - - static inline int usb_interrupt_read(usb_dev_handle *dev, int ep, - usb_ctrl_charbuf bytes, int size, int timeout) - { - /* NOTE: Also for routines below: - Map from libusb-0.1 API => libusb-1.0 API plus change of logic per below code: - int LIBUSB_CALL libusb_interrupt_transfer(libusb_device_handle *dev_handle, - unsigned char endpoint, unsigned char *data, int length, - int *actual_length, unsigned int timeout); - Note: In libusb-0.1 bytes was a (char*) but our consumer code - was already fixed to use "usb_ctrl_charbuf" to match other methods. - */ - int ret; - - if (ep < 0 || (uintmax_t)ep > UCHAR_MAX - || timeout < 0 - ) { - fatalx(EXIT_FAILURE, - "usb_interrupt_read() args out of range for libusb_interrupt_transfer() implementation"); - } - - ret = libusb_interrupt_transfer(dev, (unsigned char)ep, (unsigned char *) bytes, - size, &size, (unsigned int)timeout); - /* In case of success, return the operation size, as done with libusb 0.1 */ - return (ret == LIBUSB_SUCCESS)?size:ret; - } - - static inline int usb_interrupt_write(usb_dev_handle *dev, int ep, - const usb_ctrl_charbuf bytes, int size, int timeout) - { - /* See conversion comments above */ - int ret; - - if (ep < 0 || (uintmax_t)ep > UCHAR_MAX - || timeout < 0 - ) { - fatalx(EXIT_FAILURE, - "usb_interrupt_write() args out of range for libusb_interrupt_transfer() implementation"); - } - - ret = libusb_interrupt_transfer(dev, (unsigned char)ep, (unsigned char *) bytes, - size, &size, (unsigned int)timeout); - /* In case of success, return the operation size, as done with libusb 0.1 */ - return (ret == LIBUSB_SUCCESS)?size:ret; - } - - static inline int usb_bulk_read(usb_dev_handle *dev, int ep, - usb_ctrl_charbuf bytes, int size, int timeout) - { - /* See conversion comments above */ - int ret; - - if (ep < 0 || (uintmax_t)ep > UCHAR_MAX - || timeout < 0 - ) { - fatalx(EXIT_FAILURE, - "usb_bulk_read() args out of range for libusb_interrupt_transfer() implementation"); - } - - ret = libusb_interrupt_transfer(dev, (unsigned char)ep, (unsigned char *) bytes, - size, &size, (unsigned int)timeout); - /* In case of success, return the operation size, as done with libusb 0.1 */ - return (ret == LIBUSB_SUCCESS)?size:ret; - } - - static inline int usb_bulk_write(usb_dev_handle *dev, int ep, - usb_ctrl_charbuf bytes, int size, int timeout) - { - /* See conversion comments above */ - int ret; - - if (ep < 0 || (uintmax_t)ep > UCHAR_MAX - || timeout < 0 - ) { - fatalx(EXIT_FAILURE, - "usb_bulk_write() args out of range for libusb_interrupt_transfer() implementation"); - } - - ret = libusb_interrupt_transfer(dev, (unsigned char)ep, (unsigned char *) bytes, - size, &size, (unsigned int)timeout); - /* In case of success, return the operation size, as done with libusb 0.1 */ - return (ret == LIBUSB_SUCCESS)?size:ret; - } - - static inline int usb_get_string(usb_dev_handle *dev, int index, int langid, - usb_ctrl_charbuf buf, size_t buflen) - { - /* - Map from libusb-0.1 API (originally "char* buf") => libusb-1.0 API: - int libusb_get_string_descriptor(libusb_device_handle *dev_handle, - uint8_t desc_index, uint16_t langid, unsigned char *data, int length) - */ - - if (index < 0 || (uintmax_t)index > UINT8_MAX - || langid < 0 || (uintmax_t)langid > UINT16_MAX - || (uintmax_t)buflen > INT_MAX - ) { - fatalx(EXIT_FAILURE, - "usb_get_string() args out of range for libusb_get_string_descriptor() implementation"); - } - - return libusb_get_string_descriptor( - dev, - (uint8_t)index, - (uint16_t)langid, - (unsigned char *)buf, - (int) buflen - ); - - } - - static inline int usb_get_string_simple(usb_dev_handle *dev, int index, - usb_ctrl_charbuf buf, size_t buflen) - { - /* - Map from libusb-0.1 API (originally "char* buf") => libusb-1.0 API: - int LIBUSB_CALL libusb_get_string_descriptor_ascii(libusb_device_handle *dev_handle, - uint8_t desc_index, unsigned char *data, int length); - */ - - if (index < 0 || (uintmax_t)index > UINT8_MAX - || (uintmax_t)buflen > INT_MAX - ) { - fatalx(EXIT_FAILURE, - "usb_get_string_simple() args out of range for libusb_get_string_descriptor_ascii() implementation"); - } - - return libusb_get_string_descriptor_ascii( - dev, - (uint8_t)index, - (unsigned char *)buf, - (int) buflen - ); - } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION) -# pragma GCC diagnostic pop -#endif - - /* Functions for which simple mappings seem to suffice (no build warnings emitted): */ - #define usb_claim_interface libusb_claim_interface - #define usb_clear_halt libusb_clear_halt - #define usb_close libusb_close - #define usb_set_configuration libusb_set_configuration - #define usb_release_interface libusb_release_interface - #define usb_reset libusb_reset_device - - /* FIXME: some original libusb1.c code cast the (int) argument - * as (enum libusb_error) - should we force that in the macro? */ - #define nut_usb_strerror(a) libusb_strerror(a) -#endif /* WITH_LIBUSB_1_0 */ - -/* Note: Checked above that in practice we handle some one libusb API */ -#if WITH_LIBUSB_0_1 -# include - /* Structures */ - /* See detailed comments above, in libusb-1.0 definitions - * FIXME: It may make sense to constrain the limits to lowest common - * denominator that should fit alll of libusb-0.1, libusb-1.0 and libshut, - * so that any build of the practical (driver) code knows to not exceed - * any use-case. - */ - /* no typedef for usb_dev_handle - part of libusb-0.1 API names */ - - typedef int usb_ctrl_requesttype; - #define USB_CTRL_REQUESTTYPE_MIN INT_MIN - #define USB_CTRL_REQUESTTYPE_MAX INT_MAX - - typedef int usb_ctrl_request; - #define USB_CTRL_REQUEST_MIN INT_MIN - #define USB_CTRL_REQUEST_MAX INT_MAX - - typedef int usb_ctrl_endpoint; - #define USB_CTRL_ENDPOINT_MIN INT_MIN - #define USB_CTRL_ENDPOINT_MAX INT_MAX - - typedef int usb_ctrl_msgvalue; - #define USB_CTRL_MSGVALUE_MIN INT_MIN - #define USB_CTRL_MSGVALUE_MAX INT_MAX - - typedef int usb_ctrl_repindex; - #define USB_CTRL_REPINDEX_MIN INT_MIN - #define USB_CTRL_REPINDEX_MAX INT_MAX - - typedef int usb_ctrl_strindex; - #define USB_CTRL_STRINDEX_MIN INT_MIN - #define USB_CTRL_STRINDEX_MAX INT_MAX - - typedef int usb_ctrl_descindex; - #define USB_CTRL_DESCINDEX_MIN INT_MIN - #define USB_CTRL_DESCINDEX_MAX INT_MAX - - /* Here MIN/MAX should not matter much, type mostly used for casting */ - typedef char* usb_ctrl_charbuf; - typedef char usb_ctrl_char; - #define USB_CTRL_CHAR_MIN CHAR_MIN - #define USB_CTRL_CHAR_MAX CHAR_MAX - - typedef int usb_ctrl_charbufsize; - #define USB_CTRL_CHARBUFSIZE_MIN INT_MIN - #define USB_CTRL_CHARBUFSIZE_MAX INT_MAX - /* There is no PRIi :) So we define directly by spec */ - #define PRI_NUT_USB_CTRL_CHARBUFSIZE "i" - - typedef int usb_ctrl_timeout_msec; /* in milliseconds */ - #define USB_CTRL_TIMEOUTMSEC_MIN INT_MIN - #define USB_CTRL_TIMEOUTMSEC_MAX INT_MAX - - /* defines */ - #define ERROR_ACCESS -EACCES - #define ERROR_BUSY -EBUSY - #define ERROR_IO -EIO - #define ERROR_NO_DEVICE -ENODEV - #define ERROR_NOT_FOUND -ENOENT - #define ERROR_OVERFLOW -EOVERFLOW - #define ERROR_PIPE -EPIPE - #define ERROR_TIMEOUT -ETIMEDOUT - - /* Functions for which simple mappings seem to suffice (no build warnings emitted): */ - #define nut_usb_strerror(a) usb_strerror() -#endif /* WITH_LIBUSB_0_1 */ - -/* USB standard timeout [ms] */ -#define USB_TIMEOUT 5000 +#include /*! * USBDevice_t: Describe a USB device. This structure contains exactly @@ -451,17 +35,12 @@ * corresponding string did not exist or could not be retrieved. */ typedef struct USBDevice_s { - /* These 5 data points are common properties of an USB device: */ - uint16_t VendorID; /*!< Device's Vendor ID */ - uint16_t ProductID; /*!< Device's Product ID */ - char *Vendor; /*!< Device's Vendor Name */ - char *Product; /*!< Device's Product Name */ - char *Serial; /*!< Product serial number */ - /* These data points can be determined by the driver for some devices - or by libusb to detail its connection topology: */ - char *Bus; /*!< Bus name, e.g. "003" */ - uint16_t bcdDevice; /*!< Device release number */ - char *Device; /*!< Device name on the bus, e.g. "001" */ + uint16_t VendorID; /*!< Device's Vendor ID */ + uint16_t ProductID; /*!< Device's Product ID */ + char *Vendor; /*!< Device's Vendor Name */ + char *Product; /*!< Device's Product Name */ + char *Serial; /* Product serial number */ + char *Bus; /* Bus name, e.g. "003" */ } USBDevice_t; /*! @@ -496,8 +75,8 @@ void USBFreeRegexMatcher(USBDeviceMatcher_t *matcher); #define USB_DEVICE(vendorID, productID) vendorID, productID typedef struct { - uint16_t vendorID; - uint16_t productID; + int vendorID; + int productID; void *(*fun)(USBDevice_t *); /* handler for specific processing */ } usb_device_id_t; @@ -508,14 +87,7 @@ typedef struct { /* Function used to match a VendorID/ProductID pair against a list of * supported devices. Return values: * NOT_SUPPORTED (0), POSSIBLY_SUPPORTED (1) or SUPPORTED (2) */ -int is_usb_device_supported(usb_device_id_t *usb_device_id_list, +int is_usb_device_supported(usb_device_id_t *usb_device_id_list, USBDevice_t *device); -void nut_usb_addvars(void); - -/* Tell the users that port="auto" should be used for USB, - * and other values are quietly ignored. Implemented once - * here, to use in several USB-capable drivers. */ -void warn_if_bad_usb_port_filename(const char *fn); - #endif /* NUT_USB_COMMON_H */ diff --git a/drivers/usbhid-ups.c b/drivers/usbhid-ups.c index dfe65a3..fcf628d 100644 --- a/drivers/usbhid-ups.c +++ b/drivers/usbhid-ups.c @@ -1,11 +1,10 @@ /* usbhid-ups.c - Driver for USB and serial (MGE SHUT) HID UPS units * * Copyright (C) - * 2003-2022 Arnaud Quette + * 2003-2012 Arnaud Quette * 2005 John Stamp * 2005-2006 Peter Selinger * 2007-2009 Arjen de Korte - * 2016 Eaton / Arnaud Quette * * This program was sponsored by MGE UPS SYSTEMS, and now Eaton * @@ -28,7 +27,7 @@ */ #define DRIVER_NAME "Generic HID driver" -#define DRIVER_VERSION "0.47" +#define DRIVER_VERSION "0.38" #include "main.h" #include "libhid.h" @@ -40,25 +39,18 @@ #include "mge-hid.h" #ifndef SHUT_MODE - /* explore stub goes first, others alphabetically */ #include "explore-hid.h" #include "apc-hid.h" - #include "arduino-hid.h" #include "belkin-hid.h" #include "cps-hid.h" - #include "delta_ups-hid.h" - #include "ever-hid.h" - #include "idowell-hid.h" - #include "legrand-hid.h" #include "liebert-hid.h" - #include "openups-hid.h" #include "powercom-hid.h" - #include "powervar-hid.h" - #include "salicru-hid.h" #include "tripplite-hid.h" + #include "idowell-hid.h" + #include "openups-hid.h" #endif -/* Reference list of avaiable subdrivers */ +/* master list of avaiable subdrivers */ static subdriver_t *subdriver_list[] = { #ifndef SHUT_MODE &explore_subdriver, @@ -66,19 +58,13 @@ static subdriver_t *subdriver_list[] = { &mge_subdriver, #ifndef SHUT_MODE &apc_subdriver, - &arduino_subdriver, &belkin_subdriver, &cps_subdriver, - &delta_ups_subdriver, - &ever_subdriver, - &idowell_subdriver, - &legrand_subdriver, &liebert_subdriver, - &openups_subdriver, &powercom_subdriver, - &powervar_subdriver, - &salicru_subdriver, &tripplite_subdriver, + &idowell_subdriver, + &openups_subdriver, #endif NULL }; @@ -106,40 +92,19 @@ typedef enum { HU_WALKMODE_FULL_UPDATE } walkmode_t; -/* Compatibility layer between libusb 0.1 and 1.0, for errno/return codes */ -#if WITH_LIBUSB_0_1 || (defined SHUT_MODE) - #define ERROR_BUSY -EBUSY - #define ERROR_NO_DEVICE -ENODEV - #define ERROR_ACCESS -EACCES - #define ERROR_IO -EIO - #define ERROR_NOT_FOUND -ENOENT - #define ERROR_TIMEOUT -ETIMEDOUT - #define ERROR_OVERFLOW -EOVERFLOW - #define ERROR_PIPE -EPIPE -#else /* for libusb 1.0 */ - #define ERROR_BUSY LIBUSB_ERROR_BUSY - #define ERROR_NO_DEVICE LIBUSB_ERROR_NO_DEVICE - #define ERROR_ACCESS LIBUSB_ERROR_ACCESS - #define ERROR_IO LIBUSB_ERROR_IO - #define ERROR_NOT_FOUND LIBUSB_ERROR_NOT_FOUND - #define ERROR_TIMEOUT LIBUSB_ERROR_TIMEOUT - #define ERROR_OVERFLOW LIBUSB_ERROR_OVERFLOW - #define ERROR_PIPE LIBUSB_ERROR_PIPE -#endif - /* pointer to the active subdriver object (changed in callback() function) */ static subdriver_t *subdriver = NULL; /* Global vars */ static HIDDevice_t *hd = NULL; -static HIDDevice_t curDevice = { 0x0000, 0x0000, NULL, NULL, NULL, NULL, 0, NULL }; +static HIDDevice_t curDevice = { 0x0000, 0x0000, NULL, NULL, NULL, NULL }; static HIDDeviceMatcher_t *subdriver_matcher = NULL; #ifndef SHUT_MODE static HIDDeviceMatcher_t *exact_matcher = NULL; static HIDDeviceMatcher_t *regex_matcher = NULL; #endif static int pollfreq = DEFAULT_POLLFREQ; -static unsigned ups_status = 0; +static int ups_status = 0; static bool_t data_has_changed = FALSE; /* for SEMI_STATIC data polling */ #ifndef SUN_LIBUSB bool_t use_interrupt_pipe = TRUE; @@ -147,14 +112,7 @@ bool_t use_interrupt_pipe = TRUE; bool_t use_interrupt_pipe = FALSE; #endif static time_t lastpoll; /* Timestamp the last polling */ -hid_dev_handle_t udev = HID_DEV_HANDLE_CLOSED; - -/** - * CyberPower UT series sometime need a bit of help deciding their online status. - * This quirk is to enable the special handling of OL & DISCHRG at the same time - * as being OB (on battery power/no mains power). Enabled by device config flag. - */ -static int onlinedischarge = 0; +hid_dev_handle_t udev; /* support functions */ static hid_info_t *find_nut_info(const char *varname); @@ -167,8 +125,7 @@ static void ups_status_set(void); static bool_t hid_ups_walk(walkmode_t mode); static int reconnect_ups(void); static int ups_infoval_set(hid_info_t *item, double value); -static int callback(hid_dev_handle_t argudev, HIDDevice_t *arghd, - usb_ctrl_charbuf rdbuf, usb_ctrl_charbufsize rdlen); +static int callback(hid_dev_handle_t udev, HIDDevice_t *hd, unsigned char *rdbuf, int rdlen); #ifdef DEBUG static double interval(void); #endif @@ -177,6 +134,40 @@ static double interval(void); HIDDesc_t *pDesc = NULL; /* parsed Report Descriptor */ reportbuf_t *reportbuf = NULL; /* buffer for most recent reports */ +/* ---------------------------------------------------------------------- */ +/* data for processing boolean values from UPS */ + +#define STATUS(x) ((unsigned)1<> 9); + year = 1980 + ((long)value >> 9); /* negative value represents pre-1980 date */ month = ((long)value >> 5) & 0x0f; day = (long)value & 0x1f; - snprintf(buf, sizeof(buf), "%04ld/%02ld/%02ld", year, month, day); + snprintf(buf, sizeof(buf), "%04d/%02d/%02d", year, month, day); return buf; } -static double date_conversion_reverse(const char* date_string) -{ - long year, month, day; - long date; - - sscanf(date_string, "%04ld/%02ld/%02ld", &year, &month, &day); - if(year - 1980 > 127 || month > 12 || day > 31) - return 0; - date = (year - 1980) << 9; - date += month << 5; - date += day; - - return (double) date; -} - info_lkp_t date_conversion[] = { - { 0, NULL, date_conversion_fun, date_conversion_reverse } + { 0, NULL, date_conversion_fun } }; /* returns statically allocated string - must not use it again before @@ -473,9 +445,8 @@ static const char *hex_conversion_fun(double value) return buf; } -/* FIXME? Do we need an inverse "nuf()" here? */ info_lkp_t hex_conversion[] = { - { 0, NULL, hex_conversion_fun, NULL } + { 0, NULL, hex_conversion_fun } }; /* returns statically allocated string - must not use it again before @@ -487,9 +458,8 @@ static const char *stringid_conversion_fun(double value) return HIDGetIndexString(udev, (int)value, buf, sizeof(buf)); } -/* FIXME? Do we need an inverse "nuf()" here? */ info_lkp_t stringid_conversion[] = { - { 0, NULL, stringid_conversion_fun, NULL } + { 0, NULL, stringid_conversion_fun } }; /* returns statically allocated string - must not use it again before @@ -503,9 +473,8 @@ static const char *divide_by_10_conversion_fun(double value) return buf; } -/* FIXME? Do we need an inverse "nuf()" here? */ info_lkp_t divide_by_10_conversion[] = { - { 0, NULL, divide_by_10_conversion_fun, NULL } + { 0, NULL, divide_by_10_conversion_fun } }; /* returns statically allocated string - must not use it again before @@ -529,9 +498,8 @@ static const char *kelvin_celsius_conversion_fun(double value) return buf; } -/* FIXME? Do we need an inverse "nuf()" here? */ info_lkp_t kelvin_celsius_conversion[] = { - { 0, NULL, kelvin_celsius_conversion_fun, NULL } + { 0, NULL, kelvin_celsius_conversion_fun } }; /*! @@ -542,19 +510,12 @@ info_lkp_t kelvin_celsius_conversion[] = { #ifndef SHUT_MODE static int match_function_subdriver(HIDDevice_t *d, void *privdata) { int i; - NUT_UNUSED_VARIABLE(privdata); - - upsdebugx(2, "%s (non-SHUT mode): matching a device...", __func__); for (i=0; subdriver_list[i] != NULL; i++) { if (subdriver_list[i]->claim(d)) { return 1; } } - - upsdebugx(2, "%s (non-SHUT mode): failed to match a subdriver " - "to vendor and/or product ID", - __func__); return 0; } @@ -578,31 +539,24 @@ int instcmd(const char *cmdname, const char *extradata) if (!strcasecmp(cmdname, "beeper.off")) { /* compatibility mode for old command */ upslogx(LOG_WARNING, - "The 'beeper.off' command has been " - "renamed to 'beeper.disable'"); + "The 'beeper.off' command has been renamed to 'beeper.disable'"); return instcmd("beeper.disable", NULL); } if (!strcasecmp(cmdname, "beeper.on")) { /* compatibility mode for old command */ upslogx(LOG_WARNING, - "The 'beeper.on' command has been " - "renamed to 'beeper.enable'"); + "The 'beeper.on' command has been renamed to 'beeper.enable'"); return instcmd("beeper.enable", NULL); } - upsdebugx(1, "instcmd(%s, %s)", - cmdname, - extradata ? extradata : "[NULL]"); + upsdebugx(1, "instcmd(%s, %s)", cmdname, extradata ? extradata : "[NULL]"); /* Retrieve and check netvar & item_path */ hidups_item = find_nut_info(cmdname); /* Check for fallback if not found */ if (hidups_item == NULL) { - upsdebugx(3, "%s: cmdname '%s' not found; " - "checking for alternatives", - __func__, cmdname); if (!strcasecmp(cmdname, "load.on")) { return instcmd("load.on.delay", "0"); @@ -615,8 +569,7 @@ int instcmd(const char *cmdname, const char *extradata) if (!strcasecmp(cmdname, "shutdown.return")) { int ret; - /* Ensure "ups.start.auto" is set to "yes", - * if supported */ + /* Ensure "ups.start.auto" is set to "yes", if supported */ if (dstate_getinfo("ups.start.auto")) { setvar("ups.start.auto", "yes"); } @@ -626,11 +579,6 @@ int instcmd(const char *cmdname, const char *extradata) return ret; } - /* Some UPS's (e.g. TrippLive AVR750U w/ 3024 protocol) don't accept - * commands that arrive too rapidly, so add this arbitary wait, - * which has proven to be long enough to avoid this problem in practice */ - usleep(125000); - return instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); } @@ -647,11 +595,6 @@ int instcmd(const char *cmdname, const char *extradata) return ret; } - /* Some UPS's (e.g. TrippLive AVR750U w/ 3024 protocol) don't accept - * commands that arrive too rapidly, so add this arbitary wait, - * which has proven to be long enough to avoid this problem in practice */ - usleep(125000); - return instcmd("load.off.delay", dstate_getinfo("ups.delay.shutdown")); } @@ -659,11 +602,6 @@ int instcmd(const char *cmdname, const char *extradata) return STAT_INSTCMD_INVALID; } - upsdebugx(3, "%s: using Path '%s'", - __func__, - (hidups_item->hidpath ? hidups_item->hidpath : "[NULL]") - ); - /* Check if the item is an instant command */ if (!(hidups_item->hidflags & HU_TYPE_CMD)) { upsdebugx(2, "instcmd: %s is not an instant command\n", cmdname); @@ -682,7 +620,7 @@ int instcmd(const char *cmdname, const char *extradata) /* Actual variable setting */ if (HIDSetDataValue(udev, hidups_item->hiddata, value) == 1) { - upsdebugx(3, "instcmd: SUCCEED\n"); + upsdebugx(5, "instcmd: SUCCEED\n"); /* Set the status so that SEMI_STATIC vars are polled */ data_has_changed = TRUE; return STAT_INSTCMD_HANDLED; @@ -782,46 +720,33 @@ void upsdrv_makevartable(void) upsdebugx(1, "upsdrv_makevartable..."); - snprintf(temp, sizeof(temp), - "Set low battery level, in %% (default=%s)", - DEFAULT_LOWBATT); + snprintf(temp, sizeof(temp), "Set low battery level, in %% (default=%s).", DEFAULT_LOWBATT); addvar (VAR_VALUE, HU_VAR_LOWBATT, temp); - snprintf(temp, sizeof(temp), - "Set shutdown delay, in seconds (default=%s)", - DEFAULT_OFFDELAY); + snprintf(temp, sizeof(temp), "Set shutdown delay, in seconds (default=%s)", DEFAULT_OFFDELAY); addvar(VAR_VALUE, HU_VAR_OFFDELAY, temp); - snprintf(temp, sizeof(temp), - "Set startup delay, in seconds (default=%s)", - DEFAULT_ONDELAY); + snprintf(temp, sizeof(temp), "Set startup delay, in seconds (default=%s)", DEFAULT_ONDELAY); addvar(VAR_VALUE, HU_VAR_ONDELAY, temp); - snprintf(temp, sizeof(temp), - "Set polling frequency, in seconds, to reduce data flow (default=%d)", + snprintf(temp, sizeof(temp), "Set polling frequency, in seconds, to reduce data flow (default=%d)", DEFAULT_POLLFREQ); addvar(VAR_VALUE, HU_VAR_POLLFREQ, temp); addvar(VAR_FLAG, "pollonly", "Don't use interrupt pipe, only use polling"); - addvar(VAR_FLAG, "onlinedischarge", - "Set to treat discharging while online as being offline"); - #ifndef SHUT_MODE /* allow -x vendor=X, vendorid=X, product=X, productid=X, serial=X */ - nut_usb_addvars(); - - addvar(VAR_FLAG, "explore", - "Diagnostic matching of unsupported UPS"); - addvar(VAR_FLAG, "maxreport", - "Activate tweak for buggy APC Back-UPS firmware"); - addvar(VAR_FLAG, "interruptonly", - "Don't use polling, only use interrupt pipe"); - addvar(VAR_VALUE, "interruptsize", - "Number of bytes to read from interrupt pipe"); + addvar(VAR_VALUE, "vendor", "Regular expression to match UPS Manufacturer string"); + addvar(VAR_VALUE, "product", "Regular expression to match UPS Product string"); + addvar(VAR_VALUE, "serial", "Regular expression to match UPS Serial number"); + addvar(VAR_VALUE, "vendorid", "Regular expression to match UPS Manufacturer numerical ID (4 digits hexadecimal)"); + addvar(VAR_VALUE, "productid", "Regular expression to match UPS Product numerical ID (4 digits hexadecimal)"); + addvar(VAR_VALUE, "bus", "Regular expression to match USB bus name"); + addvar(VAR_FLAG, "explore", "Diagnostic matching of unsupported UPS"); + addvar(VAR_FLAG, "maxreport", "Activate tweak for buggy APC Back-UPS firmware"); #else - addvar(VAR_VALUE, "notification", - "Set notification type, (ignored, only for backward compatibility)"); + addvar(VAR_VALUE, "notification", "Set notification type, (ignored, only for backward compatibility)"); #endif } @@ -830,7 +755,7 @@ void upsdrv_makevartable(void) void upsdrv_updateinfo(void) { hid_info_t *item; - HIDData_t *event[MAX_EVENT_NUM], *found_data; + HIDData_t *event[MAX_EVENT_NUM]; int i, evtCount; double value; time_t now; @@ -842,7 +767,7 @@ void upsdrv_updateinfo(void) /* check for device availability to set datastale! */ if (hd == NULL) { /* don't flood reconnection attempts */ - if (now < (lastpoll + poll_interval)) { + if (now < (int)(lastpoll + poll_interval)) { return; } @@ -867,29 +792,7 @@ void upsdrv_updateinfo(void) /* Get HID notifications on Interrupt pipe first */ if (use_interrupt_pipe == TRUE) { evtCount = HIDGetEvents(udev, event, MAX_EVENT_NUM); - switch (evtCount) - { - case ERROR_BUSY: /* Device or resource busy */ - upslog_with_errno(LOG_CRIT, "Got disconnected by another driver"); - goto fallthrough_reconnect; -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ - case -EPERM: /* Operation not permitted */ -#endif - case ERROR_NO_DEVICE: /* No such device */ - case ERROR_ACCESS: /* Permission denied */ - case ERROR_IO: /* I/O error */ -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ - case -ENXIO: /* No such device or address */ -#endif - case ERROR_NOT_FOUND: /* No such file or directory */ - fallthrough_reconnect: - /* Uh oh, got to reconnect! */ - hd = NULL; - return; - default: - upsdebugx(1, "Got %i HID objects...", (evtCount >= 0) ? evtCount : 0); - break; - } + upsdebugx(1, "Got %i HID objects...", (evtCount >= 0) ? evtCount : 0); } else { evtCount = 0; upsdebugx(1, "Not using interrupt pipe..."); @@ -902,24 +805,14 @@ void upsdrv_updateinfo(void) continue; if (nut_debug_level >= 2) { - upsdebugx(2, - "Path: %s, Type: %s, ReportID: 0x%02x, " - "Offset: %i, Size: %i, Value: %g", + upsdebugx(2, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %g", HIDGetDataItem(event[i], subdriver->utab), HIDDataType(event[i]), event[i]->ReportID, event[i]->Offset, event[i]->Size, value); } /* Skip Input reports, if we don't use the Feature report */ - found_data = FindObject_with_Path(pDesc, &(event[i]->Path), interrupt_only ? ITEM_INPUT:ITEM_FEATURE); - if(!found_data && !interrupt_only) { - found_data = FindObject_with_Path(pDesc, &(event[i]->Path), ITEM_INPUT); - } - if(!found_data) { - upsdebugx(2, "Could not find event as either ITEM_INPUT or ITEM_FEATURE?"); - continue; - } - item = find_hid_info(found_data); + item = find_hid_info(FindObject_with_Path(pDesc, &(event[i]->Path), ITEM_FEATURE)); if (!item) { upsdebugx(3, "NUT doesn't use this HID object"); continue; @@ -928,14 +821,12 @@ void upsdrv_updateinfo(void) ups_infoval_set(item, value); } #ifdef DEBUG - upsdebugx(1, "took %.3f seconds handling interrupt reports...\n", - interval()); + upsdebugx(1, "took %.3f seconds handling interrupt reports...\n", interval()); #endif /* clear status buffer before begining */ status_init(); - /* Do a full update (polling) every pollfreq - * or upon data change (ie setvar/instcmd) */ + /* Do a full update (polling) every pollfreq or upon data change (ie setvar/instcmd) */ if ((now > (lastpoll + pollfreq)) || (data_has_changed == TRUE)) { upsdebugx(1, "Full update..."); @@ -962,8 +853,7 @@ void upsdrv_updateinfo(void) dstate_dataok(); #ifdef DEBUG - upsdebugx(1, "took %.3f seconds handling feature reports...\n", - interval()); + upsdebugx(1, "took %.3f seconds handling feature reports...\n", interval()); #endif } @@ -999,25 +889,18 @@ void upsdrv_initups(void) { int ret; char *val; - - upsdebugx(2, "Initializing an USB-connected UPS with library %s " \ - "(NUT subdriver name='%s' ver='%s')", - dstate_getinfo("driver.version.usb"), - comm_driver->name, comm_driver->version ); - #ifdef SHUT_MODE /*! * SHUT is a serial protocol, so it needs * only the device path */ - upsdebugx(1, "upsdrv_initups (SHUT)..."); + upsdebugx(1, "upsdrv_initups..."); subdriver_matcher = device_path; #else - char *regex_array[7]; + char *regex_array[6]; - upsdebugx(1, "upsdrv_initups (non-SHUT)..."); - warn_if_bad_usb_port_filename(device_path); + upsdebugx(1, "upsdrv_initups..."); subdriver_matcher = &subdriver_matcher_struct; @@ -1038,7 +921,6 @@ void upsdrv_initups(void) regex_array[3] = getval("product"); regex_array[4] = getval("serial"); regex_array[5] = getval("bus"); - regex_array[6] = getval("device"); ret = USBNewRegexMatcher(®ex_matcher, regex_array, REG_ICASE | REG_EXTENDED); switch(ret) @@ -1047,18 +929,8 @@ void upsdrv_initups(void) break; case -1: fatal_with_errno(EXIT_FAILURE, "HIDNewRegexMatcher()"); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); - /* Should not get here in practice, but - * compiler is afraid we can fall through */ -#endif default: fatalx(EXIT_FAILURE, "invalid regular expression: %s", regex_array[ret]); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); - /* Should not get here in practice, but - * compiler is afraid we can fall through */ -#endif } /* link the matchers */ @@ -1073,30 +945,9 @@ void upsdrv_initups(void) hd = &curDevice; - upsdebugx(1, "Detected a UPS: %s/%s", - hd->Vendor ? hd->Vendor : "unknown", + upsdebugx(1, "Detected a UPS: %s/%s", hd->Vendor ? hd->Vendor : "unknown", hd->Product ? hd->Product : "unknown"); - /* Activate Powercom tweaks */ - if (testvar("interruptonly")) { - interrupt_only = 1; - } - - /* Activate Cyberpower tweaks */ - if (testvar("onlinedischarge")) { - onlinedischarge = 1; - } - - val = getval("interruptsize"); - if (val) { - int ipv = atoi(val); - if (ipv > 0) { - interrupt_size = (unsigned int)ipv; - } else { - fatalx(EXIT_FAILURE, "Error: invalid interruptsize: %d", ipv); - } - } - if (hid_ups_walk(HU_WALKMODE_INIT) == FALSE) { fatalx(EXIT_FAILURE, "Can't initialize data from HID UPS"); } @@ -1157,7 +1008,6 @@ void upsdrv_cleanup(void) free(curDevice.Product); free(curDevice.Serial); free(curDevice.Bus); - free(curDevice.Device); #endif } @@ -1165,7 +1015,7 @@ void upsdrv_cleanup(void) * Support functions *********************************************************************/ -void possibly_supported(const char *mfr, HIDDevice_t *arghd) +void possibly_supported(const char *mfr, HIDDevice_t *hd) { upsdebugx(0, "This %s device (%04x:%04x) is not (or perhaps not yet) supported\n" @@ -1173,7 +1023,7 @@ void possibly_supported(const char *mfr, HIDDevice_t *arghd) "this does not fix the problem, try running the driver with the\n" "'-x productid=%04x' option. Please report your results to the NUT user's\n" "mailing list .\n", - mfr, arghd->VendorID, arghd->ProductID, arghd->ProductID); + mfr, hd->VendorID, hd->ProductID, hd->ProductID); } /* Update ups_status to remember this status item. Interpretation is @@ -1207,41 +1057,15 @@ static void process_boolean_info(const char *nutvalue) upsdebugx(5, "Warning: %s not in list of known values", nutvalue); } -static int callback( - hid_dev_handle_t argudev, - HIDDevice_t *arghd, - usb_ctrl_charbuf rdbuf, - usb_ctrl_charbufsize rdlen) +static int callback(hid_dev_handle_t udev, HIDDevice_t *hd, unsigned char *rdbuf, int rdlen) { int i; const char *mfr = NULL, *model = NULL, *serial = NULL; #ifndef SHUT_MODE int ret; #endif - upsdebugx(2, "Report Descriptor size = %" PRI_NUT_USB_CTRL_CHARBUFSIZE, rdlen); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -#endif - if ((uintmax_t)rdlen < (uintmax_t)SIZE_MAX) { - upsdebug_hex(3, "Report Descriptor", rdbuf, (size_t)rdlen); - } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) -# pragma GCC diagnostic pop -#endif - - /* Save the global "hd" for this driver instance */ - hd = arghd; - udev = argudev; + upsdebugx(2, "Report Descriptor size = %d", rdlen); + upsdebug_hex(3, "Report Descriptor", rdbuf, rdlen); /* Parse Report Descriptor */ Free_ReportDesc(pDesc); @@ -1275,10 +1099,7 @@ static int callback( upslogx(2, "Using subdriver: %s", subdriver->name); - if (subdriver->fix_report_desc(arghd, pDesc)) { - upsdebugx(2, "Report Descriptor Fixed"); - } - HIDDumpTree(udev, arghd, subdriver->utab); + HIDDumpTree(udev, subdriver->utab); #ifndef SHUT_MODE /* create a new matcher for later matching */ @@ -1337,15 +1158,6 @@ static double interval(void) } #endif -/* default subdriver function which doesn't attempt to fix - * any issues in the parsed HID Report Descriptor */ -int fix_report_desc(HIDDevice_t *arg_pDev, HIDDesc_t *arg_pDesc) { - NUT_UNUSED_VARIABLE(arg_pDev); - NUT_UNUSED_VARIABLE(arg_pDesc); - - return 0; -} - /* walk ups variables and set elements of the info array. */ static bool_t hid_ups_walk(walkmode_t mode) { @@ -1353,14 +1165,7 @@ static bool_t hid_ups_walk(walkmode_t mode) double value; int retcode; -#ifndef SHUT_MODE - /* extract the VendorId for further testing */ - int vendorID = curDevice.VendorID; - int productID = curDevice.ProductID; -#endif - - /* 3 modes: HU_WALKMODE_INIT, HU_WALKMODE_QUICK_UPDATE - * and HU_WALKMODE_FULL_UPDATE */ + /* 3 modes: HU_WALKMODE_INIT, HU_WALKMODE_QUICK_UPDATE and HU_WALKMODE_FULL_UPDATE */ /* Device data walk ----------------------------- */ for (item = subdriver->hid2nut; item->info_type != NULL; item++) { @@ -1436,62 +1241,22 @@ static bool_t hid_ups_walk(walkmode_t mode) break; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wcovered-switch-default" -# pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: fatalx(EXIT_FAILURE, "hid_ups_walk: unknown update mode!"); } -#ifdef __clang__ -# pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - -#ifndef SHUT_MODE - /* skip report 0x54 for Tripplite SU3000LCD2UHV due to firmware bug */ - if ((vendorID == 0x09ae) && (productID == 0x1330)) { - if (item->hiddata && (item->hiddata->ReportID == 0x54)) { - continue; - } - } -#endif retcode = HIDGetDataValue(udev, item->hiddata, &value, poll_interval); switch (retcode) { - case ERROR_BUSY: /* Device or resource busy */ + case -EBUSY: /* Device or resource busy */ upslog_with_errno(LOG_CRIT, "Got disconnected by another driver"); - goto fallthrough_reconnect; -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ case -EPERM: /* Operation not permitted */ -#endif - case ERROR_NO_DEVICE: /* No such device */ - case ERROR_ACCESS: /* Permission denied */ - case ERROR_IO: /* I/O error */ -#if WITH_LIBUSB_0_1 /* limit to libusb 0.1 implementation */ + case -ENODEV: /* No such device */ + case -EACCES: /* Permission denied */ + case -EIO: /* I/O error */ case -ENXIO: /* No such device or address */ -#endif - case ERROR_NOT_FOUND: /* No such file or directory */ - fallthrough_reconnect: + case -ENOENT: /* No such file or directory */ /* Uh oh, got to reconnect! */ hd = NULL; return FALSE; @@ -1502,27 +1267,20 @@ static bool_t hid_ups_walk(walkmode_t mode) case 0: continue; - case ERROR_TIMEOUT: /* Connection timed out */ - case ERROR_OVERFLOW: /* Value too large for defined data type */ -#if EPROTO && WITH_LIBUSB_0_1 + case -ETIMEDOUT: /* Connection timed out */ + case -EOVERFLOW: /* Value too large for defined data type */ case -EPROTO: /* Protocol error */ -#endif - case ERROR_PIPE: /* Broken pipe */ + case -EPIPE: /* Broken pipe */ default: /* Don't know what happened, try again later... */ continue; } - upsdebugx(2, - "Path: %s, Type: %s, ReportID: 0x%02x, " - "Offset: %i, Size: %i, Value: %g", - item->hidpath, HIDDataType(item->hiddata), - item->hiddata->ReportID, + upsdebugx(2, "Path: %s, Type: %s, ReportID: 0x%02x, Offset: %i, Size: %i, Value: %g", + item->hidpath, HIDDataType(item->hiddata), item->hiddata->ReportID, item->hiddata->Offset, item->hiddata->Size, value); if (item->hidflags & HU_TYPE_CMD) { - upsdebugx(3, "Adding command '%s' using Path '%s'", - item->info_type, item->hidpath); dstate_addcmd(item->info_type); continue; } @@ -1569,10 +1327,6 @@ static int reconnect_ups(void) upsdebugx(4, "= device has been disconnected, try to reconnect ="); upsdebugx(4, "=================================================="); - /* Try to close the previous handle */ - if (udev) - comm_driver->close(udev); - ret = comm_driver->open(&udev, &curDevice, subdriver_matcher, NULL); if (ret > 0) { @@ -1624,12 +1378,6 @@ static void ups_alarm_set(void) } } -/* Return the current value of ups_status */ -unsigned ups_status_get(void) -{ - return ups_status; -} - /* Convert the local status information to NUT format and set NUT status. */ static void ups_status_set(void) @@ -1642,27 +1390,10 @@ static void ups_status_set(void) dstate_delinfo("input.transfer.reason"); } - - if (!(ups_status & STATUS(ONLINE))) { + if (ups_status & STATUS(ONLINE)) { + status_set("OL"); /* on line */ + } else { status_set("OB"); /* on battery */ - } else if ((ups_status & STATUS(DISCHRG))) { - /* if online */ - if (onlinedischarge) { - /* if we treat OL+DISCHRG as being offline */ - status_set("OB"); /* on battery */ - } else { - if (!(ups_status & STATUS(CAL))) { - /* if in OL+DISCHRG unknowingly, warn user */ - upslogx(LOG_WARNING, "%s: seems that UPS [%s] is in OL+DISCHRG state now. " - "Is it calibrating or do you perhaps want to set 'onlinedischarge' option? " - "Some UPS models (e.g. CyberPower UT series) emit OL+DISCHRG when offline.", - __func__, upsname); - } - /* if we're calibrating */ - status_set("OL"); /* on line */ - } - } else if ((ups_status & STATUS(ONLINE))) { - status_set("OL"); } if ((ups_status & STATUS(DISCHRG)) && !(ups_status & STATUS(DEPLETED))) { @@ -1725,11 +1456,6 @@ static hid_info_t *find_hid_info(const HIDData_t *hiddata) { hid_info_t *hidups_item; - if(!hiddata) { - upsdebugx(2, "%s: hiddata == NULL", __func__); - return NULL; - } - for (hidups_item = subdriver->hid2nut; hidups_item->info_type != NULL ; hidups_item++) { /* Skip server side vars */ @@ -1759,16 +1485,12 @@ static long hu_find_valinfo(info_lkp_t *hid2info, const char* value) for (info_lkp = hid2info; info_lkp->nut_value != NULL; info_lkp++) { if (!(strcmp(info_lkp->nut_value, value))) { - upsdebugx(5, - "hu_find_valinfo: found %s (value: %ld)", - info_lkp->nut_value, info_lkp->hid_value); + upsdebugx(5, "hu_find_valinfo: found %s (value: %ld)", info_lkp->nut_value, info_lkp->hid_value); return info_lkp->hid_value; } } - upsdebugx(3, - "hu_find_valinfo: no matching HID value for this INFO_* value (%s)", - value); + upsdebugx(3, "hu_find_valinfo: no matching HID value for this INFO_* value (%s)", value); return -1; } @@ -1785,16 +1507,12 @@ static const char *hu_find_infoval(info_lkp_t *hid2info, const double value) /* use 'value' as an index for a lookup in an array */ for (info_lkp = hid2info; info_lkp->nut_value != NULL; info_lkp++) { if (info_lkp->hid_value == (long)value) { - upsdebugx(5, - "hu_find_infoval: found %s (value: %ld)", - info_lkp->nut_value, (long)value); + upsdebugx(5, "hu_find_infoval: found %s (value: %ld)", info_lkp->nut_value, (long)value); return info_lkp->nut_value; } } - upsdebugx(3, - "hu_find_infoval: no matching INFO_* value for this HID value (%g)", - value); + upsdebugx(3, "hu_find_infoval: no matching INFO_* value for this HID value (%g)", value); return NULL; } @@ -1825,19 +1543,7 @@ static int ups_infoval_set(hid_info_t *item, double value) dstate_setinfo(item->info_type, "%s", nutvalue); } else { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif dstate_setinfo(item->info_type, item->dfl, value); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif } return 1; diff --git a/drivers/usbhid-ups.h b/drivers/usbhid-ups.h index 5cdf7e6..4f4b3c3 100644 --- a/drivers/usbhid-ups.h +++ b/drivers/usbhid-ups.h @@ -52,9 +52,7 @@ extern bool_t use_interrupt_pipe; /* Set to FALSE if interrupt reports should /* The driver will wait for Interrupt */ /* and do "light poll" in the meantime */ -#ifndef MAX_STRING_SIZE -#define MAX_STRING_SIZE 128 -#endif +#define MAX_STRING_SIZE 128 /* --------------------------------------------------------------- */ @@ -69,9 +67,6 @@ typedef struct { double (*nuf)(const char *nut_value); /* optional NUT to HID mapping */ } info_lkp_t; -/* accessor on the status */ -extern unsigned ups_status_get(void); - /* declarations of public lookup tables */ /* boolean status values from UPS */ extern info_lkp_t online_info[]; @@ -116,40 +111,6 @@ extern info_lkp_t stringid_conversion[]; extern info_lkp_t divide_by_10_conversion[]; extern info_lkp_t kelvin_celsius_conversion[]; -/* ---------------------------------------------------------------------- */ -/* data for processing boolean values from UPS */ - -#define STATUS(x) ((unsigned)1<%s<>%s<\n",temp,temp+3); + upsdebugx(1, "ups.model >%s<>%s<\n",temp,temp+3); } - + /* ups.mfr */ if (get_data("vDm?",temp)) return; dstate_setinfo("ups.mfr", "%s", temp+3); - upsdebugx(1, "ups.mfr >%s<>%s<\n",temp,temp+3); - + upsdebugx(1, "ups.mfr >%s<>%s<\n",temp,temp+3); + /* ups.serial */ if (exist_ups_serial) - { + { if (get_data("vDS?",temp)) return; dstate_setinfo("ups.serial", "%s", temp+3); - } - upsdebugx(1, "ups.serial >%s<>%s<\n",temp,temp+3); + } + upsdebugx(1, "ups.serial >%s<>%s<\n",temp,temp+3); - /* ups.firmware */ + /* ups.firmware */ if (get_data("vDV?",temp)) return; dstate_setinfo("ups.firmware", "%s", temp+3); - upsdebugx(1, "ups.firmware >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "ups.firmware >%s<>%s<\n",temp,temp+3); /* ups.temperature */ if (exist_ups_temperature) - { + { if (get_data("vBT?",temp)) return; dstate_setinfo("ups.temperature", "%s", temp+3); - } - upsdebugx(1, "ups.temperature >%s<>%s<\n",temp,temp+3); + } + upsdebugx(1, "ups.temperature >%s<>%s<\n",temp,temp+3); /* ups.load */ if (get_data("vO0L?",temp)) return; dstate_setinfo("ups.load", "%s", temp+4); - upsdebugx(1, "ups.load >%s<>%s<\n",temp,temp+4); + upsdebugx(1, "ups.load >%s<>%s<\n",temp,temp+4); - /* ups protocol */ - /* - if (get_data("vDC?",temp)) return; + /* ups protocol */ + /*if (get_data("vDC?",temp)) return; dstate_setinfo("ups.protocol", "%s", temp+3; - upsdebugx(1, "ups.protocol >%s<>%s<\n",temp,temp+3; + upsdebugx(1, "ups.protocol >%s<>%s<\n",temp,temp+3; */ /************** input.x *****************/ - + /* input.voltage */ if (get_data("vI0U?",temp)) return; dstate_setinfo("input.voltage", "%s", temp+4); - upsdebugx(1, "input.voltage >%s<>%s<\n",temp,temp+4); - + upsdebugx(1, "input.voltage >%s<>%s<\n",temp,temp+4); + /* input.transfer.low */ if (get_data("vFi?",temp)) return; dstate_setinfo("input.transfer.low", "%s", temp+3); - upsdebugx(1, "input.transfer.low >%s<>%s<\n",temp,temp+3); - + upsdebugx(1, "input.transfer.low >%s<>%s<\n",temp,temp+3); + /* input.transfer.high */ if (get_data("vFj?",temp)) return; dstate_setinfo("input.transfer.high", "%s", temp+3); @@ -423,75 +422,75 @@ void upsdrv_updateinfo(void) /* input.frequency */ if (get_data("vI0f?",temp)) return; dstate_setinfo("input.frequency", "%2.1f", atof(temp+4) / 10.0); - upsdebugx(1, "input.frequency >%s<>%s<\n",temp,temp+4); - - - /*************** output.x ********************************/ + upsdebugx(1, "input.frequency >%s<>%s<\n",temp,temp+4); + /*************** output.x ********************************/ + + /* output.voltage */ if (get_data("vO0U?",temp)) return; dstate_setinfo("output.voltage", "%s", temp+4); - upsdebugx(1, "output.voltage >%s<>%s<\n",temp,temp+4); - + upsdebugx(1, "output.voltage >%s<>%s<\n",temp,temp+4); + /* output.frequency */ if (get_data("vOf?",temp)) return; dstate_setinfo("output.frequency", "%2.1f", atof(temp+3) / 10.0); - upsdebugx(1, "output.frequency >%s<>%s<\n",temp,temp+3); + upsdebugx(1, "output.frequency >%s<>%s<\n",temp,temp+3); /* output.current */ if (exist_output_current) - { + { if (get_data("vO0I?",temp)) return; dstate_setinfo("output.current", "%2.1f", atof(temp+4) / 10.0); - } - upsdebugx(1, "output.current >%s<>%s<\n",temp,temp+4); - - + } + upsdebugx(1, "output.current >%s<>%s<\n",temp,temp+4); + + /*************** battery.x *******************************/ - + /* battery charge */ if (exist_battery_charge) - { + { if (get_data("vBC?",temp)) return; dstate_setinfo("battery.charge", "%s", temp+3); - } - upsdebugx(1, "battery.charge >%s<>%s<\n",temp,temp+3); - + } + upsdebugx(1, "battery.charge >%s<>%s<\n",temp,temp+3); + /* battery.voltage */ if (get_data("vBU?",temp)) return; dstate_setinfo("battery.voltage", "%2.1f", atof(temp+3) / 10.0); - upsdebugx(1, "battery.voltage >%s<>%s<\n",temp,temp+3); - + upsdebugx(1, "battery.voltage >%s<>%s<\n",temp,temp+3); + /* battery.current */ if (exist_battery_current) - { + { if (get_data("vBI?",temp)) return; dstate_setinfo("battery.current", "%2.1f", atof(temp+3) / 10.0); - } - upsdebugx(1, "battery.current >%s<>%s<\n",temp,temp+3); + } + upsdebugx(1, "battery.current >%s<>%s<\n",temp,temp+3); /* battery.temperature */ if (exist_battery_temperature) - { + { if (get_data("vBT?",temp)) return; dstate_setinfo("battery.temperature", "%s", temp+3); - } - upsdebugx(1, "battery.temperature >%s<>%s<\n",temp,temp+3); + } + upsdebugx(1, "battery.temperature >%s<>%s<\n",temp,temp+3); /* battery.runtime */ if (exist_battery_runtime) - { + { if (get_data("vBt?",temp)) return; runtime_sec = strtol(temp+3, NULL, 10)*60; - snprintf(temp, sizeof(temp), "%ld", runtime_sec); + snprintf(temp, sizeof(temp), "%d", runtime_sec); dstate_setinfo("battery.runtime", "%s", temp); - } - upsdebugx(1, "battery.runtime >%s<>%ld<\n",temp,runtime_sec); + } + upsdebugx(1, "battery.runtime >%s<>%d<\n",temp,runtime_sec); dstate_dataok(); } @@ -501,7 +500,7 @@ void upsdrv_shutdown(void) ser_send(upsfd, "vCc0!%c", ENDCHAR); usleep(UPS_DELAY); - ser_send(upsfd, "vCb%i!%c", sdwdelay, ENDCHAR); + ser_send(upsfd, "vCb%i!%c", sdwdelay, ENDCHAR); } void upsdrv_help(void) @@ -512,27 +511,25 @@ void upsdrv_help(void) void upsdrv_makevartable(void) { addvar(VAR_VALUE, "usd", "Seting delay before shutdown"); - addvar(VAR_VALUE, "modelname", "Seting model name"); + addvar(VAR_VALUE, "modelname", "Seting model name"); } void upsdrv_initups(void) { char temp[ LENGTH_TEMP ], *usd = NULL; /* = NULL je dulezite jen pro prekladac */ - - + + upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B1200); - if ((usd = getval("usd"))) - { + if ((usd = getval("usd"))) { sdwdelay=atoi(usd); upsdebugx(1, "(-x) Delay before shutdown %i",sdwdelay); } - if ((model_name = getval("modelname"))) - { - /* kdyz modelname nebylo zadano je vraceno NULL*/ + if ((model_name = getval("modelname"))) { + /* kdyz modelname nebylo zadano je vraceno NULL*/ upsdebugx(1, "(-x) UPS Name %s",model_name); } diff --git a/drivers/xppc-mib.c b/drivers/xppc-mib.c deleted file mode 100644 index cfbc450..0000000 --- a/drivers/xppc-mib.c +++ /dev/null @@ -1,133 +0,0 @@ -/* xppc-mib.c - subdriver to monitor XPPC SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * 2014 Charles Lepple - * - * Note: this subdriver was initially generated as a "stub" by the - * scripts/subdriver/gen-snmp-subdriver.sh script. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "xppc-mib.h" - -#define XPPC_MIB_VERSION "0.4" - -#define XPPC_SYSOID ".1.3.6.1.4.1.935" - -/* To create a value lookup structure (as needed on the 2nd line of the example - * below), use the following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t xpcc_onbatt_info[] = { - * { 1, "OB", NULL, NULL }, - * { 2, "OL", NULL, NULL }, - * { 0, NULL, NULL, NULL } - * }; - */ - -/* upsBaseBatteryStatus */ -static info_lkp_t xpcc_onbatt_info[] = { - { 1, "", NULL, NULL }, /* unknown */ - { 2, "", NULL, NULL }, /* batteryNormal */ - { 3, "LB", NULL, NULL }, /* batteryLow */ - { 0, NULL, NULL, NULL } -}; - -/* -upsBaseOutputStatus OBJECT-TYPE - SYNTAX INTEGER { - unknown(1), - onLine(2), - onBattery(3), - onBoost(4), - sleeping(5), - onBypass(6), - rebooting(7), - standBy(8), - onBuck(9) } -*/ -static info_lkp_t xpcc_power_info[] = { - { 1, "", NULL, NULL }, /* unknown */ - { 2, "OL", NULL, NULL }, /* onLine */ - { 3, "OB", NULL, NULL }, /* onBattery */ - { 4, "OL BOOST", NULL, NULL }, /* onBoost */ - { 5, "OFF", NULL, NULL }, /* sleeping */ - { 6, "BYPASS", NULL, NULL }, /* onBypass */ - { 7, "", NULL, NULL }, /* rebooting */ - { 8, "OFF", NULL, NULL }, /* standBy */ - { 9, "OL TRIM", NULL, NULL }, /* onBuck */ - { 0, NULL, NULL, NULL } -}; - -/* XPPC Snmp2NUT lookup table */ -static snmp_info_t xppc_mib[] = { - - /* Data format: - * { info_type, info_flags, info_len, OID, dfl, flags, oid2info, setvar }, - * - * info_type: NUT INFO_ or CMD_ element name - * info_flags: flags to set in addinfo - * info_len: length of strings if STR - * cmd value if CMD, multiplier otherwise - * OID: SNMP OID or NULL - * dfl: default value - * flags: snmp-ups internal flags (FIXME: ...) - * oid2info: lookup table between OID and NUT values - * - * Example: - * { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, xpcc_onbatt_info }, - * - * To create a value lookup structure (as needed on the 2nd line), use the - * following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t xpcc_onbatt_info[] = { - * { 1, "OB" }, - * { 2, "OL" }, - * { 0, NULL } - * }; - */ - - /* standard MIB items */ - { "device.description", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.1.0", NULL, SU_FLAG_OK, NULL }, - { "device.contact", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.4.0", NULL, SU_FLAG_OK, NULL }, - { "device.location", ST_FLAG_STRING | ST_FLAG_RW, SU_INFOSIZE, ".1.3.6.1.2.1.1.6.0", NULL, SU_FLAG_OK, NULL }, - - { "ups.mfr", ST_FLAG_STRING, SU_INFOSIZE, NULL, "Tripp Lite / Phoenixtec", - SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL }, - - /* upsBaseIdentModel.0 = STRING: "Intelligent" */ - { "ups.model", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.1.1.1.0", "Generic Phoenixtec SNMP device", SU_FLAG_OK, NULL }, - /* upsBaseBatteryStatus.0 = INTEGER: batteryNormal(2) */ - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.2.1.1.0", "", SU_STATUS_BATT | SU_TYPE_INT | SU_FLAG_OK, xpcc_onbatt_info }, - /* upsSmartBatteryCapacity.0 = INTEGER: 100 */ - { "battery.charge", 0, 1, ".1.3.6.1.4.1.935.1.1.1.2.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsSmartBatteryTemperature.0 = INTEGER: 260 */ - { "ups.temperature", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.2.2.3.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsSmartInputLineVoltage.0 = INTEGER: 1998 */ - { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.3.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsBaseOutputStatus.0 = INTEGER: onLine(2) */ - { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.935.1.1.1.4.1.1.0", "", SU_TYPE_INT | SU_STATUS_PWR, xpcc_power_info }, - /* upsSmartOutputVoltage.0 = INTEGER: 2309 */ - { "output.voltage", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.4.2.1.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsSmartOutputFrequency.0 = INTEGER: 500 */ - { "output.frequency", 0, 0.1, ".1.3.6.1.4.1.935.1.1.1.4.2.2.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - /* upsSmartOutputLoad.0 = INTEGER: 7 */ - { "ups.load", 0, 1, ".1.3.6.1.4.1.935.1.1.1.4.2.3.0", NULL, SU_TYPE_INT | SU_FLAG_OK, NULL }, - - /* end of structure. */ - { NULL, 0, 0, NULL, NULL, 0, NULL } -}; - -mib2nut_info_t xppc = { "xppc", XPPC_MIB_VERSION, NULL, NULL, xppc_mib, XPPC_SYSOID, NULL }; diff --git a/drivers/xppc-mib.h b/drivers/xppc-mib.h deleted file mode 100644 index e2a360b..0000000 --- a/drivers/xppc-mib.h +++ /dev/null @@ -1,29 +0,0 @@ -/* xppc-mib.h - subdriver to monitor XPPC SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2012 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef XPPC_MIB_H -#define XPPC_MIB_H - -#include "main.h" -#include "snmp-ups.h" - -extern mib2nut_info_t xppc; - -#endif /* XPPC_MIB_H */ diff --git a/include/Makefile.am b/include/Makefile.am index c16d8c3..6e4b966 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,39 +1,32 @@ dist_noinst_HEADERS = attribute.h common.h extstate.h parseconf.h proto.h \ - state.h str.h timehead.h upsconf.h nut_float.h nut_stdint.h nut_platform.h + state.h timehead.h upsconf.h nut_stdint.h nut_platform.h # http://www.gnu.org/software/automake/manual/automake.html#Clean BUILT_SOURCES = nut_version.h CLEANFILES = nut_version.h -MAINTAINERCLEANFILES = Makefile.in .dirstamp # magic to include Git version information in NUT version string -# (for builds not made from the tagged commit in a Git workspace) nut_version.h: FORCE - @GITREV="`git describe --tags 2>/dev/null | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,'`" || GITREV=""; \ - { echo '/* Autogenerated file. Do not change. */' ; \ - echo '/* This file was generated by "make". */' ; \ - if [ -z "$$GITREV" ]; then \ - NUT_VERSION="$(PACKAGE_VERSION)"; \ - echo '/* The version number is set by AC_INIT in configure.ac. */' ; \ - else \ - NUT_VERSION="$$GITREV"; \ - echo '/* The version number is determined by Git source commit hash' ; \ - echo ' * and number of commits since the most recent Git tag (if not' ; \ - echo ' * building the newest tagged commit itself - then just the tag).'; \ - echo ' */' ; \ - fi ; \ - echo "#define NUT_VERSION_MACRO \"$$NUT_VERSION\"" ; \ - } > "$@.tmp" ; \ - echo "NUT_VERSION: \"$$NUT_VERSION\"" - -test -f "$@" || cp "$@.tmp" "$@" - -cmp -s "$@.tmp" "$@" || cp "$@.tmp" "$@" - -rm -f "$@.tmp" + @GITREV=`git describe --tags 2>/dev/null | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,' ` || GITREV=""; \ + echo '/* Autogenerated file. Do not change. */' > _nut_version.h ; \ + echo '/* This file was generated by "make". */' >> _nut_version.h ; \ + if [ -z "$$GITREV" ]; \ + then NUT_VERSION="$(PACKAGE_VERSION)"; \ + echo '/* The version number is set by AC_INIT in configure.in. */' >> _nut_version.h ; \ + else NUT_VERSION="$$GITREV"; \ + echo '/* The version number is determined by the most recent Git tag. */' >> _nut_version.h ; \ + fi ; \ + echo "#define NUT_VERSION_MACRO \"$$NUT_VERSION\"" >> _nut_version.h ; \ + echo "NUT_VERSION: \"$$NUT_VERSION\"" + -test -f nut_version.h || cp _nut_version.h nut_version.h + -cmp -s _nut_version.h nut_version.h || cp _nut_version.h nut_version.h + -rm -f _nut_version.h FORCE: # counter part of BUILT_SOURCES: since nut_version is not a direct -# deps of a local target, we must clean it by ourselves before the +# deps of a local target, we must clean it by ourself before the # distribution dist-hook: rm -f $(distdir)/nut_version.h diff --git a/include/Makefile.in b/include/Makefile.in index fed410a..cc95d61 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,61 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,24 +53,20 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = include +DIST_COMMON = $(dist_noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -116,34 +75,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(dist_noinst_HEADERS) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -152,36 +93,15 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(dist_noinst_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ - config.h.in -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -192,7 +112,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -206,7 +125,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -219,8 +137,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -230,15 +151,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -249,29 +169,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -291,9 +203,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -302,16 +211,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -325,7 +230,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -336,12 +240,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -360,21 +260,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -385,13 +282,12 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ dist_noinst_HEADERS = attribute.h common.h extstate.h parseconf.h proto.h \ - state.h str.h timehead.h upsconf.h nut_float.h nut_stdint.h nut_platform.h + state.h timehead.h upsconf.h nut_stdint.h nut_platform.h # http://www.gnu.org/software/automake/manual/automake.html#Clean BUILT_SOURCES = nut_version.h CLEANFILES = nut_version.h -MAINTAINERCLEANFILES = Makefile.in .dirstamp all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am @@ -408,13 +304,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -427,8 +324,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): config.h: stamp-h1 - @test -f $@ || rm -f stamp-h1 - @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 + @if test ! -f $@; then rm -f stamp-h1; else :; fi + @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 @@ -447,15 +344,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -467,11 +375,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -480,29 +392,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -542,8 +436,7 @@ all-am: Makefile $(HEADERS) config.h installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-exec-am +install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -574,7 +467,6 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -641,52 +533,44 @@ ps-am: uninstall-am: -.MAKE: all check install install-am install-exec install-strip +.MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool cscopelist-am ctags ctags-am dist-hook distclean \ - distclean-generic distclean-hdr distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags dist-hook distclean distclean-generic \ + distclean-hdr distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am # magic to include Git version information in NUT version string -# (for builds not made from the tagged commit in a Git workspace) nut_version.h: FORCE - @GITREV="`git describe --tags 2>/dev/null | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,'`" || GITREV=""; \ - { echo '/* Autogenerated file. Do not change. */' ; \ - echo '/* This file was generated by "make". */' ; \ - if [ -z "$$GITREV" ]; then \ - NUT_VERSION="$(PACKAGE_VERSION)"; \ - echo '/* The version number is set by AC_INIT in configure.ac. */' ; \ - else \ - NUT_VERSION="$$GITREV"; \ - echo '/* The version number is determined by Git source commit hash' ; \ - echo ' * and number of commits since the most recent Git tag (if not' ; \ - echo ' * building the newest tagged commit itself - then just the tag).'; \ - echo ' */' ; \ - fi ; \ - echo "#define NUT_VERSION_MACRO \"$$NUT_VERSION\"" ; \ - } > "$@.tmp" ; \ - echo "NUT_VERSION: \"$$NUT_VERSION\"" - -test -f "$@" || cp "$@.tmp" "$@" - -cmp -s "$@.tmp" "$@" || cp "$@.tmp" "$@" - -rm -f "$@.tmp" + @GITREV=`git describe --tags 2>/dev/null | sed -e 's/^v\([0-9]\)/\1/' -e 's,^.*/,,' ` || GITREV=""; \ + echo '/* Autogenerated file. Do not change. */' > _nut_version.h ; \ + echo '/* This file was generated by "make". */' >> _nut_version.h ; \ + if [ -z "$$GITREV" ]; \ + then NUT_VERSION="$(PACKAGE_VERSION)"; \ + echo '/* The version number is set by AC_INIT in configure.in. */' >> _nut_version.h ; \ + else NUT_VERSION="$$GITREV"; \ + echo '/* The version number is determined by the most recent Git tag. */' >> _nut_version.h ; \ + fi ; \ + echo "#define NUT_VERSION_MACRO \"$$NUT_VERSION\"" >> _nut_version.h ; \ + echo "NUT_VERSION: \"$$NUT_VERSION\"" + -test -f nut_version.h || cp _nut_version.h nut_version.h + -cmp -s _nut_version.h nut_version.h || cp _nut_version.h nut_version.h + -rm -f _nut_version.h FORCE: # counter part of BUILT_SOURCES: since nut_version is not a direct -# deps of a local target, we must clean it by ourselves before the +# deps of a local target, we must clean it by ourself before the # distribution dist-hook: rm -f $(distdir)/nut_version.h diff --git a/include/attribute.h b/include/attribute.h index f6ce29b..3fe3f4a 100644 --- a/include/attribute.h +++ b/include/attribute.h @@ -1,71 +1,12 @@ -/* attribute.h - portability hacks for __attribute__ usage in other header files +/* portability hacks for __attribute__ usage in other header files */ - Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2020 Jim Klimov +#ifndef ATTRIBUTE_H_SEEN +#define ATTRIBUTE_H_SEEN 1 - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_ATTRIBUTE_H_SEEN -#define NUT_ATTRIBUTE_H_SEEN 1 - -/* To complicate matters, compilers with native support - * for the keyword may expose or not expose it as a macro... - * but for those that perform such courtesy, or are known - * supporters, we can put up the flag. For others, someone - * with those compilers should check and file PRs to NUT. - */ -#if (!defined HAVE___ATTRIBUTE__) || (HAVE___ATTRIBUTE__ == 0) -# if ( defined(__GNUC__) && ( __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) ) ) || ( defined(__STRICT_ANSI__) && __STRICT_ANSI__ ) -# ifndef __attribute__ -# define __attribute__(x) -# endif -# ifndef HAVE___ATTRIBUTE__ -# define HAVE___ATTRIBUTE__ 0 -# endif -# else -# if defined(__clang__) || defined(__GNUC__) || defined(__SUNPRO_C) -# ifndef HAVE___ATTRIBUTE__ -# define HAVE___ATTRIBUTE__ 1 -# endif -# else -# ifndef HAVE___ATTRIBUTE__ -# define HAVE___ATTRIBUTE__ 0 -# endif -# endif +#ifndef __attribute__ +# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__ +# define __attribute__(x) # endif #endif -#if (!defined HAVE___ATTRIBUTE__) || (HAVE___ATTRIBUTE__ == 0) -# ifdef HAVE___ATTRIBUTE__UNUSED_ARG -# undef HAVE___ATTRIBUTE__UNUSED_ARG -# endif -# ifdef HAVE___ATTRIBUTE__UNUSED_FUNC -# undef HAVE___ATTRIBUTE__UNUSED_FUNC -# endif -# ifdef HAVE___ATTRIBUTE__NORETURN -# undef HAVE___ATTRIBUTE__NORETURN -# endif -# ifdef HAVE___ATTRIBUTE__ -# undef HAVE___ATTRIBUTE__ -# endif -#endif - -/* Other source files now can simply check for `ifdef HAVE___ATTRIBUTE__*` - * as usual, and not bother about 0/1 values of the macro as well. - */ - -#endif /* NUT_ATTRIBUTE_H_SEEN */ +#endif /* ATTRIBUTE_H_SEEN */ diff --git a/include/common.h b/include/common.h index ff48ecd..fb5df62 100644 --- a/include/common.h +++ b/include/common.h @@ -1,3 +1,6 @@ +#ifndef NUT_COMMON_H +#define NUT_COMMON_H + /* common.h - prototypes for the common useful functions Copyright (C) 2000 Russell Kroll @@ -17,9 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_COMMON_H_SEEN -#define NUT_COMMON_H_SEEN 1 - #include "config.h" /* must be the first header */ /* Need this on AIX when using xlc to get alloca */ @@ -33,23 +33,9 @@ #include #include #include - -#ifdef HAVE_SYS_SIGNAL_H -#include -#endif -#ifdef HAVE_SIGNAL_H #include -#endif - #include - -#ifdef HAVE_STRINGS_H -#include /* for strncasecmp() and strcasecmp() */ -#endif -#ifdef HAVE_STRING_H -#include /* for strdup() and many others */ -#endif - +#include #include #include #include @@ -57,7 +43,6 @@ #include "timehead.h" #include "attribute.h" #include "proto.h" -#include "str.h" #ifdef __cplusplus /* *INDENT-OFF* */ @@ -67,24 +52,6 @@ extern "C" { extern const char *UPS_VERSION; -/* Use in code to notify the developers and quiesce the compiler that - * (for this codepath) the argument or variable is unused intentionally. - * void f(int x) { - * NUT_UNUSED_VARIABLE(x); - * ... - * } - * - * Note that solutions which mark up function arguments or employ this or - * that __attribute__ proved not portable enough for wherever NUT builds. - */ -#define NUT_UNUSED_VARIABLE(x) (void)(x) - -/** @brief Default timeout (in seconds) for network operations, as used by `upsclient` and `nut-scanner`. */ -#define DEFAULT_NETWORK_TIMEOUT 5 - -/** @brief Default timeout (in seconds) for retrieving the result of a `TRACKING`-enabled operation (e.g. `INSTCMD`, `SET VAR`). */ -#define DEFAULT_TRACKING_TIMEOUT 10 - /* get the syslog ready for us */ void open_syslog(const char *progname); @@ -103,30 +70,13 @@ void chroot_start(const char *path); /* write a pid file - is a full pathname *or* just the program name */ void writepid(const char *name); -/* parses string buffer into a pid_t if it passes - * a few sanity checks; returns -1 on error */ -pid_t parsepid(const char *buf); - /* send a signal to another running process */ int sendsignal(const char *progname, int sig); int snprintfcat(char *dst, size_t size, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 3, 4))); -/* Report maximum platform value for the pid_t */ -pid_t get_max_pid_t(void); - -/* send sig to pid after some sanity checks, returns - * -1 for error, or zero for a successfully sent signal */ -int sendsignalpid(pid_t pid, int sig); - -/* open , get the pid, then send it - * returns zero for successfully sent signal, - * negative for errors: - * -3 PID file not found - * -2 PID file not parsable - * -1 Error sending signal - */ +/* open , get the pid, then send it */ int sendsignalfn(const char *pidfn, int sig); const char *xbasename(const char *file); @@ -144,53 +94,16 @@ const char * dflt_statepath(void); /* Return the alternate path for pid files */ const char * altpidpath(void); -/* Die with a standard message if socket filename is too long */ -void check_unix_socket_filename(const char *fn); - -/* upslog*() messages are sent to syslog always; - * their life after that is out of NUT's control */ void upslog_with_errno(int priority, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); void upslogx(int priority, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); - -/* upsdebug*() messages are only logged if debugging - * level is high enough. To speed up a bit (minimize - * passing of ultimately ignored data trough the stack) - * these are "hidden" implementations wrapped into - * macros for earlier routine names spread around the - * codebase, they would check debug level first and - * only if logging should happen - call the routine - * and pass around pointers and other data. - */ -void s_upsdebug_with_errno(int level, const char *fmt, ...) +void upsdebug_with_errno(int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -void s_upsdebugx(int level, const char *fmt, ...) +void upsdebugx(int level, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); -void s_upsdebug_hex(int level, const char *msg, const void *buf, size_t len); -void s_upsdebug_ascii(int level, const char *msg, const void *buf, size_t len); -/* These macros should help avoid run-time overheads - * passing data for messages nobody would ever see. - * - * Also NOTE: the "level" may be specified by callers in various ways, - * e.g. as a "X ? Y : Z" style expression; to catch those expansions - * transparently we hide them into parentheses as "(label)". - * - * For stricter C99 compatibility, all parameters specified to a macro - * must be populated by caller (so we do not handle "fmt, args..." where - * the args part may be skipped by caller because fmt is a fixed string). - * Note it is then up to the caller (and compiler checks) that at least - * one argument is provided, the format string (maybe fixed) -- as would - * be required by the actual s_upsdebugx*() method after macro evaluation. - */ -#define upsdebug_with_errno(level, ...) \ - do { if (nut_debug_level >= (level)) { s_upsdebug_with_errno((level), __VA_ARGS__); } } while(0) -#define upsdebugx(level, ...) \ - do { if (nut_debug_level >= (level)) { s_upsdebugx((level), __VA_ARGS__); } } while(0) -#define upsdebug_hex(level, msg, buf, len) \ - do { if (nut_debug_level >= (level)) { s_upsdebug_hex((level), msg, buf, len); } } while(0) -#define upsdebug_ascii(level, msg, buf, len) \ - do { if (nut_debug_level >= (level)) { s_upsdebug_ascii((level), msg, buf, len); } } while(0) +void upsdebug_hex(int level, const char *msg, const void *buf, int len); +void upsdebug_ascii(int level, const char *msg, const void *buf, int len); void fatal_with_errno(int status, const char *fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))) __attribute__((noreturn)); @@ -205,18 +118,16 @@ void *xcalloc(size_t number, size_t size); void *xrealloc(void *ptr, size_t size); char *xstrdup(const char *string); -ssize_t select_read(const int fd, void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec); -ssize_t select_write(const int fd, const void *buf, const size_t buflen, const time_t d_sec, const suseconds_t d_usec); +char *rtrim(char *in, const char sep); +char* ltrim(char *in, const char sep); -char * get_libname(const char* base_libname); +int select_read(const int fd, void *buf, const size_t buflen, const long d_sec, const long d_usec); +int select_write(const int fd, const void *buf, const size_t buflen, const long d_sec, const long d_usec); /* Buffer sizes used for various functions */ #define SMALLBUF 512 #define LARGEBUF 1024 -/** @brief (Minimum) Size that a string must have to hold a UUID4 (i.e. UUID4 length + the terminating null character). */ -#define UUID4_LEN 37 - /* Provide declarations for getopt() global variables */ #ifdef NEED_GETOPT_H @@ -246,4 +157,4 @@ extern int optind; /* *INDENT-ON* */ #endif -#endif /* NUT_COMMON_H_SEEN */ +#endif /* NUT_COMMON_H */ diff --git a/include/config.h.in b/include/config.h.in index 1f0b9a8..7e8db11 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1,4 +1,4 @@ -/* include/config.h.in. Generated from configure.ac by autoheader. */ +/* include/config.h.in. Generated from configure.in by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD @@ -6,24 +6,6 @@ /* Path for pid files of drivers and upsd (usually STATEPATH) */ #undef ALTPIDPATH -/* host env spec we built on */ -#undef AUTOTOOLS_BUILD_ALIAS - -/* host OS short spec we built on */ -#undef AUTOTOOLS_BUILD_SHORT_ALIAS - -/* host env spec we run on */ -#undef AUTOTOOLS_HOST_ALIAS - -/* host OS short spec we run on */ -#undef AUTOTOOLS_HOST_SHORT_ALIAS - -/* host env spec we built for */ -#undef AUTOTOOLS_TARGET_ALIAS - -/* host OS short spec we built for */ -#undef AUTOTOOLS_TARGET_SHORT_ALIAS - /* Default path for user executables */ #undef BINDIR @@ -33,15 +15,6 @@ /* Default path for configuration files */ #undef CONFPATH -/* Compiler flags for cppunit tests */ -#undef CPPUNIT_NUT_CXXFLAGS - -/* Define processor type */ -#undef CPU_TYPE - -/* Define to 1 if your C++ compiler doesn't accept -c and -o together. */ -#undef CXX_NO_MINUS_C_MINUS_O - /* Default path for data files */ #undef DATADIR @@ -57,23 +30,8 @@ MSVC and with C++ compilers. */ #undef FLEXIBLE_ARRAY_MEMBER -/* Define to the type of arg 1 for getnameinfo. */ -#undef GETNAMEINFO_TYPE_ARG1 - -/* Define to the type of arg 2 for getnameinfo. */ -#undef GETNAMEINFO_TYPE_ARG2 - -/* Define to the type of args 4 and 6 for getnameinfo. */ -#undef GETNAMEINFO_TYPE_ARG46 - -/* Define to the type of arg 7 for getnameinfo. */ -#undef GETNAMEINFO_TYPE_ARG7 - -/* Define to 1 if you have the `abs' function. */ -#undef HAVE_ABS - -/* Define to 1 if you have the `abs_val' function. */ -#undef HAVE_ABS_VAL +/* addons run as user */ +#undef HAL_USER /* Define to 1 if you have the `atexit' function. */ #undef HAVE_ATEXIT @@ -96,29 +54,8 @@ /* Define to 1 if C supports variable-length arrays. */ #undef HAVE_C_VARARRAYS -/* Define to 1 if you have the declaration of `i2c_smbus_access', and to 0 if - you don't. */ -#undef HAVE_DECL_I2C_SMBUS_ACCESS - -/* Define to 1 if you have the declaration of `i2c_smbus_read_block_data', and - to 0 if you don't. */ -#undef HAVE_DECL_I2C_SMBUS_READ_BLOCK_DATA - -/* Define to 1 if you have the declaration of `i2c_smbus_read_byte_data', and - to 0 if you don't. */ -#undef HAVE_DECL_I2C_SMBUS_READ_BYTE_DATA - -/* Define to 1 if you have the declaration of `i2c_smbus_read_word_data', and - to 0 if you don't. */ -#undef HAVE_DECL_I2C_SMBUS_READ_WORD_DATA - -/* Define to 1 if you have the declaration of `i2c_smbus_write_byte_data', and - to 0 if you don't. */ -#undef HAVE_DECL_I2C_SMBUS_WRITE_BYTE_DATA - -/* Define to 1 if you have the declaration of `i2c_smbus_write_word_data', and - to 0 if you don't. */ -#undef HAVE_DECL_I2C_SMBUS_WRITE_WORD_DATA +/* Define to 1 if you have the header file. */ +#undef HAVE_DBUS_DBUS_GLIB_H /* Define to 1 if you have the declaration of `LOG_UPTO', and to 0 if you don't. */ @@ -143,27 +80,12 @@ /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H -/* Define to 1 if you have the `fabs' function. */ -#undef HAVE_FABS - -/* Define to 1 if you have the `fabsf' function. */ -#undef HAVE_FABSF - -/* Define to 1 if you have the `fabsl' function. */ -#undef HAVE_FABSL - /* Define to 1 if you have the `fcvt' function. */ #undef HAVE_FCVT /* Define to 1 if you have the `fcvtl' function. */ #undef HAVE_FCVTL -/* Define to 1 if you have the `fileno' function. */ -#undef HAVE_FILENO - -/* Define to 1 if you have . */ -#undef HAVE_FLOAT_H - /* Define to 1 if you have the `flock' function. */ #undef HAVE_FLOCK @@ -194,6 +116,12 @@ /* Define to 1 if you have the `getpassphrase' function. */ #undef HAVE_GETPASSPHRASE +/* Define to 1 if you have the header file. */ +#undef HAVE_GLIB_H + +/* Define to 1 if you have the `g_timeout_add_seconds' function. */ +#undef HAVE_G_TIMEOUT_ADD_SECONDS + /* Define to 1 if you have the `init_snmp' function. */ #undef HAVE_INIT_SNMP @@ -206,46 +134,18 @@ /* Define if you have Boutell's libgd installed */ #undef HAVE_LIBGD +/* Define to 1 if you have the `libhal_device_new_changeset' function. */ +#undef HAVE_LIBHAL_DEVICE_NEW_CHANGESET + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBHAL_H + /* Define to enable libltdl support */ #undef HAVE_LIBLTDL /* Define to 1 if you have the header file. */ #undef HAVE_LIBPOWERMAN_H -/* Define to 1 if you have the `libusb_detach_kernel_driver' function. */ -#undef HAVE_LIBUSB_DETACH_KERNEL_DRIVER - -/* Define to 1 if you have the `libusb_detach_kernel_driver_np' function. */ -#undef HAVE_LIBUSB_DETACH_KERNEL_DRIVER_NP - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBUSB_H - -/* Define to 1 if you have the `libusb_init' function. */ -#undef HAVE_LIBUSB_INIT - -/* Define to 1 if you have the `libusb_kernel_driver_active' function. */ -#undef HAVE_LIBUSB_KERNEL_DRIVER_ACTIVE - -/* Define to 1 if you have the `libusb_set_auto_detach_kernel_driver' - function. */ -#undef HAVE_LIBUSB_SET_AUTO_DETACH_KERNEL_DRIVER - -/* Define to 1 if you have the `libusb_strerror' function. */ -#undef HAVE_LIBUSB_STRERROR - -/* Define to 1 if you have . */ -#undef HAVE_LIMITS_H - -/* Define to 1 if you have . */ -#undef HAVE_LINUX_I2C_DEV_H - -/* Define to 1 if you have . */ -#undef HAVE_LINUX_SMBUS_H - -/* Define to 1 if you have the `localtime_r' function. */ -#undef HAVE_LOCALTIME_R - /* Define to 1 if you have the `lockf' function. */ #undef HAVE_LOCKF @@ -258,30 +158,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LTDL_H -/* Define to 1 if you have . */ -#undef HAVE_MATH_H - /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H -/* Define to 1 if you have the header file. */ -#undef HAVE_MODBUS_H - -/* Define to 1 if you have the `modbus_new_rtu' function. */ -#undef HAVE_MODBUS_NEW_RTU - -/* Define to 1 if you have the `modbus_new_tcp' function. */ -#undef HAVE_MODBUS_NEW_TCP - -/* Define to 1 if you have the `modbus_set_byte_timeout' function. */ -#undef HAVE_MODBUS_SET_BYTE_TIMEOUT - -/* Define to 1 if you have the `modbus_set_response_timeout' function. */ -#undef HAVE_MODBUS_SET_RESPONSE_TIMEOUT - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - /* Define to 1 if you have the header file. */ #undef HAVE_NET_SNMP_NET_SNMP_CONFIG_H @@ -312,299 +191,9 @@ /* Define to 1 if you have the `pm_connect' function. */ #undef HAVE_PM_CONNECT -/* Define to 1 if you have the `pow10' function. */ -#undef HAVE_POW10 - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wc++98-compat(-pedantic)" and for push-pop support */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wc++98-compat(-pedantic)" and for push-pop support (outside function - bodies) */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support - (outside function bodies) */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop - support */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop - support (outside function bodies) */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wunreachable-code(-break)" and for push-pop support */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE - -/* define if your compiler has pragmas for GCC diagnostic ignored - "-Wunreachable-code(-break)" and for push-pop support (outside function - bodies) */ -#undef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC - -/* define if your compiler has #pragma clang diagnostic ignored - "-Wunreachable-code-return" */ -#undef HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN - -/* define if your compiler has #pragma clang diagnostic ignored - "-Wunreachable-code-return" (outside functions) */ -#undef HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC - -/* define if your compiler has #pragma clang diagnostic push and pop */ -#undef HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP - -/* define if your compiler has #pragma clang diagnostic push and pop outside - function bodies */ -#undef HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_BESIDEFUNC - -/* define if your compiler has #pragma clang diagnostic push and pop inside - function bodies */ -#undef HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_INSIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS - -/* define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wcovered-switch-default" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wcovered-switch-default" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wc++98-compat-pedantic" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wc++98-compat-pedantic" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wexit-time-destructors" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wexit-time-destructors" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wextra-semi-stmt" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wextra-semi-stmt" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-nonliteral" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-nonliteral" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-overflow" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-overflow" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-security" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-security" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-truncation" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wformat-truncation" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wglobal-constructors" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wglobal-constructors" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wsign-conversion" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wsign-conversion" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wstrict-prototypes" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wstrict-prototypes" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wstringop-truncation" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wstringop-truncation" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-compare" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-compare" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-constant-out-of-range-compare" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-constant-out-of-range-compare" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-type-limit-compare" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-type-limit-compare" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-unsigned-zero-compare" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wtautological-unsigned-zero-compare" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits" - */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS - -/* define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits" - (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code-break" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code-break" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code-return" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunreachable-code-return" (outside functions) */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic ignored - "-Wunused-function" */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION - -/* define if your compiler has #pragma GCC diagnostic push and pop */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP - -/* define if your compiler has #pragma GCC diagnostic push and pop outside - function bodies */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC - -/* define if your compiler has #pragma GCC diagnostic push and pop inside - function bodies */ -#undef HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC - -/* define if your libc can printf("%s", NULL) sanely */ -#undef HAVE_PRINTF_STRING_NULL - /* Define to enable pthread support code */ #undef HAVE_PTHREAD -/* Define to enable pthread_tryjoin support code */ -#undef HAVE_PTHREAD_TRYJOIN - -/* Define to 1 if you have the `round' function. */ -#undef HAVE_ROUND - -/* Define to 1 if you have with usable sem_t sem_init() and - sem_destroy(). */ -#undef HAVE_SEMAPHORE - -/* Define to 1 if you have . */ -#undef HAVE_SEMAPHORE_H - /* Define to 1 if you have the `setenv' function. */ #undef HAVE_SETENV @@ -617,23 +206,11 @@ /* Define to 1 if you have the `setsid' function. */ #undef HAVE_SETSID -/* Define to 1 if you have the `sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the `sigemptyset' function. */ -#undef HAVE_SIGEMPTYSET - -/* Define to 1 if you have . */ -#undef HAVE_SIGNAL_H - /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF -/* Define to 1 if you have the `SSL_CTX_new' function. */ -#undef HAVE_SSL_CTX_NEW - -/* Define to 1 if you have the header file. */ -#undef HAVE_SSL_H +/* Define to 1 if you have the `SSL_library_init' function. */ +#undef HAVE_SSL_LIBRARY_INIT /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H @@ -644,46 +221,21 @@ /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H -/* defined if standard library has, and C standard allows, the - strcasecmp(s1,s2) method */ -#undef HAVE_STRCASECMP - -/* defined if standard library has, and C standard allows, the strdup(s) - method */ -#undef HAVE_STRDUP - /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define to 1 if you have . */ +/* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H -/* Define to 1 if you have . */ +/* Define to 1 if you have the header file. */ #undef HAVE_STRING_H -/* defined if standard library has, and C standard allows, the - strncasecmp(s1,s2,n) method */ -#undef HAVE_STRNCASECMP - /* Define to 1 if you have the `strptime' function. */ #undef HAVE_STRPTIME -/* Define to 1 if you have the `strtok_r' function. */ -#undef HAVE_STRTOK_R - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MODEM_H -/* Define to 1 if you have with usable struct rlimit and - getrlimit(). */ -#undef HAVE_SYS_RESOURCE_H - -/* Define to 1 if you have . */ -#undef HAVE_SYS_SIGNAL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H @@ -702,18 +254,9 @@ /* Define to 1 if you have the `tcsendbreak' function. */ #undef HAVE_TCSENDBREAK -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if the system has the type `unsigned long long int'. */ -#undef HAVE_UNSIGNED_LONG_LONG_INT - /* Define to 1 if you have the `usb_detach_kernel_driver_np' function. */ #undef HAVE_USB_DETACH_KERNEL_DRIVER_NP @@ -723,10 +266,6 @@ /* Define to 1 if you have the `usb_init' function. */ #undef HAVE_USB_INIT -/* defined if standard library has, and C standard allows, the usleep(us) - method */ -#undef HAVE_USLEEP - /* Use uu_lock for locking (FreeBSD) */ #undef HAVE_UU_LOCK @@ -736,44 +275,17 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF -/* Define to 1 if you have the windows.h header file. */ -#undef HAVE_WINDOWS_H - -/* Define to 1 if you have the winsock2.h header file. */ -#undef HAVE_WINSOCK2_H - /* Define to enable libwrap support */ #undef HAVE_WRAP -/* Define to 1 if you have the ws2tcpip.h header file. */ -#undef HAVE_WS2TCPIP_H - -/* define if your compiler has __attribute__ */ -#undef HAVE___ATTRIBUTE__ - -/* define if your compiler has __attribute__((noreturn)) */ -#undef HAVE___ATTRIBUTE__NORETURN - -/* define if your compiler has __attribute__((unused)) for function arguments - */ -#undef HAVE___ATTRIBUTE__UNUSED_ARG - -/* define if your compiler has __attribute__((unused)) for functions */ -#undef HAVE___ATTRIBUTE__UNUSED_FUNC - /* Default path for HTML files */ #undef HTMLPATH -/* Default path for system libraries */ -#undef LIBDIR - -/* Default path for system exec-libraries */ -#undef LIBEXECDIR - /* Desired syslog facility - see syslog(3) */ #undef LOG_FACILITY -/* Define to the sub-directory where libtool stores uninstalled libraries. */ +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ #undef LT_OBJDIR /* Define to use explicit getopt declarations */ @@ -782,50 +294,8 @@ /* Define if getopt.h is needed */ #undef NEED_GETOPT_H -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol - -/* Variable or macro by this name is not resolvable */ -#undef NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol - -/* ${COMMENT} */ -#undef NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32 - -/* ${COMMENT} */ -#undef NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields - -/* ${COMMENT} */ -#undef NUT_MODBUS_TIMEOUT_ARG_timeval - -/* ${COMMENT} */ -#undef NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O /* NUT network protocol version */ #undef NUT_NETVERSION @@ -866,9 +336,6 @@ /* Default path for system executables */ #undef SBINDIR -/* The size of `void *', as computed by sizeof. */ -#undef SIZEOF_VOID_P - /* Path for UPS driver state files */ #undef STATEPATH @@ -878,8 +345,7 @@ /* Define to 1 for Sun version of the libusb. */ #undef SUN_LIBUSB -/* Define to 1 if you can safely include both and . This - macro is deemed obsolete by autotools. */ +/* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* NUT tree version */ @@ -922,12 +388,12 @@ /* Define to enable development files support */ #undef WITH_DEV -/* Define to enable overall documentation generation */ -#undef WITH_DOCS - /* Define to enable IPMI support using FreeIPMI */ #undef WITH_FREEIPMI +/* Define to enable HAL support */ +#undef WITH_HAL + /* Define to enable IPMI support */ #undef WITH_IPMI @@ -937,22 +403,9 @@ /* Define to enable Powerman PDU support */ #undef WITH_LIBPOWERMAN -/* Define to 1 for version 0.1 of the libusb (via pkg-config or - libusb-config). */ -#undef WITH_LIBUSB_0_1 - -/* Define to 1 for version 1.0 of the libusb (via pkg-config). */ -#undef WITH_LIBUSB_1_0 - -/* Define to enable I2C support */ -#undef WITH_LINUX_I2C - /* Define to enable Mac OS X meta-driver */ #undef WITH_MACOSX -/* Define to enable Modbus support */ -#undef WITH_MODBUS - /* Define to enable Neon HTTP support */ #undef WITH_NEON diff --git a/include/extstate.h b/include/extstate.h index a511d62..c4cc973 100644 --- a/include/extstate.h +++ b/include/extstate.h @@ -1,29 +1,7 @@ -/* extstate.h - external state structures used by things like upsd +/* external state structures used by things like upsd */ - Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2008 Arjen de Korte - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_EXTSTATE_H_SEEN -#define NUT_EXTSTATE_H_SEEN 1 +#ifndef EXTSTATE_H_SEEN +#define EXTSTATE_H_SEEN 1 #ifdef __cplusplus /* *INDENT-OFF* */ @@ -35,15 +13,13 @@ extern "C" { #define ST_MAX_VALUE_LEN 256 /* state tree flags */ -#define ST_FLAG_NONE 0x0000 -#define ST_FLAG_RW 0x0001 -#define ST_FLAG_STRING 0x0002 /* not STRING implies NUMBER */ -#define ST_FLAG_NUMBER 0x0004 -#define ST_FLAG_IMMUTABLE 0x0008 +#define ST_FLAG_RW 0x0001 +#define ST_FLAG_STRING 0x0002 +#define ST_FLAG_IMMUTABLE 0x0004 /* list of possible ENUM values */ typedef struct enum_s { - char *val; + char *val; struct enum_s *next; } enum_t; @@ -56,8 +32,8 @@ typedef struct range_s { /* list of instant commands */ typedef struct cmdlist_s { - char *name; - struct cmdlist_s *next; + char *name; + struct cmdlist_s *next; } cmdlist_t; #ifdef __cplusplus @@ -66,4 +42,4 @@ typedef struct cmdlist_s { /* *INDENT-ON* */ #endif -#endif /* NUT_EXTSTATE_H_SEEN */ +#endif /* EXTSTATE_H_SEEN */ diff --git a/include/nut_float.h b/include/nut_float.h deleted file mode 100644 index 290edb4..0000000 --- a/include/nut_float.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * nut_float.h - Network UPS Tools include files for floating point routines - * and ways to compare if non-integers are close enough to assume equal - * - * Copyright (C) 2020 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef NUT_FLOAT_H_SEEN -#define NUT_FLOAT_H_SEEN 1 - -#include "config.h" - -#if defined HAVE_FLOAT_H -# include -#endif - -#if defined HAVE_MATH_H -# include -#endif - -/* Modern compilers frown upon direct comparisons of floating point numbers - * since their imprecise internal representations can misfire, and really we - * care if they are indiscernably close. To aviod warnings like -Wfloat-equal - * we prefer to compare with methods defined below. Note: despite the "floating" - * name, fabs() seems to be defined over doubles or wider types, e.g.: - * double fabs(double x); - * float fabsf(float x); - * long double fabsl(long double x); - * To be on the safer side, we compare the difference to be smaller or equal to - * the Epsilon for the respective numeric type, in order to be equivalent to a - * zero for our needs. Various libs define it as "the next representable number - * after 1.0 which is not equal to 1.0" for the discrete maths involved; no talk - * about exactly comparing it to zero or whether it is the smallest representable - * non-zero value... - */ -#define f_equal(x, y) ( fabsf((float)(x) - (float)(y)) <= FLT_EPSILON ) -#define d_equal(x, y) ( fabs((double)(x) - (double)(y)) <= DBL_EPSILON ) -#define ld_equal(x, y) ( fabsl((long double)(x) - (long double)(y)) <= LDBL_EPSILON ) - -#endif /* NUT_FLOAT_H_SEEN */ diff --git a/include/nut_platform.h b/include/nut_platform.h index ba640c5..b7bf937 100644 --- a/include/nut_platform.h +++ b/include/nut_platform.h @@ -1,3 +1,6 @@ +#ifndef nut_platform_h +#define nut_platform_h + /** * \brief Platform-specific checks * @@ -14,9 +17,6 @@ * \date 2012/10/12 */ -#ifndef NUT_PLATFORM_H_SEEN -#define NUT_PLATFORM_H_SEEN 1 - /* * In case doxygen source doc isn't generated * (which is the case at time of writing this), @@ -121,5 +121,5 @@ #endif #endif -#endif /* NUT_PLATFORM_H_SEEN */ +#endif /* end of #ifndef nut_platform_h */ diff --git a/include/nut_stdint.h b/include/nut_stdint.h index 722038a..35292ee 100644 --- a/include/nut_stdint.h +++ b/include/nut_stdint.h @@ -19,18 +19,10 @@ */ #ifndef NUT_STDINT_H_SEEN -#define NUT_STDINT_H_SEEN 1 +#define NUT_STDINT_H_SEEN #include "config.h" -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#ifndef __STDC_CONSTANT_MACROS -#define __STDC_CONSTANT_MACROS 1 -#endif - #if defined HAVE_INTTYPES_H # include #endif @@ -39,33 +31,4 @@ # include #endif -#if defined HAVE_LIMITS_H -# include -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX ((size_t)(-1LL)) -#endif - -#ifndef SSIZE_MAX -#define SSIZE_MAX ((ssize_t)(-1LL)) -#endif - -/* Printing format for size_t and ssize_t */ -#ifndef PRIsize -# if defined(__MINGW32__) -# define PRIsize "u" -# else -# define PRIsize "zu" -# endif -#endif - -#ifndef PRIssize -# if defined(__MINGW32__) -# define PRIssize "d" -# else -# define PRIssize "zd" -# endif -#endif /* format for size_t and ssize_t */ - #endif /* NUT_STDINT_H_SEEN */ diff --git a/include/parseconf.h b/include/parseconf.h index bb7584b..d85c89d 100644 --- a/include/parseconf.h +++ b/include/parseconf.h @@ -39,7 +39,7 @@ typedef struct { FILE *f; /* stream to current file */ int state; /* current parser state */ int ch; /* last character read */ - + char **arglist; /* array of pointers to words */ size_t *argsize; /* list of sizes for realloc */ size_t numargs; /* max usable in arglist */ diff --git a/include/proto.h b/include/proto.h index c783755..9c69114 100644 --- a/include/proto.h +++ b/include/proto.h @@ -1,28 +1,5 @@ -/* proto.h - fill in the gaps about prototypes and definitions for portability - - Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2006 Peter Selinger - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_PROTO_H_SEEN -#define NUT_PROTO_H_SEEN 1 +#ifndef PROTO_H +#define PROTO_H #include "attribute.h" @@ -114,4 +91,4 @@ int putenv(char *); /* *INDENT-ON* */ #endif -#endif /* NUT_PROTO_H_SEEN */ +#endif /* PROTO_H */ diff --git a/include/state.h b/include/state.h index 97249a2..c6ea555 100644 --- a/include/state.h +++ b/include/state.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_STATE_H_SEEN -#define NUT_STATE_H_SEEN 1 +#ifndef STATE_H_SEEN +#define STATE_H_SEEN #include "extstate.h" @@ -43,7 +43,7 @@ typedef struct st_tree_s { size_t safesize; int flags; - long aux; + int aux; struct enum_s *enum_list; struct range_s *range_list; @@ -58,10 +58,10 @@ int state_addrange(st_tree_t *root, const char *var, const int min, const int ma int state_setaux(st_tree_t *root, const char *var, const char *auxs); const char *state_getinfo(st_tree_t *root, const char *var); int state_getflags(st_tree_t *root, const char *var); -long state_getaux(st_tree_t *root, const char *var); +int state_getaux(st_tree_t *root, const char *var); const enum_t *state_getenumlist(st_tree_t *root, const char *var); const range_t *state_getrangelist(st_tree_t *root, const char *var); -void state_setflags(st_tree_t *root, const char *var, size_t numflags, char **flags); +void state_setflags(st_tree_t *root, const char *var, int numflags, char **flags); int state_addcmd(cmdlist_t **list, const char *cmd); void state_infofree(st_tree_t *node); void state_cmdfree(cmdlist_t *list); @@ -77,4 +77,4 @@ st_tree_t *state_tree_find(st_tree_t *node, const char *var); /* *INDENT-ON* */ #endif -#endif /* NUT_STATE_H_SEEN */ +#endif /* STATE_H_SEEN */ diff --git a/include/str.h b/include/str.h deleted file mode 100644 index 500c078..0000000 --- a/include/str.h +++ /dev/null @@ -1,142 +0,0 @@ -/* str.h - Common string-related functions - * - * Copyright (C) - * 2000 Russell Kroll - * 2015 Daniele Pezzini - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef NUT_STR_H_SEEN -#define NUT_STR_H_SEEN 1 - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - -/* Some compilers and/or C libraries do not handle printf("%s", NULL) correctly */ -#ifndef NUT_STRARG -# ifdef HAVE_PRINTF_STRING_NULL -# define NUT_STRARG(x) x -# else -# define NUT_STRARG(x) (x?x:"(null)") -# endif -#endif - -/* Remove all - * - leading and trailing (str_trim[_m]()) - * - leading (str_ltrim[_m]()) - * - trailing (str_rtrim[_m])) - * instances of - * - *character* (plain versions) - * - each character in *characters* ('_m' versions) - * from a string. - * - *string*: null-terminated byte string from which characters are to be removed; - * - *character*: character that has to be removed from *string*; - * - *characters*: null-terminated byte string of characters to be removed from string. - * Return: - * - NULL, if *string* is NULL, otherwise - * - *string* without the specified characters (upto an empty string). */ -char *str_trim(char *string, const char character); -char *str_trim_m(char *string, const char *characters); -char *str_ltrim(char *string, const char character); -char *str_ltrim_m(char *string, const char *characters); -char *str_rtrim(char *string, const char character); -char *str_rtrim_m(char *string, const char *characters); - -/* Remove all - * - leading and trailing (str_trim_space()) - * - leading (str_ltrim_space()) - * - trailing (str_rtrim_space()) - * spaces (as identified by isspace()) from a string. - * - *string*: null-terminated byte string from which spaces are to be removed. - * Return: - * - NULL, if *string* is NULL, otherwise - * - *string* without the specified spaces (upto an empty string). */ -char *str_trim_space(char *string); -char *str_ltrim_space(char *string); -char *str_rtrim_space(char *string); - -/* Tell whether a string can be converted to a number of type str_is_[_strict](). - * - *string*: the null-terminated byte string to check; - * - *base*: the base the string must conform to. - * The same restrictions of the corresponding str_to_[_strict]() functions apply. - * If *string* can be converted to a valid number of type , return 1. - * Otherwise, return 0 with errno set to: - * - ENOMEM, if available memory is insufficient; - * - EINVAL, if the value of *base* is not supported or no conversion could be performed; - * - ERANGE, if the converted value would be out of the acceptable range of . */ -int str_is_short(const char *string, const int base); -int str_is_short_strict(const char *string, const int base); -int str_is_ushort(const char *string, const int base); -int str_is_ushort_strict(const char *string, const int base); -int str_is_int(const char *string, const int base); -int str_is_int_strict(const char *string, const int base); -int str_is_uint(const char *string, const int base); -int str_is_uint_strict(const char *string, const int base); -int str_is_long(const char *string, const int base); -int str_is_long_strict(const char *string, const int base); -int str_is_ulong(const char *string, const int base); -int str_is_ulong_strict(const char *string, const int base); -int str_is_double(const char *string, const int base); -int str_is_double_strict(const char *string, const int base); - -/* Convert a string to a number of type str_to_[_strict](). - * - *string*: the null-terminated byte string to convert, - * 'strict' versions' strings shall not contain spaces (as identified by isspace()), - * - short, int, long: strtol()'s restrictions apply, - * - ushort, uint, ulong: strtoul()'s restrictions apply, plus: - * - plus ('+') and minus ('-') signs (and hence negative values) are not supported, - * - double: strtod()'s restrictions apply, plus: - * - infinity and nan are not supported, - * - radix character (decimal point character) must be a period ('.'); - * - *number*: a pointer to a that will be filled upon execution; - * - *base*: the base the string must conform to, - * - short, ushort, int, uint, long, ulong: acceptable values as in strtol()/strtoul(), - * - double: 0 for auto-select, 10 or 16. - * On success, return 1 with *number* being the result of the conversion of *string*. - * On failure, return 0 with *number* being 0 and errno set to: - * - ENOMEM, if available memory is insufficient; - * - EINVAL, if the value of *base* is not supported or no conversion can be performed; - * - ERANGE, if the converted value is out of the acceptable range of . */ -int str_to_short(const char *string, short *number, const int base); -int str_to_short_strict(const char *string, short *number, const int base); -int str_to_ushort(const char *string, unsigned short *number, const int base); -int str_to_ushort_strict(const char *string, unsigned short *number, const int base); -int str_to_int(const char *string, int *number, const int base); -int str_to_int_strict(const char *string, int *number, const int base); -int str_to_uint(const char *string, unsigned int *number, const int base); -int str_to_uint_strict(const char *string, unsigned int *number, const int base); -int str_to_long(const char *string, long *number, const int base); -int str_to_long_strict(const char *string, long *number, const int base); -int str_to_ulong(const char *string, unsigned long *number, const int base); -int str_to_ulong_strict(const char *string, unsigned long *number, const int base); -int str_to_double(const char *string, double *number, const int base); -int str_to_double_strict(const char *string, double *number, const int base); - -/* Return non-zero if string s ends exactly with suff - * Note: s=NULL always fails the test; otherwise suff=NULL always matches - */ -int str_ends_with(const char *s, const char *suff); -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif /* NUT_STR_H_SEEN */ diff --git a/include/timehead.h b/include/timehead.h index aabcf2a..13182b7 100644 --- a/include/timehead.h +++ b/include/timehead.h @@ -1,36 +1,13 @@ -/* timehead.h - from the autoconf docs: sanely include the right time headers everywhere +/* from the autoconf docs: sanely include the right time headers everywhere */ - Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_TIMEHEAD_H_SEEN -#define NUT_TIMEHEAD_H_SEEN 1 - -#ifdef TIME_WITH_SYS_TIME +#if TIME_WITH_SYS_TIME # include # include #else -# ifdef HAVE_SYS_TIME_H +# if HAVE_SYS_TIME_H # include # else # include # endif #endif -#endif /* NUT_TIMEHEAD_H_SEEN */ diff --git a/include/upsconf.h b/include/upsconf.h index 4ae1b27..4667593 100644 --- a/include/upsconf.h +++ b/include/upsconf.h @@ -1,27 +1,3 @@ -/* upsconf.h - prototypes for upsconf.c - - Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_UPSCONF_H_SEEN -#define NUT_UPSCONF_H_SEEN 1 #ifdef __cplusplus /* *INDENT-OFF* */ @@ -31,14 +7,13 @@ extern "C" { /* callback function from read_upsconf */ void do_upsconf_args(char *upsname, char *var, char *val); - + /* open the ups.conf, parse it, and call back do_upsconf_args() */ void read_upsconf(void); - + #ifdef __cplusplus /* *INDENT-OFF* */ } /* *INDENT-ON* */ #endif -#endif /* NUT_UPSCONF_H_SEEN */ diff --git a/install-sh b/install-sh index ec298b5..a9244eb 100755 --- a/install-sh +++ b/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2020-11-14.01; # UTC +scriptversion=2011-01-19.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -35,21 +35,25 @@ scriptversion=2020-11-14.01; # UTC # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent -# 'make' implicit rules from creating a file called install from it +# `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. -tab=' ' nl=' ' -IFS=" $tab$nl" +IFS=" "" $nl" -# Set DOITPROG to "echo" to test this script. +# set DOITPROG to echo to test this script +# Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} -doit_exec=${doit:-exec} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi # Put in absolute file names if you don't have them in your path; # or use environment vars. @@ -64,16 +68,22 @@ mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + posix_mkdir= # Desired mode of installed file. mode=0755 -# Create dirs (including intermediate dirs) using mode 755. -# This is like GNU 'install' as of coreutils 8.32 (2020). -mkdir_umask=22 - -backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= @@ -87,7 +97,7 @@ dir_arg= dst_arg= copy_on_change=false -is_target_a_directory=possibly +no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE @@ -104,28 +114,18 @@ Options: --version display version info and exit. -c (ignored) - -C install only if different (preserve data modification time) + -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. - -p pass -p to $cpprog. -s $stripprog installed files. - -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG - -By default, rm is invoked with -f; when overridden with RMPROG, -it's up to you to specify -f if you want it. - -If -S is not specified, no backups are attempted. - -Email bug reports to bug-automake@gnu.org. -Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do @@ -137,62 +137,46 @@ while test $# -ne 0; do -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" - shift;; + shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 - case $mode in - *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; -o) chowncmd="$chownprog $2" - shift;; - - -p) cpprog="$cpprog -p";; + shift;; -s) stripcmd=$stripprog;; - -S) backupsuffix="$2" - shift;; + -t) dst_arg=$2 + # Protect names problematic for `test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; - -t) - is_target_a_directory=always - dst_arg=$2 - # Protect names problematic for 'test' and other utilities. - case $dst_arg in - -* | [=\(\)!]) dst_arg=./$dst_arg;; - esac - shift;; - - -T) is_target_a_directory=never;; + -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; - --) shift - break;; + --) shift + break;; - -*) echo "$0: invalid option: $1" >&2 - exit 1;; + -*) echo "$0: invalid option: $1" >&2 + exit 1;; *) break;; esac shift done -# We allow the use of options -d and -T together, by making -d -# take the precedence; this is for compatibility with GNU install. - -if test -n "$dir_arg"; then - if test -n "$dst_arg"; then - echo "$0: target directory not allowed when installing a directory." >&2 - exit 1 - fi -fi - if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. @@ -206,7 +190,7 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then fi shift # arg dst_arg=$arg - # Protect names problematic for 'test' and other utilities. + # Protect names problematic for `test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac @@ -218,20 +202,11 @@ if test $# -eq 0; then echo "$0: no input file specified." >&2 exit 1 fi - # It's OK to call 'install-sh -d' without argument. + # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi -if test -z "$dir_arg"; then - if test $# -gt 1 || test "$is_target_a_directory" = always; then - if test ! -d "$dst_arg"; then - echo "$0: $dst_arg: Is not a directory." >&2 - exit 1 - fi - fi -fi - if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 @@ -248,16 +223,16 @@ if test -z "$dir_arg"; then *[0-7]) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw='% 200' + u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then - u_plus_rw= + u_plus_rw= else - u_plus_rw=,u+rw + u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac @@ -265,7 +240,7 @@ fi for src do - # Protect names problematic for 'test' and other utilities. + # Protect names problematic for `test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac @@ -275,10 +250,6 @@ do dstdir=$dst test -d "$dstdir" dstdir_status=$? - # Don't chown directories that already exist. - if test $dstdir_status = 0; then - chowncmd="" - fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command @@ -295,148 +266,178 @@ do fi dst=$dst_arg - # If destination is a directory, append the input filename. + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. if test -d "$dst"; then - if test "$is_target_a_directory" = never; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 fi dstdir=$dst - dstbase=`basename "$src"` - case $dst in - */) dst=$dst$dstbase;; - *) dst=$dst/$dstbase;; - esac + dst=$dstdir/`basename "$src"` dstdir_status=0 else - dstdir=`dirname "$dst"` + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + test -d "$dstdir" dstdir_status=$? fi fi - case $dstdir in - */) dstdirslash=$dstdir;; - *) dstdirslash=$dstdir/;; - esac - obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - posix_mkdir=false - # The $RANDOM variable is not portable (e.g., dash). Use it - # here however when possible just to lower collision chance. - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac - trap ' - ret=$? - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null - exit $ret - ' 0 - - # Because "mkdir -p" follows existing symlinks and we likely work - # directly in world-writeable /tmp, make sure that the '$tmpdir' - # directory is successfully created first before we actually test - # 'mkdir -p'. - if (umask $mkdir_umask && - $mkdirprog $mkdir_mode "$tmpdir" && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - test_tmpdir="$tmpdir/a" - ls_ld_tmpdir=`ls -ld "$test_tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + mkdir_mode= fi - trap '' 0;; + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; esac if $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else - # mkdir does not conform to POSIX, + # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in - /*) prefix='/';; - [-=\(\)!]*) prefix='./';; - *) prefix='';; + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; esac + eval "$initialize_posix_glob" + oIFS=$IFS IFS=/ - set -f + $posix_glob set -f set fnord $dstdir shift - set +f + $posix_glob set +f IFS=$oIFS prefixes= for d do - test X"$d" = X && continue + test X"$d" = X && continue - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ done if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true fi fi fi @@ -449,25 +450,14 @@ do else # Make a couple of temp file names in the proper directory. - dsttmp=${dstdirslash}_inst.$$_ - rmtmp=${dstdirslash}_rm.$$_ + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && - { test -z "$stripcmd" || { - # Create $dsttmp read-write so that cp doesn't create it read-only, - # which would cause strip to fail. - if test -z "$doit"; then - : >"$dsttmp" # No need to fork-exec 'touch'. - else - $doit touch "$dsttmp" - fi - } - } && - $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # @@ -482,24 +472,20 @@ do # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - set -f && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && - set +f && + $posix_glob set +f && + test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else - # If $backupsuffix is set, and the file being installed - # already exists, attempt a backup. Don't worry if it fails, - # e.g., if mv doesn't support -f. - if test -n "$backupsuffix" && test -f "$dst"; then - $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null - fi - # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || @@ -507,24 +493,24 @@ do # to itself, or perhaps because mv is so ancient that it does not # support -f. { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 @@ -533,9 +519,9 @@ do done # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" +# time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: diff --git a/lib/Makefile.am b/lib/Makefile.am index f4d36cc..d164e1b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -2,11 +2,8 @@ if WITH_DEV if WITH_PKG_CONFIG - pkgconfig_DATA = libupsclient.pc libnutscan.pc libnutclient.pc libnutclientstub.pc + pkgconfig_DATA = libupsclient.pc libnutscan.pc libnutclient.pc else bin_SCRIPTS = libupsclient-config endif endif - -CLEANFILES = *-spellchecked -MAINTAINERCLEANFILES = Makefile.in .dirstamp diff --git a/lib/Makefile.in b/lib/Makefile.in index 6414edd..a8296b1 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -18,61 +19,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -93,24 +56,21 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = lib +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/libnutclient.pc.in $(srcdir)/libnutscan.pc.in \ + $(srcdir)/libupsclient-config.in $(srcdir)/libupsclient.pc.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -119,21 +79,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = libupsclient-config libupsclient.pc \ - libnutclient.pc libnutclientstub.pc libnutscan.pc + libnutclient.pc libnutscan.pc CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -164,18 +119,6 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgconfigdir)" SCRIPTS = $(bin_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -184,20 +127,13 @@ am__can_run_installinfo = \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(pkgconfig_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libnutclient.pc.in \ - $(srcdir)/libnutclientstub.pc.in $(srcdir)/libnutscan.pc.in \ - $(srcdir)/libupsclient-config.in $(srcdir)/libupsclient.pc.in \ - README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -208,7 +144,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -222,7 +157,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -235,8 +169,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -246,15 +183,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -265,29 +201,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -307,9 +235,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -318,16 +243,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -341,7 +262,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -352,12 +272,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -376,21 +292,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -400,10 +313,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -@WITH_DEV_TRUE@@WITH_PKG_CONFIG_TRUE@pkgconfig_DATA = libupsclient.pc libnutscan.pc libnutclient.pc libnutclientstub.pc +@WITH_DEV_TRUE@@WITH_PKG_CONFIG_TRUE@pkgconfig_DATA = libupsclient.pc libnutscan.pc libnutclient.pc @WITH_DEV_TRUE@@WITH_PKG_CONFIG_FALSE@bin_SCRIPTS = libupsclient-config -CLEANFILES = *-spellchecked -MAINTAINERCLEANFILES = Makefile.in .dirstamp all: all-am .SUFFIXES: @@ -419,13 +330,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -442,8 +354,6 @@ libupsclient.pc: $(top_builddir)/config.status $(srcdir)/libupsclient.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ libnutclient.pc: $(top_builddir)/config.status $(srcdir)/libnutclient.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -libnutclientstub.pc: $(top_builddir)/config.status $(srcdir)/libnutclientstub.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ libnutscan.pc: $(top_builddir)/config.status $(srcdir)/libnutscan.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @@ -508,17 +418,14 @@ uninstall-pkgconfigDATA: @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -577,7 +484,6 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -586,7 +492,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -656,19 +561,17 @@ uninstall-am: uninstall-binSCRIPTS uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-binSCRIPTS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-pkgconfigDATA install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-binSCRIPTS uninstall-pkgconfigDATA - -.PRECIOUS: Makefile + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binSCRIPTS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgconfigDATA install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ + ps ps-am uninstall uninstall-am uninstall-binSCRIPTS \ + uninstall-pkgconfigDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/lib/README b/lib/README index 6e3fac7..aecb7c2 100644 --- a/lib/README +++ b/lib/README @@ -45,7 +45,7 @@ To get LD_FLAGS, use: References: linkman:libupsclient-config[1] manual page, -NOTE: this feature may evolve (name change), or even disappear in the future. +NOTE: this feature may evolve (name change), or even disapear in the future. pkgconfig support ----------------- @@ -112,11 +112,11 @@ to libupsclient-config if not available. It will issue an error if none is found! The same is also valid for other NUT libraries, such as libnutscan. -Simply replace 'libupsclient' occurrences in the above example, by the name +Simply replace 'libupsclient' occurences in the above example, by the name of the desired library (for example, 'libnutscan'). NOTE: this is an alternate method. Use of PKG_CHECK_MODULES macro should be -preferred. +prefered. Future consideration diff --git a/lib/libnutclientstub.pc.in b/lib/libnutclientstub.pc.in deleted file mode 100644 index b730a63..0000000 --- a/lib/libnutclientstub.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ -sysconfdir=@CONFPATH@ -statepath=@STATEPATH@ -nutuser=@RUN_AS_USER@ - -Name: libnutclientstub -Description: Stub for UPS monitoring with Network UPS Tools -Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lnutclientstub -Cflags: -I${includedir} diff --git a/lib/libupsclient.pc.in b/lib/libupsclient.pc.in index 8efce40..4ad31fb 100644 --- a/lib/libupsclient.pc.in +++ b/lib/libupsclient.pc.in @@ -9,6 +9,5 @@ nutuser=@RUN_AS_USER@ Name: libupsclient Description: UPS monitoring with Network UPS Tools Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lupsclient -Cflags: -I${includedir} -Requires: @LIBSSL_REQUIRES@ +Libs: -L${libdir} -lupsclient @LIBSSL_LIBS@ +Cflags: -I${includedir} @LIBSSL_CFLAGS@ diff --git a/ltmain.sh b/ltmain.sh old mode 100755 new mode 100644 index 21e5e07..b9205ee --- a/ltmain.sh +++ b/ltmain.sh @@ -1,12 +1,9 @@ -#! /bin/sh -## DO NOT EDIT - This file generated from ./build-aux/ltmain.in -## by inline-source v2014-01-03.01 -# libtool (GNU libtool) 2.4.6 -# Provide generalized library-building support services. +# libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 -# Copyright (C) 1996-2015 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -26,670 +23,166 @@ # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --no-warn don't display warning messages +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.6 Debian-2.4.6-15" -package_revision=2.4.6 +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" +TIMESTAMP="" +package_revision=1.3337 - -## ------ ## -## Usage. ## -## ------ ## - -# Run './libtool --help' for help with using this script from the -# command line. - - -## ------------------------------- ## -## User overridable command paths. ## -## ------------------------------- ## - -# After configure completes, it has a better idea of some of the -# shell tools we need than the defaults used by the functions shared -# with bootstrap, so set those here where they can still be over- -# ridden by the user, but otherwise take precedence. - -: ${AUTOCONF="autoconf"} -: ${AUTOMAKE="automake"} - - -## -------------------------- ## -## Source external libraries. ## -## -------------------------- ## - -# Much of our low-level functionality needs to be sourced from external -# libraries, which are installed to $pkgauxdir. - -# Set a version string for this script. -scriptversion=2015-01-20.17; # UTC - -# General shell script boiler plate, and helper functions. -# Written by Gary V. Vaughan, 2004 - -# Copyright (C) 2004-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. - -# As a special exception to the GNU General Public License, if you distribute -# this file as part of a program or library that is built using GNU Libtool, -# you may include this file under the same distribution terms that you use -# for the rest of that program. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Please report bugs or propose patches to gary@gnu.org. - - -## ------ ## -## Usage. ## -## ------ ## - -# Evaluate this file near the top of your script to gain access to -# the functions and variables defined here: -# -# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh -# -# If you need to override any of the default environment variable -# settings, do that before evaluating this file. - - -## -------------------- ## -## Shell normalisation. ## -## -------------------- ## - -# Some shells need a little help to be as Bourne compatible as possible. -# Before doing anything else, make sure all that help has been provided! - -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh -# NLS nuisances: We save the old values in case they are required later. -_G_user_locale= -_G_safe_locale= -for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do - eval "if test set = \"\${$_G_var+set}\"; then - save_$_G_var=\$$_G_var - $_G_var=C - export $_G_var - _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" - _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +$lt_unset CDPATH -# Make sure IFS has a sensible default -sp=' ' -nl=' -' -IFS="$sp $nl" - -# There are apparently some retarded systems that use ';' as a PATH separator! -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - - -## ------------------------- ## -## Locate command utilities. ## -## ------------------------- ## - - -# func_executable_p FILE -# ---------------------- -# Check that FILE is an executable regular file. -func_executable_p () -{ - test -f "$1" && test -x "$1" -} - - -# func_path_progs PROGS_LIST CHECK_FUNC [PATH] -# -------------------------------------------- -# Search for either a program that responds to --version with output -# containing "GNU", or else returned by CHECK_FUNC otherwise, by -# trying all the directories in PATH with each of the elements of -# PROGS_LIST. -# -# CHECK_FUNC should accept the path to a candidate program, and -# set $func_check_prog_result if it truncates its output less than -# $_G_path_prog_max characters. -func_path_progs () -{ - _G_progs_list=$1 - _G_check_func=$2 - _G_PATH=${3-"$PATH"} - - _G_path_prog_max=0 - _G_path_prog_found=false - _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} - for _G_dir in $_G_PATH; do - IFS=$_G_save_IFS - test -z "$_G_dir" && _G_dir=. - for _G_prog_name in $_G_progs_list; do - for _exeext in '' .EXE; do - _G_path_prog=$_G_dir/$_G_prog_name$_exeext - func_executable_p "$_G_path_prog" || continue - case `"$_G_path_prog" --version 2>&1` in - *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; - *) $_G_check_func $_G_path_prog - func_path_progs_result=$func_check_prog_result - ;; - esac - $_G_path_prog_found && break 3 - done - done - done - IFS=$_G_save_IFS - test -z "$func_path_progs_result" && { - echo "no acceptable sed could be found in \$PATH" >&2 - exit 1 - } -} - - -# We want to be able to use the functions in this file before configure -# has figured out where the best binaries are kept, which means we have -# to search for them ourselves - except when the results are already set -# where we skip the searches. - -# Unless the user overrides by setting SED, search the path for either GNU -# sed, or the sed that truncates its output the least. -test -z "$SED" && { - _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for _G_i in 1 2 3 4 5 6 7; do - _G_sed_script=$_G_sed_script$nl$_G_sed_script - done - echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed - _G_sed_script= - - func_check_prog_sed () - { - _G_path_prog=$1 - - _G_count=0 - printf 0123456789 >conftest.in - while : - do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo '' >> conftest.nl - "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break - diff conftest.out conftest.nl >/dev/null 2>&1 || break - _G_count=`expr $_G_count + 1` - if test "$_G_count" -gt "$_G_path_prog_max"; then - # Best one so far, save it but keep looking for a better one - func_check_prog_result=$_G_path_prog - _G_path_prog_max=$_G_count - fi - # 10*(2^10) chars as input seems more than enough - test 10 -lt "$_G_count" && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out - } - - func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin - rm -f conftest.sed - SED=$func_path_progs_result -} - - -# Unless the user overrides by setting GREP, search the path for either GNU -# grep, or the grep that truncates its output the least. -test -z "$GREP" && { - func_check_prog_grep () - { - _G_path_prog=$1 - - _G_count=0 - _G_path_prog_max=0 - printf 0123456789 >conftest.in - while : - do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo 'GREP' >> conftest.nl - "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break - diff conftest.out conftest.nl >/dev/null 2>&1 || break - _G_count=`expr $_G_count + 1` - if test "$_G_count" -gt "$_G_path_prog_max"; then - # Best one so far, save it but keep looking for a better one - func_check_prog_result=$_G_path_prog - _G_path_prog_max=$_G_count - fi - # 10*(2^10) chars as input seems more than enough - test 10 -lt "$_G_count" && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out - } - - func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin - GREP=$func_path_progs_result -} - - -## ------------------------------- ## -## User overridable command paths. ## -## ------------------------------- ## - -# All uppercase variable names are used for environment variables. These -# variables can be overridden by the user before calling a script that -# uses them if a suitable command of that name is not already available -# in the command search PATH. - -: ${CP="cp -f"} -: ${ECHO="printf %s\n"} -: ${EGREP="$GREP -E"} -: ${FGREP="$GREP -F"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} - - -## -------------------- ## -## Useful sed snippets. ## -## -------------------- ## - -sed_dirname='s|/[^/]*$||' -sed_basename='s|^.*/||' - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='s|\([`"$\\]\)|\\\1|g' - -# Same as above, but do not quote variable references. -sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' - -# Sed substitution that converts a w32 file name or path -# that contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-'\' parameter expansions in output of sed_double_quote_subst that -# were '\'-ed in input to the same. If an odd number of '\' preceded a -# '$' in input to sed_double_quote_subst, that '$' was protected from -# expansion. Since each input '\' is now two '\'s, look for any number -# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. -_G_bs='\\' -_G_bs2='\\\\' -_G_bs4='\\\\\\\\' -_G_dollar='\$' -sed_double_backslash="\ - s/$_G_bs4/&\\ -/g - s/^$_G_bs2$_G_dollar/$_G_bs&/ - s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g - s/\n//g" - - -## ----------------- ## -## Global variables. ## -## ----------------- ## - -# Except for the global variables explicitly listed below, the following -# functions in the '^func_' namespace, and the '^require_' namespace -# variables initialised in the 'Resource management' section, sourcing -# this file will not pollute your global namespace with anything -# else. There's no portable way to scope variables in Bourne shell -# though, so actually running these functions will sometimes place -# results into a variable named after the function, and often use -# temporary variables in the '^_G_' namespace. If you are careful to -# avoid using those namespaces casually in your sourcing script, things -# should continue to work as you expect. And, of course, you can freely -# overwrite any of the functions or variables defined here before -# calling anything to customize them. - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -# Allow overriding, eg assuming that you follow the convention of -# putting '$debug_cmd' at the start of all your functions, you can get -# bash to show function call trace with: -# -# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name -debug_cmd=${debug_cmd-":"} -exit_cmd=: - -# By convention, finish your script with: -# -# exit $exit_status -# -# so that you can set exit_status to non-zero if you want to indicate -# something went wrong during execution without actually bailing out at -# the point of failure. -exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. -progpath=$0 - -# The name of this program. -progname=`$ECHO "$progpath" |$SED "$sed_basename"` - -# Make sure we have an absolute progpath for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` - progdir=`cd "$progdir" && pwd` - progpath=$progdir/$progname - ;; - *) - _G_IFS=$IFS - IFS=${PATH_SEPARATOR-:} - for progdir in $PATH; do - IFS=$_G_IFS - test -x "$progdir/$progname" && break - done - IFS=$_G_IFS - test -n "$progdir" || progdir=`pwd` - progpath=$progdir/$progname - ;; -esac +progpath="$0" -## ----------------- ## -## Standard options. ## -## ----------------- ## -# The following options affect the operation of the functions defined -# below, and should be set appropriately depending on run-time para- -# meters passed on the command line. +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} -opt_dry_run=false -opt_quiet=false -opt_verbose=false +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. -# Categories 'all' and 'none' are always available. Append any others -# you will pass as the first argument to func_warning from your own -# code. -warning_categories= +exit_status=$EXIT_SUCCESS -# By default, display warnings according to 'opt_warning_types'. Set -# 'warning_func' to ':' to elide all warnings, or func_fatal_error to -# treat the next displayed warning as a fatal error. -warning_func=func_warn_and_continue +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" -# Set to 'all' to display all warnings, 'none' to suppress all -# warnings, or a space delimited list of some subset of -# 'warning_categories' to display only the listed warnings. -opt_warning_types=all +dirname="s,/[^/]*$,," +basename="s,^.*/,," - -## -------------------- ## -## Resource management. ## -## -------------------- ## - -# This section contains definitions for functions that each ensure a -# particular resource (a file, or a non-empty configuration variable for -# example) is available, and if appropriate to extract default values -# from pertinent package files. Call them using their associated -# 'require_*' variable to ensure that they are executed, at most, once. -# -# It's entirely deliberate that calling these functions can set -# variables that don't obey the namespace limitations obeyed by the rest -# of this file, in order that that they be as useful as possible to -# callers. - - -# require_term_colors -# ------------------- -# Allow display of bold text on terminals that support it. -require_term_colors=func_require_term_colors -func_require_term_colors () -{ - $debug_cmd - - test -t 1 && { - # COLORTERM and USE_ANSI_COLORS environment variables take - # precedence, because most terminfo databases neglect to describe - # whether color sequences are supported. - test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} - - if test 1 = "$USE_ANSI_COLORS"; then - # Standard ANSI escape sequences - tc_reset='' - tc_bold=''; tc_standout='' - tc_red=''; tc_green='' - tc_blue=''; tc_cyan='' - else - # Otherwise trust the terminfo database after all. - test -n "`tput sgr0 2>/dev/null`" && { - tc_reset=`tput sgr0` - test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` - tc_standout=$tc_bold - test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` - test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` - test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` - test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` - test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` - } - fi - } - - require_term_colors=: -} - - -## ----------------- ## -## Function library. ## -## ----------------- ## - -# This section contains a variety of useful functions to call in your -# scripts. Take note of the portable wrappers for features provided by -# some modern shells, which will fall back to slower equivalents on -# less featureful shells. - - -# func_append VAR VALUE -# --------------------- -# Append VALUE onto the existing contents of VAR. - - # We should try to minimise forks, especially on Windows where they are - # unreasonably slow, so skip the feature probes when bash or zsh are - # being used: - if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then - : ${_G_HAVE_ARITH_OP="yes"} - : ${_G_HAVE_XSI_OPS="yes"} - # The += operator was introduced in bash 3.1 - case $BASH_VERSION in - [12].* | 3.0 | 3.0*) ;; - *) - : ${_G_HAVE_PLUSEQ_OP="yes"} - ;; - esac - fi - - # _G_HAVE_PLUSEQ_OP - # Can be empty, in which case the shell is probed, "yes" if += is - # useable or anything else if it does not work. - test -z "$_G_HAVE_PLUSEQ_OP" \ - && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ - && _G_HAVE_PLUSEQ_OP=yes - -if test yes = "$_G_HAVE_PLUSEQ_OP" -then - # This is an XSI compatible shell, allowing a faster implementation... - eval 'func_append () - { - $debug_cmd - - eval "$1+=\$2" - }' -else - # ...otherwise fall back to using expr, which is often a shell builtin. - func_append () - { - $debug_cmd - - eval "$1=\$$1\$2" - } -fi - - -# func_append_quoted VAR VALUE -# ---------------------------- -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -if test yes = "$_G_HAVE_PLUSEQ_OP"; then - eval 'func_append_quoted () - { - $debug_cmd - - func_quote_for_eval "$2" - eval "$1+=\\ \$func_quote_for_eval_result" - }' -else - func_append_quoted () - { - $debug_cmd - - func_quote_for_eval "$2" - eval "$1=\$$1\\ \$func_quote_for_eval_result" - } -fi - - -# func_append_uniq VAR VALUE -# -------------------------- -# Append unique VALUE onto the existing contents of VAR, assuming -# entries are delimited by the first character of VALUE. For example: -# -# func_append_uniq options " --another-option option-argument" -# -# will only append to $options if " --another-option option-argument " -# is not already present somewhere in $options already (note spaces at -# each end implied by leading space in second argument). -func_append_uniq () -{ - $debug_cmd - - eval _G_current_value='`$ECHO $'$1'`' - _G_delim=`expr "$2" : '\(.\)'` - - case $_G_delim$_G_current_value$_G_delim in - *"$2$_G_delim"*) ;; - *) func_append "$@" ;; - esac -} - - -# func_arith TERM... -# ------------------ -# Set func_arith_result to the result of evaluating TERMs. - test -z "$_G_HAVE_ARITH_OP" \ - && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ - && _G_HAVE_ARITH_OP=yes - -if test yes = "$_G_HAVE_ARITH_OP"; then - eval 'func_arith () - { - $debug_cmd - - func_arith_result=$(( $* )) - }' -else - func_arith () - { - $debug_cmd - - func_arith_result=`expr "$@"` - } -fi - - -# func_basename FILE -# ------------------ -# Set func_basename_result to FILE with everything up to and including -# the last / stripped. -if test yes = "$_G_HAVE_XSI_OPS"; then - # If this shell supports suffix pattern removal, then use it to avoid - # forking. Hide the definitions single quotes in case the shell chokes - # on unsupported syntax... - _b='func_basename_result=${1##*/}' - _d='case $1 in - */*) func_dirname_result=${1%/*}$2 ;; - * ) func_dirname_result=$3 ;; - esac' - -else - # ...otherwise fall back to using sed. - _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' - _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` - if test "X$func_dirname_result" = "X$1"; then - func_dirname_result=$3 - else - func_append func_dirname_result "$2" - fi' -fi - -eval 'func_basename () -{ - $debug_cmd - - '"$_b"' -}' - - -# func_dirname FILE APPEND NONDIR_REPLACEMENT -# ------------------------------------------- +# func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. -eval 'func_dirname () +func_dirname () { - $debug_cmd - - '"$_d"' -}' + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation -# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT -# -------------------------------------------------------- -# Perform func_basename and func_dirname in a single function +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result @@ -697,327 +190,263 @@ eval 'func_dirname () # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" -# For efficiency, we do not delegate to the functions above but instead -# duplicate the functionality here. -eval 'func_dirname_and_basename () +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () { - $debug_cmd - - '"$_b"' - '"$_d"' -}' - - -# func_echo ARG... -# ---------------- -# Echo program name prefixed message. -func_echo () -{ - $debug_cmd - - _G_message=$* - - func_echo_IFS=$IFS - IFS=$nl - for _G_line in $_G_message; do - IFS=$func_echo_IFS - $ECHO "$progname: $_G_line" - done - IFS=$func_echo_IFS -} - - -# func_echo_all ARG... -# -------------------- -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - - -# func_echo_infix_1 INFIX ARG... -# ------------------------------ -# Echo program name, followed by INFIX on the first line, with any -# additional lines not showing INFIX. -func_echo_infix_1 () -{ - $debug_cmd - - $require_term_colors - - _G_infix=$1; shift - _G_indent=$_G_infix - _G_prefix="$progname: $_G_infix: " - _G_message=$* - - # Strip color escape sequences before counting printable length - for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" - do - test -n "$_G_tc" && { - _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` - _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` - } - done - _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes - - func_echo_infix_1_IFS=$IFS - IFS=$nl - for _G_line in $_G_message; do - IFS=$func_echo_infix_1_IFS - $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 - _G_prefix=$_G_indent - done - IFS=$func_echo_infix_1_IFS -} - - -# func_error ARG... -# ----------------- -# Echo program name prefixed message to standard error. -func_error () -{ - $debug_cmd - - $require_term_colors - - func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 -} - - -# func_fatal_error ARG... -# ----------------------- -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - $debug_cmd - - func_error "$*" - exit $EXIT_FAILURE -} - - -# func_grep EXPRESSION FILENAME -# ----------------------------- -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $debug_cmd - - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_len STRING -# --------------- -# Set func_len_result to the length of STRING. STRING may not -# start with a hyphen. - test -z "$_G_HAVE_XSI_OPS" \ - && (eval 'x=a/b/c; - test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ - && _G_HAVE_XSI_OPS=yes - -if test yes = "$_G_HAVE_XSI_OPS"; then - eval 'func_len () - { - $debug_cmd - - func_len_result=${#1} - }' -else - func_len () - { - $debug_cmd - - func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` - } -fi - - -# func_mkdir_p DIRECTORY-PATH -# --------------------------- -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - $debug_cmd - - _G_directory_path=$1 - _G_dir_list= - - if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then - - # Protect directory names starting with '-' - case $_G_directory_path in - -*) _G_directory_path=./$_G_directory_path ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$_G_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - _G_dir_list=$_G_directory_path:$_G_dir_list - - # If the last portion added has no slash in it, the list is done - case $_G_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` - done - _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` - - func_mkdir_p_IFS=$IFS; IFS=: - for _G_dir in $_G_dir_list; do - IFS=$func_mkdir_p_IFS - # mkdir can fail with a 'File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$_G_dir" 2>/dev/null || : - done - IFS=$func_mkdir_p_IFS - - # Bail out if we (or some other process) failed to create a directory. - test -d "$_G_directory_path" || \ - func_fatal_error "Failed to create '$1'" - fi -} - - -# func_mktempdir [BASENAME] -# ------------------------- -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, BASENAME is the basename for that directory. -func_mktempdir () -{ - $debug_cmd - - _G_template=${TMPDIR-/tmp}/${1-$progname} - - if test : = "$opt_dry_run"; then - # Return a directory name, but don't create it in dry-run mode - _G_tmpdir=$_G_template-$$ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" else - - # If mktemp works, use that first and foremost - _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` - - if test ! -d "$_G_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - _G_tmpdir=$_G_template-${RANDOM-0}$$ - - func_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$_G_tmpdir" - umask $func_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$_G_tmpdir" || \ - func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + func_dirname_result="$func_dirname_result${2}" fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation - $ECHO "$_G_tmpdir" -} +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' # func_normal_abspath PATH -# ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. +# value returned in "$func_normal_abspath_result" func_normal_abspath () { - $debug_cmd - - # These SED scripts presuppose an absolute path with a trailing slash. - _G_pathcar='s|^/\([^/]*\).*$|\1|' - _G_pathcdr='s|^/[^/]*||' - _G_removedotparts=':dotsl - s|/\./|/|g - t dotsl - s|/\.$|/|' - _G_collapseslashes='s|/\{1,\}|/|g' - _G_finalslash='s|/*$|/|' - - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` - while :; do - # Processed it all yet? - if test / = "$func_normal_abspath_tpath"; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result"; then - func_normal_abspath_result=/ - fi - break + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$_G_pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$_G_pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } - -# func_notquiet ARG... -# -------------------- -# Echo program name prefixed message only when not in quiet mode. -func_notquiet () +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () { - $debug_cmd + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result - $opt_quiet || func_echo ${1+"$@"} + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to @@ -1025,1186 +454,450 @@ func_notquiet () : } - -# func_relative_path SRCDIR DSTDIR -# -------------------------------- -# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. -func_relative_path () +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () { - $debug_cmd + $ECHO "$*" +} - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=$func_dirname_result - if test -z "$func_relative_path_tlibdir"; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test -n "$func_stripname_result"; then - func_append func_relative_path_result "/$func_stripname_result" - fi - - # Normalisation. If bindir is libdir, return '.' else relative path. - if test -n "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - fi - - test -n "$func_relative_path_result" || func_relative_path_result=. +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + # bash bug again: : } - -# func_quote_for_eval ARG... -# -------------------------- -# Aesthetically quote ARGs to be evaled later. -# This function returns two values: -# i) func_quote_for_eval_result -# double-quoted, suitable for a subsequent eval -# ii) func_quote_for_eval_unquoted_result -# has all characters that are still active within double -# quotes backslashified. -func_quote_for_eval () +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () { - $debug_cmd + func_error ${1+"$@"} + exit $EXIT_FAILURE +} - func_quote_for_eval_unquoted_result= - func_quote_for_eval_result= - while test 0 -lt $#; do - case $1 in - *[\\\`\"\$]*) - _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; - *) - _G_unquoted_arg=$1 ;; - esac - if test -n "$func_quote_for_eval_unquoted_result"; then - func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" - else - func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" - fi +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default - case $_G_unquoted_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and variable expansion - # for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_quoted_arg=\"$_G_unquoted_arg\" - ;; - *) - _G_quoted_arg=$_G_unquoted_arg - ;; - esac - if test -n "$func_quote_for_eval_result"; then - func_append func_quote_for_eval_result " $_G_quoted_arg" - else - func_append func_quote_for_eval_result "$_G_quoted_arg" - fi - shift - done +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 } -# func_quote_for_expand ARG -# ------------------------- +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { - $debug_cmd - case $1 in *[\\\`\"]*) - _G_arg=`$ECHO "$1" | $SED \ - -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) - _G_arg=$1 ;; + my_arg="$1" ;; esac - case $_G_arg in + case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - _G_arg=\"$_G_arg\" + my_arg="\"$my_arg\"" ;; esac - func_quote_for_expand_result=$_G_arg + func_quote_for_expand_result="$my_arg" } -# func_stripname PREFIX SUFFIX NAME -# --------------------------------- -# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -if test yes = "$_G_HAVE_XSI_OPS"; then - eval 'func_stripname () - { - $debug_cmd - - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary variable first. - func_stripname_result=$3 - func_stripname_result=${func_stripname_result#"$1"} - func_stripname_result=${func_stripname_result%"$2"} - }' -else - func_stripname () - { - $debug_cmd - - case $2 in - .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; - *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; - esac - } -fi - - -# func_show_eval CMD [FAIL_EXP] -# ----------------------------- -# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { - $debug_cmd + my_cmd="$1" + my_fail_exp="${2-:}" - _G_cmd=$1 - _G_fail_exp=${2-':'} - - func_quote_for_expand "$_G_cmd" - eval "func_notquiet $func_quote_for_expand_result" - - $opt_dry_run || { - eval "$_G_cmd" - _G_status=$? - if test 0 -ne "$_G_status"; then - eval "(exit $_G_status); $_G_fail_exp" - fi + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi } -# func_show_eval_locale CMD [FAIL_EXP] -# ------------------------------------ -# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { - $debug_cmd + my_cmd="$1" + my_fail_exp="${2-:}" - _G_cmd=$1 - _G_fail_exp=${2-':'} - - $opt_quiet || { - func_quote_for_expand "$_G_cmd" + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } - $opt_dry_run || { - eval "$_G_user_locale - $_G_cmd" - _G_status=$? - eval "$_G_safe_locale" - if test 0 -ne "$_G_status"; then - eval "(exit $_G_status); $_G_fail_exp" + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" fi - } + fi } - # func_tr_sh -# ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { - $debug_cmd - - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_verbose ARG... -# ------------------- -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $debug_cmd - - $opt_verbose && func_echo "$*" - - : -} - - -# func_warn_and_continue ARG... -# ----------------------------- -# Echo program name prefixed warning message to standard error. -func_warn_and_continue () -{ - $debug_cmd - - $require_term_colors - - func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 -} - - -# func_warning CATEGORY ARG... -# ---------------------------- -# Echo program name prefixed warning message to standard error. Warning -# messages can be filtered according to CATEGORY, where this function -# elides messages where CATEGORY is not listed in the global variable -# 'opt_warning_types'. -func_warning () -{ - $debug_cmd - - # CATEGORY must be in the warning_categories list! - case " $warning_categories " in - *" $1 "*) ;; - *) func_internal_error "invalid warning category '$1'" ;; - esac - - _G_category=$1 - shift - - case " $opt_warning_types " in - *" $_G_category "*) $warning_func ${1+"$@"} ;; - esac -} - - -# func_sort_ver VER1 VER2 -# ----------------------- -# 'sort -V' is not generally available. -# Note this deviates from the version comparison in automake -# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a -# but this should suffice as we won't be specifying old -# version formats or redundant trailing .0 in bootstrap.conf. -# If we did want full compatibility then we should probably -# use m4_version_compare from autoconf. -func_sort_ver () -{ - $debug_cmd - - printf '%s\n%s\n' "$1" "$2" \ - | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n -} - -# func_lt_ver PREV CURR -# --------------------- -# Return true if PREV and CURR are in the correct order according to -# func_sort_ver, otherwise false. Use it like this: -# -# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." -func_lt_ver () -{ - $debug_cmd - - test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` -} - - -# Local variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" -# time-stamp-time-zone: "UTC" -# End: -#! /bin/sh - -# Set a version string for this script. -scriptversion=2015-10-07.11; # UTC - -# A portable, pluggable option parser for Bourne shell. -# Written by Gary V. Vaughan, 2010 - -# Copyright (C) 2010-2015 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# Please report bugs or propose patches to gary@gnu.org. - - -## ------ ## -## Usage. ## -## ------ ## - -# This file is a library for parsing options in your shell scripts along -# with assorted other useful supporting features that you can make use -# of too. -# -# For the simplest scripts you might need only: -# -# #!/bin/sh -# . relative/path/to/funclib.sh -# . relative/path/to/options-parser -# scriptversion=1.0 -# func_options ${1+"$@"} -# eval set dummy "$func_options_result"; shift -# ...rest of your script... -# -# In order for the '--version' option to work, you will need to have a -# suitably formatted comment like the one at the top of this file -# starting with '# Written by ' and ending with '# warranty; '. -# -# For '-h' and '--help' to work, you will also need a one line -# description of your script's purpose in a comment directly above the -# '# Written by ' line, like the one at the top of this file. -# -# The default options also support '--debug', which will turn on shell -# execution tracing (see the comment above debug_cmd below for another -# use), and '--verbose' and the func_verbose function to allow your script -# to display verbose messages only when your user has specified -# '--verbose'. -# -# After sourcing this file, you can plug processing for additional -# options by amending the variables from the 'Configuration' section -# below, and following the instructions in the 'Option parsing' -# section further down. - -## -------------- ## -## Configuration. ## -## -------------- ## - -# You should override these variables in your script after sourcing this -# file so that they reflect the customisations you have added to the -# option parser. - -# The usage line for option parsing errors and the start of '-h' and -# '--help' output messages. You can embed shell variables for delayed -# expansion at the time the message is displayed, but you will need to -# quote other shell meta-characters carefully to prevent them being -# expanded when the contents are evaled. -usage='$progpath [OPTION]...' - -# Short help message in response to '-h' and '--help'. Add to this or -# override it after sourcing this library to reflect the full set of -# options your script accepts. -usage_message="\ - --debug enable verbose shell tracing - -W, --warnings=CATEGORY - report the warnings falling in CATEGORY [all] - -v, --verbose verbosely report processing - --version print version information and exit - -h, --help print short or long help message and exit -" - -# Additional text appended to 'usage_message' in response to '--help'. -long_help_message=" -Warning categories include: - 'all' show all warnings - 'none' turn off all the warnings - 'error' warnings are treated as fatal errors" - -# Help message printed before fatal option parsing errors. -fatal_help="Try '\$progname --help' for more information." - - - -## ------------------------- ## -## Hook function management. ## -## ------------------------- ## - -# This section contains functions for adding, removing, and running hooks -# to the main code. A hook is just a named list of of function, that can -# be run in order later on. - -# func_hookable FUNC_NAME -# ----------------------- -# Declare that FUNC_NAME will run hooks added with -# 'func_add_hook FUNC_NAME ...'. -func_hookable () -{ - $debug_cmd - - func_append hookable_fns " $1" -} - - -# func_add_hook FUNC_NAME HOOK_FUNC -# --------------------------------- -# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must -# first have been declared "hookable" by a call to 'func_hookable'. -func_add_hook () -{ - $debug_cmd - - case " $hookable_fns " in - *" $1 "*) ;; - *) func_fatal_error "'$1' does not accept hook functions." ;; - esac - - eval func_append ${1}_hooks '" $2"' -} - - -# func_remove_hook FUNC_NAME HOOK_FUNC -# ------------------------------------ -# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. -func_remove_hook () -{ - $debug_cmd - - eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' -} - - -# func_run_hooks FUNC_NAME [ARG]... -# --------------------------------- -# Run all hook functions registered to FUNC_NAME. -# It is assumed that the list of hook functions contains nothing more -# than a whitespace-delimited list of legal shell function names, and -# no effort is wasted trying to catch shell meta-characters or preserve -# whitespace. -func_run_hooks () -{ - $debug_cmd - - _G_rc_run_hooks=false - - case " $hookable_fns " in - *" $1 "*) ;; - *) func_fatal_error "'$1' does not support hook funcions.n" ;; - esac - - eval _G_hook_fns=\$$1_hooks; shift - - for _G_hook in $_G_hook_fns; do - if eval $_G_hook '"$@"'; then - # store returned options list back into positional - # parameters for next 'cmd' execution. - eval _G_hook_result=\$${_G_hook}_result - eval set dummy "$_G_hook_result"; shift - _G_rc_run_hooks=: - fi - done - - $_G_rc_run_hooks && func_run_hooks_result=$_G_hook_result -} - - - -## --------------- ## -## Option parsing. ## -## --------------- ## - -# In order to add your own option parsing hooks, you must accept the -# full positional parameter list in your hook function, you may remove/edit -# any options that you action, and then pass back the remaining unprocessed -# options in '_result', escaped suitably for -# 'eval'. In this case you also must return $EXIT_SUCCESS to let the -# hook's caller know that it should pay attention to -# '_result'. Returning $EXIT_FAILURE signalizes that -# arguments are left untouched by the hook and therefore caller will ignore the -# result variable. -# -# Like this: -# -# my_options_prep () -# { -# $debug_cmd -# -# # Extend the existing usage message. -# usage_message=$usage_message' -# -s, --silent don'\''t print informational messages -# ' -# # No change in '$@' (ignored completely by this hook). There is -# # no need to do the equivalent (but slower) action: -# # func_quote_for_eval ${1+"$@"} -# # my_options_prep_result=$func_quote_for_eval_result -# false -# } -# func_add_hook func_options_prep my_options_prep -# -# -# my_silent_option () -# { -# $debug_cmd -# -# args_changed=false -# -# # Note that for efficiency, we parse as many options as we can -# # recognise in a loop before passing the remainder back to the -# # caller on the first unrecognised argument we encounter. -# while test $# -gt 0; do -# opt=$1; shift -# case $opt in -# --silent|-s) opt_silent=: -# args_changed=: -# ;; -# # Separate non-argument short options: -# -s*) func_split_short_opt "$_G_opt" -# set dummy "$func_split_short_opt_name" \ -# "-$func_split_short_opt_arg" ${1+"$@"} -# shift -# args_changed=: -# ;; -# *) # Make sure the first unrecognised option "$_G_opt" -# # is added back to "$@", we could need that later -# # if $args_changed is true. -# set dummy "$_G_opt" ${1+"$@"}; shift; break ;; -# esac -# done -# -# if $args_changed; then -# func_quote_for_eval ${1+"$@"} -# my_silent_option_result=$func_quote_for_eval_result -# fi -# -# $args_changed -# } -# func_add_hook func_parse_options my_silent_option -# -# -# my_option_validation () -# { -# $debug_cmd -# -# $opt_silent && $opt_verbose && func_fatal_help "\ -# '--silent' and '--verbose' options are mutually exclusive." -# -# false -# } -# func_add_hook func_validate_options my_option_validation -# -# You'll also need to manually amend $usage_message to reflect the extra -# options you parse. It's preferable to append if you can, so that -# multiple option parsing hooks can be added safely. - - -# func_options_finish [ARG]... -# ---------------------------- -# Finishing the option parse loop (call 'func_options' hooks ATM). -func_options_finish () -{ - $debug_cmd - - _G_func_options_finish_exit=false - if func_run_hooks func_options ${1+"$@"}; then - func_options_finish_result=$func_run_hooks_result - _G_func_options_finish_exit=: - fi - - $_G_func_options_finish_exit -} - - -# func_options [ARG]... -# --------------------- -# All the functions called inside func_options are hookable. See the -# individual implementations for details. -func_hookable func_options -func_options () -{ - $debug_cmd - - _G_rc_options=false - - for my_func in options_prep parse_options validate_options options_finish - do - if eval func_$my_func '${1+"$@"}'; then - eval _G_res_var='$'"func_${my_func}_result" - eval set dummy "$_G_res_var" ; shift - _G_rc_options=: - fi - done - - # Save modified positional parameters for caller. As a top-level - # options-parser function we always need to set the 'func_options_result' - # variable (regardless the $_G_rc_options value). - if $_G_rc_options; then - func_options_result=$_G_res_var - else - func_quote_for_eval ${1+"$@"} - func_options_result=$func_quote_for_eval_result - fi - - $_G_rc_options -} - - -# func_options_prep [ARG]... -# -------------------------- -# All initialisations required before starting the option parse loop. -# Note that when calling hook functions, we pass through the list of -# positional parameters. If a hook function modifies that list, and -# needs to propagate that back to rest of this script, then the complete -# modified list must be put in 'func_run_hooks_result' before -# returning $EXIT_SUCCESS (otherwise $EXIT_FAILURE is returned). -func_hookable func_options_prep -func_options_prep () -{ - $debug_cmd - - # Option defaults: - opt_verbose=false - opt_warning_types= - - _G_rc_options_prep=false - if func_run_hooks func_options_prep ${1+"$@"}; then - _G_rc_options_prep=: - # save modified positional parameters for caller - func_options_prep_result=$func_run_hooks_result - fi - - $_G_rc_options_prep -} - - -# func_parse_options [ARG]... -# --------------------------- -# The main option parsing loop. -func_hookable func_parse_options -func_parse_options () -{ - $debug_cmd - - func_parse_options_result= - - _G_rc_parse_options=false - # this just eases exit handling - while test $# -gt 0; do - # Defer to hook functions for initial option parsing, so they - # get priority in the event of reusing an option name. - if func_run_hooks func_parse_options ${1+"$@"}; then - eval set dummy "$func_run_hooks_result"; shift - _G_rc_parse_options=: - fi - - # Break out of the loop if we already parsed every option. - test $# -gt 0 || break - - _G_match_parse_options=: - _G_opt=$1 - shift - case $_G_opt in - --debug|-x) debug_cmd='set -x' - func_echo "enabling shell trace mode" - $debug_cmd - ;; - - --no-warnings|--no-warning|--no-warn) - set dummy --warnings none ${1+"$@"} - shift - ;; - - --warnings|--warning|-W) - if test $# = 0 && func_missing_arg $_G_opt; then - _G_rc_parse_options=: - break - fi - case " $warning_categories $1" in - *" $1 "*) - # trailing space prevents matching last $1 above - func_append_uniq opt_warning_types " $1" - ;; - *all) - opt_warning_types=$warning_categories - ;; - *none) - opt_warning_types=none - warning_func=: - ;; - *error) - opt_warning_types=$warning_categories - warning_func=func_fatal_error - ;; - *) - func_fatal_error \ - "unsupported warning category: '$1'" - ;; - esac - shift - ;; - - --verbose|-v) opt_verbose=: ;; - --version) func_version ;; - -\?|-h) func_usage ;; - --help) func_help ;; - - # Separate optargs to long options (plugins may need this): - --*=*) func_split_equals "$_G_opt" - set dummy "$func_split_equals_lhs" \ - "$func_split_equals_rhs" ${1+"$@"} - shift - ;; - - # Separate optargs to short options: - -W*) - func_split_short_opt "$_G_opt" - set dummy "$func_split_short_opt_name" \ - "$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-v*|-x*) - func_split_short_opt "$_G_opt" - set dummy "$func_split_short_opt_name" \ - "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) _G_rc_parse_options=: ; break ;; - -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; - *) set dummy "$_G_opt" ${1+"$@"}; shift - _G_match_parse_options=false - break - ;; - esac - - $_G_match_parse_options && _G_rc_parse_options=: - done - - - if $_G_rc_parse_options; then - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - func_parse_options_result=$func_quote_for_eval_result - fi - - $_G_rc_parse_options -} - - -# func_validate_options [ARG]... -# ------------------------------ -# Perform any sanity checks on option settings and/or unconsumed -# arguments. -func_hookable func_validate_options -func_validate_options () -{ - $debug_cmd - - _G_rc_validate_options=false - - # Display all warnings if -W was not given. - test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" - - if func_run_hooks func_validate_options ${1+"$@"}; then - # save modified positional parameters for caller - func_validate_options_result=$func_run_hooks_result - _G_rc_validate_options=: - fi - - # Bail if the options were screwed! - $exit_cmd $EXIT_FAILURE - - $_G_rc_validate_options -} - - - -## ----------------- ## -## Helper functions. ## -## ----------------- ## - -# This section contains the helper functions used by the rest of the -# hookable option parser framework in ascii-betical order. - - -# func_fatal_help ARG... -# ---------------------- -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - $debug_cmd - - eval \$ECHO \""Usage: $usage"\" - eval \$ECHO \""$fatal_help"\" - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - - -# func_help -# --------- -# Echo long help message to standard output and exit. -func_help () -{ - $debug_cmd - - func_usage_message - $ECHO "$long_help_message" - exit 0 -} - - -# func_missing_arg ARGNAME -# ------------------------ -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $debug_cmd - - func_error "Missing argument for '$1'." - exit_cmd=exit -} - - -# func_split_equals STRING -# ------------------------ -# Set func_split_equals_lhs and func_split_equals_rhs shell variables after -# splitting STRING at the '=' sign. -test -z "$_G_HAVE_XSI_OPS" \ - && (eval 'x=a/b/c; - test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ - && _G_HAVE_XSI_OPS=yes - -if test yes = "$_G_HAVE_XSI_OPS" -then - # This is an XSI compatible shell, allowing a faster implementation... - eval 'func_split_equals () - { - $debug_cmd - - func_split_equals_lhs=${1%%=*} - func_split_equals_rhs=${1#*=} - test "x$func_split_equals_lhs" = "x$1" \ - && func_split_equals_rhs= - }' -else - # ...otherwise fall back to using expr, which is often a shell builtin. - func_split_equals () - { - $debug_cmd - - func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` - func_split_equals_rhs= - test "x$func_split_equals_lhs" = "x$1" \ - || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` - } -fi #func_split_equals - - -# func_split_short_opt SHORTOPT -# ----------------------------- -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -if test yes = "$_G_HAVE_XSI_OPS" -then - # This is an XSI compatible shell, allowing a faster implementation... - eval 'func_split_short_opt () - { - $debug_cmd - - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"} - }' -else - # ...otherwise fall back to using expr, which is often a shell builtin. - func_split_short_opt () - { - $debug_cmd - - func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` - func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` - } -fi #func_split_short_opt - - -# func_usage -# ---------- -# Echo short help message to standard output and exit. -func_usage () -{ - $debug_cmd - - func_usage_message - $ECHO "Run '$progname --help |${PAGER-more}' for full usage" - exit 0 -} - - -# func_usage_message -# ------------------ -# Echo short help message to standard output. -func_usage_message () -{ - $debug_cmd - - eval \$ECHO \""Usage: $usage"\" - echo - $SED -n 's|^# || - /^Written by/{ - x;p;x - } - h - /^Written by/q' < "$progpath" - echo - eval \$ECHO \""$usage_message"\" + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac } # func_version -# ------------ # Echo version message to standard output and exit. func_version () { - $debug_cmd + $opt_debug - printf '%s\n' "$progname $scriptversion" - $SED -n ' - /(C)/!b go - :more - /\./!{ - N - s|\n# | | - b more - } - :go - /^# Written by /,/# warranty; / { - s|^# || - s|^# *$|| - s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| - p - } - /^# Written by / { - s|^# || - p - } - /^warranty; /q' < "$progpath" + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" exit $? } - -# Local variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" -# time-stamp-time-zone: "UTC" -# End: - -# Set a version string. -scriptversion='(GNU libtool) 2.4.6' - - -# func_echo ARG... -# ---------------- -# Libtool also displays the current mode in messages, so override -# funclib.sh func_echo with this custom definition. -func_echo () -{ - $debug_cmd - - _G_message=$* - - func_echo_IFS=$IFS - IFS=$nl - for _G_line in $_G_message; do - IFS=$func_echo_IFS - $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" - done - IFS=$func_echo_IFS -} - - -# func_warning ARG... -# ------------------- -# Libtool warnings are not categorized, so override funclib.sh -# func_warning with this simpler definition. -func_warning () -{ - $debug_cmd - - $warning_func ${1+"$@"} -} - - -## ---------------- ## -## Options parsing. ## -## ---------------- ## - -# Hook in the functions to make sure our own options are parsed during -# the option parsing loop. - -usage='$progpath [OPTION]... [MODE-ARG]...' - -# Short help message in response to '-h'. -usage_message="Options: - --config show all configuration variables - --debug enable verbose shell tracing - -n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --mode=MODE use operation mode MODE - --no-warnings equivalent to '-Wnone' - --preserve-dup-deps don't remove duplicate dependency libraries - --quiet, --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - -v, --verbose print more informational messages than default - --version print version information - -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] - -h, --help, --help-all print short, long, or detailed help message -" - -# Additional text appended to 'usage_message' in response to '--help'. +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. func_help () { - $debug_cmd + $opt_debug - func_usage_message - $ECHO "$long_help_message + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} -MODE must be one of the following: +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. When passed as first option, -'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. -Try '$progname --help --mode=MODE' for a more detailed description of MODE. - -When reporting a bug, please describe a test case to reproduce it and -include the following information: - - host-triplet: $host - shell: $SHELL - compiler: $LTCC - compiler flags: $LTCFLAGS - linker: $LD (gnu? $with_gnu_ld) - version: $progname $scriptversion Debian-2.4.6-15 - automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` - autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` - -Report bugs to . -GNU libtool home page: . -General help using GNU software: ." - exit 0 + func_error "missing argument for $1." + exit_cmd=exit } -# func_lo2o OBJECT-NAME -# --------------------- -# Transform OBJECT-NAME from a '.lo' suffix to the platform specific -# object suffix. +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' -lo2o=s/\\.lo\$/.$objext/ -o2lo=s/\\.$objext\$/.lo/ - -if test yes = "$_G_HAVE_XSI_OPS"; then - eval 'func_lo2o () - { - case $1 in - *.lo) func_lo2o_result=${1%.lo}.$objext ;; - * ) func_lo2o_result=$1 ;; - esac - }' - - # func_xform LIBOBJ-OR-SOURCE - # --------------------------- - # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) - # suffix to a '.lo' libtool-object suffix. - eval 'func_xform () - { - func_xform_result=${1%.*}.lo - }' -else - # ...otherwise fall back to using sed. - func_lo2o () - { - func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` - } - - func_xform () - { - func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` - } -fi + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation -# func_fatal_configuration ARG... -# ------------------------------- +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { - func__fatal_error ${1+"$@"} \ - "See the $PACKAGE documentation for more information." \ - "Fatal configuration error." + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." } # func_config -# ----------- # Display the configuration for all the tags in this script. func_config () { @@ -2222,19 +915,17 @@ func_config () exit $? } - # func_features -# ------------- # Display the features supported by this script. func_features () { echo "host: $host" - if test yes = "$build_libtool_libs"; then + if test "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi - if test yes = "$build_old_libs"; then + if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" @@ -2243,369 +934,314 @@ func_features () exit $? } - -# func_enable_tag TAGNAME -# ----------------------- +# func_enable_tag tagname # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { - # Global variable: - tagname=$1 + # Global variable: + tagname="$1" - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf=/$re_begincf/,/$re_endcf/p + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac } - # func_check_version_match -# ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - else - cat >&2 <<_LT_EOF + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF - fi - else - cat >&2 <<_LT_EOF + fi + else + cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF - fi - - exit $EXIT_MISMATCH fi + + exit $EXIT_MISMATCH + fi } -# libtool_options_prep [ARG]... -# ----------------------------- -# Preparation for options parsed by libtool. -libtool_options_prep () +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_warning=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. { - $debug_mode + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; - # Option defaults: - opt_config=false - opt_dlopen= - opt_dry_run=false - opt_help=false - opt_mode= - opt_preserve_dup_deps=false - opt_quiet=false + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-warning|--no-warn) + opt_warning=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; - nonopt= - preserve_args= + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; - _G_rc_lt_options_prep=: + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; - # Shorthand for --mode=foo, only valid as the first argument - case $1 in - clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; - compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; - execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; - finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; - install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; - link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; - uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: ;; *) - _G_rc_lt_options_prep=false + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; - esac + esac - if $_G_rc_lt_options_prep; then - # Pass back the list of options. - func_quote_for_eval ${1+"$@"} - libtool_options_prep_result=$func_quote_for_eval_result + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" fi - $_G_rc_lt_options_prep -} -func_add_hook func_options_prep libtool_options_prep + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" - -# libtool_parse_options [ARG]... -# --------------------------------- -# Provide handling for libtool specific options. -libtool_parse_options () -{ - $debug_cmd - - _G_rc_lt_parse_options=false - - # Perform our own loop to consume as many options as possible in - # each iteration. - while test $# -gt 0; do - _G_match_lt_parse_options=: - _G_opt=$1 - shift - case $_G_opt in - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - - --config) func_config ;; - - --dlopen|-dlopen) - opt_dlopen="${opt_dlopen+$opt_dlopen -}$1" - shift - ;; - - --preserve-dup-deps) - opt_preserve_dup_deps=: ;; - - --features) func_features ;; - - --finish) set dummy --mode finish ${1+"$@"}; shift ;; - - --help) opt_help=: ;; - - --help-all) opt_help=': help-all' ;; - - --mode) test $# = 0 && func_missing_arg $_G_opt && break - opt_mode=$1 - case $1 in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $_G_opt" - exit_cmd=exit - break - ;; - esac - shift - ;; - - --no-silent|--no-quiet) - opt_quiet=false - func_append preserve_args " $_G_opt" - ;; - - --no-warnings|--no-warning|--no-warn) - opt_warning=false - func_append preserve_args " $_G_opt" - ;; - - --no-verbose) - opt_verbose=false - func_append preserve_args " $_G_opt" - ;; - - --silent|--quiet) - opt_quiet=: - opt_verbose=false - func_append preserve_args " $_G_opt" - ;; - - --tag) test $# = 0 && func_missing_arg $_G_opt && break - opt_tag=$1 - func_append preserve_args " $_G_opt $1" - func_enable_tag "$1" - shift - ;; - - --verbose|-v) opt_quiet=false - opt_verbose=: - func_append preserve_args " $_G_opt" - ;; - - # An option not handled by this hook function: - *) set dummy "$_G_opt" ${1+"$@"} ; shift - _G_match_lt_parse_options=false - break - ;; - esac - $_G_match_lt_parse_options && _G_rc_lt_parse_options=: - done - - if $_G_rc_lt_parse_options; then - # save modified positional parameters for caller - func_quote_for_eval ${1+"$@"} - libtool_parse_options_result=$func_quote_for_eval_result + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE fi - $_G_rc_lt_parse_options + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE } -func_add_hook func_parse_options libtool_parse_options -# libtool_validate_options [ARG]... -# --------------------------------- -# Perform any sanity checks on option settings and/or unconsumed -# arguments. -libtool_validate_options () -{ - # save first non-option argument - if test 0 -lt $#; then - nonopt=$1 - shift - fi - - # preserve --debug - test : = "$debug_cmd" || func_append preserve_args " --debug" - - case $host in - # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 - # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 - *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - test yes != "$build_libtool_libs" \ - && test yes != "$build_old_libs" \ - && func_fatal_configuration "not configured to build any kind of library" - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test execute != "$opt_mode"; then - func_error "unrecognized option '-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help=$help - help="Try '$progname --help --mode=$opt_mode' for more information." - } - - # Pass back the unparsed argument list - func_quote_for_eval ${1+"$@"} - libtool_validate_options_result=$func_quote_for_eval_result -} -func_add_hook func_validate_options libtool_validate_options - - -# Process options as early as possible so that --help and --version -# can return quickly. -func_options ${1+"$@"} -eval set dummy "$func_options_result"; shift - - ## ----------- ## ## Main. ## ## ----------- ## -magic='%%%MAGIC variable%%%' -magic_exe='%%%MAGIC EXE variable%%%' - -# Global variables. -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# func_generated_by_libtool -# True iff stdin has been generated by Libtool. This function is only -# a basic sanity check; it will hardly flush out determined imposters. -func_generated_by_libtool_p () -{ - $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - # func_lalib_p file -# True iff FILE is a libtool '.la' library or '.lo' object file. +# True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && - $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file -# True iff FILE is a libtool '.la' library or '.lo' object file. +# True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be -# fatal anyway. Works if 'file' does not exist. +# fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no @@ -2613,13 +1249,13 @@ func_lalib_unsafe_p () for lalib_p_l in 1 2 3 4 do read lalib_p_line - case $lalib_p_line in + case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi - test yes = "$lalib_p" + test "$lalib_p" = yes } # func_ltwrapper_script_p file @@ -2628,8 +1264,7 @@ func_lalib_unsafe_p () # determined imposters. func_ltwrapper_script_p () { - test -f "$1" && - $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p + func_lalib_p "$1" } # func_ltwrapper_executable_p file @@ -2654,7 +1289,7 @@ func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" } # func_ltwrapper_p file @@ -2673,13 +1308,11 @@ func_ltwrapper_p () # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { - $debug_cmd - + $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do - IFS=$sp$nl - eval cmd=\"$cmd\" IFS=$save_ifs + eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs @@ -2691,11 +1324,10 @@ func_execute_cmds () # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing -# 'FILE.' does not work on cygwin managed mounts. +# `FILE.' does not work on cygwin managed mounts. func_source () { - $debug_cmd - + $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; @@ -2722,10 +1354,10 @@ func_resolve_sysroot () # store the result into func_replace_sysroot_result. func_replace_sysroot () { - case $lt_sysroot:$1 in + case "$lt_sysroot:$1" in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result='='$func_stripname_result + func_replace_sysroot_result="=$func_stripname_result" ;; *) # Including no sysroot. @@ -2742,8 +1374,7 @@ func_replace_sysroot () # arg is usually of the form 'gcc ...' func_infer_tag () { - $debug_cmd - + $opt_debug if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do @@ -2762,7 +1393,7 @@ func_infer_tag () for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. - eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. @@ -2787,7 +1418,7 @@ func_infer_tag () # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with '--tag'" + func_fatal_error "specify a tag with \`--tag'" # else # func_verbose "using $tagname tagged configuration" fi @@ -2803,15 +1434,15 @@ func_infer_tag () # but don't create it if we're doing a dry run. func_write_libtool_object () { - write_libobj=$1 - if test yes = "$build_libtool_libs"; then - write_lobj=\'$2\' + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' else write_lobj=none fi - if test yes = "$build_old_libs"; then - write_oldobj=\'$3\' + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' else write_oldobj=none fi @@ -2819,7 +1450,7 @@ func_write_libtool_object () $opt_dry_run || { cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$sed_naive_backslashify"` + $SED -e "$lt_sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi @@ -2884,19 +1514,18 @@ func_convert_core_file_wine_to_w32 () # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { - $debug_cmd - + $opt_debug # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result= + func_convert_core_path_wine_to_w32_result="" if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -n "$func_convert_core_file_wine_to_w32_result" ; then if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi @@ -2925,8 +1554,7 @@ func_convert_core_path_wine_to_w32 () # environment variable; do not put it in $PATH. func_cygpath () { - $debug_cmd - + $opt_debug if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then @@ -2935,7 +1563,7 @@ func_cygpath () fi else func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" fi } #end: func_cygpath @@ -2946,11 +1574,10 @@ func_cygpath () # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { - $debug_cmd - + $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 @@ -2961,14 +1588,13 @@ func_convert_core_msys_to_w32 () # func_to_host_file_result to ARG1). func_convert_file_check () { - $debug_cmd - - if test -z "$2" && test -n "$1"; then + $opt_debug + if test -z "$2" && test -n "$1" ; then func_error "Could not determine host file name corresponding to" - func_error " '$1'" + func_error " \`$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: - func_to_host_file_result=$1 + func_to_host_file_result="$1" fi } # end func_convert_file_check @@ -2980,11 +1606,10 @@ func_convert_file_check () # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { - $debug_cmd - + $opt_debug if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" - func_error " '$3'" + func_error " \`$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. @@ -2993,7 +1618,7 @@ func_convert_path_check () func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else - func_to_host_path_result=$3 + func_to_host_path_result="$3" fi fi } @@ -3005,10 +1630,9 @@ func_convert_path_check () # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { - $debug_cmd - + $opt_debug case $4 in - $1 ) func_to_host_path_result=$3$func_to_host_path_result + $1 ) func_to_host_path_result="$3$func_to_host_path_result" ;; esac case $4 in @@ -3022,7 +1646,7 @@ func_convert_path_front_back_pathsep () ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## -# invoked via '$to_host_file_cmd ARG' +# invoked via `$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. @@ -3033,8 +1657,7 @@ func_convert_path_front_back_pathsep () # in func_to_host_file_result. func_to_host_file () { - $debug_cmd - + $opt_debug $to_host_file_cmd "$1" } # end func_to_host_file @@ -3046,8 +1669,7 @@ func_to_host_file () # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { - $debug_cmd - + $opt_debug case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 @@ -3065,7 +1687,7 @@ func_to_tool_file () # Copy ARG to func_to_host_file_result. func_convert_file_noop () { - func_to_host_file_result=$1 + func_to_host_file_result="$1" } # end func_convert_file_noop @@ -3076,12 +1698,11 @@ func_convert_file_noop () # func_to_host_file_result. func_convert_file_msys_to_w32 () { - $debug_cmd - - func_to_host_file_result=$1 + $opt_debug + func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" - func_to_host_file_result=$func_convert_core_msys_to_w32_result + func_to_host_file_result="$func_convert_core_msys_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -3093,9 +1714,8 @@ func_convert_file_msys_to_w32 () # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { - $debug_cmd - - func_to_host_file_result=$1 + $opt_debug + func_to_host_file_result="$1" if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. @@ -3111,12 +1731,11 @@ func_convert_file_cygwin_to_w32 () # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { - $debug_cmd - - func_to_host_file_result=$1 + $opt_debug + func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -3128,13 +1747,12 @@ func_convert_file_nix_to_w32 () # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { - $debug_cmd - - func_to_host_file_result=$1 + $opt_debug + func_to_host_file_result="$1" if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result=$func_cygpath_result + func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -3147,14 +1765,13 @@ func_convert_file_msys_to_cygwin () # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { - $debug_cmd - - func_to_host_file_result=$1 + $opt_debug + func_to_host_file_result="$1" if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result=$func_cygpath_result + func_to_host_file_result="$func_cygpath_result" fi func_convert_file_check "$1" "$func_to_host_file_result" } @@ -3164,7 +1781,7 @@ func_convert_file_nix_to_cygwin () ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# -# invoked via '$to_host_path_cmd ARG' +# invoked via `$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. @@ -3188,11 +1805,10 @@ func_convert_file_nix_to_cygwin () to_host_path_cmd= func_init_to_host_path_cmd () { - $debug_cmd - + $opt_debug if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd=func_convert_path_$func_stripname_result + to_host_path_cmd="func_convert_path_${func_stripname_result}" fi } @@ -3202,8 +1818,7 @@ func_init_to_host_path_cmd () # in func_to_host_path_result. func_to_host_path () { - $debug_cmd - + $opt_debug func_init_to_host_path_cmd $to_host_path_cmd "$1" } @@ -3214,7 +1829,7 @@ func_to_host_path () # Copy ARG to func_to_host_path_result. func_convert_path_noop () { - func_to_host_path_result=$1 + func_to_host_path_result="$1" } # end func_convert_path_noop @@ -3225,9 +1840,8 @@ func_convert_path_noop () # func_to_host_path_result. func_convert_path_msys_to_w32 () { - $debug_cmd - - func_to_host_path_result=$1 + $opt_debug + func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; @@ -3235,7 +1849,7 @@ func_convert_path_msys_to_w32 () func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_to_host_path_result="$func_convert_core_msys_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" @@ -3249,9 +1863,8 @@ func_convert_path_msys_to_w32 () # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { - $debug_cmd - - func_to_host_path_result=$1 + $opt_debug + func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" @@ -3270,15 +1883,14 @@ func_convert_path_cygwin_to_w32 () # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { - $debug_cmd - - func_to_host_path_result=$1 + $opt_debug + func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" @@ -3292,16 +1904,15 @@ func_convert_path_nix_to_w32 () # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { - $debug_cmd - - func_to_host_path_result=$1 + $opt_debug + func_to_host_path_result="$1" if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result=$func_cygpath_result + func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" @@ -3316,9 +1927,8 @@ func_convert_path_msys_to_cygwin () # func_to_host_file_result. func_convert_path_nix_to_cygwin () { - $debug_cmd - - func_to_host_path_result=$1 + $opt_debug + func_to_host_path_result="$1" if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them @@ -3327,7 +1937,7 @@ func_convert_path_nix_to_cygwin () func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result=$func_cygpath_result + func_to_host_path_result="$func_cygpath_result" func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" @@ -3336,31 +1946,13 @@ func_convert_path_nix_to_cygwin () # end func_convert_path_nix_to_cygwin -# func_dll_def_p FILE -# True iff FILE is a Windows DLL '.def' file. -# Keep in sync with _LT_DLL_DEF_P in libtool.m4 -func_dll_def_p () -{ - $debug_cmd - - func_dll_def_p_tmp=`$SED -n \ - -e 's/^[ ]*//' \ - -e '/^\(;.*\)*$/d' \ - -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ - -e q \ - "$1"` - test DEF = "$func_dll_def_p_tmp" -} - - # func_mode_compile arg... func_mode_compile () { - $debug_cmd - + $opt_debug # Get the compilation command and the source file. base_compile= - srcfile=$nonopt # always keep a non-empty value in "srcfile" + srcfile="$nonopt" # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal @@ -3373,12 +1965,12 @@ func_mode_compile () case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile - lastarg=$arg + lastarg="$arg" arg_mode=normal ;; target ) - libobj=$arg + libobj="$arg" arg_mode=normal continue ;; @@ -3388,7 +1980,7 @@ func_mode_compile () case $arg in -o) test -n "$libobj" && \ - func_fatal_error "you cannot specify '-o' more than once" + func_fatal_error "you cannot specify \`-o' more than once" arg_mode=target continue ;; @@ -3417,12 +2009,12 @@ func_mode_compile () func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= - save_ifs=$IFS; IFS=, + save_ifs="$IFS"; IFS=',' for arg in $args; do - IFS=$save_ifs + IFS="$save_ifs" func_append_quoted lastarg "$arg" done - IFS=$save_ifs + IFS="$save_ifs" func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result @@ -3435,8 +2027,8 @@ func_mode_compile () # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # - lastarg=$srcfile - srcfile=$arg + lastarg="$srcfile" + srcfile="$arg" ;; esac # case $arg ;; @@ -3451,13 +2043,13 @@ func_mode_compile () func_fatal_error "you must specify an argument for -Xcompile" ;; target) - func_fatal_error "you must specify a target with '-o'" + func_fatal_error "you must specify a target with \`-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" - libobj=$func_basename_result + libobj="$func_basename_result" } ;; esac @@ -3477,7 +2069,7 @@ func_mode_compile () case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) - func_fatal_error "cannot determine name of library object from '$libobj'" + func_fatal_error "cannot determine name of library object from \`$libobj'" ;; esac @@ -3486,8 +2078,8 @@ func_mode_compile () for arg in $later; do case $arg in -shared) - test yes = "$build_libtool_libs" \ - || func_fatal_configuration "cannot build a shared library" + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; @@ -3513,17 +2105,17 @@ func_mode_compile () func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name '$libobj' may not contain shell special characters." + && func_warning "libobj name \`$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" - objname=$func_basename_result - xdir=$func_dirname_result - lobj=$xdir$objdir/$objname + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. - if test yes = "$build_old_libs"; then + if test "$build_old_libs" = yes; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" @@ -3535,16 +2127,16 @@ func_mode_compile () pic_mode=default ;; esac - if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c - if test no = "$compiler_c_o"; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext - lockfile=$output_obj.lock + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" else output_obj= need_locks=no @@ -3553,12 +2145,12 @@ func_mode_compile () # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file - if test yes = "$need_locks"; then + if test "$need_locks" = yes; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done - elif test warn = "$need_locks"; then + elif test "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: @@ -3566,7 +2158,7 @@ func_mode_compile () This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support '-c' and '-o' together. If you +your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -3588,11 +2180,11 @@ compiler." qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. - if test yes = "$build_libtool_libs"; then + if test "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile - if test no != "$pic_mode"; then + if test "$pic_mode" != no; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code @@ -3609,7 +2201,7 @@ compiler." func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - if test warn = "$need_locks" && + if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: @@ -3620,7 +2212,7 @@ $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support '-c' and '-o' together. If you +your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -3636,20 +2228,20 @@ compiler." fi # Allow error messages only from the first compilation. - if test yes = "$suppress_opt"; then + if test "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. - if test yes = "$build_old_libs"; then - if test yes != "$pic_mode"; then + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi - if test yes = "$compiler_c_o"; then + if test "$compiler_c_o" = yes; then func_append command " -o $obj" fi @@ -3658,7 +2250,7 @@ compiler." func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - if test warn = "$need_locks" && + if test "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: @@ -3669,7 +2261,7 @@ $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because -your compiler does not support '-c' and '-o' together. If you +your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." @@ -3689,7 +2281,7 @@ compiler." func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked - if test no != "$need_locks"; then + if test "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi @@ -3699,7 +2291,7 @@ compiler." } $opt_help || { - test compile = "$opt_mode" && func_mode_compile ${1+"$@"} + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} } func_mode_help () @@ -3719,7 +2311,7 @@ func_mode_help () Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE -(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated @@ -3738,16 +2330,16 @@ This mode accepts the following additional options: -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only - -shared do not build a '.o' file suitable for static linking - -static only build a '.o' file suitable for static linking + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler -COMPILE-COMMAND is a command to be used in creating a 'standard' object file +COMPILE-COMMAND is a command to be used in creating a \`standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix '.c' with the -library object suffix, '.lo'." +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." ;; execute) @@ -3760,7 +2352,7 @@ This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path -This mode sets the library path environment variable according to '-dlopen' +This mode sets the library path environment variable according to \`-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated @@ -3779,7 +2371,7 @@ Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use -the '--dry-run' option if you just want to see what would be executed." +the \`--dry-run' option if you just want to see what would be executed." ;; install) @@ -3789,7 +2381,7 @@ the '--dry-run' option if you just want to see what would be executed." Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be -either the 'install' or 'cp' program. +either the \`install' or \`cp' program. The following components of INSTALL-COMMAND are treated specially: @@ -3815,7 +2407,7 @@ The following components of LINK-COMMAND are treated specially: -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) - -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE @@ -3829,8 +2421,7 @@ The following components of LINK-COMMAND are treated specially: -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE use a list of object files found in FILE to specify objects - -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -objectlist FILE Use a list of object files found in FILE to specify objects -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information @@ -3850,20 +2441,20 @@ The following components of LINK-COMMAND are treated specially: -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) -All other options (arguments beginning with '-') are ignored. +All other options (arguments beginning with \`-') are ignored. -Every other argument is treated as a filename. Files ending in '.la' are +Every other argument is treated as a filename. Files ending in \`.la' are treated as uninstalled libtool libraries, other files are standard or library object files. -If the OUTPUT-FILE ends in '.la', then a libtool library is created, -only library objects ('.lo' files) may be specified, and '-rpath' is +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is required, except when creating a convenience library. -If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created -using 'ar' and 'ranlib', or on Windows using 'lib'. +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. -If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file is created, otherwise an executable program is created." ;; @@ -3874,7 +2465,7 @@ is created, otherwise an executable program is created." Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE -(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. @@ -3882,17 +2473,17 @@ Otherwise, only FILE itself is deleted using RM." ;; *) - func_fatal_help "invalid operation mode '$opt_mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" ;; esac echo - $ECHO "Try '$progname --help' for more information about other modes." + $ECHO "Try \`$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then - if test : = "$opt_help"; then + if test "$opt_help" = :; then func_mode_help else { @@ -3900,7 +2491,7 @@ if $opt_help; then for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done - } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + } | sed -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do @@ -3908,7 +2499,7 @@ if $opt_help; then func_mode_help done } | - $SED '1d + sed '1d /^When reporting/,/^Report/{ H d @@ -3925,17 +2516,16 @@ fi # func_mode_execute arg... func_mode_execute () { - $debug_cmd - + $opt_debug # The first argument is the command name. - cmd=$nonopt + cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ - || func_fatal_help "'$file' is not a file" + || func_fatal_help "\`$file' is not a file" dir= case $file in @@ -3945,7 +2535,7 @@ func_mode_execute () # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ - || func_fatal_help "'$lib' is not a valid libtool archive" + || func_fatal_help "\`$lib' is not a valid libtool archive" # Read the libtool library. dlname= @@ -3956,18 +2546,18 @@ func_mode_execute () if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ - func_warning "'$file' was not linked with '-export-dynamic'" + func_warning "\`$file' was not linked with \`-export-dynamic'" continue fi func_dirname "$file" "" "." - dir=$func_dirname_result + dir="$func_dirname_result" if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" fi fi ;; @@ -3975,18 +2565,18 @@ func_mode_execute () *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." - dir=$func_dirname_result + dir="$func_dirname_result" ;; *) - func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir=$absdir + test -n "$absdir" && dir="$absdir" # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then @@ -3998,7 +2588,7 @@ func_mode_execute () # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. - libtool_execute_magic=$magic + libtool_execute_magic="$magic" # Check if any of the arguments is a wrapper script. args= @@ -4011,12 +2601,12 @@ func_mode_execute () if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. - file=$progdir/$program + file="$progdir/$program" elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. - file=$progdir/$program + file="$progdir/$program" fi ;; esac @@ -4024,15 +2614,7 @@ func_mode_execute () func_append_quoted args "$file" done - if $opt_dry_run; then - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - else + if test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" @@ -4049,18 +2631,25 @@ func_mode_execute () done # Now prepare to actually exec the command. - exec_cmd=\$cmd$args + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS fi } -test execute = "$opt_mode" && func_mode_execute ${1+"$@"} +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { - $debug_cmd - + $opt_debug libs= libdirs= admincmds= @@ -4074,11 +2663,11 @@ func_mode_finish () if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else - func_warning "'$opt' is not a valid libtool archive" + func_warning "\`$opt' is not a valid libtool archive" fi else - func_fatal_error "invalid argument '$opt'" + func_fatal_error "invalid argument \`$opt'" fi done @@ -4093,12 +2682,12 @@ func_mode_finish () # Remove sysroot references if $opt_dry_run; then for lib in $libs; do - echo "removing references to $lt_sysroot and '=' prefixes from $lib" + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do - $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done @@ -4123,7 +2712,7 @@ func_mode_finish () fi # Exit here if they wanted silent mode. - $opt_quiet && exit $EXIT_SUCCESS + $opt_silent && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" @@ -4134,27 +2723,27 @@ func_mode_finish () echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then - echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " - add LIBDIR to the \`$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" - $ECHO " - use the '$flag' linker flag" + $ECHO " - use the \`$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" fi echo @@ -4173,20 +2762,18 @@ func_mode_finish () exit $EXIT_SUCCESS } -test finish = "$opt_mode" && func_mode_finish ${1+"$@"} +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { - $debug_cmd - + $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). - if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac - then + case $nonopt in *shtool*) :;; *) false;; esac; then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " @@ -4213,7 +2800,7 @@ func_mode_install () opts= prev= install_type= - isdir=false + isdir=no stripme= no_mode=: for arg @@ -4226,7 +2813,7 @@ func_mode_install () fi case $arg in - -d) isdir=: ;; + -d) isdir=yes ;; -f) if $install_cp; then :; else prev=$arg @@ -4244,7 +2831,7 @@ func_mode_install () *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then - if test X-m = "X$prev" && test -n "$install_override_mode"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi @@ -4269,7 +2856,7 @@ func_mode_install () func_fatal_help "you must specify an install program" test -n "$prev" && \ - func_fatal_help "the '$prev' option requires an argument" + func_fatal_help "the \`$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else @@ -4291,19 +2878,19 @@ func_mode_install () dest=$func_stripname_result # Check to see that the destination is a directory. - test -d "$dest" && isdir=: - if $isdir; then - destdir=$dest + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." - destdir=$func_dirname_result - destname=$func_basename_result + destdir="$func_dirname_result" + destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ - func_fatal_help "'$dest' is not a directory" + func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; @@ -4312,7 +2899,7 @@ func_mode_install () case $file in *.lo) ;; *) - func_fatal_help "'$destdir' must be an absolute directory name" + func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done @@ -4321,7 +2908,7 @@ func_mode_install () # This variable tells wrapper scripts just to set variables rather # than running their programs. - libtool_install_magic=$magic + libtool_install_magic="$magic" staticlibs= future_libdirs= @@ -4341,7 +2928,7 @@ func_mode_install () # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ - || func_fatal_help "'$file' is not a valid libtool archive" + || func_fatal_help "\`$file' is not a valid libtool archive" library_names= old_library= @@ -4363,7 +2950,7 @@ func_mode_install () fi func_dirname "$file" "/" "" - dir=$func_dirname_result + dir="$func_dirname_result" func_append dir "$objdir" if test -n "$relink_command"; then @@ -4377,7 +2964,7 @@ func_mode_install () # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. @@ -4386,36 +2973,29 @@ func_mode_install () relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi - func_warning "relinking '$file'" + func_warning "relinking \`$file'" func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then - realname=$1 + realname="$1" shift - srcname=$realname - test -n "$relink_command" && srcname=${realname}T + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' - tstripme=$stripme + tstripme="$stripme" case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) - tstripme= - ;; - esac - ;; - os2*) - case $realname in - *_dll.a) - tstripme= + tstripme="" ;; esac ;; @@ -4426,7 +3006,7 @@ func_mode_install () if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. - # Try 'ln -sf' first, because the 'ln' binary might depend on + # Try `ln -sf' first, because the `ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname @@ -4437,14 +3017,14 @@ func_mode_install () fi # Do each command in the postinstall commands. - lib=$destdir/$realname + lib="$destdir/$realname" func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" - name=$func_basename_result - instname=$dir/${name}i + name="$func_basename_result" + instname="$dir/$name"i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. @@ -4456,11 +3036,11 @@ func_mode_install () # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then - destfile=$destdir/$destname + destfile="$destdir/$destname" else func_basename "$file" - destfile=$func_basename_result - destfile=$destdir/$destfile + destfile="$func_basename_result" + destfile="$destdir/$destfile" fi # Deduce the name of the destination old-style object file. @@ -4470,11 +3050,11 @@ func_mode_install () staticdest=$func_lo2o_result ;; *.$objext) - staticdest=$destfile + staticdest="$destfile" destfile= ;; *) - func_fatal_help "cannot copy a libtool object to '$destfile'" + func_fatal_help "cannot copy a libtool object to \`$destfile'" ;; esac @@ -4483,7 +3063,7 @@ func_mode_install () func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. - if test yes = "$build_old_libs"; then + if test "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result @@ -4495,23 +3075,23 @@ func_mode_install () *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then - destfile=$destdir/$destname + destfile="$destdir/$destname" else func_basename "$file" - destfile=$func_basename_result - destfile=$destdir/$destfile + destfile="$func_basename_result" + destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install - stripped_ext= + stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result - stripped_ext=.exe + stripped_ext=".exe" fi ;; esac @@ -4539,19 +3119,19 @@ func_mode_install () # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script '$wrapper'" + func_fatal_error "invalid libtool wrapper script \`$wrapper'" - finalize=: + finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi - libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "'$lib' has not been installed in '$libdir'" - finalize=false + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no fi done @@ -4559,29 +3139,29 @@ func_mode_install () func_source "$wrapper" outputname= - if test no = "$fast_install" && test -n "$relink_command"; then + if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { - if $finalize; then + if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" - file=$func_basename_result - outputname=$tmpdir/$file + file="$func_basename_result" + outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - $opt_quiet || { + $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else - func_error "error: relink '$file' with the above command before installing it" + func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi - file=$outputname + file="$outputname" else - func_warning "cannot relink '$file'" + func_warning "cannot relink \`$file'" fi } else @@ -4618,10 +3198,10 @@ func_mode_install () for file in $staticlibs; do func_basename "$file" - name=$func_basename_result + name="$func_basename_result" # Set up the ranlib parameters. - oldlib=$destdir/$name + oldlib="$destdir/$name" func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result @@ -4636,18 +3216,18 @@ func_mode_install () done test -n "$future_libdirs" && \ - func_warning "remember to run '$progname --finish$future_libdirs'" + func_warning "remember to run \`$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } -test install = "$opt_mode" && func_mode_install ${1+"$@"} +test "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p @@ -4655,17 +3235,16 @@ test install = "$opt_mode" && func_mode_install ${1+"$@"} # a dlpreopen symbol table. func_generate_dlsyms () { - $debug_cmd - - my_outputname=$1 - my_originator=$2 - my_pic_p=${3-false} - my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= - if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms=${my_outputname}S.c + my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi @@ -4676,7 +3255,7 @@ func_generate_dlsyms () "") ;; *.c) # Discover the nlist of each of the dlfiles. - nlist=$output_objdir/$my_outputname.nm + nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" @@ -4684,36 +3263,34 @@ func_generate_dlsyms () func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif -#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST -#elif defined __osf__ +#elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif -#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) - /* External symbol declarations for the compiler. */\ " - if test yes = "$dlself"; then - func_verbose "generating symbol list for '$output'" + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" @@ -4721,7 +3298,7 @@ extern \"C\" { progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done @@ -4741,10 +3318,10 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols=$output_objdir/$outputname.exp + export_symbols="$output_objdir/$outputname.exp" $opt_dry_run || { $RM $export_symbols - eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' @@ -4754,7 +3331,7 @@ extern \"C\" { } else $opt_dry_run || { - eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in @@ -4768,22 +3345,22 @@ extern \"C\" { fi for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from '$dlprefile'" + func_verbose "extracting global C symbols from \`$dlprefile'" func_basename "$dlprefile" - name=$func_basename_result + name="$func_basename_result" case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename= + dlprefile_dlbasename="" if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname"; then + if test -n "$dlprefile_dlname" ; then func_basename "$dlprefile_dlname" - dlprefile_dlbasename=$func_basename_result + dlprefile_dlbasename="$func_basename_result" else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" @@ -4791,7 +3368,7 @@ extern \"C\" { fi fi $opt_dry_run || { - if test -n "$dlprefile_dlbasename"; then + if test -n "$dlprefile_dlbasename" ; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" @@ -4847,11 +3424,6 @@ extern \"C\" { echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi - func_show_eval '$RM "${nlist}I"' - if test -n "$global_symbol_to_import"; then - eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' - fi - echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ @@ -4860,30 +3432,11 @@ typedef struct { void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[];\ -" - - if test -s "$nlist"I; then - echo >> "$output_objdir/$my_dlsyms" "\ -static void lt_syminit(void) -{ - LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; - for (; symbol->name; ++symbol) - {" - $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" - echo >> "$output_objdir/$my_dlsyms" "\ - } -}" - fi - echo >> "$output_objdir/$my_dlsyms" "\ +lt_${my_prefix}_LTX_preloaded_symbols[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = -{ {\"$my_originator\", (void *) 0}," - - if test -s "$nlist"I; then - echo >> "$output_objdir/$my_dlsyms" "\ - {\"@INIT@\", (void *) <_syminit}," - fi +{\ + { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) @@ -4925,7 +3478,9 @@ static const void *lt_preloaded_setup() { *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) - $my_pic_p && pic_flag_for_symtable=" $pic_flag" + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi ;; esac ;; @@ -4942,10 +3497,10 @@ static const void *lt_preloaded_setup() { func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' # Transform the symbol file into the correct name. - symfileobj=$output_objdir/${my_outputname}S.$objext + symfileobj="$output_objdir/${my_outputname}S.$objext" case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then @@ -4963,7 +3518,7 @@ static const void *lt_preloaded_setup() { esac ;; *) - func_fatal_error "unknown suffix for '$my_dlsyms'" + func_fatal_error "unknown suffix for \`$my_dlsyms'" ;; esac else @@ -4977,32 +3532,6 @@ static const void *lt_preloaded_setup() { fi } -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $debug_cmd - - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $debug_cmd - - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - # func_win32_libid arg # return the library type of file 'arg' # @@ -5012,9 +3541,8 @@ func_cygming_ms_implib_p () # Despite the name, also deal with 64 bit binaries. func_win32_libid () { - $debug_cmd - - win32_libid_type=unknown + $opt_debug + win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import @@ -5024,29 +3552,16 @@ func_win32_libid () # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - case $nm_interface in - "MS dumpbin") - if func_cygming_ms_implib_p "$1" || - func_cygming_gnu_implib_p "$1" - then - win32_nmres=import - else - win32_nmres= - fi - ;; - *) - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' 1,100{ / I /{ - s|.*|import| + s,.*,import, p q } }'` - ;; - esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; @@ -5078,8 +3593,7 @@ func_win32_libid () # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { - $debug_cmd - + $opt_debug sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } @@ -5096,8 +3610,7 @@ func_cygming_dll_for_implib () # specified import library. func_cygming_dll_for_implib_fallback_core () { - $debug_cmd - + $opt_debug match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ @@ -5133,8 +3646,8 @@ func_cygming_dll_for_implib_fallback_core () /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the - # archive that possess that section. Heuristic: eliminate - # all those that have a first or second character that is + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually @@ -5145,6 +3658,30 @@ func_cygming_dll_for_implib_fallback_core () $SED -e '/^\./d;/^.\./d;q' } +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified @@ -5158,17 +3695,16 @@ func_cygming_dll_for_implib_fallback_core () # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { - $debug_cmd - - if func_cygming_gnu_implib_p "$1"; then + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1"; then + elif func_cygming_ms_implib_p "$1" ; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown - sharedlib_from_linklib_result= + sharedlib_from_linklib_result="" fi } @@ -5176,11 +3712,10 @@ func_cygming_dll_for_implib_fallback () # func_extract_an_archive dir oldlib func_extract_an_archive () { - $debug_cmd - - f_ex_an_ar_dir=$1; shift - f_ex_an_ar_oldlib=$1 - if test yes = "$lock_old_archive_extraction"; then + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" @@ -5189,7 +3724,7 @@ func_extract_an_archive () fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' - if test yes = "$lock_old_archive_extraction"; then + if test "$lock_old_archive_extraction" = yes; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then @@ -5203,23 +3738,22 @@ func_extract_an_archive () # func_extract_archives gentop oldlib ... func_extract_archives () { - $debug_cmd - - my_gentop=$1; shift + $opt_debug + my_gentop="$1"; shift my_oldlibs=${1+"$@"} - my_oldobjs= - my_xlib= - my_xabs= - my_xdir= + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" - my_xlib=$func_basename_result + my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in @@ -5231,7 +3765,7 @@ func_extract_archives () esac done extracted_archives="$extracted_archives $my_xlib_u" - my_xdir=$my_gentop/$my_xlib_u + my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" @@ -5244,23 +3778,22 @@ func_extract_archives () cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` - func_basename "$darwin_archive" - darwin_base_archive=$func_basename_result + darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches; do - func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" - $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" - cd "unfat-$$/$darwin_base_archive-$darwin_arch" - func_extract_an_archive "`pwd`" "$darwin_base_archive" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" - $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do @@ -5282,7 +3815,7 @@ func_extract_archives () my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done - func_extract_archives_result=$my_oldobjs + func_extract_archives_result="$my_oldobjs" } @@ -5297,7 +3830,7 @@ func_extract_archives () # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script -# will assume that the directory where it is stored is +# will assume that the directory in which it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () @@ -5308,7 +3841,7 @@ func_emit_wrapper () #! $SHELL # $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. @@ -5365,9 +3898,9 @@ _LTECHO_EOF' # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ that is used only on +# /script/ and the wrapper /executable/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options that match +# (application programs are unlikely to have options which match # this pattern). # # There are only two supported options: --lt-debug and @@ -5400,7 +3933,7 @@ func_parse_lt_options () # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then - echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 fi } @@ -5411,7 +3944,7 @@ func_lt_dump_args () lt_dump_args_N=1; for lt_arg do - \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } @@ -5425,7 +3958,7 @@ func_exec_program_core () *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then - \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} @@ -5435,7 +3968,7 @@ func_exec_program_core () *) $ECHO "\ if test -n \"\$lt_option_debug\"; then - \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} @@ -5510,13 +4043,13 @@ func_exec_program () test -n \"\$absdir\" && thisdir=\"\$absdir\" " - if test yes = "$fast_install"; then + if test "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" @@ -5533,7 +4066,7 @@ func_exec_program () if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else - \$ECHO \"\$relink_command_output\" >&2 + $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi @@ -5568,7 +4101,7 @@ func_exec_program () fi # Export our shlibpath_var if we have one. - if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" @@ -5588,7 +4121,7 @@ func_exec_program () fi else # The program doesn't exist. - \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 @@ -5607,7 +4140,7 @@ func_emit_cwrapperexe_src () cat < #include -#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) - /* declarations of non-ANSI functions */ -#if defined __MINGW32__ +#if defined(__MINGW32__) # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif -#elif defined __CYGWIN__ +#elif defined(__CYGWIN__) # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif -/* #elif defined other_platform || defined ... */ +/* #elif defined (other platforms) ... */ #endif /* portability defines, excluding path handling macros */ -#if defined _MSC_VER +#if defined(_MSC_VER) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC -#elif defined __MINGW32__ +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv -#elif defined __CYGWIN__ +#elif defined(__CYGWIN__) # define HAVE_SETENV # define FOPEN_WB "wb" -/* #elif defined other platforms ... */ +/* #elif defined (other platforms) ... */ #endif -#if defined PATH_MAX +#if defined(PATH_MAX) # define LT_PATHMAX PATH_MAX -#elif defined MAXPATHLEN +#elif defined(MAXPATHLEN) # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 @@ -5699,8 +4234,8 @@ int setenv (const char *, const char *, int); # define PATH_SEPARATOR ':' #endif -#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ - defined __OS2__ +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 @@ -5733,10 +4268,10 @@ int setenv (const char *, const char *, int); #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ - if (stale) { free (stale); stale = 0; } \ + if (stale) { free ((void *) stale); stale = 0; } \ } while (0) -#if defined LT_DEBUGWRAPPER +#if defined(LT_DEBUGWRAPPER) static int lt_debug = 1; #else static int lt_debug = 0; @@ -5765,16 +4300,11 @@ void lt_dump_script (FILE *f); EOF cat < 0) && IS_PATH_SEPARATOR (new_value[len-1])) + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { - new_value[--len] = '\0'; + new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); @@ -6552,47 +5082,27 @@ EOF # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { - $debug_cmd - + $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } -# func_suncc_cstd_abi -# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! -# Several compiler flags select an ABI that is incompatible with the -# Cstd library. Avoid specifying it if any are in CXXFLAGS. -func_suncc_cstd_abi () -{ - $debug_cmd - - case " $compile_command " in - *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) - suncc_use_cstd_abi=no - ;; - *) - suncc_use_cstd_abi=yes - ;; - esac -} - # func_mode_link arg... func_mode_link () { - $debug_cmd - + $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out - # what system we are compiling for in order to pass an extra + # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll that has undefined symbols, in which case not + # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. @@ -6636,11 +5146,10 @@ func_mode_link () module=no no_install=no objs= - os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no - preload=false + preload=no prev= prevarg= release= @@ -6652,7 +5161,7 @@ func_mode_link () vinfo= vinfo_number=no weak_libs= - single_module=$wl-single_module + single_module="${wl}-single_module" func_infer_tag $base_compile # We need to know -static, to get the right output filenames. @@ -6660,15 +5169,15 @@ func_mode_link () do case $arg in -shared) - test yes != "$build_libtool_libs" \ - && func_fatal_configuration "cannot build a shared library" + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) - if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then @@ -6701,7 +5210,7 @@ func_mode_link () # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do - arg=$1 + arg="$1" shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result @@ -6718,21 +5227,21 @@ func_mode_link () case $prev in bindir) - bindir=$arg + bindir="$arg" prev= continue ;; dlfiles|dlprefiles) - $preload || { + if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" - preload=: - } + preload=yes + fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) - if test no = "$dlself"; then + if test "$dlself" = no; then dlself=needless export_dynamic=yes fi @@ -6740,9 +5249,9 @@ func_mode_link () continue ;; self) - if test dlprefiles = "$prev"; then + if test "$prev" = dlprefiles; then dlself=yes - elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless @@ -6752,7 +5261,7 @@ func_mode_link () continue ;; *) - if test dlfiles = "$prev"; then + if test "$prev" = dlfiles; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" @@ -6763,14 +5272,14 @@ func_mode_link () esac ;; expsyms) - export_symbols=$arg + export_symbols="$arg" test -f "$arg" \ - || func_fatal_error "symbol file '$arg' does not exist" + || func_fatal_error "symbol file \`$arg' does not exist" prev= continue ;; expsyms_regex) - export_symbols_regex=$arg + export_symbols_regex="$arg" prev= continue ;; @@ -6788,13 +5297,7 @@ func_mode_link () continue ;; inst_prefix) - inst_prefix_dir=$arg - prev= - continue - ;; - mllvm) - # Clang does not use LLVM to link, so we can simply discard any - # '-mllvm $arg' options when doing the link step. + inst_prefix_dir="$arg" prev= continue ;; @@ -6818,21 +5321,21 @@ func_mode_link () if test -z "$pic_object" || test -z "$non_pic_object" || - test none = "$pic_object" && - test none = "$non_pic_object"; then - func_fatal_error "cannot find name of object for '$arg'" + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir=$func_dirname_result + xdir="$func_dirname_result" - if test none != "$pic_object"; then + if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. - pic_object=$xdir$pic_object + pic_object="$xdir$pic_object" - if test dlfiles = "$prev"; then - if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue @@ -6843,7 +5346,7 @@ func_mode_link () fi # CHECK ME: I think I busted this. -Ossama - if test dlprefiles = "$prev"; then + if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= @@ -6851,23 +5354,23 @@ func_mode_link () # A PIC object. func_append libobjs " $pic_object" - arg=$pic_object + arg="$pic_object" fi # Non-PIC object. - if test none != "$non_pic_object"; then + if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. - non_pic_object=$xdir$non_pic_object + non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test none = "$pic_object"; then - arg=$non_pic_object + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. - non_pic_object=$pic_object + non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else @@ -6875,7 +5378,7 @@ func_mode_link () if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir=$func_dirname_result + xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result @@ -6883,29 +5386,24 @@ func_mode_link () func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else - func_fatal_error "'$arg' is not a valid libtool object" + func_fatal_error "\`$arg' is not a valid libtool object" fi fi done else - func_fatal_error "link input file '$arg' does not exist" + func_fatal_error "link input file \`$arg' does not exist" fi arg=$save_arg prev= continue ;; - os2dllname) - os2dllname=$arg - prev= - continue - ;; precious_regex) - precious_files_regex=$arg + precious_files_regex="$arg" prev= continue ;; release) - release=-$arg + release="-$arg" prev= continue ;; @@ -6917,7 +5415,7 @@ func_mode_link () func_fatal_error "only absolute run-paths are allowed" ;; esac - if test rpath = "$prev"; then + if test "$prev" = rpath; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; @@ -6932,7 +5430,7 @@ func_mode_link () continue ;; shrext) - shrext_cmds=$arg + shrext_cmds="$arg" prev= continue ;; @@ -6972,7 +5470,7 @@ func_mode_link () esac fi # test -n "$prev" - prevarg=$arg + prevarg="$arg" case $arg in -all-static) @@ -6986,7 +5484,7 @@ func_mode_link () -allow-undefined) # FIXME: remove this flag sometime in the future. - func_fatal_error "'-allow-undefined' must not be used because it is the default" + func_fatal_error "\`-allow-undefined' must not be used because it is the default" ;; -avoid-version) @@ -7018,7 +5516,7 @@ func_mode_link () if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi - if test X-export-symbols = "X$arg"; then + if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex @@ -7052,9 +5550,9 @@ func_mode_link () func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then - func_fatal_error "require no space between '-L' and '$1'" + func_fatal_error "require no space between \`-L' and \`$1'" else - func_fatal_error "need path for '-L' option" + func_fatal_error "need path for \`-L' option" fi fi func_resolve_sysroot "$func_stripname_result" @@ -7065,8 +5563,8 @@ func_mode_link () *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of '$dir'" - dir=$absdir + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" ;; esac case "$deplibs " in @@ -7101,7 +5599,7 @@ func_mode_link () ;; -l*) - if test X-lc = "X$arg" || test X-lm = "X$arg"; then + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) @@ -7109,11 +5607,11 @@ func_mode_link () ;; *-*-os2*) # These systems don't actually have a C library (as such) - test X-lc = "X$arg" && continue + test "X$arg" = "X-lc" && continue ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. - test X-lc = "X$arg" && continue + test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework @@ -7122,16 +5620,16 @@ func_mode_link () ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype - test X-lc = "X$arg" && continue + test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work - test X-lc = "X$arg" && continue + test "X$arg" = "X-lc" && continue ;; esac - elif test X-lc_r = "X$arg"; then + elif test "X$arg" = "X-lc_r"; then case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; @@ -7141,11 +5639,6 @@ func_mode_link () continue ;; - -mllvm) - prev=mllvm - continue - ;; - -module) module=yes continue @@ -7175,7 +5668,7 @@ func_mode_link () ;; -multi_module) - single_module=$wl-multi_module + single_module="${wl}-multi_module" continue ;; @@ -7189,8 +5682,8 @@ func_mode_link () *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. - func_warning "'-no-install' is ignored for $host" - func_warning "assuming '-no-fast-install' instead" + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; @@ -7208,11 +5701,6 @@ func_mode_link () continue ;; - -os2dllname) - prev=os2dllname - continue - ;; - -o) prev=output ;; -precious-files-regex) @@ -7300,14 +5788,14 @@ func_mode_link () func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= - save_ifs=$IFS; IFS=, + save_ifs="$IFS"; IFS=',' for flag in $args; do - IFS=$save_ifs + IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done - IFS=$save_ifs + IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; @@ -7316,15 +5804,15 @@ func_mode_link () func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= - save_ifs=$IFS; IFS=, + save_ifs="$IFS"; IFS=',' for flag in $args; do - IFS=$save_ifs + IFS="$save_ifs" func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done - IFS=$save_ifs + IFS="$save_ifs" func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; @@ -7347,7 +5835,7 @@ func_mode_link () # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + arg="$func_quote_for_eval_result" ;; # Flags to be passed through unchanged, with rationale: @@ -7359,52 +5847,25 @@ func_mode_link () # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support - # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - # -specs=* GCC specs files - # -stdlib=* select c++ std lib with clang - # -fsanitize=* Clang/GCC memory and address sanitizer - # -fuse-ld=* Linker select flags for GCC - # -static-* direct GCC to link specific libraries statically - # -fcilkplus Cilk Plus language extension features for C/C++ + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus) + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + arg="$func_quote_for_eval_result" func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; - -Z*) - if test os2 = "`expr $host : '.*\(os2\)'`"; then - # OS/2 uses -Zxxx to specify OS/2-specific options - compiler_flags="$compiler_flags $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case $arg in - -Zlinker | -Zstack) - prev=xcompiler - ;; - esac - continue - else - # Otherwise treat like 'Some other compiler flag' below - func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result - fi - ;; - # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + arg="$func_quote_for_eval_result" ;; *.$objext) @@ -7425,21 +5886,21 @@ func_mode_link () if test -z "$pic_object" || test -z "$non_pic_object" || - test none = "$pic_object" && - test none = "$non_pic_object"; then - func_fatal_error "cannot find name of object for '$arg'" + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir=$func_dirname_result + xdir="$func_dirname_result" - test none = "$pic_object" || { + if test "$pic_object" != none; then # Prepend the subdirectory the object is found in. - pic_object=$xdir$pic_object + pic_object="$xdir$pic_object" - if test dlfiles = "$prev"; then - if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then func_append dlfiles " $pic_object" prev= continue @@ -7450,7 +5911,7 @@ func_mode_link () fi # CHECK ME: I think I busted this. -Ossama - if test dlprefiles = "$prev"; then + if test "$prev" = dlprefiles; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= @@ -7458,23 +5919,23 @@ func_mode_link () # A PIC object. func_append libobjs " $pic_object" - arg=$pic_object - } + arg="$pic_object" + fi # Non-PIC object. - if test none != "$non_pic_object"; then + if test "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. - non_pic_object=$xdir$non_pic_object + non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test none = "$pic_object"; then - arg=$non_pic_object + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. - non_pic_object=$pic_object + non_pic_object="$pic_object" func_append non_pic_objects " $non_pic_object" fi else @@ -7482,7 +5943,7 @@ func_mode_link () if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" - xdir=$func_dirname_result + xdir="$func_dirname_result" func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result @@ -7490,7 +5951,7 @@ func_mode_link () func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else - func_fatal_error "'$arg' is not a valid libtool object" + func_fatal_error "\`$arg' is not a valid libtool object" fi fi ;; @@ -7506,11 +5967,11 @@ func_mode_link () # A libtool-controlled library. func_resolve_sysroot "$arg" - if test dlfiles = "$prev"; then + if test "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= - elif test dlprefiles = "$prev"; then + elif test "$prev" = dlprefiles; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= @@ -7525,7 +5986,7 @@ func_mode_link () # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" - arg=$func_quote_for_eval_result + arg="$func_quote_for_eval_result" ;; esac # arg @@ -7537,9 +5998,9 @@ func_mode_link () done # argument parsing loop test -n "$prev" && \ - func_fatal_help "the '$prevarg' option requires an argument" + func_fatal_help "the \`$prevarg' option requires an argument" - if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" @@ -7548,23 +6009,20 @@ func_mode_link () oldlibs= # calculate the name of the file, without its directory func_basename "$output" - outputname=$func_basename_result - libobjs_save=$libobjs + outputname="$func_basename_result" + libobjs_save="$libobjs" if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - # Definition is injected by LT_CONFIG during libtool generation. - func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" - func_dirname "$output" "/" "" - output_objdir=$func_dirname_result$objdir + output_objdir="$func_dirname_result$objdir" func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. @@ -7587,7 +6045,7 @@ func_mode_link () # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do - if $opt_preserve_dup_deps; then + if $opt_preserve_dup_deps ; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac @@ -7595,7 +6053,7 @@ func_mode_link () func_append libs " $deplib" done - if test lib = "$linkmode"; then + if test "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps @@ -7627,7 +6085,7 @@ func_mode_link () case $file in *.la) ;; *) - func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" ;; esac done @@ -7635,7 +6093,7 @@ func_mode_link () prog) compile_deplibs= finalize_deplibs= - alldeplibs=false + alldeplibs=no newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" @@ -7647,32 +6105,32 @@ func_mode_link () for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... - if test lib,link = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done - deplibs=$tmp_deplibs + deplibs="$tmp_deplibs" fi - if test lib,link = "$linkmode,$pass" || - test prog,scan = "$linkmode,$pass"; then - libs=$deplibs + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" deplibs= fi - if test prog = "$linkmode"; then + if test "$linkmode" = prog; then case $pass in - dlopen) libs=$dlfiles ;; - dlpreopen) libs=$dlprefiles ;; + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS%" test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" ;; esac fi - if test lib,dlpreopen = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "lib,dlpreopen"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs @@ -7693,26 +6151,26 @@ func_mode_link () esac done done - libs=$dlprefiles + libs="$dlprefiles" fi - if test dlopen = "$pass"; then + if test "$pass" = dlopen; then # Collect dlpreopened libraries - save_deplibs=$deplibs + save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= - found=false + found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) - if test prog,link = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" - if test lib = "$linkmode"; then + if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; @@ -7722,13 +6180,13 @@ func_mode_link () continue ;; -l*) - if test lib != "$linkmode" && test prog != "$linkmode"; then - func_warning "'-l' is ignored for archives/objects" + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result - if test lib = "$linkmode"; then + if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" @@ -7736,22 +6194,31 @@ func_mode_link () for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library - lib=$searchdir/lib$name$search_ext + lib="$searchdir/lib${name}${search_ext}" if test -f "$lib"; then - if test .la = "$search_ext"; then - found=: + if test "$search_ext" = ".la"; then + found=yes else - found=false + found=no fi break 2 fi done done - if $found; then - # deplib is a libtool library + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. - if test yes = "$allow_libtool_libs_with_static_runtimes"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then @@ -7759,19 +6226,19 @@ func_mode_link () old_library= func_source "$lib" for l in $old_library $library_names; do - ll=$l + ll="$l" done - if test "X$ll" = "X$old_library"; then # only static version available - found=false + if test "X$ll" = "X$old_library" ; then # only static version available + found=no func_dirname "$lib" "" "." - ladir=$func_dirname_result + ladir="$func_dirname_result" lib=$ladir/$old_library - if test prog,link = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi @@ -7780,25 +6247,15 @@ func_mode_link () *) ;; esac fi - else - # deplib doesn't seem to be a libtool library - if test prog,link = "$linkmode,$pass"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" - fi - continue fi ;; # -l *.ltframework) - if test prog,link = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" - if test lib = "$linkmode"; then + if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; @@ -7811,18 +6268,18 @@ func_mode_link () case $linkmode in lib) deplibs="$deplib $deplibs" - test conv = "$pass" && continue + test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) - if test conv = "$pass"; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi - if test scan = "$pass"; then + if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -7833,13 +6290,13 @@ func_mode_link () func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) - func_warning "'-L' is ignored for archives/objects" + func_warning "\`-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) - if test link = "$pass"; then + if test "$pass" = link; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result @@ -7857,7 +6314,7 @@ func_mode_link () lib=$func_resolve_sysroot_result ;; *.$libext) - if test conv = "$pass"; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi @@ -7868,26 +6325,21 @@ func_mode_link () case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) - valid_a_lib=false + valid_a_lib=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=: + valid_a_lib=yes fi ;; pass_all) - valid_a_lib=: + valid_a_lib=yes ;; esac - if $valid_a_lib; then - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - else + if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" @@ -7895,13 +6347,18 @@ func_mode_link () echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) - if test link != "$pass"; then + if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" @@ -7912,10 +6369,10 @@ func_mode_link () esac # linkmode ;; # *.$libext *.lo | *.$objext) - if test conv = "$pass"; then + if test "$pass" = conv; then deplibs="$deplib $deplibs" - elif test prog = "$linkmode"; then - if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" @@ -7928,20 +6385,22 @@ func_mode_link () continue ;; %DEPLIBS%) - alldeplibs=: + alldeplibs=yes continue ;; esac # case $deplib - $found || test -f "$lib" \ - || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ - || func_fatal_error "'$lib' is not a valid libtool archive" + || func_fatal_error "\`$lib' is not a valid libtool archive" func_dirname "$lib" "" "." - ladir=$func_dirname_result + ladir="$func_dirname_result" dlname= dlopen= @@ -7971,19 +6430,19 @@ func_mode_link () done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test lib,link = "$linkmode,$pass" || - test prog,scan = "$linkmode,$pass" || - { test prog != "$linkmode" && test lib != "$linkmode"; }; then + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi - if test conv = "$pass"; then + if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for '$lib'" + func_fatal_error "cannot find name of link library for \`$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" @@ -7991,15 +6450,15 @@ func_mode_link () tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done - elif test prog != "$linkmode" && test lib != "$linkmode"; then - func_fatal_error "'$lib' is not a convenience library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" fi continue fi # $pass = conv @@ -8008,26 +6467,26 @@ func_mode_link () # Get the name of the library we link against. linklib= if test -n "$old_library" && - { test yes = "$prefer_static_libs" || - test built,no = "$prefer_static_libs,$installed"; }; then + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then linklib=$old_library else for l in $old_library $library_names; do - linklib=$l + linklib="$l" done fi if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for '$lib'" + func_fatal_error "cannot find name of link library for \`$lib'" fi # This library was specified with -dlopen. - if test dlopen = "$pass"; then - test -z "$libdir" \ - && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi if test -z "$dlname" || - test yes != "$dlopen_support" || - test no = "$build_libtool_libs" - then + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't @@ -8041,40 +6500,40 @@ func_mode_link () # We need an absolute path. case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "cannot determine absolute directory name of \`$ladir'" func_warning "passing it literally to the linker, although it might fail" - abs_ladir=$ladir + abs_ladir="$ladir" fi ;; esac func_basename "$lib" - laname=$func_basename_result + laname="$func_basename_result" # Find the relevant object directory and library name. - if test yes = "$installed"; then + if test "X$installed" = Xyes; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library '$lib' was moved." - dir=$ladir - absdir=$abs_ladir - libdir=$abs_ladir + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" else - dir=$lt_sysroot$libdir - absdir=$lt_sysroot$libdir + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" fi - test yes = "$hardcode_automatic" && avoidtemprpath=yes + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir=$ladir - absdir=$abs_ladir + dir="$ladir" + absdir="$abs_ladir" # Remove this search path later func_append notinst_path " $abs_ladir" else - dir=$ladir/$objdir - absdir=$abs_ladir/$objdir + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" # Remove this search path later func_append notinst_path " $abs_ladir" fi @@ -8083,11 +6542,11 @@ func_mode_link () name=$func_stripname_result # This library was specified with -dlpreopen. - if test dlpreopen = "$pass"; then - if test -z "$libdir" && test prog = "$linkmode"; then - func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" fi - case $host in + case "$host" in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both @@ -8131,9 +6590,9 @@ func_mode_link () if test -z "$libdir"; then # Link the convenience library - if test lib = "$linkmode"; then + if test "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" - elif test prog,link = "$linkmode,$pass"; then + elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else @@ -8143,14 +6602,14 @@ func_mode_link () fi - if test prog = "$linkmode" && test link != "$pass"; then + if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" - linkalldeplibs=false - if test no != "$link_all_deplibs" || test -z "$library_names" || - test no = "$build_libtool_libs"; then - linkalldeplibs=: + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes fi tmp_libs= @@ -8162,14 +6621,14 @@ func_mode_link () ;; esac # Need to link against all dependency_libs? - if $linkalldeplibs; then + if test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi - if $opt_preserve_dup_deps; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac @@ -8179,15 +6638,15 @@ func_mode_link () continue fi # $linkmode = prog... - if test prog,link = "$linkmode,$pass"; then + if test "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && - { { test no = "$prefer_static_libs" || - test built,yes = "$prefer_static_libs,$installed"; } || + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. - case $temp_rpath: in + case "$temp_rpath:" in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac @@ -8216,9 +6675,9 @@ func_mode_link () esac fi # $linkmode,$pass = prog,link... - if $alldeplibs && - { test pass_all = "$deplibs_check_method" || - { test yes = "$build_libtool_libs" && + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue @@ -8227,19 +6686,19 @@ func_mode_link () link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs - if test built = "$use_static_libs" && test yes = "$installed"; then + if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && - { test no = "$use_static_libs" || test -z "$old_library"; }; then + { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in - *cygwin* | *mingw* | *cegcc* | *os2*) + *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) - if test no = "$installed"; then + if test "$installed" = no; then func_append notinst_deplibs " $lib" need_relink=yes fi @@ -8249,24 +6708,24 @@ func_mode_link () # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule= + dlopenmodule="" for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule=$dlpremoduletest + dlopenmodule="$dlpremoduletest" break fi done - if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then echo - if test prog = "$linkmode"; then + if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi - if test lib = "$linkmode" && - test yes = "$hardcode_into_libs"; then + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. @@ -8294,43 +6753,43 @@ func_mode_link () # figure out the soname set dummy $library_names shift - realname=$1 + realname="$1" shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then - soname=$dlname + soname="$dlname" elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw* | *cegcc* | *os2*) + *cygwin* | mingw* | *cegcc*) func_arith $current - $age major=$func_arith_result - versuffix=-$major + versuffix="-$major" ;; esac eval soname=\"$soname_spec\" else - soname=$realname + soname="$realname" fi # Make a new name for the extract_expsyms_cmds to use - soroot=$soname + soroot="$soname" func_basename "$soroot" - soname=$func_basename_result + soname="$func_basename_result" func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else - func_verbose "extracting exported symbol list from '$soname'" + func_verbose "extracting exported symbol list from \`$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for '$soname'" + func_verbose "generating import library for \`$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library @@ -8338,58 +6797,58 @@ func_mode_link () linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" - if test prog = "$linkmode" || test relink != "$opt_mode"; then + if test "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) - if test no = "$hardcode_direct"; then - add=$dir/$linklib + if test "$hardcode_direct" = no; then + add="$dir/$linklib" case $host in - *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; - *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir=-L$dir ;; + *-*-unixware7*) add_dir="-L$dir" ;; *-*-darwin* ) - # if the lib is a (non-dlopened) module then we cannot + # if the lib is a (non-dlopened) module then we can not # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null; then + $GREP ": [^:]* bundle" >/dev/null ; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library"; then + if test -z "$old_library" ; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else - add=$dir/$old_library + add="$dir/$old_library" fi elif test -n "$old_library"; then - add=$dir/$old_library + add="$dir/$old_library" fi fi esac - elif test no = "$hardcode_minus_L"; then + elif test "$hardcode_minus_L" = no; then case $host in - *-*-sunos*) add_shlibpath=$dir ;; + *-*-sunos*) add_shlibpath="$dir" ;; esac - add_dir=-L$dir - add=-l$name - elif test no = "$hardcode_shlibpath_var"; then - add_shlibpath=$dir - add=-l$name + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" else lib_linked=no fi ;; relink) - if test yes = "$hardcode_direct" && - test no = "$hardcode_direct_absolute"; then - add=$dir/$linklib - elif test yes = "$hardcode_minus_L"; then - add_dir=-L$absdir + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$absdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in @@ -8398,10 +6857,10 @@ func_mode_link () ;; esac fi - add=-l$name - elif test yes = "$hardcode_shlibpath_var"; then - add_shlibpath=$dir - add=-l$name + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" else lib_linked=no fi @@ -8409,7 +6868,7 @@ func_mode_link () *) lib_linked=no ;; esac - if test yes != "$lib_linked"; then + if test "$lib_linked" != yes; then func_fatal_configuration "unsupported hardcode properties" fi @@ -8419,15 +6878,15 @@ func_mode_link () *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi - if test prog = "$linkmode"; then + if test "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" - if test yes != "$hardcode_direct" && - test yes != "$hardcode_minus_L" && - test yes = "$hardcode_shlibpath_var"; then + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; @@ -8436,33 +6895,33 @@ func_mode_link () fi fi - if test prog = "$linkmode" || test relink = "$opt_mode"; then + if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. - if test yes = "$hardcode_direct" && - test no = "$hardcode_direct_absolute"; then - add=$libdir/$linklib - elif test yes = "$hardcode_minus_L"; then - add_dir=-L$libdir - add=-l$name - elif test yes = "$hardcode_shlibpath_var"; then + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac - add=-l$name - elif test yes = "$hardcode_automatic"; then + add="-l$name" + elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib"; then - add=$inst_prefix_dir$libdir/$linklib + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" else - add=$libdir/$linklib + add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. - add_dir=-L$libdir + add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in @@ -8471,10 +6930,10 @@ func_mode_link () ;; esac fi - add=-l$name + add="-l$name" fi - if test prog = "$linkmode"; then + if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else @@ -8482,43 +6941,43 @@ func_mode_link () test -n "$add" && deplibs="$add $deplibs" fi fi - elif test prog = "$linkmode"; then + elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. - if test unsupported != "$hardcode_direct"; then - test -n "$old_library" && linklib=$old_library + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi - elif test yes = "$build_libtool_libs"; then + elif test "$build_libtool_libs" = yes; then # Not a shared library - if test pass_all != "$deplibs_check_method"; then + if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo - $ECHO "*** Warning: This system cannot link to static lib archive $lib." + $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." - if test yes = "$module"; then + if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." - echo "*** 'nm' from GNU binutils and a full rebuild may help." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi - if test no = "$build_old_libs"; then + if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else @@ -8531,11 +6990,11 @@ func_mode_link () fi fi # link shared/static library? - if test lib = "$linkmode"; then + if test "$linkmode" = lib; then if test -n "$dependency_libs" && - { test yes != "$hardcode_into_libs" || - test yes = "$build_old_libs" || - test yes = "$link_static"; }; then + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do @@ -8549,12 +7008,12 @@ func_mode_link () *) func_append temp_deplibs " $libdir";; esac done - dependency_libs=$temp_deplibs + dependency_libs="$temp_deplibs" fi func_append newlib_search_path " $absdir" # Link against this library - test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do @@ -8564,7 +7023,7 @@ func_mode_link () func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac - if $opt_preserve_dup_deps; then + if $opt_preserve_dup_deps ; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; @@ -8573,12 +7032,12 @@ func_mode_link () func_append tmp_libs " $func_resolve_sysroot_result" done - if test no != "$link_all_deplibs"; then + if test "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in - -L*) path=$deplib ;; + -L*) path="$deplib" ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result @@ -8586,12 +7045,12 @@ func_mode_link () dir=$func_dirname_result # We need an absolute path. case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of '$dir'" - absdir=$dir + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" fi ;; esac @@ -8599,35 +7058,35 @@ func_mode_link () case $host in *-*-darwin*) depdepl= - eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names"; then - for tmp in $deplibrary_names; do + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do depdepl=$tmp done - if test -f "$absdir/$objdir/$depdepl"; then - depdepl=$absdir/$objdir/$depdepl - darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then - darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi - func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" - func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" path= fi fi ;; *) - path=-L$absdir/$objdir + path="-L$absdir/$objdir" ;; esac else - eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ - func_fatal_error "'$deplib' is not a valid libtool archive" + func_fatal_error "\`$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ - func_warning "'$deplib' seems to be moved" + func_warning "\`$deplib' seems to be moved" - path=-L$absdir + path="-L$absdir" fi ;; esac @@ -8639,23 +7098,23 @@ func_mode_link () fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs - if test link = "$pass"; then - if test prog = "$linkmode"; then + if test "$pass" = link; then + if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi - dependency_libs=$newdependency_libs - if test dlpreopen = "$pass"; then + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi - if test dlopen != "$pass"; then - test conv = "$pass" || { + if test "$pass" != dlopen; then + if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do @@ -8665,12 +7124,12 @@ func_mode_link () esac done newlib_search_path= - } + fi - if test prog,link = "$linkmode,$pass"; then - vars="compile_deplibs finalize_deplibs" + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" else - vars=deplibs + vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order @@ -8728,93 +7187,62 @@ func_mode_link () eval $var=\"$tmp_libs\" done # for var fi - - # Add Sun CC postdeps if required: - test CXX = "$tagname" && { - case $host_os in - linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C++ 5.9 - func_suncc_cstd_abi - - if test no != "$suncc_use_cstd_abi"; then - func_append postdeps ' -library=Cstd -library=Crun' - fi - ;; - esac - ;; - - solaris*) - func_cc_basename "$CC" - case $func_cc_basename_result in - CC* | sunCC*) - func_suncc_cstd_abi - - if test no != "$suncc_use_cstd_abi"; then - func_append postdeps ' -library=Cstd -library=Crun' - fi - ;; - esac - ;; - esac - } - # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= - for i in $dependency_libs; do + for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) - i= + i="" ;; esac - if test -n "$i"; then + if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass - if test prog = "$linkmode"; then - dlfiles=$newdlfiles + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" fi - if test prog = "$linkmode" || test lib = "$linkmode"; then - dlprefiles=$newdlprefiles + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) - if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then - func_warning "'-dlopen' is ignored for archives" + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) - func_warning "'-l' and '-L' are ignored for archives" ;; + func_warning "\`-l' and \`-L' are ignored for archives" ;; esac test -n "$rpath" && \ - func_warning "'-rpath' is ignored for archives" + func_warning "\`-rpath' is ignored for archives" test -n "$xrpath" && \ - func_warning "'-R' is ignored for archives" + func_warning "\`-R' is ignored for archives" test -n "$vinfo" && \ - func_warning "'-version-info/-version-number' is ignored for archives" + func_warning "\`-version-info/-version-number' is ignored for archives" test -n "$release" && \ - func_warning "'-release' is ignored for archives" + func_warning "\`-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ - func_warning "'-export-symbols' is ignored for archives" + func_warning "\`-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no - oldlibs=$output + oldlibs="$output" func_append objs "$old_deplibs" ;; lib) - # Make sure we only generate libraries of the form 'libNAME.la'. + # Make sure we only generate libraries of the form `libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" @@ -8823,10 +7251,10 @@ func_mode_link () eval libname=\"$libname_spec\" ;; *) - test no = "$module" \ - && func_fatal_help "libtool library '$output' must begin with 'lib'" + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" - if test no != "$need_lib_prefix"; then + if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result @@ -8840,8 +7268,8 @@ func_mode_link () esac if test -n "$objs"; then - if test pass_all != "$deplibs_check_method"; then - func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" @@ -8850,21 +7278,21 @@ func_mode_link () fi fi - test no = "$dlself" \ - || func_warning "'-dlopen self' is ignored for libtool libraries" + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift - test 1 -lt "$#" \ - && func_warning "ignoring multiple '-rpath's for a libtool library" + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" - install_libdir=$1 + install_libdir="$1" oldlibs= if test -z "$rpath"; then - if test yes = "$build_libtool_libs"; then + if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. - # Some compilers have problems with a '.al' extension so + # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" @@ -8873,20 +7301,20 @@ func_mode_link () fi test -n "$vinfo" && \ - func_warning "'-version-info/-version-number' is ignored for convenience libraries" + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ - func_warning "'-release' is ignored for convenience libraries" + func_warning "\`-release' is ignored for convenience libraries" else # Parse the version information argument. - save_ifs=$IFS; IFS=: + save_ifs="$IFS"; IFS=':' set dummy $vinfo 0 0 0 shift - IFS=$save_ifs + IFS="$save_ifs" test -n "$7" && \ - func_fatal_help "too many parameters to '-version-info'" + func_fatal_help "too many parameters to \`-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts @@ -8894,45 +7322,45 @@ func_mode_link () case $vinfo_number in yes) - number_major=$1 - number_minor=$2 - number_revision=$3 + number_major="$1" + number_minor="$2" + number_revision="$3" # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix - # that has an extra 1 added just for fun + # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor - darwin|freebsd-elf|linux|osf|windows|none) + darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result - age=$number_minor - revision=$number_revision + age="$number_minor" + revision="$number_revision" ;; - freebsd-aout|qnx|sunos) - current=$number_major - revision=$number_minor - age=0 + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result - age=$number_minor - revision=$number_minor + age="$number_minor" + revision="$number_minor" lt_irix_increment=no ;; *) - func_fatal_configuration "$modename: unknown library version type '$version_type'" + func_fatal_configuration "$modename: unknown library version type \`$version_type'" ;; esac ;; no) - current=$1 - revision=$2 - age=$3 + current="$1" + revision="$2" + age="$3" ;; esac @@ -8940,30 +7368,30 @@ func_mode_link () case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "CURRENT '$current' must be a nonnegative integer" - func_fatal_error "'$vinfo' is not valid version information" + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "REVISION '$revision' must be a nonnegative integer" - func_fatal_error "'$vinfo' is not valid version information" + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) - func_error "AGE '$age' must be a nonnegative integer" - func_fatal_error "'$vinfo' is not valid version information" + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then - func_error "AGE '$age' is greater than the current interface number '$current'" - func_fatal_error "'$vinfo' is not valid version information" + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" fi # Calculate the version variables. @@ -8978,36 +7406,26 @@ func_mode_link () # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result - versuffix=$major.$age.$revision + versuffix="$major.$age.$revision" # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result - xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - # On Darwin other compilers - case $CC in - nagfor*) - verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" - ;; - *) - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - esac ;; freebsd-aout) - major=.$current - versuffix=.$current.$revision + major=".$current" + versuffix=".$current.$revision"; ;; freebsd-elf) - func_arith $current - $age - major=.$func_arith_result - versuffix=$major.$age.$revision + major=".$current" + versuffix=".$current" ;; irix | nonstopux) - if test no = "$lt_irix_increment"; then + if test "X$lt_irix_increment" = "Xno"; then func_arith $current - $age else func_arith $current - $age + 1 @@ -9018,74 +7436,69 @@ func_mode_link () nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac - verstring=$verstring_prefix$major.$revision + verstring="$verstring_prefix$major.$revision" # Add in all the interfaces that we are compatible with. loop=$revision - while test 0 -ne "$loop"; do + while test "$loop" -ne 0; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result - verstring=$verstring_prefix$major.$iface:$verstring + verstring="$verstring_prefix$major.$iface:$verstring" done - # Before this point, $major must not contain '.'. + # Before this point, $major must not contain `.'. major=.$major - versuffix=$major.$revision + versuffix="$major.$revision" ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result - versuffix=$major.$age.$revision + versuffix="$major.$age.$revision" ;; osf) func_arith $current - $age major=.$func_arith_result - versuffix=.$current.$age.$revision - verstring=$current.$age.$revision + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" # Add in all the interfaces that we are compatible with. loop=$age - while test 0 -ne "$loop"; do + while test "$loop" -ne 0; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result - verstring=$verstring:$iface.0 + verstring="$verstring:${iface}.0" done # Make executables depend on our current version. - func_append verstring ":$current.0" + func_append verstring ":${current}.0" ;; qnx) - major=.$current - versuffix=.$current - ;; - - sco) - major=.$current - versuffix=.$current + major=".$current" + versuffix=".$current" ;; sunos) - major=.$current - versuffix=.$current.$revision + major=".$current" + versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 file systems. + # extension on DOS 8.3 filesystems. func_arith $current - $age major=$func_arith_result - versuffix=-$major + versuffix="-$major" ;; *) - func_fatal_configuration "unknown library version type '$version_type'" + func_fatal_configuration "unknown library version type \`$version_type'" ;; esac @@ -9099,45 +7512,42 @@ func_mode_link () verstring= ;; *) - verstring=0.0 + verstring="0.0" ;; esac - if test no = "$need_version"; then + if test "$need_version" = no; then versuffix= else - versuffix=.0.0 + versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided - if test yes,no = "$avoid_version,$need_version"; then + if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= - verstring= + verstring="" fi # Check to see if the archive will have undefined symbols. - if test yes = "$allow_undefined"; then - if test unsupported = "$allow_undefined_flag"; then - if test yes = "$build_old_libs"; then - func_warning "undefined symbols not allowed in $host shared libraries; building static only" - build_libtool_libs=no - else - func_fatal_error "can't build $host shared library unless -no-undefined is specified" - fi + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes fi else # Don't allow undefined symbols. - allow_undefined_flag=$no_undefined_flag + allow_undefined_flag="$no_undefined_flag" fi fi - func_generate_dlsyms "$libname" "$libname" : + func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" - test " " = "$libobjs" && libobjs= + test "X$libobjs" = "X " && libobjs= - if test relink != "$opt_mode"; then + if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= @@ -9146,8 +7556,8 @@ func_mode_link () case $p in *.$objext | *.gcno) ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) - if test -n "$precious_files_regex"; then + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue @@ -9163,11 +7573,11 @@ func_mode_link () fi # Now set the variables for building old libraries. - if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. @@ -9188,13 +7598,13 @@ func_mode_link () *) func_append finalize_rpath " $libdir" ;; esac done - if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles=$dlfiles + old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in @@ -9204,7 +7614,7 @@ func_mode_link () done # Make sure dlprefiles contains only unique files - old_dlprefiles=$dlprefiles + old_dlprefiles="$dlprefiles" dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in @@ -9213,7 +7623,7 @@ func_mode_link () esac done - if test yes = "$build_libtool_libs"; then + if test "$build_libtool_libs" = yes; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) @@ -9237,7 +7647,7 @@ func_mode_link () ;; *) # Add libc to deplibs on all other systems if necessary. - if test yes = "$build_libtool_need_lc"; then + if test "$build_libtool_need_lc" = "yes"; then func_append deplibs " -lc" fi ;; @@ -9253,9 +7663,9 @@ func_mode_link () # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? - release= - versuffix= - major= + release="" + versuffix="" + major="" newdeplibs= droppeddeps=no case $deplibs_check_method in @@ -9284,20 +7694,20 @@ EOF -l*) func_stripname -l '' "$i" name=$func_stripname_result - if test yes = "$allow_libtool_libs_with_static_runtimes"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) func_append newdeplibs " $i" - i= + i="" ;; esac fi - if test -n "$i"; then + if test -n "$i" ; then libname=`eval "\\$ECHO \"$libname_spec\""` deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` set dummy $deplib_matches; shift deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then func_append newdeplibs " $i" else droppeddeps=yes @@ -9327,20 +7737,20 @@ EOF $opt_dry_run || $RM conftest if $LTCC $LTCFLAGS -o conftest conftest.c $i; then ldd_output=`ldd conftest` - if test yes = "$allow_libtool_libs_with_static_runtimes"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $i "*) func_append newdeplibs " $i" - i= + i="" ;; esac fi - if test -n "$i"; then + if test -n "$i" ; then libname=`eval "\\$ECHO \"$libname_spec\""` deplib_matches=`eval "\\$ECHO \"$library_names_spec\""` set dummy $deplib_matches; shift deplib_match=$1 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0; then + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then func_append newdeplibs " $i" else droppeddeps=yes @@ -9377,24 +7787,24 @@ EOF -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result - if test yes = "$allow_libtool_libs_with_static_runtimes"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" - a_deplib= + a_deplib="" ;; esac fi - if test -n "$a_deplib"; then + if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` if test -n "$file_magic_glob"; then libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob` else libnameglob=$libname fi - test yes = "$want_nocaseglob" && nocaseglob=`shopt -p nocaseglob` + test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - if test yes = "$want_nocaseglob"; then + if test "$want_nocaseglob" = yes; then shopt -s nocaseglob potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` $nocaseglob @@ -9412,25 +7822,25 @@ EOF # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? - potlib=$potent_lib + potlib="$potent_lib" while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; - *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" - a_deplib= + a_deplib="" break 2 fi done done fi - if test -n "$a_deplib"; then + if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." @@ -9438,7 +7848,7 @@ EOF echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib"; then + if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" @@ -9461,30 +7871,30 @@ EOF -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result - if test yes = "$allow_libtool_libs_with_static_runtimes"; then + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" - a_deplib= + a_deplib="" ;; esac fi - if test -n "$a_deplib"; then + if test -n "$a_deplib" ; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do - potlib=$potent_lib # see symlink-check above in file_magic test + potlib="$potent_lib" # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" - a_deplib= + a_deplib="" break 2 fi done done fi - if test -n "$a_deplib"; then + if test -n "$a_deplib" ; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." @@ -9492,7 +7902,7 @@ EOF echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib"; then + if test -z "$potlib" ; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" @@ -9508,18 +7918,18 @@ EOF done # Gone through all deplibs. ;; none | unknown | *) - newdeplibs= + newdeplibs="" tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test yes = "$allow_libtool_libs_with_static_runtimes"; then - for i in $predeps $postdeps; do + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo - if test none = "$deplibs_check_method"; then + if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." @@ -9543,8 +7953,8 @@ EOF ;; esac - if test yes = "$droppeddeps"; then - if test yes = "$module"; then + if test "$droppeddeps" = yes; then + if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" @@ -9553,12 +7963,12 @@ EOF if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." - echo "*** 'nm' from GNU binutils and a full rebuild may help." + echo "*** \`nm' from GNU binutils and a full rebuild may help." fi - if test no = "$build_old_libs"; then - oldlibs=$output_objdir/$libname.$libext + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else @@ -9569,14 +7979,14 @@ EOF echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." - if test no = "$allow_undefined"; then + if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." - if test no = "$build_old_libs"; then - oldlibs=$output_objdir/$libname.$libext + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else @@ -9622,7 +8032,7 @@ EOF *) func_append new_libs " $deplib" ;; esac done - deplibs=$new_libs + deplibs="$new_libs" # All the library-specific variables (install_libdir is set above). library_names= @@ -9630,25 +8040,25 @@ EOF dlname= # Test again, we may have decided not to build it any more - if test yes = "$build_libtool_libs"; then - # Remove $wl instances when linking with ld. + if test "$build_libtool_libs" = yes; then + # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac - if test yes = "$hardcode_into_libs"; then + if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= - rpath=$finalize_rpath - test relink = "$opt_mode" || rpath=$compile_rpath$rpath + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then - hardcode_libdirs=$libdir + hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -9673,7 +8083,7 @@ EOF # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir=$hardcode_libdirs + libdir="$hardcode_libdirs" eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then @@ -9687,8 +8097,8 @@ EOF test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi - shlibpath=$finalize_shlibpath - test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi @@ -9698,19 +8108,19 @@ EOF eval library_names=\"$library_names_spec\" set dummy $library_names shift - realname=$1 + realname="$1" shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else - soname=$realname + soname="$realname" fi if test -z "$dlname"; then dlname=$soname fi - lib=$output_objdir/$realname + lib="$output_objdir/$realname" linknames= for link do @@ -9724,7 +8134,7 @@ EOF delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols=$output_objdir/$libname.uexp + export_symbols="$output_objdir/$libname.uexp" func_append delfiles " $export_symbols" fi @@ -9733,31 +8143,31 @@ EOF cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile - func_dll_def_p "$export_symbols" || { + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. - orig_export_symbols=$export_symbols + orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes - } + fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then - if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for '$libname.la'" - export_symbols=$output_objdir/$libname.exp + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds - save_ifs=$IFS; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd1 in $cmds; do - IFS=$save_ifs + IFS="$save_ifs" # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in @@ -9771,7 +8181,7 @@ EOF try_normal_branch=no ;; esac - if test yes = "$try_normal_branch" \ + if test "$try_normal_branch" = yes \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then @@ -9782,7 +8192,7 @@ EOF output_la=$func_basename_result save_libobjs=$libobjs save_output=$output - output=$output_objdir/$output_la.nm + output=${output_objdir}/${output_la}.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" @@ -9805,8 +8215,8 @@ EOF break fi done - IFS=$save_ifs - if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi @@ -9814,16 +8224,16 @@ EOF fi if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols=$export_symbols - test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi - if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands, which not all seds can handle. GNU sed should be fine + # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. @@ -9842,11 +8252,11 @@ EOF ;; esac done - deplibs=$tmp_deplibs + deplibs="$tmp_deplibs" if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && - test yes = "$compiler_needs_object" && + test "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. @@ -9857,7 +8267,7 @@ EOF eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else - gentop=$output_objdir/${outputname}x + gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $convenience @@ -9866,18 +8276,18 @@ EOF fi fi - if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking - if test relink = "$opt_mode"; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. - if test yes = "$module" && test -n "$module_cmds"; then + if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds @@ -9895,7 +8305,7 @@ EOF fi fi - if test : != "$skipped_export" && + if test "X$skipped_export" != "X:" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then @@ -9928,8 +8338,8 @@ EOF last_robj= k=1 - if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then - output=$output_objdir/$output_la.lnkscript + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs @@ -9941,14 +8351,14 @@ EOF func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then - output=$output_objdir/$output_la.lnk + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= - if test yes = "$compiler_needs_object"; then + if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi @@ -9963,7 +8373,7 @@ EOF else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-$k.$objext + output=$output_objdir/$output_la-${k}.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result @@ -9975,13 +8385,13 @@ EOF func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result - if test -z "$objlist" || + if test "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. - if test 1 -eq "$k"; then + if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" @@ -9991,10 +8401,10 @@ EOF reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi - last_robj=$output_objdir/$output_la-$k.$objext + last_robj=$output_objdir/$output_la-${k}.$objext func_arith $k + 1 k=$func_arith_result - output=$output_objdir/$output_la-$k.$objext + output=$output_objdir/$output_la-${k}.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result @@ -10006,9 +8416,9 @@ EOF # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds$reload_cmds\" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" fi func_append delfiles " $output" @@ -10016,9 +8426,9 @@ EOF output= fi - ${skipped_export-false} && { - func_verbose "generating symbol list for '$libname.la'" - export_symbols=$output_objdir/$libname.exp + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. @@ -10027,16 +8437,16 @@ EOF if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi - } + fi test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. - save_ifs=$IFS; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $concat_cmds; do - IFS=$save_ifs - $opt_quiet || { + IFS="$save_ifs" + $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -10044,7 +8454,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test relink = "$opt_mode"; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -10053,7 +8463,7 @@ EOF exit $lt_exit } done - IFS=$save_ifs + IFS="$save_ifs" if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' @@ -10061,18 +8471,18 @@ EOF fi fi - ${skipped_export-false} && { + if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols=$export_symbols - test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands, which not all seds can handle. GNU sed should be fine + # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. @@ -10081,7 +8491,7 @@ EOF export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi - } + fi libobjs=$output # Restore the value of output. @@ -10095,7 +8505,7 @@ EOF # value of $libobjs for piecewise linking. # Do each of the archive commands. - if test yes = "$module" && test -n "$module_cmds"; then + if test "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else @@ -10117,7 +8527,7 @@ EOF # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then - gentop=$output_objdir/${outputname}x + gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles @@ -10125,12 +8535,11 @@ EOF test "X$libobjs" = "X " && libobjs= fi - save_ifs=$IFS; IFS='~' + save_ifs="$IFS"; IFS='~' for cmd in $cmds; do - IFS=$sp$nl + IFS="$save_ifs" eval cmd=\"$cmd\" - IFS=$save_ifs - $opt_quiet || { + $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } @@ -10138,7 +8547,7 @@ EOF lt_exit=$? # Restore the uninstalled library and exit - if test relink = "$opt_mode"; then + if test "$opt_mode" = relink; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) @@ -10147,10 +8556,10 @@ EOF exit $lt_exit } done - IFS=$save_ifs + IFS="$save_ifs" # Restore the uninstalled library and exit - if test relink = "$opt_mode"; then + if test "$opt_mode" = relink; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then @@ -10170,39 +8579,39 @@ EOF done # If -module or -export-dynamic was specified, set the dlname. - if test yes = "$module" || test yes = "$export_dynamic"; then + if test "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. - dlname=$soname + dlname="$soname" fi fi ;; obj) - if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then - func_warning "'-dlopen' is ignored for objects" + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) - func_warning "'-l' and '-L' are ignored for objects" ;; + func_warning "\`-l' and \`-L' are ignored for objects" ;; esac test -n "$rpath" && \ - func_warning "'-rpath' is ignored for objects" + func_warning "\`-rpath' is ignored for objects" test -n "$xrpath" && \ - func_warning "'-R' is ignored for objects" + func_warning "\`-R' is ignored for objects" test -n "$vinfo" && \ - func_warning "'-version-info' is ignored for objects" + func_warning "\`-version-info' is ignored for objects" test -n "$release" && \ - func_warning "'-release' is ignored for objects" + func_warning "\`-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object '$output' from non-libtool objects" + func_fatal_error "cannot build library object \`$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" @@ -10210,7 +8619,7 @@ EOF ;; *) libobj= - obj=$output + obj="$output" ;; esac @@ -10223,19 +8632,17 @@ EOF # the extraction. reload_conv_objs= gentop= - # if reload_cmds runs $LD directly, get rid of -Wl from - # whole_archive_flag_spec and hope we can get by with turning comma - # into space. - case $reload_cmds in - *\$LD[\ \$]*) wl= ;; - esac + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` else - gentop=$output_objdir/${obj}x + gentop="$output_objdir/${obj}x" func_append generated " $gentop" func_extract_archives $gentop $convenience @@ -10244,12 +8651,12 @@ EOF fi # If we're not building shared, we need to use non_pic_objs - test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" # Create the old-style object. - reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - output=$obj + output="$obj" func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. @@ -10261,7 +8668,7 @@ EOF exit $EXIT_SUCCESS fi - test yes = "$build_libtool_libs" || { + if test "$build_libtool_libs" != yes; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi @@ -10271,12 +8678,12 @@ EOF # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS - } + fi - if test -n "$pic_flag" || test default != "$pic_mode"; then + if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" - output=$libobj + output="$libobj" func_execute_cmds "$reload_cmds" 'exit $?' fi @@ -10293,14 +8700,16 @@ EOF output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ - func_warning "'-version-info' is ignored for programs" + func_warning "\`-version-info' is ignored for programs" test -n "$release" && \ - func_warning "'-release' is ignored for programs" + func_warning "\`-release' is ignored for programs" - $preload \ - && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ - && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) @@ -10314,11 +8723,11 @@ EOF *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). - if test CXX = "$tagname"; then + if test "$tagname" = CXX ; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) - func_append compile_command " $wl-bind_at_load" - func_append finalize_command " $wl-bind_at_load" + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" ;; esac fi @@ -10354,7 +8763,7 @@ EOF *) func_append new_libs " $deplib" ;; esac done - compile_deplibs=$new_libs + compile_deplibs="$new_libs" func_append compile_command " $compile_deplibs" @@ -10378,7 +8787,7 @@ EOF if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then - hardcode_libdirs=$libdir + hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -10401,7 +8810,7 @@ EOF fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; @@ -10418,10 +8827,10 @@ EOF # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir=$hardcode_libdirs + libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi - compile_rpath=$rpath + compile_rpath="$rpath" rpath= hardcode_libdirs= @@ -10429,7 +8838,7 @@ EOF if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then - hardcode_libdirs=$libdir + hardcode_libdirs="$libdir" else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in @@ -10454,43 +8863,45 @@ EOF # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then - libdir=$hardcode_libdirs + libdir="$hardcode_libdirs" eval rpath=\" $hardcode_libdir_flag_spec\" fi - finalize_rpath=$rpath + finalize_rpath="$rpath" - if test -n "$libobjs" && test yes = "$build_old_libs"; then + if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi - func_generate_dlsyms "$outputname" "@PROGRAM@" false + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi - wrappers_required=: + wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=false + wrappers_required=no ;; *cygwin* | *mingw* ) - test yes = "$build_libtool_libs" || wrappers_required=false + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi ;; *) - if test no = "$need_relink" || test yes != "$build_libtool_libs"; then - wrappers_required=false + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no fi ;; esac - $wrappers_required || { + if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command=$compile_command$compile_rpath + link_command="$compile_command$compile_rpath" # We have no uninstalled library dependencies, so finalize right now. exit_status=0 @@ -10503,12 +8914,12 @@ EOF fi # Delete the generated files. - if test -f "$output_objdir/${outputname}S.$objext"; then - func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' fi exit $exit_status - } + fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" @@ -10538,9 +8949,9 @@ EOF fi fi - if test yes = "$no_install"; then + if test "$no_install" = yes; then # We don't need to create a wrapper script. - link_command=$compile_var$compile_command$compile_rpath + link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. @@ -10557,28 +8968,27 @@ EOF exit $EXIT_SUCCESS fi - case $hardcode_action,$fast_install in - relink,*) - # Fast installation is not supported - link_command=$compile_var$compile_command$compile_rpath - relink_command=$finalize_var$finalize_command$finalize_rpath + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" - func_warning "this platform does not like uninstalled shared libraries" - func_warning "'$output' will be relinked during installation" - ;; - *,yes) - link_command=$finalize_var$compile_command$finalize_rpath - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - ;; - *,no) - link_command=$compile_var$compile_command$compile_rpath - relink_command=$finalize_var$finalize_command$finalize_rpath - ;; - *,needless) - link_command=$finalize_var$compile_command$finalize_rpath - relink_command= - ;; - esac + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` @@ -10635,8 +9045,8 @@ EOF func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result - cwrappersource=$output_path/$objdir/lt-$output_name.c - cwrapper=$output_path/$output_name.exe + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 @@ -10657,7 +9067,7 @@ EOF trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host"; then + if test "x$build" = "x$host" ; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result @@ -10680,27 +9090,25 @@ EOF # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do - case $build_libtool_libs in - convenience) - oldobjs="$libobjs_save $symfileobj" - addlibs=$convenience + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" build_libtool_libs=no - ;; - module) - oldobjs=$libobjs_save - addlibs=$old_convenience - build_libtool_libs=no - ;; - *) + else oldobjs="$old_deplibs $non_pic_objects" - $preload && test -f "$symfileobj" \ - && func_append oldobjs " $symfileobj" - addlibs=$old_convenience - ;; - esac + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi if test -n "$addlibs"; then - gentop=$output_objdir/${outputname}x + gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $addlibs @@ -10708,13 +9116,13 @@ EOF fi # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then - gentop=$output_objdir/${outputname}x + gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_extract_archives $gentop $dlprefiles @@ -10735,7 +9143,7 @@ EOF : else echo "copying selected object files to avoid basename conflicts..." - gentop=$output_objdir/${outputname}x + gentop="$output_objdir/${outputname}x" func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs @@ -10744,7 +9152,7 @@ EOF for obj in $save_oldobjs do func_basename "$obj" - objbase=$func_basename_result + objbase="$func_basename_result" case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) @@ -10813,18 +9221,18 @@ EOF else # the above command should be used before it gets too long oldobjs=$objlist - if test "$obj" = "$last_oldobj"; then + if test "$obj" = "$last_oldobj" ; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist - if test -z "$oldobjs"; then + if test "X$oldobjs" = "X" ; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" @@ -10841,7 +9249,7 @@ EOF case $output in *.la) old_library= - test yes = "$build_old_libs" && old_library=$libname.$libext + test "$build_old_libs" = yes && old_library="$libname.$libext" func_verbose "creating $output" # Preserve any variables that may affect compiler behavior @@ -10856,31 +9264,31 @@ EOF fi done # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test yes = "$hardcode_automatic"; then + if test "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do - if test yes = "$installed"; then + if test "$installed" = yes; then if test -z "$install_libdir"; then break fi - output=$output_objdir/${outputname}i + output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" - name=$func_basename_result + name="$func_basename_result" func_resolve_sysroot "$deplib" - eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ - func_fatal_error "'$deplib' is not a valid libtool archive" + func_fatal_error "\`$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) @@ -10896,23 +9304,23 @@ EOF *) func_append newdependency_libs " $deplib" ;; esac done - dependency_libs=$newdependency_libs + dependency_libs="$newdependency_libs" newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" - name=$func_basename_result - eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ - func_fatal_error "'$lib' is not a valid libtool archive" + func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done - dlfiles=$newdlfiles + dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in @@ -10922,34 +9330,34 @@ EOF # didn't already link the preopened objects directly into # the library: func_basename "$lib" - name=$func_basename_result - eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ - func_fatal_error "'$lib' is not a valid libtool archive" + func_fatal_error "\`$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done - dlprefiles=$newdlprefiles + dlprefiles="$newdlprefiles" else newdlfiles= for lib in $dlfiles; do case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done - dlfiles=$newdlfiles + dlfiles="$newdlfiles" newdlprefiles= for lib in $dlprefiles; do case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done - dlprefiles=$newdlprefiles + dlprefiles="$newdlprefiles" fi $RM $output # place dlname in correct position for cygwin @@ -10965,9 +9373,10 @@ EOF case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. - if test -n "$bindir"; then + if test "x$bindir" != x ; + then func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result/$dlname + tdlname=$func_relative_path_result$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname @@ -10976,7 +9385,7 @@ EOF esac $ECHO > $output "\ # $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. @@ -10990,7 +9399,7 @@ library_names='$library_names' # The name of the static archive. old_library='$old_library' -# Linker flags that cannot go in dependency_libs. +# Linker flags that can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. @@ -11016,7 +9425,7 @@ dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" - if test no,yes = "$installed,$need_relink"; then + if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi @@ -11031,29 +9440,27 @@ relink_command=\"$relink_command\"" exit $EXIT_SUCCESS } -if test link = "$opt_mode" || test relink = "$opt_mode"; then - func_mode_link ${1+"$@"} -fi +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { - $debug_cmd - - RM=$nonopt + $opt_debug + RM="$nonopt" files= - rmforce=false + rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. - libtool_install_magic=$magic + libtool_install_magic="$magic" for arg do case $arg in - -f) func_append RM " $arg"; rmforce=: ;; + -f) func_append RM " $arg"; rmforce=yes ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac @@ -11066,18 +9473,18 @@ func_mode_uninstall () for file in $files; do func_dirname "$file" "" "." - dir=$func_dirname_result - if test . = "$dir"; then - odir=$objdir + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" else - odir=$dir/$objdir + odir="$dir/$objdir" fi func_basename "$file" - name=$func_basename_result - test uninstall = "$opt_mode" && odir=$dir + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates - if test clean = "$opt_mode"; then + if test "$opt_mode" = clean; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; @@ -11092,11 +9499,11 @@ func_mode_uninstall () elif test -d "$file"; then exit_status=1 continue - elif $rmforce; then + elif test "$rmforce" = yes; then continue fi - rmfiles=$file + rmfiles="$file" case $name in *.la) @@ -11110,7 +9517,7 @@ func_mode_uninstall () done test -n "$old_library" && func_append rmfiles " $odir/$old_library" - case $opt_mode in + case "$opt_mode" in clean) case " $library_names " in *" $dlname "*) ;; @@ -11121,12 +9528,12 @@ func_mode_uninstall () uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; @@ -11142,19 +9549,21 @@ func_mode_uninstall () func_source $dir/$name # Add PIC object to the list of files to remove. - if test -n "$pic_object" && test none != "$pic_object"; then + if test -n "$pic_object" && + test "$pic_object" != none; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && test none != "$non_pic_object"; then + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) - if test clean = "$opt_mode"; then + if test "$opt_mode" = clean ; then noexename=$name case $file in *.exe) @@ -11181,12 +9590,12 @@ func_mode_uninstall () # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.$objext" - if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi - if test "X$noexename" != "X$name"; then - func_append rmfiles " $odir/lt-$noexename.c" + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" fi fi fi @@ -11195,7 +9604,7 @@ func_mode_uninstall () func_show_eval "$RM $rmfiles" 'exit_status=1' done - # Try to remove the $objdir's in the directories where we deleted files + # Try to remove the ${objdir}s in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" @@ -11205,17 +9614,16 @@ func_mode_uninstall () exit $exit_status } -if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then - func_mode_uninstall ${1+"$@"} -fi +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} test -z "$opt_mode" && { - help=$generic_help + help="$generic_help" func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode '$opt_mode'" + func_fatal_help "invalid operation mode \`$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" @@ -11226,7 +9634,7 @@ exit $exit_status # The TAGs below are defined such that we never get into a situation -# where we disable both kinds of libraries. Given conflicting +# in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support @@ -11249,3 +9657,5 @@ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # mode:shell-script # sh-indentation:2 # End: +# vi:sw=2 + diff --git a/m4/ax_c___attribute__.m4 b/m4/ax_c___attribute__.m4 deleted file mode 100644 index 0e952e7..0000000 --- a/m4/ax_c___attribute__.m4 +++ /dev/null @@ -1,134 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_c___attribute__.html -# -# Downloaded into the Network UPS Tools (NUT) codebase from -# http://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_c___attribute__.m4 -# as of 2020-11-20 and adapted for attribute supports we needed -# =========================================================================== -# -# SYNOPSIS -# -# AX_C___ATTRIBUTE__ -# -# DESCRIPTION -# -# Provides a test for the compiler support of __attribute__ extensions. -# Defines HAVE___ATTRIBUTE__ if it is found. -# Also in particular defines -# HAVE___ATTRIBUTE__UNUSED_ARG -# HAVE___ATTRIBUTE__UNUSED_FUNC -# HAVE___ATTRIBUTE__NORETURN -# if support for respective values and use-cases of interest for NUT -# codebase is found. -# -# LICENSE -# -# Copyright (c) 2008 Stepan Kasal -# Copyright (c) 2008 Christian Haggstrom -# Copyright (c) 2008 Ryan McCabe -# Copyright (c) 2020 Jim Klimov -# -# This program is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by the -# Free Software Foundation; either version 2 of the License, or (at your -# option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Archive. When you make and distribute a -# modified version of the Autoconf Macro, you may extend this special -# exception to the GPL to apply to your modified version as well. - -#serial 9 - -AC_DEFUN([AX_C___ATTRIBUTE__], [ - AC_LANG_PUSH([C]) - AC_CACHE_CHECK([for __attribute__((unused)) for function arguments], [ax_cv___attribute__unused_arg], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - static void foo( int); - static void - foo(__attribute__ ((unused)) int i) { - return; - } - ]], [func(1);])], - [ax_cv___attribute__unused_arg=yes], - [ax_cv___attribute__unused_arg=no] - ) - ]) - - AC_CACHE_CHECK([for __attribute__((unused)) for functions], [ax_cv___attribute__unused_func], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - static void foo(void) __attribute__ ((unused)); - static void - foo(void) { - return; - } - ]], [])], - [ax_cv___attribute__unused_func=yes], - [ax_cv___attribute__unused_func=no] - ) - ]) - - AC_CACHE_CHECK([for __attribute__((noreturn))], [ax_cv___attribute__noreturn], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[#include - static void foo(void) __attribute__ ((noreturn)); - static void - foo(void) { - exit(1); - } - ]], [foo();])], - [ax_cv___attribute__noreturn=yes], - [ax_cv___attribute__noreturn=no] - ) - ]) - AC_LANG_POP([C]) - - AC_CACHE_CHECK([for at least some __attribute__ support], [ax_cv___attribute__], - [if test "$ax_cv___attribute__unused_arg" = "yes" \ - || test "$ax_cv___attribute__unused_func" = "yes" \ - || test "$ax_cv___attribute__noreturn" = "yes" \ - ; then - dnl # Some values did not error, support for keyword itself exists - ax_cv___attribute__=yes - else - dnl # At least none of the options we are interested in work... - ax_cv___attribute__=no - fi - ]) - - if test "$ax_cv___attribute__unused_arg" = "yes"; then - AC_DEFINE([HAVE___ATTRIBUTE__UNUSED_ARG], 1, [define if your compiler has __attribute__((unused)) for function arguments]) - fi - - if test "$ax_cv___attribute__unused_func" = "yes"; then - AC_DEFINE([HAVE___ATTRIBUTE__UNUSED_FUNC], 1, [define if your compiler has __attribute__((unused)) for functions]) - fi - if test "$ax_cv___attribute__noreturn" = "yes"; then - AC_DEFINE([HAVE___ATTRIBUTE__NORETURN], 1, [define if your compiler has __attribute__((noreturn))]) - fi - - if test "$ax_cv___attribute__" = "yes"; then - AC_DEFINE([HAVE___ATTRIBUTE__], 1, [define if your compiler has __attribute__]) - fi -]) diff --git a/m4/ax_c_pragmas.m4 b/m4/ax_c_pragmas.m4 deleted file mode 100644 index 53c1aeb..0000000 --- a/m4/ax_c_pragmas.m4 +++ /dev/null @@ -1,983 +0,0 @@ -dnl Check for current compiler support of specific pragmas we use, -dnl e.g. diagnostics management to keep warnings quiet sometimes - -AC_DEFUN([AX_C_PRAGMAS], [ -if test -z "${nut_have_ax_c_pragmas_seen}"; then - nut_have_ax_c_pragmas_seen="yes" - - CFLAGS_SAVED="${CFLAGS}" - CXXFLAGS_SAVED="${CXXFLAGS}" - - dnl ### To be sure, bolt the language - AC_LANG_PUSH([C]) - - dnl # This is expected to fail builds with unknown pragma names on GCC or CLANG at least - AS_IF([test "${CLANG}" = "yes"], - [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option" - CXXFLAGS="${CXXFLAGS_SAVED} -Werror=pragmas -Werror=unknown-pragmas -Werror=unknown-warning-option"], - [AS_IF([test "${GCC}" = "yes"], -dnl ### Despite the docs, this dies with lack of (apparently) support for -dnl ### -Wunknown-warning(-options) on all GCC versions I tried (v5-v10) -dnl ### [CFLAGS="${CFLAGS_SAVED} -Werror=pragmas -Werror=unknown-warning"], - [CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror"], - [CFLAGS="${CFLAGS_SAVED} -Wall -Wextra -Werror" - CXXFLAGS="${CXXFLAGS_SAVED} -Wall -Wextra -Werror"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic push and pop (outside functions)], - [ax_cv__pragma__gcc__diags_push_pop_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#pragma GCC diagnostic push -#pragma GCC diagnostic pop - ]], [])], - [ax_cv__pragma__gcc__diags_push_pop_besidefunc=yes], - [ax_cv__pragma__gcc__diags_push_pop_besidefunc=no] - )] - ) - - AC_CACHE_CHECK([for pragma clang diagnostic push and pop (outside functions)], - [ax_cv__pragma__clang__diags_push_pop_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop - ]], [])], - [ax_cv__pragma__clang__diags_push_pop_besidefunc=yes], - [ax_cv__pragma__clang__diags_push_pop_besidefunc=no] - )] - ) - - dnl # Currently our code uses these pragmas as close to lines that cause - dnl # questions from linters as possible. GCC before 4.5 did not allow - dnl # for diag pragmas inside function bodies, but also did not complain - dnl # about messy code as new compilers do. For completeness, we support - dnl # the possibility of defining larger-scoped pragmas around whole - dnl # function bodies. In practice, we don't currently do that so in - dnl # most cases the shorter names (without _INSIDEFUNC) are used with - dnl # that implied meaning. - - AC_CACHE_CHECK([for pragma GCC diagnostic push and pop (inside functions)], - [ax_cv__pragma__gcc__diags_push_pop_insidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic push -#pragma GCC diagnostic pop -} - ]], [])], - [ax_cv__pragma__gcc__diags_push_pop_insidefunc=yes], - [ax_cv__pragma__gcc__diags_push_pop_insidefunc=no] - )] - ) - - AC_CACHE_CHECK([for pragma clang diagnostic push and pop (inside functions)], - [ax_cv__pragma__clang__diags_push_pop_insidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#ifdef __clang__ -#endif -#pragma clang diagnostic push -#pragma clang diagnostic pop -} - ]], [])], - [ax_cv__pragma__clang__diags_push_pop_insidefunc=yes], - [ax_cv__pragma__clang__diags_push_pop_insidefunc=no] - )] - ) - - AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_INSIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic push and pop inside function bodies]) - ]) - - AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic push and pop outside function bodies]) - ]) - - AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP], 1, [define if your compiler has #pragma GCC diagnostic push and pop]) - ]) - - AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_INSIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic push and pop inside function bodies]) - ]) - - AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP_BESIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic push and pop outside function bodies]) - ]) - - AS_IF([test "$ax_cv__pragma__clang__diags_push_pop_besidefunc" = "yes" && test "$ax_cv__pragma__clang__diags_push_pop_insidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_PUSH_POP], 1, [define if your compiler has #pragma clang diagnostic push and pop]) - ]) - - dnl Test for some clang-specific pragma support: primarily useful for older - dnl clang (3.x) releases, so polluting NUT codebase only when unavoidable. - dnl In most cases, GCC pragmas are usable by both; in a few others, direct - dnl use of `#ifdef __clang__` suffices. - AS_IF([test "${CLANG}" = "yes"], [ - AC_CACHE_CHECK([for pragma CLANG diagnostic ignored "-Wunreachable-code-return"], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma clang diagnostic ignored "-Wunreachable-code-return" -} - ]], [])], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return=yes], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return=no] - )] - ) - AS_IF([test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN], 1, [define if your compiler has #pragma clang diagnostic ignored "-Wunreachable-code-return"]) - ]) - - AC_CACHE_CHECK([for pragma CLANG diagnostic ignored "-Wunreachable-code-return" (outside functions)], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma clang diagnostic ignored "-Wunreachable-code-return"]], [])], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=yes], - [ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__clang__diags_ignored_unreachable_code_return_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_CLANG_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC], 1, [define if your compiler has #pragma clang diagnostic ignored "-Wunreachable-code-return" (outside functions)]) - ]) - ]) dnl Special pragma support testing for clang - - dnl Test common pragmas for GCC (and compatible) compilers - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunused-function"], - [ax_cv__pragma__gcc__diags_ignored_unused_function], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wunused-function" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_unused_function=yes], - [ax_cv__pragma__gcc__diags_ignored_unused_function=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unused_function" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNUSED_FUNCTION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunused-function"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-nonliteral"], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral=yes], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-nonliteral"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-nonliteral" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-nonliteral"]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-nonliteral" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-security"], - [ax_cv__pragma__gcc__diags_ignored_format_security], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wformat-security" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_security=yes], - [ax_cv__pragma__gcc__diags_ignored_format_security=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-security"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-security" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-security"]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-security" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-truncation"], - [ax_cv__pragma__gcc__diags_ignored_format_truncation], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wformat-truncation" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_truncation=yes], - [ax_cv__pragma__gcc__diags_ignored_format_truncation=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-truncation"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-truncation" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-truncation"]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-truncation" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstringop-truncation"], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wstringop-truncation" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation=yes], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstringop-truncation"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstringop-truncation" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wstringop-truncation"]], [])], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRINGOP_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstringop-truncation" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtype-limits"], - [ax_cv__pragma__gcc__diags_ignored_type_limits], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wtype-limits" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_type_limits=yes], - [ax_cv__pragma__gcc__diags_ignored_type_limits=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_type_limits" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtype-limits" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtype-limits"]], [])], - [ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_type_limits_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtype-limits" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Warray-bounds"], - [ax_cv__pragma__gcc__diags_ignored_array_bounds], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Warray-bounds" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_array_bounds=yes], - [ax_cv__pragma__gcc__diags_ignored_array_bounds=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_array_bounds" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Warray-bounds" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Warray-bounds"]], [])], - [ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_array_bounds_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ARRAY_BOUNDS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Warray-bounds" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-type-limit-compare"]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_type_limit_compare_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_TYPE_LIMIT_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-type-limit-compare" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare"]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_constant_out_of_range_compare_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare"]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_unsigned_zero_compare_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-unsigned-zero-compare" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-compare"], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wtautological-compare" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-compare"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wtautological-compare" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wtautological-compare"]], [])], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_tautological_compare_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wtautological-compare" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-compare"], - [ax_cv__pragma__gcc__diags_ignored_sign_compare], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wsign-compare" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_sign_compare=yes], - [ax_cv__pragma__gcc__diags_ignored_sign_compare=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_compare" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-compare" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wsign-compare"]], [])], - [ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_compare_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-compare" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-conversion"], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wsign-conversion" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion=yes], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-conversion"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wsign-conversion" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wsign-conversion"]], [])], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_sign_conversion_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wsign-conversion" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-break"], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-break" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-break"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-break" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code-break"]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BREAK_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-break" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-return"], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code-return" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-return"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code-return" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code-return"]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_return_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_RETURN_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code-return" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code"], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wunreachable-code" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wunreachable-code" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wunreachable-code"]], [])], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wunreachable-code" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-overflow"], - [ax_cv__pragma__gcc__diags_ignored_format_overflow], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wformat-overflow" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_overflow=yes], - [ax_cv__pragma__gcc__diags_ignored_format_overflow=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_overflow" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-overflow"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wformat-overflow" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wformat-overflow"]], [])], - [ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_overflow_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wformat-overflow" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcovered-switch-default"], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wcovered-switch-default" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default=yes], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcovered-switch-default"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcovered-switch-default" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wcovered-switch-default"]], [])], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_covered_switch_default_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcovered-switch-default" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wextra-semi-stmt"], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wextra-semi-stmt" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=yes], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wextra-semi-stmt"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wextra-semi-stmt" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wextra-semi-stmt"]], [])], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_extra_semi_stmt_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXTRA_SEMI_STMT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wextra-semi-stmt" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-align"], - [ax_cv__pragma__gcc__diags_ignored_cast_align], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wcast-align" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_cast_align=yes], - [ax_cv__pragma__gcc__diags_ignored_cast_align=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_align" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wcast-align" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wcast-align"]], [])], - [ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cast_align_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wcast-align" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstrict-prototypes"], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wstrict-prototypes" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes=yes], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstrict-prototypes"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wstrict-prototypes" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wstrict-prototypes"]], [])], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_strict_prototypes_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wstrict-prototypes" (outside functions)]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wassign-enum"], - [ax_cv__pragma__gcc__diags_ignored_assign_enum], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wassign-enum" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_assign_enum=yes], - [ax_cv__pragma__gcc__diags_ignored_assign_enum=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_assign_enum" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum"]) - ]) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-Wassign-enum" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wassign-enum"]], [])], - [ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_assign_enum_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wassign-enum" (outside functions)]) - ]) - - AC_LANG_POP([C]) - - dnl ### Series of tests for C++ specific pragmas - AC_LANG_PUSH([C++]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=yes], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wc++98-compat-pedantic"]], [])], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_PEDANTIC_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat-pedantic" (outside functions)]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat"], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wc++98-compat" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat=yes], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat"]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wc++98-compat" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wc++98-compat"]], [])], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wc++98-compat" (outside functions)]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wglobal-constructors"], - [ax_cv__pragma__gcc__diags_ignored_global_constructors], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wglobal-constructors" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_global_constructors=yes], - [ax_cv__pragma__gcc__diags_ignored_global_constructors=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_global_constructors" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wglobal-constructors"]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wglobal-constructors" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wglobal-constructors"]], [])], - [ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_global_constructors_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wglobal-constructors" (outside functions)]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wexit-time-destructors"], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-Wexit-time-destructors" -} -]], [])], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=yes], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wexit-time-destructors"]) - ]) - - AC_CACHE_CHECK([for C++ pragma GCC diagnostic ignored "-Wexit-time-destructors" (outside functions)], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-Wexit-time-destructors"]], [])], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=yes], - [ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc=no] - )] - ) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_exit_time_destructors_besidefunc" = "yes"],[ - AC_DEFINE([HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS_BESIDEFUNC], 1, [define if your compiler has #pragma GCC diagnostic ignored "-Wexit-time-destructors" (outside functions)]) - ]) - - AC_LANG_POP([C++]) - - dnl # Meta-macros for simpler use-cases where we pick - dnl # equivalent-effect macros for different compiler versions - AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_insidefunc" = "yes"],[ - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop support]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wunreachable-code(-break)" and for push-pop support]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wc++98-compat(-pedantic)" and for push-pop support]) - ]) - ]) - - AS_IF([test "$ax_cv__pragma__gcc__diags_push_pop_besidefunc" = "yes"],[ - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_security" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_format_nonliteral" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-nonliteral" or "-Wformat-security" and for push-pop support (outside function bodies)]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_format_truncation" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_stringop_truncation" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_TRUNCATION_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wformat-truncation" or "-Werror=stringop-truncation" and for push-pop support (outside function bodies)]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_unreachable_code_break" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wunreachable-code(-break)" and for push-pop support (outside function bodies)]) - ]) - AS_IF([test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat_pedantic" = "yes" || test "$ax_cv__pragma__gcc__diags_ignored_cxx98_compat" = "yes" ],[ - AC_DEFINE([HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_CXX98_COMPAT_BESIDEFUNC], 1, [define if your compiler has pragmas for GCC diagnostic ignored "-Wc++98-compat(-pedantic)" and for push-pop support (outside function bodies)]) - ]) - ]) - - dnl ### Sanity check if the CLI options actually work: - AC_CACHE_CHECK([for pragma BOGUSforTest], - [ax_cv__pragma__bogus], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma BOGUSforTest -} -]], [])], - [ax_cv__pragma__bogus=yes], - [ax_cv__pragma__bogus=no] - )] - ) - - AC_CACHE_CHECK([for pragma BOGUSforTest (outside functions)], - [ax_cv__pragma__bogus_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma BOGUSforTest]], [])], - [ax_cv__pragma__bogus_besidefunc=yes], - [ax_cv__pragma__bogus_besidefunc=no] - )] - ) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-WBOGUSforTest"], - [ax_cv__pragma__bogus_diag], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[void func(void) { -#pragma GCC diagnostic ignored "-WBOGUSforTest" -} -]], [])], - [ax_cv__pragma__bogus_diag=yes], - [ax_cv__pragma__bogus_diag=no] - )] - ) - - AC_CACHE_CHECK([for pragma GCC diagnostic ignored "-WBOGUSforTest" (outside functions)], - [ax_cv__pragma__bogus_diag_besidefunc], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#pragma GCC diagnostic ignored "-WBOGUSforTest"]], [])], - [ax_cv__pragma__bogus_diag_besidefunc=yes], - [ax_cv__pragma__bogus_diag_besidefunc=no] - )] - ) - - AS_IF([test "${ax_cv__pragma__bogus}" != "no"], - [AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus=$ax_cv__pragma__bogus (not 'no')])]) - - AS_IF([test "${ax_cv__pragma__bogus_besidefunc}" != "no"], - [AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_besidefunc=$ax_cv__pragma__bogus_besidefunc (not 'no')])]) - - AS_IF([test "${ax_cv__pragma__bogus_diag}" != "no"], - [AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag=$ax_cv__pragma__bogus_diag (not 'no')])]) - - AS_IF([test "${ax_cv__pragma__bogus_diag_besidefunc}" != "no"], - [AC_MSG_WARN([A bogus test that was expected to fail did not! ax_cv__pragma__bogus_diag_besidefunc=$ax_cv__pragma__bogus_diag_besidefunc (not 'no')])]) - - CFLAGS="${CFLAGS_SAVED}" - CXXFLAGS="${CXXFLAGS_SAVED}" -fi -]) - -AC_DEFUN([AX_C_PRINTF_STRING_NULL], [ -if test -z "${nut_have_ax_c_printf_string_null_seen}"; then - nut_have_ax_c_printf_string_null_seen="yes" - AC_REQUIRE([AX_RUN_OR_LINK_IFELSE])dnl - - dnl ### To be sure, bolt the language - AC_LANG_PUSH([C]) - - AC_CACHE_CHECK([for practical support to pritnf("%s", NULL)], - [ax_cv__printf_string_null], - [AX_RUN_OR_LINK_IFELSE( - [AC_LANG_PROGRAM([dnl -#include -#include -], [dnl -char buf[128]; -char *s = NULL; -int res = snprintf(buf, sizeof(buf), "%s", s); -buf[sizeof(buf)-1] = '\0'; -if (res < 0) { - printf(stderr, "FAILED to snprintf() a NULL string argument"); - exit 1; -} -if (buf[0] == '\0') - printf(stderr, "RETURNED empty string from snprintf() with a NULL string argument"); - exit 0; -} -if (strcasestr(buf, 'null') == NULL) - printf(stderr, "RETURNED some string from snprintf() with a NULL string argument: '%s'", buf); - exit 0; -} -printf(stderr, "SUCCESS: RETURNED a string that contains something like 'null' from snprintf() with a NULL string argument: '%s'", buf); -exit 0; - ])], - [ax_cv__printf_string_null=yes], - [ax_cv__printf_string_null=no] - )] - ) - - AS_IF([test "$ax_cv__printf_string_null" = "yes"],[ - AC_DEFINE([HAVE_PRINTF_STRING_NULL], 1, [define if your libc can printf("%s", NULL) sanely]) - ]) - - AC_LANG_POP([C]) -fi -]) diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 deleted file mode 100644 index a72fc05..0000000 --- a/m4/ax_check_compile_flag.m4 +++ /dev/null @@ -1,61 +0,0 @@ -# =========================================================================== -# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html -# =========================================================================== -# -# SYNOPSIS -# -# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) -# -# DESCRIPTION -# -# Check whether the given FLAG works with the current language's compiler -# or gives an error. (Warnings, however, are ignored) -# -# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on -# success/failure. -# -# If EXTRA-FLAGS is defined, it is added to the current language's default -# flags (e.g. CFLAGS) when the check is done. The check is thus made with -# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to -# force the compiler to issue an error when a bad flag is given. -# -# INPUT gives an alternative input source to AC_COMPILE_IFELSE. -# -# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this -# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. -# -# NOTE: This implementation was extended with check for compiler complaints -# -# LICENSE -# -# Copyright (c) 2008 Guido U. Draheim -# Copyright (c) 2011 Maarten Bosmans -# Copyright (c) 2022 Jim Klimov -# -# Copying and distribution of this file, with or without modification, are -# permitted in any medium without royalty provided the copyright notice -# and this notice are preserved. This file is offered as-is, without any -# warranty. - -#serial 6 - -AC_DEFUN([AX_CHECK_COMPILE_FLAG], -[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF -AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl -AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ - ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" - AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], - [dnl Toolkit per se did not return an error code; but did it complain? - dnl Below are a few strings typical for some versions of GCC and CLANG - dnl This relies on AC_COMPILE_IFELSE implementation retaining conftest.err - AS_IF([grep -E '(unrecognized.* option|did you mean|unknown argument:)' < conftest.err >/dev/null 2>/dev/null], - [AS_VAR_SET(CACHEVAR,[no])],dnl Hit a complaint, flag is not supported after all - [AS_VAR_SET(CACHEVAR,[yes])])], - [AS_VAR_SET(CACHEVAR,[no])]) - _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) -AS_VAR_IF(CACHEVAR,yes, - [m4_default([$2], :)], - [m4_default([$3], :)]) -AS_VAR_POPDEF([CACHEVAR])dnl -])dnl AX_CHECK_COMPILE_FLAGS diff --git a/m4/ax_compare_version.m4 b/m4/ax_compare_version.m4 old mode 100644 new mode 100755 diff --git a/m4/ax_run_or_link_ifelse.m4 b/m4/ax_run_or_link_ifelse.m4 deleted file mode 100644 index 0e36c7e..0000000 --- a/m4/ax_run_or_link_ifelse.m4 +++ /dev/null @@ -1,21 +0,0 @@ -dnl By default, AC_RUN_IFELSE() fails if it detects cross-compilation -dnl but it provides the fourth argument to customize the handling. -dnl In our case, we would fall back to trying just to link then - -dnl the result would not be as relevant regarding run-time behavior -dnl of the code, but at least we would know that API and ABI are ok. - -dnl Per original /usr/share/autoconf/autoconf/general.m4 which makes -dnl a similar wrapper: -dnl # AC_TRY_RUN(PROGRAM, -dnl # [ACTION-IF-TRUE], [ACTION-IF-FALSE], -dnl # [ACTION-IF-CROSS-COMPILING = RUNTIME-ERROR]) -dnl # ------------------------------------------------------- -AC_DEFUN([AX_RUN_OR_LINK_IFELSE], -[ - AC_RUN_IFELSE([$1], [$2], [$3], - [ - AC_MSG_WARN([Current build is a cross-build, so not running test binaries, just linking them]) - AC_LINK_IFELSE([$1], [$2], [$3]) - ] - ) -]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 index c4c0294..02b4bbe 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1,6 +1,8 @@ # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # -# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives @@ -8,30 +10,36 @@ # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl -# Copyright (C) 2014 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of of the License, or -# (at your option) any later version. +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 # -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program or library that is built -# using GNU Libtool, you may include this file under the same -# distribution terms that you use for the rest of that program. +# This file is part of GNU Libtool. # -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) -# serial 58 LT_INIT +# serial 57 LT_INIT # LT_PREREQ(VERSION) @@ -59,7 +67,7 @@ esac # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], -[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl @@ -83,7 +91,7 @@ dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed -LIBTOOL_DEPS=$ltmain +LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' @@ -103,43 +111,26 @@ dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) -# _LT_PREPARE_CC_BASENAME -# ----------------------- -m4_defun([_LT_PREPARE_CC_BASENAME], [ -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -func_cc_basename () -{ - for cc_temp in @S|@*""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac - done - func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -} -])# _LT_PREPARE_CC_BASENAME - - # _LT_CC_BASENAME(CC) # ------------------- -# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, -# but that macro is also expanded into generated libtool script, which -# arranges for $SED and $ECHO to be set by different means. +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], -[m4_require([_LT_PREPARE_CC_BASENAME])dnl -AC_REQUIRE([_LT_DECL_SED])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl -func_cc_basename $1 -cc_basename=$func_cc_basename_result +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set -# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} @@ -186,16 +177,15 @@ m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl -m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options that allow our +# See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}"; then +if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) -if test -n "${ZSH_VERSION+set}"; then +if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi @@ -208,7 +198,7 @@ aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. - if test set != "${COLLECT_NAMES+set}"; then + if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -219,14 +209,14 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, +# All known linkers require a `.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a -with_gnu_ld=$lt_cv_prog_gnu_ld +with_gnu_ld="$lt_cv_prog_gnu_ld" -old_CC=$CC -old_CFLAGS=$CFLAGS +old_CC="$CC" +old_CFLAGS="$CFLAGS" # Set sane defaults for various variables test -z "$CC" && CC=cc @@ -279,14 +269,14 @@ no_glob_subst='s/\*/\\\*/g' # _LT_PROG_LTMAIN # --------------- -# Note that this code is called both from 'configure', and 'config.status' +# Note that this code is called both from `configure', and `config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# `config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain=$ac_aux_dir/ltmain.sh +ltmain="$ac_aux_dir/ltmain.sh" ])# _LT_PROG_LTMAIN @@ -296,7 +286,7 @@ ltmain=$ac_aux_dir/ltmain.sh # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the 'libtool' +# in macros and then make a single call at the end using the `libtool' # label. @@ -431,8 +421,8 @@ m4_define([_lt_decl_all_varnames], # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ -# Quote a variable value, and forward it to 'config.status' so that its -# declaration there will have the same value as in 'configure'. VARNAME +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) @@ -456,7 +446,7 @@ m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags='_LT_TAGS'dnl +available_tags="_LT_TAGS"dnl ]) @@ -484,7 +474,7 @@ m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], @@ -510,8 +500,8 @@ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations -# into 'config.status', and then the shell code to quote escape them in -# for loops in 'config.status'. Finally, any additional code accumulated +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], @@ -557,7 +547,7 @@ for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -570,7 +560,7 @@ for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" @@ -586,7 +576,7 @@ _LT_OUTPUT_LIBTOOL_INIT # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the -# '#!' sequence but before initialization text begins. After this +# `#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). @@ -608,7 +598,7 @@ AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF -test 0 = "$lt_write_fail" && chmod +x $1[]dnl +test $lt_write_fail = 0 && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT @@ -631,7 +621,7 @@ exec AS_MESSAGE_LOG_FD>>config.log } >&AS_MESSAGE_LOG_FD lt_cl_help="\ -'$as_me' creates a local libtool stub from the current configuration, +\`$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. @@ -653,7 +643,7 @@ Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." -while test 0 != $[#] +while test $[#] != 0 do case $[1] in --version | --v* | -V ) @@ -666,10 +656,10 @@ do lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] -Try '$[0] --help' for more information.]) ;; +Try \`$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] -Try '$[0] --help' for more information.]) ;; +Try \`$[0] --help' for more information.]) ;; esac shift done @@ -695,7 +685,7 @@ chmod +x "$CONFIG_LT" # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: -test yes = "$silent" && +test "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false @@ -715,46 +705,32 @@ m4_defun([_LT_CONFIG], _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options that allow our + # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}"; then + if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi - cfgfile=${ofile}T + cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL -# Generated automatically by $as_me ($PACKAGE) $VERSION + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. - -# Provide generalized library-building support services. -# Written by Gordon Matzigkeit, 1996 - +# _LT_COPYING _LT_LIBTOOL_TAGS -# Configured defaults for sys_lib_dlsearch_path munging. -: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} - # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG -_LT_EOF - - cat <<'_LT_EOF' >> "$cfgfile" - -# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE - -_LT_PREPARE_MUNGE_PATH_LIST -_LT_PREPARE_CC_BASENAME - -# ### END FUNCTIONS SHARED WITH CONFIGURE - _LT_EOF case $host_os in @@ -763,7 +739,7 @@ _LT_EOF # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. -if test set != "${COLLECT_NAMES+set}"; then +if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi @@ -780,6 +756,8 @@ _LT_EOF sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) + _LT_PROG_REPLACE_SHELLFNS + mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" @@ -797,6 +775,7 @@ _LT_EOF [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS @@ -995,7 +974,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no - if test -z "$LT_MULTI_MODULE"; then + if test -z "${LT_MULTI_MODULE}"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the @@ -1013,7 +992,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. - elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + elif test -f libconftest.dylib && test $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -1031,7 +1010,7 @@ m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], @@ -1041,8 +1020,8 @@ int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF @@ -1053,7 +1032,7 @@ _LT_EOF _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD - elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD @@ -1063,32 +1042,32 @@ _LT_EOF ]) case $host_os in rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; darwin1.*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[912]]*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; - 10.[[012]][[,.]]*) - _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; - 10.*|11.*) - _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; esac ;; esac - if test yes = "$lt_cv_apple_cc_single_mod"; then + if test "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi - if test yes = "$lt_cv_ld_exported_symbols_list"; then - _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi - if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= @@ -1108,29 +1087,29 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test yes = "$lt_cv_ld_force_load"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" case $cc_basename in - ifort*|nagfor*) _lt_dar_can_shared=yes ;; + ifort*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac - if test yes = "$_lt_dar_can_shared"; then + if test "$_lt_dar_can_shared" = "yes"; then output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" m4_if([$1], [CXX], -[ if test yes != "$lt_cv_apple_cc_single_mod"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else @@ -1150,7 +1129,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES], # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl -if test set = "${lt_cv_aix_libpath+set}"; then +if test "${lt_cv_aix_libpath+set}" = set; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], @@ -1168,7 +1147,7 @@ else _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) @@ -1188,8 +1167,8 @@ m4_define([_LT_SHELL_INIT], # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script that will find a shell with a builtin -# printf (that we can use as an echo command). +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO @@ -1217,10 +1196,10 @@ fi # Invoke $ECHO with all args, space-separated. func_echo_all () { - $ECHO "$*" + $ECHO "$*" } -case $ECHO in +case "$ECHO" in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; @@ -1246,17 +1225,16 @@ _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], -[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], - [Search for dependent libraries within DIR (or the compiler's sysroot - if not specified).])], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= -case $with_sysroot in #( +case ${with_sysroot} in #( yes) - if test yes = "$GCC"; then + if test "$GCC" = yes; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( @@ -1266,14 +1244,14 @@ case $with_sysroot in #( no|'') ;; #( *) - AC_MSG_RESULT([$with_sysroot]) + AC_MSG_RESULT([${with_sysroot}]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and where our libraries should be installed.])]) +[dependent libraries, and in which our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- @@ -1281,33 +1259,31 @@ m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) -test no = "$enable_libtool_lock" || enable_libtool_lock=yes +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) - # Find out what ABI is being produced by ac_compile, and set mode - # options accordingly. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) - HPUX_IA64_MODE=32 + HPUX_IA64_MODE="32" ;; *ELF-64*) - HPUX_IA64_MODE=64 + HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. + # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then - if test yes = "$lt_cv_prog_gnu_ld"; then + if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" @@ -1336,46 +1312,9 @@ ia64-*-hpux*) rm -rf conftest* ;; -mips64*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - emul=elf - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - emul="${emul}32" - ;; - *64-bit*) - emul="${emul}64" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *MSB*) - emul="${emul}btsmip" - ;; - *LSB*) - emul="${emul}ltsmip" - ;; - esac - case `/usr/bin/file conftest.$ac_objext` in - *N32*) - emul="${emul}n32" - ;; - esac - LD="${LD-ld} -m $emul" - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. Note that the listed cases only cover the - # situations where additional linker options are needed (such as when - # doing 32-bit compilation for a host where ld defaults to 64-bit, or - # vice versa); the common cases where no linker options are needed do - # not appear in the list. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in @@ -1394,10 +1333,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ;; esac ;; - powerpc64le-*linux*) - LD="${LD-ld} -m elf32lppclinux" - ;; - powerpc64-*linux*) + ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) @@ -1416,10 +1352,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - powerpcle-*linux*) - LD="${LD-ld} -m elf64lppc" - ;; - powerpc-*linux*) + ppc*-*linux*|powerpc*-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -1437,20 +1370,19 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS=$CFLAGS + SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) - if test yes != "$lt_cv_cc_needs_belf"; then + if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS=$SAVE_CFLAGS + CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) - # Find out what ABI is being produced by ac_compile, and set linker - # options accordingly. + # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in @@ -1458,7 +1390,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) case $lt_cv_prog_gnu_ld in yes*) case $host in - i?86-*-solaris*|x86_64-*-solaris*) + i?86-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) @@ -1467,7 +1399,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then - LD=${LD-ld}_sol2 + LD="${LD-ld}_sol2" fi ;; *) @@ -1483,7 +1415,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) ;; esac -need_locks=$enable_libtool_lock +need_locks="$enable_libtool_lock" ])# _LT_ENABLE_LOCK @@ -1492,7 +1424,7 @@ need_locks=$enable_libtool_lock m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} -: ${AR_FLAGS=cr} +: ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) @@ -1502,11 +1434,11 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) - if test 0 -eq "$ac_status"; then + if test "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) - if test 0 -ne "$ac_status"; then + if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi @@ -1514,7 +1446,7 @@ AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], ]) ]) -if test no = "$lt_cv_ar_at_file"; then +if test "x$lt_cv_ar_at_file" = xno; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file @@ -1545,7 +1477,7 @@ old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in - bitrig* | openbsd*) + openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) @@ -1581,7 +1513,7 @@ AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + lt_compiler_flag="$3" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins @@ -1608,7 +1540,7 @@ AC_CACHE_CHECK([$1], [$2], $RM conftest* ]) -if test yes = "[$]$2"; then +if test x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) @@ -1630,7 +1562,7 @@ AC_DEFUN([_LT_LINKER_OPTION], m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then @@ -1649,10 +1581,10 @@ AC_CACHE_CHECK([$1], [$2], fi fi $RM -r conftest* - LDFLAGS=$save_LDFLAGS + LDFLAGS="$save_LDFLAGS" ]) -if test yes = "[$]$2"; then +if test x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) @@ -1673,7 +1605,7 @@ AC_DEFUN([LT_CMD_MAX_LEN], AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 - teststring=ABCD + teststring="ABCD" case $build_os in msdosdjgpp*) @@ -1713,7 +1645,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=8192; ;; - bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` @@ -1764,22 +1696,22 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ - test undefined != "$lt_cv_sys_max_cmd_len"; then + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8; do + for i in 1 2 3 4 5 6 7 8 ; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. - while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && - test 17 != "$i" # 1/2 MB should be enough + test $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring @@ -1795,7 +1727,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; esac ]) -if test -n "$lt_cv_sys_max_cmd_len"; then +if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) @@ -1823,7 +1755,7 @@ m4_defun([_LT_HEADER_DLFCN], # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl -if test yes = "$cross_compiling"; then : +if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 @@ -1870,9 +1802,9 @@ else # endif #endif -/* When -fvisibility=hidden is used, assume the code has been annotated +/* When -fvisbility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ -#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif @@ -1898,7 +1830,7 @@ int main () return status; }] _LT_EOF - if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in @@ -1919,7 +1851,7 @@ rm -fr conftest* # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl -if test yes != "$enable_dlopen"; then +if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown @@ -1929,52 +1861,44 @@ else case $host_os in beos*) - lt_cv_dlopen=load_add_on + lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) - lt_cv_dlopen=LoadLibrary + lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) - lt_cv_dlopen=dlopen + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) - # if libdl is installed we need to link against it + # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ - lt_cv_dlopen=dyld + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; - tpf*) - # Don't try to run any link tests for TPF. We know it's impossible - # because TPF is a cross-compiler, and we know how we open DSOs. - lt_cv_dlopen=dlopen - lt_cv_dlopen_libs= - lt_cv_dlopen_self=no - ;; - *) AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen=shl_load], + [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen=dlopen], + [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) @@ -1983,21 +1907,21 @@ else ;; esac - if test no = "$lt_cv_dlopen"; then - enable_dlopen=no - else + if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes + else + enable_dlopen=no fi case $lt_cv_dlopen in dlopen) - save_CPPFLAGS=$CPPFLAGS - test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - save_LDFLAGS=$LDFLAGS + save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - save_LIBS=$LIBS + save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], @@ -2007,7 +1931,7 @@ else lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) - if test yes = "$lt_cv_dlopen_self"; then + if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl @@ -2017,9 +1941,9 @@ else ]) fi - CPPFLAGS=$save_CPPFLAGS - LDFLAGS=$save_LDFLAGS - LIBS=$save_LIBS + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" ;; esac @@ -2111,8 +2035,8 @@ m4_defun([_LT_COMPILER_FILE_LOCKS], m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) -hard_links=nottested -if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes @@ -2122,8 +2046,8 @@ if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_loc ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) - if test no = "$hard_links"; then - AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else @@ -2150,8 +2074,8 @@ objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", - [Define to the sub-directory where libtool stores uninstalled libraries.]) +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR @@ -2163,15 +2087,15 @@ m4_defun([_LT_LINKER_HARDCODE_LIBPATH], _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || - test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. - if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one - ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && - test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else @@ -2185,12 +2109,12 @@ else fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) -if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || - test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no -elif test yes = "$shlibpath_overrides_runpath" || - test no = "$enable_shared"; then +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi @@ -2214,7 +2138,7 @@ else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) - if test -n "$STRIP"; then + if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) @@ -2232,47 +2156,6 @@ _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB -# _LT_PREPARE_MUNGE_PATH_LIST -# --------------------------- -# Make sure func_munge_path_list() is defined correctly. -m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], -[[# func_munge_path_list VARIABLE PATH -# ----------------------------------- -# VARIABLE is name of variable containing _space_ separated list of -# directories to be munged by the contents of PATH, which is string -# having a format: -# "DIR[:DIR]:" -# string "DIR[ DIR]" will be prepended to VARIABLE -# ":DIR[:DIR]" -# string "DIR[ DIR]" will be appended to VARIABLE -# "DIRP[:DIRP]::[DIRA:]DIRA" -# string "DIRP[ DIRP]" will be prepended to VARIABLE and string -# "DIRA[ DIRA]" will be appended to VARIABLE -# "DIR[:DIR]" -# VARIABLE will be replaced by "DIR[ DIR]" -func_munge_path_list () -{ - case x@S|@2 in - x) - ;; - *:) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" - ;; - x:*) - eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" - ;; - *::*) - eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" - eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" - ;; - *) - eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" - ;; - esac -} -]])# _LT_PREPARE_PATH_LIST - - # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics @@ -2283,18 +2166,17 @@ m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ -if test yes = "$GCC"; then +if test "$GCC" = yes; then case $host_os in - darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; - *) lt_awk_arg='/^libraries:/' ;; + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; - *) lt_sed_strip_eq='s|=/|/|g' ;; + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in @@ -2310,35 +2192,28 @@ if test yes = "$GCC"; then ;; esac # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary... + # and add multilib dir if necessary. lt_tmp_lt_search_path_spec= - lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - # ...but if some path component already ends with the multilib dir we assume - # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). - case "$lt_multi_os_dir; $lt_search_path_spec " in - "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) - lt_multi_os_dir= - ;; - esac + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" - elif test -n "$lt_multi_os_dir"; then + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS = " "; FS = "/|\n";} { - lt_foo = ""; - lt_count = 0; +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { - lt_foo = "/" $lt_i lt_foo; + lt_foo="/" $lt_i lt_foo; } else { lt_count--; } @@ -2352,7 +2227,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else @@ -2361,7 +2236,7 @@ fi]) library_names_spec= libname_spec='lib$name' soname_spec= -shrext_cmds=.so +shrext_cmds=".so" postinstall_cmds= postuninstall_cmds= finish_cmds= @@ -2378,17 +2253,14 @@ hardcode_into_libs=no # flags to be left without arguments need_version=unknown -AC_ARG_VAR([LT_SYS_LIBRARY_PATH], -[User-defined run-time library search path.]) - case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='$libname$release$shared_ext$major' + soname_spec='${libname}${release}${shared_ext}$major' ;; aix[[4-9]]*) @@ -2396,91 +2268,41 @@ aix[[4-9]]*) need_lib_prefix=no need_version=no hardcode_into_libs=yes - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 supports IA64 - library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with - # the line '#! .'. This would cause the generated library to - # depend on '.', always an invalid library. This was fixed in + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' - echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac - # Using Import Files as archive members, it is possible to support - # filename-based versioning of shared library archives on AIX. While - # this would work for both with and without runtime linking, it will - # prevent static linking of such archives. So we do filename-based - # shared library versioning with .so extension only, which is used - # when both runtime linking and shared linking is enabled. - # Unfortunately, runtime linking may impact performance, so we do - # not want this to be the default eventually. Also, we use the - # versioned .so libs for executables only if there is the -brtl - # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. - # To allow for filename-based versioning support, we need to create - # libNAME.so.V as an archive file, containing: - # *) an Import File, referring to the versioned filename of the - # archive as well as the shared archive member, telling the - # bitwidth (32 or 64) of that shared object, and providing the - # list of exported symbols of that shared object, eventually - # decorated with the 'weak' keyword - # *) the shared object with the F_LOADONLY flag set, to really avoid - # it being seen by the linker. - # At run time we better use the real file rather than another symlink, - # but for link time we create the symlink libNAME.so -> libNAME.so.V - - case $with_aix_soname,$aix_use_runtimelinking in - # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. - aix,yes) # traditional libtool - dynamic_linker='AIX unversionable lib.so' + if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - ;; - aix,no) # traditional AIX only - dynamic_linker='AIX lib.a[(]lib.so.V[)]' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - ;; - svr4,*) # full svr4 only - dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,yes) # both, prefer svr4 - dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" - library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' - # unpreferred sharedlib libNAME.a needs extra handling - postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' - postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' - # We do not specify a path in Import Files, so LIBPATH fires. - shlibpath_overrides_runpath=yes - ;; - *,no) # both, prefer aix - dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" - library_names_spec='$libname$release.a $libname.a' - soname_spec='$libname$release$shared_ext$major' - # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling - postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' - postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' - ;; - esac + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi shlibpath_var=LIBPATH fi ;; @@ -2490,18 +2312,18 @@ amigaos*) powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) - library_names_spec='$libname$shared_ext' + library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; @@ -2509,8 +2331,8 @@ beos*) bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" @@ -2522,7 +2344,7 @@ bsdi[[45]]*) cygwin* | mingw* | pw32* | cegcc*) version_type=windows - shrext_cmds=.dll + shrext_cmds=".dll" need_version=no need_lib_prefix=no @@ -2531,8 +2353,8 @@ cygwin* | mingw* | pw32* | cegcc*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ @@ -2548,17 +2370,17 @@ cygwin* | mingw* | pw32* | cegcc*) case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix - soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' ;; esac dynamic_linker='Win32 ld.exe' @@ -2567,8 +2389,8 @@ m4_if([$1], [],[ *,cl*) # Native MSVC libname_spec='$name' - soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' - library_names_spec='$libname.dll.lib' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' case $build_os in mingw*) @@ -2595,7 +2417,7 @@ m4_if([$1], [],[ sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) - sys_lib_search_path_spec=$LIB + sys_lib_search_path_spec="$LIB" if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` @@ -2608,8 +2430,8 @@ m4_if([$1], [],[ esac # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' @@ -2622,7 +2444,7 @@ m4_if([$1], [],[ *) # Assume MSVC wrapper - library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac @@ -2635,8 +2457,8 @@ darwin* | rhapsody*) version_type=darwin need_lib_prefix=no need_version=no - library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' - soname_spec='$libname$release$major$shared_ext' + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' @@ -2649,8 +2471,8 @@ dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -2668,13 +2490,12 @@ freebsd* | dragonfly*) version_type=freebsd-$objformat case $version_type in freebsd-elf*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac @@ -2704,10 +2525,10 @@ haiku*) need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=no + shlibpath_overrides_runpath=yes sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; @@ -2725,15 +2546,14 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' - if test 32 = "$HPUX_IA64_MODE"; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' @@ -2741,8 +2561,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; @@ -2751,8 +2571,8 @@ hpux9* | hpux10* | hpux11*) dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... @@ -2765,8 +2585,8 @@ interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2777,7 +2597,7 @@ irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) - if test yes = "$lt_cv_prog_gnu_ld"; then + if test "$lt_cv_prog_gnu_ld" = yes; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix @@ -2785,8 +2605,8 @@ irix5* | irix6* | nonstopux*) esac need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= @@ -2805,8 +2625,8 @@ irix5* | irix6* | nonstopux*) esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" - sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" hardcode_into_libs=yes ;; @@ -2815,33 +2635,13 @@ linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; -linux*android*) - version_type=none # Android doesn't support versioned libraries. - need_lib_prefix=no - need_version=no - library_names_spec='$libname$release$shared_ext' - soname_spec='$libname$release$shared_ext' - finish_cmds= - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - dynamic_linker='Android linker' - # Don't embed -rpath directories since the linker doesn't support them. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - ;; - # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no @@ -2866,12 +2666,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) # before this can be enabled. hardcode_into_libs=yes - # Ideally, we could use ldconfig to report *all* directores which are - # searched for libraries, however this is still not possible. Aside from not - # being certain /sbin/ldconfig is available, command - # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, - # even though it is searched at run-time. Try to do the best guess by - # appending ld.so.conf contents (and includes) to the search path. + # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" @@ -2903,12 +2698,12 @@ netbsd*) need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH @@ -2918,7 +2713,7 @@ netbsd*) newsos6) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; @@ -2927,68 +2722,58 @@ newsos6) version_type=qnx need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; -openbsd* | bitrig*) +openbsd*) version_type=sunos - sys_lib_dlsearch_path_spec=/usr/lib + sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then - need_version=no - else - need_version=yes - fi - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi ;; os2*) libname_spec='$name' - version_type=windows - shrext_cmds=.dll - need_version=no + shrext_cmds=".dll" need_lib_prefix=no - # OS/2 can only load a DLL with a base name of 8 characters or less. - soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; - v=$($ECHO $release$versuffix | tr -d .-); - n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); - $ECHO $n$v`$shared_ext' - library_names_spec='${libname}_dll.$libext' + library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' - shlibpath_var=BEGINLIBPATH - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - postinstall_cmds='base_file=`basename \$file`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' + shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no - soname_spec='$libname$release$shared_ext$major' - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) @@ -2999,8 +2784,8 @@ solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes @@ -3010,11 +2795,11 @@ solaris*) sunos4*) version_type=sunos - library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then need_lib_prefix=no fi need_version=yes @@ -3022,8 +2807,8 @@ sunos4*) sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) @@ -3044,24 +2829,24 @@ sysv4 | sysv4.3*) ;; sysv4*MP*) - if test -d /usr/nec; then + if test -d /usr/nec ;then version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' - soname_spec='$libname$shared_ext.$major' + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=sco + version_type=freebsd-elf need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' @@ -3079,7 +2864,7 @@ tpf*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes @@ -3087,8 +2872,8 @@ tpf*) uts4*) version_type=linux # correct to gnu/linux during the next big refactor - library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' - soname_spec='$libname$release$shared_ext$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH ;; @@ -3097,30 +2882,20 @@ uts4*) ;; esac AC_MSG_RESULT([$dynamic_linker]) -test no = "$dynamic_linker" && can_build_shared=no +test "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test yes = "$GCC"; then +if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi -if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then - sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi - -if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then - sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi -# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... -configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec - -# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code -func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" - -# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool -configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH - _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) @@ -3153,41 +2928,39 @@ _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) -_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], - [Detected run-time system search path for libraries]) -_LT_DECL([], [configure_time_lt_sys_library_path], [2], - [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- -# find a file program that can recognize shared library +# find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) - lt_save_MAGIC_CMD=$MAGIC_CMD - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$1"; then - lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD=$lt_cv_path_MAGIC_CMD + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : @@ -3210,11 +2983,11 @@ _LT_EOF break fi done - IFS=$lt_save_ifs - MAGIC_CMD=$lt_save_MAGIC_CMD + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) -MAGIC_CMD=$lt_cv_path_MAGIC_CMD +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else @@ -3232,7 +3005,7 @@ dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- -# find a file program that can recognize a shared library +# find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then @@ -3259,16 +3032,16 @@ m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test no = "$withval" || with_gnu_ld=yes], + [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld -if test yes = "$GCC"; then +if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) - # gcc leaves a trailing carriage return, which upsets mingw + # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; @@ -3282,7 +3055,7 @@ if test yes = "$GCC"; then while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done - test -z "$LD" && LD=$ac_prog + test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. @@ -3293,37 +3066,37 @@ if test yes = "$GCC"; then with_gnu_ld=unknown ;; esac -elif test yes = "$with_gnu_ld"; then +elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD=$ac_dir/$ac_prog + lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 conftest.i -cat conftest.i conftest.i >conftest2.i -: ${lt_DD:=$DD} -AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], -[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: -fi]) -rm -f conftest.i conftest2.i conftest.out]) -])# _LT_PATH_DD - - -# _LT_CMD_TRUNCATE -# ---------------- -# find command to truncate a binary pipe -m4_defun([_LT_CMD_TRUNCATE], -[m4_require([_LT_PATH_DD]) -AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], -[printf 0123456789abcdef0123456789abcdef >conftest.i -cat conftest.i conftest.i >conftest2.i -lt_cv_truncate_bin= -if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then - cmp -s conftest.i conftest.out \ - && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" -fi -rm -f conftest.i conftest2.i conftest.out -test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) -_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], - [Command to truncate a binary pipe]) -])# _LT_CMD_TRUNCATE - - # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies @@ -3446,13 +3182,13 @@ lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. -# 'unknown' -- same as none, but documents that we really don't know. +# `unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path -# that responds to the $file_magic_cmd with a given extended regex. -# If you have 'file' or equivalent on your system and you're not sure -# whether 'pass_all' will *always* work, you probably want this one. +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) @@ -3479,7 +3215,8 @@ mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. - if ( file / ) >/dev/null 2>&1; then + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else @@ -3575,8 +3312,8 @@ newos6*) lt_cv_deplibs_check_method=pass_all ;; -openbsd* | bitrig*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' @@ -3629,9 +3366,6 @@ sysv4 | sysv4.3*) tpf*) lt_cv_deplibs_check_method=pass_all ;; -os2*) - lt_cv_deplibs_check_method=pass_all - ;; esac ]) @@ -3672,38 +3406,33 @@ AC_DEFUN([LT_PATH_NM], AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. - lt_cv_path_NM=$NM + lt_cv_path_NM="$NM" else - lt_nm_to_check=${ac_tool_prefix}nm + lt_nm_to_check="${ac_tool_prefix}nm" if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. - tmp_nm=$ac_dir/$lt_tmp_nm - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then # Check to see if the nm accepts a BSD-compat flag. - # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # Adding the `sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file - # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty - case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; - *) lt_bad_file=/dev/null ;; - esac - case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in - *$lt_bad_file* | *'Invalid file or object type'*) + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" - break 2 + break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" - break 2 + break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but @@ -3714,21 +3443,21 @@ else esac fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) -if test no != "$lt_cv_path_NM"; then - NM=$lt_cv_path_NM +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) - DUMPBIN="$DUMPBIN -symbols -headers" + DUMPBIN="$DUMPBIN -symbols" ;; *) DUMPBIN=: @@ -3736,8 +3465,8 @@ else esac fi AC_SUBST([DUMPBIN]) - if test : != "$DUMPBIN"; then - NM=$DUMPBIN + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" fi fi test -z "$NM" && NM=nm @@ -3783,8 +3512,8 @@ lt_cv_sharedlib_from_linklib_cmd, case $host_os in cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh; - # decide which one to use based on capabilities of $DLLTOOL + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib @@ -3796,7 +3525,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd=$ECHO + lt_cv_sharedlib_from_linklib_cmd="$ECHO" ;; esac ]) @@ -3823,28 +3552,13 @@ AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) -if test yes != "$lt_cv_path_mainfest_tool"; then +if test "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL -# _LT_DLL_DEF_P([FILE]) -# --------------------- -# True iff FILE is a Windows DLL '.def' file. -# Keep in sync with func_dll_def_p in the libtool script -AC_DEFUN([_LT_DLL_DEF_P], -[dnl - test DEF = "`$SED -n dnl - -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace - -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments - -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl - -e q dnl Only consider the first "real" line - $1`" dnl -])# _LT_DLL_DEF_P - - # LT_LIB_M # -------- # check for math library @@ -3856,11 +3570,11 @@ case $host in # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) - AC_CHECK_LIB(m, cos, LIBM=-lm) + AC_CHECK_LIB(m, cos, LIBM="-lm") ;; esac AC_SUBST([LIBM]) @@ -3879,7 +3593,7 @@ m4_defun([_LT_COMPILER_NO_RTTI], _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= -if test yes = "$GCC"; then +if test "$GCC" = yes; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; @@ -3931,7 +3645,7 @@ cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; @@ -3964,44 +3678,14 @@ case `$NM -V 2>&1` in symcode='[[ABCDGIRSTW]]' ;; esac -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Gets list of data symbols to import. - lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" - # Adjust the below global symbol transforms to fixup imported variables. - lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" - lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" - lt_c_name_lib_hook="\ - -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ - -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" -else - # Disable hooks by default. - lt_cv_sys_global_symbol_to_import= - lt_cdecl_hook= - lt_c_name_hook= - lt_c_name_lib_hook= -fi - # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n"\ -$lt_cdecl_hook\ -" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ -$lt_c_name_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" - -# Transform an extracted symbol line into symbol name with lib prefix and -# symbol address. -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ -$lt_c_name_lib_hook\ -" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ -" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ -" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= @@ -4019,24 +3703,21 @@ for ac_symprfx in "" "_"; do # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function, - # D for any global variable and I for any imported variable. + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ -" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ -" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ -" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ -" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ -" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" @@ -4063,8 +3744,7 @@ _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm - $ECHO "$as_me:$LINENO: $NM conftest.$ac_objext | $lt_cv_sys_global_symbol_pipe > $nlist" >&AS_MESSAGE_LOG_FD - if eval "$NM" conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist 2>&AS_MESSAGE_LOG_FD && test -s "$nlist"; then + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -4077,11 +3757,11 @@ _LT_EOF if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE -/* DATA imports from DLLs on WIN32 can't be const, because runtime +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST -#elif defined __osf__ +#elif defined(__osf__) /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else @@ -4107,7 +3787,7 @@ lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF - $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; @@ -4127,9 +3807,9 @@ _LT_EOF mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS - LIBS=conftstm.$ac_objext + LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS @@ -4150,7 +3830,7 @@ _LT_EOF rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. - if test yes = "$pipe_works"; then + if test "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= @@ -4177,16 +3857,12 @@ _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], - [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], - [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS @@ -4202,18 +3878,17 @@ _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. - if test yes = "$GXX"; then + if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) @@ -4224,8 +3899,8 @@ m4_if([$1], [CXX], [ ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -4241,11 +3916,6 @@ m4_if([$1], [CXX], [ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac ;; darwin* | rhapsody*) # PIC is the default on this platform @@ -4295,7 +3965,7 @@ m4_if([$1], [CXX], [ case $host_os in aix[[4-9]]*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else @@ -4336,14 +4006,14 @@ m4_if([$1], [CXX], [ case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' - if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default @@ -4380,7 +4050,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) - # old Intel C++ for x86_64, which still supported -KPIC. + # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' @@ -4525,18 +4195,17 @@ m4_if([$1], [CXX], [ fi ], [ - if test yes = "$GCC"; then + if test "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) @@ -4547,8 +4216,8 @@ m4_if([$1], [CXX], [ ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but - # adding the '-m68020' flag to GCC prevents building anything better, - # like '-m68040'. + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac @@ -4565,11 +4234,6 @@ m4_if([$1], [CXX], [ # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac ;; darwin* | rhapsody*) @@ -4640,7 +4304,7 @@ m4_if([$1], [CXX], [ case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else @@ -4648,30 +4312,11 @@ m4_if([$1], [CXX], [ fi ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - case $cc_basename in - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - case $host_os in - os2*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' - ;; - esac ;; hpux9* | hpux10* | hpux11*) @@ -4687,7 +4332,7 @@ m4_if([$1], [CXX], [ ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) @@ -4698,18 +4343,12 @@ m4_if([$1], [CXX], [ linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in - # old Intel for x86_64, which still supported -KPIC. + # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; - # flang / f18. f95 an alias for gfortran or flang on Debian - flang* | f18* | f95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) @@ -4729,12 +4368,6 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) @@ -4832,7 +4465,7 @@ m4_if([$1], [CXX], [ ;; sysv4*MP*) - if test -d /usr/nec; then + if test -d /usr/nec ;then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi @@ -4861,7 +4494,7 @@ m4_if([$1], [CXX], [ fi ]) case $host_os in - # For platforms that do not support PIC, -DPIC is meaningless: + # For platforms which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; @@ -4927,21 +4560,17 @@ m4_if([$1], [CXX], [ case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) case $cc_basename in @@ -4990,9 +4619,9 @@ m4_if([$1], [CXX], [ # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ' (' and ')$', so one must not match beginning or - # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', - # as well as any symbol that contains 'd'. + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if @@ -5008,7 +4637,7 @@ dnl Note also adjust exclude_expsyms for C++ above. # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. - if test yes != "$GCC"; then + if test "$GCC" != yes; then with_gnu_ld=no fi ;; @@ -5016,7 +4645,7 @@ dnl Note also adjust exclude_expsyms for C++ above. # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; - openbsd* | bitrig*) + openbsd*) with_gnu_ld=no ;; linux* | k*bsd*-gnu | gnu*) @@ -5029,7 +4658,7 @@ dnl Note also adjust exclude_expsyms for C++ above. # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no - if test yes = "$with_gnu_ld"; then + if test "$with_gnu_ld" = yes; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility @@ -5051,24 +4680,24 @@ dnl Note also adjust exclude_expsyms for C++ above. esac fi - if test yes = "$lt_use_gnu_ld_interface"; then + if test "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='$wl' + wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no - case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... @@ -5081,7 +4710,7 @@ dnl Note also adjust exclude_expsyms for C++ above. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken - if test ia64 != "$host_cpu"; then + if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 @@ -5100,7 +4729,7 @@ _LT_EOF case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) @@ -5116,7 +4745,7 @@ _LT_EOF _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -5126,7 +4755,7 @@ _LT_EOF # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -5134,89 +4763,61 @@ _LT_EOF _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no - if test linux-dietlibc = "$host_os"; then + if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test no = "$tmp_diet" + && test "$tmp_diet" = no then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; @@ -5227,47 +4828,42 @@ _LT_EOF lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; - nagfor*) # NAGFOR 5.3 - tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then + if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in - tcc*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' - ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test yes = "$supports_anon_versioning"; then + if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac @@ -5281,8 +4877,8 @@ _LT_EOF _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' fi ;; @@ -5300,8 +4896,8 @@ _LT_EOF _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -5313,7 +4909,7 @@ _LT_EOF _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify @@ -5328,9 +4924,9 @@ _LT_EOF # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -5347,15 +4943,15 @@ _LT_EOF *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac - if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= @@ -5371,7 +4967,7 @@ _LT_EOF # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported @@ -5379,57 +4975,34 @@ _LT_EOF ;; aix[[4-9]]*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag= + no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to GNU nm, but means don't demangle to AIX nm. - # Without the "-l" option, or with the "-B" option, AIX nm treats - # weak defined symbols like other global defined symbols, whereas - # GNU nm marks them as "W". - # While the 'weak' keyword is ignored in the Export File, we need - # it in the Import File for the 'aix-soname' feature, so we have - # to replace the "-B" option with "-P" for AIX nm. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else - _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive + # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do - if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi ;; esac @@ -5448,21 +5021,13 @@ _LT_EOF _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # traditional, no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - ;; - esac + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - if test yes = "$GCC"; then + if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` + collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -5481,80 +5046,62 @@ _LT_EOF ;; esac shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag="$shared_flag "'$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' + _LT_TAGVAR(link_all_deplibs, $1)=no else # not using gcc - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' else - shared_flag='$wl-bM:SRE' + shared_flag='${wl}-bM:SRE' fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' fi fi - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else - if test ia64 = "$host_cpu"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' - if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -5563,7 +5110,7 @@ _LT_EOF case $host_cpu in powerpc) # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) @@ -5593,17 +5140,16 @@ _LT_EOF # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes @@ -5612,18 +5158,18 @@ _LT_EOF # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # Assume MSVC wrapper @@ -5632,7 +5178,7 @@ _LT_EOF # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. @@ -5682,33 +5228,33 @@ _LT_EOF ;; hpux9*) - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) - if test yes,no = "$GCC,$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes @@ -5716,25 +5262,25 @@ _LT_EOF ;; hpux11*) - if test yes,no = "$GCC,$with_gnu_ld"; then + if test "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ @@ -5742,14 +5288,14 @@ _LT_EOF # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in @@ -5760,7 +5306,7 @@ _LT_EOF *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. @@ -5771,16 +5317,16 @@ _LT_EOF ;; irix5* | irix6* | nonstopux*) - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], - [save_LDFLAGS=$LDFLAGS - LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], @@ -5793,32 +5339,21 @@ _LT_EOF end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) - LDFLAGS=$save_LDFLAGS]) - if test yes = "$lt_cv_irix_exported_symbol"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' fi - _LT_TAGVAR(link_all_deplibs, $1)=no else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; - linux*) - case $cc_basename in - tcc*) - # Fabrice Bellard et al's Tiny C Compiler - _LT_TAGVAR(ld_shlibs, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out @@ -5833,7 +5368,7 @@ _LT_EOF newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; @@ -5841,19 +5376,27 @@ _LT_EOF *nto* | *qnx*) ;; - openbsd* | bitrig*) + openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac fi else _LT_TAGVAR(ld_shlibs, $1)=no @@ -5864,53 +5407,33 @@ _LT_EOF _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) - if test yes = "$GCC"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag - if test yes = "$GCC"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -5921,24 +5444,24 @@ _LT_EOF solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test yes = "$GCC"; then - wlarc='$wl' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) - wlarc='$wl' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi @@ -5948,11 +5471,11 @@ _LT_EOF solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. GCC discards it without '$wl', + # but understands `-z linker_flag'. GCC discards it without `$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) - if test yes = "$GCC"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi @@ -5962,10 +5485,10 @@ _LT_EOF ;; sunos4*) - if test sequent = "$host_vendor"; then + if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi @@ -6014,43 +5537,43 @@ _LT_EOF ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not + # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' - if test yes = "$GCC"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; @@ -6065,17 +5588,17 @@ _LT_EOF ;; esac - if test sni = "$host_vendor"; then + if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld @@ -6092,7 +5615,7 @@ x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - if test yes,yes = "$GCC,$enable_shared"; then + if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. @@ -6172,12 +5695,12 @@ _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting $shlibpath_var if the + "absolute", i.e impossible to change by setting ${shlibpath_var} if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR @@ -6218,10 +5741,10 @@ dnl [Compiler flag to generate thread safe objects]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to 'libtool'. +# the compiler configuration to `libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl -lt_save_CC=$CC +lt_save_CC="$CC" AC_LANG_PUSH(C) # Source file extension for C test sources. @@ -6261,18 +5784,18 @@ if test -n "$compiler"; then LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB - # Report what library types will actually be built + # Report which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no + test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test yes = "$enable_shared" && enable_static=no + test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' @@ -6280,12 +5803,8 @@ if test -n "$compiler"; then ;; aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no fi ;; esac @@ -6293,13 +5812,13 @@ if test -n "$compiler"; then AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes + test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP -CC=$lt_save_CC +CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG @@ -6307,14 +5826,14 @@ CC=$lt_save_CC # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to 'libtool'. +# the compiler configuration to `libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test no != "$CXX" && - ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || - (test g++ != "$CXX"))); then +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes @@ -6356,7 +5875,7 @@ _LT_TAGVAR(objext, $1)=$objext # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_caught_CXX_error"; then +if test "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" @@ -6398,35 +5917,35 @@ if test yes != "$_lt_caught_CXX_error"; then if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately - if test yes = "$GXX"; then + if test "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi - if test yes = "$GXX"; then + if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. - if test yes = "$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) - wlarc='$wl' + wlarc='${wl}' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi @@ -6445,7 +5964,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no @@ -6462,30 +5981,18 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' - no_entry_flag= + no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # have runtime linking enabled, and use it for executables. - # For shared libraries, we enable/disable runtime linking - # depending on the kind of the shared library created - - # when "with_aix_soname,aix_use_runtimelinking" is: - # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables - # "aix,yes" lib.so shared, rtl:yes, for executables - # lib.a static archive - # "both,no" lib.so.V(shr.o) shared, rtl:yes - # lib.a(lib.so.V) shared, rtl:no, for executables - # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a(lib.so.V) shared, rtl:no - # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables - # lib.a static archive + # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in @@ -6495,13 +6002,6 @@ if test yes != "$_lt_caught_CXX_error"; then ;; esac done - if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then - # With aix-soname=svr4, we create the lib.so.V shared archives only, - # so we don't have lib.a shared libs to link our executables. - # We have to force runtime linking in this case. - aix_use_runtimelinking=yes - LDFLAGS="$LDFLAGS -Wl,-brtl" - fi ;; esac @@ -6520,21 +6020,13 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='$wl-f,' - case $with_aix_soname,$aix_use_runtimelinking in - aix,*) ;; # no import file - svr4,* | *,yes) # use import file - # The Import File defines what to hardcode. - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - ;; - esac + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - if test yes = "$GXX"; then + if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ - collect2name=`$CC -print-prog-name=collect2` + collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then @@ -6552,84 +6044,64 @@ if test yes != "$_lt_caught_CXX_error"; then fi esac shared_flag='-shared' - if test yes = "$aix_use_runtimelinking"; then - shared_flag=$shared_flag' $wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' fi - # Need to ensure runtime linking is disabled for the traditional - # shared library, or the linker may eventually find shared libraries - # /with/ Import File - we do not want to mix them. - shared_flag_aix='-shared' - shared_flag_svr4='-shared $wl-G' else # not using gcc - if test ia64 = "$host_cpu"; then + if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else - if test yes = "$aix_use_runtimelinking"; then - shared_flag='$wl-G' + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' else - shared_flag='$wl-bM:SRE' + shared_flag='${wl}-bM:SRE' fi - shared_flag_aix='$wl-bM:SRE' - shared_flag_svr4='$wl-G' fi fi - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes - if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. - # The "-G" linker flag allows undefined symbols. - _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else - if test ia64 = "$host_cpu"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' - if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' - # -brtl affects multiple linker settings, -berok does not and is overridden later - compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' - if test svr4 != "$with_aix_soname"; then - # This is similar to how AIX traditionally builds its shared - # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' - fi - if test aix != "$with_aix_soname"; then - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' - else - # used by -dlpreopen to get the symbols - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' - fi - _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; @@ -6639,7 +6111,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6667,58 +6139,57 @@ if test yes != "$_lt_caught_CXX_error"; then # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. - shrext_cmds=.dll + shrext_cmds=".dll" # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp "$export_symbols" "$output_objdir/$soname.def"; - echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; - else - $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile=$lt_outputfile.exe - lt_tool_outputfile=$lt_tool_outputfile.exe - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file, use it as - # is; otherwise, prepend EXPORTS... - _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi @@ -6729,34 +6200,6 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_DARWIN_LINKER_FEATURES($1) ;; - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - shrext_cmds=.dll - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ - $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ - $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ - $ECHO EXPORTS >> $output_objdir/$libname.def~ - prefix_cmds="$SED"~ - if test EXPORTS = "`$SED 1q $export_symbols`"; then - prefix_cmds="$prefix_cmds -e 1d"; - fi~ - prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ - cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ - $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ - emximp -o $lib $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - dgux*) case $cc_basename in ec++*) @@ -6792,14 +6235,14 @@ if test yes != "$_lt_caught_CXX_error"; then ;; haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default @@ -6811,7 +6254,7 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -6820,11 +6263,11 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes = "$GXX"; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no @@ -6834,15 +6277,15 @@ if test yes != "$_lt_caught_CXX_error"; then ;; hpux10*|hpux11*) - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi @@ -6868,13 +6311,13 @@ if test yes != "$_lt_caught_CXX_error"; then aCC*) case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists @@ -6885,20 +6328,20 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP " \-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi @@ -6913,22 +6356,22 @@ if test yes != "$_lt_caught_CXX_error"; then interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is @@ -6937,17 +6380,17 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) - if test yes = "$GXX"; then - if test no = "$with_gnu_ld"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; @@ -6960,8 +6403,8 @@ if test yes != "$_lt_caught_CXX_error"; then # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. @@ -6970,10 +6413,10 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. @@ -6987,59 +6430,59 @@ if test yes != "$_lt_caught_CXX_error"; then # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' ;; cxx*) # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' @@ -7053,18 +6496,18 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' - if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) @@ -7072,10 +6515,10 @@ if test yes != "$_lt_caught_CXX_error"; then *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on @@ -7133,17 +6576,22 @@ if test yes != "$_lt_caught_CXX_error"; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - openbsd* | bitrig*) + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else @@ -7159,9 +6607,9 @@ if test yes != "$_lt_caught_CXX_error"; then # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using @@ -7179,17 +6627,17 @@ if test yes != "$_lt_caught_CXX_error"; then cxx*) case $host in osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ - $RM $lib.exp' + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac @@ -7204,27 +6652,27 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) - if test yes,no = "$GXX,$with_gnu_ld"; then - _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' ;; esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support @@ -7264,9 +6712,9 @@ if test yes != "$_lt_caught_CXX_error"; then # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no @@ -7274,7 +6722,7 @@ if test yes != "$_lt_caught_CXX_error"; then solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, - # but understands '-z linker_flag'. + # but understands `-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; @@ -7291,42 +6739,42 @@ if test yes != "$_lt_caught_CXX_error"; then ;; gcx*) # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker - if test yes,no = "$GXX,$with_gnu_ld"; then - _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else - # g++ 2.7 appears to require '-G' NOT '-shared' on this + # g++ 2.7 appears to require `-G' NOT `-shared' on this # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP " \-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' ;; esac fi @@ -7335,52 +6783,52 @@ if test yes != "$_lt_caught_CXX_error"; then ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) - # Note: We CANNOT use -z defs as we might desire, because we do not + # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" + '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" + '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; @@ -7411,10 +6859,10 @@ if test yes != "$_lt_caught_CXX_error"; then esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - _LT_TAGVAR(GCC, $1)=$GXX - _LT_TAGVAR(LD, $1)=$LD + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7441,7 +6889,7 @@ if test yes != "$_lt_caught_CXX_error"; then lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test yes != "$_lt_caught_CXX_error" +fi # test "$_lt_caught_CXX_error" != yes AC_LANG_POP ])# _LT_LANG_CXX_CONFIG @@ -7463,14 +6911,13 @@ AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { - case @S|@2 in - .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; - *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF - # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose @@ -7554,13 +7001,13 @@ if AC_TRY_EVAL(ac_compile); then pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do - case $prev$p in + case ${prev}${p} in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. - if test x-L = "$p" || - test x-R = "$p"; then + if test $p = "-L" || + test $p = "-R"; then prev=$p continue fi @@ -7576,16 +7023,16 @@ if AC_TRY_EVAL(ac_compile); then case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac - if test no = "$pre_test_object_deps_done"; then - case $prev in + if test "$pre_test_object_deps_done" = no; then + case ${prev} in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" fi ;; # The "-l" case would never come before the object being @@ -7593,9 +7040,9 @@ if AC_TRY_EVAL(ac_compile); then esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)=$prev$p + _LT_TAGVAR(postdeps, $1)="${prev}${p}" else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" fi fi prev= @@ -7610,15 +7057,15 @@ if AC_TRY_EVAL(ac_compile); then continue fi - if test no = "$pre_test_object_deps_done"; then + if test "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)=$p + _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)=$p + _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi @@ -7649,6 +7096,51 @@ interix[[3-9]]*) _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; esac ]) @@ -7657,7 +7149,7 @@ case " $_LT_TAGVAR(postdeps, $1) " in esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) @@ -7677,10 +7169,10 @@ _LT_TAGDECL([], [compiler_lib_search_path], [1], # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. +# to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test no = "$F77"; then +if test -z "$F77" || test "X$F77" = "Xno"; then _lt_disable_F77=yes fi @@ -7717,7 +7209,7 @@ _LT_TAGVAR(objext, $1)=$objext # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_disable_F77"; then +if test "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t @@ -7739,7 +7231,7 @@ if test yes != "$_lt_disable_F77"; then _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. - lt_save_CC=$CC + lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} @@ -7753,25 +7245,21 @@ if test yes != "$_lt_disable_F77"; then AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no + test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test yes = "$enable_shared" && enable_static=no + test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no fi ;; esac @@ -7779,11 +7267,11 @@ if test yes != "$_lt_disable_F77"; then AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes + test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) - _LT_TAGVAR(GCC, $1)=$G77 - _LT_TAGVAR(LD, $1)=$LD + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7800,9 +7288,9 @@ if test yes != "$_lt_disable_F77"; then fi # test -n "$compiler" GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test yes != "$_lt_disable_F77" + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes AC_LANG_POP ])# _LT_LANG_F77_CONFIG @@ -7812,11 +7300,11 @@ AC_LANG_POP # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. +# to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) -if test -z "$FC" || test no = "$FC"; then +if test -z "$FC" || test "X$FC" = "Xno"; then _lt_disable_FC=yes fi @@ -7853,7 +7341,7 @@ _LT_TAGVAR(objext, $1)=$objext # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. -if test yes != "$_lt_disable_FC"; then +if test "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t @@ -7875,7 +7363,7 @@ if test yes != "$_lt_disable_FC"; then _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. - lt_save_CC=$CC + lt_save_CC="$CC" lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} @@ -7891,25 +7379,21 @@ if test yes != "$_lt_disable_FC"; then AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) - test no = "$can_build_shared" && enable_shared=no + test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) - test yes = "$enable_shared" && enable_static=no + test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) - if test ia64 != "$host_cpu"; then - case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in - yes,aix,yes) ;; # shared object as lib.so file only - yes,svr4,*) ;; # shared object as lib.so archive member only - yes,*) enable_static=no ;; # shared object in lib.a archive as well - esac + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no fi ;; esac @@ -7917,11 +7401,11 @@ if test yes != "$_lt_disable_FC"; then AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. - test yes = "$enable_shared" || enable_static=yes + test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) - _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu - _LT_TAGVAR(LD, $1)=$LD + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change @@ -7941,7 +7425,7 @@ if test yes != "$_lt_disable_FC"; then GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS -fi # test yes != "$_lt_disable_FC" +fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG @@ -7951,7 +7435,7 @@ AC_LANG_POP # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. +# to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE @@ -7985,7 +7469,7 @@ CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)=$LD +_LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. @@ -8022,7 +7506,7 @@ CFLAGS=$lt_save_CFLAGS # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. +# to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE @@ -8056,7 +7540,7 @@ CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)=$LD +_LT_TAGVAR(LD, $1)="$LD" _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. @@ -8093,7 +7577,7 @@ CFLAGS=$lt_save_CFLAGS # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to 'libtool'. +# to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE @@ -8109,7 +7593,7 @@ _LT_TAGVAR(objext, $1)=$objext lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests -lt_simple_link_test_code=$lt_simple_compile_test_code +lt_simple_link_test_code="$lt_simple_compile_test_code" # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER @@ -8119,7 +7603,7 @@ _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. -lt_save_CC=$CC +lt_save_CC="$CC" lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= @@ -8148,7 +7632,7 @@ AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) - test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) @@ -8259,7 +7743,7 @@ lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f "$lt_ac_sed" && continue + test ! -f $lt_ac_sed && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in @@ -8276,9 +7760,9 @@ for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough - test 10 -lt "$lt_ac_count" && break + test $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` - if test "$lt_ac_count" -gt "$lt_ac_max"; then + if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi @@ -8302,7 +7786,27 @@ dnl AC_DEFUN([LT_AC_PROG_SED], []) # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], -[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false @@ -8326,9 +7830,102 @@ _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- -# Determine what file name conversion functions should be used by +# Determine which file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 index 94b0829..5d9acd8 100644 --- a/m4/ltoptions.m4 +++ b/m4/ltoptions.m4 @@ -1,14 +1,14 @@ # Helper functions for option handling. -*- Autoconf -*- # -# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software -# Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. -# serial 8 ltoptions.m4 +# serial 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) @@ -29,7 +29,7 @@ m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option '$2'])])[]dnl + [m4_warning([Unknown $1 option `$2'])])[]dnl ]) @@ -75,15 +75,13 @@ m4_if([$1],[LT_INIT],[ dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither - dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], - [_LT_WITH_AIX_SONAME([aix])]) + [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS @@ -114,7 +112,7 @@ AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'dlopen' option into LT_INIT's first parameter.]) +put the `dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -150,7 +148,7 @@ AU_DEFUN([AC_LIBTOOL_WIN32_DLL], _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'win32-dll' option into LT_INIT's first parameter.]) +put the `win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -159,9 +157,9 @@ dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- -# implement the --enable-shared flag, and supports the 'shared' and -# 'disable-shared' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], @@ -174,14 +172,14 @@ AC_ARG_ENABLE([shared], *) enable_shared=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_shared=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) @@ -213,9 +211,9 @@ dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- -# implement the --enable-static flag, and support the 'static' and -# 'disable-static' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], @@ -228,14 +226,14 @@ AC_ARG_ENABLE([static], *) enable_static=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_static=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) @@ -267,9 +265,9 @@ dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- -# implement the --enable-fast-install flag, and support the 'fast-install' -# and 'disable-fast-install' LT_INIT options. -# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], @@ -282,14 +280,14 @@ AC_ARG_ENABLE([fast-install], *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) @@ -306,14 +304,14 @@ AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'fast-install' option into LT_INIT's first parameter.]) +the `fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put -the 'disable-fast-install' option into LT_INIT's first parameter.]) +the `disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: @@ -321,64 +319,11 @@ dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) -# _LT_WITH_AIX_SONAME([DEFAULT]) -# ---------------------------------- -# implement the --with-aix-soname flag, and support the `aix-soname=aix' -# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT -# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. -m4_define([_LT_WITH_AIX_SONAME], -[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl -shared_archive_member_spec= -case $host,$enable_shared in -power*-*-aix[[5-9]]*,yes) - AC_MSG_CHECKING([which variant of shared library versioning to provide]) - AC_ARG_WITH([aix-soname], - [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], - [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], - [case $withval in - aix|svr4|both) - ;; - *) - AC_MSG_ERROR([Unknown argument to --with-aix-soname]) - ;; - esac - lt_cv_with_aix_soname=$with_aix_soname], - [AC_CACHE_VAL([lt_cv_with_aix_soname], - [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) - with_aix_soname=$lt_cv_with_aix_soname]) - AC_MSG_RESULT([$with_aix_soname]) - if test aix != "$with_aix_soname"; then - # For the AIX way of multilib, we name the shared archive member - # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', - # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. - # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, - # the AIX toolchain works better with OBJECT_MODE set (default 32). - if test 64 = "${OBJECT_MODE-32}"; then - shared_archive_member_spec=shr_64 - else - shared_archive_member_spec=shr - fi - fi - ;; -*) - with_aix_soname=aix - ;; -esac - -_LT_DECL([], [shared_archive_member_spec], [0], - [Shared archive member basename, for filename based shared library versioning on AIX])dnl -])# _LT_WITH_AIX_SONAME - -LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) -LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) -LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) - - # _LT_WITH_PIC([MODE]) # -------------------- -# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# implement the --with-pic flag, and support the `pic-only' and `no-pic' # LT_INIT options. -# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], @@ -389,17 +334,19 @@ m4_define([_LT_WITH_PIC], *) pic_mode=default # Look at the argument we got. We use all the common list separators. - lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for lt_pkg in $withval; do - IFS=$lt_save_ifs + IFS="$lt_save_ifs" if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done - IFS=$lt_save_ifs + IFS="$lt_save_ifs" ;; esac], - [pic_mode=m4_default([$1], [default])]) + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC @@ -412,7 +359,7 @@ AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you -put the 'pic-only' option into LT_INIT's first parameter.]) +put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 index 48bc934..9000a05 100644 --- a/m4/ltsugar.m4 +++ b/m4/ltsugar.m4 @@ -1,7 +1,6 @@ # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software -# Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives @@ -34,7 +33,7 @@ m4_define([_lt_join], # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support -# Autoconf-2.59, which quotes differently. +# Autoconf-2.59 which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], @@ -45,7 +44,7 @@ m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 index fa04b52..07a8602 100644 --- a/m4/ltversion.m4 +++ b/m4/ltversion.m4 @@ -1,6 +1,6 @@ # ltversion.m4 -- version numbers -*- Autoconf -*- # -# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Copyright (C) 2004 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives @@ -9,15 +9,15 @@ # @configure_input@ -# serial 4179 ltversion.m4 +# serial 3337 ltversion.m4 # This file is part of GNU Libtool -m4_define([LT_PACKAGE_VERSION], [2.4.6]) -m4_define([LT_PACKAGE_REVISION], [2.4.6]) +m4_define([LT_PACKAGE_VERSION], [2.4.2]) +m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4.6' -macro_revision='2.4.6' +[macro_version='2.4.2' +macro_revision='1.3337' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 index c6b26f8..c573da9 100644 --- a/m4/lt~obsolete.m4 +++ b/m4/lt~obsolete.m4 @@ -1,7 +1,6 @@ # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # -# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software -# Foundation, Inc. +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives @@ -12,7 +11,7 @@ # These exist entirely to fool aclocal when bootstrapping libtool. # -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # @@ -26,7 +25,7 @@ # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until diff --git a/m4/nut_arg_with.m4 b/m4/nut_arg_with.m4 index 686306b..9d1c36b 100644 --- a/m4/nut_arg_with.m4 +++ b/m4/nut_arg_with.m4 @@ -1,21 +1,9 @@ dnl simplified declaration of some feature options -dnl Working With External Software (might name a variant or other contextual arg) -dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/External-Software.html#External-Software AC_DEFUN([NUT_ARG_WITH], [ AC_ARG_WITH($1, - AS_HELP_STRING([--with-$1], [$2 ($3)]), + AC_HELP_STRING([--with-$1], [$2 ($3)]), [nut_with_$1="${withval}"], [nut_with_$1="$3"] ) ]) - -dnl Enable a feature (might name a variant), or yes/no -dnl https://www.gnu.org/software/autoconf/manual/autoconf-2.66/html_node/Package-Options.html -AC_DEFUN([NUT_ARG_ENABLE], -[ AC_ARG_ENABLE($1, - AS_HELP_STRING([--enable-$1], [$2 ($3)]), - [nut_enable_$1="${enableval}"], - [nut_enable_$1="$3"] - ) -]) diff --git a/m4/nut_check_asciidoc.m4 b/m4/nut_check_asciidoc.m4 index b83381e..944870e 100644 --- a/m4/nut_check_asciidoc.m4 +++ b/m4/nut_check_asciidoc.m4 @@ -1,24 +1,12 @@ -dnl Check for tools used in generation of documentation final-format files -dnl such as the basically required MAN, and optional HTML (single or chunked). -dnl On success, set nut_have_asciidoc="yes" (meaning we can do at least some -dnl documentation generation) and lots of automake macros and configure vars. -dnl On failure, set nut_have_asciidoc="no" (meaning we can't generate even a -dnl manpage, which is a requirement for proceeding to the other formats). -dnl This macro can be run multiple times, but will do the checking only once. -dnl Also note that this routine currently only checks the basic presence (and -dnl versions) of the required software; the configure script has additional -dnl functional checks (ability to build doc files) based on --with-doc request -dnl so as to not waste time on doc-types not requested by maintainer, and done -dnl in ways more intimate to NUT (using its tracked docs). +dnl Check for LIBUSB compiler flags. On success, set nut_have_libusb="yes" +dnl and set LIBUSB_CFLAGS and LIBUSB_LDFLAGS. On failure, set +dnl nut_have_libusb="no". This macro can be run multiple times, but will +dnl do the checking only once. -AC_DEFUN([NUT_CHECK_ASCIIDOC], +AC_DEFUN([NUT_CHECK_ASCIIDOC], [ if test -z "${nut_have_asciidoc_seen}"; then nut_have_asciidoc_seen=yes - # Note: this is for both asciidoc and a2x at this time - ASCIIDOC_MIN_VERSION="8.6.3" - # Note: this is checked in the configure script if PDF is of interest at all - DBLATEX_MIN_VERSION="0.2.5" AC_PATH_PROGS([ASCIIDOC], [asciidoc]) if test -n "${ASCIIDOC}"; then @@ -28,7 +16,6 @@ if test -z "${nut_have_asciidoc_seen}"; then ASCIIDOC_VERSION="${ASCIIDOC_VERSION##* }" AC_MSG_RESULT(${ASCIIDOC_VERSION} found) fi - AM_CONDITIONAL([MANUALUPDATE], [test -n "${ASCIIDOC}"]) AC_PATH_PROGS([A2X], [a2x]) if test -n "${A2X}"; then @@ -48,89 +35,6 @@ if test -z "${nut_have_asciidoc_seen}"; then AC_MSG_RESULT(${DBLATEX_VERSION} found) fi - AC_PATH_PROGS([XSLTPROC], [xsltproc]) - if test -n "${XSLTPROC}"; then - AC_MSG_CHECKING([for xsltproc version]) - XSLTPROC_VERSION="`${XSLTPROC} --version 2>/dev/null`" - dnl strip 'xsltproc version ' from version string - XSLTPROC_VERSION="${XSLTPROC_VERSION##* }" - AC_MSG_RESULT(${XSLTPROC_VERSION} found) - fi - - AC_PATH_PROGS([XMLLINT], [xmllint]) - if test -n "${XMLLINT}"; then - AC_MSG_CHECKING([for xmllint version]) - XMLLINT_VERSION="`${XMLLINT} --version 2>/dev/null`" - dnl strip 'xmllint version ' from version string - XMLLINT_VERSION="${XMLLINT_VERSION##* }" - if test -z "${XMLLINT_VERSION}" ; then - dnl Some releases also report what flags they were compiled with as - dnl part of the version info, so the last-line match finds nothing. - dnl Also some builds return version data to stderr. - XMLLINT_VERSION="`${XMLLINT} --version 2>&1 | grep version`" - XMLLINT_VERSION="${XMLLINT_VERSION##* }" - fi - AC_MSG_RESULT(${XMLLINT_VERSION} found) - fi - - AC_PATH_PROGS([SOURCE_HIGHLIGHT], [source-highlight]) - AM_CONDITIONAL([HAVE_SOURCE_HIGHLIGHT], [test -n "$SOURCE_HIGHLIGHT"]) - - dnl check for spell checking deps - AC_PATH_PROGS([ASPELL], [aspell]) - AM_CONDITIONAL([HAVE_ASPELL], [test -n "$ASPELL"]) - - dnl Note that a common "nut_have_asciidoc" variable is in fact a flag - dnl that we have several tools needed for the documentation generation - dnl TODO? Rename the script variable and makefile flags to reflect this? - AC_MSG_CHECKING([if asciidoc version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})]) - AX_COMPARE_VERSION([${ASCIIDOC_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [ - AC_MSG_RESULT(yes) - nut_have_asciidoc="yes" - ], [ - AC_MSG_RESULT(no) - nut_have_asciidoc="no" - ]) - - AC_MSG_CHECKING([if a2x version can build manpages (minimum required ${ASCIIDOC_MIN_VERSION})]) - AX_COMPARE_VERSION([${A2X_VERSION}], [ge], [${ASCIIDOC_MIN_VERSION}], [ - AC_MSG_RESULT(yes) - ], [ - AC_MSG_RESULT(no) - nut_have_asciidoc="no" - ]) - - dnl TODO: test for docbook-xsl files (maybe build a test man page?) - dnl https://github.com/networkupstools/nut/issues/162 - AC_MSG_CHECKING([if xsltproc is present (mandatory for man page regeneration)]) - if test -n "${XSLTPROC}"; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - nut_have_asciidoc="no" - fi - - AC_MSG_CHECKING([if xmllint is present (mandatory for man page regeneration)]) - if test -n "${XMLLINT}"; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - nut_have_asciidoc="no" - fi - - dnl Notes: we also keep HAVE_ASCIIDOC for implicit targets, such as manpage - dnl building - AM_CONDITIONAL([HAVE_ASCIIDOC], [test "${nut_have_asciidoc}" = "yes"]) - - AC_MSG_CHECKING([if we have all the tools mandatory for man page regeneration]) - AC_MSG_RESULT([${nut_have_asciidoc}]) - - AC_MSG_CHECKING([if source-highlight is present (preferable for documentation generation)]) - if test -n "${SOURCE_HIGHLIGHT}"; then - AC_MSG_RESULT(yes) - else - AC_MSG_RESULT(no) - fi - + dnl FIXME check for xsltproc, xmlllint, etc for chunked HTML and man pages fi ]) diff --git a/m4/nut_check_cppcheck.m4 b/m4/nut_check_cppcheck.m4 deleted file mode 100644 index 5a85758..0000000 --- a/m4/nut_check_cppcheck.m4 +++ /dev/null @@ -1,34 +0,0 @@ -dnl Check for "cppcheck" analysis tools - -AC_DEFUN([NUT_CHECK_CPPCHECK], -[ -if test -z "${nut_have_cppcheck_seen}"; then - dnl NOTE: Did not really investigate suitable CPPCHECK_MIN_VERSION - dnl values, just using current available as the baseline; maybe - dnl older releases are also okay (if someone proves so). - dnl The oldest available on the NUT CI build farm was 1.6 that worked. - nut_have_cppcheck_seen=yes - CPPCHECK_MIN_VERSION="1.0" - - AC_PATH_PROGS([CPPCHECK], [cppcheck]) - if test -n "${CPPCHECK}"; then - AC_MSG_CHECKING([for cppcheck version]) - CPPCHECK_VERSION="`${CPPCHECK} --version 2>/dev/null`" - dnl strip 'cppcheck ' from version string - CPPCHECK_VERSION="${CPPCHECK_VERSION##* }" - AC_MSG_RESULT(${CPPCHECK_VERSION} found) - fi - - AC_MSG_CHECKING([if cppcheck version is okay (minimum required ${CPPCHECK_MIN_VERSION})]) - AX_COMPARE_VERSION([${CPPCHECK_VERSION}], [ge], [${CPPCHECK_MIN_VERSION}], [ - AC_MSG_RESULT(yes) - nut_have_cppcheck="yes" - ], [ - AC_MSG_RESULT(no) - nut_have_cppcheck="no" - ]) - - dnl Notes: we also keep HAVE_CPPCHECK for implicit targets - AM_CONDITIONAL([HAVE_CPPCHECK], [test "${nut_have_cppcheck}" = "yes"]) -fi -]) diff --git a/m4/nut_check_headers_windows.m4 b/m4/nut_check_headers_windows.m4 deleted file mode 100644 index 6f30c92..0000000 --- a/m4/nut_check_headers_windows.m4 +++ /dev/null @@ -1,193 +0,0 @@ -dnl This code was lifted and adapted for NUT from cURL project: -dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L172 -dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L207 -dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L238 -dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L275 -dnl https://github.com/curl/curl/blob/83245d9ff352b742753cff1216781ff041e4e987/acinclude.m4#L312 - -dnl NUT_CHECK_HEADER_WINDOWS -dnl ------------------------------------------------- -dnl Check for compilable and valid windows.h header - -AC_DEFUN([NUT_CHECK_HEADER_WINDOWS], [ - AC_CACHE_CHECK([for windows.h], [nut_cv_header_windows_h], [ - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINDOWS_H shall not be defined. -#else - int dummy=2*WINVER; -#endif - ]]) - ],[ - nut_cv_header_windows_h="yes" - ],[ - nut_cv_header_windows_h="no" - ]) - AC_LANG_POP([C]) - ]) - case "$nut_cv_header_windows_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINDOWS_H, 1, - [Define to 1 if you have the windows.h header file.]) - ;; - esac -]) - - -dnl NUT_CHECK_NATIVE_WINDOWS -dnl ------------------------------------------------- -dnl Check if building a native Windows target - -AC_DEFUN([NUT_CHECK_NATIVE_WINDOWS], [ - AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([whether build target is a native Windows one], [nut_cv_native_windows], [ - if test "$nut_cv_header_windows_h" = "no"; then - nut_cv_native_windows="no" - else - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ - ]],[[ -#if defined(__MINGW32__) || defined(__MINGW32CE__) || \ - (defined(_MSC_VER) && (defined(_WIN32) || defined(_WIN64))) - int dummy=1; -#else - Not a native Windows build target. -#endif - ]]) - ],[ - nut_cv_native_windows="yes" - ],[ - nut_cv_native_windows="no" - ]) - AC_LANG_POP([C]) - fi - ]) - AM_CONDITIONAL(DOING_NATIVE_WINDOWS, test "x$nut_cv_native_windows" = xyes) -]) - - -dnl NUT_CHECK_HEADER_WINSOCK -dnl ------------------------------------------------- -dnl Check for compilable and valid winsock.h header - -AC_DEFUN([NUT_CHECK_HEADER_WINSOCK], [ - AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([for winsock.h], [nut_cv_header_winsock_h], [ - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) - HAVE_WINSOCK_H shall not be defined. -#else - int dummy=WSACleanup(); -#endif - ]]) - ],[ - nut_cv_header_winsock_h="yes" - ],[ - nut_cv_header_winsock_h="no" - ]) - AC_LANG_POP([C]) - ]) - case "$nut_cv_header_winsock_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK_H, 1, - [Define to 1 if you have the winsock.h header file.]) - ;; - esac -]) - - -dnl NUT_CHECK_HEADER_WINSOCK2 -dnl ------------------------------------------------- -dnl Check for compilable and valid winsock2.h header - -AC_DEFUN([NUT_CHECK_HEADER_WINSOCK2], [ - AC_REQUIRE([NUT_CHECK_HEADER_WINDOWS])dnl - AC_CACHE_CHECK([for winsock2.h], [nut_cv_header_winsock2_h], [ - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WINSOCK2_H shall not be defined. -#else - int dummy=2*IPPROTO_ESP; -#endif - ]]) - ],[ - nut_cv_header_winsock2_h="yes" - ],[ - nut_cv_header_winsock2_h="no" - ]) - AC_LANG_POP([C]) - ]) - case "$nut_cv_header_winsock2_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WINSOCK2_H, 1, - [Define to 1 if you have the winsock2.h header file.]) - ;; - esac -]) - - -dnl NUT_CHECK_HEADER_WS2TCPIP -dnl ------------------------------------------------- -dnl Check for compilable and valid ws2tcpip.h header - -AC_DEFUN([NUT_CHECK_HEADER_WS2TCPIP], [ - AC_REQUIRE([NUT_CHECK_HEADER_WINSOCK2])dnl - AC_CACHE_CHECK([for ws2tcpip.h], [nut_cv_header_ws2tcpip_h], [ - AC_LANG_PUSH([C]) - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([[ -#undef inline -#ifndef WIN32_LEAN_AND_MEAN -#define WIN32_LEAN_AND_MEAN -#endif -#include -#include -#include - ]],[[ -#if defined(__CYGWIN__) || defined(__CEGCC__) || defined(__MINGW32CE__) - HAVE_WS2TCPIP_H shall not be defined. -#else - int dummy=2*IP_PKTINFO; -#endif - ]]) - ],[ - nut_cv_header_ws2tcpip_h="yes" - ],[ - nut_cv_header_ws2tcpip_h="no" - ]) - AC_LANG_POP([C]) - ]) - case "$nut_cv_header_ws2tcpip_h" in - yes) - AC_DEFINE_UNQUOTED(HAVE_WS2TCPIP_H, 1, - [Define to 1 if you have the ws2tcpip.h header file.]) - ;; - esac -]) diff --git a/m4/nut_check_libavahi.m4 b/m4/nut_check_libavahi.m4 index d0c4989..034d31a 100644 --- a/m4/nut_check_libavahi.m4 +++ b/m4/nut_check_libavahi.m4 @@ -1,4 +1,4 @@ -dnl Check for LIBAVAHI compiler flags. On success, set nut_have_avahi="yes" +dnl Check for LIBAVAHI compiler flags. On success, set nut_have_neon="yes" dnl and set LIBAVAHI_CFLAGS and LIBAVAHI_LIBS. On failure, set dnl nut_have_avahi="no". This macro can be run multiple times, but will dnl do the checking only once. @@ -7,29 +7,25 @@ AC_DEFUN([NUT_CHECK_LIBAVAHI], [ if test -z "${nut_have_avahi_seen}"; then nut_have_avahi_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [dnl See which version of the avahi library (if any) is installed - AC_MSG_CHECKING(for avahi-core version via pkg-config (0.6.30 minimum required)) - AVAHI_CORE_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-core 2>/dev/null`" - if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then - AVAHI_CORE_VERSION="none" - fi - AC_MSG_RESULT(${AVAHI_CORE_VERSION} found) + dnl See which version of the avahi library (if any) is installed + AC_MSG_CHECKING(for avahi-core version via pkg-config (0.6.30 minimum required)) + AVAHI_CORE_VERSION="`pkg-config --silence-errors --modversion avahi-core 2>/dev/null`" + if test "$?" != "0" -o -z "${AVAHI_CORE_VERSION}"; then + AVAHI_CORE_VERSION="none" + fi + AC_MSG_RESULT(${AVAHI_CORE_VERSION} found) - AC_MSG_CHECKING(for avahi-client version via pkg-config (0.6.30 minimum required)) - AVAHI_CLIENT_VERSION="`$PKG_CONFIG --silence-errors --modversion avahi-client 2>/dev/null`" - if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then - AVAHI_CLIENT_VERSION="none" - fi - AC_MSG_RESULT(${AVAHI_CLIENT_VERSION} found) - ], [AC_MSG_NOTICE([can not check avahi settings via pkg-config])] - ) + AC_MSG_CHECKING(for avahi-client version via pkg-config (0.6.30 minimum required)) + AVAHI_CLIENT_VERSION="`pkg-config --silence-errors --modversion avahi-client 2>/dev/null`" + if test "$?" != "0" -o -z "${AVAHI_CLIENT_VERSION}"; then + AVAHI_CLIENT_VERSION="none" + fi + AC_MSG_RESULT(${AVAHI_CLIENT_VERSION} found) AC_MSG_CHECKING(for avahi cflags) AC_ARG_WITH(avahi-includes, @@ -43,12 +39,7 @@ if test -z "${nut_have_avahi_seen}"; then CFLAGS="${withval}" ;; esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags avahi-core avahi-client 2>/dev/null`" || CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"], - [CFLAGS="-I/usr/local/include -I/usr/include -L/usr/local/lib -L/usr/lib"] - )] - ) + ], [CFLAGS="`pkg-config --silence-errors --cflags avahi-core avahi-client 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for avahi ldflags) @@ -63,12 +54,7 @@ if test -z "${nut_have_avahi_seen}"; then LIBS="${withval}" ;; esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [LIBS="`$PKG_CONFIG --silence-errors --libs avahi-core avahi-client 2>/dev/null`" || LIBS="-lavahi-core -lavahi-client"], - [LIBS="-lavahi-core -lavahi-client"] - )] - ) + ], [LIBS="`pkg-config --silence-errors --libs avahi-core avahi-client 2>/dev/null`"]) AC_MSG_RESULT([${LIBS}]) dnl check if avahi-core is usable diff --git a/m4/nut_check_libfreeipmi.m4 b/m4/nut_check_libfreeipmi.m4 index 5fad0c6..5b2eae9 100644 --- a/m4/nut_check_libfreeipmi.m4 +++ b/m4/nut_check_libfreeipmi.m4 @@ -8,36 +8,25 @@ AC_DEFUN([NUT_CHECK_LIBFREEIPMI], [ if test -z "${nut_have_libfreeipmi_seen}"; then nut_have_libfreeipmi_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011 - dnl but NUT should only require 0.8.5 (for nut-scanner) and 1.0.1 (for - dnl nut-ipmipsu) (comment from upstream Al Chu) - AC_MSG_CHECKING(for FreeIPMI version via pkg-config) - FREEIPMI_VERSION="`$PKG_CONFIG --silence-errors --modversion libfreeipmi 2>/dev/null`" - if test "$?" != "0" -o -z "${FREEIPMI_VERSION}"; then - FREEIPMI_VERSION="none" - fi - AC_MSG_RESULT(${FREEIPMI_VERSION} found) - ], - [FREEIPMI_VERSION="none" - AC_MSG_NOTICE([can not check FreeIPMI settings via pkg-config]) - ] - ) - - AS_IF([test x"$FREEIPMI_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" - ], - [CFLAGS="" - LIBS="-lfreeipmi -lipmimonitoring" - ] - ) + AC_MSG_CHECKING(for FreeIPMI version via pkg-config) + dnl pkg-config support requires Freeipmi 1.0.5, released on Thu Jun 30 2011 + dnl but NUT should only require 0.8.5 (for nut-scanner) and 1.0.1 (for + dnl nut-ipmipsu) (comment from upstream Al Chu) + FREEIPMI_VERSION="`pkg-config --silence-errors --modversion libfreeipmi 2>/dev/null`" + if test "$?" = "0" -a -n "${FREEIPMI_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags libfreeipmi libipmimonitoring 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs libfreeipmi libipmimonitoring 2>/dev/null`" + else + FREEIPMI_VERSION="none" + CFLAGS="" + LIBS="-lfreeipmi -lipmimonitoring" + fi + AC_MSG_RESULT(${FREEIPMI_VERSION} found) dnl allow overriding FreeIPMI settings if the user knows best AC_MSG_CHECKING(for FreeIPMI cflags) diff --git a/m4/nut_check_libgd.m4 b/m4/nut_check_libgd.m4 index b6f58ef..01cc882 100644 --- a/m4/nut_check_libgd.m4 +++ b/m4/nut_check_libgd.m4 @@ -1,87 +1,44 @@ dnl Check for LIBGD compiler flags. On success, set nut_have_libgd="yes" dnl and set LIBGD_CFLAGS and LIBGD_LDFLAGS. On failure, set dnl nut_have_libgd="no". This macro can be run multiple times, but will -dnl do the checking only once. +dnl do the checking only once. -AC_DEFUN([NUT_CHECK_LIBGD], +AC_DEFUN([NUT_CHECK_LIBGD], [ if test -z "${nut_have_libgd_seen}"; then nut_have_libgd_seen=yes - NUT_CHECK_PKGCONFIG CFLAGS_ORIG="${CFLAGS}" LDFLAGS_ORIG="${LDFLAGS}" LIBS_ORIG="${LIBS}" + + dnl Initial defaults. These are only used if gdlib-config is + dnl unusable and the user fails to pass better values in --with + dnl arguments CFLAGS="" - LDFLAGS="" - LIBS="" + LDFLAGS="-L/usr/X11R6/lib" + LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING(for gd version via pkg-config) - GD_VERSION="`$PKG_CONFIG --silence-errors --modversion gdlib 2>/dev/null`" - if test "$?" != "0" -o -z "${GD_VERSION}"; then - GD_VERSION="none" - fi - AC_MSG_RESULT(${GD_VERSION} found) - ], - [GD_VERSION="none" - AC_MSG_NOTICE([can not check libgd settings via pkg-config]) - ] - ) + AC_MSG_CHECKING(for gd version via gdlib-config) + GD_VERSION=`gdlib-config --version 2>/dev/null` + if test "$?" != "0" -o -z "${GD_VERSION}"; then + GD_VERSION="none" + fi + AC_MSG_RESULT(${GD_VERSION} found) - AS_IF([test x"$GD_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags gdlib 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs gdlib 2>/dev/null`" - ], - [dnl Initial defaults. These are only used if gdlib-config is - dnl unusable and the user fails to pass better values in --with - dnl arguments - CFLAGS="" - LDFLAGS="-L/usr/X11R6/lib" - LIBS="-lgd -lpng -lz -ljpeg -lfreetype -lm -lXpm -lX11" - - dnl By default seek in PATH - AC_PATH_PROGS([GDLIB_CONFIG], [gdlib-config], [none]) - AC_ARG_WITH(gdlib-config, - AS_HELP_STRING([@<:@--with-gdlib-config=/path/to/gdlib-config@:>@], - [path to program that reports GDLIB configuration]), - [ - case "${withval}" in - "") ;; - yes|no) - AC_MSG_ERROR(invalid option --with(out)-gdlib-config - see docs/configure.txt) - ;; - *) - GDLIB_CONFIG="${withval}" - ;; - esac - ]) - - AS_IF([test x"$GDLIB_CONFIG" != xnone], - [AC_MSG_CHECKING(for gd version via ${GDLIB_CONFIG}) - GD_VERSION="`${GDLIB_CONFIG} --version 2>/dev/null`" - if test "$?" != "0" -o -z "${GD_VERSION}"; then - GD_VERSION="none" - fi - AC_MSG_RESULT(${GD_VERSION} found) - ], [GD_VERSION="none"] - ) - - case "${GD_VERSION}" in - none) - ;; - 2.0.5 | 2.0.6 | 2.0.7) - AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use ${GDLIB_CONFIG} script]]) - AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]]) - ;; - *) - CFLAGS="`${GDLIB_CONFIG} --includes 2>/dev/null`" - LDFLAGS="`${GDLIB_CONFIG} --ldflags 2>/dev/null`" - LIBS="`${GDLIB_CONFIG} --libs 2>/dev/null`" - ;; - esac - ] - ) + case "${GD_VERSION}" in + none) + ;; + 2.0.5 | 2.0.6 | 2.0.7) + AC_MSG_WARN([[gd ${GD_VERSION} detected, unable to use gdlib-config script]]) + AC_MSG_WARN([[If gd detection fails, upgrade gd or use --with-gd-includes and --with-gd-libs]]) + ;; + *) + CFLAGS="`gdlib-config --includes 2>/dev/null`" + LDFLAGS="`gdlib-config --ldflags 2>/dev/null`" + LIBS="`gdlib-config --libs 2>/dev/null`" + ;; + esac dnl Now allow overriding gd settings if the user knows best AC_MSG_CHECKING(for gd include flags) @@ -117,21 +74,7 @@ if test -z "${nut_have_libgd_seen}"; then dnl check if gd is usable AC_CHECK_HEADERS(gd.h gdfontmb.h, [nut_have_libgd=yes], [nut_have_libgd=no], [AC_INCLUDES_DEFAULT]) - AC_SEARCH_LIBS(gdImagePng, gd, [], [ - dnl If using pkg-config, query additionally for Libs.private - dnl to pull -L/usr/X11R6/lib or whatever current OS wants - AC_MSG_CHECKING([for more gd library flags]) - AS_IF([test -n "${with_gd_libs}" || test x"$have_PKG_CONFIG" != xyes], [nut_have_libgd=no], [ - _LIBS_PRIVATE="`$PKG_CONFIG --silence-errors --libs gdlib --static 2>/dev/null`" - AS_IF([test -z "${_LIBS_PRIVATE}"], [nut_have_libgd=no], [ - AC_MSG_CHECKING([with gdlib.pc Libs.private]) - LDFLAGS="$LDFLAGS $_LIBS_PRIVATE" - unset ac_cv_search_gdImagePng - AC_SEARCH_LIBS(gdImagePng, gd, [], [nut_have_libgd=no]) - ]) - unset _LIBS_PRIVATE - ]) - ]) + AC_SEARCH_LIBS(gdImagePng, gd, [], [nut_have_libgd=no]) if test "${nut_have_libgd}" = "yes"; then AC_DEFINE(HAVE_LIBGD, 1, [Define if you have Boutell's libgd installed]) diff --git a/m4/nut_check_libhal.m4 b/m4/nut_check_libhal.m4 new file mode 100644 index 0000000..ec54068 --- /dev/null +++ b/m4/nut_check_libhal.m4 @@ -0,0 +1,81 @@ +dnl Check for LIBHAL compiler flags. On success, set nut_have_libhal="yes" +dnl and set LIBHAL_CFLAGS and LIBHAL_LIBS. On failure, set +dnl nut_have_libhal="no". This macro can be run multiple times, but will +dnl do the checking only once. +dnl NUT requires HAL version 0.5.8 at least + +AC_DEFUN([NUT_CHECK_LIBHAL], +[ +if test -z "${nut_have_libhal_seen}"; then + nut_have_libhal_seen=yes + + CFLAGS_ORIG="${CFLAGS}" + LIBS_ORIG="${LIBS}" + + AC_MSG_CHECKING(for libhal version via pkg-config (0.5.8 minimum required)) + HAL_VERSION="`pkg-config --silence-errors --modversion hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_VERSION}"; then + AC_MSG_RESULT(none found) + elif pkg-config --silence-errors --atleast-version=0.5.8 hal 2>/dev/null; then + AC_MSG_RESULT(${HAL_VERSION} found) + else + AC_MSG_WARN(${HAL_VERSION} is too old) + fi + + AC_MSG_CHECKING(for libhal cflags) + AC_ARG_WITH(hal-includes, + AS_HELP_STRING([@<:@--with-hal-includes=CFLAGS@:>@], [include flags for the HAL library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac + ], [ + dnl also get cflags from glib-2.0 to workaround a bug in dbus-glib + CFLAGS="`pkg-config --silence-errors --cflags hal dbus-glib-1 2>/dev/null`" + if test "$?" != "0"; then + CFLAGS="-DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/hal -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include" + fi + ]) + AC_MSG_RESULT([${CFLAGS}]) + + AC_MSG_CHECKING(for libhal ldflags) + AC_ARG_WITH(hal-libs, + AS_HELP_STRING([@<:@--with-hal-libs=LIBS@:>@], [linker flags for the HAL library]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-libs - see docs/configure.txt) + ;; + *) + LIBS="${withval}" + ;; + esac + ], [ + dnl also get libs from glib-2.0 to workaround a bug in dbus-glib + LIBS="`pkg-config --silence-errors --libs hal dbus-glib-1 2>/dev/null`" + if test "$?" != "0"; then + LIBS="-lhal -ldbus-1 -lpthread" + fi + ]) + AC_MSG_RESULT([${LIBS}]) + + dnl check if HAL is usable + AC_CHECK_HEADERS(libhal.h, [nut_have_libhal=yes], [nut_have_libhal=no], [AC_INCLUDES_DEFAULT]) + AC_CHECK_HEADERS(glib.h dbus/dbus-glib.h, [], [nut_have_libhal=no], [AC_INCLUDES_DEFAULT]) + AC_CHECK_FUNCS(libhal_device_new_changeset, [], [nut_have_libhal=no]) + + if test "${nut_have_libhal}" = "yes"; then + AC_CHECK_FUNCS(g_timeout_add_seconds) + LIBHAL_CFLAGS="${CFLAGS}" + LIBHAL_LIBS="${LIBS}" + fi + + CFLAGS="${CFLAGS_ORIG}" + LIBS="${LIBS_ORIG}" +fi +]) diff --git a/m4/nut_check_libmodbus.m4 b/m4/nut_check_libmodbus.m4 deleted file mode 100644 index ea08dd3..0000000 --- a/m4/nut_check_libmodbus.m4 +++ /dev/null @@ -1,187 +0,0 @@ -dnl Check for LIBMODBUS compiler flags. On success, set nut_have_libmodbus="yes" -dnl and set LIBMODBUS_CFLAGS and LIBMODBUS_LIBS. On failure, set -dnl nut_have_libmodbus="no". This macro can be run multiple times, but will -dnl do the checking only once. - -AC_DEFUN([NUT_CHECK_LIBMODBUS], -[ -if test -z "${nut_have_libmodbus_seen}"; then - nut_have_libmodbus_seen=yes - - dnl save CFLAGS and LIBS - CFLAGS_ORIG="${CFLAGS}" - LIBS_ORIG="${LIBS}" - NUT_CHECK_PKGCONFIG - - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING(for libmodbus version via pkg-config) - LIBMODBUS_VERSION="`$PKG_CONFIG --silence-errors --modversion libmodbus 2>/dev/null`" - if test "$?" != "0" -o -z "${LIBMODBUS_VERSION}"; then - LIBMODBUS_VERSION="none" - fi - AC_MSG_RESULT(${LIBMODBUS_VERSION} found) - ], - [LIBMODBUS_VERSION="none" - AC_MSG_NOTICE([can not check libmodbus settings via pkg-config]) - ] - ) - - AS_IF([test x"$LIBMODBUS_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags libmodbus 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libmodbus 2>/dev/null`" - ], - [CFLAGS="-I/usr/include/modbus" - LIBS="-lmodbus" - ] - ) - - AC_MSG_CHECKING(for libmodbus cflags) - AC_ARG_WITH(modbus-includes, - AS_HELP_STRING([@<:@--with-modbus-includes=CFLAGS@:>@], [include flags for the libmodbus library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-modbus-includes - see docs/configure.txt) - ;; - *) - CFLAGS="${withval}" - ;; - esac - ], []) - AC_MSG_RESULT([${CFLAGS}]) - - AC_MSG_CHECKING(for libmodbus ldflags) - AC_ARG_WITH(modbus-libs, - AS_HELP_STRING([@<:@--with-modbus-libs=LIBS@:>@], [linker flags for the libmodbus library]), - [ - case "${withval}" in - yes|no) - AC_MSG_ERROR(invalid option --with(out)-modbus-libs - see docs/configure.txt) - ;; - *) - LIBS="${withval}" - ;; - esac - ], []) - AC_MSG_RESULT([${LIBS}]) - - dnl check if libmodbus is usable - AC_CHECK_HEADERS(modbus.h, [nut_have_libmodbus=yes], [nut_have_libmodbus=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(modbus_new_rtu, [], [nut_have_libmodbus=no]) - AC_CHECK_FUNCS(modbus_new_tcp, [], [nut_have_libmodbus=no]) - AC_CHECK_FUNCS(modbus_set_byte_timeout, [], [nut_have_libmodbus=no]) - AC_CHECK_FUNCS(modbus_set_response_timeout, [], [nut_have_libmodbus=no]) - - dnl modbus_set_byte_timeout() and modbus_set_response_timeout() - dnl in 3.0.x and 3.1.x have different args (since ~2013): the - dnl older version used to accept timeout as a struct timeval - dnl instead of seconds and microseconds. Detect which we use?.. - AS_IF([test x"$nut_have_libmodbus" = xyes], - [dnl Do not rely on versions if we can test actual API - AX_C_PRAGMAS - AC_LANG_PUSH([C]) - AC_CACHE_CHECK([types of arguments for modbus_set_byte_timeout], - [nut_cv_func_modbus_set_byte_timeout_args], - [nut_cv_func_modbus_set_byte_timeout_args="unknown" - AC_COMPILE_IFELSE( - [dnl Try purely the old API (timeval) - AC_LANG_PROGRAM([ -#include -#include -], [modbus_t *ctx; struct timeval to = (struct timeval){0}; -modbus_set_byte_timeout(ctx, &to);]) - ], [nut_cv_func_modbus_set_byte_timeout_args="timeval" - dnl Try the old API in more detail: check - dnl if we can just assign uint32's for new - dnl code into timeval fields (exist+numeric)? - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([ -#include -#include -#include -], [modbus_t *ctx; uint32_t to_sec = 10, to_usec = 50; -struct timeval to = (struct timeval){0}; -/* TODO: Clarify and detect warning names and - * so pragmas for signed/unsigned assignment (e.g. - * for timeval definitions that have "long" fields) - */ -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION -# pragma GCC diagnostic ignored "-Wsign-conversion" -#endif -to.tv_sec = to_sec; -to.tv_usec = to_usec; -modbus_set_byte_timeout(ctx, &to); -]) - ], [nut_cv_func_modbus_set_byte_timeout_args="timeval_numeric_fields"]) - ], - - [dnl Try another API variant: new API with - dnl fields of struct timeval as numbers - dnl (checks they exist, and are compatible - dnl numeric types so compiler can convert) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([ -#include -#include -#include -], [modbus_t *ctx; struct timeval to = (struct timeval){0}; -/* TODO: Clarify and detect warning names and - * so pragmas for signed/unsigned assignment (e.g. - * for timeval definitions that have "long" fields) - */ -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_COMPARE -# pragma GCC diagnostic ignored "-Wsign-compare" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_SIGN_CONVERSION -# pragma GCC diagnostic ignored "-Wsign-conversion" -#endif -uint32_t to_sec = to.tv_sec, to_usec = to.tv_usec; -modbus_set_byte_timeout(ctx, to_sec, to_usec); -]) - ], [nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32_cast_timeval_fields"], - [dnl Try another API variant: new API purely (two uint32's) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([ -#include -#include -], [modbus_t *ctx; uint32_t to_sec = 0, to_usec = 0; -modbus_set_byte_timeout(ctx, to_sec, to_usec);]) - ], [nut_cv_func_modbus_set_byte_timeout_args="sec_usec_uint32"]) - ]) - ]) - ]) - - dnl NOTE: We could add similar tests to above for - dnl other time-related methods, but for now keep - dnl it simple -- and assume some same approach - dnl applies to the same generation of the library. - AC_LANG_POP([C]) - AC_MSG_RESULT([Found types to use for modbus_set_byte_timeout: ${nut_cv_func_modbus_set_byte_timeout_args}]) - dnl NOTE: code should check for having a token name defined e.g.: - dnl #ifdef NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32 - dnl Alas, we can't pass variables as macro name to AC_DEFINE - COMMENT="Define to specify timeout method args approach for libmodbus" - AS_CASE(["${nut_cv_func_modbus_set_byte_timeout_args}"], - [timeval_numeric_fields], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_timeval_numeric_fields], 1, [${COMMENT}])], - [timeval], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_timeval], 1, [${COMMENT}])], - [sec_usec_uint32_cast_timeval_fields], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32_cast_timeval_fields], 1, [${COMMENT}])], - [sec_usec_uint32], [AC_DEFINE([NUT_MODBUS_TIMEOUT_ARG_sec_usec_uint32], 1, [${COMMENT}])], - [dnl default - AC_MSG_WARN([Cannot find proper types to use for modbus_set_byte_timeout]) - nut_have_libmodbus=no] - ) - ]) - - AS_IF([test x"${nut_have_libmodbus}" = x"yes"], - [LIBMODBUS_CFLAGS="${CFLAGS}" - LIBMODBUS_LIBS="${LIBS}"] - ) - - dnl restore original CFLAGS and LIBS - CFLAGS="${CFLAGS_ORIG}" - LIBS="${LIBS_ORIG}" -fi -]) diff --git a/m4/nut_check_libneon.m4 b/m4/nut_check_libneon.m4 index 944f7a3..4fd290b 100644 --- a/m4/nut_check_libneon.m4 +++ b/m4/nut_check_libneon.m4 @@ -7,27 +7,18 @@ AC_DEFUN([NUT_CHECK_LIBNEON], [ if test -z "${nut_have_neon_seen}"; then nut_have_neon_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [dnl See which version of the neon library (if any) is installed - dnl FIXME : Support detection of cflags/ldflags below by legacy - dnl discovery if pkgconfig is not there - AC_MSG_CHECKING(for libneon version via pkg-config (0.25.0 minimum required)) - NEON_VERSION="`$PKG_CONFIG --silence-errors --modversion neon 2>/dev/null`" - if test "$?" != "0" -o -z "${NEON_VERSION}"; then - NEON_VERSION="none" - fi - AC_MSG_RESULT(${NEON_VERSION} found) - ], - [NEON_VERSION="none" - AC_MSG_NOTICE([can not check libneon settings via pkg-config]) - ] - ) + dnl See which version of the neon library (if any) is installed + AC_MSG_CHECKING(for libneon version via pkg-config (0.25.0 minimum required)) + NEON_VERSION="`pkg-config --silence-errors --modversion neon 2>/dev/null`" + if test "$?" != "0" -o -z "${NEON_VERSION}"; then + NEON_VERSION="none" + fi + AC_MSG_RESULT(${NEON_VERSION} found) AC_MSG_CHECKING(for libneon cflags) AC_ARG_WITH(neon-includes, @@ -41,12 +32,7 @@ if test -z "${nut_have_neon_seen}"; then CFLAGS="${withval}" ;; esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags neon 2>/dev/null`" || CFLAGS="-I/usr/include/neon -I/usr/local/include/neon"], - [CFLAGS="-I/usr/include/neon -I/usr/local/include/neon"] - )] - ) + ], [CFLAGS="`pkg-config --silence-errors --cflags neon 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for libneon ldflags) @@ -61,12 +47,7 @@ if test -z "${nut_have_neon_seen}"; then LIBS="${withval}" ;; esac - ], [ - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [LIBS="`$PKG_CONFIG --silence-errors --libs neon 2>/dev/null`" || LIBS="-lneon"], - [LIBS="-lneon"] - )] - ) + ], [LIBS="`pkg-config --silence-errors --libs neon 2>/dev/null`"]) AC_MSG_RESULT([${LIBS}]) dnl check if neon is usable diff --git a/m4/nut_check_libnetsnmp.m4 b/m4/nut_check_libnetsnmp.m4 index 1f89b5a..e1c1426 100644 --- a/m4/nut_check_libnetsnmp.m4 +++ b/m4/nut_check_libnetsnmp.m4 @@ -1,83 +1,25 @@ dnl Check for LIBNETSNMP compiler flags. On success, set dnl nut_have_libnetsnmp="yes" and set LIBNETSNMP_CFLAGS and dnl LIBNETSNMP_LIBS. On failure, set nut_have_libnetsnmp="no". -dnl This macro can be run multiple times, but will do the -dnl checking only once. +dnl This macro can be run multiple times, but will do the checking only +dnl once. AC_DEFUN([NUT_CHECK_LIBNETSNMP], [ if test -z "${nut_have_libnetsnmp_seen}"; then nut_have_libnetsnmp_seen=yes - NUT_CHECK_PKGCONFIG - AC_LANG_PUSH([C]) dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - dnl We prefer to get info from pkg-config (for suitable arch/bitness as - dnl specified in args for that mechanism), unless (legacy) a particular - dnl --with-net-snmp-config=... was requested. If there is no pkg-config - dnl info, we fall back to detecting and running a NET_SNMP_CONFIG as well. - - dnl By default seek in PATH, but which variant (if several are provided)? - AC_CHECK_SIZEOF([void *]) - NET_SNMP_CONFIG="none" - AS_CASE(["${ac_cv_sizeof_void_p}"], - [4],[AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config-32 net-snmp-config], [none])], - [8],[AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config-64 net-snmp-config], [none])], - [AC_PATH_PROGS([NET_SNMP_CONFIG], [net-snmp-config], [none])] - ) - - prefer_NET_SNMP_CONFIG=false - AC_ARG_WITH(net-snmp-config, - AS_HELP_STRING([@<:@--with-net-snmp-config=/path/to/net-snmp-config@:>@], - [path to program that reports Net-SNMP configuration]), - [ - case "${withval}" in - ""|yes) prefer_NET_SNMP_CONFIG=true ;; - no) - dnl AC_MSG_ERROR(invalid option --with(out)-net-snmp-config - see docs/configure.txt) - prefer_NET_SNMP_CONFIG=false - ;; - *) - NET_SNMP_CONFIG="${withval}" - prefer_NET_SNMP_CONFIG=true - ;; - esac - ]) - - if test x"$have_PKG_CONFIG" = xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then - AC_MSG_CHECKING(for Net-SNMP version via pkg-config) - dnl TODO? Loop over possible/historic pkg names, like - dnl netsnmp, net-snmp, ucd-snmp, libsnmp, snmp... - SNMP_VERSION="`$PKG_CONFIG --silence-errors --modversion netsnmp 2>/dev/null`" - if test "$?" = "0" -a -n "${SNMP_VERSION}" ; then - AC_MSG_RESULT(${SNMP_VERSION} found) - else - AC_MSG_RESULT(none found) - prefer_NET_SNMP_CONFIG=true - fi - fi - - if test "$NET_SNMP_CONFIG" = none ; then - prefer_NET_SNMP_CONFIG=false - fi - - if "${prefer_NET_SNMP_CONFIG}" ; then - dnl See which version of the Net-SNMP library (if any) is installed - AC_MSG_CHECKING(for Net-SNMP version via ${NET_SNMP_CONFIG}) - SNMP_VERSION="`${NET_SNMP_CONFIG} --version 2>/dev/null`" - if test "$?" != "0" -o -z "${SNMP_VERSION}"; then - SNMP_VERSION="none" - prefer_NET_SNMP_CONFIG=false - fi - AC_MSG_RESULT(${SNMP_VERSION} found) - fi - - if test x"$have_PKG_CONFIG" != xyes && ! "${prefer_NET_SNMP_CONFIG}" ; then - AC_MSG_WARN([did not find either net-snmp-config or pkg-config for net-snmp]) + dnl See which version of the Net-SNMP library (if any) is installed + AC_MSG_CHECKING(for Net-SNMP version via net-snmp-config) + SNMP_VERSION=`net-snmp-config --version 2>/dev/null` + if test "$?" != "0" -o -z "${SNMP_VERSION}"; then + SNMP_VERSION="none" fi + AC_MSG_RESULT(${SNMP_VERSION} found) AC_MSG_CHECKING(for Net-SNMP cflags) AC_ARG_WITH(snmp-includes, @@ -91,13 +33,7 @@ if test -z "${nut_have_libnetsnmp_seen}"; then CFLAGS="${withval}" ;; esac - ], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], - [CFLAGS="`${NET_SNMP_CONFIG} --base-cflags 2>/dev/null`"], - [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags netsnmp 2>/dev/null`"] - )] - )] - ) + ], [CFLAGS="`net-snmp-config --base-cflags 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for Net-SNMP libs) @@ -112,211 +48,17 @@ if test -z "${nut_have_libnetsnmp_seen}"; then LIBS="${withval}" ;; esac - ], [AS_IF(["${prefer_NET_SNMP_CONFIG}"], - [LIBS="`${NET_SNMP_CONFIG} --libs 2>/dev/null`"], - [AS_IF([test x"$have_PKG_CONFIG" = xyes], - [LIBS="`$PKG_CONFIG --silence-errors --libs netsnmp 2>/dev/null`"], - [LIBS="-lnetsnmp"])] - )] - ) + ], [LIBS="`net-snmp-config --libs 2>/dev/null`"]) AC_MSG_RESULT([${LIBS}]) dnl Check if the Net-SNMP library is usable AC_CHECK_HEADERS(net-snmp/net-snmp-config.h, [nut_have_libnetsnmp=yes], [nut_have_libnetsnmp=no], [AC_INCLUDES_DEFAULT]) AC_CHECK_FUNCS(init_snmp, [], [nut_have_libnetsnmp=no]) - AS_IF([test "${nut_have_libnetsnmp}" = "yes"], [ + if test "${nut_have_libnetsnmp}" = "yes"; then LIBNETSNMP_CFLAGS="${CFLAGS}" LIBNETSNMP_LIBS="${LIBS}" - - AC_MSG_CHECKING([for defined usmAESPrivProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmAESPrivProtocol; -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmAES128PrivProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmAES128PrivProtocol; -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmDESPrivProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmDESPrivProtocol; -#ifdef NETSNMP_DISABLE_DES -#error "NETSNMP_DISABLE_DES is defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmHMAC256SHA384AuthProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmHMAC256SHA384AuthProtocol; -#ifndef HAVE_EVP_SHA384 -#error "HAVE_EVP_SHA384 is NOT defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmHMAC384SHA512AuthProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmHMAC384SHA512AuthProtocol; -#ifndef HAVE_EVP_SHA384 -#error "HAVE_EVP_SHA384 is NOT defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmHMAC192SHA256AuthProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmHMAC192SHA256AuthProtocol; -#ifndef HAVE_EVP_SHA224 -#error "HAVE_EVP_SHA224 is NOT defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmAES192PrivProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmAES192PrivProtocol; -#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04 -#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmAES256PrivProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmAES256PrivProtocol; -#ifndef NETSNMP_DRAFT_BLUMENTHAL_AES_04 -#error "NETSNMP_DRAFT_BLUMENTHAL_AES_04 is NOT defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmHMACMD5AuthProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmHMACMD5AuthProtocol; -#ifdef NETSNMP_DISABLE_MD5 -#error "NETSNMP_DISABLE_MD5 is defined" -#endif -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined usmHMACSHA1AuthProtocol]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -oid * pProto = usmHMACSHA1AuthProtocol; -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol, 0, [Variable or macro by this name is not resolvable]) - ]) - - AC_MSG_CHECKING([for defined NETSNMP_DRAFT_BLUMENTHAL_AES_04]) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ -#include -#include -int num = NETSNMP_DRAFT_BLUMENTHAL_AES_04 + 1; /* if defined, NETSNMP_DRAFT_BLUMENTHAL_AES_04 is 1 */ -], -[] - )], - [AC_MSG_RESULT([yes]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04, 1, [Variable or macro by this name is resolvable]) - ], - [AC_MSG_RESULT([no]) - AC_DEFINE_UNQUOTED(NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04, 0, [Variable or macro by this name is not resolvable]) - ]) - - ]) - AC_LANG_POP([C]) + fi dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" diff --git a/m4/nut_check_libnss.m4 b/m4/nut_check_libnss.m4 index 54833d7..4adc913 100644 --- a/m4/nut_check_libnss.m4 +++ b/m4/nut_check_libnss.m4 @@ -3,50 +3,26 @@ dnl nut_have_libnss="yes" and nut_ssl_lib="Mozilla NSS", and define WITH_SSL, dnl WITH_NSS, LIBSSL_CFLAGS and LIBSSL_LIBS. On failure, set nut_have_libnss="no". dnl This macro can be run multiple times, but will do the checking only once. -AC_DEFUN([NUT_CHECK_LIBNSS], +AC_DEFUN([NUT_CHECK_LIBNSS], [ if test -z "${nut_have_libnss_seen}"; then nut_have_libnss_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - SAVED_GCC="$GCC" - SAVED_CC="$CC" - if ( test "${GCC}" = "yes" ) - then - case "$CFLAGS$LDFLAGS" in - *-m32*) CC="$CC -m32" ;; - *-m64*) CC="$CC -m64" ;; - esac + AC_MSG_CHECKING(for Mozilla NSS version via pkg-config) + NSS_VERSION="`pkg-config --silence-errors --modversion nss 2>/dev/null`" + if test "$?" = "0" -a -n "${NSS_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags nss 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs nss 2>/dev/null`" + else + NSS_VERSION="none" + CFLAGS="" + LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" fi - - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING(for Mozilla NSS version via pkg-config) - NSS_VERSION="`$PKG_CONFIG --silence-errors --modversion nss 2>/dev/null`" - if test "$?" != "0" -o -z "${NSS_VERSION}"; then - NSS_VERSION="none" - fi - AC_MSG_RESULT(${NSS_VERSION} found) - ], - [NSS_VERSION="none" - AC_MSG_NOTICE([can not check libnss settings via pkg-config]) - ] - ) - - AS_IF([test x"$NSS_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags nss 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs nss 2>/dev/null`" - REQUIRES="nss" - ], - [CFLAGS="" - LIBS="-lnss3 -lnssutil3 -lsmime3 -lssl3 -lplds4 -lplc4 -lnspr4" - REQUIRES="nss" - ] - ) + AC_MSG_RESULT(${NSS_VERSION} found) dnl allow overriding NSS settings if the user knows best AC_MSG_CHECKING(for Mozilla NSS cflags) @@ -79,15 +55,10 @@ if test -z "${nut_have_libnss_seen}"; then ], []) AC_MSG_RESULT([${LIBS}]) - dnl check if NSS is usable: we need both the runtime and headers - dnl NOTE that caller may have to specify PKG_CONFIG_PATH including - dnl their bitness variant if it is not prioritized in their default - dnl setting built in by OS distribution; the .../pkgconfig/nss.pc - dnl tends to specify the libdir which is CPU Arch dependent. - AC_CHECK_FUNCS(NSS_Init, [nut_have_libnss=yes], [nut_have_libnss=no]) - dnl libc6 also provides an nss.h file, so also check for ssl.h - AC_CHECK_HEADERS([nss.h ssl.h], [], [nut_have_libnss=no], [AC_INCLUDES_DEFAULT]) - + dnl check if NSS is usable + AC_CHECK_HEADERS(nss.h, [nut_have_libnss=yes], [nut_have_libnss=no], [AC_INCLUDES_DEFAULT]) + AC_CHECK_FUNCS(NSS_Init, [], [nut_have_libnss=no]) + if test "${nut_have_libnss}" = "yes"; then nut_with_ssl="yes" nut_ssl_lib="(Mozilla NSS)" @@ -95,14 +66,10 @@ if test -z "${nut_have_libnss_seen}"; then AC_DEFINE(WITH_NSS, 1, [Define to enable SSL support using Mozilla NSS]) LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" - GCC="$SAVED_GCC" - CC="$SAVED_CC" fi ]) diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 index d493615..1b87507 100644 --- a/m4/nut_check_libopenssl.m4 +++ b/m4/nut_check_libopenssl.m4 @@ -8,36 +8,22 @@ AC_DEFUN([NUT_CHECK_LIBOPENSSL], [ if test -z "${nut_have_libopenssl_seen}"; then nut_have_libopenssl_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - REQUIRES_ORIG="${REQUIRES}" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING(for OpenSSL version via pkg-config) - OPENSSL_VERSION="`$PKG_CONFIG --silence-errors --modversion openssl 2>/dev/null`" - if test "$?" != "0" -o -z "${OPENSSL_VERSION}"; then - OPENSSL_VERSION="none" - fi - AC_MSG_RESULT(${OPENSSL_VERSION} found) - ], - [OPENSSL_VERSION="none" - AC_MSG_NOTICE([can not check OpenSSL settings via pkg-config]) - ] - ) - - AS_IF([test x"$OPENSSL_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags openssl 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs openssl 2>/dev/null`" - REQUIRES="openssl" - ], - [CFLAGS="" - LIBS="-lssl -lcrypto" - REQUIRES="openssl" - ] - ) + AC_MSG_CHECKING(for OpenSSL version via pkg-config) + OPENSSL_VERSION="`pkg-config --silence-errors --modversion openssl 2>/dev/null`" + if test "$?" = "0" -a -n "${OPENSSL_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags openssl 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs openssl 2>/dev/null`" + else + OPENSSL_VERSION="none" + CFLAGS="" + LIBS="-lssl -lcrypto" + fi + AC_MSG_RESULT(${OPENSSL_VERSION} found) dnl allow overriding OpenSSL settings if the user knows best AC_MSG_CHECKING(for OpenSSL cflags) @@ -72,7 +58,7 @@ if test -z "${nut_have_libopenssl_seen}"; then dnl check if openssl is usable AC_CHECK_HEADERS(openssl/ssl.h, [nut_have_openssl=yes], [nut_have_openssl=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(SSL_CTX_new, [], [nut_have_openssl=no]) + AC_CHECK_FUNCS(SSL_library_init, [], [nut_have_openssl=no]) if test "${nut_have_openssl}" = "yes"; then nut_with_ssl="yes" @@ -81,12 +67,10 @@ if test -z "${nut_have_libopenssl_seen}"; then AC_DEFINE(WITH_OPENSSL, 1, [Define to enable SSL support using OpenSSL]) LIBSSL_CFLAGS="${CFLAGS}" LIBSSL_LIBS="${LIBS}" - LIBSSL_REQUIRES="${REQUIRES}" fi dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" - REQUIRES="${REQUIRES_ORIG}" fi ]) diff --git a/m4/nut_check_libpowerman.m4 b/m4/nut_check_libpowerman.m4 index b731cfe..a29afed 100644 --- a/m4/nut_check_libpowerman.m4 +++ b/m4/nut_check_libpowerman.m4 @@ -7,53 +7,24 @@ AC_DEFUN([NUT_CHECK_LIBPOWERMAN], [ if test -z "${nut_have_libpowerman_seen}"; then nut_have_libpowerman_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING([for LLNC libpowerman version via pkg-config]) - POWERMAN_VERSION="`$PKG_CONFIG --silence-errors --modversion libpowerman 2>/dev/null`" - dnl Unlike other pkg-config enabled projects we use, - dnl libpowerman (at least on Debian) delivers an empty - dnl "Version:" tag in /usr/lib/pkgconfig/libpowerman.pc - dnl (and it is the only file in that dir, others going - dnl to /usr/lib/x86_64-linux-gnu/pkgconfig/ or similar - dnl for other architectures). Empty is not an error here! - if test "$?" != "0" ; then # -o -z "${POWERMAN_VERSION}"; then - POWERMAN_VERSION="none" - fi - AC_MSG_RESULT(['${POWERMAN_VERSION}' found]) - ], - [POWERMAN_VERSION="none" - AC_MSG_NOTICE([can not check LLNC libpowerman settings via pkg-config]) - ] - ) - - AS_IF([test x"$POWERMAN_VERSION" != xnone], - [CFLAGS="`$PKG_CONFIG --silence-errors --cflags libpowerman 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libpowerman 2>/dev/null`" - ], - [CFLAGS="" - LIBS="" - ] - ) - - AC_MSG_CHECKING([for libpowerman cflags]) + AC_MSG_CHECKING(for libpowerman cflags) AC_ARG_WITH(powerman-includes, AS_HELP_STRING([@<:@--with-powerman-includes=CFLAGS@:>@], [include flags for the libpowerman library]), [ case "${withval}" in yes|no) - AC_MSG_ERROR([invalid option --with(out)-powerman-includes - see docs/configure.txt]) + AC_MSG_ERROR(invalid option --with(out)-powerman-includes - see docs/configure.txt) ;; *) CFLAGS="${withval}" ;; esac - ], []) + ], [CFLAGS="`pkg-config --silence-errors --cflags libpowerman 2>/dev/null`"]) AC_MSG_RESULT([${CFLAGS}]) AC_MSG_CHECKING(for libpowerman libs) @@ -68,23 +39,12 @@ if test -z "${nut_have_libpowerman_seen}"; then LIBS="${withval}" ;; esac - ], []) + ], [LIBS="`pkg-config --silence-errors --libs libpowerman 2>/dev/null`"]) AC_MSG_RESULT([${LIBS}]) dnl check if libpowerman is usable AC_CHECK_HEADERS(libpowerman.h, [nut_have_libpowerman=yes], [nut_have_libpowerman=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(pm_connect, [], [ - dnl Some systems may just have libpowerman in their - dnl standard paths, but not the pkg-config data - AS_IF([test "${nut_have_libpowerman}" = "yes" && test "$POWERMAN_VERSION" = "none" && test -z "$LIBS"], - [AC_MSG_CHECKING([if libpowerman is just present in path]) - LIBS="-L/usr/lib -L/usr/local/lib -lpowerman" - unset ac_cv_func_pm_connect || true - AC_CHECK_FUNCS(pm_connect, [], [nut_have_libpowerman=no]) - AC_MSG_RESULT([${nut_have_libpowerman}]) - ], [nut_have_libpowerman=no] - )] - ) + AC_CHECK_FUNCS(pm_connect, [], [nut_have_libpowerman=no]) if test "${nut_have_libpowerman}" = "yes"; then LIBPOWERMAN_CFLAGS="${CFLAGS}" diff --git a/m4/nut_check_libusb.m4 b/m4/nut_check_libusb.m4 index 89f7a02..b2bb0ab 100644 --- a/m4/nut_check_libusb.m4 +++ b/m4/nut_check_libusb.m4 @@ -1,173 +1,48 @@ -dnl Check for LIBUSB 1.0 or 0.1 (and, if found, fill 'nut_usb_lib' with its -dnl approximate version) and its compiler flags. On success, set -dnl nut_have_libusb="yes" and set LIBUSB_CFLAGS and LIBUSB_LIBS. On failure, set +dnl Check for LIBUSB compiler flags. On success, set nut_have_libusb="yes" +dnl and set LIBUSB_CFLAGS and LIBUSB_LIBS. On failure, set dnl nut_have_libusb="no". This macro can be run multiple times, but will dnl do the checking only once. -dnl By default, if both libusb 1.0 and libusb 0.1 are available and appear to be -dnl usable, libusb 1.0 takes precedence. -dnl An optional argument with value 'libusb-1.0' or 'libusb-0.1' can be used to -dnl restrict checks to a specific version. AC_DEFUN([NUT_CHECK_LIBUSB], [ if test -z "${nut_have_libusb_seen}"; then nut_have_libusb_seen=yes - NUT_CHECK_PKGCONFIG dnl save CFLAGS and LIBS CFLAGS_ORIG="${CFLAGS}" LIBS_ORIG="${LIBS}" - CFLAGS="" - LIBS="" - dnl Magic-format string to hold chosen libusb version and its config-source - nut_usb_lib="" - - dnl TOTHINK: What if there are more than 0.1 and 1.0 to juggle? - dnl TODO? Add libusb-compat (1.0 code with 0.1's API) to the mix? - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_CHECKING([for libusb-1.0 version via pkg-config]) - LIBUSB_1_0_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb-1.0 2>/dev/null`" \ - && test -n "${LIBUSB_1_0_VERSION}" \ - || LIBUSB_1_0_VERSION="none" - AC_MSG_RESULT([${LIBUSB_1_0_VERSION} found]) - - AC_MSG_CHECKING([for libusb(-0.1) version via pkg-config]) - LIBUSB_0_1_VERSION="`$PKG_CONFIG --silence-errors --modversion libusb 2>/dev/null`" \ - && test -n "${LIBUSB_0_1_VERSION}" \ - || LIBUSB_0_1_VERSION="none" - AC_MSG_RESULT([${LIBUSB_0_1_VERSION} found]) - ], - [LIBUSB_0_1_VERSION="none" - LIBUSB_1_0_VERSION="none" - AC_MSG_NOTICE([can not check libusb settings via pkg-config]) - ] - ) - - dnl Note: it seems the script was only shipped for libusb-0.1 - dnl So we don't separate into LIBUSB_0_1_CONFIG and LIBUSB_1_0_CONFIG - AC_PATH_PROGS([LIBUSB_CONFIG], [libusb-config], [none]) - - AC_ARG_WITH(libusb-config, - AS_HELP_STRING([@<:@--with-libusb-config=/path/to/libusb-config@:>@], - [path to program that reports LibUSB configuration]), dnl ...for LibUSB-0.1 - [ - AS_CASE(["${withval}"], - [""], [], dnl empty arg - [yes|no], [ - dnl MAYBE bump preference of script over pkg-config? - AC_MSG_ERROR([invalid option --with(out)-libusb-config - see docs/configure.txt]) - ], - [dnl default - LIBUSB_CONFIG="${withval}" - ] - ) - ] - ) - - AS_IF([test x"${LIBUSB_CONFIG}" != xnone], - [AC_MSG_CHECKING([via ${LIBUSB_CONFIG}]) - LIBUSB_CONFIG_VERSION="`$LIBUSB_CONFIG --version 2>/dev/null`" \ - && test -n "${LIBUSB_CONFIG_VERSION}" \ - || LIBUSB_CONFIG_VERSION="none" - AC_MSG_RESULT([${LIBUSB_CONFIG_VERSION} found]) - ], [LIBUSB_CONFIG_VERSION="none"] - ) - - dnl By default, prefer newest available, and if anything is known - dnl to pkg-config, prefer that. Otherwise, fall back to script data: - AS_IF([test x"${LIBUSB_1_0_VERSION}" != xnone], - [LIBUSB_VERSION="${LIBUSB_1_0_VERSION}" - nut_usb_lib="(libusb-1.0)" - ], - [AS_IF([test x"${LIBUSB_0_1_VERSION}" != xnone], - [LIBUSB_VERSION="${LIBUSB_0_1_VERSION}" - nut_usb_lib="(libusb-0.1)" - ], - [LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}" - AS_IF([test x"${LIBUSB_CONFIG_VERSION}" != xnone], - [dnl TODO: This assumes 0.1; check for 1.0+ somehow? - nut_usb_lib="(libusb-0.1-config)"], - [nut_usb_lib=""] - )] - )] - ) - - dnl Pick up the default or caller-provided choice here from - dnl NUT_ARG_WITH(usb, ...) in the main configure.ac script - AC_MSG_CHECKING([for libusb preferred version]) - AS_CASE(["${nut_with_usb}"], - [auto], [], dnl Use preference picked above - [yes], [], dnl Use preference from above, fail in the end if none found - [no], [], dnl Try to find, report in the end if that is discarded; TODO: not waste time? - [libusb-1.0|1.0], [ - dnl NOTE: Assuming there is no libusb-config-1.0 or similar script, never saw one - AS_IF([test x"${LIBUSB_1_0_VERSION}" = xnone], - [AC_MSG_ERROR([option --with-usb=${withval} was required, but this library version was not detected]) - ]) - LIBUSB_VERSION="${LIBUSB_1_0_VERSION}" - nut_usb_lib="(libusb-1.0)" - ], - [libusb-0.1|0.1], [ - AS_IF([test x"${LIBUSB_0_1_VERSION}" = xnone \ - && test x"${LIBUSB_CONFIG_VERSION}" = xnone], - [AC_MSG_ERROR([option --with-usb=${withval} was required, but this library version was not detected]) - ]) - AS_IF([test x"${LIBUSB_0_1_VERSION}" != xnone], - [LIBUSB_VERSION="${LIBUSB_0_1_VERSION}" - nut_usb_lib="(libusb-0.1)" - ], - [LIBUSB_VERSION="${LIBUSB_CONFIG_VERSION}" - nut_usb_lib="(libusb-0.1-config)" - ]) - ], - [dnl default - AC_MSG_ERROR([invalid option value --with-usb=${withval} - see docs/configure.txt]) - ] - ) - AC_MSG_RESULT([${LIBUSB_VERSION} ${nut_usb_lib}]) - - AS_IF([test x"${LIBUSB_1_0_VERSION}" != xnone && test x"${nut_usb_lib}" != x"(libusb-1.0)" ], - [AC_MSG_NOTICE([libusb-1.0 support was detected, but another was chosen ${nut_usb_lib}])] - ) - - dnl FIXME? Detect and report all CFLAGS/LIBS that we can, - dnl and *then* pick one set of values to use? - AS_CASE([${nut_usb_lib}], - ["(libusb-1.0)"], [ - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb-1.0 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libusb-1.0 2>/dev/null`" - ], - ["(libusb-0.1)"], [ - CFLAGS="`$PKG_CONFIG --silence-errors --cflags libusb 2>/dev/null`" - LIBS="`$PKG_CONFIG --silence-errors --libs libusb 2>/dev/null`" - ], - ["(libusb-0.1-config)"], [ - CFLAGS="`$LIBUSB_CONFIG --cflags 2>/dev/null`" - LIBS="`$LIBUSB_CONFIG --libs 2>/dev/null`" - ], - [dnl default, for other versions or "none" - AC_MSG_WARN([Defaulting libusb configuration]) + AC_MSG_CHECKING(for libusb version via pkg-config) + LIBUSB_VERSION="`pkg-config --silence-errors --modversion libusb 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then + CFLAGS="`pkg-config --silence-errors --cflags libusb 2>/dev/null`" + LIBS="`pkg-config --silence-errors --libs libusb 2>/dev/null`" + else + AC_MSG_CHECKING(via libusb-config) + LIBUSB_VERSION="`libusb-config --version 2>/dev/null`" + if test "$?" = "0" -a -n "${LIBUSB_VERSION}"; then + CFLAGS="`libusb-config --cflags 2>/dev/null`" + LIBS="`libusb-config --libs 2>/dev/null`" + else LIBUSB_VERSION="none" CFLAGS="" LIBS="-lusb" - ] - ) + fi + fi + AC_MSG_RESULT(${LIBUSB_VERSION} found) - dnl check optional user-provided values for cflags/ldflags - dnl and publish what we end up using AC_MSG_CHECKING(for libusb cflags) AC_ARG_WITH(usb-includes, AS_HELP_STRING([@<:@--with-usb-includes=CFLAGS@:>@], [include flags for the libusb library]), [ - AS_CASE(["${withval}"], - [yes|no], [ - AC_MSG_ERROR(invalid option --with(out)-usb-includes - see docs/configure.txt) - ], - [dnl default - CFLAGS="${withval}" - ] - ) + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-usb-includes - see docs/configure.txt) + ;; + *) + CFLAGS="${withval}" + ;; + esac ], []) AC_MSG_RESULT([${CFLAGS}]) @@ -175,159 +50,28 @@ if test -z "${nut_have_libusb_seen}"; then AC_ARG_WITH(usb-libs, AS_HELP_STRING([@<:@--with-usb-libs=LIBS@:>@], [linker flags for the libusb library]), [ - AS_CASE(["${withval}"], - [yes|no], [ - AC_MSG_ERROR(invalid option --with(out)-usb-libs - see docs/configure.txt) - ], - [dnl default - LIBS="${withval}" - ] - ) + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-usb-libs - see docs/configure.txt) + ;; + *) + LIBS="${withval}" + ;; + esac ], []) AC_MSG_RESULT([${LIBS}]) - dnl TODO: Consult chosen nut_usb_lib value and/or nut_with_usb argument - dnl (with "auto" we may use a 0.1 if present and working while a 1.0 is - dnl present but useless) - dnl Check if libusb is usable - AC_LANG_PUSH([C]) - if test -n "${LIBUSB_VERSION}"; then - dnl Test specifically for libusb-1.0 via pkg-config, else fall back below - test -n "$PKG_CONFIG" \ - && test x"${nut_usb_lib}" = x"(libusb-1.0)" \ - && $PKG_CONFIG --silence-errors --atleast-version=1.0 libusb-1.0 2>/dev/null - if test "$?" = "0"; then - dnl libusb 1.0: libusb_set_auto_detach_kernel_driver - AC_CHECK_HEADERS(libusb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(libusb_init, [], [nut_have_libusb=no]) - AC_CHECK_FUNCS(libusb_strerror, [], [nut_have_libusb=no; nut_have_libusb_strerror=no]) - if test "${nut_have_libusb_strerror}" = "no"; then - AC_MSG_WARN([libusb_strerror() not found; install libusbx to use libusb 1.0 API. See https://github.com/networkupstools/nut/issues/509]) - fi - if test "${nut_have_libusb}" = "yes"; then - dnl This function is fairly old, but check for it anyway: - AC_CHECK_FUNCS(libusb_kernel_driver_active) - dnl Check for libusb "force driver unbind" availability - AC_CHECK_FUNCS(libusb_set_auto_detach_kernel_driver) - dnl libusb 1.0: libusb_detach_kernel_driver - dnl FreeBSD 10.1-10.3 have this, but not libusb_set_auto_detach_kernel_driver - AC_CHECK_FUNCS(libusb_detach_kernel_driver) - AC_CHECK_FUNCS(libusb_detach_kernel_driver_np) + dnl check if libusb is usable + AC_CHECK_HEADERS(usb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT]) + AC_CHECK_FUNCS(usb_init, [], [nut_have_libusb=no]) - dnl From libusb-0.1 - check these to have valid config.h definitions - dnl Note: confusingly, FreeBSD does find both as defined - dnl (despite being spread across usb.h and libusb.h), - dnl so our source code has to care :\ - AC_CHECK_FUNCS(usb_detach_kernel_driver_np) - fi - else - dnl libusb 0.1, or missing pkg-config : - AC_CHECK_HEADERS(usb.h, [nut_have_libusb=yes], [nut_have_libusb=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(usb_init, [], [ - dnl Some systems may just have libusb in their standard - dnl paths, but not the pkg-config or libusb-config data - AS_IF([test "${nut_have_libusb}" = "yes" && test "$LIBUSB_VERSION" = "none" && test -z "$LIBS"], - [AC_MSG_CHECKING([if libusb is just present in path]) - LIBS="-L/usr/lib -L/usr/local/lib -lusb" - unset ac_cv_func_usb_init || true - AC_CHECK_FUNCS(usb_init, [], [nut_have_libusb=no]) - AC_MSG_RESULT([${nut_have_libusb}]) - ], [nut_have_libusb=no] - )] - ) - dnl Check for libusb "force driver unbind" availability - if test "${nut_have_libusb}" = "yes"; then - AC_CHECK_FUNCS(usb_detach_kernel_driver_np) - - dnl From libusb-1.0 - check these to have valid config.h definitions - AC_CHECK_FUNCS(libusb_kernel_driver_active) - AC_CHECK_FUNCS(libusb_set_auto_detach_kernel_driver) - AC_CHECK_FUNCS(libusb_detach_kernel_driver) - AC_CHECK_FUNCS(libusb_detach_kernel_driver_np) - fi - fi - else - nut_have_libusb=no - fi - - AS_IF([test "${nut_have_libusb}" = "yes"], [ - dnl ---------------------------------------------------------------------- - dnl additional USB-related checks - - dnl Solaris 10/11 USB handling (need librt and libusb runtime path) - dnl Should we check for `uname -o == illumos` to avoid legacy here? - dnl Or better yet, perform some active capability tests for need of - dnl workarounds or not? e.g. OpenIndiana should include a capable - dnl version of libusb-1.0.23+ tailored with NUT tests in mind... - dnl HPUX, since v11, needs an explicit activation of pthreads - dnl TODO: There are reports about FreeBSD error-code - dnl handling in libusb-0.1 port returning "-1" always, - dnl instead of differing codes like on other systems. - dnl Should we check for that below?.. - dnl https://github.com/networkupstools/nut/issues/490 - AS_CASE(["${target_os}"], - [solaris2.1*], [ - AC_MSG_CHECKING([for Solaris 10 / 11 specific configuration for usb drivers]) - AC_SEARCH_LIBS(nanosleep, rt) - LIBS="-R/usr/sfw/lib ${LIBS}" - dnl FIXME: Sun's libusb doesn't support timeout (so blocks notification) - dnl and need to call libusb close upon reconnection - dnl TODO: Somehow test for susceptible versions? - AC_DEFINE(SUN_LIBUSB, 1, [Define to 1 for Sun version of the libusb.]) - SUN_LIBUSB=1 - AC_MSG_RESULT([${LIBS}]) - ], - [hpux11*], [ - CFLAGS="${CFLAGS} -lpthread" - ] - ) - ]) - AC_LANG_POP([C]) - - AS_IF([test "${nut_have_libusb}" = "yes"], [ + if test "${nut_have_libusb}" = "yes"; then + dnl Check for libusb "force driver unbind" availability + AC_CHECK_FUNCS(usb_detach_kernel_driver_np) LIBUSB_CFLAGS="${CFLAGS}" LIBUSB_LIBS="${LIBS}" - ], [ - AS_CASE(["${nut_with_usb}"], - [no|auto], [], - [yes|1.0|0.1|libusb-1.0|libusb-0.1], - [dnl Explicitly choosing a library implies 'yes' (i.e. fail if not found), not 'auto'. - AC_MSG_ERROR([USB drivers requested, but libusb not found.]) - ] - ) - ]) - - if test "${nut_with_usb}" = "no"; then - if test -n "${nut_usb_lib}" && test "${nut_usb_lib}" != none ; then - AC_MSG_NOTICE([libusb was detected ${nut_usb_lib}, but a build without USB drivers was requested]) - fi - nut_usb_lib="" - else - nut_with_usb="${nut_have_libusb}" fi - dnl AC_MSG_NOTICE([DEBUG: nut_have_libusb='${nut_have_libusb}']) - dnl AC_MSG_NOTICE([DEBUG: nut_with_usb='${nut_with_usb}']) - dnl AC_MSG_NOTICE([DEBUG: nut_usb_lib='${nut_usb_lib}']) - - dnl Note: AC_DEFINE specifies a verbatim "value" so we pre-calculate it! - dnl Source code should be careful to use "#if" and not "#ifdef" when - dnl checking these values during the build. And both must be defined - dnl with some value. - AS_IF([test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-1.0)"], - [AC_DEFINE([WITH_LIBUSB_1_0], [1], - [Define to 1 for version 1.0 of the libusb (via pkg-config).])], - [AC_DEFINE([WITH_LIBUSB_1_0], [0], - [Define to 1 for version 1.0 of the libusb (via pkg-config).])] - ) - - AS_IF([test "${nut_with_usb}" = "yes" && test "${nut_usb_lib}" = "(libusb-0.1)" -o "${nut_usb_lib}" = "(libusb-0.1-config)"], - [AC_DEFINE([WITH_LIBUSB_0_1], [1], - [Define to 1 for version 0.1 of the libusb (via pkg-config or libusb-config).])], - [AC_DEFINE([WITH_LIBUSB_0_1], [0], - [Define to 1 for version 0.1 of the libusb (via pkg-config or libusb-config).])] - ) - dnl restore original CFLAGS and LIBS CFLAGS="${CFLAGS_ORIG}" LIBS="${LIBS_ORIG}" diff --git a/m4/nut_check_libwrap.m4 b/m4/nut_check_libwrap.m4 index c61f01e..7f1ff9d 100644 --- a/m4/nut_check_libwrap.m4 +++ b/m4/nut_check_libwrap.m4 @@ -18,7 +18,6 @@ if test -z "${nut_have_libwrap_seen}"; then dnl The line below does not work on Solaris 10. dnl AC_SEARCH_LIBS(request_init, wrap, [], [nut_have_libwrap=no]) AC_MSG_CHECKING(for library containing request_init) - AC_LANG_PUSH([C]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[ #include int allow_severity = 0, deny_severity = 0; @@ -36,7 +35,6 @@ int allow_severity = 0, deny_severity = 0; nut_have_libwrap=no ]) ]) - AC_LANG_POP([C]) if test "${nut_have_libwrap}" = "yes"; then AC_DEFINE(HAVE_WRAP, 1, [Define to enable libwrap support]) diff --git a/m4/nut_check_pkgconfig.m4 b/m4/nut_check_pkgconfig.m4 deleted file mode 100644 index 263be4b..0000000 --- a/m4/nut_check_pkgconfig.m4 +++ /dev/null @@ -1,91 +0,0 @@ -dnl Check for LIBPOWERMAN compiler flags. On success, set nut_have_libpowerman="yes" -dnl and set LIBPOWERMAN_CFLAGS and LIBPOWERMAN_LIBS. On failure, set -dnl nut_have_libpowerman="no". This macro can be run multiple times, but will -dnl do the checking only once. - -AC_DEFUN([NUT_CHECK_PKGCONFIG], -[ -AS_IF([test -z "${nut_have_pkg_config_seen}"], [ - nut_have_pkg_config_seen=yes - - dnl Note that PKG_CONFIG may be a filename, path, - dnl or either with args - so no quoting here - AC_MSG_CHECKING([whether usable PKG_CONFIG was already detected by autoconf]) - AS_IF([test -n "${PKG_CONFIG-}" && test x"${PKG_CONFIG-}" != x"false" && $PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null], - [AC_MSG_RESULT([yes: ${PKG_CONFIG}]) - have_PKG_CONFIG=yes - ], - [AC_MSG_RESULT([no]) - PKG_CONFIG=false - have_PKG_CONFIG=no - ] - ) - - AS_IF([test x"${PKG_CONFIG-}" = x"false"], - [dnl Some systems have older autotools without direct macro support for PKG_CONF* - have_PKG_CONFIG=yes - AC_PATH_PROG(dummy_PKG_CONFIG, pkg-config) - - AC_ARG_WITH(pkg-config, - AS_HELP_STRING([@<:@--with-pkg-config=/path/to/gdlib-config@:>@], - [path to program that reports development package configuration]), - [ - case "${withval}" in - "") ;; - yes|no) - AC_MSG_ERROR(invalid option --with(out)-pkg-config - see docs/configure.txt) - ;; - *) - dummy_PKG_CONFIG="${withval}" - ;; - esac - ]) - - AC_MSG_CHECKING([whether usable PKG_CONFIG is present in PATH or was set by caller]) - AS_IF([test x"$dummy_PKG_CONFIG" = xno || test -z "$dummy_PKG_CONFIG"], - [AC_MSG_RESULT([no]) - PKG_CONFIG=false - have_PKG_CONFIG=no - ], - [AS_IF([$dummy_PKG_CONFIG --help 2>&1 | grep -E '(--cflags|--libs)' >/dev/null], - [AC_MSG_RESULT([yes: ${dummy_PKG_CONFIG}]) - have_PKG_CONFIG=yes - PKG_CONFIG="$dummy_PKG_CONFIG" - ], - [AC_MSG_RESULT([no]) - PKG_CONFIG=false - have_PKG_CONFIG=no - ] - )] - )] - ) - - have_PKG_CONFIG_MACROS=no - AS_IF([test x"$have_PKG_CONFIG" = xyes], - [AC_MSG_NOTICE([checking for autoconf macro support of pkg-config (${PKG_CONFIG})]) - dummy_RES=0 - ifdef([PKG_PROG_PKG_CONFIG], [], [dummy_RES=1]) - ifdef([PKG_CHECK_MODULES], [], [dummy_RES=2]) - AS_IF([test "${dummy_RES}" = 0], - [AC_MSG_NOTICE([checking for autoconf macro support of pkg-config module checker]) - dnl The m4 macro below may be not defined if pkg-config package is not - dnl installed. Use of ifdef (here and below for e.g. CPPUNIT check) - dnl allows to avoid shell syntax errors in generated configure script - dnl by defining a dummy macro in-place. - ifdef([PKG_CHECK_MODULES], [], [AC_DEFUN([PKG_CHECK_MODULES], [false])]) - PKG_CHECK_MODULES([dummy_PKG_CONFIG], [pkg-config], [have_PKG_CONFIG_MACROS=yes]) - ] - )] - ) - - AS_IF([test x"$have_PKG_CONFIG" = xno], - [AC_MSG_WARN([pkg-config program is needed to look for further dependencies (will be skipped)]) - PKG_CONFIG="false" - ], - [AS_IF([test x"$have_PKG_CONFIG_MACROS" = xno], - [AC_MSG_WARN([pkg-config macros are needed to look for further dependencies, but in some cases pkg-config program can be used directly])] - )] - ) - - ]) dnl if nut_have_pkg_config_seen -]) diff --git a/m4/nut_check_python.m4 b/m4/nut_check_python.m4 deleted file mode 100644 index 6357286..0000000 --- a/m4/nut_check_python.m4 +++ /dev/null @@ -1,128 +0,0 @@ -dnl Check for python binary program names per language version -dnl to embed into scripts and Make rules - -AC_DEFUN([NUT_CHECK_PYTHON], -[ - AS_IF([test -z "${nut_with_python}"], [ - NUT_ARG_WITH([python], [Use a particular program name of the python interpeter], [auto]) - - PYTHON="" - AS_CASE([${nut_with_python}], - [auto|yes|""], [AC_CHECK_PROGS([PYTHON], [python python3 python2], [_python_runtime])], - [no], [PYTHON="no"], - [PYTHON="${nut_with_python}"] - ) - - dnl Default to calling a basename from PATH, only use a specific full pathname - dnl if provided by the caller: - AS_CASE([${PYTHON}], - [_python_runtime], [ - PYTHON="/usr/bin/env python" - AC_MSG_WARN([A python program name was not detected during configuration, will default to '$PYTHON' (scripts will fail if that is not in PATH at run time)])], - [no], [], - [/*" "*" "*], [ - AC_MSG_WARN([A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - ], - [/*], [], - [*" "*" "*], [ - AC_MSG_WARN([A python program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - PYTHON="/usr/bin/env ${PYTHON}" - ], - [*" "*], [ - AC_MSG_WARN([A python program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable]) - PYTHON="/usr/bin/env ${PYTHON}" - ], - [*], [PYTHON="/usr/bin/env ${PYTHON}"] - ) - - AC_MSG_CHECKING([python interpeter to call]) - AC_MSG_RESULT([${PYTHON}]) - AC_SUBST([PYTHON], [${PYTHON}]) - AM_CONDITIONAL([HAVE_PYTHON], [test "${PYTHON}" != "no"]) - AS_IF([test -n "${PYTHON}"], [export PYTHON]) - ]) -]) - -AC_DEFUN([NUT_CHECK_PYTHON2], -[ - AS_IF([test -z "${nut_with_python2}"], [ - NUT_ARG_WITH([python2], [Use a particular program name of the python2 interpeter for code that needs that version and is not compatible with python3], [auto]) - - PYTHON2="" - AS_CASE([${nut_with_python2}], - [auto|yes|""], [AC_CHECK_PROGS([PYTHON2], [python2 python2.7 python-2.7 python], [_python2_runtime])], - [no], [PYTHON2="no"], - [PYTHON2="${nut_with_python2}"] - ) - - dnl Default to calling a basename from PATH, only use a specific full pathname - dnl if provided by the caller: - AS_CASE([${PYTHON2}], - [_python2_runtime], [ - PYTHON2="/usr/bin/env python2" - AC_MSG_WARN([A python2 program name was not detected during configuration, will default to '$PYTHON2' (scripts will fail if that is not in PATH at run time)])], - [no], [], - [/*" "*" "*], [ - AC_MSG_WARN([A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - ], - [/*], [], - [*" "*" "*], [ - AC_MSG_WARN([A python2 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - PYTHON2="/usr/bin/env ${PYTHON2}" - ], - [*" "*], [ - AC_MSG_WARN([A python2 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable]) - PYTHON2="/usr/bin/env ${PYTHON2}" - ], - [*], [PYTHON2="/usr/bin/env ${PYTHON2}"] - ) - - AC_MSG_CHECKING([python2 interpeter to call]) - AC_MSG_RESULT([${PYTHON2}]) - AC_SUBST([PYTHON2], [${PYTHON2}]) - AM_CONDITIONAL([HAVE_PYTHON2], [test "${PYTHON2}" != "no"]) - AS_IF([test -n "${PYTHON2}"], [export PYTHON2]) - ]) -]) - -AC_DEFUN([NUT_CHECK_PYTHON3], -[ - AS_IF([test -z "${nut_with_python3}"], [ - NUT_ARG_WITH([python3], [Use a particular program name of the python3 interpeter for code that needs that version and is not compatible with python2], [auto]) - - PYTHON3="" - AS_CASE([${nut_with_python3}], - [auto|yes|""], [AC_CHECK_PROGS([PYTHON3], [python3 python3.9 python-3.9 python3.7 python-3.7 python3.5 python-3.5 python], [_python3_runtime])], - [no], [PYTHON3="no"], - [PYTHON3="${nut_with_python3}"] - ) - - dnl Default to calling a basename from PATH, only use a specific full pathname - dnl if provided by the caller: - AS_CASE([${PYTHON3}], - [_python3_runtime], [ - PYTHON3="/usr/bin/env python3" - AC_MSG_WARN([A python3 program name was not detected during configuration, will default to '$PYTHON3' (scripts will fail if that is not in PATH at run time)])], - [no], [], - [/*" "*" "*], [ - AC_MSG_WARN([A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - ], - [/*], [], - [*" "*" "*], [ - AC_MSG_WARN([A python3 program name is not a single token (was specified with more than one argument?), so shebangs can be not reliable]) - PYTHON3="/usr/bin/env ${PYTHON3}" - ], - [*" "*], [ - AC_MSG_WARN([A python3 program name is not a single token (was specified with an argument?), so /usr/bin/env shebangs can be not reliable]) - PYTHON3="/usr/bin/env ${PYTHON3}" - ], - [*], [PYTHON3="/usr/bin/env ${PYTHON3}"] - ) - - AC_MSG_CHECKING([python3 interpeter to call]) - AC_MSG_RESULT([${PYTHON3}]) - AC_SUBST([PYTHON3], [${PYTHON3}]) - AM_CONDITIONAL([HAVE_PYTHON3], [test "${PYTHON3}" != "no"]) - AS_IF([test -n "${PYTHON3}"], [export PYTHON3]) - ]) -]) diff --git a/m4/nut_compiler_family.m4 b/m4/nut_compiler_family.m4 deleted file mode 100644 index 8cdc972..0000000 --- a/m4/nut_compiler_family.m4 +++ /dev/null @@ -1,241 +0,0 @@ -dnl detect if current compiler is clang or gcc (or...) - -AC_DEFUN([NUT_COMPILER_FAMILY], -[ - AC_CACHE_CHECK([if CC compiler family is GCC], - [nut_cv_GCC], - [AS_IF([test -n "$CC"], - [AS_IF([$CC --version 2>&1 | grep 'Free Software Foundation' > /dev/null], - [nut_cv_GCC=yes],[nut_cv_GCC=no])], - [AC_MSG_ERROR([CC is not set])] - )]) - - AC_CACHE_CHECK([if CXX compiler family is GCC], - [nut_cv_GXX], - [AS_IF([test -n "$CXX"], - [AS_IF([$CXX --version 2>&1 | grep 'Free Software Foundation' > /dev/null], - [nut_cv_GXX=yes],[nut_cv_GXX=no])], - [AC_MSG_ERROR([CXX is not set])] - )]) - - AC_CACHE_CHECK([if CPP preprocessor family is GCC], - [nut_cv_GPP], - [AS_IF([test -n "$CPP"], - [AS_IF([$CPP --version 2>&1 | grep 'Free Software Foundation' > /dev/null], - [nut_cv_GPP=yes],[nut_cv_GPP=no])], - [AC_MSG_ERROR([CPP is not set])] - )]) - - AS_IF([test "x$GCC" = "x" && test "$nut_cv_GCC" = yes], [GCC=yes]) - AS_IF([test "x$GXX" = "x" && test "$nut_cv_GXX" = yes], [GXX=yes]) - AS_IF([test "x$GPP" = "x" && test "$nut_cv_GPP" = yes], [GPP=yes]) - - AC_CACHE_CHECK([if CC compiler family is clang], - [nut_cv_CLANGCC], - [AS_IF([test -n "$CC"], - [AS_IF([$CC --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null], - [nut_cv_CLANGCC=yes],[nut_cv_CLANGCC=no])], - [AC_MSG_ERROR([CC is not set])] - )]) - - AC_CACHE_CHECK([if CXX compiler family is clang], - [nut_cv_CLANGXX], - [AS_IF([test -n "$CXX"], - [AS_IF([$CXX --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null], - [nut_cv_CLANGXX=yes],[nut_cv_CLANGXX=no])], - [AC_MSG_ERROR([CXX is not set])] - )]) - - AC_CACHE_CHECK([if CPP preprocessor family is clang], - [nut_cv_CLANGPP], - [AS_IF([test -n "$CPP"], - [AS_IF([$CPP --version 2>&1 | grep -E '(clang version|Apple LLVM version .*clang-)' > /dev/null], - [nut_cv_CLANGPP=yes],[nut_cv_CLANGPP=no])], - [AC_MSG_ERROR([CPP is not set])] - )]) - - AS_IF([test "x$CLANGCC" = "x" && test "$nut_cv_CLANGCC" = yes], [CLANGCC=yes]) - AS_IF([test "x$CLANGXX" = "x" && test "$nut_cv_CLANGXX" = yes], [CLANGXX=yes]) - AS_IF([test "x$CLANGPP" = "x" && test "$nut_cv_CLANGPP" = yes], [CLANGPP=yes]) -]) - -AC_DEFUN([NUT_CHECK_COMPILE_FLAG], -[ -dnl Note: with this line uncommented, builds report -dnl sed: 0: conftest.c: No such file or directory -dnl so seemingly try to parse the method without args: - dnl### AC_REQUIRE([AX_RUN_OR_LINK_IFELSE]) - -dnl Note: per https://stackoverflow.com/questions/52557417/how-to-check-support-compile-flag-in-autoconf-for-clang -dnl the -Werror below is needed to detect "warnings" about unsupported options - COMPILERFLAG="$1" - -dnl We also try to run an actual build since tools called from that might -dnl complain if they are forwarded unknown flags accepted by the front-end. - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" - - AC_LANG_PUSH([C]) - AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}], - [CFLAGS="$CFLAGS ${COMPILERFLAG}" - AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [], [CFLAGS="$SAVED_CFLAGS"]) - ], [], [-Werror]) - AC_LANG_POP([C]) - - AC_LANG_PUSH([C++]) - AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}], - [CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" - AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [], [CXXFLAGS="$SAVED_CXXFLAGS"]) - ], [], [-Werror]) - AC_LANG_POP([C++]) -]) - -AC_DEFUN([NUT_COMPILER_FAMILY_FLAGS], -[ - AC_MSG_NOTICE([Detecting support for additional compiler flags]) - -dnl -Qunused-arguments: -dnl Do not die due to `clang: error: argument unused during compilation: '-I .'` -dnl -Wno-unknown-warning-option: Do not die (on older clang releases) due to -dnl error: unknown warning option '-Wno-double-promotion'; did you mean -dnl '-Wno-documentation'? [-Werror,-Wunknown-warning-option] -dnl -fcolor-diagnostics: help find where bugs are in the wall of text (clang) -dnl -fdiagnostics-color=ARG: help find where bugs are in the wall of text (gcc) - - dnl First check for this to avoid failing on unused include paths etc: - NUT_CHECK_COMPILE_FLAG([-Qunused-arguments]) - - m4_foreach_w([TESTCOMPILERFLAG], [ - -Wno-reserved-identifier - ], [ - NUT_CHECK_COMPILE_FLAG([TESTCOMPILERFLAG]) - ]) - - dnl Note: each m4_foreach_w arg must be named uniquely - dnl Note: Seems -fcolor-diagnostics is clang-only and sometimes - dnl gcc blindly accepts it in test and fails to use later. - AS_IF([test x"${nut_enable_Wcolor}" = xyes], [ - m4_foreach_w([TESTCOMPILERFLAG_COLOR], [ - -fdiagnostics-color=always - ], [ - NUT_CHECK_COMPILE_FLAG([TESTCOMPILERFLAG_COLOR]) - ]) - ], [AC_MSG_NOTICE([NOT checking for options to request colorized compiler output (pass --enable-Wcolor for that)])]) - - dnl Last check for this to avoid accepting anything regardless of support. - dnl NOTE that some toolkit versions accept this option blindly and without - dnl really supporting it (but not erroring out on it, either): - dnl cc1: note: unrecognized command-line option '-Wno-unknown-warning-option' - dnl may have been intended to silence earlier diagnostics - NUT_CHECK_COMPILE_FLAG([-Wno-unknown-warning-option]) - -dnl # Older "brute-forced" settings: -dnl AS_IF([test "x$CLANGCC" = xyes], [CFLAGS="$CFLAGS -Wno-unknown-warning-option"]) -dnl AS_IF([test "x$CLANGXX" = xyes], [CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option"]) - -dnl # Despite the internet lore, practical GCC versions seen so far -dnl # (4.x-10.x) do not know of this CLI option, with varied results -dnl # from "cc1: note: unrecognized command-line option '-Wno-unknown-warning' -dnl # may have been intended to silence earlier diagnostics" -dnl # to "cc1: error: unrecognized command line option '-Wno-unknown-warning' -dnl # [-Werror]"... so we do not pass it by default: -dnl AS_IF([test "x$GCC" = xyes], [CFLAGS="$CFLAGS -Wno-unknown-warning"]) -dnl AS_IF([test "x$GXX" = xyes], [CXXFLAGS="$CXXFLAGS -Wno-unknown-warning"]) - -dnl # There should be no need to include standard system paths (and possibly -dnl # confuse the compiler assumptions - along with its provided headers)... -dnl # ideally; in practice however cppunit, net-snmp and some system include -dnl # files do cause grief to picky compiler settings (more so from third -dnl # party packages shipped via /usr/local/... namespace): - AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [ -dnl # CFLAGS="-isystem /usr/include $CFLAGS" - AS_IF([test -d /usr/local/include], - [CFLAGS="-isystem /usr/local/include $CFLAGS"]) - AS_IF([test -d /usr/pkg/include], - [CFLAGS="-isystem /usr/pkg/include $CFLAGS"]) - ]) - AS_IF([test "x$CLANGXX" = xyes -o "x$GXX" = xyes], [ -dnl # CXXFLAGS="-isystem /usr/include $CXXFLAGS" - AS_IF([test -d /usr/local/include], - [CXXFLAGS="-isystem /usr/local/include $CXXFLAGS"]) - AS_IF([test -d /usr/pkg/include], - [CXXFLAGS="-isystem /usr/pkg/include $CXXFLAGS"]) - ]) - -dnl # Default to avoid noisy warnings on older compilers -dnl # (gcc-4.x, clang-3.x) due to their preference of -dnl # ANSI C (C89/C90) out of the box. While NUT codebase -dnl # currently can build in that mode, reliability of -dnl # results is uncertain - third-party and/or system -dnl # headers and libs seemingly no longer care for C90 -dnl # on modern systems, and we have no recent data from -dnl # truly legacy systems which have no choice. -dnl # Some distributions and platforms also have problems -dnl # building in "strict C" mode, so for the GNU-compatible -dnl # compilers we default to the GNU C/C++ dialects. - AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes], - [AS_CASE(["${CFLAGS}"], [-std=*], [], - [AC_LANG_PUSH([C]) - AX_CHECK_COMPILE_FLAG([-std=gnu99], - [AC_MSG_NOTICE([Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler]) - CFLAGS="$CFLAGS -std=gnu99" - ], [], [-Werror]) - AC_LANG_POP([C]) - ]) - ]) - -dnl # Note: this might upset some very old compilers -dnl # but then by default we wouldn't build C++ parts - AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes], - [AS_CASE(["${CXXFLAGS}"], [-std=*], [], - [AC_LANG_PUSH([C++]) - AX_CHECK_COMPILE_FLAG([-std=gnu++11], - [AC_MSG_NOTICE([Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler]) - CXXFLAGS="$CXXFLAGS -std=gnu++11" - ], [], [-Werror]) - AC_LANG_POP([C++]) - ]) - ]) - -]) - -AC_DEFUN([NUT_COMPILER_FAMILY_FLAGS_DEFAULT_STANDARD], -[ -dnl # Default to avoid noisy warnings on older compilers -dnl # (gcc-4.x, clang-3.x) due to their preference of -dnl # ANSI C (C89/C90) out of the box. While NUT codebase -dnl # currently can build in that mode, reliability of -dnl # results is uncertain - third-party and/or system -dnl # headers and libs seemingly no longer care for C90 -dnl # on modern systems, and we have no recent data from -dnl # truly legacy systems which have no choice. -dnl # Some distributions and platforms also have problems -dnl # building in "strict C" mode, so for the GNU-compatible -dnl # compilers we default to the GNU C/C++ dialects. - AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes], - [AS_CASE(["${CFLAGS}"], [*-std=*], [], - [AC_LANG_PUSH([C]) - AX_CHECK_COMPILE_FLAG([-std=gnu99], - [AC_MSG_NOTICE([Defaulting C standard support to GNU C99 on a GCC or CLANG compatible compiler]) - CFLAGS="$CFLAGS -std=gnu99" - ], [], [-Werror]) - AC_LANG_POP([C]) - ]) - ]) - -dnl # Note: this might upset some very old compilers -dnl # but then by default we wouldn't build C++ parts - AS_IF([test "x$GCC" = xyes -o "x$CLANGCC" = xyes], - [AS_CASE(["${CXXFLAGS}"], [*-std=*], [], - [AC_LANG_PUSH([C++]) - AX_CHECK_COMPILE_FLAG([-std=gnu++11], - [AC_MSG_NOTICE([Defaulting C++ standard support to GNU C++11 on a GCC or CLANG compatible compiler]) - CXXFLAGS="$CXXFLAGS -std=gnu++11" - ], [], [-Werror]) - AC_LANG_POP([C++]) - ]) - ]) - -]) diff --git a/m4/nut_config_libhal.m4 b/m4/nut_config_libhal.m4 new file mode 100644 index 0000000..23f6192 --- /dev/null +++ b/m4/nut_config_libhal.m4 @@ -0,0 +1,102 @@ +dnl Check for LIBHAL configuration if support for HAL was found. +dnl This keeps compile and link time options separate from runtime +dnl configuration items. This macro can be run multiple times, but +dnl will do the checking only once. + +AC_DEFUN([NUT_CONFIG_LIBHAL], +[ +if test -z "${nut_have_config_libhal_seen}" -a "${nut_have_libhal}" = "yes"; then + nut_have_config_libhal_seen=yes + + AC_REQUIRE([NUT_CHECK_LIBHAL]) + + AC_MSG_CHECKING(for libhal user) + AC_ARG_WITH(hal-user, + AS_HELP_STRING([@<:@--with-hal-user=USER@:>@], [addons run as user]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-user - see docs/configure.txt) + ;; + *) + HAL_USER="${withval}" + ;; + esac + ], [ + dnl this will only work as of HAL 0.5.9 + HAL_USER="`pkg-config --silence-errors --variable=haluser hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_USER}"; then + HAL_USER="haldaemon" + fi + ]) + AC_MSG_RESULT(${HAL_USER}) + AC_DEFINE_UNQUOTED(HAL_USER, "${HAL_USER}", [addons run as user]) + + AC_MSG_CHECKING(for libhal device match key) + AC_ARG_WITH(hal-device-match-key, + AS_HELP_STRING([@<:@--with-hal-device-match-key=KEY@:>@], [device match key]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-device-match-key - see docs/configure.txt) + ;; + *) + HAL_DEVICE_MATCH_KEY="${withval}" + ;; + esac + ], [ + dnl the device match key changed with HAL 0.5.11 + if pkg-config --silence-errors --atleast-version=0.5.11 hal 2>/dev/null; then + HAL_DEVICE_MATCH_KEY="info.bus" + else + HAL_DEVICE_MATCH_KEY="info.subsystem" + fi + ]) + AC_MSG_RESULT(${HAL_DEVICE_MATCH_KEY}) + + AC_MSG_CHECKING(for libhal Callouts path) + AC_ARG_WITH(hal-callouts-path, + AS_HELP_STRING([@<:@--with-hal-callouts-path=PATH@:>@], [installation path for callouts]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-callouts-path - see docs/configure.txt) + ;; + *) + HAL_CALLOUTS_PATH="${withval}" + ;; + esac + ], [ + dnl Determine installation path for callouts + dnl As per HAL spec, §5 Callouts addon install path: $libdir/hal + HAL_CALLOUTS_PATH="`pkg-config --silence-errors --variable=libexecdir hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_CALLOUTS_PATH}"; then + HAL_CALLOUTS_PATH="${libdir}/hal" + fi + ]) + AC_MSG_RESULT(${HAL_CALLOUTS_PATH}) + + AC_MSG_CHECKING(for libhal Device Information path) + AC_ARG_WITH(hal-fdi-path, + AS_HELP_STRING([@<:@--with-hal-fdi-path=PATH@:>@], [installation path for device information files]), + [ + case "${withval}" in + yes|no) + AC_MSG_ERROR(invalid option --with(out)-hal-fdi-path - see docs/configure.txt) + ;; + *) + HAL_FDI_PATH="${withval}" + ;; + esac + ], [ + dnl Determine installation path for .fdi + dnl As per HAL spec, §2 Device Information Files + dnl fdi install path: $datarootdir/hal/fdi/information/20thirdparty + HAL_FDI_PATH="`pkg-config --silence-errors --variable=hal_fdidir hal 2>/dev/null`" + if test "$?" != "0" -o -z "${HAL_FDI_PATH}"; then + HAL_FDI_PATH="${datarootdir}/hal/fdi/information/20thirdparty" + fi + ]) + AC_MSG_RESULT(${HAL_FDI_PATH}) +fi +]) diff --git a/m4/nut_func_getnameinfo_argtypes.m4 b/m4/nut_func_getnameinfo_argtypes.m4 deleted file mode 100644 index 8f32c42..0000000 --- a/m4/nut_func_getnameinfo_argtypes.m4 +++ /dev/null @@ -1,96 +0,0 @@ -dnl This code was lifted and adapted for NUT from cURL project: -dnl https://github.com/curl/curl/blob/e3657644d695373e9cf9ab9b4f1571afda7fd041/acinclude.m4#L228 - -dnl NUT_FUNC_GETNAMEINFO_ARGTYPES -dnl ------------------------------------------------- -dnl Check the type to be passed to five of the arguments -dnl of getnameinfo function, and define those types in -dnl macros GETNAMEINFO_TYPE_ARG1, GETNAMEINFO_TYPE_ARG2, -dnl GETNAMEINFO_TYPE_ARG46 (4 and 6) and GETNAMEINFO_TYPE_ARG7. -dnl As seen from the loop, these vary a lot between OSes... -dnl Order of attempts in the loop below was updated to first -dnl try and quickly match current X/Open definition at -dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/getnameinfo.html -dnl for modern conforming OSes. - -AC_DEFUN([NUT_FUNC_GETNAMEINFO_ARGTYPES], [ - AC_REQUIRE([NUT_CHECK_HEADER_WS2TCPIP])dnl - AC_REQUIRE([NUT_TYPE_SOCKLEN_T])dnl - AC_CHECK_HEADERS(sys/types.h sys/socket.h netdb.h) - AC_LANG_PUSH([C]) - AC_CACHE_CHECK([types of arguments for getnameinfo], - [nut_cv_func_getnameinfo_args], [ - nut_cv_func_getnameinfo_args="unknown" - for gni_arg1 in 'const struct sockaddr *' 'struct sockaddr *' 'void *'; do - for gni_arg2 in 'socklen_t' 'size_t' 'int'; do - for gni_arg46 in 'socklen_t' 'size_t' 'int' 'unsigned int'; do - for gni_arg7 in 'int' 'unsigned int'; do - AC_COMPILE_IFELSE([ - AC_LANG_PROGRAM([ -#undef inline -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -# define GNICALLCONV WSAAPI -#else -# ifdef HAVE_SYS_TYPES_H -# include -# endif -# ifdef HAVE_SYS_SOCKET_H -# include -# endif -# ifdef HAVE_NETDB_H -# include -# endif -# define GNICALLCONV -#endif - extern int GNICALLCONV getnameinfo($gni_arg1, $gni_arg2, - char *, $gni_arg46, - char *, $gni_arg46, - $gni_arg7); - ],[ - $gni_arg2 salen=0; - $gni_arg46 hostlen=0; - $gni_arg46 servlen=0; - $gni_arg7 flags=0; - int res = getnameinfo(0, salen, 0, hostlen, 0, servlen, flags); - ]) - ],[ - nut_cv_func_getnameinfo_args="$gni_arg1,$gni_arg2,$gni_arg46,$gni_arg7" - break 4 - ]) - done - done - done - done - ]) - AC_LANG_POP([C]) - if test "$nut_cv_func_getnameinfo_args" = "unknown"; then - AC_MSG_WARN([Cannot find proper types to use for getnameinfo args]) - else - gni_prev_IFS=$IFS; IFS=',' - set dummy `echo "$nut_cv_func_getnameinfo_args" | sed 's/\*/\*/g'` - IFS=$gni_prev_IFS - shift - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG1, $[1], - [Define to the type of arg 1 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG2, $[2], - [Define to the type of arg 2 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG46, $[3], - [Define to the type of args 4 and 6 for getnameinfo.]) - AC_DEFINE_UNQUOTED(GETNAMEINFO_TYPE_ARG7, $[4], - [Define to the type of arg 7 for getnameinfo.]) - fi -]) diff --git a/m4/nut_report_feature.m4 b/m4/nut_report_feature.m4 index 72667ba..f6f35b7 100644 --- a/m4/nut_report_feature.m4 +++ b/m4/nut_report_feature.m4 @@ -30,13 +30,4 @@ AC_DEFUN([NUT_REPORT_FEATURE], AC_DEFUN([NUT_PRINT_FEATURE_REPORT], [ cat conf_nut_report_feature - - echo "------------------" - echo "Compiler settings:" - printf 'CC \t:%s\n' "$CC" - printf 'CFLAGS \t:%s\n' "$CFLAGS" - printf 'CXX \t:%s\n' "$CXX" - printf 'CXXFLAGS\t:%s\n' "$CXXFLAGS" - printf 'CPP \t:%s\n' "$CPP" - printf 'CPPFLAGS\t:%s\n' "$CPPFLAGS" ]) diff --git a/m4/nut_stash_warnings.m4 b/m4/nut_stash_warnings.m4 deleted file mode 100644 index 069d6b0..0000000 --- a/m4/nut_stash_warnings.m4 +++ /dev/null @@ -1,77 +0,0 @@ -dnl Callers like CI or developers can enable various warning flags -dnl including those that would be fatal to the configure script -dnl itself passing (autotools probing code is rather sloppy by -dnl strict standards). These routines try to stash away the warning -dnl flags from CFLAGS and CXXFLAGS passed by user, to re-apply in -dnl the end of configure script run. - -AC_DEFUN([NUT_STASH_WARNINGS], -[ - dnl WARNING: This code assumes that there are no whitespaces - dnl inside C*FLAGS values (e.g. no spacey include paths) - CFLAGS_STASHED_WARNINGS="" - CPPFLAGS_STASHED_WARNINGS="" - CXXFLAGS_STASHED_WARNINGS="" - - AS_IF([test -z "$CFLAGS"],[],[ - TMP="" - for V in ${CFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CFLAGS_STASHED_WARNINGS="${CFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CFLAGS="$TMP" - ]) - AS_IF([test -n "${CFLAGS_STASHED_WARNINGS}"], - [AC_MSG_NOTICE([Stashed CFLAGS warnings to not confuse autotools probes: ${CFLAGS_STASHED_WARNINGS}])]) - - AS_IF([test -z "$CPPFLAGS"],[],[ - TMP="" - for V in ${CPPFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CPPFLAGS_STASHED_WARNINGS="${CPPFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CPPFLAGS="$TMP" - ]) - AS_IF([test -n "${CPPFLAGS_STASHED_WARNINGS}"], - [AC_MSG_NOTICE([Stashed CPPFLAGS warnings to not confuse autotools probes: ${CPPFLAGS_STASHED_WARNINGS}])]) - - - AS_IF([test -z "$CXXFLAGS"],[],[ - TMP="" - for V in ${CXXFLAGS} ; do - case "$V" in - -W*|-*pedantic*) CXXFLAGS_STASHED_WARNINGS="${CXXFLAGS_STASHED_WARNINGS} ${V}" ;; - *) TMP="${TMP} ${V}" ;; - esac - done - CXXFLAGS="$TMP" - ]) - AS_IF([test -n "${CXXFLAGS_STASHED_WARNINGS}"], - [AC_MSG_NOTICE([Stashed CXXFLAGS warnings to not confuse autotools probes: ${CXXFLAGS_STASHED_WARNINGS}])]) - -]) - -AC_DEFUN([NUT_POP_WARNINGS], -[ - AS_IF([test -n "${CFLAGS_STASHED_WARNINGS}"],[ - AC_MSG_NOTICE([Applying back the stashed CFLAGS warnings]) - CFLAGS="${CFLAGS} ${CFLAGS_STASHED_WARNINGS}" - AC_MSG_NOTICE([Ended up with: '${CFLAGS}']) - ]) - - AS_IF([test -n "${CPPFLAGS_STASHED_WARNINGS}"],[ - AC_MSG_NOTICE([Applying back the stashed CPPFLAGS warnings]) - CPPFLAGS="${CPPFLAGS} ${CPPFLAGS_STASHED_WARNINGS}" - AC_MSG_NOTICE([Ended up with: '${CPPFLAGS}']) - ]) - - AS_IF([test -n "${CXXFLAGS_STASHED_WARNINGS}"],[ - AC_MSG_NOTICE([Applying back the stashed CXXFLAGS warnings]) - CXXFLAGS="${CXXFLAGS} ${CXXFLAGS_STASHED_WARNINGS}" - AC_MSG_NOTICE([Ended up with: '${CXXFLAGS}']) - ]) -]) diff --git a/m4/nut_type_socklen_t.m4 b/m4/nut_type_socklen_t.m4 index 205a5f9..0cbf4b3 100644 --- a/m4/nut_type_socklen_t.m4 +++ b/m4/nut_type_socklen_t.m4 @@ -7,65 +7,29 @@ dnl This code gets around. This instance came from rsync 2.5.6. AC_DEFUN([NUT_TYPE_SOCKLEN_T], [ - AC_REQUIRE([NUT_CHECK_HEADER_WS2TCPIP])dnl - HEADERS_SOCKLEN_T=' -#undef inline -#ifdef HAVE_WINDOWS_H -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN -# endif -# if (!defined(_WIN32_WINNT)) || (_WIN32_WINNT < 0x0501) -# undef _WIN32_WINNT -# define _WIN32_WINNT 0x0501 -# endif -# include -# ifdef HAVE_WINSOCK2_H -# include -# ifdef HAVE_WS2TCPIP_H -# include -# endif -# endif -# define GNICALLCONV WSAAPI -# define GNICALLLINK WINSOCK_API_LINKAGE -#else -# ifdef HAVE_SYS_TYPES_H -# include -# endif -# ifdef HAVE_SYS_SOCKET_H -# include -# endif -# ifdef HAVE_NETDB_H -# include -# endif -# define GNICALLCONV -# define GNICALLLINK -#endif -' AC_CHECK_TYPE([socklen_t], ,[ AC_MSG_CHECKING([for socklen_t equivalent]) AC_CACHE_VAL([nut_cv_socklen_t_equiv], [ # Systems have either "struct sockaddr *" or # "void *" as the second argument to getpeername - AC_LANG_PUSH([C]) nut_cv_socklen_t_equiv= - for arg1 in "int" "SOCKET"; do - for arg2 in "struct sockaddr" void; do - for arg3 in int size_t unsigned long "unsigned long"; do - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([${HEADERS_SOCKLEN_T} - GNICALLLINK int GNICALLCONV getpeername ($arg1, $arg2 *, $arg3 *); - ],[ - $arg3 len; + for arg2 in "struct sockaddr" void; do + for t in int size_t unsigned long "unsigned long"; do + AC_TRY_COMPILE([ +#include +#include + + int getpeername (int, $arg2 *, $t *); + ],[ + $t len; getpeername(0,0,&len); - ])], - [ - nut_cv_socklen_t_equiv="$arg3" + ],[ + nut_cv_socklen_t_equiv="$t" break ]) done - done done - AC_LANG_POP([C]) if test "x$nut_cv_socklen_t_equiv" = x; then AC_MSG_ERROR([Cannot find a type to use in place of socklen_t]) @@ -74,5 +38,6 @@ AC_DEFUN([NUT_TYPE_SOCKLEN_T], AC_MSG_RESULT($nut_cv_socklen_t_equiv) AC_DEFINE_UNQUOTED(socklen_t, $nut_cv_socklen_t_equiv, [type to use in place of socklen_t if not defined])], - [${HEADERS_SOCKLEN_T}]) + [#include +#include ]) ]) diff --git a/missing b/missing index 8d0eaad..86a8fc3 100755 --- a/missing +++ b/missing @@ -1,10 +1,11 @@ #! /bin/sh -# Common wrapper for a few potentially missing GNU programs. +# Common stub for a few missing GNU programs while installing. -scriptversion=2018-03-07.03; # UTC +scriptversion=2012-01-06.13; # UTC -# Copyright (C) 1996-2020 Free Software Foundation, Inc. -# Originally written by Fran,cois Pinard , 1996. +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,7 +18,7 @@ scriptversion=2018-03-07.03; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -25,40 +26,68 @@ scriptversion=2018-03-07.03; # UTC # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + case $1 in - - --is-lightweight) - # Used by our autoconf macros to check whether the available missing - # script is modern enough. - exit 0 - ;; - - --run) - # Back-compat with the calling convention used by older automake. - shift - ;; +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... -Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due -to PROGRAM being missing or too old. +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails Supported PROGRAM values: - aclocal autoconf autoheader autom4te automake makeinfo - bison yacc flex lex help2man + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch] -Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and -'g' are ignored when checking the name. +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. Send bug reports to ." exit $? @@ -70,146 +99,233 @@ Send bug reports to ." ;; -*) - echo 1>&2 "$0: unknown '$1' option" - echo 1>&2 "Try '$0 --help' for more information" + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac -# Run the given program, remember its exit status. -"$@"; st=$? +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` -# If it succeeded, we are done. -test $st -eq 0 && exit 0 - -# Also exit now if we it failed (or wasn't found), and '--version' was -# passed; such an option is passed most likely to detect whether the -# program is present and works. -case $2 in --version|--help) exit $st;; esac - -# Exit code 63 means version mismatch. This often happens when the user -# tries to use an ancient version of a tool on a file that requires a -# minimum version. -if test $st -eq 63; then - msg="probably too old" -elif test $st -eq 127; then - # Program was missing. - msg="missing on your system" -else - # Program was found and executed, but failed. Give up. - exit $st -fi - -perl_URL=https://www.perl.org/ -flex_URL=https://github.com/westes/flex -gnu_software_URL=https://www.gnu.org/software - -program_details () -{ - case $1 in - aclocal|automake) - echo "The '$1' program is part of the GNU Automake package:" - echo "<$gnu_software_URL/automake>" - echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/autoconf>" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - autoconf|autom4te|autoheader) - echo "The '$1' program is part of the GNU Autoconf package:" - echo "<$gnu_software_URL/autoconf/>" - echo "It also requires GNU m4 and Perl in order to run:" - echo "<$gnu_software_URL/m4/>" - echo "<$perl_URL>" - ;; - esac -} - -give_advice () -{ - # Normalize program name to check for. - normalized_program=`echo "$1" | sed ' - s/^gnu-//; t - s/^gnu//; t - s/^g//; t'` - - printf '%s\n' "'$1' is $msg." - - configure_deps="'configure.ac' or m4 files included by 'configure.ac'" - case $normalized_program in - autoconf*) - echo "You should only need it if you modified 'configure.ac'," - echo "or m4 files included by it." - program_details 'autoconf' - ;; - autoheader*) - echo "You should only need it if you modified 'acconfig.h' or" - echo "$configure_deps." - program_details 'autoheader' - ;; - automake*) - echo "You should only need it if you modified 'Makefile.am' or" - echo "$configure_deps." - program_details 'automake' - ;; - aclocal*) - echo "You should only need it if you modified 'acinclude.m4' or" - echo "$configure_deps." - program_details 'aclocal' - ;; - autom4te*) - echo "You might have modified some maintainer files that require" - echo "the 'autom4te' program to be rebuilt." - program_details 'autom4te' - ;; - bison*|yacc*) - echo "You should only need it if you modified a '.y' file." - echo "You may want to install the GNU Bison package:" - echo "<$gnu_software_URL/bison/>" - ;; - lex*|flex*) - echo "You should only need it if you modified a '.l' file." - echo "You may want to install the Fast Lexical Analyzer package:" - echo "<$flex_URL>" - ;; - help2man*) - echo "You should only need it if you modified a dependency" \ - "of a man page." - echo "You may want to install the GNU Help2man package:" - echo "<$gnu_software_URL/help2man/>" +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. ;; - makeinfo*) - echo "You should only need it if you modified a '.texi' file, or" - echo "any other file indirectly affecting the aspect of the manual." - echo "You might want to install the Texinfo package:" - echo "<$gnu_software_URL/texinfo/>" - echo "The spurious makeinfo call might also be the consequence of" - echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" - echo "want to install GNU make:" - echo "<$gnu_software_URL/make/>" - ;; - *) - echo "You might have modified some files without having the proper" - echo "tools for further handling them. Check the 'README' file, it" - echo "often tells you about the needed prerequisites for installing" - echo "this package. You may also peek at any GNU archive site, in" - echo "case some other package contains this missing '$1' program." - ;; - esac -} -give_advice "$1" | sed -e '1s/^/WARNING: /' \ - -e '2,$s/^/ /' >&2 + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac -# Propagate the correct exit status (expected to be 127 for a program -# not found, 63 for a program that failed due to version mismatch). -exit $st +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG=\${$#} + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 # Local variables: -# eval: (add-hook 'before-save-hook 'time-stamp) +# eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" +# time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: diff --git a/scripts/Aix/nut-aix.spec.in b/scripts/Aix/nut-aix.spec.in deleted file mode 100644 index 37e4934..0000000 --- a/scripts/Aix/nut-aix.spec.in +++ /dev/null @@ -1,330 +0,0 @@ -%define nut_id @RUN_AS_USER@ -%define nut_group @RUN_AS_GROUP@ - -%define _prefix /usr/local/ups -%define _docdir %{_datadir}/doc - -%define confdir %{_prefix}/etc -%define rcdir /etc/rc.d -%define initdir %{rcdir}/init.d -%define cgidir /var/www/nut-cgi-bin -%define piddir /var/run/nut - -Summary: Network UPS Tools -Name: nut -Version: @PACKAGE_VERSION@ -Release: 1 -Group: Applications/System -License: GPLv2+ -Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Url: http://www.networkupstools.org/ -Source: http://www.networkupstools.org/source/@TREE_VERSION@/%{name}-%{version}.tar.gz -Source1: nut.init -#Source2: ups.sysconfig -#Source3: nut-client.tmpfiles - - -# FIXME: adjust according to what is available through RPM on Aix -BuildRequires: libtool -BuildRequires: net-snmp-devel -BuildRequires: openssl-devel -BuildRequires: pkgconfig - -# AIX BUILDERS, PLEASE NOTE: -# If building with xlc version 3.6.X rather than gcc, you must ensure -# you have the following PTF's installed on your system, or -# you will see a runtime error that says: -# "Expected but saw " -# PTFS needed: U462006 U462007 U462023 U462024 U462025 U462026 U462027 -# Refer to http://service.software.ibm.com/support/rs6000, or -# set CC=gcc to force use of the GCC compiler. -# -# %define stdlib lib -# %define liblink ../.. -# %define DEFCC xlc - -%description -Network UPS Tools (NUT) is a client/server monitoring system that allows -computers to share uninterruptible power supply (UPS) and power distribution -unit (PDU) hardware. Clients access the hardware through the server, and are -notified whenever the power status changes. - -%package client -Group: Applications/System -Summary: Network UPS Tools client monitoring utilities -#Requires(post): chkconfig -#Requires(preun): chkconfig -#Requires(pre): shadow-utils - -%description client -This package includes the client utilities that are required to monitor a -ups that the client host has access to, but where the UPS is physically -attached to a different computer on the network. - -%package devel -Group: Development/Libraries -Summary: Development files for NUT Client -Requires: %{name}-client = %{version}-%{release} webserver openssl-devel - -%description devel -This package contains the development header files and libraries -necessary to develop NUT client applications. - -%prep -%setup -q - -%build -/usr/bin/rm configure.in - -%configure \ - --with-all \ - --without-powerman \ - --without-avahi \ - --without-usb \ - --without-ipmi \ - --without-cgi \ - --datadir=%{_datadir}/%{name} \ - --with-user=%{nut_id} \ - --with-group=%{nut_group} \ - --with-statepath=%{piddir} \ - --with-pidpath=%{piddir} \ - --with-altpidpath=%{piddir} \ - --sysconfdir=%{confdir} \ - --with-cgipath=%{cgidir} \ - --with-drvpath=%{_sbindir} \ - --with-pkgconfig-dir=%{_libdir}/pkgconfig \ - --disable-static \ - --libdir=%{_libdir} \ - --program-transform-name=s,^%{_target_platform}-,, \ - LDFLAGS="$LDFLAGS -Wl,-brtl" \ -# --with-libltdl-includes=/opt/freeware/share/libtool/libltdl/libltdl/ \ -# --with-libltdl-libs=/opt/freeware/lib \ -# --with-doc \ asciidoc >= 8.6.3 is required - -# FIXME: remove rpath? -#sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool -#sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool - -make %{?_smp_mflags} - -%install -/usr/bin/rm -rf %{buildroot} - -/usr/bin/mkdir -p %{buildroot}%{_sbindir} \ - %{buildroot}%{piddir} \ - %{buildroot}%{_libdir}/ups \ - %{buildroot}%{initdir} \ - %{buildroot}%{_libexecdir} - -make install DESTDIR=%{buildroot} - -install -m 755 %{SOURCE1} %{buildroot}%{initdir}/ups - -/usr/bin/rm -f %{buildroot}%{_libdir}/*.la - -# Remove ".sample" suffix from the config filenames -#pushd conf; -#make install DESTDIR=%{buildroot} -#for file in %{buildroot}%{confdir}/*.sample -#do -# mv $file %{buildroot}%{confdir}/`basename $file .sample` -#done -#popd - -%pre -/usr/bin/test -L %{_libdir}/ups || \ -/usr/bin/mkdir -p %{_libdir}/ups -/usr/bin/grep -qc %{nut_group} /etc/group || \ -/usr/bin/mkgroup %{nut_group} -/usr/bin/grep -qc %{nut_id} /etc/passwd || \ -/usr/sbin/useradd -c "Network UPS Tools" \ - -g %{nut_group} -d %{_libdir}/ups %{nut_id} -/usr/bin/test -L %{piddir} || \ -/usr/bin/mkdir -p %{piddir} -/usr/bin/chmod 750 %{piddir} -/usr/bin/chown %{nut_id}:%{nut_group} %{piddir} - -%post -/usr/bin/test -L %{rcdir}/rc2.d/Sups || \ -/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Sups -/usr/bin/test -L %{rcdir}/rc2.d/Kups || \ -/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Kups -exit 0 - -%preun -%{initdir}/ups stop -if [ "$1" = "0" ]; then - /usr/bin/rm -f %{rcdir}/rc2.d/[SK]ups -fi -exit 0 - -%postun -if [ "$1" = "0" ]; then - /usr/bin/grep -qc %{nut_id} /etc/passwd && \ - /usr/sbin/userdel %{nut_id} - /usr/bin/grep -qc %{nut_group}: /etc/group && \ - /usr/sbin/rmgroup %{nut_group} - /usr/bin/test -L %{piddir} && \ - /usr/bin/rm -rf %{piddir} - /usr/bin/test -L %{_libdir}/ups && \ - /usr/bin/rm -rf %{_libdir}/ups -fi -exit 0 - -%pre client -/usr/bin/grep -qc %{nut_group}: /etc/group || \ -/usr/bin/mkgroup %{nut_group} -/usr/bin/grep -qc %{nut_id} /etc/passwd || \ -/usr/sbin/useradd -c "Network UPS Tools" \ - -g %{nut_group} -d %{_libdir}/ups %{nut_id} -/usr/bin/test -L %{piddir} || \ -/usr/bin/mkdir -p %{piddir} -/usr/bin/chmod 750 %{piddir} -/usr/bin/chown %{nut_id}:%{nut_group} %{piddir} - -%post client -/usr/bin/test -L %{rcdir}/rc2.d/Sups || \ -/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Sups -/usr/bin/test -L %{rcdir}/rc2.d/Kups || \ -/usr/bin/ln -s %{initdir}/ups %{rcdir}/rc2.d/Kups -#%{initdir}/ups start -exit 0 - -%preun client -%{initdir}/ups stop -remove="no" -if /usr/bin/rpm -q nut >/dev/null 2>&1; then - remove="no" -elif [ "$1" = "0" ]; then - remove="yes" -fi -if [ "$remove" = "yes" ]; then - /usr/bin/rm -f %{rcdir}/rc2.d/[SK]ups - /usr/bin/test -L %{piddir} && \ - /usr/bin/rm -rf %{piddir} -fi -exit 0 - -%postun client -remove="no" -if /usr/bin/rpm -q nut >/dev/null 2>&1; then - remove="no" -elif [ "$1" = "0" ]; then - remove="yes" -fi -if [ "$remove" = "yes" ]; then - /usr/bin/grep -qc %{nut_id} /etc/passwd && \ - /usr/sbin/userdel %{nut_id} - /usr/bin/grep -qc %{nut_group}: /etc/group && \ - /usr/sbin/rmgroup %{nut_group} -#else -# %{initdir}/ups start -fi -exit 0 - -%clean -/usr/bin/rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%attr(755,root,root) %{initdir}/ups -%doc COPYING ChangeLog AUTHORS MAINTAINERS README docs UPGRADING INSTALL NEWS -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/nut.conf.sample -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/ups.conf.sample -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsd.conf.sample -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsd.users.sample -%dir %attr(750,%nut_id,%nut_group) %{_libdir}/ups -#%ghost %{piddir} -%{_sbindir}/* -%{_bindir}/upslog -%{_bindir}/nutconf -%{_libdir}/libnutscan.so* -%{_libdir}/libupsclient.so* -%{_datadir}/%{name}/cmdvartab -%{_datadir}/%{name}/driver.list -%{_mandir}/man5/nut.conf.5 -%{_mandir}/man5/ups.conf.5 -%{_mandir}/man5/upsd.conf.5 -%{_mandir}/man5/upsd.users.5 -%{_mandir}/man8/apcsmart.8 -%{_mandir}/man8/bcmxcp.8 -#%{_mandir}/man8/bcmxcp_usb.8 -%{_mandir}/man8/belkin.8 -%{_mandir}/man8/bestfcom.8 -%{_mandir}/man8/belkinunv.8 -%{_mandir}/man8/bestfortress.8 -%{_mandir}/man8/bestups.8 -%{_mandir}/man8/bestuferrups.8 -%{_mandir}/man8/blazer.8 -%{_mandir}/man8/clone.8 -%{_mandir}/man8/dummy-ups.8 -%{_mandir}/man8/everups.8 -%{_mandir}/man8/etapro.8 -%{_mandir}/man8/gamatronic.8 -%{_mandir}/man8/genericups.8 -%{_mandir}/man8/isbmex.8 -%{_mandir}/man8/ivtscd.8 -%{_mandir}/man8/liebert.8 -%{_mandir}/man8/liebert-esp2.8 -%{_mandir}/man8/masterguard.8 -%{_mandir}/man8/metasys.8 -%{_mandir}/man8/microdowell.8 -%{_mandir}/man8/mge-utalk.8 -%{_mandir}/man8/mge-shut.8 -%{_mandir}/man8/nutupsdrv.8 -%{_mandir}/man8/oneac.8 -%{_mandir}/man8/optiups.8 -%{_mandir}/man8/powercom.8 -#%{_mandir}/man8/powerman-pdu.8 -%{_mandir}/man8/powerpanel.8 -%{_mandir}/man8/rhino.8 -#%{_mandir}/man8/richcomm_usb.8 -%{_mandir}/man8/safenet.8 -%{_mandir}/man8/snmp-ups.8 -%{_mandir}/man8/solis.8 -%{_mandir}/man8/tripplite.8 -#%{_mandir}/man8/tripplite_usb.8 -%{_mandir}/man8/tripplitesu.8 -%{_mandir}/man8/victronups.8 -%{_mandir}/man8/upscode2.8 -%{_mandir}/man8/upsd.8 -%{_mandir}/man8/upsdrvctl.8 - -%files client -%doc COPYING -%defattr(-,root,root) -%attr(755,root,root) %{initdir}/ups -%dir %{confdir} -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upsmon.conf.sample -%config(noreplace) %attr(640,root,%nut_group) %{confdir}/upssched.conf.sample -%dir %attr(750,%nut_id,%nut_group) %{_libdir}/ups -#%ghost %{piddir} -%{_bindir}/upsc -%{_bindir}/upscmd -%{_bindir}/upsrw -%{_sbindir}/upsmon -%{_sbindir}/upssched -%{_bindir}/upssched-cmd -%{_libdir}/libupsclient.so* -%{_mandir}/man5/upsmon.conf.5 -%{_mandir}/man5/upssched.conf.5 -%{_mandir}/man8/upsc.8 -%{_mandir}/man8/upscmd.8 -%{_mandir}/man8/upsrw.8 -%{_mandir}/man8/upslog.8 -%{_mandir}/man8/upsmon.8 -%{_mandir}/man8/upssched.8 - -%files devel -%defattr(-,root,root,-) -%{_includedir}/* -%{_mandir}/man3/upscli* -%{_libdir}/libupsclient.so* -%{_libdir}/pkgconfig/libupsclient.pc - -%changelog -* Tue Jul 12 2014 Arnaud Quette - 2.7.2-1.master -- Minor adjustments - -* Tue Jul 12 2011 Arnaud Quette - 2.6.5-1.trunk -- derive from RHEL 2.6.1-2, and adapt for Aix 6.1 diff --git a/scripts/Aix/nut.init.in b/scripts/Aix/nut.init.in deleted file mode 100755 index 018777e..0000000 --- a/scripts/Aix/nut.init.in +++ /dev/null @@ -1,171 +0,0 @@ -#! /bin/sh -# -# ups: Starts the Network UPS Tools -# -# chkconfig: - 26 74 -# description: Network UPS Tools is a collection of programs which provide a common \ -# interface for monitoring and administering UPS hardware. -# processname: upsd -# config: /usr/local/ups/etc -# config: /etc/rc.ups -# -### BEGIN INIT INFO -# Provides: ups -# Required-Start: $syslog $network $named -# Required-Stop: $local_fs -# Default-Stop: 0 1 6 -# Short-Description: Starts the Network UPS tools -# Description: Network UPS Tools is a collection of programs which provide a common \ -# interface for monitoring and administering UPS hardware. -### END INIT INFO - -success() { - echo OK -} - -failure() { - echo FAILED -} - -# Resolve what processes should run -SERVER="no" -CLIENT="no" - -NUT_DIR="@prefix@" -NUT_SBIN_DIR="${NUT_DIR}/sbin" -NUT_LIB_DIR="${NUT_DIR}/lib" -NUT_RUN_DIR="@PIDPATH@/nut" -CONFIG="@CONFPATH@/nut.conf" -NUTUSER="@RUN_AS_USER@" -NUTGROUP="@RUN_AS_GROUP@" -NUT_VAR_LOCK="/var/locks/ups" - -if [ -f "$CONFIG" ] ; then - . "$CONFIG" - - case "$MODE" in - standalone|netserver) - SERVER="yes" - ;; - esac - - rpm -q nut-client >/dev/null 2>&1 && CLIENT="yes" -fi - -do_start() { - RETVAL=0 - - if [ ! -d "$NUT_RUN_DIR" ]; then - mkdir -p "$NUT_RUN_DIR" && \ - chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \ - chmod 770 "$NUT_RUN_DIR" - RETVAL=$? - fi - - if [ "$SERVER" = "yes" ]; then - echo "Starting UPS driver controller: \c" - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsdrvctl start >/dev/null 2>&1 && success || { RETVAL=$?; failure; } - - echo "Starting upsd: \c" - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsd $UPSD_OPTIONS >/dev/null 2>&1 && success || { RETVAL=$?; failure; } - fi - - if [ "$CLIENT" = "yes" ]; then - echo "Starting UPS monitor: \c" - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon >/dev/null 2>&1 && success || { RETVAL=$?; failure; } - fi - - [ "$RETVAL" = 0 ] && touch "${NUT_VAR_LOCK}" - return $RETVAL -} - -do_stop() { - RETVAL=0 - if test -e "${NUT_RUN_DIR}"/upsmon.pid; then - echo "Stopping UPS monitor: \c" - PID="`cat "${NUT_RUN_DIR}"/upsmon.pid`" - kill -15 $PID && success || { RETVAL=$?; failure; } - rm "${NUT_RUN_DIR}"/upsmon.pid - fi - - if [ "$SERVER" = "yes" ]; then - if test -e "${NUT_RUN_DIR}"/upsd.pid; then - echo "Stopping upsd: \c" - PID="`cat "${NUT_RUN_DIR}"/upsd.pid`" - kill -15 $PID && success || { RETVAL=$?; failure; } - rm "${NUT_RUN_DIR}"/upsd.pid - fi - - echo "Shutting down UPS driver controller: \c" - "${NUT_SBIN_DIR}"/upsdrvctl stop > /dev/null 2>&1 && success || { RETVAL=$?; failure; } - fi - [ "$RETVAL" = 0 ] && rm -f "${NUT_VAR_LOCK}" - return $RETVAL -} - -do_restart() { - do_stop - waitmore=5 - while [ -n "$(ls "${NUT_RUN_DIR}"/)" -a $waitmore -ge 1 ] - do - sleep 1 - waitmore="$(expr $waitmore - 1)" - done - do_start -} - -do_reload() { - # FIXME: upsd and upsmon always return 0 - # => can't tell if reload was successful - RETVAL=0 - if [ "$SERVER" = "yes" ]; then - echo "Reloading upsd" - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsd -c reload && success || { RETVAL=$?; failure; } - fi - - echo "Reloading upsmon" - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon -c reload && success || { RETVAL=$?; failure; } - return $RETVAL -} - -# See how we are called. -case "$1" in - start) - do_start ;; - - stop) - do_stop ;; - - restart) - do_restart ;; - - try-restart) - [ -f "${NUT_VAR_LOCK}" ] && do_restart || true - ;; - - reload) - do_reload ;; - - force-reload) - do_restart ;; - - status) - if [ "$SERVER" = "yes" ]; then - if test -f "${NUT_VAR_LOCK}"; then - echo "upsd is running with PID" `cat "${NUT_RUN_DIR}"/upsd.pid` - fi - fi - - if test -e "${NUT_RUN_DIR}"/upsmon.pid; then - echo "upsmon is running with PID" `cat "${NUT_RUN_DIR}"/upsmon.pid` - elif rpm -q nut-client >/dev/null 2>&1; then - echo "upsmon isn't running" - fi - ;; - - *) - echo "Usage: $0 {start|stop|restart|try-restart|reload|force-reload|status}" - RETVAL=3 -esac - -exit $RETVAL diff --git a/scripts/Makefile.am b/scripts/Makefile.am index ef6a1dd..b6dde24 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,30 +1,27 @@ EXTRA_DIST = README \ - avahi/nut.service.in \ - HP-UX/nut-drvctl \ - HP-UX/nut-drvctl.sh \ - HP-UX/nut-upsd \ - HP-UX/nut-upsd.sh \ - HP-UX/nut-upsmon \ - HP-UX/nut-upsmon.sh \ - logrotate/nutlogd \ - misc/nut.bash_completion \ - misc/osd-notify \ - perl/Nut.pm \ - RedHat/halt.patch \ - RedHat/README \ - RedHat/ups \ - RedHat/upsd \ - RedHat/upsd.in \ - RedHat/upsmon \ - RedHat/upsmon.in \ - Solaris8/S99upsmon \ - subdriver/gen-usbhid-subdriver.sh \ - subdriver/gen-snmp-subdriver.sh \ - ufw/README \ - upower/95-upower-hid.rules \ - Windows/halt.c \ - Windows/Makefile +avahi/nut.service.in \ +HP-UX/nut-drvctl \ +HP-UX/nut-drvctl.sh \ +HP-UX/nut-upsd \ +HP-UX/nut-upsd.sh \ +HP-UX/nut-upsmon \ +HP-UX/nut-upsmon.sh \ +logrotate/nutlogd \ +misc/nut.bash_completion \ +misc/osd-notify \ +perl/Nut.pm \ +RedHat/halt.patch \ +RedHat/README \ +RedHat/ups \ +RedHat/upsd \ +RedHat/upsd.in \ +RedHat/upsmon \ +RedHat/upsmon.in \ +Solaris8/S99upsmon \ +subdriver/gen-usbhid-subdriver.sh \ +ufw/README \ +upower/95-upower-hid.rules \ +Windows/halt.c \ +Windows/Makefile -SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl - -MAINTAINERCLEANFILES = Makefile.in .dirstamp +SUBDIRS = augeas hal hotplug python systemd udev Solaris diff --git a/scripts/Makefile.in b/scripts/Makefile.in index def2e6a..fad5e58 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -14,61 +15,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -89,24 +52,19 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = scripts +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -115,43 +73,25 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -159,33 +99,12 @@ am__can_run_installinfo = \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir distdir-am -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -215,11 +134,9 @@ am__relativize = \ A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -230,7 +147,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -244,7 +160,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -257,8 +172,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -268,15 +186,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -287,29 +204,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -329,9 +238,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -340,16 +246,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -363,7 +265,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -374,12 +275,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -398,21 +295,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -423,34 +317,32 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ EXTRA_DIST = README \ - avahi/nut.service.in \ - HP-UX/nut-drvctl \ - HP-UX/nut-drvctl.sh \ - HP-UX/nut-upsd \ - HP-UX/nut-upsd.sh \ - HP-UX/nut-upsmon \ - HP-UX/nut-upsmon.sh \ - logrotate/nutlogd \ - misc/nut.bash_completion \ - misc/osd-notify \ - perl/Nut.pm \ - RedHat/halt.patch \ - RedHat/README \ - RedHat/ups \ - RedHat/upsd \ - RedHat/upsd.in \ - RedHat/upsmon \ - RedHat/upsmon.in \ - Solaris8/S99upsmon \ - subdriver/gen-usbhid-subdriver.sh \ - subdriver/gen-snmp-subdriver.sh \ - ufw/README \ - upower/95-upower-hid.rules \ - Windows/halt.c \ - Windows/Makefile +avahi/nut.service.in \ +HP-UX/nut-drvctl \ +HP-UX/nut-drvctl.sh \ +HP-UX/nut-upsd \ +HP-UX/nut-upsd.sh \ +HP-UX/nut-upsmon \ +HP-UX/nut-upsmon.sh \ +logrotate/nutlogd \ +misc/nut.bash_completion \ +misc/osd-notify \ +perl/Nut.pm \ +RedHat/halt.patch \ +RedHat/README \ +RedHat/ups \ +RedHat/upsd \ +RedHat/upsd.in \ +RedHat/upsmon \ +RedHat/upsmon.in \ +Solaris8/S99upsmon \ +subdriver/gen-usbhid-subdriver.sh \ +ufw/README \ +upower/95-upower-hid.rules \ +Windows/halt.c \ +Windows/Makefile -SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl -MAINTAINERCLEANFILES = Makefile.in .dirstamp +SUBDIRS = augeas hal hotplug python systemd udev Solaris all: all-recursive .SUFFIXES: @@ -466,13 +358,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -491,25 +384,22 @@ clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -524,12 +414,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -545,7 +480,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -557,11 +497,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -570,29 +514,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -682,7 +608,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am @@ -749,22 +674,22 @@ ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic clean-libtool cscopelist-am ctags \ - ctags-am distclean distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags tags-am uninstall uninstall-am - -.PRECIOUS: Makefile +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/scripts/README b/scripts/README index f31e103..f4251da 100644 --- a/scripts/README +++ b/scripts/README @@ -2,6 +2,8 @@ These directories hold various scripts: - example startup and shutdown scripts for various operating systems and distributions, - hotplug and udev integration for on the fly privileges settings (Linux only), +- Hardware Abstraction Layer script, for declaring and binding NUT addons to +specific USB devices, - UPower (previously DeviceKit-power) rules file, - Python Client module and application, - Perl client module, diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index 1544c79..15075b0 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -1,88 +1,17 @@ -EXTRA_DIST = makelocal.sh precheck.py.in preproto.pl.in README -PROTOTYPE_DIR = $(DESTDIR)@prefix@ -SOLARIS_CHECK_TARGETS = -PYTHON = @PYTHON@ +EXTRA_DIST = makelocal.sh -SOLARIS_SMF_MANIFESTS = \ - nut.xml \ - nut-server.xml \ - nut-monitor.xml \ - nut-driver.xml \ - nut-driver-enumerator.xml - -SOLARIS_SMF_METHODSCRIPTS = \ - svc-nut-server \ - svc-nut-monitor - -if WITH_SOLARIS_SMF -# OS equivalent of /lib/svc/method and /var/svc/manifest/application -# but we can just use then from this location -solarissmfmethoddir = @datadir@/solaris-smf/method -solarissmfmanifestdir = @datadir@/solaris-smf/manifest -solarissmfmethod_SCRIPTS = $(SOLARIS_SMF_METHODSCRIPTS) -solarissmfmanifest_DATA = $(SOLARIS_SMF_MANIFESTS) - -libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh - -sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl - -SOLARIS_CHECK_TARGETS += check-local-solaris-smf -endif - -solarisinitscriptdir = @datadir@/solaris-init -solarisinitscript_SCRIPTS = nut - -SOLARIS_PACKAGE_TARGETS = - -if WITH_SOLARIS_PKG_IPS -SOLARIS_PACKAGE_TARGETS += package-solaris-ips -endif - -if WITH_SOLARIS_PKG_SVR4 -SOLARIS_PACKAGE_TARGETS += package-solaris-svr4 -endif - -package: $(SOLARIS_PACKAGE_TARGETS) - -# TODO: Reduce build dependencies (implicit!) on python and perl -# by shelling the scripts used below -# NOTE: This assumes the rest of the product has already been built -# and installed under PROTOTYPE_DIR, but declares no explicit -# dependency on that -SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS = makelocal.sh precheck.py preproto.pl -SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS = preinstall postinstall preremove postremove -SOLARIS_PACKAGE_SVR4_INSTALLDATA = pkginfo -package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) - if test -n "@auglensdir@" && test -d "$(DESTDIR)@auglensdir@" ; then \ - mkdir -p "$(DESTDIR)@datadir@/augeas-lenses" && \ - cd "$(DESTDIR)@auglensdir@" && \ - ( cp -prf ./ "$(DESTDIR)@datadir@/augeas-lenses/" || cp -rf ./ "$(DESTDIR)@datadir@/augeas-lenses/" ) ; fi - cd $(PROTOTYPE_DIR) && find . -print | pkgproto > prototype1 - cp $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) $(PROTOTYPE_DIR) - cd $(PROTOTYPE_DIR) && chmod +x $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) - cd $(PROTOTYPE_DIR) && perl preproto.pl -if HAVE_PYTHON - cd $(PROTOTYPE_DIR) && $(PYTHON) precheck.py -endif - cd $(PROTOTYPE_DIR) && rm -f prototype1 - cd $(PROTOTYPE_DIR) && ./makelocal.sh - cp $(PROTOTYPE_DIR)/*.gz $(builddir) - UNAME_P="`uname -p`" && case "$${UNAME_P}" in \ - i386|sparc) \ - mv -f NUT_solaris_package.local.gz "$(abs_top_builddir)/NUT_solaris_$${UNAME_P}_package@PACKAGE_VERSION@.local.gz" ;; \ - esac - -# TODO: Define support for IPS packaging (provide p5m files and make rules) -package-solaris-ips: - @echo "SKIPPED : Target $@ is not implemented yet" - -check-local: $(SOLARIS_CHECK_TARGETS) - -check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) - @[ -x /usr/sbin/svccfg ] || { echo "WARNING : Target $@ skipped due to absent /usr/sbin/svccfg" >&2; return 0; } ; \ - RES=0 ; for F in $^ ; do \ - echo " SVCCFG-VALIDATE $$F"; \ - /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ - done; exit $$RES - -MAINTAINERCLEANFILES = Makefile.in .dirstamp +package: makelocal.sh pkginfo + $ cd @prefix@; $ find . -print | pkgproto > prototype1 + $ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@ + $ cd @prefix@; perl preproto.pl + $ cd @prefix@; python precheck.py + $ cd @prefix@; rm -f prototype1 + $ cd @prefix@; ./makelocal.sh + $ cp @prefix@/*.gz $(srcdir) + if test `uname -p` = "i386"; then \ + mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \ + else \ + if test `uname -p` = "sparc"; then \ + mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \ + fi; \ + fi; diff --git a/scripts/Solaris/Makefile.in b/scripts/Solaris/Makefile.in index b618339..d6f845b 100644 --- a/scripts/Solaris/Makefile.in +++ b/scripts/Solaris/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,64 +14,24 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - - VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,28 +51,22 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@WITH_SOLARIS_SMF_TRUE@am__append_1 = check-local-solaris-smf -@WITH_SOLARIS_PKG_IPS_TRUE@am__append_2 = package-solaris-ips -@WITH_SOLARIS_PKG_SVR4_TRUE@am__append_3 = package-solaris-svr4 subdir = scripts/Solaris +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nut.in $(srcdir)/pkginfo.in $(srcdir)/postinstall.in \ + $(srcdir)/preremove.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -120,69 +75,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nut-driver-enumerator.xml nut-driver.xml \ - nut-monitor.xml nut-server.xml nut.xml pkginfo svc-nut-server \ - svc-nut-monitor precheck.py preinstall postinstall preremove \ - postremove preproto.pl nut +CONFIG_CLEAN_FILES = pkginfo postinstall preremove nut CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \ - "$(DESTDIR)$(solarisinitscriptdir)" \ - "$(DESTDIR)$(solarissmfmethoddir)" \ - "$(DESTDIR)$(solarissmfmanifestdir)" -SCRIPTS = $(libexec_SCRIPTS) $(sbin_SCRIPTS) \ - $(solarisinitscript_SCRIPTS) $(solarissmfmethod_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -190,27 +92,13 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -DATA = $(solarissmfmanifest_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/nut-driver-enumerator.xml.in \ - $(srcdir)/nut-driver.xml.in $(srcdir)/nut-monitor.xml.in \ - $(srcdir)/nut-server.xml.in $(srcdir)/nut.in \ - $(srcdir)/nut.xml.in $(srcdir)/pkginfo.in \ - $(srcdir)/postinstall.in $(srcdir)/postremove.in \ - $(srcdir)/precheck.py.in $(srcdir)/preinstall.in \ - $(srcdir)/preproto.pl.in $(srcdir)/preremove.in \ - $(srcdir)/svc-nut-monitor.in $(srcdir)/svc-nut-server.in \ - README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -221,7 +109,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -235,7 +122,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -248,8 +134,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -259,15 +148,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -278,29 +166,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -320,9 +200,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -331,16 +208,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -354,7 +227,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -365,12 +237,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -389,21 +257,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -413,42 +278,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST = makelocal.sh precheck.py.in preproto.pl.in README -PROTOTYPE_DIR = $(DESTDIR)@prefix@ -SOLARIS_CHECK_TARGETS = $(am__append_1) -SOLARIS_SMF_MANIFESTS = \ - nut.xml \ - nut-server.xml \ - nut-monitor.xml \ - nut-driver.xml \ - nut-driver-enumerator.xml - -SOLARIS_SMF_METHODSCRIPTS = \ - svc-nut-server \ - svc-nut-monitor - - -# OS equivalent of /lib/svc/method and /var/svc/manifest/application -# but we can just use then from this location -@WITH_SOLARIS_SMF_TRUE@solarissmfmethoddir = @datadir@/solaris-smf/method -@WITH_SOLARIS_SMF_TRUE@solarissmfmanifestdir = @datadir@/solaris-smf/manifest -@WITH_SOLARIS_SMF_TRUE@solarissmfmethod_SCRIPTS = $(SOLARIS_SMF_METHODSCRIPTS) -@WITH_SOLARIS_SMF_TRUE@solarissmfmanifest_DATA = $(SOLARIS_SMF_MANIFESTS) -@WITH_SOLARIS_SMF_TRUE@libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh -@WITH_SOLARIS_SMF_TRUE@sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl -solarisinitscriptdir = @datadir@/solaris-init -solarisinitscript_SCRIPTS = nut -SOLARIS_PACKAGE_TARGETS = $(am__append_2) $(am__append_3) - -# TODO: Reduce build dependencies (implicit!) on python and perl -# by shelling the scripts used below -# NOTE: This assumes the rest of the product has already been built -# and installed under PROTOTYPE_DIR, but declares no explicit -# dependency on that -SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS = makelocal.sh precheck.py preproto.pl -SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS = preinstall postinstall preremove postremove -SOLARIS_PACKAGE_SVR4_INSTALLDATA = pkginfo -MAINTAINERCLEANFILES = Makefile.in .dirstamp +EXTRA_DIST = makelocal.sh all: all-am .SUFFIXES: @@ -464,13 +294,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Solaris/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/Solaris/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -481,214 +312,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -nut-driver-enumerator.xml: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-driver.xml: $(top_builddir)/config.status $(srcdir)/nut-driver.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-monitor.xml: $(top_builddir)/config.status $(srcdir)/nut-monitor.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-server.xml: $(top_builddir)/config.status $(srcdir)/nut-server.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut.xml: $(top_builddir)/config.status $(srcdir)/nut.xml.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ pkginfo: $(top_builddir)/config.status $(srcdir)/pkginfo.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -svc-nut-server: $(top_builddir)/config.status $(srcdir)/svc-nut-server.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -svc-nut-monitor: $(top_builddir)/config.status $(srcdir)/svc-nut-monitor.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -precheck.py: $(top_builddir)/config.status $(srcdir)/precheck.py.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -preinstall: $(top_builddir)/config.status $(srcdir)/preinstall.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ postinstall: $(top_builddir)/config.status $(srcdir)/postinstall.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ preremove: $(top_builddir)/config.status $(srcdir)/preremove.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -postremove: $(top_builddir)/config.status $(srcdir)/postremove.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -preproto.pl: $(top_builddir)/config.status $(srcdir)/preproto.pl.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nut: $(top_builddir)/config.status $(srcdir)/nut.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libexecSCRIPTS: $(libexec_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-libexecSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(libexecdir)'; $(am__uninstall_files_from_dir) -install-sbinSCRIPTS: $(sbin_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-sbinSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) -install-solarisinitscriptSCRIPTS: $(solarisinitscript_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(solarisinitscript_SCRIPTS)'; test -n "$(solarisinitscriptdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(solarisinitscriptdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(solarisinitscriptdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(solarisinitscriptdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(solarisinitscriptdir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-solarisinitscriptSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(solarisinitscript_SCRIPTS)'; test -n "$(solarisinitscriptdir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(solarisinitscriptdir)'; $(am__uninstall_files_from_dir) -install-solarissmfmethodSCRIPTS: $(solarissmfmethod_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(solarissmfmethod_SCRIPTS)'; test -n "$(solarissmfmethoddir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(solarissmfmethoddir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(solarissmfmethoddir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(solarissmfmethoddir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(solarissmfmethoddir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-solarissmfmethodSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(solarissmfmethod_SCRIPTS)'; test -n "$(solarissmfmethoddir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(solarissmfmethoddir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -install-solarissmfmanifestDATA: $(solarissmfmanifest_DATA) - @$(NORMAL_INSTALL) - @list='$(solarissmfmanifest_DATA)'; test -n "$(solarissmfmanifestdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(solarissmfmanifestdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(solarissmfmanifestdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(solarissmfmanifestdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(solarissmfmanifestdir)" || exit $$?; \ - done +tags: TAGS +TAGS: -uninstall-solarissmfmanifestDATA: - @$(NORMAL_UNINSTALL) - @list='$(solarissmfmanifest_DATA)'; test -n "$(solarissmfmanifestdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(solarissmfmanifestdir)'; $(am__uninstall_files_from_dir) -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -719,13 +364,9 @@ distdir-am: $(DISTFILES) fi; \ done check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -all-am: Makefile $(SCRIPTS) $(DATA) +all-am: Makefile installdirs: - for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(solarisinitscriptdir)" "$(DESTDIR)$(solarissmfmethoddir)" "$(DESTDIR)$(solarissmfmanifestdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -756,7 +397,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -777,14 +417,13 @@ info: info-am info-am: -install-data-am: install-solarisinitscriptSCRIPTS \ - install-solarissmfmanifestDATA install-solarissmfmethodSCRIPTS +install-data-am: install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-libexecSCRIPTS install-sbinSCRIPTS +install-exec-am: install-html: install-html-am @@ -822,65 +461,37 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \ - uninstall-solarisinitscriptSCRIPTS \ - uninstall-solarissmfmanifestDATA \ - uninstall-solarissmfmethodSCRIPTS +uninstall-am: -.MAKE: check-am install-am install-strip +.MAKE: install-am install-strip -.PHONY: all all-am check check-am check-local clean clean-generic \ - clean-libtool cscopelist-am ctags-am distclean \ - distclean-generic distclean-libtool distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-libexecSCRIPTS install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-sbinSCRIPTS \ - install-solarisinitscriptSCRIPTS \ - install-solarissmfmanifestDATA install-solarissmfmethodSCRIPTS \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am uninstall-libexecSCRIPTS \ - uninstall-sbinSCRIPTS uninstall-solarisinitscriptSCRIPTS \ - uninstall-solarissmfmanifestDATA \ - uninstall-solarissmfmethodSCRIPTS - -.PRECIOUS: Makefile +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am -package: $(SOLARIS_PACKAGE_TARGETS) -package-solaris-svr4: $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) - if test -n "@auglensdir@" && test -d "$(DESTDIR)@auglensdir@" ; then \ - mkdir -p "$(DESTDIR)@datadir@/augeas-lenses" && \ - cd "$(DESTDIR)@auglensdir@" && \ - ( cp -prf ./ "$(DESTDIR)@datadir@/augeas-lenses/" || cp -rf ./ "$(DESTDIR)@datadir@/augeas-lenses/" ) ; fi - cd $(PROTOTYPE_DIR) && find . -print | pkgproto > prototype1 - cp $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLDATA) $(PROTOTYPE_DIR) - cd $(PROTOTYPE_DIR) && chmod +x $(SOLARIS_PACKAGE_SVR4_HELPERSCRIPTS) $(SOLARIS_PACKAGE_SVR4_INSTALLSCRIPTS) - cd $(PROTOTYPE_DIR) && perl preproto.pl -@HAVE_PYTHON_TRUE@ cd $(PROTOTYPE_DIR) && $(PYTHON) precheck.py - cd $(PROTOTYPE_DIR) && rm -f prototype1 - cd $(PROTOTYPE_DIR) && ./makelocal.sh - cp $(PROTOTYPE_DIR)/*.gz $(builddir) - UNAME_P="`uname -p`" && case "$${UNAME_P}" in \ - i386|sparc) \ - mv -f NUT_solaris_package.local.gz "$(abs_top_builddir)/NUT_solaris_$${UNAME_P}_package@PACKAGE_VERSION@.local.gz" ;; \ - esac - -# TODO: Define support for IPS packaging (provide p5m files and make rules) -package-solaris-ips: - @echo "SKIPPED : Target $@ is not implemented yet" - -check-local: $(SOLARIS_CHECK_TARGETS) - -check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) - @[ -x /usr/sbin/svccfg ] || { echo "WARNING : Target $@ skipped due to absent /usr/sbin/svccfg" >&2; return 0; } ; \ - RES=0 ; for F in $^ ; do \ - echo " SVCCFG-VALIDATE $$F"; \ - /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ - done; exit $$RES +package: makelocal.sh pkginfo + $ cd @prefix@; $ find . -print | pkgproto > prototype1 + $ cp makelocal.sh precheck.py pkginfo nut preinstall postinstall preremove postremove preproto.pl @prefix@ + $ cd @prefix@; perl preproto.pl + $ cd @prefix@; python precheck.py + $ cd @prefix@; rm -f prototype1 + $ cd @prefix@; ./makelocal.sh + $ cp @prefix@/*.gz $(srcdir) + if test `uname -p` = "i386"; then \ + mv NUT_solaris_package.local.gz NUT_solaris_i386_package@PACKAGE_VERSION@.local.gz; \ + else \ + if test `uname -p` = "sparc"; then \ + mv NUT_solaris_package.local.gz NUT_solaris_sparc_package@PACKAGE_VERSION@.local.gz; \ + fi; \ + fi; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/scripts/Solaris/README b/scripts/Solaris/README deleted file mode 100644 index adb305e..0000000 --- a/scripts/Solaris/README +++ /dev/null @@ -1,38 +0,0 @@ -This directory contains init-scripts and SMF manifests and methods -for integration of NUT services with Solaris and descendant OSes. - -This also includes the nut-driver-enumerator.sh (service and implementation -method) and upsdrvsvcctl (tool) to manage NUT drivers as service instances, -which are stored in ../upsdrvsvcctl/ subdirectory (portable codebase shared -with Linux systemd). - -The default implementation (runs once) can be enabled with: - - svcadm enable nut-driver-enumerator:default - -Note that at the moment there is no out-of-the-box integration for triggering -a restart/refresh of the nut-driver-enumerator SMF service at the very instant -when the `ups.conf` file is modified, like there is with systemd path unit type. -Due to this, the systems administrator is expected to either invoke -`svcadm refresh nut-driver-enumerator` after changing the NUT configuration -or wait until the daemonized mode, if enabled, picks up the change (should do -so within a minute by default). However, a DTrace script or a tool like -https://github.com/emcrisostomo/fswatch wrapped into a service might be used -for equivalent effect. - -Alternatively, but somewhat more expensively, the same `nut-driver-enumerator.sh` -script can be executed in a loop as the payload of the SMF service to keep -inspecting the configuration and apply changes to the running system. It is -not a common use-case to keep changing device setups, so this solution is not -enforced by default ;) although a service variant is provided... - -Note that only one of these can be enabled at the same time: - - svcadm disable nut-driver-enumerator:default - svcadm enable nut-driver-enumerator:daemon - -Init-script solution contributed by numerous authors -SMF solution contributed by Jim Klimov - -For special notes about USB-connected device monitoring with NUT under Solaris -and related operating systems, see docs/solaris-usb.txt diff --git a/scripts/Solaris/makelocal.sh b/scripts/Solaris/makelocal.sh index f017c43..639e780 100755 --- a/scripts/Solaris/makelocal.sh +++ b/scripts/Solaris/makelocal.sh @@ -1,11 +1,5 @@ #!/bin/sh -# Creates the package file from current-directory contents -# Called by Makefile starting from installed prototype directory - -echo "Making Solaris SVR4 package metadata..." && \ -pkgmk -o -d "`pwd`" && \ -echo "Making Solaris SVR4 package archive file..." && \ -( yes "" | pkgtrans "`pwd`" "`pwd`/NUT_solaris_package.local" ) && \ -echo "Compressing Solaris SVR4 package archive file..." && \ -gzip "`pwd`/NUT_solaris_package.local" +pkgmk -o -d `pwd` +pkgtrans `pwd` `pwd`/NUT_solaris_package.local +gzip `pwd`/NUT_solaris_package.local diff --git a/scripts/Solaris/nut-driver-enumerator.xml.in b/scripts/Solaris/nut-driver-enumerator.xml.in deleted file mode 100644 index 55723c0..0000000 --- a/scripts/Solaris/nut-driver-enumerator.xml.in +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/Solaris/nut-driver.xml.in b/scripts/Solaris/nut-driver.xml.in deleted file mode 100644 index c52afac..0000000 --- a/scripts/Solaris/nut-driver.xml.in +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/Solaris/nut-monitor.xml.in b/scripts/Solaris/nut-monitor.xml.in deleted file mode 100644 index c3118d3..0000000 --- a/scripts/Solaris/nut-monitor.xml.in +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/Solaris/nut-server.xml.in b/scripts/Solaris/nut-server.xml.in deleted file mode 100644 index 6b3b4d0..0000000 --- a/scripts/Solaris/nut-server.xml.in +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/Solaris/nut.in b/scripts/Solaris/nut.in old mode 100755 new mode 100644 index 1c39603..b18b7fd --- a/scripts/Solaris/nut.in +++ b/scripts/Solaris/nut.in @@ -3,31 +3,29 @@ #init.d script to start nut services NUT_DIR="@prefix@" -NUT_SBIN_DIR="${NUT_DIR}/sbin" -NUT_LIB_DIR="${NUT_DIR}/lib" -CONFIG="@CONFPATH@/nut.conf" +CONFIG=$NUT_DIR/etc/nut.conf -if [ -f "$CONFIG" ] ; then - . "$CONFIG" +if [ -f $CONFIG ] ; then + . $CONFIG fi ups_stop () { pkill -n upsmon pkill -n upsd - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" stop > /dev/null 2>&1 + ${NUT_DIR}/bin/upsdrvctl stop > /dev/null 2>&1 } ups_start () { if [ "$MODE" = "none" ];then - echo "No NUT mode set, not starting anything" >&2 + echo No mode set exit 1 fi - if [ "$MODE" != "netclient" ] ; then - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" start #> /dev/null 2>&1 - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" #> /dev/null 2>&1 + if [ ! "$MODE" = "netclient" ];then + $NUT_DIR/bin/upsdrvctl start #> /dev/null 2>&1 + $NUT_DIR/sbin/upsd #> /dev/null 2>&1 fi - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsmon" #> /dev/null 2>&1 + $NUT_DIR/sbin/upsmon #> /dev/null 2>&1 } case $1 in @@ -48,11 +46,10 @@ case $1 in ups_start ;; 'poweroff') - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsmon" -K >/dev/null 2>&1 + $NUT_DIR/sbin/upsmon -K >/dev/null 2>&1 if [ $? = 0 ]; then - echo "Shutting down the UPS(es) ..." - echo "WARNING: UPS shutdown is currently disabled, please uncomment it in the init-script if desired" >&2 - #${NUT_SBIN_DIR}/upsdrvctl shutdown + echo "Shutting down the UPS ..." + #$NUT_DIR/bin/upsdrvctl shutdown fi ;; *) @@ -60,7 +57,7 @@ case $1 in echo "Usage: '$0' {start | stop | restart }" echo "" exit 64 - ;; + ;; esac exit $? diff --git a/scripts/Solaris/nut.xml.in b/scripts/Solaris/nut.xml.in deleted file mode 100644 index b06b2b1..0000000 --- a/scripts/Solaris/nut.xml.in +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/Solaris/pkginfo.in b/scripts/Solaris/pkginfo.in index 39667f0..d99bdbe 100644 --- a/scripts/Solaris/pkginfo.in +++ b/scripts/Solaris/pkginfo.in @@ -1,6 +1,6 @@ PKG="NUT" NAME="Network UPS Tools" -ARCH="@target_cpu@" +ARCH="@OS_NAME@" VERSION="@PACKAGE_VERSION@" CATEGORY="application" VENDOR="http://www.networkupstools.org" diff --git a/scripts/Solaris/postinstall.in b/scripts/Solaris/postinstall.in old mode 100755 new mode 100644 index a6068b4..3bf6226 --- a/scripts/Solaris/postinstall.in +++ b/scripts/Solaris/postinstall.in @@ -1,126 +1,65 @@ #!/bin/sh -# Postinstall script for Network UPS Tools package +#Postinstall script NUT_DIR="@prefix@" -prefix="@prefix@" # expanded as part of some autoconf macros below - -# TODO/FIXME : Should "/var/run" be a configure variable? -# Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime. -ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev" # make sure the nut user exists and has correct memberships -res="`getent group @RUN_AS_GROUP@`" || res="" +res=`getent group nut` if [ -z "$res" ]; then - /usr/sbin/groupadd "@RUN_AS_GROUP@" + groupadd nut fi -res="`getent passwd @RUN_AS_USER@`" || res="" +res=`getent passwd nut` if [ -z "$res" ]; then - /usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false @RUN_AS_USER@ + useradd -g nut -G root -d ${NUT_DIR}/bin nut fi -res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res="" +res=`groups nut | grep -w nut` if [ -z "$res" ]; then - /usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@" + usermod -g nut -G root nut fi # make sure that conffiles are secured and have the correct ownerships -if [ -d "@CONFPATH@" ] ; then - chown "root:@RUN_AS_GROUP@" "@CONFPATH@" +if [ -d @CONFPATH@ ] ; then + chown root:nut @CONFPATH@ fi -for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf nut-driver-enumerator.conf; do - if [ -f "@CONFPATH@/$file" ] ; then - chown "root:@RUN_AS_GROUP@" "@CONFPATH@/$file" - chmod 640 "@CONFPATH@/$file" +for file in nut.conf ups.conf upsd.conf upsmon.conf upsd.users upssched.conf; do + if [ -f @CONFPATH@/$file ] ; then + chown root:nut @CONFPATH@/$file + chmod 640 @CONFPATH@/$file fi done # make sure that /var/run/nut exists and has the correct ownerships -if [ ! -d "@PIDPATH@/nut" ] ; then - mkdir -p "@PIDPATH@/nut" +if [ ! -d @PIDPATH@/nut ] ; then + mkdir -p @PIDPATH@/nut fi -if [ -d "@PIDPATH@/nut" ] ; then - chown "root:@RUN_AS_GROUP@" "@PIDPATH@/nut" - chmod 770 "@PIDPATH@/nut" +if [ -d @PIDPATH@/nut ] ; then + chown root:nut @PIDPATH@/nut + chmod 770 @PIDPATH@/nut fi # make sure that /var/state/ups exists and has the correct ownerships -if [ ! -d "@STATEPATH@" ] ; then - mkdir -p "@STATEPATH@" +if [ ! -d @STATEPATH@ ] ; then + mkdir -p @STATEPATH@ fi -if [ -d "@STATEPATH@" ] ; then - chown "root:@RUN_AS_GROUP@" "@STATEPATH@" - chmod 770 "@STATEPATH@" +if [ -d @STATEPATH@ ] ; then + chown root:nut @STATEPATH@ + chmod 770 @STATEPATH@ fi -if [ -n "@auglensdir@" ] && [ -d "@auglensdir@" ] && [ -d "@datarootdir@/augeas-lenses" ] ; then - ( cd "@datarootdir@/augeas-lenses" && cp -prf ./ "@auglensdir@"/ ) -fi +# Put init script in /etc/init.d -if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then - echo "Register SMF services..." - for S in nut-driver-enumerator nut-driver nut-server nut-monitor nut ; do - echo "Importing NUT service manifest: $S..." - /usr/sbin/svccfg import "@datarootdir@/solaris-smf/manifest/$S.xml" - done - # Enable services if the system already has a configuration (e.g. upgrade) - if test -s "@CONFPATH@/ups.conf" ; then - echo "Stopping NUT drivers, if any (in case of upgrade)..." - @SBINDIR@/upsdrvsvcctl stop - @SBINDIR@/upsdrvctl -DDDDD stop - sleep 5 - echo "(Re-)register NUT drivers (if any)..." - REPORT_RESTART_42=no AUTO_START=no "@NUT_LIBEXECDIR@/nut-driver-enumerator.sh" --reconfigure - sleep 2 - echo "Enable NUT drivers (if any)..." - # Note: we now provide two services, a daemon that keeps checking - # the config for changes and a default one that should be refreshed - # manually to reconfigure nut-driver instances - and is "cheaper". - # This may still fail if the daemon instance is somehow enabled (admin) - PREV_ACTIVE_ENUMERATOR="" - if test -s "${ACTIVE_ENUMERATOR_FMRI_FILE}" ; then - PREV_ACTIVE_ENUMERATOR="`head -1 "${ACTIVE_ENUMERATOR_FMRI_FILE}"`" - fi - [ x"nut-driver-enumerator:default" = x"${PREV_ACTIVE_ENUMERATOR}" ] && PREV_ACTIVE_ENUMERATOR="" - for ACTIVE_ENUMERATOR in ${PREV_ACTIVE_ENUMERATOR} nut-driver-enumerator:default ; do - /usr/sbin/svcadm enable -s ${ACTIVE_ENUMERATOR} || \ - { /usr/sbin/svcadm clear ${ACTIVE_ENUMERATOR} 2>/dev/null ; \ - /usr/sbin/svcadm enable -s ${ACTIVE_ENUMERATOR} ; } && break || true - done - @SBINDIR@/upsdrvsvcctl start - else - echo "NOT ENABLING nut-driver-enumerator at this time : missing or empty @CONFPATH@/ups.conf" >&2 - fi - if test -s "@CONFPATH@/ups.conf" && test -e "@CONFPATH@/upsd.conf" && test -e "@CONFPATH@/upsd.users" ; then - # Note on the mix of "-s" and "-e" in tests above: - # it is a valid use-case for an admin to have just touched an - # empty upsd.conf and so use default settings for the daemon - echo "Enable NUT upsd data server..." - /usr/sbin/svcadm enable -s nut-server - else - echo "NOT ENABLING nut-server at this time : missing at least one of : @CONFPATH@/ups.conf @CONFPATH@/upsd.conf @CONFPATH@/upsd.users" >&2 - fi - if test -s "@CONFPATH@/upsmon.conf" ; then - echo "Enable NUT upsmon client..." - /usr/sbin/svcadm enable -s nut-monitor - else - echo "NOT ENABLING nut-monitor at this time : missing or empty @CONFPATH@/upsmon.conf" >&2 - fi - echo "Enable NUT umbrella service..." - /usr/sbin/svcadm enable -s nut -else - echo "Put init script in /etc/init.d..." - cp -pf "@NUT_DATADIR@/solaris-init/nut" /etc/init.d - chown root:bin /etc/init.d/nut - chmod 744 /etc/init.d/nut +cp $NUT_DIR/nut /etc/init.d +chmod 744 /etc/init.d/nut - ln -s ../init.d/nut /etc/rc3.d/S90nut > /dev/null 2>&1 - ln -s ../init.d/nut /etc/rc3.d/K10nut > /dev/null 2>&1 +ln -s /etc/init.d/nut /etc/rc3.d/S100nut > /dev/null 2>&1 +ln -s /etc/init.d/nut /etc/rc3.d/K100nut > /dev/null 2>&1 - # Start nut services +# Start nut services + +#echo "Starting nut services" +#$NUT_DIR/bin/upsdrvctl start #> /dev/null 2>&1 +#$NUT_DIR/sbin/upsd #> /dev/null 2>&1 +#$NUT_DIR/sbin/upsmon #> /dev/null 2>&1 - #echo "Starting nut services" - #$NUT_DIR/sbin/upsdrvctl start #> /dev/null 2>&1 - #$NUT_DIR/sbin/upsd #> /dev/null 2>&1 - #$NUT_DIR/sbin/upsmon #> /dev/null 2>&1 -fi diff --git a/scripts/Solaris/postremove.in b/scripts/Solaris/postremove.in deleted file mode 100755 index dce3f44..0000000 --- a/scripts/Solaris/postremove.in +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -# Postremove script for Network UPS Tools package - -# Remove init script from /etc/init.d - created by scripts not packaging - -rm -f /etc/init.d/nut -rm -f /etc/rc3.d/S90nut -rm -f /etc/rc3.d/K10nut - -# Remove nut group and user - -/usr/sbin/userdel "@RUN_AS_USER@" - -/usr/sbin/groupdel "@RUN_AS_GROUP@" - -# Remove /var/run/nut - -rm -rf "@PIDPATH@/nut" diff --git a/scripts/Solaris/precheck.py.in b/scripts/Solaris/precheck.py.in deleted file mode 100755 index 5a6457c..0000000 --- a/scripts/Solaris/precheck.py.in +++ /dev/null @@ -1,48 +0,0 @@ -#!@PYTHON@ - -import sys - -if sys.version_info >= ( 2, 6 ): - import subprocess - p = subprocess.Popen(["uname", "-s"], stdout=subprocess.PIPE) - platform = p.communicate()[0] - if p.returncode != 0: - raise Exception("FAILED to get platform from 'uname -s'!") - - p = subprocess.Popen(["uname", "-p"], stdout=subprocess.PIPE) - architecture = p.communicate()[0] - if p.returncode != 0: - raise Exception("FAILED to get architecture from 'uname -p'!") -else: - import commands - platform = commands.getoutput('uname -s') - architecture = commands.getoutput('uname -p') - -# checkinstall script creation -fp=open("checkinstall","w") -# Note: same arch is relevant for different bitnesses that -# can be discerned via `isainfo` further (if ever needed) -fp.write("#!/bin/sh\n") -fp.write("\nexpected_platform=SunOS\n") -if platform == "SunOS" and architecture == "i386": - fp.write("expected_architecture=i386\n") -elif platform == "SunOS" and architecture == "sparc": - fp.write("expected_architecture=sparc\n") - -fp.write("platform=\"`uname -s`\"\n") -fp.write("architecture=\"`uname -p`\"\n\n") - -fp.write("if [ \"${platform}\" -eq \"${expected_platform}\" ]; then\n") -fp.write("\tif [ \"${architecture}\" -eq \"${expected_architecture}\" ]; then\n") -fp.write("\t\techo \"Checkinstall complete\"\n") -fp.write("\telse\n") -fp.write("\t\techo \"This is not Solaris $architecture machine: platform='${platform}' expected_platform='${expected_platform}'\"\n") -fp.write("\t\texit 1\n") -fp.write("\tfi\n") -fp.write("else\n") -fp.write("\techo \"This is not Solaris machine: architecture='${architecture}' expected_architecture='${expected_architecture}'\"\n") -fp.write("\texit 1\n") -fp.write("fi\n") -fp.write("exit 0\n") - -fp.close() diff --git a/scripts/Solaris/preinstall.in b/scripts/Solaris/preinstall.in deleted file mode 100755 index 42da1ce..0000000 --- a/scripts/Solaris/preinstall.in +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# Preinstall script for Network UPS Tools package -NUT_DIR="@prefix@" - -# Create group nut - -grep -w "@RUN_AS_GROUP@" /etc/group -if [ "$?" != 0 ]; then - /usr/sbin/groupadd "@RUN_AS_GROUP@" -fi - -# Create user for installing "Network UPS Tools" - -grep -w "@RUN_AS_USER@" /etc/passwd -if [ "$?" != 0 ]; then - /usr/sbin/useradd -c "Network UPS Tools" -g "@RUN_AS_GROUP@" -G root -d "@STATEPATH@" -s /bin/false "@RUN_AS_USER@" -fi - -res="`groups "@RUN_AS_GROUP@" | grep -w "@RUN_AS_USER@"`" || res="" -if [ -z "$res" ]; then - /usr/sbin/usermod -g "@RUN_AS_GROUP@" -G root "@RUN_AS_USER@" -fi diff --git a/scripts/Solaris/preproto.pl.in b/scripts/Solaris/preproto.pl.in deleted file mode 100755 index ac52c16..0000000 --- a/scripts/Solaris/preproto.pl.in +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env perl - -$temp = "prototype1"; -$prototype="prototype"; -$pkginfo = "pkginfo"; -$checkinstall = "checkinstall"; -$preinstall = "preinstall"; -$postinstall = "postinstall"; -$preremove = "preremove"; -$postremove = "postremove"; -$nutuser = "@RUN_AS_USER@"; -$nutgroup = "@RUN_AS_GROUP@"; - -open (PREPROTO,"< $temp") || die "Unable to read prototype information ($!)\n"; -open (PROTO,"> $prototype") || die "Unable to write file prototype ($!)\n"; -print PROTO "i pkginfo=./$pkginfo\n"; -print PROTO "i checkinstall=./$checkinstall\n"; -print PROTO "i preinstall=./$preinstall\n"; -print PROTO "i postinstall=./$postinstall\n"; -print PROTO "i preremove=./$preremove\n"; -print PROTO "i postremove=./$postremove\n"; -while () { - # Read the prototype information from /tmp/prototype$$ - chomp; - $thisline = $_; - if ($thisline =~ " prototype1 ") { - # We don't need that line - } elsif ($thisline =~ "^[fd] ") { - # Change the ownership for files and directories - ($dir, $none, $file, $mode, $user, $group) = split / /,$thisline; - print PROTO "$dir $none $file=$file $mode $nutuser $nutgroup\n"; - } else { - # Symlinks and other stuff should be printed as well ofcourse - print PROTO "$thisline\n"; - } -} -#print PROTO "f $none nut $mode root $nutgroup\n"; -close PROTO; -close PREPROTO; diff --git a/scripts/Solaris/preremove.in b/scripts/Solaris/preremove.in old mode 100755 new mode 100644 index abce051..7096918 --- a/scripts/Solaris/preremove.in +++ b/scripts/Solaris/preremove.in @@ -1,71 +1,8 @@ -#!/bin/sh - -# Preremove script for Network UPS Tools package +#!bin/sh # Stop all nut services NUT_DIR="@prefix@" -prefix="@prefix@" # expanded as part of some autoconf macros below -# TODO/FIXME : Should "/var/run" be a configure variable? -# Note that "/var/run" is transient tmpfs, so upgrade has to be done during same uptime. -ACTIVE_ENUMERATOR_FMRI_FILE="/var/run/nut-driver-enumerator-fmri.prev" +#$NUT_DIR/bin/upsdrvctl stop -if test -x /usr/sbin/svcadm && test -x /usr/sbin/svccfg && test -x /usr/bin/svcs ; then - # Unconfigure SMF services - # First detect the first active (online, maintenance, etc.) - # instance of nut-driver-enumerator so we can pass it to the - # next lifetime in case of re-install of NUT and keep the - # user's previously declared preference. - ACTIVE_ENUMERATOR="`/usr/bin/svcs -H -o state,fmri '*/nut-driver-enumerator:*' | while read S F ; do [ "$S" != "disabled" ] && [ "$S" != "offline" ] && echo "$F" && break ; done`" - if [ -n "$ACTIVE_ENUMERATOR" ]; then - rm -f "${ACTIVE_ENUMERATOR_FMRI_FILE}" - touch "${ACTIVE_ENUMERATOR_FMRI_FILE}" - chmod 600 "${ACTIVE_ENUMERATOR_FMRI_FILE}" - chown 0:0 "${ACTIVE_ENUMERATOR_FMRI_FILE}" - echo "${ACTIVE_ENUMERATOR}" > "${ACTIVE_ENUMERATOR_FMRI_FILE}" - fi - # First tell the automagic to stop, so it does not interfere; diligently clean it out below - /usr/sbin/svcadm disable nut-driver-enumerator:default || true - /usr/sbin/svcadm disable nut-driver-enumerator:daemon || true - for S in nut nut-monitor nut-server ; do - echo "Stopping NUT service: $S..." - /usr/sbin/svcadm clear "$S" 2>/dev/null - /usr/sbin/svcadm disable -s "$S" - echo "Removing NUT service: $S..." - /usr/sbin/svccfg delete "$S" || \ - /usr/sbin/svccfg -s "$S" delete || \ - /usr/sbin/svccfg -s "$S" delete default - done - echo "Stopping NUT drivers, if any..." - @SBINDIR@/upsdrvsvcctl stop - @SBINDIR@/upsdrvctl -DDDDD stop - sleep 5 - for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*'` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*'` ; do - echo "Stopping NUT service: $S..." - /usr/sbin/svcadm clear "$S" 2>/dev/null - /usr/sbin/svcadm disable -s "$S" - done - sleep 5 - for S in `/usr/bin/svcs -H -o fmri '*/nut-driver:*' | grep -wv default` `/usr/bin/svcs -H -o fmri '*/nut-driver-enumerator:*' | grep -wv default` ; do - echo "Removing NUT service: $S..." - # Note: S here is a full FMRI URL - SB="`echo "$S" | sed 's,:[^:]*$,,'`" - SI="`echo "$S" | sed 's,^.*:\([^:]*\)$,\1,'`" - /usr/sbin/svcadm disable -s "$S" - /usr/sbin/svccfg -s "$SB" delete -f "$SI" || \ - /usr/sbin/svccfg delete "$S" - done - for S in nut-driver-enumerator nut-driver ; do - echo "Removing NUT service: $S..." && \ - /usr/sbin/svccfg delete "$S" || \ - /usr/sbin/svccfg -s "$S" delete || \ - /usr/sbin/svccfg -s "$S" delete default - done -else - [ -x /etc/init.d/nut ] && /etc/init.d/nut stop -fi - -if [ -n "@auglensdir@" ] && [ -d "@auglensdir@" ] && [ -d "@datarootdir@/augeas-lenses" ] ; then - ( cd "@datarootdir@/augeas-lenses" && find . -type f -exec rm -f "@auglensdir@"/'{}' \; ) -fi diff --git a/scripts/Solaris/svc-nut-monitor.in b/scripts/Solaris/svc-nut-monitor.in deleted file mode 100755 index a7dd0dc..0000000 --- a/scripts/Solaris/svc-nut-monitor.in +++ /dev/null @@ -1,56 +0,0 @@ -#!/sbin/sh - -# Trivial (better is yet to come) SMF method script to start nut services -# Adapted for OpenIndiana userland from init.d script template in NUT sources -# Adaptation copyright (C) 2016-2017 Jim Klimov - -if [ -z "$SMF_FMRI" ]; then - echo "$0 must be called in SMF context!" >&2 - exit 1 -fi - -# smf(5) -. /lib/svc/share/smf_include.sh || exit - -prefix="@prefix@" -NUT_DIR="@prefix@" -NUT_SBIN_DIR="${NUT_DIR}/sbin" -NUT_LIB_DIR="${NUT_DIR}/lib" -NUT_RUN_DIR="@PIDPATH@/nut" -CONFIG="@CONFPATH@/nut.conf" -NUTUSER="@RUN_AS_USER@" -NUTGROUP="@RUN_AS_GROUP@" - -if [ -f "$CONFIG" ] ; then - . "$CONFIG" -fi - -ups_start () { - if [ "$MODE" = "none" ];then - echo "No NUT mode set, not starting anything" >&2 - exit $SMF_EXIT_ERR_CONFIG - fi - - # Default rights inspired by NUT scripts/Solaris/postinstall.in - mkdir -p "$NUT_RUN_DIR" && \ - chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \ - chmod 770 "$NUT_RUN_DIR" \ - || exit $SMF_EXIT_ERR_FATAL - - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}"/upsmon #> /dev/null 2>&1 -} - -case "$1" in -'start') - ups_start - ;; - -*) - echo "" - echo "Usage: '$0' {start}" - echo "" - exit $SMF_EXIT_ERR_CONFIG - ;; -esac - -exit $? diff --git a/scripts/Solaris/svc-nut-server.in b/scripts/Solaris/svc-nut-server.in deleted file mode 100755 index 5fee9c1..0000000 --- a/scripts/Solaris/svc-nut-server.in +++ /dev/null @@ -1,64 +0,0 @@ -#!/sbin/sh - -# Trivial (better is yet to come) SMF method script to start nut services -# Adapted for OpenIndiana userland from init.d script template in NUT sources -# Adaptation copyright (C) 2016 Jim Klimov - -if [ -z "$SMF_FMRI" ]; then - echo "$0 must be called in SMF context!" >&2 - exit 1 -fi - -# smf(5) -. /lib/svc/share/smf_include.sh || exit - -prefix="@prefix@" -NUT_DIR="@prefix@" -NUT_SBIN_DIR="$NUT_DIR/sbin" -NUT_LIB_DIR="${NUT_DIR}/lib" -NUT_RUN_DIR="@PIDPATH@/nut" -CONFIG="@CONFPATH@/nut.conf" -NUTUSER="@RUN_AS_USER@" -NUTGROUP="@RUN_AS_GROUP@" - -if [ -f "$CONFIG" ] ; then - . "$CONFIG" -fi - -ups_start () { - # Default rights inspired by NUT scripts/Solaris/postinstall.in - mkdir -p "$NUT_RUN_DIR" && \ - chown "root:$NUTGROUP" "$NUT_RUN_DIR" && \ - chmod 770 "$NUT_RUN_DIR" \ - || exit $SMF_EXIT_ERR_FATAL - - if [ "$MODE" = "none" ];then - echo "No NUT mode set, not starting anything" >&2 - exit 1 - fi - - if [ "$MODE" != "netclient" ] ; then - # In this distribution, UPS drivers are wrapped by service instances - #LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsdrvctl" start #> /dev/null 2>&1 - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" #> /dev/null 2>&1 - fi -} - -case "$1" in -'start') - ups_start - ;; - -'refresh'|'reload') - LD_LIBRARY_PATH="${NUT_LIB_DIR}:$LD_LIBRARY_PATH" "${NUT_SBIN_DIR}/upsd" -c reload - ;; - -*) - echo "" - echo "Usage: '$0' {start}" - echo "" - exit $SMF_EXIT_ERR_CONFIG - ;; -esac - -exit $? diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index b9b8c8e..5ef4c1e 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -1,49 +1,16 @@ -EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \ +EXTRA_DIST = gen-nutupsconf-aug.py nutupsconf.aug.tpl \ README tests/test_nut.aug -PYTHON = @PYTHON@ - # only call the script to generate Augeas ups.conf lens upon "make dist", -# and if Python is present; the distributed gen-nutupsconf-aug.py.in template -# is assumed to only differ from a generated gen-nutupsconf-aug.py by the -# @PYTHON@ shebang. +# and if Python is present dist-hook: - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \ - echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \ - $(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \ + @if python -c "import re,glob,codecs"; then \ + echo "Regenerating Augeas ups.conf lens."; \ + $(distdir)/gen-nutupsconf-aug.py $(distdir)/; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping regeneration of Augeas lens for ups.conf parsing." ; \ + echo "Skipping Augeas ups.conf lens regeneration."; \ echo "----------------------------------------------------------------------"; \ fi - -# This needs augparse from augeas-tools -if HAVE_AUGPARSE -check-local: - @echo "augparse proceeding to lenses verification job..."; \ - echo "DISABLED for now due to https://github.com/networkupstools/nut/issues/657" -endif -# FIXME -# augparse -I $(srcdir)/ $(srcdir)/tests/test_nut.aug - -if WITH_AUGLENS -# Now "make install" should cover delivery of Augeas lenses... -# The "auglensdir" value should be set up by configure -# The *.aug files are generated by rule above or by autogen.sh and/or configure - auglens_DATA = \ - nuthostsconf.aug nutupsconf.aug nutupsdusers.aug nutupsschedconf.aug \ - nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug -endif - -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *-spellchecked - -# Can be re-generated by configure script and/or make: -DISTCLEANFILES = gen-nutupsconf-aug.py - -# Generated by autogen.sh and needed to run the configure script: -MAINTAINERCLEANFILES += nutupsconf.aug.in - -DISTCLEANFILES += *.aug diff --git a/scripts/augeas/Makefile.in b/scripts/augeas/Makefile.in index d427b5c..2f7fc23 100644 --- a/scripts/augeas/Makefile.in +++ b/scripts/augeas/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,63 +14,24 @@ # PARTICULAR PURPOSE. @SET_MAKE@ - VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,24 +52,24 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = scripts/augeas +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nuthostsconf.aug.in $(srcdir)/nutnutconf.aug.in \ + $(srcdir)/nutupsconf.aug.in $(srcdir)/nutupsdconf.aug.in \ + $(srcdir)/nutupsdusers.aug.in $(srcdir)/nutupsmonconf.aug.in \ + $(srcdir)/nutupsschedconf.aug.in \ + $(srcdir)/nutupssetconf.aug.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -116,35 +78,18 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nutnutconf.aug nutupsdconf.aug nutupsdusers.aug \ - nutupsmonconf.aug nutupsschedconf.aug nuthostsconf.aug \ - nutupssetconf.aug gen-nutupsconf-aug.py nutupsconf.aug +CONFIG_CLEAN_FILES = nutnutconf.aug nutupsconf.aug nutupsdconf.aug \ + nutupsdusers.aug nutupsmonconf.aug nutupsschedconf.aug \ + nuthostsconf.aug nutupssetconf.aug CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -152,52 +97,13 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(auglensdir)" -DATA = $(auglens_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/gen-nutupsconf-aug.py.in \ - $(srcdir)/nuthostsconf.aug.in $(srcdir)/nutnutconf.aug.in \ - $(srcdir)/nutupsconf.aug.in $(srcdir)/nutupsdconf.aug.in \ - $(srcdir)/nutupsdusers.aug.in $(srcdir)/nutupsmonconf.aug.in \ - $(srcdir)/nutupsschedconf.aug.in \ - $(srcdir)/nutupssetconf.aug.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -208,7 +114,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -222,7 +127,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -235,8 +139,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -246,15 +153,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -265,29 +171,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -307,9 +205,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -318,16 +213,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -341,7 +232,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -352,12 +242,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -376,21 +262,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -400,26 +283,9 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST = gen-nutupsconf-aug.py.in nutupsconf.aug.tpl \ +EXTRA_DIST = gen-nutupsconf-aug.py nutupsconf.aug.tpl \ README tests/test_nut.aug -# FIXME -# augparse -I $(srcdir)/ $(srcdir)/tests/test_nut.aug - -# Now "make install" should cover delivery of Augeas lenses... -# The "auglensdir" value should be set up by configure -# The *.aug files are generated by rule above or by autogen.sh and/or configure -@WITH_AUGLENS_TRUE@auglens_DATA = \ -@WITH_AUGLENS_TRUE@ nuthostsconf.aug nutupsconf.aug nutupsdusers.aug nutupsschedconf.aug \ -@WITH_AUGLENS_TRUE@ nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug - - -# Generated by autogen.sh and needed to run the configure script: -MAINTAINERCLEANFILES = Makefile.in .dirstamp nutupsconf.aug.in -CLEANFILES = *-spellchecked - -# Can be re-generated by configure script and/or make: -DISTCLEANFILES = gen-nutupsconf-aug.py *.aug all: all-am .SUFFIXES: @@ -435,13 +301,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/augeas/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/augeas/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -454,6 +321,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): nutnutconf.aug: $(top_builddir)/config.status $(srcdir)/nutnutconf.aug.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +nutupsconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsconf.aug.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nutupsdconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsdconf.aug.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nutupsdusers.aug: $(top_builddir)/config.status $(srcdir)/nutupsdusers.aug.in @@ -466,48 +335,20 @@ nuthostsconf.aug: $(top_builddir)/config.status $(srcdir)/nuthostsconf.aug.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nutupssetconf.aug: $(top_builddir)/config.status $(srcdir)/nutupssetconf.aug.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -gen-nutupsconf-aug.py: $(top_builddir)/config.status $(srcdir)/gen-nutupsconf-aug.py.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nutupsconf.aug: $(top_builddir)/config.status $(srcdir)/nutupsconf.aug.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -install-auglensDATA: $(auglens_DATA) - @$(NORMAL_INSTALL) - @list='$(auglens_DATA)'; test -n "$(auglensdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(auglensdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(auglensdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(auglensdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(auglensdir)" || exit $$?; \ - done +tags: TAGS +TAGS: -uninstall-auglensDATA: - @$(NORMAL_UNINSTALL) - @list='$(auglens_DATA)'; test -n "$(auglensdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(auglensdir)'; $(am__uninstall_files_from_dir) -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -540,15 +381,10 @@ distdir-am: $(DISTFILES) $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook -@HAVE_AUGPARSE_FALSE@check-local: check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am -all-am: Makefile $(DATA) +all-am: Makefile installdirs: - for dir in "$(DESTDIR)$(auglensdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -571,17 +407,14 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -602,7 +435,7 @@ info: info-am info-am: -install-data-am: install-auglensDATA +install-data-am: install-dvi: install-dvi-am @@ -646,46 +479,36 @@ ps: ps-am ps-am: -uninstall-am: uninstall-auglensDATA +uninstall-am: -.MAKE: check-am install-am install-strip +.MAKE: install-am install-strip -.PHONY: all all-am check check-am check-local clean clean-generic \ - clean-libtool cscopelist-am ctags-am dist-hook distclean \ - distclean-generic distclean-libtool distdir dvi dvi-am html \ - html-am info info-am install install-am install-auglensDATA \ - install-data install-data-am install-dvi install-dvi-am \ - install-exec install-exec-am install-html install-html-am \ - install-info install-info-am install-man install-pdf \ - install-pdf-am install-ps install-ps-am install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-auglensDATA - -.PRECIOUS: Makefile +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + dist-hook distclean distclean-generic distclean-libtool \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am # only call the script to generate Augeas ups.conf lens upon "make dist", -# and if Python is present; the distributed gen-nutupsconf-aug.py.in template -# is assumed to only differ from a generated gen-nutupsconf-aug.py by the -# @PYTHON@ shebang. +# and if Python is present dist-hook: - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c "import re,glob,codecs"; then \ - echo "Regenerating Augeas ups.conf lens with '$(PYTHON)'."; \ - $(PYTHON) $(distdir)/gen-nutupsconf-aug.py.in $(distdir)/; \ + @if python -c "import re,glob,codecs"; then \ + echo "Regenerating Augeas ups.conf lens."; \ + $(distdir)/gen-nutupsconf-aug.py $(distdir)/; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping regeneration of Augeas lens for ups.conf parsing." ; \ + echo "Skipping Augeas ups.conf lens regeneration."; \ echo "----------------------------------------------------------------------"; \ fi -# This needs augparse from augeas-tools -@HAVE_AUGPARSE_TRUE@check-local: -@HAVE_AUGPARSE_TRUE@ @echo "augparse proceeding to lenses verification job..."; \ -@HAVE_AUGPARSE_TRUE@ echo "DISABLED for now due to https://github.com/networkupstools/nut/issues/657" - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/scripts/augeas/README b/scripts/augeas/README index bfa03d3..3be147e 100644 --- a/scripts/augeas/README +++ b/scripts/augeas/README @@ -41,7 +41,7 @@ As an example, on Debian and derivatives, do the following: $ apt-get install augeas-lenses augeas-tools -And optionally: +And optionaly: $ apt-get install libaugeas0 libaugeas-dev python-augeas @@ -57,7 +57,7 @@ These are the *.aug files in the present directory. You can either install the files to the right location on your system, generally in '/usr/share/augeas/lenses/', or use these from NUT -source directory ('nut/scripts/augeas'). The latter is to be preferred for +source directory ('nut/scripts/augeas'). The latter is to be prefered for the time being. @@ -240,7 +240,7 @@ a.set(("/files/etc/nut/upsd.users/%s/instcmds" % user), "ALL") monuser = "monuser" monpasswd = "******" a.set(("/files/etc/nut/upsd.users/%s/password" % monuser), monpasswd) -a.set(("/files/etc/nut/upsd.users/%s/upsmon" % monuser), "primary") +a.set(("/files/etc/nut/upsd.users/%s/upsmon" % monuser), "master") # Generate upsmon.conf a.set("/files/etc/nut/upsmon.conf/MONITOR/system/upsname", device_name) @@ -250,7 +250,7 @@ a.set("/files/etc/nut/upsmon.conf/MONITOR/system/upsname", device_name) a.set("/files/etc/nut/upsmon.conf/MONITOR/powervalue", "1") a.set("/files/etc/nut/upsmon.conf/MONITOR/username", monuser) a.set("/files/etc/nut/upsmon.conf/MONITOR/password", monpasswd) -a.set("/files/etc/nut/upsmon.conf/MONITOR/type", "primary") +a.set("/files/etc/nut/upsmon.conf/MONITOR/type", "master") # FIXME: glitch on the generated content a.set("/files/etc/nut/upsmon.conf/SHUTDOWNCMD", "/sbin/shutdown -h +0") diff --git a/scripts/augeas/gen-nutupsconf-aug.py.in b/scripts/augeas/gen-nutupsconf-aug.py similarity index 96% rename from scripts/augeas/gen-nutupsconf-aug.py.in rename to scripts/augeas/gen-nutupsconf-aug.py index 04b6fa1..55db17a 100755 --- a/scripts/augeas/gen-nutupsconf-aug.py.in +++ b/scripts/augeas/gen-nutupsconf-aug.py @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!/usr/bin/env python # Copyright (C) 2010 - Arnaud Quette # # This program is free software; you can redistribute it and/or modify @@ -18,8 +18,6 @@ # This program extracts all drivers specific variables, declared # using 'addvar()' and output a complete ups.conf lens for Augeas -from __future__ import print_function - import sys import re import glob @@ -59,11 +57,11 @@ def grep(string,list): if __name__ == '__main__': rawCount = 0 - #global finalCount + global finalCount variableNames = [] specificVars = "" - #global inLensContent - #global finalLensContent + global inLensContent + global finalLensContent Exceptionlist = ['../../drivers/main.c', '../../drivers/skel.c'] outputFilename = 'nutupsconf.aug.in' templateFilename = 'nutupsconf.aug.tpl' @@ -71,7 +69,7 @@ if __name__ == '__main__': if (len(sys.argv) == 2): dirPrefix = sys.argv[1] - print(dirPrefix) + print dirPrefix # 1/ Extract all specific drivers parameters, in a sorted list with unique entries # 1.1/ List all drivers implementation files diff --git a/scripts/augeas/nutupsconf.aug.in b/scripts/augeas/nutupsconf.aug.in index 3c921f2..1182150 100644 --- a/scripts/augeas/nutupsconf.aug.in +++ b/scripts/augeas/nutupsconf.aug.in @@ -33,10 +33,7 @@ let ups_sep = IniFile.sep IniFile.sep_re IniFile.sep_default let ups_global = "chroot" | "driverpath" | "maxstartdelay" - | "maxretry" - | "retrydelay" | "pollinterval" - | "synchronous" | "user" let ups_fields = "driver" @@ -44,45 +41,15 @@ let ups_fields = "driver" | "sdorder" | "desc" | "nolock" - | "ignorelb" | "maxstartdelay" - | "synchronous" - | "BYPASS" - | "CHRG_addr" - | "CHRG_noro" - | "CHRG_regtype" | "CP" | "CS" - | "Could not addvar(%s)" - | "DISCHRG_addr" - | "DISCHRG_noro" - | "DISCHRG_regtype" - | "FSD_addr" - | "FSD_noro" - | "FSD_pulse_duration" - | "FSD_regtype" - | "HB_addr" - | "HB_noro" - | "HB_regtype" | "ID" | "LB" - | "LB_addr" - | "LB_noro" - | "LB_regtype" | "LowBatt" - | "OB_addr" - | "OB_noro" - | "OB_regtype" | "OL" - | "OL_addr" - | "OL_noro" - | "OL_regtype" | "OffDelay" | "OnDelay" - | "RB" - | "RB_addr" - | "RB_noro" - | "RB_regtype" | "SD" | "advanced_eco_mode" | "advorder" @@ -93,8 +60,6 @@ let ups_fields = "driver" | "awd" | "batteryPercentage" | "battery_alarm" - | "battery_max" - | "battery_min" | "battery_number" | "battery_open_status_check" | "battext" @@ -111,39 +76,21 @@ let ups_fields = "driver" | "community" | "constant_phase_angle" | "converter_mode" - | "cshdelay" | "daysoff" | "daysweek" - | "dev_slave_id" - | "device" - | "device_mfr" - | "device_model" - | "do_convert_deci" | "dumbterm" | "eco_mode" | "explore" | "fake_lowbatt" - | "fault_1" - | "fault_2" - | "fault_3" - | "fault_4" - | "fault_5" | "flash" | "frequency" | "fruid" | "full_update" - | "hb" | "houroff" | "houron" - | "i2c_address" | "idleload" - | "ignoresab" - | "input_fault_voltage" | "input_timeout" - | "interruptonly" - | "interruptsize" | "langid_fix" - | "lb" | "limited_runtime_on_battery" | "linevoltage" | "load.off" @@ -156,7 +103,6 @@ let ups_fields = "driver" | "max_bypass_freq" | "max_bypass_volt" | "max_load" - | "max_polls_without_data" | "maxreport" | "methodOfFlowControl" | "mfr" @@ -165,33 +111,22 @@ let ups_fields = "driver" | "min_bypass_volt" | "mincharge" | "minruntime" - | "mod_byte_to_s" - | "mod_byte_to_us" - | "mod_resp_to_s" - | "mod_resp_to_us" | "model" | "modelname" - | "nobt" | "nohang" | "nombattvolt" - | "nominal_cell_voltage" | "norating" - | "noscanlangid" | "notification" | "notransferoids" | "novendor" | "nowarn_noimp" | "numOfBytesFromUPS" - | "number_of_battery_cells" | "offdelay" | "oldmac" | "ondelay" - | "onlinedischarge" | "output_pace" | "output_phase_angle" - | "output_voltages" | "password" - | "pins_shutdown_mode" | "pollfreq" | "pollonly" | "powerup" @@ -203,40 +138,26 @@ let ups_fields = "driver" | "productid" | "protocol" | "rebootdelay" - | "recharge_time" | "reset_to_default" - | "rio_slave_id" - | "runtime_full" - | "runtime_half" | "runtimecal" | "sdtime" | "sdtype" | "secLevel" | "secName" - | "semistaticfreq" - | "ser_baud_rate" - | "ser_data_bit" - | "ser_parity" - | "ser_stop_bit" | "serial" | "serialnumber" - | "series" | "shutdownArguments" | "shutdown_delay" | "shutdown_duration" | "shutdown_timer" | "silent" | "site_fault_detection" - | "slave_address" - | "snmp_retries" - | "snmp_timeout" | "snmp_version" | "startdelay" | "status_only" | "stayoff" | "subdriver" | "subscribe" - | "symmetrathreephase" | "testing" | "testtime" | "timeout" @@ -245,7 +166,6 @@ let ups_fields = "driver" | "ups.delay.shutdown" | "ups.delay.start" | "upstype" - | "usb_set_altinterface" | "usd" | "use_crlf" | "use_pre_lf" diff --git a/scripts/augeas/nutupsconf.aug.tpl b/scripts/augeas/nutupsconf.aug.tpl index 0f7c66c..24f6bcc 100644 --- a/scripts/augeas/nutupsconf.aug.tpl +++ b/scripts/augeas/nutupsconf.aug.tpl @@ -33,10 +33,7 @@ let ups_sep = IniFile.sep IniFile.sep_re IniFile.sep_default let ups_global = "chroot" | "driverpath" | "maxstartdelay" - | "maxretry" - | "retrydelay" | "pollinterval" - | "synchronous" | "user" let ups_fields = "driver" @@ -44,9 +41,7 @@ let ups_fields = "driver" | "sdorder" | "desc" | "nolock" - | "ignorelb" | "maxstartdelay" - | "synchronous" @SPECIFIC_DRV_VARS@ let ups_entry = IniFile.indented_entry (ups_global|ups_fields) ups_sep ups_comment diff --git a/scripts/augeas/nutupsdconf.aug.in b/scripts/augeas/nutupsdconf.aug.in index 35bf896..d3aef1d 100644 --- a/scripts/augeas/nutupsdconf.aug.in +++ b/scripts/augeas/nutupsdconf.aug.in @@ -39,8 +39,6 @@ let comment = Util.comment let path = word let upsd_maxage = [ opt_spc . key "MAXAGE" . sep_spc . store num . eol ] -let upsd_trackingdelay = [ opt_spc . key "TRACKINGDELAY" . sep_spc . store num . eol ] -let upsd_allow_no_device = [ opt_spc . key "ALLOW_NO_DEVICE" . sep_spc . store num . eol ] let upsd_statepath = [ opt_spc . key "STATEPATH" . sep_spc . store path . eol ] let upsd_listen = [ opt_spc . key "LISTEN" . sep_spc . [ label "interface" . store ip ] @@ -51,15 +49,13 @@ let upsd_certfile = [ opt_spc . key "CERTFILE" . sep_spc . store path . eol ] (************************************************************************ * MAXAGE seconds - * TRACKINGDELAY seconds - * ALLOW_NO_DEVICE Boolean * STATEPATH path * LISTEN interface port * Multiple LISTEN addresses may be specified. The default is to bind to 0.0.0.0 if no LISTEN addresses are specified. * LISTEN 127.0.0.1 LISTEN 192.168.50.1 LISTEN ::1 LISTEN 2001:0db8:1234:08d3:1319:8a2e:0370:7344 * *************************************************************************) -let upsd_other = upsd_maxage | upsd_trackingdelay | upsd_allow_no_device | upsd_statepath | upsd_listen_list | upsd_maxconn | upsd_certfile +let upsd_other = upsd_maxage | upsd_statepath | upsd_listen_list | upsd_maxconn | upsd_certfile let upsd_lns = (upsd_other|comment|empty)* diff --git a/scripts/augeas/nutupsdusers.aug.in b/scripts/augeas/nutupsdusers.aug.in index a138b61..242e64e 100644 --- a/scripts/augeas/nutupsdusers.aug.in +++ b/scripts/augeas/nutupsdusers.aug.in @@ -67,7 +67,7 @@ let upsd_users_instcmds = [ del_spc let upsd_users_upsmon = [ del_spc . key "upsmon" . sep_spc - . store /master|primary|slave|secondary/ . eol ] + . store /master|slave/ . eol ] let upsd_users_title = IniFile.indented_title IniFile.record_re diff --git a/scripts/augeas/tests/test_nut.aug b/scripts/augeas/tests/test_nut.aug index 084fd84..4153ed7 100644 --- a/scripts/augeas/tests/test_nut.aug +++ b/scripts/augeas/tests/test_nut.aug @@ -27,8 +27,6 @@ test NutUpsConf.ups_lns get ups_conf = let upsd_conf = " MAXAGE 30 -TRACKINGDELAY 600 -ALLOW_NO_DEVICE 1 LISTEN 0.0.0.0 3493 MAXCONN 1024 " @@ -36,8 +34,6 @@ MAXCONN 1024 test NutUpsdConf.upsd_lns get upsd_conf = { } { "MAXAGE" = "30" } - { "TRACKINGDELAY" = "600" } - { "ALLOW_NO_DEVICE" = "1" } { "LISTEN" { "interface" = "0.0.0.0" } { "port" = "3493" } } @@ -54,13 +50,13 @@ let upsd_users = " instcmds = test.panel.start instcmds = test.panel.stop - [upswired] + [monmaster] password = blah - upsmon primary + upsmon master - [observer] + [monslave] password = abcd - upsmon secondary + upsmon slave " test NutUpsdUsers.upsd_users_lns get upsd_users = @@ -77,16 +73,16 @@ test NutUpsdUsers.upsd_users_lns get upsd_users = { "instcmds" = "test.panel.start" } { "instcmds" = "test.panel.stop" } { } } - { "upswired" + { "monmaster" { "password" = "blah" } - { "upsmon" = "primary" } + { "upsmon" = "master" } { } } - { "observer" + { "monslave" { "password" = "abcd" } - { "upsmon" = "secondary" } } + { "upsmon" = "slave" } } let upsmon_conf = " -MONITOR testups@localhost 1 upswired blah primary +MONITOR testups@localhost 1 monmaster blah master MINSUPPLIES 1 SHUTDOWNCMD /sbin/shutdown -h +0 @@ -107,9 +103,9 @@ test NutUpsmonConf.upsmon_lns get upsmon_conf = { "upsname" = "testups" } { "hostname" = "localhost" } } { "powervalue" = "1" } - { "username" = "upswired" } + { "username" = "monmaster" } { "password" = "blah" } - { "type" = "primary" } } + { "type" = "master" } } { } { "MINSUPPLIES" = "1" } { "SHUTDOWNCMD" = "/sbin/shutdown -h +0" } diff --git a/scripts/devd/Makefile.am b/scripts/devd/Makefile.am deleted file mode 100644 index c1c8097..0000000 --- a/scripts/devd/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ - -if WITH_DEVD - devdconfdir = $(devddir) - devdconf_DATA = -if WITH_USB - devdconf_DATA += nut-usb.conf -endif -endif - -EXTRA_DIST = README - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# Generated by configure script: -DISTCLEANFILES = nut-usb.conf - -# we should never remove this one, apart from a distclean-check -#MAINTAINERCLEANFILES = nut-usbups.rules.in - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES += nut-usbups.rules.in -MAINTAINERCLEANFILES += nut-usbups.rules.in.AUTOGEN_WITHOUT -MAINTAINERCLEANFILES += nut-usb.conf.in -MAINTAINERCLEANFILES += nut-usb.conf.in.AUTOGEN_WITHOUT diff --git a/scripts/devd/Makefile.in b/scripts/devd/Makefile.in deleted file mode 100644 index ae87b77..0000000 --- a/scripts/devd/Makefile.in +++ /dev/null @@ -1,639 +0,0 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@WITH_DEVD_TRUE@@WITH_USB_TRUE@am__append_1 = nut-usb.conf -subdir = scripts/devd -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nut_arg_with.m4 \ - $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ - $(top_srcdir)/m4/nut_check_libavahi.m4 \ - $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ - $(top_srcdir)/m4/nut_check_libgd.m4 \ - $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ - $(top_srcdir)/m4/nut_check_libneon.m4 \ - $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ - $(top_srcdir)/m4/nut_check_libnss.m4 \ - $(top_srcdir)/m4/nut_check_libopenssl.m4 \ - $(top_srcdir)/m4/nut_check_libpowerman.m4 \ - $(top_srcdir)/m4/nut_check_libusb.m4 \ - $(top_srcdir)/m4/nut_check_libwrap.m4 \ - $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ - $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ - $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nut-usb.conf -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(devdconfdir)" -DATA = $(devdconf_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut-usb.conf.in \ - README -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -A2X = @A2X@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -ASCIIDOC = @ASCIIDOC@ -ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BINDIR = @BINDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFPATH = @CONFPATH@ -CPP = @CPP@ -CPPCHECK = @CPPCHECK@ -CPPFLAGS = @CPPFLAGS@ -CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ -CPPUNIT_LIBS = @CPPUNIT_LIBS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBLATEX = @DBLATEX@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ -DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ -DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ -DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ -DRVPATH = @DRVPATH@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ -LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ -LIBGD_CFLAGS = @LIBGD_CFLAGS@ -LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ -LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ -LIBIPMI_LIBS = @LIBIPMI_LIBS@ -LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ -LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ -LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LIBS = @LIBNEON_LIBS@ -LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ -LIBS = @LIBS@ -LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ -LIBUSB_LIBS = @LIBUSB_LIBS@ -LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LIBS = @LIBWRAP_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LN_S_R = @LN_S_R@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ -NUT_NETVERSION = @NUT_NETVERSION@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OS_NAME = @OS_NAME@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIDPATH = @PIDPATH@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ -RANLIB = @RANLIB@ -RUN_AS_GROUP = @RUN_AS_GROUP@ -RUN_AS_USER = @RUN_AS_USER@ -SBINDIR = @SBINDIR@ -SED = @SED@ -SERLIBS = @SERLIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ -STATEPATH = @STATEPATH@ -STRIP = @STRIP@ -SUN_LIBUSB = @SUN_LIBUSB@ -TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -auglensdir = @auglensdir@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cgiexecdir = @cgiexecdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -devddir = @devddir@ -docdir = @docdir@ -driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -hotplugdir = @hotplugdir@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -now = @now@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgconfigdir = @pkgconfigdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ -systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -udevdir = @udevdir@ -@WITH_DEVD_TRUE@devdconfdir = $(devddir) -@WITH_DEVD_TRUE@devdconf_DATA = $(am__append_1) -EXTRA_DIST = README - -# we should never remove this one, apart from a distclean-check -#MAINTAINERCLEANFILES = nut-usbups.rules.in - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-usbups.rules.in \ - nut-usbups.rules.in.AUTOGEN_WITHOUT nut-usb.conf.in \ - nut-usb.conf.in.AUTOGEN_WITHOUT - -# Generated by configure script: -DISTCLEANFILES = nut-usb.conf -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/devd/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu scripts/devd/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -nut-usb.conf: $(top_builddir)/config.status $(srcdir)/nut-usb.conf.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-devdconfDATA: $(devdconf_DATA) - @$(NORMAL_INSTALL) - @list='$(devdconf_DATA)'; test -n "$(devdconfdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(devdconfdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(devdconfdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(devdconfdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(devdconfdir)" || exit $$?; \ - done - -uninstall-devdconfDATA: - @$(NORMAL_UNINSTALL) - @list='$(devdconf_DATA)'; test -n "$(devdconfdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(devdconfdir)'; $(am__uninstall_files_from_dir) -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile $(DATA) -installdirs: - for dir in "$(DESTDIR)$(devdconfdir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-devdconfDATA - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-devdconfDATA - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-devdconfDATA install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-devdconfDATA - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/scripts/devd/README b/scripts/devd/README deleted file mode 100644 index 58f9fda..0000000 --- a/scripts/devd/README +++ /dev/null @@ -1,11 +0,0 @@ -On FreeBSD, devd has a similar role to udev on Linux. The devd.conf file -defines actions to perform when devices are plugged in. - -The tools/nut-usbinfo.pl script generates nut-usb.conf.in by processing USB -macros in all of the drivers. In this case, the defined action for each -matching UPS is to change the permissions such that the NUT drivers can access -the devices without requiring root privileges. You may need to restart devd and -re-plug in the UPS to trigger the actions. - -The format of this configuration file should work with devd on FreeBSD 9.0 and -9.1, at the very least. diff --git a/scripts/devd/nut-usb.conf.in b/scripts/devd/nut-usb.conf.in deleted file mode 100644 index c3c1e6c..0000000 --- a/scripts/devd/nut-usb.conf.in +++ /dev/null @@ -1,1131 +0,0 @@ -# This file is generated and installed by the Network UPS Tools package. -# Homepage: http://www.networkupstools.org/ - -# SNR-UPS-LID-XXXX UPSes - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0001"; - match "product" "0x0000"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Hewlett Packard -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# T500 - bcmxcp_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f01"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# T750 - bcmxcp_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f02"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP T750 INTL - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f06"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP T1000 INTL - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f08"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP T1500 INTL - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f09"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP R/T 2200 INTL (like SMART2200RMXL2U) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1f0a"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP R1500 G2 and G3 INTL - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe0"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP T750 G2 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe1"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe2"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# HP T1500 G3 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe3"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# R/T3000 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe5"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# R/T3000 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe6"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe7"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x03f0"; - match "product" "0x1fe8"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Eaton -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0463"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0463"; - match "product" "0xffff"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Dell -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x047c"; - match "product" "0xffff"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# ST Microelectronics -# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0483"; - match "product" "0x0035"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# USB IDs device table - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0483"; - match "product" "0xa113"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# IBM -# 6000 VA LCD 4U Rack UPS; 5396-1Kx - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x04b3"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Riello (Cypress Semiconductor Corp.) -# various models - riello_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x04b4"; - match "product" "0x5500"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Minibox -# openUPS Intelligent UPS (minimum required firmware 1.4) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x04d8"; - match "product" "0xd004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# openUPS Intelligent UPS (minimum required firmware 1.4) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x04d8"; - match "product" "0xd005"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Belkin -# F6H375-USB - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0375"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C550-AVR - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0551"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C1250-TW-RK - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0750"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C1500-TW-RK - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0751"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C900-UNV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0900"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C100-UNV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0910"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C120-UNV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0912"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C800-UNV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0980"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Regulator PRO-USB - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x0f51"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# F6C1100-UNV, F6C1200-UNV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x050d"; - match "product" "0x1100"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# APC -# APC AP9584 Serial->USB kit - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x051d"; - match "product" "0x0000"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# various models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x051d"; - match "product" "0x0002"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# various 5G models - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x051d"; - match "product" "0x0003"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Powerware -# various models - bcmxcp_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0592"; - match "product" "0x0002"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PW 9140 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0592"; - match "product" "0x0004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Agiler UPS - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x05b8"; - match "product" "0x0000"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Delta UPS -# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x05dd"; - match "product" "0x041b"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Delta/Minuteman Enterprise Plus E1500RM2U - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x05dd"; - match "product" "0xa011"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Belkin F6C1200-UNV/Voltronic Power UPSes - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0665"; - match "product" "0x5161"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Phoenixtec Power Co., Ltd -# Online Yunto YQ450 - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0002"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Mustek Powermust - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0003"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Phoenixtec Innova 3/1 T - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Phoenixtec Innova RT - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0005"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Phoenixtec Innova T - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0201"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Online Zinto A - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0x0601"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PROTECT B / NAS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x06da"; - match "product" "0xffff"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# iDowell -# iDowell - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x075d"; - match "product" "0x0300"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Cyber Power Systems -# 900AVR/BC900D - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0764"; - match "product" "0x0005"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Dynex DX-800U?, CP1200AVR/BC1200D, CP825AVR-G, CP1000AVRLCD, CP1000PFCLCD, CP1500C, CP550HG, etc. - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0764"; - match "product" "0x0501"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0764"; - match "product" "0x0601"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Sweex 1000VA - richcomm_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0925"; - match "product" "0x1234"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# TrippLite -# e.g. OMNIVS1000, SMART550USB, ... - tripplite_usb -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite AVR550U - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1003"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite AVR750U - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1007"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite ECO550UPS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1008"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite ECO550UPS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1009"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite ECO550UPS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1010"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite SU3000LCD2UHV - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x1330"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite OMNI1000LCD - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2005"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite OMNI900LCD - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2007"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2008"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite Smart1000LCD - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2009"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2010"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2011"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2012"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2013"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x2014"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3008"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3009"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3010"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3011"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite smart2200RMXL2U - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3012"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3013"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3014"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3015"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite Smart1500LCD (newer unit) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3016"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite AVR750U (newer unit) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x3024"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite SmartOnline SU6000RT4U? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4002"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite SmartOnline SU1500RTXL2ua - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4003"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. TrippLite SmartOnline SU1000XLA - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4005"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4006"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4007"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# e.g. ? - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x09ae"; - match "product" "0x4008"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# PowerCOM -# PowerCOM Vanguard and BNT-xxxAP - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM Vanguard and BNT-xxxAP - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x0004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM IMP - IMPERIAL Series - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x00a2"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM SKP - Smart KING Pro (all Smart series) - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x00a3"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM WOW - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x00a4"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM VGD - Vanguard - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x00a5"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# PowerCOM BNT - Black Knight Pro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0d9f"; - match "product" "0x00a6"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Unitek Alpha 1200Sx - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x0f03"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Liebert -# Liebert PowerSure PSA UPS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x10af"; - match "product" "0x0001"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Liebert PowerSure PSI 1440 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x10af"; - match "product" "0x0004"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Liebert GXT3 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x10af"; - match "product" "0x0008"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# GE EP series - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x14f0"; - match "product" "0x00c9"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Legrand -# Legrand Keor SP - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x1cb0"; - match "product" "0x0032"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Legrand Daker DK / DK Plus - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x1cb0"; - match "product" "0x0035"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Legrand Keor PDU - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x1cb0"; - match "product" "0x0038"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2341"; - match "product" "0x0036"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2341"; - match "product" "0x8036"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2A03"; - match "product" "0x0036"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2A03"; - match "product" "0x0040"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2A03"; - match "product" "0x8036"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2A03"; - match "product" "0x8040"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# AEG -# PROTECT B / NAS - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2b2d"; - match "product" "0xffff"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Ever -# USB IDs device table - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e51"; - match "product" "0x0000"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# USB IDs device table - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e51"; - match "product" "0xffff"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Salicru -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e66"; - match "product" "0x0201"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e66"; - match "product" "0x0202"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e66"; - match "product" "0x0203"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# https://www.salicru.com/sps-home.html - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x2e66"; - match "product" "0x0300"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; - -# Powervar -# Powervar - usbhid-ups -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0x4234"; - match "product" "0x0002"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; -# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) - nutdrv_qx -notify 100 { - match "system" "USB"; - match "subsystem" "DEVICE"; - match "type" "ATTACH"; - match "vendor" "0xffff"; - match "product" "0x0000"; - action "chgrp @RUN_AS_GROUP@ /dev/$cdev; chmod g+rw /dev/$cdev"; -}; diff --git a/scripts/hal/Makefile.am b/scripts/hal/Makefile.am new file mode 100644 index 0000000..f639b22 --- /dev/null +++ b/scripts/hal/Makefile.am @@ -0,0 +1,16 @@ + +if WITH_HAL + halfdidir = $(HAL_FDI_PATH) + halfdi_DATA = 20-ups-nut-device.fdi +endif + +# FIXME: should be able to use $< here. +20-ups-nut-device.fdi: ups-nut-device.fdi + cp ups-nut-device.fdi $@ + +EXTRA_DIST = ups-nut-device.fdi.in + +DISTCLEANFILES = ups-nut-device.fdi +# we should never remove this one, apart from a distclean-check +#MAINTAINERCLEANFILES = ups-nut-device.fdi.in +CLEANFILES = 20-ups-nut-device.fdi diff --git a/docs/cables/Makefile.in b/scripts/hal/Makefile.in similarity index 71% rename from docs/cables/Makefile.in rename to scripts/hal/Makefile.in index bd4629b..4b5950d 100644 --- a/docs/cables/Makefile.in +++ b/scripts/hal/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,62 +14,25 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -88,25 +52,21 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -subdir = docs/cables +subdir = scripts/hal +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/ups-nut-device.fdi.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -115,33 +75,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = +CONFIG_CLEAN_FILES = ups-nut-device.fdi CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -149,17 +92,42 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } +am__installdirs = "$(DESTDIR)$(halfdidir)" +DATA = $(halfdi_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -170,7 +138,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -184,7 +151,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -197,8 +163,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -208,15 +177,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -227,29 +195,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -269,9 +229,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -280,16 +237,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -303,7 +256,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -314,12 +266,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -338,21 +286,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -362,8 +307,13 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -CLEANFILES = *-spellchecked -MAINTAINERCLEANFILES = Makefile.in .dirstamp +@WITH_HAL_TRUE@halfdidir = $(HAL_FDI_PATH) +@WITH_HAL_TRUE@halfdi_DATA = 20-ups-nut-device.fdi +EXTRA_DIST = ups-nut-device.fdi.in +DISTCLEANFILES = ups-nut-device.fdi +# we should never remove this one, apart from a distclean-check +#MAINTAINERCLEANFILES = ups-nut-device.fdi.in +CLEANFILES = 20-ups-nut-device.fdi all: all-am .SUFFIXES: @@ -376,16 +326,17 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/cables/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/hal/Makefile'; \ $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu docs/cables/Makefile + $(AUTOMAKE) --gnu scripts/hal/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -396,23 +347,43 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +ups-nut-device.fdi: $(top_builddir)/config.status $(srcdir)/ups-nut-device.fdi.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs -tags TAGS: +install-halfdiDATA: $(halfdi_DATA) + @$(NORMAL_INSTALL) + @list='$(halfdi_DATA)'; test -n "$(halfdidir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(halfdidir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(halfdidir)" || exit 1; \ + fi; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(halfdidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(halfdidir)" || exit $$?; \ + done -ctags CTAGS: +uninstall-halfdiDATA: + @$(NORMAL_UNINSTALL) + @list='$(halfdi_DATA)'; test -n "$(halfdidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + dir='$(DESTDIR)$(halfdidir)'; $(am__uninstall_files_from_dir) +tags: TAGS +TAGS: -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -444,8 +415,11 @@ distdir-am: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile +all-am: Makefile $(DATA) installdirs: + for dir in "$(DESTDIR)$(halfdidir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done install: install-am install-exec: install-exec-am install-data: install-data-am @@ -473,11 +447,11 @@ clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -498,7 +472,7 @@ info: info-am info-am: -install-data-am: +install-data-am: install-halfdiDATA install-dvi: install-dvi-am @@ -542,24 +516,26 @@ ps: ps-am ps-am: -uninstall-am: +uninstall-am: uninstall-halfdiDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-halfdiDATA install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am + uninstall uninstall-am uninstall-halfdiDATA -.PRECIOUS: Makefile +# FIXME: should be able to use $< here. +20-ups-nut-device.fdi: ups-nut-device.fdi + cp ups-nut-device.fdi $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/scripts/hal/ups-nut-device.fdi.in b/scripts/hal/ups-nut-device.fdi.in new file mode 100644 index 0000000..235a636 --- /dev/null +++ b/scripts/hal/ups-nut-device.fdi.in @@ -0,0 +1,707 @@ + + + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-bcmxcp_usb + ups + + + + battery + battery + hald-addon-bcmxcp_usb + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-riello_usb + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-bcmxcp_usb + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-blazer_usb + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + battery + battery + hald-addon-richcomm_usb + ups + + + + + + + + battery + battery + hald-addon-tripplite_usb + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + + + + battery + battery + hald-addon-usbhid-ups + ups + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + + battery + battery + hald-addon-blazer_usb + ups + + + + + diff --git a/scripts/hotplug/Makefile.am b/scripts/hotplug/Makefile.am index 06a6fe3..c36cd7d 100644 --- a/scripts/hotplug/Makefile.am +++ b/scripts/hotplug/Makefile.am @@ -6,16 +6,6 @@ if WITH_HOTPLUG endif EXTRA_DIST = README - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# Generated by configure script: DISTCLEANFILES = libhidups - # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = libhid.usermap - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES += libhid.usermap diff --git a/scripts/hotplug/Makefile.in b/scripts/hotplug/Makefile.in index 3a11e14..3102c3c 100644 --- a/scripts/hotplug/Makefile.in +++ b/scripts/hotplug/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,61 +17,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,24 +54,21 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = scripts/hotplug +DIST_COMMON = README $(am__dist_hotplugusb_DATA_DIST) \ + $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/libhidups.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -117,18 +77,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_hotplugusb_DATA_DIST) \ - $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = libhidups @@ -163,18 +117,6 @@ am__uninstall_files_from_dir = { \ am__installdirs = "$(DESTDIR)$(hotplugusbdir)" \ "$(DESTDIR)$(hotplugusbdir)" SCRIPTS = $(hotplugusb_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -184,17 +126,13 @@ am__can_run_installinfo = \ esac am__dist_hotplugusb_DATA_DIST = libhid.usermap DATA = $(dist_hotplugusb_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libhidups.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -205,7 +143,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -219,7 +156,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -232,8 +168,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -243,15 +182,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -262,29 +200,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -304,9 +234,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -315,16 +242,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -338,7 +261,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -349,12 +271,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -373,21 +291,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -401,16 +316,6 @@ udevdir = @udevdir@ @WITH_HOTPLUG_TRUE@dist_hotplugusb_DATA = libhid.usermap @WITH_HOTPLUG_TRUE@hotplugusb_SCRIPTS = libhidups EXTRA_DIST = README - -# we should never remove this one, apart from a distclean-check -#MAINTAINERCLEANFILES = libhid.usermap - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES = Makefile.in .dirstamp libhid.usermap - -# Generated by configure script: DISTCLEANFILES = libhidups all: all-am @@ -427,13 +332,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/hotplug/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/hotplug/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -508,17 +414,14 @@ uninstall-dist_hotplugusbDATA: @list='$(dist_hotplugusb_DATA)'; test -n "$(hotplugusbdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(hotplugusbdir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -586,7 +489,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -657,21 +559,20 @@ uninstall-am: uninstall-dist_hotplugusbDATA \ .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am \ - install-dist_hotplugusbDATA install-dvi install-dvi-am \ - install-exec install-exec-am install-hotplugusbSCRIPTS \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags-am uninstall uninstall-am \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dist_hotplugusbDATA \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-hotplugusbSCRIPTS install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-dist_hotplugusbDATA uninstall-hotplugusbSCRIPTS -.PRECIOUS: Makefile - +# we should never remove this one, apart from a distclean-check +#MAINTAINERCLEANFILES = libhid.usermap # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/scripts/hotplug/libhid.usermap b/scripts/hotplug/libhid.usermap index 5a747e3..493ce31 100644 --- a/scripts/hotplug/libhid.usermap +++ b/scripts/hotplug/libhid.usermap @@ -4,7 +4,7 @@ # libhidups 0x0003 0xVVVV 0xPPPP 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # # usb module match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info -# SNR-UPS-LID-XXXX UPSes +# Krauler UP-M500VA libhidups 0x0003 0x0001 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Hewlett Packard @@ -49,16 +49,6 @@ libhidups 0x0003 0x0463 0xffff 0x0000 0x0000 0x00 # various models libhidups 0x0003 0x047c 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# ST Microelectronics -# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs -libhidups 0x0003 0x0483 0x0035 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# USB IDs device table -libhidups 0x0003 0x0483 0xa113 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# IBM -# 6000 VA LCD 4U Rack UPS; 5396-1Kx -libhidups 0x0003 0x04b3 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - # Riello (Cypress Semiconductor Corp.) # various models libhidups 0x0003 0x04b4 0x5500 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 @@ -66,8 +56,6 @@ libhidups 0x0003 0x04b4 0x5500 0x0000 0x0000 0x00 # Minibox # openUPS Intelligent UPS (minimum required firmware 1.4) libhidups 0x0003 0x04d8 0xd004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# openUPS Intelligent UPS (minimum required firmware 1.4) -libhidups 0x0003 0x04d8 0xd005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Belkin # F6H375-USB @@ -86,14 +74,10 @@ libhidups 0x0003 0x050d 0x0910 0x0000 0x0000 0x00 libhidups 0x0003 0x050d 0x0912 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # F6C800-UNV libhidups 0x0003 0x050d 0x0980 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Regulator PRO-USB -libhidups 0x0003 0x050d 0x0f51 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # F6C1100-UNV, F6C1200-UNV libhidups 0x0003 0x050d 0x1100 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # APC -# APC AP9584 Serial->USB kit -libhidups 0x0003 0x051d 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # various models libhidups 0x0003 0x051d 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # various 5G models @@ -106,13 +90,7 @@ libhidups 0x0003 0x0592 0x0002 0x0000 0x0000 0x00 libhidups 0x0003 0x0592 0x0004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Agiler UPS libhidups 0x0003 0x05b8 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Delta UPS -# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA -libhidups 0x0003 0x05dd 0x041b 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Delta/Minuteman Enterprise Plus E1500RM2U -libhidups 0x0003 0x05dd 0xa011 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Belkin F6C1200-UNV/Voltronic Power UPSes +# Belkin F6C1200-UNV libhidups 0x0003 0x0665 0x5161 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Phoenixtec Power Co., Ltd @@ -128,7 +106,7 @@ libhidups 0x0003 0x06da 0x0005 0x0000 0x0000 0x00 libhidups 0x0003 0x06da 0x0201 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Online Zinto A libhidups 0x0003 0x06da 0x0601 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# PROTECT B / NAS +# various models libhidups 0x0003 0x06da 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # iDowell @@ -136,9 +114,9 @@ libhidups 0x0003 0x06da 0xffff 0x0000 0x0000 0x00 libhidups 0x0003 0x075d 0x0300 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # Cyber Power Systems -# 900AVR/BC900D +# 900AVR/BC900D, CP1200AVR/BC1200D libhidups 0x0003 0x0764 0x0005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Dynex DX-800U?, CP1200AVR/BC1200D, CP825AVR-G, CP1000AVRLCD, CP1000PFCLCD, CP1500C, CP550HG, etc. +# Dynex DX-800U? libhidups 0x0003 0x0764 0x0501 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U libhidups 0x0003 0x0764 0x0601 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 @@ -158,8 +136,6 @@ libhidups 0x0003 0x09ae 0x1008 0x0000 0x0000 0x00 libhidups 0x0003 0x09ae 0x1009 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite ECO550UPS libhidups 0x0003 0x09ae 0x1010 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# e.g. TrippLite SU3000LCD2UHV -libhidups 0x0003 0x09ae 0x1330 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite OMNI1000LCD libhidups 0x0003 0x09ae 0x2005 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite OMNI900LCD @@ -196,8 +172,6 @@ libhidups 0x0003 0x09ae 0x3014 0x0000 0x0000 0x00 libhidups 0x0003 0x09ae 0x3015 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite Smart1500LCD (newer unit) libhidups 0x0003 0x09ae 0x3016 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# e.g. TrippLite AVR750U (newer unit) -libhidups 0x0003 0x09ae 0x3024 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) libhidups 0x0003 0x09ae 0x4001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # e.g. TrippLite SmartOnline SU6000RT4U? @@ -217,8 +191,6 @@ libhidups 0x0003 0x09ae 0x4008 0x0000 0x0000 0x00 # PowerCOM # PowerCOM Vanguard and BNT-xxxAP -libhidups 0x0003 0x0d9f 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# PowerCOM Vanguard and BNT-xxxAP libhidups 0x0003 0x0d9f 0x0004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # PowerCOM IMP - IMPERIAL Series libhidups 0x0003 0x0d9f 0x00a2 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 @@ -236,59 +208,7 @@ libhidups 0x0003 0x0f03 0x0001 0x0000 0x0000 0x00 # Liebert # Liebert PowerSure PSA UPS libhidups 0x0003 0x10af 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Liebert PowerSure PSI 1440 -libhidups 0x0003 0x10af 0x0004 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Liebert GXT3 -libhidups 0x0003 0x10af 0x0008 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 # GE EP series libhidups 0x0003 0x14f0 0x00c9 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Legrand -# Legrand Keor SP -libhidups 0x0003 0x1cb0 0x0032 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Legrand Daker DK / DK Plus -libhidups 0x0003 0x1cb0 0x0035 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Legrand Keor PDU -libhidups 0x0003 0x1cb0 0x0038 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2341 0x0036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2341 0x8036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2A03 0x0036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2A03 0x0040 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2A03 0x8036 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Arduino Leonardo, Leonardo ETH and Pro Micro -libhidups 0x0003 0x2A03 0x8040 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# AEG -# PROTECT B / NAS -libhidups 0x0003 0x2b2d 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Ever -# USB IDs device table -libhidups 0x0003 0x2e51 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# USB IDs device table -libhidups 0x0003 0x2e51 0xffff 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Salicru -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 -libhidups 0x0003 0x2e66 0x0201 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 -libhidups 0x0003 0x2e66 0x0202 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 -libhidups 0x0003 0x2e66 0x0203 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# https://www.salicru.com/sps-home.html -libhidups 0x0003 0x2e66 0x0300 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 - -# Powervar -# Powervar -libhidups 0x0003 0x4234 0x0002 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 -# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) +# Ablerex 625L USB libhidups 0x0003 0xffff 0x0000 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000 diff --git a/scripts/perl/Nut.pm b/scripts/perl/Nut.pm index f4f81f2..8263c0d 100644 --- a/scripts/perl/Nut.pm +++ b/scripts/perl/Nut.pm @@ -164,7 +164,7 @@ sub _initialize { # Author: Kit Peters my $self = shift; my %arg = @_; - my $host = $arg{HOST} || 'localhost'; # Host running upsd and probably drivers + my $host = $arg{HOST} || 'localhost'; # Host running master upsd my $port = $arg{PORT} || '3493'; # 3493 is IANA assigned port for NUT my $proto = $arg{PROTO} || 'tcp'; # use tcp unless user tells us to my $user = $arg{USERNAME} || undef; # username passed to upsd @@ -591,8 +591,6 @@ sub Master { # check for MASTER level access # Author: Kit Peters # ### changelog: uses the new _send command # -# TODO: API change pending to replace MASTER with PRIMARY -# (and backwards-compatible alias handling) my $self = shift; my $req = "MASTER $self->{name}"; # build request @@ -843,9 +841,6 @@ It is automatically done if connection closed. Use this to find out whether or not we have MASTER privileges for this UPS. Returns 1 if we have MASTER privileges, returns 0 otherwise. -TODO: API change pending to replace MASTER with PRIMARY -(and backwards-compatible alias handling) - =item ListVar($variable, ...) This is an implementation of "LIST VAR" command. diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 313ace8..2d670e5 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -1,24 +1,10 @@ # Network UPS Tools: data/html -EXTRA_DIST_PY2GTK2 = \ - app/ui/gui-1.3.glade \ - app/NUT-Monitor-py2gtk2.in \ - app/nut-monitor-py2gtk2.desktop - -EXTRA_DIST_PY3QT5 = \ - app/ui/aboutdialog1.ui \ - app/ui/dialog1.ui \ - app/ui/dialog2.ui \ - app/ui/window1.ui \ - app/NUT-Monitor-py3qt5.in \ - app/nut-monitor-py3qt5.desktop - EXTRA_DIST = README \ - app/nut-monitor.appdata.xml \ - app/icons/48x48/nut-monitor.png \ - app/icons/64x64/nut-monitor.png \ - app/icons/256x256/nut-monitor.png \ - app/icons/scalable/nut-monitor.svg \ + app/gui-1.3.glade \ + app/NUT-Monitor \ + app/nut-monitor.desktop \ + app/nut-monitor.png \ app/README \ app/pixmaps/var-rw.png \ app/pixmaps/on_line.png \ @@ -27,14 +13,6 @@ EXTRA_DIST = README \ app/pixmaps/var-ro.png \ app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \ app/locale/it/LC_MESSAGES/NUT-Monitor.mo \ - module/PyNUT.py.in \ - module/test_nutclient.py.in + module/PyNUT.py \ + module/test_nutclient.py -# TODO: Make py2/py3-only builds, delivered preferred symlinks, etc. optional: -EXTRA_DIST += $(EXTRA_DIST_PY2GTK2) -EXTRA_DIST += $(EXTRA_DIST_PY3QT5) - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -clean-local: - rm -rf *.pyc __pycache__ */*.pyc */__pycache__ */*/*.pyc */*/__pycache__ diff --git a/scripts/python/Makefile.in b/scripts/python/Makefile.in index b261063..a3fd0df 100644 --- a/scripts/python/Makefile.in +++ b/scripts/python/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,61 +17,23 @@ # Network UPS Tools: data/html VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -91,24 +54,19 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = scripts/python +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -117,33 +75,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -151,17 +92,13 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -172,7 +109,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -186,7 +122,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -199,8 +134,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -210,15 +148,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -229,29 +166,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -271,9 +200,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -282,16 +208,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -305,7 +227,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -316,12 +237,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -340,21 +257,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -364,34 +278,22 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST_PY2GTK2 = \ - app/ui/gui-1.3.glade \ - app/NUT-Monitor-py2gtk2.in \ - app/nut-monitor-py2gtk2.desktop +EXTRA_DIST = README \ + app/gui-1.3.glade \ + app/NUT-Monitor \ + app/nut-monitor.desktop \ + app/nut-monitor.png \ + app/README \ + app/pixmaps/var-rw.png \ + app/pixmaps/on_line.png \ + app/pixmaps/warning.png \ + app/pixmaps/on_battery.png \ + app/pixmaps/var-ro.png \ + app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \ + app/locale/it/LC_MESSAGES/NUT-Monitor.mo \ + module/PyNUT.py \ + module/test_nutclient.py -EXTRA_DIST_PY3QT5 = \ - app/ui/aboutdialog1.ui \ - app/ui/dialog1.ui \ - app/ui/dialog2.ui \ - app/ui/window1.ui \ - app/NUT-Monitor-py3qt5.in \ - app/nut-monitor-py3qt5.desktop - - -# TODO: Make py2/py3-only builds, delivered preferred symlinks, etc. optional: -EXTRA_DIST = README app/nut-monitor.appdata.xml \ - app/icons/48x48/nut-monitor.png \ - app/icons/64x64/nut-monitor.png \ - app/icons/256x256/nut-monitor.png \ - app/icons/scalable/nut-monitor.svg app/README \ - app/pixmaps/var-rw.png app/pixmaps/on_line.png \ - app/pixmaps/warning.png app/pixmaps/on_battery.png \ - app/pixmaps/var-ro.png \ - app/locale/fr/LC_MESSAGES/NUT-Monitor.mo \ - app/locale/it/LC_MESSAGES/NUT-Monitor.mo module/PyNUT.py.in \ - module/test_nutclient.py.in $(EXTRA_DIST_PY2GTK2) \ - $(EXTRA_DIST_PY3QT5) -MAINTAINERCLEANFILES = Makefile.in .dirstamp all: all-am .SUFFIXES: @@ -407,13 +309,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/python/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/python/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -430,17 +333,14 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -504,10 +404,9 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am -clean-am: clean-generic clean-libtool clean-local mostlyclean-am +clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile @@ -574,22 +473,16 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - clean-local cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am -.PRECIOUS: Makefile - - -clean-local: - rm -rf *.pyc __pycache__ */*.pyc */__pycache__ */*/*.pyc */*/__pycache__ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/scripts/python/README b/scripts/python/README index 9a96e71..15932d9 100644 --- a/scripts/python/README +++ b/scripts/python/README @@ -7,7 +7,6 @@ David Goncalves, and released under GPL v3. * "module": this directory contains PyNUT.py, which is a Python abstraction class to access NUT server(s). You can use it in Python programs to access NUT's upsd data server in a simple way, without having to know the NUT protocol. -The same module should work for Python 2 and Python 3. To import it on Python programs you have to use the following (case sensitive) : 'import PyNUT' @@ -18,24 +17,16 @@ data from an upsd data server. To install the PyNUT module on Debian/Ubuntu, copy it to: /usr/share/python-support/python-pynut/ -For quick tests, just make sure its directory is exported in `PYTHONPATH` -environment variable. - This directory also contains test_nutclient.py, which is a PyNUT test program. For this to be fully functional, you will need to adapt the login, password and -upsname to fit your configuration. A NUT data server should be running for the -test program to verify connection and protocol support. +upsname to fit your configuration. * "app": this directory contains the NUT-Monitor application, that uses the PyNUT class, along with its resources. To install it, you will either need to keep the files together, or to install: -- Depending on the Python version(s) your system has, put NUT-Monitor-py2gtk2 - or NUT-Monitor-py3qt5 to /usr/bin/, /usr/X11R6/bin/ or something like that - (optionally making a simple NUT-Monitor symlink to the preferred version), -- ui/*.glade (for NUT-Monitor-py2gtk2) or ui/*.ui (for NUT-Monitor-py3qt5) - to /usr/share/nut-monitor/, +- NUT-Monitor to /usr/bin, /usr/X11R6/bin/ or something like that, +- gui.glade to /usr/share/nut-monitor/, - nut-monitor.png to something like /usr/share/pixmaps/ -- finally, nut-monitor-py2gtk2.desktop and/or nut-monitor-py3qt5.desktop - (optionally symlinked as nut-monitor.desktop) to /usr/share/applications/ +- and nut-monitor.desktop to /usr/share/applications diff --git a/scripts/python/app/NUT-Monitor-py2gtk2.in b/scripts/python/app/NUT-Monitor similarity index 96% rename from scripts/python/app/NUT-Monitor-py2gtk2.in rename to scripts/python/app/NUT-Monitor index d845e87..91e9001 100755 --- a/scripts/python/app/NUT-Monitor-py2gtk2.in +++ b/scripts/python/app/NUT-Monitor @@ -1,4 +1,4 @@ -#!@PYTHON2@ +#!/usr/bin/env python # -*- coding: utf-8 -*- # 2009-12-27 David Goncalves - Version 1.2 @@ -23,16 +23,12 @@ # # 2010-10-06 David Goncalves - Version 1.3 # Added localisation support -# -# 2015-02-14 Michal Fincham - Version 1.3.1 -# Corrected unsafe permissions on ~/.nut-monitor (Debian #777706) import gtk, gtk.glade, gobject import sys import base64 import os, os.path -import stat import platform import time import threading @@ -48,23 +44,21 @@ gobject.threads_init() class interface : - DESIRED_FAVORITES_DIRECTORY_MODE = 0700 - - __widgets = {} - __callbacks = {} - __favorites = {} - __favorites_file = None - __favorites_path = "" - __fav_menu_items = list() - __window_visible = True - __glade_file = None - __connected = False - __ups_handler = None - __ups_commands = None - __ups_vars = None - __ups_rw_vars = None - __gui_thread = None - __current_ups = None + __widgets = {} + __callbacks = {} + __favorites = {} + __favorites_file = None + __favorites_path = "" + __fav_menu_items = list() + __window_visible = True + __glade_file = None + __connected = False + __ups_handler = None + __ups_commands = None + __ups_vars = None + __ups_rw_vars = None + __gui_thread = None + __current_ups = None def __init__( self ) : @@ -76,7 +70,7 @@ class interface : ( cmd_opts, args ) = opt_parser.parse_args() - self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "ui/gui-1.3.glade" ) + self.__glade_file = os.path.join( os.path.dirname( sys.argv[0] ), "gui-1.3.glade" ) self.__widgets["interface"] = gtk.glade.XML( self.__glade_file, "window1", APP ) self.__widgets["main_window"] = self.__widgets["interface"].get_widget("window1") @@ -486,7 +480,7 @@ class interface : self.gui_status_message( error_msg ) except : - # Failed to get information from the treeview... skip action + # Failed to get informations from the treeview... skip action pass #------------------------------------------------------------------- @@ -534,9 +528,6 @@ class interface : return try : - if ( not stat.S_IMODE( os.stat( self.__favorites_path ).st_mode ) == self.DESIRED_FAVORITES_DIRECTORY_MODE ) : # unsafe pre-1.2 directory found - os.chmod( self.__favorites_path, self.DESIRED_FAVORITES_DIRECTORY_MODE ) - conf = ConfigParser.ConfigParser() conf.read( self.__favorites_file ) for current in conf.sections() : @@ -582,7 +573,7 @@ class interface : # If path does not exists, try to create it if ( not os.path.exists( self.__favorites_file ) ) : try : - os.makedirs( self.__favorites_path, mode=self.DESIRED_FAVORITES_DIRECTORY_MODE ) + os.makedirs( self.__favorites_path, mode=0700 ) except : self.gui_status_message( _("Error while creating configuration folder (%s)") % sys.exc_info()[1] ) @@ -813,7 +804,7 @@ class gui_updater( threading.Thread ) : self.__parent_class.gui_status_notification( _("Device is running on batteries"), "on_battery.png" ) was_online = False - # Check for additionnal information + # Check for additionnal informations for k,v in status_mapper.iteritems() : if vars.get("ups.status").find(k) != -1 : if ( text_right != "" ) : diff --git a/scripts/python/app/NUT-Monitor-py3qt5.in b/scripts/python/app/NUT-Monitor-py3qt5.in deleted file mode 100755 index cf1c3b6..0000000 --- a/scripts/python/app/NUT-Monitor-py3qt5.in +++ /dev/null @@ -1,944 +0,0 @@ -#!@PYTHON3@ -# -*- coding: utf-8 -*- - -# 2009-12-27 David Goncalves - Version 1.2 -# Total rewrite of NUT-Monitor to optimize GUI interaction. -# Added favorites support (saved to user's home) -# Added status icon on the notification area -# -# 2010-02-26 David Goncalves -# Added UPS vars display and the possibility to change values -# when user double-clicks on a RW var. -# -# 2010-05-01 David Goncalves -# Added support for PyNotify (if available) -# -# 2010-05-05 David Goncalves -# Added support for command line options -# -> --start-hidden -# -> --favorite -# -# NUT-Monitor now tries to detect if there is a NUT server -# on localhost and if there is 1 UPS, connects to it. -# -# 2010-10-06 David Goncalves - Version 1.3 -# Added localisation support -# -# 2015-02-14 Michal Fincham - Version 1.3.1 -# Corrected unsafe permissions on ~/.nut-monitor (Debian #777706) -# -# 2022-02-20 Luke Dashjr - Version 2.0 -# Port to Python 3 with PyQt5. - - -import PyQt5.uic -from PyQt5.QtCore import * -from PyQt5.QtGui import * -from PyQt5.QtWidgets import * -import sys -import base64 -import os, os.path -import stat -import platform -import time -import threading -import optparse -import configparser -import locale -import gettext -import PyNUT - - -class interface : - - DESIRED_FAVORITES_DIRECTORY_MODE = 0o700 - - __widgets = {} - __callbacks = {} - __favorites = {} - __favorites_file = None - __favorites_path = "" - __fav_menu_items = list() - __window_visible = True - __ui_file = None - __connected = False - __ups_handler = None - __ups_commands = None - __ups_vars = None - __ups_rw_vars = None - __gui_thread = None - __current_ups = None - - def __init__( self, argv ) : - - # Before anything, parse command line options if any present... - opt_parser = optparse.OptionParser() - opt_parser.add_option( "-H", "--start-hidden", action="store_true", default=False, dest="hidden", help="Start iconified in tray" ) - opt_parser.add_option( "-F", "--favorite", dest="favorite", help="Load the specified favorite and connect to UPS" ) - - ( cmd_opts, args ) = opt_parser.parse_args() - - - self.__app = QApplication( argv ) - - self.__ui_file = self.__find_res_file( 'ui', "window1.ui" ) - - self.__widgets["interface"] = PyQt5.uic.loadUi( self.__ui_file ) - self.__widgets["main_window"] = self.__widgets["interface"] - self.__widgets["status_bar"] = self.__widgets["interface"].statusbar2 - self.__widgets["ups_host_entry"] = self.__widgets["interface"].entry1 - self.__widgets["ups_port_entry"] = self.__widgets["interface"].spinbutton1 - self.__widgets["ups_refresh_button"] = self.__widgets["interface"].button1 - self.__widgets["ups_authentication_check"] = self.__widgets["interface"].checkbutton1 - self.__widgets["ups_authentication_frame"] = self.__widgets["interface"].hbox1 - self.__widgets["ups_authentication_login"] = self.__widgets["interface"].entry2 - self.__widgets["ups_authentication_password"] = self.__widgets["interface"].entry3 - self.__widgets["ups_list_combo"] = self.__widgets["interface"].combobox1 - self.__widgets["ups_commands_combo"] = self.__widgets["interface"].ups_commands_combo - self.__widgets["ups_commands_button"] = self.__widgets["interface"].button8 - self.__widgets["ups_connect"] = self.__widgets["interface"].button2 - self.__widgets["ups_disconnect"] = self.__widgets["interface"].button7 - self.__widgets["ups_params_box"] = self.__widgets["interface"].vbox6 - self.__widgets["ups_infos"] = self.__widgets["interface"].notebook1 - self.__widgets["ups_vars_tree"] = self.__widgets["interface"].treeview1 - self.__widgets["ups_vars_refresh"] = self.__widgets["interface"].button9 - self.__widgets["ups_status_image"] = self.__widgets["interface"].image1 - self.__widgets["ups_status_left"] = self.__widgets["interface"].label10 - self.__widgets["ups_status_right"] = self.__widgets["interface"].label11 - self.__widgets["ups_status_time"] = self.__widgets["interface"].label15 - self.__widgets["menu_favorites_root"] = self.__widgets["interface"].menu2 - self.__widgets["menu_favorites"] = self.__widgets["interface"].menu2 - self.__widgets["menu_favorites_add"] = self.__widgets["interface"].menuitem4 - self.__widgets["menu_favorites_del"] = self.__widgets["interface"].menuitem5 - self.__widgets["progress_battery_charge"] = self.__widgets["interface"].progressbar1 - self.__widgets["progress_battery_load"] = self.__widgets["interface"].progressbar2 - - # Create the tray icon and connect it to the show/hide method... - self.__widgets["status_icon"] = QSystemTrayIcon( QIcon( self.__find_res_file( "pixmaps", "on_line.png" ) ) ) - self.__widgets["status_icon"].setVisible( True ) - self.__widgets["status_icon"].activated.connect( self.tray_activated ) - - self.__widgets["ups_status_image"].setPixmap( QPixmap( self.__find_res_file( "pixmaps", "on_line.png" ) ) ) - - # Connect interface callbacks actions - self.__widgets["main_window"].destroyed.connect( self.quit ) - self.__widgets["interface"].imagemenuitem1.triggered.connect( self.gui_about_dialog ) - self.__widgets["interface"].imagemenuitem5.triggered.connect( self.quit ) - self.__widgets["ups_host_entry"].textChanged.connect( self.__check_gui_fields ) - self.__widgets["ups_authentication_login"].textChanged.connect( self.__check_gui_fields ) - self.__widgets["ups_authentication_password"].textChanged.connect( self.__check_gui_fields ) - self.__widgets["ups_authentication_check"].stateChanged.connect( self.__check_gui_fields ) - self.__widgets["ups_port_entry"].valueChanged.connect( self.__check_gui_fields ) - self.__widgets["ups_refresh_button"].clicked.connect( self.__update_ups_list ) - self.__widgets["ups_connect"].clicked.connect( self.connect_to_ups ) - self.__widgets["ups_disconnect"].clicked.connect( self.disconnect_from_ups ) - self.__widgets["ups_vars_refresh"].clicked.connect( self.__gui_update_ups_vars_view ) - self.__widgets["menu_favorites_add"].triggered.connect( self.__gui_add_favorite ) - self.__widgets["menu_favorites_del"].triggered.connect( self.__gui_delete_favorite ) - self.__widgets["ups_vars_tree"].doubleClicked.connect( self.__gui_ups_vars_selected ) - - # Remove the dummy combobox entry on UPS List and Commands - self.__widgets["ups_list_combo"].removeItem( 0 ) - - # Set UPS vars treeview properties ----------------------------- - store = QStandardItemModel( 0, 3, self.__widgets["ups_vars_tree"] ) - self.__widgets["ups_vars_tree"].setModel( store ) - self.__widgets["ups_vars_tree"].setHeaderHidden( False ) - self.__widgets["ups_vars_tree"].setRootIsDecorated( False ) - - # Column 0 - store.setHeaderData( 0, Qt.Horizontal, '' ) - - # Column 1 - store.setHeaderData( 1, Qt.Horizontal, _('Var name') ) - - # Column 2 - store.setHeaderData( 2, Qt.Horizontal, _('Value') ) - self.__widgets["ups_vars_tree"].header().setStretchLastSection( True ) - - self.__widgets["ups_vars_tree"].sortByColumn( 1, Qt.AscendingOrder ) - self.__widgets["ups_vars_tree_store"] = store - - self.__widgets["ups_vars_tree"].setMinimumSize( 0, 50 ) - #--------------------------------------------------------------- - - # UPS Commands combo box creation ------------------------------ - ups_commands_height = self.__widgets["ups_commands_combo"].size().height() * 2 - self.__widgets["ups_commands_combo"].setMinimumSize(0, ups_commands_height) - self.__widgets["ups_commands_combo"].setCurrentIndex( 0 ) - - self.__widgets["ups_commands_button"].setMinimumSize(0, ups_commands_height) - self.__widgets["ups_commands_button"].clicked.connect( self.__gui_send_ups_command ) - - self.__widgets["ups_commands_combo_store"] = self.__widgets["ups_commands_combo"] - #--------------------------------------------------------------- - - self.gui_init_unconnected() - - if ( cmd_opts.hidden != True ) : - self.__widgets["main_window"].show() - - # Define favorites path and load favorites - if ( platform.system() == "Linux" ) : - self.__favorites_path = os.path.join( os.environ.get("HOME"), ".nut-monitor" ) - elif ( platform.system() == "Windows" ) : - self.__favorites_path = os.path.join( os.environ.get("USERPROFILE"), "Application Data", "NUT-Monitor" ) - - self.__favorites_file = os.path.join( self.__favorites_path, "favorites.ini" ) - self.__parse_favorites() - - self.gui_status_message( _("Welcome to NUT Monitor") ) - - if ( cmd_opts.favorite != None ) : - if ( cmd_opts.favorite in self.__favorites ) : - self.__gui_load_favorite( fav_name=cmd_opts.favorite ) - self.connect_to_ups() - else : - # Try to scan localhost for available ups and connect to it if there is only one - self.__widgets["ups_host_entry"].setText( "localhost" ) - self.__update_ups_list() - if self.__widgets["ups_list_combo"].count() == 1: - self.connect_to_ups() - - def exec( self ) : - self.__app.exec() - - def __find_res_file( self, ftype, filename ) : - filename = os.path.join( ftype, filename ) - # TODO: Skip checking application directory if installed - path = os.path.join( os.path.dirname( sys.argv[0] ), filename ) - if os.path.exists(path): - return path - path = QStandardPaths.locate(QStandardPaths.AppDataLocation, filename) - if os.path.exists(path): - return path - raise RuntimeError("Cannot find %s resource %s" % (ftype, filename)) - - def __find_icon_file( self ) : - filename = 'nut-monitor.png' - # TODO: Skip checking application directory if installed - path = os.path.join( os.path.dirname( sys.argv[0] ), "icons", "256x256", filename ) - if os.path.exists(path): - return path - path = QStandardPaths.locate(QStandardPaths.AppDataLocation, os.path.join( "icons", "hicolor", "256x256", "apps", filename ) ) - if os.path.exists(path): - return path - raise RuntimeError("Cannot find %s resource %s" % ('icon', filename)) - - # Check if correct fields are filled to enable connection to the UPS - def __check_gui_fields( self, widget=None ) : - # If UPS list contains something, clear it - if self.__widgets["ups_list_combo"].currentIndex() != -1 : - self.__widgets["ups_list_combo"].clear() - self.__widgets["ups_connect"].setEnabled( False ) - self.__widgets["menu_favorites_add"].setEnabled( False ) - - # Host/Port selection - if len( self.__widgets["ups_host_entry"].text() ) > 0 : - sensitive = True - - # If authentication is selected, check that we have a login and password - if self.__widgets["ups_authentication_check"].isChecked() : - if len( self.__widgets["ups_authentication_login"].text() ) == 0 : - sensitive = False - - if len( self.__widgets["ups_authentication_password"].text() ) == 0 : - sensitive = False - - self.__widgets["ups_refresh_button"].setEnabled( sensitive ) - if not sensitive : - self.__widgets["ups_connect"].setEnabled( False ) - self.__widgets["menu_favorites_add"].setEnabled( False ) - else : - self.__widgets["ups_refresh_button"].setEnabled( False ) - self.__widgets["ups_connect"].setEnabled( False ) - self.__widgets["menu_favorites_add"].setEnabled( False ) - - # Use authentication fields... - if self.__widgets["ups_authentication_check"].isChecked() : - self.__widgets["ups_authentication_frame"].setEnabled( True ) - else : - self.__widgets["ups_authentication_frame"].setEnabled( False ) - - self.gui_status_message() - - #------------------------------------------------------------------- - # This method is used to show/hide the main window when user clicks on the tray icon - def tray_activated( self, widget=None, data=None ) : - if self.__window_visible : - self.__widgets["main_window"].hide() - else : - self.__widgets["main_window"].show() - - self.__window_visible = not self.__window_visible - - #------------------------------------------------------------------- - # Change the status icon and tray icon - def change_status_icon( self, icon="on_line", blink=False ) : - self.__widgets["status_icon"].setIcon( QIcon( self.__find_res_file( "pixmaps", "%s.png" % icon ) ) ) - self.__widgets["ups_status_image"].setPixmap( QPixmap( self.__find_res_file( "pixmaps", "%s.png" % icon ) ) ) - # TODO self.__widgets["status_icon"].set_blinking( blink ) - - #------------------------------------------------------------------- - # This method connects to the NUT server and retrieve availables UPSes - # using connection parameters (host, port, login, pass...) - def __update_ups_list( self, widget=None ) : - - host = self.__widgets["ups_host_entry"].text() - port = int( self.__widgets["ups_port_entry"].value() ) - login = None - password = None - - if self.__widgets["ups_authentication_check"].isChecked() : - login = self.__widgets["ups_authentication_login"].text() - password = self.__widgets["ups_authentication_password"].text() - - try : - nut_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password ) - upses = nut_handler.GetUPSList() - - ups_list = list(key.decode('ascii') for key in upses.keys()) - ups_list.sort() - - # If UPS list contains something, clear it - self.__widgets["ups_list_combo"].clear() - - for current in ups_list : - self.__widgets["ups_list_combo"].addItem( current ) - - self.__widgets["ups_list_combo"].setCurrentIndex( 0 ) - - self.__widgets["ups_connect"].setEnabled( True ) - self.__widgets["menu_favorites_add"].setEnabled( True ) - - self.gui_status_message( _("Found {0} devices on {1}").format( len( ups_list ), host ) ) - - except : - error_msg = _("Error connecting to '{0}' ({1})").format( host, sys.exc_info()[1] ) - self.gui_status_message( error_msg ) - - #------------------------------------------------------------------- - # Quit program - def quit( self, widget=None ) : - # If we are connected to an UPS, disconnect first... - if self.__connected : - self.gui_status_message( _("Disconnecting from device") ) - self.disconnect_from_ups() - - self.__app.quit() - - #------------------------------------------------------------------- - # Method called when user wants to add a new favorite entry. It - # displays a dialog to enable user to select the name of the favorite - def __gui_add_favorite( self, widget=None ) : - dialog_ui_file = self.__find_res_file( 'ui', "dialog1.ui" ) - dialog = PyQt5.uic.loadUi( dialog_ui_file ) - - # Define interface callbacks actions - def check_entry(val): - if self.__gui_add_favorite_check_gui_fields(val): - dialog.buttonBox.button(QDialogButtonBox.Ok).setEnabled( True ) - else: - dialog.buttonBox.button(QDialogButtonBox.Ok).setEnabled( False ) - dialog.entry4.textChanged.connect( check_entry ) - - self.__widgets["main_window"].setEnabled( False ) - rc = dialog.exec() - if rc == QDialog.Accepted : - fav_data = {} - fav_data["host"] = self.__widgets["ups_host_entry"].text() - fav_data["port"] = "%d" % self.__widgets["ups_port_entry"].value() - fav_data["ups"] = self.__widgets["ups_list_combo"].currentText() - fav_data["auth"] = self.__widgets["ups_authentication_check"].isChecked() - if fav_data["auth"] : - fav_data["login"] = self.__widgets["ups_authentication_login"].text() - fav_data["password"] = base64.b64encode( self.__widgets["ups_authentication_password"].text().encode('ascii') ).decode('ascii') - - fav_name = dialog.entry4.text() - self.__favorites[ fav_name ] = fav_data - self.__gui_refresh_favorites_menu() - - # Save all favorites - self.__save_favorites() - - self.__widgets["main_window"].setEnabled( True ) - - #------------------------------------------------------------------- - # Method called when user wants to delete an entry from favorites - def __gui_delete_favorite( self, widget=None ) : - dialog_ui_file = self.__find_res_file( 'ui', "dialog2.ui" ) - dialog = PyQt5.uic.loadUi( dialog_ui_file ) - - # Remove the dummy combobox entry on list - dialog.combobox2.removeItem( 0 ) - - favs = list(self.__favorites.keys()) - favs.sort() - for current in favs : - dialog.combobox2.addItem( current ) - - dialog.combobox2.setCurrentIndex( 0 ) - - self.__widgets["main_window"].setEnabled( False ) - rc = dialog.exec() - fav_name = dialog.combobox2.currentText() - self.__widgets["main_window"].setEnabled( True ) - - if ( rc == QDialog.Accepted ) : - # Remove entry, show confirmation dialog - resp = QMessageBox.question( None, self.__widgets["main_window"].windowTitle(), _("Are you sure that you want to remove this favorite ?"), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes ) - - if ( resp == QMessageBox.Yes ) : - del self.__favorites[ fav_name ] - self.__gui_refresh_favorites_menu() - self.__save_favorites() - self.gui_status_message( _("Removed favorite '%s'") % fav_name ) - - #------------------------------------------------------------------- - # Method called when user selects a favorite from the favorites menu - def __gui_load_favorite( self, fav_name="" ) : - - if ( fav_name in self.__favorites ) : - # If auth is activated, process it before other fields to avoir weird - # reactions with the 'check_gui_fields' function. - if ( self.__favorites[fav_name].get("auth", False ) ) : - self.__widgets["ups_authentication_check"].setChecked( True ) - self.__widgets["ups_authentication_login"].setText( self.__favorites[fav_name].get("login","") ) - self.__widgets["ups_authentication_password"].setText( self.__favorites[fav_name].get("password","") ) - - self.__widgets["ups_host_entry"].setText( self.__favorites[fav_name].get("host","") ) - self.__widgets["ups_port_entry"].setValue( int( self.__favorites[fav_name].get( "port", 3493 ) ) ) - - # Clear UPS list and add current UPS name - self.__widgets["ups_list_combo"].clear() - - self.__widgets["ups_list_combo"].addItem( self.__favorites[fav_name].get("ups","") ) - self.__widgets["ups_list_combo"].setCurrentIndex( 0 ) - - # Activate the connect button - self.__widgets["ups_connect"].setEnabled( True ) - - self.gui_status_message( _("Loaded '%s'") % fav_name ) - - #------------------------------------------------------------------- - # Send the selected command to the UPS - def __gui_send_ups_command( self, widget=None ) : - offset = self.__widgets["ups_commands_combo"].currentIndex() - cmd = self.__ups_commands[ offset ].decode('ascii') - - self.__widgets["main_window"].setEnabled( False ) - resp = QMessageBox.question( None, self.__widgets["main_window"].windowTitle(), _("Are you sure that you want to send '%s' to the device ?") % cmd, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes ) - self.__widgets["main_window"].setEnabled( True ) - - if ( resp == QMessageBox.Yes ) : - try : - self.__ups_handler.RunUPSCommand( self.__current_ups, cmd ) - self.gui_status_message( _("Sent '{0}' command to {1}").format( cmd, self.__current_ups ) ) - - except : - self.gui_status_message( _("Failed to send '{0}' ({1})").format( cmd, sys.exc_info()[1] ) ) - - #------------------------------------------------------------------- - # Method called when user clicks on the UPS vars treeview. If the user - # performs a double click on a RW var, the GUI shows the update var dialog. - def __gui_ups_vars_selected( self, index ) : - if True : - model = self.__widgets["ups_vars_tree_store"] - try : - ups_var = model.data( index.siblingAtColumn(1) ).encode('ascii') - if ( ups_var in self.__ups_rw_vars ) : - # The selected var is RW, then we can show the update dialog - - cur_val = self.__ups_rw_vars.get(ups_var).decode('ascii') - - self.__widgets["main_window"].setEnabled( False ) - new_val, rc = QInputDialog.getText( None, self.__widgets["main_window"].windowTitle(), _("Enter a new value for the variable.

{0} = {1} (current value)").format( ups_var, cur_val), QLineEdit.Normal, cur_val ) - self.__widgets["main_window"].setEnabled( True ) - - if ( rc ) : - try : - self.__ups_handler.SetRWVar( ups=self.__current_ups, var=ups_var.decode('ascii'), value=new_val ) - self.gui_status_message( _("Updated variable on %s") % self.__current_ups ) - - # Change the value on the local dict to update the GUI - new_val = new_val.encode('ascii') - self.__ups_vars[ups_var] = new_val - self.__ups_rw_vars[ups_var] = new_val - self.__gui_update_ups_vars_view() - - except : - error_msg = _("Error updating variable on '{0}' ({1})").format( self.__current_ups, sys.exc_info()[1] ) - self.gui_status_message( error_msg ) - - else : - # User cancelled modification... - error_msg = _("No variable modified on %s - User cancelled") % self.__current_ups - self.gui_status_message( error_msg ) - - except : - # Failed to get information from the treeview... skip action - pass - - #------------------------------------------------------------------- - # Refresh the content of the favorites menu according to the defined favorites - def __gui_refresh_favorites_menu( self ) : - for current in self.__fav_menu_items : - self.__widgets["menu_favorites"].removeAction(current) - - self.__fav_menu_items = list() - - items = list(self.__favorites.keys()) - items.sort() - - for current in items : - menu_item = QAction( current ) - self.__fav_menu_items.append( menu_item ) - self.__widgets["menu_favorites"].addAction( menu_item ) - - menu_item.triggered.connect( lambda: self.__gui_load_favorite( current ) ) - - if len( items ) > 0 : - self.__widgets["menu_favorites_del"].setEnabled( True ) - else : - self.__widgets["menu_favorites_del"].setEnabled( False ) - - #------------------------------------------------------------------- - # In 'add favorites' dialog, this method compares the content of the - # text widget representing the name of the new favorite with existing - # ones. If they match, the 'add' button will be set to non sensitive - # to avoid creating entries with the same name. - def __gui_add_favorite_check_gui_fields( self, fav_name ) : - if ( len( fav_name ) > 0 ) and ( fav_name not in list(self.__favorites.keys()) ) : - return True - else : - return False - - #------------------------------------------------------------------- - # Load and parse favorites - def __parse_favorites( self ) : - - if ( not os.path.exists( self.__favorites_file ) ) : - # There is no favorites files, do nothing - return - - try : - if ( not stat.S_IMODE( os.stat( self.__favorites_path ).st_mode ) == self.DESIRED_FAVORITES_DIRECTORY_MODE ) : # unsafe pre-1.2 directory found - os.chmod( self.__favorites_path, self.DESIRED_FAVORITES_DIRECTORY_MODE ) - - conf = configparser.ConfigParser() - conf.read( self.__favorites_file ) - for current in conf.sections() : - # Check if mandatory fields are present - if ( conf.has_option( current, "host" ) and conf.has_option( current, "ups" ) ) : - # Valid entry found, add it to the list - fav_data = {} - fav_data["host"] = conf.get( current, "host" ) - fav_data["ups"] = conf.get( current, "ups" ) - - if ( conf.has_option( current, "port" ) ) : - fav_data["port"] = conf.get( current, "port" ) - else : - fav_data["port"] = "3493" - - # If auth is defined the section must have login and pass defined - if ( conf.has_option( current, "auth" ) ) : - if( conf.has_option( current, "login" ) and conf.has_option( current, "password" ) ) : - # Add the entry - fav_data["auth"] = conf.getboolean( current, "auth" ) - fav_data["login"] = conf.get( current, "login" ) - - try : - fav_data["password"] = base64.decodebytes( conf.get( current, "password" ).encode('ascii') ).decode('ascii') - - except : - # If the password is not in base64, let the field empty - print(( _("Error parsing favorites, password for '%s' is not in base64\nSkipping password for this entry") % current )) - fav_data["password"] = "" - else : - fav_data["auth"] = False - - self.__favorites[current] = fav_data - self.__gui_refresh_favorites_menu() - - except : - self.gui_status_message( _("Error while parsing favorites file (%s)") % sys.exc_info()[1] ) - - #------------------------------------------------------------------- - # Save favorites to the defined favorites file using ini format - def __save_favorites( self ) : - - # If path does not exists, try to create it - if ( not os.path.exists( self.__favorites_file ) ) : - try : - os.makedirs( self.__favorites_path, mode=self.DESIRED_FAVORITES_DIRECTORY_MODE, exist_ok=True ) - except : - self.gui_status_message( _("Error while creating configuration folder (%s)") % sys.exc_info()[1] ) - - save_conf = configparser.ConfigParser() - for current in list(self.__favorites.keys()) : - save_conf.add_section( current ) - for k, v in self.__favorites[ current ].items() : - if isinstance( v, bool ) : - v = str( v ) - save_conf.set( current, k, v ) - - try : - fh = open( self.__favorites_file, "w" ) - save_conf.write( fh ) - fh.close() - self.gui_status_message( _("Saved favorites...") ) - - except : - self.gui_status_message( _("Error while saving favorites (%s)") % sys.exc_info()[1] ) - - #------------------------------------------------------------------- - # Display the about dialog - def gui_about_dialog( self, widget=None ) : - self.__widgets["main_window"].adjustSize() - dialog_ui_file = self.__find_res_file( 'ui', "aboutdialog1.ui" ) - - dialog = PyQt5.uic.loadUi( dialog_ui_file ) - dialog.icon.setPixmap( QPixmap( self.__find_icon_file() ) ) - - credits_button = QPushButton( dialog ) - credits_button.setText( _("C&redits") ) - credits_button.setIcon( dialog.style().standardIcon( QStyle.SP_MessageBoxInformation ) ) - credits_button.clicked.connect( self.gui_about_credits ) - - licence_button = QPushButton( dialog ) - licence_button.setText( _("&Licence") ) - licence_button.clicked.connect( self.gui_about_licence ) - - dialog.buttonBox.addButton( credits_button, QDialogButtonBox.HelpRole ) - dialog.buttonBox.addButton( licence_button, QDialogButtonBox.HelpRole ) - - self.__widgets["main_window"].setEnabled( False ) - dialog.exec() - self.__widgets["main_window"].setEnabled( True ) - - def gui_about_credits( self ) : - QMessageBox.about( None, _("Credits"), _(""" -Written by: -David Goncalves - -Translated by: -David Goncalves - Français -Daniele Pezzini - Italiano - """).strip() ) - - def gui_about_licence( self ) : - QMessageBox.about( None, _("Licence"), _(""" -Copyright (C) 2010 David Goncalves - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . - """).strip() ) - - #------------------------------------------------------------------- - # Display a message on the status bar. The message is also set as - # tooltip to enable users to see long messages. - def gui_status_message( self, msg="" ) : - text = msg - - message_id = self.__widgets["status_bar"].showMessage( text.replace("\n", "") ) - self.__widgets["status_bar"].setToolTip( text ) - - #------------------------------------------------------------------- - # Display a notification using QSystemTrayIcon with an optional icon - def gui_status_notification( self, message="", icon_file="" ) : - if ( icon_file != "" ) : - icon = QIcon( os.path.abspath( self.__find_res_file( "pixmaps", icon_file ) ) ) - else : - icon = None - - self.__widgets["status_icon"].showMessage( "NUT Monitor", message, icon ) - - #------------------------------------------------------------------- - # Connect to the selected UPS using parameters (host,port,login,pass) - def connect_to_ups( self, widget=None ) : - - host = self.__widgets["ups_host_entry"].text() - port = int( self.__widgets["ups_port_entry"].value() ) - login = None - password = None - - if self.__widgets["ups_authentication_check"].isChecked() : - login = self.__widgets["ups_authentication_login"].text() - password = self.__widgets["ups_authentication_password"].text() - - try : - self.__ups_handler = PyNUT.PyNUTClient( host=host, port=port, login=login, password=password ) - - except : - self.gui_status_message( _("Error connecting to '{0}' ({1})").format( host, sys.exc_info()[1] ) ) - self.gui_status_notification( _("Error connecting to '{0}'\n{1}").format( host, sys.exc_info()[1] ), "warning.png" ) - return - - # Check if selected UPS exists on server... - srv_upses = self.__ups_handler.GetUPSList() - self.__current_ups = self.__widgets["ups_list_combo"].currentText() - - if self.__current_ups.encode('ascii') not in srv_upses : - self.gui_status_message( _("Device '%s' not found on server") % self.__current_ups ) - self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" ) - return - - self.__connected = True - self.__widgets["ups_connect"].hide() - self.__widgets["ups_disconnect"].show() - self.__widgets["ups_infos"].show() - self.__widgets["ups_params_box"].setEnabled( False ) - self.__widgets["menu_favorites_root"].setEnabled( False ) - self.__widgets["ups_params_box"].hide() - - commands = self.__ups_handler.GetUPSCommands( self.__current_ups ) - self.__ups_commands = list(commands.keys()) - self.__ups_commands.sort() - - # Refresh UPS commands combo box - self.__widgets["ups_commands_combo_store"].clear() - for desc in self.__ups_commands : - # TODO: Style as "%s
%s" - self.__widgets["ups_commands_combo_store"].addItem( "%s\n%s" % ( desc.decode('ascii'), commands[desc].decode('ascii') ) ) - - self.__widgets["ups_commands_combo"].setCurrentIndex( 0 ) - - # Update UPS vars manually before the thread - self.__ups_vars = self.__ups_handler.GetUPSVars( self.__current_ups ) - self.__ups_rw_vars = self.__ups_handler.GetRWVars( self.__current_ups ) - self.__gui_update_ups_vars_view() - - # Try to resize the main window... - # FIXME: For some reason, calling this immediately doesn't work right - QTimer.singleShot(10, self.__widgets["main_window"].adjustSize) - - # Start the GUI updater thread - self.__gui_thread = gui_updater( self ) - self.__gui_thread.start() - - self.gui_status_message( _("Connected to '{0}' on {1}").format( self.__current_ups, host ) ) - - - #------------------------------------------------------------------- - # Refresh UPS vars in the treeview - def __gui_update_ups_vars_view( self, widget=None ) : - if self.__ups_handler : - vars = self.__ups_vars - rwvars = self.__ups_rw_vars - - self.__widgets["ups_vars_tree_store"].removeRows(0, self.__widgets["ups_vars_tree_store"].rowCount()) - - for k,v in vars.items() : - if ( k in rwvars ) : - icon_file = self.__find_res_file( "pixmaps", "var-rw.png" ) - else : - icon_file = self.__find_res_file( "pixmaps", "var-ro.png" ) - - icon = QIcon( icon_file ) - item_icon = QStandardItem(icon, '') - item_icon.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren) - item_var_name = QStandardItem( k.decode('ascii') ) - item_var_name.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren) - item_var_val = QStandardItem( v.decode('ascii') ) - item_var_val.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemNeverHasChildren) - self.__widgets["ups_vars_tree_store"].appendRow( (item_icon, item_var_name, item_var_val) ) - self.__widgets["ups_vars_tree"].resizeColumnToContents( 0 ) - self.__widgets["ups_vars_tree"].resizeColumnToContents( 1 ) - - - def gui_init_unconnected( self ) : - self.__connected = False - self.__widgets["ups_connect"].show() - self.__widgets["ups_disconnect"].hide() - self.__widgets["ups_infos"].hide() - self.__widgets["ups_params_box"].setEnabled( True ) - self.__widgets["menu_favorites_root"].setEnabled( True ) - self.__widgets["status_icon"].setToolTip( _("Not connected") ) - self.__widgets["ups_params_box"].show() - - # Try to resize the main window... - self.__widgets["main_window"].adjustSize() - - #------------------------------------------------------------------- - # Disconnect from the UPS - def disconnect_from_ups( self, widget=None ) : - self.gui_init_unconnected() - - # Stop the GUI updater thread - self.__gui_thread.stop_thread() - - del self.__ups_handler - self.gui_status_message( _("Disconnected from '%s'") % self.__current_ups ) - self.change_status_icon( "on_line", blink=False ) - self.__current_ups = None - -#----------------------------------------------------------------------- -# GUI Updater class -# This class updates the main gui with data from connected UPS -class gui_updater : - - __parent_class = None - __stop_thread = False - - def __init__( self, parent_class ) : - threading.Thread.__init__( self ) - self.__parent_class = parent_class - - def start( self ) : - self.__timer = QTimer() - self.__timer.timeout.connect(self.__update) - self.__timer.start(1000) - - def __update( self ) : - - ups = self.__parent_class._interface__current_ups - was_online = True - - # Define a dict containing different UPS status - status_mapper = { b"LB" : "%s" % _("Low batteries"), - b"RB" : "%s" % _("Replace batteries !"), - b"BYPASS" : "Bypass %s" % _("(no battery protection)"), - b"CAL" : _("Performing runtime calibration"), - b"OFF" : "%s (%s)" % ( _("Offline"), _("not providing power to the load") ), - b"OVER" : "%s (%s)" % ( _("Overloaded !"), _("there is too much load for device") ), - b"TRIM" : _("Triming (UPS is triming incoming voltage)"), - b"BOOST" : _("Boost (UPS is boosting incoming voltage)") - } - - if not self.__stop_thread : - try : - vars = self.__parent_class._interface__ups_handler.GetUPSVars( ups ) - self.__parent_class._interface__ups_vars = vars - - # Text displayed on the status frame - text_left = "" - text_right = "" - status_text = "" - - text_left += "%s
" % _("Device status :") - - if ( vars.get(b"ups.status").find(b"OL") != -1 ) : - text_right += "%s" % _("Online") - if not was_online : - self.__parent_class.change_status_icon( "on_line", blink=False ) - was_online = True - - if ( vars.get(b"ups.status").find(b"OB") != -1 ) : - text_right += "%s" % _("On batteries") - if was_online : - self.__parent_class.change_status_icon( "on_battery", blink=True ) - self.__parent_class.gui_status_notification( _("Device is running on batteries"), "on_battery.png" ) - was_online = False - - # Check for additionnal information - for k,v in status_mapper.items() : - if vars.get(b"ups.status").find(k) != -1 : - if ( text_right != "" ) : - text_right += " - %s" % v - else : - text_right += "%s" % v - - # CHRG and DISCHRG cannot be trated with the previous loop ;) - if ( vars.get(b"ups.status").find(b"DISCHRG") != -1 ) : - text_right += " - %s" % _("discharging") - elif ( vars.get(b"ups.status").find(b"CHRG") != -1 ) : - text_right += " - %s" % _("charging") - - status_text += text_right - text_right += "
" - - if ( b"ups.mfr" in vars ) : - text_left += "%s

" % _("Model :") - text_right += "%s
%s
" % ( - vars.get(b"ups.mfr",b"").decode('ascii'), - vars.get(b"ups.model",b"").decode('ascii'), - ) - - if ( b"ups.temperature" in vars ) : - text_left += "%s
" % _("Temperature :") - text_right += "%s
" % int( float( vars.get( b"ups.temperature", 0 ) ) ) - - if ( b"battery.voltage" in vars ) : - text_left += "%s
" % _("Battery voltage :") - text_right += "%sv
" % (vars.get( b"battery.voltage", 0 ).decode('ascii'),) - - self.__parent_class._interface__widgets["ups_status_left"].setText( text_left[:-4] ) - self.__parent_class._interface__widgets["ups_status_right"].setText( text_right[:-4] ) - - # UPS load and battery charge progress bars - self.__parent_class._interface__widgets["progress_battery_charge"].setRange( 0, 100 ) - if ( b"battery.charge" in vars ) : - charge = vars.get( b"battery.charge", "0" ) - self.__parent_class._interface__widgets["progress_battery_charge"].setValue( int( float( charge ) ) ) - self.__parent_class._interface__widgets["progress_battery_charge"].resetFormat() - status_text += "
%s %s%%" % ( _("Battery charge :"), int( float( charge ) ) ) - else : - self.__parent_class._interface__widgets["progress_battery_charge"].setValue( 0 ) - self.__parent_class._interface__widgets["progress_battery_charge"].setFormat( _("Not available") ) - # FIXME: Some themes don't draw text, so swap it with a QLabel? - - self.__parent_class._interface__widgets["progress_battery_load"].setRange( 0, 100 ) - if ( b"ups.load" in vars ) : - load = vars.get( b"ups.load", "0" ) - self.__parent_class._interface__widgets["progress_battery_load"].setValue( int( float( load ) ) ) - self.__parent_class._interface__widgets["progress_battery_load"].resetFormat() - status_text += "
%s %s%%" % ( _("UPS load :"), int( float( load ) ) ) - else : - self.__parent_class._interface__widgets["progress_battery_load"].setValue( 0 ) - self.__parent_class._interface__widgets["progress_battery_load"].setFormat( _("Not available") ) - # FIXME: Some themes don't draw text, so swap it with a QLabel? - - if ( b"battery.runtime" in vars ) : - autonomy = int( float( vars.get( b"battery.runtime", 0 ) ) ) - - if ( autonomy >= 3600 ) : - info = time.strftime( _("%H hours %M minutes %S seconds"), time.gmtime( autonomy ) ) - elif ( autonomy > 300 ) : - info = time.strftime( _("%M minutes %S seconds"), time.gmtime( autonomy ) ) - else : - info = time.strftime( _("%M minutes %S seconds"), time.gmtime( autonomy ) ) - else : - info = _("Not available") - - self.__parent_class._interface__widgets["ups_status_time"].setText( info ) - - # Display UPS status as tooltip for tray icon - self.__parent_class._interface__widgets["status_icon"].setToolTip( status_text ) - - except : - self.__parent_class.gui_status_message( _("Error from '{0}' ({1})").format( ups, sys.exc_info()[1] ) ) - self.__parent_class.gui_status_notification( _("Error from '{0}'\n{1}").format( ups, sys.exc_info()[1] ), "warning.png" ) - - def stop_thread( self ) : - self.__timer.stop() - - -#----------------------------------------------------------------------- -# The main program starts here :-) -if __name__ == "__main__" : - - # Init the localisation - APP = "NUT-Monitor" - DIR = "locale" - - gettext.bindtextdomain( APP, DIR ) - gettext.textdomain( APP ) - _ = gettext.gettext - - for module in ( gettext, ) : - module.bindtextdomain( APP, DIR ) - module.textdomain( APP ) - - gui = interface(sys.argv) - gui.exec() - diff --git a/scripts/python/app/README b/scripts/python/app/README index 163c4ae..2285f2c 100644 --- a/scripts/python/app/README +++ b/scripts/python/app/README @@ -1,55 +1,7 @@ -NUT-Monitor -=========== - -NUT-Monitor is a graphical application to access and manage UPSes connected to +NUT-Monitor is a graphical application to access and manager UPSes connected to a NUT (Network UPS Tools) server. -Dependencies ------------- +This application (written in Python + GTK) uses the python-pynut class +(available at http://www.lestat.st) -This application (variants written in Python 2 + GTK2, and in Python 3 + Qt5) -uses the python-pynut class (available at http://www.lestat.st), delivered -as PyNUT in the NUT source tree. - -Refer to your OS packaging and/or install custom modules with `pip` (or `pip3`) -to get required dependencies (GTK + GObject or QT5). - -Path to PyNUT module --------------------- - -For quick tests (e.g. during development), you can run the clients like this: -```` -:; PYTHONPATH=../module/ python2 ./NUT-Monitor-py2gtk2.in -```` -or: -```` -:; PYTHONPATH=../module/ python3 ./NUT-Monitor-py3qt5.in -```` - -Localization ------------- - -For localized UI, also `export LANG=fr_FR.UTF-8` or `export LANG=ru_RU.UTF-8` -(see and feel welcome to improve the choice of languages in `locale` directory). - -NOTE: Currently localization only works for Python 2 client, PRs are welcome. - -Desktop menu integration ------------------------- - -This component ships both implementation-specific `nut-monitor-py2gtk2.desktop` -and `nut-monitor-py3qt5.desktop` files which allows a user to have icons for -both variants separately, as well as the legacy-named `nut-monitor.desktop` -for running the wrapper script `NUT-Monitor` which picks an implementation best -suited for current run-time circumstances. - -Kudos ------ - -NUT-Monitor and PyNUT (for Python 2 syntax) were originally authored -by David Goncalves - -NUT-Monitor was converted to Python 3 + QT5 by Luke Dashjr - -PyNUT was extended, and two variants of NUT-Monitor converged and wrapped -for Python 2+3 dual support by Jim Klimov +David Goncalves diff --git a/scripts/python/app/ui/gui-1.3.glade b/scripts/python/app/gui-1.3.glade similarity index 99% rename from scripts/python/app/ui/gui-1.3.glade rename to scripts/python/app/gui-1.3.glade index eb42aba..1d54fe6 100644 --- a/scripts/python/app/ui/gui-1.3.glade +++ b/scripts/python/app/gui-1.3.glade @@ -1021,7 +1021,7 @@ want to delete from list... center-always normal NUT-Monitor - 1.3.1 + 1.3 Copyright (c) 2010 David Goncalves GUI to manage devices connected a NUT server. diff --git a/scripts/python/app/icons/256x256/nut-monitor.png b/scripts/python/app/icons/256x256/nut-monitor.png deleted file mode 100644 index 15f472a..0000000 Binary files a/scripts/python/app/icons/256x256/nut-monitor.png and /dev/null differ diff --git a/scripts/python/app/icons/64x64/nut-monitor.png b/scripts/python/app/icons/64x64/nut-monitor.png deleted file mode 100644 index 9d92284..0000000 Binary files a/scripts/python/app/icons/64x64/nut-monitor.png and /dev/null differ diff --git a/scripts/python/app/icons/scalable/nut-monitor.svg b/scripts/python/app/icons/scalable/nut-monitor.svg deleted file mode 100644 index c046562..0000000 --- a/scripts/python/app/icons/scalable/nut-monitor.svg +++ /dev/null @@ -1,490 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - Lapo Calamandrei - - - Battery - - - battery - recharge - power - acpi - apm - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/scripts/python/app/nut-monitor-py2gtk2.desktop b/scripts/python/app/nut-monitor-py2gtk2.desktop deleted file mode 100644 index 130cd06..0000000 --- a/scripts/python/app/nut-monitor-py2gtk2.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Name=NUT Monitor -Name[fr]=Moniteur NUT -Comment=Network UPS Tools GUI client (Py2Gtk2) -Comment[fr]=Client graphique pour NUT (Network UPS Tools, Py2Gtk2) -Comment[it]=Client grafico per NUT (Network UPS Tools, Py2Gtk2) -Categories=System;Monitor;HardwareSettings;Settings;GTK -Exec=NUT-Monitor-py2gtk2 -Icon=nut-monitor -Terminal=false -Type=Application diff --git a/scripts/python/app/nut-monitor-py3qt5.desktop b/scripts/python/app/nut-monitor-py3qt5.desktop deleted file mode 100644 index 66fcd86..0000000 --- a/scripts/python/app/nut-monitor-py3qt5.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Name=NUT Monitor -Name[fr]=Moniteur NUT -Comment=Network UPS Tools GUI client (Py3Qt5) -Comment[fr]=Client graphique pour NUT (Network UPS Tools, Py3Qt5) -Comment[it]=Client grafico per NUT (Network UPS Tools, Py3Qt5) -Categories=System;Monitor;HardwareSettings;Settings;Qt -Exec=NUT-Monitor-py3qt5 -Icon=nut-monitor -Terminal=false -Type=Application diff --git a/scripts/python/app/nut-monitor.appdata.xml b/scripts/python/app/nut-monitor.appdata.xml deleted file mode 100644 index da0f163..0000000 --- a/scripts/python/app/nut-monitor.appdata.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - nut-monitor.desktop - CC0-1.0 - GPL-3.0+ - NUT Monitor - GUI application to monitor UPS status - -

- NUT Monitor is a GUI application to monitor UPS status, through NUT - - Network UPS Tools. - NUT is a client/server monitoring system that allows computers to - share uninterruptible power supply (UPS) and power distribution unit - (PDU) hardware. Clients access the hardware through the server, and - are notified whenever the power status changes. -

-

NUT Monitor provides the following features:

-
    -
  • Automatically connects to local UPS if there is only one managed
  • -
  • Command line options to start hidden, load a favorite, ...
  • -
  • System tray (notification area) integration, including notifications
  • -
  • Favorites, to store different devices
  • -
  • Display all device variables
  • -
  • Modify writable variables on UPS and devices
  • -
  • Support English and French
  • -
-

- NUT Monitor requires that you have a running NUT system, that you can - connect to, either locally or remotely. - For more information on NUT: http://www.networkupstools.org/ -

-
- - - https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-1.png - - - https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-2.png - - - https://www.lestat.st/_media/informatique/projets/nut-monitor/nut-monitor-3.png - - - https://www.lestat.st/en/informatique/projets/nut-monitor - david@lestat.st - -
diff --git a/scripts/python/app/nut-monitor.desktop b/scripts/python/app/nut-monitor.desktop new file mode 100644 index 0000000..4e698d2 --- /dev/null +++ b/scripts/python/app/nut-monitor.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Name=NUT Monitor +Name[fr]=Moniteur NUT +Comment=Network UPS Tools GUI client +Comment[fr]=Client graphique pour NUT (Network UPS Tools) +Comment[it]=Client grafico per NUT (Network UPS Tools) +Categories=Application;Network; +Encoding=UTF-8 +Exec=NUT-Monitor +Icon=nut-monitor.png +Terminal=false +Type=Application diff --git a/scripts/python/app/icons/48x48/nut-monitor.png b/scripts/python/app/nut-monitor.png similarity index 100% rename from scripts/python/app/icons/48x48/nut-monitor.png rename to scripts/python/app/nut-monitor.png diff --git a/scripts/python/app/ui/aboutdialog1.ui b/scripts/python/app/ui/aboutdialog1.ui deleted file mode 100644 index c6a6214..0000000 --- a/scripts/python/app/ui/aboutdialog1.ui +++ /dev/null @@ -1,108 +0,0 @@ - - - aboutdialog1 - - - About NUT-Monitor - - - true - - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - <h1>NUT-Monitor 1.3.1</h1> -<p>GUI to manage devices connected a NUT server.</p> -<p>For more information about NUT (Network UPS Tools) please visit the author's website.</p> -<p style="margin-bottom: 1.5em">http://www.networkupstools.org</p> -<p style=" font-size:8pt;">Copyright (c) 2010 David Goncalves</p> -<p><a href="http://www.lestat.st/informatique/projets/nut-monitor-en">http://www.lestat.st</a></p> - - - Qt::RichText - - - Qt::AlignCenter - - - true - - - true - - - Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - aboutdialog1 - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - aboutdialog1 - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/scripts/python/app/ui/dialog1.ui b/scripts/python/app/ui/dialog1.ui deleted file mode 100644 index 6cf652b..0000000 --- a/scripts/python/app/ui/dialog1.ui +++ /dev/null @@ -1,89 +0,0 @@ - - - dialog1 - - - - 0 - 0 - 297 - 133 - - - - Dialog - - - true - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Enter a name for this favorite<br><br><font color="#808080">You cannot re-use a name from another entry</font> - - - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - dialog1 - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - dialog1 - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/scripts/python/app/ui/dialog2.ui b/scripts/python/app/ui/dialog2.ui deleted file mode 100644 index d31542e..0000000 --- a/scripts/python/app/ui/dialog2.ui +++ /dev/null @@ -1,98 +0,0 @@ - - - dialog2 - - - - 0 - 0 - 229 - 116 - - - - Dialog - - - true - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - Please select the favorite that you want to delete from list... - - - true - - - - - - - - None - - - - - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - dialog2 - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - dialog2 - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/scripts/python/app/ui/window1.ui b/scripts/python/app/ui/window1.ui deleted file mode 100644 index 1950464..0000000 --- a/scripts/python/app/ui/window1.ui +++ /dev/null @@ -1,473 +0,0 @@ - - - window1 - - - - 0 - 0 - 560 - 465 - - - - NUT Monitor - - - - ../../../../../.designer/backup../../../../../.designer/backup - - - - - - - NUT Server - - - Qt::AlignCenter - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - 65535 - - - 3493 - - - - - - - - - - Device : - - - - - - - - None - - - - - - - - Host / Port : - - - - - - - false - - - &Refresh - - - - - - - - - - - - Use authentication - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Login / Password : - - - - - - - - - - QLineEdit::Password - - - - - - - - - - QFrame::HLine - - - QFrame::Sunken - - - - - - - - - - - - false - - - C&onnect - - - - - - - - - - &Disconnect - - - - - - - - - - - - - - - 0 - - - - Device status - - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - 0 - 0 - - - - label - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - label - - - - - - - - - - - - - - Remaining time : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Battery charge : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 24 - - - - - - - Device commands : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - 24 - - - - - - - Current load : - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - N/A - - - Qt::AlignCenter - - - - - - - - - - - - - 0 - 0 - - - - QComboBox::AdjustToContents - - - - - - - &Execute - - - - - - - - - - - - - - - Device vars - - - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - - - &Refresh - - - - - - - - - - - - - - - - - - - 0 - 0 - 560 - 24 - - - - - &File - - - - - - - - F&avorites - - - - - - - - - - - - - - - &About - - - - - - - - &Quit - - - Ctrl+Q - - - - - false - - - - - - &Add - - - - - false - - - - - - &Delete - - - - - - diff --git a/scripts/python/module/PyNUT.py.in b/scripts/python/module/PyNUT.py similarity index 51% rename from scripts/python/module/PyNUT.py.in rename to scripts/python/module/PyNUT.py index 226c0ae..98c9114 100644 --- a/scripts/python/module/PyNUT.py.in +++ b/scripts/python/module/PyNUT.py @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2008 David Goncalves @@ -35,21 +35,9 @@ # 2012-02-07 René Martín Rodríguez - Version 1.2.2 # Added support for LIST CLIENTS command # -# 2014-06-03 george2 - Version 1.3.0 -# Added custom exception class, fixed minor bug, added Python 3 support. -# -# 2021-09-27 Jim Klimov - Version 1.4.0 -# Revise strings used to be byte sequences as required by telnetlib -# in Python 3.9, by spelling out b"STR" or str.encode('ascii'); -# the change was also tested to work with Python 2.7, 3.4, 3.5 and -# 3.7 (to the extent of accompanying test_nutclient.py at least). import telnetlib -class PyNUTError( Exception ) : - """ Base class for custom exceptions """ - - class PyNUTClient : """ Abstraction class to access NUT (Network UPS Tools) server """ @@ -61,8 +49,8 @@ class PyNUTClient : __timeout = None __srv_handler = None - __version = "1.4.0" - __release = "2021-09-27" + __version = "1.2.2" + __release = "2012-02-07" def __init__( self, host="127.0.0.1", port=3493, login=None, password=None, debug=False, timeout=5 ) : @@ -94,7 +82,7 @@ timeout : Timeout used to wait for network response def __del__( self ) : """ Class destructor method """ try : - self.__srv_handler.write( b"LOGOUT\n" ) + self.__srv_handler.write( "LOGOUT\n" ) except : pass @@ -110,16 +98,16 @@ if something goes wrong. self.__srv_handler = telnetlib.Telnet( self.__host, self.__port ) if self.__login != None : - self.__srv_handler.write( ("USERNAME %s\n" % self.__login).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n", self.__timeout ) - if result[:2] != b"OK" : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "USERNAME %s\n" % self.__login ) + result = self.__srv_handler.read_until( "\n", self.__timeout ) + if result[:2] != "OK" : + raise Exception, result.replace( "\n", "" ) if self.__password != None : - self.__srv_handler.write( ("PASSWORD %s\n" % self.__password).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n", self.__timeout ) - if result[:2] != b"OK" : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "PASSWORD %s\n" % self.__password ) + result = self.__srv_handler.read_until( "\n", self.__timeout ) + if result[:2] != "OK" : + raise Exception, result.replace( "\n", "" ) def GetUPSList( self ) : """ Returns the list of available UPS from the NUT server @@ -129,18 +117,18 @@ The result is a dictionary containing 'key->val' pairs of 'UPSName' and 'UPS Des if self.__debug : print( "[DEBUG] GetUPSList from server" ) - self.__srv_handler.write( b"LIST UPS\n" ) - result = self.__srv_handler.read_until( b"\n" ) - if result != b"BEGIN LIST UPS\n" : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "LIST UPS\n" ) + result = self.__srv_handler.read_until( "\n" ) + if result != "BEGIN LIST UPS\n" : + raise Exception, result.replace( "\n", "" ) - result = self.__srv_handler.read_until( b"END LIST UPS\n" ) + result = self.__srv_handler.read_until( "END LIST UPS\n" ) ups_list = {} - for line in result.split( b"\n" ) : - if line[:3] == b"UPS" : - ups, desc = line[4:-1].split( b'"' ) - ups_list[ ups.replace( b" ", b"" ) ] = desc + for line in result.split( "\n" ) : + if line[:3] == "UPS" : + ups, desc = line[4:-1].split( '"' ) + ups_list[ ups.replace( " ", "" ) ] = desc return( ups_list ) @@ -153,19 +141,19 @@ available vars. if self.__debug : print( "[DEBUG] GetUPSVars called..." ) - self.__srv_handler.write( ("LIST VAR %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if result != ("BEGIN LIST VAR %s\n" % ups).encode('ascii') : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "LIST VAR %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if result != "BEGIN LIST VAR %s\n" % ups : + raise Exception, result.replace( "\n", "" ) ups_vars = {} - result = self.__srv_handler.read_until( ("END LIST VAR %s\n" % ups).encode('ascii') ) - offset = len( ("VAR %s " % ups ).encode('ascii') ) - end_offset = 0 - ( len( ("END LIST VAR %s\n" % ups).encode('ascii') ) + 1 ) + result = self.__srv_handler.read_until( "END LIST VAR %s\n" % ups ) + offset = len( "VAR %s " % ups ) + end_offset = 0 - ( len( "END LIST VAR %s\n" % ups ) + 1 ) - for current in result[:end_offset].split( b"\n" ) : - var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" ) - data = current[ offset: ].split( b'"' )[1] + for current in result[:end_offset].split( "\n" ) : + var = current[ offset: ].split( '"' )[0].replace( " ", "" ) + data = current[ offset: ].split( '"' )[1] ups_vars[ var ] = data return( ups_vars ) @@ -179,28 +167,28 @@ of the command as value if self.__debug : print( "[DEBUG] GetUPSCommands called..." ) - self.__srv_handler.write( ("LIST CMD %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if result != ("BEGIN LIST CMD %s\n" % ups).encode('ascii') : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "LIST CMD %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if result != "BEGIN LIST CMD %s\n" % ups : + raise Exception, result.replace( "\n", "" ) ups_cmds = {} - result = self.__srv_handler.read_until( ("END LIST CMD %s\n" % ups).encode('ascii') ) - offset = len( ("CMD %s " % ups).encode('ascii') ) - end_offset = 0 - ( len( ("END LIST CMD %s\n" % ups).encode('ascii') ) + 1 ) + result = self.__srv_handler.read_until( "END LIST CMD %s\n" % ups ) + offset = len( "CMD %s " % ups ) + end_offset = 0 - ( len( "END LIST CMD %s\n" % ups ) + 1 ) - for current in result[:end_offset].split( b"\n" ) : - var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" ) + for current in result[:end_offset].split( "\n" ) : + var = current[ offset: ].split( '"' )[0].replace( " ", "" ) # For each var we try to get the available description try : - self.__srv_handler.write( ("GET CMDDESC %s %s\n" % ( ups, var )).encode('ascii') ) - temp = self.__srv_handler.read_until( b"\n" ) - if temp[:7] != b"CMDDESC" : - raise PyNUTError + self.__srv_handler.write( "GET CMDDESC %s %s\n" % ( ups, var ) ) + temp = self.__srv_handler.read_until( "\n" ) + if temp[:7] != "CMDDESC" : + raise else : - off = len( ("CMDDESC %s %s " % ( ups, var )).encode('ascii') ) - desc = temp[off:-1].split(b'"')[1] + off = len( "CMDDESC %s %s " % ( ups, var ) ) + desc = temp[off:-1].split('"')[1] except : desc = var @@ -216,20 +204,20 @@ The result is presented as a dictionary containing 'key->val' pairs if self.__debug : print( "[DEBUG] GetUPSVars from '%s'..." % ups ) - self.__srv_handler.write( ("LIST RW %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result != ("BEGIN LIST RW %s\n" % ups).encode('ascii') ) : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "LIST RW %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if ( result != "BEGIN LIST RW %s\n" % ups ) : + raise Exception, result.replace( "\n", "" ) - result = self.__srv_handler.read_until( ("END LIST RW %s\n" % ups).encode('ascii') ) - offset = len( ("VAR %s" % ups).encode('ascii') ) - end_offset = 0 - ( len( ("END LIST RW %s\n" % ups).encode('ascii') ) + 1 ) + result = self.__srv_handler.read_until( "END LIST RW %s\n" % ups ) + offset = len( "VAR %s" % ups ) + end_offset = 0 - ( len( "END LIST RW %s\n" % ups ) + 1 ) rw_vars = {} try : - for current in result[:end_offset].split( b"\n" ) : - var = current[ offset: ].split( b'"' )[0].replace( b" ", b"" ) - data = current[ offset: ].split( b'"' )[1] + for current in result[:end_offset].split( "\n" ) : + var = current[ offset: ].split( '"' )[0].replace( " ", "" ) + data = current[ offset: ].split( '"' )[1] rw_vars[ var ] = data except : @@ -244,12 +232,12 @@ The variable must be a writable value (cf GetRWVars) and you must have the prope rights to set it (maybe login/password). """ - self.__srv_handler.write( ("SET VAR %s %s %s\n" % ( ups, var, value )).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result == b"OK\n" ) : + self.__srv_handler.write( "SET VAR %s %s %s\n" % ( ups, var, value ) ) + result = self.__srv_handler.read_until( "\n" ) + if ( result == "OK\n" ) : return( "OK" ) else : - raise PyNUTError( result ) + raise Exception, result def RunUPSCommand( self, ups="", command="" ) : """ Send a command to the specified UPS @@ -260,43 +248,35 @@ Returns OK on success or raises an error if self.__debug : print( "[DEBUG] RunUPSCommand called..." ) - self.__srv_handler.write( ("INSTCMD %s %s\n" % ( ups, command )).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result == b"OK\n" ) : + self.__srv_handler.write( "INSTCMD %s %s\n" % ( ups, command ) ) + result = self.__srv_handler.read_until( "\n" ) + if ( result == "OK\n" ) : return( "OK" ) else : - raise PyNUTError( result.replace( b"\n", b"" ) ) + raise Exception, result.replace( "\n", "" ) def FSD( self, ups="") : """ Send FSD command Returns OK on success or raises an error - -NOTE: API changed since NUT 2.8.0 to replace MASTER with PRIMARY -(and backwards-compatible alias handling) """ if self.__debug : - print( "[DEBUG] PRIMARY called..." ) + print( "[DEBUG] MASTER called..." ) - self.__srv_handler.write( ("PRIMARY %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result != b"OK PRIMARY-GRANTED\n" ) : - if self.__debug : - print( "[DEBUG] Retrying: MASTER called..." ) - self.__srv_handler.write( ("MASTER %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result != b"OK MASTER-GRANTED\n" ) : - raise PyNUTError( ( "Primary level functions are not available", "" ) ) + self.__srv_handler.write( "MASTER %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if ( result != "OK MASTER-GRANTED\n" ) : + raise Exception, ( "Master level function are not available", "" ) if self.__debug : print( "[DEBUG] FSD called..." ) - self.__srv_handler.write( ("FSD %s\n" % ups).encode('ascii') ) - result = self.__srv_handler.read_until( b"\n" ) - if ( result == b"OK FSD-SET\n" ) : + self.__srv_handler.write( "FSD %s\n" % ups ) + result = self.__srv_handler.read_until( "\n" ) + if ( result == "OK FSD-SET\n" ) : return( "OK" ) else : - raise PyNUTError( result.replace( b"\n", b"" ) ) + raise Exception, result.replace( "\n", "" ) def help(self) : """ Send HELP command @@ -305,8 +285,8 @@ NOTE: API changed since NUT 2.8.0 to replace MASTER with PRIMARY if self.__debug : print( "[DEBUG] HELP called..." ) - self.__srv_handler.write( b"HELP\n" ) - return self.__srv_handler.read_until( b"\n" ) + self.__srv_handler.write( "HELP\n") + return self.__srv_handler.read_until( "\n" ) def ver(self) : """ Send VER command @@ -315,8 +295,8 @@ NOTE: API changed since NUT 2.8.0 to replace MASTER with PRIMARY if self.__debug : print( "[DEBUG] VER called..." ) - self.__srv_handler.write( b"VER\n" ) - return self.__srv_handler.read_until( b"\n" ) + self.__srv_handler.write( "VER\n") + return self.__srv_handler.read_until( "\n" ) def ListClients( self, ups = None ) : """ Returns the list of connected clients from the NUT server @@ -327,23 +307,23 @@ The result is a dictionary containing 'key->val' pairs of 'UPSName' and a list o print( "[DEBUG] ListClients from server" ) if ups and (ups not in self.GetUPSList()): - raise PyNUTError( "%s is not a valid UPS" % ups ) + raise Exception, "%s is not a valid UPS" % ups if ups: - self.__srv_handler.write( ("LIST CLIENTS %s\n" % ups).encode('ascii') ) + self.__srv_handler.write( "LIST CLIENTS %s\n" % ups) else: - self.__srv_handler.write( b"LIST CLIENTS\n" ) - result = self.__srv_handler.read_until( b"\n" ) - if result != b"BEGIN LIST CLIENTS\n" : - raise PyNUTError( result.replace( b"\n", b"" ) ) + self.__srv_handler.write( "LIST CLIENTS\n" ) + result = self.__srv_handler.read_until( "\n" ) + if result != "BEGIN LIST CLIENTS\n" : + raise Exception, result.replace( "\n", "" ) - result = self.__srv_handler.read_until( b"END LIST CLIENTS\n" ) + result = self.__srv_handler.read_until( "END LIST CLIENTS\n" ) ups_list = {} - for line in result.split( b"\n" ): - if line[:6] == b"CLIENT" : - host, ups = line[7:].split(b' ') - ups.replace(b' ', b'') + for line in result.split( "\n" ): + if line[:6] == "CLIENT" : + host, ups = line[7:].split(' ') + ups.replace(' ', '') if not ups in ups_list: ups_list[ups] = [] ups_list[ups].append(host) diff --git a/scripts/python/module/test_nutclient.py.in b/scripts/python/module/test_nutclient.py similarity index 68% rename from scripts/python/module/test_nutclient.py.in rename to scripts/python/module/test_nutclient.py index 22e6adb..39993e0 100755 --- a/scripts/python/module/test_nutclient.py.in +++ b/scripts/python/module/test_nutclient.py @@ -1,31 +1,22 @@ -#!@PYTHON@ +#!/usr/bin/env python # -*- coding: utf-8 -*- # This source code is provided for testing/debuging purpose ;) import PyNUT import sys -import os if __name__ == "__main__" : - NUT_PORT = int(os.getenv('NUT_PORT', '3493')) - NUT_USER = os.getenv('NUT_USER', None) - NUT_PASS = os.getenv('NUT_PASS', None) print( "PyNUTClient test..." ) - #nut = PyNUT.PyNUTClient( debug=True, port=NUT_PORT ) - nut = PyNUT.PyNUTClient( login=NUT_USER, password=NUT_PASS, debug=True, port=NUT_PORT ) - #nut = PyNUT.PyNUTClient( login="upsadmin", password="upsadmin", debug=True, port=NUT_PORT ) + nut = PyNUT.PyNUTClient( debug=True ) + #nut = PyNUT.PyNUTClient( login="upsadmin", password="upsadmin", debug=True ) print( 80*"-" + "\nTesting 'GetUPSList' :") result = nut.GetUPSList( ) print( "\033[01;33m%s\033[0m\n" % result ) - # [dummy] - # driver = dummy-ups - # desc = "Test device" - # port = /src/nut/data/evolution500.seq - print( 80*"-" + "\nTesting 'GetUPSVars' for 'dummy' (should be registered in upsd.conf) :") + print( 80*"-" + "\nTesting 'GetUPSVars' :") result = nut.GetUPSVars( "dummy" ) print( "\033[01;33m%s\033[0m\n" % result ) diff --git a/scripts/subdriver/gen-snmp-subdriver.sh b/scripts/subdriver/gen-snmp-subdriver.sh deleted file mode 100755 index f7ccf44..0000000 --- a/scripts/subdriver/gen-snmp-subdriver.sh +++ /dev/null @@ -1,474 +0,0 @@ -#!/bin/bash -# -# an auxiliary script to produce a "stub" snmp-ups subdriver from -# SNMP data from a real agent or from dump files -# -# Version: 0.13 -# -# See also: docs/snmp-subdrivers.txt -# -# Copyright (C) -# 2011 - 2012 Arnaud Quette -# 2015 - 2022 Eaton (author: Arnaud Quette ) -# 2011 Jim Klimov -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# TODO: -# - Prepend sysDescription (.1.3.6.1.2.1.1.1.0) to have some more visibility -# - extend to SNMP v3 (auth.) - -usage() { - echo "Usage: $0 [options] [file]" - echo "Options:" - echo " -h, --help -- show this message and quit" - echo " -n name -- subdriver name (use natural capitalization)" - echo " -M DIRLIST -- colon separated list of directories to also search for MIBs" - echo " -k -- keep temporary files (for debugging)" - echo "" - echo "mode 1: get SNMP data from a real agent" - echo " -H host_address -- SNMP host IP address or name" - echo " -c community -- SNMP v1 community name (default: public)" - echo " -s XXXX -- override SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.10'" - echo "" - echo "mode 2: get data from files (snmpwalk dumps of 'sysOID' subtree)" - echo " -s XXXX -- SNMP OID entry point (sysOID). Ex: '.1.3.6.1.4.1.534.6.6.7'" - echo " file1 file2 -- read from files instead of an host (using Net SNMP)" - echo " file1: numeric SNMP walk (snmpwalk -On ... )" - echo " file2: string SNMP walk (snmpwalk -Os ... )" - echo "" - echo "mode 3: get data from 1 file (numeric snmpwalk dump of the whole SNMP tree)" - echo " The sysOID is extracted from the dump, and only the pointed subtree is used" - echo " A MIB file MUST be provided, and is used to produce the string SNMP walk" - echo " file1 -- read from file instead of an host (using Net SNMP)" - echo " file1: numeric SNMP walk (snmpwalk -On ... )" - echo "" - - echo "Notes:" - echo " For both modes, prefer to copy the specific MIB file(s) for your device in the $0 script directory" - echo " So that it is automatically taken into account for the string name resolution of OIDs" - echo " Otherwise, use \"-M.\" option" - echo "" - echo "Example:" - echo "mode 1: $0 -H 192.168.0.1 -n mibname -c mycommunity" - echo "mode 2: (using sysOID .1.3.6.1.4.1.534.6.6.7)" - echo " snmpwalk -On -v1 -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> numeric-walk-file" - echo " snmpwalk -Os -v1 -m ALL -M+. -c mycommunity 192.168.0.1 .1.3.6.1.4.1.534.6.6.7 2>/dev/null 1> string-walk-file" - echo " $0 -s .1.3.6.1.4.1.534.6.6.7 numeric-walk-file string-walk-file" - echo "mode 3:" - echo " snmpwalk -On -v1 -c mycommunity 192.168.0.1 .1 2>/dev/null 1> numeric-walk-file" - echo " $0 numeric-walk-file" - echo "" - echo " You may alos need to install additional packages:" - echo " - 'snmp' package (on Debian) for the base commands (snmpget, snmpwalk, snmptranslate)" - echo " - 'snmp-mibs-downloader' package (on Debian) to get all standard MIBs" -} - -# variables -DRIVER="" -KEEP="" -HOSTNAME="" -MIBS_DIRLIST="+." -COMMUNITY="public" -DEVICE_SYSOID="" -SYSOID="" -MODE=0 - -# constants -NAME=gen-snmp-subdriver -TMPDIR="${TEMPDIR:-/tmp}" -SYSOID_NUMBER=".1.3.6.1.2.1.1.2.0" -DEBUG="`mktemp "$TMPDIR/$NAME-DEBUG.XXXXXX"`" -DFL_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-NUMWALK.XXXXXX"`" -DFL_STRWALKFILE="`mktemp "$TMPDIR/$NAME-STRWALK.XXXXXX"`" -TMP_NUMWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-NUMWALK.XXXXXX"`" -TMP_STRWALKFILE="`mktemp "$TMPDIR/$NAME-TMP-STRWALK.XXXXXX"`" - -get_snmp_data() { - # 1) get the sysOID (points the mfr specif MIB), apart if there's an override - if [ -z "$SYSOID" ] - then - SYSOID="`snmpget -On -v1 -c "$COMMUNITY" -Ov "$HOSTNAME" "$SYSOID_NUMBER" | cut -d' ' -f2`" - echo "sysOID retrieved: ${SYSOID}" - else - echo "Using the provided sysOID override ($SYSOID)" - fi - DEVICE_SYSOID="$SYSOID" - - OID_COUNT=0 - while (test "$OID_COUNT" -eq 0) - do - # 2) get the content of the mfr specif MIB - echo "Retrieving SNMP information. This may take some time" - snmpwalk -On -v1 -c "$COMMUNITY" "$HOSTNAME" "$SYSOID" 2>/dev/null 1> "$DFL_NUMWALKFILE" - snmpwalk -Os -v1 -m ALL -M"$MIBS_DIRLIST" -c "$COMMUNITY" "$HOSTNAME" "$SYSOID" 2>/dev/null 1> "$DFL_STRWALKFILE" - - # 3) test return value of the walk, and possibly ramp-up the path to get something. - # The sysOID mechanism only works if we're pointed somehow in the right direction - # i.e. doesn't work if sysOID is .1.3.6.1.4.1.705.1 and data is at .1.3.6.1.4.1.534... - # Ex: sysOID = ".1.X.Y.Z" - # try with ".1.X.Y.Z", if fails try with .1.X.Y", if fails try with .1.X"... - OID_COUNT="`cat $NUMWALKFILE | wc -l`" - if [ $OID_COUNT -eq 0 ]; then - # ramp-up the provided sysOID by removing the last .x part - SYSOID=${SYSOID%.*} - echo "Warning: sysOID provided no data! Trying with a level up using $SYSOID" - fi - done - return $OID_COUNT -} - -generate_C() { - # create file names, lowercase - LDRIVER="`echo "$DRIVER" | tr A-Z a-z`" - UDRIVER="`echo "$DRIVER" | tr a-z A-Z`" - # keep dashes in name for files - CFILE="$LDRIVER-mib.c" - HFILE="$LDRIVER-mib.h" - # but replace with underscores for the structures and defines - LDRIVER="`echo "$LDRIVER" | tr - _`" - UDRIVER="`echo "$UDRIVER" | tr - _`" - - # generate header file - # NOTE: with <<-EOF leading TABs are all stripped - echo "Creating $HFILE" - cat > "$HFILE" <<-EOF - /* ${HFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2016 Arnaud Quette - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - #ifndef ${UDRIVER}_MIB_H - #define ${UDRIVER}_MIB_H - - #include "main.h" - #include "snmp-ups.h" - - extern mib2nut_info_t ${LDRIVER}; - - #endif /* ${UDRIVER}_MIB_H */ - EOF - - # generate source file - # create heading boilerblate - # NOTE: with <<-EOF leading TABs are all stripped - echo "Creating $CFILE" - cat > "$CFILE" <<-EOF - /* ${CFILE} - subdriver to monitor ${DRIVER} SNMP devices with NUT - * - * Copyright (C) - * 2011 - 2016 Arnaud Quette - * - * Note: this subdriver was initially generated as a "stub" by the - * gen-snmp-subdriver script. It must be customized! - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - - #include "${HFILE}" - - #define ${UDRIVER}_MIB_VERSION "0.1" - - #define ${UDRIVER}_SYSOID "${DEVICE_SYSOID}" - - /* To create a value lookup structure (as needed on the 2nd line of the example - * below), use the following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t onbatt_info[] = { - * { 1, "OB" }, - * { 2, "OL" }, - * { 0, NULL } - * }; - */ - - /* ${UDRIVER} Snmp2NUT lookup table */ - static snmp_info_t ${LDRIVER}_mib[] = { - - /* Data format: - * { info_type, info_flags, info_len, OID, dfl, flags, oid2info }, - * - * info_type: NUT INFO_ or CMD_ element name - * info_flags: flags to set in addinfo - * info_len: length of strings if ST_FLAG_STRING, multiplier otherwise - * OID: SNMP OID or NULL - * dfl: default value - * flags: snmp-ups internal flags (FIXME: ...) - * oid2info: lookup table between OID and NUT values - * - * Example: - * { "input.voltage", 0, 0.1, ".1.3.6.1.4.1.705.1.6.2.1.2.1", "", SU_INPUT_1, NULL }, - * { "ups.status", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.705.1.7.3.0", "", SU_FLAG_OK | SU_STATUS_BATT, onbatt_info }, - * - * To create a value lookup structure (as needed on the 2nd line), use the - * following kind of declaration, outside of the present snmp_info_t[]: - * static info_lkp_t onbatt_info[] = { - * { 1, "OB" }, - * { 2, "OL" }, - * { 0, NULL } - * }; - */ - - /* standard MIB items; if the vendor MIB contains better OIDs for - * this (e.g. with daisy-chain support), consider adding those here - */ - EOF - - # Same file, indented text (TABs not stripped): - cat >> "$CFILE" < /dev/null - if [ $? -eq 0 ]; then - ST_FLAG_TYPE="ST_FLAG_STRING" - SU_INFOSIZE="SU_INFOSIZE" - else - ST_FLAG_TYPE="0" - SU_INFOSIZE="1" - fi - # get the matching numeric OID - NUM_OID="`sed -n "${LINENB}p" "${NUMWALKFILE}" | cut -d' ' -f1`" - printf "\t/* ${FULL_STR_OID} */\n\t{ \"unmapped.${STR_OID}\", ${ST_FLAG_TYPE}, ${SU_INFOSIZE}, \"${NUM_OID}\", NULL, SU_FLAG_OK, NULL },\n" - done < "${STRWALKFILE}" >> "${CFILE}" - - # append footer (TABs not stripped): - cat >> "$CFILE" <&2 - exit 1 - fi -done - -# check that the needed parameters are provided, depending on the mode -if [ -z "$NUMWALKFILE" ]; then - # mode 1: directly get SNMP data from a real agent - echo "Mode 1 selected" - MODE=1 - NUMWALKFILE="$DFL_NUMWALKFILE" - STRWALKFILE="$DFL_STRWALKFILE" - - # check if Net SNMP is available - if [ -z "`command -v snmpget`" -o -z "`command -v snmpwalk`" ] && \ - [ -z "`which snmpget`" -o -z "`which snmpwalk`" ]; then - echo "Net SNMP not found! snmpget and snmpwalk commands are required." >&2 - exit 1 - fi - # hostname is also mandatory - while [ -z "$HOSTNAME" ]; do - printf "\n\tPlease enter the SNMP host IP address or name.\n" - read -p "SNMP host IP name or address: " HOSTNAME < /dev/tty - if echo "$HOSTNAME" | egrep -q '[^a-zA-Z0-9.-]'; then - echo "Please use only letters, digits, dash and period character" - HOSTNAME="" - fi - done - # get data from the agent - get_snmp_data -else - # no string walk provided, so mode 3 - if [ -z "$STRWALKFILE" ]; then - # mode 3: get data from 1 file, - # Filter according to sysOID on the specific subtree - # Generate the numeric SNMP walk using this output - # then use snmptranslate to get the string OIDs and generated the string SNMP walk - echo "Mode 3 selected" - MODE=3 - RAWWALKFILE="$NUMWALKFILE" - NUMWALKFILE="$DFL_NUMWALKFILE" - STRWALKFILE="$DFL_STRWALKFILE" - - # check for actual file existence - if [ ! -f "$RAWWALKFILE" ]; then - echo "SNMP walk dump file is missing on disk. Try --help for more info." >&2 - exit 1 - fi - # Extract the sysOID - # Format is "1.3.6.1.2.1.1.2.0 = OID: 1.3.6.1.4.1.4555.1.1.1" - DEVICE_SYSOID="`grep 1.3.6.1.2.1.1.2.0 "$RAWWALKFILE" | cut -d' ' -f4`" - if [ -n "$DEVICE_SYSOID" ]; then - echo "Found sysOID $DEVICE_SYSOID" - else - echo "SNMP sysOID is missing in file. Try --help for more info." >&2 - exit 1 - fi - - # Switch to the entry point, and extract the subtree - # Extract the numeric walk - echo -n "Extracting numeric SNMP walk..." - grep "$DEVICE_SYSOID" "$RAWWALKFILE" | egrep -v "1.3.6.1.2.1.1.2.0" 2>/dev/null 1> "$NUMWALKFILE" - echo " done" - - # Create the string walk from a translation of the numeric one - echo -n "Converting string SNMP walk..." - while IFS=' = ' read NUM_OID OID_VALUE - do - STR_OID="`snmptranslate -Os -m ALL -M+. "$NUM_OID" 2>/dev/null`" - # Uncomment the below line to get debug logs - #echo "Got: $STR_OID = $OID_VALUE" - printf "." - echo "$STR_OID = $OID_VALUE" >> "$STRWALKFILE" - done < "$NUMWALKFILE" - echo " done" - else - # mode 2: get data from files - echo "Mode 2 selected" - MODE=2 - - # get sysOID value from command line, if needed - while [ -z "$SYSOID" ]; do - echo " -Please enter the value of sysOID, as displayed by snmp-ups. For example '.1.3.6.1.4.1.2254.2.4'. -You can get it using: snmpget -v1 -c XXX $SYSOID_NUMBER" - read -p "Value of sysOID: " SYSOID < /dev/tty - if echo "$SYSOID" | egrep -q '[^0-9.]'; then - echo "Please use only the numeric form, with dots and digits" - SYSOID="" - fi - done - # check for actual files existence - if [ ! -f "$NUMWALKFILE" -o ! -f "$STRWALKFILE" ]; then - echo "SNMP walk dump files are missing on disk. Try --help for more info." >&2 - exit 1 - fi - fi -fi - -# delete temporary files: this is called just before exiting. -cleanup () { - rm -f "$DEBUG $DFL_NUMWALKFILE $TMP_NUMWALKFILE $DFL_STRWALKFILE $TMP_STRWALKFILE" -} -if [ -n "$KEEP" ]; then - trap cleanup EXIT -fi - -# prompt use for name of driver -while [ -z "$DRIVER" ]; do - echo " -Please enter a name for this driver. Use only letters and numbers. Use -natural (upper- and lowercase) capitalization, e.g., 'Belkin', 'APC'." - read -p "Name of subdriver: " DRIVER < /dev/tty - if echo "$DRIVER" | egrep -q '[^a-zA-Z0-9]'; then - echo "Please use only letters and digits" - DRIVER="" - fi -done - -# remove blank and "End of MIB" lines -egrep -e "^[[:space:]]?$" -e "End of MIB" -v "${NUMWALKFILE}" > "${TMP_NUMWALKFILE}" -egrep -e "^[[:space:]]?$" -e "End of MIB" -v "${STRWALKFILE}" > "${TMP_STRWALKFILE}" -NUMWALKFILE="${TMP_NUMWALKFILE}" -STRWALKFILE="${TMP_STRWALKFILE}" - -# FIXME: sanity checks (! -z contents -a same `wc -l`) -NUM_OID_COUNT="`cat "$NUMWALKFILE" | wc -l`" -STR_OID_COUNT="`cat "$STRWALKFILE" | wc -l`" - -echo "SNMP OIDs extracted = $NUM_OID_COUNT / $NUM_OID_COUNT" - -generate_C - -# Display the remaining tasks -cat < "$CFILE" < * 2005 - 2006 Peter Selinger * 2008 - 2009 Arjen de Korte - * 2013 Charles Lepple - * - * TODO: Add year and name for new subdriver author (contributor) - * Mention in docs/acknowledgements.txt if this is a vendor contribution * * Note: this subdriver was initially generated as a "stub" by the * gen-usbhid-subdriver script. It must be customized. @@ -206,7 +202,7 @@ static usb_device_id_t ${LDRIVER}_usb_device_table[] = { { USB_DEVICE(${UDRIVER}_VENDORID, 0x${PRODUCTID}), NULL }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; @@ -221,7 +217,7 @@ EOF cat "$SUBST" | sed 's/\(.*\) \(.*\)/\t{ "\2",\t0x\1 },/' >> "$CFILE" cat >> "$CFILE" <> "$CFILE" <> "$CFILE" <VendorID, hd->ProductID); switch (status) { @@ -296,7 +292,6 @@ subdriver_t ${LDRIVER}_subdriver = { ${LDRIVER}_format_model, ${LDRIVER}_format_mfr, ${LDRIVER}_format_serial, - fix_report_desc, /* may optionally be customized, see cps-hid.c for example */ }; EOF @@ -304,8 +299,8 @@ cat <&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,31 +53,26 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@HAVE_SYSTEMD_TRUE@am__append_1 = nut-driver.target nut.target -@HAVE_SYSTEMD_FALSE@am__append_2 = \ -@HAVE_SYSTEMD_FALSE@ nut-driver@.service.in nut-monitor.service.in \ -@HAVE_SYSTEMD_FALSE@ nut-server.service.in nutshutdown.in nut-driver.target nut.target \ -@HAVE_SYSTEMD_FALSE@ nut-driver-enumerator.path.in nut-driver-enumerator.service.in +@HAVE_SYSTEMD_FALSE@am__append_1 = nut-driver.service.in nut-monitor.service.in \ +@HAVE_SYSTEMD_FALSE@ nut-server.service.in nutshutdown.in subdir = scripts/systemd +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nut-driver.service.in \ + $(srcdir)/nut-monitor.service.in \ + $(srcdir)/nut-server.service.in $(srcdir)/nutshutdown.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -123,23 +81,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nut-common.tmpfiles nut-driver@.service \ - nut-monitor.service nut-server.service \ - nut-driver-enumerator.service nut-driver-enumerator.path \ - nutshutdown +CONFIG_CLEAN_FILES = nut-driver.service nut-monitor.service \ + nut-server.service nutshutdown CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -168,24 +119,9 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } -am__installdirs = "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" \ - "$(DESTDIR)$(systemdshutdowndir)" \ - "$(DESTDIR)$(systemdsystemunitdir)" \ - "$(DESTDIR)$(systemdtmpfilesdir)" -SCRIPTS = $(libexec_SCRIPTS) $(sbin_SCRIPTS) \ - $(systemdshutdown_SCRIPTS) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = +am__installdirs = "$(DESTDIR)$(systemdsystemshutdowndir)" \ + "$(DESTDIR)$(systemdsystemunitdir)" +SCRIPTS = $(systemdsystemshutdown_SCRIPTS) SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -193,25 +129,14 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -DATA = $(systemdsystemunit_DATA) $(systemdtmpfiles_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/nut-common.tmpfiles.in \ - $(srcdir)/nut-driver-enumerator.path.in \ - $(srcdir)/nut-driver-enumerator.service.in \ - $(srcdir)/nut-driver@.service.in \ - $(srcdir)/nut-monitor.service.in \ - $(srcdir)/nut-server.service.in $(srcdir)/nutshutdown.in \ - README +DATA = $(systemdsystemunit_DATA) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -222,7 +147,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -236,7 +160,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -249,8 +172,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -260,15 +186,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -279,29 +204,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -321,9 +238,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -332,16 +246,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -355,7 +265,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -366,12 +275,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -390,21 +295,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -414,27 +316,13 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -EXTRA_DIST = README $(am__append_1) $(am__append_2) +EXTRA_DIST = README $(am__append_1) @HAVE_SYSTEMD_TRUE@systemdsystemunit_DATA = \ -@HAVE_SYSTEMD_TRUE@ nut-driver-enumerator.service \ -@HAVE_SYSTEMD_TRUE@ nut-driver-enumerator.path \ -@HAVE_SYSTEMD_TRUE@ nut-driver@.service \ +@HAVE_SYSTEMD_TRUE@ nut-driver.service \ @HAVE_SYSTEMD_TRUE@ nut-monitor.service \ -@HAVE_SYSTEMD_TRUE@ nut-server.service \ -@HAVE_SYSTEMD_TRUE@ nut-driver.target \ -@HAVE_SYSTEMD_TRUE@ nut.target +@HAVE_SYSTEMD_TRUE@ nut-server.service -@HAVE_SYSTEMD_TRUE@systemdtmpfiles_DATA = \ -@HAVE_SYSTEMD_TRUE@ nut-common.tmpfiles - -@HAVE_SYSTEMD_TRUE@systemdshutdown_SCRIPTS = nutshutdown -@HAVE_SYSTEMD_TRUE@libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh -@HAVE_SYSTEMD_TRUE@sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl - -# NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build - -# Generated by autogen.sh and needed to run the configure script: -MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-common.tmpfiles.in +@HAVE_SYSTEMD_TRUE@systemdsystemshutdown_SCRIPTS = nutshutdown all: all-am .SUFFIXES: @@ -450,13 +338,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/systemd/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/systemd/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -467,26 +356,20 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -nut-common.tmpfiles: $(top_builddir)/config.status $(srcdir)/nut-common.tmpfiles.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-driver@.service: $(top_builddir)/config.status $(srcdir)/nut-driver@.service.in +nut-driver.service: $(top_builddir)/config.status $(srcdir)/nut-driver.service.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nut-monitor.service: $(top_builddir)/config.status $(srcdir)/nut-monitor.service.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nut-server.service: $(top_builddir)/config.status $(srcdir)/nut-server.service.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-driver-enumerator.service: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.service.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-driver-enumerator.path: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.path.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ nutshutdown: $(top_builddir)/config.status $(srcdir)/nutshutdown.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -install-libexecSCRIPTS: $(libexec_SCRIPTS) +install-systemdsystemshutdownSCRIPTS: $(systemdsystemshutdown_SCRIPTS) @$(NORMAL_INSTALL) - @list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || list=; \ + @list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || list=; \ if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(libexecdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libexecdir)" || exit 1; \ + echo " $(MKDIR_P) '$(DESTDIR)$(systemdsystemshutdowndir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(systemdsystemshutdowndir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ @@ -505,87 +388,17 @@ install-libexecSCRIPTS: $(libexec_SCRIPTS) while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \ + echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(systemdsystemshutdowndir)$$dir'"; \ + $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(systemdsystemshutdowndir)$$dir" || exit $$?; \ } \ ; done -uninstall-libexecSCRIPTS: +uninstall-systemdsystemshutdownSCRIPTS: @$(NORMAL_UNINSTALL) - @list='$(libexec_SCRIPTS)'; test -n "$(libexecdir)" || exit 0; \ + @list='$(systemdsystemshutdown_SCRIPTS)'; test -n "$(systemdsystemshutdowndir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(libexecdir)'; $(am__uninstall_files_from_dir) -install-sbinSCRIPTS: $(sbin_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(sbindir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-sbinSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(sbindir)'; $(am__uninstall_files_from_dir) -install-systemdshutdownSCRIPTS: $(systemdshutdown_SCRIPTS) - @$(NORMAL_INSTALL) - @list='$(systemdshutdown_SCRIPTS)'; test -n "$(systemdshutdowndir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(systemdshutdowndir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(systemdshutdowndir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n' \ - -e 'h;s|.*|.|' \ - -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) { files[d] = files[d] " " $$1; \ - if (++n[d] == $(am__install_max)) { \ - print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ - else { print "f", d "/" $$4, $$1 } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(systemdshutdowndir)$$dir'"; \ - $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(systemdshutdowndir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-systemdshutdownSCRIPTS: - @$(NORMAL_UNINSTALL) - @list='$(systemdshutdown_SCRIPTS)'; test -n "$(systemdshutdowndir)" || exit 0; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 's,.*/,,;$(transform)'`; \ - dir='$(DESTDIR)$(systemdshutdowndir)'; $(am__uninstall_files_from_dir) + dir='$(DESTDIR)$(systemdsystemshutdowndir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo @@ -613,38 +426,14 @@ uninstall-systemdsystemunitDATA: @list='$(systemdsystemunit_DATA)'; test -n "$(systemdsystemunitdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(systemdsystemunitdir)'; $(am__uninstall_files_from_dir) -install-systemdtmpfilesDATA: $(systemdtmpfiles_DATA) - @$(NORMAL_INSTALL) - @list='$(systemdtmpfiles_DATA)'; test -n "$(systemdtmpfilesdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(systemdtmpfilesdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(systemdtmpfilesdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(systemdtmpfilesdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(systemdtmpfilesdir)" || exit $$?; \ - done +tags: TAGS +TAGS: -uninstall-systemdtmpfilesDATA: - @$(NORMAL_UNINSTALL) - @list='$(systemdtmpfiles_DATA)'; test -n "$(systemdtmpfilesdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(systemdtmpfilesdir)'; $(am__uninstall_files_from_dir) -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -678,7 +467,7 @@ check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: - for dir in "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(systemdshutdowndir)" "$(DESTDIR)$(systemdsystemunitdir)" "$(DESTDIR)$(systemdtmpfilesdir)"; do \ + for dir in "$(DESTDIR)$(systemdsystemshutdowndir)" "$(DESTDIR)$(systemdsystemunitdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -711,7 +500,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -732,14 +520,14 @@ info: info-am info-am: -install-data-am: install-systemdshutdownSCRIPTS \ - install-systemdsystemunitDATA install-systemdtmpfilesDATA +install-data-am: install-systemdsystemshutdownSCRIPTS \ + install-systemdsystemunitDATA install-dvi: install-dvi-am install-dvi-am: -install-exec-am: install-libexecSCRIPTS install-sbinSCRIPTS +install-exec-am: install-html: install-html-am @@ -777,30 +565,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \ - uninstall-systemdshutdownSCRIPTS \ - uninstall-systemdsystemunitDATA uninstall-systemdtmpfilesDATA +uninstall-am: uninstall-systemdsystemshutdownSCRIPTS \ + uninstall-systemdsystemunitDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am \ - install-libexecSCRIPTS install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-sbinSCRIPTS install-strip \ - install-systemdshutdownSCRIPTS install-systemdsystemunitDATA \ - install-systemdtmpfilesDATA installcheck installcheck-am \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-systemdsystemshutdownSCRIPTS \ + install-systemdsystemunitDATA installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am tags-am uninstall uninstall-am \ - uninstall-libexecSCRIPTS uninstall-sbinSCRIPTS \ - uninstall-systemdshutdownSCRIPTS \ - uninstall-systemdsystemunitDATA uninstall-systemdtmpfilesDATA - -.PRECIOUS: Makefile + ps ps-am uninstall uninstall-am \ + uninstall-systemdsystemshutdownSCRIPTS \ + uninstall-systemdsystemunitDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/scripts/systemd/README b/scripts/systemd/README index b006358..c8930ab 100644 --- a/scripts/systemd/README +++ b/scripts/systemd/README @@ -4,10 +4,5 @@ Service Manager. These files are automatically installed, upon detection (at configure time) of a systemd enabled system. -This also uses the nut-driver-enumerator.sh (service and implementation -method) and upsdrvsvcctl (tool) to manage NUT drivers as service instances -located in ../upsdrvsvcctl/ source subdirectory. - Contributed by Michal Hlavinka -Updated 2016-2018 by Michal Hrusecky and Jim Klimov diff --git a/scripts/systemd/nut-common.tmpfiles.in b/scripts/systemd/nut-common.tmpfiles.in deleted file mode 100644 index e69e784..0000000 --- a/scripts/systemd/nut-common.tmpfiles.in +++ /dev/null @@ -1,5 +0,0 @@ -# State file (e.g. upsd to driver) and pidfile location for NUT: -d @STATEPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @STATEPATH@/nut -d @PIDPATH@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - - -X @PIDPATH@/nut diff --git a/scripts/systemd/nut-driver-enumerator.path.in b/scripts/systemd/nut-driver-enumerator.path.in deleted file mode 100644 index 11f3406..0000000 --- a/scripts/systemd/nut-driver-enumerator.path.in +++ /dev/null @@ -1,7 +0,0 @@ -# Trigger restart of nut-driver-enumerator.service whenever ups.conf is edited - -[Path] -PathModified=@CONFPATH@/ups.conf - -[Install] -WantedBy=nut.target diff --git a/scripts/systemd/nut-driver-enumerator.service.in b/scripts/systemd/nut-driver-enumerator.service.in deleted file mode 100644 index 51e6d15..0000000 --- a/scripts/systemd/nut-driver-enumerator.service.in +++ /dev/null @@ -1,30 +0,0 @@ -[Unit] -# This unit starts early in system lifecycle to set up nut-driver instances. -# End-user may also restart this unit after editing ups.conf to automatically -# un-register or add new instances as appropriate. -Description=Network UPS Tools - enumeration of configure-file devices into systemd unit instances -After=local-fs.target -Before=nut-driver.target -PartOf=nut.target - -[Service] -### Script needs privileges to restart units -#User=@RUN_AS_USER@ -#Group=@RUN_AS_GROUP@ -User=root -SyslogIdentifier=%N -# it is expected that the process has to exit before systemd starts follow-up -# units; it should not be a problem for those -Type=oneshot -# Currently systemd does not support restarting of oneshot services, and does -# not seem to guarantee that other services would only start after the script -# completes, for a non-oneshot case. The script itself handles restarting of -# nut-server which is the primary concerned dependency at the moment, so we -# don't want it to fail the unit (when it can't restart). -Environment=REPORT_RESTART_42=no -EnvironmentFile=-@CONFPATH@/nut.conf -ExecStart=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh -ExecReload=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh - -[Install] -WantedBy=nut.target diff --git a/scripts/systemd/nut-driver.service.in b/scripts/systemd/nut-driver.service.in new file mode 100644 index 0000000..8664162 --- /dev/null +++ b/scripts/systemd/nut-driver.service.in @@ -0,0 +1,10 @@ +[Unit] +Description=Network UPS Tools - power device driver controller +After=local-fs.target network.target +StopWhenUnneeded=yes + +[Service] +ExecStart=@DRVPATH@/upsdrvctl start +ExecStop=@DRVPATH@/upsdrvctl stop +Type=forking + diff --git a/scripts/systemd/nut-driver.target b/scripts/systemd/nut-driver.target deleted file mode 100644 index d994ab9..0000000 --- a/scripts/systemd/nut-driver.target +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Network UPS Tools - target for power device drivers on this system -After=local-fs.target -# network.target -PartOf=nut.target - -[Install] -WantedBy=nut.target diff --git a/scripts/systemd/nut-driver@.service.in b/scripts/systemd/nut-driver@.service.in deleted file mode 100644 index 3f1d028..0000000 --- a/scripts/systemd/nut-driver@.service.in +++ /dev/null @@ -1,67 +0,0 @@ -[Unit] -Description=Network UPS Tools - device driver for %I -After=local-fs.target - -# Note: If the "Before" line below is uncommented, the target unit -# would only become initialized after the driver units are all in -# a final state (active, failed, ...) and would allow nut-server -# (upsd) to start up and represent those devices on the network. -# With this constraint commented away, the nut-server should start -# earlier, but may initially report some devices as Not connected -# (they should appear when drivers complete their initialization - -# e.g. snmp walks of large MIBs can take a while): -#Before=nut-driver.target - -# Propagate stopping of the target: -PartOf=nut-driver.target - -# Note: The choice of "network.target" allows to schedule this unit -# roughly when the network stack of this OS is ready (e.g. that the -# subsequent `upsd` will have a `0.0.0.0` or a `localhost` to bind -# to); however this target does not ensure availability of a real -# connection or final IP addresses. Drivers that require network as -# a media for interaction with UPSes (snmp-ups, netxml-ups, ipmi etc.) -# may want to extend this unit with `Requires=network-online.target` -# instead. Also note that *generally* this should not be a problem, -# since the drivers have a few retries with timeouts during startup, -# and typically by the time the box gets an IP address, the driver -# is still retrying to start and will succeed. -# Extending the unit does not require *this* file to be edited, you -# can instead drop in an additional piece of configuration, e.g. add -# a `/etc/systemd/system/nut-driver@.service.d/network.conf` with: -# [Unit] -# Requires=network-online.target -# After=network-online.target -# If your `upsd` requires specific IP addresses to be available before -# starting, a `/etc/systemd/system/nut-driver.target.d/network.conf` -# can be used in a similar manner. -# Finally note that "nut-driver-enumerator.service" should take care of this. - -[Service] -EnvironmentFile=-@CONFPATH@/nut.conf -SyslogIdentifier=%N -ExecStart=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl start "$NUTDEV"' -ExecStop=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl stop "$NUTDEV"' -# Restart really always, do not stop trying: -StartLimitInterval=0 -Restart=always -# Protract the "hold-off" interval, so if the device connection is -# lost, the driver does not reapidly restart and fail too many times, -# and then systemd would keep the unit failed without further retries. -# Notably, this helps start "dummy-ups" drivers retranslating local -# devices (so getting a chicken-and-egg problem for driver-upsd-driver -# orderly series of initializations). More details in NUT issue #779. -RestartSec=15s -Type=forking -# Note: If you customize the "maxstartdelay" in ups.conf or in your -# NUT compilation defaults, so it exceeds the default systemd unit -# startup timeout (typically 90 sec), then make sure to set a slightly -# longer systemd timeout for the nut-driver unit instances. You can -# do this by populating a drop-in configuration, so it is not later -# overwritten by updates to your NUT package -- create a dir+file: -# /etc/systemd/system/nut-driver@.service.d/timeout.conf with lines: -# [Service] -# TimeoutStartSec=190s - -[Install] -WantedBy=nut-driver.target diff --git a/scripts/systemd/nut-monitor.service.in b/scripts/systemd/nut-monitor.service.in index 4ee216e..8429bf2 100644 --- a/scripts/systemd/nut-monitor.service.in +++ b/scripts/systemd/nut-monitor.service.in @@ -1,26 +1,11 @@ [Unit] Description=Network UPS Tools - power device monitor and shutdown controller After=local-fs.target network.target nut-server.service -# Note: We do not specify Requires nut-server.service because -# the `upsd` daemon(s) may be running on a different machine -# (connected to the UPSes) than the `upsmon` shutdown protector. -# The "Wants" directive would try to start the nut-server but -# would not abort if that attempt fails for whatever reason. -Wants=nut-server.service -# Extending the unit does not require *this* file to be edited, you -# can instead drop in an additional piece of configuration, e.g. add -# a `/etc/systemd/system/nut-monitor.service.d/network.conf` with: -# [Unit] -# Requires=network-online.target -# After=network-online.target -PartOf=nut.target [Service] -EnvironmentFile=-@CONFPATH@/nut.conf -SyslogIdentifier=%N -ExecStart=@SBINDIR@/upsmon -F -ExecReload=@SBINDIR@/upsmon -c reload +ExecStart=@SBINDIR@/upsmon PIDFile=@PIDPATH@/upsmon.pid +Type=forking [Install] -WantedBy=nut.target +WantedBy=multi-user.target diff --git a/scripts/systemd/nut-server.service.in b/scripts/systemd/nut-server.service.in index 713f5c4..edcaf10 100644 --- a/scripts/systemd/nut-server.service.in +++ b/scripts/systemd/nut-server.service.in @@ -1,29 +1,12 @@ [Unit] Description=Network UPS Tools - power devices information server -After=local-fs.target network.target nut-driver.target -# We don't Require drivers to be successfully started! This would be -# a change of behavior compared to init SysV, and could prevent from -# accessing successfully started, at least to audit a system. -Wants=nut-driver.target -# The `upsd` is a networked service (even if bound to a `localhost`) -# so it requires that the OS has some notion of networking already. -# Extending the unit does not require *this* file to be edited, you -# can instead drop in an additional piece of configuration, e.g. add -# a `/etc/systemd/system/nut-server.service.d/network.conf` with: -# [Unit] -# Requires=network-online.target -# After=network-online.target -Requires=network.target +After=local-fs.target network.target nut-driver.service +Requires=nut-driver.service Before=nut-monitor.service -PartOf=nut.target [Service] -EnvironmentFile=-@CONFPATH@/nut.conf -SyslogIdentifier=%N -# Note: foreground mode by default skips writing a PID file (and -# needs Type=simple); can use "-FF" here to create one anyway: -ExecStart=@SBINDIR@/upsd -F -ExecReload=@SBINDIR@/upsd -c reload -P $MAINPID +ExecStart=@SBINDIR@/upsd +Type=forking [Install] -WantedBy=nut.target +WantedBy=multi-user.target diff --git a/scripts/systemd/nut.target b/scripts/systemd/nut.target deleted file mode 100644 index f744d29..0000000 --- a/scripts/systemd/nut.target +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Network UPS Tools - target for power device drivers, data server and monitoring client (if enabled) on this system -After=local-fs.target nut-driver.target nut-server.service nut-monitor.service -Wants=local-fs.target nut-driver.target nut-server.service nut-monitor.service -# network.target - -[Install] -WantedBy=multi-user.target diff --git a/scripts/systemd/nutshutdown.in b/scripts/systemd/nutshutdown.in old mode 100755 new mode 100644 index ace2485..2caac4b --- a/scripts/systemd/nutshutdown.in +++ b/scripts/systemd/nutshutdown.in @@ -1,23 +1,2 @@ #!/bin/sh - -# This script requires both nut-server (drivers) -# and nut-client (upsmon) to be present locally -# and on mounted filesystems -[ -x "@SBINDIR@/upsmon" ] && [ -x "@SBINDIR@/upsdrvctl" ] || exit - -if @SBINDIR@/upsmon -K >/dev/null 2>&1; then - # The argument may be anything compatible with sleep - # (not necessarily a non-negative integer) - wait_delay="`/bin/sed -ne 's#^ *POWEROFF_WAIT= *\(.*\)$#\1#p' @CONFPATH@/nut.conf`" || wait_delay="" - - @SBINDIR@/upsdrvctl shutdown - - if [ -n "$wait_delay" ] ; then - /bin/sleep $wait_delay - # We need to pass --force twice here to bypass systemd and execute the - # reboot directly ourself. - /bin/systemctl reboot --force --force - fi -fi - -exit 0 +@SBINDIR@/upsmon -K >/dev/null 2>&1 && @driverexecdir@/upsdrvctl shutdown diff --git a/scripts/udev/Makefile.am b/scripts/udev/Makefile.am index 5d299a7..fcd6eeb 100644 --- a/scripts/udev/Makefile.am +++ b/scripts/udev/Makefile.am @@ -3,7 +3,7 @@ if WITH_UDEV udevrulesdir = $(udevdir)/rules.d udevrules_DATA = if WITH_USB - udevrules_DATA += 62-nut-usbups.rules + udevrules_DATA += 52-nut-usbups.rules endif if WITH_IPMI udevrules_DATA += 52-nut-ipmipsu.rules @@ -12,23 +12,13 @@ endif EXTRA_DIST = README -62-nut-usbups.rules: nut-usbups.rules - cp nut-usbups.rules $@ +52-nut-usbups.rules: nut-usbups.rules + cp nut-usbups.rules 52-nut-usbups.rules 52-nut-ipmipsu.rules: nut-ipmipsu.rules - cp nut-ipmipsu.rules $@ + cp nut-ipmipsu.rules 52-nut-ipmipsu.rules -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# Generated by configure script: DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules - -CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules - +CLEANFILES = 52-nut-usbups.rules 52-nut-ipmipsu.rules # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = nut-usbups.rules.in - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES += nut-usbups.rules.in nut-usbups.rules.in.AUTOGEN_WITHOUT diff --git a/scripts/udev/Makefile.in b/scripts/udev/Makefile.in index 70061d2..6e6aa5c 100644 --- a/scripts/udev/Makefile.in +++ b/scripts/udev/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,61 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -89,27 +52,23 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@WITH_UDEV_TRUE@@WITH_USB_TRUE@am__append_1 = 62-nut-usbups.rules +@WITH_UDEV_TRUE@@WITH_USB_TRUE@am__append_1 = 52-nut-usbups.rules @WITH_IPMI_TRUE@@WITH_UDEV_TRUE@am__append_2 = 52-nut-ipmipsu.rules subdir = scripts/udev +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/nut-ipmipsu.rules.in $(srcdir)/nut-usbups.rules.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -118,33 +77,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = nut-ipmipsu.rules nut-usbups.rules CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ @@ -181,18 +123,13 @@ am__uninstall_files_from_dir = { \ } am__installdirs = "$(DESTDIR)$(udevrulesdir)" DATA = $(udevrules_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut-ipmipsu.rules.in \ - $(srcdir)/nut-usbups.rules.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -203,7 +140,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -217,7 +153,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -230,8 +165,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -241,15 +179,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -260,29 +197,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -302,9 +231,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -313,16 +239,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -336,7 +258,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -347,12 +268,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -371,21 +288,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -398,19 +312,8 @@ udevdir = @udevdir@ @WITH_UDEV_TRUE@udevrulesdir = $(udevdir)/rules.d @WITH_UDEV_TRUE@udevrules_DATA = $(am__append_1) $(am__append_2) EXTRA_DIST = README - -# we should never remove this one, apart from a distclean-check -#MAINTAINERCLEANFILES = nut-usbups.rules.in - -# Generated by autogen.sh and needed to run the configure script -# (technically, generated by tools/nut-usbinfo.pl script among -# GENERATED_USB_OS_FILES): -MAINTAINERCLEANFILES = Makefile.in .dirstamp nut-usbups.rules.in \ - nut-usbups.rules.in.AUTOGEN_WITHOUT - -# Generated by configure script: DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules -CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules +CLEANFILES = 52-nut-usbups.rules 52-nut-ipmipsu.rules all: all-am .SUFFIXES: @@ -426,13 +329,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/udev/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/udev/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -474,17 +378,14 @@ uninstall-udevrulesDATA: @list='$(udevrules_DATA)'; test -n "$(udevrulesdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(udevrulesdir)'; $(am__uninstall_files_from_dir) -tags TAGS: +tags: TAGS +TAGS: -ctags CTAGS: - -cscope cscopelist: +ctags: CTAGS +CTAGS: -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -553,7 +454,6 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am @@ -623,26 +523,25 @@ uninstall-am: uninstall-udevrulesDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip install-udevrulesDATA installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ - uninstall-am uninstall-udevrulesDATA - -.PRECIOUS: Makefile + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + install-udevrulesDATA installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-udevrulesDATA -62-nut-usbups.rules: nut-usbups.rules - cp nut-usbups.rules $@ +52-nut-usbups.rules: nut-usbups.rules + cp nut-usbups.rules 52-nut-usbups.rules 52-nut-ipmipsu.rules: nut-ipmipsu.rules - cp nut-ipmipsu.rules $@ + cp nut-ipmipsu.rules 52-nut-ipmipsu.rules +# we should never remove this one, apart from a distclean-check +#MAINTAINERCLEANFILES = nut-usbups.rules.in # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/scripts/udev/README b/scripts/udev/README index ff6a1a0..a3b5567 100644 --- a/scripts/udev/README +++ b/scripts/udev/README @@ -1,6 +1,6 @@ Desc: Udev script for NUT USB and IPMI drivers File: scripts/udev/README -Date: 31 July 2014 +Date: 25 July 2011 Auth: Arnaud Quette This document introduces the Linux udev script for NUT USB @@ -32,7 +32,7 @@ Manual installation To install them manually, copy the rules file(s) to /etc/udev/rules.d (or /lib/udev/rules.d on newer systems) using the command(s): -$ cp -f nut-usbups.rules /etc/udev/rules.d/62-nut-usbups.rules +$ cp -f nut-usbups.rules /etc/udev/rules.d/52-nut-usbups.rules $ cp -f nut-ipmipsu.rules /etc/udev/rules.d/52-nut-ipmipsu.rules You will need to refresh the bus to avoid a reboot for these rules to be diff --git a/scripts/udev/nut-usbups.rules.in b/scripts/udev/nut-usbups.rules.in index e073853..d7285c8 100644 --- a/scripts/udev/nut-usbups.rules.in +++ b/scripts/udev/nut-usbups.rules.in @@ -1,12 +1,12 @@ # This file is generated and installed by the Network UPS Tools package. -ACTION=="remove", GOTO="nut-usbups_rules_end" +ACTION!="add|change", GOTO="nut-usbups_rules_end" SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real" SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real" -GOTO="nut-usbups_rules_end" +SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end" LABEL="nut-usbups_rules_real" -# SNR-UPS-LID-XXXX UPSes - nutdrv_qx +# Krauler UP-M500VA - blazer_usb ATTR{idVendor}=="0001", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" # Hewlett Packard @@ -51,16 +51,6 @@ ATTR{idVendor}=="0463", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROU # various models - usbhid-ups ATTR{idVendor}=="047c", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" -# ST Microelectronics -# TS Shara UPSes; vendor ID 0x0483 is from ST Microelectronics - with product IDs delegated to different OEMs - nutdrv_qx -ATTR{idVendor}=="0483", ATTR{idProduct}=="0035", MODE="664", GROUP="@RUN_AS_GROUP@" -# USB IDs device table - usbhid-ups -ATTR{idVendor}=="0483", ATTR{idProduct}=="a113", MODE="664", GROUP="@RUN_AS_GROUP@" - -# IBM -# 6000 VA LCD 4U Rack UPS; 5396-1Kx - usbhid-ups -ATTR{idVendor}=="04b3", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@" - # Riello (Cypress Semiconductor Corp.) # various models - riello_usb ATTR{idVendor}=="04b4", ATTR{idProduct}=="5500", MODE="664", GROUP="@RUN_AS_GROUP@" @@ -68,8 +58,6 @@ ATTR{idVendor}=="04b4", ATTR{idProduct}=="5500", MODE="664", GROUP="@RUN_AS_GROU # Minibox # openUPS Intelligent UPS (minimum required firmware 1.4) - usbhid-ups ATTR{idVendor}=="04d8", ATTR{idProduct}=="d004", MODE="664", GROUP="@RUN_AS_GROUP@" -# openUPS Intelligent UPS (minimum required firmware 1.4) - usbhid-ups -ATTR{idVendor}=="04d8", ATTR{idProduct}=="d005", MODE="664", GROUP="@RUN_AS_GROUP@" # Belkin # F6H375-USB - usbhid-ups @@ -88,14 +76,10 @@ ATTR{idVendor}=="050d", ATTR{idProduct}=="0910", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="050d", ATTR{idProduct}=="0912", MODE="664", GROUP="@RUN_AS_GROUP@" # F6C800-UNV - usbhid-ups ATTR{idVendor}=="050d", ATTR{idProduct}=="0980", MODE="664", GROUP="@RUN_AS_GROUP@" -# Regulator PRO-USB - usbhid-ups -ATTR{idVendor}=="050d", ATTR{idProduct}=="0f51", MODE="664", GROUP="@RUN_AS_GROUP@" # F6C1100-UNV, F6C1200-UNV - usbhid-ups ATTR{idVendor}=="050d", ATTR{idProduct}=="1100", MODE="664", GROUP="@RUN_AS_GROUP@" # APC -# APC AP9584 Serial->USB kit - usbhid-ups -ATTR{idVendor}=="051d", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" # various models - usbhid-ups ATTR{idVendor}=="051d", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" # various 5G models - usbhid-ups @@ -106,31 +90,25 @@ ATTR{idVendor}=="051d", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="0592", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" # PW 9140 - usbhid-ups ATTR{idVendor}=="0592", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@" -# Agiler UPS - nutdrv_qx +# Agiler UPS - blazer_usb ATTR{idVendor}=="05b8", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Delta UPS -# Delta UPS Amplon R Series, Single Phase UPS, 1/2/3 kVA - usbhid-ups -ATTR{idVendor}=="05dd", ATTR{idProduct}=="041b", MODE="664", GROUP="@RUN_AS_GROUP@" -# Delta/Minuteman Enterprise Plus E1500RM2U - usbhid-ups -ATTR{idVendor}=="05dd", ATTR{idProduct}=="a011", MODE="664", GROUP="@RUN_AS_GROUP@" -# Belkin F6C1200-UNV/Voltronic Power UPSes - nutdrv_qx +# Belkin F6C1200-UNV - blazer_usb ATTR{idVendor}=="0665", ATTR{idProduct}=="5161", MODE="664", GROUP="@RUN_AS_GROUP@" # Phoenixtec Power Co., Ltd -# Online Yunto YQ450 - nutdrv_qx +# Online Yunto YQ450 - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" -# Mustek Powermust - nutdrv_qx +# Mustek Powermust - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0003", MODE="664", GROUP="@RUN_AS_GROUP@" -# Phoenixtec Innova 3/1 T - nutdrv_qx +# Phoenixtec Innova 3/1 T - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@" -# Phoenixtec Innova RT - nutdrv_qx +# Phoenixtec Innova RT - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@" -# Phoenixtec Innova T - nutdrv_qx +# Phoenixtec Innova T - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0201", MODE="664", GROUP="@RUN_AS_GROUP@" -# Online Zinto A - nutdrv_qx +# Online Zinto A - blazer_usb ATTR{idVendor}=="06da", ATTR{idProduct}=="0601", MODE="664", GROUP="@RUN_AS_GROUP@" -# PROTECT B / NAS - usbhid-ups +# various models - usbhid-ups ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" # iDowell @@ -138,9 +116,9 @@ ATTR{idVendor}=="06da", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="075d", ATTR{idProduct}=="0300", MODE="664", GROUP="@RUN_AS_GROUP@" # Cyber Power Systems -# 900AVR/BC900D - usbhid-ups +# 900AVR/BC900D, CP1200AVR/BC1200D - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0005", MODE="664", GROUP="@RUN_AS_GROUP@" -# Dynex DX-800U?, CP1200AVR/BC1200D, CP825AVR-G, CP1000AVRLCD, CP1000PFCLCD, CP1500C, CP550HG, etc. - usbhid-ups +# Dynex DX-800U? - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0501", MODE="664", GROUP="@RUN_AS_GROUP@" # OR2200LCDRM2U, OR700LCDRM1U, PR6000LCDRTXL5U - usbhid-ups ATTR{idVendor}=="0764", ATTR{idProduct}=="0601", MODE="664", GROUP="@RUN_AS_GROUP@" @@ -160,8 +138,6 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="1008", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="09ae", ATTR{idProduct}=="1009", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite ECO550UPS - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="1010", MODE="664", GROUP="@RUN_AS_GROUP@" -# e.g. TrippLite SU3000LCD2UHV - usbhid-ups -ATTR{idVendor}=="09ae", ATTR{idProduct}=="1330", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite OMNI1000LCD - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="2005", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite OMNI900LCD - usbhid-ups @@ -198,8 +174,6 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="3014", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="09ae", ATTR{idProduct}=="3015", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite Smart1500LCD (newer unit) - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="3016", MODE="664", GROUP="@RUN_AS_GROUP@" -# e.g. TrippLite AVR750U (newer unit) - usbhid-ups -ATTR{idVendor}=="09ae", ATTR{idProduct}=="3024", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite SmartOnline SU1500RTXL2UA (older unit?) - usbhid-ups ATTR{idVendor}=="09ae", ATTR{idProduct}=="4001", MODE="664", GROUP="@RUN_AS_GROUP@" # e.g. TrippLite SmartOnline SU6000RT4U? - usbhid-ups @@ -219,8 +193,6 @@ ATTR{idVendor}=="09ae", ATTR{idProduct}=="4008", MODE="664", GROUP="@RUN_AS_GROU # PowerCOM # PowerCOM Vanguard and BNT-xxxAP - usbhid-ups -ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@" -# PowerCOM Vanguard and BNT-xxxAP - usbhid-ups ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@" # PowerCOM IMP - IMPERIAL Series - usbhid-ups ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a2", MODE="664", GROUP="@RUN_AS_GROUP@" @@ -232,67 +204,15 @@ ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a4", MODE="664", GROUP="@RUN_AS_GROU ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a5", MODE="664", GROUP="@RUN_AS_GROUP@" # PowerCOM BNT - Black Knight Pro - usbhid-ups ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a6", MODE="664", GROUP="@RUN_AS_GROUP@" -# Unitek Alpha 1200Sx - nutdrv_qx +# Unitek Alpha 1200Sx - blazer_usb ATTR{idVendor}=="0f03", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@" # Liebert # Liebert PowerSure PSA UPS - usbhid-ups ATTR{idVendor}=="10af", ATTR{idProduct}=="0001", MODE="664", GROUP="@RUN_AS_GROUP@" -# Liebert PowerSure PSI 1440 - usbhid-ups -ATTR{idVendor}=="10af", ATTR{idProduct}=="0004", MODE="664", GROUP="@RUN_AS_GROUP@" -# Liebert GXT3 - usbhid-ups -ATTR{idVendor}=="10af", ATTR{idProduct}=="0008", MODE="664", GROUP="@RUN_AS_GROUP@" -# GE EP series - nutdrv_qx +# GE EP series - blazer_usb ATTR{idVendor}=="14f0", ATTR{idProduct}=="00c9", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Legrand -# Legrand Keor SP - usbhid-ups -ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0032", MODE="664", GROUP="@RUN_AS_GROUP@" -# Legrand Daker DK / DK Plus - nutdrv_qx -ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0035", MODE="664", GROUP="@RUN_AS_GROUP@" -# Legrand Keor PDU - usbhid-ups -ATTR{idVendor}=="1cb0", ATTR{idProduct}=="0038", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2341", ATTR{idProduct}=="0036", MODE="664", GROUP="@RUN_AS_GROUP@" -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2341", ATTR{idProduct}=="8036", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Arduino -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2A03", ATTR{idProduct}=="0036", MODE="664", GROUP="@RUN_AS_GROUP@" -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2A03", ATTR{idProduct}=="0040", MODE="664", GROUP="@RUN_AS_GROUP@" -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2A03", ATTR{idProduct}=="8036", MODE="664", GROUP="@RUN_AS_GROUP@" -# Arduino Leonardo, Leonardo ETH and Pro Micro - usbhid-ups -ATTR{idVendor}=="2A03", ATTR{idProduct}=="8040", MODE="664", GROUP="@RUN_AS_GROUP@" - -# AEG -# PROTECT B / NAS - usbhid-ups -ATTR{idVendor}=="2b2d", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Ever -# USB IDs device table - usbhid-ups -ATTR{idVendor}=="2e51", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" -# USB IDs device table - usbhid-ups -ATTR{idVendor}=="2e51", ATTR{idProduct}=="ffff", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Salicru -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -ATTR{idVendor}=="2e66", ATTR{idProduct}=="0201", MODE="664", GROUP="@RUN_AS_GROUP@" -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -ATTR{idVendor}=="2e66", ATTR{idProduct}=="0202", MODE="664", GROUP="@RUN_AS_GROUP@" -# SLC TWIN PRO2<=3KVA per https://github.com/networkupstools/nut/issues/450 - usbhid-ups -ATTR{idVendor}=="2e66", ATTR{idProduct}=="0203", MODE="664", GROUP="@RUN_AS_GROUP@" -# https://www.salicru.com/sps-home.html - usbhid-ups -ATTR{idVendor}=="2e66", ATTR{idProduct}=="0300", MODE="664", GROUP="@RUN_AS_GROUP@" - -# Powervar -# Powervar - usbhid-ups -ATTR{idVendor}=="4234", ATTR{idProduct}=="0002", MODE="664", GROUP="@RUN_AS_GROUP@" -# Ablerex 625L USB (Note: earlier best-fit was "krauler_subdriver" before PR #1135) - nutdrv_qx +# Ablerex 625L USB - blazer_usb ATTR{idVendor}=="ffff", ATTR{idProduct}=="0000", MODE="664", GROUP="@RUN_AS_GROUP@" LABEL="nut-usbups_rules_end" diff --git a/scripts/ufw/Makefile.am b/scripts/ufw/Makefile.am deleted file mode 100644 index dc72ff3..0000000 --- a/scripts/ufw/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *-spellchecked diff --git a/scripts/ufw/Makefile.in b/scripts/ufw/Makefile.in deleted file mode 100644 index 039dbc9..0000000 --- a/scripts/ufw/Makefile.in +++ /dev/null @@ -1,569 +0,0 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -subdir = scripts/ufw -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nut_arg_with.m4 \ - $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ - $(top_srcdir)/m4/nut_check_libavahi.m4 \ - $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ - $(top_srcdir)/m4/nut_check_libgd.m4 \ - $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ - $(top_srcdir)/m4/nut_check_libneon.m4 \ - $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ - $(top_srcdir)/m4/nut_check_libnss.m4 \ - $(top_srcdir)/m4/nut_check_libopenssl.m4 \ - $(top_srcdir)/m4/nut_check_libpowerman.m4 \ - $(top_srcdir)/m4/nut_check_libusb.m4 \ - $(top_srcdir)/m4/nut_check_libwrap.m4 \ - $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ - $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ - $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nut.ufw.profile -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/nut.ufw.profile.in \ - README -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -A2X = @A2X@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -ASCIIDOC = @ASCIIDOC@ -ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BINDIR = @BINDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFPATH = @CONFPATH@ -CPP = @CPP@ -CPPCHECK = @CPPCHECK@ -CPPFLAGS = @CPPFLAGS@ -CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ -CPPUNIT_LIBS = @CPPUNIT_LIBS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBLATEX = @DBLATEX@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ -DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ -DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ -DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ -DRVPATH = @DRVPATH@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ -LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ -LIBGD_CFLAGS = @LIBGD_CFLAGS@ -LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ -LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ -LIBIPMI_LIBS = @LIBIPMI_LIBS@ -LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ -LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ -LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LIBS = @LIBNEON_LIBS@ -LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ -LIBS = @LIBS@ -LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ -LIBUSB_LIBS = @LIBUSB_LIBS@ -LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LIBS = @LIBWRAP_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LN_S_R = @LN_S_R@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ -NUT_NETVERSION = @NUT_NETVERSION@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OS_NAME = @OS_NAME@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIDPATH = @PIDPATH@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ -RANLIB = @RANLIB@ -RUN_AS_GROUP = @RUN_AS_GROUP@ -RUN_AS_USER = @RUN_AS_USER@ -SBINDIR = @SBINDIR@ -SED = @SED@ -SERLIBS = @SERLIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ -STATEPATH = @STATEPATH@ -STRIP = @STRIP@ -SUN_LIBUSB = @SUN_LIBUSB@ -TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -auglensdir = @auglensdir@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cgiexecdir = @cgiexecdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -devddir = @devddir@ -docdir = @docdir@ -driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -hotplugdir = @hotplugdir@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -now = @now@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgconfigdir = @pkgconfigdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ -systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -udevdir = @udevdir@ -MAINTAINERCLEANFILES = Makefile.in .dirstamp -CLEANFILES = *-spellchecked -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/ufw/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu scripts/ufw/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -nut.ufw.profile: $(top_builddir)/config.status $(srcdir)/nut.ufw.profile.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/scripts/upower/95-upower-hid.rules b/scripts/upower/95-upower-hid.rules index c6e2d06..8af6415 100644 --- a/scripts/upower/95-upower-hid.rules +++ b/scripts/upower/95-upower-hid.rules @@ -1,2 +1,127 @@ -# Copy some attributes from the USB device to the hiddev device -SUBSYSTEM=="usbmisc", SUBSYSTEMS=="usb", KERNEL=="hiddev*", IMPORT{parent}="UPOWER_*", IMPORT{parent}="ID_VENDOR", IMPORT{parent}="ID_PRODUCT" +############################################################################################################## +# Uninterruptible Power Supplies with USB HID interfaces +# +# to keep up to date, monitor: http://svn.debian.org/wsvn/nut/trunk/scripts/upower/95-upower-hid.rules + +# only support USB, else ignore +SUBSYSTEM!="usb", GOTO="up_hid_end" + +# if usbraw device, ignore +KERNEL!="hiddev*", GOTO="up_hid_end" + +# if an interface, ignore +ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end" + +ATTRS{idVendor}=="03f0", ENV{UPOWER_VENDOR}="Hewlett Packard" +ATTRS{idVendor}=="0463", ENV{UPOWER_VENDOR}="Eaton" +ATTRS{idVendor}=="047c", ENV{UPOWER_VENDOR}="Dell" +ATTRS{idVendor}=="04d8", ENV{UPOWER_VENDOR}="Minibox" +ATTRS{idVendor}=="050d", ENV{UPOWER_VENDOR}="Belkin" +ATTRS{idVendor}=="051d", ENV{UPOWER_VENDOR}="APC" +ATTRS{idVendor}=="0592", ENV{UPOWER_VENDOR}="Powerware" +ATTRS{idVendor}=="06da", ENV{UPOWER_VENDOR}="Phoenixtec Power Co., Ltd" +ATTRS{idVendor}=="075d", ENV{UPOWER_VENDOR}="iDowell" +ATTRS{idVendor}=="0764", ENV{UPOWER_VENDOR}="Cyber Power Systems" +ATTRS{idVendor}=="09ae", ENV{UPOWER_VENDOR}="TrippLite" +ATTRS{idVendor}=="0d9f", ENV{UPOWER_VENDOR}="PowerCOM" +ATTRS{idVendor}=="10af", ENV{UPOWER_VENDOR}="Liebert" + +# Hewlett Packard +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f06", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f08", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f09", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1f0a", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe0", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe1", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe2", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe3", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe5", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe6", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe7", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="1fe8", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Eaton +ATTRS{idVendor}=="0463", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0463", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Dell +ATTRS{idVendor}=="047c", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Minibox +ATTRS{idVendor}=="04d8", ATTRS{idProduct}=="d004", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Belkin +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0375", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0551", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0750", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0751", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0900", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0910", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0912", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="0980", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="050d", ATTRS{idProduct}=="1100", ENV{UPOWER_BATTERY_TYPE}="ups" + +# APC +ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0002", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="051d", ATTRS{idProduct}=="0003", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Powerware +ATTRS{idVendor}=="0592", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Phoenixtec Power Co., Ltd +ATTRS{idVendor}=="06da", ATTRS{idProduct}=="ffff", ENV{UPOWER_BATTERY_TYPE}="ups" + +# iDowell +ATTRS{idVendor}=="075d", ATTRS{idProduct}=="0300", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Cyber Power Systems +ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0005", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0501", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0764", ATTRS{idProduct}=="0601", ENV{UPOWER_BATTERY_TYPE}="ups" + +# TrippLite +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1003", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1007", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1008", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1009", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="1010", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2005", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2007", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2008", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2009", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2010", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2011", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2012", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2013", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="2014", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3008", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3009", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3010", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3011", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3012", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3013", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3014", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3015", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="3016", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4001", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4002", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4003", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4004", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4005", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4006", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4007", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="09ae", ATTRS{idProduct}=="4008", ENV{UPOWER_BATTERY_TYPE}="ups" + +# PowerCOM +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="0004", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a2", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a3", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a4", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a5", ENV{UPOWER_BATTERY_TYPE}="ups" +ATTRS{idVendor}=="0d9f", ATTRS{idProduct}=="00a6", ENV{UPOWER_BATTERY_TYPE}="ups" + +# Liebert +ATTRS{idVendor}=="10af", ATTRS{idProduct}=="0001", ENV{UPOWER_BATTERY_TYPE}="ups" + +LABEL="up_hid_end" diff --git a/scripts/upsdrvsvcctl/Makefile.am b/scripts/upsdrvsvcctl/Makefile.am deleted file mode 100644 index 77313ca..0000000 --- a/scripts/upsdrvsvcctl/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -EXTRA_DIST = README - -if HAVE_SYSTEMD -EXTRA_DIST += nut-driver-enumerator.sh upsdrvsvcctl -else -if WITH_SOLARIS_SMF -EXTRA_DIST += nut-driver-enumerator.sh upsdrvsvcctl -endif -endif - -EXTRA_DIST += nut-driver-enumerator.sh.in upsdrvsvcctl.in - -MAINTAINERCLEANFILES = Makefile.in .dirstamp diff --git a/scripts/upsdrvsvcctl/Makefile.in b/scripts/upsdrvsvcctl/Makefile.in deleted file mode 100644 index 860002a..0000000 --- a/scripts/upsdrvsvcctl/Makefile.in +++ /dev/null @@ -1,574 +0,0 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@HAVE_SYSTEMD_TRUE@am__append_1 = nut-driver-enumerator.sh upsdrvsvcctl -@HAVE_SYSTEMD_FALSE@@WITH_SOLARIS_SMF_TRUE@am__append_2 = nut-driver-enumerator.sh upsdrvsvcctl -subdir = scripts/upsdrvsvcctl -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nut_arg_with.m4 \ - $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ - $(top_srcdir)/m4/nut_check_libavahi.m4 \ - $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ - $(top_srcdir)/m4/nut_check_libgd.m4 \ - $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ - $(top_srcdir)/m4/nut_check_libneon.m4 \ - $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ - $(top_srcdir)/m4/nut_check_libnss.m4 \ - $(top_srcdir)/m4/nut_check_libopenssl.m4 \ - $(top_srcdir)/m4/nut_check_libpowerman.m4 \ - $(top_srcdir)/m4/nut_check_libusb.m4 \ - $(top_srcdir)/m4/nut_check_libwrap.m4 \ - $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ - $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ - $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = nut-driver-enumerator.sh upsdrvsvcctl -CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -SOURCES = -DIST_SOURCES = -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/nut-driver-enumerator.sh.in \ - $(srcdir)/upsdrvsvcctl.in README -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -A2X = @A2X@ -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -ASCIIDOC = @ASCIIDOC@ -ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BINDIR = @BINDIR@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CONFPATH = @CONFPATH@ -CPP = @CPP@ -CPPCHECK = @CPPCHECK@ -CPPFLAGS = @CPPFLAGS@ -CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ -CPPUNIT_LIBS = @CPPUNIT_LIBS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBLATEX = @DBLATEX@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ -DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ -DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ -DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ -DRVPATH = @DRVPATH@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ -LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ -LIBGD_CFLAGS = @LIBGD_CFLAGS@ -LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ -LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ -LIBIPMI_LIBS = @LIBIPMI_LIBS@ -LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ -LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ -LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ -LIBNEON_LIBS = @LIBNEON_LIBS@ -LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ -LIBNETSNMP_LIBS = @LIBNETSNMP_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBPOWERMAN_CFLAGS = @LIBPOWERMAN_CFLAGS@ -LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ -LIBS = @LIBS@ -LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ -LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ -LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ -LIBUSB_LIBS = @LIBUSB_LIBS@ -LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ -LIBWRAP_LIBS = @LIBWRAP_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LN_S_R = @LN_S_R@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ -NUT_NETVERSION = @NUT_NETVERSION@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OS_NAME = @OS_NAME@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIDPATH = @PIDPATH@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ -RANLIB = @RANLIB@ -RUN_AS_GROUP = @RUN_AS_GROUP@ -RUN_AS_USER = @RUN_AS_USER@ -SBINDIR = @SBINDIR@ -SED = @SED@ -SERLIBS = @SERLIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ -STATEPATH = @STATEPATH@ -STRIP = @STRIP@ -SUN_LIBUSB = @SUN_LIBUSB@ -TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -auglensdir = @auglensdir@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -cgiexecdir = @cgiexecdir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -devddir = @devddir@ -docdir = @docdir@ -driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -hotplugdir = @hotplugdir@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -now = @now@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -pkgconfigdir = @pkgconfigdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ -systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -udevdir = @udevdir@ -EXTRA_DIST = README $(am__append_1) $(am__append_2) \ - nut-driver-enumerator.sh.in upsdrvsvcctl.in -MAINTAINERCLEANFILES = Makefile.in .dirstamp -all: all-am - -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/upsdrvsvcctl/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu scripts/upsdrvsvcctl/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -nut-driver-enumerator.sh: $(top_builddir)/config.status $(srcdir)/nut-driver-enumerator.sh.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -upsdrvsvcctl: $(top_builddir)/config.status $(srcdir)/upsdrvsvcctl.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -tags TAGS: - -ctags CTAGS: - -cscope cscopelist: - - -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: check-am -all-am: Makefile -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-am - -clean-am: clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f Makefile -distclean-am: clean-am distclean-generic - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-generic mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: install-am install-strip - -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - cscopelist-am ctags-am distclean distclean-generic \ - distclean-libtool distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags-am uninstall uninstall-am - -.PRECIOUS: Makefile - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/scripts/upsdrvsvcctl/README b/scripts/upsdrvsvcctl/README deleted file mode 100644 index b2a9db6..0000000 --- a/scripts/upsdrvsvcctl/README +++ /dev/null @@ -1,11 +0,0 @@ -This directory contains the shared NUT support files for Linux systemd (the -System and Service Manager) and Solaris SMF (Service Management Framework). -It includes the nut-driver-enumerator.sh (service and implementation method) -and upsdrvsvcctl (tool) to manage NUT drivers as service instances. - -These files are automatically installed into SBINDIR/upsdrvsvcctl and -LIBEXECDIR/nut-driver-enumerator.sh, upon detection (at configure time) -of a systemd or SMF enabled system, with Makefiles of the ../systemd/ and -../Solaris/ source directories respectively. - -Contributed 2016-2018 by Jim Klimov diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh deleted file mode 100755 index cce714c..0000000 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh +++ /dev/null @@ -1,1391 +0,0 @@ -#!/bin/sh -# -# NOTE: This script is intentionally written with portable shell constructs -# with the aim and hope to work in different interpreters, so it is a -# bit dumber and less efficient than could be achieved with the more -# featured shells in the spectrum. -# NOTE ALSO: The configuration parser in this script is not meant to be a -# reference or 100% compliant with what the binary code uses; its aim -# is to just pick out some strings relevant for tracking config changes. -# -# Copyright (C) 2016-2020 Eaton -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#! \file nut-driver-enumerator.sh(.in) -# \author Jim Klimov -# \brief Enumerate NUT devices for service-unit instance configuration -# \details This script allows to enumerate UPSes in order to produce the -# individual service unit instances for each defined configuration. -# It assumes the user has adequate permissions to inspect and create -# services (e.g. is a root or has proper RBAC profiles to do so). -# It helps service frameworks such as Linux systemd and Solaris SMF. -# When executed, this script looks for all configured ups.conf -# sections and registered service instances, and makes these two -# lists match up. It has also a mode to do this in a loop, to keep -# checking for differences and applying them, on systems where it's -# problematic to trigger it in response to FS event notifications. -# Returns exit codes: -# 0 Sections and services already match up -# 42 Sections and services differed, but now match up - -# now the caller should likely restart some services. -# Note that the drivers' service instances were started or -# stopped as required (by AUTO_START=yes) - but maybe the -# upsd or upsmon services should restart. If you pass envvar -# REPORT_RESTART_42=no then this codepath would return 0. -# In default mode, such non-null reconfiguration should cause -# the nut-driver-enumerator service to restart and this would -# propagate to other NUT services that depend on it. -# 13 Sections and services differed, and still do not match up -# 1 Bad inputs, e.g. unrecognized service management framework -# 2 Absent or unreadable ups.conf file -# - -# NOTE: Currently found caveats that might be solved later but require -# considerable effort: -# * Solaris SMF constrains the syntax of valid strings for instance names -# (e.g. not starting with a digit, no period chars) which blocks creation -# of some UPS driver instances. This might be worked around by hashing -# the device name e.g. to base64 (and un-hashing instance name when calling -# upsdrvctl), but is not quite user-friendly. Also can store device name -# in a service attribute while mangling the instance name to a valid subset. -# Comparisons (if devices are already wrapped) becomes more complicated in -# the script in either case, as well as in the service startup method. -# ** The `+` `/` `=` characters from base64 are also invalid for SMF instance -# name, but the first two can be sed'ed to `-` `_` and back, for example. -# Some prefix word is also needed (avoid starting with a digit). -# The trailing padding `=` can be dropped, and added until we get a -# non-empty decode. Conversions can be done by -# `echo "$string" | openssl base64 -e|-d` -# * Dummy-UPS services that "proxy" another locally defined section are -# essentially a circular dependency for upsd. While the system might -# start-up lacking a driver, there should be some timer to re-enable -# failed not-disabled drivers (would be useful in any case though). - -# Directory where NUT configs are located, e.g. /etc/nut or /etc/ups -# Set at package configuration, compiled into daemons and drivers -prefix="/usr/local" -[ -n "${NUT_CONFPATH-}" ] || NUT_CONFPATH="${prefix}/etc" -# Technically this should be a distribution-dependent value configured -# during package build. But everyone has it the same from systemd defaults: -[ -n "${SYSTEMD_CONFPATH-}" ] || SYSTEMD_CONFPATH="/etc/systemd/system" - -if [ -n "$ZSH_VERSION" ]; then - ### Problem: loops like `for UPS in $UPSLIST` do not separate - ### the UPSLIST into many tokens but use it as one string. - echo "FATAL: zsh is not supported in this script" >&2 - exit 1 -# setopt noglob -# setopt +F -# IFS="`printf ' \t\r\n'`" ; export IFS -fi - -if set | egrep '^(shell|version|t?csh)' | egrep 't?csh' >/dev/null ; then - echo "FATAL: csh or tcsh is not supported in this script" >&2 - exit 1 -fi - -# Third-party services to depend on (can be overridden by config file) -### Note that for systemd+udev integration, it may be better to set up -### triggers in udev, see e.g. -### http://stackoverflow.com/questions/18463755/linux-start-daemon-on-connected-usb-serial-dongle -### Also can tune whether a driver "Wants" another service (would consider -### ordering if that one is enabled, but live if it is disabled), or if it -### "Requires" that (would cause that to start). -DEPSVC_USB_SYSTEMD="systemd-udev.service systemd-udev-settle.service" -DEPREQ_USB_SYSTEMD="Wants" -DEPSVC_NET_FULL_SYSTEMD="network-online.target systemd-resolved.service ifplugd.service" -DEPREQ_NET_FULL_SYSTEMD="Wants" -DEPSVC_NET_LOCAL_SYSTEMD="network.target" -DEPREQ_NET_LOCAL_SYSTEMD="Wants" -SVCNAME_SYSTEMD="nut-driver" - -# Some or all of these FMRIs may be related to dynamically changing hardware -# require_all) ;; # All cited services are running (online or degraded) -# require_any) ;; # At least one of the cited services is running -# optional_all) ;; # (All) cited services are running or would not run -# # without administrative action (disabled, maintenance, -# # not present, or are waiting for dependencies which do -# # not start without administrative action). -DEPSVC_USB_SMF="svc:/system/hotplug:default svc:/system/dbus:default svc:/system/hal:default svc:/milestone/devices:default" -DEPREQ_USB_SMF="optional_all" -# By default there are several physical network FMRIs shipped and at most -# only one is enabled on a particular system (e.g. :default or :nwam) -DEPSVC_NET_FULL_SMF="svc:/network/physical svc:/milestone/name-services" -DEPREQ_NET_FULL_SMF="optional_all" -DEPSVC_NET_LOCAL_SMF="svc:/network/loopback:default" -DEPREQ_NET_LOCAL_SMF="optional_all" -SVCNAME_SMF="svc:/system/power/nut-driver" - -[ -z "${NUT_DRIVER_ENUMERATOR_CONF-}" ] && \ - NUT_DRIVER_ENUMERATOR_CONF="${NUT_CONFPATH}/nut-driver-enumerator.conf" - -[ -s "${NUT_DRIVER_ENUMERATOR_CONF}" ] && \ - echo "Sourcing config file: ${NUT_DRIVER_ENUMERATOR_CONF}" && \ - . "${NUT_DRIVER_ENUMERATOR_CONF}" - -[ -z "${UPSCONF-}" ] && \ - UPSCONF="${NUT_CONFPATH}/ups.conf" - -# Start a freshly-registered unit? -[ -z "${AUTO_START-}" ] && AUTO_START=yes - -# We avoid regex '\t' which gets misinterpreted by some tools -TABCHAR="`printf '\t'`" || TABCHAR=' ' - -if [ -z "${SERVICE_FRAMEWORK-}" ] ; then - [ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && [ -x /usr/bin/svcprop ] && \ - SERVICE_FRAMEWORK="smf" - [ -z "${SERVICE_FRAMEWORK-}" ] && \ - [ -x /bin/systemctl ] && \ - SERVICE_FRAMEWORK="systemd" -fi - -# Optionally use Coreutils timeout to limit the -# (potentially hanging) calls to systemd tools... -# Should not hurt with SMF too, if it ever misbehaves. -if [ -z "${TIMEOUT_CMD+x}" ]; then - # Envvar not set at all (set but empty is okay, caller wants that then) - TIMEOUT_CMD="" - TIMEOUT_ARGS="" - if which timeout 2>/dev/null >/dev/null ; then - # Systemd default timeout for unit start/stop - TIMEOUT_CMD="timeout" - TIMEOUT_ARGS="90s" - fi -fi - -# Cache needed bits of ups.conf to speed up later parsing. Note that these -# data are needed for most operations, and populated by upslist_readFile() -UPSCONF_DATA="" -# Subset of normalized data above that only has sections, drivers and ports -UPSCONF_DATA_SDP="" - -# List of configured UPSes in the config-file -UPSLIST_FILE="" -# List of configured service instances for UPS drivers -UPSLIST_SVCS="" - -# Framework-specific implementations are generally hooked here: -hook_registerInstance="" -hook_unregisterInstance="" -hook_refreshSupervizor="" -hook_listInstances="" -hook_listInstances_raw="" -hook_validInstanceName="" -hook_validFullUnitName="" -hook_validInstanceSuffixName="" -hook_getSavedMD5="" -hook_setSavedMD5="" -hook_restart_upsd="" -hook_restart_drv="" - -case "${SERVICE_FRAMEWORK-}" in - smf) - hook_registerInstance="smf_registerInstance" - hook_unregisterInstance="smf_unregisterInstance" - hook_refreshSupervizor="smf_refreshSupervizor" - hook_listInstances="smf_listInstances" - hook_listInstances_raw="smf_listInstances_raw" - hook_validInstanceName="smf_validInstanceName" - hook_validFullUnitName="smf_validFullUnitName" - hook_validInstanceSuffixName="smf_validInstanceSuffixName" - hook_getSavedMD5="smf_getSavedMD5" - hook_setSavedMD5="smf_setSavedMD5" - hook_restart_upsd="smf_restart_upsd" - hook_restart_drv="smf_restart_drv" - ;; - systemd) - hook_registerInstance="systemd_registerInstance" - hook_unregisterInstance="systemd_unregisterInstance" - hook_refreshSupervizor="systemd_refreshSupervizor" - hook_listInstances="systemd_listInstances" - hook_listInstances_raw="systemd_listInstances_raw" - hook_validInstanceName="systemd_validInstanceName" - hook_validFullUnitName="systemd_validFullUnitName" - hook_validInstanceSuffixName="systemd_validInstanceSuffixName" - hook_getSavedMD5="systemd_getSavedMD5" - hook_setSavedMD5="systemd_setSavedMD5" - hook_restart_upsd="systemd_restart_upsd" - hook_restart_drv="systemd_restart_drv" - ;; - selftest) - hook_registerInstance="selftest_NOOP" - hook_unregisterInstance="selftest_NOOP" - hook_refreshSupervizor="selftest_NOOP" - hook_listInstances="selftest_NOOP" - hook_listInstances_raw="selftest_NOOP" - hook_validInstanceName="selftest_NOOP" - hook_validFullUnitName="selftest_NOOP" - hook_validInstanceSuffixName="selftest_NOOP" - hook_getSavedMD5="selftest_NOOP" - hook_setSavedMD5="selftest_NOOP" - hook_restart_upsd="selftest_NOOP" - hook_restart_drv="selftest_NOOP" - ;; - "") - echo "Error detecting the service-management framework on this OS" >&2 - exit 1 - ;; - *) - echo "Error: User provided an unknown service-management framework '$SERVICE_FRAMEWORK'" >&2 - exit 1 - ;; -esac - -selftest_NOOP() { - echo "NO-OP: Self-testing context does not do systems configuration" >&2 - return 0 -} - -common_isFiled() { - [ -n "$UPSLIST_FILE" ] && \ - for UPSF in $UPSLIST_FILE ; do - [ "$1" = "$UPSF" ] && return 0 - [ "`$hook_validInstanceName "$UPSF"`" = "$1" ] && return 0 - done - return 1 -} - -common_isRegistered() { - [ -n "$UPSLIST_SVCS" ] && \ - for UPSS in $UPSLIST_SVCS ; do - [ "$1" = "$UPSS" ] && return 0 - [ "`$hook_validInstanceName "$1"`" = "$UPSS" ] && return 0 - done - return 1 -} - -upslist_equals() { - # Compare pre-sorted list of DEVICES ($1) and SVCINSTs ($2) including - # the possible mangling for service names. Return 0 if lists describe - # exactly same set of devices and their services. - # Note: This logic only checks the names, not the contents of device - # sections, so re-definitions of an existing device configuration - # would not trigger a service restart by itself. Such deeper check - # belongs in a different routine, see upssvcconf_checksum_unchanged(). - - # Trivial case 0: one string is empty, another is not - # Note: `echo '' | wc -l` == "1" not "0"! - [ -n "$1" -a -z "$2" ] && return 1 - [ -z "$1" -a -n "$2" ] && return 1 - - # Trivial case 1: equal strings - [ "$1" = "$2" ] && return 0 - # Trivial case 2: different amount of entries - [ "`echo "$1" | wc -l`" = "`echo "$2" | wc -l`" ] || return $? - - _TMP_DEV_SVC="" - for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "$_DEV"`" - for _SVC in $2 ; do - [ "$_DEV" = "$_SVC" ] \ - || [ "$DEVINST" = "$_SVC" ] \ - && { [ -z "$_TMP_DEV_SVC" ] \ - && _TMP_DEV_SVC="$_DEV = $_SVC" \ - || _TMP_DEV_SVC="$_TMP_DEV_SVC -$_DEV = $_SVC" ; } - done - done - - # Input was not empty; did anything in output fit? - [ -z "$_TMP_DEV_SVC" ] && return 1 - - # Exit code : is the built mapping as long as the source list(s)? - [ "`echo "$1" | wc -l`" = "`echo "$_TMP_DEV_SVC" | wc -l`" ] -} - -upssvcconf_checksum_unchanged() { - # $1 = dev, $2 = svc - # compare checksums of the configuration section from the file and the - # stashed configuration in a service instance (if any). - # FIXME : optimize by caching, we likely have quite a few requests - [ "`upsconf_getSection_MD5 "$1"`" = "`$hook_getSavedMD5 "$2"`" ] -} - -upslist_checksums_unchanged() { - # For each device and its corresponding unit, compare checksums of the - # configuration section from the file and the stashed configuration in - # a service instance. Prints a list of mismatching service names that - # should get reconfigured. - [ -z "$1" -o -z "$2" ] && return 1 - - _TMP_SVC="" - for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "$_DEV"`" - for _SVC in $2 ; do - if [ "$_DEV" = "$_SVC" ] \ - || [ "$DEVINST" = "$_SVC" ] \ - ; then - upssvcconf_checksum_unchanged "$_DEV" "$_SVC" || \ - { [ -z "$_TMP_SVC" ] \ - && _TMP_SVC="$_SVC" \ - || _TMP_SVC="$_TMP_SVC -$_SVC" ; } - fi - done - done - [ -z "$_TMP_SVC" ] && return 0 - echo "$_TMP_SVC" - return 1 -} - -upsconf_getSection_content() { - # "$1" = name of ups.conf section to display in whole, from whatever - # comes on stdin (file or a pre-made normalized variable) - # empty "$1" means the global config (before any sections) - # - # NOTE (TODO?): This routine finds the one NUT device section, prints it - # and returns when the section is over. It currently does not cover (in - # a way allowing to do it efficiently) selection of several sections, - # or storing each section content in some array or dynamic variables - # (as would be better fit for portable shells) to later address them - # quickly without re-parsing the file or big envvar many times. - # - - CURR_SECTION="" - SECTION_CONTENT="" - RES=1 - [ -n "$1" ] || RES=0 - while read LINE ; do - case "$LINE" in - \["$1"\]) - if [ "$RES" = 0 ]; then - # We have already displayed a section, here is a new one, - # and this routine only displays one (TODO: toggle?) - break - fi - SECTION_CONTENT="$LINE" - CURR_SECTION="$1" - RES=0 - continue - ;; - \[*\ *\]|\[*"$TABCHAR"*\]) - # Note that section-name brackets should contain a single token - # Fall through to add the line to contents of existing section - ;; - \[*\]) - [ "$CURR_SECTION" = "$1" ] && break - # Use a value that can not be a section name here: - CURR_SECTION="[]" - continue - ;; - "") continue ;; - *) ;; # Fall through to add the line to contents of existing section - esac - if [ "$CURR_SECTION" = "$1" ]; then - if [ -n "$SECTION_CONTENT" ]; then - SECTION_CONTENT="$SECTION_CONTENT -$LINE" - else - SECTION_CONTENT="$LINE" - fi - fi - done - - if [ -n "$SECTION_CONTENT" ]; then - echo "$SECTION_CONTENT" - fi - - [ "$RES" = 0 ] || echo "ERROR: Section [$1] was not found in the '$UPSCONF' file" >&2 - return $RES -} - -upsconf_getSection() { - # Use the whole output of normalization parser - upslist_normalizeFile_once || return # Propagate errors upwards - upsconf_getSection_content "$@" << EOF -${UPSCONF_DATA} -EOF -} - -upsconf_getSection_MD5() { - calc_md5 "`upsconf_getSection "$@"`" -} - -upsconf_getSection_SDP() { - # Use the section-driver-port subset - upslist_normalizeFile_once || return # Propagate errors upwards - upsconf_getSection_content "$@" << EOF -${UPSCONF_DATA_SDP} -EOF -} - -upsconf_getValue() { - # "$1" = name of ups.conf section, may be empty for global config - # "$2..$N" = name of config key; we will echo its value -### [ -n "$1" ] || return $? - [ -n "$2" ] || return $? - [ -n "$GETSECTION" ] || GETSECTION="upsconf_getSection" - CURR_SECTION="" # Gets set by a GETSECTION implementation - RES=0 - - # Note: Primary aim of this egrep is to pick either assignments or flags - # As a by-product it can be used to test if a particular value is set ;) - SECTION_CONTENT="`$GETSECTION "$1"`" || return - shift - KEYS="$*" - - while [ "$#" -gt 0 ] ; do - RES_L=0 - VALUE="" - - LINE="`echo "$SECTION_CONTENT" | egrep '(^'"$1"'=|^'"$1"'$)'`" \ - && VALUE="$(echo "$LINE" | sed -e "s,^$1=,," -e 's,^\"\(.*\)\"$,\1,' -e "s,^'\(.*\)'$,\1,")" \ - || RES_L=$? - - [ "$RES_L" = 0 ] || { RES="$RES_L" ; echo "ERROR: Section [$CURR_SECTION] or key '$1' in it was not found in the '$UPSCONF' file" >&2 ; } - - echo "$VALUE" - shift - done - - [ "$RES" = 0 ] || echo "ERROR: Section [$CURR_SECTION] or key(s) '$KEYS' in it was not found in the '$UPSCONF' file" >&2 - return $RES -} - -upsconf_getDriver() { - # "$1" = name of ups.conf section; return (echo) the driver name used there - # In the context this function is used, UPSCONF exists and section is there - GETSECTION="upsconf_getSection_SDP" upsconf_getValue "$1" "driver" - return $? -} - -upsconf_getPort() { - # "$1" = name of ups.conf section; return (echo) the "port" name used there - # In the context this function is used, UPSCONF exists and section is there - GETSECTION="upsconf_getSection_SDP" upsconf_getValue "$1" "port" - return $? -} - -upsconf_getDriverMedia() { - # "$1" = name of ups.conf section; return (echo) name and type of driver as - # needed for dependency evaluation (what services we must depend on for this - # unit), newline-separated (drvnametype). Empty type for unclassified - # results, assuming no known special dependencies (note that depending on - # particular system's physics, both serial and network media may need USB). - CURR_DRV="`upsconf_getDriver "$1"`" || return $? - case "$CURR_DRV" in - *netxml*|*snmp*|*ipmi*|*powerman*|*-mib*|*avahi*|*apcupsd*) - printf '%s\n%s\n' "$CURR_DRV" "network" ; return ;; - *usb*) - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; - nutdrv_qx) # May be direct serial or USB - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" - case "$CURR_PORT" in - auto|/dev/*usb*|/dev/*hid*) - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; - /dev/*) - # See drivers/nutdrv_qx.c :: upsdrv_initups() for a list - if [ -n "`upsconf_getValue "$1" 'subdriver' 'vendorid' 'productid' 'vendor' 'product' 'serial' 'bus' 'langid_fix'`" ] \ - ; then - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return - else - printf '%s\n%s\n' "$CURR_DRV" "serial" ; return - fi - ;; - *) - printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac - ;; - *dummy*|*clone*) # May be networked (proxy to remote NUT) - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" - case "$CURR_PORT" in - *@localhost|*@|*@127.0.0.1|*@::1) - printf '%s\n%s\n' "$CURR_DRV" "network-localhost" ; return ;; - *@*) - printf '%s\n%s\n' "$CURR_DRV" "network" ; return ;; - *) - printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac - ;; - *) printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac -} - -upsconf_getMedia() { - _DRVMED="`upsconf_getDriverMedia "$1"`" || return - echo "$_DRVMED" | tail -n +2 - return 0 -} - -upsconf_debug() { - _DRV="`upsconf_getDriver "$1"`" - _PRT="`upsconf_getPort "$1"`" - _MED="`upsconf_getMedia "$1"`" - _MD5="`upsconf_getSection_MD5 "$1"`" - NAME_MD5="`calc_md5 "$1"`" - echo "INST: ${NAME_MD5}~[$1]: DRV='$_DRV' PORT='$_PRT' MEDIA='$_MED' SECTIONMD5='$_MD5'" -} - -calc_md5() { - # Tries several ways to produce an MD5 of the "$1" argument - _MD5="`echo "$1" | md5sum 2>/dev/null | awk '{print $1}'`" && [ -n "$_MD5" ] || \ - { _MD5="`echo "$1" | openssl dgst -md5 2>/dev/null | awk '{print $NF}'`" && [ -n "$_MD5" ]; } || \ - return 1 - - echo "$_MD5" -} - -calc_md5_file() { - # Tries several ways to produce an MD5 of the file named by "$1" argument - [ -s "$1" ] || return 2 - - _MD5="`md5sum 2>/dev/null < "$1" | awk '{print $1}'`" && [ -n "$_MD5" ] || \ - { _MD5="`openssl dgst -md5 2>/dev/null < "$1" | awk '{print $NF}'`" && [ -n "$_MD5" ]; } || \ - return 1 - - echo "$_MD5" -} - -smf_validFullUnitName() { - case "$1" in - *:*) echo "$1" ;; - *) echo "$SVCNAME_SMF:$1" ;; - esac -} -smf_validInstanceName() { - echo "MD5_`calc_md5 "$1"`" -} -smf_validInstanceSuffixName() { - case "$1" in - *:*) echo "$1" | sed 's,^.*:\([^:]*\)$,\1,' ;; - *) echo "$1" ;; - esac -} -smf_registerInstance() { - DEVICE="$1" - SVCINST="$1" - /usr/sbin/svccfg -s nut-driver add "$DEVICE" || \ - { SVCINST="`smf_validInstanceName "$1"`" && \ - /usr/sbin/svccfg -s nut-driver add "$SVCINST" || return ; } - echo "Added instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 - - DEPSVC="" - DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" - case "$_MED" in - usb) - DEPSVC="$DEPSVC_USB_SMF" - DEPREQ="$DEPREQ_USB_SMF" ;; - network-localhost) - DEPSVC="$DEPSVC_NET_LOCAL_SMF" - DEPREQ="$DEPREQ_NET_LOCAL_SMF" ;; - network) - DEPSVC="$DEPSVC_NET_FULL_SMF" - DEPREQ="$DEPREQ_NET_FULL_SMF" ;; - serial) ;; - '') ;; - *) echo "WARNING: Unexpected NUT media type ignored: '$_MED'" >&2 ;; - esac - - TARGET_FMRI="nut-driver:$SVCINST" - if [ -n "$DEPSVC" ]; then - [ -n "$DEPREQ" ] || DEPREQ="optional_all" - echo "Adding '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'..." - - DEPPG="nut-driver-enumerator-generated" - RESTARTON="refresh" - /usr/sbin/svccfg -s "$TARGET_FMRI" addpg "$DEPPG" dependency && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/grouping = astring: "$DEPREQ" && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/restart_on = astring: "$RESTARTON" && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/type = astring: service && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/entities = fmri: "($DEPSVC)" && \ - echo "OK" || echo "FAILED to define the dependency" >&2 - fi - - smf_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" - - /usr/sbin/svcadm refresh "${TARGET_FMRI}" || return - if [ "$AUTO_START" = yes ] ; then - /usr/sbin/svcadm clear "${TARGET_FMRI}" 2>/dev/null || true - /usr/sbin/svcadm enable "${TARGET_FMRI}" || return - echo "Started instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 - fi -} -smf_unregisterInstance() { - echo "Removing instance: 'nut-driver:$1' ..." >&2 - /usr/sbin/svcadm disable -ts 'nut-driver:'"$1" || false - /usr/sbin/svccfg -s nut-driver delete "$1" -} -smf_refreshSupervizor() { - : -} -smf_listInstances_raw() { - # Newer versions have pattern matching; older SMF might not have this luxury - /usr/bin/svcs -a -H -o fmri | egrep '/nut-driver:' -} -smf_listInstances() { - smf_listInstances_raw | sed 's/^.*://' | sort -n -} -smf_getSavedMD5() { - # Query service instance $1 - PG="nut-driver-enumerator-generated-checksum" - PROP="SECTION_CHECKSUM" - - if [ -n "$1" ]; then - TARGET_FMRI="nut-driver:$1" - else - # Global section - TARGET_FMRI="nut-driver" - PROP="SECTION_CHECKSUM_GLOBAL" - fi - - # Note: lookups for GLOBAL cause each service instance to show up - /usr/bin/svcprop -p "$PG/$PROP" "$TARGET_FMRI" | head -1 | awk '{print $NF}' -} -smf_setSavedMD5() { - # Save checksum value $2 into service instance $1 - PG="nut-driver-enumerator-generated-checksum" - PROP="SECTION_CHECKSUM" - - if [ -n "$1" ]; then - TARGET_FMRI="nut-driver:$1" - else - # Global section - TARGET_FMRI="nut-driver" - PROP="SECTION_CHECKSUM_GLOBAL" - fi - - /usr/sbin/svccfg -s "$TARGET_FMRI" delprop "$PG" || true - /usr/sbin/svccfg -s "$TARGET_FMRI" addpg "$PG" application && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$PG/$PROP" = astring: "$2" - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the checksum">&2 ; return 1 ; } - /usr/sbin/svcadm refresh "${TARGET_FMRI}" || return -} -smf_restart_upsd() { - echo "Restarting NUT data server to make sure it knows new configuration..." - /usr/sbin/svcadm enable "nut-server" 2>/dev/null - /usr/sbin/svcadm clear "nut-server" 2>/dev/null - /usr/sbin/svcadm refresh "nut-server" || \ - /usr/sbin/svcadm restart "nut-server" -} -smf_restart_drv() { - echo "Restarting NUT driver instance '$1' to make sure it knows new configuration..." - /usr/sbin/svcadm enable "nut-driver:$1" 2>/dev/null - /usr/sbin/svcadm clear "nut-driver:$1" 2>/dev/null - /usr/sbin/svcadm refresh "nut-driver:$1" || \ - /usr/sbin/svcadm restart "nut-driver:$1" -} - -systemd_validFullUnitName() { - case "$1" in - *@*.*) echo "$1" ;; - *@*) echo "$1.service" ;; - *) echo "$SVCNAME_SYSTEMD@$1.service" ;; - esac -} -systemd_validInstanceName() { - echo "MD5_`calc_md5 "$1"`" -} -systemd_validInstanceSuffixName() { - echo "$1" | sed -e 's,^.*@,,' -e 's,\.service$,,' -} -systemd_registerInstance() { - # Instance is registered by device section name; ultimate name in systemd may differ - DEVICE="$1" - SVCINST="$1" - /bin/systemctl enable 'nut-driver@'"$DEVICE".service || \ - { SVCINST="`systemd_validInstanceName "$1"`" && \ - /bin/systemctl enable 'nut-driver@'"$SVCINST".service || return ; } - echo "Enabled instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 - - DEPSVC="" - DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" - case "$_MED" in - usb) - DEPSVC="$DEPSVC_USB_SYSTEMD" - DEPREQ="$DEPREQ_USB_SYSTEMD" ;; - network-localhost) - DEPSVC="$DEPSVC_NET_LOCAL_SYSTEMD" - DEPREQ="$DEPREQ_NET_LOCAL_SYSTEMD" ;; - network) - DEPSVC="$DEPSVC_NET_FULL_SYSTEMD" - DEPREQ="$DEPREQ_NET_FULL_SYSTEMD" ;; - serial) ;; - '') ;; - *) echo "WARNING: Unexpected NUT media type ignored: '$_MED'" >&2 ;; - esac - if [ -n "$DEPSVC" ]; then - [ -n "$DEPREQ" ] || DEPREQ="#Wants" - echo "Adding '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'..." - mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d" && \ - cat > "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d/nut-driver-enumerator-generated.conf" <&2 - fi - - systemd_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" - - if [ "$AUTO_START" = yes ] ; then - systemd_refreshSupervizor || echo "WARNING: Somehow managed to fail systemd_refreshSupervizor()" >&2 - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl start --no-block 'nut-driver@'"$SVCINST".service || return - echo "Started instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 - fi -} -systemd_unregisterInstance() { - echo "Removing instance: 'nut-driver@$1' ..." >&2 - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || false - - /bin/systemctl disable 'nut-driver@'"$1".service - rm -rf "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" - /bin/systemctl reset-failed 'nut-driver@'"$1".service -} -systemd_refreshSupervizor() { - /bin/systemctl daemon-reload -} -systemd_listInstances_raw() { - /bin/systemctl show 'nut-driver@*' -p Id | egrep '=nut-driver' | sed 's,^Id=,,' -} -systemd_listInstances() { - systemd_listInstances_raw | sed -e 's/^.*@//' -e 's/\.service$//' | sort -n -} -systemd_getSavedMD5() { - # Query service instance $1 or global section - PROP="SECTION_CHECKSUM" - [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" - [ -s "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" ] \ - && grep "Environment='$PROP=" "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" | sed -e "s,^Environment='$PROP=,," -e "s,'\$,," \ - || { echo "Did not find '${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf' with a $PROP" ; return 1; } -} -systemd_setSavedMD5() { - # Save checksum value $2 into service instance $1 - PROP="SECTION_CHECKSUM" - [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" - mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ - cat > "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" << EOF -[Service] -Environment='$PROP=$2' -EOF - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the checksum">&2 ; return 1 ; } -} -systemd_restart_upsd() { - # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-server"`" in - active|unknown) ;; # unknown meant "starting" in our testing... - failed) echo "Note: nut-server unit was 'failed' - not disabled by user, so (re)starting it (probably had no config initially)" >&2 ;; - *) return 0 ;; - esac - - echo "Restarting NUT data server to make sure it knows new configuration..." - # Note: reload is a better way to go about this, so the - # data service is not interrupted by re-initialization - # of the daemon. But systemd/systemctl sometimes stalls... - - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl reload-or-restart "nut-server" || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl restart "nut-server" -} - -systemd_restart_drv() { - # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-driver@$1"`" in - active|unknown) ;; - *) return 0 ;; - esac - - echo "Restarting NUT driver instance '$1' to make sure it knows new configuration..." - - # Full restart, e.g. in case we changed the user= in configs - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl restart "nut-driver@$1" -} - -upslist_normalizeFile_filter() { - # See upslist_normalizeFile() detailed comments below; this routine - # is a pipe worker to prepare the text into a simpler expected form. - - # Pick the lines which contain a bracket or assignment character, - # or a single token (certain keywords come as just NUT "flags"), - # trim leading and trailing whitespace, comment-only lines, and in - # assignment lines trim the spaces around equality character and - # quoting characters around assignment of values without whitespaces. - # Any whitespace characters around a section name (single token that - # starts the line and is enclosed in brackets) and a trailing comment - # are dropped. Note that brackets with spaces inside, and brackets - # that do not start the non-whitespace payload of the line, are not - # sections. - egrep -v '(^$|^#)' | \ - sed -e 's,^['"$TABCHAR"'\ ]*,,' \ - -e 's,^\#.*$,,' \ - -e 's,['"$TABCHAR"'\ ]*$,,' \ - -e 's,^\([^=\ '"$TABCHAR"']*\)['"$TABCHAR"'\ ]*=['"$TABCHAR"'\ ]*,\1=,g' \ - -e 's,=\"\([^\ '"$TABCHAR"']*\)\"$,=\1,' \ - -e 's,^\(\[[^]'"$TABCHAR"'\ ]*\]\)['"$TABCHAR"'\ ]*\(#.*\)*$,\1,' \ - | egrep -v '^$' \ - | egrep '([\[\=]|^[^ '"$TABCHAR"']*$|^[^ '"$TABCHAR"']*[ '"$TABCHAR"']*\#.*$)' -} - -upslist_normalizeFile() { - # Read the ups.conf file and find all defined sections (names of - # configuration blocks for drivers that connect to a certain device - # using specified protocol and media); normalize section contents - # as detailed below, to simplify subsequent parsing and comparison. - - # File contents - UPSCONF_DATA="" - UPSCONF_DATA_SDP="" - if [ -n "$UPSCONF" ] && [ -f "$UPSCONF" ] && [ -r "$UPSCONF" ]; then - [ ! -s "$UPSCONF" ] \ - && echo "WARNING: The '$UPSCONF' file exists but is empty" >&2 \ - && return 0 - # Ok to continue - we may end up removing all instances - else - echo "FATAL: The '$UPSCONF' file does not exist or is not readable" >&2 - return 2 - fi - - # Store a normalized version of NUT configuration file contents. - # Also use a SDP subset with just section, driver and port info - # for faster parsing when determining driver-required media etc. - UPSCONF_DATA="$(upslist_normalizeFile_filter < "$UPSCONF")" \ - && [ -n "$UPSCONF_DATA" ] \ - && UPSCONF_DATA_SDP="`egrep '^(\[.*\]|driver=|port=)' << EOF -$UPSCONF_DATA -EOF`" \ - || { echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: nothing left after normalization" >&2 - UPSCONF_DATA="" - UPSCONF_DATA_SDP="" - } -} - -upslist_normalizeFile_once() { - # Wrapper that ensures that the parsing is only done once - # (will re-parse if there were no devices listed on the - # first time, though) - [ -z "$UPSCONF_DATA" ] && [ -z "$UPSCONF_DATA_SDP" ] || return 0 - upslist_normalizeFile -} - -upslist_readFile() { - # Use the routine above (unconditionally) to get or update the - # listing of device sections known at this moment. - - # List of devices from the config file - UPSLIST_FILE="" - if [ "$DO_NORMALIZE_ONCE" = yes ]; then - upslist_normalizeFile_once || return # Propagate errors upwards - else - upslist_normalizeFile || return # Propagate errors upwards - fi - - if [ -n "$UPSCONF_DATA" ] ; then - # Note that section-name brackets should contain a single token - UPSLIST_FILE="$(echo "$UPSCONF_DATA_SDP" | egrep '^\[[^'"$TABCHAR"'\ ]*\]$' | sed 's,^\[\(.*\)\]$,\1,' | sort -n)" \ - || UPSLIST_FILE="" - if [ -z "$UPSLIST_FILE" ] ; then - echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: no section declarations in parsed normalized contents" >&2 - fi - fi - # Ok to continue with empty results - we may end up removing all instances -} - -upslist_readFile_once() { - # Wrapper that ensures that the parsing is only done once - # (will re-parse if there were no devices listed on the - # first time, though) - [ -z "$UPSLIST_FILE" ] || return 0 - DO_NORMALIZE_ONCE=yes upslist_readFile -} - -upslist_readSvcs() { - UPSLIST_SVCS="`$hook_listInstances`" || UPSLIST_SVCS="" - if [ -z "$UPSLIST_SVCS" ] && [ "$1" != "-" ] ; then - EXPLAIN="" - [ -z "$1" ] || EXPLAIN=" - $1" - echo "Error reading the list of ${SERVICE_FRAMEWORK-} service instances for UPS drivers, or none are defined${EXPLAIN}" >&2 - # Ok to continue - we may end up defining new instances - fi -} - -upslist_debug() { - for UPSF in "" $UPSLIST_FILE ; do - upsconf_debug "$UPSF" - done -} - -upslist_addSvcs() { - # Note: This routine registers service instances for device config sections - # that are not wrapped currently. Support for redefined previously existing - # sections - is attained by removing the old service instance elsewhere and - # recreating it here, since any data could change including the dependency - # list, etc. - for UPSF in $UPSLIST_FILE ; do - if ! common_isRegistered "$UPSF" ; then - echo "Adding new ${SERVICE_FRAMEWORK} service instance for power device [${UPSF}]..." >&2 - $hook_registerInstance "$UPSF" - fi - done -} - -upslist_delSvcs() { - for UPSS in $UPSLIST_SVCS ; do - if ! common_isFiled "$UPSS" ; then - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] which is no longer in config file..." >&2 - $hook_unregisterInstance "$UPSS" - fi - done -} - -upslist_restartSvcs() { - for UPSS in $UPSLIST_SVCS ; do - if common_isFiled "$UPSS" ; then - $hook_restart_drv "$UPSS" - fi - done -} - -nut_driver_enumerator_main() { - ################# MAIN PROGRAM by default - - # Note: do not use the read..._once() here, to ensure that the - # looped daemon sees the whole picture, which can be new every time - upslist_readFile || return $? - #upslist_debug - upslist_readSvcs "before manipulations" - - # Test if global config has changed since last run - RESTART_ALL=no - upssvcconf_checksum_unchanged "" || { echo "`date -u` : Detected changes in global section of '$UPSCONF', will restart all drivers"; RESTART_ALL=yes; } - - # Quickly exit if there's nothing to do; note the lists are pre-sorted - # Otherwise a non-zero exit will be done below - # Note: We implement testing in detail whether section definitions were - # changed since last run, as a first step before checking that name - # lists are still equivalent, because we need to always have the result - # of the "has it changed?" check as a hit-list of something to remove, - # while the check for no new device section definitions is just boolean. - # We can only exit quickly if both there are no changed sections and no - # new or removed sections since last run. - NEW_CHECKSUM="`upslist_checksums_unchanged "$UPSLIST_FILE" "$UPSLIST_SVCS"`" \ - && [ -z "$NEW_CHECKSUM" ] \ - && upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" \ - && if [ -z "$DAEMON_SLEEP" -o "${VERBOSE_LOOP}" = yes ] ; then \ - echo "`date -u` : OK: No changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" ; \ - fi \ - && [ "$RESTART_ALL" = no ] && return 0 - - if [ -n "$NEW_CHECKSUM" ]; then - for UPSS in $NEW_CHECKSUM ; do - echo "Dropping old ${SERVICE_FRAMEWORK} service instance ${UPSS} whose section in config file has changed..." >&2 - $hook_unregisterInstance "$UPSS" - done - upslist_readSvcs "after updating for new config section checksums" - fi - - if [ -n "$UPSLIST_SVCS" ]; then - # Drop services that are not in config file (any more?) - upslist_delSvcs - - if [ "$RESTART_ALL" = yes ] && [ "$AUTO_START" = yes ] ; then - # Here restart only existing services; new ones will (try to) - # start soon after creation and upsd is handled below - upslist_restartSvcs - fi - fi - - if [ "$RESTART_ALL" = yes ] ; then - # Save new checksum of global config - $hook_setSavedMD5 "" "`upsconf_getSection_MD5 ""`" - fi - - if [ -n "$UPSLIST_FILE" ]; then - # Add services for sections that are in config file but not yet wrapped - upslist_addSvcs - $hook_refreshSupervizor - upslist_readSvcs "after checking for new config sections to define service instances" - fi - - upslist_readSvcs - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" - echo "$UPSLIST_SVCS" - fi - - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" - echo "$UPSLIST_FILE" - fi - - # We had some changes to the config file; upsd must be made aware - if [ "$AUTO_START" = yes ] ; then - $hook_restart_upsd - fi - - # Return 42 if there was a change applied succesfully - # (but e.g. some services should restart - upsd, maybe upsmon) - UPSLIST_EQ_RES=0 - upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" || UPSLIST_EQ_RES=$? - - # File processing and service startups take a while; - # make sure upsconf did not change while we worked... - # NOTE: Check this at the last moment to minimize - # the chance of still not noticing the change made - # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true - if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then - # NOTE: even if daemonized, the sleep between iterations - # can be configured into an uncomfortably long lag, so - # we should re-sync the system config in any case. - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" - # Make sure the cycle does not repeat itself due to diffs - # from an ages-old state of the file from when we started. - UPSCONF_CHECKSUM_START="$UPSCONF_CHECKSUM_END" - ( nut_driver_enumerator_main ) ; return $? - # The "main" routine at the end of recursions will - # do REPORT_RESTART_42 logic or the error exit-code - fi - - if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" - [ "${REPORT_RESTART_42-}" = no ] && return 0 || return 42 - fi - return 13 -} - -daemonize() ( - # Support (SIG)HUP == signal code 1 to quickly reconfigure, - # e.g. to request it while the sleep is happening or while - # "main" is processing an earlier change of the file. - RECONFIGURE_ASAP=false - trap 'RECONFIGURE_ASAP=true' 1 - - # Note: this loop would die on errors with config file or - # inability to ensure that it matches the list of services. - # If caller did not `export REPORT_RESTART_42=no` then the - # loop would exit with code 42, and probably trigger restart - # of the service which wraps this daemon do topple others that - # depend on it. - # Note: do not quickly skip the "main" based on full-file - # checksum refresh, to ensure that whatever is configured - # gets applied (e.g. if user disabled some services or they - # died, or some config was not applied due to coding error). - while nut_driver_enumerator_main ; do - if $RECONFIGURE_ASAP ; then - echo "`date -u` : Trapped a SIGHUP during last run of nut_driver_enumerator_main, repeating reconfiguration quickly" >&2 - else - sleep $DAEMON_SLEEP & - trap "kill $! ; echo 'Sleep interrupted, processing configs now!'>&2" 1 - wait $! - fi - RECONFIGURE_ASAP=false - trap 'RECONFIGURE_ASAP=true' 1 - done - exit $? -) - -# Save the checksum of ups.conf as early as possible, -# to test in the end that it is still the same file. -UPSCONF_CHECKSUM_START="`calc_md5_file "$UPSCONF"`" || true - -# By default, update wrapping of devices into services -if [ $# = 0 ]; then - nut_driver_enumerator_main ; exit $? -fi - -if [ $# = 1 ] ; then - [ -n "$DAEMON_SLEEP" ] || DAEMON_SLEEP=60 - # Note: Not all shells have 'case ... ;&' support - case "$1" in - --daemon=*) DAEMON_SLEEP="`echo "$1" | sed 's,^--daemon=,,'`" ;; - esac - case "$1" in - --daemon|--daemon=*) - daemonize & - exit $? - ;; - esac -fi -unset DAEMON_SLEEP - -usage() { - cat << EOF -$0 (no args) - Update wrapping of devices into services -$0 --daemon(=freq) - Update wrapping of devices into services in an infinite loop - Default freq is 60 sec -$0 --reconfigure - Stop and un-register all service instances and recreate them - (e.g. if new dependency template was defined in a new - version of this script and/or NUT package) -$0 --get-service-framework - Print the detected service - management framework in this OS -$0 --list-devices - Print list of devices in NUT config -$0 --list-services - Print list of service instances which wrap registered - NUT devices (full name of service unit) -$0 --list-instances - Print list of service instances which wrap registered - NUT devices (just instance suffix) -$0 --get-service-for-device DEV - Print the full name of service unit which wraps a NUT - device named "DEV" -$0 --get-device-for-service SVC - Print the NUT device name for full or instance-suffix name of - a service unit which wraps it -$0 --list-services-for-devices - Print a TAB-separated list of service units and corresponding - NUT device names which each such unit wraps -$0 --show-configs|--show-all-configs - Show the complete normalized list of device configuration blocks -$0 --show-config DEV -$0 --show-device-config DEV - Show configuration block of the specified NUT device -$0 --show-device-config-value DEV KEY [KEY...] - Show single configuration key value of the specified NUT device - For flags, shows the flag name if present in the section - If several keys or flags are requested, their values are reported - one per line in the same order (including empty lines for missing - values); any missing value yields a non-zero exit code. -EOF -} - -while [ $# -gt 0 ]; do - case "$1" in - --help|-h|-help) usage; exit 0 ;; - --get-service-framework) echo "${SERVICE_FRAMEWORK}" ; exit 0 ;; - --reconfigure) - upslist_readFile_once || exit $? - upslist_readSvcs "before manipulations" - - if [ -n "$UPSLIST_SVCS" ]; then - for UPSS in $UPSLIST_SVCS ; do - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] to reconfigure the service unit..." >&2 - $hook_unregisterInstance "$UPSS" - done - upslist_readSvcs "after dropping" - fi - - if [ -n "$UPSLIST_FILE" ]; then - upslist_addSvcs - upslist_readSvcs "after checking for new config sections to define service instances" - fi - - # Save new checksum of global config - $hook_setSavedMD5 "" "`upsconf_getSection_MD5 ""`" - - # Service units were manipulated, including saving of checksums; - # refresh the service management daemon if needed - $hook_refreshSupervizor - - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" - echo "$UPSLIST_SVCS" - fi - - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" - echo "$UPSLIST_FILE" - fi - - # We had some changes to the config file; upsd must be made aware - if [ "$AUTO_START" = yes ] ; then - $hook_restart_upsd - fi - - # Return 42 if there was a change applied succesfully - # (but e.g. some services should restart - upsd, maybe upsmon) - UPSLIST_EQ_RES=0 - upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" || UPSLIST_EQ_RES=$? - - # File processing and service startups take a while; - # make sure upsconf did not change while we worked... - # NOTE: Check this at the last moment to minimize - # the chance of still not noticing the change made - # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true - if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" - $0 ; exit $? - # The "main" routine will do REPORT_RESTART_42 logic too - fi - - if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" - [ "${REPORT_RESTART_42-}" = no ] && exit 0 || exit 42 - fi - - exit 13 - ;; - --list-devices) - upslist_readFile_once && \ - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" >&2 - echo "$UPSLIST_FILE" - exit 0 - fi - echo "No devices detected in '$UPSCONF'" >&2 - exit 1 - ;; - --list-services) - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && \ - if [ -n "$UPSLIST_SVCS_RAW" ] ; then - echo "=== The currently defined service units are:" >&2 - echo "$UPSLIST_SVCS_RAW" - exit 0 - fi - echo "No service units detected" >&2 - exit 1 - ;; - --list-instances) - upslist_readSvcs "by user request" && \ - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" >&2 - echo "$UPSLIST_SVCS" - exit 0 - fi - echo "No service instances detected" >&2 - exit 1 - ;; - --get-service-for-device) [ -z "$2" ] && echo "Device name argument required" >&2 && exit 1 - DEV="$2" - upslist_readSvcs "by user request" && [ -n "$UPSLIST_SVCS" ] \ - || { echo "No service instances detected" >&2 ; exit 1; } - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ -n "$UPSLIST_SVCS_RAW" ] \ - || { echo "No service units detected" >&2 ; exit 1; } - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" - # First pass over simple verbatim names - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$DEV" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITD" ] ; then - echo "$UNIT" - exit 0 - fi - done - fi - done - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$vINST" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITI" ] ; then - echo "$UNIT" - exit 0 - fi - done - fi - done - echo "No service instances detected that match device '$2'" >&2 - exit 1 - ;; - --get-device-for-service) [ -z "$2" ] && echo "Service (instance) name argument required" >&2 && exit 1 - # Instance name can be a hash or "native" NUT section name - SVC="`$hook_validInstanceSuffixName "$2"`" - case "$SVC" in - MD5_*) ;; # fall through to the bulk of code - *) upslist_readFile_once || exit $? - echo "$UPSLIST_FILE" | egrep "^$SVC\$" - exit $? - ;; - esac - FINAL_RES=0 - OUT="`"$0" --list-services-for-devices`" && [ -n "$OUT" ] || FINAL_RES=$? - if [ "$FINAL_RES" = 0 ]; then - echo "$OUT" | grep "$SVC" | ( \ - while read _SVC _DEV ; do - _SVC="`$hook_validInstanceSuffixName "${_SVC}"`" || exit - [ "${_SVC}" = "${SVC}" ] && echo "$_DEV" && exit 0 - done ; exit 1 ) && exit 0 - fi - echo "No service instance '$2' was detected that matches a NUT device" >&2 - exit 1 - ;; - --list-services-for-devices) - FINAL_RES=0 - upslist_readFile_once && [ -n "$UPSLIST_FILE" ] \ - || { echo "No devices detected in '$UPSCONF'" >&2 ; exit 1 ; } - upslist_readSvcs "by user request" && [ -n "$UPSLIST_SVCS" ] \ - || { echo "No service instances detected" >&2 ; exit 1; } - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ -n "$UPSLIST_SVCS_RAW" ] \ - || { echo "No service units detected" >&2 ; exit 1; } - for DEV in $UPSLIST_FILE ; do - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" - # First pass over simple verbatim names - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$DEV" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITD" ] ; then - printf '%s\t%s\n' "$UNIT" "$DEV" - continue 3 - fi - done - fi - done - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$vINST" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITI" ] ; then - printf '%s\t%s\n' "$UNIT" "$DEV" - continue 3 - fi - done - fi - done - echo "WARNING: no service instances detected that match device '$DEV'" >&2 - FINAL_RES=1 - done - exit $FINAL_RES - ;; - --show-configs|--show-device-configs|--show-all-configs|--show-all-device-configs) - RES=0 - upslist_readFile_once || RES=$? - [ "$RES" != 0 ] && { echo "ERROR: upslist_readFile_once () failed with code $RES" >&2; exit $RES; } - [ -n "$UPSLIST_FILE" ] \ - || { echo "WARNING: No devices detected in '$UPSCONF'" >&2 ; RES=1 ; } - echo "$UPSCONF_DATA" - exit $RES - ;; - --show-config|--show-device-config) - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 - DEV="$2" - upsconf_getSection "$DEV" - exit $? - ;; - --show-config-value|--show-device-config-value) - [ -z "$3" ] && echo "At least one configuration key name argument is required" >&2 && exit 1 - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 - DEV="$2" - shift 2 - upsconf_getValue "$DEV" "$@" - exit $? - ;; - upsconf_debug) # Not public, not in usage() - [ -z "$2" ] && echo "Device name argument required" >&2 && exit 1 - upsconf_debug "$2" - exit $? - ;; - upslist_debug) # Not public, not in usage() - upslist_readFile_once || exit - upslist_debug - exit $? - ;; - *) echo "Unrecognized argument: $1" >&2 ; exit 1 ;; - esac - shift -done diff --git a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in b/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in deleted file mode 100755 index a91ce5e..0000000 --- a/scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in +++ /dev/null @@ -1,1391 +0,0 @@ -#!/bin/sh -# -# NOTE: This script is intentionally written with portable shell constructs -# with the aim and hope to work in different interpreters, so it is a -# bit dumber and less efficient than could be achieved with the more -# featured shells in the spectrum. -# NOTE ALSO: The configuration parser in this script is not meant to be a -# reference or 100% compliant with what the binary code uses; its aim -# is to just pick out some strings relevant for tracking config changes. -# -# Copyright (C) 2016-2020 Eaton -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#! \file nut-driver-enumerator.sh(.in) -# \author Jim Klimov -# \brief Enumerate NUT devices for service-unit instance configuration -# \details This script allows to enumerate UPSes in order to produce the -# individual service unit instances for each defined configuration. -# It assumes the user has adequate permissions to inspect and create -# services (e.g. is a root or has proper RBAC profiles to do so). -# It helps service frameworks such as Linux systemd and Solaris SMF. -# When executed, this script looks for all configured ups.conf -# sections and registered service instances, and makes these two -# lists match up. It has also a mode to do this in a loop, to keep -# checking for differences and applying them, on systems where it's -# problematic to trigger it in response to FS event notifications. -# Returns exit codes: -# 0 Sections and services already match up -# 42 Sections and services differed, but now match up - -# now the caller should likely restart some services. -# Note that the drivers' service instances were started or -# stopped as required (by AUTO_START=yes) - but maybe the -# upsd or upsmon services should restart. If you pass envvar -# REPORT_RESTART_42=no then this codepath would return 0. -# In default mode, such non-null reconfiguration should cause -# the nut-driver-enumerator service to restart and this would -# propagate to other NUT services that depend on it. -# 13 Sections and services differed, and still do not match up -# 1 Bad inputs, e.g. unrecognized service management framework -# 2 Absent or unreadable ups.conf file -# - -# NOTE: Currently found caveats that might be solved later but require -# considerable effort: -# * Solaris SMF constrains the syntax of valid strings for instance names -# (e.g. not starting with a digit, no period chars) which blocks creation -# of some UPS driver instances. This might be worked around by hashing -# the device name e.g. to base64 (and un-hashing instance name when calling -# upsdrvctl), but is not quite user-friendly. Also can store device name -# in a service attribute while mangling the instance name to a valid subset. -# Comparisons (if devices are already wrapped) becomes more complicated in -# the script in either case, as well as in the service startup method. -# ** The `+` `/` `=` characters from base64 are also invalid for SMF instance -# name, but the first two can be sed'ed to `-` `_` and back, for example. -# Some prefix word is also needed (avoid starting with a digit). -# The trailing padding `=` can be dropped, and added until we get a -# non-empty decode. Conversions can be done by -# `echo "$string" | openssl base64 -e|-d` -# * Dummy-UPS services that "proxy" another locally defined section are -# essentially a circular dependency for upsd. While the system might -# start-up lacking a driver, there should be some timer to re-enable -# failed not-disabled drivers (would be useful in any case though). - -# Directory where NUT configs are located, e.g. /etc/nut or /etc/ups -# Set at package configuration, compiled into daemons and drivers -prefix="@prefix@" -[ -n "${NUT_CONFPATH-}" ] || NUT_CONFPATH="@sysconfdir@" -# Technically this should be a distribution-dependent value configured -# during package build. But everyone has it the same from systemd defaults: -[ -n "${SYSTEMD_CONFPATH-}" ] || SYSTEMD_CONFPATH="/etc/systemd/system" - -if [ -n "$ZSH_VERSION" ]; then - ### Problem: loops like `for UPS in $UPSLIST` do not separate - ### the UPSLIST into many tokens but use it as one string. - echo "FATAL: zsh is not supported in this script" >&2 - exit 1 -# setopt noglob -# setopt +F -# IFS="`printf ' \t\r\n'`" ; export IFS -fi - -if set | egrep '^(shell|version|t?csh)' | egrep 't?csh' >/dev/null ; then - echo "FATAL: csh or tcsh is not supported in this script" >&2 - exit 1 -fi - -# Third-party services to depend on (can be overridden by config file) -### Note that for systemd+udev integration, it may be better to set up -### triggers in udev, see e.g. -### http://stackoverflow.com/questions/18463755/linux-start-daemon-on-connected-usb-serial-dongle -### Also can tune whether a driver "Wants" another service (would consider -### ordering if that one is enabled, but live if it is disabled), or if it -### "Requires" that (would cause that to start). -DEPSVC_USB_SYSTEMD="systemd-udev.service systemd-udev-settle.service" -DEPREQ_USB_SYSTEMD="Wants" -DEPSVC_NET_FULL_SYSTEMD="network-online.target systemd-resolved.service ifplugd.service" -DEPREQ_NET_FULL_SYSTEMD="Wants" -DEPSVC_NET_LOCAL_SYSTEMD="network.target" -DEPREQ_NET_LOCAL_SYSTEMD="Wants" -SVCNAME_SYSTEMD="nut-driver" - -# Some or all of these FMRIs may be related to dynamically changing hardware -# require_all) ;; # All cited services are running (online or degraded) -# require_any) ;; # At least one of the cited services is running -# optional_all) ;; # (All) cited services are running or would not run -# # without administrative action (disabled, maintenance, -# # not present, or are waiting for dependencies which do -# # not start without administrative action). -DEPSVC_USB_SMF="svc:/system/hotplug:default svc:/system/dbus:default svc:/system/hal:default svc:/milestone/devices:default" -DEPREQ_USB_SMF="optional_all" -# By default there are several physical network FMRIs shipped and at most -# only one is enabled on a particular system (e.g. :default or :nwam) -DEPSVC_NET_FULL_SMF="svc:/network/physical svc:/milestone/name-services" -DEPREQ_NET_FULL_SMF="optional_all" -DEPSVC_NET_LOCAL_SMF="svc:/network/loopback:default" -DEPREQ_NET_LOCAL_SMF="optional_all" -SVCNAME_SMF="svc:/system/power/nut-driver" - -[ -z "${NUT_DRIVER_ENUMERATOR_CONF-}" ] && \ - NUT_DRIVER_ENUMERATOR_CONF="${NUT_CONFPATH}/nut-driver-enumerator.conf" - -[ -s "${NUT_DRIVER_ENUMERATOR_CONF}" ] && \ - echo "Sourcing config file: ${NUT_DRIVER_ENUMERATOR_CONF}" && \ - . "${NUT_DRIVER_ENUMERATOR_CONF}" - -[ -z "${UPSCONF-}" ] && \ - UPSCONF="${NUT_CONFPATH}/ups.conf" - -# Start a freshly-registered unit? -[ -z "${AUTO_START-}" ] && AUTO_START=yes - -# We avoid regex '\t' which gets misinterpreted by some tools -TABCHAR="`printf '\t'`" || TABCHAR=' ' - -if [ -z "${SERVICE_FRAMEWORK-}" ] ; then - [ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && [ -x /usr/bin/svcprop ] && \ - SERVICE_FRAMEWORK="smf" - [ -z "${SERVICE_FRAMEWORK-}" ] && \ - [ -x /bin/systemctl ] && \ - SERVICE_FRAMEWORK="systemd" -fi - -# Optionally use Coreutils timeout to limit the -# (potentially hanging) calls to systemd tools... -# Should not hurt with SMF too, if it ever misbehaves. -if [ -z "${TIMEOUT_CMD+x}" ]; then - # Envvar not set at all (set but empty is okay, caller wants that then) - TIMEOUT_CMD="" - TIMEOUT_ARGS="" - if which timeout 2>/dev/null >/dev/null ; then - # Systemd default timeout for unit start/stop - TIMEOUT_CMD="timeout" - TIMEOUT_ARGS="90s" - fi -fi - -# Cache needed bits of ups.conf to speed up later parsing. Note that these -# data are needed for most operations, and populated by upslist_readFile() -UPSCONF_DATA="" -# Subset of normalized data above that only has sections, drivers and ports -UPSCONF_DATA_SDP="" - -# List of configured UPSes in the config-file -UPSLIST_FILE="" -# List of configured service instances for UPS drivers -UPSLIST_SVCS="" - -# Framework-specific implementations are generally hooked here: -hook_registerInstance="" -hook_unregisterInstance="" -hook_refreshSupervizor="" -hook_listInstances="" -hook_listInstances_raw="" -hook_validInstanceName="" -hook_validFullUnitName="" -hook_validInstanceSuffixName="" -hook_getSavedMD5="" -hook_setSavedMD5="" -hook_restart_upsd="" -hook_restart_drv="" - -case "${SERVICE_FRAMEWORK-}" in - smf) - hook_registerInstance="smf_registerInstance" - hook_unregisterInstance="smf_unregisterInstance" - hook_refreshSupervizor="smf_refreshSupervizor" - hook_listInstances="smf_listInstances" - hook_listInstances_raw="smf_listInstances_raw" - hook_validInstanceName="smf_validInstanceName" - hook_validFullUnitName="smf_validFullUnitName" - hook_validInstanceSuffixName="smf_validInstanceSuffixName" - hook_getSavedMD5="smf_getSavedMD5" - hook_setSavedMD5="smf_setSavedMD5" - hook_restart_upsd="smf_restart_upsd" - hook_restart_drv="smf_restart_drv" - ;; - systemd) - hook_registerInstance="systemd_registerInstance" - hook_unregisterInstance="systemd_unregisterInstance" - hook_refreshSupervizor="systemd_refreshSupervizor" - hook_listInstances="systemd_listInstances" - hook_listInstances_raw="systemd_listInstances_raw" - hook_validInstanceName="systemd_validInstanceName" - hook_validFullUnitName="systemd_validFullUnitName" - hook_validInstanceSuffixName="systemd_validInstanceSuffixName" - hook_getSavedMD5="systemd_getSavedMD5" - hook_setSavedMD5="systemd_setSavedMD5" - hook_restart_upsd="systemd_restart_upsd" - hook_restart_drv="systemd_restart_drv" - ;; - selftest) - hook_registerInstance="selftest_NOOP" - hook_unregisterInstance="selftest_NOOP" - hook_refreshSupervizor="selftest_NOOP" - hook_listInstances="selftest_NOOP" - hook_listInstances_raw="selftest_NOOP" - hook_validInstanceName="selftest_NOOP" - hook_validFullUnitName="selftest_NOOP" - hook_validInstanceSuffixName="selftest_NOOP" - hook_getSavedMD5="selftest_NOOP" - hook_setSavedMD5="selftest_NOOP" - hook_restart_upsd="selftest_NOOP" - hook_restart_drv="selftest_NOOP" - ;; - "") - echo "Error detecting the service-management framework on this OS" >&2 - exit 1 - ;; - *) - echo "Error: User provided an unknown service-management framework '$SERVICE_FRAMEWORK'" >&2 - exit 1 - ;; -esac - -selftest_NOOP() { - echo "NO-OP: Self-testing context does not do systems configuration" >&2 - return 0 -} - -common_isFiled() { - [ -n "$UPSLIST_FILE" ] && \ - for UPSF in $UPSLIST_FILE ; do - [ "$1" = "$UPSF" ] && return 0 - [ "`$hook_validInstanceName "$UPSF"`" = "$1" ] && return 0 - done - return 1 -} - -common_isRegistered() { - [ -n "$UPSLIST_SVCS" ] && \ - for UPSS in $UPSLIST_SVCS ; do - [ "$1" = "$UPSS" ] && return 0 - [ "`$hook_validInstanceName "$1"`" = "$UPSS" ] && return 0 - done - return 1 -} - -upslist_equals() { - # Compare pre-sorted list of DEVICES ($1) and SVCINSTs ($2) including - # the possible mangling for service names. Return 0 if lists describe - # exactly same set of devices and their services. - # Note: This logic only checks the names, not the contents of device - # sections, so re-definitions of an existing device configuration - # would not trigger a service restart by itself. Such deeper check - # belongs in a different routine, see upssvcconf_checksum_unchanged(). - - # Trivial case 0: one string is empty, another is not - # Note: `echo '' | wc -l` == "1" not "0"! - [ -n "$1" -a -z "$2" ] && return 1 - [ -z "$1" -a -n "$2" ] && return 1 - - # Trivial case 1: equal strings - [ "$1" = "$2" ] && return 0 - # Trivial case 2: different amount of entries - [ "`echo "$1" | wc -l`" = "`echo "$2" | wc -l`" ] || return $? - - _TMP_DEV_SVC="" - for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "$_DEV"`" - for _SVC in $2 ; do - [ "$_DEV" = "$_SVC" ] \ - || [ "$DEVINST" = "$_SVC" ] \ - && { [ -z "$_TMP_DEV_SVC" ] \ - && _TMP_DEV_SVC="$_DEV = $_SVC" \ - || _TMP_DEV_SVC="$_TMP_DEV_SVC -$_DEV = $_SVC" ; } - done - done - - # Input was not empty; did anything in output fit? - [ -z "$_TMP_DEV_SVC" ] && return 1 - - # Exit code : is the built mapping as long as the source list(s)? - [ "`echo "$1" | wc -l`" = "`echo "$_TMP_DEV_SVC" | wc -l`" ] -} - -upssvcconf_checksum_unchanged() { - # $1 = dev, $2 = svc - # compare checksums of the configuration section from the file and the - # stashed configuration in a service instance (if any). - # FIXME : optimize by caching, we likely have quite a few requests - [ "`upsconf_getSection_MD5 "$1"`" = "`$hook_getSavedMD5 "$2"`" ] -} - -upslist_checksums_unchanged() { - # For each device and its corresponding unit, compare checksums of the - # configuration section from the file and the stashed configuration in - # a service instance. Prints a list of mismatching service names that - # should get reconfigured. - [ -z "$1" -o -z "$2" ] && return 1 - - _TMP_SVC="" - for _DEV in $1 ; do - DEVINST="`$hook_validInstanceName "$_DEV"`" - for _SVC in $2 ; do - if [ "$_DEV" = "$_SVC" ] \ - || [ "$DEVINST" = "$_SVC" ] \ - ; then - upssvcconf_checksum_unchanged "$_DEV" "$_SVC" || \ - { [ -z "$_TMP_SVC" ] \ - && _TMP_SVC="$_SVC" \ - || _TMP_SVC="$_TMP_SVC -$_SVC" ; } - fi - done - done - [ -z "$_TMP_SVC" ] && return 0 - echo "$_TMP_SVC" - return 1 -} - -upsconf_getSection_content() { - # "$1" = name of ups.conf section to display in whole, from whatever - # comes on stdin (file or a pre-made normalized variable) - # empty "$1" means the global config (before any sections) - # - # NOTE (TODO?): This routine finds the one NUT device section, prints it - # and returns when the section is over. It currently does not cover (in - # a way allowing to do it efficiently) selection of several sections, - # or storing each section content in some array or dynamic variables - # (as would be better fit for portable shells) to later address them - # quickly without re-parsing the file or big envvar many times. - # - - CURR_SECTION="" - SECTION_CONTENT="" - RES=1 - [ -n "$1" ] || RES=0 - while read LINE ; do - case "$LINE" in - \["$1"\]) - if [ "$RES" = 0 ]; then - # We have already displayed a section, here is a new one, - # and this routine only displays one (TODO: toggle?) - break - fi - SECTION_CONTENT="$LINE" - CURR_SECTION="$1" - RES=0 - continue - ;; - \[*\ *\]|\[*"$TABCHAR"*\]) - # Note that section-name brackets should contain a single token - # Fall through to add the line to contents of existing section - ;; - \[*\]) - [ "$CURR_SECTION" = "$1" ] && break - # Use a value that can not be a section name here: - CURR_SECTION="[]" - continue - ;; - "") continue ;; - *) ;; # Fall through to add the line to contents of existing section - esac - if [ "$CURR_SECTION" = "$1" ]; then - if [ -n "$SECTION_CONTENT" ]; then - SECTION_CONTENT="$SECTION_CONTENT -$LINE" - else - SECTION_CONTENT="$LINE" - fi - fi - done - - if [ -n "$SECTION_CONTENT" ]; then - echo "$SECTION_CONTENT" - fi - - [ "$RES" = 0 ] || echo "ERROR: Section [$1] was not found in the '$UPSCONF' file" >&2 - return $RES -} - -upsconf_getSection() { - # Use the whole output of normalization parser - upslist_normalizeFile_once || return # Propagate errors upwards - upsconf_getSection_content "$@" << EOF -${UPSCONF_DATA} -EOF -} - -upsconf_getSection_MD5() { - calc_md5 "`upsconf_getSection "$@"`" -} - -upsconf_getSection_SDP() { - # Use the section-driver-port subset - upslist_normalizeFile_once || return # Propagate errors upwards - upsconf_getSection_content "$@" << EOF -${UPSCONF_DATA_SDP} -EOF -} - -upsconf_getValue() { - # "$1" = name of ups.conf section, may be empty for global config - # "$2..$N" = name of config key; we will echo its value -### [ -n "$1" ] || return $? - [ -n "$2" ] || return $? - [ -n "$GETSECTION" ] || GETSECTION="upsconf_getSection" - CURR_SECTION="" # Gets set by a GETSECTION implementation - RES=0 - - # Note: Primary aim of this egrep is to pick either assignments or flags - # As a by-product it can be used to test if a particular value is set ;) - SECTION_CONTENT="`$GETSECTION "$1"`" || return - shift - KEYS="$*" - - while [ "$#" -gt 0 ] ; do - RES_L=0 - VALUE="" - - LINE="`echo "$SECTION_CONTENT" | egrep '(^'"$1"'=|^'"$1"'$)'`" \ - && VALUE="$(echo "$LINE" | sed -e "s,^$1=,," -e 's,^\"\(.*\)\"$,\1,' -e "s,^'\(.*\)'$,\1,")" \ - || RES_L=$? - - [ "$RES_L" = 0 ] || { RES="$RES_L" ; echo "ERROR: Section [$CURR_SECTION] or key '$1' in it was not found in the '$UPSCONF' file" >&2 ; } - - echo "$VALUE" - shift - done - - [ "$RES" = 0 ] || echo "ERROR: Section [$CURR_SECTION] or key(s) '$KEYS' in it was not found in the '$UPSCONF' file" >&2 - return $RES -} - -upsconf_getDriver() { - # "$1" = name of ups.conf section; return (echo) the driver name used there - # In the context this function is used, UPSCONF exists and section is there - GETSECTION="upsconf_getSection_SDP" upsconf_getValue "$1" "driver" - return $? -} - -upsconf_getPort() { - # "$1" = name of ups.conf section; return (echo) the "port" name used there - # In the context this function is used, UPSCONF exists and section is there - GETSECTION="upsconf_getSection_SDP" upsconf_getValue "$1" "port" - return $? -} - -upsconf_getDriverMedia() { - # "$1" = name of ups.conf section; return (echo) name and type of driver as - # needed for dependency evaluation (what services we must depend on for this - # unit), newline-separated (drvnametype). Empty type for unclassified - # results, assuming no known special dependencies (note that depending on - # particular system's physics, both serial and network media may need USB). - CURR_DRV="`upsconf_getDriver "$1"`" || return $? - case "$CURR_DRV" in - *netxml*|*snmp*|*ipmi*|*powerman*|*-mib*|*avahi*|*apcupsd*) - printf '%s\n%s\n' "$CURR_DRV" "network" ; return ;; - *usb*) - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; - nutdrv_qx) # May be direct serial or USB - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" - case "$CURR_PORT" in - auto|/dev/*usb*|/dev/*hid*) - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return ;; - /dev/*) - # See drivers/nutdrv_qx.c :: upsdrv_initups() for a list - if [ -n "`upsconf_getValue "$1" 'subdriver' 'vendorid' 'productid' 'vendor' 'product' 'serial' 'bus' 'langid_fix'`" ] \ - ; then - printf '%s\n%s\n' "$CURR_DRV" "usb" ; return - else - printf '%s\n%s\n' "$CURR_DRV" "serial" ; return - fi - ;; - *) - printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac - ;; - *dummy*|*clone*) # May be networked (proxy to remote NUT) - CURR_PORT="`upsconf_getPort "$1"`" || CURR_PORT="" - case "$CURR_PORT" in - *@localhost|*@|*@127.0.0.1|*@::1) - printf '%s\n%s\n' "$CURR_DRV" "network-localhost" ; return ;; - *@*) - printf '%s\n%s\n' "$CURR_DRV" "network" ; return ;; - *) - printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac - ;; - *) printf '%s\n%s\n' "$CURR_DRV" "" ; return ;; - esac -} - -upsconf_getMedia() { - _DRVMED="`upsconf_getDriverMedia "$1"`" || return - echo "$_DRVMED" | tail -n +2 - return 0 -} - -upsconf_debug() { - _DRV="`upsconf_getDriver "$1"`" - _PRT="`upsconf_getPort "$1"`" - _MED="`upsconf_getMedia "$1"`" - _MD5="`upsconf_getSection_MD5 "$1"`" - NAME_MD5="`calc_md5 "$1"`" - echo "INST: ${NAME_MD5}~[$1]: DRV='$_DRV' PORT='$_PRT' MEDIA='$_MED' SECTIONMD5='$_MD5'" -} - -calc_md5() { - # Tries several ways to produce an MD5 of the "$1" argument - _MD5="`echo "$1" | md5sum 2>/dev/null | awk '{print $1}'`" && [ -n "$_MD5" ] || \ - { _MD5="`echo "$1" | openssl dgst -md5 2>/dev/null | awk '{print $NF}'`" && [ -n "$_MD5" ]; } || \ - return 1 - - echo "$_MD5" -} - -calc_md5_file() { - # Tries several ways to produce an MD5 of the file named by "$1" argument - [ -s "$1" ] || return 2 - - _MD5="`md5sum 2>/dev/null < "$1" | awk '{print $1}'`" && [ -n "$_MD5" ] || \ - { _MD5="`openssl dgst -md5 2>/dev/null < "$1" | awk '{print $NF}'`" && [ -n "$_MD5" ]; } || \ - return 1 - - echo "$_MD5" -} - -smf_validFullUnitName() { - case "$1" in - *:*) echo "$1" ;; - *) echo "$SVCNAME_SMF:$1" ;; - esac -} -smf_validInstanceName() { - echo "MD5_`calc_md5 "$1"`" -} -smf_validInstanceSuffixName() { - case "$1" in - *:*) echo "$1" | sed 's,^.*:\([^:]*\)$,\1,' ;; - *) echo "$1" ;; - esac -} -smf_registerInstance() { - DEVICE="$1" - SVCINST="$1" - /usr/sbin/svccfg -s nut-driver add "$DEVICE" || \ - { SVCINST="`smf_validInstanceName "$1"`" && \ - /usr/sbin/svccfg -s nut-driver add "$SVCINST" || return ; } - echo "Added instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 - - DEPSVC="" - DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" - case "$_MED" in - usb) - DEPSVC="$DEPSVC_USB_SMF" - DEPREQ="$DEPREQ_USB_SMF" ;; - network-localhost) - DEPSVC="$DEPSVC_NET_LOCAL_SMF" - DEPREQ="$DEPREQ_NET_LOCAL_SMF" ;; - network) - DEPSVC="$DEPSVC_NET_FULL_SMF" - DEPREQ="$DEPREQ_NET_FULL_SMF" ;; - serial) ;; - '') ;; - *) echo "WARNING: Unexpected NUT media type ignored: '$_MED'" >&2 ;; - esac - - TARGET_FMRI="nut-driver:$SVCINST" - if [ -n "$DEPSVC" ]; then - [ -n "$DEPREQ" ] || DEPREQ="optional_all" - echo "Adding '$DEPREQ' dependency for '$SVCINST' on '$DEPSVC'..." - - DEPPG="nut-driver-enumerator-generated" - RESTARTON="refresh" - /usr/sbin/svccfg -s "$TARGET_FMRI" addpg "$DEPPG" dependency && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/grouping = astring: "$DEPREQ" && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/restart_on = astring: "$RESTARTON" && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/type = astring: service && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$DEPPG"/entities = fmri: "($DEPSVC)" && \ - echo "OK" || echo "FAILED to define the dependency" >&2 - fi - - smf_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" - - /usr/sbin/svcadm refresh "${TARGET_FMRI}" || return - if [ "$AUTO_START" = yes ] ; then - /usr/sbin/svcadm clear "${TARGET_FMRI}" 2>/dev/null || true - /usr/sbin/svcadm enable "${TARGET_FMRI}" || return - echo "Started instance: 'nut-driver:$SVCINST' for NUT configuration section '$DEVICE'" >&2 - fi -} -smf_unregisterInstance() { - echo "Removing instance: 'nut-driver:$1' ..." >&2 - /usr/sbin/svcadm disable -ts 'nut-driver:'"$1" || false - /usr/sbin/svccfg -s nut-driver delete "$1" -} -smf_refreshSupervizor() { - : -} -smf_listInstances_raw() { - # Newer versions have pattern matching; older SMF might not have this luxury - /usr/bin/svcs -a -H -o fmri | egrep '/nut-driver:' -} -smf_listInstances() { - smf_listInstances_raw | sed 's/^.*://' | sort -n -} -smf_getSavedMD5() { - # Query service instance $1 - PG="nut-driver-enumerator-generated-checksum" - PROP="SECTION_CHECKSUM" - - if [ -n "$1" ]; then - TARGET_FMRI="nut-driver:$1" - else - # Global section - TARGET_FMRI="nut-driver" - PROP="SECTION_CHECKSUM_GLOBAL" - fi - - # Note: lookups for GLOBAL cause each service instance to show up - /usr/bin/svcprop -p "$PG/$PROP" "$TARGET_FMRI" | head -1 | awk '{print $NF}' -} -smf_setSavedMD5() { - # Save checksum value $2 into service instance $1 - PG="nut-driver-enumerator-generated-checksum" - PROP="SECTION_CHECKSUM" - - if [ -n "$1" ]; then - TARGET_FMRI="nut-driver:$1" - else - # Global section - TARGET_FMRI="nut-driver" - PROP="SECTION_CHECKSUM_GLOBAL" - fi - - /usr/sbin/svccfg -s "$TARGET_FMRI" delprop "$PG" || true - /usr/sbin/svccfg -s "$TARGET_FMRI" addpg "$PG" application && \ - /usr/sbin/svccfg -s "$TARGET_FMRI" setprop "$PG/$PROP" = astring: "$2" - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the checksum">&2 ; return 1 ; } - /usr/sbin/svcadm refresh "${TARGET_FMRI}" || return -} -smf_restart_upsd() { - echo "Restarting NUT data server to make sure it knows new configuration..." - /usr/sbin/svcadm enable "nut-server" 2>/dev/null - /usr/sbin/svcadm clear "nut-server" 2>/dev/null - /usr/sbin/svcadm refresh "nut-server" || \ - /usr/sbin/svcadm restart "nut-server" -} -smf_restart_drv() { - echo "Restarting NUT driver instance '$1' to make sure it knows new configuration..." - /usr/sbin/svcadm enable "nut-driver:$1" 2>/dev/null - /usr/sbin/svcadm clear "nut-driver:$1" 2>/dev/null - /usr/sbin/svcadm refresh "nut-driver:$1" || \ - /usr/sbin/svcadm restart "nut-driver:$1" -} - -systemd_validFullUnitName() { - case "$1" in - *@*.*) echo "$1" ;; - *@*) echo "$1.service" ;; - *) echo "$SVCNAME_SYSTEMD@$1.service" ;; - esac -} -systemd_validInstanceName() { - echo "MD5_`calc_md5 "$1"`" -} -systemd_validInstanceSuffixName() { - echo "$1" | sed -e 's,^.*@,,' -e 's,\.service$,,' -} -systemd_registerInstance() { - # Instance is registered by device section name; ultimate name in systemd may differ - DEVICE="$1" - SVCINST="$1" - /bin/systemctl enable 'nut-driver@'"$DEVICE".service || \ - { SVCINST="`systemd_validInstanceName "$1"`" && \ - /bin/systemctl enable 'nut-driver@'"$SVCINST".service || return ; } - echo "Enabled instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 - - DEPSVC="" - DEPREQ="" - _MED="`upsconf_getMedia "$DEVICE"`" - case "$_MED" in - usb) - DEPSVC="$DEPSVC_USB_SYSTEMD" - DEPREQ="$DEPREQ_USB_SYSTEMD" ;; - network-localhost) - DEPSVC="$DEPSVC_NET_LOCAL_SYSTEMD" - DEPREQ="$DEPREQ_NET_LOCAL_SYSTEMD" ;; - network) - DEPSVC="$DEPSVC_NET_FULL_SYSTEMD" - DEPREQ="$DEPREQ_NET_FULL_SYSTEMD" ;; - serial) ;; - '') ;; - *) echo "WARNING: Unexpected NUT media type ignored: '$_MED'" >&2 ;; - esac - if [ -n "$DEPSVC" ]; then - [ -n "$DEPREQ" ] || DEPREQ="#Wants" - echo "Adding '$DEPREQ'+After dependency for '$SVCINST' on '$DEPSVC'..." - mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d" && \ - cat > "${SYSTEMD_CONFPATH}/nut-driver@$SVCINST.service.d/nut-driver-enumerator-generated.conf" <&2 - fi - - systemd_setSavedMD5 "$SVCINST" "`upsconf_getSection_MD5 "$DEVICE"`" - - if [ "$AUTO_START" = yes ] ; then - systemd_refreshSupervizor || echo "WARNING: Somehow managed to fail systemd_refreshSupervizor()" >&2 - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl start --no-block 'nut-driver@'"$SVCINST".service || return - echo "Started instance: 'nut-driver@$SVCINST' for NUT configuration section '$DEVICE'" >&2 - fi -} -systemd_unregisterInstance() { - echo "Removing instance: 'nut-driver@$1' ..." >&2 - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl stop 'nut-driver@'"$1".service || false - - /bin/systemctl disable 'nut-driver@'"$1".service - rm -rf "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" - /bin/systemctl reset-failed 'nut-driver@'"$1".service -} -systemd_refreshSupervizor() { - /bin/systemctl daemon-reload -} -systemd_listInstances_raw() { - /bin/systemctl show 'nut-driver@*' -p Id | egrep '=nut-driver' | sed 's,^Id=,,' -} -systemd_listInstances() { - systemd_listInstances_raw | sed -e 's/^.*@//' -e 's/\.service$//' | sort -n -} -systemd_getSavedMD5() { - # Query service instance $1 or global section - PROP="SECTION_CHECKSUM" - [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" - [ -s "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" ] \ - && grep "Environment='$PROP=" "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" | sed -e "s,^Environment='$PROP=,," -e "s,'\$,," \ - || { echo "Did not find '${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf' with a $PROP" ; return 1; } -} -systemd_setSavedMD5() { - # Save checksum value $2 into service instance $1 - PROP="SECTION_CHECKSUM" - [ -n "$1" ] || PROP="SECTION_CHECKSUM_GLOBAL" - mkdir -p "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d" && \ - cat > "${SYSTEMD_CONFPATH}/nut-driver@$1.service.d/nut-driver-enumerator-generated-checksum.conf" << EOF -[Service] -Environment='$PROP=$2' -EOF - [ $? = 0 ] && echo "OK" || { echo "FAILED to stash the checksum">&2 ; return 1 ; } -} -systemd_restart_upsd() { - # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-server"`" in - active|unknown) ;; # unknown meant "starting" in our testing... - failed) echo "Note: nut-server unit was 'failed' - not disabled by user, so (re)starting it (probably had no config initially)" >&2 ;; - *) return 0 ;; - esac - - echo "Restarting NUT data server to make sure it knows new configuration..." - # Note: reload is a better way to go about this, so the - # data service is not interrupted by re-initialization - # of the daemon. But systemd/systemctl sometimes stalls... - - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl reload-or-restart "nut-server" || \ - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl restart "nut-server" -} - -systemd_restart_drv() { - # Do not restart/reload if not already running - case "`/bin/systemctl is-active "nut-driver@$1"`" in - active|unknown) ;; - *) return 0 ;; - esac - - echo "Restarting NUT driver instance '$1' to make sure it knows new configuration..." - - # Full restart, e.g. in case we changed the user= in configs - $TIMEOUT_CMD $TIMEOUT_ARGS /bin/systemctl restart "nut-driver@$1" -} - -upslist_normalizeFile_filter() { - # See upslist_normalizeFile() detailed comments below; this routine - # is a pipe worker to prepare the text into a simpler expected form. - - # Pick the lines which contain a bracket or assignment character, - # or a single token (certain keywords come as just NUT "flags"), - # trim leading and trailing whitespace, comment-only lines, and in - # assignment lines trim the spaces around equality character and - # quoting characters around assignment of values without whitespaces. - # Any whitespace characters around a section name (single token that - # starts the line and is enclosed in brackets) and a trailing comment - # are dropped. Note that brackets with spaces inside, and brackets - # that do not start the non-whitespace payload of the line, are not - # sections. - egrep -v '(^$|^#)' | \ - sed -e 's,^['"$TABCHAR"'\ ]*,,' \ - -e 's,^\#.*$,,' \ - -e 's,['"$TABCHAR"'\ ]*$,,' \ - -e 's,^\([^=\ '"$TABCHAR"']*\)['"$TABCHAR"'\ ]*=['"$TABCHAR"'\ ]*,\1=,g' \ - -e 's,=\"\([^\ '"$TABCHAR"']*\)\"$,=\1,' \ - -e 's,^\(\[[^]'"$TABCHAR"'\ ]*\]\)['"$TABCHAR"'\ ]*\(#.*\)*$,\1,' \ - | egrep -v '^$' \ - | egrep '([\[\=]|^[^ '"$TABCHAR"']*$|^[^ '"$TABCHAR"']*[ '"$TABCHAR"']*\#.*$)' -} - -upslist_normalizeFile() { - # Read the ups.conf file and find all defined sections (names of - # configuration blocks for drivers that connect to a certain device - # using specified protocol and media); normalize section contents - # as detailed below, to simplify subsequent parsing and comparison. - - # File contents - UPSCONF_DATA="" - UPSCONF_DATA_SDP="" - if [ -n "$UPSCONF" ] && [ -f "$UPSCONF" ] && [ -r "$UPSCONF" ]; then - [ ! -s "$UPSCONF" ] \ - && echo "WARNING: The '$UPSCONF' file exists but is empty" >&2 \ - && return 0 - # Ok to continue - we may end up removing all instances - else - echo "FATAL: The '$UPSCONF' file does not exist or is not readable" >&2 - return 2 - fi - - # Store a normalized version of NUT configuration file contents. - # Also use a SDP subset with just section, driver and port info - # for faster parsing when determining driver-required media etc. - UPSCONF_DATA="$(upslist_normalizeFile_filter < "$UPSCONF")" \ - && [ -n "$UPSCONF_DATA" ] \ - && UPSCONF_DATA_SDP="`egrep '^(\[.*\]|driver=|port=)' << EOF -$UPSCONF_DATA -EOF`" \ - || { echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: nothing left after normalization" >&2 - UPSCONF_DATA="" - UPSCONF_DATA_SDP="" - } -} - -upslist_normalizeFile_once() { - # Wrapper that ensures that the parsing is only done once - # (will re-parse if there were no devices listed on the - # first time, though) - [ -z "$UPSCONF_DATA" ] && [ -z "$UPSCONF_DATA_SDP" ] || return 0 - upslist_normalizeFile -} - -upslist_readFile() { - # Use the routine above (unconditionally) to get or update the - # listing of device sections known at this moment. - - # List of devices from the config file - UPSLIST_FILE="" - if [ "$DO_NORMALIZE_ONCE" = yes ]; then - upslist_normalizeFile_once || return # Propagate errors upwards - else - upslist_normalizeFile || return # Propagate errors upwards - fi - - if [ -n "$UPSCONF_DATA" ] ; then - # Note that section-name brackets should contain a single token - UPSLIST_FILE="$(echo "$UPSCONF_DATA_SDP" | egrep '^\[[^'"$TABCHAR"'\ ]*\]$' | sed 's,^\[\(.*\)\]$,\1,' | sort -n)" \ - || UPSLIST_FILE="" - if [ -z "$UPSLIST_FILE" ] ; then - echo "Error reading the '$UPSCONF' file or it does not declare any device configurations: no section declarations in parsed normalized contents" >&2 - fi - fi - # Ok to continue with empty results - we may end up removing all instances -} - -upslist_readFile_once() { - # Wrapper that ensures that the parsing is only done once - # (will re-parse if there were no devices listed on the - # first time, though) - [ -z "$UPSLIST_FILE" ] || return 0 - DO_NORMALIZE_ONCE=yes upslist_readFile -} - -upslist_readSvcs() { - UPSLIST_SVCS="`$hook_listInstances`" || UPSLIST_SVCS="" - if [ -z "$UPSLIST_SVCS" ] && [ "$1" != "-" ] ; then - EXPLAIN="" - [ -z "$1" ] || EXPLAIN=" - $1" - echo "Error reading the list of ${SERVICE_FRAMEWORK-} service instances for UPS drivers, or none are defined${EXPLAIN}" >&2 - # Ok to continue - we may end up defining new instances - fi -} - -upslist_debug() { - for UPSF in "" $UPSLIST_FILE ; do - upsconf_debug "$UPSF" - done -} - -upslist_addSvcs() { - # Note: This routine registers service instances for device config sections - # that are not wrapped currently. Support for redefined previously existing - # sections - is attained by removing the old service instance elsewhere and - # recreating it here, since any data could change including the dependency - # list, etc. - for UPSF in $UPSLIST_FILE ; do - if ! common_isRegistered "$UPSF" ; then - echo "Adding new ${SERVICE_FRAMEWORK} service instance for power device [${UPSF}]..." >&2 - $hook_registerInstance "$UPSF" - fi - done -} - -upslist_delSvcs() { - for UPSS in $UPSLIST_SVCS ; do - if ! common_isFiled "$UPSS" ; then - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] which is no longer in config file..." >&2 - $hook_unregisterInstance "$UPSS" - fi - done -} - -upslist_restartSvcs() { - for UPSS in $UPSLIST_SVCS ; do - if common_isFiled "$UPSS" ; then - $hook_restart_drv "$UPSS" - fi - done -} - -nut_driver_enumerator_main() { - ################# MAIN PROGRAM by default - - # Note: do not use the read..._once() here, to ensure that the - # looped daemon sees the whole picture, which can be new every time - upslist_readFile || return $? - #upslist_debug - upslist_readSvcs "before manipulations" - - # Test if global config has changed since last run - RESTART_ALL=no - upssvcconf_checksum_unchanged "" || { echo "`date -u` : Detected changes in global section of '$UPSCONF', will restart all drivers"; RESTART_ALL=yes; } - - # Quickly exit if there's nothing to do; note the lists are pre-sorted - # Otherwise a non-zero exit will be done below - # Note: We implement testing in detail whether section definitions were - # changed since last run, as a first step before checking that name - # lists are still equivalent, because we need to always have the result - # of the "has it changed?" check as a hit-list of something to remove, - # while the check for no new device section definitions is just boolean. - # We can only exit quickly if both there are no changed sections and no - # new or removed sections since last run. - NEW_CHECKSUM="`upslist_checksums_unchanged "$UPSLIST_FILE" "$UPSLIST_SVCS"`" \ - && [ -z "$NEW_CHECKSUM" ] \ - && upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" \ - && if [ -z "$DAEMON_SLEEP" -o "${VERBOSE_LOOP}" = yes ] ; then \ - echo "`date -u` : OK: No changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" ; \ - fi \ - && [ "$RESTART_ALL" = no ] && return 0 - - if [ -n "$NEW_CHECKSUM" ]; then - for UPSS in $NEW_CHECKSUM ; do - echo "Dropping old ${SERVICE_FRAMEWORK} service instance ${UPSS} whose section in config file has changed..." >&2 - $hook_unregisterInstance "$UPSS" - done - upslist_readSvcs "after updating for new config section checksums" - fi - - if [ -n "$UPSLIST_SVCS" ]; then - # Drop services that are not in config file (any more?) - upslist_delSvcs - - if [ "$RESTART_ALL" = yes ] && [ "$AUTO_START" = yes ] ; then - # Here restart only existing services; new ones will (try to) - # start soon after creation and upsd is handled below - upslist_restartSvcs - fi - fi - - if [ "$RESTART_ALL" = yes ] ; then - # Save new checksum of global config - $hook_setSavedMD5 "" "`upsconf_getSection_MD5 ""`" - fi - - if [ -n "$UPSLIST_FILE" ]; then - # Add services for sections that are in config file but not yet wrapped - upslist_addSvcs - $hook_refreshSupervizor - upslist_readSvcs "after checking for new config sections to define service instances" - fi - - upslist_readSvcs - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" - echo "$UPSLIST_SVCS" - fi - - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" - echo "$UPSLIST_FILE" - fi - - # We had some changes to the config file; upsd must be made aware - if [ "$AUTO_START" = yes ] ; then - $hook_restart_upsd - fi - - # Return 42 if there was a change applied succesfully - # (but e.g. some services should restart - upsd, maybe upsmon) - UPSLIST_EQ_RES=0 - upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" || UPSLIST_EQ_RES=$? - - # File processing and service startups take a while; - # make sure upsconf did not change while we worked... - # NOTE: Check this at the last moment to minimize - # the chance of still not noticing the change made - # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true - if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then - # NOTE: even if daemonized, the sleep between iterations - # can be configured into an uncomfortably long lag, so - # we should re-sync the system config in any case. - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" - # Make sure the cycle does not repeat itself due to diffs - # from an ages-old state of the file from when we started. - UPSCONF_CHECKSUM_START="$UPSCONF_CHECKSUM_END" - ( nut_driver_enumerator_main ) ; return $? - # The "main" routine at the end of recursions will - # do REPORT_RESTART_42 logic or the error exit-code - fi - - if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" - [ "${REPORT_RESTART_42-}" = no ] && return 0 || return 42 - fi - return 13 -} - -daemonize() ( - # Support (SIG)HUP == signal code 1 to quickly reconfigure, - # e.g. to request it while the sleep is happening or while - # "main" is processing an earlier change of the file. - RECONFIGURE_ASAP=false - trap 'RECONFIGURE_ASAP=true' 1 - - # Note: this loop would die on errors with config file or - # inability to ensure that it matches the list of services. - # If caller did not `export REPORT_RESTART_42=no` then the - # loop would exit with code 42, and probably trigger restart - # of the service which wraps this daemon do topple others that - # depend on it. - # Note: do not quickly skip the "main" based on full-file - # checksum refresh, to ensure that whatever is configured - # gets applied (e.g. if user disabled some services or they - # died, or some config was not applied due to coding error). - while nut_driver_enumerator_main ; do - if $RECONFIGURE_ASAP ; then - echo "`date -u` : Trapped a SIGHUP during last run of nut_driver_enumerator_main, repeating reconfiguration quickly" >&2 - else - sleep $DAEMON_SLEEP & - trap "kill $! ; echo 'Sleep interrupted, processing configs now!'>&2" 1 - wait $! - fi - RECONFIGURE_ASAP=false - trap 'RECONFIGURE_ASAP=true' 1 - done - exit $? -) - -# Save the checksum of ups.conf as early as possible, -# to test in the end that it is still the same file. -UPSCONF_CHECKSUM_START="`calc_md5_file "$UPSCONF"`" || true - -# By default, update wrapping of devices into services -if [ $# = 0 ]; then - nut_driver_enumerator_main ; exit $? -fi - -if [ $# = 1 ] ; then - [ -n "$DAEMON_SLEEP" ] || DAEMON_SLEEP=60 - # Note: Not all shells have 'case ... ;&' support - case "$1" in - --daemon=*) DAEMON_SLEEP="`echo "$1" | sed 's,^--daemon=,,'`" ;; - esac - case "$1" in - --daemon|--daemon=*) - daemonize & - exit $? - ;; - esac -fi -unset DAEMON_SLEEP - -usage() { - cat << EOF -$0 (no args) - Update wrapping of devices into services -$0 --daemon(=freq) - Update wrapping of devices into services in an infinite loop - Default freq is 60 sec -$0 --reconfigure - Stop and un-register all service instances and recreate them - (e.g. if new dependency template was defined in a new - version of this script and/or NUT package) -$0 --get-service-framework - Print the detected service - management framework in this OS -$0 --list-devices - Print list of devices in NUT config -$0 --list-services - Print list of service instances which wrap registered - NUT devices (full name of service unit) -$0 --list-instances - Print list of service instances which wrap registered - NUT devices (just instance suffix) -$0 --get-service-for-device DEV - Print the full name of service unit which wraps a NUT - device named "DEV" -$0 --get-device-for-service SVC - Print the NUT device name for full or instance-suffix name of - a service unit which wraps it -$0 --list-services-for-devices - Print a TAB-separated list of service units and corresponding - NUT device names which each such unit wraps -$0 --show-configs|--show-all-configs - Show the complete normalized list of device configuration blocks -$0 --show-config DEV -$0 --show-device-config DEV - Show configuration block of the specified NUT device -$0 --show-device-config-value DEV KEY [KEY...] - Show single configuration key value of the specified NUT device - For flags, shows the flag name if present in the section - If several keys or flags are requested, their values are reported - one per line in the same order (including empty lines for missing - values); any missing value yields a non-zero exit code. -EOF -} - -while [ $# -gt 0 ]; do - case "$1" in - --help|-h|-help) usage; exit 0 ;; - --get-service-framework) echo "${SERVICE_FRAMEWORK}" ; exit 0 ;; - --reconfigure) - upslist_readFile_once || exit $? - upslist_readSvcs "before manipulations" - - if [ -n "$UPSLIST_SVCS" ]; then - for UPSS in $UPSLIST_SVCS ; do - echo "Dropping old ${SERVICE_FRAMEWORK} service instance for power device [${UPSS}] to reconfigure the service unit..." >&2 - $hook_unregisterInstance "$UPSS" - done - upslist_readSvcs "after dropping" - fi - - if [ -n "$UPSLIST_FILE" ]; then - upslist_addSvcs - upslist_readSvcs "after checking for new config sections to define service instances" - fi - - # Save new checksum of global config - $hook_setSavedMD5 "" "`upsconf_getSection_MD5 ""`" - - # Service units were manipulated, including saving of checksums; - # refresh the service management daemon if needed - $hook_refreshSupervizor - - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" - echo "$UPSLIST_SVCS" - fi - - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" - echo "$UPSLIST_FILE" - fi - - # We had some changes to the config file; upsd must be made aware - if [ "$AUTO_START" = yes ] ; then - $hook_restart_upsd - fi - - # Return 42 if there was a change applied succesfully - # (but e.g. some services should restart - upsd, maybe upsmon) - UPSLIST_EQ_RES=0 - upslist_equals "$UPSLIST_FILE" "$UPSLIST_SVCS" || UPSLIST_EQ_RES=$? - - # File processing and service startups take a while; - # make sure upsconf did not change while we worked... - # NOTE: Check this at the last moment to minimize - # the chance of still not noticing the change made - # at just the wrong moment. - UPSCONF_CHECKSUM_END="`calc_md5_file "$UPSCONF"`" || true - if [ "$UPSCONF_CHECKSUM_END" != "$UPSCONF_CHECKSUM_START" ] ; then - echo "`date -u` : '$UPSCONF' changed while $0 $* was processing its older contents; re-running the script to pick up the late-coming changes" - $0 ; exit $? - # The "main" routine will do REPORT_RESTART_42 logic too - fi - - if [ "$UPSLIST_EQ_RES" = 0 ] ; then - echo "`date -u` : OK: No more changes to reconcile between ${SERVICE_FRAMEWORK} service instances and device configurations in '$UPSCONF'" - [ "${REPORT_RESTART_42-}" = no ] && exit 0 || exit 42 - fi - - exit 13 - ;; - --list-devices) - upslist_readFile_once && \ - if [ -n "$UPSLIST_FILE" ] ; then - echo "=== The currently defined configurations in '$UPSCONF' are:" >&2 - echo "$UPSLIST_FILE" - exit 0 - fi - echo "No devices detected in '$UPSCONF'" >&2 - exit 1 - ;; - --list-services) - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && \ - if [ -n "$UPSLIST_SVCS_RAW" ] ; then - echo "=== The currently defined service units are:" >&2 - echo "$UPSLIST_SVCS_RAW" - exit 0 - fi - echo "No service units detected" >&2 - exit 1 - ;; - --list-instances) - upslist_readSvcs "by user request" && \ - if [ -n "$UPSLIST_SVCS" ] ; then - echo "=== The currently defined service instances are:" >&2 - echo "$UPSLIST_SVCS" - exit 0 - fi - echo "No service instances detected" >&2 - exit 1 - ;; - --get-service-for-device) [ -z "$2" ] && echo "Device name argument required" >&2 && exit 1 - DEV="$2" - upslist_readSvcs "by user request" && [ -n "$UPSLIST_SVCS" ] \ - || { echo "No service instances detected" >&2 ; exit 1; } - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ -n "$UPSLIST_SVCS_RAW" ] \ - || { echo "No service units detected" >&2 ; exit 1; } - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" - # First pass over simple verbatim names - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$DEV" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITD" ] ; then - echo "$UNIT" - exit 0 - fi - done - fi - done - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$vINST" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITI" ] ; then - echo "$UNIT" - exit 0 - fi - done - fi - done - echo "No service instances detected that match device '$2'" >&2 - exit 1 - ;; - --get-device-for-service) [ -z "$2" ] && echo "Service (instance) name argument required" >&2 && exit 1 - # Instance name can be a hash or "native" NUT section name - SVC="`$hook_validInstanceSuffixName "$2"`" - case "$SVC" in - MD5_*) ;; # fall through to the bulk of code - *) upslist_readFile_once || exit $? - echo "$UPSLIST_FILE" | egrep "^$SVC\$" - exit $? - ;; - esac - FINAL_RES=0 - OUT="`"$0" --list-services-for-devices`" && [ -n "$OUT" ] || FINAL_RES=$? - if [ "$FINAL_RES" = 0 ]; then - echo "$OUT" | grep "$SVC" | ( \ - while read _SVC _DEV ; do - _SVC="`$hook_validInstanceSuffixName "${_SVC}"`" || exit - [ "${_SVC}" = "${SVC}" ] && echo "$_DEV" && exit 0 - done ; exit 1 ) && exit 0 - fi - echo "No service instance '$2' was detected that matches a NUT device" >&2 - exit 1 - ;; - --list-services-for-devices) - FINAL_RES=0 - upslist_readFile_once && [ -n "$UPSLIST_FILE" ] \ - || { echo "No devices detected in '$UPSCONF'" >&2 ; exit 1 ; } - upslist_readSvcs "by user request" && [ -n "$UPSLIST_SVCS" ] \ - || { echo "No service instances detected" >&2 ; exit 1; } - UPSLIST_SVCS_RAW="`$hook_listInstances_raw`" && [ -n "$UPSLIST_SVCS_RAW" ] \ - || { echo "No service units detected" >&2 ; exit 1; } - for DEV in $UPSLIST_FILE ; do - vINST="`$hook_validInstanceName "$DEV"`" - vUNITD="`$hook_validFullUnitName "$DEV"`" - vUNITI="`$hook_validFullUnitName "$vINST"`" - # First pass over simple verbatim names - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$DEV" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITD" ] ; then - printf '%s\t%s\n' "$UNIT" "$DEV" - continue 3 - fi - done - fi - done - for INST in $UPSLIST_SVCS ; do - if [ "$INST" = "$vINST" ] ; then - for UNIT in $UPSLIST_SVCS_RAW ; do - if [ "$UNIT" = "$vUNITI" ] ; then - printf '%s\t%s\n' "$UNIT" "$DEV" - continue 3 - fi - done - fi - done - echo "WARNING: no service instances detected that match device '$DEV'" >&2 - FINAL_RES=1 - done - exit $FINAL_RES - ;; - --show-configs|--show-device-configs|--show-all-configs|--show-all-device-configs) - RES=0 - upslist_readFile_once || RES=$? - [ "$RES" != 0 ] && { echo "ERROR: upslist_readFile_once () failed with code $RES" >&2; exit $RES; } - [ -n "$UPSLIST_FILE" ] \ - || { echo "WARNING: No devices detected in '$UPSCONF'" >&2 ; RES=1 ; } - echo "$UPSCONF_DATA" - exit $RES - ;; - --show-config|--show-device-config) - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 - DEV="$2" - upsconf_getSection "$DEV" - exit $? - ;; - --show-config-value|--show-device-config-value) - [ -z "$3" ] && echo "At least one configuration key name argument is required" >&2 && exit 1 - [ -z "$2" ] && echo "WARNING: Device name argument empty, will show global config" >&2 - DEV="$2" - shift 2 - upsconf_getValue "$DEV" "$@" - exit $? - ;; - upsconf_debug) # Not public, not in usage() - [ -z "$2" ] && echo "Device name argument required" >&2 && exit 1 - upsconf_debug "$2" - exit $? - ;; - upslist_debug) # Not public, not in usage() - upslist_readFile_once || exit - upslist_debug - exit $? - ;; - *) echo "Unrecognized argument: $1" >&2 ; exit 1 ;; - esac - shift -done diff --git a/scripts/upsdrvsvcctl/upsdrvsvcctl b/scripts/upsdrvsvcctl/upsdrvsvcctl deleted file mode 100755 index 001ac42..0000000 --- a/scripts/upsdrvsvcctl/upsdrvsvcctl +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2016-2018 Eaton -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#! \file upsdrvsvcctl(.in) -# \author Jim Klimov -# \brief Manage NUT devices registered as service-unit instances -# - -if [ -z "${SERVICE_FRAMEWORK-}" ] ; then - [ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && \ - SERVICE_FRAMEWORK="smf" - [ -z "${SERVICE_FRAMEWORK-}" ] && \ - [ -x /bin/systemctl ] && \ - SERVICE_FRAMEWORK="systemd" -fi - -VERB="" -CMD="" -CMDARG="" -ENUMERATOR="" -case "$SERVICE_FRAMEWORK" in - smf) CMD="/usr/sbin/svcadm" - ENUMERATOR="/usr/local/libexec/nut-driver-enumerator.sh" - ;; - systemd) CMD="/bin/systemctl" - ENUMERATOR="/usr/local/libexec/nut-driver-enumerator.sh" - ;; - *) echo "Unrecognized SERVICE_FRAMEWORK: $SERVICE_FRAMEWORK" >&2 ; exit ;; -esac - - -usage() { - # Note: version header differs from UPS_VERSION in binaries that - # might also have the git-version suffixed during build time - cat << EOF -Network UPS Tools - UPS driver controller ${PACKAGE_VERSION} -Starts and stops UPS drivers via system service instances, see -the $ENUMERATOR -script for more details. - -usage: $0 [OPTIONS] (start | stop | shutdown) [] - -Options: - -h display this help - -t testing mode - prints actions without doing them - -D raise debugging level - start start all UPS drivers in ups.conf - start only start driver for UPS - stop stop all UPS drivers in ups.conf - stop only stop driver for UPS - -Note: the "shutdown" options from original upsdrvctl are not currently -directly supported by this service management framework wrapper; instead -they are passed to the native upsdrvctl binary (your current user account -should have sufficient permissions to do that all): - shutdown shutdown all UPS drivers in ups.conf - shutdown only shutdown UPS - -usage: $0 [OPTIONS] resync - resync call $ENUMERATOR - to update the mapping of service instances for - NUT drivers to device sections in 'ups.conf' - -usage: $0 [OPTIONS] reconfigure - reconfigure call $ENUMERATOR - to remove and re-create the mapping of all service - instances for NUT drivers to device sections in - 'ups.conf' e.g. after a NUT package upgrade - -usage: $0 [OPTIONS] list [] - list call $ENUMERATOR - to list the mapping of service instances to device sections - list (optionally return the service instance name for one device) - -usage: $0 [OPTIONS] show-config [] - show-config output config section from ups.conf for device - show-config ...or all devices if no argument was passed -EOF -} - -ACTION="" -SVCINST="" -DRYRUN="" -DEBUG=0 -# Note: DEBUG is UNUSED_PARAM so far -while [ $# -gt 0 ]; do - case "$1" in - resync) eval $DRYRUN $ENUMERATOR ; exit $? ;; - reconf|reconfigure) eval $DRYRUN $ENUMERATOR --reconfigure ; exit $? ;; - list) - if [ -n "$2" ] ; then - eval $ENUMERATOR --get-service-for-device "$2" ; exit $? - else - eval $ENUMERATOR --list-services-for-devices ; exit $? - fi - ;; - show-config) - if [ -n "$2" ] ; then - eval $ENUMERATOR --show-device-config "$2" ; exit $? - else - eval $ENUMERATOR --show-all-configs ; exit $? - fi - ;; - start|stop) - ACTION="$1" - if [ -n "$2" ] ; then - SVCINST="`$ENUMERATOR --get-service-for-device "$2"`" || exit - shift - fi - ;; - shutdown) - echo "NOTE: Action '$1' is not implemented via services currently, will call upsdrvctl" >&2 - echo "Stopping the driver service instance(s) to release exclusive resources, if any..." >&2 - RES=0 - $0 stop $2 - /usr/local/sbin/upsdrvctl shutdown $2 || RES=$? - echo "Starting the driver service instance(s) so they can reconnect when the UPS returns..." >&2 - $0 start $2 - exit $RES - ;; - -t) DRYRUN="echo" ;; - -h) usage; exit 0 ;; - -D) DEBUG="`expr $DEBUG + 1`" ;; - -r|-u) echo "Option '$1 $2' is not implemented via services currently" >&2 ; shift;; - *) echo "Unrecognized argument: $1" >&2 ; exit ;; - esac - shift -done - -if [ -z "$ENUMERATOR" ] || [ ! -s "$ENUMERATOR" ] || [ ! -x "$ENUMERATOR" ] ; then - echo "ENUMERATOR script (nut-driver-enumerator.sh) not found!" >&2 - exit 1 -fi - -if [ -z "$ACTION" ]; then - echo "No action was requested!" >&2 - exit 1 -fi - -if [ -z "$SVCINST" ]; then - SVCINST="`$ENUMERATOR --list-services`" || exit -fi - -# TODO: Support shutdown of one or all UPSes by stopping its service -# and then calling the original upsdrvctl on it? -case "$ACTION" in - start) - VERB="Starting" - case "$SERVICE_FRAMEWORK" in - smf) CMDARG="enable -ts" ;; - systemd) CMDARG="start" ;; - esac - ;; - stop) - VERB="Stopping" - case "$SERVICE_FRAMEWORK" in - smf) CMDARG="disable -ts" ;; - systemd) CMDARG="stop" ;; - esac - ;; - *) echo "Unrecognized ACTION: $ACTION" >&2 ; exit ;; -esac - -for INST in $SVCINST ; do - echo "$VERB $INST ..." >&2 - $DRYRUN $CMD $CMDARG "$INST" & -done -wait - -case "$SERVICE_FRAMEWORK" in - smf) - sleep 1 - echo "Post-process clearing services that failed early..." >&2 - for INST in $SVCINST ; do - echo "Clearing $INST (if it got broken) ..." >&2 - $DRYRUN $CMD clear "$INST" & - done - ;; -esac - -wait diff --git a/scripts/upsdrvsvcctl/upsdrvsvcctl.in b/scripts/upsdrvsvcctl/upsdrvsvcctl.in deleted file mode 100755 index d9e127c..0000000 --- a/scripts/upsdrvsvcctl/upsdrvsvcctl.in +++ /dev/null @@ -1,196 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2016-2018 Eaton -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#! \file upsdrvsvcctl(.in) -# \author Jim Klimov -# \brief Manage NUT devices registered as service-unit instances -# - -if [ -z "${SERVICE_FRAMEWORK-}" ] ; then - [ -x /usr/sbin/svcadm ] && [ -x /usr/sbin/svccfg ] && [ -x /usr/bin/svcs ] && \ - SERVICE_FRAMEWORK="smf" - [ -z "${SERVICE_FRAMEWORK-}" ] && \ - [ -x /bin/systemctl ] && \ - SERVICE_FRAMEWORK="systemd" -fi - -VERB="" -CMD="" -CMDARG="" -ENUMERATOR="" -case "$SERVICE_FRAMEWORK" in - smf) CMD="/usr/sbin/svcadm" - ENUMERATOR="@NUT_LIBEXECDIR@/nut-driver-enumerator.sh" - ;; - systemd) CMD="/bin/systemctl" - ENUMERATOR="@NUT_LIBEXECDIR@/nut-driver-enumerator.sh" - ;; - *) echo "Unrecognized SERVICE_FRAMEWORK: $SERVICE_FRAMEWORK" >&2 ; exit ;; -esac - - -usage() { - # Note: version header differs from UPS_VERSION in binaries that - # might also have the git-version suffixed during build time - cat << EOF -Network UPS Tools - UPS driver controller ${PACKAGE_VERSION} -Starts and stops UPS drivers via system service instances, see -the $ENUMERATOR -script for more details. - -usage: $0 [OPTIONS] (start | stop | shutdown) [] - -Options: - -h display this help - -t testing mode - prints actions without doing them - -D raise debugging level - start start all UPS drivers in ups.conf - start only start driver for UPS - stop stop all UPS drivers in ups.conf - stop only stop driver for UPS - -Note: the "shutdown" options from original upsdrvctl are not currently -directly supported by this service management framework wrapper; instead -they are passed to the native upsdrvctl binary (your current user account -should have sufficient permissions to do that all): - shutdown shutdown all UPS drivers in ups.conf - shutdown only shutdown UPS - -usage: $0 [OPTIONS] resync - resync call $ENUMERATOR - to update the mapping of service instances for - NUT drivers to device sections in 'ups.conf' - -usage: $0 [OPTIONS] reconfigure - reconfigure call $ENUMERATOR - to remove and re-create the mapping of all service - instances for NUT drivers to device sections in - 'ups.conf' e.g. after a NUT package upgrade - -usage: $0 [OPTIONS] list [] - list call $ENUMERATOR - to list the mapping of service instances to device sections - list (optionally return the service instance name for one device) - -usage: $0 [OPTIONS] show-config [] - show-config output config section from ups.conf for device - show-config ...or all devices if no argument was passed -EOF -} - -ACTION="" -SVCINST="" -DRYRUN="" -DEBUG=0 -# Note: DEBUG is UNUSED_PARAM so far -while [ $# -gt 0 ]; do - case "$1" in - resync) eval $DRYRUN $ENUMERATOR ; exit $? ;; - reconf|reconfigure) eval $DRYRUN $ENUMERATOR --reconfigure ; exit $? ;; - list) - if [ -n "$2" ] ; then - eval $ENUMERATOR --get-service-for-device "$2" ; exit $? - else - eval $ENUMERATOR --list-services-for-devices ; exit $? - fi - ;; - show-config) - if [ -n "$2" ] ; then - eval $ENUMERATOR --show-device-config "$2" ; exit $? - else - eval $ENUMERATOR --show-all-configs ; exit $? - fi - ;; - start|stop) - ACTION="$1" - if [ -n "$2" ] ; then - SVCINST="`$ENUMERATOR --get-service-for-device "$2"`" || exit - shift - fi - ;; - shutdown) - echo "NOTE: Action '$1' is not implemented via services currently, will call upsdrvctl" >&2 - echo "Stopping the driver service instance(s) to release exclusive resources, if any..." >&2 - RES=0 - $0 stop $2 - @SBINDIR@/upsdrvctl shutdown $2 || RES=$? - echo "Starting the driver service instance(s) so they can reconnect when the UPS returns..." >&2 - $0 start $2 - exit $RES - ;; - -t) DRYRUN="echo" ;; - -h) usage; exit 0 ;; - -D) DEBUG="`expr $DEBUG + 1`" ;; - -r|-u) echo "Option '$1 $2' is not implemented via services currently" >&2 ; shift;; - *) echo "Unrecognized argument: $1" >&2 ; exit ;; - esac - shift -done - -if [ -z "$ENUMERATOR" ] || [ ! -s "$ENUMERATOR" ] || [ ! -x "$ENUMERATOR" ] ; then - echo "ENUMERATOR script (nut-driver-enumerator.sh) not found!" >&2 - exit 1 -fi - -if [ -z "$ACTION" ]; then - echo "No action was requested!" >&2 - exit 1 -fi - -if [ -z "$SVCINST" ]; then - SVCINST="`$ENUMERATOR --list-services`" || exit -fi - -# TODO: Support shutdown of one or all UPSes by stopping its service -# and then calling the original upsdrvctl on it? -case "$ACTION" in - start) - VERB="Starting" - case "$SERVICE_FRAMEWORK" in - smf) CMDARG="enable -ts" ;; - systemd) CMDARG="start" ;; - esac - ;; - stop) - VERB="Stopping" - case "$SERVICE_FRAMEWORK" in - smf) CMDARG="disable -ts" ;; - systemd) CMDARG="stop" ;; - esac - ;; - *) echo "Unrecognized ACTION: $ACTION" >&2 ; exit ;; -esac - -for INST in $SVCINST ; do - echo "$VERB $INST ..." >&2 - $DRYRUN $CMD $CMDARG "$INST" & -done -wait - -case "$SERVICE_FRAMEWORK" in - smf) - sleep 1 - echo "Post-process clearing services that failed early..." >&2 - for INST in $SVCINST ; do - echo "Clearing $INST (if it got broken) ..." >&2 - $DRYRUN $CMD clear "$INST" & - done - ;; -esac - -wait diff --git a/server/Makefile.am b/server/Makefile.am index 1ab6393..8146568 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -1,10 +1,5 @@ # Network UPS Tools: server -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libparseconf.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - # Avoid per-target CFLAGS, because this will prevent re-use of object # files. In any case, CFLAGS are only -I options, so there is no harm, # but only add them if we really use the target. @@ -15,7 +10,7 @@ endif if WITH_SSL AM_CFLAGS += $(LIBSSL_CFLAGS) endif -LDADD = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la $(NETLIBS) +LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) if WITH_WRAP LDADD += $(LIBWRAP_LIBS) endif @@ -33,12 +28,3 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ upstype.h user-data.h user.h sockdebug_SOURCES = sockdebug.c - -dummy: - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps diff --git a/server/Makefile.in b/server/Makefile.in index bfb217c..6ef6823 100644 --- a/server/Makefile.in +++ b/server/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,61 +18,23 @@ # Network UPS Tools: server VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -98,24 +61,19 @@ target_triplet = @target@ sbin_PROGRAMS = upsd$(EXEEXT) EXTRA_PROGRAMS = sockdebug$(EXEEXT) subdir = server +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -124,17 +82,12 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = @@ -147,62 +100,31 @@ sockdebug_LDADD = $(LDADD) am__DEPENDENCIES_1 = @WITH_WRAP_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) @WITH_SSL_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) -sockdebug_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - $(top_builddir)/common/libparseconf.la $(am__DEPENDENCIES_1) \ +sockdebug_DEPENDENCIES = ../common/libcommon.la \ + ../common/libparseconf.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = am_upsd_OBJECTS = upsd.$(OBJEXT) user.$(OBJEXT) conf.$(OBJEXT) \ netssl.$(OBJEXT) sstate.$(OBJEXT) desc.$(OBJEXT) \ netget.$(OBJEXT) netmisc.$(OBJEXT) netlist.$(OBJEXT) \ netuser.$(OBJEXT) netset.$(OBJEXT) netinstcmd.$(OBJEXT) upsd_OBJECTS = $(am_upsd_OBJECTS) upsd_LDADD = $(LDADD) -upsd_DEPENDENCIES = $(top_builddir)/common/libcommon.la \ - $(top_builddir)/common/libparseconf.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = +upsd_DEPENDENCIES = ../common/libcommon.la ../common/libparseconf.la \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ + $(am__DEPENDENCIES_3) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/conf.Po ./$(DEPDIR)/desc.Po \ - ./$(DEPDIR)/netget.Po ./$(DEPDIR)/netinstcmd.Po \ - ./$(DEPDIR)/netlist.Po ./$(DEPDIR)/netmisc.Po \ - ./$(DEPDIR)/netset.Po ./$(DEPDIR)/netssl.Po \ - ./$(DEPDIR)/netuser.Po ./$(DEPDIR)/sockdebug.Po \ - ./$(DEPDIR)/sstate.Po ./$(DEPDIR)/upsd.Po ./$(DEPDIR)/user.Po +am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ SOURCES = $(sockdebug_SOURCES) $(upsd_SOURCES) DIST_SOURCES = $(sockdebug_SOURCES) $(upsd_SOURCES) am__can_run_installinfo = \ @@ -210,35 +132,15 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -249,7 +151,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -263,7 +164,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -276,8 +176,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -287,15 +190,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -306,29 +208,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -348,9 +242,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -359,16 +250,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -382,7 +269,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -393,12 +279,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -417,21 +299,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -446,8 +325,7 @@ udevdir = @udevdir@ # files. In any case, CFLAGS are only -I options, so there is no harm, # but only add them if we really use the target. AM_CFLAGS = -I$(top_srcdir)/include $(am__append_1) $(am__append_2) -LDADD = $(top_builddir)/common/libcommon.la \ - $(top_builddir)/common/libparseconf.la $(NETLIBS) \ +LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) \ $(am__append_3) $(am__append_4) upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ netget.c netmisc.c netlist.c netuser.c netset.c netinstcmd.c \ @@ -456,7 +334,6 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ upstype.h user-data.h user.h sockdebug_SOURCES = sockdebug.c -MAINTAINERCLEANFILES = Makefile.in .dirstamp all: all-am .SUFFIXES: @@ -473,13 +350,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu server/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu server/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -499,12 +377,10 @@ install-sbinPROGRAMS: $(sbin_PROGRAMS) fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ @@ -525,8 +401,7 @@ uninstall-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ + -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files @@ -539,14 +414,12 @@ clean-sbinPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - sockdebug$(EXEEXT): $(sockdebug_OBJECTS) $(sockdebug_DEPENDENCIES) $(EXTRA_sockdebug_DEPENDENCIES) @rm -f sockdebug$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(sockdebug_OBJECTS) $(sockdebug_LDADD) $(LIBS) - + $(LINK) $(sockdebug_OBJECTS) $(sockdebug_LDADD) $(LIBS) upsd$(EXEEXT): $(upsd_OBJECTS) $(upsd_DEPENDENCIES) $(EXTRA_upsd_DEPENDENCIES) @rm -f upsd$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(upsd_OBJECTS) $(upsd_LDADD) $(LIBS) + $(LINK) $(upsd_OBJECTS) $(upsd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -554,49 +427,40 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desc.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netget.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netinstcmd.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netmisc.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netset.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netssl.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netuser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockdebug.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sstate.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsd.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/conf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/desc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netinstcmd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netlist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netmisc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netssl.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/netuser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sockdebug.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sstate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/upsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/user.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -604,15 +468,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -624,11 +499,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -637,29 +516,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -726,26 +587,13 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-generic clean-libtool clean-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/conf.Po - -rm -f ./$(DEPDIR)/desc.Po - -rm -f ./$(DEPDIR)/netget.Po - -rm -f ./$(DEPDIR)/netinstcmd.Po - -rm -f ./$(DEPDIR)/netlist.Po - -rm -f ./$(DEPDIR)/netmisc.Po - -rm -f ./$(DEPDIR)/netset.Po - -rm -f ./$(DEPDIR)/netssl.Po - -rm -f ./$(DEPDIR)/netuser.Po - -rm -f ./$(DEPDIR)/sockdebug.Po - -rm -f ./$(DEPDIR)/sstate.Po - -rm -f ./$(DEPDIR)/upsd.Po - -rm -f ./$(DEPDIR)/user.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -791,19 +639,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/conf.Po - -rm -f ./$(DEPDIR)/desc.Po - -rm -f ./$(DEPDIR)/netget.Po - -rm -f ./$(DEPDIR)/netinstcmd.Po - -rm -f ./$(DEPDIR)/netlist.Po - -rm -f ./$(DEPDIR)/netmisc.Po - -rm -f ./$(DEPDIR)/netset.Po - -rm -f ./$(DEPDIR)/netssl.Po - -rm -f ./$(DEPDIR)/netuser.Po - -rm -f ./$(DEPDIR)/sockdebug.Po - -rm -f ./$(DEPDIR)/sstate.Po - -rm -f ./$(DEPDIR)/upsd.Po - -rm -f ./$(DEPDIR)/user.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -824,34 +660,20 @@ uninstall-am: uninstall-sbinPROGRAMS .MAKE: install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-generic clean-libtool clean-sbinPROGRAMS cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-sbinPROGRAMS install-strip \ - installcheck installcheck-am installdirs maintainer-clean \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-sbinPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-sbinPROGRAMS install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-sbinPROGRAMS + tags uninstall uninstall-am uninstall-sbinPROGRAMS -.PRECIOUS: Makefile - - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la \ -$(top_builddir)/common/libparseconf.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dummy: - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/server/conf.c b/server/conf.c index 3dd2696..aea8220 100644 --- a/server/conf.c +++ b/server/conf.c @@ -23,19 +23,9 @@ #include "sstate.h" #include "user.h" #include "netssl.h" -#include "nut_stdint.h" -#include -static ups_t *upstable = NULL; -int num_ups = 0; - -/* Users can pass a -D[...] option to enable debugging. - * For the service tracing purposes, also the upsd.conf - * can define a debug_min value in the global section, - * to set the minimal debug level (CLI provided value less - * than that would not have effect, can only have more). - */ -int nut_debug_level_global = -1; + ups_t *upstable = NULL; + int num_ups = 0; /* add another UPS for monitoring from ups.conf */ static void ups_create(const char *fn, const char *name, const char *desc) @@ -120,91 +110,25 @@ static void ups_update(const char *fn, const char *name, const char *desc) /* always set this on reload */ temp->retain = 1; -} - -/* returns 1 if "arg" was usable as a boolean value, 0 if not - * saves converted meaning of "arg" into referenced "result" - */ -static int parse_boolean(char *arg, int *result) -{ - if ( (!strcasecmp(arg, "true")) || (!strcasecmp(arg, "on")) || (!strcasecmp(arg, "yes")) || (!strcasecmp(arg, "1"))) { - *result = 1; - return 1; - } - if ( (!strcasecmp(arg, "false")) || (!strcasecmp(arg, "off")) || (!strcasecmp(arg, "no")) || (!strcasecmp(arg, "0"))) { - *result = 0; - return 1; - } - return 0; -} +} /* return 1 if usable, 0 if not */ -static int parse_upsd_conf_args(size_t numargs, char **arg) +static int parse_upsd_conf_args(int numargs, char **arg) { /* everything below here uses up through arg[1] */ if (numargs < 2) return 0; - /* DEBUG_MIN (NUM) */ - /* debug_min (NUM) also acceptable, to be on par with ups.conf */ - if (!strcasecmp(arg[0], "DEBUG_MIN")) { - int lvl = -1; // typeof common/common.c: int nut_debug_level - if ( str_to_int (arg[1], &lvl, 10) && lvl >= 0 ) { - nut_debug_level_global = lvl; - } else { - upslogx(LOG_INFO, "DEBUG_MIN has non numeric or negative value in upsd.conf"); - } - return 1; - } - /* MAXAGE */ if (!strcmp(arg[0], "MAXAGE")) { - if (isdigit((size_t)arg[1][0])) { - maxage = atoi(arg[1]); - return 1; - } - else { - upslogx(LOG_ERR, "MAXAGE has non numeric value (%s)!", arg[1]); - return 0; - } - } - - /* TRACKINGDELAY */ - if (!strcmp(arg[0], "TRACKINGDELAY")) { - if (isdigit((size_t)arg[1][0])) { - tracking_delay = atoi(arg[1]); - return 1; - } - else { - upslogx(LOG_ERR, "TRACKINGDELAY has non numeric value (%s)!", arg[1]); - return 0; - } - } - - /* ALLOW_NO_DEVICE */ - if (!strcmp(arg[0], "ALLOW_NO_DEVICE")) { - if (isdigit((size_t)arg[1][0])) { - allow_no_device = (atoi(arg[1]) != 0); /* non-zero arg is true here */ - return 1; - } - if (parse_boolean(arg[1], &allow_no_device)) - return 1; - - upslogx(LOG_ERR, "ALLOW_NO_DEVICE has non numeric and non boolean value (%s)!", arg[1]); - return 0; + maxage = atoi(arg[1]); + return 1; } /* MAXCONN */ if (!strcmp(arg[0], "MAXCONN")) { - if (isdigit((size_t)arg[1][0])) { - /* FIXME: Check for overflows (and int size of nfds_t vs. long) - see get_max_pid_t() for example */ - maxconn = (nfds_t)atol(arg[1]); - return 1; - } - else { - upslogx(LOG_ERR, "MAXCONN has non numeric value (%s)!", arg[1]); - return 0; - } + maxconn = atoi(arg[1]); + return 1; } /* STATEPATH */ @@ -238,29 +162,12 @@ static int parse_upsd_conf_args(size_t numargs, char **arg) #ifdef WITH_CLIENT_CERTIFICATE_VALIDATION /* CERTREQUEST (0 | 1 | 2) */ if (!strcmp(arg[0], "CERTREQUEST")) { - if (isdigit((size_t)arg[1][0])) { - certrequest = atoi(arg[1]); - return 1; - } - else { - upslogx(LOG_ERR, "CERTREQUEST has non numeric value (%s)!", arg[1]); - return 0; - } + certrequest = atoi(arg[1]); + return 1; } #endif /* WITH_CLIENT_CERTIFICATE_VALIDATION */ #endif /* WITH_OPENSSL | WITH_NSS */ - -#if defined(WITH_OPENSSL) || defined(WITH_NSS) - /* DISABLE_WEAK_SSL */ - if (!strcmp(arg[0], "DISABLE_WEAK_SSL")) { - if (parse_boolean(arg[1], &disable_weak_ssl)) - return 1; - - upslogx(LOG_ERR, "DISABLE_WEAK_SSL has non boolean value (%s)!", arg[1]); - return 0; - } -#endif /* WITH_OPENSSL | WITH_NSS */ - + /* ACCEPT [...] */ if (!strcmp(arg[0], "ACCEPT")) { upslogx(LOG_WARNING, "ACCEPT in upsd.conf is no longer supported - switch to LISTEN"); @@ -291,7 +198,7 @@ static int parse_upsd_conf_args(size_t numargs, char **arg) upslogx(LOG_WARNING, "ACL in upsd.conf is no longer supported - switch to LISTEN"); return 1; } - + #ifdef WITH_NSS /* CERTIDENT */ if (!strcmp(arg[0], "CERTIDENT")) { @@ -334,13 +241,6 @@ void load_upsdconf(int reloading) return; } - if (reloading) { - /* if upsd.conf added or changed - * (or commented away) the debug_min - * setting, detect that */ - nut_debug_level_global = -1; - } - while (pconf_file_next(&ctx)) { if (pconf_parse_error(&ctx)) { upslogx(LOG_ERR, "Parse error: %s:%d: %s", @@ -355,11 +255,11 @@ void load_upsdconf(int reloading) unsigned int i; char errmsg[SMALLBUF]; - snprintf(errmsg, sizeof(errmsg), + snprintf(errmsg, sizeof(errmsg), "upsd.conf: invalid directive"); for (i = 0; i < ctx.numargs; i++) - snprintfcat(errmsg, sizeof(errmsg), " %s", + snprintfcat(errmsg, sizeof(errmsg), " %s", ctx.arglist[i]); upslogx(LOG_WARNING, "%s", errmsg); @@ -367,16 +267,7 @@ void load_upsdconf(int reloading) } - if (reloading) { - if (nut_debug_level_global > -1) { - upslogx(LOG_INFO, - "Applying debug_min=%d from upsd.conf", - nut_debug_level_global); - nut_debug_level = nut_debug_level_global; - } - } - - pconf_finish(&ctx); + pconf_finish(&ctx); } /* callback during parsing of ups.conf */ @@ -440,7 +331,7 @@ void upsconf_add(int reloading) /* don't accept an entry that's missing items */ if ((!tmp->driver) || (!tmp->port)) { - upslogx(LOG_WARNING, "Warning: ignoring incomplete configuration for UPS [%s]\n", + upslogx(LOG_WARNING, "Warning: ignoring incomplete configuration for UPS [%s]\n", tmp->upsname); } else { snprintf(statefn, sizeof(statefn), "%s-%s", @@ -513,7 +404,7 @@ static void delete_ups(upstype_t *target) /* shouldn't happen */ upslogx(LOG_ERR, "delete_ups: UPS not found"); -} +} /* see if we can open a file */ static int check_file(const char *fn) diff --git a/server/conf.h b/server/conf.h index 432b7f9..e6b207a 100644 --- a/server/conf.h +++ b/server/conf.h @@ -3,7 +3,6 @@ Copyright (C) 2001 Russell Kroll 2008 Arjen de Korte - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,9 +19,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_CONF_H_SEEN -#define NUT_CONF_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -51,7 +47,6 @@ void delete_acls(void); void delete_access(void); extern int num_ups; -extern int nut_debug_level_global; #ifdef __cplusplus /* *INDENT-OFF* */ @@ -59,4 +54,3 @@ extern int nut_debug_level_global; /* *INDENT-ON* */ #endif -#endif /* NUT_CONF_H_SEEN */ diff --git a/server/desc.c b/server/desc.c index e6b08f0..b74df72 100644 --- a/server/desc.c +++ b/server/desc.c @@ -17,8 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include "common.h" diff --git a/server/desc.h b/server/desc.h index a574831..00b413d 100644 --- a/server/desc.h +++ b/server/desc.h @@ -1,28 +1,3 @@ -/* desc.h - variable/command description handling for upsd - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_DESC_H_SEEN -#define NUT_DESC_H_SEEN 1 #ifdef __cplusplus /* *INDENT-OFF* */ @@ -41,4 +16,3 @@ const char *desc_get_var(const char *name); /* *INDENT-ON* */ #endif -#endif /* NUT_DESC_H_SEEN */ diff --git a/server/netcmds.h b/server/netcmds.h index 6a5a632..20bc464 100644 --- a/server/netcmds.h +++ b/server/netcmds.h @@ -1,11 +1,6 @@ /* netcmds.h - upsd support structure details Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2010 Arjen de Korte - 2012 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_NETCMDS_H_SEEN -#define NUT_NETCMDS_H_SEEN 1 - #include "nut_ctype.h" #include "netssl.h" @@ -43,14 +35,13 @@ extern "C" { /* *INDENT-ON* */ #endif -static struct { +struct { const char *name; - void (*func)(nut_ctype_t *client, size_t numargs, const char **arg); + void (*func)(nut_ctype_t *client, int numargs, const char **arg); int flags; } netcmds[] = { { "VER", net_ver, 0 }, { "NETVER", net_netver, 0 }, - { "PROTVER", net_netver, 0 }, /* aliased since NUT 2.8.0 */ { "HELP", net_help, 0 }, { "STARTTLS", net_starttls, 0 }, @@ -62,10 +53,6 @@ static struct { { "LOGIN", net_login, FLAG_USER }, { "LOGOUT", net_logout, 0 }, - /* NOTE: Protocol in NUT 2.8.0 allows to handle - * master/primary to rename/alias the routine. - */ - { "PRIMARY", net_primary, FLAG_USER }, { "MASTER", net_master, FLAG_USER }, { "FSD", net_fsd, FLAG_USER }, @@ -73,7 +60,7 @@ static struct { { "SET", net_set, FLAG_USER }, { "INSTCMD", net_instcmd, FLAG_USER }, - { NULL, (void(*)(struct nut_ctype_s *, size_t, const char **))(NULL), 0 } + { NULL, (void(*)())(NULL), 0 } }; #ifdef __cplusplus @@ -82,4 +69,3 @@ static struct { /* *INDENT-ON* */ #endif -#endif /* NUT_NETCMDS_H_SEEN */ diff --git a/server/neterr.h b/server/neterr.h index 3891452..0be8b83 100644 --- a/server/neterr.h +++ b/server/neterr.h @@ -1,35 +1,3 @@ -/* neterr.h - network error definitions for NUT - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETERR_H_SEEN -#define NUT_NETERR_H_SEEN 1 - -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - /* network error definitions for consistency */ #define NUT_ERR_ACCESS_DENIED "ACCESS-DENIED" @@ -65,11 +33,3 @@ extern "C" { #define NUT_ERR_UNKNOWN_INSTCMD "UNKNOWN-INSTCMD" #define NUT_ERR_MISSING_ARGUMENT "MISSING-ARGUMENT" #define NUT_ERR_INVALID_VALUE "INVALID-VALUE" - -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - -#endif /* NUT_NETERR_H_SEEN */ diff --git a/server/netget.c b/server/netget.c index a5f822a..9d6cf08 100644 --- a/server/netget.c +++ b/server/netget.c @@ -109,7 +109,7 @@ static void get_cmddesc(nut_ctype_t *client, const char *upsname, const char *cm if (desc) sendback(client, "CMDDESC %s %s \"%s\"\n", upsname, cmd, desc); else - sendback(client, "CMDDESC %s %s \"Description unavailable\"\n", + sendback(client, "CMDDESC %s %s \"Description unavailable\"\n", upsname, cmd); } @@ -142,36 +142,37 @@ static void get_type(nut_ctype_t *client, const char *upsname, const char *var) snprintfcat(buf, sizeof(buf), " RW"); if (node->enum_list) { - snprintfcat(buf, sizeof(buf), " ENUM"); - } - - if (node->range_list) { - snprintfcat(buf, sizeof(buf), " RANGE"); - } - - if (node->flags & ST_FLAG_STRING) { - sendback(client, "%s STRING:%ld\n", buf, node->aux); + sendback(client, "%s ENUM\n", buf); return; } - /* Any variable that is not string | range | enum is just a simple - * numeric value */ + if (node->range_list) { + sendback(client, "%s RANGE\n", buf); + return; + } - sendback(client, "%s NUMBER\n", buf); -} + if (node->flags & ST_FLAG_STRING) { + sendback(client, "%s STRING:%d\n", buf, node->aux); + return; + } + + /* hmm... */ + + sendback(client, "TYPE %s %s UNKNOWN\n", upsname, var); +} static void get_var_server(nut_ctype_t *client, const char *upsname, const char *var) { if (!strcasecmp(var, "server.info")) { sendback(client, "VAR %s server.info " "\"Network UPS Tools upsd %s - " - "http://www.networkupstools.org/\"\n", + "http://www.networkupstools.org/\"\n", upsname, UPS_VERSION); return; } if (!strcasecmp(var, "server.version")) { - sendback(client, "VAR %s server.version \"%s\"\n", + sendback(client, "VAR %s server.version \"%s\"\n", upsname, UPS_VERSION); return; } @@ -214,27 +215,8 @@ static void get_var(nut_ctype_t *client, const char *upsname, const char *var) sendback(client, "VAR %s %s \"%s\"\n", upsname, var, val); } -void net_get(nut_ctype_t *client, size_t numarg, const char **arg) +void net_get(nut_ctype_t *client, int numarg, const char **arg) { - if (numarg < 1) { - send_err(client, NUT_ERR_INVALID_ARGUMENT); - return; - } - - /* GET TRACKING [ID] */ - if (!strcasecmp(arg[0], "TRACKING")) { - if (numarg < 2) { - sendback(client, "%s\n", (client->tracking) ? "ON" : "OFF"); - } - else { - if (client->tracking) - sendback(client, "%s\n", tracking_get(arg[1])); - else - send_err(client, NUT_ERR_FEATURE_NOT_CONFIGURED); - } - return; - } - if (numarg < 2) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; diff --git a/server/netget.h b/server/netget.h index 4ccfd7b..eb98b99 100644 --- a/server/netget.h +++ b/server/netget.h @@ -1,37 +1,10 @@ -/* netget.h - GET handlers for upsd - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETGET_H_SEEN -#define NUT_NETGET_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_get(nut_ctype_t *client, size_t numarg, const char **arg); +void net_get(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -39,4 +12,3 @@ void net_get(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETGET_H_SEEN */ diff --git a/server/netinstcmd.c b/server/netinstcmd.c index 00923c4..c21d7ec 100644 --- a/server/netinstcmd.c +++ b/server/netinstcmd.c @@ -28,10 +28,10 @@ #include "netinstcmd.h" -static void send_instcmd(nut_ctype_t *client, const char *upsname, - const char *cmdname, const char *value, const char *tracking_id) +static void send_instcmd(nut_ctype_t *client, const char *upsname, + const char *cmdname, const char *value) { - int found, have_tracking_id = 0; + int found; upstype_t *ups; const cmdlist_t *ctmp; char sockcmd[SMALLBUF], esc[SMALLBUF]; @@ -70,30 +70,20 @@ static void send_instcmd(nut_ctype_t *client, const char *upsname, return; } - /* Format the base command */ - snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s", cmdname); - /* see if the user has also passed a value for this command */ - if (value != NULL) - snprintfcat(sockcmd, sizeof(sockcmd), " %s", pconf_encode(value, esc, sizeof(esc))); + if (value != NULL) { + upslogx(LOG_INFO, "Instant command: %s@%s did %s with value \"%s\" on %s", + client->username, client->addr, cmdname, value, ups->name); - /* see if the user want execution tracking for this command */ - if (tracking_id && *tracking_id) { - snprintfcat(sockcmd, sizeof(sockcmd), " TRACKING %s", tracking_id); - /* Add an entry in the tracking structure */ - tracking_add(tracking_id); - have_tracking_id = 1; + snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s %s\n", + cmdname, pconf_encode(value, esc, sizeof(esc))); } + else { + upslogx(LOG_INFO, "Instant command: %s@%s did %s on %s", + client->username, client->addr, cmdname, ups->name); - /* add EOL */ - snprintfcat(sockcmd, sizeof(sockcmd), "\n"); - - upslogx(LOG_INFO, "Instant command: %s@%s did %s%s%s on %s (tracking ID: %s)", - client->username, client->addr, cmdname, - (value != NULL)?" with value ":"", - (value != NULL)?value:"", - ups->name, - (have_tracking_id) ? tracking_id : "disabled"); + snprintf(sockcmd, sizeof(sockcmd), "INSTCMD %s\n", cmdname); + } if (!sstate_sendline(ups, sockcmd)) { upslogx(LOG_INFO, "Set command send failed"); @@ -101,38 +91,18 @@ static void send_instcmd(nut_ctype_t *client, const char *upsname, return; } - /* return the result, possibly including tracking_id */ - if (have_tracking_id) - sendback(client, "OK TRACKING %s\n", tracking_id); - else - sendback(client, "OK\n"); + /* FIXME: need to retrieve the cookie number */ + sendback(client, "OK\n"); } -void net_instcmd(nut_ctype_t *client, size_t numarg, const char **arg) +void net_instcmd(nut_ctype_t *client, int numarg, const char **arg) { - const char *devname = NULL; - const char *cmdname = NULL; - const char *cmdparam = NULL; - char tracking_id[UUID4_LEN] = ""; - if (numarg < 2) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; } - - /* INSTCMD [cmdparam] */ - /* Check arguments */ - devname = arg[0]; - cmdname = arg[1]; - if (numarg == 3) - cmdparam = arg[2]; - - if (client->tracking) { - /* Generate a tracking ID, if client requested status tracking */ - nut_uuid_v4(tracking_id); - } - - send_instcmd(client, devname, cmdname, cmdparam, tracking_id); - + + /* INSTCMD []*/ + send_instcmd(client, arg[0], arg[1], (numarg == 3)?arg[2]:NULL); return; } diff --git a/server/netinstcmd.h b/server/netinstcmd.h index 2814ecb..d8ef7e2 100644 --- a/server/netinstcmd.h +++ b/server/netinstcmd.h @@ -1,37 +1,10 @@ -/* netinstcmd.h - network instand command definitions for NUT - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETINSTCMD_H_SEEN -#define NUT_NETINSTCMD_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_instcmd(nut_ctype_t *client, size_t numarg, const char **arg); +void net_instcmd(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -39,4 +12,3 @@ void net_instcmd(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETINSTCMD_H_SEEN */ diff --git a/server/netlist.c b/server/netlist.c index d480eb1..91f7831 100644 --- a/server/netlist.c +++ b/server/netlist.c @@ -52,7 +52,7 @@ static int tree_dump(st_tree_t *node, nut_ctype_t *client, const char *ups, if (node->flags & ST_FLAG_RW) { ret = sendback(client, "RW %s %s \"%s\"\n", ups, node->var, node->val); - + } else { ret = 1; /* dummy */ } @@ -220,7 +220,7 @@ static void list_range(nut_ctype_t *client, const char *upsname, const char *var return; } - sendback(client, "END LIST RANGE %s %s\n", upsname, var); + sendback(client, "END LIST ENUM %s %s\n", upsname, var); } static void list_ups(nut_ctype_t *client) @@ -240,7 +240,7 @@ static void list_ups(nut_ctype_t *client) pconf_encode(utmp->desc, esc, sizeof(esc)); ret = sendback(client, "UPS %s \"%s\"\n", utmp->name, esc); - + } else { ret = sendback(client, "UPS %s \"Description unavailable\"\n", utmp->name); @@ -253,7 +253,7 @@ static void list_ups(nut_ctype_t *client) } sendback(client, "END LIST UPS\n"); -} +} static void list_clients(nut_ctype_t *client, const char *upsname) { @@ -285,7 +285,7 @@ static void list_clients(nut_ctype_t *client, const char *upsname) sendback(client, "END LIST CLIENT %s\n", upsname); } -void net_list(nut_ctype_t *client, size_t numarg, const char **arg) +void net_list(nut_ctype_t *client, int numarg, const char **arg) { if (numarg < 1) { send_err(client, NUT_ERR_INVALID_ARGUMENT); diff --git a/server/netlist.h b/server/netlist.h index 072dc94..535af2a 100644 --- a/server/netlist.h +++ b/server/netlist.h @@ -1,37 +1,10 @@ -/* netlist.h - LIST handlers for upsd - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETLIST_H_SEEN -#define NUT_NETLIST_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_list(nut_ctype_t *client, size_t numarg, const char **arg); +void net_list(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -39,4 +12,3 @@ void net_list(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETLIST_H_SEEN */ diff --git a/server/netmisc.c b/server/netmisc.c index 106d828..3863ae5 100644 --- a/server/netmisc.c +++ b/server/netmisc.c @@ -22,16 +22,15 @@ #include "common.h" #include "upsd.h" -#include "sstate.h" +#include "sstate.h" #include "state.h" #include "user.h" /* for user_checkaction */ #include "neterr.h" #include "netmisc.h" -void net_ver(nut_ctype_t *client, size_t numarg, const char **arg) +void net_ver(nut_ctype_t *client, int numarg, const char **arg) { - NUT_UNUSED_VARIABLE(arg); if (numarg != 0) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; @@ -41,9 +40,8 @@ void net_ver(nut_ctype_t *client, size_t numarg, const char **arg) UPS_VERSION); } -void net_netver(nut_ctype_t *client, size_t numarg, const char **arg) +void net_netver(nut_ctype_t *client, int numarg, const char **arg) { - NUT_UNUSED_VARIABLE(arg); if (numarg != 0) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; @@ -52,9 +50,8 @@ void net_netver(nut_ctype_t *client, size_t numarg, const char **arg) sendback(client, "%s\n", NUT_NETVERSION); } -void net_help(nut_ctype_t *client, size_t numarg, const char **arg) +void net_help(nut_ctype_t *client, int numarg, const char **arg) { - NUT_UNUSED_VARIABLE(arg); if (numarg != 0) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; @@ -64,7 +61,7 @@ void net_help(nut_ctype_t *client, size_t numarg, const char **arg) " USERNAME PASSWORD STARTTLS\n"); } -void net_fsd(nut_ctype_t *client, size_t numarg, const char **arg) +void net_fsd(nut_ctype_t *client, int numarg, const char **arg) { upstype_t *ups; @@ -80,13 +77,13 @@ void net_fsd(nut_ctype_t *client, size_t numarg, const char **arg) return; } - /* make sure this user is allowed to do FSD */ + /* make sure this user is allowed to do FSD */ if (!user_checkaction(client->username, client->password, "FSD")) { send_err(client, NUT_ERR_ACCESS_DENIED); return; } - upslogx(LOG_INFO, "Client %s@%s set FSD on UPS [%s]", + upslogx(LOG_INFO, "Client %s@%s set FSD on UPS [%s]", client->username, client->addr, ups->name); ups->fsd = 1; diff --git a/server/netmisc.h b/server/netmisc.h index 8513190..7e69c38 100644 --- a/server/netmisc.h +++ b/server/netmisc.h @@ -1,40 +1,13 @@ -/* netmisc.h - miscellaneous network handlers for upsd (VER, HELP, FSD) - - Copyright (C) - 2003 Russell Kroll - 2007 Peter Selinger - 2012 Arnaud Quette - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETMISC_H_SEEN -#define NUT_NETMISC_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_ver(nut_ctype_t *client, size_t numarg, const char **arg); -void net_netver(nut_ctype_t *client, size_t numarg, const char **arg); -void net_help(nut_ctype_t *client, size_t numarg, const char **arg); -void net_fsd(nut_ctype_t *client, size_t numarg, const char **arg); +void net_ver(nut_ctype_t *client, int numarg, const char **arg); +void net_netver(nut_ctype_t *client, int numarg, const char **arg); +void net_help(nut_ctype_t *client, int numarg, const char **arg); +void net_fsd(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -42,4 +15,3 @@ void net_fsd(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETMISC_H_SEEN */ diff --git a/server/netset.c b/server/netset.c index 1e185b8..b88bb40 100644 --- a/server/netset.c +++ b/server/netset.c @@ -28,14 +28,13 @@ #include "netset.h" static void set_var(nut_ctype_t *client, const char *upsname, const char *var, - const char *newval, const char *tracking_id) + const char *newval) { upstype_t *ups; const char *val; const enum_t *etmp; const range_t *rtmp; char cmd[SMALLBUF], esc[SMALLBUF]; - int have_tracking_id = 0; ups = get_ups_ptr(upsname); @@ -69,7 +68,7 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var, /* see if the new value is allowed for this variable */ if (sstate_getflags(ups, var) & ST_FLAG_STRING) { - long aux; + int aux; aux = sstate_getaux(ups, var); @@ -82,10 +81,6 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var, return; } - /* FIXME? Should this cast to "long"? - * An int-size string is quite a lot already, - * even on architectures with a moderate INTMAX - */ if (aux < (int) strlen(newval)) { send_err(client, NUT_ERR_TOO_LONG); return; @@ -139,92 +134,31 @@ static void set_var(nut_ctype_t *client, const char *upsname, const char *var, /* must be OK now */ - snprintf(cmd, sizeof(cmd), "SET %s \"%s\"", + upslogx(LOG_INFO, "Set variable: %s@%s set %s on %s to %s", + client->username, client->addr, var, ups->name, newval); + + snprintf(cmd, sizeof(cmd), "SET %s \"%s\"\n", var, pconf_encode(newval, esc, sizeof(esc))); - /* see if the user want execution tracking for this command */ - if (tracking_id && *tracking_id) { - snprintfcat(cmd, sizeof(cmd), " TRACKING %s", tracking_id); - /* Add an entry in the tracking structure */ - tracking_add(tracking_id); - have_tracking_id = 1; - } - - /* add EOL */ - snprintfcat(cmd, sizeof(cmd), "\n"); - - upslogx(LOG_INFO, "Set variable: %s@%s set %s on %s to %s (tracking ID: %s)", - client->username, client->addr, var, ups->name, newval, - (have_tracking_id) ? tracking_id : "disabled"); - if (!sstate_sendline(ups, cmd)) { upslogx(LOG_INFO, "Set command send failed"); send_err(client, NUT_ERR_SET_FAILED); return; } - /* return the result, possibly including tracking_id */ - if (have_tracking_id) - sendback(client, "OK TRACKING %s\n", tracking_id); - else - sendback(client, "OK\n"); + sendback(client, "OK\n"); } -void net_set(nut_ctype_t *client, size_t numarg, const char **arg) +void net_set(nut_ctype_t *client, int numarg, const char **arg) { - char tracking_id[UUID4_LEN] = ""; - - /* Base verification, to ensure that we have at least the SET parameter */ - if (numarg < 2) { + if (numarg < 4) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; } /* SET VAR UPS VARNAME VALUE */ if (!strcasecmp(arg[0], "VAR")) { - if (numarg < 4) { - send_err(client, NUT_ERR_INVALID_ARGUMENT); - return; - } - - if (client->tracking) { - /* Generate a tracking ID, if client requested status tracking */ - nut_uuid_v4(tracking_id); - } - - set_var(client, arg[1], arg[2], arg[3], tracking_id); - - return; - } - - /* SET TRACKING VALUE */ - if (!strcasecmp(arg[0], "TRACKING")) { - if (!strcasecmp(arg[1], "ON")) { - /* general enablement along with for this client */ - client->tracking = tracking_enable(); - } - else if (!strcasecmp(arg[1], "OFF")) { - /* disable status tracking for this client first */ - client->tracking = 0; - /* then only disable the general one if no other clients use it! - * Note: don't call tracking_free() since we want info to - * persist, and tracking_cleanup() takes care of cleaning */ - if (tracking_disable()) { - upsdebugx(2, "%s: TRACKING disabled for one client, more remain.", __func__); - } else { - upsdebugx(2, "%s: TRACKING disabled for last client.", __func__); - } - } - else { - send_err(client, NUT_ERR_INVALID_ARGUMENT); - return; - } - upsdebugx(1, "%s: TRACKING general %s, client %s.", __func__, - tracking_is_enabled() ? "enabled" : "disabled", - client->tracking ? "enabled" : "disabled"); - - sendback(client, "OK\n"); - + set_var(client, arg[1], arg[2], arg[3]); return; } diff --git a/server/netset.h b/server/netset.h index 1306126..afcde0f 100644 --- a/server/netset.h +++ b/server/netset.h @@ -1,37 +1,10 @@ -/* netset.h - SET handler for upsd - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2013 Emilien Kia - 2020 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETSET_H_SEEN -#define NUT_NETSET_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_set(nut_ctype_t *client, size_t numarg, const char **arg); +void net_set(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -39,4 +12,3 @@ void net_set(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETSET_H_SEEN */ diff --git a/server/netssl.c b/server/netssl.c index 6360117..cbf0c7e 100644 --- a/server/netssl.c +++ b/server/netssl.c @@ -30,35 +30,21 @@ #include "upsd.h" #include "neterr.h" #include "netssl.h" -#include "nut_stdint.h" #ifdef WITH_NSS #include #include #include -#if defined(NSS_VMAJOR) && (NSS_VMAJOR > 3 || (NSS_VMAJOR == 3 && defined(NSS_VMINOR) && NSS_VMINOR >= 39)) - #include - #include -#else #include #include -#endif /* NSS before 3.39 */ #include #include - #include #endif /* WITH_NSS */ char *certfile = NULL; char *certname = NULL; char *certpasswd = NULL; -/* Warning: in this release of NUT, this feature is disabled by default - * in order to retain compatibility with "least surprise" for earlier - * existing deployments. Over time it can become enabled by default. - * See upsd.conf option DISABLE_WEAK_SSL to toggle this in-vivo. - */ -int disable_weak_ssl = 0; - #ifdef WITH_CLIENT_CERTIFICATE_VALIDATION int certrequest = 0; #endif /* WITH_CLIENT_CERTIFICATE_VALIDATION */ @@ -68,32 +54,20 @@ static int ssl_initialized = 0; #ifndef WITH_SSL /* stubs for non-ssl compiles */ -void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) +void net_starttls(nut_ctype_t *client, int numarg, const char **arg) { - NUT_UNUSED_VARIABLE(client); - NUT_UNUSED_VARIABLE(numarg); - NUT_UNUSED_VARIABLE(arg); - send_err(client, NUT_ERR_FEATURE_NOT_SUPPORTED); return; } -ssize_t ssl_write(nut_ctype_t *client, const char *buf, size_t buflen) +int ssl_write(nut_ctype_t *client, const char *buf, size_t buflen) { - NUT_UNUSED_VARIABLE(client); - NUT_UNUSED_VARIABLE(buf); - NUT_UNUSED_VARIABLE(buflen); - upslogx(LOG_ERR, "ssl_write called but SSL wasn't compiled in"); return -1; } -ssize_t ssl_read(nut_ctype_t *client, char *buf, size_t buflen) +int ssl_read(nut_ctype_t *client, char *buf, size_t buflen) { - NUT_UNUSED_VARIABLE(client); - NUT_UNUSED_VARIABLE(buf); - NUT_UNUSED_VARIABLE(buflen); - upslogx(LOG_ERR, "ssl_read called but SSL wasn't compiled in"); return -1; } @@ -122,7 +96,7 @@ static SSL_CTX *ssl_ctx = NULL; static void ssl_debug(void) { - unsigned long e; + int e; char errmsg[SMALLBUF]; while ((e = ERR_get_error()) != 0) { @@ -131,36 +105,32 @@ static void ssl_debug(void) } } -static int ssl_error(SSL *ssl, ssize_t ret) +static int ssl_error(SSL *ssl, int ret) { int e; - if (ret >= INT_MAX) { - upslogx(LOG_ERR, "ssl_error() ret=%zd would not fit in an int", ret); - return -1; - } - e = SSL_get_error(ssl, (int)ret); + e = SSL_get_error(ssl, ret); switch (e) { case SSL_ERROR_WANT_READ: - upsdebugx(1, "ssl_error() ret=%zd SSL_ERROR_WANT_READ", ret); + upsdebugx(1, "ssl_error() ret=%d SSL_ERROR_WANT_READ", ret); break; case SSL_ERROR_WANT_WRITE: - upsdebugx(1, "ssl_error() ret=%zd SSL_ERROR_WANT_WRITE", ret); + upsdebugx(1, "ssl_error() ret=%d SSL_ERROR_WANT_WRITE", ret); break; case SSL_ERROR_SYSCALL: if (ret == 0 && ERR_peek_error() == 0) { upsdebugx(1, "ssl_error() EOF from client"); } else { - upsdebugx(1, "ssl_error() ret=%zd SSL_ERROR_SYSCALL", ret); + upsdebugx(1, "ssl_error() ret=%d SSL_ERROR_SYSCALL", ret); } break; default: - upsdebugx(1, "ssl_error() ret=%zd SSL_ERROR %d", ret, e); + upsdebugx(1, "ssl_error() ret=%d SSL_ERROR %d", ret, e); ssl_debug(); } @@ -172,11 +142,9 @@ static int ssl_error(SSL *ssl, ssize_t ret) static CERTCertificate *cert; static SECKEYPrivateKey *privKey; -static char *nss_password_callback(PK11SlotInfo *slot, PRBool retry, +static char *nss_password_callback(PK11SlotInfo *slot, PRBool retry, void *arg) { - NUT_UNUSED_VARIABLE(arg); - if (retry) { /* Force not inted to retrieve password many times. */ return NULL; @@ -197,14 +165,12 @@ static void nss_error(const char* text) } } -static int ssl_error(PRFileDesc *ssl, ssize_t ret) +static int ssl_error(PRFileDesc *ssl, int ret) { char buffer[256]; PRInt32 length; PRErrorCode e; - NUT_UNUSED_VARIABLE(ssl); - NUT_UNUSED_VARIABLE(ret); - + e = PR_GetError(); length = PR_GetErrorText(buffer); if (length > 0 && length < 256) { @@ -229,15 +195,13 @@ static SECStatus AuthCertificate(CERTCertDBHandle *arg, PRFileDesc *fd, static SECStatus BadCertHandler(nut_ctype_t *arg, PRFileDesc *fd) { - NUT_UNUSED_VARIABLE(fd); - upslogx(LOG_WARNING, "Certificate validation failed for %s", (arg&&arg->addr)?arg->addr:""); #ifdef WITH_CLIENT_CERTIFICATE_VALIDATION /* BadCertHandler is called when the NSS certificate validation is failed. * If the certificate verification (user conf) is mandatory, reject authentication * else accept it. - */ + */ return certrequest==NETSSL_CERTREQ_REQUIRE?SECFailure:SECSuccess; #else /* WITH_CLIENT_CERTIFICATE_VALIDATION */ /* Always accept clients. */ @@ -247,8 +211,6 @@ static SECStatus BadCertHandler(nut_ctype_t *arg, PRFileDesc *fd) static void HandshakeCallback(PRFileDesc *fd, nut_ctype_t *client_data) { - NUT_UNUSED_VARIABLE(fd); - upslogx(LOG_INFO, "SSL handshake done successfully with client %s", client_data->addr); } @@ -256,7 +218,7 @@ static void HandshakeCallback(PRFileDesc *fd, nut_ctype_t *client_data) #endif /* WITH_OPENSSL | WITH_NSS */ -void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) +void net_starttls(nut_ctype_t *client, int numarg, const char **arg) { #ifdef WITH_OPENSSL int ret; @@ -264,10 +226,7 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) SECStatus status; PRFileDesc *socket; #endif /* WITH_OPENSSL | WITH_NSS */ - - NUT_UNUSED_VARIABLE(numarg); - NUT_UNUSED_VARIABLE(arg); - + if (client->ssl) { send_err(client, NUT_ERR_ALREADY_SSL_MODE); return; @@ -279,23 +238,22 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) send_err(client, NUT_ERR_FEATURE_NOT_CONFIGURED); return; } - -#ifdef WITH_OPENSSL - if (!ssl_ctx) + +#ifdef WITH_OPENSSL + if (!ssl_ctx) { #elif defined(WITH_NSS) /* WITH_OPENSSL */ - if (!NSS_IsInitialized()) + if (!NSS_IsInitialized()) { #endif /* WITH_OPENSSL | WITH_NSS */ - { send_err(client, NUT_ERR_FEATURE_NOT_CONFIGURED); ssl_initialized = 0; return; } - + if (!sendback(client, "OK STARTTLS\n")) { return; } -#ifdef WITH_OPENSSL +#ifdef WITH_OPENSSL client->ssl = SSL_new(ssl_ctx); @@ -310,15 +268,15 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) ssl_debug(); return; } - + ret = SSL_accept(client->ssl); switch (ret) { case 1: client->ssl_connected = 1; - upsdebugx(3, "SSL connected (%s)", SSL_get_version(client->ssl)); + upsdebugx(3, "SSL connected"); break; - + case 0: upslog_with_errno(LOG_ERR, "SSL_accept do not accept handshake."); ssl_error(client->ssl, ret); @@ -328,7 +286,7 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) ssl_error(client->ssl, ret); break; } - + #elif defined(WITH_NSS) /* WITH_OPENSSL */ socket = PR_ImportTCPSocket(client->sock_fd); @@ -344,13 +302,13 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) nss_error("net_starttls / SSL_ImportFD"); return; } - + if (SSL_SetPKCS11PinArg(client->ssl, client) == -1){ upslogx(LOG_ERR, "Can not inialize SSL connection"); nss_error("net_starttls / SSL_SetPKCS11PinArg"); return; } - + /* Note cast to SSLAuthCertificate to prevent warning due to * bad function prototype in NSS. */ @@ -360,21 +318,21 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg) nss_error("net_starttls / SSL_AuthCertificateHook"); return; } - + status = SSL_BadCertHook(client->ssl, (SSLBadCertHandler)BadCertHandler, client); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not inialize SSL connection"); nss_error("net_starttls / SSL_BadCertHook"); return; } - + status = SSL_HandshakeCallback(client->ssl, (SSLHandshakeCallback)HandshakeCallback, client); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not inialize SSL connection"); nss_error("net_starttls / SSL_HandshakeCallback"); return; } - + status = SSL_ConfigSecureServer(client->ssl, cert, privKey, NSS_FindCertKEAType(cert)); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not inialize SSL connection"); @@ -412,53 +370,35 @@ void ssl_init(void) { #ifdef WITH_NSS SECStatus status; -#if defined(NSS_VMAJOR) && (NSS_VMAJOR > 3 || (NSS_VMAJOR == 3 && defined(NSS_VMINOR) && NSS_VMINOR >= 14)) - SSLVersionRange range; +#elif defined(WITH_OPENSSL) +#if OPENSSL_VERSION_NUMBER >= 0x10000000L + const SSL_METHOD *ssl_method; +#else + SSL_METHOD *ssl_method; #endif -#endif /* WITH_NSS */ +#endif /* WITH_NSS|WITH_OPENSSL */ if (!certfile) { return; } check_perms(certfile); - if (!disable_weak_ssl) - upslogx(LOG_WARNING, "Warning: DISABLE_WEAK_SSL is not enabled. Please consider enabling to improve network security."); #ifdef WITH_OPENSSL -#if OPENSSL_VERSION_NUMBER < 0x10100000L SSL_load_error_strings(); SSL_library_init(); - ssl_ctx = SSL_CTX_new(SSLv23_server_method()); -#else - ssl_ctx = SSL_CTX_new(TLS_server_method()); -#endif + if ((ssl_method = TLSv1_server_method()) == NULL) { + ssl_debug(); + fatalx(EXIT_FAILURE, "TLSv1_server_method failed"); + } - if (!ssl_ctx) { + if ((ssl_ctx = SSL_CTX_new(ssl_method)) == NULL) { ssl_debug(); fatalx(EXIT_FAILURE, "SSL_CTX_new failed"); } - SSL_CTX_set_options(ssl_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE); -#if OPENSSL_VERSION_NUMBER < 0x10100000L - /* set minimum protocol TLSv1 */ - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3); - if (disable_weak_ssl) { -#if defined(SSL_OP_NO_TLSv1_2) - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1 | SSL_OP_NO_TLSv1_1); -#elif defined(SSL_OP_NO_TLSv1_1) - SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_TLSv1); -#endif - } -#else - if (SSL_CTX_set_min_proto_version(ssl_ctx, disable_weak_ssl ? TLS1_2_VERSION : TLS1_VERSION) != 1) { - ssl_debug(); - fatalx(EXIT_FAILURE, "SSL_CTX_set_min_proto_version(TLS1_VERSION)"); - } -#endif - if (SSL_CTX_use_certificate_chain_file(ssl_ctx, certfile) != 1) { ssl_debug(); fatalx(EXIT_FAILURE, "SSL_CTX_use_certificate_chain_file(%s) failed", certfile); @@ -482,7 +422,7 @@ void ssl_init(void) SSL_CTX_set_verify(ssl_ctx, SSL_VERIFY_NONE, NULL); ssl_initialized = 1; - + #elif defined(WITH_NSS) /* WITH_OPENSSL */ if (!certname || certname[0]==0 ) { @@ -491,9 +431,9 @@ void ssl_init(void) } PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); - + PK11_SetPasswordFunc(nss_password_callback); - + if (certfile) /* Note: this call can generate memory leaks not resolvable * by any release function. @@ -504,10 +444,10 @@ void ssl_init(void) status = NSS_NoDB_Init(NULL); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not initialize SSL context"); - nss_error("upscli_init / NSS_[NoDB]_Init"); + nss_error("upscli_init / NSS_[NoDB]_Init"); return; } - + status = NSS_SetDomesticPolicy(); if (status != SECSuccess) { upslogx(LOG_ERR, "Can not initialize SSL policy"); @@ -522,57 +462,18 @@ void ssl_init(void) nss_error("upscli_init / SSL_ConfigServerSessionIDCache"); return; } - - if (!disable_weak_ssl) { - status = SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not enable SSLv3"); - nss_error("upscli_init / SSL_OptionSetDefault(SSL_ENABLE_SSL3)"); - return; - } - status = SSL_OptionSetDefault(SSL_ENABLE_TLS, PR_TRUE); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not enable TLSv1"); - nss_error("upscli_init / SSL_OptionSetDefault(SSL_ENABLE_TLS)"); - return; - } - } else { -#if defined(NSS_VMAJOR) && (NSS_VMAJOR > 3 || (NSS_VMAJOR == 3 && defined(NSS_VMINOR) && NSS_VMINOR >= 14)) - status = SSL_VersionRangeGetSupported(ssl_variant_stream, &range); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not get versions supported"); - nss_error("upscli_init / SSL_VersionRangeGetSupported"); - return; - } - range.min = SSL_LIBRARY_VERSION_TLS_1_1; -#ifdef SSL_LIBRARY_VERSION_TLS_1_2 - range.min = SSL_LIBRARY_VERSION_TLS_1_2; -#endif - status = SSL_VersionRangeSetDefault(ssl_variant_stream, &range); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not set versions supported"); - nss_error("upscli_init / SSL_VersionRangeSetDefault"); - return; - } - /* Disable old/weak ciphers */ - SSL_CipherPrefSetDefault(TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA, PR_FALSE); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_3DES_EDE_CBC_SHA, PR_FALSE); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_RC4_128_SHA, PR_FALSE); - SSL_CipherPrefSetDefault(TLS_RSA_WITH_RC4_128_MD5, PR_FALSE); -#else - status = SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_FALSE); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not disable SSLv3"); - nss_error("upscli_init / SSL_OptionSetDefault(SSL_DISABLE_SSL3)"); - return; - } - status = SSL_OptionSetDefault(SSL_ENABLE_TLS, PR_TRUE); - if (status != SECSuccess) { - upslogx(LOG_ERR, "Can not enable TLSv1"); - nss_error("upscli_init / SSL_OptionSetDefault(SSL_ENABLE_TLS)"); - return; - } -#endif + + status = SSL_OptionSetDefault(SSL_ENABLE_SSL3, PR_TRUE); + if (status != SECSuccess) { + upslogx(LOG_ERR, "Can not enable SSLv3"); + nss_error("upscli_init / SSL_OptionSetDefault(SSL_ENABLE_SSL3)"); + return; + } + status = SSL_OptionSetDefault(SSL_ENABLE_TLS, PR_TRUE); + if (status != SECSuccess) { + upslogx(LOG_ERR, "Can not enable TLSv1"); + nss_error("upscli_init / SSL_OptionSetDefault(SSL_ENABLE_TLS)"); + return; } #ifdef WITH_CLIENT_CERTIFICATE_VALIDATION @@ -582,7 +483,7 @@ void ssl_init(void) return; } - if (certrequest == NETSSL_CERTREQ_REQUEST || + if (certrequest == NETSSL_CERTREQ_REQUEST || certrequest == NETSSL_CERTREQ_REQUIRE ) { status = SSL_OptionSetDefault(SSL_REQUEST_CERTIFICATE, PR_TRUE); if (status != SECSuccess) { @@ -601,59 +502,39 @@ void ssl_init(void) } } #endif /* WITH_CLIENT_CERTIFICATE_VALIDATION */ - + cert = PK11_FindCertFromNickname(certname, NULL); if(cert==NULL) { upslogx(LOG_ERR, "Can not find server certificate"); nss_error("upscli_init / PK11_FindCertFromNickname"); return; } - + privKey = PK11_FindKeyByAnyCert(cert, NULL); if(privKey==NULL){ upslogx(LOG_ERR, "Can not find private key associate to server certificate"); nss_error("upscli_init / PK11_FindKeyByAnyCert"); return; } - + ssl_initialized = 1; #else /* WITH_OPENSSL | WITH_NSS */ upslogx(LOG_ERR, "ssl_init called but SSL wasn't compiled in"); #endif /* WITH_OPENSSL | WITH_NSS */ } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif -ssize_t ssl_read(nut_ctype_t *client, char *buf, size_t buflen) +int ssl_read(nut_ctype_t *client, char *buf, size_t buflen) { - ssize_t ret = -1; + int ret; if (!client->ssl_connected) { return -1; } #ifdef WITH_OPENSSL - /* SSL_* routines deal with int type for return and buflen - * We might need to window our I/O if we exceed 2GB (in - * 32-bit builds)... Not likely to exceed in 64-bit builds, - * but smaller systems with 16-bits might be endangered :) - */ - assert(buflen <= INT_MAX); - int iret = SSL_read(client->ssl, buf, (int)buflen); - assert(iret <= SSIZE_MAX); - ret = (ssize_t)iret; + ret = SSL_read(client->ssl, buf, buflen); #elif defined(WITH_NSS) /* WITH_OPENSSL */ - /* PR_* routines deal in PRInt32 type - * We might need to window our I/O if we exceed 2GB :) */ - assert(buflen <= PR_INT32_MAX); - ret = PR_Read(client->ssl, buf, (PRInt32)buflen); + ret = PR_Read(client->ssl, buf, buflen); #endif /* WITH_OPENSSL | WITH_NSS */ if (ret < 1) { @@ -664,38 +545,24 @@ ssize_t ssl_read(nut_ctype_t *client, char *buf, size_t buflen) return ret; } -ssize_t ssl_write(nut_ctype_t *client, const char *buf, size_t buflen) +int ssl_write(nut_ctype_t *client, const char *buf, size_t buflen) { - ssize_t ret = -1; + int ret; if (!client->ssl_connected) { return -1; } #ifdef WITH_OPENSSL - /* SSL_* routines deal with int type for return and buflen - * We might need to window our I/O if we exceed 2GB (in - * 32-bit builds)... Not likely to exceed in 64-bit builds, - * but smaller systems with 16-bits might be endangered :) - */ - assert(buflen <= INT_MAX); - int iret = SSL_write(client->ssl, buf, (int)buflen); - assert(iret <= SSIZE_MAX); - ret = (ssize_t)iret; + ret = SSL_write(client->ssl, buf, buflen); #elif defined(WITH_NSS) /* WITH_OPENSSL */ - /* PR_* routines deal in PRInt32 type - * We might need to window our I/O if we exceed 2GB :) */ - assert(buflen <= PR_INT32_MAX); - ret = PR_Write(client->ssl, buf, (PRInt32)buflen); + ret = PR_Write(client->ssl, buf, buflen); #endif /* WITH_OPENSSL | WITH_NSS */ - upsdebugx(5, "ssl_write ret=%zd", ret); + upsdebugx(5, "ssl_write ret=%d", ret); return ret; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP_BESIDEFUNC) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS_BESIDEFUNC) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE_BESIDEFUNC) ) -# pragma GCC diagnostic pop -#endif void ssl_finish(nut_ctype_t *client) { diff --git a/server/netssl.h b/server/netssl.h index 1cff564..8f68168 100644 --- a/server/netssl.h +++ b/server/netssl.h @@ -17,8 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_NETSSL_H_SEEN -#define NUT_NETSSL_H_SEEN 1 +#ifndef NETSSL_H_SEEN +#define NETSSL_H_SEEN 1 #include "nut_ctype.h" @@ -31,7 +31,6 @@ extern "C" { extern char *certfile; extern char *certname; extern char *certpasswd; -extern int disable_weak_ssl; #ifdef WITH_CLIENT_CERTIFICATE_VALIDATION extern int certrequest; #endif /* WITH_CLIENT_CERTIFICATE_VALIDATION */ @@ -49,10 +48,10 @@ void ssl_init(void); void ssl_finish(nut_ctype_t *client); void ssl_cleanup(void); -ssize_t ssl_read(nut_ctype_t *client, char *buf, size_t buflen); -ssize_t ssl_write(nut_ctype_t *client, const char *buf, size_t buflen); +int ssl_read(nut_ctype_t *client, char *buf, size_t buflen); +int ssl_write(nut_ctype_t *client, const char *buf, size_t buflen); -void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg); +void net_starttls(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -60,4 +59,4 @@ void net_starttls(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETSSL_H_SEEN */ +#endif /* NETSSL_H_SEEN */ diff --git a/server/netuser.c b/server/netuser.c index 6f4c677..29c8596 100644 --- a/server/netuser.c +++ b/server/netuser.c @@ -1,4 +1,4 @@ -/* netuser.c - LOGIN/LOGOUT/USERNAME/PASSWORD/MASTER[PRIMARY] handlers for upsd +/* netuser.c - LOGIN/LOGOUT/USERNAME/PASSWORD/MASTER handlers for upsd Copyright (C) 2003 Russell Kroll @@ -28,7 +28,7 @@ #include "netuser.h" /* LOGIN */ -void net_login(nut_ctype_t *client, size_t numarg, const char **arg) +void net_login(nut_ctype_t *client, int numarg, const char **arg) { upstype_t *ups; @@ -53,8 +53,6 @@ void net_login(nut_ctype_t *client, size_t numarg, const char **arg) /* make sure this is a valid user */ if (!user_checkaction(client->username, client->password, "LOGIN")) { - upsdebugx(3, "%s: not a valid user: %s", - __func__, client->username); send_err(client, NUT_ERR_ACCESS_DENIED); return; } @@ -67,9 +65,8 @@ void net_login(nut_ctype_t *client, size_t numarg, const char **arg) sendback(client, "OK\n"); } -void net_logout(nut_ctype_t *client, size_t numarg, const char **arg) +void net_logout(nut_ctype_t *client, int numarg, const char **arg) { - NUT_UNUSED_VARIABLE(arg); if (numarg != 0) { send_err(client, NUT_ERR_INVALID_ARGUMENT); return; @@ -85,64 +82,35 @@ void net_logout(nut_ctype_t *client, size_t numarg, const char **arg) client->last_heard = 0; } -/* NOTE: Protocol updated since NUT 2.8.0 to handle master/primary - * and API bumped, to rename/alias the routine. - */ -static int do_net_primary(nut_ctype_t *client, size_t numarg, const char **arg) +/* MASTER */ +void net_master(nut_ctype_t *client, int numarg, const char **arg) { upstype_t *ups; if (numarg != 1) { send_err(client, NUT_ERR_INVALID_ARGUMENT); - return -1; + return; } ups = get_ups_ptr(arg[0]); if (!ups) { send_err(client, NUT_ERR_UNKNOWN_UPS); - return -1; + return; } - /* make sure this user is allowed to do PRIMARY or MASTER */ - if (!user_checkaction(client->username, client->password, "PRIMARY") - && !user_checkaction(client->username, client->password, "MASTER") - ) { + /* make sure this user is allowed to do MASTER */ + if (!user_checkaction(client->username, client->password, "MASTER")) { send_err(client, NUT_ERR_ACCESS_DENIED); - return -1; + return; } /* this is just an access level check */ - /* sendback() will be worded by caller below */ - return 0; -} - -/* MASTER (deprecated) */ -void net_master(nut_ctype_t *client, size_t numarg, const char **arg) { - /* Allow existing binaries linked against this file to still work */ - upsdebugx(1, - "WARNING: Client %s@%s " - "requested MASTER level for device %s - " - "which is deprecated in favor of PRIMARY " - "since NUT 2.8.0", - client->username, client->addr, - (numarg > 0) ? arg[0] : ""); - - if (0 == do_net_primary(client, numarg, arg)) { - sendback(client, "OK MASTER-GRANTED\n"); - } -} - -/* PRIMARY (since NUT 2.8.0) */ -void net_primary(nut_ctype_t *client, size_t numarg, const char **arg) -{ - if (0 == do_net_primary(client, numarg, arg)) { - sendback(client, "OK PRIMARY-GRANTED\n"); - } + sendback(client, "OK MASTER-GRANTED\n"); } /* USERNAME */ -void net_username(nut_ctype_t *client, size_t numarg, const char **arg) +void net_username(nut_ctype_t *client, int numarg, const char **arg) { if (numarg != 1) { send_err(client, NUT_ERR_INVALID_ARGUMENT); @@ -162,7 +130,7 @@ void net_username(nut_ctype_t *client, size_t numarg, const char **arg) } /* PASSWORD */ -void net_password(nut_ctype_t *client, size_t numarg, const char **arg) +void net_password(nut_ctype_t *client, int numarg, const char **arg) { if (numarg != 1) { send_err(client, NUT_ERR_INVALID_ARGUMENT); diff --git a/server/netuser.h b/server/netuser.h index 7532b3c..af227b9 100644 --- a/server/netuser.h +++ b/server/netuser.h @@ -1,48 +1,14 @@ -/* netuser.c - LOGIN/LOGOUT/USERNAME/PASSWORD/MASTER[PRIMARY] handlers for upsd - - Copyright (C) - 2003 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2013 Emilien Kia - 2020-2021 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#ifndef NUT_NETUSER_H_SEEN -#define NUT_NETUSER_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { /* *INDENT-ON* */ #endif -void net_login(nut_ctype_t *client, size_t numarg, const char **arg); -void net_logout(nut_ctype_t *client, size_t numarg, const char **arg); - -/* NOTE: Since NUT 2.8.0 we handle master as alias for primary - * Header keyword kept for building older consumers, but - * the implementation will warn that it is deprecated. - */ -void net_master(nut_ctype_t *client, size_t numarg, const char **arg); -void net_primary(nut_ctype_t *client, size_t numarg, const char **arg); - -void net_username(nut_ctype_t *client, size_t numarg, const char **arg); -void net_password(nut_ctype_t *client, size_t numarg, const char **arg); +void net_login(nut_ctype_t *client, int numarg, const char **arg); +void net_logout(nut_ctype_t *client, int numarg, const char **arg); +void net_master(nut_ctype_t *client, int numarg, const char **arg); +void net_username(nut_ctype_t *client, int numarg, const char **arg); +void net_password(nut_ctype_t *client, int numarg, const char **arg); #ifdef __cplusplus /* *INDENT-OFF* */ @@ -50,4 +16,3 @@ void net_password(nut_ctype_t *client, size_t numarg, const char **arg); /* *INDENT-ON* */ #endif -#endif /* NUT_NETUSER_H_SEEN */ diff --git a/server/nut_ctype.h b/server/nut_ctype.h index db9f4df..c2302aa 100644 --- a/server/nut_ctype.h +++ b/server/nut_ctype.h @@ -4,8 +4,6 @@ 2002 Russell Kroll 2008 Arjen de Korte 2011 Arnaud Quette - 2013 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -39,12 +37,6 @@ #include "parseconf.h" -#ifdef __cplusplus -/* *INDENT-OFF* */ -extern "C" { -/* *INDENT-ON* */ -#endif - /* client structure */ typedef struct nut_ctype_s { char *addr; @@ -53,9 +45,6 @@ typedef struct nut_ctype_s { char *loginups; char *password; char *username; - /* per client status info for commands and settings - * (disabled by default) */ - int tracking; #ifdef WITH_OPENSSL SSL *ssl; @@ -73,10 +62,4 @@ typedef struct nut_ctype_s { struct nut_ctype_s *next; } nut_ctype_t; -#ifdef __cplusplus -/* *INDENT-OFF* */ -} -/* *INDENT-ON* */ -#endif - #endif /* NUT_CTYPE_H_SEEN */ diff --git a/server/sockdebug.c b/server/sockdebug.c index f9fe476..7829292 100644 --- a/server/sockdebug.c +++ b/server/sockdebug.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include @@ -31,11 +31,11 @@ PCONF_CTX_t sock_ctx; -static void sock_arg(size_t numarg, char **arg) +static void sock_arg(int numarg, char **arg) { - size_t i; + int i; - printf("numarg=%zu : ", numarg); + printf("numarg=%d : ", numarg); for (i = 0; i < numarg; i++) printf("[%s] ", arg[i]); @@ -48,8 +48,6 @@ static int socket_connect(const char *sockfn) int ret, fd; struct sockaddr_un sa; - check_unix_socket_filename(sockfn); - memset(&sa, '\0', sizeof(sa)); sa.sun_family = AF_UNIX; snprintf(sa.sun_path, sizeof(sa.sun_path), "%s", sockfn); @@ -100,7 +98,7 @@ static void read_sock(int fd) } if (ret < 0) { - perror("read sockfd"); + perror("read sockfd"); exit(EXIT_FAILURE); } diff --git a/server/sstate.c b/server/sstate.c index 167bc09..15d2c14 100644 --- a/server/sstate.c +++ b/server/sstate.c @@ -25,9 +25,7 @@ #include "timehead.h" #include "sstate.h" -#include "upsd.h" #include "upstype.h" -#include "nut_stdint.h" #include #include @@ -35,9 +33,9 @@ #include #include #include -#include +#include -static int parse_args(upstype_t *ups, size_t numargs, char **arg) +static int parse_args(upstype_t *ups, int numargs, char **arg) { if (numargs < 1) return 0; @@ -106,63 +104,48 @@ static int parse_args(upstype_t *ups, size_t numargs, char **arg) return 1; } - /* DELENUM */ - if (!strcasecmp(arg[0], "DELENUM")) { - state_delenum(ups->inforoot, arg[1], arg[2]); - return 1; - } - - /* SETAUX */ - if (!strcasecmp(arg[0], "SETAUX")) { - state_setaux(ups->inforoot, arg[1], arg[2]); - return 1; - } - - /* TRACKING */ - if (!strcasecmp(arg[0], "TRACKING")) { - tracking_set(arg[1], arg[2]); - upsdebugx(1, "TRACKING: ID %s status %s", arg[1], arg[2]); - - /* log actual result of instcmd / setvar */ - if (strncmp(arg[2], "PENDING", 7) != 0) { - upslogx(LOG_INFO, "tracking ID: %s\tresult: %s", arg[1], tracking_get(arg[1])); - } - return 1; - } - - if (numargs < 4) - return 0; - /* ADDRANGE */ if (!strcasecmp(arg[0], "ADDRANGE")) { state_addrange(ups->inforoot, arg[1], atoi(arg[2]), atoi(arg[3])); return 1; } + /* DELENUM */ + if (!strcasecmp(arg[0], "DELENUM")) { + state_delenum(ups->inforoot, arg[1], arg[2]); + return 1; + } + /* DELRANGE */ if (!strcasecmp(arg[0], "DELRANGE")) { state_delrange(ups->inforoot, arg[1], atoi(arg[2]), atoi(arg[3])); return 1; } + /* SETAUX */ + if (!strcasecmp(arg[0], "SETAUX")) { + state_setaux(ups->inforoot, arg[1], arg[2]); + return 1; + } + return 0; } /* nothing fancy - just make the driver say something back to us */ static void sendping(upstype_t *ups) { - ssize_t ret; + int ret; const char *cmd = "PING\n"; - size_t cmdlen = strlen(cmd); if ((!ups) || (ups->sock_fd < 0)) { return; } upsdebugx(3, "Pinging UPS [%s]", ups->name); - ret = write(ups->sock_fd, cmd, cmdlen); - if ((ret < 1) || (ret != (ssize_t)cmdlen)) { + ret = write(ups->sock_fd, cmd, strlen(cmd)); + + if (ret != (int)strlen(cmd)) { upslog_with_errno(LOG_NOTICE, "Send ping to UPS [%s] failed", ups->name); sstate_disconnect(ups); return; @@ -175,14 +158,10 @@ static void sendping(upstype_t *ups) int sstate_connect(upstype_t *ups) { - int fd; + int ret, fd; const char *dumpcmd = "DUMPALL\n"; - size_t dumpcmdlen = strlen(dumpcmd); - ssize_t ret; struct sockaddr_un sa; - check_unix_socket_filename(ups->fn); - memset(&sa, '\0', sizeof(sa)); sa.sun_family = AF_UNIX; snprintf(sa.sun_path, sizeof(sa.sun_path), "%s", ups->fn); @@ -207,7 +186,7 @@ int sstate_connect(upstype_t *ups) return -1; ups->last_connfail = now; - upslog_with_errno(LOG_ERR, "Can't connect to UPS [%s] (%s)", + upslog_with_errno(LOG_ERR, "Can't connect to UPS [%s] (%s)", ups->name, ups->fn); return -1; @@ -230,9 +209,9 @@ int sstate_connect(upstype_t *ups) } /* get a dump started so we have a fresh set of data */ - ret = write(fd, dumpcmd, dumpcmdlen); + ret = write(fd, dumpcmd, strlen(dumpcmd)); - if ((ret < 1) || (ret != (ssize_t)dumpcmdlen)) { + if (ret != (int)strlen(dumpcmd)) { upslog_with_errno(LOG_ERR, "Initial write to UPS [%s] failed", ups->name); close(fd); return -1; @@ -271,7 +250,7 @@ void sstate_disconnect(upstype_t *ups) void sstate_readline(upstype_t *ups) { - ssize_t i, ret; + int i, ret; char buf[SMALLBUF]; if ((!ups) || (ups->sock_fd < 0)) { @@ -301,7 +280,7 @@ void sstate_readline(upstype_t *ups) case 1: /* set the 'last heard' time to now for later staleness checks */ if (parse_args(ups, ups->sock_ctx.numargs, ups->sock_ctx.arglist)) { - time(&ups->last_heard); + time(&ups->last_heard); } continue; @@ -324,12 +303,12 @@ const char *sstate_getinfo(const upstype_t *ups, const char *var) int sstate_getflags(const upstype_t *ups, const char *var) { return state_getflags(ups->inforoot, var); -} +} -long sstate_getaux(const upstype_t *ups, const char *var) +int sstate_getaux(const upstype_t *ups, const char *var) { return state_getaux(ups->inforoot, var); -} +} const enum_t *sstate_getenumlist(const upstype_t *ups, const char *var) { @@ -346,7 +325,7 @@ const cmdlist_t *sstate_getcmdlist(const upstype_t *ups) return ups->cmdlist; } -int sstate_dead(upstype_t *ups, int arg_maxage) +int sstate_dead(upstype_t *ups, int maxage) { time_t now; double elapsed; @@ -368,12 +347,12 @@ int sstate_dead(upstype_t *ups, int arg_maxage) elapsed = difftime(now, ups->last_heard); /* somewhere beyond a third of the maximum time - prod it to make it talk */ - if ((elapsed > (arg_maxage / 3)) && (difftime(now, ups->last_ping) > (arg_maxage / 3))) + if ((elapsed > (maxage / 3)) && (difftime(now, ups->last_ping) > (maxage / 3))) sendping(ups); - if (elapsed > arg_maxage) { + if (elapsed > maxage) { upsdebugx(3, "sstate_dead: didn't hear from driver for UPS [%s] for %g seconds (max %d)", - ups->name, elapsed, arg_maxage); + ups->name, elapsed, maxage); return 1; /* dead */ } @@ -397,24 +376,16 @@ void sstate_cmdfree(upstype_t *ups) int sstate_sendline(upstype_t *ups, const char *buf) { - ssize_t ret; - size_t buflen; + int ret; if ((!ups) ||(ups->sock_fd < 0)) { return 0; /* failed */ } - buflen = strlen(buf); - if (buflen >= SSIZE_MAX) { - /* Can't compare buflen to ret... */ - upslog_with_errno(LOG_NOTICE, "Send ping to UPS [%s] failed: buffered message too large", ups->name); - return 0; /* failed */ - } + ret = write(ups->sock_fd, buf, strlen(buf)); - ret = write(ups->sock_fd, buf, buflen); - - if (ret == (ssize_t)buflen) { - return 1; + if (ret == (int)strlen(buf)) { + return 1; } upslog_with_errno(LOG_NOTICE, "Send to UPS [%s] failed", ups->name); diff --git a/server/sstate.h b/server/sstate.h index 7a7fff6..fe8485c 100644 --- a/server/sstate.h +++ b/server/sstate.h @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_SSTATE_H_SEEN -#define NUT_SSTATE_H_SEEN 1 +#ifndef SSTATE_H_SEEN +#define SSTATE_H_SEEN #include "state.h" #include "upstype.h" @@ -40,7 +40,7 @@ void sstate_disconnect(upstype_t *ups); void sstate_readline(upstype_t *ups); const char *sstate_getinfo(const upstype_t *ups, const char *var); int sstate_getflags(const upstype_t *ups, const char *var); -long sstate_getaux(const upstype_t *ups, const char *var); +int sstate_getaux(const upstype_t *ups, const char *var); const enum_t *sstate_getenumlist(const upstype_t *ups, const char *var); const range_t *sstate_getrangelist(const upstype_t *ups, const char *var); const cmdlist_t *sstate_getcmdlist(const upstype_t *ups); @@ -59,4 +59,4 @@ const st_tree_t *sstate_getnode(const upstype_t *ups, const char *varname); /* *INDENT-ON* */ #endif -#endif /* NUT_SSTATE_H_SEEN */ +#endif /* SSTATE_H_SEEN */ diff --git a/server/stype.h b/server/stype.h index 54e5ff2..c143018 100644 --- a/server/stype.h +++ b/server/stype.h @@ -18,8 +18,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_STYPE_H_SEEN -#define NUT_STYPE_H_SEEN 1 +#ifndef STYPE_H_SEEN +#define STYPE_H_SEEN 1 #include @@ -50,4 +50,4 @@ typedef struct stype_s { /* *INDENT-ON* */ #endif -#endif /* NUT_STYPE_H_SEEN */ +#endif /* STYPE_H_SEEN */ diff --git a/server/upsd.c b/server/upsd.c index 6299150..2c0d1a1 100644 --- a/server/upsd.c +++ b/server/upsd.c @@ -1,10 +1,9 @@ -/* upsd.c - watches ups state files and answers queries +/* upsd.c - watches ups state files and answers queries Copyright (C) 1999 Russell Kroll 2008 Arjen de Korte 2011 - 2012 Arnaud Quette - 2019 Eaton (author: Arnaud Quette ) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,8 +20,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include "upsd.h" #include "upstype.h" #include "conf.h" @@ -33,17 +30,10 @@ #include #include #include - -#ifdef HAVE_SYS_SIGNAL_H -#include -#endif -#ifdef HAVE_SIGNAL_H -#include -#endif +#include #include "user.h" #include "nut_ctype.h" -#include "nut_stdint.h" #include "stype.h" #include "netssl.h" #include "sstate.h" @@ -56,38 +46,29 @@ int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; #endif /* HAVE_WRAP */ -/* externally-visible settings and pointers */ + /* externally-visible settings and pointers */ -upstype_t *firstups = NULL; + upstype_t *firstups = NULL; -/* default 15 seconds before data is marked stale */ -int maxage = 15; + /* default 15 seconds before data is marked stale */ + int maxage = 15; -/* default to 1h before cleaning up status tracking entries */ -int tracking_delay = 3600; + /* preloaded to {OPEN_MAX} in main, can be overridden via upsd.conf */ + int maxconn = 0; -/* - * Preloaded to ALLOW_NO_DEVICE from upsd.conf or environment variable - * (with higher prio for envvar); defaults to disabled for legacy compat. - */ -int allow_no_device = 0; + /* preloaded to STATEPATH in main, can be overridden via upsd.conf */ + char *statepath = NULL; -/* preloaded to {OPEN_MAX} in main, can be overridden via upsd.conf */ -nfds_t maxconn = 0; + /* preloaded to DATADIR in main, can be overridden via upsd.conf */ + char *datapath = NULL; -/* preloaded to STATEPATH in main, can be overridden via upsd.conf */ -char *statepath = NULL; - -/* preloaded to DATADIR in main, can be overridden via upsd.conf */ -char *datapath = NULL; - -/* everything else */ -static const char *progname; + /* everything else */ + const char *progname; nut_ctype_t *firstclient = NULL; /* static nut_ctype_t *lastclient = NULL; */ -/* default is to listen on all local interfaces */ + /* default is to listen on all local interfaces */ static stype_t *firstaddr = NULL; static int opt_af = AF_UNSPEC; @@ -103,28 +84,6 @@ typedef struct { void *data; } handler_t; - -/* Commands and settings status tracking */ - -/* general enable/disable status info for commands and settings - * (disabled by default) - * Note that only client that requested it will have it enabled - * (see nut_ctype.h) */ -static int tracking_enabled = 0; - -/* Commands and settings status tracking structure */ -typedef struct tracking_s { - char *id; - int status; - time_t request_time; /* for cleanup */ - /* doubly linked list */ - struct tracking_s *prev; - struct tracking_s *next; -} tracking_t; - -static tracking_t *tracking_list = NULL; - - /* pollfd */ static struct pollfd *fds = NULL; static handler_t *handler = NULL; @@ -135,11 +94,6 @@ static char pidfn[SMALLBUF]; /* set by signal handlers */ static int reload_flag = 0, exit_flag = 0; -/* Minimalistic support for UUID v4 */ -/* Ref: RFC 4122 https://tools.ietf.org/html/rfc4122#section-4.1.2 */ -#define UUID4_BYTESIZE 16 - - static const char *inet_ntopW (struct sockaddr_storage *s) { static char str[40]; @@ -250,7 +204,7 @@ static void setuptcp(stype_t *server) upsdebug_with_errno(3, "setuptcp: socket"); continue; } - + if (setsockopt(sock_fd, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(one)) != 0) { fatal_with_errno(EXIT_FAILURE, "setuptcp: setsockopt"); } @@ -354,15 +308,12 @@ static void client_disconnect(nut_ctype_t *client) return; } -/* send the buffer of length to host - * returns effectively a boolean: 0 = failed, 1 = sent ok - */ +/* send the buffer of length to host */ int sendback(nut_ctype_t *client, const char *fmt, ...) { - ssize_t res; - size_t len; - char ans[NUT_NET_ANSWER_MAX+1]; - va_list ap; + int res, len; + char ans[NUT_NET_ANSWER_MAX+1]; + va_list ap; if (!client) { return 0; @@ -374,23 +325,18 @@ int sendback(nut_ctype_t *client, const char *fmt, ...) len = strlen(ans); - /* System write() and our ssl_write() have a loophole that they write a - * size_t amount of bytes and upon success return that in ssize_t value - */ - assert(len < SSIZE_MAX); - #ifdef WITH_SSL if (client->ssl) { res = ssl_write(client, ans, len); - } else + } else #endif /* WITH_SSL */ { res = write(client->sock_fd, ans, len); } - upsdebugx(2, "write: [destfd=%d] [len=%zu] [%s]", client->sock_fd, len, str_rtrim(ans, '\n')); + upsdebugx(2, "write: [destfd=%d] [len=%d] [%s]", client->sock_fd, len, rtrim(ans, '\n')); - if (res < 0 || len != (size_t)res) { + if (len != res) { upslog_with_errno(LOG_NOTICE, "write() failed for %s", client->addr); client->last_heard = 0; return 0; /* failed */ @@ -450,25 +396,20 @@ int ups_available(const upstype_t *ups, nut_ctype_t *client) } /* check flags and access for an incoming command from the network */ -static void check_command(int cmdnum, nut_ctype_t *client, size_t numarg, +static void check_command(int cmdnum, nut_ctype_t *client, int numarg, const char **arg) { - upsdebugx(6, "Entering %s: %s", __func__, numarg > 0 ? arg[0] : "<>"); - if (netcmds[cmdnum].flags & FLAG_USER) { - /* command requires previous authentication */ #ifdef HAVE_WRAP struct request_info req; #endif /* HAVE_WRAP */ if (!client->username) { - upsdebugx(1, "%s: client not logged in yet", __func__); send_err(client, NUT_ERR_USERNAME_REQUIRED); return; } if (!client->password) { - upsdebugx(1, "%s: client not logged in yet", __func__); send_err(client, NUT_ERR_PASSWORD_REQUIRED); return; } @@ -478,20 +419,15 @@ static void check_command(int cmdnum, nut_ctype_t *client, size_t numarg, fromhost(&req); if (!hosts_access(&req)) { - upsdebugx(1, - "%s: while authenticating %s found that " - "tcp-wrappers says access should be denied", - __func__, client->username); + /* tcp-wrappers says access should be denied */ send_err(client, NUT_ERR_ACCESS_DENIED); return; } #endif /* HAVE_WRAP */ } - upsdebugx(6, "%s: Calling command handler for %s", __func__, numarg > 0 ? arg[0] : "<>"); - /* looks good - call the command */ - netcmds[cmdnum].func(client, (numarg < 2) ? 0 : (numarg - 1), (numarg > 1) ? &arg[1] : NULL); + netcmds[cmdnum].func(client, numarg - 1, &arg[1]); } /* parse requests from the network */ @@ -521,7 +457,7 @@ static void parse_net(nut_ctype_t *client) static void client_connect(stype_t *server) { struct sockaddr_storage csock; -#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) +#if defined(__hpux) && !defined(_XOPEN_SOURCE_EXTENDED) int clen; #else socklen_t clen; @@ -544,8 +480,6 @@ static void client_connect(stype_t *server) client->addr = xstrdup(inet_ntopW(&csock)); - client->tracking = 0; - pconf_init(&client->ctx, NULL); if (firstclient) { @@ -570,13 +504,12 @@ static void client_connect(stype_t *server) static void client_readline(nut_ctype_t *client) { char buf[SMALLBUF]; - int i; - ssize_t ret; + int i, ret; #ifdef WITH_SSL if (client->ssl) { ret = ssl_read(client, buf, sizeof(buf)); - } else + } else #endif /* WITH_SSL */ { ret = read(client->sock_fd, buf, sizeof(buf)); @@ -636,7 +569,7 @@ void server_load(void) for (server = firstaddr; server; server = server->next) { setuptcp(server); } - + /* check if we have at least 1 valid LISTEN interface */ if (firstaddr->sock_fd < 0) { fatalx(EXIT_FAILURE, "no listening interface available"); @@ -674,14 +607,11 @@ static void client_free(void) } } -static void driver_free(void) +void driver_free(void) { upstype_t *ups, *unext; for (ups = firstups; ups; ups = unext) { - upsdebugx(1, "%s: forgetting UPS [%s] (FD %d)", - __func__, ups->name, ups->sock_fd); - unext = ups->next; if (ups->sock_fd != -1) { @@ -710,11 +640,10 @@ static void upsd_cleanup(void) user_flush(); desc_free(); - + server_free(); client_free(); driver_free(); - tracking_free(); free(statepath); free(datapath); @@ -726,256 +655,27 @@ static void upsd_cleanup(void) free(handler); } -static void poll_reload(void) +void poll_reload(void) { - long ret; + int ret; ret = sysconf(_SC_OPEN_MAX); - if ((intmax_t)ret < (intmax_t)maxconn) { + if (ret < maxconn) { fatalx(EXIT_FAILURE, - "Your system limits the maximum number of connections to %ld\n" - "but you requested %jd. The server won't start until this\n" - "problem is resolved.\n", ret, (intmax_t)maxconn); + "Your system limits the maximum number of connections to %d\n" + "but you requested %d. The server won't start until this\n" + "problem is resolved.\n", ret, maxconn); } - if (1 > maxconn) { - fatalx(EXIT_FAILURE, - "You requested %jd as maximum number of connections.\n" - "The server won't start until this problem is resolved.\n", (intmax_t)maxconn); - } - - /* How many items can we stuff into the array? */ - size_t maxalloc = SIZE_MAX / sizeof(void *); - if ((uintmax_t)maxalloc < (uintmax_t)maxconn) { - fatalx(EXIT_FAILURE, - "You requested %jd as maximum number of connections, but we can only allocate %zu.\n" - "The server won't start until this problem is resolved.\n", (intmax_t)maxconn, maxalloc); - } - - /* The checks above effectively limit that maxconn is in size_t range */ - fds = xrealloc(fds, (size_t)maxconn * sizeof(*fds)); - handler = xrealloc(handler, (size_t)maxconn * sizeof(*handler)); -} - -/* instant command and setvar status tracking */ - -/* allocate a new status tracking entry */ -int tracking_add(const char *id) -{ - tracking_t *item; - - if ((!tracking_enabled) || (!id)) - return 0; - - item = xcalloc(1, sizeof(*item)); - - item->id = xstrdup(id); - item->status = STAT_PENDING; - time(&item->request_time); - - if (tracking_list) { - tracking_list->prev = item; - item->next = tracking_list; - } - - tracking_list = item; - - return 1; -} - -/* set status of a specific tracking entry */ -int tracking_set(const char *id, const char *value) -{ - tracking_t *item, *next_item; - - /* sanity checks */ - if ((!tracking_list) || (!id) || (!value)) - return 0; - - for (item = tracking_list; item; item = next_item) { - - next_item = item->next; - - if (!strcasecmp(item->id, id)) { - item->status = atoi(value); - return 1; - } - } - - return 0; /* id not found! */ -} - -/* free a specific tracking entry */ -int tracking_del(const char *id) -{ - tracking_t *item, *next_item; - - /* sanity check */ - if ((!tracking_list) || (!id)) - return 0; - - upsdebugx(3, "%s: deleting id %s", __func__, id); - - for (item = tracking_list; item; item = next_item) { - - next_item = item->next; - - if (strcasecmp(item->id, id)) - continue; - - if (item->prev) - item->prev->next = item->next; - else - /* deleting first entry */ - tracking_list = item->next; - - if (item->next) - item->next->prev = item->prev; - - free(item->id); - free(item); - - return 1; - - } - - return 0; /* id not found! */ -} - -/* free all status tracking entries */ -void tracking_free(void) -{ - tracking_t *item, *next_item; - - /* sanity check */ - if (!tracking_list) - return; - - upsdebugx(3, "%s", __func__); - - for (item = tracking_list; item; item = next_item) { - next_item = item->next; - tracking_del(item->id); - } -} - -/* cleanup status tracking entries according to their age and tracking_delay */ -void tracking_cleanup(void) -{ - tracking_t *item, *next_item; - time_t now; - - /* sanity check */ - if (!tracking_list) - return; - - time(&now); - - upsdebugx(3, "%s", __func__); - - for (item = tracking_list; item; item = next_item) { - - next_item = item->next; - - if (difftime(now, item->request_time) > tracking_delay) { - tracking_del(item->id); - } - } -} - -/* get status of a specific tracking entry */ -char *tracking_get(const char *id) -{ - tracking_t *item, *next_item; - - /* sanity checks */ - if ((!tracking_list) || (!id)) - return "ERR UNKNOWN"; - - for (item = tracking_list; item; item = next_item) { - - next_item = item->next; - - if (strcasecmp(item->id, id)) - continue; - - switch (item->status) - { - case STAT_PENDING: - return "PENDING"; - case STAT_HANDLED: - return "SUCCESS"; - case STAT_UNKNOWN: - return "ERR UNKNOWN"; - case STAT_INVALID: - return "ERR INVALID-ARGUMENT"; - case STAT_FAILED: - return "ERR FAILED"; - } - } - - return "ERR UNKNOWN"; /* id not found! */ -} - -/* enable general status tracking (tracking_enabled) and return its value (1). */ -int tracking_enable(void) -{ - tracking_enabled = 1; - - return tracking_enabled; -} - -/* disable general status tracking only if no client use it anymore. - * return the new value for tracking_enabled */ -int tracking_disable(void) -{ - nut_ctype_t *client, *cnext; - - for (client = firstclient; client; client = cnext) { - cnext = client->next; - if (client->tracking == 1) - return 1; - } - return 0; -} - -/* return current general status of tracking (tracking_enabled). */ -int tracking_is_enabled(void) -{ - return tracking_enabled; -} - -/* UUID v4 basic implementation - * Note: 'dest' must be at least `UUID4_LEN` long */ -int nut_uuid_v4(char *uuid_str) -{ - size_t i; - uint8_t nut_uuid[UUID4_BYTESIZE]; - - if (!uuid_str) - return 0; - - for (i = 0; i < UUID4_BYTESIZE; i++) - nut_uuid[i] = (uint8_t)rand() + (uint8_t)rand(); - - /* set variant and version */ - nut_uuid[6] = (nut_uuid[6] & 0x0F) | 0x40; - nut_uuid[8] = (nut_uuid[8] & 0x3F) | 0x80; - - return snprintf(uuid_str, UUID4_LEN, - "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", - nut_uuid[0], nut_uuid[1], nut_uuid[2], nut_uuid[3], - nut_uuid[4], nut_uuid[5], nut_uuid[6], nut_uuid[7], - nut_uuid[8], nut_uuid[9], nut_uuid[10], nut_uuid[11], - nut_uuid[12], nut_uuid[13], nut_uuid[14], nut_uuid[15]); + fds = xrealloc(fds, maxconn * sizeof(*fds)); + handler = xrealloc(handler, maxconn * sizeof(*handler)); } /* service requests and check on new data */ static void mainloop(void) { - int ret; - nfds_t i, nfds = 0; + int i, ret, nfds = 0; upstype_t *ups; nut_ctype_t *client, *cnext; @@ -990,19 +690,12 @@ static void mainloop(void) reload_flag = 0; } - /* cleanup instcmd/setvar status tracking entries if needed */ - tracking_cleanup(); - /* scan through driver sockets */ for (ups = firstups; ups && (nfds < maxconn); ups = ups->next) { /* see if we need to (re)connect to the socket */ if (ups->sock_fd < 0) { - upsdebugx(1, "%s: UPS [%s] is not currently connected", - __func__, ups->name); ups->sock_fd = sstate_connect(ups); - upsdebugx(1, "%s: UPS [%s] is now connected as FD %d", - __func__, ups->name, ups->sock_fd); continue; } @@ -1029,7 +722,6 @@ static void mainloop(void) if (difftime(now, client->last_heard) > 60) { /* shed clients after 1 minute of inactivity */ - /* FIXME: create an upsd.conf parameter (CLIENT_INACTIVITY_DELAY) */ client_disconnect(client); continue; } @@ -1064,7 +756,7 @@ static void mainloop(void) nfds++; } - upsdebugx(2, "%s: polling %jd filedescriptors", __func__, (intmax_t)nfds); + upsdebugx(2, "%s: polling %d filedescriptors", __func__, nfds); ret = poll(fds, nfds, 2000); @@ -1093,36 +785,9 @@ static void mainloop(void) case SERVER: upsdebugx(2, "%s: server disconnected", __func__); break; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcovered-switch-default" -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: upsdebugx(2, "%s: disconnected", __func__); break; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif - } continue; @@ -1141,35 +806,9 @@ static void mainloop(void) case SERVER: client_connect((stype_t *)handler[i].data); break; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT -# pragma GCC diagnostic ignored "-Wcovered-switch-default" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -# pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -/* Older CLANG (e.g. clang-3.4) seems to not support the GCC pragmas above */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wcovered-switch-default" -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* All enum cases defined as of the time of coding - * have been covered above. Handle later definitions, - * memory corruptions and buggy inputs below... - */ default: upsdebugx(2, "%s: has data available", __func__); break; -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_COVERED_SWITCH_DEFAULT) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE) ) -# pragma GCC diagnostic pop -#endif } continue; @@ -1177,24 +816,17 @@ static void mainloop(void) } } -static void help(const char *arg_progname) - __attribute__((noreturn)); - -static void help(const char *arg_progname) +static void help(const char *progname) { printf("Network server for UPS data.\n\n"); - printf("usage: %s [OPTIONS]\n", arg_progname); + printf("usage: %s [OPTIONS]\n", progname); printf("\n"); printf(" -c send via signal to background process\n"); printf(" commands:\n"); printf(" - reload: reread configuration files\n"); printf(" - stop: stop process and exit\n"); - printf(" -P send the signal above to specified PID (bypassing PID file)\n"); - printf(" -D raise debugging level (and stay foreground by default)\n"); - printf(" -F stay foregrounded even if no debugging is enabled\n"); - printf(" -FF stay foregrounded and still save the PID file\n"); - printf(" -B stay backgrounded even if debugging is bumped\n"); + printf(" -D raise debugging level\n"); printf(" -h display this help\n"); printf(" -r chroots to \n"); printf(" -q raise log level threshold\n"); @@ -1208,7 +840,6 @@ static void help(const char *arg_progname) static void set_reload_flag(int sig) { - NUT_UNUSED_VARIABLE(sig); reload_flag = 1; } @@ -1226,14 +857,7 @@ static void setup_signals(void) sa.sa_flags = 0; /* basic signal setup to ignore SIGPIPE */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif sa.sa_handler = SIG_IGN; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif sigaction(SIGPIPE, &sa, NULL); /* handle shutdown signals */ @@ -1266,11 +890,10 @@ void check_perms(const char *fn) int main(int argc, char **argv) { - int i, cmd = 0, cmdret = 0, foreground = -1; + int i, cmd = 0; char *chroot_path = NULL; const char *user = RUN_AS_USER; struct passwd *new_uid = NULL; - pid_t oldpid = -1; progname = xbasename(argv[0]); @@ -1283,29 +906,25 @@ int main(int argc, char **argv) printf("Network UPS Tools %s %s\n", progname, UPS_VERSION); - while ((i = getopt(argc, argv, "+h46p:qr:i:fu:Vc:P:DFB")) != -1) { + while ((i = getopt(argc, argv, "+h46p:qr:i:fu:Vc:D")) != -1) { switch (i) { + case 'h': + help(progname); + break; case 'p': case 'i': fatalx(EXIT_FAILURE, "Specifying a listening addresses with '-i
' and '-p '\n" "is deprecated. Use 'LISTEN
[]' in 'upsd.conf' instead.\n" "See 'man 8 upsd.conf' for more information."); -#ifndef HAVE___ATTRIBUTE__NORETURN - exit(EXIT_FAILURE); /* Should not get here in practice, but compiler is afraid we can fall through */ -#endif - case 'q': nut_log_level++; break; - case 'r': chroot_path = optarg; break; - case 'u': user = optarg; break; - case 'V': /* do nothing - we already printed the banner */ exit(EXIT_SUCCESS); @@ -1321,25 +940,9 @@ int main(int argc, char **argv) help(progname); break; - case 'P': - if ((oldpid = parsepid(optarg)) < 0) - help(progname); - break; - case 'D': nut_debug_level++; break; - case 'F': - if (foreground > 0) { - /* specified twice to save PID file anyway */ - foreground = 2; - } else { - foreground = 1; - } - break; - case 'B': - foreground = 0; - break; case '4': opt_af = AF_INET; @@ -1349,56 +952,24 @@ int main(int argc, char **argv) opt_af = AF_INET6; break; - case 'h': default: help(progname); - } - } - - if (foreground < 0) { - if (nut_debug_level > 0) { - foreground = 1; - } else { - foreground = 0; + break; } } if (cmd) { - if (oldpid < 0) { - cmdret = sendsignalfn(pidfn, cmd); - } else { - cmdret = sendsignalpid(oldpid, cmd); - } - exit((cmdret == 0)?EXIT_SUCCESS:EXIT_FAILURE); + sendsignalfn(pidfn, cmd); + exit(EXIT_SUCCESS); } /* otherwise, we are being asked to start. * so check if a previous instance is running by sending signal '0' * (Ie 'kill 0') */ - if (oldpid < 0) { - cmdret = sendsignalfn(pidfn, 0); - } else { - cmdret = sendsignalpid(oldpid, 0); - } - switch (cmdret) { - case 0: + if (sendsignalfn(pidfn, 0) == 0) { printf("Fatal error: A previous upsd instance is already running!\n"); printf("Either stop the previous instance first, or use the 'reload' command.\n"); exit(EXIT_FAILURE); - - case -3: - case -2: - upslogx(LOG_WARNING, "Could not %s PID file '%s' " - "to see if previous upsd instance is " - "already running!\n", - (cmdret == -3 ? "find" : "parse"), - pidfn); - break; - - case -1: - default: - /* Just failed to send signal, no competitor running */ - break; } argc -= optind; @@ -1424,46 +995,18 @@ int main(int argc, char **argv) chroot_start(chroot_path); } - /* default to system limit (may be overridden in upsd.conf) */ - /* FIXME: Check for overflows (and int size of nfds_t vs. long) - see get_max_pid_t() for example */ - maxconn = (nfds_t)sysconf(_SC_OPEN_MAX); + /* default to system limit (may be overridden in upsd.conf */ + maxconn = sysconf(_SC_OPEN_MAX); /* handle upsd.conf */ load_upsdconf(0); /* 0 = initial */ - /* CLI debug level can not be smaller than debug_min specified - * in upsd.conf. Note that non-zero debug_min does not impact - * foreground running mode. - */ - if (nut_debug_level_global > nut_debug_level) - nut_debug_level = nut_debug_level_global; - upsdebugx(1, "debug level is '%d'", nut_debug_level); - - { /* scope */ - /* As documented above, the ALLOW_NO_DEVICE can be provided via - * envvars and then has higher priority than an upsd.conf setting - */ - const char *envvar = getenv("ALLOW_NO_DEVICE"); - if ( envvar != NULL) { - if ( (!strncasecmp("TRUE", envvar, 4)) || (!strncasecmp("YES", envvar, 3)) || (!strncasecmp("ON", envvar, 2)) || (!strncasecmp("1", envvar, 1)) ) { - /* Admins of this server expressed a desire to serve - * anything on the NUT protocol, even if nothing is - * configured yet - tell the clients so, properly. - */ - allow_no_device = 1; - } else if ( (!strncasecmp("FALSE", envvar, 5)) || (!strncasecmp("NO", envvar, 2)) || (!strncasecmp("OFF", envvar, 3)) || (!strncasecmp("0", envvar, 1)) ) { - /* Admins of this server expressed a desire to serve - * anything on the NUT protocol, even if nothing is - * configured yet - tell the clients so, properly. - */ - allow_no_device = 0; - } - } - } /* scope */ - /* start server */ server_load(); + /* initialize SSL before we drop privileges (we may not be able to read the keyfile as non-root) */ + ssl_init(); + become_user(new_uid); if (chdir(statepath)) { @@ -1479,11 +1022,7 @@ int main(int argc, char **argv) poll_reload(); if (num_ups == 0) { - if (allow_no_device) { - upslogx(LOG_WARNING, "Normally at least one UPS must be defined in ups.conf, currently there are none (please configure the file and reload the service)"); - } else { - fatalx(EXIT_FAILURE, "Fatal error: at least one UPS must be defined in ups.conf"); - } + fatalx(EXIT_FAILURE, "Fatal error: at least one UPS must be defined in ups.conf"); } /* try to bring in the var/cmd descriptions */ @@ -1492,22 +1031,13 @@ int main(int argc, char **argv) /* handle upsd.users */ user_load(); - if (!foreground) { + if (!nut_debug_level) { background(); writepid(pidfn); } else { - if (foreground == 2) { - upslogx(LOG_WARNING, "Running as foreground process, but saving a PID file anyway"); - writepid(pidfn); - } else { - upslogx(LOG_WARNING, "Running as foreground process, not saving a PID file"); - memset(pidfn, 0, sizeof(pidfn)); - } + memset(pidfn, 0, sizeof(pidfn)); } - /* initialize SSL (keyfile must be readable by nut user) */ - ssl_init(); - while (!exit_flag) { mainloop(); } diff --git a/server/upsd.h b/server/upsd.h index 1380188..2b3a3a7 100644 --- a/server/upsd.h +++ b/server/upsd.h @@ -38,7 +38,6 @@ #include "timehead.h" #include -#include /* nfds_t */ #include "parseconf.h" #include "nut_ctype.h" @@ -69,30 +68,9 @@ void server_free(void); void check_perms(const char *fn); -/* return values for instcmd / setvar status tracking, - * mapped on drivers/upshandler.h, apart from STAT_PENDING (initial state) */ -enum { - STAT_PENDING = -1, /* not yet completed */ - STAT_HANDLED = 0, /* completed successfully (NUT_SUCCESS or "OK") */ - STAT_UNKNOWN, /* unspecified error (NUT_ERR_UNKNOWN) */ - STAT_INVALID, /* invalid command/setvar (NUT_ERR_INVALID_ARGUMENT) */ - STAT_FAILED /* command/setvar failed (NUT_ERR_INSTCMD_FAILED / NUT_ERR_SET_FAILED) */ -}; - -/* Commands and settings status tracking functions */ -int tracking_add(const char *id); -int tracking_set(const char *id, const char *value); -int tracking_del(const char *id); -void tracking_free(void); -void tracking_cleanup(void); -char *tracking_get(const char *id); -int tracking_enable(void); -int tracking_disable(void); -int tracking_is_enabled(void); - /* declarations from upsd.c */ -extern int maxage, tracking_delay, allow_no_device; -extern nfds_t maxconn; + +extern int maxage, maxconn; extern char *statepath, *datapath; extern upstype_t *firstups; extern nut_ctype_t *firstclient; @@ -113,10 +91,6 @@ extern nut_ctype_t *firstclient; #define shutdown_how 2 #endif -/* UUID v4 generation function - * Note: 'dest' must be at least `UUID4_LEN` long */ -int nut_uuid_v4(char *uuid_str); - #ifdef __cplusplus /* *INDENT-OFF* */ } diff --git a/server/upstype.h b/server/upstype.h index bc03187..bbadd50 100644 --- a/server/upstype.h +++ b/server/upstype.h @@ -19,8 +19,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_UPSTYPE_H_SEEN -#define NUT_UPSTYPE_H_SEEN 1 +#ifndef UPSTYPE_H_SEEN +#define UPSTYPE_H_SEEN 1 #include "parseconf.h" @@ -51,7 +51,7 @@ typedef struct upstype_s { int fsd; /* forced shutdown in effect? */ int retain; - + struct upstype_s *next; } upstype_t; @@ -64,4 +64,4 @@ extern upstype_t *firstups; /* *INDENT-ON* */ #endif -#endif /* NUT_UPSTYPE_H_SEEN */ +#endif /* UPSTYPE_H_SEEN */ diff --git a/server/user-data.h b/server/user-data.h index d5da7b4..5cc1e99 100644 --- a/server/user-data.h +++ b/server/user-data.h @@ -1,11 +1,6 @@ /* user-data.h - structures for user.c Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2008 Arjen de Korte - 2013 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_USERDATA_H_SEEN -#define NUT_USERDATA_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -55,4 +47,3 @@ typedef struct { /* *INDENT-ON* */ #endif -#endif /* NUT_USERDATA_H_SEEN */ diff --git a/server/user.c b/server/user.c index b0c985b..8eff8a0 100644 --- a/server/user.c +++ b/server/user.c @@ -17,8 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "config.h" /* must be the first header */ - #include #include #include @@ -30,9 +28,9 @@ #include "user.h" #include "user-data.h" -static ulist_t *users = NULL; + ulist_t *users = NULL; -static ulist_t *curr_user; + static ulist_t *curr_user; /* create a new user entry */ static void user_add(const char *un) @@ -59,7 +57,7 @@ static void user_add(const char *un) if (last) { last->next = tmp; } else { - users = tmp; + users = tmp; } /* remember who we're working on */ @@ -80,7 +78,7 @@ static void user_password(const char *pw) } if (curr_user->password) { - fprintf(stderr, "Ignoring duplicate password for %s\n", + fprintf(stderr, "Ignoring duplicate password for %s\n", curr_user->username); return; } @@ -319,20 +317,19 @@ int user_checkaction(const char *un, const char *pw, const char *action) return 0; /* fail */ } -/* handle "upsmon primary" and "upsmon secondary" for nicer configurations */ -/* FIXME: Protocol update needed to handle master/primary alias (in action and in protocol) */ +/* handle "upsmon master" and "upsmon slave" for nicer configurations */ static void set_upsmon_type(char *type) { - /* primary: login, master, fsd */ - if (!strcasecmp(type, "master") || !strcasecmp(type, "primary")) { + /* master: login, master, fsd */ + if (!strcasecmp(type, "master")) { user_add_action("login"); - user_add_action("master"); /* Note: this is linked to "MASTER" API command permission */ + user_add_action("master"); user_add_action("fsd"); return; } - /* secondary: just login */ - if (!strcasecmp(type, "slave") || !strcasecmp(type, "secondary")) { + /* slave: just login */ + if (!strcasecmp(type, "slave")) { user_add_action("login"); return; } @@ -373,9 +370,9 @@ static void parse_var(char *var, char *val) } /* parse first var+val pair, then flip through remaining vals */ -static void parse_rest(char *var, char *fval, char **arg, size_t next, size_t left) +static void parse_rest(char *var, char *fval, char **arg, int next, int left) { - size_t i; + int i; /* no globals supported yet, so there's no sense in continuing */ if (!curr_user) { @@ -393,7 +390,7 @@ static void parse_rest(char *var, char *fval, char **arg, size_t next, size_t le } } -static void user_parse_arg(size_t numargs, char **arg) +static void user_parse_arg(int numargs, char **arg) { char *ep; @@ -417,7 +414,7 @@ static void user_parse_arg(size_t numargs, char **arg) /* 0 1 2 ... */ /* foo=bar ... */ - parse_rest(arg[0], ep+1, arg, 1, (numargs < 2) ? 0 : (numargs - 1)); + parse_rest(arg[0], ep+1, arg, 1, numargs - 1); return; } @@ -450,8 +447,8 @@ static void user_parse_arg(size_t numargs, char **arg) /* foo = bar ... */ /* parse first var/val, plus subsequent values (if any) */ - - parse_rest(arg[0], arg[2], arg, 3, (numargs < 4) ? 0 : (numargs - 3)); + + parse_rest(arg[0], arg[2], arg, 3, numargs - 3); return; } diff --git a/server/user.h b/server/user.h index 613a0c5..48b7004 100644 --- a/server/user.h +++ b/server/user.h @@ -1,11 +1,6 @@ /* user.c - supporting elements of user handling functions for upsd Copyright (C) 2001 Russell Kroll - 2005 Arnaud Quette - 2007 Peter Selinger - 2008 Arjen de Korte - 2013 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,9 +17,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef NUT_USER_H_SEEN -#define NUT_USER_H_SEEN 1 - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -47,4 +39,3 @@ void check_perms(const char *fn); /* *INDENT-ON* */ #endif -#endif /* NUT_USER_H_SEEN */ diff --git a/test-driver b/test-driver deleted file mode 100755 index 9759384..0000000 --- a/test-driver +++ /dev/null @@ -1,150 +0,0 @@ -#! /bin/sh -# test-driver - basic testsuite driver script. - -scriptversion=2018-03-07.03; # UTC - -# Copyright (C) 2011-2020 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -# Make unconditional expansion of undefined variables an error. This -# helps a lot in preventing typo-related bugs. -set -u - -usage_error () -{ - echo "$0: $*" >&2 - print_usage >&2 - exit 2 -} - -print_usage () -{ - cat <$log_file 2>&1 -estatus=$? - -if test $enable_hard_errors = no && test $estatus -eq 99; then - tweaked_estatus=1 -else - tweaked_estatus=$estatus -fi - -case $tweaked_estatus:$expect_failure in - 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; - 0:*) col=$grn res=PASS recheck=no gcopy=no;; - 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; - 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; - *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; - *:*) col=$red res=FAIL recheck=yes gcopy=yes;; -esac - -# Report the test outcome and exit status in the logs, so that one can -# know whether the test passed or failed simply by looking at the '.log' -# file, without the need of also peaking into the corresponding '.trs' -# file (automake bug#11814). -echo "$res $test_name (exit status: $estatus)" >>$log_file - -# Report outcome to console. -echo "${col}${res}${std}: $test_name" - -# Register the test result, and other relevant metadata. -echo ":test-result: $res" > $trs_file -echo ":global-test-result: $res" >> $trs_file -echo ":recheck: $recheck" >> $trs_file -echo ":copy-in-global-log: $gcopy" >> $trs_file - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/tests/Makefile.am b/tests/Makefile.am index e9cfd70..3960ad8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,117 +1,21 @@ # Network UPS Tools: tests -SUBDIRS = . NIT +if HAVE_CPPUNIT -all: $(TESTS) - -EXTRA_DIST = nut-driver-enumerator-test.sh nut-driver-enumerator-test--ups.conf - -TESTS = nutlogtest -CLEANFILES = *.trs *.log - -AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/drivers -AM_CXXFLAGS = -I$(top_srcdir)/include +TESTS = cppunittest check_PROGRAMS = $(TESTS) -# NUT Integration Testing suite -check-NIT check-NIT-devel: - cd "$(builddir)/NIT" && $(MAKE) $@ +cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) +cppunittest_LDFLAGS = $(CPPUNIT_LIBS) -nutlogtest_SOURCES = nutlogtest.c -nutlogtest_LDADD = $(top_builddir)/common/libcommon.la - -# Separate the .deps of other dirs from this one -LINKED_SOURCE_FILES = hidparser.c - -# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver -# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -hidparser.c: $(top_srcdir)/drivers/hidparser.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" - -if WITH_USB -TESTS += getvaluetest - -getvaluetest_SOURCES = getvaluetest.c -nodist_getvaluetest_SOURCES = hidparser.c -# Pull the right include path for chosen libusb version: -getvaluetest_CFLAGS = $(AM_CFLAGS) $(LIBUSB_CFLAGS) -getvaluetest_LDADD = $(top_builddir)/common/libcommon.la -endif - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -### Optional tests which can not be built everywhere # List of src files for CppUnit tests -CPPUNITTESTSRC = example.cpp nutclienttest.cpp -# The test driver which orchestrates running those tests above -CPPUNITTESTERSRC = cpputest.cpp +CPPUNITTESTSRC = example.cpp -CPPCLIENTTESTSRC = cpputest-client.cpp - -TESTS_CXX11 = cppunittest - -if HAVE_CXX11 -if HAVE_CPPUNIT -# Note: per configure script this "SHOULD" also assume -# that we HAVE_CXX11 - but better have it explicit - -TESTS += $(TESTS_CXX11) - -# Note: we only build it, but do not run directly (NIT prepares the sandbox) -check_PROGRAMS += cppnit - -if WITH_VALGRIND -check-local: $(check_PROGRAMS) - RES=0; for P in $^ ; do $(VALGRIND) ./$$P || { RES=$$? ; echo "FAILED: $(VALGRIND) ./$$P" >&2; }; done; exit $$RES -endif - -cppunittest_CXXFLAGS = $(AM_CXXFLAGS) $(CPPUNIT_CFLAGS) $(CPPUNIT_CXXFLAGS) $(CPPUNIT_NUT_CXXFLAGS) $(CXXFLAGS) -cppunittest_LDFLAGS = $(CPPUNIT_LDFLAGS) $(CPPUNIT_LIBS) -cppunittest_LDADD = $(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la -cppunittest_SOURCES = $(CPPUNITTESTSRC) $(CPPUNITTESTERSRC) - -cppnit_CXXFLAGS = $(AM_CXXFLAGS) $(CPPUNIT_CFLAGS) $(CPPUNIT_CXXFLAGS) $(CPPUNIT_NUT_CXXFLAGS) $(CXXFLAGS) -cppnit_LDFLAGS = $(CPPUNIT_LDFLAGS) $(CPPUNIT_LIBS) -cppnit_LDADD = $(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la -cppnit_SOURCES = $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) - -# Make sure out-of-dir C++ dependencies exist (especially when dev-building -# only some parts of NUT): -$(top_builddir)/clients/libnutclient.la \ -$(top_builddir)/clients/libnutclientstub.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) +cppunittest_SOURCES = $(CPPUNITTESTSRC) cpputest.cpp else !HAVE_CPPUNIT -# Just redistribute test source into tarball if not building tests -EXTRA_DIST += $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) - -cppnit: - @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 +EXTRA_DIST = example.cpp cpputest.cpp endif !HAVE_CPPUNIT - -else !HAVE_CXX11 -# Just redistribute test source into tarball if not building C++ at all - -EXTRA_DIST += $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) - -cppnit: - @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 - -endif !HAVE_CXX11 - -dummy: - -BUILT_SOURCES = $(LINKED_SOURCE_FILES) -CLEANFILES += $(LINKED_SOURCE_FILES) -CLEANFILES += $(TESTS) $(TESTS_CXX11) -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps diff --git a/tests/Makefile.in b/tests/Makefile.in index 25d882b..153fc11 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,61 +17,23 @@ # Network UPS Tools: tests VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -90,41 +53,22 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -TESTS = nutlogtest$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3) -check_PROGRAMS = $(am__EXEEXT_4) $(am__EXEEXT_5) -@WITH_USB_TRUE@am__append_1 = getvaluetest - -# Note: per configure script this "SHOULD" also assume -# that we HAVE_CXX11 - but better have it explicit -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am__append_2 = $(TESTS_CXX11) - -# Note: we only build it, but do not run directly (NIT prepares the sandbox) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am__append_3 = cppnit - -# Just redistribute test source into tarball if not building tests -@HAVE_CPPUNIT_FALSE@@HAVE_CXX11_TRUE@am__append_4 = $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) - -# Just redistribute test source into tarball if not building C++ at all -@HAVE_CXX11_FALSE@am__append_5 = $(CPPUNITTESTSRC) $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) +@HAVE_CPPUNIT_TRUE@TESTS = cppunittest$(EXEEXT) +@HAVE_CPPUNIT_TRUE@check_PROGRAMS = $(am__EXEEXT_1) subdir = tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -133,418 +77,57 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -@WITH_USB_TRUE@am__EXEEXT_1 = getvaluetest$(EXEEXT) -am__EXEEXT_2 = cppunittest$(EXEEXT) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am__EXEEXT_3 = $(am__EXEEXT_2) -am__EXEEXT_4 = nutlogtest$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_3) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am__EXEEXT_5 = cppnit$(EXEEXT) -am__cppnit_SOURCES_DIST = cpputest-client.cpp cpputest.cpp -am__objects_1 = cppnit-cpputest-client.$(OBJEXT) -am__objects_2 = cppnit-cpputest.$(OBJEXT) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am_cppnit_OBJECTS = \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(am__objects_1) \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(am__objects_2) -cppnit_OBJECTS = $(am_cppnit_OBJECTS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit_DEPENDENCIES = $(top_builddir)/clients/libnutclient.la \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(top_builddir)/clients/libnutclientstub.la -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -cppnit_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(cppnit_CXXFLAGS) \ - $(CXXFLAGS) $(cppnit_LDFLAGS) $(LDFLAGS) -o $@ -am__cppunittest_SOURCES_DIST = example.cpp nutclienttest.cpp \ - cpputest.cpp -am__objects_3 = cppunittest-example.$(OBJEXT) \ - cppunittest-nutclienttest.$(OBJEXT) -am__objects_4 = cppunittest-cpputest.$(OBJEXT) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@am_cppunittest_OBJECTS = \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(am__objects_3) \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(am__objects_4) +@HAVE_CPPUNIT_TRUE@am__EXEEXT_1 = cppunittest$(EXEEXT) +am__cppunittest_SOURCES_DIST = example.cpp cpputest.cpp +@HAVE_CPPUNIT_TRUE@am__objects_1 = cppunittest-example.$(OBJEXT) +@HAVE_CPPUNIT_TRUE@am_cppunittest_OBJECTS = $(am__objects_1) \ +@HAVE_CPPUNIT_TRUE@ cppunittest-cpputest.$(OBJEXT) cppunittest_OBJECTS = $(am_cppunittest_OBJECTS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppunittest_DEPENDENCIES = $(top_builddir)/clients/libnutclient.la \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(top_builddir)/clients/libnutclientstub.la -cppunittest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ +cppunittest_LDADD = $(LDADD) +cppunittest_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(cppunittest_CXXFLAGS) \ $(CXXFLAGS) $(cppunittest_LDFLAGS) $(LDFLAGS) -o $@ -am__getvaluetest_SOURCES_DIST = getvaluetest.c -@WITH_USB_TRUE@am_getvaluetest_OBJECTS = \ -@WITH_USB_TRUE@ getvaluetest-getvaluetest.$(OBJEXT) -@WITH_USB_TRUE@nodist_getvaluetest_OBJECTS = \ -@WITH_USB_TRUE@ getvaluetest-hidparser.$(OBJEXT) -getvaluetest_OBJECTS = $(am_getvaluetest_OBJECTS) \ - $(nodist_getvaluetest_OBJECTS) -@WITH_USB_TRUE@getvaluetest_DEPENDENCIES = \ -@WITH_USB_TRUE@ $(top_builddir)/common/libcommon.la -getvaluetest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(getvaluetest_CFLAGS) \ - $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -am_nutlogtest_OBJECTS = nutlogtest.$(OBJEXT) -nutlogtest_OBJECTS = $(am_nutlogtest_OBJECTS) -nutlogtest_DEPENDENCIES = $(top_builddir)/common/libcommon.la -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/cppnit-cpputest-client.Po \ - ./$(DEPDIR)/cppnit-cpputest.Po \ - ./$(DEPDIR)/cppunittest-cpputest.Po \ - ./$(DEPDIR)/cppunittest-example.Po \ - ./$(DEPDIR)/cppunittest-nutclienttest.Po \ - ./$(DEPDIR)/getvaluetest-getvaluetest.Po \ - ./$(DEPDIR)/getvaluetest-hidparser.Po \ - ./$(DEPDIR)/nutlogtest.Po +am__depfiles_maybe = depfiles am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -AM_V_CXX = $(am__v_CXX_@AM_V@) -am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@) -am__v_CXX_0 = @echo " CXX " $@; -am__v_CXX_1 = +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CXXLD = $(am__v_CXXLD_@AM_V@) -am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@) -am__v_CXXLD_0 = @echo " CXXLD " $@; -am__v_CXXLD_1 = -SOURCES = $(cppnit_SOURCES) $(cppunittest_SOURCES) \ - $(getvaluetest_SOURCES) $(nodist_getvaluetest_SOURCES) \ - $(nutlogtest_SOURCES) -DIST_SOURCES = $(am__cppnit_SOURCES_DIST) \ - $(am__cppunittest_SOURCES_DIST) \ - $(am__getvaluetest_SOURCES_DIST) $(nutlogtest_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(cppunittest_SOURCES) +DIST_SOURCES = $(am__cppunittest_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - check recheck distdir distdir-am -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' -RECHECK_LOGS = $(TEST_LOGS) -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp \ - $(top_srcdir)/test-driver +am__tty_colors = \ +red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -555,7 +138,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -569,7 +151,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -582,8 +163,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -593,15 +177,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -612,29 +195,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -654,9 +229,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -665,16 +237,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -688,7 +256,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -699,12 +266,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -723,21 +286,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -747,47 +307,17 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ -SUBDIRS = . NIT -EXTRA_DIST = nut-driver-enumerator-test.sh \ - nut-driver-enumerator-test--ups.conf $(am__append_4) \ - $(am__append_5) -CLEANFILES = *.trs *.log $(LINKED_SOURCE_FILES) $(TESTS) \ - $(TESTS_CXX11) -AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/drivers -AM_CXXFLAGS = -I$(top_srcdir)/include -nutlogtest_SOURCES = nutlogtest.c -nutlogtest_LDADD = $(top_builddir)/common/libcommon.la +@HAVE_CPPUNIT_TRUE@cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) +@HAVE_CPPUNIT_TRUE@cppunittest_LDFLAGS = $(CPPUNIT_LIBS) -# Separate the .deps of other dirs from this one -LINKED_SOURCE_FILES = hidparser.c -@WITH_USB_TRUE@getvaluetest_SOURCES = getvaluetest.c -@WITH_USB_TRUE@nodist_getvaluetest_SOURCES = hidparser.c -# Pull the right include path for chosen libusb version: -@WITH_USB_TRUE@getvaluetest_CFLAGS = $(AM_CFLAGS) $(LIBUSB_CFLAGS) -@WITH_USB_TRUE@getvaluetest_LDADD = $(top_builddir)/common/libcommon.la - -### Optional tests which can not be built everywhere # List of src files for CppUnit tests -CPPUNITTESTSRC = example.cpp nutclienttest.cpp -# The test driver which orchestrates running those tests above -CPPUNITTESTERSRC = cpputest.cpp -CPPCLIENTTESTSRC = cpputest-client.cpp -TESTS_CXX11 = cppunittest -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppunittest_CXXFLAGS = $(AM_CXXFLAGS) $(CPPUNIT_CFLAGS) $(CPPUNIT_CXXFLAGS) $(CPPUNIT_NUT_CXXFLAGS) $(CXXFLAGS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppunittest_LDFLAGS = $(CPPUNIT_LDFLAGS) $(CPPUNIT_LIBS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppunittest_LDADD = $(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppunittest_SOURCES = $(CPPUNITTESTSRC) $(CPPUNITTESTERSRC) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit_CXXFLAGS = $(AM_CXXFLAGS) $(CPPUNIT_CFLAGS) $(CPPUNIT_CXXFLAGS) $(CPPUNIT_NUT_CXXFLAGS) $(CXXFLAGS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit_LDFLAGS = $(CPPUNIT_LDFLAGS) $(CPPUNIT_LIBS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit_LDADD = $(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit_SOURCES = $(CPPCLIENTTESTSRC) $(CPPUNITTESTERSRC) -BUILT_SOURCES = $(LINKED_SOURCE_FILES) -MAINTAINERCLEANFILES = Makefile.in .dirstamp -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-recursive +@HAVE_CPPUNIT_TRUE@CPPUNITTESTSRC = example.cpp +@HAVE_CPPUNIT_TRUE@cppunittest_SOURCES = $(CPPUNITTESTSRC) cpputest.cpp +@HAVE_CPPUNIT_FALSE@EXTRA_DIST = example.cpp cpputest.cpp +all: all-am .SUFFIXES: -.SUFFIXES: .c .cpp .lo .log .o .obj .test .test$(EXEEXT) .trs +.SUFFIXES: .cpp .lo .o .obj $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ @@ -800,13 +330,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tests/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tests/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -826,22 +357,9 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list - -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@cppnit$(EXEEXT): $(cppnit_OBJECTS) $(cppnit_DEPENDENCIES) $(EXTRA_cppnit_DEPENDENCIES) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ @rm -f cppnit$(EXEEXT) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ $(AM_V_CXXLD)$(cppnit_LINK) $(cppnit_OBJECTS) $(cppnit_LDADD) $(LIBS) - cppunittest$(EXEEXT): $(cppunittest_OBJECTS) $(cppunittest_DEPENDENCIES) $(EXTRA_cppunittest_DEPENDENCIES) @rm -f cppunittest$(EXEEXT) - $(AM_V_CXXLD)$(cppunittest_LINK) $(cppunittest_OBJECTS) $(cppunittest_LDADD) $(LIBS) - -getvaluetest$(EXEEXT): $(getvaluetest_OBJECTS) $(getvaluetest_DEPENDENCIES) $(EXTRA_getvaluetest_DEPENDENCIES) - @rm -f getvaluetest$(EXEEXT) - $(AM_V_CCLD)$(getvaluetest_LINK) $(getvaluetest_OBJECTS) $(getvaluetest_LDADD) $(LIBS) - -nutlogtest$(EXEEXT): $(nutlogtest_OBJECTS) $(nutlogtest_DEPENDENCIES) $(EXTRA_nutlogtest_DEPENDENCIES) - @rm -f nutlogtest$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(nutlogtest_OBJECTS) $(nutlogtest_LDADD) $(LIBS) + $(cppunittest_LINK) $(cppunittest_OBJECTS) $(cppunittest_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -849,166 +367,57 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppnit-cpputest-client.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppnit-cpputest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppunittest-cpputest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppunittest-example.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppunittest-nutclienttest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getvaluetest-getvaluetest.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getvaluetest-hidparser.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nutlogtest.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -getvaluetest-getvaluetest.o: getvaluetest.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -MT getvaluetest-getvaluetest.o -MD -MP -MF $(DEPDIR)/getvaluetest-getvaluetest.Tpo -c -o getvaluetest-getvaluetest.o `test -f 'getvaluetest.c' || echo '$(srcdir)/'`getvaluetest.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/getvaluetest-getvaluetest.Tpo $(DEPDIR)/getvaluetest-getvaluetest.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getvaluetest.c' object='getvaluetest-getvaluetest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -c -o getvaluetest-getvaluetest.o `test -f 'getvaluetest.c' || echo '$(srcdir)/'`getvaluetest.c - -getvaluetest-getvaluetest.obj: getvaluetest.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -MT getvaluetest-getvaluetest.obj -MD -MP -MF $(DEPDIR)/getvaluetest-getvaluetest.Tpo -c -o getvaluetest-getvaluetest.obj `if test -f 'getvaluetest.c'; then $(CYGPATH_W) 'getvaluetest.c'; else $(CYGPATH_W) '$(srcdir)/getvaluetest.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/getvaluetest-getvaluetest.Tpo $(DEPDIR)/getvaluetest-getvaluetest.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='getvaluetest.c' object='getvaluetest-getvaluetest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -c -o getvaluetest-getvaluetest.obj `if test -f 'getvaluetest.c'; then $(CYGPATH_W) 'getvaluetest.c'; else $(CYGPATH_W) '$(srcdir)/getvaluetest.c'; fi` - -getvaluetest-hidparser.o: hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -MT getvaluetest-hidparser.o -MD -MP -MF $(DEPDIR)/getvaluetest-hidparser.Tpo -c -o getvaluetest-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/getvaluetest-hidparser.Tpo $(DEPDIR)/getvaluetest-hidparser.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hidparser.c' object='getvaluetest-hidparser.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -c -o getvaluetest-hidparser.o `test -f 'hidparser.c' || echo '$(srcdir)/'`hidparser.c - -getvaluetest-hidparser.obj: hidparser.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -MT getvaluetest-hidparser.obj -MD -MP -MF $(DEPDIR)/getvaluetest-hidparser.Tpo -c -o getvaluetest-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/getvaluetest-hidparser.Tpo $(DEPDIR)/getvaluetest-hidparser.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='hidparser.c' object='getvaluetest-hidparser.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(getvaluetest_CFLAGS) $(CFLAGS) -c -o getvaluetest-hidparser.obj `if test -f 'hidparser.c'; then $(CYGPATH_W) 'hidparser.c'; else $(CYGPATH_W) '$(srcdir)/hidparser.c'; fi` +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppunittest-cpputest.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppunittest-example.Po@am__quote@ .cpp.o: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $< +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .cpp.lo: -@am__fastdepCXX_TRUE@ $(AM_V_CXX)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCXX_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $< - -cppnit-cpputest-client.o: cpputest-client.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -MT cppnit-cpputest-client.o -MD -MP -MF $(DEPDIR)/cppnit-cpputest-client.Tpo -c -o cppnit-cpputest-client.o `test -f 'cpputest-client.cpp' || echo '$(srcdir)/'`cpputest-client.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppnit-cpputest-client.Tpo $(DEPDIR)/cppnit-cpputest-client.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest-client.cpp' object='cppnit-cpputest-client.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -c -o cppnit-cpputest-client.o `test -f 'cpputest-client.cpp' || echo '$(srcdir)/'`cpputest-client.cpp - -cppnit-cpputest-client.obj: cpputest-client.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -MT cppnit-cpputest-client.obj -MD -MP -MF $(DEPDIR)/cppnit-cpputest-client.Tpo -c -o cppnit-cpputest-client.obj `if test -f 'cpputest-client.cpp'; then $(CYGPATH_W) 'cpputest-client.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest-client.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppnit-cpputest-client.Tpo $(DEPDIR)/cppnit-cpputest-client.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest-client.cpp' object='cppnit-cpputest-client.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -c -o cppnit-cpputest-client.obj `if test -f 'cpputest-client.cpp'; then $(CYGPATH_W) 'cpputest-client.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest-client.cpp'; fi` - -cppnit-cpputest.o: cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -MT cppnit-cpputest.o -MD -MP -MF $(DEPDIR)/cppnit-cpputest.Tpo -c -o cppnit-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppnit-cpputest.Tpo $(DEPDIR)/cppnit-cpputest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest.cpp' object='cppnit-cpputest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -c -o cppnit-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp - -cppnit-cpputest.obj: cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -MT cppnit-cpputest.obj -MD -MP -MF $(DEPDIR)/cppnit-cpputest.Tpo -c -o cppnit-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppnit-cpputest.Tpo $(DEPDIR)/cppnit-cpputest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest.cpp' object='cppnit-cpputest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppnit_CXXFLAGS) $(CXXFLAGS) -c -o cppnit-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< cppunittest-example.o: example.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-example.o -MD -MP -MF $(DEPDIR)/cppunittest-example.Tpo -c -o cppunittest-example.o `test -f 'example.cpp' || echo '$(srcdir)/'`example.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-example.Tpo $(DEPDIR)/cppunittest-example.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='example.cpp' object='cppunittest-example.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-example.o -MD -MP -MF $(DEPDIR)/cppunittest-example.Tpo -c -o cppunittest-example.o `test -f 'example.cpp' || echo '$(srcdir)/'`example.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cppunittest-example.Tpo $(DEPDIR)/cppunittest-example.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='example.cpp' object='cppunittest-example.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-example.o `test -f 'example.cpp' || echo '$(srcdir)/'`example.cpp +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-example.o `test -f 'example.cpp' || echo '$(srcdir)/'`example.cpp cppunittest-example.obj: example.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-example.obj -MD -MP -MF $(DEPDIR)/cppunittest-example.Tpo -c -o cppunittest-example.obj `if test -f 'example.cpp'; then $(CYGPATH_W) 'example.cpp'; else $(CYGPATH_W) '$(srcdir)/example.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-example.Tpo $(DEPDIR)/cppunittest-example.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='example.cpp' object='cppunittest-example.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-example.obj -MD -MP -MF $(DEPDIR)/cppunittest-example.Tpo -c -o cppunittest-example.obj `if test -f 'example.cpp'; then $(CYGPATH_W) 'example.cpp'; else $(CYGPATH_W) '$(srcdir)/example.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cppunittest-example.Tpo $(DEPDIR)/cppunittest-example.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='example.cpp' object='cppunittest-example.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-example.obj `if test -f 'example.cpp'; then $(CYGPATH_W) 'example.cpp'; else $(CYGPATH_W) '$(srcdir)/example.cpp'; fi` - -cppunittest-nutclienttest.o: nutclienttest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-nutclienttest.o -MD -MP -MF $(DEPDIR)/cppunittest-nutclienttest.Tpo -c -o cppunittest-nutclienttest.o `test -f 'nutclienttest.cpp' || echo '$(srcdir)/'`nutclienttest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-nutclienttest.Tpo $(DEPDIR)/cppunittest-nutclienttest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nutclienttest.cpp' object='cppunittest-nutclienttest.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-nutclienttest.o `test -f 'nutclienttest.cpp' || echo '$(srcdir)/'`nutclienttest.cpp - -cppunittest-nutclienttest.obj: nutclienttest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-nutclienttest.obj -MD -MP -MF $(DEPDIR)/cppunittest-nutclienttest.Tpo -c -o cppunittest-nutclienttest.obj `if test -f 'nutclienttest.cpp'; then $(CYGPATH_W) 'nutclienttest.cpp'; else $(CYGPATH_W) '$(srcdir)/nutclienttest.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-nutclienttest.Tpo $(DEPDIR)/cppunittest-nutclienttest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='nutclienttest.cpp' object='cppunittest-nutclienttest.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-nutclienttest.obj `if test -f 'nutclienttest.cpp'; then $(CYGPATH_W) 'nutclienttest.cpp'; else $(CYGPATH_W) '$(srcdir)/nutclienttest.cpp'; fi` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-example.obj `if test -f 'example.cpp'; then $(CYGPATH_W) 'example.cpp'; else $(CYGPATH_W) '$(srcdir)/example.cpp'; fi` cppunittest-cpputest.o: cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-cpputest.o -MD -MP -MF $(DEPDIR)/cppunittest-cpputest.Tpo -c -o cppunittest-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-cpputest.Tpo $(DEPDIR)/cppunittest-cpputest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest.cpp' object='cppunittest-cpputest.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-cpputest.o -MD -MP -MF $(DEPDIR)/cppunittest-cpputest.Tpo -c -o cppunittest-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cppunittest-cpputest.Tpo $(DEPDIR)/cppunittest-cpputest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cpputest.cpp' object='cppunittest-cpputest.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-cpputest.o `test -f 'cpputest.cpp' || echo '$(srcdir)/'`cpputest.cpp cppunittest-cpputest.obj: cpputest.cpp -@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-cpputest.obj -MD -MP -MF $(DEPDIR)/cppunittest-cpputest.Tpo -c -o cppunittest-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` -@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/cppunittest-cpputest.Tpo $(DEPDIR)/cppunittest-cpputest.Po -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='cpputest.cpp' object='cppunittest-cpputest.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -MT cppunittest-cpputest.obj -MD -MP -MF $(DEPDIR)/cppunittest-cpputest.Tpo -c -o cppunittest-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` +@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/cppunittest-cpputest.Tpo $(DEPDIR)/cppunittest-cpputest.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='cpputest.cpp' object='cppunittest-cpputest.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(cppunittest_CXXFLAGS) $(CXXFLAGS) -c -o cppunittest-cpputest.obj `if test -f 'cpputest.cpp'; then $(CYGPATH_W) 'cpputest.cpp'; else $(CYGPATH_W) '$(srcdir)/cpputest.cpp'; fi` mostlyclean-libtool: -rm -f *.lo @@ -1016,62 +425,26 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -1083,11 +456,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -1096,206 +473,104 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ else \ - color_start= color_end=; \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi -check-TESTS: $(check_PROGRAMS) - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all $(check_PROGRAMS) - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -nutlogtest.log: nutlogtest$(EXEEXT) - @p='nutlogtest$(EXEEXT)'; \ - b='nutlogtest'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -getvaluetest.log: getvaluetest$(EXEEXT) - @p='getvaluetest$(EXEEXT)'; \ - b='getvaluetest'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -cppunittest.log: cppunittest$(EXEEXT) - @p='cppunittest$(EXEEXT)'; \ - b='cppunittest'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -1325,53 +600,21 @@ distdir-am: $(DISTFILES) || exit 1; \ fi; \ done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -@HAVE_CPPUNIT_FALSE@check-local: -@HAVE_CXX11_FALSE@check-local: -@WITH_VALGRIND_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) - $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am all-am: Makefile -installdirs: installdirs-recursive -installdirs-am: -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -installcheck: installcheck-recursive +installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ @@ -1383,12 +626,8 @@ install-strip: "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) @@ -1397,150 +636,93 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) -clean: clean-recursive +clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ mostlyclean-am -distclean: distclean-recursive - -rm -f ./$(DEPDIR)/cppnit-cpputest-client.Po - -rm -f ./$(DEPDIR)/cppnit-cpputest.Po - -rm -f ./$(DEPDIR)/cppunittest-cpputest.Po - -rm -f ./$(DEPDIR)/cppunittest-example.Po - -rm -f ./$(DEPDIR)/cppunittest-nutclienttest.Po - -rm -f ./$(DEPDIR)/getvaluetest-getvaluetest.Po - -rm -f ./$(DEPDIR)/getvaluetest-hidparser.Po - -rm -f ./$(DEPDIR)/nutlogtest.Po +distclean: distclean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags -dvi: dvi-recursive +dvi: dvi-am dvi-am: -html: html-recursive +html: html-am html-am: -info: info-recursive +info: info-am info-am: install-data-am: -install-dvi: install-dvi-recursive +install-dvi: install-dvi-am install-dvi-am: install-exec-am: -install-html: install-html-recursive +install-html: install-html-am install-html-am: -install-info: install-info-recursive +install-info: install-info-am install-info-am: install-man: -install-pdf: install-pdf-recursive +install-pdf: install-pdf-am install-pdf-am: -install-ps: install-ps-recursive +install-ps: install-ps-am install-ps-am: installcheck-am: -maintainer-clean: maintainer-clean-recursive - -rm -f ./$(DEPDIR)/cppnit-cpputest-client.Po - -rm -f ./$(DEPDIR)/cppnit-cpputest.Po - -rm -f ./$(DEPDIR)/cppunittest-cpputest.Po - -rm -f ./$(DEPDIR)/cppunittest-example.Po - -rm -f ./$(DEPDIR)/cppunittest-nutclienttest.Po - -rm -f ./$(DEPDIR)/getvaluetest-getvaluetest.Po - -rm -f ./$(DEPDIR)/getvaluetest-hidparser.Po - -rm -f ./$(DEPDIR)/nutlogtest.Po +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic -mostlyclean: mostlyclean-recursive +mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-recursive +pdf: pdf-am pdf-am: -ps: ps-recursive +ps: ps-am ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) all check check-am install install-am \ - install-exec install-strip +.MAKE: check-am install-am install-strip -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ - am--depfiles check check-TESTS check-am check-local clean \ - clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \ - ctags ctags-am distclean distclean-compile distclean-generic \ +.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool ctags \ + distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ + installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - recheck tags tags-am uninstall uninstall-am + tags uninstall uninstall-am -.PRECIOUS: Makefile - - -all: $(TESTS) - -# NUT Integration Testing suite -check-NIT check-NIT-devel: - cd "$(builddir)/NIT" && $(MAKE) $@ - -# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver -# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -hidparser.c: $(top_srcdir)/drivers/hidparser.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@@WITH_VALGRIND_TRUE@check-local: $(check_PROGRAMS) -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@@WITH_VALGRIND_TRUE@ RES=0; for P in $^ ; do $(VALGRIND) ./$$P || { RES=$$? ; echo "FAILED: $(VALGRIND) ./$$P" >&2; }; done; exit $$RES - -# Make sure out-of-dir C++ dependencies exist (especially when dev-building -# only some parts of NUT): -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@$(top_builddir)/clients/libnutclient.la \ -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@$(top_builddir)/clients/libnutclientstub.la: dummy -@HAVE_CPPUNIT_TRUE@@HAVE_CXX11_TRUE@ @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -@HAVE_CPPUNIT_FALSE@@HAVE_CXX11_TRUE@cppnit: -@HAVE_CPPUNIT_FALSE@@HAVE_CXX11_TRUE@ @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 - -@HAVE_CXX11_FALSE@cppnit: -@HAVE_CXX11_FALSE@ @echo "SKIP: $@ not implemented without C++11 and CPPUNIT enabled" >&2 ; exit 1 - -dummy: - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/tests/NIT/Makefile.am b/tests/NIT/Makefile.am deleted file mode 100644 index 6ce64a9..0000000 --- a/tests/NIT/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -EXTRA_DIST = nit.sh README - -if WITH_CHECK_NIT -check: check-NIT -else -check: - @echo "NO-OP: $@ in `pwd` is inactive by default. Run 'configure --enable-check-NIT' or 'make check-NIT' explicitly" >&2 -endif - -# Run in builddir, use script from srcdir -# Avoid running "$<" - not all make implementations handle that -check-NIT: $(abs_srcdir)/nit.sh - "$(abs_srcdir)/nit.sh" - -# Make sure pre-requisites for NIT are fresh as we iterate -check-NIT-devel: $(abs_srcdir)/nit.sh - @cd .. && ( $(MAKE) -s cppnit || echo "OPTIONAL C++ test client test will be skipped" ) - @cd "$(top_builddir)/clients" && $(MAKE) -s upsc upsrw upsmon - @cd "$(top_builddir)/server" && $(MAKE) -s upsd - @cd "$(top_builddir)/drivers" && $(MAKE) -s dummy-ups - @$(MAKE) check-NIT - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -clean-local: - rm -rf tmp diff --git a/tests/NIT/README b/tests/NIT/README deleted file mode 100644 index 30da730..0000000 --- a/tests/NIT/README +++ /dev/null @@ -1,17 +0,0 @@ -NUT Integration Testing suite -============================= - -This suite aims to simplify running `upsd`, a `dummy-ups` driver and -a few clients to query them, as part of regular `make check` routine -or separately with existing binaries (should not impact any existing -installation data, processes or communications). - -WARNING: Current working directory when starting the script should be -the location where it may create temporary data (e.g. the BUILDDIR). - -See also -link:https://git.launchpad.net/ubuntu/+source/nut/tree/debian/tests/test-nut.py[The NUT testing script] -available in the -link:https://code.edge.launchpad.net/qa-regression-testing[Ubuntu QA Regression Testing suite] -doing a similar job with NUT installed from packages and configuring -it via files in standard path names. diff --git a/tests/NIT/nit.sh b/tests/NIT/nit.sh deleted file mode 100755 index f404cb9..0000000 --- a/tests/NIT/nit.sh +++ /dev/null @@ -1,853 +0,0 @@ -#!/bin/sh - -# NUT Integration Testing suite, assumes the codebase was built and -# arranges running of the binaries to test driver-client-server -# ability to start and their interactions. -# -# Note: currently it is a PoC-quality mess that gets the job done -# but could be refactored for better maintainability and generic -# approach. Part of the goal was to let this script set up the -# sandbox to run tests which could be defined in other files. -# -# WARNING: Current working directory when starting the script should be -# the location where it may create temporary data (e.g. the BUILDDIR). -# Caller can export envvars to impact the script behavior, e.g.: -# DEBUG=true to print debug messages, running processes, etc. -# DEBUG_SLEEP=60 to sleep after tests, with driver+server running -# NUT_DEBUG_MIN=3 to set (minimum) debug level for drivers, upsd... -# NUT_PORT=12345 custom port for upsd to listen and clients to query -# -# Design note: written with dumbed-down POSIX shell syntax, to -# properly work in whatever different OSes have (bash, dash, -# ksh, busybox sh...) -# -# Copyright -# 2022 Jim Klimov -# -# License: GPLv2+ - -TZ=UTC -LANG=C -LC_ALL=C -export TZ LANG LC_ALL - -log_separator() { - echo "" >&2 - echo "================================" >&2 -} - -shouldDebug() { - [ -n "$DEBUG" ] || [ -n "$DEBUG_SLEEP" ] -} - -log_debug() { - if shouldDebug ; then - echo "[DEBUG] $@" >&2 - fi -} - -log_info() { - echo "[INFO] $@" >&2 -} - -log_error() { - echo "[ERROR] $@" >&2 -} - -die() { - echo "[FATAL] $@" >&2 - exit 1 -} - -# Note: current directory is assumed to be writeable for temporary -# data, e.g. the $(builddir) from the Makefile. Static resources -# from the source codebase are where the script resides, e.g. -# the $(srcdir) from the Makefile. If we are not in the source -# tree, tests would use binaries in PATH (e.g. packaged install). -BUILDDIR="`pwd`" -TOP_BUILDDIR="" -case "${BUILDDIR}" in - */tests/NIT) - TOP_BUILDDIR="`cd "${BUILDDIR}"/../.. && pwd`" ;; - *) log_info "Current directory '${BUILDDIR}' is not a .../tests/NIT" ;; -esac -if ! test -w "${BUILDDIR}" ; then - log_error "BUILDDIR='${BUILDDIR}' is not writeable, tests may fail below" -fi - -SRCDIR="`dirname "$0"`" -SRCDIR="`cd "$SRCDIR" && pwd`" -TOP_SRCDIR="" -case "${SRCDIR}" in - */tests/NIT) - TOP_SRCDIR="`cd "${SRCDIR}"/../.. && pwd`" ;; - *) log_info "Script source directory '${SRCDIR}' is not a .../tests/NIT" ;; -esac - -# No fuss about LD_LIBRARY_PATH: for binaries that need it, -# PATH entries below would contain libtool wrapper scripts; -# for other builds we use system default or caller's env. -PATH_ADD="${BUILDDIR}" -if [ x"${SRCDIR}" != x"${BUILDDIR}" ]; then - PATH_ADD="${PATH_ADD}:${SRCDIR}" -fi - -if [ x"${TOP_BUILDDIR}" != x ]; then - PATH_ADD="${PATH_ADD}:${TOP_BUILDDIR}/clients:${TOP_BUILDDIR}/drivers:${TOP_BUILDDIR}/server:${TOP_BUILDDIR}/tools:${TOP_BUILDDIR}/tools/nut-scanner" -fi - -if [ x"${TOP_SRCDIR}" != x ]; then - PATH_ADD="${PATH_ADD}:${TOP_SRCDIR}/clients:${TOP_SRCDIR}/drivers:${TOP_SRCDIR}/server:${TOP_SRCDIR}/tools:${TOP_SRCDIR}/tools/nut-scanner" -fi - -PATH="${PATH_ADD}:${PATH}" -export PATH -unset PATH_ADD - -log_debug "Using PATH='$PATH'" - -for PROG in upsd upsc dummy-ups upsmon ; do - (command -v ${PROG}) || die "Useless setup: ${PROG} not found in PATH: ${PATH}" -done - -PID_UPSD="" -PID_DUMMYUPS="" -PID_DUMMYUPS1="" -PID_DUMMYUPS2="" - -TESTDIR="$BUILDDIR/tmp" -# Technically the limit is sizeof(sockaddr.sun_path) for complete socket -# pathname, which varies 104-108 chars max on systems seen in CI farm; -# we reserve 17 chars for "/dummy-ups-dummy" longest filename. -if [ `echo "$TESTDIR" | wc -c` -gt 80 ]; then - log_info "'$TESTDIR' is too long to store AF_UNIX socket files, will mktemp" - if ! ( [ -n "${TMPDIR-}" ] && [ -d "${TMPDIR-}" ] && [ -w "${TMPDIR-}" ] ) ; then - if [ -d /dev/shm ] && [ -w /dev/shm ]; then TMPDIR=/dev/shm ; else TMPDIR=/tmp ; fi - fi - TESTDIR="`mktemp -d "${TMPDIR}/nit-tmp.$$.XXXXXX"`" || die "Failed to mktemp" -else - rm -rf "${TESTDIR}" || true -fi -log_info "Using '$TESTDIR' for generated configs and state files" - -mkdir -p "${TESTDIR}/etc" "${TESTDIR}/run" && chmod 750 "${TESTDIR}/run" \ -|| die "Failed to create temporary FS structure for the NIT" - -stop_daemons() { - if [ -n "$PID_UPSD$PID_DUMMYUPS$PID_DUMMYUPS1$PID_DUMMYUPS2" ] ; then - log_info "Stopping test daemons" - kill -15 $PID_UPSD $PID_DUMMYUPS $PID_DUMMYUPS1 $PID_DUMMYUPS2 2>/dev/null - fi -} - -trap 'RES=$?; stop_daemons; if [ "${TESTDIR}" != "${BUILDDIR}/tmp" ] ; then rm -rf "${TESTDIR}" ; fi; exit $RES;' 0 1 2 3 15 - -NUT_STATEPATH="${TESTDIR}/run" -NUT_ALTPIDPATH="${TESTDIR}/run" -NUT_CONFPATH="${TESTDIR}/etc" -export NUT_STATEPATH NUT_ALTPIDPATH NUT_CONFPATH - -# TODO: Find a portable way to (check and) grab a random unprivileged port? -[ -n "${NUT_PORT-}" ] && [ "$NUT_PORT" -gt 0 ] && [ "$NUT_PORT" -lt 65536 ] \ -|| { - DELTA1="`date +%S`" || DELTA1=0 - DELTA2="`expr $$ % 99`" || DELTA2=0 - - NUT_PORT="`expr 34931 + $DELTA1 + $DELTA2`" \ - && [ "$NUT_PORT" -gt 0 ] && [ "$NUT_PORT" -lt 65536 ] \ - || NUT_PORT=34931 -} -export NUT_PORT - -### upsd.conf: ################################################## - -generatecfg_upsd_trivial() { - # Populate the configs for the run - cat > "$NUT_CONFPATH/upsd.conf" << EOF -STATEPATH "$NUT_STATEPATH" -LISTEN localhost $NUT_PORT -EOF - [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: upsd.conf" - chmod 640 "$NUT_CONFPATH/upsd.conf" - - # Some systems listining on symbolic "localhost" actually - # only bind to IPv6, and Python telnetlib resolves IPv4 - # and fails its connection tests. Others fare well with - # both addresses in one command. - for LH in 127.0.0.1 '::1' ; do - if ( - ( cat /etc/hosts || getent hosts ) | grep "$LH" \ - || ping -c 1 "$LH" - ) 2>/dev/null >/dev/null ; then - echo "LISTEN $LH $NUT_PORT" >> "$NUT_CONFPATH/upsd.conf" - fi - done - - if [ -n "${NUT_DEBUG_MIN-}" ] ; then - echo "DEBUG_MIN ${NUT_DEBUG_MIN}" >> "$NUT_CONFPATH/upsd.conf" || exit - fi -} - -generatecfg_upsd_nodev() { - generatecfg_upsd_trivial - echo "ALLOW_NO_DEVICE true" >> "$NUT_CONFPATH/upsd.conf" \ - || die "Failed to populate temporary FS structure for the NIT: upsd.conf" -} - -### upsd.users: ################################################## - -TESTPASS_ADMIN='mypass' -TESTPASS_TESTER='pass words' -TESTPASS_UPSMON_PRIMARY='P@ssW0rdAdm' -TESTPASS_UPSMON_SECONDARY='P@ssW0rd' - -generatecfg_upsdusers_trivial() { - cat > "$NUT_CONFPATH/upsd.users" << EOF -[admin] - password = $TESTPASS_ADMIN - actions = SET - instcmds = ALL - -[tester] - password = "${TESTPASS_TESTER}" - instcmds = test.battery.start - instcmds = test.battery.stop - -[dummy-admin-m] - password = "${TESTPASS_UPSMON_PRIMARY}" - upsmon master - -[dummy-admin] - password = "${TESTPASS_UPSMON_PRIMARY}" - upsmon primary - -[dummy-user-s] - password = "${TESTPASS_UPSMON_SECONDARY}" - upsmon slave - -[dummy-user] - password = "${TESTPASS_UPSMON_SECONDARY}" - upsmon secondary -EOF - [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: upsd.users" - chmod 640 "$NUT_CONFPATH/upsd.users" -} - -### upsmon.conf: ################################################## - -generatecfg_upsmon_trivial() { - # Populate the configs for the run - ( echo 'MINSUPPLIES 0' > "$NUT_CONFPATH/upsmon.conf" || exit - echo 'SHUTDOWNCMD "echo TESTING_DUMMY_SHUTDOWN_NOW"' >> "$NUT_CONFPATH/upsmon.conf" || exit - - if [ -n "${NUT_DEBUG_MIN-}" ] ; then - echo "DEBUG_MIN ${NUT_DEBUG_MIN}" >> "$NUT_CONFPATH/upsmon.conf" || exit - fi - ) || die "Failed to populate temporary FS structure for the NIT: upsmon.conf" - chmod 640 "$NUT_CONFPATH/upsmon.conf" -} - -generatecfg_upsmon_master() { - generatecfg_upsmon_trivial - echo "MONITOR 'dummy@localhost:$NUT_PORT' 0 'dummy-admin-m' '${TESTPASS_UPSMON_PRIMARY}' master" >> "$NUT_CONFPATH/upsmon.conf" \ - || die "Failed to populate temporary FS structure for the NIT: upsmon.conf" -} - -generatecfg_upsmon_primary() { - generatecfg_upsmon_trivial - echo "MONITOR 'dummy@localhost:$NUT_PORT' 0 'dummy-admin' '${TESTPASS_UPSMON_PRIMARY}' primary" >> "$NUT_CONFPATH/upsmon.conf" \ - || die "Failed to populate temporary FS structure for the NIT: upsmon.conf" -} - -generatecfg_upsmon_slave() { - generatecfg_upsmon_trivial - echo "MONITOR 'dummy@localhost:$NUT_PORT' 0 'dummy-user-s' '${TESTPASS_UPSMON_SECONDARY}' slave" >> "$NUT_CONFPATH/upsmon.conf" \ - || die "Failed to populate temporary FS structure for the NIT: upsmon.conf" -} - -generatecfg_upsmon_secondary() { - generatecfg_upsmon_trivial - echo "MONITOR 'dummy@localhost:$NUT_PORT' 0 'dummy-user' '${TESTPASS_UPSMON_SECONDARY}' secondary" >> "$NUT_CONFPATH/upsmon.conf" \ - || die "Failed to populate temporary FS structure for the NIT: upsmon.conf" -} - -### ups.conf: ################################################## - -generatecfg_ups_trivial() { - # Populate the configs for the run - ( echo 'maxretry = 3' > "$NUT_CONFPATH/ups.conf" || exit - if [ x"${TOP_BUILDDIR}" != x ]; then - echo "driverpath = '${TOP_BUILDDIR}/drivers'" >> "$NUT_CONFPATH/ups.conf" || exit - fi - if [ -n "${NUT_DEBUG_MIN-}" ] ; then - echo "debug_min = ${NUT_DEBUG_MIN}" >> "$NUT_CONFPATH/ups.conf" || exit - fi - ) || die "Failed to populate temporary FS structure for the NIT: ups.conf" - chmod 640 "$NUT_CONFPATH/ups.conf" - -} - -generatecfg_ups_dummy() { - generatecfg_ups_trivial - - cat > "$NUT_CONFPATH/dummy.seq" << EOF -ups.status: OB -TIMER 5 -ups.status: OL -TIMER 5 -EOF - [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: dummy.seq" - - cat >> "$NUT_CONFPATH/ups.conf" << EOF -[dummy] - driver = dummy-ups - desc = "Crash Dummy" - port = dummy.seq - #mode = dummy-loop -EOF - [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: ups.conf" - - if [ x"${TOP_SRCDIR}" != x ]; then - cp "${TOP_SRCDIR}/data/evolution500.seq" "${TOP_SRCDIR}/data/epdu-managed.dev" "$NUT_CONFPATH/" - - cat >> "$NUT_CONFPATH/ups.conf" << EOF -[UPS1] - driver = dummy-ups - desc = "Example event sequence" - port = evolution500.seq - -[UPS2] - driver = dummy-ups - desc = "Example ePDU data dump" - port = epdu-managed.dev - mode = dummy-once -EOF - [ $? = 0 ] || die "Failed to populate temporary FS structure for the NIT: ups.conf" - - # HACK: Avoid empty ups.status that may be present in example docs - # FIXME: Might we actually want that value (un-)set for tests?.. - # TODO: Check if the problem was with dummy-ups looping? [#1385] - for F in "$NUT_CONFPATH/"*.dev "$NUT_CONFPATH/"*.seq ; do - sed -e 's,^ups.status: *$,ups.status: OL BOOST,' -i'.bak' "$F" - grep -E '^ups.status:' "$F" >/dev/null || { echo "ups.status: OL BOOST" >> "$F"; } - done - fi - -} - -##################################################### - -isPidAlive() { - [ -n "$1" ] && [ "$1" -gt 0 ] || return - [ -d "/proc/$1" ] || kill -0 "$1" 2>/dev/null -} - -FAILED=0 -PASSED=0 - -testcase_upsd_no_configs_at_all() { - log_separator - log_info "Test UPSD without configs at all" - upsd -F - if [ "$?" = 0 ]; then - log_error "upsd should fail without configs" - FAILED="`expr $FAILED + 1`" - else - log_info "OK, upsd failed to start in wrong conditions" - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_upsd_no_configs_driver_file() { - log_separator - log_info "Test UPSD without driver config file" - generatecfg_upsd_trivial - upsd -F - if [ "$?" = 0 ]; then - log_error "upsd should fail without driver config file" - FAILED="`expr $FAILED + 1`" - else - log_info "OK, upsd failed to start in wrong conditions" - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_upsd_no_configs_in_driver_file() { - log_separator - log_info "Test UPSD without drivers defined in config file" - generatecfg_upsd_trivial - generatecfg_ups_trivial - upsd -F - if [ "$?" = 0 ]; then - log_error "upsd should fail without drivers defined in config file" - FAILED="`expr $FAILED + 1`" - else - log_info "OK, upsd failed to start in wrong conditions" - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_upsd_allow_no_device() { - log_separator - log_info "Test UPSD allowed to run without driver configs" - generatecfg_upsd_nodev - generatecfg_upsdusers_trivial - generatecfg_ups_trivial - upsd -F & - PID_UPSD="$!" - sleep 2 - if isPidAlive "$PID_UPSD"; then - log_info "OK, upsd is running" - PASSED="`expr $PASSED + 1`" - - log_separator - log_info "Test that UPSD responds to UPSC" - OUT="`upsc -l localhost:$NUT_PORT`" || die "upsd does not respond: $OUT" - if [ -n "$OUT" ] ; then - log_error "got reply for upsc listing when none was expected: $OUT" - FAILED="`expr $FAILED + 1`" - else - log_info "OK, empty response as expected" - PASSED="`expr $PASSED + 1`" - fi - else - log_error "upsd was expected to be running although no devices are defined" - FAILED="`expr $FAILED + 1`" - fi - kill -15 $PID_UPSD - wait $PID_UPSD -} - -testgroup_upsd_invalid_configs() { - testcase_upsd_no_configs_at_all - testcase_upsd_no_configs_driver_file - testcase_upsd_no_configs_in_driver_file -} - -testgroup_upsd_questionable_configs() { - testcase_upsd_allow_no_device -} - -######################################################### -### Tests in a common sandbox with driver(s) + server ### -######################################################### - -SANDBOX_CONFIG_GENERATED=false -sandbox_generate_configs() { - if $SANDBOX_CONFIG_GENERATED ; then return ; fi - - log_info "Generating configs for sandbox" - generatecfg_upsd_nodev - generatecfg_upsdusers_trivial - generatecfg_ups_dummy - SANDBOX_CONFIG_GENERATED=true -} - -sandbox_forget_configs() { - SANDBOX_CONFIG_GENERATED=false - if [ -z "${DEBUG_SLEEP-}" ] ; then - stop_daemons - fi -} - -sandbox_start_upsd() { - if isPidAlive "$PID_UPSD" ; then - return 0 - fi - - sandbox_generate_configs - - log_info "Starting UPSD for sandbox" - upsd -F & - PID_UPSD="$!" - sleep 5 -} - -sandbox_start_drivers() { - if isPidAlive "$PID_DUMMYUPS" \ - && { [ x"${TOP_SRCDIR}" != x ] && isPidAlive "$PID_DUMMYUPS1" && isPidAlive "$PID_DUMMYUPS2" \ - || [ x"${TOP_SRCDIR}" = x ] ; } \ - ; then - # All drivers expected for this environment are already running - return 0 - fi - - sandbox_generate_configs - - log_info "Starting dummy-ups driver(s) for sandbox" - #upsdrvctl -F start dummy & - dummy-ups -a dummy -F & - PID_DUMMYUPS="$!" - - if [ x"${TOP_SRCDIR}" != x ]; then - dummy-ups -a UPS1 -F & - PID_DUMMYUPS1="$!" - - dummy-ups -a UPS2 -F & - PID_DUMMYUPS2="$!" - fi - - sleep 5 - - if shouldDebug ; then - (ps -ef || ps -xawwu) 2>/dev/null | grep -E '(ups|nut|dummy)' || true - fi -} - -testcase_sandbox_start_upsd_alone() { - log_separator - log_info "Test starting UPSD but not a driver before it" - sandbox_start_upsd - - EXPECTED_UPSLIST='dummy' - if [ x"${TOP_SRCDIR}" != x ]; then - EXPECTED_UPSLIST="$EXPECTED_UPSLIST -UPS1 -UPS2" - fi - - log_info "Query listing from UPSD by UPSC (driver not running yet)" - OUT="`upsc -l localhost:$NUT_PORT`" || die "upsd does not respond: $OUT" - if [ x"$OUT" != x"$EXPECTED_UPSLIST" ] ; then - log_error "got this reply for upsc listing when '$EXPECTED_UPSLIST' was expected: $OUT" - FAILED="`expr $FAILED + 1`" - else - PASSED="`expr $PASSED + 1`" - fi - - log_info "Query driver state from UPSD by UPSC (driver not running yet)" - OUT="`upsc dummy@localhost:$NUT_PORT 2>&1`" && { - log_error "upsc was supposed to answer with error exit code: $OUT" - FAILED="`expr $FAILED + 1`" - } - if ! echo "$OUT" | grep 'Error: Driver not connected' ; then - log_error "got reply for upsc query when 'Error: Driver not connected' was expected: '$OUT'" - FAILED="`expr $FAILED + 1`" - else - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_sandbox_start_upsd_after_drivers() { - # Historically this is a fallback from testcase_sandbox_start_drivers_after_upsd - kill -15 $PID_UPSD 2>/dev/null - wait $PID_UPSD - upsd -F & - PID_UPSD="$!" - - sandbox_start_drivers - sandbox_start_upsd - - sleep 5 - upsc dummy@localhost:$NUT_PORT || die "upsd does not respond" -} - -testcase_sandbox_start_drivers_after_upsd() { - #sandbox_start_upsd - testcase_sandbox_start_upsd_alone - sandbox_start_drivers - - log_info "Query driver state from UPSD by UPSC after driver startup" - upsc dummy@localhost:$NUT_PORT || { - # Should not get to this, except on very laggy systems maybe - log_error "Query failed, retrying with UPSD started after drivers" - testcase_sandbox_start_upsd_after_drivers - } - - if [ x"${TOP_SRCDIR}" != x ]; then - log_info "Wait for dummy UPSes with larger data sets to initialize" - for U in UPS1 UPS2 ; do - COUNTDOWN=60 - while ! upsc $U@localhost:$NUT_PORT ups.status ; do - sleep 1 - COUNTDOWN="`expr $COUNTDOWN - 1`" - # Systemic error, e.g. could not create socket file? - [ "$COUNTDOWN" -lt 1 ] && die "Dummy driver did not start or respond in time" - done - done - fi - - log_info "Expected drivers are now responding via UPSD" -} - -testcase_sandbox_upsc_query_model() { - OUT="`upsc dummy@localhost:$NUT_PORT device.model`" || die "upsd does not respond: $OUT" - if [ x"$OUT" != x"Dummy UPS" ] ; then - log_error "got this reply for upsc query when 'Dummy UPS' was expected: $OUT" - FAILED="`expr $FAILED + 1`" - else - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_sandbox_upsc_query_bogus() { - log_info "Query driver state from UPSD by UPSC for bogus info" - OUT="`upsc dummy@localhost:$NUT_PORT ups.bogus.value 2>&1`" && { - log_error "upsc was supposed to answer with error exit code: $OUT" - FAILED="`expr $FAILED + 1`" - } - if ! echo "$OUT" | grep 'Error: Variable not supported by UPS' ; then - log_error "got reply for upsc query when 'Error: Variable not supported by UPS' was expected: $OUT" - FAILED="`expr $FAILED + 1`" - else - PASSED="`expr $PASSED + 1`" - fi -} - -testcase_sandbox_upsc_query_timer() { - log_separator - log_info "Test that dummy-ups TIMER action changes the reported state" - # Driver is set up to flip ups.status every 5 sec, so check every 3 - OUT1="`upsc dummy@localhost:$NUT_PORT ups.status`" || die "upsd does not respond: $OUT1" ; sleep 3 - OUT2="`upsc dummy@localhost:$NUT_PORT ups.status`" || die "upsd does not respond: $OUT2" - OUT3="" - OUT4="" - if [ x"$OUT1" = x"$OUT2" ]; then - sleep 3 - OUT3="`upsc dummy@localhost:$NUT_PORT ups.status`" || die "upsd does not respond: $OUT3" - if [ x"$OUT2" = x"$OUT3" ]; then - sleep 3 - OUT4="`upsc dummy@localhost:$NUT_PORT ups.status`" || die "upsd does not respond: $OUT4" - fi - fi - if echo "$OUT1$OUT2$OUT3$OUT4" | grep "OB" && echo "$OUT1$OUT2$OUT3$OUT4" | grep "OL" ; then - log_info "OK, ups.status flips over time" - PASSED="`expr $PASSED + 1`" - else - log_error "ups.status did not flip over time" - FAILED="`expr $FAILED + 1`" - fi -} - -isTestablePython() { - # We optionally make python module (if interpreter is found): - if [ x"${TOP_BUILDDIR}" = x ] \ - || [ ! -x "${TOP_BUILDDIR}/scripts/python/module/test_nutclient.py" ] \ - ; then - return 1 - fi - return 0 -} - -testcase_sandbox_python_without_credentials() { - isTestablePython || return 0 - log_separator - log_info "Call Python module test suite: PyNUT (NUT Python bindings) without login credentials" - if ( unset NUT_USER || true - unset NUT_PASS || true - "${TOP_BUILDDIR}/scripts/python/module/test_nutclient.py" - ) ; then - log_info "OK, PyNUT did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "PyNUT complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcase_sandbox_python_with_credentials() { - isTestablePython || return 0 - - # That script says it expects data/evolution500.seq (as the UPS1 dummy) - # but the dummy data does not currently let issue the commands and - # setvars tested from python script. - log_separator - log_info "Call Python module test suite: PyNUT (NUT Python bindings) with login credentials" - if ( - NUT_USER='admin' - NUT_PASS="${TESTPASS_ADMIN}" - export NUT_USER NUT_PASS - "${TOP_BUILDDIR}/scripts/python/module/test_nutclient.py" - ) ; then - log_info "OK, PyNUT did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "PyNUT complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcases_sandbox_python() { - isTestablePython || return 0 - testcase_sandbox_python_without_credentials - testcase_sandbox_python_with_credentials -} - -#################################### - -isTestableCppNIT() { - # We optionally make and here can run C++ client tests: - if [ x"${TOP_BUILDDIR}" = x ] \ - || [ ! -x "${TOP_BUILDDIR}/tests/cppnit" ] \ - ; then - return 1 - fi - return 0 -} - -testcase_sandbox_cppnit_without_creds() { - isTestableCppNIT || return 0 - - log_separator - log_info "Call libnutclient test suite: cppnit without login credentials" - if ( unset NUT_USER || true - unset NUT_PASS || true - "${TOP_BUILDDIR}/tests/cppnit" - ) ; then - log_info "OK, cppnit did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "cppnit complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcase_sandbox_cppnit_simple_admin() { - isTestableCppNIT || return 0 - - log_separator - log_info "Call libnutclient test suite: cppnit with login credentials: simple admin" - if ( - NUT_USER='admin' - NUT_PASS="${TESTPASS_ADMIN}" - if [ x"${TOP_SRCDIR}" != x ]; then - # Avoid dummies with TIMER flip-flops - NUT_SETVAR_DEVICE='UPS2' - else - # Risks failure when lauching sub-test at the wrong second - NUT_SETVAR_DEVICE='dummy' - fi - unset NUT_PRIMARY_DEVICE - export NUT_USER NUT_PASS NUT_SETVAR_DEVICE - "${TOP_BUILDDIR}/tests/cppnit" - ) ; then - log_info "OK, cppnit did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "cppnit complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcase_sandbox_cppnit_upsmon_primary() { - isTestableCppNIT || return 0 - - log_separator - log_info "Call libnutclient test suite: cppnit with login credentials: upsmon-primary" - if ( - NUT_USER='dummy-admin' - NUT_PASS="${TESTPASS_UPSMON_PRIMARY}" - NUT_PRIMARY_DEVICE='dummy' - unset NUT_SETVAR_DEVICE - export NUT_USER NUT_PASS NUT_PRIMARY_DEVICE - "${TOP_BUILDDIR}/tests/cppnit" - ) ; then - log_info "OK, cppnit did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "cppnit complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcase_sandbox_cppnit_upsmon_master() { - isTestableCppNIT || return 0 - - log_separator - log_info "Call libnutclient test suite: cppnit with login credentials: upsmon-master" - if ( - NUT_USER='dummy-admin-m' - NUT_PASS="${TESTPASS_UPSMON_PRIMARY}" - NUT_PRIMARY_DEVICE='dummy' - unset NUT_SETVAR_DEVICE - export NUT_USER NUT_PASS NUT_PRIMARY_DEVICE - "${TOP_BUILDDIR}/tests/cppnit" - ) ; then - log_info "OK, cppnit did not complain" - PASSED="`expr $PASSED + 1`" - else - log_error "cppnit complained, check above" - FAILED="`expr $FAILED + 1`" - fi -} - -testcases_sandbox_cppnit() { - isTestableCppNIT || return 0 - testcase_sandbox_cppnit_without_creds - testcase_sandbox_cppnit_upsmon_primary - testcase_sandbox_cppnit_upsmon_master - testcase_sandbox_cppnit_simple_admin -} - -# TODO: Some upsmon tests? - -testgroup_sandbox() { - testcase_sandbox_start_drivers_after_upsd - testcase_sandbox_upsc_query_model - testcase_sandbox_upsc_query_bogus - testcase_sandbox_upsc_query_timer - testcases_sandbox_python - testcases_sandbox_cppnit - - sandbox_forget_configs -} - -testgroup_sandbox_python() { - # Arrange for quick test iterations - testcase_sandbox_start_drivers_after_upsd - testcases_sandbox_python - sandbox_forget_configs -} - -testgroup_sandbox_cppnit() { - # Arrange for quick test iterations - testcase_sandbox_start_drivers_after_upsd - testcases_sandbox_cppnit - sandbox_forget_configs -} - -testgroup_sandbox_cppnit_simple_admin() { - # Arrange for quick test iterations - testcase_sandbox_start_drivers_after_upsd - testcase_sandbox_cppnit_simple_admin - sandbox_forget_configs -} - -################################################################ - -case "${NIT_CASE}" in - cppnit) testgroup_sandbox_cppnit ;; - python) testgroup_sandbox_python ;; - testcase_*|testgroup_*|testcases_*|testgroups_*) - "${NIT_CASE}" ;; - "") # Default test groups: - testgroup_upsd_invalid_configs - testgroup_upsd_questionable_configs - testgroup_sandbox - ;; - *) die "Unsupported NIT_CASE='$NIT_CASE' was requested" ;; -esac - -log_separator -log_info "OVERALL: PASSED=$PASSED FAILED=$FAILED" - -# Allow to leave the sandbox daemons running for a while, -# to experiment with them interactively: -if [ -n "${DEBUG_SLEEP-}" ] ; then - log_separator - log_info "Sleeping now as asked, so you can play with the driver and server running; hint: export NUT_PORT=$NUT_PORT" - log_separator - if [ "${DEBUG_SLEEP-}" -gt 0 ] ; then - sleep "${DEBUG_SLEEP}" - else - sleep 60 - fi - log_info "Sleep finished" - log_separator -fi - -if [ "$PASSED" = 0 ] || [ "$FAILED" != 0 ] ; then - die "Some test scenarios failed!" -else - log_info "SUCCESS" -fi diff --git a/tests/cpputest-client.cpp b/tests/cpputest-client.cpp deleted file mode 100644 index 9a6169a..0000000 --- a/tests/cpputest-client.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/* cpputest-client - CppUnit libnutclient active test - - Module for NUT `cpputest` runner, to check client-server interactions - as part of NIT (NUT Integration Testing) suite and similar scenarios. - This is an "active" NUT client talking to an `upsd` on $NUT_PORT, - as opposed to nutclienttest.cpp which unit-tests the class API etc. - in isolated-binary fashion. - - Copyright (C) 2022 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "common.h" - -/* Current CPPUnit offends the honor of C++98 */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic push -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS -# pragma GCC diagnostic ignored "-Wglobal-constructors" -# endif -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS -# pragma GCC diagnostic ignored "-Wexit-time-destructors" -# endif -#endif - -#include -#include -#include -#include -#include - -namespace nut { - -class NutActiveClientTest : public CppUnit::TestFixture -{ - /* Note: is "friend" of nut::TcpClient class - * to test a few of its protected methods */ - - CPPUNIT_TEST_SUITE( NutActiveClientTest ); - CPPUNIT_TEST( test_query_ver ); - CPPUNIT_TEST( test_list_ups ); - CPPUNIT_TEST( test_auth_user ); - CPPUNIT_TEST( test_auth_primary ); - CPPUNIT_TEST_SUITE_END(); - -private: - /* Fed by caller via envvars: */ - uint16_t NUT_PORT = 0; - std::string NUT_USER = ""; - std::string NUT_PASS = ""; - std::string NUT_PRIMARY_DEVICE = ""; - std::string NUT_SETVAR_DEVICE = ""; - -public: - void setUp() override; - void tearDown() override; - - void test_query_ver(); - void test_list_ups(); - void test_auth_user(); - void test_auth_primary(); -}; - -// Registers the fixture into the 'registry' -CPPUNIT_TEST_SUITE_REGISTRATION( NutActiveClientTest ); - -} // namespace nut {} - -#ifndef _NUTCLIENTTEST_BUILD -# define _NUTCLIENTTEST_BUILD 1 -#endif - -#include "../clients/nutclient.h" -#include "../clients/nutclientmem.h" - -namespace nut { - -extern "C" { -strarr stringset_to_strarr(const std::set& strset); -strarr stringvector_to_strarr(const std::vector& strset); -} // extern "C" - -void NutActiveClientTest::setUp() -{ - /* NUT_PORT etc. are provided by external test suite driver */ - char * s; - - s = std::getenv("NUT_PORT"); - if (s) { - long l = atol(s); - if (l < 1 || l > 65535) { - throw std::runtime_error("NUT_PORT specified by caller is out of range"); - } - NUT_PORT = static_cast(l); - } else { - throw std::runtime_error("NUT_PORT not specified by caller, NIT should call this test"); - } - - s = std::getenv("NUT_USER"); - if (s) { - NUT_USER = s; - } // else stays empty - - s = std::getenv("NUT_PASS"); - if (s) { - NUT_PASS = s; - } // else stays empty - - s = std::getenv("NUT_PRIMARY_DEVICE"); - if (s) { - NUT_PRIMARY_DEVICE = s; - } // else stays empty - - s = std::getenv("NUT_SETVAR_DEVICE"); - if (s) { - NUT_SETVAR_DEVICE = s; - } // else stays empty -} - -void NutActiveClientTest::tearDown() -{ -} - -void NutActiveClientTest::test_query_ver() { - nut::TcpClient c("localhost", NUT_PORT); - std::string s; - - std::cerr << "[D] C++ NUT Client lib test running against Data Server at: " - << c.getHost() << ':' << c.getPort() << std::endl; - - CPPUNIT_ASSERT_MESSAGE( - "TcpClient is not connected after constructor", - c.isConnected()); - - /* Note: generic client code can not use protected methods - * like low-level sendQuery(), list(), get() and some more, - * but this NutActiveClientTest is a friend of TcpClient: - */ - s = c.sendQuery("VER"); - std::cerr << "[D] Got Data Server VER: " << s << std::endl; - - try { - s = c.sendQuery("PROTVER"); - std::cerr << "[D] Got PROTVER: " << s << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Did not get PROTVER: " << ex.what() << std::endl; - } - - try { - s = c.sendQuery("NETVER"); - std::cerr << "[D] Got NETVER (obsolete): " << s << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Did not get NETVER (obsolete): " << ex.what() << std::endl; - } - - try { - c.logout(); - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not get LOGOUT: " << ex.what() << std::endl; - } - - try { - c.disconnect(); - } - catch(nut::NutException& ex) - { - /* NUT_UNUSED_VARIABLE(ex); */ - std::cerr << "[D] Could not get disconnect(): " << ex.what() << std::endl; - } -} - -void NutActiveClientTest::test_list_ups() { - nut::TcpClient c("localhost", NUT_PORT); - std::set devs; - bool noException = true; - - try { - devs = c.getDeviceNames(); - std::cerr << "[D] Got device list (" << devs.size() << "): ["; - for (std::set::iterator it = devs.begin(); - it != devs.end(); it++ - ) { - if (it != devs.begin()) { - std::cerr << ", "; - } - std::cerr << '"' << *it << '"'; - } - std::cerr << "]" << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not device list: " << ex.what() << std::endl; - noException = false; - } - - c.logout(); - c.disconnect(); - - CPPUNIT_ASSERT_MESSAGE( - "Failed to list UPS with TcpClient: threw NutException", - noException); -} - -void NutActiveClientTest::test_auth_user() { - if (NUT_USER.empty()) { - std::cerr << "[D] SKIPPING test_auth_user()" << std::endl; - return; - } - - nut::TcpClient c("localhost", NUT_PORT); - bool noException = true; - try { - c.authenticate(NUT_USER, NUT_PASS); - std::cerr << "[D] Authenticated without exceptions" << std::endl; - /* Note: no high hopes here, credentials are checked by server - * when running critical commands, not at auth request itself */ - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not authenticate as a simple user: " << ex.what() << std::endl; - noException = false; - } - - if (!NUT_SETVAR_DEVICE.empty()) { - try { - TrackingResult tres; - TrackingID tid; - int i; - std::string nutVar = "ups.status"; /* Has a risk of flip-flop with NIT dummy setup */ - std::string s1 = c.getDeviceVariableValue(NUT_SETVAR_DEVICE, nutVar)[0]; - std::string sTest = s1 + "-test"; - - std::cerr << "[D] Got initial device '" << NUT_SETVAR_DEVICE - << "' variable '" << nutVar << "' value: " << s1 << std::endl; - CPPUNIT_ASSERT_MESSAGE( - "Did not expect empty value here", - !s1.empty()); - - tid = c.setDeviceVariable(NUT_SETVAR_DEVICE, nutVar, sTest); - while ( (tres = c.getTrackingResult(tid)) == PENDING) { - usleep(100); - } - if (tres != SUCCESS) { - std::cerr << "[D] Failed to set device variable: " - << "tracking result is " << tres << std::endl; - noException = false; - } - /* Check what we got after set */ - /* Note that above we told the server to tell the driver - * to set a dstate entry; below we ask the server to ask - * the driver and relay the answer to us. The dummy-ups - * driver may also be in a sleeping state between cycles. - * Data propagation may be not instantaneous, so we loop - * for a while to see the expected value (or give up). - */ - std::string s2; - for (i = 0; i < 100 ; i++) { - s2 = c.getDeviceVariableValue(NUT_SETVAR_DEVICE, nutVar)[0]; - if (s2 == sTest) - break; - usleep(100000); - } - std::cerr << "[D] Read back: " << s2 - << " after " << (100 * i) << "msec" - << std::endl; - - /* Fix it back */ - tid = c.setDeviceVariable(NUT_SETVAR_DEVICE, nutVar, s1); - while ( (tres = c.getTrackingResult(tid)) == PENDING) { - usleep(100); - } - if (tres != SUCCESS) { - std::cerr << "[D] Failed to set device variable: " - << "tracking result is " << tres << std::endl; - noException = false; - } - std::string s3; - for (i = 0; i < 100 ; i++) { - s3 = c.getDeviceVariableValue(NUT_SETVAR_DEVICE, nutVar)[0]; - if (s3 == s1) - break; - usleep(100000); - } - std::cerr << "[D] Read back: " << s3 - << " after " << (100 * i) << "msec" - << std::endl; - - if (s3 != s1) { - std::cerr << "[D] Final device variable value '" << s3 - << "' differs from original '" << s1 - << "'" << std::endl; - noException = false; - } - - if (s2 == s1) { - std::cerr << "[D] Tweaked device variable value '" << s2 - << "' does not differ from original '" << s1 - << "'" << std::endl; - noException = false; - } - - if (noException) { - std::cerr << "[D] Tweaked device variable value OK" << std::endl; - } - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Failed to set device variable: " - << ex.what() << std::endl; - noException = false; - } - } else { - std::cerr << "[D] SKIPPING test_auth_user() active test " - << "(got no NUT_SETVAR_DEVICE to poke)" << std::endl; - } - - c.logout(); - c.disconnect(); - - CPPUNIT_ASSERT_MESSAGE( - "Failed to auth as user with TcpClient or tweak device variable", - noException); -} - -void NutActiveClientTest::test_auth_primary() { - if (NUT_USER.empty() || NUT_PRIMARY_DEVICE.empty()) { - std::cerr << "[D] SKIPPING test_auth_primary()" << std::endl; - return; - } - - nut::TcpClient c("localhost", NUT_PORT); - bool noException = true; - try { - c.authenticate(NUT_USER, NUT_PASS); - std::cerr << "[D] Authenticated without exceptions" << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not authenticate as an upsmon primary user: " - << ex.what() << std::endl; - noException = false; - } - - try { - Device d = c.getDevice(NUT_PRIMARY_DEVICE); - bool gotPrimary = false; - bool gotMaster = false; - - try { - c.deviceMaster(NUT_PRIMARY_DEVICE); - gotMaster = true; - std::cerr << "[D] Elevated as MASTER without exceptions" << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not elevate as MASTER for " - << "NUT_PRIMARY_DEVICE " << NUT_PRIMARY_DEVICE << ": " - << ex.what() << std::endl; - } - - try { - c.devicePrimary(NUT_PRIMARY_DEVICE); - gotPrimary = true; - std::cerr << "[D] Elevated as PRIMARY without exceptions" << std::endl; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] Could not elevate as PRIMARY for " - << "NUT_PRIMARY_DEVICE " << NUT_PRIMARY_DEVICE << ": " - << ex.what() << std::endl; - } - - if (!gotMaster && !gotPrimary) - noException = false; - } - catch(nut::NutException& ex) - { - std::cerr << "[D] NUT_PRIMARY_DEVICE " << NUT_PRIMARY_DEVICE - << " not found on Data Server: " - << ex.what() << std::endl; - noException = false; - } - - c.logout(); - c.disconnect(); - - CPPUNIT_ASSERT_MESSAGE( - "Failed to auth as user with TcpClient: threw NutException", - noException); -} - -} // namespace nut {} - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic pop -#endif diff --git a/tests/cpputest.cpp b/tests/cpputest.cpp index d0b0adb..448dd5b 100644 --- a/tests/cpputest.cpp +++ b/tests/cpputest.cpp @@ -2,7 +2,6 @@ Copyright (C) 2012 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,75 +18,27 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include -#include #include -#include #include #include -#include "common.h" -// Inspired by https://stackoverflow.com/a/66702001 -class MyCustomProgressTestListener : public CppUnit::TextTestProgressListener { - public: - virtual void startTest(CppUnit::Test *test) override; -}; - -// Implement out of class declaration to avoid -// error: 'MyCustomProgressTestListener' has no out-of-line virtual method -// definitions; its vtable will be emitted in every translation unit -// [-Werror,-Wweak-vtables] -void MyCustomProgressTestListener::startTest(CppUnit::Test *test) { - //fprintf(stderr, "starting test %s\n", test->getName().c_str()); - std::cerr << "starting test " << test->getName() << std::endl; -} int main(int argc, char* argv[]) { - bool verbose = false; - if (argc > 1) { - if (strcmp("-v", argv[1]) == 0 || strcmp("--verbose", argv[1]) == 0 ) { - verbose = true; - } - } - /* Get the top level suite from the registry */ - std::cerr << "D: Getting test suite..." << std::endl; CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); /* Adds the test to the list of test to run */ - std::cerr << "D: Preparing test runner..." << std::endl; CppUnit::TextUi::TestRunner runner; runner.addTest( suite ); /* Change the default outputter to a compiler error format outputter */ - std::cerr << "D: Setting test runner outputter..." << std::endl; runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(), std::cerr ) ); - - if (verbose) { - /* Add a listener to report test names */ - std::cerr << "D: Setting test runner listener for test names..." << std::endl; - MyCustomProgressTestListener progress; - runner.eventManager().addListener(&progress); - } - /* Run the tests. */ - bool wasSucessful = false; - try { - std::cerr << "D: Launching the test run..." << std::endl; - wasSucessful = runner.run(); - } - catch ( std::invalid_argument &e ) // Test path not resolved - { - std::cerr << std::endl - << "ERROR: " << e.what() - << std::endl; - wasSucessful = false; - } + bool wasSucessful = runner.run(); /* Return error code 1 if the one of test failed. */ - std::cerr << "D: Got to the end of test suite with code " << - "'" << ( wasSucessful ? "true" : "false" ) << "'" << std::endl; return wasSucessful ? 0 : 1; } + diff --git a/tests/example.cpp b/tests/example.cpp index cb52e93..28ea52e 100644 --- a/tests/example.cpp +++ b/tests/example.cpp @@ -2,7 +2,6 @@ Copyright (C) 2012 Emilien Kia - 2020 Jim Klimov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,20 +17,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#include "common.h" - -/* Current CPPUnit offends the honor of C++98 */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic push -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS -# pragma GCC diagnostic ignored "-Wglobal-constructors" -# endif -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS -# pragma GCC diagnostic ignored "-Wexit-time-destructors" -# endif -#endif - #include class ExampleTest : public CppUnit::TestFixture @@ -41,8 +26,8 @@ class ExampleTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); public: - void setUp() override; - void tearDown() override; + void setUp(); + void tearDown(); void testOne(); }; @@ -68,12 +53,10 @@ void ExampleTest::testOne() float f = 1.0; // Process - int cast = static_cast(f); + int cast = (int)f; // Check CPPUNIT_ASSERT_EQUAL( i, cast ); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic pop -#endif + diff --git a/tests/getvaluetest.c b/tests/getvaluetest.c deleted file mode 100644 index 769df06..0000000 --- a/tests/getvaluetest.c +++ /dev/null @@ -1,282 +0,0 @@ -/* getvaluetest - check that the bitness/endianness dependent conversions - * of representation of numeric types between wire protocols and different - * CPU computations produce expected results. - * - * See also: - * https://github.com/networkupstools/nut/pull/1055 - * https://github.com/networkupstools/nut/pull/1040 - * https://github.com/networkupstools/nut/pull/1024 - * https://github.com/networkupstools/nut/issues/1023 - * - * Copyright (C) - * 2021 Nick Briggs - * 2022 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include "hidtypes.h" -#include "usb-common.h" -#include "common.h" - -void GetValue(const unsigned char *Buf, HIDData_t *pData, long *pValue); - -static void Usage(char *name) { - printf("%s [ ]\n", name); - printf(" - string of hex digit pairs, space separated\n"); - printf(" - offset of the report item value in bits, typically 0..31\n"); - printf(" - size of the report item value in bits: typically 1..32\n"); - printf(" - logical minimum value for report item\n"); - printf(" - logical maximum value for report item\n"); - printf(" - expected value\n"); - printf("\n"); - printf("%s \"0c 64 11 0d\" 8 16 0 65535 3345\n", name); - printf("\nIf no arguments are given a builtin set of tests are run.\n"); -} - -static void PrintBufAndData(uint8_t *buf, size_t bufSize, HIDData_t *pData) { - size_t i; - - printf("buf \""); - for (i = 0; i < bufSize - 1; i++) { - printf("%02x ", buf[i]); - } - printf("%02x\"", buf[bufSize - 1]); - printf(" offset %u size %u logmin %ld (0x%lx) logmax %ld (0x%lx)", - pData->Offset, pData->Size, pData->LogMin, pData->LogMin, pData->LogMax, pData->LogMax); -} - -static int RunBuiltInTests(char *argv[]) { - NUT_UNUSED_VARIABLE(argv); - - int exitStatus = 0; - size_t i; - char *next; - uint8_t reportBuf[64]; - size_t bufSize; - HIDData_t data; - long value; - - static struct { - char *buf; /* item data, starts with report id byte, then remaining report bytes */ - uint8_t Offset; /* item offset in bits, typically 0..31 */ - uint8_t Size; /* item size in bits, typically 1..32 */ - long LogMin, LogMax; /* logical minimum and maximum values */ - long expectedValue; /* the expected result of decoding the value in the buffer */ - } testData[] = { - {.buf = "00 ff ff ff ff", .Offset = 0, .Size = 32, .LogMin = -1, .LogMax = 2147483647, .expectedValue = -1}, - {.buf = "00 ff", .Offset = 0, .Size = 8, .LogMin = -1, .LogMax = 127, .expectedValue = -1}, - {.buf = "00 ff", .Offset = 0, .Size = 8, .LogMin = 0, .LogMax = 127, .expectedValue = 127}, - {.buf = "00 ff", .Offset = 0, .Size = 8, .LogMin = 0, .LogMax = 255, .expectedValue = 255}, - {.buf = "33 00 0a 08 80", .Offset = 0, .Size = 32, .LogMin = 0, .LogMax = 65535, .expectedValue = 2560}, - {.buf = "00 00 08 00 00", .Offset = 0, .Size = 32, .LogMin = 0, .LogMax = 65535, .expectedValue = 2048}, - {.buf = "06 00 00 08", .Offset = 0, .Size = 8, .LogMin = 0, .LogMax = 255, .expectedValue = 0}, - {.buf = "06 00 00 08", .Offset = 8, .Size = 8, .LogMin = 0, .LogMax = 255, .expectedValue = 0}, - {.buf = "06 00 00 08", .Offset = 16, .Size = 8, .LogMin = 0, .LogMax = 255, .expectedValue = 8}, - {.buf = "16 0c 00 00 00", .Offset = 0, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 1, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 2, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 1}, - {.buf = "16 0c 00 00 00", .Offset = 3, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 1}, - {.buf = "16 0c 00 00 00", .Offset = 4, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 5, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 6, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 7, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 8, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 9, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0}, - {.buf = "16 0c 00 00 00", .Offset = 10, .Size = 1, .LogMin = 0, .LogMax = 1, .expectedValue = 0} - }; - - for (i = 0; i < sizeof(testData)/sizeof(testData[0]); i++) { - next = testData[i].buf; - for (bufSize = 0; *next != 0; bufSize++) { - reportBuf[bufSize] = (uint8_t) strtol(next, (char **)&next, 16); - } - memset((void *)&data, 0, sizeof(data)); - data.Offset = testData[i].Offset; - data.Size = testData[i].Size; - data.LogMin = testData[i].LogMin; - data.LogMax = testData[i].LogMax; - - GetValue(reportBuf, &data, &value); - - printf("Test #%zd ", i + 1); - PrintBufAndData(reportBuf, bufSize, &data); - if (value == testData[i].expectedValue) { - printf(" value %ld PASS\n", value); - } else { - printf(" value %ld FAIL expected %ld\n", value, testData[i].expectedValue); - exitStatus = 1; - } - } - - /* Emulate rdlen calculations in libusb{0,1}.c or - * langid calculations in nutdrv_qx.c; in these - * cases we take two bytes (cast from usb_ctrl_char - * type, may be signed depending on used API version) - * from the protocol buffer, and build a platform - * dependent representation of a two-byte word. - */ - usb_ctrl_char bufC[2]; - signed char bufS[2]; - unsigned char bufU[2]; - int rdlen; - - /* Example from issue https://github.com/networkupstools/nut/issues/1261 - * where resulting length 0x01a9 should be "425" but ended up "-87" */ - bufC[0] = (usb_ctrl_char)0xa9; - bufC[1] = (usb_ctrl_char)0x01; - - bufS[0] = (signed char)0xa9; - bufS[1] = (signed char)0x01; - - bufU[0] = (unsigned char)0xa9; - bufU[1] = (unsigned char)0x01; - - /* Check different conversion methods and hope current build CPU, - * C implementation etc. do not mess up bit-shifting vs rotation, - * zeroing high bits, int type width extension et al. If something - * is mismatched below, the production NUT code may need adaptations - * for that platform to count stuff correctly! - */ - printf("\nTesting bit-shifting approaches used in codebase to get 2-byte int lengths from wire bytes:\n"); - printf("(Expected correct value is '425', incorrect '-87' or other)\n"); - -#define REPORT_VERDICT(expected) { if (expected) { printf(" - PASS\n"); } else { printf(" - FAIL\n"); exitStatus = 1; } } - - rdlen = bufC[0] | (bufC[1] << 8); - printf(" * reference: no casting, usb_ctrl_char :\t%d\t(depends on libusb API built against)", rdlen); - REPORT_VERDICT (rdlen == 425 || rdlen == -87) - - rdlen = bufS[0] | (bufS[1] << 8); - printf(" * reference: no casting, signed char :\t%d\t(expected '-87' here)", rdlen); - REPORT_VERDICT (rdlen == -87) - - rdlen = bufU[0] | (bufU[1] << 8); - printf(" * reference: no casting, unsigned char :\t%d\t(expected '425')", rdlen); - REPORT_VERDICT (rdlen == 425) - - - rdlen = (uint8_t)bufC[0] | ((uint8_t)bufC[1] << 8); - printf(" * uint8_t casting, usb_ctrl_char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = (uint8_t)bufS[0] | ((uint8_t)bufS[1] << 8); - printf(" * uint8_t casting, signed char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = (uint8_t)bufU[0] | ((uint8_t)bufU[1] << 8); - printf(" * uint8_t casting, unsigned char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - - rdlen = ((uint8_t)bufC[0]) | (((uint8_t)bufC[1]) << 8); - printf(" * uint8_t casting with parentheses, usb_ctrl_char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = ((uint8_t)bufS[0]) | (((uint8_t)bufS[1]) << 8); - printf(" * uint8_t casting with parentheses, signed char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = ((uint8_t)bufU[0]) | (((uint8_t)bufU[1]) << 8); - printf(" * uint8_t casting with parentheses, unsigned char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - - rdlen = ((uint16_t)(bufC[0]) & 0x00FF) | (((uint16_t)(bufC[1]) & 0x00FF) << 8); - printf(" * uint16_t casting with 8-bit mask, usb_ctrl_char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = ((uint16_t)(bufS[0]) & 0x00FF) | (((uint16_t)(bufS[1]) & 0x00FF) << 8); - printf(" * uint16_t casting with 8-bit mask, signed char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = ((uint16_t)(bufU[0]) & 0x00FF) | (((uint16_t)(bufU[1]) & 0x00FF) << 8); - printf(" * uint16_t casting with 8-bit mask, unsigned char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - - rdlen = 256 * (uint8_t)(bufC[1]) + (uint8_t)(bufC[0]); - printf(" * uint8_t casting with multiplication, usb_ctrl_char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = 256 * (uint8_t)(bufS[1]) + (uint8_t)(bufS[0]); - printf(" * uint8_t casting with multiplication, signed char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - rdlen = 256 * (uint8_t)(bufU[1]) + (uint8_t)(bufU[0]); - printf(" * uint8_t casting with multiplication, unsigned char :\t%d", rdlen); - REPORT_VERDICT (rdlen == 425) - - - return (exitStatus); -} - -static int RunCommandLineTest(char *argv[]) { - uint8_t reportBuf[64]; - size_t bufSize; - char *start, *end; - HIDData_t data; - long value, expectedValue; - - start = argv[1]; - end = NULL; - for (bufSize = 0; *start != 0; bufSize++) { - reportBuf[bufSize] = (uint8_t) strtol(start, (char **)&end, 16); - if (start == end) break; - start = end; - } - memset((void *)&data, 0, sizeof(data)); - data.Offset = (uint8_t) atoi(argv[2]); - data.Size = (uint8_t) atoi(argv[3]); - data.LogMin = strtol(argv[4], 0, 0); - data.LogMax = strtol(argv[5], 0, 0); - expectedValue = strtol(argv[6], 0, 0); - - GetValue(reportBuf, &data, &value); - - printf("Test #0 "); - PrintBufAndData(reportBuf, bufSize, &data); - if (value == expectedValue) { - printf(" value %ld PASS\n", value); - return (0); - } else { - printf(" value %ld FAIL expected %ld\n", value, expectedValue); - return (1); - } -} - -int main (int argc, char *argv[]) { - int status; - - switch (argc) { - case 1: - status = RunBuiltInTests(argv); - break; - case 7: - status = RunCommandLineTest(argv); - break; - default: - Usage(argv[0]); - status = 2; - } - return(status); -} diff --git a/tests/nut-driver-enumerator-test--ups.conf b/tests/nut-driver-enumerator-test--ups.conf deleted file mode 100644 index c2916e2..0000000 --- a/tests/nut-driver-enumerator-test--ups.conf +++ /dev/null @@ -1,71 +0,0 @@ -# This is an ups.conf file for nut-driver-enumerator-test.sh -# It is intentionally written in different samples of markup, -# do not clean it up ;) - -maxstartdelay=180 -globalflag - -[dummy1] -driver = dummy-ups - port = file1.dev - desc = "This is ups-1" -[epdu-2] -# This is an ePDU -driver=netxml-ups -port="http://172.16.1.2" -synchronous=yes -[epdu-2-snmp] -driver=snmp-ups -port=172.16.1.2 -synchronous=no - -[usb_3] - driver = "usbhid-ups" - port = "auto" - -[serial.4] - - driver = serial-ups -driverflag - port = /dev/ttyS1 # some path - - -[dummy-proxy] -driver = "dummy-ups " - port = remoteUPS@RemoteHost.local - -[dummy-proxy-localhost] -driver = 'dummy-ups ' - port = "localUPS@127.0.0.1" - -[valueHasEquals] - driver = dummy=ups - port = file1.dev # key = val, right? - -[valueHasHashtag] - driver = dummy-ups - port = file#1.dev - -[valueHasQuotedHashtag] - driver = dummy-ups - port = "file#1.dev" - -[qx-serial] - driver=nutdrv_qx - port = /dev/ttyb - -[qx-usb1] - driver=nutdrv_qx - port = auto -[qx-usb2] - driver=nutdrv_qx - port = /dev/usb/8 -[sectionWithComment]# Some comment - driver=nutdrv_qx#comment - port = /dev/usb/8 - desc="value with [brackets]" - [brackets with spaces are not sections] # but rather an invalid mess as binary parser may think - [sectionWithCommentWhitespace] # Some comment with a space and tab - driver=nutdrv_qx # comment - port = /dev/usb/8 # comment - commentedDriverFlag # This flag gotta mean something diff --git a/tests/nut-driver-enumerator-test.sh b/tests/nut-driver-enumerator-test.sh deleted file mode 100755 index dd91a58..0000000 --- a/tests/nut-driver-enumerator-test.sh +++ /dev/null @@ -1,314 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2018 Eaton -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -#! \file nut-driver-enumerator-test.sh -# \author Jim Klimov -# \brief Self-test for nut-driver-enumerator.sh utility -# \details Automated sanity test for nut-driver-enumerator.sh(.in) -# using different shells (per $SHELL_PROGS) and CLI requests -# for regression and compatibility tests as well as for TDD -# fueled by pre-decided expected outcomes. - -### Use a standard locale setup so sorting in expected results is not confused -LANG=C -LC_ALL=C -TZ=UTC -export LANG LC_ALL TZ - -### Note: These are relative to where the selftest script lives, -### not the NUT top_srcdir etc. They can be exported by a Makefile. -[ -n "${BUILDDIR-}" ] || BUILDDIR="`dirname $0`" -[ -n "${SRCDIR-}" ] || SRCDIR="`dirname $0`" -[ -n "${SHELL_PROGS-}" ] || SHELL_PROGS="/bin/sh" -case "${DEBUG-}" in - [Yy]|[Yy][Ee][Ss]) DEBUG=yes ;; - [Tt][Rr][Aa][Cc][Ee]) DEBUG=trace ;; - *) DEBUG="" ;; -esac - -SYSTEMD_CONFPATH="${BUILDDIR}/selftest-rw/systemd-units" -export SYSTEMD_CONFPATH - -NUT_CONFPATH="${BUILDDIR}/selftest-rw/nut" -export NUT_CONFPATH - -[ -n "${UPSCONF-}" ] || UPSCONF="${SRCDIR}/nut-driver-enumerator-test--ups.conf" -[ ! -s "${UPSCONF-}" ] && echo "FATAL : testing ups.conf not found as '$UPSCONF'" >&2 && exit 1 -export UPSCONF - -if [ ! -n "${NDE-}" ] ; then - for NDE in \ - "${BUILDDIR}/../scripts/upsdrvsvcctl/nut-driver-enumerator.sh" \ - "${SRCDIR}/../scripts/upsdrvsvcctl/nut-driver-enumerator.sh.in" \ - ; do [ -s "$NDE" ] && break ; done -fi -[ ! -s "${NDE-}" ] && echo "FATAL : testing nut-driver-enumerator.sh implementation not found as '$NDE'" >&2 && exit 1 - -# TODO : Add tests that generate configuration files for units -#mkdir -p "${NUT_CONFPATH}" "${SYSTEMD_CONFPATH}" || exit - -FAIL_COUNT=0 -GOOD_COUNT=0 -callNDE() { - case "$DEBUG" in - yes) time $USE_SHELL $NDE "$@" ;; - trace) time $USE_SHELL -x $NDE "$@" ;; - *) $USE_SHELL $NDE "$@" 2>/dev/null ;; - esac -} - -run_testcase() { - # First 3 args are required as defined below; the rest are - # CLI arg(s) to nut-driver-enumerator.sh - CASE_DESCR="$1" - EXPECT_CODE="$2" - EXPECT_TEXT="$3" - shift 3 - - printf "Testing : SHELL='%s'\tCASE='%s'\t" "$USE_SHELL" "$CASE_DESCR" - OUT="`callNDE "$@"`" ; RESCODE=$? - printf "Got : RESCODE='%s'\t" "$RESCODE" - - RES=0 - if [ "$RESCODE" = "$EXPECT_CODE" ]; then - printf "STATUS_CODE='MATCHED'\t" - GOOD_COUNT="`expr $GOOD_COUNT + 1`" - else - printf "STATUS_CODE='MISMATCH' expect_code=%s received_code=%s\t" "$EXPECT_CODE" "$RESCODE" >&2 - FAIL_COUNT="`expr $FAIL_COUNT + 1`" - RES="`expr $RES + 1`" - fi - - if [ "$OUT" = "$EXPECT_TEXT" ]; then - printf "STATUS_TEXT='MATCHED'\n" - GOOD_COUNT="`expr $GOOD_COUNT + 1`" - else - printf "STATUS_TEXT='MISMATCH'\n" - printf '\t--- expected ---\n%s\n\t--- received ---\n%s\n\t--- MISMATCH ABOVE\n\n' "$EXPECT_TEXT" "$OUT" >&2 - # Give a nice output to help track the problem: - ( rm -f "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" \ - && echo "$EXPECT_TEXT" > "/tmp/.nde.text.expected.$$" \ - && echo "$OUT" > "/tmp/.nde.text.actual.$$" \ - && diff -u "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" ) 2>/dev/null || true - rm -f "/tmp/.nde.text.expected.$$" "/tmp/.nde.text.actual.$$" - FAIL_COUNT="`expr $FAIL_COUNT + 1`" - RES="`expr $RES + 2`" - fi - if [ "$RES" != 0 ] || [ -n "$DEBUG" ] ; then echo "" ; fi - return $RES -} - -################################################################## -# Note: expectations in test cases below are tightly connected # -# to both the current code in the script and content of the test # -# configuration file. # -################################################################## - -testcase_bogus_args() { - run_testcase "Reject unknown args" 1 "" \ - --some-bogus-arg -} - -testcase_list_all_devices() { - # We expect a list of unbracketed names from the device sections - # Note: unlike other outputs, this list is alphabetically sorted - run_testcase "List all device names from sections" 0 \ -"dummy-proxy -dummy-proxy-localhost -dummy1 -epdu-2 -epdu-2-snmp -qx-serial -qx-usb1 -qx-usb2 -sectionWithComment -sectionWithCommentWhitespace -serial.4 -usb_3 -valueHasEquals -valueHasHashtag -valueHasQuotedHashtag" \ - --list-devices -} - -testcase_show_all_configs() { - # We expect whitespace trimmed, comment-only lines removed - run_testcase "Show all configs" 0 \ -'maxstartdelay=180 -globalflag -[dummy1] -driver=dummy-ups -port=file1.dev -desc="This is ups-1" -[epdu-2] -driver=netxml-ups -port=http://172.16.1.2 -synchronous=yes -[epdu-2-snmp] -driver=snmp-ups -port=172.16.1.2 -synchronous=no -[usb_3] -driver=usbhid-ups -port=auto -[serial.4] -driver=serial-ups -driverflag -port=/dev/ttyS1 # some path -[dummy-proxy] -driver="dummy-ups " -port=remoteUPS@RemoteHost.local -[dummy-proxy-localhost] -driver='"'dummy-ups '"' -port=localUPS@127.0.0.1 -[valueHasEquals] -driver=dummy=ups -port=file1.dev # key = val, right? -[valueHasHashtag] -driver=dummy-ups -port=file#1.dev -[valueHasQuotedHashtag] -driver=dummy-ups -port=file#1.dev -[qx-serial] -driver=nutdrv_qx -port=/dev/ttyb -[qx-usb1] -driver=nutdrv_qx -port=auto -[qx-usb2] -driver=nutdrv_qx -port=/dev/usb/8 -[sectionWithComment] -driver=nutdrv_qx#comment -port=/dev/usb/8 -desc="value with [brackets]" -[brackets with spaces are not sections] # but rather an invalid mess as binary parser may think -[sectionWithCommentWhitespace] -driver=nutdrv_qx # comment -port=/dev/usb/8 # comment -commentedDriverFlag # This flag gotta mean something' \ - --show-all-configs -} - -testcase_upslist_debug() { - # We expect a list of names, ports and decided MEDIA type (for dependencies) - run_testcase "List decided MEDIA and config checksums for all devices" 0 \ -"INST: 68b329da9893e34099c7d8ad5cb9c940~[]: DRV='' PORT='' MEDIA='' SECTIONMD5='9a1f372a850f1ee3ab1fc08b185783e0' -INST: 010cf0aed6dd49865bb49b70267946f5~[dummy-proxy]: DRV='dummy-ups ' PORT='remoteUPS@RemoteHost.local' MEDIA='network' SECTIONMD5='aff543fc07d7fbf83e81001b181c8b97' -INST: 1ea79c6eea3681ba73cc695f3253e605~[dummy-proxy-localhost]: DRV='dummy-ups ' PORT='localUPS@127.0.0.1' MEDIA='network-localhost' SECTIONMD5='73e6b7e3e3b73558dc15253d8cca51b2' -INST: 76b645e28b0b53122b4428f4ab9eb4b9~[dummy1]: DRV='dummy-ups' PORT='file1.dev' MEDIA='' SECTIONMD5='9e0a326b67e00d455494f8b4258a01f1' -INST: a293d65e62e89d6cc3ac6cb88bc312b8~[epdu-2]: DRV='netxml-ups' PORT='http://172.16.1.2' MEDIA='network' SECTIONMD5='0d9a0147dcf87c7c720e341170f69ed4' -INST: 9a5561464ff8c78dd7cb544740ce2adc~[epdu-2-snmp]: DRV='snmp-ups' PORT='172.16.1.2' MEDIA='network' SECTIONMD5='2631b6c21140cea0dd30bb88b942ce3f' -INST: 16adbdafb22d9fdff1d09038520eb32e~[qx-serial]: DRV='nutdrv_qx' PORT='/dev/ttyb' MEDIA='serial' SECTIONMD5='e3e6e586fbe5b3c0a89432f4b993f4ad' -INST: a21bd2b786228b9619f6adba6db8fa83~[qx-usb1]: DRV='nutdrv_qx' PORT='auto' MEDIA='usb' SECTIONMD5='a6139c5da35bef89dc5b96e2296f5369' -INST: 0066605e07c66043a17eccecbeea1ac5~[qx-usb2]: DRV='nutdrv_qx' PORT='/dev/usb/8' MEDIA='usb' SECTIONMD5='5722dd9c21d07a1f5bcb516dbc458deb' -INST: 1280a731e03116f77290e51dd2a2f37e~[sectionWithComment]: DRV='nutdrv_qx#comment' PORT='/dev/usb/8' MEDIA='' SECTIONMD5='be30e15e17d0579c85eecaf176b4a064' -INST: 770abd5659061a29ed3ae4f7c0b00915~[sectionWithCommentWhitespace]: DRV='nutdrv_qx # comment' PORT='/dev/usb/8 # comment' MEDIA='' SECTIONMD5='c757822a331521cdc97310d0241eba28' -INST: efdb1b4698215fdca36b9bc06d24661d~[serial.4]: DRV='serial-ups' PORT='/dev/ttyS1 # some path' MEDIA='' SECTIONMD5='9c485f733aa6d6c85c1724f162929443' -INST: f4a1c33db201c2ca897a3337993c10fc~[usb_3]: DRV='usbhid-ups' PORT='auto' MEDIA='usb' SECTIONMD5='1f6a24becde9bd31c9852610658ef84a' -INST: 8e5686f92a5ba11901996c813e7bb23d~[valueHasEquals]: DRV='dummy=ups' PORT='file1.dev # key = val, right?' MEDIA='' SECTIONMD5='2f04d65da53e3b13771bb65422f0f4c0' -INST: 99da99b1e301e84f34f349443aac545b~[valueHasHashtag]: DRV='dummy-ups' PORT='file#1.dev' MEDIA='' SECTIONMD5='6029bda216de0cf1e81bd55ebd4a0fff' -INST: d50c3281f9b68a94bf9df72a115fbb5c~[valueHasQuotedHashtag]: DRV='dummy-ups' PORT='file#1.dev' MEDIA='' SECTIONMD5='af59c3c0caaa68dcd796d7145ae403ee'" \ - upslist_debug - - # FIXME : in [valueHasEquals] and [serial.4] the PORT value is quite bogus - # with its embedded comments. Check vs. binary config parser, whether in - # unquoted case only first token is the valid value, and how comments are - # handled in general? - # FIXME : in [valueHasHashtag] the line after "#" should likely be dropped - # (check in binary config parser first) while in [valueHasQuotedHashtag] - # it should stay. -} - -testcase_getValue() { - run_testcase "Query a configuration key (SDP)" 0 \ - "file1.dev" \ - --show-device-config-value dummy1 port - - run_testcase "Query a configuration key (other)" 0 \ - "yes" \ - --show-device-config-value epdu-2 synchronous - - run_testcase "Query a configuration key (originally quoted)" 0 \ - 'This is ups-1' \ - --show-device-config-value dummy1 desc - - run_testcase "Query a configuration flag (driver)" 0 \ - "driverflag" \ - --show-config-value 'serial.4' driverflag - - run_testcase "Query a missing configuration flag (driver)" 1 \ - "" \ - --show-config-value 'valueHasQuotedHashtag' nosuchflag - - run_testcase "Query multiple configuration keys (originally quoted)" 0 \ - 'This is ups-1 -file1.dev' \ - --show-device-config-value dummy1 desc port - - run_testcase "Query multiple configuration keys with some missing (originally quoted)" 1 \ - 'This is ups-1 - -file1.dev' \ - --show-device-config-value dummy1 desc unknownkey port -} - -testcase_globalSection() { - run_testcase "Display global config" 0 \ - "maxstartdelay=180 -globalflag" \ - --show-config '' - - run_testcase "Query a configuration key (global)" 0 \ - "180" \ - --show-config-value '' maxstartdelay - - run_testcase "Query a configuration flag (global)" 0 \ - "globalflag" \ - --show-config-value '' globalflag - - run_testcase "Query a missing configuration flag (global)" 1 \ - "" \ - --show-config-value '' nosuchflag -} - - -# Combine the cases above into a stack -testsuite() { - testcase_bogus_args - testcase_list_all_devices - testcase_show_all_configs - testcase_getValue - testcase_globalSection - # This one can take a while, put it last - testcase_upslist_debug -} - -# If no args... -for USE_SHELL in $SHELL_PROGS ; do - case "$USE_SHELL" in - busybox|busybox_sh) USE_SHELL="busybox sh" ;; - esac - testsuite -done -# End of loop over shells - -echo "Test suite for nut-driver-enumerator has completed with $FAIL_COUNT failed cases and $GOOD_COUNT good cases" >&2 - -[ "$FAIL_COUNT" = 0 ] || { echo "As a developer, you may want to export DEBUG=trace or export DEBUG=yes and re-run the test; also make sure you meant the nut-driver-enumerator.sh implementation as NDE='$NDE'" >&2 ; exit 1; } diff --git a/tests/nutclienttest.cpp b/tests/nutclienttest.cpp deleted file mode 100644 index 774e8c6..0000000 --- a/tests/nutclienttest.cpp +++ /dev/null @@ -1,525 +0,0 @@ -/* nutclienttest - CppUnit nutclient unit test - - Copyright (C) 2016 Emilien Kia - Copyright (C) 2020 - 2021 Jim Klimov - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "common.h" - -/* Current CPPUnit offends the honor of C++98 */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic push -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS -# pragma GCC diagnostic ignored "-Wglobal-constructors" -# endif -# ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS -# pragma GCC diagnostic ignored "-Wexit-time-destructors" -# endif -#endif - -#include - -namespace nut { - -class NutClientTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE( NutClientTest ); - CPPUNIT_TEST( test_strarr_alloc ); - CPPUNIT_TEST( test_stringset_to_strarr ); - CPPUNIT_TEST( test_stringvector_to_strarr ); - - CPPUNIT_TEST( test_copy_constructor_dev ); - CPPUNIT_TEST( test_copy_assignment_dev ); - - CPPUNIT_TEST( test_copy_constructor_cmd ); - CPPUNIT_TEST( test_copy_assignment_cmd ); - - CPPUNIT_TEST( test_copy_constructor_var ); - CPPUNIT_TEST( test_copy_assignment_var ); - - CPPUNIT_TEST( test_nutclientstub_dev ); - CPPUNIT_TEST_SUITE_END(); - -public: - void setUp() override; - void tearDown() override; - - void test_strarr_alloc(); - void test_stringset_to_strarr(); - void test_stringvector_to_strarr(); - - void test_copy_constructor_dev(); - void test_copy_assignment_dev(); - - void test_copy_constructor_cmd(); - void test_copy_assignment_cmd(); - - void test_copy_constructor_var(); - void test_copy_assignment_var(); - - void test_nutclientstub_dev(); -}; - -// Registers the fixture into the 'registry' -CPPUNIT_TEST_SUITE_REGISTRATION( NutClientTest ); - -} // namespace nut {} - -#ifndef _NUTCLIENTTEST_BUILD -# define _NUTCLIENTTEST_BUILD 1 -#endif - -#include "../clients/nutclient.h" -#include "../clients/nutclientmem.h" - -namespace nut { - -extern "C" { -strarr stringset_to_strarr(const std::set& strset); -strarr stringvector_to_strarr(const std::vector& strset); -} // extern "C" - -void NutClientTest::setUp() -{ -} - -void NutClientTest::tearDown() -{ -} - -void NutClientTest::test_strarr_alloc() -{ - bool noException = true; - - strarr arr = nullptr; - - try { - arr = strarr_alloc(5); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed strarr_alloc(...): throw exception", - noException); - - CPPUNIT_ASSERT_MESSAGE( - "Failed strarr_alloc(...): result is null", - arr != nullptr); - - strarr_free(arr); -} - -void NutClientTest::test_stringset_to_strarr() -{ - std::set strset; - strset.insert("test"); - strset.insert("hello"); - strset.insert("world"); - - strarr arr = stringset_to_strarr(strset); - CPPUNIT_ASSERT_MESSAGE( - "stringset_to_strarr(...) result is null", - arr != nullptr); - - std::set res; - - char** ptr = arr; - while(*ptr != nullptr) - { - res.insert(std::string(*ptr)); - ptr++; - } - - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "stringset_to_strarr(...) result has not 3 items", - static_cast(3), res.size()); - CPPUNIT_ASSERT_MESSAGE( - "stringset_to_strarr(...) result has not item \"test\"", - res.find("test") != res.end()); - CPPUNIT_ASSERT_MESSAGE( - "stringset_to_strarr(...) result has not item \"hello\"", - res.find("hello") != res.end()); - CPPUNIT_ASSERT_MESSAGE( - "stringset_to_strarr(...) result has not item \"world\"", - res.find("world") != res.end()); - - strarr_free(arr); -} - -void NutClientTest::test_stringvector_to_strarr() -{ - std::vector strset; - strset.push_back("test"); - strset.push_back("hello"); - strset.push_back("world"); - - strarr arr = stringvector_to_strarr(strset); - CPPUNIT_ASSERT_MESSAGE( - "stringvector_to_strarr(...) result is null", - arr != nullptr); - - char** ptr = arr; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "stringvector_to_strarr(...) result has not item 0==\"test\"", - std::string("test"), std::string(*ptr)); - ++ptr; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "stringvector_to_strarr(...) result has not item 1==\"hello\"", - std::string("hello"), std::string(*ptr)); - ++ptr; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "stringvector_to_strarr(...) result has not item 2==\"world\"", - std::string("world"), std::string(*ptr)); - ++ptr; - - /* https://stackoverflow.com/a/12565009/4715872 - * Can not compare nullptr_t and another data type (char*) - * with CPPUNIT template assertEquals() - */ - CPPUNIT_ASSERT_MESSAGE( - "stringvector_to_strarr(...) result has not only 3 items", - nullptr == *ptr); - - strarr_free(arr); -} - -void NutClientTest::test_copy_constructor_dev() { - nut::TcpClient c; - nut::Device i(&c, "ups1"); - nut::Device j(i); - - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Device variable j by initializing from i", - i, j); -} - -void NutClientTest::test_copy_assignment_dev() { - nut::TcpClient c; - nut::Device i(&c, "ups1"); - nut::Device j(nullptr, "ups2"); - - CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE( - "Device variables i and j were initialized differently " - "but claim to be equal", - CPPUNIT_ASSERT_EQUAL(i, j) ); - - j = i; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Device Command j by equating to i", - i, j); -} - -void NutClientTest::test_copy_constructor_cmd() { - nut::TcpClient c; - nut::Device d(nullptr, "ups1"); - - nut::Command i(&d, "cmd1"); - nut::Command j(i); - - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Command variable j by initializing from i", - i, j); -} - -void NutClientTest::test_copy_assignment_cmd() { - nut::TcpClient c; - nut::Device d(nullptr, "ups1"); - - nut::Command i(&d, "var1"); - nut::Command j(nullptr, "var2"); - - CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE( - "Command variables i and j were initialized differently " - "but claim to be equal", - CPPUNIT_ASSERT_EQUAL(i, j) ); - - j = i; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Command variable j by equating to i", - i, j); -} - -void NutClientTest::test_copy_constructor_var() { - nut::TcpClient c; - nut::Device d(nullptr, "ups1"); - - nut::Variable i(&d, "var1"); - nut::Variable j(i); - - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Variable variable j by initializing from i", - i, j); -} - -void NutClientTest::test_copy_assignment_var() { - nut::TcpClient c; - nut::Device d(nullptr, "ups1"); - - nut::Variable i(&d, "var1"); - nut::Variable j(nullptr, "var2"); - - CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE( - "Variable variables i and j were initialized differently " - "but claim to be equal", - CPPUNIT_ASSERT_EQUAL(i, j) ); - - j = i; - CPPUNIT_ASSERT_EQUAL_MESSAGE( - "Failed to assign value of Variable variable j by equating to i", - i, j); -} - -void NutClientTest::test_nutclientstub_dev() { - bool noException = true; - - nut::MemClientStub c; - nut::Device d(nullptr, "ups_1"); - try - { - // set mono value - c.setDeviceVariable("ups_1", "name_1", "value_1"); - // get mono value - ListValue values = c.getDeviceVariableValue("ups_1", "name_1"); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: mono wrong values number", - values.size() == 1); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: mono bad value", - values[0] == std::string("value_1")); - - // set multi value - ListValue values_multi = { "multi_1", "multi_2" }; - c.setDeviceVariable("ups_1", "name_multi_1", values_multi); - // get multi value - values = c.getDeviceVariableValue("ups_1", "name_multi_1"); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: multi wrong values number", - values.size() == 2); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: multi first bad value", - values[0] == std::string("multi_1")); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: multi second bad value", - values[1] == std::string("multi_2")); - - // get object values - ListObject objects = c.getDeviceVariableValues("ups_1"); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects wrong values number", - objects.size() == 2); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects mono wrong values number", - objects["name_1"].size() == 1); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects mono bad value", - objects["name_1"][0] == std::string("value_1")); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects multi wrong values number", - objects["name_multi_1"].size() == 2); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects mono bad value", - objects["name_multi_1"][0] == std::string("multi_1")); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: objects mono bad value", - objects["name_multi_1"][1] == std::string("multi_2")); - - // get device values - std::set devices_name = { "ups_1" }; - ListDevice devices = c.getDevicesVariableValues(devices_name); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices wrong values number", - devices.size() == 1); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices mono wrong values number", - devices["ups_1"]["name_1"].size() == 1); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices mono bad value", - devices["ups_1"]["name_1"][0] == std::string("value_1")); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices multi wrong values number", - devices["ups_1"]["name_multi_1"].size() == 2); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices mono bad value", - devices["ups_1"]["name_multi_1"][0] == std::string("multi_1")); - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: devices mono bad value", - devices["ups_1"]["name_multi_1"][1] == std::string("multi_2")); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw exception", - noException); - - // List of functions not implemented (should return exception) - noException = true; - try { - std::set cmd = c.getDeviceCommandNames("ups-1"); - CPPUNIT_ASSERT_MESSAGE( - "Variable not use", - cmd.size() == 0); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - std::string desc = c.getDeviceCommandDescription("ups-1", "cmd-1"); - CPPUNIT_ASSERT_MESSAGE( - "Variable not use", - desc.empty()); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - TrackingID id = c.executeDeviceCommand("ups-1", "cmd-1", "param-1"); - CPPUNIT_ASSERT_MESSAGE( - "Variable not use", - id.empty()); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - c.deviceLogin("ups-1"); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - c.deviceMaster("ups-1"); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - c.deviceForcedShutdown("ups-1"); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - c.deviceGetNumLogins("ups-1"); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - TrackingResult result = c.getTrackingResult("track-1"); - CPPUNIT_ASSERT_MESSAGE( - "Variable not use", - result == TrackingResult::SUCCESS); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - bool status = c.isFeatureEnabled(Feature("feature-1")); - CPPUNIT_ASSERT_MESSAGE( - "Variable not use", - !status); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); - - noException = true; - try { - c.setFeature(Feature("feature-1"), true); - } - catch(nut::NutException& ex) - { - NUT_UNUSED_VARIABLE(ex); - noException = false; - } - CPPUNIT_ASSERT_MESSAGE( - "Failed stub tcp client: throw no exception", - !noException); -} - -} // namespace nut {} - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_EXIT_TIME_DESTRUCTORS || defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_GLOBAL_CONSTRUCTORS) -#pragma GCC diagnostic pop -#endif diff --git a/tests/nutlogtest.c b/tests/nutlogtest.c deleted file mode 100644 index 09342c7..0000000 --- a/tests/nutlogtest.c +++ /dev/null @@ -1,65 +0,0 @@ -/* nutlogtest - some trivial usage for upslog*() and upsdebug*() related - * routines to sanity-check their code (compiler does not warn, test runs - * do not crash). - * - * Copyright (C) - * 2020 Jim Klimov - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include "common.h" - -int main(void) { - const char *s1 = "!NULL"; - const char *s2 = NULL; - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wformat-overflow" -#endif - upsdebugx(0, "D: checking with libc handling of NULL: '%s' vs '%s'", s1, s2); - -/* This explicitly does not work with -Wformat, due to verbatim NULL without a var: - * nutlogtest.c:20:5: error: reading through null pointer (argument 4) [-Werror=format=] - * and also due to (void*) vs (char*) in naive case: - * upsdebugx(0, "D: '%s' vs '%s'", NUT_STRARG(NULL), NULL); - * but with casting the explicit NULL remains: - * upsdebugx(0, "D: '%s' vs '%s'", NUT_STRARG((char *)NULL), (char *)NULL); - */ - - upsdebugx(0, "D: checking with NUT_STRARG macro: '%s' vs '%s'", NUT_STRARG(s2), s2); - -#ifdef NUT_STRARG -#undef NUT_STRARG -#endif - -#define NUT_STRARG(x) (x?x:"") - -/* This explicitly does not work with -Wformat, due to a NULL in the '%s' - * format string expansion (e.g. due to NUT PR #675 conversion to macros): - * ../include/common.h:155:41: warning: '%s' directive argument is null [-Wformat-overflow=] - * <...snip...> - * nutlogtest.c:45:63: note: format string is defined here - * 45 | upsdebugx(0, "D: checking with NUT_STRARG macro: '%s' vs '%s'", NUT_STRARG(s2), s2); - * | ^~ - */ - upsdebugx(0, "D: checking that macro wrap trick works: '%s' vs '%s'", NUT_STRARG(s2), s2); - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_OVERFLOW) -# pragma GCC diagnostic pop -#endif - - return 0; -} diff --git a/tools/Makefile.am b/tools/Makefile.am index 9095195..bfcadf7 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,9 @@ +# TODO: remove redundancies! + +# XXX this does not work with Automake!!! +# +# In fact the very concept is entirely antithetical to Automake. +# # SUBDIRS are explicitly a listing of all the directories that make # must recurse into BEFORE processing the current directory. # @@ -7,113 +13,84 @@ # # Anyway, for the time being, we force build in ./ before nut-scanner, # to have nutscan-{usb,snmp}.h built before going into the nut-scanner -# sub-directory. For good measure we also call this from nut-scanner's -# make, to handle developer workflow (editing the *.c sources this uses). +# sub-directory SUBDIRS = . nut-scanner -PYTHON = @PYTHON@ +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh gitlog2changelog.py nut-snmpinfo.py -EXTRA_DIST = nut-usbinfo.pl nut-recorder.sh nut-ddl-dump.sh nut-dumpdiff.sh \ - gitlog2changelog.py.in nut-snmpinfo.py.in driver-list-format.sh +all: nut-scanner-deps -GENERATED_SNMP_FILES = nut-scanner/nutscan-snmp.h - -GENERATED_USB_FILES = nut-scanner/nutscan-usb.h - -# Hotplug output file -GENERATED_USB_OS_FILES = ../scripts/hotplug/libhid.usermap - -# udev output file -GENERATED_USB_OS_FILES += ../scripts/udev/nut-usbups.rules.in - -# BSD devd output file -GENERATED_USB_OS_FILES += ../scripts/devd/nut-usb.conf.in - -# UPower output file -GENERATED_USB_OS_FILES += ../scripts/upower/95-upower-hid.rules - -CLEANFILES = $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES) -# We do not clean away these files, some are even tracked in Git: -#CLEANFILES += $(GENERATED_USB_OS_FILES) - -all: nut-scanner-deps $(GENERATED_USB_OS_FILES) - -# This target is called from the making of nut-scanner to ensure its bits -nut-scanner-deps: $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES) - -# Aliases for particular files, if someone has a need: -nut-scanner-deps-snmpinfo: $(GENERATED_SNMP_FILES) -nut-scanner-deps-usb: $(GENERATED_USB_FILES) - -# The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. -$(GENERATED_SNMP_FILES): $(top_srcdir)/drivers/*-mib.c - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in SRC dir with '$(PYTHON)'."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - cd $(builddir) && $(PYTHON) $(top_srcdir)/tools/nut-snmpinfo.py.in; \ +# XXX these rules are all bogus! They cause un-named target files to +# always be rebuilt! None of that is ever the right way to use make, +# and especially not Automake. Explicit filenames and their exact +# dependencies need to be properly listed. +nut-scanner-deps: + @if python -c 1; then \ + echo "Regenerating the SNMP helper files."; \ + $(top_srcdir)/tools/nut-snmpinfo.py; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping the SNMP helper files regeneration in SRC dir."; \ + echo "Skipping the SNMP helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi -$(GENERATED_USB_FILES): $(top_srcdir)/drivers/*-hid.c $(top_srcdir)/drivers/*usb*.c $(top_srcdir)/drivers/nutdrv_qx.c @if perl -e 1; then \ - echo "Regenerating the USB helper files in SRC dir."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - cd $(builddir) && $(top_srcdir)/tools/nut-usbinfo.pl; \ + echo "Regenerating the USB helper files."; \ + $(top_srcdir)/tools/nut-usbinfo.pl; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Perl is not available."; \ - echo "Skipping the USB helper files regeneration in SRC dir."; \ + echo "Skipping the USB helper files regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi + +website: + @if python -c "import json,simplejson,lxml"; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + $(top_srcdir)/tools/nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: either Python, or a required module (json, simplejson, lxml) "; \ + echo "is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ echo "----------------------------------------------------------------------"; \ fi # call the USB info script upon "make dist", and if Perl is present # call the SNMP info script upon "make dist", and if Python is present # and call both for building nut-scanner -# Also ensure that data/driver.list is well formatted -# NOTE: Beware that current working directory for the script should be builddir -# so it may write the files in "dist" case (read-only sources), but the script -# is called from the distdir where its copy is present. -# The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. +# also generate HCL data files dist-hook: - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in DIST dir with '$(PYTHON)'."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - $(PYTHON) $(distdir)/nut-snmpinfo.py.in; \ + @if python -c 1; then \ + echo "Regenerating the SNMP helper files."; \ + $(distdir)/nut-snmpinfo.py; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping the SNMP helper files regeneration in DIST dir."; \ + echo "Skipping the SNMP helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi @if perl -e 1; then \ - echo "Regenerating the USB helper files in DIST dir."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ + echo "Regenerating the USB helper files."; \ $(distdir)/nut-usbinfo.pl; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Perl is not available."; \ - echo "Skipping the USB helper files regeneration in DIST dir."; \ + echo "Skipping the USB helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi - @$(distdir)/driver-list-format.sh; - -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# Can be recreated by `make` or `configure`, -# impacted by choice of PYTHON version: -DISTCLEANFILES = gitlog2changelog.py -DISTCLEANFILES += nut-snmpinfo.py + @if python -c "import json,simplejson,lxml"; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + $(distdir)/nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: either Python, or a required module (json, simplejson, lxml) "; \ + echo "is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps diff --git a/tools/Makefile.in b/tools/Makefile.in index 51acd39..0535d38 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,62 +14,26 @@ # PARTICULAR PURPOSE. @SET_MAKE@ + +# TODO: remove redundancies! VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -89,24 +54,19 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ subdir = tools +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -115,43 +75,25 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h -CONFIG_CLEAN_FILES = gitlog2changelog.py nut-snmpinfo.py +CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = SOURCES = DIST_SOURCES = -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -159,34 +101,12 @@ am__can_run_installinfo = \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir distdir-am -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(srcdir)/gitlog2changelog.py.in $(srcdir)/nut-snmpinfo.py.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ @@ -216,11 +136,9 @@ am__relativize = \ A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -231,7 +149,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -245,7 +162,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -258,8 +174,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -269,15 +188,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -288,29 +206,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -330,9 +240,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -341,16 +248,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -364,7 +267,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -375,12 +277,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -399,21 +297,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -424,6 +319,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ +# XXX this does not work with Automake!!! +# +# In fact the very concept is entirely antithetical to Automake. +# # SUBDIRS are explicitly a listing of all the directories that make # must recurse into BEFORE processing the current directory. # @@ -433,32 +332,9 @@ udevdir = @udevdir@ # # Anyway, for the time being, we force build in ./ before nut-scanner, # to have nutscan-{usb,snmp}.h built before going into the nut-scanner -# sub-directory. For good measure we also call this from nut-scanner's -# make, to handle developer workflow (editing the *.c sources this uses). +# sub-directory SUBDIRS = . nut-scanner -EXTRA_DIST = nut-usbinfo.pl nut-recorder.sh nut-ddl-dump.sh nut-dumpdiff.sh \ - gitlog2changelog.py.in nut-snmpinfo.py.in driver-list-format.sh - -GENERATED_SNMP_FILES = nut-scanner/nutscan-snmp.h -GENERATED_USB_FILES = nut-scanner/nutscan-usb.h - -# Hotplug output file - -# udev output file - -# BSD devd output file - -# UPower output file -GENERATED_USB_OS_FILES = ../scripts/hotplug/libhid.usermap \ - ../scripts/udev/nut-usbups.rules.in \ - ../scripts/devd/nut-usb.conf.in \ - ../scripts/upower/95-upower-hid.rules -CLEANFILES = $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES) -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# Can be recreated by `make` or `configure`, -# impacted by choice of PYTHON version: -DISTCLEANFILES = gitlog2changelog.py nut-snmpinfo.py +EXTRA_DIST = nut-usbinfo.pl nut-hclinfo.py nut-recorder.sh gitlog2changelog.py nut-snmpinfo.py all: all-recursive .SUFFIXES: @@ -474,13 +350,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tools/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -491,10 +368,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -gitlog2changelog.py: $(top_builddir)/config.status $(srcdir)/gitlog2changelog.py.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ -nut-snmpinfo.py: $(top_builddir)/config.status $(srcdir)/nut-snmpinfo.py.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo @@ -503,25 +376,22 @@ clean-libtool: -rm -rf .libs _libs # This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ + list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ @@ -536,12 +406,57 @@ $(am__recursive_targets): $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ @@ -557,7 +472,12 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -569,11 +489,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -582,29 +506,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -689,17 +595,14 @@ install-strip: mostlyclean-generic: clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am @@ -766,11 +669,12 @@ ps-am: uninstall-am: -.MAKE: $(am__recursive_targets) install-am install-strip +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am clean clean-generic clean-libtool cscopelist-am ctags \ - ctags-am dist-hook distclean distclean-generic \ +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive dist-hook distclean distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ @@ -779,86 +683,84 @@ uninstall-am: install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ - uninstall-am + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am -.PRECIOUS: Makefile -# We do not clean away these files, some are even tracked in Git: -#CLEANFILES += $(GENERATED_USB_OS_FILES) +all: nut-scanner-deps -all: nut-scanner-deps $(GENERATED_USB_OS_FILES) - -# This target is called from the making of nut-scanner to ensure its bits -nut-scanner-deps: $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES) - -# Aliases for particular files, if someone has a need: -nut-scanner-deps-snmpinfo: $(GENERATED_SNMP_FILES) -nut-scanner-deps-usb: $(GENERATED_USB_FILES) - -# The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. -$(GENERATED_SNMP_FILES): $(top_srcdir)/drivers/*-mib.c - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in SRC dir with '$(PYTHON)'."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - cd $(builddir) && $(PYTHON) $(top_srcdir)/tools/nut-snmpinfo.py.in; \ +# XXX these rules are all bogus! They cause un-named target files to +# always be rebuilt! None of that is ever the right way to use make, +# and especially not Automake. Explicit filenames and their exact +# dependencies need to be properly listed. +nut-scanner-deps: + @if python -c 1; then \ + echo "Regenerating the SNMP helper files."; \ + $(top_srcdir)/tools/nut-snmpinfo.py; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping the SNMP helper files regeneration in SRC dir."; \ + echo "Skipping the SNMP helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi -$(GENERATED_USB_FILES): $(top_srcdir)/drivers/*-hid.c $(top_srcdir)/drivers/*usb*.c $(top_srcdir)/drivers/nutdrv_qx.c @if perl -e 1; then \ - echo "Regenerating the USB helper files in SRC dir."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - cd $(builddir) && $(top_srcdir)/tools/nut-usbinfo.pl; \ + echo "Regenerating the USB helper files."; \ + $(top_srcdir)/tools/nut-usbinfo.pl; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Perl is not available."; \ - echo "Skipping the USB helper files regeneration in SRC dir."; \ + echo "Skipping the USB helper files regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi + +website: + @if python -c "import json,simplejson,lxml"; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + $(top_srcdir)/tools/nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: either Python, or a required module (json, simplejson, lxml) "; \ + echo "is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ echo "----------------------------------------------------------------------"; \ fi # call the USB info script upon "make dist", and if Perl is present # call the SNMP info script upon "make dist", and if Python is present # and call both for building nut-scanner -# Also ensure that data/driver.list is well formatted -# NOTE: Beware that current working directory for the script should be builddir -# so it may write the files in "dist" case (read-only sources), but the script -# is called from the distdir where its copy is present. -# The distributed nut-snmpinfo.py.in template is assumed to only differ from -# a generated nut-snmpinfo.py by the @PYTHON@ shebang. +# also generate HCL data files dist-hook: - @if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \ - echo "Regenerating the SNMP helper files in DIST dir with '$(PYTHON)'."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ - $(PYTHON) $(distdir)/nut-snmpinfo.py.in; \ + @if python -c 1; then \ + echo "Regenerating the SNMP helper files."; \ + $(distdir)/nut-snmpinfo.py; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Python is not available."; \ - echo "Skipping the SNMP helper files regeneration in DIST dir."; \ + echo "Skipping the SNMP helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi @if perl -e 1; then \ - echo "Regenerating the USB helper files in DIST dir."; \ - TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \ - TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \ + echo "Regenerating the USB helper files."; \ $(distdir)/nut-usbinfo.pl; \ else \ echo "----------------------------------------------------------------------"; \ echo "Warning: Perl is not available."; \ - echo "Skipping the USB helper files regeneration in DIST dir."; \ + echo "Skipping the USB helper files regeneration."; \ echo "----------------------------------------------------------------------"; \ fi - @$(distdir)/driver-list-format.sh; + @if python -c "import json,simplejson,lxml"; then \ + echo "Regenerating the HTML and JSON formated HCL tables."; \ + $(distdir)/nut-hclinfo.py; \ + else \ + echo "----------------------------------------------------------------------"; \ + echo "Warning: either Python, or a required module (json, simplejson, lxml) "; \ + echo "is not available."; \ + echo "Skipping the HTML and JSON formated HCL tables regeneration."; \ + echo "----------------------------------------------------------------------"; \ + fi .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps diff --git a/tools/driver-list-format.sh b/tools/driver-list-format.sh deleted file mode 100755 index cf9f291..0000000 --- a/tools/driver-list-format.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -################################################################################ -# -# Ensure that driver.list and driver.list.in are properly formatted (with tabs) -# -################################################################################ - -# Adapt path for either dist target or manual call -CURRENT_PATH="`dirname $0`" -DRVLIST_PATH="" - -if [ -f "${CURRENT_PATH}/data/driver.list.in" ]; then - DRVLIST_PATH="${CURRENT_PATH}" -elif [ -f "${CURRENT_PATH}/../data/driver.list.in" ]; then - DRVLIST_PATH="${CURRENT_PATH}/.." -else - echo "Can't find driver.list in . or .." - exit 1 -fi - -echo "Checking whether driver.list[.in] are well formatted" -for drvfile in driver.list.in driver.list -do - if [ -f "${DRVLIST_PATH}/data/${drvfile}" ]; then - sed -e '/^#/!s/\" \+\"/\"\t\"/g' -e "/^#/!s/[[:blank:]]*$//" < "${DRVLIST_PATH}/data/${drvfile}" > "${DRVLIST_PATH}/data/${drvfile}.tabbed" - mv -f "${DRVLIST_PATH}/data/${drvfile}.tabbed" "${DRVLIST_PATH}/data/${drvfile}" - echo "Processed ${DRVLIST_PATH}/data/${drvfile}" - else - echo "Skipping ${drvfile} as it is missing..." - fi -done -echo "done" diff --git a/tools/gitlog2changelog.py.in b/tools/gitlog2changelog.py similarity index 87% rename from tools/gitlog2changelog.py.in rename to tools/gitlog2changelog.py index 5d882cb..d8c0891 100755 --- a/tools/gitlog2changelog.py.in +++ b/tools/gitlog2changelog.py @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!/usr/bin/env python # Copyright 2008 Marcus D. Hanwell # Minor changes for NUT by Charles Lepple # Distributed under the terms of the GNU General Public License v2 or later @@ -44,25 +44,17 @@ for line in fin: files = "" continue # Match the author line and extract the part we want - # (Don't use startswith to allow Author override inside commit message.) elif 'Author:' in line: authorList = re.split(': ', line, 1) - try: - author = authorList[1] - author = author[0:len(author)-1] - authorFound = True - except: - print ("Could not parse authorList = '%s'" % (line)) - + author = authorList[1] + author = author[0:len(author)-1] + authorFound = True # Match the date line - elif line.startswith('Date:'): + elif 'Date:' in line: dateList = re.split(': ', line, 1) - try: - date = dateList[1] - date = date[0:len(date)-1] - dateFound = True - except: - print ("Could not parse dateList = '%s'" % (line)) + date = dateList[1] + date = date[0:len(date)-1] + dateFound = True # The Fossil-IDs are ignored: elif line.startswith(' Fossil-ID:') or line.startswith(' [[SVN:'): continue @@ -88,7 +80,7 @@ for line in fin: else: message = message + " " + line.strip() # If this line is hit all of the files have been stored for this commit - elif re.search('files? changed', line): + elif re.search('files? changed', line) >= 0: filesFound = True continue # Collect the files for this commit. FIXME: Still need to add +/- to files diff --git a/tools/nut-ddl-dump.sh b/tools/nut-ddl-dump.sh deleted file mode 100755 index 326a06d..0000000 --- a/tools/nut-ddl-dump.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -################################################################################ -# A script to ease the generation of NUT device dumps for NUT Devices Dumps Library -################################################################################ -# Author: (C) Arnaud Quette -# License: GPL v2+ -################################################################################ -# FIXME: -# - check if a previous report exists, and increase report number -#  - we currently use the .dev format ; but also consider the NDS format -# http://www.networkupstools.org/ddl/ -################################################################################ - -strUsage="Usage: $0 " - -# Check command line parameter () -if [ -z "$1" ]; then - echo "$strUsage" - exit -else - DDL_DEVICE_NAME=$1 -fi - -# Test communication with the device -upscResult="`upsc ${DDL_DEVICE_NAME} 2> /dev/null`" -if [ $? -gt 0 ]; then - echo "Can't communicate with ${DDL_DEVICE_NAME}" - exit -fi - -# Collect more information -dumpDate="`date -R`" -upsrwResult="`upsrw ${DDL_DEVICE_NAME} 2> /dev/null`" -upscmdResult="`upscmd -l ${DDL_DEVICE_NAME} 2> /dev/null`" - -# Build the filename -# ________. -# Process the Manufacturer name -RAW_DDL_MFR="`upsc ${DDL_DEVICE_NAME} device.mfr 2>/dev/null`" -if [ "${RAW_DDL_MFR}" = "EATON" ]; then - RAW_DDL_MFR="Eaton" -fi -# Replace spaces with underscores -DDL_MFR="`echo ${RAW_DDL_MFR} | sed s/\ /_/g`" -# Process the Model name -# Replace spaces with underscores -RAW_DDL_MODEL="`upsc ${DDL_DEVICE_NAME} device.model 2>/dev/null`" -DDL_MODEL="`echo ${RAW_DDL_MODEL} | sed s/\ /_/g`" -# Process the driver name and NUT version -DDL_DRIVER_NAME="`upsc ${DDL_DEVICE_NAME} driver.name 2>/dev/null`" -DDL_NUT_VERSION="`upsc ${DDL_DEVICE_NAME} driver.version 2>/dev/null`" -# TODO: check if a similar file exists, to update Report nb -DDL_REPORT_NUMBER="01" -DDL_FILENAME="${DDL_MFR}__${DDL_MODEL}__${DDL_DRIVER_NAME}__${DDL_NUT_VERSION}__${DDL_REPORT_NUMBER}.dev" - -# Dump device data into the file -echo "# Device dump generated by $0 on $dumpDate" > ${DDL_FILENAME} -echo "# upsrw output:" >> ${DDL_FILENAME} -echo "${upsrwResult}" | sed -e 's/^/# /' >> ${DDL_FILENAME} -echo "# upscmd output:" >> ${DDL_FILENAME} -echo "${upscmdResult}" | sed -e 's/^/# /' >> ${DDL_FILENAME} -echo "" >> ${DDL_FILENAME} -echo "# upsc output:" >> ${DDL_FILENAME} -echo "${upscResult}" >> ${DDL_FILENAME} -echo "${DDL_FILENAME} generated using ${DDL_DEVICE_NAME} " diff --git a/tools/nut-dumpdiff.sh b/tools/nut-dumpdiff.sh deleted file mode 100755 index 0dcb470..0000000 --- a/tools/nut-dumpdiff.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -# This script is intended to simplify comparison of NUT data dumps, -# such as those collected by drivers with `-d 1` argument, or by -# the `upsc` client, ignoring irrelevant variations (e.g. numbers). -# -# TODO: Make more portable than bash and GNU toolkits -# -# Subject to same license as the NUT Project. -# -# Copyright (C) -# 2022 Jim Klimov -# - -if [ $# = 2 ] && [ -s "$1" ] && [ -s "$2" ]; then - echo "=== $0: comparing '$1' (-) vs '$2' (+)" >&2 -else - echo "=== $0: aborting: requires two filenames to compare as arguments" >&2 - exit 1 -fi - -# Pre-sort just in case: -DATA1="`sort -n < "$1"`" -DATA2="`sort -n < "$2"`" - -# Strip away same-context lines, -# and lines with measurements that are either decimal numbers -# or multi-digit numbers without a decimal point (assuming -# differences in shorter numbers or counters may be important) -diff -bu <(echo "$DATA1") <(echo "$DATA2") \ -| grep -E '^[+-][^+-]' \ -| grep -vE '^[^:]*(power|load|voltage|current|frequency|temperature|humidity): ([0-9][0-9]*|[0-9][0-9]*\.[0-9][0-9]*)$' - -# Note: up to user to post-filter, "^driver.version.*:" -# may be deemed irrelevant as well diff --git a/tools/nut-hclinfo.py b/tools/nut-hclinfo.py new file mode 100755 index 0000000..35b368e --- /dev/null +++ b/tools/nut-hclinfo.py @@ -0,0 +1,277 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (c) 2009 - Arnaud Quette +# Copyright (c) 2010 - Sébastien Volle +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# This script convert the driver.list into HTML and JSON formated tables +# These tables are then used by the AsciiDoc generated website and +# documentation + +try: + import json +except ImportError: + import simplejson as json # Required for Python < 2.6 + +import re +import sys +import os, errno + +# HCL file location and name +rawHCL="../data/driver.list"; + +# Website output +webJsonHCL = "../docs/website/scripts/ups_data.js"; +webStaticHCL = "../docs/ups-html.txt"; + +# from http://wiki.python.org/moin/EscapingHtml + +html_escape_table = { + "&": "&", + '"': """, + "'": "'", + ">": ">", + "<": "<", + } + +def html_escape(text): + """Produce entities within text.""" + return "".join(html_escape_table.get(c,c) for c in text) + +# # # + +class WrongFieldNumberException(Exception): + pass + +def buildData(deviceDataFile): + """ + Read and parse data file under provided path. + Return a bi-dimensional list representing parsed data. + """ + + deviceData = [] + numFields = 6 # Manufacturer, type, support level, model comment, driver + + try: + file = open(deviceDataFile, "r") + except IOError: + print "Cannot open", deviceDataFile + exit(1) + + for line in file: + # Ignore empty lines or comments + if re.match(r"^$|^\s*#", line): + continue + + # Strip all trailing whitespace chars + line = re.sub(r"\s+$", "", line) + + # Replace all tabs by commas + line = re.sub(r"\t", ",", line) + + # Remove trailing comma + line = re.sub(r",$", "", line) + + # Split fields and append result to device data list + # We suppose there are no double-quotes in fields + row = re.findall(r'"([^"]*)",?', line) + + if len(row) != numFields: + print "Warning: Unexpected number of fields in line: %s" % row + print "\tLine will be skipped." + else: + deviceData.append(re.findall(r'"([^"]*)",?', line)) + + return deviceData + +def buildHTMLTable(deviceData): + """ + Convert provided device data into an HTML table. + Return string representation of the HTML table. + + Identical cells are merged vertically with rowspan attribute. + The driver column is color-coded on support level. + + A support level column is also provided. It should be hidden in a graphic + browser but should be visible from a console based browser (w3m). + """ + + from lxml import etree, html + from lxml.builder import E + + if not type(deviceData).__name__ == "list" or len(deviceData) == 0: + raise Exception("Incorrect data was provided") + + # HTML table columns definition + columns = [ + { + "name": "manufacturer", "id": "manufacturer-col", + "text": "Manufacturer", "fields": ["manufacturer"] + }, + { + "name": "model", "id": "model-col", + "text": "Model", "fields": ["model", "comment"] + }, + { + "name": "driver", "id": "driver-col", + "text": "Driver", "fields": ["driver"] + }, + { + "name": "support-level", "id": "support-level-col", + "text": "Support Level", "fields": ["support-level"] + }, + ] + # Device data fields definition + dataFields = [ + "manufacturer", "device-type", "support-level", + "model", "comment", "driver" + ] + + # FIXME: CSS classes should be defined in script global settings + supportLevelClasses = { + "0": "", "1": "red", "2": "orange", + "3": "yellow", "4": "blue", "5": "green" + } + hiddenClass = "hidden" + + # Build table header + table = E.table(id="ups_list", border="1") + header = E.tr() + + for column in columns: + td = E.td(column.get("text"), id=column.get("id")) + if column["id"] == "support-level-col": + td.set("class", hiddenClass) + header.append(td) + + table.append(E.thead(header)) + + # Build table body + tbody = E.tbody(id="ups_list_body") + + cellHistory = [] + rowHistory = deviceData[0][0] + rows = [] + classes = ("even", "odd") + currentClass = 0 + manufIndex = dataFields.index("manufacturer") + + # Build table rows + for device in deviceData: + + # Devices are expected to have a specified number of fields + if len(device) < len(dataFields): + print "Unexpected number of fields in device: %s" % device + print "Device will not be included in result set." + continue + + # Alternate CSS class if current manufacturer is different from the last + if device[manufIndex] != rowHistory : + currentClass = (currentClass + 1) % 2 + rowHistory = device[manufIndex] + + cells = [] + + colIndex = 0 + for column in columns: + cellContent = [] + for field in column["fields"]: + fieldIndex = dataFields.index(field) + fieldContent = device[fieldIndex] + cellContent.append(html_escape(fieldContent)) + cellContent = "
".join(cellContent) + + try: + cH = cellHistory[colIndex] + except: + cH = False + + if not column["name"] == "driver" and cH and cH.get("text") == cellContent: + cH["rowspan"] = cH.get("rowspan", 1) + 1 + else: + cell = { "text": cellContent, "rowspan": 1 } + if column["name"] == "driver": + cell["class"] = supportLevelClasses[device[dataFields.index("support-level")]] + else: + cell["class"] = classes[currentClass] + if column["name"] == "support-level": + cell["class"] = hiddenClass + + cells.append(cell) + try: + cellHistory[colIndex] = cell + except: + cellHistory.append(cell) + + colIndex += 1 + + rows.append(cells) + + for row in rows: + r = E.tr() + for cell in row: + attr = "" + innerHTML = "" + for key, value in cell.iteritems(): + val = unicode(str(value), "utf-8") + if key != "text": + attr += " %s='%s'" % (key, val) + else: + innerHTML = val + + r.append(html.fromstring("%s" % (attr, innerHTML))) + + tbody.append(r) + + table.append(tbody) + + return etree.tostring(table, pretty_print=True) + +# main program +deviceData = buildData(rawHCL) + +# Dump device data as JSON +jsonData = "var UPSData = %s" % json.dumps(deviceData, encoding="utf-8") + +# First, check if target directory exists (which is not the case for 'dist') +dir = os.path.dirname(webJsonHCL) +try: + os.makedirs(dir) +except OSError: + pass + +try: + file = open(webJsonHCL, "w") + file.write(jsonData) + file.close() + print "JSON HCL written" +except IOError: + print "Unable to write JSON device data to %s" % webJsonHCL + exit(1) + +# Create HTML table from device data +table = buildHTMLTable(deviceData) +try: + file = open(webStaticHCL, "w") + file.write("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n") + file.write(table) + file.write("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n") + print "HTML HCL written" +except IOError: + print "Unable to write HTML device table to %s" % webStaticHCL + exit(1) + diff --git a/tools/nut-recorder.sh b/tools/nut-recorder.sh index 2329c2d..e2785c0 100755 --- a/tools/nut-recorder.sh +++ b/tools/nut-recorder.sh @@ -71,7 +71,7 @@ do sleep $pollInterval # update the TIMER value - curTimer=`expr $curTimer + $pollInterval` + curTimer=`expr $curTimer + $pollInterval` # dump the current data testResult="`upsc $devName > ${TEMP_DIR}/curDump.tmp`" diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 667b40b..56278ee 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -1,47 +1,7 @@ -# Generally, list headers and/or sources which are re-generated -# for nut-scanner in the parent dir -NUT_SCANNER_DEPS_H = nutscan-usb.h nutscan-snmp.h -NUT_SCANNER_DEPS_C = +BUILT_SOURCES = nutscan-usb.h nutscan-snmp.h -# General set of nut-scanner dependencies generated in the parent dir -NUT_SCANNER_DEPS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C) - -BUILT_SOURCES = $(NUT_SCANNER_DEPS) -CLEANFILES = $(BUILT_SOURCES) - -# Make sure we have the freshest files (no-op if built earlier and then -# no driver sources and other dependencies were edited by a developer) -$(NUT_SCANNER_DEPS): dummy - @cd .. && $(MAKE) $(AM_MAKEFLAGS) nut-scanner-deps - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -# do not hard depend on '../include/nut_version.h', since it blocks -# 'dist', and is only required for actual build, in which case -# BUILT_SOURCES (in ../include) will ensure nut_version.h will -# be built before anything else -nut-scanner.c: $(top_builddir)/include/nut_version.h - -LINKED_SOURCE_FILES = - -# Separate the .deps of other dirs from this one -# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver -# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -LINKED_SOURCE_FILES += serial.c -serial.c: $(top_srcdir)/drivers/serial.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" - -LINKED_SOURCE_FILES += bcmxcp_ser.c -bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" - -CLEANFILES += $(LINKED_SOURCE_FILES) -BUILT_SOURCES += $(LINKED_SOURCE_FILES) - -$(top_builddir)/include/nut_version.h: - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) +nutscan-usb.h nutscan-snmp.h: + cd ..; $(MAKE) $(AM_MAKEFLAGS) nut-scanner-deps # Only build nut-scanner, and its library, if libltdl was found (required!) if WITH_LIBLTDL @@ -50,39 +10,18 @@ if WITH_LIBLTDL endif libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ nutscan-device.c nutscan-ip.c nutscan-display.c \ - nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \ - scan_avahi.c scan_eaton_serial.c nutscan-serial.c -nodist_libnutscan_la_SOURCES = $(LINKED_SOURCE_FILES) -libnutscan_la_LIBADD = $(NETLIBS) -if WITH_LIBLTDL -libnutscan_la_LIBADD += $(LIBLTDL_LIBS) -endif -libnutscan_la_LIBADD += $(top_builddir)/common/libcommonclient.la -# -# Below we set API versions of public libraries -# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -# Note that changes here may have to be reflected in packaging (the shared -# object .so names would differ) -# -# libnutscan version information -libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 2:0:0 - -# libnutscan exported symbols regex -# WARNING: Since the library includes parts of libcommon (as much as needed -# e.g. for logging or string manipulations), we export a few symbols from -# those too. This may cause issues for (third-party) code development that -# would use both libnutscan and libcommon or similar libs. Here we did have -# a problem with nut-scanner using two copies of common.c and conflicting -# copies of "nut_debug_level" making fun of our debug-logging attempts. -# One solution to tackle if needed for those cases would be to make some -# dynamic/shared libnutcommon (etc.) -libnutscan_la_LDFLAGS += -export-symbols-regex '^(nutscan_|nut_debug_level|s_upsdebugx|max_threads|curr_threads)' -libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include \ - $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers + nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \ + scan_avahi.c scan_eaton_serial.c nutscan-serial.c \ + $(top_srcdir)/drivers/serial.c \ + $(top_srcdir)/drivers/bcmxcp_ser.c \ + $(top_srcdir)/common/common.c +libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) +libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0 +libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers nut_scanner_SOURCES = nut-scanner.c nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include -nut_scanner_LDADD = libnutscan.la +nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la if WITH_SSL libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS) @@ -104,21 +43,13 @@ if WITH_IPMI libnutscan_la_CFLAGS += $(LIBIPMI_CFLAGS) endif -# C is not a header, but there is no dist_noinst_SOURCES -dist_noinst_HEADERS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C) +dist_noinst_HEADERS = nutscan-usb.h nutscan-snmp.h if WITH_DEV - include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h + include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h else dist_noinst_HEADERS += nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h endif -dummy: +CLEANFILES = nutscan-usb.h nutscan-snmp.h -CLEANFILES += *-spellchecked -MAINTAINERCLEANFILES = Makefile.in .dirstamp - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps diff --git a/tools/nut-scanner/Makefile.in b/tools/nut-scanner/Makefile.in index 068ee30..6352714 100644 --- a/tools/nut-scanner/Makefile.in +++ b/tools/nut-scanner/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.16.3 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -17,61 +18,23 @@ VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ +am__make_dryrun = \ + { \ + am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -92,34 +55,30 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ @WITH_LIBLTDL_TRUE@bin_PROGRAMS = nut-scanner$(EXEEXT) -@WITH_LIBLTDL_TRUE@am__append_1 = $(LIBLTDL_LIBS) -@WITH_SSL_TRUE@am__append_2 = $(LIBSSL_CFLAGS) -@WITH_SSL_TRUE@am__append_3 = $(LIBSSL_LIBS) -@WITH_USB_TRUE@am__append_4 = $(LIBUSB_CFLAGS) -@WITH_SNMP_TRUE@am__append_5 = $(LIBNETSNMP_CFLAGS) -@WITH_NEON_TRUE@am__append_6 = $(LIBNEON_CFLAGS) -@WITH_AVAHI_TRUE@am__append_7 = $(LIBAVAHI_CFLAGS) -@WITH_IPMI_TRUE@am__append_8 = $(LIBIPMI_CFLAGS) -@WITH_DEV_FALSE@am__append_9 = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h +@WITH_SSL_TRUE@am__append_1 = $(LIBSSL_CFLAGS) +@WITH_SSL_TRUE@am__append_2 = $(LIBSSL_LIBS) +@WITH_USB_TRUE@am__append_3 = $(LIBUSB_CFLAGS) +@WITH_SNMP_TRUE@am__append_4 = $(LIBNETSNMP_CFLAGS) +@WITH_NEON_TRUE@am__append_5 = $(LIBNEON_CFLAGS) +@WITH_AVAHI_TRUE@am__append_6 = $(LIBAVAHI_CFLAGS) +@WITH_IPMI_TRUE@am__append_7 = $(LIBIPMI_CFLAGS) +@WITH_DEV_FALSE@am__append_8 = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h subdir = tools/nut-scanner +DIST_COMMON = README $(am__dist_noinst_HEADERS_DIST) \ + $(am__include_HEADERS_DIST) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ - $(top_srcdir)/m4/ax_c_pragmas.m4 \ - $(top_srcdir)/m4/ax_check_compile_flag.m4 \ - $(top_srcdir)/m4/ax_compare_version.m4 \ - $(top_srcdir)/m4/ax_run_or_link_ifelse.m4 \ +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_compare_version.m4 \ $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nut_arg_with.m4 \ $(top_srcdir)/m4/nut_check_asciidoc.m4 \ - $(top_srcdir)/m4/nut_check_cppcheck.m4 \ - $(top_srcdir)/m4/nut_check_headers_windows.m4 \ $(top_srcdir)/m4/nut_check_libavahi.m4 \ $(top_srcdir)/m4/nut_check_libfreeipmi.m4 \ $(top_srcdir)/m4/nut_check_libgd.m4 \ + $(top_srcdir)/m4/nut_check_libhal.m4 \ $(top_srcdir)/m4/nut_check_libltdl.m4 \ - $(top_srcdir)/m4/nut_check_libmodbus.m4 \ $(top_srcdir)/m4/nut_check_libneon.m4 \ $(top_srcdir)/m4/nut_check_libnetsnmp.m4 \ $(top_srcdir)/m4/nut_check_libnss.m4 \ @@ -128,25 +87,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/ax_c___attribute__.m4 \ $(top_srcdir)/m4/nut_check_libusb.m4 \ $(top_srcdir)/m4/nut_check_libwrap.m4 \ $(top_srcdir)/m4/nut_check_os.m4 \ - $(top_srcdir)/m4/nut_check_pkgconfig.m4 \ - $(top_srcdir)/m4/nut_check_python.m4 \ - $(top_srcdir)/m4/nut_compiler_family.m4 \ - $(top_srcdir)/m4/nut_func_getnameinfo_argtypes.m4 \ + $(top_srcdir)/m4/nut_config_libhal.m4 \ $(top_srcdir)/m4/nut_report_feature.m4 \ - $(top_srcdir)/m4/nut_stash_warnings.m4 \ $(top_srcdir)/m4/nut_type_socklen_t.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__dist_noinst_HEADERS_DIST) \ - $(am__include_HEADERS_DIST) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" \ - "$(DESTDIR)$(includedir)" -PROGRAMS = $(bin_PROGRAMS) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -174,90 +124,47 @@ am__uninstall_files_from_dir = { \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \ + "$(DESTDIR)$(includedir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = -@WITH_LIBLTDL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -@WITH_SSL_TRUE@am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) +@WITH_SSL_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) libnutscan_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_2) \ - $(top_builddir)/common/libcommonclient.la \ - $(am__DEPENDENCIES_3) + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) am_libnutscan_la_OBJECTS = libnutscan_la-scan_nut.lo \ libnutscan_la-scan_ipmi.lo libnutscan_la-nutscan-device.lo \ libnutscan_la-nutscan-ip.lo libnutscan_la-nutscan-display.lo \ libnutscan_la-nutscan-init.lo libnutscan_la-scan_usb.lo \ libnutscan_la-scan_snmp.lo libnutscan_la-scan_xml_http.lo \ libnutscan_la-scan_avahi.lo libnutscan_la-scan_eaton_serial.lo \ - libnutscan_la-nutscan-serial.lo -am__objects_1 = libnutscan_la-serial.lo libnutscan_la-bcmxcp_ser.lo -nodist_libnutscan_la_OBJECTS = $(am__objects_1) -libnutscan_la_OBJECTS = $(am_libnutscan_la_OBJECTS) \ - $(nodist_libnutscan_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libnutscan_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + libnutscan_la-nutscan-serial.lo libnutscan_la-serial.lo \ + libnutscan_la-bcmxcp_ser.lo libnutscan_la-common.lo +libnutscan_la_OBJECTS = $(am_libnutscan_la_OBJECTS) +libnutscan_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libnutscan_la_CFLAGS) \ $(CFLAGS) $(libnutscan_la_LDFLAGS) $(LDFLAGS) -o $@ @WITH_LIBLTDL_TRUE@am_libnutscan_la_rpath = -rpath $(libdir) +PROGRAMS = $(bin_PROGRAMS) am_nut_scanner_OBJECTS = nut_scanner-nut-scanner.$(OBJEXT) nut_scanner_OBJECTS = $(am_nut_scanner_OBJECTS) -nut_scanner_DEPENDENCIES = libnutscan.la -nut_scanner_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ +nut_scanner_DEPENDENCIES = libnutscan.la ../../common/libcommon.la +nut_scanner_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(nut_scanner_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo \ - ./$(DEPDIR)/libnutscan_la-nutscan-device.Plo \ - ./$(DEPDIR)/libnutscan_la-nutscan-display.Plo \ - ./$(DEPDIR)/libnutscan_la-nutscan-init.Plo \ - ./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo \ - ./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_avahi.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_nut.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_snmp.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_usb.Plo \ - ./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo \ - ./$(DEPDIR)/libnutscan_la-serial.Plo \ - ./$(DEPDIR)/nut_scanner-nut-scanner.Po +am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libnutscan_la_SOURCES) $(nodist_libnutscan_la_SOURCES) \ - $(nut_scanner_SOURCES) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libnutscan_la_SOURCES) $(nut_scanner_SOURCES) DIST_SOURCES = $(libnutscan_la_SOURCES) $(nut_scanner_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -267,37 +174,17 @@ am__can_run_installinfo = \ am__dist_noinst_HEADERS_DIST = nutscan-usb.h nutscan-snmp.h nut-scan.h \ nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h am__include_HEADERS_DIST = nut-scan.h nutscan-device.h nutscan-ip.h \ - nutscan-init.h nutscan-serial.h + nutscan-init.h HEADERS = $(dist_noinst_HEADERS) $(include_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags -am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) A2X = @A2X@ ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ ASCIIDOC = @ASCIIDOC@ ASPELL = @ASPELL@ -AUGPARSE = @AUGPARSE@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -308,7 +195,6 @@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CONFPATH = @CONFPATH@ CPP = @CPP@ -CPPCHECK = @CPPCHECK@ CPPFLAGS = @CPPFLAGS@ CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ CPPUNIT_LIBS = @CPPUNIT_LIBS@ @@ -322,7 +208,6 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DOC_BUILD_LIST = @DOC_BUILD_LIST@ -DOC_CHECK_LIST = @DOC_CHECK_LIST@ DRIVER_BUILD_LIST = @DRIVER_BUILD_LIST@ DRIVER_INSTALL_TARGET = @DRIVER_INSTALL_TARGET@ DRIVER_MAN_LIST = @DRIVER_MAN_LIST@ @@ -335,8 +220,11 @@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ -GDLIB_CONFIG = @GDLIB_CONFIG@ GREP = @GREP@ +HAL_CALLOUTS_PATH = @HAL_CALLOUTS_PATH@ +HAL_DEVICE_MATCH_KEY = @HAL_DEVICE_MATCH_KEY@ +HAL_FDI_PATH = @HAL_FDI_PATH@ +HAL_USER = @HAL_USER@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -346,15 +234,14 @@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBAVAHI_CFLAGS = @LIBAVAHI_CFLAGS@ LIBAVAHI_LIBS = @LIBAVAHI_LIBS@ -LIBDIR = @LIBDIR@ LIBGD_CFLAGS = @LIBGD_CFLAGS@ LIBGD_LDFLAGS = @LIBGD_LDFLAGS@ +LIBHAL_CFLAGS = @LIBHAL_CFLAGS@ +LIBHAL_LIBS = @LIBHAL_LIBS@ LIBIPMI_CFLAGS = @LIBIPMI_CFLAGS@ LIBIPMI_LIBS = @LIBIPMI_LIBS@ LIBLTDL_CFLAGS = @LIBLTDL_CFLAGS@ LIBLTDL_LIBS = @LIBLTDL_LIBS@ -LIBMODBUS_CFLAGS = @LIBMODBUS_CFLAGS@ -LIBMODBUS_LIBS = @LIBMODBUS_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBNETSNMP_CFLAGS = @LIBNETSNMP_CFLAGS@ @@ -365,29 +252,21 @@ LIBPOWERMAN_LIBS = @LIBPOWERMAN_LIBS@ LIBS = @LIBS@ LIBSSL_CFLAGS = @LIBSSL_CFLAGS@ LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBSSL_REQUIRES = @LIBSSL_REQUIRES@ LIBTOOL = @LIBTOOL@ -LIBTOOL_DEPS = @LIBTOOL_DEPS@ LIBUSB_CFLAGS = @LIBUSB_CFLAGS@ -LIBUSB_CONFIG = @LIBUSB_CONFIG@ LIBUSB_LIBS = @LIBUSB_LIBS@ LIBWRAP_CFLAGS = @LIBWRAP_CFLAGS@ LIBWRAP_LIBS = @LIBWRAP_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ -LN_S_R = @LN_S_R@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NETLIBS = @NETLIBS@ -NET_SNMP_CONFIG = @NET_SNMP_CONFIG@ NM = @NM@ NMEDIT = @NMEDIT@ -NUT_DATADIR = @NUT_DATADIR@ -NUT_LIBEXECDIR = @NUT_LIBEXECDIR@ NUT_NETVERSION = @NUT_NETVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ @@ -407,9 +286,6 @@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ PORT = @PORT@ -PYTHON = @PYTHON@ -PYTHON2 = @PYTHON2@ -PYTHON3 = @PYTHON3@ RANLIB = @RANLIB@ RUN_AS_GROUP = @RUN_AS_GROUP@ RUN_AS_USER = @RUN_AS_USER@ @@ -418,16 +294,12 @@ SED = @SED@ SERLIBS = @SERLIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ -SOURCE_HIGHLIGHT = @SOURCE_HIGHLIGHT@ STATEPATH = @STATEPATH@ STRIP = @STRIP@ SUN_LIBUSB = @SUN_LIBUSB@ TREE_VERSION = @TREE_VERSION@ -VALGRIND = @VALGRIND@ VERSION = @VERSION@ WORDS_BIGENDIAN = @WORDS_BIGENDIAN@ -XMLLINT = @XMLLINT@ -XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ @@ -441,7 +313,6 @@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ -auglensdir = @auglensdir@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ @@ -452,12 +323,8 @@ builddir = @builddir@ cgiexecdir = @cgiexecdir@ datadir = @datadir@ datarootdir = @datarootdir@ -devddir = @devddir@ docdir = @docdir@ driverexecdir = @driverexecdir@ -dummy_PKG_CONFIG = @dummy_PKG_CONFIG@ -dummy_PKG_CONFIG_CFLAGS = @dummy_PKG_CONFIG_CFLAGS@ -dummy_PKG_CONFIG_LIBS = @dummy_PKG_CONFIG_LIBS@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ @@ -476,21 +343,18 @@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ -now = @now@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ -systemdshutdowndir = @systemdshutdowndir@ +systemdsystemshutdowndir = @systemdsystemshutdowndir@ systemdsystemunitdir = @systemdsystemunitdir@ -systemdtmpfilesdir = @systemdtmpfilesdir@ target = @target@ target_alias = @target_alias@ target_cpu = @target_cpu@ @@ -500,63 +364,28 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ - -# Generally, list headers and/or sources which are re-generated -# for nut-scanner in the parent dir -NUT_SCANNER_DEPS_H = nutscan-usb.h nutscan-snmp.h -NUT_SCANNER_DEPS_C = - -# General set of nut-scanner dependencies generated in the parent dir -NUT_SCANNER_DEPS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C) -BUILT_SOURCES = $(NUT_SCANNER_DEPS) $(LINKED_SOURCE_FILES) -CLEANFILES = $(BUILT_SOURCES) $(LINKED_SOURCE_FILES) *-spellchecked - -# Separate the .deps of other dirs from this one -# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver -# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -LINKED_SOURCE_FILES = serial.c bcmxcp_ser.c +BUILT_SOURCES = nutscan-usb.h nutscan-snmp.h @WITH_LIBLTDL_TRUE@lib_LTLIBRARIES = libnutscan.la libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ nutscan-device.c nutscan-ip.c nutscan-display.c \ - nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \ - scan_avahi.c scan_eaton_serial.c nutscan-serial.c + nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \ + scan_avahi.c scan_eaton_serial.c nutscan-serial.c \ + $(top_srcdir)/drivers/serial.c \ + $(top_srcdir)/drivers/bcmxcp_ser.c \ + $(top_srcdir)/common/common.c -nodist_libnutscan_la_SOURCES = $(LINKED_SOURCE_FILES) -libnutscan_la_LIBADD = $(NETLIBS) $(am__append_1) \ - $(top_builddir)/common/libcommonclient.la $(am__append_3) -# -# Below we set API versions of public libraries -# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -# Note that changes here may have to be reflected in packaging (the shared -# object .so names would differ) -# -# libnutscan version information - -# libnutscan exported symbols regex -# WARNING: Since the library includes parts of libcommon (as much as needed -# e.g. for logging or string manipulations), we export a few symbols from -# those too. This may cause issues for (third-party) code development that -# would use both libnutscan and libcommon or similar libs. Here we did have -# a problem with nut-scanner using two copies of common.c and conflicting -# copies of "nut_debug_level" making fun of our debug-logging attempts. -# One solution to tackle if needed for those cases would be to make some -# dynamic/shared libnutcommon (etc.) -libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 2:0:0 \ - -export-symbols-regex \ - '^(nutscan_|nut_debug_level|s_upsdebugx|max_threads|curr_threads)' +libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) $(am__append_2) +libnutscan_la_LDFLAGS = $(SERLIBS) -version-info 1:0:0 libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include \ - $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers $(am__append_2) \ - $(am__append_4) $(am__append_5) $(am__append_6) \ - $(am__append_7) $(am__append_8) + $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers $(am__append_1) \ + $(am__append_3) $(am__append_4) $(am__append_5) \ + $(am__append_6) $(am__append_7) nut_scanner_SOURCES = nut-scanner.c nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include -nut_scanner_LDADD = libnutscan.la - -# C is not a header, but there is no dist_noinst_SOURCES -dist_noinst_HEADERS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C) \ - $(am__append_9) -@WITH_DEV_TRUE@include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h -MAINTAINERCLEANFILES = Makefile.in .dirstamp +nut_scanner_LDADD = libnutscan.la ../../common/libcommon.la +dist_noinst_HEADERS = nutscan-usb.h nutscan-snmp.h $(am__append_8) +@WITH_DEV_TRUE@include_HEADERS = nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h +CLEANFILES = nutscan-usb.h nutscan-snmp.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am @@ -574,13 +403,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu tools/nut-scanner/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu tools/nut-scanner/Makefile +.PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) @@ -591,56 +421,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ @@ -667,21 +447,63 @@ uninstall-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libnutscan.la: $(libnutscan_la_OBJECTS) $(libnutscan_la_DEPENDENCIES) $(EXTRA_libnutscan_la_DEPENDENCIES) - $(AM_V_CCLD)$(libnutscan_la_LINK) $(am_libnutscan_la_rpath) $(libnutscan_la_OBJECTS) $(libnutscan_la_LIBADD) $(LIBS) + $(libnutscan_la_LINK) $(am_libnutscan_la_rpath) $(libnutscan_la_OBJECTS) $(libnutscan_la_LIBADD) $(LIBS) +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + if test -n "$$list"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ + fi; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list nut-scanner$(EXEEXT): $(nut_scanner_OBJECTS) $(nut_scanner_DEPENDENCIES) $(EXTRA_nut_scanner_DEPENDENCIES) @rm -f nut-scanner$(EXEEXT) - $(AM_V_CCLD)$(nut_scanner_LINK) $(nut_scanner_OBJECTS) $(nut_scanner_LDADD) $(LIBS) + $(nut_scanner_LINK) $(nut_scanner_OBJECTS) $(nut_scanner_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -689,163 +511,162 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-device.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-display.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-init.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_avahi.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_nut.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_snmp.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_usb.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-serial.Plo@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut_scanner-nut-scanner.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-common.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-device.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-display.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-init.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_avahi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_nut.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_snmp.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_usb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnutscan_la-serial.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nut_scanner-nut-scanner.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< libnutscan_la-scan_nut.lo: scan_nut.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_nut.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_nut.Tpo -c -o libnutscan_la-scan_nut.lo `test -f 'scan_nut.c' || echo '$(srcdir)/'`scan_nut.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_nut.Tpo $(DEPDIR)/libnutscan_la-scan_nut.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_nut.c' object='libnutscan_la-scan_nut.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_nut.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_nut.Tpo -c -o libnutscan_la-scan_nut.lo `test -f 'scan_nut.c' || echo '$(srcdir)/'`scan_nut.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_nut.Tpo $(DEPDIR)/libnutscan_la-scan_nut.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_nut.c' object='libnutscan_la-scan_nut.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_nut.lo `test -f 'scan_nut.c' || echo '$(srcdir)/'`scan_nut.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_nut.lo `test -f 'scan_nut.c' || echo '$(srcdir)/'`scan_nut.c libnutscan_la-scan_ipmi.lo: scan_ipmi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_ipmi.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_ipmi.Tpo -c -o libnutscan_la-scan_ipmi.lo `test -f 'scan_ipmi.c' || echo '$(srcdir)/'`scan_ipmi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_ipmi.Tpo $(DEPDIR)/libnutscan_la-scan_ipmi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_ipmi.c' object='libnutscan_la-scan_ipmi.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_ipmi.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_ipmi.Tpo -c -o libnutscan_la-scan_ipmi.lo `test -f 'scan_ipmi.c' || echo '$(srcdir)/'`scan_ipmi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_ipmi.Tpo $(DEPDIR)/libnutscan_la-scan_ipmi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_ipmi.c' object='libnutscan_la-scan_ipmi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_ipmi.lo `test -f 'scan_ipmi.c' || echo '$(srcdir)/'`scan_ipmi.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_ipmi.lo `test -f 'scan_ipmi.c' || echo '$(srcdir)/'`scan_ipmi.c libnutscan_la-nutscan-device.lo: nutscan-device.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-device.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-device.Tpo -c -o libnutscan_la-nutscan-device.lo `test -f 'nutscan-device.c' || echo '$(srcdir)/'`nutscan-device.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-nutscan-device.Tpo $(DEPDIR)/libnutscan_la-nutscan-device.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutscan-device.c' object='libnutscan_la-nutscan-device.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-device.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-device.Tpo -c -o libnutscan_la-nutscan-device.lo `test -f 'nutscan-device.c' || echo '$(srcdir)/'`nutscan-device.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-device.Tpo $(DEPDIR)/libnutscan_la-nutscan-device.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-device.c' object='libnutscan_la-nutscan-device.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-device.lo `test -f 'nutscan-device.c' || echo '$(srcdir)/'`nutscan-device.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-device.lo `test -f 'nutscan-device.c' || echo '$(srcdir)/'`nutscan-device.c libnutscan_la-nutscan-ip.lo: nutscan-ip.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-ip.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-ip.Tpo -c -o libnutscan_la-nutscan-ip.lo `test -f 'nutscan-ip.c' || echo '$(srcdir)/'`nutscan-ip.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-nutscan-ip.Tpo $(DEPDIR)/libnutscan_la-nutscan-ip.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutscan-ip.c' object='libnutscan_la-nutscan-ip.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-ip.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-ip.Tpo -c -o libnutscan_la-nutscan-ip.lo `test -f 'nutscan-ip.c' || echo '$(srcdir)/'`nutscan-ip.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-ip.Tpo $(DEPDIR)/libnutscan_la-nutscan-ip.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-ip.c' object='libnutscan_la-nutscan-ip.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-ip.lo `test -f 'nutscan-ip.c' || echo '$(srcdir)/'`nutscan-ip.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-ip.lo `test -f 'nutscan-ip.c' || echo '$(srcdir)/'`nutscan-ip.c libnutscan_la-nutscan-display.lo: nutscan-display.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-display.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-display.Tpo -c -o libnutscan_la-nutscan-display.lo `test -f 'nutscan-display.c' || echo '$(srcdir)/'`nutscan-display.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-nutscan-display.Tpo $(DEPDIR)/libnutscan_la-nutscan-display.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutscan-display.c' object='libnutscan_la-nutscan-display.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-display.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-display.Tpo -c -o libnutscan_la-nutscan-display.lo `test -f 'nutscan-display.c' || echo '$(srcdir)/'`nutscan-display.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-display.Tpo $(DEPDIR)/libnutscan_la-nutscan-display.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-display.c' object='libnutscan_la-nutscan-display.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-display.lo `test -f 'nutscan-display.c' || echo '$(srcdir)/'`nutscan-display.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-display.lo `test -f 'nutscan-display.c' || echo '$(srcdir)/'`nutscan-display.c libnutscan_la-nutscan-init.lo: nutscan-init.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-init.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-init.Tpo -c -o libnutscan_la-nutscan-init.lo `test -f 'nutscan-init.c' || echo '$(srcdir)/'`nutscan-init.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-nutscan-init.Tpo $(DEPDIR)/libnutscan_la-nutscan-init.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutscan-init.c' object='libnutscan_la-nutscan-init.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-init.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-init.Tpo -c -o libnutscan_la-nutscan-init.lo `test -f 'nutscan-init.c' || echo '$(srcdir)/'`nutscan-init.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-init.Tpo $(DEPDIR)/libnutscan_la-nutscan-init.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-init.c' object='libnutscan_la-nutscan-init.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-init.lo `test -f 'nutscan-init.c' || echo '$(srcdir)/'`nutscan-init.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-init.lo `test -f 'nutscan-init.c' || echo '$(srcdir)/'`nutscan-init.c libnutscan_la-scan_usb.lo: scan_usb.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_usb.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_usb.Tpo -c -o libnutscan_la-scan_usb.lo `test -f 'scan_usb.c' || echo '$(srcdir)/'`scan_usb.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_usb.Tpo $(DEPDIR)/libnutscan_la-scan_usb.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_usb.c' object='libnutscan_la-scan_usb.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_usb.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_usb.Tpo -c -o libnutscan_la-scan_usb.lo `test -f 'scan_usb.c' || echo '$(srcdir)/'`scan_usb.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_usb.Tpo $(DEPDIR)/libnutscan_la-scan_usb.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_usb.c' object='libnutscan_la-scan_usb.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_usb.lo `test -f 'scan_usb.c' || echo '$(srcdir)/'`scan_usb.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_usb.lo `test -f 'scan_usb.c' || echo '$(srcdir)/'`scan_usb.c libnutscan_la-scan_snmp.lo: scan_snmp.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_snmp.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_snmp.Tpo -c -o libnutscan_la-scan_snmp.lo `test -f 'scan_snmp.c' || echo '$(srcdir)/'`scan_snmp.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_snmp.Tpo $(DEPDIR)/libnutscan_la-scan_snmp.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_snmp.c' object='libnutscan_la-scan_snmp.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_snmp.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_snmp.Tpo -c -o libnutscan_la-scan_snmp.lo `test -f 'scan_snmp.c' || echo '$(srcdir)/'`scan_snmp.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_snmp.Tpo $(DEPDIR)/libnutscan_la-scan_snmp.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_snmp.c' object='libnutscan_la-scan_snmp.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_snmp.lo `test -f 'scan_snmp.c' || echo '$(srcdir)/'`scan_snmp.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_snmp.lo `test -f 'scan_snmp.c' || echo '$(srcdir)/'`scan_snmp.c libnutscan_la-scan_xml_http.lo: scan_xml_http.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_xml_http.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_xml_http.Tpo -c -o libnutscan_la-scan_xml_http.lo `test -f 'scan_xml_http.c' || echo '$(srcdir)/'`scan_xml_http.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_xml_http.Tpo $(DEPDIR)/libnutscan_la-scan_xml_http.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_xml_http.c' object='libnutscan_la-scan_xml_http.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_xml_http.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_xml_http.Tpo -c -o libnutscan_la-scan_xml_http.lo `test -f 'scan_xml_http.c' || echo '$(srcdir)/'`scan_xml_http.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_xml_http.Tpo $(DEPDIR)/libnutscan_la-scan_xml_http.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_xml_http.c' object='libnutscan_la-scan_xml_http.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_xml_http.lo `test -f 'scan_xml_http.c' || echo '$(srcdir)/'`scan_xml_http.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_xml_http.lo `test -f 'scan_xml_http.c' || echo '$(srcdir)/'`scan_xml_http.c libnutscan_la-scan_avahi.lo: scan_avahi.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_avahi.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_avahi.Tpo -c -o libnutscan_la-scan_avahi.lo `test -f 'scan_avahi.c' || echo '$(srcdir)/'`scan_avahi.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_avahi.Tpo $(DEPDIR)/libnutscan_la-scan_avahi.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_avahi.c' object='libnutscan_la-scan_avahi.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_avahi.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_avahi.Tpo -c -o libnutscan_la-scan_avahi.lo `test -f 'scan_avahi.c' || echo '$(srcdir)/'`scan_avahi.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_avahi.Tpo $(DEPDIR)/libnutscan_la-scan_avahi.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_avahi.c' object='libnutscan_la-scan_avahi.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_avahi.lo `test -f 'scan_avahi.c' || echo '$(srcdir)/'`scan_avahi.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_avahi.lo `test -f 'scan_avahi.c' || echo '$(srcdir)/'`scan_avahi.c libnutscan_la-scan_eaton_serial.lo: scan_eaton_serial.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_eaton_serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo $(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='scan_eaton_serial.c' object='libnutscan_la-scan_eaton_serial.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-scan_eaton_serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-scan_eaton_serial.Tpo $(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='scan_eaton_serial.c' object='libnutscan_la-scan_eaton_serial.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-scan_eaton_serial.lo `test -f 'scan_eaton_serial.c' || echo '$(srcdir)/'`scan_eaton_serial.c libnutscan_la-nutscan-serial.lo: nutscan-serial.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo $(DEPDIR)/libnutscan_la-nutscan-serial.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nutscan-serial.c' object='libnutscan_la-nutscan-serial.lo' libtool=yes @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-nutscan-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-nutscan-serial.Tpo $(DEPDIR)/libnutscan_la-nutscan-serial.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nutscan-serial.c' object='libnutscan_la-nutscan-serial.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-nutscan-serial.lo `test -f 'nutscan-serial.c' || echo '$(srcdir)/'`nutscan-serial.c -libnutscan_la-serial.lo: serial.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-serial.Tpo -c -o libnutscan_la-serial.lo `test -f 'serial.c' || echo '$(srcdir)/'`serial.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-serial.Tpo $(DEPDIR)/libnutscan_la-serial.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='serial.c' object='libnutscan_la-serial.lo' libtool=yes @AMDEPBACKSLASH@ +libnutscan_la-serial.lo: $(top_srcdir)/drivers/serial.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-serial.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-serial.Tpo -c -o libnutscan_la-serial.lo `test -f '$(top_srcdir)/drivers/serial.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/serial.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-serial.Tpo $(DEPDIR)/libnutscan_la-serial.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/drivers/serial.c' object='libnutscan_la-serial.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-serial.lo `test -f 'serial.c' || echo '$(srcdir)/'`serial.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-serial.lo `test -f '$(top_srcdir)/drivers/serial.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/serial.c -libnutscan_la-bcmxcp_ser.lo: bcmxcp_ser.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-bcmxcp_ser.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo -c -o libnutscan_la-bcmxcp_ser.lo `test -f 'bcmxcp_ser.c' || echo '$(srcdir)/'`bcmxcp_ser.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo $(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bcmxcp_ser.c' object='libnutscan_la-bcmxcp_ser.lo' libtool=yes @AMDEPBACKSLASH@ +libnutscan_la-bcmxcp_ser.lo: $(top_srcdir)/drivers/bcmxcp_ser.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-bcmxcp_ser.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo -c -o libnutscan_la-bcmxcp_ser.lo `test -f '$(top_srcdir)/drivers/bcmxcp_ser.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/bcmxcp_ser.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-bcmxcp_ser.Tpo $(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/drivers/bcmxcp_ser.c' object='libnutscan_la-bcmxcp_ser.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-bcmxcp_ser.lo `test -f 'bcmxcp_ser.c' || echo '$(srcdir)/'`bcmxcp_ser.c +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-bcmxcp_ser.lo `test -f '$(top_srcdir)/drivers/bcmxcp_ser.c' || echo '$(srcdir)/'`$(top_srcdir)/drivers/bcmxcp_ser.c + +libnutscan_la-common.lo: $(top_srcdir)/common/common.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -MT libnutscan_la-common.lo -MD -MP -MF $(DEPDIR)/libnutscan_la-common.Tpo -c -o libnutscan_la-common.lo `test -f '$(top_srcdir)/common/common.c' || echo '$(srcdir)/'`$(top_srcdir)/common/common.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libnutscan_la-common.Tpo $(DEPDIR)/libnutscan_la-common.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/common/common.c' object='libnutscan_la-common.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnutscan_la_CFLAGS) $(CFLAGS) -c -o libnutscan_la-common.lo `test -f '$(top_srcdir)/common/common.c' || echo '$(srcdir)/'`$(top_srcdir)/common/common.c nut_scanner-nut-scanner.o: nut-scanner.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -MT nut_scanner-nut-scanner.o -MD -MP -MF $(DEPDIR)/nut_scanner-nut-scanner.Tpo -c -o nut_scanner-nut-scanner.o `test -f 'nut-scanner.c' || echo '$(srcdir)/'`nut-scanner.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nut_scanner-nut-scanner.Tpo $(DEPDIR)/nut_scanner-nut-scanner.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nut-scanner.c' object='nut_scanner-nut-scanner.o' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -MT nut_scanner-nut-scanner.o -MD -MP -MF $(DEPDIR)/nut_scanner-nut-scanner.Tpo -c -o nut_scanner-nut-scanner.o `test -f 'nut-scanner.c' || echo '$(srcdir)/'`nut-scanner.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nut_scanner-nut-scanner.Tpo $(DEPDIR)/nut_scanner-nut-scanner.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nut-scanner.c' object='nut_scanner-nut-scanner.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -c -o nut_scanner-nut-scanner.o `test -f 'nut-scanner.c' || echo '$(srcdir)/'`nut-scanner.c +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -c -o nut_scanner-nut-scanner.o `test -f 'nut-scanner.c' || echo '$(srcdir)/'`nut-scanner.c nut_scanner-nut-scanner.obj: nut-scanner.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -MT nut_scanner-nut-scanner.obj -MD -MP -MF $(DEPDIR)/nut_scanner-nut-scanner.Tpo -c -o nut_scanner-nut-scanner.obj `if test -f 'nut-scanner.c'; then $(CYGPATH_W) 'nut-scanner.c'; else $(CYGPATH_W) '$(srcdir)/nut-scanner.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nut_scanner-nut-scanner.Tpo $(DEPDIR)/nut_scanner-nut-scanner.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='nut-scanner.c' object='nut_scanner-nut-scanner.obj' libtool=no @AMDEPBACKSLASH@ +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -MT nut_scanner-nut-scanner.obj -MD -MP -MF $(DEPDIR)/nut_scanner-nut-scanner.Tpo -c -o nut_scanner-nut-scanner.obj `if test -f 'nut-scanner.c'; then $(CYGPATH_W) 'nut-scanner.c'; else $(CYGPATH_W) '$(srcdir)/nut-scanner.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nut_scanner-nut-scanner.Tpo $(DEPDIR)/nut_scanner-nut-scanner.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nut-scanner.c' object='nut_scanner-nut-scanner.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -c -o nut_scanner-nut-scanner.obj `if test -f 'nut-scanner.c'; then $(CYGPATH_W) 'nut-scanner.c'; else $(CYGPATH_W) '$(srcdir)/nut-scanner.c'; fi` +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(nut_scanner_CFLAGS) $(CFLAGS) -c -o nut_scanner-nut-scanner.obj `if test -f 'nut-scanner.c'; then $(CYGPATH_W) 'nut-scanner.c'; else $(CYGPATH_W) '$(srcdir)/nut-scanner.c'; fi` mostlyclean-libtool: -rm -f *.lo @@ -874,15 +695,26 @@ uninstall-includeHEADERS: files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ - $(am__define_uniq_tagged_files); \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ @@ -894,11 +726,15 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $$unique; \ fi; \ fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique @@ -907,29 +743,11 @@ GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) +distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ @@ -962,17 +780,16 @@ distdir-am: $(DISTFILES) check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(PROGRAMS) $(LTLIBRARIES) $(HEADERS) +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) install-binPROGRAMS: install-libLTLIBRARIES installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)"; do \ + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-exec-am +install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -1003,28 +820,13 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) - -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ clean-libtool mostlyclean-am distclean: distclean-am - -rm -f ./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-device.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-display.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-init.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_avahi.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_nut.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_snmp.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_usb.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-serial.Plo - -rm -f ./$(DEPDIR)/nut_scanner-nut-scanner.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -1070,21 +872,7 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/libnutscan_la-bcmxcp_ser.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-device.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-display.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-init.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-ip.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-nutscan-serial.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_avahi.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_eaton_serial.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_ipmi.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_nut.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_snmp.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_usb.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-scan_xml_http.Plo - -rm -f ./$(DEPDIR)/libnutscan_la-serial.Plo - -rm -f ./$(DEPDIR)/nut_scanner-nut-scanner.Po + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic @@ -1104,56 +892,27 @@ ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \ uninstall-libLTLIBRARIES -.MAKE: all check install install-am install-exec install-strip +.MAKE: all check install install-am install-strip -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ - clean-binPROGRAMS clean-generic clean-libLTLIBRARIES \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-binPROGRAMS install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libLTLIBRARIES clean-libtool ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ install-includeHEADERS install-info install-info-am \ install-libLTLIBRARIES install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-binPROGRAMS \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-includeHEADERS uninstall-libLTLIBRARIES -.PRECIOUS: Makefile - -# Make sure we have the freshest files (no-op if built earlier and then -# no driver sources and other dependencies were edited by a developer) -$(NUT_SCANNER_DEPS): dummy - @cd .. && $(MAKE) $(AM_MAKEFLAGS) nut-scanner-deps - -# Make sure out-of-dir dependencies exist (especially when dev-building parts): -$(top_builddir)/common/libcommon.la: dummy - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -# do not hard depend on '../include/nut_version.h', since it blocks -# 'dist', and is only required for actual build, in which case -# BUILT_SOURCES (in ../include) will ensure nut_version.h will -# be built before anything else -nut-scanner.c: $(top_builddir)/include/nut_version.h -serial.c: $(top_srcdir)/drivers/serial.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" -bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c - test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" - -$(top_builddir)/include/nut_version.h: - @cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) - -dummy: - -# NOTE: Do not clean ".deps" in SUBDIRS of the main project, -# the root Makefile.am takes care of that! -#clean-local: -# rm -rf $(builddir)/.deps +nutscan-usb.h nutscan-snmp.h: + cd ..; $(MAKE) $(AM_MAKEFLAGS) nut-scanner-deps # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/tools/nut-scanner/README b/tools/nut-scanner/README index 1889237..d6e9d59 100644 --- a/tools/nut-scanner/README +++ b/tools/nut-scanner/README @@ -38,8 +38,6 @@ iteration function to display results: nutscan_options_t * opt; nutscan_device_t *device; - nutscan-init(); - if ((device = nutscan_scan_usb()) == NULL) { printf("No device found\n"); exit(EXIT_FAILURE); @@ -77,7 +75,7 @@ iteration function to display results: This library file and the associated header files are not installed by -default. You must `./configure --with-dev` to enable building and +default. You must `./configure --with-lib` to enable building and installing these files. The libraries can then be built and installed with `make` and `make install` as usual. This must be done before building other (non-NUT) programs which depend on them. diff --git a/tools/nut-scanner/nut-scan.h b/tools/nut-scanner/nut-scan.h index dee6739..37298fa 100644 --- a/tools/nut-scanner/nut-scan.h +++ b/tools/nut-scanner/nut-scan.h @@ -1,9 +1,8 @@ -/* +/* nut-scan.h: detect NUT services + * * Copyright (C) - * 2011 - EATON + * 2011 - Frederic Bohe * 2012 - Arnaud Quette - * 2016 - EATON - IP addressed XML scan - * 2016-2021 - EATON - Various threads-related improvements * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,51 +19,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nut-scan.h - \brief general header for nut-scanner - \author Frederic Bohe - \author Arnaud Quette - \author Michal Vyskocil - \author Jim Klimov -*/ - #ifndef NUT_SCAN_H #define NUT_SCAN_H -#include "config.h" -#include -#include "nut_stdint.h" - #include #include #include -#include #ifdef WITH_IPMI #include #endif -#ifdef HAVE_PTHREAD -# include - -# ifdef HAVE_SEMAPHORE -# include -# endif - -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) -extern size_t max_threads, curr_threads, max_threads_netxml, max_threads_oldnut, max_threads_netsnmp; -# endif - -# ifdef HAVE_PTHREAD_TRYJOIN -extern pthread_mutex_t threadcount_mutex; -# endif - -typedef struct nutscan_thread { - pthread_t thread; - int active; /* true if the thread was created, false if joined (to not join twice) */ -} nutscan_thread_t; -#endif /* HAVE_PTHREAD */ - #ifdef __cplusplus /* *INDENT-OFF* */ extern "C" { @@ -113,39 +78,21 @@ typedef struct nutscan_ipmi { #define IPMI_1_5 1 #define IPMI_2_0 0 -/* XML HTTP structure */ -typedef struct nutscan_xml { - uint16_t port_http; /* Port for xml http (tcp) */ - uint16_t port_udp; /* Port for xml udp */ - useconds_t usec_timeout; /* Wait this long for a response */ - char *peername; /* Hostname or NULL for broadcast mode */ -} nutscan_xml_t; - /* Scanning */ -nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip, useconds_t usec_timeout, nutscan_snmp_t * sec); +nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip, long usec_timeout, nutscan_snmp_t * sec); -nutscan_device_t * nutscan_scan_usb(void); +nutscan_device_t * nutscan_scan_usb(); -/* If "ip" == NULL, do a broadcast scan */ -/* If sec->usec_timeout <= 0 then the common usec_timeout arg overrides it */ -nutscan_device_t * nutscan_scan_xml_http_range(const char *start_ip, const char *end_ip, useconds_t usec_timeout, nutscan_xml_t * sec); +nutscan_device_t * nutscan_scan_xml_http(long usec_timeout); -nutscan_device_t * nutscan_scan_nut(const char * startIP, const char * stopIP, const char * port, useconds_t usec_timeout); +nutscan_device_t * nutscan_scan_nut(const char * startIP, const char * stopIP, const char * port, long usec_timeout); -nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout); +nutscan_device_t * nutscan_scan_avahi(long usec_timeout); -nutscan_device_t * nutscan_scan_ipmi(const char * startIP, const char * stopIP, nutscan_ipmi_t * sec); +nutscan_device_t * nutscan_scan_ipmi(const char * startIP, const char * stopIP, nutscan_ipmi_t * sec); nutscan_device_t * nutscan_scan_eaton_serial(const char* ports_list); -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE -/* Expose shared libnutscanner semaphore for overall thread count - * limited across different scanning methods (protocols/media): */ -sem_t * nutscan_semaphore(void); -# endif -#endif - /* Display functions */ void nutscan_display_ups_conf(nutscan_device_t * device); void nutscan_display_parsable(nutscan_device_t * device); diff --git a/tools/nut-scanner/nut-scanner.c b/tools/nut-scanner/nut-scanner.c index 30a7206..4451158 100644 --- a/tools/nut-scanner/nut-scanner.c +++ b/tools/nut-scanner/nut-scanner.c @@ -1,7 +1,7 @@ -/* - * Copyright (C) 2011 - 2012 Arnaud Quette - * Copyright (C) 2016 Michal Vyskocil - * Copyright (C) 2016 - 2021 Jim Klimov +/* nut-scanner.c: a tool to detect NUT supported devices + * + * Copyright (C) + * 2011 - 2012 Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,42 +18,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nut-scanner.c - \brief A tool to detect NUT supported devices - \author Arnaud Quette - \author Michal Vyskocil - \author Jim Klimov -*/ - -#include "common.h" /* Must be first include to pull "config.h" */ - #include #include #include +#include "common.h" #include "nut_version.h" #include #include - #ifdef HAVE_PTHREAD -# include -# ifdef HAVE_SEMAPHORE -# include -# endif -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) -# include "nut_stdint.h" -# ifdef HAVE_SYS_RESOURCE_H -# include /* for getrlimit() and struct rlimit */ -# include - -/* 3 is reserved for known overhead (for NetXML at least) - * following practical investigation summarized at - * https://github.com/networkupstools/nut/pull/1158 - * and probably means the usual stdin/stdout/stderr triplet - */ -# define RESERVE_FD_COUNT 3 -# endif /* HAVE_SYS_RESOURCE_H */ -# endif /* HAVE_PTHREAD_TRYJOIN || HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ +#include +#endif #include "nut-scan.h" @@ -61,288 +35,120 @@ #define ERR_BAD_OPTION (-1) -static const char optstring[] = "?ht:T:s:e:E:c:l:u:W:X:w:x:p:b:B:d:L:CUSMOAm:NPqIVaD"; +const char optstring[] = "?ht:s:e:E:c:l:u:W:X:w:x:p:b:B:d:D:CUSMOAm:NPqIVa"; #ifdef HAVE_GETOPT_LONG -static const struct option longopts[] = { - { "timeout", required_argument, NULL, 't' }, - { "thread", required_argument, NULL, 'T' }, - { "start_ip", required_argument, NULL, 's' }, - { "end_ip", required_argument, NULL, 'e' }, - { "eaton_serial", required_argument, NULL, 'E' }, - { "mask_cidr", required_argument, NULL, 'm' }, - { "community", required_argument, NULL, 'c' }, - { "secLevel", required_argument, NULL, 'l' }, - { "secName", required_argument, NULL, 'u' }, - { "authPassword", required_argument, NULL, 'W' }, - { "privPassword", required_argument, NULL, 'X' }, - { "authProtocol", required_argument, NULL, 'w' }, - { "privProtocol", required_argument, NULL, 'x' }, - { "username", required_argument, NULL, 'b' }, - { "password", required_argument, NULL, 'B' }, - { "authType", required_argument, NULL, 'd' }, - { "cipher_suite_id", required_argument, NULL, 'L' }, - { "port", required_argument, NULL, 'p' }, - { "complete_scan", no_argument, NULL, 'C' }, - { "usb_scan", no_argument, NULL, 'U' }, - { "snmp_scan", no_argument, NULL, 'S' }, - { "xml_scan", no_argument, NULL, 'M' }, - { "oldnut_scan", no_argument, NULL, 'O' }, - { "avahi_scan", no_argument, NULL, 'A' }, - { "ipmi_scan", no_argument, NULL, 'I' }, - { "disp_nut_conf", no_argument, NULL, 'N' }, - { "disp_parsable", no_argument, NULL, 'P' }, - { "quiet", no_argument, NULL, 'q' }, - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'V' }, - { "available", no_argument, NULL, 'a' }, - { "nut_debug_level", no_argument, NULL, 'D' }, - { NULL, 0, NULL, 0 } -}; +const struct option longopts[] = + {{ "timeout",required_argument,NULL,'t' }, + { "start_ip",required_argument,NULL,'s' }, + { "end_ip",required_argument,NULL,'e' }, + { "eaton_serial",required_argument,NULL,'E' }, + { "mask_cidr",required_argument,NULL,'m' }, + { "community",required_argument,NULL,'c' }, + { "secLevel",required_argument,NULL,'l' }, + { "secName",required_argument,NULL,'u' }, + { "authPassword",required_argument,NULL,'W' }, + { "privPassword",required_argument,NULL,'X' }, + { "authProtocol",required_argument,NULL,'w' }, + { "privProtocol",required_argument,NULL,'x' }, + { "username",required_argument,NULL,'b' }, + { "password",required_argument,NULL,'B' }, + { "authType",required_argument,NULL,'d' }, + { "cipher_suite_id",required_argument,NULL,'D' }, + { "port",required_argument,NULL,'p' }, + { "complete_scan",no_argument,NULL,'C' }, + { "usb_scan",no_argument,NULL,'U' }, + { "snmp_scan",no_argument,NULL,'S' }, + { "xml_scan",no_argument,NULL,'M' }, + { "oldnut_scan",no_argument,NULL,'O' }, + { "avahi_scan",no_argument,NULL,'A' }, + { "ipmi_scan",no_argument,NULL,'I' }, + { "disp_nut_conf",no_argument,NULL,'N' }, + { "disp_parsable",no_argument,NULL,'P' }, + { "quiet",no_argument,NULL,'q' }, + { "help",no_argument,NULL,'h' }, + { "version",no_argument,NULL,'V' }, + { "available",no_argument,NULL,'a' }, + {NULL,0,NULL,0}}; #else -#define getopt_long(a,b,c,d,e) getopt(a,b,c) +#define getopt_long(a,b,c,d,e) getopt(a,b,c) #endif /* HAVE_GETOPT_LONG */ static nutscan_device_t *dev[TYPE_END]; -static useconds_t timeout = DEFAULT_NETWORK_TIMEOUT * 1000 * 1000; /* in usec */ -static char * start_ip = NULL; -static char * end_ip = NULL; +static long timeout = DEFAULT_TIMEOUT*1000*1000; /* in usec */ +static char * start_ip = NULL; +static char * end_ip = NULL; static char * port = NULL; static char * serial_ports = NULL; #ifdef HAVE_PTHREAD static pthread_t thread[TYPE_END]; -static void * run_usb(void *arg) +static void * run_usb(void * arg) { - NUT_UNUSED_VARIABLE(arg); - dev[TYPE_USB] = nutscan_scan_usb(); return NULL; } - static void * run_snmp(void * arg) { nutscan_snmp_t * sec = (nutscan_snmp_t *)arg; - dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip, end_ip, timeout, sec); + dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip,end_ip,timeout,sec); return NULL; } - static void * run_xml(void * arg) { - nutscan_xml_t * sec = (nutscan_xml_t *)arg; - - dev[TYPE_XML] = nutscan_scan_xml_http_range(start_ip, end_ip, timeout, sec); + dev[TYPE_XML] = nutscan_scan_xml_http(timeout); return NULL; } -static void * run_nut_old(void *arg) +static void * run_nut_old(void * arg) { - NUT_UNUSED_VARIABLE(arg); - - dev[TYPE_NUT] = nutscan_scan_nut(start_ip, end_ip, port, timeout); + dev[TYPE_NUT] = nutscan_scan_nut(start_ip,end_ip,port,timeout); return NULL; } -static void * run_avahi(void *arg) +static void * run_avahi(void * arg) { - NUT_UNUSED_VARIABLE(arg); - dev[TYPE_AVAHI] = nutscan_scan_avahi(timeout); return NULL; } - static void * run_ipmi(void * arg) { nutscan_ipmi_t * sec = (nutscan_ipmi_t *)arg; - dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip, end_ip, sec); + dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip,end_ip,sec); return NULL; } -static void * run_eaton_serial(void *arg) +static void * run_eaton_serial(void * arg) { - NUT_UNUSED_VARIABLE(arg); - - dev[TYPE_EATON_SERIAL] = nutscan_scan_eaton_serial(serial_ports); + dev[TYPE_EATON_SERIAL] = nutscan_scan_eaton_serial (serial_ports); return NULL; } #endif /* HAVE_PTHREAD */ - -static void show_usage() +int printq(int quiet,const char *fmt, ...) { -/* NOTE: This code uses `nutscan_avail_*` global vars from nutscan-init.c */ - puts("nut-scanner : utility for detection of available power devices.\n"); - puts("OPTIONS:"); - printf(" -C, --complete_scan: Scan all available devices except serial ports (default).\n"); - if (nutscan_avail_usb) { - printf(" -U, --usb_scan: Scan USB devices.\n"); - } else { - printf("* Options for USB devices scan not enabled: library not detected.\n"); - } - if (nutscan_avail_snmp) { - printf(" -S, --snmp_scan: Scan SNMP devices using built-in mapping definitions.\n"); - } else { - printf("* Options for SNMP devices scan not enabled: library not detected.\n"); - } - if (nutscan_avail_xml_http) { - printf(" -M, --xml_scan: Scan XML/HTTP devices.\n"); - } else { - printf("* Options for XML/HTTP devices scan not enabled: library not detected.\n"); - } - printf(" -O, --oldnut_scan: Scan NUT devices (old method).\n"); - if (nutscan_avail_avahi) { - printf(" -A, --avahi_scan: Scan NUT devices (avahi method).\n"); - } else { - printf("* Options for NUT devices (avahi method) scan not enabled: library not detected.\n"); - } - if (nutscan_avail_ipmi) { - printf(" -I, --ipmi_scan: Scan IPMI devices.\n"); - } else { - printf("* Options for IPMI devices scan not enabled: library not detected.\n"); + va_list ap; + int ret; + + if(quiet) { + return 0; } - printf(" -E, --eaton_serial : Scan serial Eaton devices (XCP, SHUT and Q1).\n"); + va_start(ap, fmt); + ret = vprintf(fmt, ap); + va_end(ap); -#if (defined HAVE_PTHREAD) && (defined HAVE_PTHREAD_TRYJOIN) - printf(" -T, --thread : Limit the amount of scanning threads running simultaneously (default: %zu).\n", max_threads); -#else - printf(" -T, --thread : Limit the amount of scanning threads running simultaneously (not implemented in this build: no pthread support)"); -#endif - - printf("\nNetwork specific options:\n"); - printf(" -t, --timeout : network operation timeout (default %d).\n", DEFAULT_NETWORK_TIMEOUT); - printf(" -s, --start_ip : First IP address to scan.\n"); - printf(" -e, --end_ip : Last IP address to scan.\n"); - printf(" -m, --mask_cidr : Give a range of IP using CIDR notation.\n"); - - if (nutscan_avail_snmp) { - printf("\nSNMP v1 specific options:\n"); - printf(" -c, --community : Set SNMP v1 community name (default = public)\n"); - - printf("\nSNMP v3 specific options:\n"); - printf(" -l, --secLevel : Set the securityLevel used for SNMPv3 messages (allowed values: noAuthNoPriv, authNoPriv, authPriv)\n"); - printf(" -u, --secName : Set the securityName used for authenticated SNMPv3 messages (mandatory if you set secLevel. No default)\n"); - - /* Construct help for AUTHPROTO */ - { int comma = 0; - NUT_UNUSED_VARIABLE(comma); /* potentially, if no protocols are available */ - printf(" -w, --authProtocol : Set the authentication protocol ("); -#if (defined WITH_SNMP) && (defined NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol) -/* Note: NUT_HAVE_LIBNETSNMP_* macros are not AC_DEFINE'd when libsnmp was - * completely not detected at configure time, so "#if" is not a pedantically - * correct test (unknown macro may default to "0" but is not guaranteed to). - */ -# if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "MD5" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "SHA" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "SHA256" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "SHA384" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "SHA512" - ); -# endif - printf("%s%s", - (comma ? "" : "none supported"), - ") used for authenticated SNMPv3 messages (default=MD5 if available)\n" - ); - } /* Construct help for AUTHPROTO */ - - printf(" -W, --authPassword : Set the authentication pass phrase used for authenticated SNMPv3 messages (mandatory if you set secLevel to authNoPriv or authPriv)\n"); - - /* Construct help for PRIVPROTO */ - { int comma = 0; - NUT_UNUSED_VARIABLE(comma); /* potentially, if no protocols are available */ - printf(" -x, --privProtocol : Set the privacy protocol ("); -# if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "DES" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "AES" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "AES192" - ); -# endif -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - printf("%s%s", - (comma++ ? ", " : ""), - "AES256" - ); -# endif -# endif /* NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 */ -#endif /* built WITH_SNMP */ - printf("%s%s", - (comma ? "" : "none supported"), - ") used for encrypted SNMPv3 messages (default=DES if available)\n" - ); - } /* Construct help for PRIVPROTO */ - - printf(" -X, --privPassword : Set the privacy pass phrase used for encrypted SNMPv3 messages (mandatory if you set secLevel to authPriv)\n"); - } - - if (nutscan_avail_ipmi) { - printf("\nIPMI over LAN specific options:\n"); - printf(" -b, --username : Set the username used for authenticating IPMI over LAN connections (mandatory for IPMI over LAN. No default)\n"); - /* Specify the username to use when authenticating with the remote host. If not specified, a null (i.e. anonymous) username is assumed. The user must have - * at least ADMIN privileges in order for this tool to operate fully. */ - printf(" -B, --password : Specify the password to use when authenticationg with the remote host (mandatory for IPMI over LAN. No default)\n"); - /* Specify the password to use when authenticationg with the remote host. If not specified, a null password is assumed. Maximum password length is 16 for IPMI - * 1.5 and 20 for IPMI 2.0. */ - printf(" -d, --authType : Specify the IPMI 1.5 authentication type to use (NONE, STRAIGHT_PASSWORD_KEY, MD2, and MD5) with the remote host (default=MD5)\n"); - printf(" -L, --cipher_suite_id : Specify the IPMI 2.0 cipher suite ID to use, for authentication, integrity, and confidentiality (default=3)\n"); - } - - printf("\nNUT specific options:\n"); - printf(" -p, --port : Port number of remote NUT upsd\n"); - printf("\ndisplay specific options:\n"); - printf(" -N, --disp_nut_conf: Display result in the ups.conf format\n"); - printf(" -P, --disp_parsable: Display result in a parsable format\n"); - printf("\nMiscellaneous options:\n"); - printf(" -V, --version: Display NUT version\n"); - printf(" -a, --available: Display available bus that can be scanned\n"); - printf(" -q, --quiet: Display only scan result. No information on currently scanned bus is displayed.\n"); - printf(" -D, --nut_debug_level: Raise the debugging level. Use this multiple times to see more details.\n"); + return ret; } int main(int argc, char *argv[]) { nutscan_snmp_t snmp_sec; nutscan_ipmi_t ipmi_sec; - nutscan_xml_t xml_sec; int opt_ret; char * cidr = NULL; int allow_all = 0; @@ -352,97 +158,39 @@ int main(int argc, char *argv[]) int allow_oldnut = 0; int allow_avahi = 0; int allow_ipmi = 0; - int allow_eaton_serial = 0; /* MUST be requested explicitly! */ - int quiet = 0; /* The debugging level for certain upsdebugx() progress messages; 0 = print always, quiet==1 is to require at least one -D */ + int allow_eaton_serial = 0; /* MUST be requested explicitely! */ + int quiet = 0; void (*display_func)(nutscan_device_t * device); int ret_code = EXIT_SUCCESS; -#if (defined HAVE_PTHREAD) && ( (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) ) && (defined HAVE_SYS_RESOURCE_H) - struct rlimit nofile_limit; - - /* Limit the max scanning thread count by the amount of allowed open - * file descriptors (which caller can change with `ulimit -n NUM`), - * following practical investigation summarized at - * https://github.com/networkupstools/nut/pull/1158 - * Resource-Limit code inspired by example from: - * https://stackoverflow.com/questions/4076848/how-to-do-the-equivalent-of-ulimit-n-400-from-within-c/4077000#4077000 - */ - - /* Get max number of files. */ - if (getrlimit(RLIMIT_NOFILE, &nofile_limit) != 0) { - /* Report error, keep hardcoded default */ - fprintf(stderr, "getrlimit() failed with errno=%d, keeping default job limits\n", errno); - nofile_limit.rlim_cur = 0; - nofile_limit.rlim_max = 0; - } else { - if (nofile_limit.rlim_cur > 0 - && nofile_limit.rlim_cur > RESERVE_FD_COUNT - && (uintmax_t)max_threads > (uintmax_t)(nofile_limit.rlim_cur - RESERVE_FD_COUNT) - && (uintmax_t)(nofile_limit.rlim_cur) < (uintmax_t)SIZE_MAX - ) { - max_threads = (size_t)nofile_limit.rlim_cur; - if (max_threads > (RESERVE_FD_COUNT + 1)) { - max_threads -= RESERVE_FD_COUNT; - } - } - } -#endif /* HAVE_PTHREAD && ( HAVE_PTHREAD_TRYJOIN || HAVE_SEMAPHORE ) && HAVE_SYS_RESOURCE_H */ memset(&snmp_sec, 0, sizeof(snmp_sec)); memset(&ipmi_sec, 0, sizeof(ipmi_sec)); - memset(&xml_sec, 0, sizeof(xml_sec)); - /* Set the default values for IPMI */ ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_MD5; ipmi_sec.ipmi_version = IPMI_1_5; /* default to IPMI 1.5, if not otherwise specified */ ipmi_sec.cipher_suite_id = 3; /* default to HMAC-SHA1; HMAC-SHA1-96; AES-CBC-128 */ ipmi_sec.privilege_level = IPMI_PRIVILEGE_LEVEL_ADMIN; /* should be sufficient */ - /* Set the default values for XML HTTP (run_xml()) */ - xml_sec.port_http = 80; - xml_sec.port_udp = 4679; - xml_sec.usec_timeout = 0; /* Override with the "timeout" common setting later */ - xml_sec.peername = NULL; - - /* Parse command line options -- First loop: only get debug level */ - /* Suppress error messages, for now -- leave them to the second loop. */ - opterr = 0; - while ((opt_ret = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) { - if (opt_ret == 'D') - nut_debug_level++; - } - nutscan_init(); display_func = nutscan_display_ups_conf; - /* Parse command line options -- Second loop: everything else */ - /* Restore error messages... */ - opterr = 1; - /* ...and index of the item to be processed by getopt(). */ - optind = 1; - /* Note: the getopts print an error message about unknown arguments - * or arguments which need a second token and that is missing now */ - while ((opt_ret = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) { + while((opt_ret = getopt_long(argc, argv, optstring, longopts, NULL))!=-1) { switch(opt_ret) { case 't': - timeout = (useconds_t)atol(optarg) * 1000 * 1000; /*in usec*/ - if (timeout <= 0) { - fprintf(stderr, - "Illegal timeout value, using default %ds\n", - DEFAULT_NETWORK_TIMEOUT); - timeout = DEFAULT_NETWORK_TIMEOUT * 1000 * 1000; + timeout = atol(optarg)*1000*1000; /*in usec*/ + if( timeout == 0 ) { + fprintf(stderr,"Illegal timeout value, using default %ds\n", DEFAULT_TIMEOUT); + timeout = DEFAULT_TIMEOUT*1000*1000; } break; case 's': start_ip = strdup(optarg); - if (end_ip == NULL) - end_ip = start_ip; + end_ip = start_ip; break; case 'e': end_ip = strdup(optarg); - if (start_ip == NULL) - start_ip = end_ip; break; case 'E': serial_ports = strdup(optarg); @@ -450,73 +198,69 @@ int main(int argc, char *argv[]) break; case 'm': cidr = strdup(optarg); - upsdebugx(5, "Got CIDR net/mask: %s", cidr); - break; - case 'D': - /* nothing to do, here */ break; case 'c': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.community = strdup(optarg); break; case 'l': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.secLevel = strdup(optarg); break; case 'u': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.secName = strdup(optarg); break; case 'W': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.authPassword = strdup(optarg); break; case 'X': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.privPassword = strdup(optarg); break; case 'w': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.authProtocol = strdup(optarg); break; case 'x': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } snmp_sec.privProtocol = strdup(optarg); break; case 'S': - if (!nutscan_avail_snmp) { + if(!nutscan_avail_snmp) { goto display_help; } allow_snmp = 1; break; case 'b': - if (!nutscan_avail_ipmi) { + if(!nutscan_avail_ipmi) { goto display_help; } ipmi_sec.username = strdup(optarg); break; case 'B': - if (!nutscan_avail_ipmi) { + if(!nutscan_avail_ipmi) { goto display_help; } ipmi_sec.password = strdup(optarg); break; case 'd': - if (!nutscan_avail_ipmi) { + if(!nutscan_avail_ipmi) { goto display_help; } if (!strcmp(optarg, "NONE")) { @@ -532,13 +276,11 @@ int main(int argc, char *argv[]) ipmi_sec.authentication_type = IPMI_AUTHENTICATION_TYPE_MD5; } else { - fprintf(stderr, - "Unknown authentication type (%s). Defaulting to MD5\n", - optarg); + fprintf(stderr,"Unknown authentication type (%s). Defaulting to MD5\n", optarg); } break; - case 'L': - if (!nutscan_avail_ipmi) { + case 'D': + if(!nutscan_avail_ipmi) { goto display_help; } ipmi_sec.cipher_suite_id = atoi(optarg); @@ -548,70 +290,17 @@ int main(int argc, char *argv[]) case 'p': port = strdup(optarg); break; - case 'T': { -#if (defined HAVE_PTHREAD) && ( (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) ) - char* endptr; - long val = strtol(optarg, &endptr, 10); - /* With endptr we check that no chars were left in optarg - * (that is, pointed-to char -- if reported -- is '\0') - */ - if ((!endptr || !*endptr) - && val > 0 - && (uintmax_t)val < (uintmax_t)SIZE_MAX - ) { -# ifdef HAVE_SYS_RESOURCE_H - if (nofile_limit.rlim_cur > 0 - && nofile_limit.rlim_cur > RESERVE_FD_COUNT - && (uintmax_t)nofile_limit.rlim_cur < (uintmax_t)SIZE_MAX - && (uintmax_t)val > (uintmax_t)(nofile_limit.rlim_cur - RESERVE_FD_COUNT) - ) { - upsdebugx(1, "Detected soft limit for " - "file descriptor count is %ju", - (uintmax_t)nofile_limit.rlim_cur); - upsdebugx(1, "Detected hard limit for " - "file descriptor count is %ju", - (uintmax_t)nofile_limit.rlim_max); - - max_threads = (size_t)nofile_limit.rlim_cur; - if (max_threads > (RESERVE_FD_COUNT + 1)) { - max_threads -= RESERVE_FD_COUNT; - } - - fprintf(stderr, - "WARNING: Requested max scanning " - "thread count %s (%ld) exceeds the " - "current file descriptor count limit " - "(minus reservation), constraining " - "to %zu\n", - optarg, val, max_threads); - } else -# endif /* HAVE_SYS_RESOURCE_H */ - max_threads = (size_t)val; - } else { - fprintf(stderr, - "WARNING: Requested max scanning " - "thread count %s (%ld) is out of range, " - "using default %zu\n", - optarg, val, max_threads); - } -#else - fprintf(stderr, - "WARNING: Max scanning thread count option " - "is not supported in this build, ignored\n"); -#endif /* HAVE_PTHREAD && ways to limit the thread count */ - } - break; case 'C': allow_all = 1; break; case 'U': - if (!nutscan_avail_usb) { + if(!nutscan_avail_usb) { goto display_help; } allow_usb = 1; break; case 'M': - if (!nutscan_avail_xml_http) { + if(!nutscan_avail_xml_http) { goto display_help; } allow_xml = 1; @@ -620,13 +309,13 @@ int main(int argc, char *argv[]) allow_oldnut = 1; break; case 'A': - if (!nutscan_avail_avahi) { + if(!nutscan_avail_avahi) { goto display_help; } allow_avahi = 1; break; case 'I': - if (!nutscan_avail_ipmi) { + if(!nutscan_avail_ipmi) { goto display_help; } allow_ipmi = 1; @@ -645,85 +334,105 @@ int main(int argc, char *argv[]) exit(EXIT_SUCCESS); case 'a': printf("OLDNUT\n"); - if (nutscan_avail_usb) { + if(nutscan_avail_usb) { printf("USB\n"); } - if (nutscan_avail_snmp) { + if(nutscan_avail_snmp) { printf("SNMP\n"); } - if (nutscan_avail_xml_http) { + if(nutscan_avail_xml_http) { printf("XML\n"); } - if (nutscan_avail_avahi) { + if(nutscan_avail_avahi) { printf("AVAHI\n"); } - if (nutscan_avail_ipmi) { + if(nutscan_avail_ipmi) { printf("IPMI\n"); } printf("EATON_SERIAL\n"); exit(EXIT_SUCCESS); case '?': ret_code = ERR_BAD_OPTION; - goto display_help; - /* Fall through to usage and error exit */ case 'h': default: display_help: - show_usage(); - if ((opt_ret != 'h') || (ret_code != EXIT_SUCCESS)) - fprintf(stderr, "\n\n" - "WARNING: Some error has occurred while processing 'nut-scanner' command-line\n" - "arguments, see more details above the usage help text.\n\n"); + puts("nut-scanner : detecting available power devices.\n"); + puts("OPTIONS:"); + printf(" -C, --complete_scan: Scan all available devices (default).\n"); + if( nutscan_avail_usb ) { + printf(" -U, --usb_scan: Scan USB devices.\n"); + } + if( nutscan_avail_snmp ) { + printf(" -S, --snmp_scan: Scan SNMP devices.\n"); + } + if( nutscan_avail_xml_http ) { + printf(" -M, --xml_scan: Scan XML/HTTP devices.\n"); + } + printf(" -O, --oldnut_scan: Scan NUT devices (old method).\n"); + if( nutscan_avail_avahi ) { + printf(" -A, --avahi_scan: Scan NUT devices (avahi method).\n"); + } + if( nutscan_avail_ipmi ) { + printf(" -I, --ipmi_scan: Scan IPMI devices.\n"); + } + + printf(" -E, --eaton_serial : Scan serial Eaton devices (XCP, SHUT and Q1).\n"); + + printf("\nNetwork specific options:\n"); + printf(" -t, --timeout : network operation timeout (default %d).\n",DEFAULT_TIMEOUT); + printf(" -s, --start_ip : First IP address to scan.\n"); + printf(" -e, --end_ip : Last IP address to scan.\n"); + printf(" -m, --mask_cidr : Give a range of IP using CIDR notation.\n"); + + if( nutscan_avail_snmp ) { + printf("\nSNMP v1 specific options:\n"); + printf(" -c, --community : Set SNMP v1 community name (default = public)\n"); + + printf("\nSNMP v3 specific options:\n"); + printf(" -l, --secLevel : Set the securityLevel used for SNMPv3 messages (allowed values: noAuthNoPriv,authNoPriv,authPriv)\n"); + printf(" -u, --secName : Set the securityName used for authenticated SNMPv3 messages (mandatory if you set secLevel. No default)\n"); + printf(" -w, --authProtocol : Set the authentication protocol (MD5 or SHA) used for authenticated SNMPv3 messages (default=MD5)\n"); + printf(" -W, --authPassword : Set the authentication pass phrase used for authenticated SNMPv3 messages (mandatory if you set secLevel to authNoPriv or authPriv)\n"); + printf(" -x, --privProtocol : Set the privacy protocol (DES or AES) used for encrypted SNMPv3 messages (default=DES)\n"); + printf(" -X, --privPassword : Set the privacy pass phrase used for encrypted SNMPv3 messages (mandatory if you set secLevel to authPriv)\n"); + } + + if( nutscan_avail_ipmi ) { + printf("\nIPMI over LAN specific options:\n"); + printf(" -b, --username : Set the username used for authenticating IPMI over LAN connections (mandatory for IPMI over LAN. No default)\n"); + /* Specify the username to use when authenticating with the remote host. If not specified, a null (i.e. anonymous) username is assumed. The user must have + * at least ADMIN privileges in order for this tool to operate fully. */ + printf(" -B, --password : Specify the password to use when authenticationg with the remote host (mandatory for IPMI over LAN. No default)\n"); + /* Specify the password to use when authenticationg with the remote host. If not specified, a null password is assumed. Maximum password length is 16 for IPMI + * 1.5 and 20 for IPMI 2.0. */ + printf(" -d, --authType : Specify the IPMI 1.5 authentication type to use (NONE, STRAIGHT_PASSWORD_KEY, MD2, and MD5) with the remote host (default=MD5)\n"); + printf(" -D, --cipher_suite_id : Specify the IPMI 2.0 cipher suite ID to use, for authentication, integrity, and confidentiality (default=3)\n"); + } + + printf("\nNUT specific options:\n"); + printf(" -p, --port : Port number of remote NUT upsd\n"); + printf("\ndisplay specific options:\n"); + printf(" -N, --disp_nut_conf: Display result in the ups.conf format\n"); + printf(" -P, --disp_parsable: Display result in a parsable format\n"); + printf("\nMiscellaneous options:\n"); + printf(" -V, --version: Display NUT version\n"); + printf(" -a, --available: Display available bus that can be scanned\n"); + printf(" -q, --quiet: Display only scan result. No information on currently scanned bus is displayed.\n"); return ret_code; } + } -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - /* FIXME: Currently sem_init already done on nutscan-init for lib need. - We need to destroy it before re-init. We currently can't change "sem value" - on lib (need to be thread safe). */ - sem_t *current_sem = nutscan_semaphore(); - sem_destroy(current_sem); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Different platforms, different sizes, none fits all... */ - if (SIZE_MAX > UINT_MAX && max_threads > UINT_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - fprintf(stderr, "\n\n" - "WARNING: Limiting max_threads to range acceptable for sem_init()\n\n"); - max_threads = UINT_MAX - 1; - } - sem_init(current_sem, 0, (unsigned int)max_threads); -# endif -#endif /* HAVE_PTHREAD */ - - if (cidr) { - upsdebugx(1, "Processing CIDR net/mask: %s", cidr); + if( cidr ) { nutscan_cidr_to_ip(cidr, &start_ip, &end_ip); - upsdebugx(1, "Extracted IP address range from CIDR net/mask: %s => %s", start_ip, end_ip); } - if (!allow_usb && !allow_snmp && !allow_xml && !allow_oldnut && - !allow_avahi && !allow_ipmi && !allow_eaton_serial - ) { + if( !allow_usb && !allow_snmp && !allow_xml && !allow_oldnut && + !allow_avahi && !allow_ipmi && !allow_eaton_serial) { allow_all = 1; } - if (allow_all) { + if( allow_all ) { allow_usb = 1; allow_snmp = 1; allow_xml = 1; @@ -733,211 +442,141 @@ display_help: /* BEWARE: allow_all does not include allow_eaton_serial! */ } -/* TODO/discuss : Should the #else...#endif code below for lack of pthreads - * during build also serve as a fallback for pthread failure at runtime? - */ - if (allow_usb && nutscan_avail_usb) { - upsdebugx(quiet, "Scanning USB bus."); + if( allow_usb && nutscan_avail_usb ) { + printq(quiet,"Scanning USB bus.\n"); #ifdef HAVE_PTHREAD - if (pthread_create(&thread[TYPE_USB], NULL, run_usb, NULL)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if(pthread_create(&thread[TYPE_USB],NULL,run_usb,NULL)) { nutscan_avail_usb = 0; } #else - upsdebugx(1, "USB SCAN: no pthread support, starting nutscan_scan_usb..."); dev[TYPE_USB] = nutscan_scan_usb(); #endif /* HAVE_PTHREAD */ - } else { - upsdebugx(1, "USB SCAN: not requested, SKIPPED"); } - if (allow_snmp && nutscan_avail_snmp) { - if (start_ip == NULL) { - upsdebugx(quiet, "No start IP, skipping SNMP"); + if( allow_snmp && nutscan_avail_snmp ) { + if( start_ip == NULL ) { + printq(quiet,"No start IP, skipping SNMP\n"); nutscan_avail_snmp = 0; } else { - upsdebugx(quiet, "Scanning SNMP bus."); + printq(quiet,"Scanning SNMP bus.\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "SNMP SCAN: starting pthread_create with run_snmp..."); - if (pthread_create(&thread[TYPE_SNMP], NULL, run_snmp, &snmp_sec)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if( pthread_create(&thread[TYPE_SNMP],NULL,run_snmp,&snmp_sec)) { nutscan_avail_snmp = 0; } #else - upsdebugx(1, "SNMP SCAN: no pthread support, starting nutscan_scan_snmp..."); - dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip, end_ip, timeout, &snmp_sec); + dev[TYPE_SNMP] = nutscan_scan_snmp(start_ip,end_ip,timeout,&snmp_sec); #endif /* HAVE_PTHREAD */ } - } else { - upsdebugx(1, "SNMP SCAN: not requested, SKIPPED"); } - if (allow_xml && nutscan_avail_xml_http) { - upsdebugx(quiet, "Scanning XML/HTTP bus."); - xml_sec.usec_timeout = timeout; + if( allow_xml && nutscan_avail_xml_http) { + printq(quiet,"Scanning XML/HTTP bus.\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "XML/HTTP SCAN: starting pthread_create with run_xml..."); - if (pthread_create(&thread[TYPE_XML], NULL, run_xml, &xml_sec)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if(pthread_create(&thread[TYPE_XML],NULL,run_xml,NULL)) { nutscan_avail_xml_http = 0; } #else - upsdebugx(1, "XML/HTTP SCAN: no pthread support, starting nutscan_scan_xml_http_range()..."); - dev[TYPE_XML] = nutscan_scan_xml_http_range(start_ip, end_ip, timeout, &xml_sec); + dev[TYPE_XML] = nutscan_scan_xml_http(timeout); #endif /* HAVE_PTHREAD */ - } else { - upsdebugx(1, "XML/HTTP SCAN: not requested, SKIPPED"); } - if (allow_oldnut && nutscan_avail_nut) { - if (start_ip == NULL) { - upsdebugx(quiet, "No start IP, skipping NUT bus (old connect method)"); + if( allow_oldnut && nutscan_avail_nut) { + if( start_ip == NULL ) { + printq(quiet,"No start IP, skipping NUT bus (old connect method)\n"); nutscan_avail_nut = 0; } else { - upsdebugx(quiet, "Scanning NUT bus (old connect method)."); + printq(quiet,"Scanning NUT bus (old connect method).\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "NUT bus (old) SCAN: starting pthread_create with run_nut_old..."); - if (pthread_create(&thread[TYPE_NUT], NULL, run_nut_old, NULL)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if(pthread_create(&thread[TYPE_NUT],NULL,run_nut_old,NULL)) { nutscan_avail_nut = 0; } #else - upsdebugx(1, "NUT bus (old) SCAN: no pthread support, starting nutscan_scan_nut..."); - dev[TYPE_NUT] = nutscan_scan_nut(start_ip, end_ip, port, timeout); + dev[TYPE_NUT] = nutscan_scan_nut(start_ip,end_ip,port,timeout); #endif /* HAVE_PTHREAD */ } - } else { - upsdebugx(1, "NUT bus (old) SCAN: not requested, SKIPPED"); } - if (allow_avahi && nutscan_avail_avahi) { - upsdebugx(quiet, "Scanning NUT bus (avahi method)."); + if( allow_avahi && nutscan_avail_avahi) { + printq(quiet,"Scanning NUT bus (avahi method).\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "NUT bus (avahi) SCAN: starting pthread_create with run_avahi..."); - if (pthread_create(&thread[TYPE_AVAHI], NULL, run_avahi, NULL)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if(pthread_create(&thread[TYPE_AVAHI],NULL,run_avahi,NULL)) { nutscan_avail_avahi = 0; } #else - upsdebugx(1, "NUT bus (avahi) SCAN: no pthread support, starting nutscan_scan_avahi..."); dev[TYPE_AVAHI] = nutscan_scan_avahi(timeout); #endif /* HAVE_PTHREAD */ - } else { - upsdebugx(1, "NUT bus (avahi) SCAN: not requested, SKIPPED"); } - if (allow_ipmi && nutscan_avail_ipmi) { - upsdebugx(quiet, "Scanning IPMI bus."); + if( allow_ipmi && nutscan_avail_ipmi) { + printq(quiet,"Scanning IPMI bus.\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "IPMI SCAN: starting pthread_create with run_ipmi..."); - if (pthread_create(&thread[TYPE_IPMI], NULL, run_ipmi, &ipmi_sec)) { - upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); + if(pthread_create(&thread[TYPE_IPMI],NULL,run_ipmi,&ipmi_sec)) { nutscan_avail_ipmi = 0; } #else - upsdebugx(1, "IPMI SCAN: no pthread support, starting nutscan_scan_ipmi..."); - dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip, end_ip, &ipmi_sec); + dev[TYPE_IPMI] = nutscan_scan_ipmi(start_ip,end_ip,&ipmi_sec); #endif /* HAVE_PTHREAD */ - } else { - upsdebugx(1, "IPMI SCAN: not requested, SKIPPED"); } /* Eaton serial scan */ if (allow_eaton_serial) { - upsdebugx(quiet, "Scanning serial bus for Eaton devices."); + printq(quiet,"Scanning serial bus for Eaton devices.\n"); #ifdef HAVE_PTHREAD - upsdebugx(1, "SERIAL SCAN: starting pthread_create with run_eaton_serial (return not checked!)..."); pthread_create(&thread[TYPE_EATON_SERIAL], NULL, run_eaton_serial, serial_ports); /* FIXME: check return code */ - /* upsdebugx(1, "pthread_create returned an error; disabling this scan mode"); */ - /* nutscan_avail_eaton_serial(?) = 0; */ #else - upsdebugx(1, "SERIAL SCAN: no pthread support, starting nutscan_scan_eaton_serial..."); dev[TYPE_EATON_SERIAL] = nutscan_scan_eaton_serial (serial_ports); #endif /* HAVE_PTHREAD */ - } else { - upsdebugx(1, "SERIAL SCAN: not requested, SKIPPED"); } #ifdef HAVE_PTHREAD - if (allow_usb && nutscan_avail_usb && thread[TYPE_USB]) { - upsdebugx(1, "USB SCAN: join back the pthread"); - pthread_join(thread[TYPE_USB], NULL); + if( allow_usb && nutscan_avail_usb ) { + pthread_join(thread[TYPE_USB],NULL); } - if (allow_snmp && nutscan_avail_snmp && thread[TYPE_SNMP]) { - upsdebugx(1, "SNMP SCAN: join back the pthread"); - pthread_join(thread[TYPE_SNMP], NULL); + if( allow_snmp && nutscan_avail_snmp ) { + pthread_join(thread[TYPE_SNMP],NULL); } - if (allow_xml && nutscan_avail_xml_http && thread[TYPE_XML]) { - upsdebugx(1, "XML/HTTP SCAN: join back the pthread"); - pthread_join(thread[TYPE_XML], NULL); + if( allow_xml && nutscan_avail_xml_http ) { + pthread_join(thread[TYPE_XML],NULL); } - if (allow_oldnut && nutscan_avail_nut && thread[TYPE_NUT]) { - upsdebugx(1, "NUT bus (old) SCAN: join back the pthread"); - pthread_join(thread[TYPE_NUT], NULL); + if( allow_oldnut && nutscan_avail_nut ) { + pthread_join(thread[TYPE_NUT],NULL); } - if (allow_avahi && nutscan_avail_avahi && thread[TYPE_AVAHI]) { - upsdebugx(1, "NUT bus (avahi) SCAN: join back the pthread"); - pthread_join(thread[TYPE_AVAHI], NULL); + if( allow_avahi && nutscan_avail_avahi ) { + pthread_join(thread[TYPE_AVAHI],NULL); } - if (allow_ipmi && nutscan_avail_ipmi && thread[TYPE_IPMI]) { - upsdebugx(1, "IPMI SCAN: join back the pthread"); - pthread_join(thread[TYPE_IPMI], NULL); + if( allow_ipmi && nutscan_avail_ipmi ) { + pthread_join(thread[TYPE_IPMI],NULL); } - if (allow_eaton_serial && thread[TYPE_EATON_SERIAL]) { - upsdebugx(1, "SERIAL SCAN: join back the pthread"); - pthread_join(thread[TYPE_EATON_SERIAL], NULL); + if (allow_eaton_serial) { + pthread_join(thread[TYPE_EATON_SERIAL],NULL); } #endif /* HAVE_PTHREAD */ - upsdebugx(1, "SCANS DONE: display results"); - - upsdebugx(1, "SCANS DONE: display results: USB"); display_func(dev[TYPE_USB]); - upsdebugx(1, "SCANS DONE: free resources: USB"); nutscan_free_device(dev[TYPE_USB]); - upsdebugx(1, "SCANS DONE: display results: SNMP"); display_func(dev[TYPE_SNMP]); - upsdebugx(1, "SCANS DONE: free resources: SNMP"); nutscan_free_device(dev[TYPE_SNMP]); - upsdebugx(1, "SCANS DONE: display results: XML/HTTP"); display_func(dev[TYPE_XML]); - upsdebugx(1, "SCANS DONE: free resources: XML/HTTP"); nutscan_free_device(dev[TYPE_XML]); - upsdebugx(1, "SCANS DONE: display results: NUT bus (old)"); display_func(dev[TYPE_NUT]); - upsdebugx(1, "SCANS DONE: free resources: NUT bus (old)"); nutscan_free_device(dev[TYPE_NUT]); - upsdebugx(1, "SCANS DONE: display results: NUT bus (avahi)"); display_func(dev[TYPE_AVAHI]); - upsdebugx(1, "SCANS DONE: free resources: NUT bus (avahi)"); nutscan_free_device(dev[TYPE_AVAHI]); - upsdebugx(1, "SCANS DONE: display results: IPMI"); display_func(dev[TYPE_IPMI]); - upsdebugx(1, "SCANS DONE: free resources: IPMI"); nutscan_free_device(dev[TYPE_IPMI]); - upsdebugx(1, "SCANS DONE: display results: SERIAL"); display_func(dev[TYPE_EATON_SERIAL]); - upsdebugx(1, "SCANS DONE: free resources: SERIAL"); nutscan_free_device(dev[TYPE_EATON_SERIAL]); -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - sem_destroy(nutscan_semaphore()); -# endif -#endif - - upsdebugx(1, "SCANS DONE: free common scanner resources"); nutscan_free(); - upsdebugx(1, "SCANS DONE: EXIT_SUCCESS"); return EXIT_SUCCESS; } diff --git a/tools/nut-scanner/nutscan-device.c b/tools/nut-scanner/nutscan-device.c index bde57fe..c1b3268 100644 --- a/tools/nut-scanner/nutscan-device.c +++ b/tools/nut-scanner/nutscan-device.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* device.c: manipulation of a container describing a NUT device + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,13 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file nutscan-device.c - \brief manipulation of a container describing a NUT device - \author Frederic Bohe -*/ -#include "config.h" /* must be the first header */ - #include "nutscan-device.h" #include #include @@ -35,18 +29,18 @@ const char * nutscan_device_type_strings[TYPE_END - 1] = { "IPMI", "Avahi", "serial", -}; + }; nutscan_device_t * nutscan_new_device() { nutscan_device_t * device; device = malloc(sizeof(nutscan_device_t)); - if (device == NULL) { + if( device==NULL) { return NULL; } - memset(device, 0, sizeof(nutscan_device_t)); + memset(device,0,sizeof(nutscan_device_t)); return device; } @@ -55,13 +49,13 @@ static void deep_free_device(nutscan_device_t * device) { nutscan_options_t * current; - if (device == NULL) { + if(device==NULL) { return; } - if (device->driver) { + if(device->driver) { free(device->driver); } - if (device->port) { + if(device->port) { free(device->port); } @@ -69,21 +63,21 @@ static void deep_free_device(nutscan_device_t * device) current = device->opt; device->opt = current->next; - if (current->option != NULL) { + if(current->option != NULL) { free(current->option); } - if (current->value != NULL) { + if(current->value != NULL) { free(current->value); } free(current); - } + }; - if (device->prev) { + if(device->prev) { device->prev->next = device->next; } - if (device->next) { + if(device->next) { device->next->prev = device->prev; } @@ -92,13 +86,13 @@ static void deep_free_device(nutscan_device_t * device) void nutscan_free_device(nutscan_device_t * device) { - if (device == NULL) { + if(device==NULL) { return; } - while (device->prev != NULL) { + while(device->prev != NULL) { deep_free_device(device->prev); } - while (device->next != NULL) { + while(device->next != NULL) { deep_free_device(device->next); } @@ -117,19 +111,19 @@ void nutscan_add_option_to_device(nutscan_device_t * device, char * option, char *opt = (nutscan_options_t *)malloc(sizeof(nutscan_options_t)); - /* TBD: A gracefull way to propagate memory failure would be nice */ + // TBD: A gracefull way to propagate memory failure would be nice assert(NULL != *opt); memset(*opt, 0, sizeof(nutscan_options_t)); - if (option != NULL) { + if( option != NULL ) { (*opt)->option = strdup(option); } else { (*opt)->option = NULL; } - if (value != NULL) { + if( value != NULL ) { (*opt)->value = strdup(value); } else { @@ -139,40 +133,41 @@ void nutscan_add_option_to_device(nutscan_device_t * device, char * option, char nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutscan_device_t * second) { - nutscan_device_t * dev1 = NULL; - nutscan_device_t * dev2 = NULL; + nutscan_device_t * dev1=NULL; + nutscan_device_t * dev2=NULL; /* Get end of first device */ - if (first != NULL) { + if( first != NULL) { dev1 = first; - while (dev1->next != NULL) { + while(dev1->next != NULL) { dev1 = dev1->next; } } else { - if (second == NULL) { + if( second == NULL ) { return NULL; } /* return end of second */ dev2 = second; - while (dev2->next != NULL) { + while(dev2->next != NULL) { dev2 = dev2->next; } return dev2; } /* Get start of second */ - if (second != NULL) { + if( second != NULL ) { dev2 = second; - while (dev2->prev != NULL) { + while(dev2->prev != NULL) { dev2 = dev2->prev; } } else { /* return end of first */ dev1 = first; - while (dev1->next != NULL) { + while(dev1->next != NULL) { dev1 = dev1->next; + } return dev1; } @@ -182,8 +177,8 @@ nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutsca dev2->prev = dev1; /* return end of both */ - while (dev2->next != NULL) { - dev2 = dev2->next; + while(dev2->next != NULL) { + dev2 = dev2->next; } return dev2; diff --git a/tools/nut-scanner/nutscan-device.h b/tools/nut-scanner/nutscan-device.h index 9023394..8960410 100644 --- a/tools/nut-scanner/nutscan-device.h +++ b/tools/nut-scanner/nutscan-device.h @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* device.h: definition of a container describing a NUT device + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file nutscan-device.h - \brief definition of a container describing a NUT discovered device - \author Frederic Bohe -*/ - #ifndef SCAN_DEVICE #define SCAN_DEVICE @@ -41,7 +36,7 @@ extern "C" { (assert(0 < (type) && (type) < TYPE_END), nutscan_device_type_strings[type - 1]) typedef enum nutscan_device_type { - TYPE_NONE = 0, + TYPE_NONE=0, TYPE_USB, TYPE_SNMP, TYPE_XML, @@ -70,9 +65,9 @@ typedef struct nutscan_device { struct nutscan_device * next; } nutscan_device_t; -nutscan_device_t * nutscan_new_device(void); +nutscan_device_t * nutscan_new_device(); void nutscan_free_device(nutscan_device_t * device); -void nutscan_add_option_to_device(nutscan_device_t * device, char * option, char * value); +void nutscan_add_option_to_device(nutscan_device_t * device,char * option, char * value); nutscan_device_t * nutscan_add_device_to_device(nutscan_device_t * first, nutscan_device_t * second); /** diff --git a/tools/nut-scanner/nutscan-display.c b/tools/nut-scanner/nutscan-display.c index 71f2248..411ed25 100644 --- a/tools/nut-scanner/nutscan-display.c +++ b/tools/nut-scanner/nutscan-display.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* display.c: format and display scanned devices + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,26 +17,19 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nutscan-display.c - \brief format and display scanned devices - \author Frederic Bohe -*/ - #include "common.h" #include #include "nutscan-device.h" -#include "nut-scan.h" -static char * nutscan_device_type_string[TYPE_END] = { - "NONE", - "USB", - "SNMP", - "XML", - "NUT", - "IPMI", - "AVAHI", - "EATON_SERIAL" -}; +char * nutscan_device_type_string[TYPE_END]= { + "NONE", + "USB", + "SNMP", + "XML", + "NUT", + "IPMI", + "AVAHI", + "EATON_SERIAL" }; void nutscan_display_ups_conf(nutscan_device_t * device) { @@ -43,16 +37,16 @@ void nutscan_display_ups_conf(nutscan_device_t * device) nutscan_options_t * opt; static int nutdev_num = 1; - if (device == NULL) { + if(device==NULL) { return; } /* Find start of the list */ - while (current_dev->prev != NULL) { + while(current_dev->prev != NULL) { current_dev = current_dev->prev; } - /* Display each device */ + /* Display each devices */ do { printf("[nutdev%i]\n\tdriver = \"%s\"\n\tport = \"%s\"\n", nutdev_num, current_dev->driver, @@ -61,9 +55,9 @@ void nutscan_display_ups_conf(nutscan_device_t * device) opt = current_dev->opt; while (NULL != opt) { - if (opt->option != NULL) { - printf("\t%s", opt->option); - if (opt->value != NULL) { + if( opt->option != NULL ) { + printf("\t%s",opt->option); + if( opt->value != NULL ) { printf(" = \"%s\"", opt->value); } printf("\n"); @@ -75,7 +69,7 @@ void nutscan_display_ups_conf(nutscan_device_t * device) current_dev = current_dev->next; } - while (current_dev != NULL); + while( current_dev != NULL ); } void nutscan_display_parsable(nutscan_device_t * device) @@ -83,18 +77,17 @@ void nutscan_display_parsable(nutscan_device_t * device) nutscan_device_t * current_dev = device; nutscan_options_t * opt; - if (device == NULL) { + if(device==NULL) { return; } /* Find start of the list */ - while (current_dev->prev != NULL) { + while(current_dev->prev != NULL) { current_dev = current_dev->prev; } - /* Display each device */ + /* Display each devices */ do { - /* Do not separate by whitespace, in case someone already parses this */ printf("%s:driver=\"%s\",port=\"%s\"", nutscan_device_type_string[current_dev->type], current_dev->driver, @@ -103,10 +96,9 @@ void nutscan_display_parsable(nutscan_device_t * device) opt = current_dev->opt; while (NULL != opt) { - if (opt->option != NULL) { - /* Do not separate by whitespace, in case someone already parses this */ - printf(",%s", opt->option); - if (opt->value != NULL) { + if( opt->option != NULL ) { + printf(",%s",opt->option); + if( opt->value != NULL ) { printf("=\"%s\"", opt->value); } } @@ -117,5 +109,6 @@ void nutscan_display_parsable(nutscan_device_t * device) current_dev = current_dev->next; } - while (current_dev != NULL); + while( current_dev != NULL ); } + diff --git a/tools/nut-scanner/nutscan-init.c b/tools/nut-scanner/nutscan-init.c index 9ea3f5d..16ea760 100644 --- a/tools/nut-scanner/nutscan-init.c +++ b/tools/nut-scanner/nutscan-init.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011-2021 - EATON +/* nutscan-init.c: init functions for nut scanner library + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,19 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nutscan-init.c - \brief init functions for nut scanner library - \author Frederic Bohe - \author Arnaud Quette -*/ - #include "common.h" -#include "nutscan-init.h" #include -#include -#include -#include -#include "nut-scan.h" int nutscan_avail_avahi = 0; int nutscan_avail_ipmi = 0; @@ -37,183 +27,51 @@ int nutscan_avail_snmp = 0; int nutscan_avail_usb = 0; int nutscan_avail_xml_http = 0; -int nutscan_load_usb_library(const char *libname_path); -int nutscan_load_snmp_library(const char *libname_path); -int nutscan_load_neon_library(const char *libname_path); -int nutscan_load_avahi_library(const char *libname_path); -int nutscan_load_ipmi_library(const char *libname_path); -int nutscan_load_upsclient_library(const char *libname_path); - -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE -/* Shared by library consumers, exposed by nutscan_semaphore() below */ -static sem_t semaphore; - -sem_t * nutscan_semaphore(void) -{ - return &semaphore; -} -# endif /* HAVE_SEMAPHORE */ - -# ifdef HAVE_PTHREAD_TRYJOIN -pthread_mutex_t threadcount_mutex; -# endif - -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) -/* We have 3 networked scan types: nut, snmp, xml, - * and users typically give their /24 subnet as "-m" arg. - * With some systems having a 1024 default (u)limit to - * file descriptors, this should fit if those are involved. - * On some systems tested, a large amount of not-joined - * pthreads did cause various crashes; also RAM is limited. - * Note that each scan may be time consuming to query an - * IP address and wait for (no) reply, so while these threads - * are usually not resource-intensive (nor computationally), - * they spend much wallclock time each so parallelism helps. - */ -size_t max_threads = DEFAULT_THREAD; -size_t curr_threads = 0; - -size_t max_threads_netxml = 1021; /* experimental finding, see PR#1158 */ -size_t max_threads_oldnut = 1021; -size_t max_threads_netsnmp = 0; /* 10240; */ - /* per reports in PR#1158, some versions of net-snmp could be limited - * to 1024 threads in the past; this was not found in practice. - * Still, some practical limit can be useful (configurable?) - * Here 0 means to not apply any special limit (beside max_threads). - */ - -# endif /* HAVE_PTHREAD_TRYJOIN || HAVE_SEMAPHORE */ - -#endif /* HAVE_PTHREAD */ +int nutscan_load_usb_library(void); +int nutscan_load_snmp_library(void); +int nutscan_load_neon_library(void); +int nutscan_load_avahi_library(void); +int nutscan_load_ipmi_library(void); +int nutscan_load_upsclient_library(void); void nutscan_init(void) { -#ifdef HAVE_PTHREAD -/* TOTHINK: Should semaphores to limit thread count - * and the more naive but portable methods be an - * if-else proposition? At least when initializing? - */ -# ifdef HAVE_SEMAPHORE - /* NOTE: This semaphore may get re-initialized in nut-scanner program - * after parsing command-line arguments. It calls nutscan_init() before - * parsing CLI, to know about available libs and to set defaults below. - */ -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Different platforms, different sizes, none fits all... */ - if (SIZE_MAX > UINT_MAX && max_threads > UINT_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - upsdebugx(1, - "WARNING: %s: Limiting max_threads to range acceptable for sem_init()", - __func__); - max_threads = UINT_MAX - 1; - } - sem_init(&semaphore, 0, (unsigned int)max_threads); -# endif - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_init(&threadcount_mutex, NULL); -# endif -#endif /* HAVE_PTHREAD */ - - char *libname = NULL; #ifdef WITH_USB - #if WITH_LIBUSB_1_0 - libname = get_libname("libusb-1.0.so"); - #else - libname = get_libname("libusb-0.1.so"); - if (!libname) { - /* We can also use libusb-compat from newer libusb-1.0 releases */ - libname = get_libname("libusb.so"); - } - #endif - if (libname) { - nutscan_avail_usb = nutscan_load_usb_library(libname); - free(libname); - } + nutscan_avail_usb = nutscan_load_usb_library(); #endif #ifdef WITH_SNMP - libname = get_libname("libnetsnmp.so"); - if (libname) { - nutscan_avail_snmp = nutscan_load_snmp_library(libname); - free(libname); - } + nutscan_avail_snmp = nutscan_load_snmp_library(); #endif #ifdef WITH_NEON - libname = get_libname("libneon.so"); - if (!libname) { - libname = get_libname("libneon-gnutls.so"); - } - if (libname) { - nutscan_avail_xml_http = nutscan_load_neon_library(libname); - free(libname); - } + nutscan_avail_xml_http = nutscan_load_neon_library(); #endif #ifdef WITH_AVAHI - libname = get_libname("libavahi-client.so"); - if (libname) { - nutscan_avail_avahi = nutscan_load_avahi_library(libname); - free(libname); - } + nutscan_avail_avahi = nutscan_load_avahi_library(); #endif #ifdef WITH_FREEIPMI - libname = get_libname("libfreeipmi.so"); - if (libname) { - nutscan_avail_ipmi = nutscan_load_ipmi_library(libname); - free(libname); - } + nutscan_avail_ipmi = nutscan_load_ipmi_library(); #endif - libname = get_libname("libupsclient.so"); - if (libname) { - nutscan_avail_nut = nutscan_load_upsclient_library(libname); - free(libname); - } + nutscan_avail_nut = nutscan_load_upsclient_library(); } void nutscan_free(void) { - if (nutscan_avail_usb) { + if( nutscan_avail_usb ) { lt_dlexit(); } - if (nutscan_avail_snmp) { + if( nutscan_avail_snmp ) { lt_dlexit(); } - if (nutscan_avail_xml_http) { + if( nutscan_avail_xml_http ) { lt_dlexit(); } - if (nutscan_avail_avahi) { + if( nutscan_avail_avahi ) { lt_dlexit(); } - if (nutscan_avail_ipmi) { + if( nutscan_avail_ipmi ) { lt_dlexit(); } - if (nutscan_avail_nut) { + if( nutscan_avail_nut ) { lt_dlexit(); } - -#ifdef HAVE_PTHREAD -/* TOTHINK: See comments near mutex/semaphore init code above */ -# ifdef HAVE_SEMAPHORE - sem_destroy(nutscan_semaphore()); -# endif - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_destroy(&threadcount_mutex); -# endif -#endif - } diff --git a/tools/nut-scanner/nutscan-init.h b/tools/nut-scanner/nutscan-init.h index 4ff5f39..daf1358 100644 --- a/tools/nut-scanner/nutscan-init.h +++ b/tools/nut-scanner/nutscan-init.h @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* nutscan-init.h: initialisation data + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file nutscan-init.h - \brief initialisation data - \author Frederic Bohe -*/ - #ifndef SCAN_INIT #define SCAN_INIT @@ -40,8 +35,6 @@ extern int nutscan_avail_xml_http; void nutscan_init(void); void nutscan_free(void); -#define DEFAULT_THREAD 512 - #ifdef __cplusplus /* *INDENT-OFF* */ } diff --git a/tools/nut-scanner/nutscan-ip.c b/tools/nut-scanner/nutscan-ip.c index f064534..8788018 100644 --- a/tools/nut-scanner/nutscan-ip.c +++ b/tools/nut-scanner/nutscan-ip.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* ip.c: iterator for IPv4 or IPv6 addresses + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,13 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nutscan-ip.c - \brief iterator for IPv4 or IPv6 addresses - \author Frederic Bohe -*/ - -#include "config.h" /* must be first */ - #include "nutscan-ip.h" #include #include "common.h" @@ -34,9 +28,9 @@ static void increment_IPv6(struct in6_addr * addr) { int i; - for (i = 15 ; i >= 0 ; i--) { + for( i=15 ; i>= 0 ; i--) { addr->s6_addr[i]++; - if (addr->s6_addr[i] != 0) { + if( addr->s6_addr[i] != 0) { break; } } @@ -46,39 +40,37 @@ static void invert_IPv6(struct in6_addr * addr1, struct in6_addr * addr2) { struct in6_addr addr; - memcpy(addr.s6_addr, addr1->s6_addr, sizeof(addr.s6_addr)); - memcpy(addr1->s6_addr, addr2->s6_addr, sizeof(addr.s6_addr)); - memcpy(addr2->s6_addr, addr.s6_addr, sizeof(addr.s6_addr)); + memcpy(addr.s6_addr,addr1->s6_addr,sizeof(addr.s6_addr)); + memcpy(addr1->s6_addr,addr2->s6_addr,sizeof(addr.s6_addr)); + memcpy(addr2->s6_addr,addr.s6_addr,sizeof(addr.s6_addr)); } -static int ntop(struct in_addr * ip, char * host, GETNAMEINFO_TYPE_ARG46 host_size) +static int ntop( struct in_addr * ip, char * host, size_t host_size) { struct sockaddr_in in; - memset(&in, 0, sizeof(struct sockaddr_in)); + memset(&in,0,sizeof(struct sockaddr_in)); in.sin_addr = *ip; in.sin_family = AF_INET; - return getnameinfo( - (struct sockaddr *)&in, - sizeof(struct sockaddr_in), - host, host_size, NULL, 0, NI_NUMERICHOST); + return getnameinfo((struct sockaddr *)&in, + sizeof(struct sockaddr_in), + host,host_size,NULL,0,NI_NUMERICHOST); } -static int ntop6(struct in6_addr * ip, char * host, GETNAMEINFO_TYPE_ARG46 host_size) +static int ntop6( struct in6_addr * ip, char * host, size_t host_size) { struct sockaddr_in6 in6; - memset(&in6, 0, sizeof(struct sockaddr_in6)); - memcpy(&in6.sin6_addr, ip, sizeof(struct in6_addr)); + memset(&in6,0,sizeof(struct sockaddr_in6)); + memcpy( &in6.sin6_addr, ip, sizeof(struct in6_addr) ); in6.sin6_family = AF_INET6; - return getnameinfo( - (struct sockaddr *)&in6, - sizeof(struct sockaddr_in6), - host, host_size, NULL, 0, NI_NUMERICHOST); + return getnameinfo((struct sockaddr *)&in6, + sizeof(struct sockaddr_in6), + host,host_size,NULL,0,NI_NUMERICHOST); } /* Return the first ip or NULL if error */ char * nutscan_ip_iter_init(nutscan_ip_iter_t * ip, const char * startIP, const char * stopIP) { - uint32_t addr; /* 32-bit IPv4 address */ + int addr; int i; struct addrinfo hints; struct addrinfo *res; @@ -86,127 +78,92 @@ char * nutscan_ip_iter_init(nutscan_ip_iter_t * ip, const char * startIP, const struct sockaddr_in6 * s_in6; char host[SMALLBUF]; - if (startIP == NULL) { + if( startIP == NULL ) { return NULL; } - if (stopIP == NULL) { + if(stopIP == NULL ) { stopIP = startIP; } - memset(&hints, 0, sizeof(struct addrinfo)); + memset(&hints,0,sizeof(struct addrinfo)); hints.ai_family = AF_INET; ip->type = IPv4; /* Detecting IPv4 vs IPv6 */ - if (getaddrinfo(startIP, NULL, &hints, &res) != 0) { + if(getaddrinfo(startIP,NULL,&hints,&res) != 0) { /*Try IPv6 detection */ ip->type = IPv6; hints.ai_family = AF_INET6; - if (getaddrinfo(startIP, NULL, &hints, &res) != 0) { - fprintf(stderr, "Invalid address : %s\n", startIP); + if(getaddrinfo(startIP,NULL,&hints,&res) != 0) { + fprintf(stderr,"Invalid address : %s\n",startIP); return NULL; } - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ + s_in6 = (struct sockaddr_in6 *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - memcpy(&ip->start6, &s_in6->sin6_addr, sizeof(struct in6_addr)); + memcpy(&ip->start6,&s_in6->sin6_addr,sizeof(struct in6_addr)); freeaddrinfo(res); } else { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ s_in = (struct sockaddr_in *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif ip->start = s_in->sin_addr; freeaddrinfo(res); } /* Compute stop IP */ - if (ip->type == IPv4) { + if( ip->type == IPv4 ) { hints.ai_family = AF_INET; - if (getaddrinfo(stopIP, NULL, &hints, &res) != 0) { - fprintf(stderr, "Invalid address : %s\n", stopIP); - return NULL; - } + if(getaddrinfo(stopIP,NULL,&hints,&res) != 0) { + fprintf(stderr,"Invalid address : %s\n",stopIP); + return NULL; + } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ s_in = (struct sockaddr_in *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif ip->stop = s_in->sin_addr; freeaddrinfo(res); - } - else { + } + else { hints.ai_family = AF_INET6; - if (getaddrinfo(stopIP, NULL, &hints, &res) != 0) { - fprintf(stderr, "Invalid address : %s\n", stopIP); - return NULL; - } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ + if(getaddrinfo(stopIP,NULL,&hints,&res) != 0) { + fprintf(stderr,"Invalid address : %s\n",stopIP); + return NULL; + } s_in6 = (struct sockaddr_in6 *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - memcpy(&ip->stop6, &s_in6->sin6_addr, sizeof(struct in6_addr)); + memcpy(&ip->stop6,&s_in6->sin6_addr,sizeof(struct in6_addr)); freeaddrinfo(res); - } + } - /* Make sure start IP is lesser than stop IP */ - if (ip->type == IPv4) { - if (ntohl(ip->start.s_addr) > ntohl(ip->stop.s_addr)) { - addr = ip->start.s_addr; - ip->start.s_addr = ip->stop.s_addr; - ip->stop.s_addr = addr; - } + /* Make sure start IP is lesser than stop IP */ + if( ip->type == IPv4 ) { + if( ntohl(ip->start.s_addr) > ntohl(ip->stop.s_addr) ) { + addr = ip->start.s_addr; + ip->start.s_addr = ip->stop.s_addr; + ip->stop.s_addr = addr; + } - if (ntop(&ip->start, host, sizeof(host)) != 0) { + if( ntop(&ip->start, host, sizeof(host)) != 0 ) { return NULL; } return strdup(host); - } - else { /* IPv6 */ - for (i = 0; i < 16; i++) { - if (ip->start6.s6_addr[i] !=ip->stop6.s6_addr[i]) { - if (ip->start6.s6_addr[i] > ip->stop6.s6_addr[i]) { - invert_IPv6(&ip->start6, &ip->stop6); - } - break; - } - } + } + else { /* IPv6 */ + for( i=0; i<16; i++ ) { + if( ip->start6.s6_addr[i] !=ip->stop6.s6_addr[i] ) { + if(ip->start6.s6_addr[i]>ip->stop6.s6_addr[i]){ + invert_IPv6(&ip->start6,&ip->stop6); + } + break; + } + } - if (ntop6(&ip->start6, host, sizeof(host)) != 0) { + if( ntop6(&ip->start6, host, sizeof(host)) != 0 ) { return NULL; } return strdup(host); - } + } + } @@ -217,30 +174,30 @@ char * nutscan_ip_iter_inc(nutscan_ip_iter_t * ip) { char host[SMALLBUF]; - if (ip->type == IPv4) { + if( ip->type == IPv4 ) { /* Check if this is the last address to scan */ - if (ip->start.s_addr == ip->stop.s_addr) { + if(ip->start.s_addr == ip->stop.s_addr) { return NULL; } /* increment the address (need to pass address in host byte order, then pass back in network byte order */ - ip->start.s_addr = htonl((ntohl(ip->start.s_addr) + 1)); + ip->start.s_addr = htonl((ntohl(ip->start.s_addr)+1)); - if (ntop(&ip->start, host, sizeof(host)) != 0) { + if( ntop(&ip->start, host, sizeof(host)) != 0 ) { return NULL; } - + return strdup(host); } else { /* Check if this is the last address to scan */ - if (memcmp(&ip->start6.s6_addr, &ip->stop6.s6_addr, - sizeof(ip->start6.s6_addr)) == 0) { + if( memcmp(&ip->start6.s6_addr, &ip->stop6.s6_addr, + sizeof(ip->start6.s6_addr)) == 0 ) { return NULL; } increment_IPv6(&ip->start6); - if (ntop6(&ip->start6, host, sizeof(host)) != 0) { + if( ntop6(&ip->start6, host, sizeof(host)) != 0 ) { return NULL; } @@ -257,7 +214,7 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip) nutscan_ip_iter_t ip; int mask_val; int mask_byte; - uint32_t mask_bit; /* 32-bit IPv4 address bitmask */ + unsigned long mask_bit; char host[SMALLBUF]; struct addrinfo hints; struct addrinfo *res; @@ -268,87 +225,47 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip) *stop_ip = NULL; cidr_tok = strdup(cidr); - first_ip = strdup(strtok_r(cidr_tok, "/", &saveptr)); - if (first_ip == NULL) { - upsdebugx(0, "WARNING: %s failed to parse first_ip from cidr=%s", - __func__, cidr); - free(cidr_tok); + first_ip = strdup(strtok_r(cidr_tok,"/",&saveptr)); + if( first_ip == NULL) { return 0; } - mask = strtok_r(NULL, "/", &saveptr); - if (mask == NULL) { - upsdebugx(0, "WARNING: %s failed to parse mask from cidr=%s (first_ip=%s)", - __func__, cidr, first_ip); - free (first_ip); - free(cidr_tok); + mask = strtok_r(NULL,"/",&saveptr); + if( mask == NULL ) { return 0; } - upsdebugx(5, "%s: parsed cidr=%s into first_ip=%s and mask=%s", - __func__, cidr, first_ip, mask); - - mask_val = atoi(mask); - upsdebugx(5, "%s: parsed mask value %d", - __func__, mask_val); - - /* NOTE: Sanity-wise, some larger number also makes sense - * as the maximum subnet size we would scan. But at least, - * this helps avoid scanning the whole Internet just due - * to string-parsing errors. - */ - if (mask_val < 1) { - fatalx(EXIT_FAILURE, "Bad netmask: %s", mask); - } - - /* Note: this freeing invalidates "mask" and "saveptr" pointer targets */ free(cidr_tok); - /* Detecting IPv4 vs IPv6 */ - memset(&hints, 0, sizeof(struct addrinfo)); + mask_val = atoi(mask); + + /* Detecting IPv4 vs IPv6 */ + memset(&hints,0,sizeof(struct addrinfo)); hints.ai_family = AF_INET; ip.type = IPv4; /* Detecting IPv4 vs IPv6 */ - if (getaddrinfo(first_ip, NULL, &hints, &res) != 0) { + if(getaddrinfo(first_ip,NULL,&hints,&res) != 0) { /*Try IPv6 detection */ ip.type = IPv6; hints.ai_family = AF_INET6; int ret; - if ((ret = getaddrinfo(first_ip, NULL, &hints, &res)) != 0) { + if((ret=getaddrinfo(first_ip,NULL,&hints,&res)) != 0) { free(first_ip); return 0; } - -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ + s_in6 = (struct sockaddr_in6 *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - memcpy(&ip.start6, &s_in6->sin6_addr, sizeof(struct in6_addr)); + memcpy(&ip.start6,&s_in6->sin6_addr,sizeof(struct in6_addr)); freeaddrinfo(res); } else { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ s_in = (struct sockaddr_in *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif ip.start = s_in->sin_addr; freeaddrinfo(res); } - if (ip.type == IPv4) { + if( ip.type == IPv4 ) { - if (mask_val > 0) { + if( mask_val > 0 ) { mask_val --; mask_bit = 0x80000000; mask_bit >>= mask_val; @@ -360,14 +277,14 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip) ip.stop.s_addr = htonl(ntohl(ip.start.s_addr)|mask_bit); ip.start.s_addr = htonl(ntohl(ip.start.s_addr)&(~mask_bit)); - if (ntop(&ip.start, host, sizeof(host)) != 0) { + if( ntop(&ip.start, host, sizeof(host)) != 0 ) { *start_ip = NULL; *stop_ip = NULL; return 0; } *start_ip = strdup(host); - if (ntop(&ip.stop, host, sizeof(host)) != 0) { + if( ntop(&ip.stop, host, sizeof(host)) != 0 ) { free(*start_ip); *start_ip = NULL; *stop_ip = NULL; @@ -379,40 +296,31 @@ int nutscan_cidr_to_ip(const char * cidr, char ** start_ip, char ** stop_ip) return 1; } else { - if (getaddrinfo(first_ip, NULL, &hints, &res) != 0) { + if(getaddrinfo(first_ip,NULL,&hints,&res) != 0) { return 0; } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wcast-align" -#endif - /* Note: we receive a pointer to res above, so have - * no control about alignment of its further data */ s_in6 = (struct sockaddr_in6 *)res->ai_addr; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_CAST_ALIGN) -# pragma GCC diagnostic pop -#endif - memcpy(&ip.stop6, &s_in6->sin6_addr, sizeof(struct in6_addr)); + memcpy(&ip.stop6,&s_in6->sin6_addr,sizeof(struct in6_addr)); freeaddrinfo(res); mask_byte = mask_val / 8; - if (mask_byte < 16 && mask_byte >= 0) { - memset(&(ip.stop6.s6_addr[mask_byte + 1]), 0xFF, 15 - (uint8_t)mask_byte); - memset(&(ip.start6.s6_addr[mask_byte + 1]), 0x00, 15 - (uint8_t)mask_byte); + if( mask_byte < 16 ) { + memset( &(ip.stop6.s6_addr[mask_byte+1]), 0xFF, 15 - mask_byte); + memset( &(ip.start6.s6_addr[mask_byte+1]), 0x00, 15 - mask_byte); - mask_bit = (0x100 >> mask_val%8) - 1; + mask_bit = (0x100 >> mask_val%8)-1; ip.stop6.s6_addr[mask_byte] |= mask_bit; ip.start6.s6_addr[mask_byte] &= (~mask_bit); } - if (ntop6(&ip.start6, host, sizeof(host)) != 0) { + if( ntop6(&ip.start6, host, sizeof(host)) != 0 ) { *start_ip = NULL; *stop_ip = NULL; return 0; } *start_ip = strdup(host); - if (ntop6(&ip.stop6, host, sizeof(host)) != 0) { + if( ntop6(&ip.stop6, host, sizeof(host)) != 0 ) { free(*start_ip); *start_ip = NULL; *stop_ip = NULL; diff --git a/tools/nut-scanner/nutscan-ip.h b/tools/nut-scanner/nutscan-ip.h index 6fa868d..b28ff00 100644 --- a/tools/nut-scanner/nutscan-ip.h +++ b/tools/nut-scanner/nutscan-ip.h @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* ip.h: iterator for IPv4 or IPv6 addresses + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file nutscan-ip.h - \brief iterator for IPv4 or IPv6 addresses - \author Frederic Bohe -*/ - #ifndef SCAN_IP #define SCAN_IP @@ -34,16 +29,16 @@ extern "C" { #endif enum network_type { - IPv4, - IPv6 + IPv4, + IPv6 }; typedef struct nutscan_ip_iter { enum network_type type; - struct in_addr start; - struct in_addr stop; - struct in6_addr start6; - struct in6_addr stop6; + struct in_addr start; + struct in_addr stop; + struct in6_addr start6; + struct in6_addr stop6; } nutscan_ip_iter_t; char * nutscan_ip_iter_init(nutscan_ip_iter_t *, const char * startIP, const char * stopIP); diff --git a/tools/nut-scanner/nutscan-serial.c b/tools/nut-scanner/nutscan-serial.c index bf4ac29..65e0c03 100644 --- a/tools/nut-scanner/nutscan-serial.c +++ b/tools/nut-scanner/nutscan-serial.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* nutscan-serial.c: helper functions to get serial devices name + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,20 +17,11 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file nutscan-serial.c - \brief helper functions to get serial devices name - \author Frederic Bohe - \author Arnaud Quette -*/ - -#include "config.h" /* must be the first header */ - #include "nutscan-serial.h" #include #include #include #include "nut_platform.h" -#include "common.h" #ifdef WIN32 /* Windows: all serial port names start with "COM" */ @@ -47,7 +39,7 @@ typedef struct { char auto_stop_port; } device_portname_t; -static device_portname_t device_portname[] = { +device_portname_t device_portname[] = { #ifdef NUT_PLATFORM_HPUX /* the first number seems to be a card instance, the second number seems to be a port number */ @@ -73,7 +65,7 @@ static device_portname_t device_portname[] = { /* { "/dev/ttyd%i", "=" }, */ /* { "/dev/ttyf%i", "=" }, */ /* FIXME: Mac OS X has no serial port, but maybe ttyUSB? */ - { NULL, 0, 0 } + { NULL, 0 } }; /* Return 1 if port_name is a full path name to a serial port, @@ -90,26 +82,25 @@ static int is_serial_port_path(const char * port_name) static char ** add_port(char ** list, char * port) { char ** res; - size_t count = 0; + int count = 0; - if (list == NULL) { + if(list == NULL) { count = 0; } else { - while (list[count] != NULL) { + while(list[count] != NULL) { count++; } } /*+1 to get the number of port from the index nb_ports*/ /*+1 for the terminal NULL */ - res = realloc(list, sizeof(char*) * (count + 1 + 1)); - if (res == NULL) { - upsdebugx(1, "%s: Failed to realloc port list", __func__); - return list; + res = realloc(list,(count+1+1)*sizeof(char*)); + if( res == NULL ) { + return NULL; } res[count] = strdup(port); - res[count + 1] = NULL; + res[count+1] = NULL; return res; } @@ -139,19 +130,19 @@ char ** nutscan_get_serial_ports_list(const char *ports_range) /* we have a list: * - single element: X (digit) or port name (COM1, /dev/ttyS0, ...) * - range list: X-Y - * - multiple elements (comma separated): /dev/ttyS0,/dev/ttyUSB0 */ - if ((list_sep_ptr = strchr(range, '-')) != NULL) { - tok = strtok_r(range, "-", &saveptr); - if (tok[1] != 0) { - fprintf(stderr, ERR_OUT_OF_BOUND); + * - multiple elements (coma separated): /dev/ttyS0,/dev/ttyUSB0 */ + if ( (list_sep_ptr = strchr(range, '-')) != NULL ) { + tok = strtok_r(range,"-",&saveptr); + if( tok[1] != 0 ) { + fprintf(stderr,ERR_OUT_OF_BOUND); free(range); return NULL; } start_port = tok[0]; - tok = strtok_r(NULL, "-", &saveptr); - if (tok != NULL) { - if (tok[1] != 0) { - fprintf(stderr, ERR_OUT_OF_BOUND); + tok = strtok_r(NULL,"-",&saveptr); + if( tok != NULL ) { + if( tok[1] != 0 ) { + fprintf(stderr,ERR_OUT_OF_BOUND); free(range); return NULL; } @@ -161,20 +152,19 @@ char ** nutscan_get_serial_ports_list(const char *ports_range) stop_port = start_port; } } - else if (((list_sep_ptr = strchr(ports_range, ',')) != NULL) - && (is_serial_port_path(ports_range)) - ) { - tok = strtok_r(range, ",", &saveptr); - while (tok != NULL) { - ports_list = add_port(ports_list, tok); - tok = strtok_r(NULL, ",", &saveptr); + else if ( ((list_sep_ptr = strchr(ports_range, ',')) != NULL ) + && (is_serial_port_path(ports_range)) ) { + tok = strtok_r(range,",",&saveptr); + while( tok != NULL ) { + ports_list = add_port(ports_list,tok); + tok = strtok_r(NULL,",",&saveptr); } } else { /* we have been provided a single port name */ /* it's a full device name */ - if (ports_range[1] != 0) { - ports_list = add_port(ports_list, range); + if( ports_range[1] != 0 ) { + ports_list = add_port(ports_list,range); } /* it's device number */ else { @@ -184,35 +174,21 @@ char ** nutscan_get_serial_ports_list(const char *ports_range) free(range); } - if (start_port == 0 && !flag_auto) { + + if( start_port == 0 && !flag_auto) { return ports_list; } - for (cur_device = device_portname; cur_device->name != NULL; cur_device++) { - if (flag_auto) { + for (cur_device=device_portname;cur_device->name!= NULL;cur_device++) { + if( flag_auto ) { start_port = cur_device->auto_start_port; stop_port = cur_device->auto_stop_port; } - for (current_port = start_port; current_port <= stop_port; - current_port++) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic ignored "-Wformat-nonliteral" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_FORMAT_SECURITY -#pragma GCC diagnostic ignored "-Wformat-security" -#endif - /* We actually have a format string in the name, - * see the device_portname[] definition above */ - snprintf(str_tmp, sizeof(str_tmp), cur_device->name, + for( current_port=start_port; current_port <= stop_port; + current_port++){ + snprintf(str_tmp, sizeof(str_tmp),cur_device->name, current_port); -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_FORMAT_NONLITERAL -#pragma GCC diagnostic pop -#endif - - ports_list = add_port(ports_list, str_tmp); + ports_list = add_port(ports_list,str_tmp); } } return ports_list; diff --git a/tools/nut-scanner/nutscan-serial.h b/tools/nut-scanner/nutscan-serial.h index 2471247..175b1d7 100644 --- a/tools/nut-scanner/nutscan-serial.h +++ b/tools/nut-scanner/nutscan-serial.h @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* nutscan-serial.h: helper functions to get serial devices name + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file nutscan-serial.h - \brief helper functions to get serial devices name - \author Frederic Bohe -*/ - #ifndef SCAN_SERIAL #define SCAN_SERIAL diff --git a/tools/nut-scanner/nutscan-snmp.h b/tools/nut-scanner/nutscan-snmp.h index 660994b..886916a 100644 --- a/tools/nut-scanner/nutscan-snmp.h +++ b/tools/nut-scanner/nutscan-snmp.h @@ -1,7 +1,5 @@ -/* nutscan-snmp.h - fully generated during build of NUT - * Copyright (C) 2011-2019 EATON - * Authors: Frederic Bohe - * Arnaud Quette +/* nutscan-snmp + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,44 +20,31 @@ #define DEVSCAN_SNMP_H typedef struct { - char * oid; - char * mib; - char * sysoid; + char * oid; + char * mib; + char * sysoid; } snmp_device_id_t; /* SNMP IDs device table */ static snmp_device_id_t snmp_device_table[] = { - { ".1.3.6.1.4.1.318.1.1.8.1.5.0", "apc_ats", ".1.3.6.1.4.1.318.1.3.11" }, - { ".1.3.6.1.4.1.318.1.1.1.1.1.1.0", "apcc", ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" }, - { ".1.3.6.1.4.1.318.1.1.4.1.4.0", "apc_pdu", ".1.3.6.1.4.1.318.1.3.4.4.1.3.6.1.4.1.318.1.3.4.5" }, - { ".1.3.6.1.4.1.318.1.1.4.1.4.0", "apc_pdu", ".1.3.6.1.4.1.318.1.3.4.5" }, - { ".1.3.6.1.4.1.318.1.1.4.1.4.0", "apc_pdu", ".1.3.6.1.4.1.318.1.3.4.6" }, - { ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1", "baytech", ".1.3.6.1.4.1.4779" }, - { ".1.3.6.1.4.1.2947.1.1.2.0", "bestpower", ".1.3.6.1.4.1.2947.1.1.2.0" }, - { ".1.3.6.1.4.1.232.165.3.1.1.0", "cpqpower", ".1.3.6.1.4.1.232.165.3" }, - { ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0", "cyberpower", ".1.3.6.1.4.1.3808.1.1.1" }, - { NULL, "delta_ups", ".1.3.6.1.4.1.2254.2.4" }, - { ".1.3.6.1.4.1.534.10.2.1.2.0", "eaton_ats16_nm2", ".1.3.6.1.4.1.534.10.2" }, - { ".1.3.6.1.4.1.534.10.2.1.2.0", "eaton_ats16_nmc", ".1.3.6.1.4.1.705.1" }, - { ".1.3.6.1.4.1.534.10.1.2.1.0", "eaton_ats30", ".1.3.6.1.4.1.534.10.1" }, - { ".1.3.6.1.4.1.17373.3.1.1.0", "aphel_genesisII", ".1.3.6.1.4.1.17373" }, - { ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0", "eaton_epdu", ".1.3.6.1.4.1.534.6.6.7" }, - { ".1.3.6.1.4.1.20677.1", "pulizzi_switched1", ".1.3.6.1.4.1.20677.1" }, - { ".1.3.6.1.4.1.20677.1", "pulizzi_switched2", ".1.3.6.1.4.1.20677.2" }, - { ".1.3.6.1.4.1.534.6.6.6.1.1.12.0", "aphel_revelation", ".1.3.6.1.4.1.534.6.6.6" }, - { ".1.3.6.1.4.1.10418.17.2.1.2.0", "emerson_avocent_pdu", ".1.3.6.1.4.1.10418.17.1.7" }, - { ".1.3.6.1.4.1.232.165.7.1.2.1.3.0", "hpe_epdu", ".1.3.6.1.4.1.232.165.7" }, - { ".1.3.6.1.4.1.2011.6.174.1.2.100.1.2.1", "huawei", ".1.3.6.1.4.1.8072.3.2.10" }, - { NULL, "tripplite", ".1.3.6.1.4.1.850.1" }, - { "1.3.6.1.2.1.33.1.1.1.0", "ietf", ".1.3.6.1.2.1.33" }, - { ".1.3.6.1.4.1.705.1.1.1.0", "mge", ".1.3.6.1.4.1.705.1" }, - { ".1.3.6.1.4.1.4555.1.1.1.1.1.1.0", "netvision", ".1.3.6.1.4.1.4555.1.1.1" }, - { "1.3.6.1.4.1.534.1.1.2.0", "pw", ".1.3.6.1.4.1.534.1" }, - { "1.3.6.1.4.1.534.1.1.2.0", "pxgx_ups", ".1.3.6.1.4.1.534.2.12" }, - { ".1.3.6.1.4.1.13742.1.1.12.0", "raritan", ".1.3.6.1.4.1.13742" }, - { ".1.3.6.1.4.1.13742.6.3.2.1.1.3.1", "raritan-px2", ".1.3.6.1.4.1.13742.6" }, - { NULL, "xppc", ".1.3.6.1.4.1.935" }, - /* Terminating entry */ - { NULL, NULL, NULL } + { ".1.3.6.1.4.1.4555.1.1.1.1.1.1.0" , "netvision", ".1.3.6.1.4.1.4555.1.1.1"}, + { ".1.3.6.1.4.1.4779.1.3.5.2.1.24.1" , "baytech", NULL}, + { ".1.3.6.1.4.1.318.1.1.1.1.1.1.0" , "apcc", NULL}, + { "1.3.6.1.4.1.534.1.1.2.0" , "pw", ".1.3.6.1.4.1.534.1"}, + { ".1.3.6.1.4.1.17373.3.1.1.0" , "aphel_genesisII", ".1.3.6.1.4.1.17373"}, + { ".1.3.6.1.4.1.534.6.6.6.1.1.12.0" , "aphel_revelation", ".1.3.6.1.4.1.534.6.6.6"}, + { ".1.3.6.1.4.1.534.6.6.7.1.2.1.2.0" , "eaton_epdu", ".1.3.6.1.4.1.534.6.6.7"}, + { "" , "pulizzi_monitored", NULL}, + { ".1.3.6.1.4.1.20677.1" , "pulizzi_switched1", ".1.3.6.1.4.1.20677.1"}, + { ".1.3.6.1.4.1.20677.1" , "pulizzi_switched2", ".1.3.6.1.4.1.20677.2"}, + { ".1.3.6.1.4.1.2947.1.1.2.0" , "bestpower", NULL}, + { ".1.3.6.1.4.1.3808.1.1.1.1.1.1.0" , "cyberpower", ".1.3.6.1.4.1.3808"}, + { "" , "delta_ups", ".1.3.6.1.4.1.2254.2.4"}, + { ".1.3.6.1.4.1.705.1.1.1.0" , "mge", ".1.3.6.1.4.1.705.1"}, + { ".1.3.6.1.4.1.232.165.3.1.1.0" , "cpqpower", ".1.3.6.1.4.1.232.165.3"}, + { ".1.3.6.1.4.1.13742.1.1.12.0" , "raritan", ".1.3.6.1.4.1.13742"}, + { "1.3.6.1.2.1.33.1.1.1.0" , "ietf", ".1.3.6.1.2.1.33"}, + /* Terminating entry */ + { NULL, NULL, NULL} }; #endif /* DEVSCAN_SNMP_H */ diff --git a/tools/nut-scanner/nutscan-usb.h b/tools/nut-scanner/nutscan-usb.h index 072c6a7..d8085d8 100644 --- a/tools/nut-scanner/nutscan-usb.h +++ b/tools/nut-scanner/nutscan-usb.h @@ -19,29 +19,9 @@ #ifndef DEVSCAN_USB_H #define DEVSCAN_USB_H -#include "nut_stdint.h" /* for uint16_t etc. */ +#include +#include "nut_stdint.h" /* for uint16_t */ -#include /* for PATH_MAX in usb.h etc. */ - -#include /* for MAXPATHLEN etc. */ - -/* libusb header file */ -#if (!WITH_LIBUSB_1_0) && (!WITH_LIBUSB_0_1) -#error "configure script error: Neither WITH_LIBUSB_1_0 nor WITH_LIBUSB_0_1 is set" -#endif - -#if (WITH_LIBUSB_1_0) && (WITH_LIBUSB_0_1) -#error "configure script error: Both WITH_LIBUSB_1_0 and WITH_LIBUSB_0_1 are set" -#endif - -#if WITH_LIBUSB_1_0 - #include -#endif -#if WITH_LIBUSB_0_1 - #include - /* simple remap to avoid bloating structures */ - typedef usb_dev_handle libusb_device_handle; -#endif typedef struct { uint16_t vendorID; uint16_t productID; @@ -51,7 +31,7 @@ typedef struct { /* USB IDs device table */ static usb_device_id_t usb_device_table[] = { - { 0x0001, 0x0000, "nutdrv_qx" }, + { 0x0001, 0x0000, "blazer_usb" }, { 0x03f0, 0x0001, "usbhid-ups" }, { 0x03f0, 0x1f01, "bcmxcp_usb" }, { 0x03f0, 0x1f02, "bcmxcp_usb" }, @@ -70,12 +50,8 @@ static usb_device_id_t usb_device_table[] = { { 0x0463, 0x0001, "usbhid-ups" }, { 0x0463, 0xffff, "usbhid-ups" }, { 0x047c, 0xffff, "usbhid-ups" }, - { 0x0483, 0x0035, "nutdrv_qx" }, - { 0x0483, 0xa113, "usbhid-ups" }, - { 0x04b3, 0x0001, "usbhid-ups" }, { 0x04b4, 0x5500, "riello_usb" }, { 0x04d8, 0xd004, "usbhid-ups" }, - { 0x04d8, 0xd005, "usbhid-ups" }, { 0x050d, 0x0375, "usbhid-ups" }, { 0x050d, 0x0551, "usbhid-ups" }, { 0x050d, 0x0750, "usbhid-ups" }, @@ -84,23 +60,19 @@ static usb_device_id_t usb_device_table[] = { { 0x050d, 0x0910, "usbhid-ups" }, { 0x050d, 0x0912, "usbhid-ups" }, { 0x050d, 0x0980, "usbhid-ups" }, - { 0x050d, 0x0f51, "usbhid-ups" }, { 0x050d, 0x1100, "usbhid-ups" }, - { 0x051d, 0x0000, "usbhid-ups" }, { 0x051d, 0x0002, "usbhid-ups" }, { 0x051d, 0x0003, "usbhid-ups" }, { 0x0592, 0x0002, "bcmxcp_usb" }, { 0x0592, 0x0004, "usbhid-ups" }, - { 0x05b8, 0x0000, "nutdrv_qx" }, - { 0x05dd, 0x041b, "usbhid-ups" }, - { 0x05dd, 0xa011, "usbhid-ups" }, - { 0x0665, 0x5161, "nutdrv_qx" }, - { 0x06da, 0x0002, "nutdrv_qx" }, - { 0x06da, 0x0003, "nutdrv_qx" }, - { 0x06da, 0x0004, "nutdrv_qx" }, - { 0x06da, 0x0005, "nutdrv_qx" }, - { 0x06da, 0x0201, "nutdrv_qx" }, - { 0x06da, 0x0601, "nutdrv_qx" }, + { 0x05b8, 0x0000, "blazer_usb" }, + { 0x0665, 0x5161, "blazer_usb" }, + { 0x06da, 0x0002, "blazer_usb" }, + { 0x06da, 0x0003, "blazer_usb" }, + { 0x06da, 0x0004, "blazer_usb" }, + { 0x06da, 0x0005, "blazer_usb" }, + { 0x06da, 0x0201, "blazer_usb" }, + { 0x06da, 0x0601, "blazer_usb" }, { 0x06da, 0xffff, "usbhid-ups" }, { 0x075d, 0x0300, "usbhid-ups" }, { 0x0764, 0x0005, "usbhid-ups" }, @@ -113,7 +85,6 @@ static usb_device_id_t usb_device_table[] = { { 0x09ae, 0x1008, "usbhid-ups" }, { 0x09ae, 0x1009, "usbhid-ups" }, { 0x09ae, 0x1010, "usbhid-ups" }, - { 0x09ae, 0x1330, "usbhid-ups" }, { 0x09ae, 0x2005, "usbhid-ups" }, { 0x09ae, 0x2007, "usbhid-ups" }, { 0x09ae, 0x2008, "usbhid-ups" }, @@ -132,7 +103,6 @@ static usb_device_id_t usb_device_table[] = { { 0x09ae, 0x3014, "usbhid-ups" }, { 0x09ae, 0x3015, "usbhid-ups" }, { 0x09ae, 0x3016, "usbhid-ups" }, - { 0x09ae, 0x3024, "usbhid-ups" }, { 0x09ae, 0x4001, "usbhid-ups" }, { 0x09ae, 0x4002, "usbhid-ups" }, { 0x09ae, 0x4003, "usbhid-ups" }, @@ -141,39 +111,18 @@ static usb_device_id_t usb_device_table[] = { { 0x09ae, 0x4006, "usbhid-ups" }, { 0x09ae, 0x4007, "usbhid-ups" }, { 0x09ae, 0x4008, "usbhid-ups" }, - { 0x0d9f, 0x0001, "usbhid-ups" }, { 0x0d9f, 0x0004, "usbhid-ups" }, { 0x0d9f, 0x00a2, "usbhid-ups" }, { 0x0d9f, 0x00a3, "usbhid-ups" }, { 0x0d9f, 0x00a4, "usbhid-ups" }, { 0x0d9f, 0x00a5, "usbhid-ups" }, { 0x0d9f, 0x00a6, "usbhid-ups" }, - { 0x0f03, 0x0001, "nutdrv_qx" }, + { 0x0f03, 0x0001, "blazer_usb" }, { 0x10af, 0x0001, "usbhid-ups" }, - { 0x10af, 0x0004, "usbhid-ups" }, - { 0x10af, 0x0008, "usbhid-ups" }, - { 0x14f0, 0x00c9, "nutdrv_qx" }, - { 0x1cb0, 0x0032, "usbhid-ups" }, - { 0x1cb0, 0x0035, "nutdrv_qx" }, - { 0x1cb0, 0x0038, "usbhid-ups" }, - { 0x2341, 0x0036, "usbhid-ups" }, - { 0x2341, 0x8036, "usbhid-ups" }, - { 0x2A03, 0x0036, "usbhid-ups" }, - { 0x2A03, 0x0040, "usbhid-ups" }, - { 0x2A03, 0x8036, "usbhid-ups" }, - { 0x2A03, 0x8040, "usbhid-ups" }, - { 0x2b2d, 0xffff, "usbhid-ups" }, - { 0x2e51, 0x0000, "usbhid-ups" }, - { 0x2e51, 0xffff, "usbhid-ups" }, - { 0x2e66, 0x0201, "usbhid-ups" }, - { 0x2e66, 0x0202, "usbhid-ups" }, - { 0x2e66, 0x0203, "usbhid-ups" }, - { 0x2e66, 0x0300, "usbhid-ups" }, - { 0x4234, 0x0002, "usbhid-ups" }, - { 0xffff, 0x0000, "nutdrv_qx" }, - + { 0x14f0, 0x00c9, "blazer_usb" }, + { 0xffff, 0x0000, "blazer_usb" }, /* Terminating entry */ - { 0, 0, NULL } + { -1, -1, NULL } }; #endif /* DEVSCAN_USB_H */ diff --git a/tools/nut-scanner/scan_avahi.c b/tools/nut-scanner/scan_avahi.c index 67530a7..198e1f2 100644 --- a/tools/nut-scanner/scan_avahi.c +++ b/tools/nut-scanner/scan_avahi.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011 - EATON +/* scan_avahi.c: detect NUT avahi services + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,12 +16,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file scan_avahi.c - \brief detect NUT through Avahi mDNS / DNS-SD services - \author Frederic Bohe -*/ - #include "common.h" #include "nut-scan.h" @@ -41,6 +36,7 @@ #include /* dynamic link library stuff */ +static char * libname = "libavahi-client"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -86,141 +82,134 @@ static int (*nut_avahi_service_browser_free)(AvahiServiceBrowser *); static char * (*nut_avahi_address_snprint)(char *ret_s, size_t length, const AvahiAddress *a); static const AvahiPoll* (*nut_avahi_simple_poll_get)(AvahiSimplePoll *s); -/* return 0 on error; visible externally */ -int nutscan_load_avahi_library(const char *libname_path); -int nutscan_load_avahi_library(const char *libname_path) +/* return 0 on error */ +int nutscan_load_avahi_library() { - if (dl_handle != NULL) { - /* if previous init failed */ - if (dl_handle == (void *)1) { - return 0; - } - /* init has already been done */ - return 1; - } + if( dl_handle != NULL ) { + /* if previous init failed */ + if( dl_handle == (void *)1 ) { + return 0; + } + /* init has already been done */ + return 1; + } - if (libname_path == NULL) { - fprintf(stderr, "AVAHI client library not found. AVAHI search disabled.\n"); - return 0; - } + if( lt_dlinit() != 0 ) { + fprintf(stderr, "Error initializing lt_init\n"); + return 0; + } - if (lt_dlinit() != 0) { - fprintf(stderr, "Error initializing lt_init\n"); - return 0; - } + dl_handle = lt_dlopenext(libname); + if (!dl_handle) { + dl_error = lt_dlerror(); + goto err; + } + lt_dlerror(); /* Clear any existing error */ + *(void **) (&nut_avahi_service_browser_get_client) = lt_dlsym(dl_handle, "avahi_service_browser_get_client"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - dl_handle = lt_dlopen(libname_path); - if (!dl_handle) { - dl_error = lt_dlerror(); - goto err; - } - lt_dlerror(); /* Clear any existing error */ - *(void **) (&nut_avahi_service_browser_get_client) = lt_dlsym(dl_handle, "avahi_service_browser_get_client"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_simple_poll_loop) = lt_dlsym(dl_handle, "avahi_simple_poll_loop"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_simple_poll_loop) = lt_dlsym(dl_handle, "avahi_simple_poll_loop"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_client_free) = lt_dlsym(dl_handle, "avahi_client_free"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_client_free) = lt_dlsym(dl_handle, "avahi_client_free"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_client_errno) = lt_dlsym(dl_handle, "avahi_client_errno"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_client_errno) = lt_dlsym(dl_handle, "avahi_client_errno"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_free) = lt_dlsym(dl_handle, "avahi_free"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_free) = lt_dlsym(dl_handle, "avahi_free"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_simple_poll_quit) = lt_dlsym(dl_handle, "avahi_simple_poll_quit"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_simple_poll_quit) = lt_dlsym(dl_handle, "avahi_simple_poll_quit"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_client_new) = lt_dlsym(dl_handle, "avahi_client_new"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_client_new) = lt_dlsym(dl_handle, "avahi_client_new"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_simple_poll_free) = lt_dlsym(dl_handle, "avahi_simple_poll_free"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_simple_poll_free) = lt_dlsym(dl_handle, "avahi_simple_poll_free"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_service_resolver_new) = lt_dlsym(dl_handle, "avahi_service_resolver_new"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_service_resolver_new) = lt_dlsym(dl_handle, "avahi_service_resolver_new"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_strerror) = lt_dlsym(dl_handle, "avahi_strerror"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_strerror) = lt_dlsym(dl_handle, "avahi_strerror"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_service_resolver_get_client) = lt_dlsym(dl_handle, "avahi_service_resolver_get_client"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_service_resolver_get_client) = lt_dlsym(dl_handle, "avahi_service_resolver_get_client"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_service_browser_new) = lt_dlsym(dl_handle, "avahi_service_browser_new"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_service_browser_new) = lt_dlsym(dl_handle, "avahi_service_browser_new"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_service_resolver_free) = lt_dlsym(dl_handle, "avahi_service_resolver_free"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_service_resolver_free) = lt_dlsym(dl_handle, "avahi_service_resolver_free"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_simple_poll_new) = lt_dlsym(dl_handle, "avahi_simple_poll_new"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_simple_poll_new) = lt_dlsym(dl_handle, "avahi_simple_poll_new"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_string_list_to_string) = lt_dlsym(dl_handle, "avahi_string_list_to_string"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_string_list_to_string) = lt_dlsym(dl_handle, "avahi_string_list_to_string"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_service_browser_free) = lt_dlsym(dl_handle, "avahi_service_browser_free"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_service_browser_free) = lt_dlsym(dl_handle, "avahi_service_browser_free"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_address_snprint) = lt_dlsym(dl_handle, "avahi_address_snprint"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_address_snprint) = lt_dlsym(dl_handle, "avahi_address_snprint"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_avahi_simple_poll_get) = lt_dlsym(dl_handle, "avahi_simple_poll_get"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_avahi_simple_poll_get) = lt_dlsym(dl_handle, "avahi_simple_poll_get"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - return 1; + return 1; err: - fprintf(stderr, - "Cannot load AVAHI library (%s) : %s. AVAHI search disabled.\n", - libname_path, dl_error); - dl_handle = (void *)1; + fprintf(stderr, "Cannot load AVAHI library (%s) : %s. AVAHI search disabled.\n", libname, dl_error); + + dl_handle = (void *)1; lt_dlexit(); - return 0; + return 0; } /* end of dynamic link library stuff */ static AvahiSimplePoll *simple_poll = NULL; static nutscan_device_t * dev_ret = NULL; -static useconds_t avahi_usec_timeout = 0; +static long avahi_usec_timeout = 0; -static void update_device(const char * host_name, const char *ip, uint16_t port, char * text, int proto) +static void update_device(const char * host_name,const char *ip, uint16_t port,char * text, int proto) { nutscan_device_t * dev = NULL; @@ -234,114 +223,113 @@ static void update_device(const char * host_name, const char *ip, uint16_t port, char * device_saveptr = NULL; int device_found = 0; char buf[6]; - size_t buf_size; + int buf_size; - if (text == NULL) { + if( text == NULL ) { return; } t = strdup(text); - phrase = strtok_r(t, "\"", &t_saveptr); - while (phrase != NULL) { - word = strtok_r(phrase, "=", &phrase_saveptr); - if (word == NULL) { - phrase = strtok_r(NULL, "\"", &t_saveptr); + phrase = strtok_r(t,"\"",&t_saveptr); + while(phrase != NULL ) { + word = strtok_r(phrase,"=",&phrase_saveptr); + if( word == NULL ) { + phrase = strtok_r(NULL,"\"",&t_saveptr); continue; } - value = strtok_r(NULL, "=", &phrase_saveptr); - if (value == NULL) { - phrase = strtok_r(NULL, "\"", &t_saveptr); + value = strtok_r(NULL,"=",&phrase_saveptr); + if( value == NULL ) { + phrase = strtok_r(NULL,"\"",&t_saveptr); continue; } - if (strcmp(word, "device_list") != 0) { - phrase = strtok_r(NULL, "\"", &t_saveptr); + if( strcmp(word,"device_list") != 0 ) { + phrase = strtok_r(NULL,"\"",&t_saveptr); continue; } - device = strtok_r(value, ";", &device_saveptr); - while (device != NULL) { + device = strtok_r(value,";",&device_saveptr); + while( device != NULL ) { device_found = 1; dev = nutscan_new_device(); dev->type = TYPE_NUT; dev->driver = strdup("nutclient"); - if (proto == AVAHI_PROTO_INET) { - nutscan_add_option_to_device(dev, "desc", "IPv4"); + if( proto == AVAHI_PROTO_INET) { + nutscan_add_option_to_device(dev,"desc","IPv4"); } - if (proto == AVAHI_PROTO_INET6) { - nutscan_add_option_to_device(dev, "desc", "IPv6"); + if( proto == AVAHI_PROTO_INET6 ) { + nutscan_add_option_to_device(dev,"desc","IPv6"); } - if (port != PORT) { - /* +5+1+1+1 is for : + if( port != PORT) { + /* +5+1+1+1 is for : - port number (max 65535 so 5 characters), - '@' and ':' characters - terminating 0 */ - buf_size = strlen(device) + - strlen(host_name) + - 5 + 1 + 1 + 1; - dev->port = malloc(buf_size); - if (dev->port) { - snprintf(dev->port, buf_size, "%s@%s:%u", - device, host_name, port); + buf_size = strlen(device)+strlen(host_name)+ + 5+1+1+1; + dev->port=malloc(buf_size); + if(dev->port) { + snprintf(dev->port,buf_size,"%s@%s:%u", + device,host_name,port); } } else { /*+1+1 is for '@' character and terminating 0 */ - buf_size = strlen(device) + strlen(host_name) + 1 + 1; - dev->port = malloc(buf_size); - if (dev->port) { - snprintf(dev->port, buf_size, "%s@%s", - device, host_name); + buf_size = strlen(device)+strlen(host_name)+1+1; + dev->port=malloc(buf_size); + if(dev->port) { + snprintf(dev->port,buf_size,"%s@%s", + device,host_name); } } - if (dev->port) { - dev_ret = nutscan_add_device_to_device(dev_ret, dev); + if( dev->port ) { + dev_ret = nutscan_add_device_to_device(dev_ret,dev); } else { nutscan_free_device(dev); } - device = strtok_r(NULL, ";", &device_saveptr); - } + device = strtok_r(NULL,";",&device_saveptr); + }; - phrase = strtok_r(NULL, "\"", &t_saveptr); - } + phrase = strtok_r(NULL,"\"",&t_saveptr); + }; free(t); /* If no device published in avahi data, try to get the device by connecting directly to upsd */ - if (!device_found) { - snprintf(buf, sizeof(buf), "%u", port); - dev = nutscan_scan_nut(ip, ip, buf, avahi_usec_timeout); - if (dev) { - dev_ret = nutscan_add_device_to_device(dev_ret, dev); + if( !device_found) { + snprintf(buf,sizeof(buf),"%u",port); + dev = nutscan_scan_nut(ip,ip,buf,avahi_usec_timeout); + if(dev) { + dev_ret = nutscan_add_device_to_device(dev_ret,dev); } /* add an upsd entry without associated device */ else { dev = nutscan_new_device(); dev->type = TYPE_NUT; dev->driver = strdup("nutclient"); - if (proto == AVAHI_PROTO_INET) { - nutscan_add_option_to_device(dev, "desc", "IPv4"); + if( proto == AVAHI_PROTO_INET) { + nutscan_add_option_to_device(dev,"desc","IPv4"); } - if (proto == AVAHI_PROTO_INET6) { - nutscan_add_option_to_device(dev, "desc", "IPv6"); + if( proto == AVAHI_PROTO_INET6 ) { + nutscan_add_option_to_device(dev,"desc","IPv6"); } - if (port != PORT) { + if( port != PORT) { /*+1+1 is for ':' character and terminating 0 */ /*buf is the string containing the port number*/ - buf_size = strlen(host_name) + strlen(buf) + 1 + 1; - dev->port = malloc(buf_size); - if (dev->port) { - snprintf(dev->port, buf_size, "%s:%s", - host_name, buf); + buf_size = strlen(host_name)+strlen(buf)+1+1; + dev->port=malloc(buf_size); + if(dev->port) { + snprintf(dev->port,buf_size,"%s:%s", + host_name,buf); } } else { - dev->port = strdup(host_name); + dev->port=strdup(host_name); } - if (dev->port) { - dev_ret = nutscan_add_device_to_device(dev_ret, dev); + if( dev->port ) { + dev_ret = nutscan_add_device_to_device(dev_ret,dev); } else { nutscan_free_device(dev); @@ -352,8 +340,8 @@ static void update_device(const char * host_name, const char *ip, uint16_t port, static void resolve_callback( AvahiServiceResolver *r, - AvahiIfIndex interface, - AvahiProtocol protocol, + AVAHI_GCC_UNUSED AvahiIfIndex interface, + AVAHI_GCC_UNUSED AvahiProtocol protocol, AvahiResolverEvent event, const char *name, const char *type, @@ -363,23 +351,15 @@ static void resolve_callback( uint16_t port, AvahiStringList *txt, AvahiLookupResultFlags flags, - void* userdata) -{ + AVAHI_GCC_UNUSED void* userdata) { assert(r); - NUT_UNUSED_VARIABLE(interface); - NUT_UNUSED_VARIABLE(protocol); - NUT_UNUSED_VARIABLE(userdata); - /* Called whenever a service has been resolved successfully or timed out */ switch (event) { case AVAHI_RESOLVER_FAILURE: - fprintf(stderr, - "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", - name, type, domain, - (*nut_avahi_strerror)((*nut_avahi_client_errno)((*nut_avahi_service_resolver_get_client)(r)))); + fprintf(stderr, "(Resolver) Failed to resolve service '%s' of type '%s' in domain '%s': %s\n", name, type, domain, (*nut_avahi_strerror)((*nut_avahi_client_errno)((*nut_avahi_service_resolver_get_client)(r)))); break; case AVAHI_RESOLVER_FOUND: { @@ -389,8 +369,6 @@ static void resolve_callback( (*nut_avahi_address_snprint)(a, sizeof(a), address); t = (*nut_avahi_string_list_to_string)(txt); - - NUT_UNUSED_VARIABLE(flags); /* fprintf(stderr, "\t%s:%u (%s)\n" @@ -410,7 +388,7 @@ static void resolve_callback( !!(flags & AVAHI_LOOKUP_RESULT_MULTICAST), !!(flags & AVAHI_LOOKUP_RESULT_CACHED)); */ - update_device(host_name, a, port, t, address->proto); + update_device(host_name,a,port,t,address->proto); (*nut_avahi_free)(t); } } @@ -426,23 +404,18 @@ static void browse_callback( const char *name, const char *type, const char *domain, - AvahiLookupResultFlags flags, - void* userdata) -{ + AVAHI_GCC_UNUSED AvahiLookupResultFlags flags, + void* userdata) { AvahiClient *c = userdata; assert(b); - NUT_UNUSED_VARIABLE(flags); - /* Called whenever a new services becomes available on the LAN or is removed from the LAN */ switch (event) { case AVAHI_BROWSER_FAILURE: - fprintf(stderr, - "(Browser) %s\n", - (*nut_avahi_strerror)((*nut_avahi_client_errno)((*nut_avahi_service_browser_get_client)(b)))); + fprintf(stderr, "(Browser) %s\n", (*nut_avahi_strerror)((*nut_avahi_client_errno)((*nut_avahi_service_browser_get_client)(b)))); (*nut_avahi_simple_poll_quit)(simple_poll); return; @@ -454,22 +427,8 @@ static void browse_callback( the callback function is called the server will free the resolver for us. */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wassign-enum" -#endif - /* It seems that avahi-common/defs.h only defines the flags in a - * manner similar to bitmask flags to request certain features, - * but lacks a value in that enum for lack of flags (unconstrained - * lookup). So we have to silence a warning here... - */ if (!((*nut_avahi_service_resolver_new)(c, interface, protocol, name, type, domain, AVAHI_PROTO_UNSPEC, 0, resolve_callback, c))) -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic pop -#endif - fprintf(stderr, - "Failed to resolve service '%s': %s\n", - name, (*nut_avahi_strerror)((*nut_avahi_client_errno)(c))); + fprintf(stderr, "Failed to resolve service '%s': %s\n", name, (*nut_avahi_strerror)((*nut_avahi_client_errno)(c))); break; @@ -479,39 +438,33 @@ static void browse_callback( case AVAHI_BROWSER_ALL_FOR_NOW: (*nut_avahi_simple_poll_quit)(simple_poll); - goto fallthrough_AVAHI_BROWSER_CACHE_EXHAUSTED; /* be explicit */ - case AVAHI_BROWSER_CACHE_EXHAUSTED: - fallthrough_AVAHI_BROWSER_CACHE_EXHAUSTED: /* fprintf(stderr, "(Browser) %s\n", event == AVAHI_BROWSER_CACHE_EXHAUSTED ? "CACHE_EXHAUSTED" : "ALL_FOR_NOW"); */ break; } } -static void client_callback(AvahiClient *c, AvahiClientState state, void * userdata) { +static void client_callback(AvahiClient *c, AvahiClientState state, AVAHI_GCC_UNUSED void * userdata) { assert(c); - NUT_UNUSED_VARIABLE(userdata); /* Called whenever the client or server state changes */ if (state == AVAHI_CLIENT_FAILURE) { - fprintf(stderr, - "Server connection failure: %s\n", - (*nut_avahi_strerror)((*nut_avahi_client_errno)(c))); + fprintf(stderr, "Server connection failure: %s\n", (*nut_avahi_strerror)((*nut_avahi_client_errno)(c))); (*nut_avahi_simple_poll_quit)(simple_poll); } } -nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout) +nutscan_device_t * nutscan_scan_avahi(long usec_timeout) { - /* Example service publication + /* Example service publication * $ avahi-publish -s nut _upsd._tcp 3493 txtvers=1 protovers=1.0.0 device_list="dev1;dev2" */ AvahiClient *client = NULL; AvahiServiceBrowser *sb = NULL; int error; - if (!nutscan_avail_avahi) { + if( !nutscan_avail_avahi ) { return NULL; } @@ -524,44 +477,17 @@ nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout) } /* Allocate a new client */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wassign-enum" -#endif - /* It seems that avahi-common/defs.h only defines the flags in a - * manner similar to bitmask flags to request certain features, - * but lacks a value in that enum for lack of flags (unconstrained - * lookup). So we have to silence a warning here... - */ client = (*nut_avahi_client_new)((*nut_avahi_simple_poll_get)(simple_poll), 0, client_callback, NULL, &error); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic pop -#endif /* Check wether creating the client object succeeded */ if (!client) { - fprintf(stderr, - "Failed to create client: %s\n", - (*nut_avahi_strerror)(error)); + fprintf(stderr, "Failed to create client: %s\n", (*nut_avahi_strerror)(error)); goto fail; } /* Create the service browser */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wassign-enum" -#endif - /* See comments about flags just a bit above */ - if (!(sb = (*nut_avahi_service_browser_new)( - client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, - "_upsd._tcp", NULL, 0, browse_callback, client)) - ) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_ASSIGN_ENUM) -# pragma GCC diagnostic pop -#endif - fprintf(stderr, - "Failed to create service browser: %s\n", - (*nut_avahi_strerror)((*nut_avahi_client_errno)(client))); + if (!(sb = (*nut_avahi_service_browser_new)(client, AVAHI_IF_UNSPEC, AVAHI_PROTO_UNSPEC, "_upsd._tcp", NULL, 0, browse_callback, client))) { + fprintf(stderr, "Failed to create service browser: %s\n", (*nut_avahi_strerror)((*nut_avahi_client_errno)(client))); goto fail; } @@ -584,10 +510,8 @@ fail: } #else /* WITH_AVAHI */ /* stub function */ -nutscan_device_t * nutscan_scan_avahi(useconds_t usec_timeout) +nutscan_device_t * nutscan_scan_avahi(long usec_timeout) { - NUT_UNUSED_VARIABLE(usec_timeout); - return NULL; } #endif /* WITH_AVAHI */ diff --git a/tools/nut-scanner/scan_eaton_serial.c b/tools/nut-scanner/scan_eaton_serial.c index 4b16311..ecfbe14 100644 --- a/tools/nut-scanner/scan_eaton_serial.c +++ b/tools/nut-scanner/scan_eaton_serial.c @@ -1,6 +1,6 @@ -/* - * Copyright (C) 2012 - EATON - * Copyright (C) 2016-2021 - EATON - Various threads-related improvements +/* scan_eaton_serial.c: detect Eaton serial XCP, SHUT and Q1 devices + * + * Copyright (C) 2012 Arnaud Quette * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,14 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file scan_eaton_serial.c - \brief detect Eaton serial XCP, SHUT and Q1 devices - \author Arnaud Quette - \author Jim Klimov -*/ - #include "common.h" -#include "nut-scan.h" /* Need this on AIX when using xlc to get alloca */ #ifdef _AIX @@ -33,50 +26,36 @@ #include #include -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif -#ifdef HAVE_SYS_SIGNAL_H -# include -#endif -#ifdef HAVE_SIGNAL_H -# include -#endif -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif +#include #include #include #include +#include "nut-scan.h" #include "serial.h" #include "bcmxcp_io.h" -#include "bcmxcp_ser.h" #include "bcmxcp.h" #include "nutscan-serial.h" +#ifdef HAVE_PTHREAD +#include +#endif + /* SHUT header */ #define SHUT_SYNC 0x16 #define MAX_TRY 4 -/* BCMXCP header defines these externs now: */ -/* -extern unsigned char BCMXCP_AUTHCMD[4]; +/* BCMXCP header */ +extern unsigned char AUT[4]; extern struct pw_baud_rate { - int rate; - int name; + int rate; + int name; } pw_baud_rates[]; -*/ /* Local list of found devices */ static nutscan_device_t * dev_ret = NULL; /* Remap some functions to avoid undesired behavior (drivers/main.c) */ -char *getval(const char *var) -{ - NUT_UNUSED_VARIABLE(var); - return NULL; -} +char *getval(const char *var) { return NULL; } #ifdef HAVE_PTHREAD static pthread_mutex_t dev_mutex; @@ -119,7 +98,7 @@ unsigned char calc_checksum(const unsigned char *buf) int i; c = 0; - for (i = 0; i < 2 + buf[1]; i++) + for(i = 0; i < 2 + buf[1]; i++) c -= buf[i]; return c; @@ -131,22 +110,18 @@ unsigned char calc_checksum(const unsigned char *buf) /* Light version of of drivers/libshut.c->shut_synchronise() * return 1 if OK, 0 otherwise */ -static int shut_synchronise(int arg_upsfd) +int shut_synchronise(int upsfd) { int try; - unsigned char reply = '\0'; - /* FIXME? Should we save "arg_upsfd" into global "upsfd" variable? - * This was previously shadowed by function argument named "upsfd"... - */ - /* upsfd = arg_upsfd; */ + u_char reply = '\0'; /* Sync with the UPS according to notification */ for (try = 0; try < MAX_TRY; try++) { - if ((ser_send_char(arg_upsfd, SHUT_SYNC)) == -1) { + if ((ser_send_char(upsfd, SHUT_SYNC)) == -1) { continue; } - ser_get_char(arg_upsfd, &reply, 1, 0); + ser_get_char(upsfd, &reply, 1, 0); if (reply == SHUT_SYNC) { return 1; } @@ -158,12 +133,12 @@ static int shut_synchronise(int arg_upsfd) * send SYNC token (0x16) and receive the SYNC token back * FIXME: maybe try to get device descriptor?! */ -static nutscan_device_t * nutscan_scan_eaton_serial_shut(const char* port_name) +nutscan_device_t * nutscan_scan_eaton_serial_shut(const char* port_name) { nutscan_device_t * dev = NULL; int devfd = -1; - if ((devfd = ser_open_nf(port_name)) != -1) { + if ( (devfd = ser_open_nf(port_name)) != -1 ) { /* set RTS to off and DTR to on to allow correct behavior * with UPS using PnP feature */ if (ser_set_dtr(devfd, 1) != -1) { @@ -207,17 +182,16 @@ static nutscan_device_t * nutscan_scan_eaton_serial_shut(const char* port_name) * Send PW_SET_REQ_ONLY_MODE command (0xA0) and wait for response * [Get ID Block (PW_ID_BLOCK_REQ) (0x31)] */ -static nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) +nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) { nutscan_device_t * dev = NULL; - int i, devfd = -1; - ssize_t ret; + int i, ret, devfd = -1; unsigned char answer[256]; unsigned char sbuf[128]; memset(sbuf, 0, 128); - if ((devfd = ser_open_nf(port_name)) != -1) { + if ( (devfd = ser_open_nf(port_name)) != -1 ) { #ifdef HAVE_PTHREAD pthread_mutex_lock(&dev_mutex); #endif @@ -226,7 +200,7 @@ static nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) pthread_mutex_unlock(&dev_mutex); #endif - for (i = 0; (pw_baud_rates[i].rate != 0) && (dev == NULL); i++) + for (i=0; (pw_baud_rates[i].rate != 0) && (dev == NULL); i++) { memset(answer, 0, 256); @@ -238,9 +212,9 @@ static nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) break; usleep(90000); - send_write_command(BCMXCP_AUTHCMD, 4); + send_write_command(AUT, 4); usleep(500000); - + /* Discovery with Baud Hunting (XCP protocol spec. §4.1.2) * sending PW_SET_REQ_ONLY_MODE should be enough, since * the unit should send back Identification block */ @@ -262,7 +236,7 @@ static nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) } #endif - if ((ret > 0) && (answer[0] == PW_COMMAND_START_BYTE)) { + if ( (ret > 0) && (answer[0] == PW_COMMAND_START_BYTE) ) { dev = nutscan_new_device(); dev->type = TYPE_EATON_SERIAL; dev->driver = strdup(XCP_DRIVER_NAME); @@ -297,16 +271,15 @@ static nutscan_device_t * nutscan_scan_eaton_serial_xcp(const char* port_name) * - simply try to get Q1 (status) string * - check its size and first char. which should be '(' */ -static nutscan_device_t * nutscan_scan_eaton_serial_q1(const char* port_name) +nutscan_device_t * nutscan_scan_eaton_serial_q1(const char* port_name) { nutscan_device_t * dev = NULL; struct termios tio; - ssize_t ret = 0; - int retry; + int ret = 0, retry; int devfd = -1; char buf[128]; - if ((devfd = ser_open_nf(port_name)) != -1) { + if ( (devfd = ser_open_nf(port_name)) != -1 ) { if (ser_set_speed_nf(devfd, port_name, B2400) != -1) { if (!tcgetattr(devfd, &tio)) { @@ -341,10 +314,10 @@ static nutscan_device_t * nutscan_scan_eaton_serial_q1(const char* port_name) /* simplified code */ ser_flush_io(devfd); - if ((ret = ser_send(devfd, "Q1\r")) > 0) { + if ( (ret = ser_send(devfd, "Q1\r")) > 0) { /* Get Q1 reply */ - if ((ret = ser_get_buf(devfd, buf, sizeof(buf), SER_WAIT_SEC, 0)) > 0) { + if ( (ret = ser_get_buf(devfd, buf, sizeof(buf), SER_WAIT_SEC, 0)) > 0) { /* Check answer */ /* should at least (and most) be 46 chars */ @@ -383,10 +356,10 @@ static void * nutscan_scan_eaton_serial_device(void * port_arg) char* port_name = (char*) port_arg; /* Try SHUT first */ - if ((dev = nutscan_scan_eaton_serial_shut(port_name)) == NULL) { + if ( (dev = nutscan_scan_eaton_serial_shut(port_name)) == NULL) { usleep(100000); /* Else, try XCP */ - if ((dev = nutscan_scan_eaton_serial_xcp(port_name)) == NULL) { + if ( (dev = nutscan_scan_eaton_serial_xcp(port_name)) == NULL) { /* Else, try Q1 */ usleep(100000); dev = nutscan_scan_eaton_serial_q1(port_name); @@ -398,257 +371,66 @@ static void * nutscan_scan_eaton_serial_device(void * port_arg) nutscan_device_t * nutscan_scan_eaton_serial(const char* ports_range) { - bool_t pass = TRUE; /* Track that we may spawn a scanning thread */ struct sigaction oldact; int change_action_handler = 0; char *current_port_name = NULL; char **serial_ports_list; int current_port_nb; + int i; #ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - sem_t * semaphore = nutscan_semaphore(); -# endif pthread_t thread; - nutscan_thread_t * thread_array = NULL; - size_t thread_count = 0, i; + pthread_t * thread_array = NULL; + int thread_count = 0; - pthread_mutex_init(&dev_mutex, NULL); -#endif /* HAVE_PTHREAD */ + pthread_mutex_init(&dev_mutex,NULL); +#endif /* 1) Get ports_list */ serial_ports_list = nutscan_get_serial_ports_list(ports_range); - if (serial_ports_list == NULL) { + if( serial_ports_list == NULL ) { return NULL; } /* Ignore SIGPIPE if the caller hasn't set a handler for it yet */ - if (sigaction(SIGPIPE, NULL, &oldact) == 0) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif - if (oldact.sa_handler == SIG_DFL) { + if( sigaction(SIGPIPE, NULL, &oldact) == 0 ) { + if( oldact.sa_handler == SIG_DFL ) { change_action_handler = 1; - signal(SIGPIPE, SIG_IGN); + signal(SIGPIPE,SIG_IGN); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif } /* port(s) iterator */ current_port_nb = 0; - while (serial_ports_list[current_port_nb] != NULL) { + while(serial_ports_list[current_port_nb] != NULL) { + current_port_name = serial_ports_list[current_port_nb]; #ifdef HAVE_PTHREAD - /* NOTE: With many enough targets to scan, this can crash - * by spawning too many children; add a limit and loop to - * "reap" some already done with their work. And probably - * account them in thread_array[] as something to not wait - * for below in pthread_join()... - */ - -# ifdef HAVE_SEMAPHORE - /* Just wait for someone to free a semaphored slot, - * if none are available, and then/otherwise grab one - */ - if (thread_array == NULL) { - /* Starting point, or after a wait to complete - * all earlier runners */ - sem_wait(semaphore); - pass = TRUE; - } else { - pass = (sem_trywait(semaphore) == 0); + if (pthread_create(&thread, NULL, nutscan_scan_eaton_serial_device, (void*)current_port_name) == 0){ + thread_count++; + thread_array = realloc(thread_array, + thread_count*sizeof(pthread_t)); + thread_array[thread_count-1] = thread; } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* A somewhat naive and brute-force solution for - * systems without a semaphore.h. This may suffer - * some off-by-one errors, using a few more threads - * than intended (if we race a bit at the wrong time, - * probably up to one per enabled scanner routine). - */ - - /* TOTHINK: Should there be a threadcount_mutex when - * we just read the value in if() and while() below? - * At worst we would overflow the limit a bit due to - * other protocol scanners... - */ - if (curr_threads >= max_threads) { - upsdebugx(2, "%s: already running %zu scanning threads " - "(launched overall: %zu), " - "waiting until some would finish", - __func__, curr_threads, thread_count); - while (curr_threads >= max_threads) { - for (i = 0; i < thread_count ; i++) { - int ret; - - if (!thread_array[i].active) continue; - - pthread_mutex_lock(&threadcount_mutex); - upsdebugx(3, "%s: Trying to join thread #%i...", __func__, i); - ret = pthread_tryjoin_np(thread_array[i].thread, NULL); - switch (ret) { - case ESRCH: /* No thread with the ID thread could be found - already "joined"? */ - upsdebugx(5, "%s: Was thread #%zu joined earlier?", __func__, i); - break; - case 0: /* thread exited */ - if (curr_threads > 0) { - curr_threads --; - upsdebugx(4, "%s: Joined a finished thread #%zu", __func__, i); - } else { - /* threadcount_mutex fault? */ - upsdebugx(0, "WARNING: %s: Accounting of thread count " - "says we are already at 0", __func__); - } - thread_array[i].active = FALSE; - break; - case EBUSY: /* actively running */ - upsdebugx(6, "%s: thread #%zu still busy (%i)", - __func__, i, ret); - break; - case EDEADLK: /* Errors with thread interactions... bail out? */ - case EINVAL: /* Errors with thread interactions... bail out? */ - default: /* new pthreads abilities? */ - upsdebugx(5, "%s: thread #%zu reported code %i", - __func__, i, ret); - break; - } - pthread_mutex_unlock(&threadcount_mutex); - } - - if (curr_threads >= max_threads) { - usleep (10000); /* microSec's, so 0.01s here */ - } - } - upsdebugx(2, "%s: proceeding with scan", __func__); - } - /* NOTE: No change to default "pass" in this ifdef: - * if we got to this line, we have a slot to use */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - if (pass) { - current_port_name = serial_ports_list[current_port_nb]; +#else + nutscan_scan_eaton_serial_device(current_port_name); +#endif + current_port_nb++; + } #ifdef HAVE_PTHREAD - if (pthread_create(&thread, NULL, nutscan_scan_eaton_serial_device, (void*)current_port_name) == 0) { -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - curr_threads++; -# endif /* HAVE_PTHREAD_TRYJOIN */ - - thread_count++; - nutscan_thread_t *new_thread_array = realloc(thread_array, - thread_count * sizeof(nutscan_thread_t)); - if (new_thread_array == NULL) { - upsdebugx(1, "%s: Failed to realloc thread array", __func__); - break; - } - else { - thread_array = new_thread_array; - } - thread_array[thread_count - 1].thread = thread; - thread_array[thread_count - 1].active = TRUE; - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ - } -#else /* if not HAVE_PTHREAD */ - nutscan_scan_eaton_serial_device(current_port_name); -#endif /* if HAVE_PTHREAD */ - current_port_nb++; - } else { /* if not pass -- all slots busy */ -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - /* Wait for all current scans to complete */ - if (thread_array != NULL) { - upsdebugx (2, "%s: Running too many scanning threads, " - "waiting until older ones would finish", - __func__); - for (i = 0; i < thread_count ; i++) { - int ret; - if (!thread_array[i].active) { - /* Probably should not get here, - * but handle it just in case */ - upsdebugx(0, "WARNING: %s: Midway clean-up: did not expect thread %zu to be not active", - __func__, i); - sem_post(semaphore); - continue; - } - thread_array[i].active = FALSE; - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Midway clean-up: pthread_join() returned code %i", - __func__, ret); - } - sem_post(semaphore); - } - thread_count = 0; - free(thread_array); - thread_array = NULL; - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* TODO: Move the wait-loop for TRYJOIN here? */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - } /* if: could we "pass" or not? */ - } /* while */ - -#ifdef HAVE_PTHREAD - if (thread_array != NULL) { - upsdebugx(2, "%s: all planned scans launched, waiting for threads to complete", __func__); - for (i = 0; i < thread_count; i++) { - int ret; - - if (!thread_array[i].active) continue; - - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Clean-up: pthread_join() returned code %i", - __func__, ret); - } - thread_array[i].active = FALSE; -# ifdef HAVE_SEMAPHORE - sem_post(semaphore); -# else -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - if (curr_threads > 0) { - curr_threads --; - upsdebugx(5, "%s: Clean-up: Joined a finished thread #%zu", - __func__, i); - } else { - upsdebugx(0, "WARNING: %s: Clean-up: Accounting of thread count " - "says we are already at 0", __func__); - } - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ - } - free(thread_array); - upsdebugx(2, "%s: all threads freed", __func__); + for ( i = 0; i < thread_count ; i++) { + pthread_join(thread_array[i],NULL); } pthread_mutex_destroy(&dev_mutex); -#endif /* HAVE_PTHREAD */ + free(thread_array); +#endif - if (change_action_handler) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif - signal(SIGPIPE, SIG_DFL); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif + if(change_action_handler) { + signal(SIGPIPE,SIG_DFL); } /* free everything... */ - i = 0; - while (serial_ports_list[i] != NULL) { + i=0; + while(serial_ports_list[i] != NULL) { free(serial_ports_list[i]); i++; } diff --git a/tools/nut-scanner/scan_ipmi.c b/tools/nut-scanner/scan_ipmi.c index 6dca351..4da3dcd 100644 --- a/tools/nut-scanner/scan_ipmi.c +++ b/tools/nut-scanner/scan_ipmi.c @@ -1,4 +1,5 @@ -/* +/* scan_ipmi.c: detect NUT supported Power Supply Units + * * Copyright (C) * 2011 - 2012 Arnaud Quette * @@ -16,12 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -/*! \file scan_ipmi.c - \brief detect NUT supported Power Supply Units - \author Arnaud Quette -*/ - #include "common.h" #include "nut-scan.h" @@ -40,6 +35,7 @@ #define IPMI_RETRANSMISSION_TIMEOUT_LENGTH_DEFAULT 250 /* dynamic link library stuff */ +static char * libname = "libfreeipmi"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -115,30 +111,24 @@ static void (*nut_ipmi_ctx_destroy) (ipmi_ctx_t ctx); /* Internal functions */ static nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t * sec); -/* Return 0 on error; visible externally */ -int nutscan_load_ipmi_library(const char *libname_path); -int nutscan_load_ipmi_library(const char *libname_path) +/* Return 0 on error */ +int nutscan_load_ipmi_library() { - if (dl_handle != NULL) { + if( dl_handle != NULL ) { /* if previous init failed */ - if (dl_handle == (void *)1) { + if( dl_handle == (void *)1 ) { return 0; } /* init has already been done */ return 1; } - if (libname_path == NULL) { - fprintf(stderr, "IPMI library not found. IPMI search disabled.\n"); - return 0; - } - - if (lt_dlinit() != 0) { + if( lt_dlinit() != 0 ) { fprintf(stderr, "Error initializing lt_init\n"); return 0; } - dl_handle = lt_dlopen(libname_path); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -148,103 +138,103 @@ int nutscan_load_ipmi_library(const char *libname_path) lt_dlerror(); *(void **) (&nut_ipmi_fru_close_device_id) = lt_dlsym(dl_handle, IPMI_FRU_CLOSE_DEVICE_ID); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_ctx_destroy) = lt_dlsym(dl_handle, IPMI_FRU_CTX_DESTROY); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } #ifdef HAVE_FREEIPMI_11X_12X *(void **) (&nut_ipmi_sdr_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_sdr_ctx_destroy"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } #else /* HAVE_FREEIPMI_11X_12X */ *(void **) (&nut_ipmi_sdr_cache_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_sdr_cache_ctx_destroy"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_sdr_parse_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_sdr_parse_ctx_destroy"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } #endif /* HAVE_FREEIPMI_11X_12X */ *(void **) (&nut_ipmi_fru_ctx_create) = lt_dlsym(dl_handle, IPMI_FRU_CTX_CREATE); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_ctx_set_flags) = lt_dlsym(dl_handle, IPMI_FRU_CTX_SET_FLAGS); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_open_device_id) = lt_dlsym(dl_handle, IPMI_FRU_OPEN_DEVICE_ID); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_ctx_errormsg) = lt_dlsym(dl_handle, IPMI_FRU_CTX_ERRORMSG); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_read_data_area) = lt_dlsym(dl_handle, IPMI_FRU_READ_DATA_AREA); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_fru_next) = lt_dlsym(dl_handle, IPMI_FRU_PARSE_NEXT); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_create) = lt_dlsym(dl_handle, "ipmi_ctx_create"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_find_inband) = lt_dlsym(dl_handle, "ipmi_ctx_find_inband"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_open_outofband) = lt_dlsym(dl_handle, "ipmi_ctx_open_outofband"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_errnum) = lt_dlsym(dl_handle, "ipmi_ctx_errnum"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_errormsg) = lt_dlsym(dl_handle, "ipmi_ctx_errormsg"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_close) = lt_dlsym(dl_handle, "ipmi_ctx_close"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_ipmi_ctx_destroy) = lt_dlsym(dl_handle, "ipmi_ctx_destroy"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } return 1; err: - fprintf(stderr, "Cannot load IPMI library (%s) : %s. IPMI search disabled.\n", libname_path, dl_error); + fprintf(stderr, "Cannot load IPMI library (%s) : %s. IPMI search disabled.\n", libname, dl_error); dl_handle = (void *)1; lt_dlexit(); return 0; @@ -286,12 +276,12 @@ static void nut_freeipmi_cleanup(ipmi_fru_parse_ctx_t fru_parse_ctx, } /* Return 1 if supported, 0 otherwise */ -static int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id) +int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id) { int ret = -1; unsigned int area_type = 0; unsigned int area_length = 0; - uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX + 1]; + uint8_t areabuf[IPMI_FRU_AREA_SIZE_MAX+1]; ipmi_fru_parse_ctx_t fru_parse_ctx = NULL; #ifdef HAVE_FREEIPMI_11X_12X ipmi_sdr_ctx_t sdr_ctx = NULL; @@ -318,11 +308,7 @@ static int is_ipmi_device_supported(ipmi_ctx_t ipmi_ctx, int ipmi_id) return 0; } - if (ipmi_id < 0 || (unsigned int)ipmi_id > UINT8_MAX) { - fprintf(stderr, "is_ipmi_device_supported: ipmi_id=%d is out of range!\n", ipmi_id); - return 0; - } - if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, (uint8_t)ipmi_id) < 0) + if ((*nut_ipmi_fru_open_device_id) (fru_parse_ctx, ipmi_id) < 0) { #ifdef HAVE_FREEIPMI_11X_12X nut_freeipmi_cleanup(fru_parse_ctx, sdr_ctx); @@ -389,7 +375,7 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t int ipmi_id = 0; char port_id[64]; - if (!nutscan_avail_ipmi) { + if( !nutscan_avail_ipmi ) { return NULL; } @@ -397,12 +383,12 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t if (!(ipmi_ctx = (*nut_ipmi_ctx_create) ())) { /* we have to force cleanup, since exit handler is not yet installed */ - fprintf(stderr, "Failed to ipmi_ctx_create\n"); + fprintf(stderr, "ipmi_ctx_create\n"); return NULL; } /* Are we scanning locally, or over the network? */ - if (IPaddr == NULL) + if (IPaddr == NULL) { /* FIXME: we need root right to access local IPMI! if (!ipmi_is_root ()) { @@ -419,7 +405,7 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t 0 /* flags */ )) < 0) { - upsdebugx(2, "ipmi_ctx_find_inband (local scan): %s", + fprintf(stderr, "ipmi_ctx_find_inband: %s\n", (*nut_ipmi_ctx_errormsg) (ipmi_ctx)); return NULL; } @@ -446,7 +432,7 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t ipmi_sec->username, ipmi_sec->password, ipmi_sec->K_g_BMC_key, -/*???*/ (ipmi_sec->K_g_BMC_key) ? config->k_g_len : 0, +??? (ipmi_sec->K_g_BMC_key) ? config->k_g_len : 0, ipmi_sec->privilege_level, ipmi_sec->cipher_suite_id, IPMI_SESSION_TIMEOUT_LENGTH_DEFAULT, @@ -454,11 +440,7 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t ipmi_dev->workaround_flags, flags) < 0) { - upsdebugx(2, "nut_ipmi_ctx_open_outofband_2_0 (%s): %s", - IPaddr, (*nut_ipmi_ctx_errormsg) (c->ipmi_ctx)); - IPMI_MONITORING_DEBUG (("ipmi_ctx_open_outofband_2_0 (%s): %s", - IPaddr, ipmi_ctx_errormsg (c->ipmi_ctx))); - + IPMI_MONITORING_DEBUG (("ipmi_ctx_open_outofband_2_0: %s", ipmi_ctx_errormsg (c->ipmi_ctx))); if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_USERNAME_INVALID) c->errnum = IPMI_MONITORING_ERR_USERNAME_INVALID; else if (ipmi_ctx_errnum (c->ipmi_ctx) == IPMI_ERR_PASSWORD_INVALID) @@ -502,28 +484,12 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t #endif /* 0 */ /* Fall back to IPMI 1.5 */ - if (ipmi_sec->authentication_type < 0 - || (unsigned int)ipmi_sec->authentication_type > UINT8_MAX - ) { - upsdebugx(2, "nutscan_scan_ipmi_device (%s): " - "authentication_type=%d is out of range!", - IPaddr, ipmi_sec->authentication_type); - return 0; - } - if (ipmi_sec->privilege_level < 0 - || (unsigned int)ipmi_sec->privilege_level > UINT8_MAX - ) { - upsdebugx(2, "nutscan_scan_ipmi_device (%s): " - "privilege_level=%d is out of range!", - IPaddr, ipmi_sec->privilege_level); - return 0; - } if ((ret = (*nut_ipmi_ctx_open_outofband) (ipmi_ctx, IPaddr, ipmi_sec->username, ipmi_sec->password, - (uint8_t)ipmi_sec->authentication_type, - (uint8_t)ipmi_sec->privilege_level, + ipmi_sec->authentication_type, + ipmi_sec->privilege_level, IPMI_SESSION_TIMEOUT_LENGTH_DEFAULT, IPMI_RETRANSMISSION_TIMEOUT_LENGTH_DEFAULT, ipmi_sec->workaround_flags, @@ -541,8 +507,8 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t || (*nut_ipmi_ctx_errnum) (ipmi_ctx) == IPMI_ERR_CONNECTION_TIMEOUT) { */ /* FIXME: don't log timeout errors */ - upsdebugx(2, "nut_ipmi_ctx_open_outofband (%s): %s", - IPaddr, (*nut_ipmi_ctx_errormsg) (ipmi_ctx)); + fprintf(stderr, "nut_ipmi_ctx_open_outofband: %s\n", + (*nut_ipmi_ctx_errormsg) (ipmi_ctx)); return NULL; /*}*/ } @@ -553,8 +519,8 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t if (is_ipmi_device_supported(ipmi_ctx, ipmi_id)) { - if ((nut_dev = nutscan_new_device()) == NULL) { - fprintf(stderr, "Memory allocation error\n"); + if ( (nut_dev = nutscan_new_device()) == NULL ) { + fprintf(stderr,"Memory allocation error\n"); nutscan_free_device(current_nut_dev); break; } @@ -572,14 +538,13 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t nut_dev->port = strdup(port_id); /* FIXME: also dump device.serial? * using drivers/libfreeipmi_get_board_info() */ - + current_nut_dev = nutscan_add_device_to_device( current_nut_dev, nut_dev); memset (port_id, 0, sizeof(port_id)); } - } /* Final cleanup */ @@ -602,13 +567,13 @@ nutscan_device_t * nutscan_scan_ipmi(const char * start_ip, const char * stop_ip nutscan_device_t * nut_dev = NULL; nutscan_device_t * current_nut_dev = NULL; - if (!nutscan_avail_ipmi) { + if( !nutscan_avail_ipmi ) { return NULL; } /* Are we scanning locally, or through the network? */ - if (start_ip == NULL) + if (start_ip == NULL) { /* Local PSU scan */ current_nut_dev = nutscan_scan_ipmi_device(NULL, NULL); @@ -616,7 +581,7 @@ nutscan_device_t * nutscan_scan_ipmi(const char * start_ip, const char * stop_ip else { ip_str = nutscan_ip_iter_init(&ip, start_ip, stop_ip); - while (ip_str != NULL) { + while(ip_str != NULL) { tmp_sec = malloc(sizeof(nutscan_ipmi_t)); memcpy(tmp_sec, sec, sizeof(nutscan_ipmi_t)); @@ -626,7 +591,7 @@ nutscan_device_t * nutscan_scan_ipmi(const char * start_ip, const char * stop_ip } /* Prepare the next iteration */ ip_str = nutscan_ip_iter_inc(&ip); - } + }; } return nutscan_rewind_device(current_nut_dev); @@ -635,10 +600,6 @@ nutscan_device_t * nutscan_scan_ipmi(const char * start_ip, const char * stop_ip /* stub function */ nutscan_device_t * nutscan_scan_ipmi(const char * startIP, const char * stopIP, nutscan_ipmi_t * sec) { - NUT_UNUSED_VARIABLE(startIP); - NUT_UNUSED_VARIABLE(stopIP); - NUT_UNUSED_VARIABLE(sec); - return NULL; } #endif /* WITH_IPMI */ diff --git a/tools/nut-scanner/scan_nut.c b/tools/nut-scanner/scan_nut.c index a0f2b3e..005cfe6 100644 --- a/tools/nut-scanner/scan_nut.c +++ b/tools/nut-scanner/scan_nut.c @@ -1,6 +1,6 @@ -/* - * Copyright (C) 2011 - EATON - * Copyright (C) 2016-2021 - EATON - Various threads-related improvements +/* scan_nut.c: detect remote NUT services + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,28 +17,26 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file scan_nut.c - \brief detect remote NUT services - \author Frederic Bohe - \author Jim Klimov -*/ - #include "common.h" #include "upsclient.h" #include "nut-scan.h" +#ifdef HAVE_PTHREAD +#include +#endif #include /* dynamic link library stuff */ +static char * libname = "libupsclient"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; -static int (*nut_upscli_splitaddr)(const char *buf, char **hostname, int *port); +static int (*nut_upscli_splitaddr)(const char *buf,char **hostname, int *port); static int (*nut_upscli_tryconnect)(UPSCONN_t *ups, const char *host, int port, - int flags, struct timeval * timeout); -static int (*nut_upscli_list_start)(UPSCONN_t *ups, size_t numq, + int flags,struct timeval * timeout); +static int (*nut_upscli_list_start)(UPSCONN_t *ups, unsigned int numq, const char **query); -static int (*nut_upscli_list_next)(UPSCONN_t *ups, size_t numq, - const char **query, size_t *numa, char ***answer); +static int (*nut_upscli_list_next)(UPSCONN_t *ups, unsigned int numq, + const char **query,unsigned int *numa, char ***answer); static int (*nut_upscli_disconnect)(UPSCONN_t *ups); static nutscan_device_t * dev_ret = NULL; @@ -46,85 +44,73 @@ static nutscan_device_t * dev_ret = NULL; static pthread_mutex_t dev_mutex; #endif -/* use explicit booleans */ -#ifndef FALSE -typedef enum ebool { FALSE = 0, TRUE } bool_t; -#else -typedef int bool_t; -#endif - struct scan_nut_arg { char * hostname; - useconds_t timeout; + long timeout; }; -/* return 0 on error; visible externally */ -int nutscan_load_upsclient_library(const char *libname_path); -int nutscan_load_upsclient_library(const char *libname_path) +/* return 0 on error */ +int nutscan_load_upsclient_library() { - if (dl_handle != NULL) { - /* if previous init failed */ - if (dl_handle == (void *)1) { - return 0; - } - /* init has already been done */ - return 1; - } - if (libname_path == NULL) { - fprintf(stderr, "NUT client library not found. NUT search disabled.\n"); - return 0; - } + if( dl_handle != NULL ) { + /* if previous init failed */ + if( dl_handle == (void *)1 ) { + return 0; + } + /* init has already been done */ + return 1; + } - if (lt_dlinit() != 0) { - fprintf(stderr, "Error initializing lt_init\n"); - return 0; - } + if( lt_dlinit() != 0 ) { + fprintf(stderr, "Error initializing lt_init\n"); + return 0; + } - dl_handle = lt_dlopen(libname_path); - if (!dl_handle) { - dl_error = lt_dlerror(); - goto err; - } + dl_handle = lt_dlopenext(libname); + if (!dl_handle) { + dl_error = lt_dlerror(); + goto err; + } - lt_dlerror(); /* Clear any existing error */ + lt_dlerror(); /* Clear any existing error */ - *(void **) (&nut_upscli_splitaddr) = lt_dlsym(dl_handle, - "upscli_splitaddr"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_upscli_splitaddr) = lt_dlsym(dl_handle, + "upscli_splitaddr"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_upscli_tryconnect) = lt_dlsym(dl_handle, - "upscli_tryconnect"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_upscli_tryconnect) = lt_dlsym(dl_handle, + "upscli_tryconnect"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_upscli_list_start) = lt_dlsym(dl_handle, - "upscli_list_start"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_upscli_list_start) = lt_dlsym(dl_handle, + "upscli_list_start"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_upscli_list_next) = lt_dlsym(dl_handle, - "upscli_list_next"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_upscli_list_next) = lt_dlsym(dl_handle, + "upscli_list_next"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_upscli_disconnect) = lt_dlsym(dl_handle, - "upscli_disconnect"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_upscli_disconnect) = lt_dlsym(dl_handle, + "upscli_disconnect"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - return 1; + return 1; err: - fprintf(stderr, "Cannot load NUT library (%s) : %s. NUT search disabled.\n", libname_path, dl_error); - dl_handle = (void *)1; + fprintf(stderr, "Cannot load NUT library (%s) : %s. NUT search disabled.\n", libname, dl_error); + dl_handle = (void *)1; lt_dlexit(); - return 0; + return 0; } /* FIXME: SSL support */ @@ -134,13 +120,13 @@ static void * list_nut_devices(void * arg) char *target_hostname = nut_arg->hostname; struct timeval tv; int port; - size_t numq, numa; + unsigned int numq, numa; const char *query[4]; char **answer; char *hostname = NULL; UPSCONN_t *ups = malloc(sizeof(*ups)); nutscan_device_t * dev = NULL; - size_t buf_size; + int buf_size; tv.tv_sec = nut_arg->timeout / (1000*1000); tv.tv_usec = nut_arg->timeout % (1000*1000); @@ -155,14 +141,14 @@ static void * list_nut_devices(void * arg) return NULL; } - if ((*nut_upscli_tryconnect)(ups, hostname, port, UPSCLI_CONN_TRYSSL, &tv) < 0) { + if ((*nut_upscli_tryconnect)(ups, hostname, port,UPSCLI_CONN_TRYSSL,&tv) < 0) { free(target_hostname); free(nut_arg); free(ups); return NULL; } - if ((*nut_upscli_list_start)(ups, numq, query) < 0) { + if((*nut_upscli_list_start)(ups, numq, query) < 0) { (*nut_upscli_disconnect)(ups); free(target_hostname); free(nut_arg); @@ -170,7 +156,7 @@ static void * list_nut_devices(void * arg) return NULL; } - while ((*nut_upscli_list_next)(ups, numq, query, &numa, &answer) == 1) { + while ((*nut_upscli_list_next)(ups,numq, query, &numa, &answer) == 1) { /* UPS */ if (numa < 3) { (*nut_upscli_disconnect)(ups); @@ -184,25 +170,26 @@ static void * list_nut_devices(void * arg) /* FIXME: * - also print answer[2] if != "Unavailable"? * - for upsmon.conf or ups.conf (using dummy-ups)? */ - dev = nutscan_new_device(); - dev->type = TYPE_NUT; - dev->driver = strdup("nutclient"); - /* +1+1 is for '@' character and terminating 0 */ - buf_size = strlen(answer[1]) + strlen(hostname) + 1 + 1; - dev->port = malloc(buf_size); + if (numa >= 3) { + dev = nutscan_new_device(); + dev->type = TYPE_NUT; + dev->driver = strdup("nutclient"); + /* +1+1 is for '@' character and terminating 0 */ + buf_size = strlen(answer[1])+strlen(hostname)+1+1; + dev->port = malloc(buf_size); + if( dev->port ) { + snprintf(dev->port,buf_size,"%s@%s",answer[1], + hostname); +#ifdef HAVE_PTHREAD + pthread_mutex_lock(&dev_mutex); +#endif + dev_ret = nutscan_add_device_to_device(dev_ret,dev); +#ifdef HAVE_PTHREAD + pthread_mutex_unlock(&dev_mutex); +#endif + } - if (dev->port) { - snprintf(dev->port, buf_size, "%s@%s", answer[1], - hostname); -#ifdef HAVE_PTHREAD - pthread_mutex_lock(&dev_mutex); -#endif - dev_ret = nutscan_add_device_to_device(dev_ret, dev); -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&dev_mutex); -#endif } - } (*nut_upscli_disconnect)(ups); @@ -212,330 +199,85 @@ static void * list_nut_devices(void * arg) return NULL; } -nutscan_device_t * nutscan_scan_nut(const char* startIP, const char* stopIP, const char* port, useconds_t usec_timeout) +nutscan_device_t * nutscan_scan_nut(const char* startIP, const char* stopIP, const char* port,long usec_timeout) { - bool_t pass = TRUE; /* Track that we may spawn a scanning thread */ nutscan_ip_iter_t ip; char * ip_str = NULL; char * ip_dest = NULL; char buf[SMALLBUF]; struct sigaction oldact; int change_action_handler = 0; + int i; struct scan_nut_arg *nut_arg; #ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - sem_t * semaphore = nutscan_semaphore(); - sem_t semaphore_scantype_inst; - sem_t * semaphore_scantype = &semaphore_scantype_inst; -# endif /* HAVE_SEMAPHORE */ pthread_t thread; - nutscan_thread_t * thread_array = NULL; - size_t thread_count = 0, i; -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) - size_t max_threads_scantype = max_threads_oldnut; -# endif + pthread_t * thread_array = NULL; + int thread_count = 0; - pthread_mutex_init(&dev_mutex, NULL); + pthread_mutex_init(&dev_mutex,NULL); +#endif -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) { -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic ignored "-Wunreachable-code" -#endif -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunreachable-code" -#endif - /* Different platforms, different sizes, none fits all... */ - if (SIZE_MAX > UINT_MAX && max_threads_scantype > UINT_MAX) { -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#ifdef HAVE_PRAGMAS_FOR_GCC_DIAGNOSTIC_IGNORED_UNREACHABLE_CODE -#pragma GCC diagnostic pop -#endif - upsdebugx(1, - "WARNING: %s: Limiting max_threads_scantype to range acceptable for sem_init()", - __func__); - max_threads_scantype = UINT_MAX - 1; - } - sem_init(semaphore_scantype, 0, (unsigned int)max_threads_scantype); - } -# endif /* HAVE_SEMAPHORE */ - -#endif /* HAVE_PTHREAD */ - - if (!nutscan_avail_nut) { - return NULL; - } + if( !nutscan_avail_nut ) { + return NULL; + } /* Ignore SIGPIPE if the caller hasn't set a handler for it yet */ - if (sigaction(SIGPIPE, NULL, &oldact) == 0) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif - if (oldact.sa_handler == SIG_DFL) { + if( sigaction(SIGPIPE, NULL, &oldact) == 0 ) { + if( oldact.sa_handler == SIG_DFL ) { change_action_handler = 1; - signal(SIGPIPE, SIG_IGN); + signal(SIGPIPE,SIG_IGN); } -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop -#endif } - ip_str = nutscan_ip_iter_init(&ip, startIP, stopIP); + ip_str = nutscan_ip_iter_init(&ip,startIP,stopIP); - while (ip_str != NULL) { -#ifdef HAVE_PTHREAD - /* NOTE: With many enough targets to scan, this can crash - * by spawning too many children; add a limit and loop to - * "reap" some already done with their work. And probably - * account them in thread_array[] as something to not wait - * for below in pthread_join()... - */ - -# ifdef HAVE_SEMAPHORE - /* Just wait for someone to free a semaphored slot, - * if none are available, and then/otherwise grab one - */ - if (thread_array == NULL) { - /* Starting point, or after a wait to complete - * all earlier runners */ - if (max_threads_scantype > 0) - sem_wait(semaphore_scantype); - sem_wait(semaphore); - pass = TRUE; - } else { - pass = ((max_threads_scantype == 0 || sem_trywait(semaphore_scantype) == 0) && - sem_trywait(semaphore) == 0); - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* A somewhat naive and brute-force solution for - * systems without a semaphore.h. This may suffer - * some off-by-one errors, using a few more threads - * than intended (if we race a bit at the wrong time, - * probably up to one per enabled scanner routine). - */ - - /* TOTHINK: Should there be a threadcount_mutex when - * we just read the value in if() and while() below? - * At worst we would overflow the limit a bit due to - * other protocol scanners... - */ - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - upsdebugx(2, "%s: already running %zu scanning threads " - "(launched overall: %zu), " - "waiting until some would finish", - __func__, curr_threads, thread_count); - while (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - for (i = 0; i < thread_count ; i++) { - int ret; - - if (!thread_array[i].active) continue; - - pthread_mutex_lock(&threadcount_mutex); - upsdebugx(3, "%s: Trying to join thread #%i...", __func__, i); - ret = pthread_tryjoin_np(thread_array[i].thread, NULL); - switch (ret) { - case ESRCH: /* No thread with the ID thread could be found - already "joined"? */ - upsdebugx(5, "%s: Was thread #%zu joined earlier?", __func__, i); - break; - case 0: /* thread exited */ - if (curr_threads > 0) { - curr_threads --; - upsdebugx(4, "%s: Joined a finished thread #%zu", __func__, i); - } else { - /* threadcount_mutex fault? */ - upsdebugx(0, "WARNING: %s: Accounting of thread count " - "says we are already at 0", __func__); - } - thread_array[i].active = FALSE; - break; - case EBUSY: /* actively running */ - upsdebugx(6, "%s: thread #%zu still busy (%i)", - __func__, i, ret); - break; - case EDEADLK: /* Errors with thread interactions... bail out? */ - case EINVAL: /* Errors with thread interactions... bail out? */ - default: /* new pthreads abilities? */ - upsdebugx(5, "%s: thread #%zu reported code %i", - __func__, i, ret); - break; - } - pthread_mutex_unlock(&threadcount_mutex); - } - - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - usleep (10000); /* microSec's, so 0.01s here */ - } - } - upsdebugx(2, "%s: proceeding with scan", __func__); - } - /* NOTE: No change to default "pass" in this ifdef: - * if we got to this line, we have a slot to use */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - if (pass) { - if (port) { - if (ip.type == IPv4) { - snprintf(buf, sizeof(buf), "%s:%s", ip_str, port); - } - else { - snprintf(buf, sizeof(buf), "[%s]:%s", ip_str, port); - } - - ip_dest = strdup(buf); + while( ip_str != NULL ) + { + if( port ) { + if( ip.type == IPv4 ) { + snprintf(buf,sizeof(buf),"%s:%s",ip_str,port); } else { - ip_dest = strdup(ip_str); + snprintf(buf,sizeof(buf),"[%s]:%s",ip_str,port); } - if ((nut_arg = malloc(sizeof(struct scan_nut_arg))) == NULL) { - free(ip_dest); - break; - } - - nut_arg->timeout = usec_timeout; - nut_arg->hostname = ip_dest; - -#ifdef HAVE_PTHREAD - if (pthread_create(&thread, NULL, list_nut_devices, (void*)nut_arg) == 0) { -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - curr_threads++; -# endif /* HAVE_PTHREAD_TRYJOIN */ - - thread_count++; - nutscan_thread_t *new_thread_array = realloc(thread_array, - thread_count * sizeof(nutscan_thread_t)); - if (new_thread_array == NULL) { - upsdebugx(1, "%s: Failed to realloc thread array", __func__); - break; - } - else { - thread_array = new_thread_array; - } - thread_array[thread_count - 1].thread = thread; - thread_array[thread_count - 1].active = TRUE; - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ - } -#else /* not HAVE_PTHREAD */ - list_nut_devices(nut_arg); -#endif /* if HAVE_PTHREAD */ - free(ip_str); - ip_str = nutscan_ip_iter_inc(&ip); - } else { /* if not pass -- all slots busy */ -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - /* Wait for all current scans to complete */ - if (thread_array != NULL) { - upsdebugx (2, "%s: Running too many scanning threads, " - "waiting until older ones would finish", - __func__); - for (i = 0; i < thread_count ; i++) { - int ret; - if (!thread_array[i].active) { - /* Probably should not get here, - * but handle it just in case */ - upsdebugx(0, "WARNING: %s: Midway clean-up: did not expect thread %zu to be not active", - __func__, i); - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - continue; - } - thread_array[i].active = FALSE; - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Midway clean-up: pthread_join() returned code %i", - __func__, ret); - } - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - } - thread_count = 0; - free(thread_array); - thread_array = NULL; - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* TODO: Move the wait-loop for TRYJOIN here? */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - } /* if: could we "pass" or not? */ - } /* while */ - -#ifdef HAVE_PTHREAD - if (thread_array != NULL) { - upsdebugx(2, "%s: all planned scans launched, waiting for threads to complete", __func__); - for (i = 0; i < thread_count; i++) { - int ret; - - if (!thread_array[i].active) continue; - - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Clean-up: pthread_join() returned code %i", - __func__, ret); - } - thread_array[i].active = FALSE; -# ifdef HAVE_SEMAPHORE - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); -# else -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - if (curr_threads > 0) { - curr_threads --; - upsdebugx(5, "%s: Clean-up: Joined a finished thread #%zu", - __func__, i); - } else { - upsdebugx(0, "WARNING: %s: Clean-up: Accounting of thread count " - "says we are already at 0", __func__); - } - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ + ip_dest = strdup(buf); } - free(thread_array); - upsdebugx(2, "%s: all threads freed", __func__); + else { + ip_dest = strdup(ip_str); + } + + if((nut_arg = malloc(sizeof(struct scan_nut_arg))) == NULL ) { + free(ip_dest); + break; + } + + nut_arg->timeout = usec_timeout; + nut_arg->hostname = ip_dest; +#ifdef HAVE_PTHREAD + if (pthread_create(&thread,NULL,list_nut_devices,(void*)nut_arg)==0){ + thread_count++; + thread_array = realloc(thread_array, + thread_count*sizeof(pthread_t)); + thread_array[thread_count-1] = thread; + } +#else + list_nut_devices(nut_arg); +#endif + free(ip_str); + ip_str = nutscan_ip_iter_inc(&ip); + } + +#ifdef HAVE_PTHREAD + for ( i=0; i < thread_count ; i++) { + pthread_join(thread_array[i],NULL); } pthread_mutex_destroy(&dev_mutex); - -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) - sem_destroy(semaphore_scantype); -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - if (change_action_handler) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-prototypes" -#endif - signal(SIGPIPE, SIG_DFL); -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_STRICT_PROTOTYPES) -# pragma GCC diagnostic pop + free(thread_array); #endif + + if(change_action_handler) { + signal(SIGPIPE,SIG_DFL); } return nutscan_rewind_device(dev_ret); diff --git a/tools/nut-scanner/scan_snmp.c b/tools/nut-scanner/scan_snmp.c index 48bdaaa..0fcb9a6 100644 --- a/tools/nut-scanner/scan_snmp.c +++ b/tools/nut-scanner/scan_snmp.c @@ -1,6 +1,6 @@ -/* - * Copyright (C) 2011 - EATON - * Copyright (C) 2016-2021 - EATON - Various threads-related improvements +/* scan_snmp.c: detect NUT supported SNMP devices + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,13 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file scan_snmp.c - \brief detect NUT supported SNMP devices - \author Frederic Bohe - \author Arnaud Quette - \author Jim Klimov -*/ - #include "common.h" #include "nut-scan.h" @@ -58,10 +51,13 @@ #include #include +#ifdef HAVE_PTHREAD +#include +#endif #include "nutscan-snmp.h" /* Address API change */ -#if ( ! NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol ) && ( ! defined usmAESPrivProtocol ) +#ifndef usmAESPrivProtocol #define USMAESPRIVPROTOCOL "usmAES128PrivProtocol" #else #define USMAESPRIVPROTOCOL "usmAESPrivProtocol" @@ -69,20 +65,16 @@ #define SysOID ".1.3.6.1.2.1.1.2.0" -/* use explicit booleans */ -#ifndef FALSE -typedef enum ebool { FALSE = 0, TRUE } bool_t; -#else -typedef int bool_t; -#endif - static nutscan_device_t * dev_ret = NULL; #ifdef HAVE_PTHREAD static pthread_mutex_t dev_mutex; +static pthread_t * thread_array = NULL; +static int thread_count = 0; #endif -static useconds_t g_usec_timeout ; +long g_usec_timeout ; /* dynamic link library stuff */ +static char * libname = "libnetsnmp"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -90,86 +82,44 @@ static void (*nut_init_snmp)(const char *type); static void (*nut_snmp_sess_init)(netsnmp_session * session); static void * (*nut_snmp_sess_open)(struct snmp_session *session); static int (*nut_snmp_sess_close)(void *handle); -static struct snmp_session * (*nut_snmp_sess_session)(void *handle); +static struct snmp_session * (*nut_snmp_sess_session)(void *handle); static void * (*nut_snmp_parse_oid)(const char *input, oid *objid, size_t *objidlen); -static struct snmp_pdu * (*nut_snmp_pdu_create) (int command); -static netsnmp_variable_list * (*nut_snmp_add_null_var)(netsnmp_pdu *pdu, +static struct snmp_pdu * (*nut_snmp_pdu_create) (int command ); +netsnmp_variable_list * (*nut_snmp_add_null_var)(netsnmp_pdu *pdu, const oid *objid, size_t objidlen); static int (*nut_snmp_sess_synch_response) (void *sessp, netsnmp_pdu *pdu, netsnmp_pdu **response); static int (*nut_snmp_oid_compare) (const oid *in_name1, size_t len1, const oid *in_name2, size_t len2); static void (*nut_snmp_free_pdu) (netsnmp_pdu *pdu); - -/* NOTE: Net-SNMP headers just are weird like that, in the same release: -net-snmp/types.h: size_t securityAuthProtoLen; -net-snmp/library/keytools.h: int generate_Ku(const oid * hashtype, u_int hashtype_len, ... - * Should we match in configure like for "getnameinfo()" arg types? - * Currently we cast one to another below (detecting target type could help). - */ static int (*nut_generate_Ku)(const oid * hashtype, u_int hashtype_len, - unsigned char * P, size_t pplen, unsigned char * Ku, size_t * kulen); -static char* (*nut_snmp_out_toggle_options)(char *options); + u_char * P, size_t pplen, u_char * Ku, size_t * kulen); static const char * (*nut_snmp_api_errstring) (int snmp_errnumber); +static int (*nut_snmp_errno); +static oid * (*nut_usmAESPrivProtocol); +static oid * (*nut_usmHMACMD5AuthProtocol); +static oid * (*nut_usmHMACSHA1AuthProtocol); +static oid * (*nut_usmDESPrivProtocol); -/* Variables (not methods) exported by libnet-snmp: */ -static int *nut_snmp_errno; -#if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol -static oid *nut_usmAESPrivProtocol; /* might be usmAES128PrivProtocol on some systems */ -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol -static oid *nut_usmHMACMD5AuthProtocol; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol -static oid *nut_usmHMACSHA1AuthProtocol; -#endif -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol -static oid *nut_usmDESPrivProtocol; -#endif -#if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol -static oid *nut_usmAES192PrivProtocol; -# endif -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol -static oid *nut_usmAES256PrivProtocol; -# endif -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol -static oid *nut_usmHMAC192SHA256AuthProtocol; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol -static oid *nut_usmHMAC256SHA384AuthProtocol; -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol -static oid *nut_usmHMAC384SHA512AuthProtocol; -#endif - -/* return 0 on error; visible externally */ -int nutscan_load_snmp_library(const char *libname_path); - -int nutscan_load_snmp_library(const char *libname_path) +/* return 0 on error */ +int nutscan_load_snmp_library() { - if (dl_handle != NULL) { + if( dl_handle != NULL ) { /* if previous init failed */ - if (dl_handle == (void *)1) { + if( dl_handle == (void *)1 ) { return 0; } /* init has already been done */ return 1; } - if (libname_path == NULL) { - upsdebugx(1, "SNMP library not found. SNMP search disabled"); - return 0; - } + if( lt_dlinit() != 0 ) { + fprintf(stderr, "Error initializing lt_init\n"); + return 0; + } - if (lt_dlinit() != 0) { - upsdebugx(1, "Error initializing lt_init"); - return 0; - } - - dl_handle = lt_dlopen(libname_path); + dl_handle = lt_dlopenext(libname); if (!dl_handle) { dl_error = lt_dlerror(); goto err; @@ -177,184 +127,126 @@ int nutscan_load_snmp_library(const char *libname_path) lt_dlerror(); /* Clear any existing error */ *(void **) (&nut_init_snmp) = lt_dlsym(dl_handle, "init_snmp"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_sess_init) = lt_dlsym(dl_handle, "snmp_sess_init"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_sess_open) = lt_dlsym(dl_handle, "snmp_sess_open"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_sess_close) = lt_dlsym(dl_handle, "snmp_sess_close"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_sess_session) = lt_dlsym(dl_handle, "snmp_sess_session"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_parse_oid) = lt_dlsym(dl_handle, "snmp_parse_oid"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_pdu_create) = lt_dlsym(dl_handle, "snmp_pdu_create"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_add_null_var) = lt_dlsym(dl_handle, "snmp_add_null_var"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_sess_synch_response) = lt_dlsym(dl_handle, "snmp_sess_synch_response"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_oid_compare) = lt_dlsym(dl_handle, "snmp_oid_compare"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } - *(void **) (&nut_snmp_free_pdu) = lt_dlsym(dl_handle, "snmp_free_pdu"); - if ((dl_error = lt_dlerror()) != NULL) { + *(void **) (&nut_snmp_free_pdu) = lt_dlsym(dl_handle,"snmp_free_pdu"); + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_generate_Ku) = lt_dlsym(dl_handle, "generate_Ku"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_snmp_out_toggle_options) = lt_dlsym(dl_handle, - "snmp_out_toggle_options"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_api_errstring) = lt_dlsym(dl_handle, "snmp_api_errstring"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } *(void **) (&nut_snmp_errno) = lt_dlsym(dl_handle, "snmp_errno"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } -#if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol *(void **) (&nut_usmAESPrivProtocol) = lt_dlsym(dl_handle, USMAESPRIVPROTOCOL); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } -#endif /* NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol */ -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol *(void **) (&nut_usmHMACMD5AuthProtocol) = lt_dlsym(dl_handle, "usmHMACMD5AuthProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } -#endif /* NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol */ -#if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol *(void **) (&nut_usmHMACSHA1AuthProtocol) = lt_dlsym(dl_handle, "usmHMACSHA1AuthProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } -#endif /* NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol */ -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol *(void **) (&nut_usmDESPrivProtocol) = lt_dlsym(dl_handle, "usmDESPrivProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { + if ((dl_error = lt_dlerror()) != NULL) { goto err; } -#endif /* NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol */ - -#if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - *(void **) (&nut_usmAES192PrivProtocol) = lt_dlsym(dl_handle, - "usmAES192PrivProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -# endif /* NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol */ - -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - *(void **) (&nut_usmAES256PrivProtocol) = lt_dlsym(dl_handle, - "usmAES256PrivProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -# endif /* NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol */ -#endif /* NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 */ - -#if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - *(void **) (&nut_usmHMAC192SHA256AuthProtocol) = lt_dlsym(dl_handle, - "usmHMAC192SHA256AuthProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -#endif /* NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol */ - -#if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - *(void **) (&nut_usmHMAC256SHA384AuthProtocol) = lt_dlsym(dl_handle, - "usmHMAC256SHA384AuthProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -#endif /* NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol */ - -#if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - *(void **) (&nut_usmHMAC384SHA512AuthProtocol) = lt_dlsym(dl_handle, - "usmHMAC384SHA512AuthProtocol"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -#endif /* NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol */ return 1; - err: - fprintf(stderr, "Cannot load SNMP library (%s) : %s. SNMP search disabled.\n", - libname_path, dl_error); + fprintf(stderr, "Cannot load SNMP library (%s) : %s. SNMP search disabled.\n", libname, dl_error); dl_handle = (void *)1; lt_dlexit(); return 0; } /* end of dynamic link library stuff */ -static void scan_snmp_add_device(nutscan_snmp_t * sec, struct snmp_pdu *response, char * mib) +static void scan_snmp_add_device(nutscan_snmp_t * sec, struct snmp_pdu *response,char * mib) { nutscan_device_t * dev = NULL; struct snmp_session * session; char * buf; session = (*nut_snmp_sess_session)(sec->handle); - if (session == NULL) { + if(session == NULL) { return; } /* SNMP device found */ @@ -362,53 +254,49 @@ static void scan_snmp_add_device(nutscan_snmp_t * sec, struct snmp_pdu *response dev->type = TYPE_SNMP; dev->driver = strdup("snmp-ups"); dev->port = strdup(session->peername); - if (response != NULL) { - buf = malloc (response->variables->val_len + 1); - if (buf) { - memcpy(buf, response->variables->val.string, - response->variables->val_len); - buf[response->variables->val_len] = 0; - nutscan_add_option_to_device(dev, "desc", buf); - free(buf); - } + buf = malloc( response->variables->val_len + 1 ); + if( buf ) { + memcpy(buf,response->variables->val.string, + response->variables->val_len); + buf[response->variables->val_len]=0; + nutscan_add_option_to_device(dev,"desc",buf); + free(buf); } - nutscan_add_option_to_device(dev, "mibs", mib); + nutscan_add_option_to_device(dev,"mibs",mib); /* SNMP v3 */ - if (session->community == NULL || session->community[0] == 0) { - nutscan_add_option_to_device(dev, "snmp_version", "v3"); - - if (sec->secLevel) { - nutscan_add_option_to_device(dev, "secLevel", - sec->secLevel); + if( session->community == NULL || session->community[0] == 0) { + if( sec->secLevel ) { + nutscan_add_option_to_device(dev,"secLevel", + sec->secLevel); } - if (sec->secName) { - nutscan_add_option_to_device(dev, "secName", - sec->secName); + if( sec->secName ) { + nutscan_add_option_to_device(dev,"secName", + sec->secName); } - if (sec->authPassword) { - nutscan_add_option_to_device(dev, "authPassword", - sec->authPassword); + if( sec->authPassword ) { + nutscan_add_option_to_device(dev,"authPassword", + sec->authPassword); } - if (sec->privPassword) { - nutscan_add_option_to_device(dev, "privPassword", - sec->privPassword); + if( sec->privPassword ) { + nutscan_add_option_to_device(dev,"privPassword", + sec->privPassword); } - if (sec->authProtocol) { - nutscan_add_option_to_device(dev, "authProtocol", - sec->authProtocol); + if( sec->authProtocol ) { + nutscan_add_option_to_device(dev,"authProtocol", + sec->authProtocol); } - if (sec->privProtocol) { - nutscan_add_option_to_device(dev, "privProtocol", - sec->privProtocol); + if( sec->privProtocol ) { + nutscan_add_option_to_device(dev,"privProtocol", + sec->privProtocol); } } else { - buf = malloc (session->community_len + 1); - if (buf) { - memcpy(buf, session->community, + buf = malloc( session->community_len + 1 ); + if( buf ) { + memcpy(buf,session->community, session->community_len); - buf[session->community_len] = 0; - nutscan_add_option_to_device(dev, "community", buf); + buf[session->community_len]=0; + nutscan_add_option_to_device(dev,"community",buf); free(buf); } } @@ -416,17 +304,17 @@ static void scan_snmp_add_device(nutscan_snmp_t * sec, struct snmp_pdu *response #ifdef HAVE_PTHREAD pthread_mutex_lock(&dev_mutex); #endif - dev_ret = nutscan_add_device_to_device(dev_ret, dev); + dev_ret = nutscan_add_device_to_device(dev_ret,dev); #ifdef HAVE_PTHREAD pthread_mutex_unlock(&dev_mutex); #endif } -static struct snmp_pdu * scan_snmp_get_oid(char* oid_str, void* handle) +static struct snmp_pdu * scan_snmp_get_manufacturer(char* oid_str,void* handle) { - size_t name_len; - oid name[MAX_OID_LEN]; + size_t name_len; + oid name[MAX_OID_LEN]; struct snmp_pdu *pdu, *response = NULL; int status; int index = 0; @@ -447,21 +335,19 @@ static struct snmp_pdu * scan_snmp_get_oid(char* oid_str, void* handle) (*nut_snmp_add_null_var)(pdu, name, name_len); - status = (*nut_snmp_sess_synch_response)(handle, pdu, &response); - if (response == NULL) { + status = (*nut_snmp_sess_synch_response)(handle,pdu, &response); + if( response == NULL ) { index++; return NULL; } - if (status != STAT_SUCCESS - || response->errstat != SNMP_ERR_NOERROR - || response->variables == NULL - || response->variables->name == NULL - || ((*nut_snmp_oid_compare)(response->variables->name, - response->variables->name_length, - name, name_len) != 0) - || response->variables->val.string == NULL - ) { + if(status!=STAT_SUCCESS||response->errstat!=SNMP_ERR_NOERROR|| + response->variables == NULL || + response->variables->name == NULL || + (*nut_snmp_oid_compare)(response->variables->name, + response->variables->name_length, + name, name_len) != 0 || + response->variables->val.string == NULL ) { (*nut_snmp_free_pdu)(response); index++; return NULL; @@ -470,38 +356,21 @@ static struct snmp_pdu * scan_snmp_get_oid(char* oid_str, void* handle) return response; } -static void try_all_oid(void * arg, const char * mib_found) +static void try_all_oid(void * arg) { struct snmp_pdu *response = NULL; int index = 0; nutscan_snmp_t * sec = (nutscan_snmp_t *)arg; - upsdebugx(2, "Entering %s for %s", __func__, sec->peername); + while(snmp_device_table[index].oid != NULL) { - while (snmp_device_table[index].mib != NULL) { - - if (snmp_device_table[index].oid == NULL - || snmp_device_table[index].oid[0] == '\0' - ) { + response = scan_snmp_get_manufacturer(snmp_device_table[index].oid,sec->handle); + if( response == NULL ) { index++; continue; } - response = scan_snmp_get_oid(snmp_device_table[index].oid, sec->handle); - if (response == NULL) { - index++; - continue; - } - - /* add device only if not yet detected with the same mib */ - if (mib_found == NULL || (strcmp(mib_found, snmp_device_table[index].mib) != 0)) { - scan_snmp_add_device(sec, response, snmp_device_table[index].mib); - upsdebugx(3, "Found another match for device with MIB '%s'", - snmp_device_table[index].mib); - } - else { - upsdebugx(3, "Skip duplicated device %s", snmp_device_table[index].mib); - } + scan_snmp_add_device(sec,response,snmp_device_table[index].mib); (*nut_snmp_free_pdu)(response); response = NULL; @@ -516,9 +385,9 @@ static int init_session(struct snmp_session * snmp_sess, nutscan_snmp_t * sec) snmp_sess->peername = sec->peername; - if (sec->community != NULL || sec->secLevel == NULL) { + if( sec->community != NULL || sec->secLevel == NULL ) { snmp_sess->version = SNMP_VERSION_1; - if (sec->community != NULL) { + if( sec->community != NULL ) { snmp_sess->community = (unsigned char *)sec->community; snmp_sess->community_len = strlen(sec->community); } @@ -527,7 +396,7 @@ static int init_session(struct snmp_session * snmp_sess, nutscan_snmp_t * sec) snmp_sess->community_len = strlen("public"); } } - else { /* SNMP v3 */ + else { /* SNMP v3 */ snmp_sess->version = SNMP_VERSION_3; /* Security level */ @@ -538,230 +407,130 @@ static int init_session(struct snmp_session * snmp_sess, nutscan_snmp_t * sec) else if (strcmp(sec->secLevel, "authPriv") == 0) snmp_sess->securityLevel = SNMP_SEC_LEVEL_AUTHPRIV; else { - fprintf(stderr, - "Bad SNMPv3 securityLevel: %s\n", - sec->secLevel); + fprintf(stderr,"Bad SNMPv3 securityLevel: %s\n", + sec->secLevel); return 0; } /* Security name */ - if (sec->secName == NULL) { - fprintf(stderr, "securityName is required for SNMPv3\n"); + if( sec->secName == NULL ) { + fprintf(stderr,"securityName is required for SNMPv3\n"); return 0; } snmp_sess->securityName = strdup(sec->secName); snmp_sess->securityNameLen = strlen(snmp_sess->securityName); /* Everything is ready for NOAUTH */ - if (snmp_sess->securityLevel == SNMP_SEC_LEVEL_NOAUTH) { + if( snmp_sess->securityLevel == SNMP_SEC_LEVEL_NOAUTH ) { return 1; } /* Process mandatory fields, based on the security level */ - switch (snmp_sess->securityLevel) { - case SNMP_SEC_LEVEL_AUTHNOPRIV: - if (sec->authPassword == NULL) { - fprintf(stderr, - "authPassword is required " - "for SNMPv3 in %s mode\n", + switch (snmp_sess->securityLevel) { + case SNMP_SEC_LEVEL_AUTHNOPRIV: + if (sec->authPassword == NULL) { + fprintf(stderr, + "authPassword is required for SNMPv3 in %s mode\n", sec->secLevel); return 0; } break; - case SNMP_SEC_LEVEL_AUTHPRIV: - if ((sec->authPassword == NULL) || + case SNMP_SEC_LEVEL_AUTHPRIV: + if ((sec->authPassword == NULL) || (sec->privPassword == NULL)) { - fprintf(stderr, - "authPassword and privPassword are " - "required for SNMPv3 in %s mode\n", + fprintf(stderr, + "authPassword and privPassword are required for SNMPv3 in %s mode\n", sec->secLevel); return 0; } break; - default: - /* nothing else needed */ - break; - } + default: + /* nothing else needed */ + break; + } - /* Process authentication protocol and key */ - snmp_sess->securityAuthKeyLen = USM_AUTH_KU_LEN; + /* Process authentication protocol and key */ + snmp_sess->securityAuthKeyLen = USM_AUTH_KU_LEN; -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol /* default to MD5 */ - snmp_sess->securityAuthProto = nut_usmHMACMD5AuthProtocol; + snmp_sess->securityAuthProto = (*nut_usmHMACMD5AuthProtocol); snmp_sess->securityAuthProtoLen = - sizeof(usmHMACMD5AuthProtocol)/ - sizeof(oid); -#endif + sizeof((*nut_usmHMACMD5AuthProtocol))/ + sizeof(oid); - if (sec->authProtocol) { -#if NUT_HAVE_LIBNETSNMP_usmHMACSHA1AuthProtocol + if( sec->authProtocol ) { if (strcmp(sec->authProtocol, "SHA") == 0) { - snmp_sess->securityAuthProto = nut_usmHMACSHA1AuthProtocol; + snmp_sess->securityAuthProto = + (*nut_usmHMACSHA1AuthProtocol); snmp_sess->securityAuthProtoLen = - sizeof(usmHMACSHA1AuthProtocol)/ + sizeof((*nut_usmHMACSHA1AuthProtocol))/ sizeof(oid); } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC192SHA256AuthProtocol - if (strcmp(sec->authProtocol, "SHA256") == 0) { - snmp_sess->securityAuthProto = nut_usmHMAC192SHA256AuthProtocol; - snmp_sess->securityAuthProtoLen = - sizeof(usmHMAC192SHA256AuthProtocol)/ - sizeof(oid); - } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC256SHA384AuthProtocol - if (strcmp(sec->authProtocol, "SHA384") == 0) { - snmp_sess->securityAuthProto = nut_usmHMAC256SHA384AuthProtocol; - snmp_sess->securityAuthProtoLen = - sizeof(usmHMAC256SHA384AuthProtocol)/ - sizeof(oid); - } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMAC384SHA512AuthProtocol - if (strcmp(sec->authProtocol, "SHA512") == 0) { - snmp_sess->securityAuthProto = nut_usmHMAC384SHA512AuthProtocol; - snmp_sess->securityAuthProtoLen = - sizeof(usmHMAC384SHA512AuthProtocol)/ - sizeof(oid); - } - else -#endif -#if NUT_HAVE_LIBNETSNMP_usmHMACMD5AuthProtocol - if (strcmp(sec->authProtocol, "MD5") != 0) { -#else - { -#endif - fprintf(stderr, - "Bad SNMPv3 authProtocol: %s\n", - sec->authProtocol); - return 0; + else { + if (strcmp(sec->authProtocol, "MD5") != 0) { + fprintf(stderr, + "Bad SNMPv3 authProtocol: %s", + sec->authProtocol); + return 0; + } } } /* set the authentication key to a MD5/SHA1 hashed version of * our passphrase (must be at least 8 characters long) */ -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)snmp_sess->securityAuthProtoLen > UINT_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - fprintf(stderr, "Bad SNMPv3 securityAuthProtoLen: %zu", - snmp_sess->securityAuthProtoLen); - return 0; - } if ((*nut_generate_Ku)(snmp_sess->securityAuthProto, - (u_int)snmp_sess->securityAuthProtoLen, - (unsigned char *) sec->authPassword, + snmp_sess->securityAuthProtoLen, + (u_char *) sec->authPassword, strlen(sec->authPassword), snmp_sess->securityAuthKey, &snmp_sess->securityAuthKeyLen) - != SNMPERR_SUCCESS - ) { - fprintf(stderr, - "Error generating Ku from " - "authentication pass phrase\n"); - return 0; + != SNMPERR_SUCCESS) { + fprintf(stderr, + "Error generating Ku from authentication pass phrase\n"); + return 0; } /* Everything is ready for AUTHNOPRIV */ - if (snmp_sess->securityLevel == SNMP_SEC_LEVEL_AUTHNOPRIV) { + if( snmp_sess->securityLevel == SNMP_SEC_LEVEL_AUTHNOPRIV ) { return 1; } -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol /* default to DES */ - snmp_sess->securityPrivProto = nut_usmDESPrivProtocol; + snmp_sess->securityPrivProto=(*nut_usmDESPrivProtocol); snmp_sess->securityPrivProtoLen = - sizeof(usmDESPrivProtocol)/sizeof(oid); -#endif + sizeof((*nut_usmDESPrivProtocol))/sizeof(oid); - if (sec->privProtocol) { -#if NUT_HAVE_LIBNETSNMP_usmAESPrivProtocol || NUT_HAVE_LIBNETSNMP_usmAES128PrivProtocol + if( sec->privProtocol ) { if (strcmp(sec->privProtocol, "AES") == 0) { - snmp_sess->securityPrivProto = nut_usmAESPrivProtocol; - snmp_sess->securityPrivProtoLen = - sizeof(usmAESPrivProtocol)/ + snmp_sess->securityPrivProto= + (*nut_usmAESPrivProtocol); + snmp_sess->securityPrivProtoLen = + sizeof((*nut_usmAESPrivProtocol))/ sizeof(oid); } - else -#endif -#if NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 -# if NUT_HAVE_LIBNETSNMP_usmAES192PrivProtocol - if (strcmp(sec->privProtocol, "AES192") == 0) { - snmp_sess->securityPrivProto = nut_usmAES192PrivProtocol; - snmp_sess->securityPrivProtoLen = - sizeof(usmAES192PrivProtocol)/ - sizeof(oid); - } - else -# endif -# if NUT_HAVE_LIBNETSNMP_usmAES256PrivProtocol - if (strcmp(sec->privProtocol, "AES256") == 0) { - snmp_sess->securityPrivProto = nut_usmAES256PrivProtocol; - snmp_sess->securityPrivProtoLen = - sizeof(usmAES256PrivProtocol)/ - sizeof(oid); - } - else -# endif -#endif /* NUT_HAVE_LIBNETSNMP_DRAFT_BLUMENTHAL_AES_04 */ -#if NUT_HAVE_LIBNETSNMP_usmDESPrivProtocol - if (strcmp(sec->privProtocol, "DES") != 0) { -#else - { -#endif - fprintf(stderr, - "Bad SNMPv3 privProtocol: %s\n", - sec->privProtocol); + else { + if (strcmp(sec->privProtocol, "DES") != 0) { + fprintf(stderr, + "Bad SNMPv3 authProtocol: %s\n" + ,sec->authProtocol); return 0; + } } } /* set the private key to a MD5/SHA hashed version of * our passphrase (must be at least 8 characters long) */ snmp_sess->securityPrivKeyLen = USM_PRIV_KU_LEN; -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic push -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS -# pragma GCC diagnostic ignored "-Wtype-limits" -#endif -#ifdef HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE -# pragma GCC diagnostic ignored "-Wtautological-constant-out-of-range-compare" -#endif - if ((uintmax_t)snmp_sess->securityAuthProtoLen > UINT_MAX) { -#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) ) -# pragma GCC diagnostic pop -#endif - fprintf(stderr, "Bad SNMPv3 securityAuthProtoLen: %zu", - snmp_sess->securityAuthProtoLen); - return 0; - } if ((*nut_generate_Ku)(snmp_sess->securityAuthProto, - (u_int)snmp_sess->securityAuthProtoLen, - (unsigned char *) sec->privPassword, + snmp_sess->securityAuthProtoLen, + (u_char *) sec->privPassword, strlen(sec->privPassword), snmp_sess->securityPrivKey, &snmp_sess->securityPrivKeyLen) - != SNMPERR_SUCCESS - ) { - fprintf(stderr, - "Error generating Ku from " - "private pass phrase\n"); - return 0; + != SNMPERR_SUCCESS) { + fprintf(stderr, + "Error generating Ku from private pass phrase\n"); + return 0; } } @@ -774,40 +543,32 @@ static void * try_SysOID(void * arg) struct snmp_session snmp_sess; void * handle; struct snmp_pdu *pdu, *response = NULL, *resp = NULL; - oid name[MAX_OID_LEN]; - size_t name_len = MAX_OID_LEN; + oid name[MAX_OID_LEN]; + size_t name_len = MAX_OID_LEN; nutscan_snmp_t * sec = (nutscan_snmp_t *)arg; int index = 0; - char *mib_found = NULL; - - upsdebugx(2, "Entering %s for %s", __func__, sec->peername); + int sysoid_found = 0; /* Initialize session */ - if (!init_session(&snmp_sess, sec)) { + if( !init_session(&snmp_sess,sec) ) { goto try_SysOID_free; } - + snmp_sess.retries = 0; - /* netsnmp timeout is accounted in uS, but typed as long - * and not useconds_t (which is at most long per POSIX) - */ - snmp_sess.timeout = (long)g_usec_timeout; + snmp_sess.timeout = g_usec_timeout; /* Open the session */ handle = (*nut_snmp_sess_open)(&snmp_sess); /* establish the session */ if (handle == NULL) { - upsdebugx(2, - "Failed to open SNMP session for %s", + fprintf(stderr,"Failed to open SNMP session for %s.\n", sec->peername); goto try_SysOID_free; } /* create and send request. */ if (!(*nut_snmp_parse_oid)(SysOID, name, &name_len)) { - upsdebugx(2, - "SNMP errors for %s: %s", - sec->peername, - (*nut_snmp_api_errstring)((*nut_snmp_errno))); + fprintf(stderr,"SNMP errors: %s\n", + (*nut_snmp_api_errstring)((*nut_snmp_errno))); (*nut_snmp_sess_close)(handle); goto try_SysOID_free; } @@ -815,7 +576,7 @@ static void * try_SysOID(void * arg) pdu = (*nut_snmp_pdu_create)(SNMP_MSG_GET); if (pdu == NULL) { - fprintf(stderr, "Not enough memory\n"); + fprintf(stderr,"Not enough memory\n"); (*nut_snmp_sess_close)(handle); goto try_SysOID_free; } @@ -832,58 +593,44 @@ static void * try_SysOID(void * arg) /* SysOID is supposed to give the required MIB. */ /* Check if the received OID match with a known sysOID */ - if (response->variables != NULL && - response->variables->val.objid != NULL - ) { - while (snmp_device_table[index].mib != NULL) { - if (snmp_device_table[index].sysoid == NULL) { + if(response->variables != NULL && + response->variables->val.objid != NULL){ + while(snmp_device_table[index].oid != NULL) { + if(snmp_device_table[index].sysoid == NULL ) { index++; continue; } name_len = MAX_OID_LEN; - if (!(*nut_snmp_parse_oid)( snmp_device_table[index].sysoid, - name, &name_len) - ) { + name, &name_len)) { index++; continue; } - if ((*nut_snmp_oid_compare)( + if ( (*nut_snmp_oid_compare)( response->variables->val.objid, response->variables->val_len/sizeof(oid), - name, name_len) == 0 - ) { - /* we have found a relevant sysoid */ - - /* add mib if no complementary oid is present */ - /* FIXME: No desc defined when add device */ - if (snmp_device_table[index].oid == NULL - || snmp_device_table[index].oid[0] == '\0' - ) { - scan_snmp_add_device(sec, NULL, snmp_device_table[index].mib); - mib_found = snmp_device_table[index].sysoid; - } - /* else test complementary oid before adding mib */ - else { - resp = scan_snmp_get_oid( - snmp_device_table[index].oid, - handle); - if (resp != NULL) { - scan_snmp_add_device(sec, resp, snmp_device_table[index].mib); - mib_found = snmp_device_table[index].mib; - (*nut_snmp_free_pdu)(resp); - } + name, name_len) == 0 ) { + /* we have found a relevent sysoid */ + resp = scan_snmp_get_manufacturer( + snmp_device_table[index].oid, + handle); + if( resp != NULL ) { + scan_snmp_add_device(sec,resp, + snmp_device_table[index].mib); + sysoid_found = 1; + (*nut_snmp_free_pdu)(resp); } } index++; } } - /* try a list of known OID, if no device was found otherwise */ - if (mib_found == NULL) - try_all_oid(sec, mib_found); + /* try a list of known OID */ + if( !sysoid_found ) { + try_all_oid(sec); + } (*nut_snmp_free_pdu)(response); response = NULL; @@ -892,7 +639,7 @@ static void * try_SysOID(void * arg) (*nut_snmp_sess_close)(handle); try_SysOID_free: - if (sec->peername) { + if( sec->peername ) { free(sec->peername); } free(sec); @@ -900,295 +647,63 @@ try_SysOID_free: return NULL; } -nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip, - useconds_t usec_timeout, nutscan_snmp_t * sec) +nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip,long usec_timeout, nutscan_snmp_t * sec) { - bool_t pass = TRUE; /* Track that we may spawn a scanning thread */ + int i; nutscan_snmp_t * tmp_sec; nutscan_ip_iter_t ip; char * ip_str = NULL; #ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - sem_t * semaphore = nutscan_semaphore(); - sem_t semaphore_scantype_inst; - sem_t * semaphore_scantype = &semaphore_scantype_inst; -# endif /* HAVE_SEMAPHORE */ pthread_t thread; - nutscan_thread_t * thread_array = NULL; - size_t thread_count = 0, i; -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) - size_t max_threads_scantype = max_threads_netsnmp; -# endif - pthread_mutex_init(&dev_mutex, NULL); + pthread_mutex_init(&dev_mutex,NULL); +#endif -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) { - if (SIZE_MAX > UINT_MAX && max_threads_scantype > UINT_MAX) { - upsdebugx(1, - "WARNING: %s: Limiting max_threads_scantype to range acceptable for sem_init()", - __func__); - max_threads_scantype = UINT_MAX - 1; - } - sem_init(semaphore_scantype, 0, (unsigned int)max_threads_scantype); - } -# endif /* HAVE_SEMAPHORE */ + if( !nutscan_avail_snmp ) { + return NULL; + } -#endif /* HAVE_PTHREAD */ - - if (!nutscan_avail_snmp) { - return NULL; - } g_usec_timeout = usec_timeout; - /* Force numeric OIDs resolution (ie, do not resolve to textual names) - * This is mostly for the convenience of debug output */ - if (nut_snmp_out_toggle_options("n") != NULL) { - upsdebugx(1, "Failed to enable numeric OIDs resolution"); - } - /* Initialize the SNMP library */ (*nut_init_snmp)("nut-scanner"); ip_str = nutscan_ip_iter_init(&ip, start_ip, stop_ip); - while (ip_str != NULL) { -#ifdef HAVE_PTHREAD - /* NOTE: With many enough targets to scan, this can crash - * by spawning too many children; add a limit and loop to - * "reap" some already done with their work. And probably - * account them in thread_array[] as something to not wait - * for below in pthread_join()... - */ + while(ip_str != NULL) { + tmp_sec = malloc(sizeof(nutscan_snmp_t)); + memcpy(tmp_sec, sec, sizeof(nutscan_snmp_t)); + tmp_sec->peername = ip_str; -# ifdef HAVE_SEMAPHORE - /* Just wait for someone to free a semaphored slot, - * if none are available, and then/otherwise grab one - */ - if (thread_array == NULL) { - /* Starting point, or after a wait to complete - * all earlier runners */ - if (max_threads_scantype > 0) - sem_wait(semaphore_scantype); - sem_wait(semaphore); - pass = TRUE; - } else { - pass = ((max_threads_scantype == 0 || sem_trywait(semaphore_scantype) == 0) && - sem_trywait(semaphore) == 0); +#ifdef HAVE_PTHREAD + if (pthread_create(&thread,NULL,try_SysOID,(void*)tmp_sec)==0){ + thread_count++; + thread_array = realloc(thread_array, + thread_count*sizeof(pthread_t)); + thread_array[thread_count-1] = thread; } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* A somewhat naive and brute-force solution for - * systems without a semaphore.h. This may suffer - * some off-by-one errors, using a few more threads - * than intended (if we race a bit at the wrong time, - * probably up to one per enabled scanner routine). - */ - - /* TOTHINK: Should there be a threadcount_mutex when - * we just read the value in if() and while() below? - * At worst we would overflow the limit a bit due to - * other protocol scanners... - */ - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - upsdebugx(2, "%s: already running %zu scanning threads " - "(launched overall: %zu), " - "waiting until some would finish", - __func__, curr_threads, thread_count); - while (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - for (i = 0; i < thread_count ; i++) { - int ret; - - if (!thread_array[i].active) continue; - - pthread_mutex_lock(&threadcount_mutex); - upsdebugx(3, "%s: Trying to join thread #%i...", __func__, i); - ret = pthread_tryjoin_np(thread_array[i].thread, NULL); - switch (ret) { - case ESRCH: /* No thread with the ID thread could be found - already "joined"? */ - upsdebugx(5, "%s: Was thread #%zu joined earlier?", __func__, i); - break; - case 0: /* thread exited */ - if (curr_threads > 0) { - curr_threads --; - upsdebugx(4, "%s: Joined a finished thread #%zu", __func__, i); - } else { - /* threadcount_mutex fault? */ - upsdebugx(0, "WARNING: %s: Accounting of thread count " - "says we are already at 0", __func__); - } - thread_array[i].active = FALSE; - break; - case EBUSY: /* actively running */ - upsdebugx(6, "%s: thread #%zu still busy (%i)", - __func__, i, ret); - break; - case EDEADLK: /* Errors with thread interactions... bail out? */ - case EINVAL: /* Errors with thread interactions... bail out? */ - default: /* new pthreads abilities? */ - upsdebugx(5, "%s: thread #%zu reported code %i", - __func__, i, ret); - break; - } - pthread_mutex_unlock(&threadcount_mutex); - } - - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - usleep (10000); /* microSec's, so 0.01s here */ - } - } - upsdebugx(2, "%s: proceeding with scan", __func__); - } - /* NOTE: No change to default "pass" in this ifdef: - * if we got to this line, we have a slot to use */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - if (pass) { - tmp_sec = malloc(sizeof(nutscan_snmp_t)); - memcpy(tmp_sec, sec, sizeof(nutscan_snmp_t)); - tmp_sec->peername = ip_str; +#else + try_SysOID((void *)tmp_sec); +#endif + ip_str = nutscan_ip_iter_inc(&ip); + }; #ifdef HAVE_PTHREAD - if (pthread_create(&thread, NULL, try_SysOID, (void*)tmp_sec) == 0) { -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - curr_threads++; -# endif /* HAVE_PTHREAD_TRYJOIN */ - - thread_count++; - nutscan_thread_t *new_thread_array = realloc(thread_array, - thread_count * sizeof(nutscan_thread_t)); - if (new_thread_array == NULL) { - upsdebugx(1, "%s: Failed to realloc thread array", __func__); - break; - } - else { - thread_array = new_thread_array; - } - thread_array[thread_count - 1].thread = thread; - thread_array[thread_count - 1].active = TRUE; - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ - } -#else /* not HAVE_PTHREAD */ - try_SysOID((void *)tmp_sec); -#endif /* if HAVE_PTHREAD */ -/* free(ip_str); */ /* Do not free() here - seems to cause a double-free instead */ - ip_str = nutscan_ip_iter_inc(&ip); -/* free(tmp_sec); */ - } else { /* if not pass -- all slots busy */ -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - /* Wait for all current scans to complete */ - if (thread_array != NULL) { - upsdebugx (2, "%s: Running too many scanning threads, " - "waiting until older ones would finish", - __func__); - for (i = 0; i < thread_count ; i++) { - int ret; - if (!thread_array[i].active) { - /* Probably should not get here, - * but handle it just in case */ - upsdebugx(0, "WARNING: %s: Midway clean-up: did not expect thread %zu to be not active", - __func__, i); - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - continue; - } - thread_array[i].active = FALSE; - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Midway clean-up: pthread_join() returned code %i", - __func__, ret); - } - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - } - thread_count = 0; - free(thread_array); - thread_array = NULL; - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* TODO: Move the wait-loop for TRYJOIN here? */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - } /* if: could we "pass" or not? */ - } /* while */ - -#ifdef HAVE_PTHREAD - if (thread_array != NULL) { - upsdebugx(2, "%s: all planned scans launched, waiting for threads to complete", __func__); - for (i = 0; i < thread_count; i++) { - int ret; - - if (!thread_array[i].active) continue; - - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Clean-up: pthread_join() returned code %i", - __func__, ret); - } - thread_array[i].active = FALSE; -# ifdef HAVE_SEMAPHORE - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); -# else -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - if (curr_threads > 0) { - curr_threads --; - upsdebugx(5, "%s: Clean-up: Joined a finished thread #%zu", - __func__, i); - } else { - upsdebugx(0, "WARNING: %s: Clean-up: Accounting of thread count " - "says we are already at 0", __func__); - } - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ - } - free(thread_array); - upsdebugx(2, "%s: all threads freed", __func__); + for ( i=0; i < thread_count ; i++) { + pthread_join(thread_array[i],NULL); } pthread_mutex_destroy(&dev_mutex); + free(thread_array); +#endif -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) - sem_destroy(semaphore_scantype); -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - nutscan_device_t * result = nutscan_rewind_device(dev_ret); - dev_ret = NULL; - return result; + return nutscan_rewind_device(dev_ret); } - #else /* WITH_SNMP */ - -nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip, - useconds_t usec_timeout, nutscan_snmp_t * sec) +nutscan_device_t * nutscan_scan_snmp(const char * start_ip, const char * stop_ip,long usec_timeout, nutscan_snmp_t * sec) { - NUT_UNUSED_VARIABLE(start_ip); - NUT_UNUSED_VARIABLE(stop_ip); - NUT_UNUSED_VARIABLE(usec_timeout); - NUT_UNUSED_VARIABLE(sec); return NULL; } - #endif /* WITH_SNMP */ + + diff --git a/tools/nut-scanner/scan_usb.c b/tools/nut-scanner/scan_usb.c index a828827..c82dad5 100644 --- a/tools/nut-scanner/scan_usb.c +++ b/tools/nut-scanner/scan_usb.c @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2011-2016 - EATON +/* scan_usb.c: detect NUT supported USB devices + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,12 +17,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file scan_usb.c - \brief detect NUT supported USB devices - \author Frederic Bohe - \author Arnaud Quette -*/ - #include "common.h" #include "nut-scan.h" @@ -33,152 +28,89 @@ #include /* dynamic link library stuff */ +static char * libname = "libusb"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; -static int (*nut_usb_close)(libusb_device_handle *dev); -static int (*nut_usb_get_string_simple)(libusb_device_handle *dev, int index, +static int (*nut_usb_close)(usb_dev_handle *dev); +static int (*nut_usb_find_busses)(void); +static char * (*nut_usb_strerror)(void); +static void (*nut_usb_init)(void); +static int (*nut_usb_get_string_simple)(usb_dev_handle *dev, int index, char *buf, size_t buflen); +static struct usb_bus * (*nut_usb_busses); +static usb_dev_handle * (*nut_usb_open)(struct usb_device *dev); +static int (*nut_usb_find_devices)(void); - -/* Compatibility layer between libusb 0.1 and 1.0 */ -#if WITH_LIBUSB_1_0 - #define USB_INIT_SYMBOL "libusb_init" - #define USB_OPEN_SYMBOL "libusb_open" - #define USB_CLOSE_SYMBOL "libusb_close" - #define USB_STRERROR_SYMBOL "libusb_strerror" - static int (*nut_usb_open)(libusb_device *dev, libusb_device_handle **handle); - static int (*nut_usb_init)(libusb_context **ctx); - static void (*nut_usb_exit)(libusb_context *ctx); - static char * (*nut_usb_strerror)(enum libusb_error errcode); - static ssize_t (*nut_usb_get_device_list)(libusb_context *ctx, libusb_device ***list); - static void (*nut_usb_free_device_list)(libusb_device **list, int unref_devices); - static uint8_t (*nut_usb_get_bus_number)(libusb_device *dev); - static int (*nut_usb_get_device_descriptor)(libusb_device *dev, - struct libusb_device_descriptor *desc); -#else - #define USB_INIT_SYMBOL "usb_init" - #define USB_OPEN_SYMBOL "usb_open" - #define USB_CLOSE_SYMBOL "usb_close" - #define USB_STRERROR_SYMBOL "usb_strerror" - static libusb_device_handle * (*nut_usb_open)(struct usb_device *dev); - static void (*nut_usb_init)(void); - static int (*nut_usb_find_busses)(void); - static struct usb_bus * (*nut_usb_busses); - static int (*nut_usb_find_devices)(void); - static char * (*nut_usb_strerror)(void); -#endif - -/* return 0 on error; visible externally */ -int nutscan_load_usb_library(const char *libname_path); -int nutscan_load_usb_library(const char *libname_path) +/* return 0 on error */ +int nutscan_load_usb_library() { - if (dl_handle != NULL) { - /* if previous init failed */ - if (dl_handle == (void *)1) { - return 0; - } - /* init has already been done */ - return 1; - } + if( dl_handle != NULL ) { + /* if previous init failed */ + if( dl_handle == (void *)1 ) { + return 0; + } + /* init has already been done */ + return 1; + } - if (libname_path == NULL) { - fprintf(stderr, "USB library not found. USB search disabled.\n"); - return 0; - } - - if (lt_dlinit() != 0) { + if( lt_dlinit() != 0 ) { fprintf(stderr, "Error initializing lt_init\n"); return 0; } - dl_handle = lt_dlopen(libname_path); - if (!dl_handle) { - dl_error = lt_dlerror(); - goto err; - } + dl_handle = lt_dlopenext(libname); + if (!dl_handle) { + dl_error = lt_dlerror(); + goto err; + } + lt_dlerror(); /* Clear any existing error */ + *(void **) (&nut_usb_close) = lt_dlsym(dl_handle, "usb_close"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_usb_init) = lt_dlsym(dl_handle, USB_INIT_SYMBOL); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_find_busses) = lt_dlsym(dl_handle, "usb_find_busses"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_usb_open) = lt_dlsym(dl_handle, USB_OPEN_SYMBOL); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_strerror) = lt_dlsym(dl_handle, "usb_strerror"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - lt_dlerror(); /* Clear any existing error */ - *(void **) (&nut_usb_close) = lt_dlsym(dl_handle, USB_CLOSE_SYMBOL); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_init) = lt_dlsym(dl_handle, "usb_init"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_usb_strerror) = lt_dlsym(dl_handle, USB_STRERROR_SYMBOL); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_get_string_simple) = lt_dlsym(dl_handle, + "usb_get_string_simple"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } -#if WITH_LIBUSB_1_0 - *(void **) (&nut_usb_exit) = lt_dlsym(dl_handle, "libusb_exit"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_busses) = lt_dlsym(dl_handle, "usb_busses"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_usb_get_device_list) = lt_dlsym(dl_handle, "libusb_get_device_list"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_usb_open) = lt_dlsym(dl_handle, "usb_open"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_usb_free_device_list) = lt_dlsym(dl_handle, "libusb_free_device_list"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_usb_get_bus_number) = lt_dlsym(dl_handle, "libusb_get_bus_number"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_usb_get_device_descriptor) = lt_dlsym(dl_handle, "libusb_get_device_descriptor"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_usb_get_string_simple) = lt_dlsym(dl_handle, - "libusb_get_string_descriptor_ascii"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -#else /* for libusb 0.1 */ - *(void **) (&nut_usb_find_busses) = lt_dlsym(dl_handle, "usb_find_busses"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_usb_busses) = lt_dlsym(dl_handle, "usb_busses"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **)(&nut_usb_find_devices) = lt_dlsym(dl_handle, "usb_find_devices"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - *(void **) (&nut_usb_get_string_simple) = lt_dlsym(dl_handle, - "usb_get_string_simple"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } -#endif /* WITH_LIBUSB_1_0 */ - - return 1; + *(void **)(&nut_usb_find_devices) = lt_dlsym(dl_handle,"usb_find_devices"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } + return 1; err: - fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname_path, dl_error); - dl_handle = (void *)1; + fprintf(stderr, "Cannot load USB library (%s) : %s. USB search disabled.\n", libname, dl_error); + dl_handle = (void *)1; lt_dlexit(); - return 0; + return 0; } /* end of dynamic link library stuff */ @@ -187,10 +119,10 @@ static char* is_usb_device_supported(usb_device_id_t *usb_device_id_list, { usb_device_id_t *usbdev; - for (usbdev = usb_device_id_list; usbdev->driver_name != NULL; usbdev++) { - if ((usbdev->vendorID == dev_VendorID) - && (usbdev->productID == dev_ProductID) - ) { + for (usbdev=usb_device_id_list; usbdev->driver_name != NULL; usbdev++) { + if ( (usbdev->vendorID == dev_VendorID) + && (usbdev->productID == dev_ProductID) ) { + return usbdev->driver_name; } } @@ -207,259 +139,128 @@ nutscan_device_t * nutscan_scan_usb() char *serialnumber = NULL; char *device_name = NULL; char *vendor_name = NULL; - uint8_t iManufacturer = 0, iProduct = 0, iSerialNumber = 0; - uint16_t VendorID; - uint16_t ProductID; - char *busname; -#if WITH_LIBUSB_1_0 - libusb_device *dev; - libusb_device **devlist; - uint8_t bus; -#else /* => WITH_LIBUSB_0_1 */ struct usb_device *dev; struct usb_bus *bus; -#endif /* WITH_LIBUSB_1_0 */ - libusb_device_handle *udev; + usb_dev_handle *udev; nutscan_device_t * nut_dev = NULL; nutscan_device_t * current_nut_dev = NULL; - if (!nutscan_avail_usb) { - return NULL; - } + if( !nutscan_avail_usb ) { + return NULL; + } /* libusb base init */ - /* Initialize Libusb */ -#if WITH_LIBUSB_1_0 - if ((*nut_usb_init)(NULL) < 0) { - (*nut_usb_exit)(NULL); - fatal_with_errno(EXIT_FAILURE, "Failed to init libusb 1.0"); - } -#else /* => WITH_LIBUSB_0_1 */ (*nut_usb_init)(); (*nut_usb_find_busses)(); (*nut_usb_find_devices)(); -#endif /* WITH_LIBUSB_1_0 */ -#if WITH_LIBUSB_1_0 - ssize_t devcount = 0; - struct libusb_device_descriptor dev_desc; - int i; - - devcount = (*nut_usb_get_device_list)(NULL, &devlist); - if (devcount <= 0) { - (*nut_usb_exit)(NULL); - fatal_with_errno(EXIT_FAILURE, "No USB device found"); - } - - for (i = 0; i < devcount; i++) { - - dev = devlist[i]; - (*nut_usb_get_device_descriptor)(dev, &dev_desc); - - VendorID = dev_desc.idVendor; - ProductID = dev_desc.idProduct; - - iManufacturer = dev_desc.iManufacturer; - iProduct = dev_desc.iProduct; - iSerialNumber = dev_desc.iSerialNumber; - bus = (*nut_usb_get_bus_number)(dev); - busname = (char *)malloc(4); - if (busname == NULL) { - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } - snprintf(busname, 4, "%03d", bus); -#else /* => WITH_LIBUSB_0_1 */ for (bus = (*nut_usb_busses); bus; bus = bus->next) { for (dev = bus->devices; dev; dev = dev->next) { - - VendorID = dev->descriptor.idVendor; - ProductID = dev->descriptor.idProduct; - - iManufacturer = dev->descriptor.iManufacturer; - iProduct = dev->descriptor.iProduct; - iSerialNumber = dev->descriptor.iSerialNumber; - busname = bus->dirname; -#endif if ((driver_name = is_usb_device_supported(usb_device_table, - VendorID, ProductID)) != NULL) { + dev->descriptor.idVendor, + dev->descriptor.idProduct)) != NULL) { /* open the device */ -#if WITH_LIBUSB_1_0 - ret = (*nut_usb_open)(dev, &udev); - if (!udev || ret != LIBUSB_SUCCESS) { - fprintf(stderr,"Failed to open device " - "bus '%s', skipping: %s\n", - busname, - (*nut_usb_strerror)(ret)); - - /* Note: closing is not applicable - * it seems, and can even segfault - * (even though an udev is not NULL - * when e.g. permissions problem) - */ - - free (busname); - - continue; - } -#else /* => WITH_LIBUSB_0_1 */ udev = (*nut_usb_open)(dev); if (!udev) { - /* TOTHINK: any errno or similar to test? */ - fprintf(stderr, "Failed to open device " - "bus '%s',skipping: %s\n", - busname, + fprintf(stderr,"Failed to open device, \ + skipping. (%s)\n", (*nut_usb_strerror)()); continue; } -#endif /* get serial number */ - if (iSerialNumber) { + if (dev->descriptor.iSerialNumber) { ret = (*nut_usb_get_string_simple)(udev, - iSerialNumber, string, sizeof(string)); + dev->descriptor.iSerialNumber, + string, sizeof(string)); if (ret > 0) { - serialnumber = strdup(str_rtrim(string, ' ')); - if (serialnumber == NULL) { - (*nut_usb_close)(udev); -#if WITH_LIBUSB_1_0 - free(busname); - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } + serialnumber = strdup(rtrim(string, ' ')); } } - /* get product name */ - if (iProduct) { + if (dev->descriptor.iProduct) { ret = (*nut_usb_get_string_simple)(udev, - iProduct, string, sizeof(string)); + dev->descriptor.iProduct, + string, sizeof(string)); if (ret > 0) { - device_name = strdup(str_rtrim(string, ' ')); - if (device_name == NULL) { - free(serialnumber); - (*nut_usb_close)(udev); -#if WITH_LIBUSB_1_0 - free(busname); - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } + device_name = strdup(rtrim(string, ' ')); } } /* get vendor name */ - if (iManufacturer) { + if (dev->descriptor.iManufacturer) { ret = (*nut_usb_get_string_simple)(udev, - iManufacturer, string, sizeof(string)); + dev->descriptor.iManufacturer, + string, sizeof(string)); if (ret > 0) { - vendor_name = strdup(str_rtrim(string, ' ')); - if (vendor_name == NULL) { - free(serialnumber); - free(device_name); - (*nut_usb_close)(udev); -#if WITH_LIBUSB_1_0 - free(busname); - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); -#endif /* WITH_LIBUSB_1_0 */ - fatal_with_errno(EXIT_FAILURE, "Out of memory"); - } + vendor_name = strdup(rtrim(string, ' ')); } } nut_dev = nutscan_new_device(); - if (nut_dev == NULL) { - fprintf(stderr, - "Memory allocation error\n"); + if(nut_dev == NULL) { + fprintf(stderr,"Memory allocation \ + error\n"); nutscan_free_device(current_nut_dev); free(serialnumber); free(device_name); free(vendor_name); - (*nut_usb_close)(udev); -#if WITH_LIBUSB_1_0 - free(busname); - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); -#endif /* WITH_LIBUSB_1_0 */ return NULL; } nut_dev->type = TYPE_USB; - if (driver_name) { + if(driver_name) { nut_dev->driver = strdup(driver_name); } nut_dev->port = strdup("auto"); - - sprintf(string, "%04X", VendorID); - nutscan_add_option_to_device(nut_dev, - "vendorid", - string); - - sprintf(string, "%04X", ProductID); - nutscan_add_option_to_device(nut_dev, - "productid", - string); - - if (device_name) { + sprintf(string,"%04X",dev->descriptor.idVendor); + nutscan_add_option_to_device(nut_dev,"vendorid", + string); + sprintf(string,"%04X", + dev->descriptor.idProduct); + nutscan_add_option_to_device(nut_dev,"productid", + string); + if(device_name) { nutscan_add_option_to_device(nut_dev, - "product", - device_name); + "product", + device_name); free(device_name); - device_name = NULL; } - - if (serialnumber) { + if(serialnumber) { nutscan_add_option_to_device(nut_dev, - "serial", - serialnumber); + "serial", + serialnumber); free(serialnumber); - serialnumber = NULL; } - - if (vendor_name) { + if(vendor_name) { nutscan_add_option_to_device(nut_dev, - "vendor", - vendor_name); + "vendor", + vendor_name); free(vendor_name); - vendor_name = NULL; } - - nutscan_add_option_to_device(nut_dev, - "bus", - busname); + nutscan_add_option_to_device(nut_dev,"bus", + bus->dirname); current_nut_dev = nutscan_add_device_to_device( - current_nut_dev, - nut_dev); + current_nut_dev, + nut_dev); memset (string, 0, sizeof(string)); (*nut_usb_close)(udev); } -#if WITH_LIBUSB_0_1 } } -#else /* not WITH_LIBUSB_0_1 */ - free(busname); - } - - (*nut_usb_free_device_list)(devlist, 1); - (*nut_usb_exit)(NULL); -#endif /* WITH_LIBUSB_0_1 */ return nutscan_rewind_device(current_nut_dev); } -#else /* not WITH_USB */ +#else /* WITH_USB */ nutscan_device_t * nutscan_scan_usb() { return NULL; } #endif /* WITH_USB */ + diff --git a/tools/nut-scanner/scan_xml_http.c b/tools/nut-scanner/scan_xml_http.c index 6676a81..ee713e4 100644 --- a/tools/nut-scanner/scan_xml_http.c +++ b/tools/nut-scanner/scan_xml_http.c @@ -1,7 +1,6 @@ -/* - * Copyright (C) 2011 - EATON - * Copyright (C) 2016 - EATON - IP addressed XML scan - * Copyright (C) 2016-2021 - EATON - Various threads-related improvements +/* scan_xml_http.c: detect NUT supported XML HTTP devices + * + * Copyright (C) 2011 - Frederic Bohe * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,16 +17,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/*! \file scan_xml_http.c - \brief detect NUT supported XML HTTP devices - \author Frederic Bohe - \author Michal Vyskocil - \author Jim Klimov -*/ - #include "common.h" #include "nut-scan.h" - #ifdef WITH_NEON #include #include @@ -42,7 +33,7 @@ #include /* dynamic link library stuff */ -static char * libname = "libneon"; /* Note: this is for info messages, not the SONAME */ +static char * libname = "libneon"; static lt_dlhandle dl_handle = NULL; static const char *dl_error = NULL; @@ -52,665 +43,199 @@ static void (*nut_ne_xml_push_handler)(ne_xml_parser *p, ne_xml_endelm_cb *endelm, void *userdata); static void (*nut_ne_xml_destroy)(ne_xml_parser *p); -static int (*nut_ne_xml_failed)(ne_xml_parser *p); static ne_xml_parser * (*nut_ne_xml_create)(void); static int (*nut_ne_xml_parse)(ne_xml_parser *p, const char *block, size_t len); -static nutscan_device_t * dev_ret = NULL; -#ifdef HAVE_PTHREAD -static pthread_mutex_t dev_mutex; -#endif - -/* use explicit booleans */ -#ifndef FALSE -typedef enum ebool { FALSE = 0, TRUE } bool_t; -#else -typedef int bool_t; -#endif - -/* return 0 on error; visible externally */ -int nutscan_load_neon_library(const char *libname_path); -int nutscan_load_neon_library(const char *libname_path) +/* return 0 on error */ +int nutscan_load_neon_library() { - if (dl_handle != NULL) { - /* if previous init failed */ - if (dl_handle == (void *)1) { - return 0; - } - /* init has already been done */ - return 1; - } - if (libname_path == NULL) { - fprintf(stderr, "Neon library not found. XML search disabled.\n"); - return 0; - } + if( dl_handle != NULL ) { + /* if previous init failed */ + if( dl_handle == (void *)1 ) { + return 0; + } + /* init has already been done */ + return 1; + } - if (lt_dlinit() != 0) { - fprintf(stderr, "Error initializing lt_init\n"); - return 0; - } + if( lt_dlinit() != 0 ) { + fprintf(stderr, "Error initializing lt_init\n"); + return 0; + } - dl_handle = lt_dlopen(libname_path); - if (!dl_handle) { - dl_error = lt_dlerror(); - goto err; - } + dl_handle = lt_dlopenext(libname); + if (!dl_handle) { + dl_error = lt_dlerror(); + goto err; + } - lt_dlerror(); /* Clear any existing error */ - *(void **) (&nut_ne_xml_push_handler) = lt_dlsym(dl_handle, - "ne_xml_push_handler"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + lt_dlerror(); /* Clear any existing error */ + *(void **) (&nut_ne_xml_push_handler) = lt_dlsym(dl_handle, + "ne_xml_push_handler"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_ne_xml_destroy) = lt_dlsym(dl_handle, "ne_xml_destroy"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_ne_xml_destroy) = lt_dlsym(dl_handle,"ne_xml_destroy"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_ne_xml_create) = lt_dlsym(dl_handle, "ne_xml_create"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_ne_xml_create) = lt_dlsym(dl_handle,"ne_xml_create"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_ne_xml_parse) = lt_dlsym(dl_handle, "ne_xml_parse"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } + *(void **) (&nut_ne_xml_parse) = lt_dlsym(dl_handle,"ne_xml_parse"); + if ((dl_error = lt_dlerror()) != NULL) { + goto err; + } - *(void **) (&nut_ne_xml_failed) = lt_dlsym(dl_handle, "ne_xml_failed"); - if ((dl_error = lt_dlerror()) != NULL) { - goto err; - } - - return 1; + return 1; err: - fprintf(stderr, "Cannot load XML library (%s) : %s. XML search disabled.\n", libname, dl_error); - dl_handle = (void *)1; + fprintf(stderr, "Cannot load XML library (%s) : %s. XML search disabled.\n", libname, dl_error); + dl_handle = (void *)1; lt_dlexit(); - return 0; + return 0; } -/* A start-element callback for element with given namespace/name. */ static int startelm_cb(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { nutscan_device_t * dev = (nutscan_device_t *)userdata; char buf[SMALLBUF]; int i = 0; - int result = -1; - while (atts[i] != NULL) { - upsdebugx(5, "startelm_cb() : parent=%d nspace='%s' name='%s' atts[%d]='%s' atts[%d]='%s'", - parent, nspace, name, i, atts[i], (i + 1), atts[i + 1]); - /* The Eaton/MGE ePDUs almost exclusively support only XMLv4 protocol - * (only the very first generation of G2/G3 NMCs supported an older - * protocol, but all should have been FW upgraded by now), which NUT - * drivers don't yet support. To avoid failing drivers later, the - * nut-scanner should not suggest netxml-ups configuration for ePDUs - * at this time. */ - if (strcmp(atts[i], "class") == 0 && strcmp(atts[i + 1], "DEV.PDU") == 0) { - upsdebugx(3, "startelm_cb() : XML v4 protocol is not supported by current NUT drivers, skipping device!"); - /* netxml-ups currently only supports XML version 3 (for UPS), - * and not version 4 (for UPS and PDU)! */ - return -1; + while( atts[i] != NULL ) { + if(strcmp(atts[i],"type") == 0) { + snprintf(buf,sizeof(buf),"%s",atts[i+1]); + nutscan_add_option_to_device(dev,"desc",buf); + return 0; } - if (strcmp(atts[i], "type") == 0) { - snprintf(buf, sizeof(buf), "%s", atts[i + 1]); - nutscan_add_option_to_device(dev, "desc", buf); - result = 0; - } - i = i + 2; + i=i+2; } - return result; + return 0; } -static void * nutscan_scan_xml_http_generic(void * arg) +nutscan_device_t * nutscan_scan_xml_http(long usec_timeout) { - nutscan_xml_t * sec = (nutscan_xml_t *)arg; char *scanMsg = ""; -/* Note: at this time the HTTP/XML scan is in fact not implemented - just the UDP part */ -/* uint16_t port_http = 80; */ - uint16_t port_udp = 4679; -/* A NULL "ip" causes a broadcast scan; otherwise the single ip address is queried directly */ - char *ip = NULL; - useconds_t usec_timeout = 0; + int port = 4679; int peerSocket; int sockopt_on = 1; - struct sockaddr_in sockAddress_udp; - socklen_t sockAddressLength = sizeof(sockAddress_udp); - memset(&sockAddress_udp, 0, sizeof(sockAddress_udp)); + struct sockaddr_in sockAddress; + socklen_t sockAddressLength = sizeof(sockAddress); + memset(&sockAddress, 0, sizeof(sockAddress)); fd_set fds; struct timeval timeout; int ret; - char buf[SMALLBUF + 8]; + char buf[SMALLBUF]; char string[SMALLBUF]; ssize_t recv_size; - int i; nutscan_device_t * nut_dev = NULL; - if (sec != NULL) { -/* if (sec->port_http > 0 && sec->port_http <= 65534) - * port_http = sec->port_http; */ - if (sec->port_udp > 0 && sec->port_udp <= 65534) - port_udp = sec->port_udp; - if (sec->usec_timeout > 0) - usec_timeout = sec->usec_timeout; - ip = sec->peername; /* NULL or not... */ - } + nutscan_device_t * current_nut_dev = NULL; - if (usec_timeout <= 0) - usec_timeout = 5000000; /* Driver default : 5sec */ + if( !nutscan_avail_xml_http ) { + return NULL; + } - if (!nutscan_avail_xml_http) { - return NULL; - } - - if ((peerSocket = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { - fprintf(stderr, "Error creating socket\n"); - return NULL; - } - -/* FIXME : Per http://stackoverflow.com/questions/683624/udp-broadcast-on-all-interfaces - * A single sendto() generates a single packet, so one must iterate all known interfaces... */ -#define MAX_RETRIES 3 - for (i = 0; i != MAX_RETRIES ; i++) { + if((peerSocket = socket(AF_INET, SOCK_DGRAM, 0)) != -1) + { /* Initialize socket */ - sockAddress_udp.sin_family = AF_INET; - if (ip == NULL) { - upsdebugx(2, - "nutscan_scan_xml_http_generic() : scanning connected network segment(s) " - "with a broadcast, attempt %d of %d with a timeout of %jd usec", - (i + 1), MAX_RETRIES, (uintmax_t)usec_timeout); - sockAddress_udp.sin_addr.s_addr = INADDR_BROADCAST; - setsockopt(peerSocket, SOL_SOCKET, SO_BROADCAST, &sockopt_on, + sockAddress.sin_family = AF_INET; + sockAddress.sin_addr.s_addr = INADDR_BROADCAST; + sockAddress.sin_port = htons(port); + setsockopt(peerSocket, SOL_SOCKET, SO_BROADCAST, &sockopt_on, sizeof(sockopt_on)); - } else { - upsdebugx(2, - "nutscan_scan_xml_http_generic() : scanning IP '%s' with a unicast, " - "attempt %d of %d with a timeout of %jd usec", - ip, (i + 1), MAX_RETRIES, (uintmax_t)usec_timeout); - inet_pton(AF_INET, ip, &(sockAddress_udp.sin_addr)); - } - sockAddress_udp.sin_port = htons(port_udp); /* Send scan request */ - if (sendto(peerSocket, scanMsg, strlen(scanMsg), 0, - (struct sockaddr *)&sockAddress_udp, - sockAddressLength) <= 0 - ) { - fprintf(stderr, - "Error sending Eaton to %s, #%d/%d\n", - (ip ? ip : ""), (i + 1), MAX_RETRIES); - usleep(usec_timeout); - continue; + if(sendto(peerSocket, scanMsg, strlen(scanMsg), 0, + (struct sockaddr *)&sockAddress, + sockAddressLength) <= 0) + { + fprintf(stderr,"Error sending Eaton \n"); } else { - int retNum = 0; FD_ZERO(&fds); - FD_SET(peerSocket, &fds); + FD_SET(peerSocket,&fds); timeout.tv_sec = usec_timeout / 1000000; timeout.tv_usec = usec_timeout % 1000000; - upsdebugx(5, "nutscan_scan_xml_http_generic() : sent request to %s, " - "loop #%d/%d, waiting for responses", - (ip ? ip : ""), (i + 1), MAX_RETRIES); - while ((ret = select(peerSocket + 1, &fds, NULL, NULL, - &timeout)) - ) { - retNum ++; - upsdebugx(5, "nutscan_scan_xml_http_generic() : request to %s, " - "loop #%d/%d, response #%d", - (ip ? ip : ""), (i + 1), MAX_RETRIES, retNum); + while ((ret=select(peerSocket+1,&fds,NULL,NULL, + &timeout) )) { timeout.tv_sec = usec_timeout / 1000000; timeout.tv_usec = usec_timeout % 1000000; - if (ret == -1) { + if( ret == -1 ) { fprintf(stderr, "Error waiting on \ - socket: %d\n", errno); + socket: %d\n",errno); break; } sockAddressLength = sizeof(struct sockaddr_in); - recv_size = recvfrom(peerSocket, buf, - sizeof(buf), 0, - (struct sockaddr *)&sockAddress_udp, - &sockAddressLength); + recv_size = recvfrom(peerSocket,buf, + sizeof(buf),0, + (struct sockaddr *)&sockAddress, + &sockAddressLength); - if (recv_size < 0) { + if(recv_size==-1) { fprintf(stderr, "Error reading \ - socket: %d, #%d/%d\n", errno, (i + 1), MAX_RETRIES); - usleep(usec_timeout); + socket: %d\n",errno); continue; } - if (getnameinfo( - (struct sockaddr *)&sockAddress_udp, - sizeof(struct sockaddr_in), string, - sizeof(string), NULL, 0, - NI_NUMERICHOST) != 0 - ) { + if( getnameinfo( + (struct sockaddr *)&sockAddress, + sizeof(struct sockaddr_in),string, + sizeof(string),NULL,0, + NI_NUMERICHOST) != 0) { fprintf(stderr, - "Error converting IP address: %d\n", errno); - usleep(usec_timeout); + "Error converting IP address \ + : %d\n",errno); continue; } - nut_dev = nutscan_new_device(); - if (nut_dev == NULL) { - fprintf(stderr, "Memory allocation error\n"); - goto end_abort; - } + nut_dev = nutscan_new_device(); + if(nut_dev == NULL) { + fprintf(stderr,"Memory allocation \ + error\n"); + return NULL; + } -#ifdef HAVE_PTHREAD - pthread_mutex_lock(&dev_mutex); -#endif - upsdebugx(5, - "Some host at IP %s replied to NetXML UDP request on port %d, " - "inspecting the response...", - string, port_udp); - nut_dev->type = TYPE_XML; + nut_dev->type = TYPE_XML; /* Try to read device type */ ne_xml_parser *parser = (*nut_ne_xml_create)(); (*nut_ne_xml_push_handler)(parser, startelm_cb, NULL, NULL, nut_dev); - /* recv_size is a ssize_t, so in range of size_t */ - (*nut_ne_xml_parse)(parser, buf, (size_t)recv_size); - int parserFailed = (*nut_ne_xml_failed)(parser); /* 0 = ok, nonzero = fail */ + (*nut_ne_xml_parse)(parser, buf, recv_size); (*nut_ne_xml_destroy)(parser); - if (parserFailed == 0) { - nut_dev->driver = strdup("netxml-ups"); - sprintf(buf, "http://%s", string); - nut_dev->port = strdup(buf); - upsdebugx(3, - "nutscan_scan_xml_http_generic(): " - "Adding configuration for driver='%s' port='%s'", - nut_dev->driver, nut_dev->port); - dev_ret = nutscan_add_device_to_device( - dev_ret, nut_dev); -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&dev_mutex); -#endif - } - else - { - fprintf(stderr, - "Device at IP %s replied with NetXML but was not deemed compatible " - "with 'netxml-ups' driver (unsupported protocol version, etc.)\n", - string); - nutscan_free_device(nut_dev); - nut_dev = NULL; -#ifdef HAVE_PTHREAD - pthread_mutex_unlock(&dev_mutex); -#endif - if (ip == NULL) { - /* skip this device; note that for a - * broadcast scan there may be more - * in the loop's queue */ - continue; - } - } + nut_dev->driver = strdup("netxml-ups"); + sprintf(buf,"http://%s",string); + nut_dev->port = strdup(buf); + + current_nut_dev = nutscan_add_device_to_device( + current_nut_dev,nut_dev); - if (ip != NULL) { - upsdebugx(2, - "nutscan_scan_xml_http_generic(): we collected one reply " - "to unicast for %s (repsponse from %s), done", - ip, string); - goto end; - } - } /* while select() responses */ - if (ip == NULL && dev_ret != NULL) { - upsdebugx(2, - "nutscan_scan_xml_http_generic(): we collected one round of replies " - "to broadcast with no errors, done"); - goto end; } } } - upsdebugx(2, - "nutscan_scan_xml_http_generic(): no replies collected for %s, done", - (ip ? ip : "")); - goto end; + else + { + fprintf(stderr,"Error creating socket\n"); + } -end_abort: - upsdebugx(1, - "Had to abort nutscan_scan_xml_http_generic() for %s, see fatal details above", - (ip ? ip : "")); -end: - if (ip != NULL) /* do not free "ip", it comes from caller */ - close(peerSocket); - return NULL; + + return nutscan_rewind_device(current_nut_dev); } - -nutscan_device_t * nutscan_scan_xml_http_range(const char * start_ip, const char * end_ip, useconds_t usec_timeout, nutscan_xml_t * sec) -{ - bool_t pass = TRUE; /* Track that we may spawn a scanning thread */ - nutscan_xml_t * tmp_sec = NULL; - nutscan_device_t * result = NULL; - - if (!nutscan_avail_xml_http) { - return NULL; - } - - if (start_ip == NULL && end_ip != NULL) { - start_ip = end_ip; - } - - if (start_ip == NULL) { - upsdebugx(1, "Scanning XML/HTTP bus using broadcast."); - } else { - if ((start_ip == end_ip) || (end_ip == NULL) || (0 == strncmp(start_ip, end_ip, 128))) { - upsdebugx(1, "Scanning XML/HTTP bus for single IP (%s).", start_ip); - } else { - /* Iterate the range of IPs to scan */ - nutscan_ip_iter_t ip; - char * ip_str = NULL; -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - sem_t * semaphore = nutscan_semaphore(); - sem_t semaphore_scantype_inst; - sem_t * semaphore_scantype = &semaphore_scantype_inst; -# endif /* HAVE_SEMAPHORE */ - pthread_t thread; - nutscan_thread_t * thread_array = NULL; - size_t thread_count = 0, i; -# if (defined HAVE_PTHREAD_TRYJOIN) || (defined HAVE_SEMAPHORE) - size_t max_threads_scantype = max_threads_netxml; -# endif - - pthread_mutex_init(&dev_mutex, NULL); - -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) { - if (SIZE_MAX > UINT_MAX && max_threads_scantype > UINT_MAX) { - upsdebugx(1, - "WARNING: %s: Limiting max_threads_scantype to range acceptable for sem_init()", - __func__); - max_threads_scantype = UINT_MAX - 1; - } - sem_init(semaphore_scantype, 0, (unsigned int)max_threads_scantype); - } -# endif /* HAVE_SEMAPHORE */ - -#endif /* HAVE_PTHREAD */ - - ip_str = nutscan_ip_iter_init(&ip, start_ip, end_ip); - - while (ip_str != NULL) { -#ifdef HAVE_PTHREAD - /* NOTE: With many enough targets to scan, this can crash - * by spawning too many children; add a limit and loop to - * "reap" some already done with their work. And probably - * account them in thread_array[] as something to not wait - * for below in pthread_join()... - */ - -# ifdef HAVE_SEMAPHORE - /* Just wait for someone to free a semaphored slot, - * if none are available, and then/otherwise grab one - */ - if (thread_array == NULL) { - /* Starting point, or after a wait to complete - * all earlier runners */ - if (max_threads_scantype > 0) - sem_wait(semaphore_scantype); - sem_wait(semaphore); - pass = TRUE; - } else { - pass = ((max_threads_scantype == 0 || sem_trywait(semaphore_scantype) == 0) && - sem_trywait(semaphore) == 0); - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* A somewhat naive and brute-force solution for - * systems without a semaphore.h. This may suffer - * some off-by-one errors, using a few more threads - * than intended (if we race a bit at the wrong time, - * probably up to one per enabled scanner routine). - */ - - /* TOTHINK: Should there be a threadcount_mutex when - * we just read the value in if() and while() below? - * At worst we would overflow the limit a bit due to - * other protocol scanners... - */ - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - upsdebugx(2, "%s: already running %zu scanning threads " - "(launched overall: %zu), " - "waiting until some would finish", - __func__, curr_threads, thread_count); - while (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - for (i = 0; i < thread_count ; i++) { - int ret; - - if (!thread_array[i].active) continue; - - pthread_mutex_lock(&threadcount_mutex); - upsdebugx(3, "%s: Trying to join thread #%i...", __func__, i); - ret = pthread_tryjoin_np(thread_array[i].thread, NULL); - switch (ret) { - case ESRCH: /* No thread with the ID thread could be found - already "joined"? */ - upsdebugx(5, "%s: Was thread #%zu joined earlier?", __func__, i); - break; - case 0: /* thread exited */ - if (curr_threads > 0) { - curr_threads --; - upsdebugx(4, "%s: Joined a finished thread #%zu", __func__, i); - } else { - /* threadcount_mutex fault? */ - upsdebugx(0, "WARNING: %s: Accounting of thread count " - "says we are already at 0", __func__); - } - thread_array[i].active = FALSE; - break; - case EBUSY: /* actively running */ - upsdebugx(6, "%s: thread #%zu still busy (%i)", - __func__, i, ret); - break; - case EDEADLK: /* Errors with thread interactions... bail out? */ - case EINVAL: /* Errors with thread interactions... bail out? */ - default: /* new pthreads abilities? */ - upsdebugx(5, "%s: thread #%zu reported code %i", - __func__, i, ret); - break; - } - pthread_mutex_unlock(&threadcount_mutex); - } - - if (curr_threads >= max_threads - || (curr_threads >= max_threads_scantype && max_threads_scantype > 0) - ) { - usleep (10000); /* microSec's, so 0.01s here */ - } - } - upsdebugx(2, "%s: proceeding with scan", __func__); - } - /* NOTE: No change to default "pass" in this ifdef: - * if we got to this line, we have a slot to use */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - if (pass) { - tmp_sec = malloc(sizeof(nutscan_xml_t)); - if (tmp_sec == NULL) { - fprintf(stderr, - "Memory allocation error\n"); - return NULL; - } - memcpy(tmp_sec, sec, sizeof(nutscan_xml_t)); - tmp_sec->peername = ip_str; - if (tmp_sec->usec_timeout <= 0) { - tmp_sec->usec_timeout = usec_timeout; - } - -#ifdef HAVE_PTHREAD - if (pthread_create(&thread, NULL, nutscan_scan_xml_http_generic, (void *)tmp_sec) == 0) { -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - curr_threads++; -# endif /* HAVE_PTHREAD_TRYJOIN */ - - thread_count++; - nutscan_thread_t *new_thread_array = realloc(thread_array, - thread_count*sizeof(nutscan_thread_t)); - if (new_thread_array == NULL) { - upsdebugx(1, "%s: Failed to realloc thread array", __func__); - break; - } - else { - thread_array = new_thread_array; - } - thread_array[thread_count - 1].thread = thread; - thread_array[thread_count - 1].active = TRUE; - -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ - } -#else /* not HAVE_PTHREAD */ - nutscan_scan_xml_http_generic((void *)tmp_sec); -#endif /* if HAVE_PTHREAD */ - -/* free(ip_str); */ /* One of these free()s seems to cause a double-free instead */ - ip_str = nutscan_ip_iter_inc(&ip); -/* free(tmp_sec); */ - } else { /* if not pass -- all slots busy */ -#ifdef HAVE_PTHREAD -# ifdef HAVE_SEMAPHORE - /* Wait for all current scans to complete */ - if (thread_array != NULL) { - upsdebugx (2, "%s: Running too many scanning threads, " - "waiting until older ones would finish", - __func__); - for (i = 0; i < thread_count ; i++) { - int ret; - if (!thread_array[i].active) { - /* Probably should not get here, - * but handle it just in case */ - upsdebugx(0, "WARNING: %s: Midway clean-up: did not expect thread %zu to be not active", - __func__, i); - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - continue; - } - thread_array[i].active = FALSE; - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Midway clean-up: pthread_join() returned code %i", - __func__, ret); - } - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); - } - thread_count = 0; - free(thread_array); - thread_array = NULL; - } -# else -# ifdef HAVE_PTHREAD_TRYJOIN - /* TODO: Move the wait-loop for TRYJOIN here? */ -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - } /* if: could we "pass" or not? */ - } /* while */ - -#ifdef HAVE_PTHREAD - if (thread_array != NULL) { - upsdebugx(2, "%s: all planned scans launched, waiting for threads to complete", __func__); - for (i = 0; i < thread_count; i++) { - int ret; - - if (!thread_array[i].active) continue; - - ret = pthread_join(thread_array[i].thread, NULL); - if (ret != 0) { - upsdebugx(0, "WARNING: %s: Clean-up: pthread_join() returned code %i", - __func__, ret); - } - thread_array[i].active = FALSE; -# ifdef HAVE_SEMAPHORE - sem_post(semaphore); - if (max_threads_scantype > 0) - sem_post(semaphore_scantype); -# else -# ifdef HAVE_PTHREAD_TRYJOIN - pthread_mutex_lock(&threadcount_mutex); - if (curr_threads > 0) { - curr_threads --; - upsdebugx(5, "%s: Clean-up: Joined a finished thread #%zu", - __func__, i); - } else { - upsdebugx(0, "WARNING: %s: Clean-up: Accounting of thread count " - "says we are already at 0", __func__); - } - pthread_mutex_unlock(&threadcount_mutex); -# endif /* HAVE_PTHREAD_TRYJOIN */ -# endif /* HAVE_SEMAPHORE */ - } - free(thread_array); - upsdebugx(2, "%s: all threads freed", __func__); - } - pthread_mutex_destroy(&dev_mutex); - -# ifdef HAVE_SEMAPHORE - if (max_threads_scantype > 0) - sem_destroy(semaphore_scantype); -# endif /* HAVE_SEMAPHORE */ -#endif /* HAVE_PTHREAD */ - - result = nutscan_rewind_device(dev_ret); - dev_ret = NULL; - return result; - } - } - - tmp_sec = malloc(sizeof(nutscan_xml_t)); - if (tmp_sec == NULL) { - fprintf(stderr, - "Memory allocation error\n"); - return NULL; - } - - memcpy(tmp_sec, sec, sizeof(nutscan_xml_t)); - if (start_ip == NULL) { - tmp_sec->peername = NULL; - } else { - tmp_sec->peername = strdup(start_ip); - } - - if (tmp_sec->usec_timeout <= 0) { - tmp_sec->usec_timeout = usec_timeout; - } - - nutscan_scan_xml_http_generic(tmp_sec); - result = nutscan_rewind_device(dev_ret); - dev_ret = NULL; - free(tmp_sec); - return result; -} - #else /* WITH_NEON */ - -nutscan_device_t * nutscan_scan_xml_http_range(const char * start_ip, const char * end_ip, useconds_t usec_timeout, nutscan_xml_t * sec) +nutscan_device_t * nutscan_scan_xml_http(long usec_timeout) { - NUT_UNUSED_VARIABLE(start_ip); - NUT_UNUSED_VARIABLE(end_ip); - NUT_UNUSED_VARIABLE(usec_timeout); - NUT_UNUSED_VARIABLE(sec); return NULL; } - #endif /* WITH_NEON */ diff --git a/tools/nut-snmpinfo.py.in b/tools/nut-snmpinfo.py similarity index 66% rename from tools/nut-snmpinfo.py.in rename to tools/nut-snmpinfo.py index c76e9de..89cc359 100755 --- a/tools/nut-snmpinfo.py.in +++ b/tools/nut-snmpinfo.py @@ -1,7 +1,5 @@ -#!@PYTHON@ -# Copyright (C) 2011-2021 Eaton -# Authors: Frederic Bohe -# Arnaud Quette +#!/usr/bin/env python +# Copyright (C) 2011 - Frederic Bohe # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -17,22 +15,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# This program extracts all SNMP information related to NUT snmp-ups drivers. +# This program extracts all SNMP information related to NUT snmp-ups +# drivers. import glob import re -import sys -import os -TOP_SRCDIR = os.getenv('TOP_SRCDIR') -if TOP_SRCDIR is None: - TOP_SRCDIR=".." - -TOP_BUILDDIR = os.getenv('TOP_BUILDDIR') -if TOP_BUILDDIR is None: - TOP_BUILDDIR=".." - -output_file_name = TOP_BUILDDIR + "/tools/nut-scanner/nutscan-snmp.h" +output_file_name="./nut-scanner/nutscan-snmp.h" output_file = open(output_file_name,'w') #expand #define constant @@ -43,16 +32,7 @@ def expand_define(filename,constant): if constant in line and "#define" in line: line_without_carriage_return = re.sub("[\n\r]", "", line) line_with_single_blank = re.sub("[ \t]+", " ", line_without_carriage_return) - line_without_eol_comments = line_with_single_blank - # Note: per precedent in code, this assumes a single-line /* ... */ trailing comment - i = line_without_eol_comments.find('/*') - if i >= 0: - line_without_eol_comments = line_without_eol_comments[:i] - i = line_without_eol_comments.find('//') - if i >= 0: - line_without_eol_comments = line_without_eol_comments[:i] - line_without_eol_comments = line_without_eol_comments.strip() - define_line = line_without_eol_comments.split(" ") + define_line = line_with_single_blank.split(" "); #define_line[0] = "#define" #define_line[1] = const name #define_line[2...] = const value (may be other const name) @@ -64,14 +44,12 @@ def expand_define(filename,constant): clean_elem = re.sub("\"", "", elem) ret_line = ret_line + clean_elem else: - ret_line = ret_line + expand_define(filename,elem) + ret_line = ret_line + expand_define(filename,elem); return ret_line -output_file.write( "/* nutscan-snmp.h - fully generated during build of NUT\n" ) -output_file.write( " * Copyright (C) 2011-2019 EATON\n" ) -output_file.write( " * Authors: Frederic Bohe \n" ) -output_file.write( " * Arnaud Quette \n" ) +output_file.write( "/* nutscan-snmp\n" ) +output_file.write( " * Copyright (C) 2011 - Frederic Bohe \n" ) output_file.write( " *\n" ) output_file.write( " * This program is free software; you can redistribute it and/or modify\n" ) output_file.write( " * it under the terms of the GNU General Public License as published by\n" ) @@ -92,32 +70,25 @@ output_file.write( "#ifndef DEVSCAN_SNMP_H\n" ) output_file.write( "#define DEVSCAN_SNMP_H\n" ) output_file.write( "\n" ) output_file.write( "typedef struct {\n" ) -output_file.write( "\tchar *\toid;\n" ) -output_file.write( "\tchar *\tmib;\n" ) -output_file.write( "\tchar *\tsysoid;\n" ) +output_file.write( " char * oid;\n" ) +output_file.write( " char * mib;\n" ) +output_file.write( " char * sysoid;\n" ) output_file.write( "} snmp_device_id_t;\n" ) output_file.write( "\n" ) output_file.write( "/* SNMP IDs device table */\n" ) output_file.write( "static snmp_device_id_t snmp_device_table[] = {\n" ) -for filename in sorted(glob.glob(TOP_SRCDIR + '/drivers/*-mib.c')): +for filename in glob.glob('../drivers/*-mib.c'): list_of_line = open(filename,'r').read().split(';') for line in list_of_line: if "mib2nut_info_t" in line: - # Discard commented lines - # Note that we only search for the beginning of the comment, the - # end can be in the following line, due to the .split(';') - m = re.search(r'/\*.*', line) - if m: - #sys.stderr.write('discarding line'+line+'\n') - continue #clean up line line2 = re.sub("[\n\t\r}]", "", line) # split line line = line2.split("{",1) #line[1] is the part between {} line2 = line[1].split(",") - mib = line2[0].lstrip(" ") + mib = line2[0] #line2[3] is the OID of the device model name which #could be made of #define const and string. source_oid = line2[3] @@ -138,7 +109,7 @@ for filename in sorted(glob.glob(TOP_SRCDIR + '/drivers/*-mib.c')): clean_elem = re.sub("\"", "", elem) oid = oid+clean_elem else: - oid = oid + expand_define(filename,elem) + oid = oid + expand_define(filename,elem); #decode source_sysoid line = source_sysoid.lstrip(" ") @@ -151,22 +122,16 @@ for filename in sorted(glob.glob(TOP_SRCDIR + '/drivers/*-mib.c')): clean_elem = re.sub("\"", "", elem) sysoid = sysoid+clean_elem else: - sysoid = sysoid + expand_define(filename,elem) + sysoid = sysoid + expand_define(filename,elem); - # Sanity checks if sysoid == "": sysoid = "NULL" else: sysoid = "\"" + sysoid + "\"" - if oid == "": - oid = "NULL" - else: - oid = "\"" + oid + "\"" + output_file.write( "\t{ \"" + oid + "\" , " + mib + ", " + sysoid + "},\n" ) - output_file.write( "\t{ " + oid + ", " + mib + ", " + sysoid + " },\n" ) - -output_file.write( "\t/* Terminating entry */\n" ) -output_file.write( "\t{ NULL, NULL, NULL }\n" ) +output_file.write( " /* Terminating entry */\n" ) +output_file.write( " { NULL, NULL, NULL}\n" ) output_file.write( "};\n" ) output_file.write( "#endif /* DEVSCAN_SNMP_H */\n" ) diff --git a/tools/nut-usbinfo.pl b/tools/nut-usbinfo.pl index 9fd07a1..5e3592e 100755 --- a/tools/nut-usbinfo.pl +++ b/tools/nut-usbinfo.pl @@ -1,8 +1,8 @@ #!/usr/bin/env perl -# Current Version : 1.3 -# Copyright (C) 2008 - 2012 dloic (loic.dardant AT gmail DOT com) -# Copyright (C) 2008 - 2015 Arnaud Quette -# Copyright (C) 2013 - 2014 Charles Lepple +# Current Version : 1.2 +# Copyright (C) 2008 - 2012 +# Arnaud Quette +# dloic (loic.dardant AT gmail DOT com) # # Based on the usbdevice.pl script, made for the Ubuntu Media Center # for the final use of the LIRC project. @@ -28,34 +28,27 @@ use File::Find; use strict; - -my $TOP_SRCDIR = ".."; -if (defined $ENV{'TOP_SRCDIR'}) { - $TOP_SRCDIR = $ENV{'TOP_SRCDIR'}; -} - -my $TOP_BUILDDIR = ".."; -if (defined $ENV{'TOP_BUILDDIR'}) { - $TOP_BUILDDIR = $ENV{'TOP_BUILDDIR'}; -} - # path to scan for USB_DEVICE pattern -my $scanPath="$TOP_SRCDIR/drivers"; +my $scanPath="../drivers"; + +# HAL output file +my $outputHAL="../scripts/hal/ups-nut-device.fdi.in"; # Hotplug output file -my $outputHotplug="$TOP_BUILDDIR/scripts/hotplug/libhid.usermap"; +my $outputHotplug="../scripts/hotplug/libhid.usermap"; # udev output file -my $outputUdev="$TOP_BUILDDIR/scripts/udev/nut-usbups.rules.in"; - -# BSD devd output file -my $output_devd="$TOP_BUILDDIR/scripts/devd/nut-usb.conf.in"; +my $outputUdev="../scripts/udev/nut-usbups.rules.in"; # UPower output file -my $outputUPower="$TOP_BUILDDIR/scripts/upower/95-upower-hid.hwdb"; +my $outputUPower="../scripts/upower/95-upower-hid.rules"; +# tmp output, to allow generating the ENV{UPOWER_VENDOR} header list +my $tmpOutputUPower; +# mfr header flag +my $upowerMfrHeaderDone = 0; # NUT device scanner - C header -my $outputDevScanner = "$TOP_BUILDDIR/tools/nut-scanner/nutscan-usb.h"; +my $outputDevScanner = "./nut-scanner/nutscan-usb.h"; my $GPL_header = "\ * Copyright (C) 2011 - Arnaud Quette \ @@ -74,7 +67,7 @@ my $GPL_header = "\ * along with this program; if not, write to the Free Software\ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; -# array of products indexed by vendorID +# array of products indexed by vendorID my %vendor; # contain for each vendor, its name (and...) @@ -82,12 +75,19 @@ my %vendorName; ################# MAIN ################# -find({wanted=>\&find_usbdevs, preprocess=>sub{sort @_}}, $scanPath); +find(\&find_usbdevs,$scanPath); &gen_usb_files; ################# SUB METHOD ################# sub gen_usb_files { + # HAL file header + open my $outHAL, ">$outputHAL" || die "error $outputHAL : $!"; + print $outHAL ' '."\n"; + print $outHAL ''."\n"; + print $outHAL ' '."\n"; + print $outHAL ' '."\n"; + # Hotplug file header open my $outHotplug, ">$outputHotplug" || die "error $outputHotplug : $!"; print $outHotplug '# This file is generated and installed by the Network UPS Tools package.'."\n"; @@ -103,48 +103,27 @@ sub gen_usb_files # Udev file header open my $outUdev, ">$outputUdev" || die "error $outputUdev : $!"; print $outUdev '# This file is generated and installed by the Network UPS Tools package.'."\n\n"; - print $outUdev 'ACTION=="remove", GOTO="nut-usbups_rules_end"'."\n"; + print $outUdev 'ACTION!="add|change", GOTO="nut-usbups_rules_end"'."\n"; print $outUdev 'SUBSYSTEM=="usb_device", GOTO="nut-usbups_rules_real"'."\n"; print $outUdev 'SUBSYSTEM=="usb", GOTO="nut-usbups_rules_real"'."\n"; - print $outUdev 'GOTO="nut-usbups_rules_end"'."\n\n"; + print $outUdev 'SUBSYSTEM!="usb", GOTO="nut-usbups_rules_end"'."\n\n"; print $outUdev 'LABEL="nut-usbups_rules_real"'."\n"; - open my $out_devd, ">$output_devd" || die "error $output_devd : $!"; - print $out_devd '# This file is generated and installed by the Network UPS Tools package.'."\n"; - print $out_devd "# Homepage: http://www.networkupstools.org/\n\n"; - # UPower file header open my $outputUPower, ">$outputUPower" || die "error $outputUPower : $!"; print $outputUPower '##############################################################################################################'."\n"; print $outputUPower '# Uninterruptible Power Supplies with USB HID interfaces'."\n#\n"; - print $outputUPower '# This file was automatically generated by NUT:'."\n"; - print $outputUPower '# https://github.com/networkupstools/nut/'."\n#\n"; - print $outputUPower '# To keep up to date, monitor upstream NUT'."\n"; - print $outputUPower '# https://github.com/networkupstools/nut/commits/master/scripts/upower/95-upower-hid.hwdb'."\n"; - print $outputUPower "# or checkout the NUT repository and call 'tools/nut-usbinfo.pl'\n"; + print $outputUPower '# to keep up to date, monitor: http://svn.debian.org/wsvn/nut/trunk/scripts/upower/95-upower-hid.rules'."\n\n"; + print $outputUPower '# only support USB, else ignore'."\n".'SUBSYSTEM!="usb", GOTO="up_hid_end"'."\n\n"; + print $outputUPower '# if usbraw device, ignore'."\n".'KERNEL!="hiddev*", GOTO="up_hid_end"'."\n\n"; + print $outputUPower '# if an interface, ignore'."\n".'ENV{DEVTYPE}=="usb_interface", GOTO="up_hid_end"'."\n\n"; # Device scanner header open my $outputDevScanner, ">$outputDevScanner" || die "error $outputDevScanner : $!"; print $outputDevScanner '/* nutscan-usb'.$GPL_header."\n */\n\n"; print $outputDevScanner "#ifndef DEVSCAN_USB_H\n#define DEVSCAN_USB_H\n\n"; - print $outputDevScanner "#include \"nut_stdint.h\"\t/* for uint16_t etc. */\n\n"; - print $outputDevScanner "#include \t/* for PATH_MAX in usb.h etc. */\n\n"; - print $outputDevScanner "#include \t/* for MAXPATHLEN etc. */\n\n"; - print $outputDevScanner "/* libusb header file */\n"; - print $outputDevScanner "#if (!WITH_LIBUSB_1_0) && (!WITH_LIBUSB_0_1)\n"; - print $outputDevScanner "#error \"configure script error: Neither WITH_LIBUSB_1_0 nor WITH_LIBUSB_0_1 is set\"\n"; - print $outputDevScanner "#endif\n\n"; - print $outputDevScanner "#if (WITH_LIBUSB_1_0) && (WITH_LIBUSB_0_1)\n"; - print $outputDevScanner "#error \"configure script error: Both WITH_LIBUSB_1_0 and WITH_LIBUSB_0_1 are set\"\n"; - print $outputDevScanner "#endif\n\n"; - print $outputDevScanner "#if WITH_LIBUSB_1_0\n"; - print $outputDevScanner " #include \n"; - print $outputDevScanner "#endif\n"; - print $outputDevScanner "#if WITH_LIBUSB_0_1\n"; - print $outputDevScanner " #include \n"; - print $outputDevScanner " /* simple remap to avoid bloating structures */\n"; - print $outputDevScanner " typedef usb_dev_handle libusb_device_handle;\n"; - print $outputDevScanner "#endif\n"; + print $outputDevScanner "#include \n"; + print $outputDevScanner "#include \"nut_stdint.h\"\t/* for uint16_t */\n\n"; # vid, pid, driver print $outputDevScanner "typedef struct {\n\tuint16_t\tvendorID;\n\tuint16_t\tproductID;\n\tchar*\tdriver_name;\n} usb_device_id_t;\n\n"; print $outputDevScanner "/* USB IDs device table */\nstatic usb_device_id_t usb_device_table[] = {\n\n"; @@ -152,6 +131,12 @@ sub gen_usb_files # generate the file in alphabetical order (first for VendorID, then for ProductID) foreach my $vendorId (sort { lc $a cmp lc $b } keys %vendorName) { + # HAL vendor header + if ($vendorName{$vendorId}) { + print $outHAL "\n \n"; + } + print $outHAL " \n"; + # Hotplug vendor header if ($vendorName{$vendorId}) { print $outHotplug "\n# ".$vendorName{$vendorId}."\n"; @@ -162,17 +147,20 @@ sub gen_usb_files print $outUdev "\n# ".$vendorName{$vendorId}."\n"; } - # devd vendor header - if ($vendorName{$vendorId}) { - print $out_devd "\n# ".$vendorName{$vendorId}."\n"; - } - - # UPower vendor header flag - my $upowerVendorHasDevices = 0; + $upowerMfrHeaderDone = 0; foreach my $productId (sort { lc $a cmp lc $b } keys %{$vendor{$vendorId}}) { + # HAL device entry + print $outHAL " \n"; + print $outHAL " \n"; + print $outHAL ' battery'."\n"; + print $outHAL ' battery'."\n"; + print $outHAL " hald-addon-".$vendor{$vendorId}{$productId}{"driver"}."\n"; + print $outHAL ' ups'."\n"; + print $outHAL ' '."\n"; + # Hotplug device entry print $outHotplug "# ".$vendor{$vendorId}{$productId}{"comment"}."\n"; print $outHotplug "libhidups 0x0003 ".$vendorId." ".$productId." 0x0000 0x0000 0x00"; @@ -183,57 +171,56 @@ sub gen_usb_files print $outUdev "ATTR{idVendor}==\"".removeHexPrefix($vendorId); print $outUdev "\", ATTR{idProduct}==\"".removeHexPrefix($productId)."\","; print $outUdev ' MODE="664", GROUP="@RUN_AS_GROUP@"'."\n"; - - # devd device entry - print $out_devd "# ".$vendor{$vendorId}{$productId}{"comment"}.' - '.$vendor{$vendorId}{$productId}{"driver"}."\n"; - print $out_devd "notify 100 {\n\tmatch \"system\"\t\t\"USB\";\n"; - print $out_devd "\tmatch \"subsystem\"\t\"DEVICE\";\n"; - print $out_devd "\tmatch \"type\"\t\t\"ATTACH\";\n"; - print $out_devd "\tmatch \"vendor\"\t\t\"$vendorId\";\n"; - # - print $out_devd "\tmatch \"product\"\t\t\"$productId\";\n"; - print $out_devd "\taction \"chgrp \@RUN_AS_GROUP\@ /dev/\$cdev; chmod g+rw /dev/\$cdev\";\n"; - print $out_devd "};\n"; - + # UPower device entry (only for USB/HID devices!) if ($vendor{$vendorId}{$productId}{"driver"} eq "usbhid-ups") { - if (!$upowerVendorHasDevices) { + if ($upowerMfrHeaderDone == 0) + { + # UPower vendor header if ($vendorName{$vendorId}) { - print $outputUPower "\n# ".$vendorName{$vendorId}."\n"; + $tmpOutputUPower = $tmpOutputUPower."\n# ".$vendorName{$vendorId}."\n"; } - $upowerVendorHasDevices = 1; + print $outputUPower "ATTRS{idVendor}==\"".removeHexPrefix($vendorId)."\", ENV{UPOWER_VENDOR}=\"".$vendorName{$vendorId}."\"\n"; + $upowerMfrHeaderDone = 1; } - print $outputUPower "usb:v".uc(removeHexPrefix($vendorId))."p".uc(removeHexPrefix($productId))."*\n"; + $tmpOutputUPower = $tmpOutputUPower."ATTRS{idVendor}==\"".removeHexPrefix($vendorId); + $tmpOutputUPower = $tmpOutputUPower."\", ATTRS{idProduct}==\"".removeHexPrefix($productId)."\","; + $tmpOutputUPower = $tmpOutputUPower.' ENV{UPOWER_BATTERY_TYPE}="ups"'."\n"; } # Device scanner entry print $outputDevScanner "\t{ ".$vendorId.', '.$productId.", \"".$vendor{$vendorId}{$productId}{"driver"}."\" },\n"; } - - if ($upowerVendorHasDevices) { - print $outputUPower " UPOWER_BATTERY_TYPE=ups\n"; - if ($vendorName{$vendorId}) { - print $outputUPower " UPOWER_VENDOR=".$vendorName{$vendorId}."\n"; - } - } - + # HAL vendor footer + print $outHAL " \n"; } + # HAL footer + print $outHAL " \n"; + print $outHAL " \n"; + print $outHAL "\n"; + # Udev footer print $outUdev "\n".'LABEL="nut-usbups_rules_end"'."\n"; + # UPower... + # ...flush device table + print $outputUPower $tmpOutputUPower; + # ...and print footer + print $outputUPower "\n".'LABEL="up_hid_end"'."\n"; + # Device scanner footer - print $outputDevScanner "\n\t/* Terminating entry */\n\t{ 0, 0, NULL }\n};\n#endif /* DEVSCAN_USB_H */\n\n"; + print $outputDevScanner "\t/* Terminating entry */\n\t{ -1, -1, NULL }\n};\n#endif /* DEVSCAN_USB_H */\n\n"; } sub find_usbdevs { # maybe there's an option to turn off all .* files, but anyway this is stupid - return $File::Find::prune = 1 if ($_ eq '.svn') || ($_ =~ /^\.#/) || ($_ =~ /\.orig$/); + return $File::Find::prune = 1 if ($_ eq '.svn') || ($_ =~ /^\.#/); my $nameFile=$_; my $lastComment=""; - + open my $file,$nameFile or die "error open file $nameFile"; while(my $line=<$file>) { @@ -243,7 +230,7 @@ sub find_usbdevs $lastComment=$1; } - if($line =~/^\s*\{\s*USB_DEVICE\(([^)]+)\,([^)]+)\)\s*/) # for example : { USB_DEVICE(MGE_VENDORID, 0x0001)... } + if($line =~/^\s*\{\s*USB_DEVICE\((.+)\,(.+)\)\s*/) # for example : { USB_DEVICE(MGE_VENDORID, 0x0001)... } { my $VendorID=trim($1); my $ProductID=trim($2); @@ -260,7 +247,7 @@ sub find_usbdevs { # catch Vendor Name if($data =~/\s*\/\*(.+)\*\/\s*$/) - { + { $VendorName=$1; } # catch VendorID @@ -285,8 +272,8 @@ sub find_usbdevs } } - # store data (to be optimized) - # and don't overwrite actual vendor names with empty values + # store date (to be optimized) + # and don't overwritte actual vendor names with empty values if( (!$vendorName{$VendorID}) or (($vendorName{$VendorID} eq "") and ($VendorName ne "")) ) { $vendorName{$VendorID}=trim($VendorName); @@ -297,19 +284,28 @@ sub find_usbdevs if($nameFile=~/(.+)-hid\.c/) { $driver="usbhid-ups"; } - # generic matching rule *.c => * - elsif ($nameFile =~ /(.+)\.c$/) { - $driver=$1; + # FIXME: make a generic matching rule *.c => * + elsif ($nameFile eq "bcmxcp_usb.c") { + $driver="bcmxcp_usb"; + } + elsif ($nameFile eq "tripplite_usb.c") { + $driver="tripplite_usb"; + } + elsif ($nameFile eq "blazer_usb.c") { + $driver="blazer_usb"; + } + elsif ($nameFile eq "richcomm_usb.c") { + $driver="richcomm_usb"; + } + elsif ($nameFile eq "riello_usb.c") { + $driver="riello_usb"; + } + elsif ($nameFile eq "nutdrv_qx.c") { + $driver="nutdrv_qx"; } else { die "Unknown driver type: $nameFile"; } - if ($vendor{$VendorID}{$ProductID}{"driver"} && $ENV{"DEBUG"}) { - print STDERR "nut-usbinfo.pl: VendorID=$VendorID ProductID=$ProductID " . - "was already related to driver '" . - $vendor{$VendorID}{$ProductID}{"driver"} . - "' and changing to '$driver'\n"; - } $vendor{$VendorID}{$ProductID}{"driver"}=$driver; } }